@livon/client 0.27.0-rc.5 → 0.28.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -5
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/dist/client.cjs +89 -184
- package/dist/client.d.ts +3 -3
- package/dist/client.js +60 -147
- package/dist/generate.cjs +160 -303
- package/dist/generate.d.ts +2 -2
- package/dist/generate.js +117 -251
- package/dist/index.cjs +29 -51
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -10
- package/dist/typeScriptSurfaceTemplate.cjs +31 -54
- package/dist/typeScriptSurfaceTemplate.js +0 -13
- package/package.json +21 -33
- package/dist/mini/client.cjs +0 -1
- package/dist/mini/client.d.ts +0 -100
- package/dist/mini/client.js +0 -1
- package/dist/mini/generate.cjs +0 -6
- package/dist/mini/generate.d.ts +0 -37
- package/dist/mini/generate.js +0 -6
- package/dist/mini/index.cjs +0 -1
- package/dist/mini/index.d.ts +0 -7
- package/dist/mini/index.js +0 -1
- package/dist/mini/typeScriptSurfaceTemplate.cjs +0 -1
- package/dist/mini/typeScriptSurfaceTemplate.d.ts +0 -35
- package/dist/mini/typeScriptSurfaceTemplate.js +0 -1
- /package/{LICENCE.md → LICENSE.md} +0 -0
package/README.md
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
<!-- Generated from website/docs/packages/*.md. Do not edit directly. -->
|
|
2
|
+
|
|
1
3
|
# @livon/client
|
|
2
4
|
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@livon/client)
|
|
7
|
+
[](https://libraries.io/npm/%40livon%2Fclient)
|
|
8
|
+
[](https://github.com/live-input-vector-output-node/livon-ts/actions/workflows/code-quality.yml)
|
|
9
|
+
[](https://www.npmjs.com/package/@livon/client)
|
|
10
|
+
[](https://github.com/live-input-vector-output-node/livon-ts)
|
|
11
|
+
|
|
3
12
|
## Purpose
|
|
4
13
|
|
|
5
|
-
[@livon/client](https://
|
|
14
|
+
[@livon/client](https://livon.tech/docs/packages/client) provides deterministic client interface execution and generated-client foundations.
|
|
15
|
+
|
|
16
|
+
## Best for
|
|
17
|
+
|
|
18
|
+
Use this package when frontend apps consume generated LIVON APIs and typed subscription handlers.
|
|
6
19
|
|
|
7
20
|
Exports include:
|
|
8
21
|
|
|
@@ -10,6 +23,28 @@ Exports include:
|
|
|
10
23
|
- `createClientModule`
|
|
11
24
|
- `clientModule`
|
|
12
25
|
|
|
26
|
+
## Generator sync policy
|
|
27
|
+
|
|
28
|
+
Generated client surfaces and hover docs are built from the client generator.
|
|
29
|
+
When generator output changes, docs must be updated in sync.
|
|
30
|
+
|
|
31
|
+
- Rule source: `packages/client/PROMPT.md`
|
|
32
|
+
- JSDoc reference: [SchemaDoc & Generated JSDoc](https://livon.tech/docs/core/schema-doc-and-generated-jsdoc)
|
|
33
|
+
|
|
34
|
+
Current generated typing behavior to keep in sync:
|
|
35
|
+
|
|
36
|
+
- `and(...)` schema nodes are emitted as TypeScript intersections (`Left & Right`).
|
|
37
|
+
- If schema composition passes an explicit `name`, that name is used as the generated type name.
|
|
38
|
+
|
|
39
|
+
### Central TypeScript surface template
|
|
40
|
+
|
|
41
|
+
Generated interface and signature syntax is centralized in:
|
|
42
|
+
|
|
43
|
+
- `packages/client/src/typeScriptSurfaceTemplate.ts`
|
|
44
|
+
|
|
45
|
+
Use this file when TypeScript surface style should change globally (for example interface member syntax, callable signatures, or method/property signature formatting).
|
|
46
|
+
This avoids editing many render call sites in `packages/client/src/generate.ts`.
|
|
47
|
+
|
|
13
48
|
## Install
|
|
14
49
|
|
|
15
50
|
```sh
|
|
@@ -103,7 +138,8 @@ runtime(transport, module);
|
|
|
103
138
|
|
|
104
139
|
## Related pages
|
|
105
140
|
|
|
106
|
-
- [@livon/runtime](https://
|
|
107
|
-
- [@livon/client-ws-transport](https://
|
|
108
|
-
- [@livon/schema](https://
|
|
109
|
-
- [
|
|
141
|
+
- [@livon/runtime](https://livon.tech/docs/packages/runtime)
|
|
142
|
+
- [@livon/client-ws-transport](https://livon.tech/docs/packages/client-ws-transport)
|
|
143
|
+
- [@livon/schema](https://livon.tech/docs/packages/schema)
|
|
144
|
+
- [SchemaDoc & Generated JSDoc](https://livon.tech/docs/core/schema-doc-and-generated-jsdoc)
|
|
145
|
+
- [Schema APIs](https://livon.tech/docs/schema)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
No third-party notices are required for this package at this time.
|
package/dist/client.cjs
CHANGED
|
@@ -1,85 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
-
return typeof document === 'undefined'
|
|
4
|
-
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
-
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
-
new URL('main.js', document.baseURI).href;
|
|
7
|
-
})();
|
|
8
|
-
;
|
|
9
|
-
// The require scope
|
|
10
2
|
var __webpack_require__ = {};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
21
10
|
})();
|
|
22
|
-
|
|
23
|
-
(
|
|
24
|
-
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
25
13
|
})();
|
|
26
|
-
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
35
23
|
})();
|
|
36
24
|
var __webpack_exports__ = {};
|
|
37
25
|
__webpack_require__.r(__webpack_exports__);
|
|
38
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
clientModule: ()=>clientModule,
|
|
28
|
+
createClient: ()=>createClient,
|
|
29
|
+
createClientModule: ()=>createClientModule
|
|
42
30
|
});
|
|
43
31
|
const DEFAULT_REQUEST_KEY = 'livon.client.request';
|
|
44
32
|
const setClientRequest = ({ client, registry, requestKey })=>{
|
|
45
|
-
if (
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
33
|
+
if ('object' != typeof client || null === client || !('setRequest' in client)) return;
|
|
48
34
|
const candidate = client;
|
|
49
|
-
if (typeof candidate.setRequest
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
35
|
+
if ('function' != typeof candidate.setRequest) return;
|
|
52
36
|
candidate.setRequest((event, payload)=>{
|
|
53
37
|
const request = registry.state.get(requestKey);
|
|
54
|
-
if (!request)
|
|
55
|
-
throw new Error('Client request handler is not available.');
|
|
56
|
-
}
|
|
38
|
+
if (!request) throw new Error('Client request handler is not available.');
|
|
57
39
|
return request(event, payload);
|
|
58
40
|
});
|
|
59
41
|
};
|
|
60
42
|
const buildClientEventEnvelope = (envelope)=>{
|
|
61
|
-
if ('payload' in envelope) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
}
|
|
43
|
+
if ('payload' in envelope) return {
|
|
44
|
+
...envelope,
|
|
45
|
+
payload: envelope.payload
|
|
46
|
+
};
|
|
67
47
|
return {
|
|
68
48
|
...envelope,
|
|
69
49
|
error: envelope.error
|
|
70
50
|
};
|
|
71
51
|
};
|
|
72
|
-
|
|
73
|
-
* clientModule is part of the public LIVON API.
|
|
74
|
-
*
|
|
75
|
-
* @remarks
|
|
76
|
-
* Parameter and return types are defined in the TypeScript signature.
|
|
77
|
-
*
|
|
78
|
-
* @see https://live-input-vector-output-node.github.io/livon-ts/docs/packages/client
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* const result = clientModule(undefined as never);
|
|
82
|
-
*/ const clientModule = (client, options = {})=>{
|
|
52
|
+
const clientModule = (client, options = {})=>{
|
|
83
53
|
const register = (registry)=>{
|
|
84
54
|
const requestKey = options.requestKey ?? DEFAULT_REQUEST_KEY;
|
|
85
55
|
setClientRequest({
|
|
@@ -97,9 +67,9 @@ const buildClientEventEnvelope = (envelope)=>{
|
|
|
97
67
|
register
|
|
98
68
|
};
|
|
99
69
|
};
|
|
100
|
-
const isRecord = (value)=>
|
|
70
|
+
const isRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
|
|
101
71
|
const isArray = (value)=>Array.isArray(value);
|
|
102
|
-
const capitalize = (value)=>value.length
|
|
72
|
+
const capitalize = (value)=>0 === value.length ? value : value.slice(0, 1).toUpperCase() + value.slice(1);
|
|
103
73
|
const camelCaseName = (value)=>{
|
|
104
74
|
if (!value) return value;
|
|
105
75
|
return value.replace(/[^a-zA-Z0-9]+(.)/g, (_, group)=>String(group).toUpperCase()).replace(/^./, (char)=>char.toLowerCase());
|
|
@@ -113,9 +83,7 @@ const walkAst = (node, visit)=>{
|
|
|
113
83
|
const collectOperations = (root)=>{
|
|
114
84
|
const operations = [];
|
|
115
85
|
walkAst(root, (node)=>{
|
|
116
|
-
if (node.type
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
86
|
+
if ('operation' !== node.type || !node.name) return;
|
|
119
87
|
const input = node.children?.[0];
|
|
120
88
|
const output = node.children?.[1];
|
|
121
89
|
operations.push({
|
|
@@ -130,22 +98,16 @@ const collectOperations = (root)=>{
|
|
|
130
98
|
const collectFieldOperations = (root)=>{
|
|
131
99
|
const registry = new Map();
|
|
132
100
|
walkAst(root, (node)=>{
|
|
133
|
-
if (node.type
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
101
|
+
if ('field' !== node.type) return;
|
|
136
102
|
const constraints = node.constraints;
|
|
137
|
-
const owner = typeof constraints?.owner
|
|
138
|
-
const field = typeof constraints?.field
|
|
139
|
-
if (!owner || !field)
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
103
|
+
const owner = 'string' == typeof constraints?.owner ? constraints.owner : void 0;
|
|
104
|
+
const field = 'string' == typeof constraints?.field ? constraints.field : void 0;
|
|
105
|
+
if (!owner || !field) return;
|
|
142
106
|
const children = node.children ?? [];
|
|
143
107
|
const dependsOn = children[0];
|
|
144
|
-
const input = children.length
|
|
145
|
-
const output = children.length
|
|
146
|
-
if (!dependsOn)
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
108
|
+
const input = 3 === children.length ? children[1] : void 0;
|
|
109
|
+
const output = 3 === children.length ? children[2] : children[1];
|
|
110
|
+
if (!dependsOn) return;
|
|
149
111
|
const spec = {
|
|
150
112
|
owner,
|
|
151
113
|
field,
|
|
@@ -153,18 +115,14 @@ const collectFieldOperations = (root)=>{
|
|
|
153
115
|
output,
|
|
154
116
|
event: fieldEventName(owner, field)
|
|
155
117
|
};
|
|
156
|
-
if (!registry.has(owner))
|
|
157
|
-
registry.set(owner, new Map());
|
|
158
|
-
}
|
|
118
|
+
if (!registry.has(owner)) registry.set(owner, new Map());
|
|
159
119
|
registry.get(owner).set(field, spec);
|
|
160
120
|
});
|
|
161
121
|
return registry;
|
|
162
122
|
};
|
|
163
123
|
const hydrateByNode = ({ value, node, registry, request })=>{
|
|
164
|
-
if (!node)
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
if (node.type === 'array' && isArray(value)) {
|
|
124
|
+
if (!node) return value;
|
|
125
|
+
if ('array' === node.type && isArray(value)) {
|
|
168
126
|
const child = node.children?.[0];
|
|
169
127
|
value.forEach((item, index)=>{
|
|
170
128
|
value[index] = hydrateByNode({
|
|
@@ -176,7 +134,7 @@ const hydrateByNode = ({ value, node, registry, request })=>{
|
|
|
176
134
|
});
|
|
177
135
|
return value;
|
|
178
136
|
}
|
|
179
|
-
if (node.type
|
|
137
|
+
if ('tuple' === node.type && isArray(value)) {
|
|
180
138
|
const children = node.children ?? [];
|
|
181
139
|
value.forEach((item, index)=>{
|
|
182
140
|
value[index] = hydrateByNode({
|
|
@@ -188,33 +146,25 @@ const hydrateByNode = ({ value, node, registry, request })=>{
|
|
|
188
146
|
});
|
|
189
147
|
return value;
|
|
190
148
|
}
|
|
191
|
-
if (node.type
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
if (node.type === 'object' && isRecord(value)) {
|
|
149
|
+
if ('and' === node.type) return (node.children ?? []).reduce((current, child)=>hydrateByNode({
|
|
150
|
+
value: current,
|
|
151
|
+
node: child,
|
|
152
|
+
registry,
|
|
153
|
+
request
|
|
154
|
+
}), value);
|
|
155
|
+
if ('object' === node.type && isRecord(value)) {
|
|
200
156
|
const typeName = node.name;
|
|
201
|
-
if (typeName && registry.has(typeName)) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
});
|
|
208
|
-
}
|
|
157
|
+
if (typeName && registry.has(typeName)) attachFieldOperations({
|
|
158
|
+
target: value,
|
|
159
|
+
typeName,
|
|
160
|
+
registry,
|
|
161
|
+
request
|
|
162
|
+
});
|
|
209
163
|
const fields = node.children ?? [];
|
|
210
164
|
fields.forEach((fieldNode)=>{
|
|
211
|
-
if (fieldNode.type
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
165
|
+
if ('field' !== fieldNode.type || !fieldNode.name) return;
|
|
214
166
|
const child = fieldNode.children?.[0];
|
|
215
|
-
if (!child)
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
167
|
+
if (!child) return;
|
|
218
168
|
value[fieldNode.name] = hydrateByNode({
|
|
219
169
|
value: value[fieldNode.name],
|
|
220
170
|
node: child,
|
|
@@ -224,7 +174,7 @@ const hydrateByNode = ({ value, node, registry, request })=>{
|
|
|
224
174
|
});
|
|
225
175
|
return value;
|
|
226
176
|
}
|
|
227
|
-
if (node.type
|
|
177
|
+
if ('field' === node.type) {
|
|
228
178
|
const child = node.children?.[0];
|
|
229
179
|
return hydrateByNode({
|
|
230
180
|
value,
|
|
@@ -237,16 +187,10 @@ const hydrateByNode = ({ value, node, registry, request })=>{
|
|
|
237
187
|
};
|
|
238
188
|
const attachFieldOperations = ({ target, typeName, registry, request })=>{
|
|
239
189
|
const operations = registry.get(typeName);
|
|
240
|
-
if (!operations)
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
if (!Object.isExtensible(target)) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
190
|
+
if (!operations) return;
|
|
191
|
+
if (!Object.isExtensible(target)) return;
|
|
246
192
|
operations.forEach((spec, fieldName)=>{
|
|
247
|
-
if (fieldName in target)
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
193
|
+
if (fieldName in target) return;
|
|
250
194
|
Object.defineProperty(target, fieldName, {
|
|
251
195
|
enumerable: false,
|
|
252
196
|
configurable: true,
|
|
@@ -269,12 +213,10 @@ const attachFieldOperations = ({ target, typeName, registry, request })=>{
|
|
|
269
213
|
const normalizeFieldPayload = (payload)=>{
|
|
270
214
|
if (isRecord(payload) && 'dependsOn' in payload) {
|
|
271
215
|
const dependsOn = payload.dependsOn;
|
|
272
|
-
const input = 'input' in payload ? payload.input :
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
};
|
|
277
|
-
}
|
|
216
|
+
const input = 'input' in payload ? payload.input : void 0;
|
|
217
|
+
if (void 0 === input) return {
|
|
218
|
+
dependsOn
|
|
219
|
+
};
|
|
278
220
|
return {
|
|
279
221
|
dependsOn,
|
|
280
222
|
input
|
|
@@ -297,17 +239,12 @@ const createClientCore = ({ ast })=>{
|
|
|
297
239
|
const roomHandlers = new Map();
|
|
298
240
|
const roomEnabled = new Map();
|
|
299
241
|
const registerHandlers = (handlers, roomId)=>{
|
|
300
|
-
const entries = Object.entries(handlers).filter(([, handler])=>typeof handler
|
|
301
|
-
if (entries.length
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
globalHandlers.set(event, handler);
|
|
307
|
-
globalEnabled.set(event, true);
|
|
308
|
-
});
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
242
|
+
const entries = Object.entries(handlers).filter(([, handler])=>'function' == typeof handler);
|
|
243
|
+
if (0 === entries.length) return;
|
|
244
|
+
if (!roomId) return void entries.forEach(([event, handler])=>{
|
|
245
|
+
globalHandlers.set(event, handler);
|
|
246
|
+
globalEnabled.set(event, true);
|
|
247
|
+
});
|
|
311
248
|
const roomMap = roomHandlers.get(roomId) ?? new Map();
|
|
312
249
|
const enabledMap = roomEnabled.get(roomId) ?? new Map();
|
|
313
250
|
entries.forEach(([event, handler])=>{
|
|
@@ -318,10 +255,7 @@ const createClientCore = ({ ast })=>{
|
|
|
318
255
|
roomEnabled.set(roomId, enabledMap);
|
|
319
256
|
};
|
|
320
257
|
const toggleHandler = ({ enabled, event, roomId })=>{
|
|
321
|
-
if (!roomId)
|
|
322
|
-
globalEnabled.set(event, enabled);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
258
|
+
if (!roomId) return void globalEnabled.set(event, enabled);
|
|
325
259
|
const enabledMap = roomEnabled.get(roomId) ?? new Map();
|
|
326
260
|
enabledMap.set(event, enabled);
|
|
327
261
|
roomEnabled.set(roomId, enabledMap);
|
|
@@ -333,7 +267,7 @@ const createClientCore = ({ ast })=>{
|
|
|
333
267
|
status: envelope.status,
|
|
334
268
|
metadata: envelope.metadata,
|
|
335
269
|
context: envelope.context,
|
|
336
|
-
room: typeof envelope.metadata?.room
|
|
270
|
+
room: 'string' == typeof envelope.metadata?.room ? String(envelope.metadata.room) : void 0
|
|
337
271
|
};
|
|
338
272
|
const roomId = ctx.room;
|
|
339
273
|
if (roomId) {
|
|
@@ -341,21 +275,15 @@ const createClientCore = ({ ast })=>{
|
|
|
341
275
|
const roomMap = roomHandlers.get(roomId);
|
|
342
276
|
const handler = roomMap?.get(envelope.event);
|
|
343
277
|
const isEnabled = enabledMap?.get(envelope.event) ?? true;
|
|
344
|
-
if (handler && isEnabled)
|
|
345
|
-
handler(envelope.payload, ctx);
|
|
346
|
-
}
|
|
278
|
+
if (handler && isEnabled) handler(envelope.payload, ctx);
|
|
347
279
|
}
|
|
348
280
|
const handler = globalHandlers.get(envelope.event);
|
|
349
281
|
const isEnabled = globalEnabled.get(envelope.event) ?? true;
|
|
350
|
-
if (handler && isEnabled)
|
|
351
|
-
handler(envelope.payload, ctx);
|
|
352
|
-
}
|
|
282
|
+
if (handler && isEnabled) handler(envelope.payload, ctx);
|
|
353
283
|
};
|
|
354
284
|
operations.forEach((op)=>{
|
|
355
285
|
client[op.name] = async (input)=>{
|
|
356
|
-
if (!request)
|
|
357
|
-
throw new Error('Client request handler is not available.');
|
|
358
|
-
}
|
|
286
|
+
if (!request) throw new Error('Client request handler is not available.');
|
|
359
287
|
const result = await request(op.event, input);
|
|
360
288
|
return hydrateByNode({
|
|
361
289
|
value: result,
|
|
@@ -368,14 +296,10 @@ const createClientCore = ({ ast })=>{
|
|
|
368
296
|
fieldRegistry.forEach((fields, owner)=>{
|
|
369
297
|
fields.forEach((spec, field)=>{
|
|
370
298
|
const method = fieldMethodName(owner, field);
|
|
371
|
-
if (method in client)
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
299
|
+
if (method in client) return;
|
|
374
300
|
client[method] = async (payload, input)=>{
|
|
375
301
|
const normalized = normalizeFieldPayload(payload);
|
|
376
|
-
if (!request)
|
|
377
|
-
throw new Error('Client request handler is not available.');
|
|
378
|
-
}
|
|
302
|
+
if (!request) throw new Error('Client request handler is not available.');
|
|
379
303
|
const result = await request(spec.event, {
|
|
380
304
|
dependsOn: normalized.dependsOn,
|
|
381
305
|
input: input ?? normalized.input
|
|
@@ -399,17 +323,7 @@ const createClientCore = ({ ast })=>{
|
|
|
399
323
|
emitEvent: dispatch
|
|
400
324
|
});
|
|
401
325
|
};
|
|
402
|
-
|
|
403
|
-
* createClient is part of the public LIVON API.
|
|
404
|
-
*
|
|
405
|
-
* @remarks
|
|
406
|
-
* Parameter and return types are defined in the TypeScript signature.
|
|
407
|
-
*
|
|
408
|
-
* @see https://live-input-vector-output-node.github.io/livon-ts/docs/packages/client
|
|
409
|
-
*
|
|
410
|
-
* @example
|
|
411
|
-
* const result = createClient(undefined as never);
|
|
412
|
-
*/ const createClient = (input)=>{
|
|
326
|
+
const createClient = (input)=>{
|
|
413
327
|
const client = createClientCore({
|
|
414
328
|
ast: input.ast
|
|
415
329
|
});
|
|
@@ -432,24 +346,15 @@ const createClientCore = ({ ast })=>{
|
|
|
432
346
|
const moduleWithClient = Object.assign(moduleBase, client);
|
|
433
347
|
return moduleWithClient;
|
|
434
348
|
};
|
|
435
|
-
|
|
436
|
-
* createClientModule is part of the public LIVON API.
|
|
437
|
-
*
|
|
438
|
-
* @remarks
|
|
439
|
-
* Parameter and return types are defined in the TypeScript signature.
|
|
440
|
-
*
|
|
441
|
-
* @see https://live-input-vector-output-node.github.io/livon-ts/docs/packages/client
|
|
442
|
-
*
|
|
443
|
-
* @example
|
|
444
|
-
* const result = createClientModule(undefined as never);
|
|
445
|
-
*/ const createClientModule = (input)=>createClient(input);
|
|
446
|
-
|
|
349
|
+
const createClientModule = (input)=>createClient(input);
|
|
447
350
|
exports.clientModule = __webpack_exports__.clientModule;
|
|
448
351
|
exports.createClient = __webpack_exports__.createClient;
|
|
449
352
|
exports.createClientModule = __webpack_exports__.createClientModule;
|
|
450
|
-
for(var __rspack_i in __webpack_exports__)
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
Object.defineProperty(exports, '__esModule', {
|
|
353
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
354
|
+
"clientModule",
|
|
355
|
+
"createClient",
|
|
356
|
+
"createClientModule"
|
|
357
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
358
|
+
Object.defineProperty(exports, '__esModule', {
|
|
359
|
+
value: true
|
|
360
|
+
});
|
package/dist/client.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface ClientModuleOptions {
|
|
|
64
64
|
* @remarks
|
|
65
65
|
* Parameter and return types are defined in the TypeScript signature.
|
|
66
66
|
*
|
|
67
|
-
* @see https://
|
|
67
|
+
* @see https://livon.tech/docs/packages/client
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
70
70
|
* const result = clientModule(undefined as never);
|
|
@@ -76,7 +76,7 @@ export declare const clientModule: (client: ClientEventEmitter, options?: Client
|
|
|
76
76
|
* @remarks
|
|
77
77
|
* Parameter and return types are defined in the TypeScript signature.
|
|
78
78
|
*
|
|
79
|
-
* @see https://
|
|
79
|
+
* @see https://livon.tech/docs/packages/client
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
* const result = createClient(undefined as never);
|
|
@@ -92,7 +92,7 @@ export declare const createClient: (input: ClientModuleInput) => ClientModule &
|
|
|
92
92
|
* @remarks
|
|
93
93
|
* Parameter and return types are defined in the TypeScript signature.
|
|
94
94
|
*
|
|
95
|
-
* @see https://
|
|
95
|
+
* @see https://livon.tech/docs/packages/client
|
|
96
96
|
*
|
|
97
97
|
* @example
|
|
98
98
|
* const result = createClientModule(undefined as never);
|