@tailor-platform/sdk 1.54.2 → 1.55.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 (48) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{actor-Cjae_LGD.d.mts → actor-J2gJ0eK5.d.mts} +2 -2
  3. package/dist/application-DM8q9GDI.mjs +4 -0
  4. package/dist/{application-BfGje3iZ.mjs → application-DzUlASfA.mjs} +333 -4
  5. package/dist/application-DzUlASfA.mjs.map +1 -0
  6. package/dist/brand-DlnJ375c.mjs.map +1 -1
  7. package/dist/cli/index.mjs +5 -5
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +1334 -176
  10. package/dist/cli/lib.mjs +3 -3
  11. package/dist/{client-CGO7gniI.mjs → client-DLPEPJ_s.mjs} +24 -19
  12. package/dist/client-DLPEPJ_s.mjs.map +1 -0
  13. package/dist/{client-yfFdZU9s.mjs → client-DrzwCD1W.mjs} +1 -1
  14. package/dist/configure/index.d.mts +5 -4
  15. package/dist/configure/index.mjs +48 -2
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crashreport-DGdAgX8Y.mjs → crashreport-Bm2mN5tg.mjs} +2 -2
  18. package/dist/{crashreport-DGdAgX8Y.mjs.map → crashreport-Bm2mN5tg.mjs.map} +1 -1
  19. package/dist/{crashreport-DnwIxpzF.mjs → crashreport-C5oHvHUC.mjs} +1 -1
  20. package/dist/{index-qQYMbkT-.d.mts → index-BE-fpxIo.d.mts} +2 -2
  21. package/dist/{index-BTLgs0DP.d.mts → index-BLsnrEtc.d.mts} +97 -5
  22. package/dist/{index-DrYHpTja.d.mts → index-D9xG-a6Y.d.mts} +2 -2
  23. package/dist/{index-CyyoHrPK.d.mts → index-S6-FtUpA.d.mts} +2 -2
  24. package/dist/{index-Cf1Lo_XT.d.mts → index-cHqh66cF.d.mts} +2 -2
  25. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  26. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  27. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  28. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  29. package/dist/plugin/index.d.mts +2 -2
  30. package/dist/plugin-BuE5ZOnW.d.mts +634 -0
  31. package/dist/{runtime-DLFzjgEo.mjs → runtime-BZsl7Mh9.mjs} +320 -155
  32. package/dist/runtime-BZsl7Mh9.mjs.map +1 -0
  33. package/dist/{schema-CQrYG_55.mjs → schema-DKsNhbav.mjs} +5 -3
  34. package/dist/{schema-CQrYG_55.mjs.map → schema-DKsNhbav.mjs.map} +1 -1
  35. package/dist/seed-DfLyRh63.mjs.map +1 -1
  36. package/dist/tailordb-BlBGmQK-.d.mts +863 -0
  37. package/dist/utils/test/index.d.mts +3 -3
  38. package/dist/vitest/index.d.mts +25 -1
  39. package/dist/vitest/index.mjs +57 -12
  40. package/dist/vitest/index.mjs.map +1 -1
  41. package/dist/{workflow.generated-dBixCwUo.d.mts → workflow.generated-CQg1_Ami.d.mts} +185 -8
  42. package/docs/services/http-adapter.md +100 -0
  43. package/package.json +1 -1
  44. package/dist/application-BfGje3iZ.mjs.map +0 -1
  45. package/dist/application-BsipSxp3.mjs +0 -4
  46. package/dist/client-CGO7gniI.mjs.map +0 -1
  47. package/dist/runtime-DLFzjgEo.mjs.map +0 -1
  48. package/dist/tailor-db-field-D0qg8s4U.d.mts +0 -1639
@@ -0,0 +1,863 @@
1
+ import { NonEmptyObject } from "type-fest";
2
+
3
+ //#region src/types/helpers.d.ts
4
+ type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
5
+ type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
6
+ type output<T> = T extends {
7
+ _output: infer U;
8
+ } ? DeepWritable<U> : never;
9
+ type NullableToOptional<T> = { [K in keyof T as null extends T[K] ? never : K]: T[K] } & { [K in keyof T as null extends T[K] ? K : never]?: T[K] };
10
+ type InferFieldsOutput<F extends Record<string, {
11
+ _output: any;
12
+ [key: string]: any;
13
+ }>> = DeepWritable<Prettify<NullableToOptional<{ [K in keyof F]: output<F[K]> }>>>;
14
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
15
+ [key: string]: JsonValue;
16
+ };
17
+ /**
18
+ * A looser version of JsonValue that accepts interfaces.
19
+ * TypeScript interfaces don't have index signatures by default, so they can't
20
+ * be assigned to JsonValue's `{ [key: string]: JsonValue }`. This type uses a
21
+ * recursive structural check instead.
22
+ *
23
+ * Rejection rules:
24
+ * - Functions are rejected (top-level or as property values).
25
+ * - Objects with a `toJSON` method are rejected (can't faithfully round-trip).
26
+ * - Class instances that expose methods are rejected via the property walk
27
+ * (methods are function-typed properties, which resolve to `never`).
28
+ *
29
+ * Limitation: class instances whose declared type has only data properties
30
+ * (for example `Error`, or user-defined DTO classes) are structurally
31
+ * indistinguishable from plain objects and cannot be rejected here. The
32
+ * platform performs the authoritative check at runtime.
33
+ */
34
+ type JsonCompatible<T> = T extends string | number | boolean | null | undefined ? T : T extends readonly (infer U)[] ? JsonCompatible<U>[] : T extends Function ? never : T extends object ? T extends {
35
+ toJSON: () => unknown;
36
+ } ? never : { [K in keyof T]: JsonCompatible<T[K]> } : never;
37
+ //#endregion
38
+ //#region src/types/user.d.ts
39
+ interface AttributeMap {}
40
+ interface AttributeList {
41
+ __tuple?: [];
42
+ }
43
+ type InferredAttributeMap = keyof AttributeMap extends never ? Record<string, string | string[] | boolean | boolean[] | undefined> : AttributeMap;
44
+ type InferredAttributeList = AttributeList["__tuple"] extends [] ? string[] : AttributeList["__tuple"];
45
+ /** Represents a user in the Tailor platform. */
46
+ type TailorUser = {
47
+ /**
48
+ * The ID of the user.
49
+ * For unauthenticated users, this will be a nil UUID.
50
+ */
51
+ id: string;
52
+ /**
53
+ * The type of the user.
54
+ * For unauthenticated users, this will be an empty string.
55
+ */
56
+ type: "user" | "machine_user" | ""; /** The ID of the workspace the user belongs to. */
57
+ workspaceId: string;
58
+ /**
59
+ * A map of the user's attributes.
60
+ * For unauthenticated users, this will be null.
61
+ */
62
+ attributes: InferredAttributeMap | null;
63
+ /**
64
+ * A list of the user's attributes.
65
+ * For unauthenticated users, this will be an empty array.
66
+ */
67
+ attributeList: InferredAttributeList;
68
+ };
69
+ /** Represents an unauthenticated user in the Tailor platform. */
70
+ declare const unauthenticatedTailorUser: TailorUser;
71
+ /**
72
+ * The invoker of the current function execution.
73
+ *
74
+ * Reflects `authInvoker` delegation: when `authInvoker` is specified, this is
75
+ * the machine user; otherwise it is the calling user.
76
+ * Distinct from resolver's `user` (the authenticated caller) and executor's
77
+ * `actor` (the subject of the event).
78
+ *
79
+ * `null` for anonymous requests.
80
+ *
81
+ * TODO(v2): unify with `TailorUser` — same underlying principal shape.
82
+ */
83
+ type TailorInvoker = {
84
+ /** The ID of the invoker (user ID or machine user ID). */id: string; /** The type of the invoker. */
85
+ type: "user" | "machine_user"; /** The ID of the workspace the invoker belongs to. */
86
+ workspaceId: string; /** A map of the invoker's attributes. */
87
+ attributes: InferredAttributeMap; /** A list of the invoker's attribute IDs. */
88
+ attributeList: InferredAttributeList;
89
+ } | null;
90
+ //#endregion
91
+ //#region src/types/validation.d.ts
92
+ /**
93
+ * Validation function type
94
+ */
95
+ type ValidateFn<O, D = unknown> = (args: {
96
+ value: O;
97
+ data: D;
98
+ user: TailorUser;
99
+ }) => boolean;
100
+ /**
101
+ * Validation configuration with custom error message
102
+ */
103
+ type ValidateConfig<O, D = unknown> = [ValidateFn<O, D>, string];
104
+ /**
105
+ * Field-level validation function
106
+ */
107
+ type FieldValidateFn<O> = ValidateFn<O>;
108
+ /**
109
+ * Field-level validation configuration
110
+ */
111
+ type FieldValidateConfig<O> = ValidateConfig<O>;
112
+ /**
113
+ * Input type for field validation - can be either a function or a tuple of [function, errorMessage]
114
+ */
115
+ type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
116
+ /**
117
+ * Base validators type for field collections
118
+ * @template F - Record of fields
119
+ * @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
120
+ */
121
+ type ValidatorsBase<F extends Record<string, {
122
+ _defined: any;
123
+ _output: any;
124
+ [key: string]: any;
125
+ }>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
126
+ validate: unknown;
127
+ } ? never : K]?: ValidateFn<output<F[K]>, InferFieldsOutput<F>> | ValidateConfig<output<F[K]>, InferFieldsOutput<F>> | (ValidateFn<output<F[K]>, InferFieldsOutput<F>> | ValidateConfig<output<F[K]>, InferFieldsOutput<F>>)[] }>;
128
+ /**
129
+ * Validators type (by default excludes "id" field for TailorDB compatibility)
130
+ * Can be used with both TailorField and TailorDBField
131
+ */
132
+ type Validators<F extends Record<string, {
133
+ _defined: any;
134
+ _output: any;
135
+ [key: string]: any;
136
+ }>> = ValidatorsBase<F, "id">;
137
+ //#endregion
138
+ //#region src/types/field-types.d.ts
139
+ interface EnumValue {
140
+ value: string;
141
+ description?: string;
142
+ }
143
+ type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "decimal" | "enum" | "date" | "datetime" | "time" | "nested";
144
+ type TailorToTs = {
145
+ string: string;
146
+ integer: number;
147
+ float: number;
148
+ decimal: string;
149
+ boolean: boolean;
150
+ uuid: string;
151
+ date: string;
152
+ datetime: string | Date;
153
+ time: string;
154
+ enum: string;
155
+ object: Record<string, unknown>;
156
+ nested: Record<string, unknown>;
157
+ } & Record<TailorFieldType, unknown>;
158
+ interface FieldMetadata {
159
+ description?: string;
160
+ required?: boolean;
161
+ array?: boolean;
162
+ allowedValues?: EnumValue[];
163
+ validate?: FieldValidateInput<any>[];
164
+ typeName?: string;
165
+ }
166
+ interface DefinedFieldMetadata {
167
+ type: TailorFieldType;
168
+ array: boolean;
169
+ description?: boolean;
170
+ validate?: boolean;
171
+ typeName?: boolean;
172
+ }
173
+ type FieldOptions = {
174
+ optional?: boolean;
175
+ array?: boolean;
176
+ };
177
+ type FieldOutput<T, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T, O>, O>;
178
+ type OptionalFieldOutput<T, O extends FieldOptions> = O["optional"] extends true ? T | null : T;
179
+ type ArrayFieldOutput<T, O extends FieldOptions> = [O] extends [{
180
+ array: true;
181
+ }] ? T[] : T;
182
+ //#endregion
183
+ //#region src/types/plugin-attachment.d.ts
184
+ /**
185
+ * Plugin attachment stored on TailorAnyDBType instances.
186
+ */
187
+ interface PluginAttachment {
188
+ pluginId: string;
189
+ config: unknown;
190
+ }
191
+ //#endregion
192
+ //#region src/types/tailor-field.d.ts
193
+ /**
194
+ * Minimal structural interface for TailorField.
195
+ * Defines only the properties needed by parser, plugin, cli, and types layers.
196
+ * The full interface with builder methods (description, typeName, validate, parse)
197
+ * is defined in configure/types/type.ts.
198
+ */
199
+ interface TailorField<Defined extends DefinedFieldMetadata = DefinedFieldMetadata, Output = any, M extends FieldMetadata = FieldMetadata, T extends TailorFieldType = TailorFieldType> {
200
+ readonly type: T;
201
+ readonly fields: Record<string, TailorAnyField>;
202
+ readonly _defined: Defined;
203
+ readonly _output: Output;
204
+ readonly metadata: M;
205
+ }
206
+ type TailorAnyField = TailorField<any>;
207
+ //#endregion
208
+ //#region src/types/tailordb.generated.d.ts
209
+ /**
210
+ * Configuration for GraphQL operations on a TailorDB type.
211
+ * All operations are enabled by default (undefined or true = enabled, false = disabled).
212
+ */
213
+ type GqlOperationsInput = "query" | {
214
+ create?: boolean | undefined;
215
+ update?: boolean | undefined;
216
+ delete?: boolean | undefined;
217
+ read?: boolean | undefined;
218
+ };
219
+ type DBFieldMetadata$1 = {
220
+ /** Whether the field is required */required?: boolean | undefined; /** Whether the field is an array */
221
+ array?: boolean | undefined; /** Field description */
222
+ description?: string | undefined; /** Type name for nested or enum fields */
223
+ typeName?: string | undefined; /** Allowed values for enum fields */
224
+ allowedValues?: {
225
+ value: string; /** Field description */
226
+ description?: string | undefined;
227
+ }[] | undefined; /** Whether the field is indexed for faster queries */
228
+ index?: boolean | undefined; /** Whether the field value must be unique */
229
+ unique?: boolean | undefined; /** Whether the field is a vector field for similarity search */
230
+ vector?: boolean | undefined; /** Whether the field is a foreign key */
231
+ foreignKey?: boolean | undefined; /** Target type name for foreign key relations */
232
+ foreignKeyType?: string | undefined; /** Target field name for foreign key relations */
233
+ foreignKeyField?: string | undefined; /** Lifecycle hooks for the field */
234
+ hooks?: {
235
+ create?: Function | undefined;
236
+ update?: Function | undefined;
237
+ } | undefined; /** Validation functions for the field */
238
+ validate?: (Function | [Function, string])[] | undefined; /** Serial (auto-increment) configuration */
239
+ serial?: {
240
+ start: number;
241
+ maxValue?: number | undefined;
242
+ format?: string | undefined;
243
+ } | undefined; /** Decimal scale (number of digits after decimal point, 0-12) */
244
+ scale?: number | undefined;
245
+ };
246
+ type TailorDBTypeParsedSettings = {
247
+ /** Custom plural form of the type name for GraphQL */pluralForm?: string | undefined; /** Enable aggregation queries for this type */
248
+ aggregation?: boolean | undefined; /** Enable bulk upsert mutation for this type */
249
+ bulkUpsert?: boolean | undefined; /** Configure GraphQL operations for this type. Use "query" for read-only mode, or an object for granular control. */
250
+ gqlOperations?: {
251
+ create?: boolean | undefined;
252
+ update?: boolean | undefined;
253
+ delete?: boolean | undefined;
254
+ read?: boolean | undefined;
255
+ } | undefined;
256
+ /**
257
+ * Enable publishing events for this type.
258
+ * When enabled, record creation/update/deletion events are published.
259
+ * If not specified, this is automatically set to true when an executor uses this type
260
+ * with recordCreated/recordUpdated/recordDeleted triggers. If explicitly set to false
261
+ * while an executor uses this type, an error will be thrown during apply.
262
+ */
263
+ publishEvents?: boolean | undefined;
264
+ };
265
+ type RawPermissions = {
266
+ record?: {
267
+ create: readonly (readonly [(string | boolean | string[] | boolean[] | {
268
+ user: string;
269
+ } | {
270
+ record: string;
271
+ } | {
272
+ oldRecord: string;
273
+ } | {
274
+ newRecord: string;
275
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
276
+ user: string;
277
+ } | {
278
+ record: string;
279
+ } | {
280
+ oldRecord: string;
281
+ } | {
282
+ newRecord: string;
283
+ })] | readonly [(string | boolean | string[] | boolean[] | {
284
+ user: string;
285
+ } | {
286
+ record: string;
287
+ } | {
288
+ oldRecord: string;
289
+ } | {
290
+ newRecord: string;
291
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
292
+ user: string;
293
+ } | {
294
+ record: string;
295
+ } | {
296
+ oldRecord: string;
297
+ } | {
298
+ newRecord: string;
299
+ }), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
300
+ user: string;
301
+ } | {
302
+ record: string;
303
+ } | {
304
+ oldRecord: string;
305
+ } | {
306
+ newRecord: string;
307
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
308
+ user: string;
309
+ } | {
310
+ record: string;
311
+ } | {
312
+ oldRecord: string;
313
+ } | {
314
+ newRecord: string;
315
+ })])[] | {
316
+ conditions: readonly [(string | boolean | string[] | boolean[] | {
317
+ user: string;
318
+ } | {
319
+ record: string;
320
+ } | {
321
+ oldRecord: string;
322
+ } | {
323
+ newRecord: string;
324
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
325
+ user: string;
326
+ } | {
327
+ record: string;
328
+ } | {
329
+ oldRecord: string;
330
+ } | {
331
+ newRecord: string;
332
+ })] | readonly (readonly [(string | boolean | string[] | boolean[] | {
333
+ user: string;
334
+ } | {
335
+ record: string;
336
+ } | {
337
+ oldRecord: string;
338
+ } | {
339
+ newRecord: string;
340
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
341
+ user: string;
342
+ } | {
343
+ record: string;
344
+ } | {
345
+ oldRecord: string;
346
+ } | {
347
+ newRecord: string;
348
+ })])[];
349
+ description?: string | undefined;
350
+ permit?: boolean | undefined;
351
+ })[];
352
+ read: readonly (readonly [(string | boolean | string[] | boolean[] | {
353
+ user: string;
354
+ } | {
355
+ record: string;
356
+ } | {
357
+ oldRecord: string;
358
+ } | {
359
+ newRecord: string;
360
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
361
+ user: string;
362
+ } | {
363
+ record: string;
364
+ } | {
365
+ oldRecord: string;
366
+ } | {
367
+ newRecord: string;
368
+ })] | readonly [(string | boolean | string[] | boolean[] | {
369
+ user: string;
370
+ } | {
371
+ record: string;
372
+ } | {
373
+ oldRecord: string;
374
+ } | {
375
+ newRecord: string;
376
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
377
+ user: string;
378
+ } | {
379
+ record: string;
380
+ } | {
381
+ oldRecord: string;
382
+ } | {
383
+ newRecord: string;
384
+ }), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
385
+ user: string;
386
+ } | {
387
+ record: string;
388
+ } | {
389
+ oldRecord: string;
390
+ } | {
391
+ newRecord: string;
392
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
393
+ user: string;
394
+ } | {
395
+ record: string;
396
+ } | {
397
+ oldRecord: string;
398
+ } | {
399
+ newRecord: string;
400
+ })])[] | {
401
+ conditions: readonly [(string | boolean | string[] | boolean[] | {
402
+ user: string;
403
+ } | {
404
+ record: string;
405
+ } | {
406
+ oldRecord: string;
407
+ } | {
408
+ newRecord: string;
409
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
410
+ user: string;
411
+ } | {
412
+ record: string;
413
+ } | {
414
+ oldRecord: string;
415
+ } | {
416
+ newRecord: string;
417
+ })] | readonly (readonly [(string | boolean | string[] | boolean[] | {
418
+ user: string;
419
+ } | {
420
+ record: string;
421
+ } | {
422
+ oldRecord: string;
423
+ } | {
424
+ newRecord: string;
425
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
426
+ user: string;
427
+ } | {
428
+ record: string;
429
+ } | {
430
+ oldRecord: string;
431
+ } | {
432
+ newRecord: string;
433
+ })])[];
434
+ description?: string | undefined;
435
+ permit?: boolean | undefined;
436
+ })[];
437
+ update: readonly (readonly [(string | boolean | string[] | boolean[] | {
438
+ user: string;
439
+ } | {
440
+ record: string;
441
+ } | {
442
+ oldRecord: string;
443
+ } | {
444
+ newRecord: string;
445
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
446
+ user: string;
447
+ } | {
448
+ record: string;
449
+ } | {
450
+ oldRecord: string;
451
+ } | {
452
+ newRecord: string;
453
+ })] | readonly [(string | boolean | string[] | boolean[] | {
454
+ user: string;
455
+ } | {
456
+ record: string;
457
+ } | {
458
+ oldRecord: string;
459
+ } | {
460
+ newRecord: string;
461
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
462
+ user: string;
463
+ } | {
464
+ record: string;
465
+ } | {
466
+ oldRecord: string;
467
+ } | {
468
+ newRecord: string;
469
+ }), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
470
+ user: string;
471
+ } | {
472
+ record: string;
473
+ } | {
474
+ oldRecord: string;
475
+ } | {
476
+ newRecord: string;
477
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
478
+ user: string;
479
+ } | {
480
+ record: string;
481
+ } | {
482
+ oldRecord: string;
483
+ } | {
484
+ newRecord: string;
485
+ })])[] | {
486
+ conditions: readonly [(string | boolean | string[] | boolean[] | {
487
+ user: string;
488
+ } | {
489
+ record: string;
490
+ } | {
491
+ oldRecord: string;
492
+ } | {
493
+ newRecord: string;
494
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
495
+ user: string;
496
+ } | {
497
+ record: string;
498
+ } | {
499
+ oldRecord: string;
500
+ } | {
501
+ newRecord: string;
502
+ })] | readonly (readonly [(string | boolean | string[] | boolean[] | {
503
+ user: string;
504
+ } | {
505
+ record: string;
506
+ } | {
507
+ oldRecord: string;
508
+ } | {
509
+ newRecord: string;
510
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
511
+ user: string;
512
+ } | {
513
+ record: string;
514
+ } | {
515
+ oldRecord: string;
516
+ } | {
517
+ newRecord: string;
518
+ })])[];
519
+ description?: string | undefined;
520
+ permit?: boolean | undefined;
521
+ })[];
522
+ delete: readonly (readonly [(string | boolean | string[] | boolean[] | {
523
+ user: string;
524
+ } | {
525
+ record: string;
526
+ } | {
527
+ oldRecord: string;
528
+ } | {
529
+ newRecord: string;
530
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
531
+ user: string;
532
+ } | {
533
+ record: string;
534
+ } | {
535
+ oldRecord: string;
536
+ } | {
537
+ newRecord: string;
538
+ })] | readonly [(string | boolean | string[] | boolean[] | {
539
+ user: string;
540
+ } | {
541
+ record: string;
542
+ } | {
543
+ oldRecord: string;
544
+ } | {
545
+ newRecord: string;
546
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
547
+ user: string;
548
+ } | {
549
+ record: string;
550
+ } | {
551
+ oldRecord: string;
552
+ } | {
553
+ newRecord: string;
554
+ }), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
555
+ user: string;
556
+ } | {
557
+ record: string;
558
+ } | {
559
+ oldRecord: string;
560
+ } | {
561
+ newRecord: string;
562
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
563
+ user: string;
564
+ } | {
565
+ record: string;
566
+ } | {
567
+ oldRecord: string;
568
+ } | {
569
+ newRecord: string;
570
+ })])[] | {
571
+ conditions: readonly [(string | boolean | string[] | boolean[] | {
572
+ user: string;
573
+ } | {
574
+ record: string;
575
+ } | {
576
+ oldRecord: string;
577
+ } | {
578
+ newRecord: string;
579
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
580
+ user: string;
581
+ } | {
582
+ record: string;
583
+ } | {
584
+ oldRecord: string;
585
+ } | {
586
+ newRecord: string;
587
+ })] | readonly (readonly [(string | boolean | string[] | boolean[] | {
588
+ user: string;
589
+ } | {
590
+ record: string;
591
+ } | {
592
+ oldRecord: string;
593
+ } | {
594
+ newRecord: string;
595
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
596
+ user: string;
597
+ } | {
598
+ record: string;
599
+ } | {
600
+ oldRecord: string;
601
+ } | {
602
+ newRecord: string;
603
+ })])[];
604
+ description?: string | undefined;
605
+ permit?: boolean | undefined;
606
+ })[];
607
+ } | undefined;
608
+ gql?: readonly {
609
+ conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
610
+ user: string;
611
+ }), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
612
+ user: string;
613
+ })])[];
614
+ actions: "all" | readonly ("create" | "read" | "update" | "delete" | "aggregate" | "bulkUpsert")[];
615
+ permit?: boolean | undefined;
616
+ description?: string | undefined;
617
+ }[] | undefined;
618
+ };
619
+ type TailorDBServiceConfigInput = {
620
+ /** Glob patterns for TailorDB type definition files */files: string[]; /** Glob patterns to exclude from type discovery */
621
+ ignores?: string[] | undefined; /** URL for the ERD (Entity Relationship Diagram) site */
622
+ erdSite?: string | undefined; /** Migration configuration */
623
+ migration?: {
624
+ directory: string;
625
+ machineUser?: string | undefined;
626
+ } | undefined; /** Default GraphQL operations for all types in this service */
627
+ gqlOperations?: "query" | {
628
+ create?: boolean | undefined;
629
+ update?: boolean | undefined;
630
+ delete?: boolean | undefined;
631
+ read?: boolean | undefined;
632
+ } | undefined;
633
+ };
634
+ //#endregion
635
+ //#region src/types/tailordb-metadata.d.ts
636
+ type SerialConfig<T extends "string" | "integer" = "string" | "integer"> = Prettify<{
637
+ start: number;
638
+ maxValue?: number;
639
+ } & (T extends "string" ? {
640
+ format?: string;
641
+ } : object)>;
642
+ interface DBFieldMetadata extends FieldMetadata {
643
+ index?: boolean;
644
+ unique?: boolean;
645
+ vector?: boolean;
646
+ foreignKey?: boolean;
647
+ foreignKeyType?: string;
648
+ foreignKeyField?: string;
649
+ /** Lifecycle hooks for the field */
650
+ hooks?: DBFieldMetadata$1["hooks"];
651
+ serial?: SerialConfig;
652
+ relation?: boolean;
653
+ scale?: number;
654
+ }
655
+ interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
656
+ index?: boolean;
657
+ unique?: boolean;
658
+ vector?: boolean;
659
+ foreignKey?: boolean;
660
+ foreignKeyType?: boolean;
661
+ validate?: boolean;
662
+ hooks?: {
663
+ create: boolean;
664
+ update: boolean;
665
+ };
666
+ serial?: boolean;
667
+ relation?: boolean;
668
+ }
669
+ type GqlOperationsConfig = GqlOperationsInput;
670
+ interface RawRelationConfig {
671
+ type: "1-1" | "n-1" | "keyOnly" | "oneToOne" | "manyToOne" | "N-1";
672
+ toward: {
673
+ type: string;
674
+ as?: string;
675
+ key?: string;
676
+ };
677
+ backward?: string;
678
+ }
679
+ interface TailorDBTypeMetadata {
680
+ name: string;
681
+ description?: string;
682
+ settings?: {
683
+ pluralForm?: string;
684
+ aggregation?: boolean;
685
+ bulkUpsert?: boolean;
686
+ gqlOperations?: GqlOperationsConfig;
687
+ publishEvents?: boolean;
688
+ };
689
+ permissions: RawPermissions;
690
+ files: Record<string, string>;
691
+ indexes?: Record<string, {
692
+ fields: string[];
693
+ unique?: boolean;
694
+ }>;
695
+ }
696
+ //#endregion
697
+ //#region src/types/tailor-db-field.d.ts
698
+ /**
699
+ * Minimal structural interface for TailorDBField.
700
+ * Defines only the properties needed by parser, plugin, cli, and types layers.
701
+ * The full interface with builder methods (relation, index, unique, hooks, validate, etc.)
702
+ * is defined in configure/services/tailordb/schema.ts.
703
+ */
704
+ interface TailorDBField<Defined extends DefinedDBFieldMetadata = DefinedDBFieldMetadata, Output = any> extends Omit<TailorField<Defined, Output, DBFieldMetadata, Defined["type"]>, "fields"> {
705
+ readonly fields: Record<string, TailorAnyDBField>;
706
+ readonly rawRelation: Readonly<RawRelationConfig> | undefined;
707
+ }
708
+ type TailorAnyDBField = TailorDBField<any, any>;
709
+ /**
710
+ * Minimal structural interface for TailorDBType.
711
+ * Defines only the properties needed by parser, plugin, cli, and types layers.
712
+ * The full interface with builder methods (hooks, validate, features, permission, etc.)
713
+ * is defined in configure/services/tailordb/schema.ts.
714
+ */
715
+ interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
716
+ readonly name: string;
717
+ readonly fields: Fields;
718
+ readonly _output: InferFieldsOutput<Fields>;
719
+ readonly metadata: TailorDBTypeMetadata;
720
+ readonly plugins: PluginAttachment[];
721
+ }
722
+ type TailorAnyDBType = TailorDBType$1<any, any>;
723
+ type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType$1<Fields, User>;
724
+ //#endregion
725
+ //#region src/types/auth-value.d.ts
726
+ type ValueOperand = string | boolean | string[] | boolean[];
727
+ //#endregion
728
+ //#region src/types/tailordb.d.ts
729
+ type IndexDef<T extends {
730
+ fields: Record<PropertyKey, unknown>;
731
+ }> = {
732
+ fields: [keyof T["fields"], keyof T["fields"], ...(keyof T["fields"])[]];
733
+ unique?: boolean;
734
+ name?: string;
735
+ };
736
+ type RelationType = "1-1" | "oneToOne" | "n-1" | "manyToOne" | "N-1" | "keyOnly";
737
+ type TailorDBExternalConfig = {
738
+ external: true;
739
+ };
740
+ type TailorDBServiceInput = {
741
+ [namespace: string]: TailorDBServiceConfigInput | TailorDBExternalConfig;
742
+ };
743
+ interface UserDefinedTypeSource {
744
+ filePath: string;
745
+ exportName: string;
746
+ pluginId?: never;
747
+ }
748
+ interface PluginGeneratedTypeSource {
749
+ filePath?: never;
750
+ exportName: string;
751
+ pluginId: string;
752
+ pluginImportPath: string;
753
+ originalFilePath: string;
754
+ originalExportName: string;
755
+ generatedTypeKind?: string;
756
+ pluginConfig?: unknown;
757
+ namespace?: string;
758
+ }
759
+ type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;
760
+ interface Script {
761
+ expr: string;
762
+ }
763
+ interface OperatorValidateConfig {
764
+ script: Script;
765
+ errorMessage: string;
766
+ }
767
+ interface OperatorFieldHook {
768
+ create?: Script;
769
+ update?: Script;
770
+ }
771
+ interface OperatorFieldConfig {
772
+ type: string;
773
+ required?: boolean;
774
+ description?: string;
775
+ allowedValues?: EnumValue[];
776
+ array?: boolean;
777
+ index?: boolean;
778
+ unique?: boolean;
779
+ vector?: boolean;
780
+ foreignKey?: boolean;
781
+ foreignKeyType?: string;
782
+ foreignKeyField?: string;
783
+ rawRelation?: RawRelationConfig;
784
+ validate?: OperatorValidateConfig[];
785
+ hooks?: OperatorFieldHook;
786
+ serial?: {
787
+ start: number;
788
+ maxValue?: number;
789
+ format?: string;
790
+ };
791
+ scale?: number;
792
+ fields?: Record<string, OperatorFieldConfig>;
793
+ }
794
+ type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
795
+ type StandardPermissionOperator = "eq" | "ne" | "in" | "nin" | "hasAny" | "nhasAny";
796
+ type UserOperand = {
797
+ user: string;
798
+ };
799
+ type StandardRecordOperand<Update extends boolean = false> = Update extends true ? {
800
+ oldRecord: string;
801
+ } | {
802
+ newRecord: string;
803
+ } : {
804
+ record: string;
805
+ };
806
+ type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ? StandardRecordOperand<Update> : never);
807
+ type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Update>, StandardPermissionOperator, PermissionOperand<Level, Update>];
808
+ type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
809
+ conditions: readonly StandardPermissionCondition<Level, Update>[];
810
+ description?: string;
811
+ permit: "allow" | "deny";
812
+ };
813
+ type StandardTailorTypePermission = {
814
+ create: readonly StandardActionPermission<"record", false>[];
815
+ read: readonly StandardActionPermission<"record", false>[];
816
+ update: readonly StandardActionPermission<"record", true>[];
817
+ delete: readonly StandardActionPermission<"record", false>[];
818
+ };
819
+ type StandardGqlPermissionPolicy = {
820
+ conditions: readonly StandardPermissionCondition<"gql">[];
821
+ actions: readonly ["all"] | readonly GqlPermissionAction[];
822
+ permit: "allow" | "deny";
823
+ description?: string;
824
+ };
825
+ type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
826
+ interface Permissions {
827
+ record?: StandardTailorTypePermission;
828
+ gql?: StandardTailorTypeGqlPermission;
829
+ }
830
+ interface ParsedField {
831
+ name: string;
832
+ config: OperatorFieldConfig;
833
+ relation?: {
834
+ targetType: string;
835
+ forwardName: string;
836
+ backwardName: string;
837
+ key: string;
838
+ unique: boolean;
839
+ };
840
+ }
841
+ interface ParsedRelationship {
842
+ name: string;
843
+ targetType: string;
844
+ targetField: string;
845
+ sourceField: string;
846
+ isArray: boolean;
847
+ description: string;
848
+ }
849
+ interface TailorDBType {
850
+ name: string;
851
+ pluralForm: string;
852
+ description?: string;
853
+ fields: Record<string, ParsedField>;
854
+ forwardRelationships: Record<string, ParsedRelationship>;
855
+ backwardRelationships: Record<string, ParsedRelationship>;
856
+ settings: TailorDBTypeParsedSettings;
857
+ permissions: Permissions;
858
+ indexes?: TailorDBTypeMetadata["indexes"];
859
+ files?: TailorDBTypeMetadata["files"];
860
+ }
861
+ //#endregion
862
+ export { InferredAttributeList as A, FieldOutput as C, Validators as D, FieldValidateInput as E, InferFieldsOutput as F, JsonCompatible as I, JsonValue as L, TailorInvoker as M, TailorUser as N, AttributeList as O, unauthenticatedTailorUser as P, Prettify as R, FieldOptions as S, TailorToTs as T, PluginAttachment as _, TypeSourceInfoEntry as a, EnumValue as b, TailorAnyDBType as c, TailorDBType$1 as d, DBFieldMetadata as f, TailorField as g, SerialConfig as h, TailorDBType as i, InferredAttributeMap as j, AttributeMap as k, TailorDBField as l, GqlOperationsConfig as m, RelationType as n, ValueOperand as o, DefinedDBFieldMetadata as p, TailorDBServiceInput as r, TailorAnyDBField as s, IndexDef as t, TailorDBInstance as u, ArrayFieldOutput as v, TailorFieldType as w, FieldMetadata as x, DefinedFieldMetadata as y, output as z };
863
+ //# sourceMappingURL=tailordb-BlBGmQK-.d.mts.map