@tailor-platform/sdk 1.4.2 → 1.5.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.
@@ -1,10 +1,7 @@
1
1
  /// <reference path="./user-defined.d.ts" />
2
- import * as zod0 from "zod";
3
2
  import { z } from "zod";
4
- import * as type_fest0 from "type-fest";
5
- import { IsAny, NonEmptyObject } from "type-fest";
6
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
7
- import * as zod_v4_core0 from "zod/v4/core";
4
+ import { IsAny, NonEmptyObject } from "type-fest";
8
5
 
9
6
  //#region src/parser/service/tailordb/relation.d.ts
10
7
  declare const relationTypes: {
@@ -17,13 +14,33 @@ declare const relationTypes: {
17
14
  };
18
15
  type RelationType = keyof typeof relationTypes;
19
16
  //#endregion
17
+ //#region src/configure/types/field.d.ts
18
+ type AllowedValue = EnumValue;
19
+ type AllowedValues = [string | EnumValue, ...(string | EnumValue)[]];
20
+ type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ? T extends string ? T : T extends {
21
+ value: infer K;
22
+ } ? K : never : never;
23
+ //#endregion
24
+ //#region src/configure/types/brand.d.ts
25
+ /**
26
+ * Symbol brands for type identification.
27
+ * These symbols are used to reliably identify SDK objects
28
+ * without relying on instanceof checks or property shape detection.
29
+ */
30
+ /** Brand symbol for TailorField instances */
31
+ declare const TAILOR_FIELD_BRAND: unique symbol;
32
+ /** Brand symbol for TailorDBField instances */
33
+ declare const TAILOR_DB_FIELD_BRAND: unique symbol;
34
+ /** Brand symbol for TailorDBType instances */
35
+ declare const TAILOR_DB_TYPE_BRAND: unique symbol;
36
+ //#endregion
20
37
  //#region src/configure/types/helpers.d.ts
21
- type Prettify<T$1> = { [K in keyof T$1 as string extends K ? never : K]: T$1[K] } & {};
22
- type DeepWritable<T$1> = T$1 extends Date | RegExp | Function ? T$1 : T$1 extends object ? { -readonly [P in keyof T$1]: DeepWritable<T$1[P]> } & {} : T$1;
23
- type output<T$1> = T$1 extends {
38
+ type Prettify<T> = { [K in keyof T as string extends K ? never : K]: T[K] } & {};
39
+ type DeepWritable<T> = T extends Date | RegExp | Function ? T : T extends object ? { -readonly [P in keyof T]: DeepWritable<T[P]> } & {} : T;
40
+ type output<T> = T extends {
24
41
  _output: infer U;
25
42
  } ? DeepWritable<U> : never;
26
- type NullableToOptional<T$1> = { [K in keyof T$1 as null extends T$1[K] ? never : K]: T$1[K] } & { [K in keyof T$1 as null extends T$1[K] ? K : never]?: T$1[K] };
43
+ 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] };
27
44
  type InferFieldsOutput<F extends Record<string, {
28
45
  _output: any;
29
46
  [key: string]: any;
@@ -34,96 +51,9 @@ type InferFieldsOutput<F extends Record<string, {
34
51
  * so they can't be assigned to JsonValue's {[Key in string]: JsonValue}.
35
52
  * This type uses a recursive check instead.
36
53
  */
37
- type JsonCompatible<T$1> = T$1 extends string | number | boolean | null | undefined ? T$1 : T$1 extends readonly (infer U)[] ? JsonCompatible<U>[] : T$1 extends object ? T$1 extends {
54
+ type JsonCompatible<T> = T extends string | number | boolean | null | undefined ? T : T extends readonly (infer U)[] ? JsonCompatible<U>[] : T extends object ? T extends {
38
55
  toJSON: () => unknown;
39
- } ? never : { [K in keyof T$1]: JsonCompatible<T$1[K]> } : never;
40
- //#endregion
41
- //#region src/configure/types/validation.d.ts
42
- /**
43
- * Validation function type
44
- */
45
- type ValidateFn<O, D$1 = unknown> = (args: {
46
- value: O;
47
- data: D$1;
48
- user: TailorUser;
49
- }) => boolean;
50
- /**
51
- * Validation configuration with custom error message
52
- */
53
- type ValidateConfig<O, D$1 = unknown> = [ValidateFn<O, D$1>, string];
54
- /**
55
- * Field-level validation function
56
- */
57
- type FieldValidateFn<O> = ValidateFn<O>;
58
- /**
59
- * Field-level validation configuration
60
- */
61
- type FieldValidateConfig<O> = ValidateConfig<O>;
62
- /**
63
- * Input type for field validation - can be either a function or a tuple of [function, errorMessage]
64
- */
65
- type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
66
- /**
67
- * Base validators type for field collections
68
- * @template F - Record of fields
69
- * @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
70
- */
71
- type ValidatorsBase<F extends Record<string, {
72
- _defined: any;
73
- _output: any;
74
- [key: string]: any;
75
- }>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
76
- validate: unknown;
77
- } ? 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>>)[] }>;
78
- /**
79
- * Validators type (by default excludes "id" field for TailorDB compatibility)
80
- * Can be used with both TailorField and TailorDBField
81
- */
82
- type Validators<F extends Record<string, {
83
- _defined: any;
84
- _output: any;
85
- [key: string]: any;
86
- }>> = ValidatorsBase<F, "id">;
87
- //#endregion
88
- //#region src/configure/types/types.d.ts
89
- type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
90
- type TailorToTs = {
91
- string: string;
92
- integer: number;
93
- float: number;
94
- boolean: boolean;
95
- uuid: string;
96
- date: string;
97
- datetime: string | Date;
98
- time: string;
99
- enum: string;
100
- object: Record<string, unknown>;
101
- nested: Record<string, unknown>;
102
- } & Record<TailorFieldType, unknown>;
103
- interface FieldMetadata {
104
- description?: string;
105
- required?: boolean;
106
- array?: boolean;
107
- allowedValues?: AllowedValue[];
108
- validate?: FieldValidateInput<any>[];
109
- typeName?: string;
110
- }
111
- interface DefinedFieldMetadata {
112
- type: TailorFieldType;
113
- array: boolean;
114
- description?: boolean;
115
- validate?: boolean;
116
- typeName?: boolean;
117
- }
118
- type FieldOptions = {
119
- optional?: boolean;
120
- array?: boolean;
121
- };
122
- type FieldOutput$1<T$1, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T$1, O>, O>;
123
- type OptionalFieldOutput<T$1, O extends FieldOptions> = O["optional"] extends true ? T$1 | null : T$1;
124
- type ArrayFieldOutput<T$1, O extends FieldOptions> = [O] extends [{
125
- array: true;
126
- }] ? T$1[] : T$1;
56
+ } ? never : { [K in keyof T]: JsonCompatible<T[K]> } : never;
127
57
  //#endregion
128
58
  //#region src/parser/service/resolver/schema.d.ts
129
59
  declare const QueryTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"query">, z.ZodLiteral<"mutation">]>;
@@ -234,25 +164,42 @@ type FieldParseArgs = {
234
164
  data: unknown;
235
165
  user: TailorUser;
236
166
  };
237
- declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFieldMetadata, const Output = any, M extends FieldMetadata = FieldMetadata, T$1 extends TailorFieldType = TailorFieldType> implements TailorFieldInput {
238
- readonly type: T$1;
167
+ type FieldParseInternalArgs = {
168
+ value: any;
169
+ data: unknown;
170
+ user: TailorUser;
171
+ pathArray: string[];
172
+ };
173
+ /**
174
+ * TailorField interface representing a field with metadata, type information, and optional nested fields.
175
+ * This is the base field type used by both resolver types and TailorDB types.
176
+ * Using interface to allow self-referencing in the fields property.
177
+ */
178
+ interface TailorField<Defined extends DefinedFieldMetadata = DefinedFieldMetadata, Output = any, M extends FieldMetadata = FieldMetadata, T extends TailorFieldType = TailorFieldType> extends TailorFieldInput {
179
+ /** Brand symbol for type identification */
180
+ readonly [TAILOR_FIELD_BRAND]: true;
181
+ readonly type: T;
239
182
  readonly fields: Record<string, TailorAnyField>;
240
- protected _metadata: M;
241
183
  readonly _defined: Defined;
242
184
  readonly _output: Output;
243
- get metadata(): M;
244
- protected constructor(type: T$1, options?: FieldOptions, fields?: Record<string, TailorAnyField>, values?: AllowedValues);
245
- static create<const TType extends TailorFieldType, const TOptions extends FieldOptions, const OutputBase = TailorToTs[TType]>(type: TType, options?: TOptions, fields?: Record<string, TailorAnyField>, values?: AllowedValues): TailorField<{
246
- type: TType;
247
- array: TOptions extends {
248
- array: true;
249
- } ? true : false;
250
- }, FieldOutput$1<OutputBase, TOptions>, FieldMetadata, TailorFieldType>;
185
+ _metadata: M;
186
+ /** Returns a shallow copy of the metadata */
187
+ readonly metadata: M;
188
+ /**
189
+ * Set a description for the field
190
+ * @param description - The description text
191
+ * @returns The field with updated metadata
192
+ */
251
193
  description<CurrentDefined extends Defined>(this: CurrentDefined extends {
252
194
  description: unknown;
253
195
  } ? never : TailorField<CurrentDefined, Output>, description: string): TailorField<Prettify<CurrentDefined & {
254
196
  description: true;
255
197
  }>, Output>;
198
+ /**
199
+ * Set a custom type name for enum or nested types
200
+ * @param typeName - The custom type name
201
+ * @returns The field with updated metadata
202
+ */
256
203
  typeName<CurrentDefined extends Defined>(this: CurrentDefined extends {
257
204
  typeName: unknown;
258
205
  } ? never : CurrentDefined extends {
@@ -260,6 +207,11 @@ declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFi
260
207
  } ? TailorField<CurrentDefined, Output> : never, typeName: string): TailorField<Prettify<CurrentDefined & {
261
208
  typeName: true;
262
209
  }>, Output>;
210
+ /**
211
+ * Add validation functions to the field
212
+ * @param validate - One or more validation functions
213
+ * @returns The field with updated metadata
214
+ */
263
215
  validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
264
216
  validate: unknown;
265
217
  } ? never : TailorField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorField<Prettify<CurrentDefined & {
@@ -272,21 +224,13 @@ declare class TailorField<const Defined extends DefinedFieldMetadata = DefinedFi
272
224
  * @returns Validation result
273
225
  */
274
226
  parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;
275
- /**
276
- * Validate a single value (not an array element)
277
- * Used internally for array element validation
278
- * @private
279
- * @param args - Validation arguments
280
- * @returns Validation issues
281
- */
282
- private _validateValue;
283
227
  /**
284
228
  * Internal parse method that tracks field path for nested validation
285
229
  * @private
286
230
  * @param args - Parse arguments
287
231
  * @returns Validation result
288
232
  */
289
- private _parseInternal;
233
+ _parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;
290
234
  }
291
235
  //#endregion
292
236
  //#region src/configure/types/user.d.ts
@@ -324,6 +268,93 @@ type TailorUser = {
324
268
  /** Represents an unauthenticated user in the Tailor platform. */
325
269
  declare const unauthenticatedTailorUser: TailorUser;
326
270
  //#endregion
271
+ //#region src/configure/types/validation.d.ts
272
+ /**
273
+ * Validation function type
274
+ */
275
+ type ValidateFn<O, D$1 = unknown> = (args: {
276
+ value: O;
277
+ data: D$1;
278
+ user: TailorUser;
279
+ }) => boolean;
280
+ /**
281
+ * Validation configuration with custom error message
282
+ */
283
+ type ValidateConfig<O, D$1 = unknown> = [ValidateFn<O, D$1>, string];
284
+ /**
285
+ * Field-level validation function
286
+ */
287
+ type FieldValidateFn<O> = ValidateFn<O>;
288
+ /**
289
+ * Field-level validation configuration
290
+ */
291
+ type FieldValidateConfig<O> = ValidateConfig<O>;
292
+ /**
293
+ * Input type for field validation - can be either a function or a tuple of [function, errorMessage]
294
+ */
295
+ type FieldValidateInput<O> = FieldValidateFn<O> | FieldValidateConfig<O>;
296
+ /**
297
+ * Base validators type for field collections
298
+ * @template F - Record of fields
299
+ * @template ExcludeKeys - Keys to exclude from validation (default: "id" for TailorDB)
300
+ */
301
+ type ValidatorsBase<F extends Record<string, {
302
+ _defined: any;
303
+ _output: any;
304
+ [key: string]: any;
305
+ }>, ExcludeKeys extends string = "id"> = NonEmptyObject<{ [K in Exclude<keyof F, ExcludeKeys> as F[K]["_defined"] extends {
306
+ validate: unknown;
307
+ } ? 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>>)[] }>;
308
+ /**
309
+ * Validators type (by default excludes "id" field for TailorDB compatibility)
310
+ * Can be used with both TailorField and TailorDBField
311
+ */
312
+ type Validators<F extends Record<string, {
313
+ _defined: any;
314
+ _output: any;
315
+ [key: string]: any;
316
+ }>> = ValidatorsBase<F, "id">;
317
+ //#endregion
318
+ //#region src/configure/types/types.d.ts
319
+ type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
320
+ type TailorToTs = {
321
+ string: string;
322
+ integer: number;
323
+ float: number;
324
+ boolean: boolean;
325
+ uuid: string;
326
+ date: string;
327
+ datetime: string | Date;
328
+ time: string;
329
+ enum: string;
330
+ object: Record<string, unknown>;
331
+ nested: Record<string, unknown>;
332
+ } & Record<TailorFieldType, unknown>;
333
+ interface FieldMetadata {
334
+ description?: string;
335
+ required?: boolean;
336
+ array?: boolean;
337
+ allowedValues?: AllowedValue[];
338
+ validate?: FieldValidateInput<any>[];
339
+ typeName?: string;
340
+ }
341
+ interface DefinedFieldMetadata {
342
+ type: TailorFieldType;
343
+ array: boolean;
344
+ description?: boolean;
345
+ validate?: boolean;
346
+ typeName?: boolean;
347
+ }
348
+ type FieldOptions = {
349
+ optional?: boolean;
350
+ array?: boolean;
351
+ };
352
+ type FieldOutput$1<T, O extends FieldOptions> = OptionalFieldOutput<ArrayFieldOutput<T, O>, O>;
353
+ type OptionalFieldOutput<T, O extends FieldOptions> = O["optional"] extends true ? T | null : T;
354
+ type ArrayFieldOutput<T, O extends FieldOptions> = [O] extends [{
355
+ array: true;
356
+ }] ? T[] : T;
357
+ //#endregion
327
358
  //#region src/configure/services/tailordb/permission.d.ts
328
359
  type TailorTypePermission<User extends object = InferredAttributeMap, Type extends object = object> = {
329
360
  create: readonly ActionPermission<"record", User, Type, false>[];
@@ -379,7 +410,8 @@ type ContainsCondition<Level extends "record" | "gql" = "record", User extends o
379
410
  * Type representing a permission condition that combines user attributes, record fields, and literal values using comparison operators.
380
411
  *
381
412
  * The User type is extended by `user-defined.d.ts`, which is automatically generated when running `tailor-sdk generate`.
382
- * Attributes enabled in the config file's `auth.userProfile.attributes` become available as types.
413
+ * Attributes enabled in the config file's `auth.userProfile.attributes` (or
414
+ * `auth.machineUserAttributes` when userProfile is omitted) become available as types.
383
415
  * @example
384
416
  * ```ts
385
417
  * // tailor.config.ts
@@ -413,10 +445,10 @@ declare const unsafeAllowAllTypePermission: TailorTypePermission;
413
445
  declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
414
446
  //#endregion
415
447
  //#region src/configure/services/tailordb/types.d.ts
416
- type SerialConfig<T$1 extends "string" | "integer" = "string" | "integer"> = Prettify<{
448
+ type SerialConfig<T extends "string" | "integer" = "string" | "integer"> = Prettify<{
417
449
  start: number;
418
450
  maxValue?: number;
419
- } & (T$1 extends "string" ? {
451
+ } & (T extends "string" ? {
420
452
  format?: string;
421
453
  } : object)>;
422
454
  interface DBFieldMetadata extends FieldMetadata {
@@ -444,10 +476,10 @@ interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
444
476
  serial?: boolean;
445
477
  relation?: boolean;
446
478
  }
447
- type ExcludeNestedDBFields<T$1 extends Record<string, TailorAnyDBField>> = { [K in keyof T$1]: T$1[K] extends TailorDBField<{
479
+ type ExcludeNestedDBFields<T extends Record<string, TailorAnyDBField>> = { [K in keyof T]: T[K] extends TailorDBField<{
448
480
  type: "nested";
449
481
  array: boolean;
450
- }, any> ? never : T$1[K] };
482
+ }, any> ? never : T[K] };
451
483
  type HookFn<TValue, TData, TReturn> = (args: {
452
484
  value: TValue;
453
485
  data: TData extends Record<string, unknown> ? { readonly [K in keyof TData]?: TData[K] | null | undefined } : unknown;
@@ -473,10 +505,10 @@ type TailorDBExternalConfig = {
473
505
  type TailorDBServiceInput = {
474
506
  [namespace: string]: TailorDBServiceConfig | TailorDBExternalConfig;
475
507
  };
476
- type IndexDef<T$1 extends {
508
+ type IndexDef<T extends {
477
509
  fields: Record<PropertyKey, unknown>;
478
510
  }> = {
479
- fields: [keyof T$1["fields"], keyof T$1["fields"], ...(keyof T$1["fields"])[]];
511
+ fields: [keyof T["fields"], keyof T["fields"], ...(keyof T["fields"])[]];
480
512
  unique?: boolean;
481
513
  name?: string;
482
514
  };
@@ -486,69 +518,404 @@ interface TypeFeatures {
486
518
  bulkUpsert?: true;
487
519
  }
488
520
  //#endregion
489
- //#region src/parser/service/auth/schema.d.ts
490
- declare const AuthInvokerSchema: z.ZodObject<{
491
- namespace: z.ZodString;
492
- machineUserName: z.ZodString;
493
- }, z.core.$strip>;
494
- declare const OIDCSchema: z.ZodObject<{
495
- name: z.ZodString;
496
- kind: z.ZodLiteral<"OIDC">;
497
- clientID: z.ZodString;
498
- clientSecret: z.ZodObject<{
499
- vaultName: z.ZodString;
500
- secretKey: z.ZodString;
501
- }, z.core.$strip>;
502
- providerURL: z.ZodString;
503
- issuerURL: z.ZodOptional<z.ZodString>;
504
- usernameClaim: z.ZodOptional<z.ZodString>;
505
- }, z.core.$strip>;
506
- declare const SAMLSchema: z.ZodObject<{
507
- name: z.ZodString;
508
- kind: z.ZodLiteral<"SAML">;
509
- enableSignRequest: z.ZodDefault<z.ZodBoolean>;
510
- metadataURL: z.ZodOptional<z.ZodString>;
511
- rawMetadata: z.ZodOptional<z.ZodString>;
512
- }, z.core.$strip>;
513
- declare const IDTokenSchema: z.ZodObject<{
514
- name: z.ZodString;
515
- kind: z.ZodLiteral<"IDToken">;
516
- providerURL: z.ZodString;
517
- issuerURL: z.ZodOptional<z.ZodString>;
518
- clientID: z.ZodString;
519
- usernameClaim: z.ZodOptional<z.ZodString>;
520
- }, z.core.$strip>;
521
- declare const BuiltinIdPSchema: z.ZodObject<{
522
- name: z.ZodString;
523
- kind: z.ZodLiteral<"BuiltInIdP">;
524
- namespace: z.ZodString;
525
- clientName: z.ZodString;
526
- }, z.core.$strip>;
527
- declare const IdProviderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
528
- name: z.ZodString;
529
- kind: z.ZodLiteral<"OIDC">;
530
- clientID: z.ZodString;
531
- clientSecret: z.ZodObject<{
532
- vaultName: z.ZodString;
533
- secretKey: z.ZodString;
534
- }, z.core.$strip>;
535
- providerURL: z.ZodString;
536
- issuerURL: z.ZodOptional<z.ZodString>;
537
- usernameClaim: z.ZodOptional<z.ZodString>;
538
- }, z.core.$strip>, z.ZodObject<{
539
- name: z.ZodString;
540
- kind: z.ZodLiteral<"SAML">;
541
- enableSignRequest: z.ZodDefault<z.ZodBoolean>;
542
- metadataURL: z.ZodOptional<z.ZodString>;
543
- rawMetadata: z.ZodOptional<z.ZodString>;
544
- }, z.core.$strip>, z.ZodObject<{
545
- name: z.ZodString;
546
- kind: z.ZodLiteral<"IDToken">;
547
- providerURL: z.ZodString;
548
- issuerURL: z.ZodOptional<z.ZodString>;
549
- clientID: z.ZodString;
550
- usernameClaim: z.ZodOptional<z.ZodString>;
551
- }, z.core.$strip>, z.ZodObject<{
521
+ //#region src/configure/services/tailordb/schema.d.ts
522
+ interface RelationConfig<S extends RelationType, T extends TailorDBType> {
523
+ type: S;
524
+ toward: {
525
+ type: T;
526
+ as?: string;
527
+ key?: keyof T["fields"] & string;
528
+ };
529
+ backward?: string;
530
+ }
531
+ type RelationSelfConfig = {
532
+ type: RelationType;
533
+ toward: {
534
+ type: "self";
535
+ as?: string;
536
+ key?: string;
537
+ };
538
+ backward?: string;
539
+ };
540
+ type TailorAnyDBField = TailorDBField<any, any>;
541
+ /**
542
+ * TailorDBField interface representing a database field with extended metadata.
543
+ * Extends TailorField with database-specific features like relations, indexes, and hooks.
544
+ */
545
+ interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends Omit<TailorField<Defined, Output, DBFieldMetadata, Defined["type"]>, "description" | "validate"> {
546
+ /** Brand symbol for type identification */
547
+ readonly [TAILOR_DB_FIELD_BRAND]: true;
548
+ /** Returns a shallow copy of the raw relation config if set */
549
+ readonly rawRelation: Readonly<RawRelationConfig> | undefined;
550
+ /**
551
+ * Set a description for the field
552
+ * @param description - The description text
553
+ * @returns The field with updated metadata
554
+ */
555
+ description<CurrentDefined extends Defined>(this: CurrentDefined extends {
556
+ description: unknown;
557
+ } ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
558
+ description: true;
559
+ }>, Output>;
560
+ /**
561
+ * Define a relation to another type
562
+ */
563
+ relation<S extends RelationType, T extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
564
+ relation: unknown;
565
+ } ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
566
+ unique: true;
567
+ index: true;
568
+ relation: true;
569
+ }> : Prettify<CurrentDefined & {
570
+ index: true;
571
+ relation: true;
572
+ }>, Output>;
573
+ /**
574
+ * Define a self-referencing relation
575
+ */
576
+ relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
577
+ relation: unknown;
578
+ } ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
579
+ unique: true;
580
+ index: true;
581
+ relation: true;
582
+ }> : Prettify<CurrentDefined & {
583
+ index: true;
584
+ relation: true;
585
+ }>, Output>;
586
+ /**
587
+ * Add an index to the field
588
+ */
589
+ index<CurrentDefined extends Defined>(this: CurrentDefined extends {
590
+ index: unknown;
591
+ } ? never : CurrentDefined extends {
592
+ array: true;
593
+ } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
594
+ index: true;
595
+ }>, Output>;
596
+ /**
597
+ * Make the field unique (also adds an index)
598
+ */
599
+ unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
600
+ unique: unknown;
601
+ } ? never : CurrentDefined extends {
602
+ array: true;
603
+ } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
604
+ unique: true;
605
+ index: true;
606
+ }>, Output>;
607
+ /**
608
+ * Enable vector search on the field (string type only)
609
+ */
610
+ vector<CurrentDefined extends Defined>(this: CurrentDefined extends {
611
+ vector: unknown;
612
+ } ? never : CurrentDefined extends {
613
+ type: "string";
614
+ array: false;
615
+ } ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
616
+ vector: true;
617
+ }>, Output>;
618
+ /**
619
+ * Add hooks for create/update operations
620
+ */
621
+ hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
622
+ hooks: unknown;
623
+ } ? never : CurrentDefined extends {
624
+ type: "nested";
625
+ } ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
626
+ hooks?: {
627
+ create: H extends {
628
+ create: unknown;
629
+ } ? true : false;
630
+ update: H extends {
631
+ update: unknown;
632
+ } ? true : false;
633
+ };
634
+ serial: false;
635
+ }>, Output>;
636
+ /**
637
+ * Add validation functions to the field
638
+ */
639
+ validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
640
+ validate: unknown;
641
+ } ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
642
+ validate: true;
643
+ }>, Output>;
644
+ /**
645
+ * Configure serial/auto-increment behavior
646
+ */
647
+ serial<CurrentDefined extends Defined>(this: CurrentDefined extends {
648
+ serial: unknown;
649
+ } ? never : Output extends null ? never : CurrentDefined extends {
650
+ type: "integer" | "string";
651
+ array: false;
652
+ } ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
653
+ serial: true;
654
+ hooks: {
655
+ create: false;
656
+ update: false;
657
+ };
658
+ }>, Output>;
659
+ /**
660
+ * Clone the field with optional overrides for field options
661
+ * @param options - Optional field options to override
662
+ * @returns A new TailorDBField instance with the same configuration
663
+ */
664
+ clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
665
+ array: NewOpt extends {
666
+ array: true;
667
+ } ? true : Defined["array"];
668
+ }>, FieldOutput$1<TailorToTs[Defined["type"]], NewOpt>>;
669
+ }
670
+ declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
671
+ type: "uuid";
672
+ array: Opt extends {
673
+ array: true;
674
+ } ? true : false;
675
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
676
+ declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
677
+ type: "string";
678
+ array: Opt extends {
679
+ array: true;
680
+ } ? true : false;
681
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
682
+ declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
683
+ type: "boolean";
684
+ array: Opt extends {
685
+ array: true;
686
+ } ? true : false;
687
+ }, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
688
+ declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
689
+ type: "integer";
690
+ array: Opt extends {
691
+ array: true;
692
+ } ? true : false;
693
+ }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
694
+ declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
695
+ type: "float";
696
+ array: Opt extends {
697
+ array: true;
698
+ } ? true : false;
699
+ }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
700
+ declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
701
+ type: "date";
702
+ array: Opt extends {
703
+ array: true;
704
+ } ? true : false;
705
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
706
+ declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
707
+ type: "datetime";
708
+ array: Opt extends {
709
+ array: true;
710
+ } ? true : false;
711
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
712
+ declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
713
+ type: "time";
714
+ array: Opt extends {
715
+ array: true;
716
+ } ? true : false;
717
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
718
+ declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
719
+ type: "enum";
720
+ array: Opt extends {
721
+ array: true;
722
+ } ? true : false;
723
+ }, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
724
+ declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
725
+ type: "nested";
726
+ array: Opt extends {
727
+ array: true;
728
+ } ? true : false;
729
+ }, FieldOutput$1<InferFieldsOutput<F>, Opt>>;
730
+ type TailorAnyDBType = TailorDBType<any, any>;
731
+ /**
732
+ * TailorDBType interface representing a database type definition with fields, permissions, and settings.
733
+ */
734
+ interface TailorDBType<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
735
+ /** Brand symbol for type identification */
736
+ readonly [TAILOR_DB_TYPE_BRAND]: true;
737
+ readonly name: string;
738
+ readonly fields: Fields;
739
+ readonly _output: InferFieldsOutput<Fields>;
740
+ _description?: string;
741
+ /** Returns metadata for the type */
742
+ readonly metadata: TailorDBTypeMetadata;
743
+ /**
744
+ * Add hooks for fields
745
+ */
746
+ hooks(hooks: Hooks<Fields>): TailorDBType<Fields, User>;
747
+ /**
748
+ * Add validators for fields
749
+ */
750
+ validate(validators: Validators<Fields>): TailorDBType<Fields, User>;
751
+ /**
752
+ * Configure type features
753
+ */
754
+ features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType<Fields, User>;
755
+ /**
756
+ * Define composite indexes
757
+ */
758
+ indexes(...indexes: IndexDef<TailorDBType<Fields, User>>[]): TailorDBType<Fields, User>;
759
+ /**
760
+ * Define file fields
761
+ */
762
+ files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<TailorDBType<Fields, User>>, never>>): TailorDBType<Fields, User>;
763
+ /**
764
+ * Set record-level permissions
765
+ */
766
+ permission<U$1 extends object = User, P$1 extends TailorTypePermission<U$1, output<TailorDBType<Fields, User>>> = TailorTypePermission<U$1, output<TailorDBType<Fields, User>>>>(permission: P$1): TailorDBType<Fields, U$1>;
767
+ /**
768
+ * Set GraphQL-level permissions
769
+ */
770
+ gqlPermission<U$1 extends object = User, P$1 extends TailorTypeGqlPermission<U$1> = TailorTypeGqlPermission<U$1>>(permission: P$1): TailorDBType<Fields, U$1>;
771
+ /**
772
+ * Set type description
773
+ */
774
+ description(description: string): TailorDBType<Fields, User>;
775
+ /**
776
+ * Pick specific fields from the type
777
+ */
778
+ pickFields<K$1 extends keyof Fields, const Opt extends FieldOptions>(keys: K$1[], options: Opt): { [P in K$1]: Fields[P$1] extends TailorDBField<infer D, infer _O> ? TailorDBField<Omit<D, "array"> & {
779
+ array: Opt extends {
780
+ array: true;
781
+ } ? true : D["array"];
782
+ }, FieldOutput$1<TailorToTs[D["type"]], Opt>> : never };
783
+ /**
784
+ * Omit specific fields from the type
785
+ */
786
+ omitFields<K$1 extends keyof Fields>(keys: K$1[]): Omit<Fields, K$1>;
787
+ }
788
+ type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType<Fields, User>;
789
+ declare const idField: TailorDBField<{
790
+ type: "uuid";
791
+ array: false;
792
+ }, string>;
793
+ type idField = typeof idField;
794
+ type DBType<F extends {
795
+ id?: never;
796
+ } & Record<string, TailorAnyDBField>> = TailorDBInstance<{
797
+ id: idField;
798
+ } & F>;
799
+ /**
800
+ * Creates a new database type with the specified fields
801
+ * @param name - The name of the type, or a tuple of [name, pluralForm]
802
+ * @param fields - The field definitions for the type
803
+ * @returns A new TailorDBType instance
804
+ */
805
+ declare function dbType<const F extends {
806
+ id?: never;
807
+ } & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
808
+ /**
809
+ * Creates a new database type with the specified fields and description
810
+ * @param name - The name of the type, or a tuple of [name, pluralForm]
811
+ * @param description - A description of the type
812
+ * @param fields - The field definitions for the type
813
+ * @returns A new TailorDBType instance
814
+ */
815
+ declare function dbType<const F extends {
816
+ id?: never;
817
+ } & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
818
+ declare const db: {
819
+ type: typeof dbType;
820
+ uuid: typeof uuid;
821
+ string: typeof string;
822
+ bool: typeof bool;
823
+ int: typeof int;
824
+ float: typeof float;
825
+ date: typeof date;
826
+ datetime: typeof datetime;
827
+ time: typeof time;
828
+ enum: typeof _enum;
829
+ object: typeof object;
830
+ fields: {
831
+ timestamps: () => {
832
+ createdAt: TailorDBField<{
833
+ type: "datetime";
834
+ array: false;
835
+ hooks?: {
836
+ create: true;
837
+ update: false;
838
+ } | undefined;
839
+ serial: false;
840
+ description: true;
841
+ }, string | Date>;
842
+ updatedAt: TailorDBField<{
843
+ type: "datetime";
844
+ array: false;
845
+ hooks?: {
846
+ create: false;
847
+ update: true;
848
+ } | undefined;
849
+ serial: false;
850
+ description: true;
851
+ }, string | Date | null>;
852
+ };
853
+ };
854
+ };
855
+ //#endregion
856
+ //#region src/parser/service/auth/schema.d.ts
857
+ declare const AuthInvokerSchema: z.ZodObject<{
858
+ namespace: z.ZodString;
859
+ machineUserName: z.ZodString;
860
+ }, z.core.$strip>;
861
+ declare const OIDCSchema: z.ZodObject<{
862
+ name: z.ZodString;
863
+ kind: z.ZodLiteral<"OIDC">;
864
+ clientID: z.ZodString;
865
+ clientSecret: z.ZodObject<{
866
+ vaultName: z.ZodString;
867
+ secretKey: z.ZodString;
868
+ }, z.core.$strip>;
869
+ providerURL: z.ZodString;
870
+ issuerURL: z.ZodOptional<z.ZodString>;
871
+ usernameClaim: z.ZodOptional<z.ZodString>;
872
+ }, z.core.$strip>;
873
+ declare const SAMLSchema: z.ZodObject<{
874
+ name: z.ZodString;
875
+ kind: z.ZodLiteral<"SAML">;
876
+ enableSignRequest: z.ZodDefault<z.ZodBoolean>;
877
+ metadataURL: z.ZodOptional<z.ZodString>;
878
+ rawMetadata: z.ZodOptional<z.ZodString>;
879
+ }, z.core.$strip>;
880
+ declare const IDTokenSchema: z.ZodObject<{
881
+ name: z.ZodString;
882
+ kind: z.ZodLiteral<"IDToken">;
883
+ providerURL: z.ZodString;
884
+ issuerURL: z.ZodOptional<z.ZodString>;
885
+ clientID: z.ZodString;
886
+ usernameClaim: z.ZodOptional<z.ZodString>;
887
+ }, z.core.$strip>;
888
+ declare const BuiltinIdPSchema: z.ZodObject<{
889
+ name: z.ZodString;
890
+ kind: z.ZodLiteral<"BuiltInIdP">;
891
+ namespace: z.ZodString;
892
+ clientName: z.ZodString;
893
+ }, z.core.$strip>;
894
+ declare const IdProviderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
895
+ name: z.ZodString;
896
+ kind: z.ZodLiteral<"OIDC">;
897
+ clientID: z.ZodString;
898
+ clientSecret: z.ZodObject<{
899
+ vaultName: z.ZodString;
900
+ secretKey: z.ZodString;
901
+ }, z.core.$strip>;
902
+ providerURL: z.ZodString;
903
+ issuerURL: z.ZodOptional<z.ZodString>;
904
+ usernameClaim: z.ZodOptional<z.ZodString>;
905
+ }, z.core.$strip>, z.ZodObject<{
906
+ name: z.ZodString;
907
+ kind: z.ZodLiteral<"SAML">;
908
+ enableSignRequest: z.ZodDefault<z.ZodBoolean>;
909
+ metadataURL: z.ZodOptional<z.ZodString>;
910
+ rawMetadata: z.ZodOptional<z.ZodString>;
911
+ }, z.core.$strip>, z.ZodObject<{
912
+ name: z.ZodString;
913
+ kind: z.ZodLiteral<"IDToken">;
914
+ providerURL: z.ZodString;
915
+ issuerURL: z.ZodOptional<z.ZodString>;
916
+ clientID: z.ZodString;
917
+ usernameClaim: z.ZodOptional<z.ZodString>;
918
+ }, z.core.$strip>, z.ZodObject<{
552
919
  name: z.ZodString;
553
920
  kind: z.ZodLiteral<"BuiltInIdP">;
554
921
  namespace: z.ZodString;
@@ -693,7 +1060,7 @@ type UsernameFieldKey<User extends TailorDBInstance> = IsAny<User> extends true
693
1060
  type UserAttributeKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldSupportsValueOperand<User, K> extends true ? FieldIsOfType<User, K, "datetime" | "date" | "time"> extends true ? never : K : never }[UserFieldKeys<User>];
694
1061
  type UserAttributeListKey<User extends TailorDBInstance> = { [K in UserFieldKeys<User>]: K extends "id" ? never : FieldIsOfType<User, K, "uuid"> extends true ? FieldIsArray<User, K> extends true ? never : K : never }[UserFieldKeys<User>];
695
1062
  type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
696
- type DisallowExtraKeys<T$1, Allowed extends PropertyKey> = T$1 & { [K in Exclude<keyof T$1, Allowed>]: never };
1063
+ type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
697
1064
  type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
698
1065
  type AttributeListToTuple<User extends TailorDBInstance, AttributeList$1 extends readonly UserAttributeListKey<User>[]> = { [Index in keyof AttributeList$1]: AttributeList$1[Index] extends UserAttributeListKey<User> ? AttributeListValue<User, AttributeList$1[Index]> : never };
699
1066
  type AttributeMapSelectedKeys<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>> = Extract<{ [K in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K] ? never : K }[keyof AttributeMap$1], UserAttributeKey<User>>;
@@ -710,7 +1077,28 @@ type UserProfile<User extends TailorDBInstance, AttributeMap$1 extends UserAttri
710
1077
  attributes?: DisallowExtraKeys<AttributeMap$1, UserAttributeKey<User>>;
711
1078
  attributeList?: AttributeList$1;
712
1079
  };
713
- type MachineUser<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[] = []> = IsAny<User> extends true ? {
1080
+ type MachineUserAttributeFields$1 = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
1081
+ type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
1082
+ type MachineUserAttributeValues<Fields extends MachineUserAttributeFields$1> = { [K in keyof Fields]: TailorFieldOutputValue<Fields[K]> extends ValueOperand | null | undefined ? TailorFieldOutputValue<Fields[K]> : never };
1083
+ type MachineUserFromAttributes<Fields extends MachineUserAttributeFields$1> = (keyof Fields extends never ? {
1084
+ attributes?: never;
1085
+ } : {
1086
+ attributes: DisallowExtraKeys<MachineUserAttributeValues<Fields>, keyof Fields>;
1087
+ }) & {
1088
+ attributeList?: string[];
1089
+ };
1090
+ type MachineUser<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields$1 | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
1091
+ attributes: Record<string, AuthAttributeValue>;
1092
+ attributeList?: string[];
1093
+ } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
1094
+ attributes?: never;
1095
+ } : {
1096
+ attributes: { [K in AttributeMapSelectedKeys<User, AttributeMap$1>]: K extends keyof output<User> ? output<User>[K] : never } & { [K in Exclude<keyof output<User>, AttributeMapSelectedKeys<User, AttributeMap$1>>]?: never };
1097
+ }) & ([] extends AttributeList$1 ? {
1098
+ attributeList?: never;
1099
+ } : {
1100
+ attributeList: AttributeListToTuple<User, AttributeList$1>;
1101
+ }) : [MachineUserAttributes] extends [MachineUserAttributeFields$1] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
714
1102
  attributes: Record<string, AuthAttributeValue>;
715
1103
  attributeList?: string[];
716
1104
  } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
@@ -722,9 +1110,10 @@ type MachineUser<User extends TailorDBInstance, AttributeMap$1 extends UserAttri
722
1110
  } : {
723
1111
  attributeList: AttributeListToTuple<User, AttributeList$1>;
724
1112
  });
725
- type AuthServiceInput<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[], MachineUserNames extends string> = {
1113
+ type AuthServiceInput<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields$1 | undefined = MachineUserAttributeFields$1 | undefined> = {
726
1114
  userProfile?: UserProfile<User, AttributeMap$1, AttributeList$1>;
727
- machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap$1, AttributeList$1>>;
1115
+ machineUserAttributes?: MachineUserAttributes;
1116
+ machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap$1, AttributeList$1, MachineUserAttributes>>;
728
1117
  oauth2Clients?: Record<string, OAuth2ClientInput>;
729
1118
  idProvider?: IdProviderConfig;
730
1119
  scim?: SCIMConfig;
@@ -737,469 +1126,170 @@ interface Script {
737
1126
  expr: string;
738
1127
  }
739
1128
  interface EnumValue {
740
- value: string;
741
- description?: string;
742
- }
743
- interface OperatorValidateConfig {
744
- script: Script;
745
- errorMessage: string;
746
- }
747
- interface OperatorFieldHook {
748
- create?: Script;
749
- update?: Script;
750
- }
751
- /**
752
- * Raw relation config stored in configure layer, processed in parser layer.
753
- * This is the serialized form of RelationConfig from schema.ts where
754
- * the TailorDBType reference is replaced with the type name string.
755
- */
756
- interface RawRelationConfig {
757
- type: RelationType;
758
- toward: {
759
- type: string;
760
- as?: string;
761
- key?: string;
762
- };
763
- backward?: string;
764
- }
765
- interface OperatorFieldConfig {
766
- type: string;
767
- required?: boolean;
768
- description?: string;
769
- allowedValues?: EnumValue[];
770
- array?: boolean;
771
- index?: boolean;
772
- unique?: boolean;
773
- vector?: boolean;
774
- foreignKey?: boolean;
775
- foreignKeyType?: string;
776
- foreignKeyField?: string;
777
- rawRelation?: RawRelationConfig;
778
- validate?: OperatorValidateConfig[];
779
- hooks?: OperatorFieldHook;
780
- serial?: {
781
- start: number;
782
- maxValue?: number;
783
- format?: string;
784
- };
785
- fields?: Record<string, OperatorFieldConfig>;
786
- }
787
- type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
788
- type StandardPermissionOperator = "eq" | "ne" | "in" | "nin";
789
- type UserOperand = {
790
- user: string;
791
- };
792
- type RecordOperand<Update extends boolean = false> = Update extends true ? {
793
- oldRecord: string;
794
- } | {
795
- newRecord: string;
796
- } : {
797
- record: string;
798
- };
799
- type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ? RecordOperand<Update> : never);
800
- type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Update>, StandardPermissionOperator, PermissionOperand<Level, Update>];
801
- type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
802
- conditions: readonly StandardPermissionCondition<Level, Update>[];
803
- description?: string;
804
- permit: "allow" | "deny";
805
- };
806
- type StandardTailorTypePermission = {
807
- create: readonly StandardActionPermission<"record", false>[];
808
- read: readonly StandardActionPermission<"record", false>[];
809
- update: readonly StandardActionPermission<"record", true>[];
810
- delete: readonly StandardActionPermission<"record", false>[];
811
- };
812
- type StandardGqlPermissionPolicy = {
813
- conditions: readonly StandardPermissionCondition<"gql">[];
814
- actions: readonly ["all"] | readonly GqlPermissionAction[];
815
- permit: "allow" | "deny";
816
- description?: string;
817
- };
818
- type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
819
- interface Permissions {
820
- record?: StandardTailorTypePermission;
821
- gql?: StandardTailorTypeGqlPermission;
822
- }
823
- interface RawPermissions {
824
- record?: TailorTypePermission<any, any>;
825
- gql?: TailorTypeGqlPermission<any, any>;
826
- }
827
- interface TailorDBTypeMetadata {
828
- name: string;
829
- description?: string;
830
- settings?: {
831
- pluralForm?: string;
832
- aggregation?: boolean;
833
- bulkUpsert?: boolean;
834
- };
835
- permissions: RawPermissions;
836
- files: Record<string, string>;
837
- indexes?: Record<string, {
838
- fields: string[];
839
- unique?: boolean;
840
- }>;
1129
+ value: string;
1130
+ description?: string;
841
1131
  }
842
- /**
843
- * Parsed and normalized TailorDB field information
844
- */
845
- interface ParsedField {
846
- name: string;
847
- config: OperatorFieldConfig;
848
- relation?: {
849
- targetType: string;
850
- forwardName: string;
851
- backwardName: string;
852
- key: string;
853
- unique: boolean;
854
- };
1132
+ interface OperatorValidateConfig {
1133
+ script: Script;
1134
+ errorMessage: string;
855
1135
  }
856
- /**
857
- * Parsed and normalized TailorDB relationship information
858
- */
859
- interface ParsedRelationship {
860
- name: string;
861
- targetType: string;
862
- targetField: string;
863
- sourceField: string;
864
- isArray: boolean;
865
- description: string;
1136
+ interface OperatorFieldHook {
1137
+ create?: Script;
1138
+ update?: Script;
866
1139
  }
867
1140
  /**
868
- * Parsed and normalized TailorDB type information
1141
+ * Raw relation config stored in configure layer, processed in parser layer.
1142
+ * This is the serialized form of RelationConfig from schema.ts where
1143
+ * the TailorDBType reference is replaced with the type name string.
869
1144
  */
870
- interface ParsedTailorDBType {
871
- name: string;
872
- pluralForm: string;
873
- description?: string;
874
- fields: Record<string, ParsedField>;
875
- forwardRelationships: Record<string, ParsedRelationship>;
876
- backwardRelationships: Record<string, ParsedRelationship>;
877
- settings: TailorDBTypeMetadata["settings"];
878
- permissions: Permissions;
879
- indexes?: TailorDBTypeMetadata["indexes"];
880
- files?: TailorDBTypeMetadata["files"];
881
- }
882
- //#endregion
883
- //#region src/configure/types/field.d.ts
884
- type AllowedValue = EnumValue;
885
- type AllowedValues = [string | EnumValue, ...(string | EnumValue)[]];
886
- type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T ? T extends string ? T : T extends {
887
- value: infer K;
888
- } ? K : never : never;
889
- //#endregion
890
- //#region src/configure/services/tailordb/schema.d.ts
891
- interface RelationConfig<S extends RelationType, T$1 extends TailorDBType> {
892
- type: S;
893
- toward: {
894
- type: T$1;
895
- as?: string;
896
- key?: keyof T$1["fields"] & string;
897
- };
898
- backward?: string;
899
- }
900
- type RelationSelfConfig = {
1145
+ interface RawRelationConfig {
901
1146
  type: RelationType;
902
1147
  toward: {
903
- type: "self";
1148
+ type: string;
904
1149
  as?: string;
905
1150
  key?: string;
906
1151
  };
907
1152
  backward?: string;
908
- };
909
- type TailorAnyDBField = TailorDBField<any, any>;
910
- declare class TailorDBField<const Defined extends DefinedDBFieldMetadata, const Output> extends TailorField<Defined, Output, DBFieldMetadata> {
911
- private _rawRelation;
912
- get rawRelation(): Readonly<RawRelationConfig> | undefined;
913
- get metadata(): {
914
- index?: boolean;
915
- unique?: boolean;
916
- vector?: boolean;
917
- foreignKey?: boolean;
918
- foreignKeyType?: string;
919
- foreignKeyField?: string;
920
- hooks?: Hook<any, any>;
921
- serial?: SerialConfig;
922
- relation?: boolean;
923
- description?: string;
924
- required?: boolean;
925
- array?: boolean;
926
- allowedValues?: AllowedValue[];
927
- validate?: FieldValidateInput<any>[];
928
- typeName?: string;
1153
+ }
1154
+ interface OperatorFieldConfig {
1155
+ type: string;
1156
+ required?: boolean;
1157
+ description?: string;
1158
+ allowedValues?: EnumValue[];
1159
+ array?: boolean;
1160
+ index?: boolean;
1161
+ unique?: boolean;
1162
+ vector?: boolean;
1163
+ foreignKey?: boolean;
1164
+ foreignKeyType?: string;
1165
+ foreignKeyField?: string;
1166
+ rawRelation?: RawRelationConfig;
1167
+ validate?: OperatorValidateConfig[];
1168
+ hooks?: OperatorFieldHook;
1169
+ serial?: {
1170
+ start: number;
1171
+ maxValue?: number;
1172
+ format?: string;
929
1173
  };
930
- private constructor();
931
- static create<const T$1 extends TailorFieldType, const TOptions extends FieldOptions, const OutputBase = TailorToTs[T$1]>(type: T$1, options?: TOptions, fields?: Record<string, TailorAnyDBField>, values?: AllowedValues): TailorDBField<{
932
- type: T$1;
933
- array: TOptions extends {
934
- array: true;
935
- } ? true : false;
936
- }, FieldOutput$1<OutputBase, TOptions>>;
937
- description<CurrentDefined extends Defined>(this: CurrentDefined extends {
938
- description: unknown;
939
- } ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
940
- description: true;
941
- }>, Output>;
942
- relation<S extends RelationType, T$1 extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
943
- relation: unknown;
944
- } ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T$1>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
945
- unique: true;
946
- index: true;
947
- relation: true;
948
- }> : Prettify<CurrentDefined & {
949
- index: true;
950
- relation: true;
951
- }>, Output>;
952
- relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
953
- relation: unknown;
954
- } ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
955
- unique: true;
956
- index: true;
957
- relation: true;
958
- }> : Prettify<CurrentDefined & {
959
- index: true;
960
- relation: true;
961
- }>, Output>;
962
- index<CurrentDefined extends Defined>(this: CurrentDefined extends {
963
- index: unknown;
964
- } ? never : CurrentDefined extends {
965
- array: true;
966
- } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
967
- index: true;
968
- }>, Output>;
969
- unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
970
- unique: unknown;
971
- } ? never : CurrentDefined extends {
972
- array: true;
973
- } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
974
- unique: true;
975
- index: true;
976
- }>, Output>;
977
- vector<CurrentDefined extends Defined>(this: CurrentDefined extends {
978
- vector: unknown;
979
- } ? never : CurrentDefined extends {
980
- type: "string";
981
- array: false;
982
- } ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
983
- vector: true;
984
- }>, Output>;
985
- hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
986
- hooks: unknown;
987
- } ? never : CurrentDefined extends {
988
- type: "nested";
989
- } ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
990
- hooks?: {
991
- create: H extends {
992
- create: unknown;
993
- } ? true : false;
994
- update: H extends {
995
- update: unknown;
996
- } ? true : false;
997
- };
998
- serial: false;
999
- }>, Output>;
1000
- validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
1001
- validate: unknown;
1002
- } ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
1003
- validate: true;
1004
- }>, Output>;
1005
- serial<CurrentDefined extends Defined>(this: CurrentDefined extends {
1006
- serial: unknown;
1007
- } ? never : Output extends null ? never : CurrentDefined extends {
1008
- type: "integer" | "string";
1009
- array: false;
1010
- } ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
1011
- serial: true;
1012
- hooks: {
1013
- create: false;
1014
- update: false;
1015
- };
1016
- }>, Output>;
1017
- /**
1018
- * Clone the field with optional overrides for field options
1019
- * @param options - Optional field options to override
1020
- * @returns A new TailorDBField instance with the same configuration
1021
- */
1022
- clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
1023
- array: NewOpt extends {
1024
- array: true;
1025
- } ? true : Defined["array"];
1026
- }>, FieldOutput$1<TailorToTs[Defined["type"]], NewOpt>>;
1174
+ fields?: Record<string, OperatorFieldConfig>;
1027
1175
  }
1028
- declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1029
- type: "uuid";
1030
- array: Opt extends {
1031
- array: true;
1032
- } ? true : false;
1033
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1034
- declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1035
- type: "string";
1036
- array: Opt extends {
1037
- array: true;
1038
- } ? true : false;
1039
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1040
- declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1041
- type: "boolean";
1042
- array: Opt extends {
1043
- array: true;
1044
- } ? true : false;
1045
- }, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
1046
- declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1047
- type: "integer";
1048
- array: Opt extends {
1049
- array: true;
1050
- } ? true : false;
1051
- }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
1052
- declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1053
- type: "float";
1054
- array: Opt extends {
1055
- array: true;
1056
- } ? true : false;
1057
- }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
1058
- declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1059
- type: "date";
1060
- array: Opt extends {
1061
- array: true;
1062
- } ? true : false;
1063
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1064
- declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1065
- type: "datetime";
1066
- array: Opt extends {
1067
- array: true;
1068
- } ? true : false;
1069
- }, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
1070
- declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1071
- type: "time";
1072
- array: Opt extends {
1073
- array: true;
1074
- } ? true : false;
1075
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1076
- declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
1077
- type: "enum";
1078
- array: Opt extends {
1079
- array: true;
1080
- } ? true : false;
1081
- }, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
1082
- declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
1083
- type: "nested";
1084
- array: Opt extends {
1085
- array: true;
1086
- } ? true : false;
1087
- }, FieldOutput$1<InferFieldsOutput<F>, Opt>>;
1088
- type TailorAnyDBType = TailorDBType<any, any>;
1089
- declare class TailorDBType<const Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
1090
- readonly name: string;
1091
- readonly fields: Fields;
1092
- readonly _output: InferFieldsOutput<Fields>;
1093
- _description?: string;
1094
- private _settings;
1095
- private _indexes;
1096
- private _permissions;
1097
- private _files;
1098
- constructor(name: string, fields: Fields, options: {
1176
+ type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
1177
+ type StandardPermissionOperator = "eq" | "ne" | "in" | "nin";
1178
+ type UserOperand = {
1179
+ user: string;
1180
+ };
1181
+ type RecordOperand<Update extends boolean = false> = Update extends true ? {
1182
+ oldRecord: string;
1183
+ } | {
1184
+ newRecord: string;
1185
+ } : {
1186
+ record: string;
1187
+ };
1188
+ type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ? RecordOperand<Update> : never);
1189
+ type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Update>, StandardPermissionOperator, PermissionOperand<Level, Update>];
1190
+ type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
1191
+ conditions: readonly StandardPermissionCondition<Level, Update>[];
1192
+ description?: string;
1193
+ permit: "allow" | "deny";
1194
+ };
1195
+ type StandardTailorTypePermission = {
1196
+ create: readonly StandardActionPermission<"record", false>[];
1197
+ read: readonly StandardActionPermission<"record", false>[];
1198
+ update: readonly StandardActionPermission<"record", true>[];
1199
+ delete: readonly StandardActionPermission<"record", false>[];
1200
+ };
1201
+ type StandardGqlPermissionPolicy = {
1202
+ conditions: readonly StandardPermissionCondition<"gql">[];
1203
+ actions: readonly ["all"] | readonly GqlPermissionAction[];
1204
+ permit: "allow" | "deny";
1205
+ description?: string;
1206
+ };
1207
+ type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
1208
+ interface Permissions {
1209
+ record?: StandardTailorTypePermission;
1210
+ gql?: StandardTailorTypeGqlPermission;
1211
+ }
1212
+ interface RawPermissions {
1213
+ record?: TailorTypePermission<any, any>;
1214
+ gql?: TailorTypeGqlPermission<any, any>;
1215
+ }
1216
+ interface TailorDBTypeMetadata {
1217
+ name: string;
1218
+ description?: string;
1219
+ settings?: {
1099
1220
  pluralForm?: string;
1100
- description?: string;
1101
- });
1102
- get metadata(): TailorDBTypeMetadata;
1103
- hooks(hooks: Hooks<Fields>): this;
1104
- validate(validators: Validators<Fields>): this;
1105
- features(features: Omit<TypeFeatures, "pluralForm">): this;
1106
- indexes(...indexes: IndexDef<this>[]): this;
1107
- files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<this>, never>>): this;
1108
- permission<U$1 extends object = User, P$1 extends TailorTypePermission<U$1, output<this>> = TailorTypePermission<U$1, output<this>>>(permission: P$1): TailorDBType<Fields, U$1>;
1109
- gqlPermission<U$1 extends object = User, P$1 extends TailorTypeGqlPermission<U$1> = TailorTypeGqlPermission<U$1>>(permission: P$1): TailorDBType<Fields, U$1>;
1110
- description(description: string): this;
1111
- /**
1112
- * Pick specific fields from the type
1113
- * @param keys - Array of field keys to pick
1114
- * @param options - Optional field options to apply to picked fields
1115
- * @returns An object containing only the specified fields
1116
- */
1117
- pickFields<K$1 extends keyof Fields, const Opt extends FieldOptions>(keys: K$1[], options: Opt): { [P in K$1]: Fields[P$1] extends TailorDBField<infer D, infer _O> ? TailorDBField<Omit<D, "array"> & {
1118
- array: Opt extends {
1119
- array: true;
1120
- } ? true : D["array"];
1121
- }, FieldOutput$1<TailorToTs[D["type"]], Opt>> : never };
1122
- /**
1123
- * Omit specific fields from the type
1124
- * @template K
1125
- * @param keys - Array of field keys to omit
1126
- * @returns An object containing all fields except the specified ones
1127
- */
1128
- omitFields<K$1 extends keyof Fields>(keys: K$1[]): Omit<Fields, K$1>;
1221
+ aggregation?: boolean;
1222
+ bulkUpsert?: boolean;
1223
+ };
1224
+ permissions: RawPermissions;
1225
+ files: Record<string, string>;
1226
+ indexes?: Record<string, {
1227
+ fields: string[];
1228
+ unique?: boolean;
1229
+ }>;
1129
1230
  }
1130
- type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = InstanceType<typeof TailorDBType<Fields, User>>;
1131
- declare const idField: TailorDBField<{
1132
- type: "uuid";
1133
- array: false;
1134
- }, string>;
1135
- type idField = typeof idField;
1136
- type DBType<F extends {
1137
- id?: never;
1138
- } & Record<string, TailorAnyDBField>> = TailorDBInstance<{
1139
- id: idField;
1140
- } & F>;
1141
1231
  /**
1142
- * Creates a new database type with the specified fields
1143
- * @param name - The name of the type, or a tuple of [name, pluralForm]
1144
- * @param fields - The field definitions for the type
1145
- * @returns A new TailorDBType instance
1232
+ * Parsed and normalized TailorDB field information
1146
1233
  */
1147
- declare function dbType<const F extends {
1148
- id?: never;
1149
- } & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
1234
+ interface ParsedField {
1235
+ name: string;
1236
+ config: OperatorFieldConfig;
1237
+ relation?: {
1238
+ targetType: string;
1239
+ forwardName: string;
1240
+ backwardName: string;
1241
+ key: string;
1242
+ unique: boolean;
1243
+ };
1244
+ }
1150
1245
  /**
1151
- * Creates a new database type with the specified fields and description
1152
- * @param name - The name of the type, or a tuple of [name, pluralForm]
1153
- * @param description - A description of the type
1154
- * @param fields - The field definitions for the type
1155
- * @returns A new TailorDBType instance
1246
+ * Parsed and normalized TailorDB relationship information
1156
1247
  */
1157
- declare function dbType<const F extends {
1158
- id?: never;
1159
- } & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
1160
- declare const db: {
1161
- type: typeof dbType;
1162
- uuid: typeof uuid;
1163
- string: typeof string;
1164
- bool: typeof bool;
1165
- int: typeof int;
1166
- float: typeof float;
1167
- date: typeof date;
1168
- datetime: typeof datetime;
1169
- time: typeof time;
1170
- enum: typeof _enum;
1171
- object: typeof object;
1172
- fields: {
1173
- timestamps: () => {
1174
- createdAt: TailorDBField<{
1175
- type: "datetime";
1176
- array: false;
1177
- hooks?: {
1178
- create: true;
1179
- update: false;
1180
- } | undefined;
1181
- serial: false;
1182
- description: true;
1183
- }, string | Date>;
1184
- updatedAt: TailorDBField<{
1185
- type: "datetime";
1186
- array: false;
1187
- hooks?: {
1188
- create: false;
1189
- update: true;
1190
- } | undefined;
1191
- serial: false;
1192
- description: true;
1193
- }, string | Date | null>;
1194
- };
1195
- };
1196
- };
1248
+ interface ParsedRelationship {
1249
+ name: string;
1250
+ targetType: string;
1251
+ targetField: string;
1252
+ sourceField: string;
1253
+ isArray: boolean;
1254
+ description: string;
1255
+ }
1256
+ /**
1257
+ * Parsed and normalized TailorDB type information
1258
+ */
1259
+ interface ParsedTailorDBType {
1260
+ name: string;
1261
+ pluralForm: string;
1262
+ description?: string;
1263
+ fields: Record<string, ParsedField>;
1264
+ forwardRelationships: Record<string, ParsedRelationship>;
1265
+ backwardRelationships: Record<string, ParsedRelationship>;
1266
+ settings: TailorDBTypeMetadata["settings"];
1267
+ permissions: Permissions;
1268
+ indexes?: TailorDBTypeMetadata["indexes"];
1269
+ files?: TailorDBTypeMetadata["files"];
1270
+ }
1197
1271
  //#endregion
1198
1272
  //#region src/configure/services/auth/index.d.ts
1199
1273
  declare const authDefinitionBrand: unique symbol;
1200
1274
  type AuthDefinitionBrand = {
1201
1275
  readonly [authDefinitionBrand]: true;
1202
1276
  };
1277
+ type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
1278
+ type PlaceholderUser = TailorDBInstance<Record<string, never>, Record<string, never>>;
1279
+ type PlaceholderAttributeMap = UserAttributeMap<PlaceholderUser>;
1280
+ type PlaceholderAttributeList = UserAttributeListKey<PlaceholderUser>[];
1281
+ type UserProfileAuthInput<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[], MachineUserNames extends string> = Omit<AuthServiceInput<User, AttributeMap$1, AttributeList$1, MachineUserNames, undefined>, "userProfile" | "machineUserAttributes"> & {
1282
+ userProfile: NonNullable<AuthServiceInput<User, AttributeMap$1, AttributeList$1, MachineUserNames, undefined>["userProfile"]>;
1283
+ machineUserAttributes?: never;
1284
+ };
1285
+ type MachineUserOnlyAuthInput<MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields> = Omit<AuthServiceInput<PlaceholderUser, PlaceholderAttributeMap, PlaceholderAttributeList, MachineUserNames, MachineUserAttributes>, "userProfile" | "machineUserAttributes"> & {
1286
+ userProfile?: never;
1287
+ machineUserAttributes: MachineUserAttributes;
1288
+ };
1289
+ type DefinedAuth<Name extends string, Config, MachineUserNames extends string> = Config & {
1290
+ name: Name;
1291
+ invoker<M extends MachineUserNames>(machineUser: M): AuthInvoker<M>;
1292
+ } & AuthDefinitionBrand;
1203
1293
  /**
1204
1294
  * Invoker type compatible with tailor.v1.AuthInvoker
1205
1295
  * - namespace: auth service name
@@ -1220,50 +1310,157 @@ type AuthInvoker<M extends string> = Omit<AuthInvoker$1, "machineUserName"> & {
1220
1310
  * @param config - Auth service configuration
1221
1311
  * @returns Defined auth service
1222
1312
  */
1223
- declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap$1 extends UserAttributeMap<User>, const AttributeList$1 extends UserAttributeListKey<User>[], const MachineUserNames extends string>(name: Name, config: AuthServiceInput<User, AttributeMap$1, AttributeList$1, MachineUserNames>): {
1224
- readonly name: Name;
1225
- readonly invoker: <M extends MachineUserNames>(machineUser: M) => {
1226
- readonly namespace: Name;
1227
- readonly machineUserName: M;
1228
- };
1229
- readonly userProfile?: {
1230
- namespace?: string;
1231
- type: User;
1232
- usernameField: UsernameFieldKey<User>;
1233
- attributes?: (AttributeMap$1 & { [K in Exclude<keyof AttributeMap$1, UserAttributeKey<User>>]: never }) | undefined;
1234
- attributeList?: AttributeList$1 | undefined;
1235
- } | undefined;
1236
- readonly machineUsers?: Record<MachineUserNames, type_fest0.IsAny<User> extends true ? {
1237
- attributes: Record<string, AuthAttributeValue>;
1238
- attributeList?: string[];
1239
- } : (Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>> extends never ? {
1240
- attributes?: never;
1241
- } : {
1242
- attributes: { [K_2 in Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>>]: K_2 extends keyof output<User> ? output<User>[K_2] : never } & { [K_3 in Exclude<keyof output<User>, Extract<{ [K_1 in keyof AttributeMap$1]-?: undefined extends AttributeMap$1[K_1] ? never : K_1 }[keyof AttributeMap$1], UserAttributeKey<User>>>]?: undefined };
1243
- }) & ([] extends AttributeList$1 ? {
1244
- attributeList?: never;
1245
- } : {
1246
- attributeList: { [Index in keyof AttributeList$1]: AttributeList$1[Index] extends UserAttributeListKey<User> ? AttributeList$1[Index] extends infer T ? T extends AttributeList$1[Index] ? T extends keyof output<User> ? output<User>[T] : never : never : never : never };
1247
- })> | undefined;
1248
- readonly oauth2Clients?: Record<string, OAuth2ClientInput>;
1249
- readonly idProvider?: IdProviderConfig;
1250
- readonly scim?: SCIMConfig;
1251
- readonly tenantProvider?: TenantProviderConfig;
1252
- readonly publishSessionEvents?: boolean;
1253
- } & AuthDefinitionBrand;
1313
+ declare function defineAuth<const Name extends string, const User extends TailorDBInstance, const AttributeMap$1 extends UserAttributeMap<User>, const AttributeList$1 extends UserAttributeListKey<User>[], const MachineUserNames extends string>(name: Name, config: UserProfileAuthInput<User, AttributeMap$1, AttributeList$1, MachineUserNames>): DefinedAuth<Name, UserProfileAuthInput<User, AttributeMap$1, AttributeList$1, MachineUserNames>, MachineUserNames>;
1314
+ declare function defineAuth<const Name extends string, const MachineUserAttributes extends MachineUserAttributeFields, const MachineUserNames extends string>(name: Name, config: MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>): DefinedAuth<Name, MachineUserOnlyAuthInput<MachineUserNames, MachineUserAttributes>, MachineUserNames>;
1254
1315
  type AuthExternalConfig = {
1255
1316
  name: string;
1256
1317
  external: true;
1257
1318
  };
1258
- type AuthOwnConfig = ReturnType<typeof defineAuth<string, any, any, any, string>>;
1319
+ type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
1320
+ type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
1259
1321
  type AuthConfig = AuthOwnConfig | AuthExternalConfig;
1260
1322
  //#endregion
1261
- //#region src/configure/services/executor/types.d.ts
1262
- type ExecutorServiceConfig = {
1263
- files: string[];
1264
- ignores?: string[];
1265
- };
1266
- type ExecutorServiceInput = ExecutorServiceConfig;
1323
+ //#region src/configure/services/executor/types.d.ts
1324
+ type ExecutorServiceConfig = {
1325
+ files: string[];
1326
+ ignores?: string[];
1327
+ };
1328
+ type ExecutorServiceInput = ExecutorServiceConfig;
1329
+ //#endregion
1330
+ //#region src/parser/service/executor/schema.d.ts
1331
+ declare const RecordTriggerSchema: z.ZodObject<{
1332
+ kind: z.ZodEnum<{
1333
+ recordCreated: "recordCreated";
1334
+ recordUpdated: "recordUpdated";
1335
+ recordDeleted: "recordDeleted";
1336
+ }>;
1337
+ typeName: z.ZodString;
1338
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1339
+ }, z.core.$strip>;
1340
+ declare const ResolverExecutedTriggerSchema: z.ZodObject<{
1341
+ kind: z.ZodLiteral<"resolverExecuted">;
1342
+ resolverName: z.ZodString;
1343
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1344
+ }, z.core.$strip>;
1345
+ declare const ScheduleTriggerSchema: z.ZodObject<{
1346
+ kind: z.ZodLiteral<"schedule">;
1347
+ cron: z.ZodString;
1348
+ timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1349
+ }, z.core.$strip>;
1350
+ declare const IncomingWebhookTriggerSchema: z.ZodObject<{
1351
+ kind: z.ZodLiteral<"incomingWebhook">;
1352
+ }, z.core.$strip>;
1353
+ declare const FunctionOperationSchema: z.ZodObject<{
1354
+ kind: z.ZodEnum<{
1355
+ function: "function";
1356
+ jobFunction: "jobFunction";
1357
+ }>;
1358
+ body: z.ZodCustom<Function, Function>;
1359
+ authInvoker: z.ZodOptional<z.ZodObject<{
1360
+ namespace: z.ZodString;
1361
+ machineUserName: z.ZodString;
1362
+ }, z.core.$strip>>;
1363
+ }, z.core.$strip>;
1364
+ declare const GqlOperationSchema: z.ZodObject<{
1365
+ kind: z.ZodLiteral<"graphql">;
1366
+ appName: z.ZodOptional<z.ZodString>;
1367
+ query: z.ZodPipe<z.ZodTransform<string, unknown>, z.ZodString>;
1368
+ variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
1369
+ authInvoker: z.ZodOptional<z.ZodObject<{
1370
+ namespace: z.ZodString;
1371
+ machineUserName: z.ZodString;
1372
+ }, z.core.$strip>>;
1373
+ }, z.core.$strip>;
1374
+ declare const WebhookOperationSchema: z.ZodObject<{
1375
+ kind: z.ZodLiteral<"webhook">;
1376
+ url: z.ZodCustom<Function, Function>;
1377
+ requestBody: z.ZodOptional<z.ZodCustom<Function, Function>>;
1378
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1379
+ vault: z.ZodString;
1380
+ key: z.ZodString;
1381
+ }, z.core.$strip>]>>>;
1382
+ }, z.core.$strip>;
1383
+ declare const WorkflowOperationSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
1384
+ kind: z.ZodLiteral<"workflow">;
1385
+ workflowName: z.ZodString;
1386
+ args: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<Function, Function>]>>;
1387
+ authInvoker: z.ZodOptional<z.ZodObject<{
1388
+ namespace: z.ZodString;
1389
+ machineUserName: z.ZodString;
1390
+ }, z.core.$strip>>;
1391
+ }, z.core.$strip>>;
1392
+ declare const ExecutorSchema: z.ZodObject<{
1393
+ name: z.ZodString;
1394
+ description: z.ZodOptional<z.ZodString>;
1395
+ disabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1396
+ trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
1397
+ kind: z.ZodEnum<{
1398
+ recordCreated: "recordCreated";
1399
+ recordUpdated: "recordUpdated";
1400
+ recordDeleted: "recordDeleted";
1401
+ }>;
1402
+ typeName: z.ZodString;
1403
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1404
+ }, z.core.$strip>, z.ZodObject<{
1405
+ kind: z.ZodLiteral<"resolverExecuted">;
1406
+ resolverName: z.ZodString;
1407
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1408
+ }, z.core.$strip>, z.ZodObject<{
1409
+ kind: z.ZodLiteral<"schedule">;
1410
+ cron: z.ZodString;
1411
+ timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1412
+ }, z.core.$strip>, z.ZodObject<{
1413
+ kind: z.ZodLiteral<"incomingWebhook">;
1414
+ }, z.core.$strip>], "kind">;
1415
+ operation: z.ZodUnion<readonly [z.ZodObject<{
1416
+ kind: z.ZodEnum<{
1417
+ function: "function";
1418
+ jobFunction: "jobFunction";
1419
+ }>;
1420
+ body: z.ZodCustom<Function, Function>;
1421
+ authInvoker: z.ZodOptional<z.ZodObject<{
1422
+ namespace: z.ZodString;
1423
+ machineUserName: z.ZodString;
1424
+ }, z.core.$strip>>;
1425
+ }, z.core.$strip>, z.ZodObject<{
1426
+ kind: z.ZodLiteral<"graphql">;
1427
+ appName: z.ZodOptional<z.ZodString>;
1428
+ query: z.ZodPipe<z.ZodTransform<string, unknown>, z.ZodString>;
1429
+ variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
1430
+ authInvoker: z.ZodOptional<z.ZodObject<{
1431
+ namespace: z.ZodString;
1432
+ machineUserName: z.ZodString;
1433
+ }, z.core.$strip>>;
1434
+ }, z.core.$strip>, z.ZodObject<{
1435
+ kind: z.ZodLiteral<"webhook">;
1436
+ url: z.ZodCustom<Function, Function>;
1437
+ requestBody: z.ZodOptional<z.ZodCustom<Function, Function>>;
1438
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1439
+ vault: z.ZodString;
1440
+ key: z.ZodString;
1441
+ }, z.core.$strip>]>>>;
1442
+ }, z.core.$strip>, z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
1443
+ kind: z.ZodLiteral<"workflow">;
1444
+ workflowName: z.ZodString;
1445
+ args: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<Function, Function>]>>;
1446
+ authInvoker: z.ZodOptional<z.ZodObject<{
1447
+ namespace: z.ZodString;
1448
+ machineUserName: z.ZodString;
1449
+ }, z.core.$strip>>;
1450
+ }, z.core.$strip>>]>;
1451
+ }, z.core.$strip>;
1452
+ //#endregion
1453
+ //#region src/parser/service/executor/types.d.ts
1454
+ type RecordTrigger = z.infer<typeof RecordTriggerSchema>;
1455
+ type ResolverExecutedTrigger = z.infer<typeof ResolverExecutedTriggerSchema>;
1456
+ type ScheduleTriggerInput = z.input<typeof ScheduleTriggerSchema>;
1457
+ type IncomingWebhookTrigger = z.infer<typeof IncomingWebhookTriggerSchema>;
1458
+ type FunctionOperation = z.infer<typeof FunctionOperationSchema>;
1459
+ type GqlOperation = z.infer<typeof GqlOperationSchema>;
1460
+ type WebhookOperation = z.infer<typeof WebhookOperationSchema>;
1461
+ type WorkflowOperation = z.infer<typeof WorkflowOperationSchema>;
1462
+ type Executor = z.infer<typeof ExecutorSchema>;
1463
+ type ExecutorInput = z.input<typeof ExecutorSchema>;
1267
1464
  //#endregion
1268
1465
  //#region src/configure/services/resolver/types.d.ts
1269
1466
  type ResolverServiceConfig = {
@@ -1277,6 +1474,15 @@ type ResolverServiceInput = {
1277
1474
  [namespace: string]: ResolverServiceConfig | ResolverExternalConfig;
1278
1475
  };
1279
1476
  //#endregion
1477
+ //#region src/configure/services/workflow/types.d.ts
1478
+ type WorkflowServiceConfig = {
1479
+ files: string[];
1480
+ job_files?: string[];
1481
+ ignores?: string[];
1482
+ job_ignores?: string[];
1483
+ };
1484
+ type WorkflowServiceInput = WorkflowServiceConfig;
1485
+ //#endregion
1280
1486
  //#region src/parser/service/idp/schema.d.ts
1281
1487
  declare const IdPSchema: z.core.$ZodBranded<z.ZodObject<{
1282
1488
  name: z.ZodString;
@@ -1316,6 +1522,7 @@ declare const IdPSchema: z.core.$ZodBranded<z.ZodObject<{
1316
1522
  passwordMinLength?: number | undefined;
1317
1523
  passwordMaxLength?: number | undefined;
1318
1524
  }>>>;
1525
+ publishUserEvents: z.ZodOptional<z.ZodBoolean>;
1319
1526
  }, z.core.$strip>, "IdPConfig", "out">;
1320
1527
  //#endregion
1321
1528
  //#region src/parser/service/idp/types.d.ts
@@ -1357,6 +1564,7 @@ declare function defineIdp<const TClients extends string[]>(name: string, config
1357
1564
  passwordMinLength?: number | undefined;
1358
1565
  passwordMaxLength?: number | undefined;
1359
1566
  } | undefined;
1567
+ readonly publishUserEvents?: boolean | undefined;
1360
1568
  readonly clients: TClients;
1361
1569
  } & IdpDefinitionBrand;
1362
1570
  type IdPExternalConfig = {
@@ -1394,14 +1602,27 @@ declare function defineStaticWebSite(name: string, config: Omit<StaticWebsiteInp
1394
1602
  } & StaticWebsiteDefinitionBrand;
1395
1603
  type StaticWebsiteConfig = Omit<ReturnType<typeof defineStaticWebSite>, "url">;
1396
1604
  //#endregion
1397
- //#region src/configure/services/workflow/types.d.ts
1398
- type WorkflowServiceConfig = {
1399
- files: string[];
1400
- job_files?: string[];
1401
- ignores?: string[];
1402
- job_ignores?: string[];
1605
+ //#region src/parser/app-config/types.d.ts
1606
+ interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
1607
+ name: string;
1608
+ env?: Env;
1609
+ cors?: string[];
1610
+ allowedIpAddresses?: string[];
1611
+ disableIntrospection?: boolean;
1612
+ db?: TailorDBServiceInput;
1613
+ resolver?: ResolverServiceInput;
1614
+ idp?: Idp;
1615
+ auth?: Auth;
1616
+ executor?: ExecutorServiceInput;
1617
+ workflow?: WorkflowServiceInput;
1618
+ staticWebsites?: StaticWebsites;
1619
+ }
1620
+ //#endregion
1621
+ //#region src/parser/generator-config/types.d.ts
1622
+ type GeneratorConfig = z.input<typeof BaseGeneratorConfigSchema>;
1623
+ type CodeGeneratorBase = Omit<z.output<typeof CodeGeneratorSchema>, "dependencies"> & {
1624
+ dependencies: readonly DependencyKind[];
1403
1625
  };
1404
- type WorkflowServiceInput = WorkflowServiceConfig;
1405
1626
  //#endregion
1406
1627
  //#region src/parser/generator-config/index.d.ts
1407
1628
  declare const DependencyKindSchema: z.ZodEnum<{
@@ -1500,194 +1721,5 @@ declare function createGeneratorConfigSchema(builtinGenerators: Map<string, (opt
1500
1721
  type GeneratorConfigSchemaType = ReturnType<typeof createGeneratorConfigSchema>;
1501
1722
  type Generator = z.output<GeneratorConfigSchemaType>;
1502
1723
  //#endregion
1503
- //#region src/parser/generator-config/types.d.ts
1504
- type GeneratorConfig = z.input<typeof BaseGeneratorConfigSchema>;
1505
- type CodeGeneratorBase = Omit<z.output<typeof CodeGeneratorSchema>, "dependencies"> & {
1506
- dependencies: readonly DependencyKind[];
1507
- };
1508
- //#endregion
1509
- //#region src/configure/config.d.ts
1510
- interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[] = IdPConfig[], StaticWebsites extends StaticWebsiteConfig[] = StaticWebsiteConfig[], Env extends Record<string, string | number | boolean> = Record<string, string | number | boolean>> {
1511
- name: string;
1512
- env?: Env;
1513
- cors?: string[];
1514
- allowedIpAddresses?: string[];
1515
- disableIntrospection?: boolean;
1516
- db?: TailorDBServiceInput;
1517
- resolver?: ResolverServiceInput;
1518
- idp?: Idp;
1519
- auth?: Auth;
1520
- executor?: ExecutorServiceInput;
1521
- workflow?: WorkflowServiceInput;
1522
- staticWebsites?: StaticWebsites;
1523
- }
1524
- /**
1525
- * Define a Tailor SDK application configuration with shallow exactness.
1526
- * @template Config
1527
- * @param config - Application configuration
1528
- * @returns The same configuration object
1529
- */
1530
- declare function defineConfig<const Config extends AppConfig & Record<Exclude<keyof Config, keyof AppConfig>, never>>(config: Config): Config;
1531
- /**
1532
- * Define generators to be used with the Tailor SDK.
1533
- * @param configs - Generator configurations
1534
- * @returns Generator configurations as given
1535
- */
1536
- declare function defineGenerators(...configs: GeneratorConfig[]): (["@tailor-platform/kysely-type", {
1537
- distPath: string;
1538
- }] | ["@tailor-platform/seed", {
1539
- distPath: string;
1540
- machineUserName?: string | undefined;
1541
- }] | ["@tailor-platform/enum-constants", {
1542
- distPath: string;
1543
- }] | ["@tailor-platform/file-utils", {
1544
- distPath: string;
1545
- }] | {
1546
- id: string;
1547
- description: string;
1548
- dependencies: ("tailordb" | "resolver" | "executor")[];
1549
- aggregate: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod0.ZodAny>;
1550
- processType?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1551
- processResolver?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1552
- processExecutor?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1553
- processTailorDBNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1554
- processResolverNamespace?: zod_v4_core0.$InferInnerFunctionType<zod_v4_core0.$ZodFunctionArgs, zod_v4_core0.$ZodFunctionOut> | undefined;
1555
- })[];
1556
- //#endregion
1557
- //#region src/parser/service/executor/schema.d.ts
1558
- declare const RecordTriggerSchema: z.ZodObject<{
1559
- kind: z.ZodEnum<{
1560
- recordCreated: "recordCreated";
1561
- recordUpdated: "recordUpdated";
1562
- recordDeleted: "recordDeleted";
1563
- }>;
1564
- typeName: z.ZodString;
1565
- condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1566
- }, z.core.$strip>;
1567
- declare const ResolverExecutedTriggerSchema: z.ZodObject<{
1568
- kind: z.ZodLiteral<"resolverExecuted">;
1569
- resolverName: z.ZodString;
1570
- condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1571
- }, z.core.$strip>;
1572
- declare const ScheduleTriggerSchema: z.ZodObject<{
1573
- kind: z.ZodLiteral<"schedule">;
1574
- cron: z.ZodString;
1575
- timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1576
- }, z.core.$strip>;
1577
- declare const IncomingWebhookTriggerSchema: z.ZodObject<{
1578
- kind: z.ZodLiteral<"incomingWebhook">;
1579
- }, z.core.$strip>;
1580
- declare const FunctionOperationSchema: z.ZodObject<{
1581
- kind: z.ZodEnum<{
1582
- function: "function";
1583
- jobFunction: "jobFunction";
1584
- }>;
1585
- body: z.ZodCustom<Function, Function>;
1586
- authInvoker: z.ZodOptional<z.ZodObject<{
1587
- namespace: z.ZodString;
1588
- machineUserName: z.ZodString;
1589
- }, z.core.$strip>>;
1590
- }, z.core.$strip>;
1591
- declare const GqlOperationSchema: z.ZodObject<{
1592
- kind: z.ZodLiteral<"graphql">;
1593
- appName: z.ZodOptional<z.ZodString>;
1594
- query: z.ZodPipe<z.ZodTransform<string, unknown>, z.ZodString>;
1595
- variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
1596
- authInvoker: z.ZodOptional<z.ZodObject<{
1597
- namespace: z.ZodString;
1598
- machineUserName: z.ZodString;
1599
- }, z.core.$strip>>;
1600
- }, z.core.$strip>;
1601
- declare const WebhookOperationSchema: z.ZodObject<{
1602
- kind: z.ZodLiteral<"webhook">;
1603
- url: z.ZodCustom<Function, Function>;
1604
- requestBody: z.ZodOptional<z.ZodCustom<Function, Function>>;
1605
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1606
- vault: z.ZodString;
1607
- key: z.ZodString;
1608
- }, z.core.$strip>]>>>;
1609
- }, z.core.$strip>;
1610
- declare const WorkflowOperationSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
1611
- kind: z.ZodLiteral<"workflow">;
1612
- workflowName: z.ZodString;
1613
- args: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<Function, Function>]>>;
1614
- authInvoker: z.ZodOptional<z.ZodObject<{
1615
- namespace: z.ZodString;
1616
- machineUserName: z.ZodString;
1617
- }, z.core.$strip>>;
1618
- }, z.core.$strip>>;
1619
- declare const ExecutorSchema: z.ZodObject<{
1620
- name: z.ZodString;
1621
- description: z.ZodOptional<z.ZodString>;
1622
- disabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1623
- trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
1624
- kind: z.ZodEnum<{
1625
- recordCreated: "recordCreated";
1626
- recordUpdated: "recordUpdated";
1627
- recordDeleted: "recordDeleted";
1628
- }>;
1629
- typeName: z.ZodString;
1630
- condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1631
- }, z.core.$strip>, z.ZodObject<{
1632
- kind: z.ZodLiteral<"resolverExecuted">;
1633
- resolverName: z.ZodString;
1634
- condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1635
- }, z.core.$strip>, z.ZodObject<{
1636
- kind: z.ZodLiteral<"schedule">;
1637
- cron: z.ZodString;
1638
- timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1639
- }, z.core.$strip>, z.ZodObject<{
1640
- kind: z.ZodLiteral<"incomingWebhook">;
1641
- }, z.core.$strip>], "kind">;
1642
- operation: z.ZodUnion<readonly [z.ZodObject<{
1643
- kind: z.ZodEnum<{
1644
- function: "function";
1645
- jobFunction: "jobFunction";
1646
- }>;
1647
- body: z.ZodCustom<Function, Function>;
1648
- authInvoker: z.ZodOptional<z.ZodObject<{
1649
- namespace: z.ZodString;
1650
- machineUserName: z.ZodString;
1651
- }, z.core.$strip>>;
1652
- }, z.core.$strip>, z.ZodObject<{
1653
- kind: z.ZodLiteral<"graphql">;
1654
- appName: z.ZodOptional<z.ZodString>;
1655
- query: z.ZodPipe<z.ZodTransform<string, unknown>, z.ZodString>;
1656
- variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
1657
- authInvoker: z.ZodOptional<z.ZodObject<{
1658
- namespace: z.ZodString;
1659
- machineUserName: z.ZodString;
1660
- }, z.core.$strip>>;
1661
- }, z.core.$strip>, z.ZodObject<{
1662
- kind: z.ZodLiteral<"webhook">;
1663
- url: z.ZodCustom<Function, Function>;
1664
- requestBody: z.ZodOptional<z.ZodCustom<Function, Function>>;
1665
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1666
- vault: z.ZodString;
1667
- key: z.ZodString;
1668
- }, z.core.$strip>]>>>;
1669
- }, z.core.$strip>, z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
1670
- kind: z.ZodLiteral<"workflow">;
1671
- workflowName: z.ZodString;
1672
- args: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<Function, Function>]>>;
1673
- authInvoker: z.ZodOptional<z.ZodObject<{
1674
- namespace: z.ZodString;
1675
- machineUserName: z.ZodString;
1676
- }, z.core.$strip>>;
1677
- }, z.core.$strip>>]>;
1678
- }, z.core.$strip>;
1679
- //#endregion
1680
- //#region src/parser/service/executor/types.d.ts
1681
- type RecordTrigger = z.infer<typeof RecordTriggerSchema>;
1682
- type ResolverExecutedTrigger = z.infer<typeof ResolverExecutedTriggerSchema>;
1683
- type ScheduleTriggerInput = z.input<typeof ScheduleTriggerSchema>;
1684
- type IncomingWebhookTrigger = z.infer<typeof IncomingWebhookTriggerSchema>;
1685
- type FunctionOperation = z.infer<typeof FunctionOperationSchema>;
1686
- type GqlOperation = z.infer<typeof GqlOperationSchema>;
1687
- type WebhookOperation = z.infer<typeof WebhookOperationSchema>;
1688
- type WorkflowOperation = z.infer<typeof WorkflowOperationSchema>;
1689
- type Executor = z.infer<typeof ExecutorSchema>;
1690
- type ExecutorInput = z.input<typeof ExecutorSchema>;
1691
- //#endregion
1692
- export { TenantProviderConfig as $, AuthOwnConfig as A, BuiltinIdP as B, ResolverServiceConfig as C, TailorFieldType as Ct, AuthConfig as D, ExecutorServiceInput as E, output as Et, db as F, OIDC as G, IdProviderConfig as H, AllowedValues as I, SCIMAttributeMapping as J, SAML as K, AllowedValuesOutput as L, TailorDBField as M, TailorDBInstance as N, AuthExternalConfig as O, TailorDBType as P, SCIMResource as Q, ParsedTailorDBType as R, ResolverExternalConfig as S, FieldOutput$1 as St, ExecutorServiceConfig as T, JsonCompatible as Tt, OAuth2ClientGrantType as U, IDToken as V, OAuth2ClientInput as W, SCIMAuthorization as X, SCIMAttributeType as Y, SCIMConfig as Z, StaticWebsiteConfig as _, Resolver as _t, IncomingWebhookTrigger as a, PermissionCondition as at, IdPExternalConfig as b, FieldMetadata as bt, ScheduleTriggerInput as c, unsafeAllowAllGqlPermission as ct, AppConfig as d, AttributeMap as dt, UserAttributeKey as et, defineConfig as f, TailorUser as ft, WorkflowServiceInput as g, QueryType as gt, WorkflowServiceConfig as h, TailorField as ht, GqlOperation as i, ValueOperand as it, defineAuth as j, AuthInvoker as k, WebhookOperation as l, unsafeAllowAllTypePermission as lt, Generator as m, TailorAnyField as mt, ExecutorInput as n, UserAttributeMap as nt, RecordTrigger as o, TailorTypeGqlPermission as ot, defineGenerators as p, unauthenticatedTailorUser as pt, SCIMAttribute as q, FunctionOperation as r, UsernameFieldKey as rt, ResolverExecutedTrigger as s, TailorTypePermission as st, Executor as t, UserAttributeListKey as tt, WorkflowOperation as u, AttributeList as ut, defineStaticWebSite as v, ResolverInput as vt, ResolverServiceInput as w, InferFieldsOutput as wt, defineIdp as x, FieldOptions as xt, IdPConfig as y, ArrayFieldOutput as yt, AuthServiceInput as z };
1693
- //# sourceMappingURL=types-BWzDv7TK.d.mts.map
1724
+ export { TailorDBInstance as $, defineAuth as A, SCIMAttribute as B, WorkflowOperation as C, output as Ct, AuthExternalConfig as D, AuthConfig as E, IdProviderConfig as F, SCIMResource as G, SCIMAttributeType as H, OAuth2ClientGrantType as I, UserAttributeListKey as J, TenantProviderConfig as K, OAuth2ClientInput as L, AuthServiceInput as M, BuiltinIdP as N, AuthInvoker as O, IDToken as P, TailorDBField as Q, OIDC as R, WebhookOperation as S, JsonCompatible as St, ExecutorServiceInput as T, AllowedValuesOutput as Tt, SCIMAuthorization as U, SCIMAttributeMapping as V, SCIMConfig as W, UsernameFieldKey as X, UserAttributeMap as Y, ValueOperand as Z, GqlOperation as _, TailorField as _t, defineStaticWebSite as a, unsafeAllowAllGqlPermission as at, ResolverExecutedTrigger as b, ResolverInput as bt, defineIdp as c, FieldMetadata as ct, ResolverExternalConfig as d, TailorFieldType as dt, TailorDBType as et, ResolverServiceConfig as f, AttributeList as ft, FunctionOperation as g, TailorAnyField as gt, ExecutorInput as h, unauthenticatedTailorUser as ht, StaticWebsiteConfig as i, TailorTypePermission as it, ParsedTailorDBType as j, AuthOwnConfig as k, WorkflowServiceConfig as l, FieldOptions as lt, Executor as m, TailorUser as mt, GeneratorConfig as n, PermissionCondition as nt, IdPConfig as o, unsafeAllowAllTypePermission as ot, ResolverServiceInput as p, AttributeMap as pt, UserAttributeKey as q, AppConfig as r, TailorTypeGqlPermission as rt, IdPExternalConfig as s, ArrayFieldOutput as st, Generator as t, db as tt, WorkflowServiceInput as u, FieldOutput$1 as ut, IncomingWebhookTrigger as v, QueryType as vt, ExecutorServiceConfig as w, AllowedValues as wt, ScheduleTriggerInput as x, InferFieldsOutput as xt, RecordTrigger as y, Resolver as yt, SAML as z };
1725
+ //# sourceMappingURL=index-D40SiXpf.d.mts.map