Skip to content

Commit abf1654

Browse files
committed
Update SDK Documentation
1 parent 7d52ec4 commit abf1654

4 files changed

Lines changed: 187 additions & 5 deletions

File tree

src/reference/sdks/frontend/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ Utilities to interact with frontend-plugin storage.
194194
195195
Utilities to create UI components.
196196

197+
##### websocket
198+
199+
> **websocket**: [`WebsocketSDK`](websockets.md#websocketsdk)
200+
201+
Utilities to interact with the Websocket page.
202+
197203
##### window
198204

199205
> **window**: [`WindowSDK`](window.md#windowsdk)

src/reference/sdks/frontend/match-and-replace.md

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,36 @@ An operation to update the response status code.
496496
497497
***
498498

499+
### MatchReplaceOperationWebsocket
500+
501+
> **MatchReplaceOperationWebsocket** = [`KeepOperation`](other.md#keepoperation)\<[`MatchReplaceOperationWebsocketRaw`](#matchreplaceoperationwebsocketraw)\>
502+
503+
An operation for the response websocket section.
504+
505+
***
506+
507+
### MatchReplaceOperationWebsocketRaw
508+
509+
> **MatchReplaceOperationWebsocketRaw** = `object`
510+
511+
A raw operation for the response websocket section.
512+
513+
#### Properties
514+
515+
##### kind
516+
517+
> **kind**: `"OperationWebsocketRaw"`
518+
519+
##### matcher
520+
521+
> **matcher**: [`MatchReplaceMatcherRaw`](#matchreplacematcherraw)
522+
523+
##### replacer
524+
525+
> **replacer**: [`MatchReplaceReplacer`](#matchreplacereplacer)
526+
527+
***
528+
499529
### MatchReplacePageContext
500530

501531
> **MatchReplacePageContext** = `object`
@@ -712,10 +742,10 @@ Create a rule.
712742

713743
| Parameter | Type | Description |
714744
| ------ | ------ | ------ |
715-
| `options` | \{ `collectionId`: [`ID`](utils.md#id); `name`: `string`; `query`: [`HTTPQL`](utils.md#httpql); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The options for the rule. |
745+
| `options` | \{ `collectionId`: [`ID`](utils.md#id); `name`: `string`; `query`: [`QueryInput`](utils.md#queryinput); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The options for the rule. |
716746
| `options.collectionId` | [`ID`](utils.md#id) | The ID of the collection the rule belongs to. |
717747
| `options.name` | `string` | The name of the rule. |
718-
| `options.query` | [`HTTPQL`](utils.md#httpql) | The HTTPQL query to match the rule against. |
748+
| `options.query` | [`QueryInput`](utils.md#queryinput) | The query to match the rule against. |
719749
| `options.section` | [`MatchReplaceSection`](#matchreplacesection) | - |
720750
| `options.sources` | [`Source`](#source)[] | The sources the rule belongs to. |
721751

@@ -893,9 +923,9 @@ Update a rule.
893923
| Parameter | Type | Description |
894924
| ------ | ------ | ------ |
895925
| `id` | [`ID`](utils.md#id) | The ID of the rule. |
896-
| `options` | \{ `name`: `string`; `query?`: [`HTTPQL`](utils.md#httpql); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The new values for the rule. |
926+
| `options` | \{ `name`: `string`; `query?`: [`QueryInput`](utils.md#queryinput); `section`: [`MatchReplaceSection`](#matchreplacesection); `sources`: [`Source`](#source)[]; \} | The new values for the rule. |
897927
| `options.name` | `string` | The new name of the rule. |
898-
| `options.query?` | [`HTTPQL`](utils.md#httpql) | The new HTTPQL query of the rule. |
928+
| `options.query?` | [`QueryInput`](utils.md#queryinput) | The new query of the rule. |
899929
| `options.section` | [`MatchReplaceSection`](#matchreplacesection) | The new section of the rule. |
900930
| `options.sources` | [`Source`](#source)[] | The new sources of the rule. |
901931

@@ -907,7 +937,7 @@ Update a rule.
907937

908938
### MatchReplaceSection
909939

910-
> **MatchReplaceSection** = [`MatchReplaceSectionRequestAll`](#matchreplacesectionrequestall) \| [`MatchReplaceSectionRequestBody`](#matchreplacesectionrequestbody) \| [`MatchReplaceSectionRequestFirstLine`](#matchreplacesectionrequestfirstline) \| [`MatchReplaceSectionRequestHeader`](#matchreplacesectionrequestheader) \| [`MatchReplaceSectionRequestMethod`](#matchreplacesectionrequestmethod) \| [`MatchReplaceSectionRequestPath`](#matchreplacesectionrequestpath) \| [`MatchReplaceSectionRequestQuery`](#matchreplacesectionrequestquery) \| [`MatchReplaceSectionRequestSNI`](#matchreplacesectionrequestsni) \| [`MatchReplaceSectionResponseAll`](#matchreplacesectionresponseall) \| [`MatchReplaceSectionResponseBody`](#matchreplacesectionresponsebody) \| [`MatchReplaceSectionResponseFirstLine`](#matchreplacesectionresponsefirstline) \| [`MatchReplaceSectionResponseHeader`](#matchreplacesectionresponseheader) \| [`MatchReplaceSectionResponseStatusCode`](#matchreplacesectionresponsestatuscode)
940+
> **MatchReplaceSection** = [`MatchReplaceSectionRequestAll`](#matchreplacesectionrequestall) \| [`MatchReplaceSectionRequestBody`](#matchreplacesectionrequestbody) \| [`MatchReplaceSectionRequestFirstLine`](#matchreplacesectionrequestfirstline) \| [`MatchReplaceSectionRequestHeader`](#matchreplacesectionrequestheader) \| [`MatchReplaceSectionRequestMethod`](#matchreplacesectionrequestmethod) \| [`MatchReplaceSectionRequestPath`](#matchreplacesectionrequestpath) \| [`MatchReplaceSectionRequestQuery`](#matchreplacesectionrequestquery) \| [`MatchReplaceSectionRequestSNI`](#matchreplacesectionrequestsni) \| [`MatchReplaceSectionResponseAll`](#matchreplacesectionresponseall) \| [`MatchReplaceSectionResponseBody`](#matchreplacesectionresponsebody) \| [`MatchReplaceSectionResponseFirstLine`](#matchreplacesectionresponsefirstline) \| [`MatchReplaceSectionResponseHeader`](#matchreplacesectionresponseheader) \| [`MatchReplaceSectionResponseStatusCode`](#matchreplacesectionresponsestatuscode) \| [`MatchReplaceSectionResponseWebsocket`](#matchreplacesectionresponsewebsocket) \| [`MatchReplaceSectionRequestWebsocket`](#matchreplacesectionrequestwebsocket)
911941

912942
A discriminated union of all possible match and replace sections.
913943

@@ -1057,6 +1087,24 @@ A section for the request SNI.
10571087
10581088
***
10591089

1090+
### MatchReplaceSectionRequestWebsocket
1091+
1092+
> **MatchReplaceSectionRequestWebsocket** = `object`
1093+
1094+
A section for the request websocket.
1095+
1096+
#### Properties
1097+
1098+
##### kind
1099+
1100+
> **kind**: `"SectionRequestWebsocket"`
1101+
1102+
##### operation
1103+
1104+
> **operation**: [`MatchReplaceOperationWebsocket`](#matchreplaceoperationwebsocket)
1105+
1106+
***
1107+
10601108
### MatchReplaceSectionResponseAll
10611109

10621110
> **MatchReplaceSectionResponseAll** = `object`
@@ -1147,6 +1195,24 @@ A section for the response status code.
11471195
11481196
***
11491197

1198+
### MatchReplaceSectionResponseWebsocket
1199+
1200+
> **MatchReplaceSectionResponseWebsocket** = `object`
1201+
1202+
A section for the response websocket.
1203+
1204+
#### Properties
1205+
1206+
##### kind
1207+
1208+
> **kind**: `"SectionResponseWebsocket"`
1209+
1210+
##### operation
1211+
1212+
> **operation**: [`MatchReplaceOperationWebsocket`](#matchreplaceoperationwebsocket)
1213+
1214+
***
1215+
11501216
### MatchReplaceSlotContent
11511217

11521218
> **MatchReplaceSlotContent** = `object`

src/reference/sdks/frontend/utils.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,24 @@ Utility type for converting endpoint return types to promises.
181181

182182
***
183183

184+
### QueryInput
185+
186+
> **QueryInput** = [`HTTPQL`](#httpql) \| [`StreamQL`](#streamql)
187+
188+
A query input.
189+
190+
#### Examples
191+
192+
```ts
193+
`"req.method.eq:'POST'"`
194+
```
195+
196+
```ts
197+
`"ws.raw.cont:'hello'"`
198+
```
199+
200+
***
201+
184202
### Selection
185203

186204
> **Selection**\<`TId`\> = \{ `kind`: `"Empty"`; \} \| \{ `kind`: `"Selected"`; `main`: `TId`; `secondary`: `TId`[]; \}
@@ -193,3 +211,23 @@ Main represents the primary selected item, secondary represents additional selec
193211
| Type Parameter |
194212
| ------ |
195213
| `TId` |
214+
215+
***
216+
217+
### StreamQL
218+
219+
> **StreamQL** = `string` & `object`
220+
221+
A STREAMQL expression.
222+
223+
#### Type Declaration
224+
225+
##### \_\_streamql?
226+
227+
> `optional` **\_\_streamql**: `never`
228+
229+
#### Example
230+
231+
```ts
232+
`ws.raw.cont:"hello"`
233+
```

src/reference/sdks/frontend/websockets.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
# Websockets
22

3+
### MessageViewModeOptions
4+
5+
> **MessageViewModeOptions** = `object`
6+
7+
Options for defining a custom message view mode.
8+
9+
#### Properties
10+
11+
##### label
12+
13+
> **label**: `string`
14+
15+
The label of the view mode.
16+
17+
##### view
18+
19+
> **view**: [`ComponentDefinition`](utils.md#componentdefinition)
20+
21+
The component to render when the view mode is selected.
22+
23+
##### when()?
24+
25+
> `optional` **when**: (`message`: [`StreamWsMessageMeta`](#streamwsmessagemeta)) => `boolean`
26+
27+
A function that determines if the view mode should be shown for a given message.
28+
29+
###### Parameters
30+
31+
| Parameter | Type |
32+
| ------ | ------ |
33+
| `message` | [`StreamWsMessageMeta`](#streamwsmessagemeta) |
34+
35+
###### Returns
36+
37+
`boolean`
38+
39+
***
40+
41+
### StreamWsMessageMeta
42+
43+
> **StreamWsMessageMeta** = [`Prettify`](utils.md#prettify)\<[`As`](utils.md#as)\<`"StreamWsMessageMeta"`\> & `object`\>
44+
45+
A complete message with all metadata and raw content.
46+
47+
***
48+
349
### WebsocketPageContext
450

551
> **WebsocketPageContext** = `object`
@@ -11,3 +57,29 @@ Certificate page context.
1157
##### kind
1258

1359
> **kind**: `"Websocket"`
60+
61+
***
62+
63+
### WebsocketSDK
64+
65+
> **WebsocketSDK** = `object`
66+
67+
Utilities to interact with websockets
68+
69+
#### Properties
70+
71+
##### addMessageViewMode()
72+
73+
> **addMessageViewMode**: (`options`: [`MessageViewModeOptions`](#messageviewmodeoptions)) => `void`
74+
75+
Add a custom message view mode.
76+
77+
###### Parameters
78+
79+
| Parameter | Type | Description |
80+
| ------ | ------ | ------ |
81+
| `options` | [`MessageViewModeOptions`](#messageviewmodeoptions) | The view mode options. |
82+
83+
###### Returns
84+
85+
`void`

0 commit comments

Comments
 (0)