spacetimedb 2.5.0 → 2.6.0

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 (180) hide show
  1. package/LICENSE.txt +759 -759
  2. package/README.md +211 -211
  3. package/dist/angular/index.cjs.map +1 -1
  4. package/dist/angular/index.mjs.map +1 -1
  5. package/dist/browser/angular/index.mjs.map +1 -1
  6. package/dist/browser/react/index.mjs +129 -57
  7. package/dist/browser/react/index.mjs.map +1 -1
  8. package/dist/browser/solid/index.mjs +120 -50
  9. package/dist/browser/solid/index.mjs.map +1 -1
  10. package/dist/browser/svelte/index.mjs.map +1 -1
  11. package/dist/browser/vue/index.mjs.map +1 -1
  12. package/dist/index.browser.mjs +10 -2
  13. package/dist/index.browser.mjs.map +1 -1
  14. package/dist/index.cjs +10 -2
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.mjs +10 -2
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/min/index.browser.mjs +1 -1
  19. package/dist/min/index.browser.mjs.map +1 -1
  20. package/dist/min/react/index.mjs +1 -1
  21. package/dist/min/react/index.mjs.map +1 -1
  22. package/dist/min/sdk/index.browser.mjs +1 -1
  23. package/dist/min/sdk/index.browser.mjs.map +1 -1
  24. package/dist/react/index.cjs +129 -57
  25. package/dist/react/index.cjs.map +1 -1
  26. package/dist/react/index.mjs +129 -57
  27. package/dist/react/index.mjs.map +1 -1
  28. package/dist/react/useTable.d.ts.map +1 -1
  29. package/dist/sdk/connection_manager.d.ts +8 -0
  30. package/dist/sdk/connection_manager.d.ts.map +1 -1
  31. package/dist/sdk/db_connection_impl.d.ts +7 -0
  32. package/dist/sdk/db_connection_impl.d.ts.map +1 -1
  33. package/dist/sdk/index.browser.mjs +10 -2
  34. package/dist/sdk/index.browser.mjs.map +1 -1
  35. package/dist/sdk/index.cjs +10 -2
  36. package/dist/sdk/index.cjs.map +1 -1
  37. package/dist/sdk/index.mjs +10 -2
  38. package/dist/sdk/index.mjs.map +1 -1
  39. package/dist/sdk/websocket_test_adapter.d.ts +2 -1
  40. package/dist/sdk/websocket_test_adapter.d.ts.map +1 -1
  41. package/dist/server/index.mjs.map +1 -1
  42. package/dist/server/runtime.d.ts.map +1 -1
  43. package/dist/solid/index.cjs +120 -50
  44. package/dist/solid/index.cjs.map +1 -1
  45. package/dist/solid/index.mjs +120 -50
  46. package/dist/solid/index.mjs.map +1 -1
  47. package/dist/svelte/index.cjs.map +1 -1
  48. package/dist/svelte/index.mjs.map +1 -1
  49. package/dist/tanstack/index.cjs +120 -50
  50. package/dist/tanstack/index.cjs.map +1 -1
  51. package/dist/tanstack/index.mjs +120 -50
  52. package/dist/tanstack/index.mjs.map +1 -1
  53. package/dist/vue/index.cjs.map +1 -1
  54. package/dist/vue/index.mjs.map +1 -1
  55. package/package.json +1 -1
  56. package/src/angular/connection_state.ts +19 -19
  57. package/src/angular/index.ts +3 -3
  58. package/src/angular/injectors/index.ts +4 -4
  59. package/src/angular/injectors/inject-reducer.ts +62 -62
  60. package/src/angular/injectors/inject-spacetimedb-connected.ts +13 -13
  61. package/src/angular/injectors/inject-spacetimedb.ts +10 -10
  62. package/src/angular/injectors/inject-table.ts +234 -234
  63. package/src/angular/providers/index.ts +1 -1
  64. package/src/angular/providers/provide-spacetimedb.ts +96 -96
  65. package/src/index.ts +16 -16
  66. package/src/lib/algebraic_type.ts +819 -819
  67. package/src/lib/algebraic_type_variants.ts +26 -26
  68. package/src/lib/algebraic_value.ts +10 -10
  69. package/src/lib/autogen/types.ts +746 -746
  70. package/src/lib/binary_reader.ts +188 -188
  71. package/src/lib/binary_writer.ts +213 -213
  72. package/src/lib/connection_id.ts +102 -102
  73. package/src/lib/constraints.ts +48 -48
  74. package/src/lib/errors.ts +26 -26
  75. package/src/lib/filter.ts +195 -195
  76. package/src/lib/identity.ts +83 -83
  77. package/src/lib/indexes.ts +251 -251
  78. package/src/lib/option.ts +34 -34
  79. package/src/lib/query.ts +1019 -1019
  80. package/src/lib/reducer_schema.ts +38 -38
  81. package/src/lib/reducers.ts +116 -116
  82. package/src/lib/result.ts +36 -36
  83. package/src/lib/schedule_at.ts +86 -86
  84. package/src/lib/schema.ts +420 -420
  85. package/src/lib/table.ts +548 -548
  86. package/src/lib/table_schema.ts +64 -64
  87. package/src/lib/time_duration.ts +77 -77
  88. package/src/lib/timestamp.ts +148 -148
  89. package/src/lib/type_builders.test-d.ts +128 -128
  90. package/src/lib/type_builders.ts +4014 -4014
  91. package/src/lib/type_util.ts +124 -124
  92. package/src/lib/util.ts +196 -196
  93. package/src/lib/uuid.ts +337 -337
  94. package/src/react/SpacetimeDBProvider.ts +84 -84
  95. package/src/react/connection_state.ts +6 -6
  96. package/src/react/index.ts +5 -5
  97. package/src/react/useProcedure.ts +60 -60
  98. package/src/react/useReducer.ts +53 -53
  99. package/src/react/useSpacetimeDB.ts +18 -18
  100. package/src/react/useTable.ts +256 -251
  101. package/src/sdk/client_api/index.ts +114 -114
  102. package/src/sdk/client_api/types/procedures.ts +8 -8
  103. package/src/sdk/client_api/types/reducers.ts +8 -8
  104. package/src/sdk/client_api/types.ts +288 -288
  105. package/src/sdk/client_cache.ts +129 -129
  106. package/src/sdk/client_table.ts +179 -179
  107. package/src/sdk/connection_manager.ts +352 -237
  108. package/src/sdk/db_connection_builder.ts +290 -290
  109. package/src/sdk/db_connection_impl.ts +1356 -1347
  110. package/src/sdk/db_context.ts +28 -28
  111. package/src/sdk/db_view.ts +12 -12
  112. package/src/sdk/decompress.ts +51 -51
  113. package/src/sdk/event.ts +18 -18
  114. package/src/sdk/event_context.ts +51 -51
  115. package/src/sdk/event_emitter.ts +32 -32
  116. package/src/sdk/index.ts +14 -14
  117. package/src/sdk/internal.ts +2 -2
  118. package/src/sdk/json_api.ts +46 -46
  119. package/src/sdk/logger.ts +134 -134
  120. package/src/sdk/message_types.ts +46 -46
  121. package/src/sdk/procedures.ts +83 -83
  122. package/src/sdk/reducer_event.ts +20 -20
  123. package/src/sdk/reducer_handle.ts +12 -12
  124. package/src/sdk/reducers.ts +159 -159
  125. package/src/sdk/schema.ts +45 -45
  126. package/src/sdk/spacetime_module.ts +28 -28
  127. package/src/sdk/subscription_builder_impl.ts +275 -275
  128. package/src/sdk/table_cache.ts +581 -581
  129. package/src/sdk/type_utils.ts +19 -19
  130. package/src/sdk/version.ts +133 -133
  131. package/src/sdk/websocket_decompress_adapter.ts +63 -63
  132. package/src/sdk/websocket_protocols.ts +25 -25
  133. package/src/sdk/websocket_test_adapter.ts +107 -100
  134. package/src/sdk/websocket_v3_frames.ts +126 -126
  135. package/src/sdk/ws.ts +105 -105
  136. package/src/server/console.ts +81 -81
  137. package/src/server/db_view.ts +21 -21
  138. package/src/server/errors.ts +138 -138
  139. package/src/server/http.test-d.ts +80 -80
  140. package/src/server/http.ts +14 -14
  141. package/src/server/http_handlers.ts +413 -413
  142. package/src/server/http_internal.ts +79 -79
  143. package/src/server/http_shared.ts +186 -186
  144. package/src/server/index.ts +37 -37
  145. package/src/server/polyfills.ts +4 -4
  146. package/src/server/procedures.ts +239 -239
  147. package/src/server/query.ts +1 -1
  148. package/src/server/range.ts +53 -53
  149. package/src/server/reducers.ts +113 -113
  150. package/src/server/rng.ts +113 -113
  151. package/src/server/runtime.ts +1102 -1102
  152. package/src/server/schema.test-d.ts +99 -99
  153. package/src/server/schema.ts +663 -663
  154. package/src/server/sys.d.ts +125 -125
  155. package/src/server/view.test-d.ts +194 -194
  156. package/src/server/views.ts +340 -340
  157. package/src/solid/SpacetimeDBProvider.ts +97 -97
  158. package/src/solid/connection_state.ts +6 -6
  159. package/src/solid/index.ts +5 -5
  160. package/src/solid/useProcedure.ts +57 -57
  161. package/src/solid/useReducer.ts +50 -50
  162. package/src/solid/useSpacetimeDB.ts +18 -18
  163. package/src/solid/useTable.ts +203 -203
  164. package/src/svelte/SpacetimeDBProvider.ts +101 -101
  165. package/src/svelte/connection_state.ts +16 -16
  166. package/src/svelte/index.ts +4 -4
  167. package/src/svelte/useReducer.ts +61 -61
  168. package/src/svelte/useSpacetimeDB.ts +22 -22
  169. package/src/svelte/useTable.ts +218 -218
  170. package/src/tanstack/SpacetimeDBQueryClient.ts +330 -330
  171. package/src/tanstack/hooks.ts +83 -83
  172. package/src/tanstack/index.ts +16 -16
  173. package/src/util-stub.ts +1 -1
  174. package/src/vue/SpacetimeDBProvider.ts +157 -157
  175. package/src/vue/connection_state.ts +19 -19
  176. package/src/vue/index.ts +5 -5
  177. package/src/vue/useProcedure.ts +62 -62
  178. package/src/vue/useReducer.ts +55 -55
  179. package/src/vue/useSpacetimeDB.ts +18 -18
  180. package/src/vue/useTable.ts +229 -229
@@ -1,746 +1,746 @@
1
- // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
- // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
-
4
- /* eslint-disable */
5
- /* tslint:disable */
6
- import {
7
- TypeBuilder as __TypeBuilder,
8
- t as __t,
9
- type AlgebraicTypeType as __AlgebraicTypeType,
10
- type Infer as __Infer,
11
- } from '../../lib/type_builders';
12
-
13
- // The tagged union or sum type for the algebraic type `AlgebraicType`.
14
- export const AlgebraicType: __TypeBuilder<
15
- __AlgebraicTypeType,
16
- __AlgebraicTypeType
17
- > = __t.enum('AlgebraicType', {
18
- Ref: __t.u32(),
19
- get Sum() {
20
- return SumType;
21
- },
22
- get Product() {
23
- return ProductType;
24
- },
25
- get Array() {
26
- return AlgebraicType;
27
- },
28
- String: __t.unit(),
29
- Bool: __t.unit(),
30
- I8: __t.unit(),
31
- U8: __t.unit(),
32
- I16: __t.unit(),
33
- U16: __t.unit(),
34
- I32: __t.unit(),
35
- U32: __t.unit(),
36
- I64: __t.unit(),
37
- U64: __t.unit(),
38
- I128: __t.unit(),
39
- U128: __t.unit(),
40
- I256: __t.unit(),
41
- U256: __t.unit(),
42
- F32: __t.unit(),
43
- F64: __t.unit(),
44
- });
45
- export type AlgebraicType = __Infer<typeof AlgebraicType>;
46
-
47
- // The tagged union or sum type for the algebraic type `CaseConversionPolicy`.
48
- export const CaseConversionPolicy = __t.enum('CaseConversionPolicy', {
49
- None: __t.unit(),
50
- SnakeCase: __t.unit(),
51
- });
52
- export type CaseConversionPolicy = __Infer<typeof CaseConversionPolicy>;
53
-
54
- // The tagged union or sum type for the algebraic type `ExplicitNameEntry`.
55
- export const ExplicitNameEntry = __t.enum('ExplicitNameEntry', {
56
- get Table() {
57
- return NameMapping;
58
- },
59
- get Function() {
60
- return NameMapping;
61
- },
62
- get Index() {
63
- return NameMapping;
64
- },
65
- });
66
- export type ExplicitNameEntry = __Infer<typeof ExplicitNameEntry>;
67
-
68
- export const ExplicitNames = __t.object('ExplicitNames', {
69
- get entries() {
70
- return __t.array(ExplicitNameEntry);
71
- },
72
- });
73
- export type ExplicitNames = __Infer<typeof ExplicitNames>;
74
-
75
- // The tagged union or sum type for the algebraic type `FunctionVisibility`.
76
- export const FunctionVisibility = __t.enum('FunctionVisibility', {
77
- Private: __t.unit(),
78
- ClientCallable: __t.unit(),
79
- });
80
- export type FunctionVisibility = __Infer<typeof FunctionVisibility>;
81
-
82
- export const HttpHeaderPair = __t.object('HttpHeaderPair', {
83
- name: __t.string(),
84
- value: __t.byteArray(),
85
- });
86
- export type HttpHeaderPair = __Infer<typeof HttpHeaderPair>;
87
-
88
- export const HttpHeaders = __t.object('HttpHeaders', {
89
- get entries() {
90
- return __t.array(HttpHeaderPair);
91
- },
92
- });
93
- export type HttpHeaders = __Infer<typeof HttpHeaders>;
94
-
95
- // The tagged union or sum type for the algebraic type `HttpMethod`.
96
- export const HttpMethod = __t.enum('HttpMethod', {
97
- Get: __t.unit(),
98
- Head: __t.unit(),
99
- Post: __t.unit(),
100
- Put: __t.unit(),
101
- Delete: __t.unit(),
102
- Connect: __t.unit(),
103
- Options: __t.unit(),
104
- Trace: __t.unit(),
105
- Patch: __t.unit(),
106
- Extension: __t.string(),
107
- });
108
- export type HttpMethod = __Infer<typeof HttpMethod>;
109
-
110
- export const HttpRequest = __t.object('HttpRequest', {
111
- get method() {
112
- return HttpMethod;
113
- },
114
- get headers() {
115
- return HttpHeaders;
116
- },
117
- timeout: __t.option(__t.timeDuration()),
118
- uri: __t.string(),
119
- get version() {
120
- return HttpVersion;
121
- },
122
- });
123
- export type HttpRequest = __Infer<typeof HttpRequest>;
124
-
125
- export const HttpResponse = __t.object('HttpResponse', {
126
- get headers() {
127
- return HttpHeaders;
128
- },
129
- get version() {
130
- return HttpVersion;
131
- },
132
- code: __t.u16(),
133
- });
134
- export type HttpResponse = __Infer<typeof HttpResponse>;
135
-
136
- // The tagged union or sum type for the algebraic type `HttpVersion`.
137
- export const HttpVersion = __t.enum('HttpVersion', {
138
- Http09: __t.unit(),
139
- Http10: __t.unit(),
140
- Http11: __t.unit(),
141
- Http2: __t.unit(),
142
- Http3: __t.unit(),
143
- });
144
- export type HttpVersion = __Infer<typeof HttpVersion>;
145
-
146
- // The tagged union or sum type for the algebraic type `IndexType`.
147
- export const IndexType = __t.enum('IndexType', {
148
- BTree: __t.unit(),
149
- Hash: __t.unit(),
150
- });
151
- export type IndexType = __Infer<typeof IndexType>;
152
-
153
- // The tagged union or sum type for the algebraic type `Lifecycle`.
154
- export const Lifecycle = __t.enum('Lifecycle', {
155
- Init: __t.unit(),
156
- OnConnect: __t.unit(),
157
- OnDisconnect: __t.unit(),
158
- });
159
- export type Lifecycle = __Infer<typeof Lifecycle>;
160
-
161
- // The tagged union or sum type for the algebraic type `MethodOrAny`.
162
- export const MethodOrAny = __t.enum('MethodOrAny', {
163
- Any: __t.unit(),
164
- get Method() {
165
- return HttpMethod;
166
- },
167
- });
168
- export type MethodOrAny = __Infer<typeof MethodOrAny>;
169
-
170
- // The tagged union or sum type for the algebraic type `MiscModuleExport`.
171
- export const MiscModuleExport = __t.enum('MiscModuleExport', {
172
- get TypeAlias() {
173
- return TypeAlias;
174
- },
175
- });
176
- export type MiscModuleExport = __Infer<typeof MiscModuleExport>;
177
-
178
- export const NameMapping = __t.object('NameMapping', {
179
- sourceName: __t.string(),
180
- canonicalName: __t.string(),
181
- });
182
- export type NameMapping = __Infer<typeof NameMapping>;
183
-
184
- export const ProductType = __t.object('ProductType', {
185
- get elements() {
186
- return __t.array(ProductTypeElement);
187
- },
188
- });
189
- export type ProductType = __Infer<typeof ProductType>;
190
-
191
- export const ProductTypeElement = __t.object('ProductTypeElement', {
192
- name: __t.option(__t.string()),
193
- get algebraicType() {
194
- return AlgebraicType;
195
- },
196
- });
197
- export type ProductTypeElement = __Infer<typeof ProductTypeElement>;
198
-
199
- export const RawColumnDefV8 = __t.object('RawColumnDefV8', {
200
- colName: __t.string(),
201
- get colType() {
202
- return AlgebraicType;
203
- },
204
- });
205
- export type RawColumnDefV8 = __Infer<typeof RawColumnDefV8>;
206
-
207
- export const RawColumnDefaultValueV10 = __t.object('RawColumnDefaultValueV10', {
208
- colId: __t.u16(),
209
- value: __t.byteArray(),
210
- });
211
- export type RawColumnDefaultValueV10 = __Infer<typeof RawColumnDefaultValueV10>;
212
-
213
- export const RawColumnDefaultValueV9 = __t.object('RawColumnDefaultValueV9', {
214
- table: __t.string(),
215
- colId: __t.u16(),
216
- value: __t.byteArray(),
217
- });
218
- export type RawColumnDefaultValueV9 = __Infer<typeof RawColumnDefaultValueV9>;
219
-
220
- // The tagged union or sum type for the algebraic type `RawConstraintDataV9`.
221
- export const RawConstraintDataV9 = __t.enum('RawConstraintDataV9', {
222
- get Unique() {
223
- return RawUniqueConstraintDataV9;
224
- },
225
- });
226
- export type RawConstraintDataV9 = __Infer<typeof RawConstraintDataV9>;
227
-
228
- export const RawConstraintDefV10 = __t.object('RawConstraintDefV10', {
229
- sourceName: __t.option(__t.string()),
230
- get data() {
231
- return RawConstraintDataV9;
232
- },
233
- });
234
- export type RawConstraintDefV10 = __Infer<typeof RawConstraintDefV10>;
235
-
236
- export const RawConstraintDefV8 = __t.object('RawConstraintDefV8', {
237
- constraintName: __t.string(),
238
- constraints: __t.u8(),
239
- columns: __t.array(__t.u16()),
240
- });
241
- export type RawConstraintDefV8 = __Infer<typeof RawConstraintDefV8>;
242
-
243
- export const RawConstraintDefV9 = __t.object('RawConstraintDefV9', {
244
- name: __t.option(__t.string()),
245
- get data() {
246
- return RawConstraintDataV9;
247
- },
248
- });
249
- export type RawConstraintDefV9 = __Infer<typeof RawConstraintDefV9>;
250
-
251
- export const RawHttpHandlerDefV10 = __t.object('RawHttpHandlerDefV10', {
252
- sourceName: __t.string(),
253
- });
254
- export type RawHttpHandlerDefV10 = __Infer<typeof RawHttpHandlerDefV10>;
255
-
256
- export const RawHttpRouteDefV10 = __t.object('RawHttpRouteDefV10', {
257
- handlerFunction: __t.string(),
258
- get method() {
259
- return MethodOrAny;
260
- },
261
- path: __t.string(),
262
- });
263
- export type RawHttpRouteDefV10 = __Infer<typeof RawHttpRouteDefV10>;
264
-
265
- // The tagged union or sum type for the algebraic type `RawIndexAlgorithm`.
266
- export const RawIndexAlgorithm = __t.enum('RawIndexAlgorithm', {
267
- BTree: __t.array(__t.u16()),
268
- Hash: __t.array(__t.u16()),
269
- Direct: __t.u16(),
270
- });
271
- export type RawIndexAlgorithm = __Infer<typeof RawIndexAlgorithm>;
272
-
273
- export const RawIndexDefV10 = __t.object('RawIndexDefV10', {
274
- sourceName: __t.option(__t.string()),
275
- accessorName: __t.option(__t.string()),
276
- get algorithm() {
277
- return RawIndexAlgorithm;
278
- },
279
- });
280
- export type RawIndexDefV10 = __Infer<typeof RawIndexDefV10>;
281
-
282
- export const RawIndexDefV8 = __t.object('RawIndexDefV8', {
283
- indexName: __t.string(),
284
- isUnique: __t.bool(),
285
- get indexType() {
286
- return IndexType;
287
- },
288
- columns: __t.array(__t.u16()),
289
- });
290
- export type RawIndexDefV8 = __Infer<typeof RawIndexDefV8>;
291
-
292
- export const RawIndexDefV9 = __t.object('RawIndexDefV9', {
293
- name: __t.option(__t.string()),
294
- accessorName: __t.option(__t.string()),
295
- get algorithm() {
296
- return RawIndexAlgorithm;
297
- },
298
- });
299
- export type RawIndexDefV9 = __Infer<typeof RawIndexDefV9>;
300
-
301
- export const RawLifeCycleReducerDefV10 = __t.object(
302
- 'RawLifeCycleReducerDefV10',
303
- {
304
- get lifecycleSpec() {
305
- return Lifecycle;
306
- },
307
- functionName: __t.string(),
308
- }
309
- );
310
- export type RawLifeCycleReducerDefV10 = __Infer<
311
- typeof RawLifeCycleReducerDefV10
312
- >;
313
-
314
- // The tagged union or sum type for the algebraic type `RawMiscModuleExportV9`.
315
- export const RawMiscModuleExportV9 = __t.enum('RawMiscModuleExportV9', {
316
- get ColumnDefaultValue() {
317
- return RawColumnDefaultValueV9;
318
- },
319
- get Procedure() {
320
- return RawProcedureDefV9;
321
- },
322
- get View() {
323
- return RawViewDefV9;
324
- },
325
- });
326
- export type RawMiscModuleExportV9 = __Infer<typeof RawMiscModuleExportV9>;
327
-
328
- // The tagged union or sum type for the algebraic type `RawModuleDef`.
329
- export const RawModuleDef = __t.enum('RawModuleDef', {
330
- get V8BackCompat() {
331
- return RawModuleDefV8;
332
- },
333
- get V9() {
334
- return RawModuleDefV9;
335
- },
336
- get V10() {
337
- return RawModuleDefV10;
338
- },
339
- });
340
- export type RawModuleDef = __Infer<typeof RawModuleDef>;
341
-
342
- export const RawModuleDefV10 = __t.object('RawModuleDefV10', {
343
- get sections() {
344
- return __t.array(RawModuleDefV10Section);
345
- },
346
- });
347
- export type RawModuleDefV10 = __Infer<typeof RawModuleDefV10>;
348
-
349
- // The tagged union or sum type for the algebraic type `RawModuleDefV10Section`.
350
- export const RawModuleDefV10Section = __t.enum('RawModuleDefV10Section', {
351
- get Typespace() {
352
- return Typespace;
353
- },
354
- get Types() {
355
- return __t.array(RawTypeDefV10);
356
- },
357
- get Tables() {
358
- return __t.array(RawTableDefV10);
359
- },
360
- get Reducers() {
361
- return __t.array(RawReducerDefV10);
362
- },
363
- get Procedures() {
364
- return __t.array(RawProcedureDefV10);
365
- },
366
- get Views() {
367
- return __t.array(RawViewDefV10);
368
- },
369
- get Schedules() {
370
- return __t.array(RawScheduleDefV10);
371
- },
372
- get LifeCycleReducers() {
373
- return __t.array(RawLifeCycleReducerDefV10);
374
- },
375
- get RowLevelSecurity() {
376
- return __t.array(RawRowLevelSecurityDefV9);
377
- },
378
- get CaseConversionPolicy() {
379
- return CaseConversionPolicy;
380
- },
381
- get ExplicitNames() {
382
- return ExplicitNames;
383
- },
384
- get HttpHandlers() {
385
- return __t.array(RawHttpHandlerDefV10);
386
- },
387
- get HttpRoutes() {
388
- return __t.array(RawHttpRouteDefV10);
389
- },
390
- get ViewPrimaryKeys() {
391
- return __t.array(RawViewPrimaryKeyDefV10);
392
- },
393
- });
394
- export type RawModuleDefV10Section = __Infer<typeof RawModuleDefV10Section>;
395
-
396
- export const RawModuleDefV8 = __t.object('RawModuleDefV8', {
397
- get typespace() {
398
- return Typespace;
399
- },
400
- get tables() {
401
- return __t.array(TableDesc);
402
- },
403
- get reducers() {
404
- return __t.array(ReducerDef);
405
- },
406
- get miscExports() {
407
- return __t.array(MiscModuleExport);
408
- },
409
- });
410
- export type RawModuleDefV8 = __Infer<typeof RawModuleDefV8>;
411
-
412
- export const RawModuleDefV9 = __t.object('RawModuleDefV9', {
413
- get typespace() {
414
- return Typespace;
415
- },
416
- get tables() {
417
- return __t.array(RawTableDefV9);
418
- },
419
- get reducers() {
420
- return __t.array(RawReducerDefV9);
421
- },
422
- get types() {
423
- return __t.array(RawTypeDefV9);
424
- },
425
- get miscExports() {
426
- return __t.array(RawMiscModuleExportV9);
427
- },
428
- get rowLevelSecurity() {
429
- return __t.array(RawRowLevelSecurityDefV9);
430
- },
431
- });
432
- export type RawModuleDefV9 = __Infer<typeof RawModuleDefV9>;
433
-
434
- export const RawProcedureDefV10 = __t.object('RawProcedureDefV10', {
435
- sourceName: __t.string(),
436
- get params() {
437
- return ProductType;
438
- },
439
- get returnType() {
440
- return AlgebraicType;
441
- },
442
- get visibility() {
443
- return FunctionVisibility;
444
- },
445
- });
446
- export type RawProcedureDefV10 = __Infer<typeof RawProcedureDefV10>;
447
-
448
- export const RawProcedureDefV9 = __t.object('RawProcedureDefV9', {
449
- name: __t.string(),
450
- get params() {
451
- return ProductType;
452
- },
453
- get returnType() {
454
- return AlgebraicType;
455
- },
456
- });
457
- export type RawProcedureDefV9 = __Infer<typeof RawProcedureDefV9>;
458
-
459
- export const RawReducerDefV10 = __t.object('RawReducerDefV10', {
460
- sourceName: __t.string(),
461
- get params() {
462
- return ProductType;
463
- },
464
- get visibility() {
465
- return FunctionVisibility;
466
- },
467
- get okReturnType() {
468
- return AlgebraicType;
469
- },
470
- get errReturnType() {
471
- return AlgebraicType;
472
- },
473
- });
474
- export type RawReducerDefV10 = __Infer<typeof RawReducerDefV10>;
475
-
476
- export const RawReducerDefV9 = __t.object('RawReducerDefV9', {
477
- name: __t.string(),
478
- get params() {
479
- return ProductType;
480
- },
481
- get lifecycle() {
482
- return __t.option(Lifecycle);
483
- },
484
- });
485
- export type RawReducerDefV9 = __Infer<typeof RawReducerDefV9>;
486
-
487
- export const RawRowLevelSecurityDefV9 = __t.object('RawRowLevelSecurityDefV9', {
488
- sql: __t.string(),
489
- });
490
- export type RawRowLevelSecurityDefV9 = __Infer<typeof RawRowLevelSecurityDefV9>;
491
-
492
- export const RawScheduleDefV10 = __t.object('RawScheduleDefV10', {
493
- sourceName: __t.option(__t.string()),
494
- tableName: __t.string(),
495
- scheduleAtCol: __t.u16(),
496
- functionName: __t.string(),
497
- });
498
- export type RawScheduleDefV10 = __Infer<typeof RawScheduleDefV10>;
499
-
500
- export const RawScheduleDefV9 = __t.object('RawScheduleDefV9', {
501
- name: __t.option(__t.string()),
502
- reducerName: __t.string(),
503
- scheduledAtColumn: __t.u16(),
504
- });
505
- export type RawScheduleDefV9 = __Infer<typeof RawScheduleDefV9>;
506
-
507
- export const RawScopedTypeNameV10 = __t.object('RawScopedTypeNameV10', {
508
- scope: __t.array(__t.string()),
509
- sourceName: __t.string(),
510
- });
511
- export type RawScopedTypeNameV10 = __Infer<typeof RawScopedTypeNameV10>;
512
-
513
- export const RawScopedTypeNameV9 = __t.object('RawScopedTypeNameV9', {
514
- scope: __t.array(__t.string()),
515
- name: __t.string(),
516
- });
517
- export type RawScopedTypeNameV9 = __Infer<typeof RawScopedTypeNameV9>;
518
-
519
- export const RawSequenceDefV10 = __t.object('RawSequenceDefV10', {
520
- sourceName: __t.option(__t.string()),
521
- column: __t.u16(),
522
- start: __t.option(__t.i128()),
523
- minValue: __t.option(__t.i128()),
524
- maxValue: __t.option(__t.i128()),
525
- increment: __t.i128(),
526
- });
527
- export type RawSequenceDefV10 = __Infer<typeof RawSequenceDefV10>;
528
-
529
- export const RawSequenceDefV8 = __t.object('RawSequenceDefV8', {
530
- sequenceName: __t.string(),
531
- colPos: __t.u16(),
532
- increment: __t.i128(),
533
- start: __t.option(__t.i128()),
534
- minValue: __t.option(__t.i128()),
535
- maxValue: __t.option(__t.i128()),
536
- allocated: __t.i128(),
537
- });
538
- export type RawSequenceDefV8 = __Infer<typeof RawSequenceDefV8>;
539
-
540
- export const RawSequenceDefV9 = __t.object('RawSequenceDefV9', {
541
- name: __t.option(__t.string()),
542
- column: __t.u16(),
543
- start: __t.option(__t.i128()),
544
- minValue: __t.option(__t.i128()),
545
- maxValue: __t.option(__t.i128()),
546
- increment: __t.i128(),
547
- });
548
- export type RawSequenceDefV9 = __Infer<typeof RawSequenceDefV9>;
549
-
550
- export const RawTableDefV10 = __t.object('RawTableDefV10', {
551
- sourceName: __t.string(),
552
- productTypeRef: __t.u32(),
553
- primaryKey: __t.array(__t.u16()),
554
- get indexes() {
555
- return __t.array(RawIndexDefV10);
556
- },
557
- get constraints() {
558
- return __t.array(RawConstraintDefV10);
559
- },
560
- get sequences() {
561
- return __t.array(RawSequenceDefV10);
562
- },
563
- get tableType() {
564
- return TableType;
565
- },
566
- get tableAccess() {
567
- return TableAccess;
568
- },
569
- get defaultValues() {
570
- return __t.array(RawColumnDefaultValueV10);
571
- },
572
- isEvent: __t.bool(),
573
- });
574
- export type RawTableDefV10 = __Infer<typeof RawTableDefV10>;
575
-
576
- export const RawTableDefV8 = __t.object('RawTableDefV8', {
577
- tableName: __t.string(),
578
- get columns() {
579
- return __t.array(RawColumnDefV8);
580
- },
581
- get indexes() {
582
- return __t.array(RawIndexDefV8);
583
- },
584
- get constraints() {
585
- return __t.array(RawConstraintDefV8);
586
- },
587
- get sequences() {
588
- return __t.array(RawSequenceDefV8);
589
- },
590
- tableType: __t.string(),
591
- tableAccess: __t.string(),
592
- scheduled: __t.option(__t.string()),
593
- });
594
- export type RawTableDefV8 = __Infer<typeof RawTableDefV8>;
595
-
596
- export const RawTableDefV9 = __t.object('RawTableDefV9', {
597
- name: __t.string(),
598
- productTypeRef: __t.u32(),
599
- primaryKey: __t.array(__t.u16()),
600
- get indexes() {
601
- return __t.array(RawIndexDefV9);
602
- },
603
- get constraints() {
604
- return __t.array(RawConstraintDefV9);
605
- },
606
- get sequences() {
607
- return __t.array(RawSequenceDefV9);
608
- },
609
- get schedule() {
610
- return __t.option(RawScheduleDefV9);
611
- },
612
- get tableType() {
613
- return TableType;
614
- },
615
- get tableAccess() {
616
- return TableAccess;
617
- },
618
- });
619
- export type RawTableDefV9 = __Infer<typeof RawTableDefV9>;
620
-
621
- export const RawTypeDefV10 = __t.object('RawTypeDefV10', {
622
- get sourceName() {
623
- return RawScopedTypeNameV10;
624
- },
625
- ty: __t.u32(),
626
- customOrdering: __t.bool(),
627
- });
628
- export type RawTypeDefV10 = __Infer<typeof RawTypeDefV10>;
629
-
630
- export const RawTypeDefV9 = __t.object('RawTypeDefV9', {
631
- get name() {
632
- return RawScopedTypeNameV9;
633
- },
634
- ty: __t.u32(),
635
- customOrdering: __t.bool(),
636
- });
637
- export type RawTypeDefV9 = __Infer<typeof RawTypeDefV9>;
638
-
639
- export const RawUniqueConstraintDataV9 = __t.object(
640
- 'RawUniqueConstraintDataV9',
641
- {
642
- columns: __t.array(__t.u16()),
643
- }
644
- );
645
- export type RawUniqueConstraintDataV9 = __Infer<
646
- typeof RawUniqueConstraintDataV9
647
- >;
648
-
649
- export const RawViewDefV10 = __t.object('RawViewDefV10', {
650
- sourceName: __t.string(),
651
- index: __t.u32(),
652
- isPublic: __t.bool(),
653
- isAnonymous: __t.bool(),
654
- get params() {
655
- return ProductType;
656
- },
657
- get returnType() {
658
- return AlgebraicType;
659
- },
660
- });
661
- export type RawViewDefV10 = __Infer<typeof RawViewDefV10>;
662
-
663
- export const RawViewDefV9 = __t.object('RawViewDefV9', {
664
- name: __t.string(),
665
- index: __t.u32(),
666
- isPublic: __t.bool(),
667
- isAnonymous: __t.bool(),
668
- get params() {
669
- return ProductType;
670
- },
671
- get returnType() {
672
- return AlgebraicType;
673
- },
674
- });
675
- export type RawViewDefV9 = __Infer<typeof RawViewDefV9>;
676
-
677
- export const RawViewPrimaryKeyDefV10 = __t.object('RawViewPrimaryKeyDefV10', {
678
- viewSourceName: __t.string(),
679
- columns: __t.array(__t.string()),
680
- });
681
- export type RawViewPrimaryKeyDefV10 = __Infer<typeof RawViewPrimaryKeyDefV10>;
682
-
683
- export const ReducerDef = __t.object('ReducerDef', {
684
- name: __t.string(),
685
- get args() {
686
- return __t.array(ProductTypeElement);
687
- },
688
- });
689
- export type ReducerDef = __Infer<typeof ReducerDef>;
690
-
691
- export const SumType = __t.object('SumType', {
692
- get variants() {
693
- return __t.array(SumTypeVariant);
694
- },
695
- });
696
- export type SumType = __Infer<typeof SumType>;
697
-
698
- export const SumTypeVariant = __t.object('SumTypeVariant', {
699
- name: __t.option(__t.string()),
700
- get algebraicType() {
701
- return AlgebraicType;
702
- },
703
- });
704
- export type SumTypeVariant = __Infer<typeof SumTypeVariant>;
705
-
706
- // The tagged union or sum type for the algebraic type `TableAccess`.
707
- export const TableAccess = __t.enum('TableAccess', {
708
- Public: __t.unit(),
709
- Private: __t.unit(),
710
- });
711
- export type TableAccess = __Infer<typeof TableAccess>;
712
-
713
- export const TableDesc = __t.object('TableDesc', {
714
- get schema() {
715
- return RawTableDefV8;
716
- },
717
- data: __t.u32(),
718
- });
719
- export type TableDesc = __Infer<typeof TableDesc>;
720
-
721
- // The tagged union or sum type for the algebraic type `TableType`.
722
- export const TableType = __t.enum('TableType', {
723
- System: __t.unit(),
724
- User: __t.unit(),
725
- });
726
- export type TableType = __Infer<typeof TableType>;
727
-
728
- export const TypeAlias = __t.object('TypeAlias', {
729
- name: __t.string(),
730
- ty: __t.u32(),
731
- });
732
- export type TypeAlias = __Infer<typeof TypeAlias>;
733
-
734
- export const Typespace = __t.object('Typespace', {
735
- get types() {
736
- return __t.array(AlgebraicType);
737
- },
738
- });
739
- export type Typespace = __Infer<typeof Typespace>;
740
-
741
- // The tagged union or sum type for the algebraic type `ViewResultHeader`.
742
- export const ViewResultHeader = __t.enum('ViewResultHeader', {
743
- RowData: __t.unit(),
744
- RawSql: __t.string(),
745
- });
746
- export type ViewResultHeader = __Infer<typeof ViewResultHeader>;
1
+ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2
+ // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
3
+
4
+ /* eslint-disable */
5
+ /* tslint:disable */
6
+ import {
7
+ TypeBuilder as __TypeBuilder,
8
+ t as __t,
9
+ type AlgebraicTypeType as __AlgebraicTypeType,
10
+ type Infer as __Infer,
11
+ } from '../../lib/type_builders';
12
+
13
+ // The tagged union or sum type for the algebraic type `AlgebraicType`.
14
+ export const AlgebraicType: __TypeBuilder<
15
+ __AlgebraicTypeType,
16
+ __AlgebraicTypeType
17
+ > = __t.enum('AlgebraicType', {
18
+ Ref: __t.u32(),
19
+ get Sum() {
20
+ return SumType;
21
+ },
22
+ get Product() {
23
+ return ProductType;
24
+ },
25
+ get Array() {
26
+ return AlgebraicType;
27
+ },
28
+ String: __t.unit(),
29
+ Bool: __t.unit(),
30
+ I8: __t.unit(),
31
+ U8: __t.unit(),
32
+ I16: __t.unit(),
33
+ U16: __t.unit(),
34
+ I32: __t.unit(),
35
+ U32: __t.unit(),
36
+ I64: __t.unit(),
37
+ U64: __t.unit(),
38
+ I128: __t.unit(),
39
+ U128: __t.unit(),
40
+ I256: __t.unit(),
41
+ U256: __t.unit(),
42
+ F32: __t.unit(),
43
+ F64: __t.unit(),
44
+ });
45
+ export type AlgebraicType = __Infer<typeof AlgebraicType>;
46
+
47
+ // The tagged union or sum type for the algebraic type `CaseConversionPolicy`.
48
+ export const CaseConversionPolicy = __t.enum('CaseConversionPolicy', {
49
+ None: __t.unit(),
50
+ SnakeCase: __t.unit(),
51
+ });
52
+ export type CaseConversionPolicy = __Infer<typeof CaseConversionPolicy>;
53
+
54
+ // The tagged union or sum type for the algebraic type `ExplicitNameEntry`.
55
+ export const ExplicitNameEntry = __t.enum('ExplicitNameEntry', {
56
+ get Table() {
57
+ return NameMapping;
58
+ },
59
+ get Function() {
60
+ return NameMapping;
61
+ },
62
+ get Index() {
63
+ return NameMapping;
64
+ },
65
+ });
66
+ export type ExplicitNameEntry = __Infer<typeof ExplicitNameEntry>;
67
+
68
+ export const ExplicitNames = __t.object('ExplicitNames', {
69
+ get entries() {
70
+ return __t.array(ExplicitNameEntry);
71
+ },
72
+ });
73
+ export type ExplicitNames = __Infer<typeof ExplicitNames>;
74
+
75
+ // The tagged union or sum type for the algebraic type `FunctionVisibility`.
76
+ export const FunctionVisibility = __t.enum('FunctionVisibility', {
77
+ Private: __t.unit(),
78
+ ClientCallable: __t.unit(),
79
+ });
80
+ export type FunctionVisibility = __Infer<typeof FunctionVisibility>;
81
+
82
+ export const HttpHeaderPair = __t.object('HttpHeaderPair', {
83
+ name: __t.string(),
84
+ value: __t.byteArray(),
85
+ });
86
+ export type HttpHeaderPair = __Infer<typeof HttpHeaderPair>;
87
+
88
+ export const HttpHeaders = __t.object('HttpHeaders', {
89
+ get entries() {
90
+ return __t.array(HttpHeaderPair);
91
+ },
92
+ });
93
+ export type HttpHeaders = __Infer<typeof HttpHeaders>;
94
+
95
+ // The tagged union or sum type for the algebraic type `HttpMethod`.
96
+ export const HttpMethod = __t.enum('HttpMethod', {
97
+ Get: __t.unit(),
98
+ Head: __t.unit(),
99
+ Post: __t.unit(),
100
+ Put: __t.unit(),
101
+ Delete: __t.unit(),
102
+ Connect: __t.unit(),
103
+ Options: __t.unit(),
104
+ Trace: __t.unit(),
105
+ Patch: __t.unit(),
106
+ Extension: __t.string(),
107
+ });
108
+ export type HttpMethod = __Infer<typeof HttpMethod>;
109
+
110
+ export const HttpRequest = __t.object('HttpRequest', {
111
+ get method() {
112
+ return HttpMethod;
113
+ },
114
+ get headers() {
115
+ return HttpHeaders;
116
+ },
117
+ timeout: __t.option(__t.timeDuration()),
118
+ uri: __t.string(),
119
+ get version() {
120
+ return HttpVersion;
121
+ },
122
+ });
123
+ export type HttpRequest = __Infer<typeof HttpRequest>;
124
+
125
+ export const HttpResponse = __t.object('HttpResponse', {
126
+ get headers() {
127
+ return HttpHeaders;
128
+ },
129
+ get version() {
130
+ return HttpVersion;
131
+ },
132
+ code: __t.u16(),
133
+ });
134
+ export type HttpResponse = __Infer<typeof HttpResponse>;
135
+
136
+ // The tagged union or sum type for the algebraic type `HttpVersion`.
137
+ export const HttpVersion = __t.enum('HttpVersion', {
138
+ Http09: __t.unit(),
139
+ Http10: __t.unit(),
140
+ Http11: __t.unit(),
141
+ Http2: __t.unit(),
142
+ Http3: __t.unit(),
143
+ });
144
+ export type HttpVersion = __Infer<typeof HttpVersion>;
145
+
146
+ // The tagged union or sum type for the algebraic type `IndexType`.
147
+ export const IndexType = __t.enum('IndexType', {
148
+ BTree: __t.unit(),
149
+ Hash: __t.unit(),
150
+ });
151
+ export type IndexType = __Infer<typeof IndexType>;
152
+
153
+ // The tagged union or sum type for the algebraic type `Lifecycle`.
154
+ export const Lifecycle = __t.enum('Lifecycle', {
155
+ Init: __t.unit(),
156
+ OnConnect: __t.unit(),
157
+ OnDisconnect: __t.unit(),
158
+ });
159
+ export type Lifecycle = __Infer<typeof Lifecycle>;
160
+
161
+ // The tagged union or sum type for the algebraic type `MethodOrAny`.
162
+ export const MethodOrAny = __t.enum('MethodOrAny', {
163
+ Any: __t.unit(),
164
+ get Method() {
165
+ return HttpMethod;
166
+ },
167
+ });
168
+ export type MethodOrAny = __Infer<typeof MethodOrAny>;
169
+
170
+ // The tagged union or sum type for the algebraic type `MiscModuleExport`.
171
+ export const MiscModuleExport = __t.enum('MiscModuleExport', {
172
+ get TypeAlias() {
173
+ return TypeAlias;
174
+ },
175
+ });
176
+ export type MiscModuleExport = __Infer<typeof MiscModuleExport>;
177
+
178
+ export const NameMapping = __t.object('NameMapping', {
179
+ sourceName: __t.string(),
180
+ canonicalName: __t.string(),
181
+ });
182
+ export type NameMapping = __Infer<typeof NameMapping>;
183
+
184
+ export const ProductType = __t.object('ProductType', {
185
+ get elements() {
186
+ return __t.array(ProductTypeElement);
187
+ },
188
+ });
189
+ export type ProductType = __Infer<typeof ProductType>;
190
+
191
+ export const ProductTypeElement = __t.object('ProductTypeElement', {
192
+ name: __t.option(__t.string()),
193
+ get algebraicType() {
194
+ return AlgebraicType;
195
+ },
196
+ });
197
+ export type ProductTypeElement = __Infer<typeof ProductTypeElement>;
198
+
199
+ export const RawColumnDefV8 = __t.object('RawColumnDefV8', {
200
+ colName: __t.string(),
201
+ get colType() {
202
+ return AlgebraicType;
203
+ },
204
+ });
205
+ export type RawColumnDefV8 = __Infer<typeof RawColumnDefV8>;
206
+
207
+ export const RawColumnDefaultValueV10 = __t.object('RawColumnDefaultValueV10', {
208
+ colId: __t.u16(),
209
+ value: __t.byteArray(),
210
+ });
211
+ export type RawColumnDefaultValueV10 = __Infer<typeof RawColumnDefaultValueV10>;
212
+
213
+ export const RawColumnDefaultValueV9 = __t.object('RawColumnDefaultValueV9', {
214
+ table: __t.string(),
215
+ colId: __t.u16(),
216
+ value: __t.byteArray(),
217
+ });
218
+ export type RawColumnDefaultValueV9 = __Infer<typeof RawColumnDefaultValueV9>;
219
+
220
+ // The tagged union or sum type for the algebraic type `RawConstraintDataV9`.
221
+ export const RawConstraintDataV9 = __t.enum('RawConstraintDataV9', {
222
+ get Unique() {
223
+ return RawUniqueConstraintDataV9;
224
+ },
225
+ });
226
+ export type RawConstraintDataV9 = __Infer<typeof RawConstraintDataV9>;
227
+
228
+ export const RawConstraintDefV10 = __t.object('RawConstraintDefV10', {
229
+ sourceName: __t.option(__t.string()),
230
+ get data() {
231
+ return RawConstraintDataV9;
232
+ },
233
+ });
234
+ export type RawConstraintDefV10 = __Infer<typeof RawConstraintDefV10>;
235
+
236
+ export const RawConstraintDefV8 = __t.object('RawConstraintDefV8', {
237
+ constraintName: __t.string(),
238
+ constraints: __t.u8(),
239
+ columns: __t.array(__t.u16()),
240
+ });
241
+ export type RawConstraintDefV8 = __Infer<typeof RawConstraintDefV8>;
242
+
243
+ export const RawConstraintDefV9 = __t.object('RawConstraintDefV9', {
244
+ name: __t.option(__t.string()),
245
+ get data() {
246
+ return RawConstraintDataV9;
247
+ },
248
+ });
249
+ export type RawConstraintDefV9 = __Infer<typeof RawConstraintDefV9>;
250
+
251
+ export const RawHttpHandlerDefV10 = __t.object('RawHttpHandlerDefV10', {
252
+ sourceName: __t.string(),
253
+ });
254
+ export type RawHttpHandlerDefV10 = __Infer<typeof RawHttpHandlerDefV10>;
255
+
256
+ export const RawHttpRouteDefV10 = __t.object('RawHttpRouteDefV10', {
257
+ handlerFunction: __t.string(),
258
+ get method() {
259
+ return MethodOrAny;
260
+ },
261
+ path: __t.string(),
262
+ });
263
+ export type RawHttpRouteDefV10 = __Infer<typeof RawHttpRouteDefV10>;
264
+
265
+ // The tagged union or sum type for the algebraic type `RawIndexAlgorithm`.
266
+ export const RawIndexAlgorithm = __t.enum('RawIndexAlgorithm', {
267
+ BTree: __t.array(__t.u16()),
268
+ Hash: __t.array(__t.u16()),
269
+ Direct: __t.u16(),
270
+ });
271
+ export type RawIndexAlgorithm = __Infer<typeof RawIndexAlgorithm>;
272
+
273
+ export const RawIndexDefV10 = __t.object('RawIndexDefV10', {
274
+ sourceName: __t.option(__t.string()),
275
+ accessorName: __t.option(__t.string()),
276
+ get algorithm() {
277
+ return RawIndexAlgorithm;
278
+ },
279
+ });
280
+ export type RawIndexDefV10 = __Infer<typeof RawIndexDefV10>;
281
+
282
+ export const RawIndexDefV8 = __t.object('RawIndexDefV8', {
283
+ indexName: __t.string(),
284
+ isUnique: __t.bool(),
285
+ get indexType() {
286
+ return IndexType;
287
+ },
288
+ columns: __t.array(__t.u16()),
289
+ });
290
+ export type RawIndexDefV8 = __Infer<typeof RawIndexDefV8>;
291
+
292
+ export const RawIndexDefV9 = __t.object('RawIndexDefV9', {
293
+ name: __t.option(__t.string()),
294
+ accessorName: __t.option(__t.string()),
295
+ get algorithm() {
296
+ return RawIndexAlgorithm;
297
+ },
298
+ });
299
+ export type RawIndexDefV9 = __Infer<typeof RawIndexDefV9>;
300
+
301
+ export const RawLifeCycleReducerDefV10 = __t.object(
302
+ 'RawLifeCycleReducerDefV10',
303
+ {
304
+ get lifecycleSpec() {
305
+ return Lifecycle;
306
+ },
307
+ functionName: __t.string(),
308
+ }
309
+ );
310
+ export type RawLifeCycleReducerDefV10 = __Infer<
311
+ typeof RawLifeCycleReducerDefV10
312
+ >;
313
+
314
+ // The tagged union or sum type for the algebraic type `RawMiscModuleExportV9`.
315
+ export const RawMiscModuleExportV9 = __t.enum('RawMiscModuleExportV9', {
316
+ get ColumnDefaultValue() {
317
+ return RawColumnDefaultValueV9;
318
+ },
319
+ get Procedure() {
320
+ return RawProcedureDefV9;
321
+ },
322
+ get View() {
323
+ return RawViewDefV9;
324
+ },
325
+ });
326
+ export type RawMiscModuleExportV9 = __Infer<typeof RawMiscModuleExportV9>;
327
+
328
+ // The tagged union or sum type for the algebraic type `RawModuleDef`.
329
+ export const RawModuleDef = __t.enum('RawModuleDef', {
330
+ get V8BackCompat() {
331
+ return RawModuleDefV8;
332
+ },
333
+ get V9() {
334
+ return RawModuleDefV9;
335
+ },
336
+ get V10() {
337
+ return RawModuleDefV10;
338
+ },
339
+ });
340
+ export type RawModuleDef = __Infer<typeof RawModuleDef>;
341
+
342
+ export const RawModuleDefV10 = __t.object('RawModuleDefV10', {
343
+ get sections() {
344
+ return __t.array(RawModuleDefV10Section);
345
+ },
346
+ });
347
+ export type RawModuleDefV10 = __Infer<typeof RawModuleDefV10>;
348
+
349
+ // The tagged union or sum type for the algebraic type `RawModuleDefV10Section`.
350
+ export const RawModuleDefV10Section = __t.enum('RawModuleDefV10Section', {
351
+ get Typespace() {
352
+ return Typespace;
353
+ },
354
+ get Types() {
355
+ return __t.array(RawTypeDefV10);
356
+ },
357
+ get Tables() {
358
+ return __t.array(RawTableDefV10);
359
+ },
360
+ get Reducers() {
361
+ return __t.array(RawReducerDefV10);
362
+ },
363
+ get Procedures() {
364
+ return __t.array(RawProcedureDefV10);
365
+ },
366
+ get Views() {
367
+ return __t.array(RawViewDefV10);
368
+ },
369
+ get Schedules() {
370
+ return __t.array(RawScheduleDefV10);
371
+ },
372
+ get LifeCycleReducers() {
373
+ return __t.array(RawLifeCycleReducerDefV10);
374
+ },
375
+ get RowLevelSecurity() {
376
+ return __t.array(RawRowLevelSecurityDefV9);
377
+ },
378
+ get CaseConversionPolicy() {
379
+ return CaseConversionPolicy;
380
+ },
381
+ get ExplicitNames() {
382
+ return ExplicitNames;
383
+ },
384
+ get HttpHandlers() {
385
+ return __t.array(RawHttpHandlerDefV10);
386
+ },
387
+ get HttpRoutes() {
388
+ return __t.array(RawHttpRouteDefV10);
389
+ },
390
+ get ViewPrimaryKeys() {
391
+ return __t.array(RawViewPrimaryKeyDefV10);
392
+ },
393
+ });
394
+ export type RawModuleDefV10Section = __Infer<typeof RawModuleDefV10Section>;
395
+
396
+ export const RawModuleDefV8 = __t.object('RawModuleDefV8', {
397
+ get typespace() {
398
+ return Typespace;
399
+ },
400
+ get tables() {
401
+ return __t.array(TableDesc);
402
+ },
403
+ get reducers() {
404
+ return __t.array(ReducerDef);
405
+ },
406
+ get miscExports() {
407
+ return __t.array(MiscModuleExport);
408
+ },
409
+ });
410
+ export type RawModuleDefV8 = __Infer<typeof RawModuleDefV8>;
411
+
412
+ export const RawModuleDefV9 = __t.object('RawModuleDefV9', {
413
+ get typespace() {
414
+ return Typespace;
415
+ },
416
+ get tables() {
417
+ return __t.array(RawTableDefV9);
418
+ },
419
+ get reducers() {
420
+ return __t.array(RawReducerDefV9);
421
+ },
422
+ get types() {
423
+ return __t.array(RawTypeDefV9);
424
+ },
425
+ get miscExports() {
426
+ return __t.array(RawMiscModuleExportV9);
427
+ },
428
+ get rowLevelSecurity() {
429
+ return __t.array(RawRowLevelSecurityDefV9);
430
+ },
431
+ });
432
+ export type RawModuleDefV9 = __Infer<typeof RawModuleDefV9>;
433
+
434
+ export const RawProcedureDefV10 = __t.object('RawProcedureDefV10', {
435
+ sourceName: __t.string(),
436
+ get params() {
437
+ return ProductType;
438
+ },
439
+ get returnType() {
440
+ return AlgebraicType;
441
+ },
442
+ get visibility() {
443
+ return FunctionVisibility;
444
+ },
445
+ });
446
+ export type RawProcedureDefV10 = __Infer<typeof RawProcedureDefV10>;
447
+
448
+ export const RawProcedureDefV9 = __t.object('RawProcedureDefV9', {
449
+ name: __t.string(),
450
+ get params() {
451
+ return ProductType;
452
+ },
453
+ get returnType() {
454
+ return AlgebraicType;
455
+ },
456
+ });
457
+ export type RawProcedureDefV9 = __Infer<typeof RawProcedureDefV9>;
458
+
459
+ export const RawReducerDefV10 = __t.object('RawReducerDefV10', {
460
+ sourceName: __t.string(),
461
+ get params() {
462
+ return ProductType;
463
+ },
464
+ get visibility() {
465
+ return FunctionVisibility;
466
+ },
467
+ get okReturnType() {
468
+ return AlgebraicType;
469
+ },
470
+ get errReturnType() {
471
+ return AlgebraicType;
472
+ },
473
+ });
474
+ export type RawReducerDefV10 = __Infer<typeof RawReducerDefV10>;
475
+
476
+ export const RawReducerDefV9 = __t.object('RawReducerDefV9', {
477
+ name: __t.string(),
478
+ get params() {
479
+ return ProductType;
480
+ },
481
+ get lifecycle() {
482
+ return __t.option(Lifecycle);
483
+ },
484
+ });
485
+ export type RawReducerDefV9 = __Infer<typeof RawReducerDefV9>;
486
+
487
+ export const RawRowLevelSecurityDefV9 = __t.object('RawRowLevelSecurityDefV9', {
488
+ sql: __t.string(),
489
+ });
490
+ export type RawRowLevelSecurityDefV9 = __Infer<typeof RawRowLevelSecurityDefV9>;
491
+
492
+ export const RawScheduleDefV10 = __t.object('RawScheduleDefV10', {
493
+ sourceName: __t.option(__t.string()),
494
+ tableName: __t.string(),
495
+ scheduleAtCol: __t.u16(),
496
+ functionName: __t.string(),
497
+ });
498
+ export type RawScheduleDefV10 = __Infer<typeof RawScheduleDefV10>;
499
+
500
+ export const RawScheduleDefV9 = __t.object('RawScheduleDefV9', {
501
+ name: __t.option(__t.string()),
502
+ reducerName: __t.string(),
503
+ scheduledAtColumn: __t.u16(),
504
+ });
505
+ export type RawScheduleDefV9 = __Infer<typeof RawScheduleDefV9>;
506
+
507
+ export const RawScopedTypeNameV10 = __t.object('RawScopedTypeNameV10', {
508
+ scope: __t.array(__t.string()),
509
+ sourceName: __t.string(),
510
+ });
511
+ export type RawScopedTypeNameV10 = __Infer<typeof RawScopedTypeNameV10>;
512
+
513
+ export const RawScopedTypeNameV9 = __t.object('RawScopedTypeNameV9', {
514
+ scope: __t.array(__t.string()),
515
+ name: __t.string(),
516
+ });
517
+ export type RawScopedTypeNameV9 = __Infer<typeof RawScopedTypeNameV9>;
518
+
519
+ export const RawSequenceDefV10 = __t.object('RawSequenceDefV10', {
520
+ sourceName: __t.option(__t.string()),
521
+ column: __t.u16(),
522
+ start: __t.option(__t.i128()),
523
+ minValue: __t.option(__t.i128()),
524
+ maxValue: __t.option(__t.i128()),
525
+ increment: __t.i128(),
526
+ });
527
+ export type RawSequenceDefV10 = __Infer<typeof RawSequenceDefV10>;
528
+
529
+ export const RawSequenceDefV8 = __t.object('RawSequenceDefV8', {
530
+ sequenceName: __t.string(),
531
+ colPos: __t.u16(),
532
+ increment: __t.i128(),
533
+ start: __t.option(__t.i128()),
534
+ minValue: __t.option(__t.i128()),
535
+ maxValue: __t.option(__t.i128()),
536
+ allocated: __t.i128(),
537
+ });
538
+ export type RawSequenceDefV8 = __Infer<typeof RawSequenceDefV8>;
539
+
540
+ export const RawSequenceDefV9 = __t.object('RawSequenceDefV9', {
541
+ name: __t.option(__t.string()),
542
+ column: __t.u16(),
543
+ start: __t.option(__t.i128()),
544
+ minValue: __t.option(__t.i128()),
545
+ maxValue: __t.option(__t.i128()),
546
+ increment: __t.i128(),
547
+ });
548
+ export type RawSequenceDefV9 = __Infer<typeof RawSequenceDefV9>;
549
+
550
+ export const RawTableDefV10 = __t.object('RawTableDefV10', {
551
+ sourceName: __t.string(),
552
+ productTypeRef: __t.u32(),
553
+ primaryKey: __t.array(__t.u16()),
554
+ get indexes() {
555
+ return __t.array(RawIndexDefV10);
556
+ },
557
+ get constraints() {
558
+ return __t.array(RawConstraintDefV10);
559
+ },
560
+ get sequences() {
561
+ return __t.array(RawSequenceDefV10);
562
+ },
563
+ get tableType() {
564
+ return TableType;
565
+ },
566
+ get tableAccess() {
567
+ return TableAccess;
568
+ },
569
+ get defaultValues() {
570
+ return __t.array(RawColumnDefaultValueV10);
571
+ },
572
+ isEvent: __t.bool(),
573
+ });
574
+ export type RawTableDefV10 = __Infer<typeof RawTableDefV10>;
575
+
576
+ export const RawTableDefV8 = __t.object('RawTableDefV8', {
577
+ tableName: __t.string(),
578
+ get columns() {
579
+ return __t.array(RawColumnDefV8);
580
+ },
581
+ get indexes() {
582
+ return __t.array(RawIndexDefV8);
583
+ },
584
+ get constraints() {
585
+ return __t.array(RawConstraintDefV8);
586
+ },
587
+ get sequences() {
588
+ return __t.array(RawSequenceDefV8);
589
+ },
590
+ tableType: __t.string(),
591
+ tableAccess: __t.string(),
592
+ scheduled: __t.option(__t.string()),
593
+ });
594
+ export type RawTableDefV8 = __Infer<typeof RawTableDefV8>;
595
+
596
+ export const RawTableDefV9 = __t.object('RawTableDefV9', {
597
+ name: __t.string(),
598
+ productTypeRef: __t.u32(),
599
+ primaryKey: __t.array(__t.u16()),
600
+ get indexes() {
601
+ return __t.array(RawIndexDefV9);
602
+ },
603
+ get constraints() {
604
+ return __t.array(RawConstraintDefV9);
605
+ },
606
+ get sequences() {
607
+ return __t.array(RawSequenceDefV9);
608
+ },
609
+ get schedule() {
610
+ return __t.option(RawScheduleDefV9);
611
+ },
612
+ get tableType() {
613
+ return TableType;
614
+ },
615
+ get tableAccess() {
616
+ return TableAccess;
617
+ },
618
+ });
619
+ export type RawTableDefV9 = __Infer<typeof RawTableDefV9>;
620
+
621
+ export const RawTypeDefV10 = __t.object('RawTypeDefV10', {
622
+ get sourceName() {
623
+ return RawScopedTypeNameV10;
624
+ },
625
+ ty: __t.u32(),
626
+ customOrdering: __t.bool(),
627
+ });
628
+ export type RawTypeDefV10 = __Infer<typeof RawTypeDefV10>;
629
+
630
+ export const RawTypeDefV9 = __t.object('RawTypeDefV9', {
631
+ get name() {
632
+ return RawScopedTypeNameV9;
633
+ },
634
+ ty: __t.u32(),
635
+ customOrdering: __t.bool(),
636
+ });
637
+ export type RawTypeDefV9 = __Infer<typeof RawTypeDefV9>;
638
+
639
+ export const RawUniqueConstraintDataV9 = __t.object(
640
+ 'RawUniqueConstraintDataV9',
641
+ {
642
+ columns: __t.array(__t.u16()),
643
+ }
644
+ );
645
+ export type RawUniqueConstraintDataV9 = __Infer<
646
+ typeof RawUniqueConstraintDataV9
647
+ >;
648
+
649
+ export const RawViewDefV10 = __t.object('RawViewDefV10', {
650
+ sourceName: __t.string(),
651
+ index: __t.u32(),
652
+ isPublic: __t.bool(),
653
+ isAnonymous: __t.bool(),
654
+ get params() {
655
+ return ProductType;
656
+ },
657
+ get returnType() {
658
+ return AlgebraicType;
659
+ },
660
+ });
661
+ export type RawViewDefV10 = __Infer<typeof RawViewDefV10>;
662
+
663
+ export const RawViewDefV9 = __t.object('RawViewDefV9', {
664
+ name: __t.string(),
665
+ index: __t.u32(),
666
+ isPublic: __t.bool(),
667
+ isAnonymous: __t.bool(),
668
+ get params() {
669
+ return ProductType;
670
+ },
671
+ get returnType() {
672
+ return AlgebraicType;
673
+ },
674
+ });
675
+ export type RawViewDefV9 = __Infer<typeof RawViewDefV9>;
676
+
677
+ export const RawViewPrimaryKeyDefV10 = __t.object('RawViewPrimaryKeyDefV10', {
678
+ viewSourceName: __t.string(),
679
+ columns: __t.array(__t.string()),
680
+ });
681
+ export type RawViewPrimaryKeyDefV10 = __Infer<typeof RawViewPrimaryKeyDefV10>;
682
+
683
+ export const ReducerDef = __t.object('ReducerDef', {
684
+ name: __t.string(),
685
+ get args() {
686
+ return __t.array(ProductTypeElement);
687
+ },
688
+ });
689
+ export type ReducerDef = __Infer<typeof ReducerDef>;
690
+
691
+ export const SumType = __t.object('SumType', {
692
+ get variants() {
693
+ return __t.array(SumTypeVariant);
694
+ },
695
+ });
696
+ export type SumType = __Infer<typeof SumType>;
697
+
698
+ export const SumTypeVariant = __t.object('SumTypeVariant', {
699
+ name: __t.option(__t.string()),
700
+ get algebraicType() {
701
+ return AlgebraicType;
702
+ },
703
+ });
704
+ export type SumTypeVariant = __Infer<typeof SumTypeVariant>;
705
+
706
+ // The tagged union or sum type for the algebraic type `TableAccess`.
707
+ export const TableAccess = __t.enum('TableAccess', {
708
+ Public: __t.unit(),
709
+ Private: __t.unit(),
710
+ });
711
+ export type TableAccess = __Infer<typeof TableAccess>;
712
+
713
+ export const TableDesc = __t.object('TableDesc', {
714
+ get schema() {
715
+ return RawTableDefV8;
716
+ },
717
+ data: __t.u32(),
718
+ });
719
+ export type TableDesc = __Infer<typeof TableDesc>;
720
+
721
+ // The tagged union or sum type for the algebraic type `TableType`.
722
+ export const TableType = __t.enum('TableType', {
723
+ System: __t.unit(),
724
+ User: __t.unit(),
725
+ });
726
+ export type TableType = __Infer<typeof TableType>;
727
+
728
+ export const TypeAlias = __t.object('TypeAlias', {
729
+ name: __t.string(),
730
+ ty: __t.u32(),
731
+ });
732
+ export type TypeAlias = __Infer<typeof TypeAlias>;
733
+
734
+ export const Typespace = __t.object('Typespace', {
735
+ get types() {
736
+ return __t.array(AlgebraicType);
737
+ },
738
+ });
739
+ export type Typespace = __Infer<typeof Typespace>;
740
+
741
+ // The tagged union or sum type for the algebraic type `ViewResultHeader`.
742
+ export const ViewResultHeader = __t.enum('ViewResultHeader', {
743
+ RowData: __t.unit(),
744
+ RawSql: __t.string(),
745
+ });
746
+ export type ViewResultHeader = __Infer<typeof ViewResultHeader>;