@ganju/utils 0.0.14 → 0.0.16

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 (111) hide show
  1. package/dist/channelCustomer.d.ts +99 -0
  2. package/dist/channelCustomer.d.ts.map +1 -0
  3. package/dist/channelCustomer.js +533 -0
  4. package/dist/channelDebounce.d.ts +7 -0
  5. package/dist/channelDebounce.d.ts.map +1 -1
  6. package/dist/chunkOverlap.d.ts +2 -0
  7. package/dist/chunkOverlap.d.ts.map +1 -0
  8. package/dist/chunkOverlap.js +9 -0
  9. package/dist/chunking.d.ts.map +1 -1
  10. package/dist/chunking.js +24 -4
  11. package/dist/citations.d.ts +28 -0
  12. package/dist/citations.d.ts.map +1 -0
  13. package/dist/citations.js +111 -0
  14. package/dist/constants.d.ts +49 -0
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/constants.js +202 -17
  17. package/dist/data.d.ts +9 -0
  18. package/dist/data.d.ts.map +1 -0
  19. package/dist/data.js +78 -0
  20. package/dist/dataApi.d.ts +511 -0
  21. package/dist/dataApi.d.ts.map +1 -0
  22. package/dist/dataApi.js +355 -0
  23. package/dist/dataCompiler.d.ts +68 -0
  24. package/dist/dataCompiler.d.ts.map +1 -0
  25. package/dist/dataCompiler.js +726 -0
  26. package/dist/dataDdl.d.ts +29 -0
  27. package/dist/dataDdl.d.ts.map +1 -0
  28. package/dist/dataDdl.js +354 -0
  29. package/dist/dataEngine.d.ts +143 -0
  30. package/dist/dataEngine.d.ts.map +1 -0
  31. package/dist/dataEngine.js +2022 -0
  32. package/dist/dataIdentifiers.d.ts +8 -0
  33. package/dist/dataIdentifiers.d.ts.map +1 -0
  34. package/dist/dataIdentifiers.js +55 -0
  35. package/dist/dataImport.d.ts +77 -0
  36. package/dist/dataImport.d.ts.map +1 -0
  37. package/dist/dataImport.js +450 -0
  38. package/dist/dataRpc.d.ts +131 -0
  39. package/dist/dataRpc.d.ts.map +1 -0
  40. package/dist/dataRpc.js +2 -0
  41. package/dist/dataTypes.d.ts +157 -0
  42. package/dist/dataTypes.d.ts.map +1 -0
  43. package/dist/dataTypes.js +160 -0
  44. package/dist/index.d.ts +570 -36
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +72 -0
  47. package/dist/jsonSchemaToZodShape.d.ts +5 -1
  48. package/dist/jsonSchemaToZodShape.d.ts.map +1 -1
  49. package/dist/jsonSchemaToZodShape.js +21 -9
  50. package/dist/oauth.d.ts +14 -0
  51. package/dist/oauth.d.ts.map +1 -1
  52. package/dist/oauth.js +42 -2
  53. package/dist/pagination.d.ts +47 -0
  54. package/dist/pagination.d.ts.map +1 -0
  55. package/dist/pagination.js +160 -0
  56. package/dist/processQueueBatch.d.ts +6 -1
  57. package/dist/processQueueBatch.d.ts.map +1 -1
  58. package/dist/processQueueBatch.js +23 -10
  59. package/dist/queueFailure.d.ts +14 -0
  60. package/dist/queueFailure.d.ts.map +1 -0
  61. package/dist/queueFailure.js +43 -0
  62. package/dist/resourceRerank.d.ts +3 -2
  63. package/dist/resourceRerank.d.ts.map +1 -1
  64. package/dist/resourceRerank.js +8 -3
  65. package/dist/schema.d.ts +374 -29
  66. package/dist/schema.d.ts.map +1 -1
  67. package/dist/schema.js +290 -6
  68. package/dist/ssrf.d.ts +1 -0
  69. package/dist/ssrf.d.ts.map +1 -1
  70. package/dist/ssrf.js +48 -12
  71. package/dist/toolConfirmation.d.ts +48 -0
  72. package/dist/toolConfirmation.d.ts.map +1 -1
  73. package/dist/toolConfirmation.js +75 -1
  74. package/dist/toolCount.d.ts +13 -0
  75. package/dist/toolCount.d.ts.map +1 -0
  76. package/dist/toolCount.js +45 -0
  77. package/dist/toolLint.d.ts +1 -1
  78. package/dist/toolLint.d.ts.map +1 -1
  79. package/dist/toolLint.js +20 -0
  80. package/dist/untrustedContent.d.ts +135 -0
  81. package/dist/untrustedContent.d.ts.map +1 -0
  82. package/dist/untrustedContent.js +402 -0
  83. package/package.json +17 -1
  84. package/src/channelCustomer.ts +604 -0
  85. package/src/channelDebounce.ts +17 -0
  86. package/src/chunkOverlap.ts +6 -0
  87. package/src/chunking.ts +25 -4
  88. package/src/citations.ts +127 -0
  89. package/src/constants.ts +219 -17
  90. package/src/data.ts +74 -0
  91. package/src/dataApi.ts +428 -0
  92. package/src/dataCompiler.ts +948 -0
  93. package/src/dataDdl.ts +419 -0
  94. package/src/dataEngine.ts +2753 -0
  95. package/src/dataIdentifiers.ts +63 -0
  96. package/src/dataImport.ts +554 -0
  97. package/src/dataRpc.ts +121 -0
  98. package/src/dataTypes.ts +312 -0
  99. package/src/index.ts +156 -2
  100. package/src/jsonSchemaToZodShape.ts +31 -13
  101. package/src/oauth.ts +42 -1
  102. package/src/pagination.ts +193 -0
  103. package/src/processQueueBatch.ts +42 -12
  104. package/src/queueFailure.ts +63 -0
  105. package/src/resourceRerank.ts +10 -3
  106. package/src/schema.ts +346 -4
  107. package/src/ssrf.ts +40 -11
  108. package/src/toolConfirmation.ts +123 -0
  109. package/src/toolCount.ts +53 -0
  110. package/src/toolLint.ts +27 -0
  111. package/src/untrustedContent.ts +476 -0
@@ -0,0 +1,511 @@
1
+ import { z } from 'zod';
2
+ export declare const DATA_API_BASE = "/organization/:organizationId/project/:projectId/artifact/data";
3
+ export type DataApiMethod = 'get' | 'post' | 'patch' | 'delete';
4
+ export interface DataApiRoute {
5
+ method: DataApiMethod;
6
+ path: string;
7
+ summary: string;
8
+ description?: string;
9
+ tag: 'Database' | 'Tables' | 'Rows' | 'History and export';
10
+ body?: z.ZodType;
11
+ query?: z.ZodObject;
12
+ returns: string;
13
+ status?: 200 | 201;
14
+ file?: boolean;
15
+ }
16
+ export declare const DATA_API_ROUTES: {
17
+ readonly getDatabase: {
18
+ readonly method: "get";
19
+ readonly path: "";
20
+ readonly tag: "Database";
21
+ readonly summary: "The project's database";
22
+ readonly description: "Its status and size, and its tables when it is ready. `database` is null when the project has none.";
23
+ readonly returns: "{ database }";
24
+ };
25
+ readonly create: {
26
+ readonly method: "post";
27
+ readonly path: "";
28
+ readonly tag: "Database";
29
+ readonly summary: "Create the database";
30
+ readonly description: "Pro and Enterprise. Safe to repeat: a second call returns the same database. `name` defaults to the project's slug. While a deleted database is in its grace period this is refused unless `replaceDeleted` is true: the deleted one can then no longer be restored or exported, and is emptied when its grace period ends.";
31
+ readonly body: z.ZodObject<{
32
+ name: z.ZodOptional<z.ZodString>;
33
+ replaceDeleted: z.ZodOptional<z.ZodBoolean>;
34
+ }, z.core.$strip>;
35
+ readonly returns: "{ database }";
36
+ readonly status: 201;
37
+ };
38
+ readonly remove: {
39
+ readonly method: "delete";
40
+ readonly path: "";
41
+ readonly tag: "Database";
42
+ readonly summary: "Delete the database";
43
+ readonly description: "Needs `confirmName`, the database name typed out. It can be restored for 7 days.";
44
+ readonly body: z.ZodObject<{
45
+ confirmName: z.ZodString;
46
+ }, z.core.$strip>;
47
+ readonly returns: "{ database }";
48
+ };
49
+ readonly restore: {
50
+ readonly method: "post";
51
+ readonly path: "/restore";
52
+ readonly tag: "Database";
53
+ readonly summary: "Undo a delete";
54
+ readonly description: "Within the 7-day grace period.";
55
+ readonly returns: "{ database }";
56
+ };
57
+ readonly restorePoint: {
58
+ readonly method: "post";
59
+ readonly path: "/restore-point";
60
+ readonly tag: "Database";
61
+ readonly summary: "Restore to a point in time";
62
+ readonly description: "Replaces everything with the database as it was at `timestamp` (within 30 days), or at the `bookmark` a checkpoint, a dropped table or column, a type change or an earlier restore answered with. The answer carries `undoBookmark`, which undoes the restore. Calls in flight while it restarts fail.";
63
+ readonly body: z.ZodUnion<readonly [z.ZodObject<{
64
+ timestamp: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodNumber]>;
65
+ }, z.core.$strict>, z.ZodObject<{
66
+ bookmark: z.ZodString;
67
+ }, z.core.$strict>]>;
68
+ readonly returns: "{ bookmark, undoBookmark }";
69
+ };
70
+ readonly checkpoint: {
71
+ readonly method: "post";
72
+ readonly path: "/checkpoint";
73
+ readonly tag: "Database";
74
+ readonly summary: "Take a restore point";
75
+ readonly description: "Answers with the `bookmark` of the database as it is right now, which `POST /restore-point` accepts. Take one before a large change, such as replacing a table's rows, to undo exactly that change: a time is not that precise.";
76
+ readonly returns: "{ bookmark }";
77
+ };
78
+ readonly dismissCopy: {
79
+ readonly method: "delete";
80
+ readonly path: "/copy";
81
+ readonly tag: "Tables";
82
+ readonly summary: "Dismiss a failed table copy";
83
+ readonly description: "A column change on a table over 100,000 rows copies it in the background; table changes, and writes that would change its rows, wait until it finishes (`copy` on `GET` shows how far it got). A copy that failed left the table as it was and stays in `copy` with its `error` until dismissed, or until the next column change.";
84
+ readonly returns: "{ copy: null }";
85
+ };
86
+ readonly listTables: {
87
+ readonly method: "get";
88
+ readonly path: "/table";
89
+ readonly tag: "Tables";
90
+ readonly summary: "Tables and their columns";
91
+ readonly returns: "{ tables }";
92
+ };
93
+ readonly createTable: {
94
+ readonly method: "post";
95
+ readonly path: "/table";
96
+ readonly tag: "Tables";
97
+ readonly summary: "Create a table";
98
+ readonly body: z.ZodObject<{
99
+ name: z.ZodString;
100
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ displayColumn: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
+ access: z.ZodOptional<z.ZodEnum<{
104
+ none: "none";
105
+ read: "read";
106
+ add: "add";
107
+ full: "full";
108
+ }>>;
109
+ customerScoped: z.ZodOptional<z.ZodBoolean>;
110
+ history: z.ZodOptional<z.ZodBoolean>;
111
+ columns: z.ZodArray<z.ZodObject<{
112
+ name: z.ZodString;
113
+ type: z.ZodEnum<{
114
+ boolean: "boolean";
115
+ email: "email";
116
+ json: "json";
117
+ text: "text";
118
+ long_text: "long_text";
119
+ integer: "integer";
120
+ decimal: "decimal";
121
+ date: "date";
122
+ datetime: "datetime";
123
+ enum: "enum";
124
+ url: "url";
125
+ phone: "phone";
126
+ relation: "relation";
127
+ file: "file";
128
+ }>;
129
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
+ required: z.ZodOptional<z.ZodBoolean>;
132
+ unique: z.ZodOptional<z.ZodBoolean>;
133
+ filterable: z.ZodOptional<z.ZodBoolean>;
134
+ searchable: z.ZodOptional<z.ZodBoolean>;
135
+ personal: z.ZodOptional<z.ZodBoolean>;
136
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
137
+ table: z.ZodOptional<z.ZodString>;
138
+ onDelete: z.ZodOptional<z.ZodEnum<{
139
+ restrict: "restrict";
140
+ cascade: "cascade";
141
+ set_null: "set_null";
142
+ }>>;
143
+ min: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
144
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
145
+ }, z.core.$strict>>;
146
+ }, z.core.$strict>;
147
+ readonly returns: "{ table }";
148
+ readonly status: 201;
149
+ };
150
+ readonly updateTable: {
151
+ readonly method: "patch";
152
+ readonly path: "/table/:table";
153
+ readonly tag: "Tables";
154
+ readonly summary: "Rename a table or change its settings";
155
+ readonly body: z.ZodObject<{
156
+ name: z.ZodOptional<z.ZodString>;
157
+ label: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
158
+ description: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
159
+ displayColumn: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
160
+ access: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
161
+ none: "none";
162
+ read: "read";
163
+ add: "add";
164
+ full: "full";
165
+ }>>>;
166
+ customerScoped: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
167
+ history: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
168
+ }, z.core.$strict>;
169
+ readonly returns: "{ table }";
170
+ };
171
+ readonly dropTable: {
172
+ readonly method: "delete";
173
+ readonly path: "/table/:table";
174
+ readonly tag: "Tables";
175
+ readonly summary: "Drop a table";
176
+ readonly description: "Needs `confirmName`, the table name typed out. The answer carries a `bookmark`: restoring to it brings the table back.";
177
+ readonly body: z.ZodObject<{
178
+ confirmName: z.ZodString;
179
+ }, z.core.$strict>;
180
+ readonly returns: "{ dropped, bookmark }";
181
+ };
182
+ readonly addColumn: {
183
+ readonly method: "post";
184
+ readonly path: "/table/:table/column";
185
+ readonly tag: "Tables";
186
+ readonly summary: "Add a column";
187
+ readonly body: z.ZodObject<{
188
+ name: z.ZodString;
189
+ type: z.ZodEnum<{
190
+ boolean: "boolean";
191
+ email: "email";
192
+ json: "json";
193
+ text: "text";
194
+ long_text: "long_text";
195
+ integer: "integer";
196
+ decimal: "decimal";
197
+ date: "date";
198
+ datetime: "datetime";
199
+ enum: "enum";
200
+ url: "url";
201
+ phone: "phone";
202
+ relation: "relation";
203
+ file: "file";
204
+ }>;
205
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
207
+ required: z.ZodOptional<z.ZodBoolean>;
208
+ unique: z.ZodOptional<z.ZodBoolean>;
209
+ filterable: z.ZodOptional<z.ZodBoolean>;
210
+ searchable: z.ZodOptional<z.ZodBoolean>;
211
+ personal: z.ZodOptional<z.ZodBoolean>;
212
+ values: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
+ table: z.ZodOptional<z.ZodString>;
214
+ onDelete: z.ZodOptional<z.ZodEnum<{
215
+ restrict: "restrict";
216
+ cascade: "cascade";
217
+ set_null: "set_null";
218
+ }>>;
219
+ min: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
220
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
221
+ }, z.core.$strict>;
222
+ readonly returns: "{ table }";
223
+ readonly status: 201;
224
+ };
225
+ readonly updateColumn: {
226
+ readonly method: "patch";
227
+ readonly path: "/table/:table/column/:column";
228
+ readonly tag: "Tables";
229
+ readonly summary: "Rename a column or change it";
230
+ readonly description: "A type change copies the table and lists the first rows that would not fit. When it copies, the answer carries a `bookmark` from just before. Over 100,000 rows the copy runs in the background: the answer carries `copy`, the table keeps its old columns until it finishes, and meanwhile table changes, and writes that would change its rows, are refused.";
231
+ readonly body: z.ZodObject<{
232
+ name: z.ZodOptional<z.ZodString>;
233
+ type: z.ZodOptional<z.ZodEnum<{
234
+ boolean: "boolean";
235
+ email: "email";
236
+ json: "json";
237
+ text: "text";
238
+ long_text: "long_text";
239
+ integer: "integer";
240
+ decimal: "decimal";
241
+ date: "date";
242
+ datetime: "datetime";
243
+ enum: "enum";
244
+ url: "url";
245
+ phone: "phone";
246
+ relation: "relation";
247
+ file: "file";
248
+ }>>;
249
+ label: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
250
+ description: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
251
+ required: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
252
+ unique: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
253
+ filterable: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
254
+ searchable: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
255
+ personal: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
256
+ values: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
257
+ table: z.ZodOptional<z.ZodOptional<z.ZodString>>;
258
+ onDelete: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
259
+ restrict: "restrict";
260
+ cascade: "cascade";
261
+ set_null: "set_null";
262
+ }>>>;
263
+ min: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
264
+ default: z.ZodOptional<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
265
+ }, z.core.$strict>;
266
+ readonly returns: "{ table, bookmark, copy }";
267
+ };
268
+ readonly dropColumn: {
269
+ readonly method: "delete";
270
+ readonly path: "/table/:table/column/:column";
271
+ readonly tag: "Tables";
272
+ readonly summary: "Drop a column";
273
+ readonly description: "The answer carries a `bookmark`: restoring to it brings the column back. Dropping a relation column copies the table, in the background over 100,000 rows, as for a type change.";
274
+ readonly returns: "{ table, bookmark, copy }";
275
+ };
276
+ readonly listRows: {
277
+ readonly method: "get";
278
+ readonly path: "/table/:table/row";
279
+ readonly tag: "Rows";
280
+ readonly summary: "List, filter and search rows";
281
+ readonly description: "Up to 500 rows or 1 MB a page; `nextCursor` reads the next. `where` is JSON, e.g. `{\"status\":\"open\",\"price\":{\"lt\":30000}}`. `sort` is a list of columns, `-` for descending. `q` searches the searchable columns.";
282
+ readonly query: z.ZodObject<{
283
+ where: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<unknown, string>>>;
284
+ sort: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
285
+ include: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
286
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
287
+ cursor: z.ZodOptional<z.ZodString>;
288
+ q: z.ZodOptional<z.ZodString>;
289
+ timeZone: z.ZodOptional<z.ZodString>;
290
+ }, z.core.$strict>;
291
+ readonly returns: "{ table, rows, total?, nextCursor? }";
292
+ };
293
+ readonly createRows: {
294
+ readonly method: "post";
295
+ readonly path: "/table/:table/row";
296
+ readonly tag: "Rows";
297
+ readonly summary: "Insert one row, or up to 500";
298
+ readonly body: z.ZodUnion<readonly [z.ZodObject<{
299
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
300
+ }, z.core.$strict>, z.ZodObject<{
301
+ rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
302
+ }, z.core.$strict>]>;
303
+ readonly returns: "{ ids }";
304
+ readonly status: 201;
305
+ };
306
+ readonly getRow: {
307
+ readonly method: "get";
308
+ readonly path: "/table/:table/row/:id";
309
+ readonly tag: "Rows";
310
+ readonly summary: "One row";
311
+ readonly query: z.ZodObject<{
312
+ timeZone: z.ZodOptional<z.ZodString>;
313
+ include: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
314
+ }, z.core.$strict>;
315
+ readonly returns: "{ row }";
316
+ };
317
+ readonly updateRow: {
318
+ readonly method: "patch";
319
+ readonly path: "/table/:table/row/:id";
320
+ readonly tag: "Rows";
321
+ readonly summary: "Change a row";
322
+ readonly description: "Send the `version` you read: if the row changed since, the answer is 409 with the current row and who changed it.";
323
+ readonly body: z.ZodObject<{
324
+ set: z.ZodRecord<z.ZodString, z.ZodUnknown>;
325
+ version: z.ZodOptional<z.ZodNumber>;
326
+ }, z.core.$strict>;
327
+ readonly returns: "{ row }";
328
+ };
329
+ readonly deleteRow: {
330
+ readonly method: "delete";
331
+ readonly path: "/table/:table/row/:id";
332
+ readonly tag: "Rows";
333
+ readonly summary: "Delete a row";
334
+ readonly description: "Send the `version` you read, as for a change.";
335
+ readonly body: z.ZodObject<{
336
+ version: z.ZodOptional<z.ZodNumber>;
337
+ }, z.core.$strict>;
338
+ readonly returns: "{ deleted }";
339
+ };
340
+ readonly deletePreview: {
341
+ readonly method: "post";
342
+ readonly path: "/table/:table/delete-preview";
343
+ readonly tag: "Rows";
344
+ readonly summary: "What deleting rows would do";
345
+ readonly description: "For `ids`, or every row without them: each relation column pointing at a row the delete removes, with how many rows it would delete (cascade), clear (set null) or that refuse the delete (restrict). Cascades are followed all the way down. `blocked` says a restrict would refuse it. Past 200,000 affected rows `truncated` is true and the counts are lower bounds. Nothing is deleted.";
346
+ readonly body: z.ZodObject<{
347
+ ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
348
+ }, z.core.$strict>;
349
+ readonly returns: "{ table, rows, effects, blocked, truncated }";
350
+ };
351
+ readonly rowHistory: {
352
+ readonly method: "get";
353
+ readonly path: "/table/:table/row/:id/history";
354
+ readonly tag: "History and export";
355
+ readonly summary: "A row's history";
356
+ readonly description: "Newest first, kept 90 days, with who made each change.";
357
+ readonly query: z.ZodObject<{
358
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
359
+ cursor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
360
+ timeZone: z.ZodOptional<z.ZodString>;
361
+ }, z.core.$strict>;
362
+ readonly returns: "{ entries, nextCursor? }";
363
+ };
364
+ readonly write: {
365
+ readonly method: "post";
366
+ readonly path: "/write";
367
+ readonly tag: "Rows";
368
+ readonly summary: "Several writes, all or nothing";
369
+ readonly description: "Inserts, updates and deletes across tables in one transaction. A guard (`where` plus `expect`) that fails rolls everything back. A later step uses an earlier single-row insert's id as `{ \"$ref\": <step> }`, in its values or as the `id` it updates or deletes.";
370
+ readonly body: z.ZodObject<{
371
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
372
+ op: z.ZodLiteral<"insert">;
373
+ table: z.ZodString;
374
+ values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
375
+ rows: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
376
+ }, z.core.$strict>, z.ZodObject<{
377
+ set: z.ZodRecord<z.ZodString, z.ZodUnknown>;
378
+ table: z.ZodString;
379
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
380
+ $ref: z.ZodNumber;
381
+ }, z.core.$strict>]>>;
382
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
383
+ expect: z.ZodOptional<z.ZodNumber>;
384
+ version: z.ZodOptional<z.ZodNumber>;
385
+ op: z.ZodLiteral<"update">;
386
+ }, z.core.$strict>, z.ZodObject<{
387
+ table: z.ZodString;
388
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
389
+ $ref: z.ZodNumber;
390
+ }, z.core.$strict>]>>;
391
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
392
+ expect: z.ZodOptional<z.ZodNumber>;
393
+ version: z.ZodOptional<z.ZodNumber>;
394
+ op: z.ZodLiteral<"delete">;
395
+ }, z.core.$strict>], "op">>;
396
+ }, z.core.$strict>;
397
+ readonly returns: "{ results }";
398
+ };
399
+ readonly startExport: {
400
+ readonly method: "post";
401
+ readonly path: "/export";
402
+ readonly tag: "History and export";
403
+ readonly summary: "Start an export";
404
+ readonly description: "Writes a copy in the background: schema.json and one JSONL or CSV file per table. Poll `GET /export` until `status` is `done`. Works during the 7-day grace period after a delete too.";
405
+ readonly body: z.ZodObject<{
406
+ format: z.ZodOptional<z.ZodEnum<{
407
+ csv: "csv";
408
+ jsonl: "jsonl";
409
+ }>>;
410
+ }, z.core.$strict>;
411
+ readonly returns: "{ exportId, status }";
412
+ readonly status: 201;
413
+ };
414
+ readonly exportStatus: {
415
+ readonly method: "get";
416
+ readonly path: "/export";
417
+ readonly tag: "History and export";
418
+ readonly summary: "The latest export";
419
+ readonly query: z.ZodObject<{
420
+ exportId: z.ZodOptional<z.ZodUUID>;
421
+ }, z.core.$strict>;
422
+ readonly returns: "{ export }";
423
+ };
424
+ readonly exportFile: {
425
+ readonly method: "get";
426
+ readonly path: "/export/file";
427
+ readonly tag: "History and export";
428
+ readonly summary: "Download one of an export's files";
429
+ readonly description: "A table's file, or schema.json without `table`.";
430
+ readonly query: z.ZodObject<{
431
+ exportId: z.ZodUUID;
432
+ table: z.ZodOptional<z.ZodString>;
433
+ }, z.core.$strict>;
434
+ readonly returns: "The file";
435
+ readonly file: true;
436
+ };
437
+ readonly listChanges: {
438
+ readonly method: "get";
439
+ readonly path: "/change";
440
+ readonly tag: "History and export";
441
+ readonly summary: "The schema change log";
442
+ readonly description: "Newest first: tables and columns changed, restores, exports, deletes.";
443
+ readonly query: z.ZodObject<{
444
+ limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
445
+ cursor: z.ZodOptional<z.ZodUUID>;
446
+ }, z.core.$strict>;
447
+ readonly returns: "{ changes, nextCursor? }";
448
+ };
449
+ };
450
+ export type DataApiRouteId = keyof typeof DATA_API_ROUTES;
451
+ /**
452
+ * The OpenAPI 3.1 document for the Data API, served by apps/api at
453
+ * /openapi/data.json.
454
+ */
455
+ export declare const dataOpenApi: (serverUrl: string) => {
456
+ openapi: string;
457
+ info: {
458
+ title: string;
459
+ version: string;
460
+ description: string;
461
+ };
462
+ servers: {
463
+ url: string;
464
+ }[];
465
+ security: {
466
+ bearer: never[];
467
+ }[];
468
+ tags: {
469
+ name: string;
470
+ }[];
471
+ paths: Record<string, Record<string, unknown>>;
472
+ components: {
473
+ securitySchemes: {
474
+ bearer: {
475
+ type: string;
476
+ scheme: string;
477
+ };
478
+ };
479
+ schemas: {
480
+ Error: {
481
+ type: string;
482
+ properties: {
483
+ error: {
484
+ type: string;
485
+ };
486
+ code: {
487
+ type: string;
488
+ };
489
+ details: {
490
+ type: string;
491
+ };
492
+ errors: {
493
+ type: string;
494
+ items: {
495
+ type: string;
496
+ properties: {
497
+ path: {
498
+ type: string;
499
+ };
500
+ message: {
501
+ type: string;
502
+ };
503
+ };
504
+ };
505
+ };
506
+ };
507
+ };
508
+ };
509
+ };
510
+ };
511
+ //# sourceMappingURL=dataApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataApi.d.ts","sourceRoot":"","sources":["../src/dataApi.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa,mEACwC,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,aAAa,CAAC;IAEtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,oBAAoB,CAAC;IAC3D,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAEpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IAEnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAyBD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmPqB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,eAAe,CAAC;AAmB1D;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G5C,CAAC"}