@livon/schema 0.27.0-rc.1

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.
Files changed (169) hide show
  1. package/PROMPT.md +21 -0
  2. package/README.md +13 -0
  3. package/SCHEMA.md +13 -0
  4. package/dist/SchemaValidationError.cjs +41 -0
  5. package/dist/SchemaValidationError.d.ts +20 -0
  6. package/dist/SchemaValidationError.js +7 -0
  7. package/dist/SchemaValidationError.spec.cjs +65 -0
  8. package/dist/SchemaValidationError.spec.d.ts +1 -0
  9. package/dist/SchemaValidationError.spec.js +59 -0
  10. package/dist/after.cjs +36 -0
  11. package/dist/after.d.ts +30 -0
  12. package/dist/after.js +2 -0
  13. package/dist/after.spec.cjs +54 -0
  14. package/dist/after.spec.d.ts +1 -0
  15. package/dist/after.spec.js +48 -0
  16. package/dist/and.cjs +36 -0
  17. package/dist/and.d.ts +26 -0
  18. package/dist/and.js +2 -0
  19. package/dist/and.spec.cjs +57 -0
  20. package/dist/and.spec.d.ts +1 -0
  21. package/dist/and.spec.js +51 -0
  22. package/dist/api.cjs +317 -0
  23. package/dist/api.d.ts +107 -0
  24. package/dist/api.js +277 -0
  25. package/dist/api.spec.cjs +512 -0
  26. package/dist/api.spec.d.ts +1 -0
  27. package/dist/api.spec.js +506 -0
  28. package/dist/array.cjs +74 -0
  29. package/dist/array.d.ts +25 -0
  30. package/dist/array.js +40 -0
  31. package/dist/array.spec.cjs +167 -0
  32. package/dist/array.spec.d.ts +1 -0
  33. package/dist/array.spec.js +161 -0
  34. package/dist/before.cjs +36 -0
  35. package/dist/before.d.ts +30 -0
  36. package/dist/before.js +2 -0
  37. package/dist/before.spec.cjs +54 -0
  38. package/dist/before.spec.d.ts +1 -0
  39. package/dist/before.spec.js +48 -0
  40. package/dist/binary.cjs +53 -0
  41. package/dist/binary.d.ts +24 -0
  42. package/dist/binary.js +19 -0
  43. package/dist/binary.spec.cjs +107 -0
  44. package/dist/binary.spec.d.ts +1 -0
  45. package/dist/binary.spec.js +101 -0
  46. package/dist/boolean.cjs +53 -0
  47. package/dist/boolean.d.ts +24 -0
  48. package/dist/boolean.js +19 -0
  49. package/dist/boolean.spec.cjs +96 -0
  50. package/dist/boolean.spec.d.ts +1 -0
  51. package/dist/boolean.spec.js +90 -0
  52. package/dist/context.cjs +125 -0
  53. package/dist/context.d.ts +101 -0
  54. package/dist/context.js +76 -0
  55. package/dist/context.spec.cjs +244 -0
  56. package/dist/context.spec.d.ts +1 -0
  57. package/dist/context.spec.js +238 -0
  58. package/dist/date.cjs +53 -0
  59. package/dist/date.d.ts +24 -0
  60. package/dist/date.js +19 -0
  61. package/dist/date.spec.cjs +97 -0
  62. package/dist/date.spec.d.ts +1 -0
  63. package/dist/date.spec.js +91 -0
  64. package/dist/doc.cjs +54 -0
  65. package/dist/doc.d.ts +25 -0
  66. package/dist/doc.js +17 -0
  67. package/dist/doc.spec.cjs +99 -0
  68. package/dist/doc.spec.d.ts +1 -0
  69. package/dist/doc.spec.js +93 -0
  70. package/dist/enumeration.cjs +74 -0
  71. package/dist/enumeration.d.ts +50 -0
  72. package/dist/enumeration.js +40 -0
  73. package/dist/enumeration.spec.cjs +110 -0
  74. package/dist/enumeration.spec.d.ts +1 -0
  75. package/dist/enumeration.spec.js +104 -0
  76. package/dist/hydrate.cjs +18 -0
  77. package/dist/hydrate.d.ts +1 -0
  78. package/dist/hydrate.js +0 -0
  79. package/dist/index.cjs +145 -0
  80. package/dist/index.d.ts +34 -0
  81. package/dist/index.js +24 -0
  82. package/dist/index.spec.cjs +43 -0
  83. package/dist/index.spec.d.ts +1 -0
  84. package/dist/index.spec.js +37 -0
  85. package/dist/literal.cjs +55 -0
  86. package/dist/literal.d.ts +25 -0
  87. package/dist/literal.js +21 -0
  88. package/dist/literal.spec.cjs +93 -0
  89. package/dist/literal.spec.d.ts +1 -0
  90. package/dist/literal.spec.js +87 -0
  91. package/dist/number.cjs +89 -0
  92. package/dist/number.d.ts +84 -0
  93. package/dist/number.js +55 -0
  94. package/dist/number.spec.cjs +155 -0
  95. package/dist/number.spec.d.ts +1 -0
  96. package/dist/number.spec.js +149 -0
  97. package/dist/object.cjs +66 -0
  98. package/dist/object.d.ts +37 -0
  99. package/dist/object.js +32 -0
  100. package/dist/object.spec.cjs +171 -0
  101. package/dist/object.spec.d.ts +1 -0
  102. package/dist/object.spec.js +165 -0
  103. package/dist/operation.cjs +182 -0
  104. package/dist/operation.d.ts +197 -0
  105. package/dist/operation.js +133 -0
  106. package/dist/operation.spec.cjs +454 -0
  107. package/dist/operation.spec.d.ts +1 -0
  108. package/dist/operation.spec.js +448 -0
  109. package/dist/or.cjs +85 -0
  110. package/dist/or.d.ts +37 -0
  111. package/dist/or.js +51 -0
  112. package/dist/or.spec.cjs +204 -0
  113. package/dist/or.spec.d.ts +1 -0
  114. package/dist/or.spec.js +198 -0
  115. package/dist/schema.cjs +285 -0
  116. package/dist/schema.d.ts +132 -0
  117. package/dist/schema.js +233 -0
  118. package/dist/schema.spec.cjs +587 -0
  119. package/dist/schema.spec.d.ts +1 -0
  120. package/dist/schema.spec.js +581 -0
  121. package/dist/schemaFactory.cjs +125 -0
  122. package/dist/schemaFactory.d.ts +97 -0
  123. package/dist/schemaFactory.js +88 -0
  124. package/dist/schemaFactory.spec.cjs +197 -0
  125. package/dist/schemaFactory.spec.d.ts +1 -0
  126. package/dist/schemaFactory.spec.js +191 -0
  127. package/dist/schemaModule.cjs +280 -0
  128. package/dist/schemaModule.d.ts +97 -0
  129. package/dist/schemaModule.js +243 -0
  130. package/dist/schemaModule.spec.cjs +355 -0
  131. package/dist/schemaModule.spec.d.ts +1 -0
  132. package/dist/schemaModule.spec.js +349 -0
  133. package/dist/string.cjs +93 -0
  134. package/dist/string.d.ts +85 -0
  135. package/dist/string.js +59 -0
  136. package/dist/string.spec.cjs +158 -0
  137. package/dist/string.spec.d.ts +1 -0
  138. package/dist/string.spec.js +152 -0
  139. package/dist/testing/mocks/assertions.mock.cjs +48 -0
  140. package/dist/testing/mocks/assertions.mock.d.ts +5 -0
  141. package/dist/testing/mocks/assertions.mock.js +14 -0
  142. package/dist/testing/mocks/index.cjs +52 -0
  143. package/dist/testing/mocks/index.d.ts +4 -0
  144. package/dist/testing/mocks/index.js +3 -0
  145. package/dist/testing/mocks/schema.mock.cjs +120 -0
  146. package/dist/testing/mocks/schema.mock.d.ts +37 -0
  147. package/dist/testing/mocks/schema.mock.js +74 -0
  148. package/dist/tuple.cjs +58 -0
  149. package/dist/tuple.d.ts +33 -0
  150. package/dist/tuple.js +24 -0
  151. package/dist/tuple.spec.cjs +162 -0
  152. package/dist/tuple.spec.d.ts +1 -0
  153. package/dist/tuple.spec.js +156 -0
  154. package/dist/typeGuards.cjs +60 -0
  155. package/dist/typeGuards.d.ts +93 -0
  156. package/dist/typeGuards.js +8 -0
  157. package/dist/typeGuards.spec.cjs +101 -0
  158. package/dist/typeGuards.spec.d.ts +1 -0
  159. package/dist/typeGuards.spec.js +95 -0
  160. package/dist/types.cjs +18 -0
  161. package/dist/types.d.ts +289 -0
  162. package/dist/types.js +0 -0
  163. package/dist/union.cjs +74 -0
  164. package/dist/union.d.ts +33 -0
  165. package/dist/union.js +40 -0
  166. package/dist/union.spec.cjs +159 -0
  167. package/dist/union.spec.d.ts +1 -0
  168. package/dist/union.spec.js +153 -0
  169. package/package.json +47 -0
package/dist/api.cjs ADDED
@@ -0,0 +1,317 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
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
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
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
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ api: ()=>api,
28
+ composeApi: ()=>composeApi,
29
+ subscription: ()=>api_subscription
30
+ });
31
+ const external_doc_cjs_namespaceObject = require("./doc.cjs");
32
+ const external_operation_cjs_namespaceObject = require("./operation.cjs");
33
+ const api_subscription = (input)=>({
34
+ type: "subscription",
35
+ payload: input.payload,
36
+ ...input.input ? {
37
+ input: input.input
38
+ } : {},
39
+ ...input.output ? {
40
+ output: input.output
41
+ } : {},
42
+ ...input.filter ? {
43
+ filter: input.filter
44
+ } : {},
45
+ ...input.exec ? {
46
+ exec: input.exec
47
+ } : {},
48
+ ...input.name ? {
49
+ name: input.name
50
+ } : {},
51
+ ...input.doc ? {
52
+ doc: input.doc
53
+ } : {}
54
+ });
55
+ const isOperation = (value)=>'object' == typeof value && null !== value && 'type' in value && 'operation' === value.type;
56
+ const isSchema = (value)=>'object' == typeof value && null !== value && 'parse' in value && 'ast' in value;
57
+ const isRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
58
+ const mergeOperations = (input, explicit)=>{
59
+ const ops = {
60
+ ...explicit ?? {}
61
+ };
62
+ Object.entries(input).forEach(([key, value])=>{
63
+ if (!ops[key] && isOperation(value)) ops[key] = value;
64
+ });
65
+ return ops;
66
+ };
67
+ const mergeFieldOperations = (input)=>({
68
+ ...input ?? {}
69
+ });
70
+ const subscriptionFromInput = (name, value)=>{
71
+ if (isRecord(value) && 'payload' in value && isSchema(value.payload)) {
72
+ const payload = value.payload;
73
+ const input = isSchema(value.input) ? value.input : void 0;
74
+ const output = isSchema(value.output) ? value.output : void 0;
75
+ const filter = 'function' == typeof value.filter ? value.filter : void 0;
76
+ const exec = 'function' == typeof value.exec ? value.exec : void 0;
77
+ const doc = value.doc;
78
+ const normalized = value.name;
79
+ return {
80
+ type: "subscription",
81
+ payload,
82
+ ...input ? {
83
+ input
84
+ } : {},
85
+ ...output ? {
86
+ output
87
+ } : {},
88
+ ...filter ? {
89
+ filter
90
+ } : {},
91
+ ...exec ? {
92
+ exec
93
+ } : {},
94
+ ...doc ? {
95
+ doc
96
+ } : {},
97
+ ...normalized ? {
98
+ name: normalized
99
+ } : {}
100
+ };
101
+ }
102
+ if (isSchema(value)) return {
103
+ type: "subscription",
104
+ payload: value,
105
+ name
106
+ };
107
+ };
108
+ const mergeSubscriptions = (input)=>{
109
+ const subs = {};
110
+ if (!input) return subs;
111
+ Object.entries(input).forEach(([key, value])=>{
112
+ const subscription = subscriptionFromInput(key, value);
113
+ if (subscription) subs[key] = subscription;
114
+ });
115
+ return subs;
116
+ };
117
+ const api = (input)=>{
118
+ const { type, operations, fieldOperations, subscriptions, ...rest } = input;
119
+ const mergedOperations = mergeOperations(rest, operations);
120
+ const mergedFieldOperations = mergeFieldOperations(fieldOperations);
121
+ const mergedSubscriptions = mergeSubscriptions(subscriptions);
122
+ if (Object.keys(mergedFieldOperations).length > 0 && !type) throw new Error('api.type is required when fieldOperations are provided.');
123
+ const namedOperations = Object.entries(mergedOperations).reduce((acc, [key, op])=>{
124
+ acc[key] = op.name ? op : (0, external_operation_cjs_namespaceObject.withOperationName)({
125
+ name: key,
126
+ operation: op
127
+ });
128
+ return acc;
129
+ }, {});
130
+ const namedFieldOperations = Object.entries(mergedFieldOperations).reduce((acc, [key, op])=>{
131
+ acc[key] = op.name ? op : (0, external_operation_cjs_namespaceObject.withFieldOperationName)({
132
+ name: key,
133
+ operation: op
134
+ });
135
+ return acc;
136
+ }, {});
137
+ const namedSubscriptions = Object.entries(mergedSubscriptions).reduce((acc, [key, sub])=>{
138
+ acc[key] = sub.name ? sub : {
139
+ ...sub,
140
+ name: key
141
+ };
142
+ return acc;
143
+ }, {});
144
+ Object.entries(namedOperations).forEach(([operationName, op])=>{
145
+ const topics = Object.keys(op.publish ?? {});
146
+ topics.forEach((topic)=>{
147
+ if (!namedSubscriptions[topic]) throw new Error(`api: operation "${operationName}" publishes "${topic}" but no subscription with that name exists.`);
148
+ });
149
+ });
150
+ const apiDoc = (0, external_doc_cjs_namespaceObject.normalizeDoc)(input.doc);
151
+ return {
152
+ type: 'api',
153
+ entity: type,
154
+ operations: namedOperations,
155
+ fieldOperations: namedFieldOperations,
156
+ subscriptions: namedSubscriptions,
157
+ ast: ()=>({
158
+ type: 'api',
159
+ name: type?.name,
160
+ doc: apiDoc,
161
+ children: [
162
+ ...Object.entries(namedOperations).map(([name, op])=>{
163
+ const publishTopics = Object.keys(op.publish ?? {});
164
+ const requestType = op.input?.name ?? void 0;
165
+ const responseType = op.output?.name ?? void 0;
166
+ const ackConfig = op.ack;
167
+ const constraints = {
168
+ ...publishTopics.length > 0 ? {
169
+ publish: publishTopics
170
+ } : {},
171
+ ...void 0 !== ackConfig ? {
172
+ ack: ackConfig
173
+ } : {},
174
+ ...requestType ? {
175
+ request: requestType
176
+ } : {},
177
+ ...responseType ? {
178
+ response: responseType
179
+ } : {}
180
+ };
181
+ return {
182
+ type: 'operation',
183
+ name,
184
+ constraints: Object.keys(constraints).length > 0 ? constraints : void 0,
185
+ doc: (0, external_doc_cjs_namespaceObject.normalizeDoc)(op.doc),
186
+ request: requestType,
187
+ response: responseType,
188
+ children: [
189
+ op.input.ast(),
190
+ ...op.output ? [
191
+ op.output.ast()
192
+ ] : []
193
+ ]
194
+ };
195
+ }),
196
+ ...Object.entries(namedSubscriptions).map(([name, sub])=>{
197
+ const inputType = sub.input?.name ?? void 0;
198
+ const payloadType = sub.payload?.name ?? void 0;
199
+ const outputType = sub.output?.name ?? payloadType;
200
+ const constraints = {
201
+ ...inputType ? {
202
+ input: inputType
203
+ } : {},
204
+ ...payloadType ? {
205
+ payload: payloadType
206
+ } : {},
207
+ ...outputType ? {
208
+ output: outputType
209
+ } : {}
210
+ };
211
+ return {
212
+ type: "subscription",
213
+ name,
214
+ constraints: Object.keys(constraints).length > 0 ? constraints : void 0,
215
+ doc: (0, external_doc_cjs_namespaceObject.normalizeDoc)(sub.doc),
216
+ request: inputType,
217
+ response: outputType,
218
+ children: [
219
+ sub.payload.ast(),
220
+ ...sub.input ? [
221
+ sub.input.ast()
222
+ ] : [],
223
+ ...sub.output ? [
224
+ sub.output.ast()
225
+ ] : []
226
+ ]
227
+ };
228
+ }),
229
+ ...Object.entries(namedFieldOperations).map(([fieldName, op])=>{
230
+ const requestType = op.input?.name ?? void 0;
231
+ const responseType = op.output?.name ?? void 0;
232
+ const dependsOnType = op.dependsOn?.name ?? void 0;
233
+ const constraints = {
234
+ owner: type?.name,
235
+ field: fieldName,
236
+ ...requestType ? {
237
+ request: requestType
238
+ } : {},
239
+ ...responseType ? {
240
+ response: responseType
241
+ } : {},
242
+ ...dependsOnType ? {
243
+ dependsOn: dependsOnType
244
+ } : {}
245
+ };
246
+ return {
247
+ type: 'field',
248
+ name: type?.name ? `${type.name}.${fieldName}` : fieldName,
249
+ constraints,
250
+ doc: (0, external_doc_cjs_namespaceObject.normalizeDoc)(op.doc),
251
+ request: requestType,
252
+ response: responseType,
253
+ dependsOn: dependsOnType,
254
+ children: [
255
+ op.dependsOn.ast(),
256
+ ...op.input ? [
257
+ op.input.ast()
258
+ ] : [],
259
+ ...op.output ? [
260
+ op.output.ast()
261
+ ] : []
262
+ ]
263
+ };
264
+ })
265
+ ]
266
+ })
267
+ };
268
+ };
269
+ const composeApi = (apis)=>{
270
+ const operations = {};
271
+ const fieldOperations = {};
272
+ const subscriptions = {};
273
+ Object.values(apis).forEach((apiInstance)=>{
274
+ Object.entries(apiInstance.operations).forEach(([name, op])=>{
275
+ if (operations[name]) throw new Error(`composeApi: duplicate operation name \"${name}\"`);
276
+ operations[name] = op;
277
+ });
278
+ Object.entries(apiInstance.fieldOperations).forEach(([name, op])=>{
279
+ const owner = apiInstance.entity?.name;
280
+ const key = owner ? `${owner}.${name}` : name;
281
+ if (fieldOperations[key]) throw new Error(`composeApi: duplicate field operation name \"${key}\"`);
282
+ fieldOperations[key] = op;
283
+ });
284
+ Object.entries(apiInstance.subscriptions ?? {}).forEach(([name, sub])=>{
285
+ if (subscriptions[name]) throw new Error(`composeApi: duplicate subscription name "${name}"`);
286
+ subscriptions[name] = sub;
287
+ });
288
+ });
289
+ return {
290
+ type: 'api-composed',
291
+ apis,
292
+ operations,
293
+ fieldOperations,
294
+ subscriptions,
295
+ ast: ()=>({
296
+ type: 'api-composed',
297
+ children: Object.entries(apis).map(([name, apiInstance])=>{
298
+ const node = apiInstance.ast();
299
+ return {
300
+ ...node,
301
+ name
302
+ };
303
+ })
304
+ })
305
+ };
306
+ };
307
+ exports.api = __webpack_exports__.api;
308
+ exports.composeApi = __webpack_exports__.composeApi;
309
+ exports.subscription = __webpack_exports__.subscription;
310
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
311
+ "api",
312
+ "composeApi",
313
+ "subscription"
314
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
315
+ Object.defineProperty(exports, '__esModule', {
316
+ value: true
317
+ });
package/dist/api.d.ts ADDED
@@ -0,0 +1,107 @@
1
+ import { AstNode, Infer, Schema, SchemaContext, SchemaDoc } from './types.js';
2
+ import { FieldOperation, Operation } from './operation.js';
3
+ type AnySchema = Schema<any>;
4
+ type AnyFieldOperation = FieldOperation<AnySchema, any, AnySchema | undefined, unknown>;
5
+ type AnyResult = any;
6
+ type AnySubscription = Subscription<AnySchema | undefined, AnySchema, AnySchema | undefined, unknown>;
7
+ type InputInfer<TInputSchema extends AnySchema | undefined> = TInputSchema extends AnySchema ? Infer<TInputSchema> : undefined;
8
+ export interface SubscriptionFilter<TInput, TPayload> {
9
+ (input: TInput, payload: TPayload, ctx: SchemaContext): boolean | Promise<boolean>;
10
+ }
11
+ export interface SubscriptionExecutor<TInput, TPayload, TResult> {
12
+ (input: TInput, payload: TPayload, ctx: SchemaContext): TResult | Promise<TResult>;
13
+ }
14
+ export interface ApiShape {
15
+ [key: string]: Operation<AnySchema, AnySchema | undefined, AnyResult>;
16
+ }
17
+ export interface ApiFieldShape {
18
+ [key: string]: AnyFieldOperation;
19
+ }
20
+ export interface Subscription<TInputSchema extends AnySchema | undefined, TPayloadSchema extends AnySchema, TOutputSchema extends AnySchema | undefined, TResult> {
21
+ type: 'subscription';
22
+ input?: TInputSchema;
23
+ output?: TOutputSchema;
24
+ payload: TPayloadSchema;
25
+ filter?: SubscriptionFilter<InputInfer<TInputSchema>, Infer<TPayloadSchema>>;
26
+ exec?: SubscriptionExecutor<InputInfer<TInputSchema>, Infer<TPayloadSchema>, TResult>;
27
+ name?: string;
28
+ doc?: SchemaDoc;
29
+ }
30
+ export interface SubscriptionShape {
31
+ [key: string]: AnySubscription;
32
+ }
33
+ export interface SubscriptionInput<TInputSchema extends AnySchema | undefined = AnySchema | undefined, TPayloadSchema extends AnySchema = AnySchema, TOutputSchema extends AnySchema | undefined = AnySchema | undefined, TResult = unknown> {
34
+ input?: TInputSchema;
35
+ payload: TPayloadSchema;
36
+ output?: TOutputSchema;
37
+ filter?: SubscriptionFilter<InputInfer<TInputSchema>, Infer<TPayloadSchema>>;
38
+ exec?: SubscriptionExecutor<InputInfer<TInputSchema>, Infer<TPayloadSchema>, TResult>;
39
+ name?: string;
40
+ doc?: SchemaDoc;
41
+ }
42
+ export interface SubscriptionInputShape {
43
+ [key: string]: AnySubscription | SubscriptionInput | AnySchema;
44
+ }
45
+ /**
46
+ * subscription is part of the public LIVON API.
47
+ *
48
+ * @remarks
49
+ * Parameter and return types are defined in the TypeScript signature.
50
+ *
51
+ * @see https://live-input-vector-output-node.github.io/livon-ts/docs/schema/api
52
+ *
53
+ * @example
54
+ * const result = subscription(undefined as never);
55
+ */
56
+ export declare const subscription: <TInputSchema extends AnySchema | undefined = AnySchema | undefined, TPayloadSchema extends AnySchema = AnySchema, TOutputSchema extends AnySchema | undefined = AnySchema | undefined, TResult = unknown>(input: SubscriptionInput<TInputSchema, TPayloadSchema, TOutputSchema, TResult>) => Subscription<TInputSchema, TPayloadSchema, TOutputSchema, TResult>;
57
+ export interface ApiAst {
58
+ (): AstNode;
59
+ }
60
+ export interface Api<TType extends AnySchema | undefined, TShape extends ApiShape, TFieldShape extends ApiFieldShape> {
61
+ type: 'api';
62
+ entity?: TType;
63
+ operations: TShape;
64
+ fieldOperations: TFieldShape;
65
+ subscriptions: SubscriptionShape;
66
+ ast: ApiAst;
67
+ }
68
+ export type ApiInput<TType extends AnySchema | undefined, TShape extends ApiShape, TFieldShape extends ApiFieldShape> = {
69
+ type?: TType;
70
+ operations?: TShape;
71
+ fieldOperations?: TFieldShape;
72
+ subscriptions?: SubscriptionInputShape;
73
+ doc?: SchemaDoc;
74
+ } & Partial<TShape>;
75
+ /**
76
+ * api is part of the public LIVON API.
77
+ *
78
+ * @remarks
79
+ * Parameter and return types are defined in the TypeScript signature.
80
+ *
81
+ * @see https://live-input-vector-output-node.github.io/livon-ts/docs/schema/api
82
+ *
83
+ * @example
84
+ * const result = api(undefined as never);
85
+ */
86
+ export declare const api: <TType extends AnySchema | undefined, TShape extends ApiShape, TFieldShape extends ApiFieldShape>(input: ApiInput<TType, TShape, TFieldShape>) => Api<TType, TShape, TFieldShape>;
87
+ export interface ComposedApi<TApis extends Record<string, Api<AnySchema | undefined, ApiShape, ApiFieldShape>>> {
88
+ type: 'api-composed';
89
+ apis: TApis;
90
+ operations: ApiShape;
91
+ fieldOperations: ApiFieldShape;
92
+ subscriptions: SubscriptionShape;
93
+ ast: ApiAst;
94
+ }
95
+ /**
96
+ * composeApi is part of the public LIVON API.
97
+ *
98
+ * @remarks
99
+ * Parameter and return types are defined in the TypeScript signature.
100
+ *
101
+ * @see https://live-input-vector-output-node.github.io/livon-ts/docs/schema/api
102
+ *
103
+ * @example
104
+ * const result = composeApi(undefined as never);
105
+ */
106
+ export declare const composeApi: <TApis extends Record<string, Api<AnySchema | undefined, ApiShape, ApiFieldShape>>>(apis: TApis) => ComposedApi<TApis>;
107
+ export {};