@tailor-platform/sdk 1.17.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/{application-BMDE8KqK.mjs → application-A6PZjujv.mjs} +192 -1673
  3. package/dist/application-A6PZjujv.mjs.map +1 -0
  4. package/dist/application-nPS5veK6.mjs +9 -0
  5. package/dist/brand-BZJCv6UY.mjs +28 -0
  6. package/dist/brand-BZJCv6UY.mjs.map +1 -0
  7. package/dist/cli/index.mjs +40 -20
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +16 -33
  10. package/dist/cli/lib.mjs +12 -5
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +10 -19
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/enum-constants-CGVvu3dd.mjs +115 -0
  16. package/dist/enum-constants-CGVvu3dd.mjs.map +1 -0
  17. package/dist/file-utils-GX_tGWl4.mjs +139 -0
  18. package/dist/file-utils-GX_tGWl4.mjs.map +1 -0
  19. package/dist/index-B6pvy1MK.d.mts +20 -0
  20. package/dist/index-B91ZpOcd.d.mts +18 -0
  21. package/dist/index-CPzbMghQ.d.mts +18 -0
  22. package/dist/{index-CVcYqZSf.d.mts → index-ClLZCbcm.d.mts} +18 -5
  23. package/dist/index-DDqKNFh4.d.mts +18 -0
  24. package/dist/interceptor-D8MeZOxX.mjs +33 -0
  25. package/dist/interceptor-D8MeZOxX.mjs.map +1 -0
  26. package/dist/{jiti-BrELlEYT.mjs → jiti-DfS9jItj.mjs} +2 -2
  27. package/dist/{jiti-BrELlEYT.mjs.map → jiti-DfS9jItj.mjs.map} +1 -1
  28. package/dist/{job-CULA2Pvf.mjs → job-2Q82qQ6N.mjs} +27 -5
  29. package/dist/job-2Q82qQ6N.mjs.map +1 -0
  30. package/dist/kysely-type-Cpq5TNGY.mjs +260 -0
  31. package/dist/kysely-type-Cpq5TNGY.mjs.map +1 -0
  32. package/dist/package-json-DUY2kB6z.mjs +17 -0
  33. package/dist/package-json-DUY2kB6z.mjs.map +1 -0
  34. package/dist/package-json-Dd1AnA5F.mjs +3 -0
  35. package/dist/plugin/builtin/enum-constants/index.d.mts +4 -0
  36. package/dist/plugin/builtin/enum-constants/index.mjs +3 -0
  37. package/dist/plugin/builtin/file-utils/index.d.mts +4 -0
  38. package/dist/plugin/builtin/file-utils/index.mjs +3 -0
  39. package/dist/plugin/builtin/kysely-type/index.d.mts +4 -0
  40. package/dist/plugin/builtin/kysely-type/index.mjs +3 -0
  41. package/dist/plugin/builtin/seed/index.d.mts +4 -0
  42. package/dist/plugin/builtin/seed/index.mjs +3 -0
  43. package/dist/plugin/index.d.mts +3 -3
  44. package/dist/plugin/index.mjs +11 -11
  45. package/dist/plugin/index.mjs.map +1 -1
  46. package/dist/{schema-R5TxC5Pn.mjs → schema-D5Cpd8fQ.mjs} +48 -5
  47. package/dist/schema-D5Cpd8fQ.mjs.map +1 -0
  48. package/dist/seed-CeUEANfQ.mjs +1050 -0
  49. package/dist/seed-CeUEANfQ.mjs.map +1 -0
  50. package/dist/{src-DMROgdcL.mjs → src-Bb1UVstT.mjs} +2 -2
  51. package/dist/{src-DMROgdcL.mjs.map → src-Bb1UVstT.mjs.map} +1 -1
  52. package/dist/telemetry-9A1BZqbl.mjs +3 -0
  53. package/dist/telemetry-rFq0QdvJ.mjs +84 -0
  54. package/dist/telemetry-rFq0QdvJ.mjs.map +1 -0
  55. package/dist/types-CJF3Y1x8.d.mts +158 -0
  56. package/dist/{types-CZZBCaxB.d.mts → types-CblXasFV.d.mts} +1405 -1045
  57. package/dist/{types-b-ig8nW_.mjs → types-ClK_HJ0G.mjs} +1 -1
  58. package/dist/{types-b-ig8nW_.mjs.map → types-ClK_HJ0G.mjs.map} +1 -1
  59. package/dist/{update-CUBVjZbL.mjs → update-Cr5c7h1r.mjs} +485 -244
  60. package/dist/update-Cr5c7h1r.mjs.map +1 -0
  61. package/dist/utils/test/index.d.mts +4 -4
  62. package/dist/utils/test/index.mjs +3 -2
  63. package/dist/utils/test/index.mjs.map +1 -1
  64. package/docs/cli/application.md +106 -14
  65. package/docs/cli/auth.md +92 -12
  66. package/docs/cli/completion.md +18 -2
  67. package/docs/cli/executor.md +122 -14
  68. package/docs/cli/function.md +32 -4
  69. package/docs/cli/secret.md +134 -18
  70. package/docs/cli/staticwebsite.md +60 -8
  71. package/docs/cli/tailordb.md +148 -20
  72. package/docs/cli/user.md +154 -22
  73. package/docs/cli/workflow.md +100 -12
  74. package/docs/cli/workspace.md +274 -38
  75. package/docs/generator/custom.md +2 -2
  76. package/docs/plugin/custom.md +270 -163
  77. package/docs/plugin/index.md +48 -2
  78. package/package.json +28 -2
  79. package/dist/application-BMDE8KqK.mjs.map +0 -1
  80. package/dist/application-Dni_W16P.mjs +0 -4
  81. package/dist/job-CULA2Pvf.mjs.map +0 -1
  82. package/dist/schema-R5TxC5Pn.mjs.map +0 -1
  83. package/dist/types-DthzUFfx.d.mts +0 -372
  84. package/dist/update-CUBVjZbL.mjs.map +0 -1
  85. /package/dist/{chunk-GMkBE123.mjs → chunk-CqAI0b6X.mjs} +0 -0
@@ -534,8 +534,8 @@ declare const RawPermissionsSchema: z.ZodObject<{
534
534
  }, z.core.$strict>, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodBoolean>]>], null>>>>;
535
535
  actions: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodReadonly<z.ZodArray<z.ZodEnum<{
536
536
  create: "create";
537
- delete: "delete";
538
537
  update: "update";
538
+ delete: "delete";
539
539
  aggregate: "aggregate";
540
540
  bulkUpsert: "bulkUpsert";
541
541
  read: "read";
@@ -677,11 +677,12 @@ declare const TailorFieldSchema: z.ZodObject<{
677
677
  type: z.ZodEnum<{
678
678
  string: "string";
679
679
  boolean: "boolean";
680
- date: "date";
681
- enum: "enum";
682
680
  uuid: "uuid";
683
681
  integer: "integer";
684
682
  float: "float";
683
+ decimal: "decimal";
684
+ enum: "enum";
685
+ date: "date";
685
686
  datetime: "datetime";
686
687
  time: "time";
687
688
  nested: "nested";
@@ -710,11 +711,12 @@ declare const ResolverSchema: z.ZodObject<{
710
711
  type: z.ZodEnum<{
711
712
  string: "string";
712
713
  boolean: "boolean";
713
- date: "date";
714
- enum: "enum";
715
714
  uuid: "uuid";
716
715
  integer: "integer";
717
716
  float: "float";
717
+ decimal: "decimal";
718
+ enum: "enum";
719
+ date: "date";
718
720
  datetime: "datetime";
719
721
  time: "time";
720
722
  nested: "nested";
@@ -740,11 +742,12 @@ declare const ResolverSchema: z.ZodObject<{
740
742
  type: z.ZodEnum<{
741
743
  string: "string";
742
744
  boolean: "boolean";
743
- date: "date";
744
- enum: "enum";
745
745
  uuid: "uuid";
746
746
  integer: "integer";
747
747
  float: "float";
748
+ decimal: "decimal";
749
+ enum: "enum";
750
+ date: "date";
748
751
  datetime: "datetime";
749
752
  time: "time";
750
753
  nested: "nested";
@@ -905,11 +908,12 @@ type Validators<F extends Record<string, {
905
908
  }>> = ValidatorsBase<F, "id">;
906
909
  //#endregion
907
910
  //#region src/configure/types/types.d.ts
908
- type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
911
+ type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "decimal" | "enum" | "date" | "datetime" | "time" | "nested";
909
912
  type TailorToTs = {
910
913
  string: string;
911
914
  integer: number;
912
915
  float: number;
916
+ decimal: string;
913
917
  boolean: boolean;
914
918
  uuid: string;
915
919
  date: string;
@@ -1074,6 +1078,7 @@ interface DBFieldMetadata extends FieldMetadata {
1074
1078
  hooks?: Hook<any, any>;
1075
1079
  serial?: SerialConfig;
1076
1080
  relation?: boolean;
1081
+ scale?: number;
1077
1082
  }
1078
1083
  interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
1079
1084
  index?: boolean;
@@ -1145,1107 +1150,1461 @@ interface TypeFeatures {
1145
1150
  gqlOperations?: GqlOperationsConfig;
1146
1151
  }
1147
1152
  //#endregion
1148
- //#region src/parser/plugin-config/types.d.ts
1149
- type TypeConfigRequired<PluginConfig = unknown> = boolean | ((pluginConfig: PluginConfig | undefined) => boolean);
1150
- /**
1151
- * Interface for plugin configuration mapping.
1152
- * Extend this interface via declaration merging to add typed plugin configs.
1153
- *
1154
- * The `Fields` type parameter provides field names from the type being configured,
1155
- * enabling type-safe field references in plugin configs.
1156
- * @example
1157
- * ```typescript
1158
- * // In your plugin package or types file:
1159
- * declare module "@tailor-platform/sdk" {
1160
- * interface PluginConfigs<Fields extends string> {
1161
- * "@my-company/i18n": {
1162
- * labels: Partial<Record<Fields, { ja: string; en: string }>>;
1163
- * };
1164
- * }
1165
- * }
1166
- * ```
1167
- */
1168
- interface PluginConfigs<Fields extends string = string> {}
1169
- /**
1170
- * Plugin attachment stored on TailorAnyDBType instances.
1171
- * This is the configuration passed via `.plugin()` method.
1172
- */
1173
- interface PluginAttachment {
1174
- pluginId: string;
1175
- config: unknown;
1176
- }
1177
- /**
1178
- * Context passed to plugin's process method
1179
- */
1180
- interface PluginProcessContext<TypeConfig = unknown, PluginConfig = unknown> {
1181
- /** The raw TailorDB type being processed */
1182
- type: TailorAnyDBType;
1183
- /** Per-type configuration passed via .plugin() method */
1184
- typeConfig: TypeConfig;
1185
- /** Plugin-level configuration passed via definePlugins() */
1186
- pluginConfig: PluginConfig;
1187
- /** Namespace of the TailorDB type */
1188
- namespace: string;
1189
- }
1190
- /**
1191
- * Context passed to plugin's processNamespace method.
1192
- * Used for plugins that operate on a namespace without requiring a source type.
1193
- */
1194
- interface PluginNamespaceProcessContext<PluginConfig = unknown> {
1195
- /** Plugin-level configuration passed via definePlugins() */
1196
- pluginConfig: PluginConfig;
1197
- /** Target namespace for generated types */
1198
- namespace: string;
1199
- }
1200
- /**
1201
- * Interface representing a TailorDB type for plugin output.
1202
- * This interface is satisfied by db.type() instances.
1203
- */
1204
- interface TailorDBTypeForPlugin {
1205
- /** The name of the type */
1206
- readonly name: string;
1207
- /** The field definitions */
1208
- readonly fields: Record<string, unknown>;
1209
- }
1210
- /**
1211
- * Type generated by a plugin - use db.type() to create these.
1212
- */
1213
- type PluginGeneratedType = TailorDBTypeForPlugin;
1214
- /**
1215
- * Map of generated types keyed by kind identifier.
1216
- * The kind is used to generate distinct TypeScript type files for each generated type.
1217
- * @example
1218
- * ```typescript
1219
- * {
1220
- * request: changeRequest,
1221
- * step: changeStep,
1222
- * approval: changeApproval,
1223
- * }
1224
- * ```
1225
- */
1226
- type PluginGeneratedTypes = Record<string, PluginGeneratedType>;
1227
- /**
1228
- * Resolver definition generated by a plugin.
1229
- * Fields can be TailorDB field instances or raw field definitions.
1230
- */
1231
- interface PluginGeneratedResolver {
1232
- name: string;
1233
- operation: "query" | "mutation";
1234
- inputFields?: Record<string, unknown>;
1235
- outputFields: Record<string, unknown>;
1236
- /** Function body code as string */
1237
- body: string;
1238
- }
1239
- /**
1240
- * Record trigger configuration for plugin-generated executors
1241
- */
1242
- interface PluginRecordTriggerConfig {
1243
- kind: "recordCreated" | "recordUpdated" | "recordDeleted";
1244
- /** TailorDB type name for record triggers */
1245
- typeName: string;
1246
- }
1247
- /**
1248
- * Schedule trigger configuration for plugin-generated executors
1249
- */
1250
- interface PluginScheduleTriggerConfig {
1251
- kind: "schedule";
1252
- /** Cron expression */
1253
- cron: string;
1254
- /** Timezone (defaults to UTC) */
1255
- timezone?: string;
1256
- }
1257
- /**
1258
- * Incoming webhook trigger configuration for plugin-generated executors
1259
- */
1260
- interface PluginIncomingWebhookTriggerConfig {
1261
- kind: "incomingWebhook";
1262
- }
1263
- /**
1264
- * Trigger configuration for plugin-generated executors
1265
- */
1266
- type PluginTriggerConfig = PluginRecordTriggerConfig | PluginScheduleTriggerConfig | PluginIncomingWebhookTriggerConfig;
1267
- /**
1268
- * Inject value types supported for plugin executor injection.
1269
- * These values are serialized as const declarations in the generated file.
1270
- */
1271
- type PluginInjectValue = string | number | boolean | null;
1272
- /**
1273
- * Inject map for plugin executor.
1274
- * Keys become const variable names in the generated file.
1275
- */
1276
- type PluginInjectMap = Record<string, PluginInjectValue>;
1277
- /**
1278
- * Function operation configuration for plugin-generated executors
1279
- */
1280
- interface PluginFunctionOperationConfig {
1281
- kind: "function";
1282
- /** Function body code as string */
1283
- body: string;
1284
- /**
1285
- * Variables to inject into the generated file scope.
1286
- * These become const declarations at the top of the generated file,
1287
- * allowing the function body to reference them.
1288
- * @example { namespace: "tailordb", historyTypeName: "CustomerHistory" }
1289
- */
1290
- inject?: PluginInjectMap;
1291
- }
1292
- /**
1293
- * GraphQL operation configuration for plugin-generated executors
1294
- */
1295
- interface PluginGraphQLOperationConfig {
1296
- kind: "graphql";
1297
- /** GraphQL query string */
1298
- query: string;
1299
- /** App name for the GraphQL endpoint */
1300
- appName?: string;
1301
- /**
1302
- * Variables expression as a string function.
1303
- * Receives the executor args object and returns the variables object.
1304
- * @example "(args) => ({ input: { recordId: args.newRecord.id } })"
1305
- */
1306
- variables?: string;
1307
- }
1308
- /**
1309
- * Webhook operation configuration for plugin-generated executors
1310
- */
1311
- interface PluginWebhookOperationConfig {
1312
- kind: "webhook";
1313
- /** Webhook URL */
1314
- url: string;
1315
- }
1316
- /**
1317
- * Workflow operation configuration for plugin-generated executors
1318
- */
1319
- interface PluginWorkflowOperationConfig {
1320
- kind: "workflow";
1321
- /** Workflow name */
1322
- workflowName: string;
1323
- }
1324
- /**
1325
- * Operation configuration for plugin-generated executors
1326
- */
1327
- type PluginOperationConfig = PluginFunctionOperationConfig | PluginGraphQLOperationConfig | PluginWebhookOperationConfig | PluginWorkflowOperationConfig;
1328
- /**
1329
- * Context value types for plugin executor context.
1330
- * Supports primitive values and type references.
1331
- */
1332
- type PluginExecutorContextValue = TailorAnyDBType | string | number | boolean | null | undefined;
1333
- /**
1334
- * Base executor context that can include type references and other values.
1335
- * Type objects (TailorAnyDBType) will be handled specially by the generator
1336
- * to create appropriate import statements.
1337
- *
1338
- * Plugin authors should extend this interface for their specific context needs.
1339
- */
1340
- interface PluginExecutorContextBase {
1341
- /** Source type that the plugin is attached to. Null for namespace executors. */
1342
- sourceType: TailorAnyDBType | null;
1343
- /** TailorDB namespace for data operations */
1344
- namespace: string;
1345
- }
1346
- /**
1347
- * Flexible executor context type that allows additional properties.
1348
- * Used as the context type in PluginGeneratedExecutorWithFile.
1349
- */
1350
- type PluginExecutorContext = PluginExecutorContextBase & {
1351
- [key: string]: PluginExecutorContextValue;
1352
- };
1353
- /**
1354
- * Module shape returned by plugin executor resolve().
1355
- * The concrete context type is intentionally erased at this boundary.
1356
- */
1357
- interface PluginExecutorModule {
1358
- default: unknown;
1359
- }
1360
- /**
1361
- * Executor definition with dynamic import reference (new format).
1362
- * Used with withPluginContext for type-safe executor definitions in separate files.
1363
- */
1364
- interface PluginGeneratedExecutorWithFile<Ctx = PluginExecutorContext> {
1365
- /** Executor name (used for generated file name) */
1366
- name: string;
1367
- /**
1368
- * Resolver function for the executor module.
1369
- * Should return a dynamic import to the executor file.
1370
- * Relative import specifiers are resolved from the plugin's importPath base.
1371
- * @example `async () => await import("./executors/on-create")`
1372
- */
1373
- resolve: () => Promise<PluginExecutorModule>;
1374
- /**
1375
- * Context to pass to the executor factory.
1376
- * Can include TailorAnyDBType objects - these will be handled specially
1377
- * by the generator to create appropriate import statements.
1378
- */
1379
- context: Ctx;
1380
- }
1381
- /**
1382
- * Executor definition generated by a plugin (legacy format).
1383
- * @deprecated Use PluginGeneratedExecutorWithFile with withPluginContext instead.
1384
- */
1385
- interface PluginGeneratedExecutorLegacy {
1386
- name: string;
1387
- description?: string;
1388
- trigger: PluginTriggerConfig;
1389
- operation: PluginOperationConfig;
1390
- }
1391
- /**
1392
- * Executor definition generated by a plugin.
1393
- * Supports both legacy format (inline trigger/operation) and new format (executorFile/context).
1394
- */
1395
- type PluginGeneratedExecutor = PluginGeneratedExecutorWithFile | PluginGeneratedExecutorLegacy;
1396
- /**
1397
- * Extension options for modifying the source type
1398
- */
1399
- interface PluginExtends {
1400
- /**
1401
- * Fields to add to the source type.
1402
- * These fields will be merged into the original type's fields.
1403
- * Existing fields (from original definition or earlier plugins) take precedence.
1404
- */
1405
- fields?: Record<string, TailorAnyDBField>;
1406
- }
1407
- /**
1408
- * Base output returned by a plugin's process method.
1409
- * Used by both processType and processNamespace.
1410
- */
1411
- interface PluginOutput {
1153
+ //#region src/parser/generator-config/types.d.ts
1154
+ type GeneratorConfig = z.input<typeof BaseGeneratorConfigSchema>;
1155
+ //#endregion
1156
+ //#region src/parser/generator-config/index.d.ts
1157
+ declare const BaseGeneratorConfigSchema: z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"@tailor-platform/kysely-type">, z.ZodObject<{
1158
+ distPath: z.ZodString;
1159
+ }, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/seed">, z.ZodObject<{
1160
+ distPath: z.ZodString;
1161
+ machineUserName: z.ZodOptional<z.ZodString>;
1162
+ }, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/enum-constants">, z.ZodObject<{
1163
+ distPath: z.ZodString;
1164
+ }, z.core.$strip>], null>, z.ZodTuple<[z.ZodLiteral<"@tailor-platform/file-utils">, z.ZodObject<{
1165
+ distPath: z.ZodString;
1166
+ }, z.core.$strip>], null>, z.ZodObject<{
1167
+ id: z.ZodString;
1168
+ description: z.ZodString;
1169
+ dependencies: z.ZodArray<z.ZodEnum<{
1170
+ executor: "executor";
1171
+ tailordb: "tailordb";
1172
+ resolver: "resolver";
1173
+ }>>;
1174
+ processType: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
1175
+ processResolver: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
1176
+ processExecutor: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
1177
+ processTailorDBNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
1178
+ processResolverNamespace: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
1179
+ aggregate: z.ZodFunction<z.core.$ZodFunctionArgs, z.ZodAny>;
1180
+ }, z.core.$strip>]>;
1181
+ //#endregion
1182
+ //#region src/parser/service/auth/schema.d.ts
1183
+ declare const AuthInvokerSchema: z.ZodObject<{
1184
+ namespace: z.ZodString;
1185
+ machineUserName: z.ZodString;
1186
+ }, z.core.$strip>;
1187
+ declare const OIDCSchema: z.ZodObject<{
1188
+ name: z.ZodString;
1189
+ kind: z.ZodLiteral<"OIDC">;
1190
+ clientID: z.ZodString;
1191
+ clientSecret: z.ZodObject<{
1192
+ vaultName: z.ZodString;
1193
+ secretKey: z.ZodString;
1194
+ }, z.core.$strip>;
1195
+ providerURL: z.ZodString;
1196
+ issuerURL: z.ZodOptional<z.ZodString>;
1197
+ usernameClaim: z.ZodOptional<z.ZodString>;
1198
+ }, z.core.$strip>;
1199
+ declare const SAMLSchema: z.ZodObject<{
1200
+ name: z.ZodString;
1201
+ kind: z.ZodLiteral<"SAML">;
1202
+ enableSignRequest: z.ZodDefault<z.ZodBoolean>;
1203
+ metadataURL: z.ZodOptional<z.ZodString>;
1204
+ rawMetadata: z.ZodOptional<z.ZodString>;
1205
+ }, z.core.$strip>;
1206
+ declare const IDTokenSchema: z.ZodObject<{
1207
+ name: z.ZodString;
1208
+ kind: z.ZodLiteral<"IDToken">;
1209
+ providerURL: z.ZodString;
1210
+ issuerURL: z.ZodOptional<z.ZodString>;
1211
+ clientID: z.ZodString;
1212
+ usernameClaim: z.ZodOptional<z.ZodString>;
1213
+ }, z.core.$strip>;
1214
+ declare const BuiltinIdPSchema: z.ZodObject<{
1215
+ name: z.ZodString;
1216
+ kind: z.ZodLiteral<"BuiltInIdP">;
1217
+ namespace: z.ZodString;
1218
+ clientName: z.ZodString;
1219
+ }, z.core.$strip>;
1220
+ declare const IdProviderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1221
+ name: z.ZodString;
1222
+ kind: z.ZodLiteral<"OIDC">;
1223
+ clientID: z.ZodString;
1224
+ clientSecret: z.ZodObject<{
1225
+ vaultName: z.ZodString;
1226
+ secretKey: z.ZodString;
1227
+ }, z.core.$strip>;
1228
+ providerURL: z.ZodString;
1229
+ issuerURL: z.ZodOptional<z.ZodString>;
1230
+ usernameClaim: z.ZodOptional<z.ZodString>;
1231
+ }, z.core.$strip>, z.ZodObject<{
1232
+ name: z.ZodString;
1233
+ kind: z.ZodLiteral<"SAML">;
1234
+ enableSignRequest: z.ZodDefault<z.ZodBoolean>;
1235
+ metadataURL: z.ZodOptional<z.ZodString>;
1236
+ rawMetadata: z.ZodOptional<z.ZodString>;
1237
+ }, z.core.$strip>, z.ZodObject<{
1238
+ name: z.ZodString;
1239
+ kind: z.ZodLiteral<"IDToken">;
1240
+ providerURL: z.ZodString;
1241
+ issuerURL: z.ZodOptional<z.ZodString>;
1242
+ clientID: z.ZodString;
1243
+ usernameClaim: z.ZodOptional<z.ZodString>;
1244
+ }, z.core.$strip>, z.ZodObject<{
1245
+ name: z.ZodString;
1246
+ kind: z.ZodLiteral<"BuiltInIdP">;
1247
+ namespace: z.ZodString;
1248
+ clientName: z.ZodString;
1249
+ }, z.core.$strip>], "kind">;
1250
+ declare const OAuth2ClientGrantTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>;
1251
+ declare const OAuth2ClientSchema: z.ZodObject<{
1252
+ description: z.ZodOptional<z.ZodString>;
1253
+ grantTypes: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>>>;
1254
+ redirectURIs: z.ZodArray<z.ZodUnion<readonly [z.ZodTemplateLiteral<`https://${string}`>, z.ZodTemplateLiteral<`http://${string}`>, z.ZodTemplateLiteral<`${string}:url`>, z.ZodTemplateLiteral<`${string}:url/${string}`>]>>;
1255
+ clientType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"confidential">, z.ZodLiteral<"public">, z.ZodLiteral<"browser">]>>;
1256
+ accessTokenLifetimeSeconds: z.ZodPipe<z.ZodOptional<z.ZodNumber>, z.ZodTransform<{
1257
+ seconds: bigint;
1258
+ nanos: number;
1259
+ } | undefined, number | undefined>>;
1260
+ refreshTokenLifetimeSeconds: z.ZodPipe<z.ZodOptional<z.ZodNumber>, z.ZodTransform<{
1261
+ seconds: bigint;
1262
+ nanos: number;
1263
+ } | undefined, number | undefined>>;
1264
+ requireDpop: z.ZodOptional<z.ZodBoolean>;
1265
+ }, z.core.$strip>;
1266
+ declare const SCIMAuthorizationSchema: z.ZodObject<{
1267
+ type: z.ZodUnion<readonly [z.ZodLiteral<"oauth2">, z.ZodLiteral<"bearer">]>;
1268
+ bearerSecret: z.ZodOptional<z.ZodObject<{
1269
+ vaultName: z.ZodString;
1270
+ secretKey: z.ZodString;
1271
+ }, z.core.$strip>>;
1272
+ }, z.core.$strip>;
1273
+ declare const SCIMAttributeTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
1274
+ declare const SCIMAttributeSchema: z.ZodObject<{
1275
+ type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
1276
+ name: z.ZodString;
1277
+ description: z.ZodOptional<z.ZodString>;
1278
+ mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
1279
+ required: z.ZodOptional<z.ZodBoolean>;
1280
+ multiValued: z.ZodOptional<z.ZodBoolean>;
1281
+ uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
1282
+ canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1283
+ subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
1284
+ }, z.core.$strip>;
1285
+ declare const SCIMAttributeMappingSchema: z.ZodObject<{
1286
+ tailorDBField: z.ZodString;
1287
+ scimPath: z.ZodString;
1288
+ }, z.core.$strip>;
1289
+ declare const SCIMResourceSchema: z.ZodObject<{
1290
+ name: z.ZodString;
1291
+ tailorDBNamespace: z.ZodString;
1292
+ tailorDBType: z.ZodString;
1293
+ coreSchema: z.ZodObject<{
1294
+ name: z.ZodString;
1295
+ attributes: z.ZodArray<z.ZodObject<{
1296
+ type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
1297
+ name: z.ZodString;
1298
+ description: z.ZodOptional<z.ZodString>;
1299
+ mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
1300
+ required: z.ZodOptional<z.ZodBoolean>;
1301
+ multiValued: z.ZodOptional<z.ZodBoolean>;
1302
+ uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
1303
+ canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1304
+ subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
1305
+ }, z.core.$strip>>;
1306
+ }, z.core.$strip>;
1307
+ attributeMapping: z.ZodArray<z.ZodObject<{
1308
+ tailorDBField: z.ZodString;
1309
+ scimPath: z.ZodString;
1310
+ }, z.core.$strip>>;
1311
+ }, z.core.$strip>;
1312
+ declare const SCIMSchema: z.ZodObject<{
1313
+ machineUserName: z.ZodString;
1314
+ authorization: z.ZodObject<{
1315
+ type: z.ZodUnion<readonly [z.ZodLiteral<"oauth2">, z.ZodLiteral<"bearer">]>;
1316
+ bearerSecret: z.ZodOptional<z.ZodObject<{
1317
+ vaultName: z.ZodString;
1318
+ secretKey: z.ZodString;
1319
+ }, z.core.$strip>>;
1320
+ }, z.core.$strip>;
1321
+ resources: z.ZodArray<z.ZodObject<{
1322
+ name: z.ZodString;
1323
+ tailorDBNamespace: z.ZodString;
1324
+ tailorDBType: z.ZodString;
1325
+ coreSchema: z.ZodObject<{
1326
+ name: z.ZodString;
1327
+ attributes: z.ZodArray<z.ZodObject<{
1328
+ type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
1329
+ name: z.ZodString;
1330
+ description: z.ZodOptional<z.ZodString>;
1331
+ mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
1332
+ required: z.ZodOptional<z.ZodBoolean>;
1333
+ multiValued: z.ZodOptional<z.ZodBoolean>;
1334
+ uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
1335
+ canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
1336
+ subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
1337
+ }, z.core.$strip>>;
1338
+ }, z.core.$strip>;
1339
+ attributeMapping: z.ZodArray<z.ZodObject<{
1340
+ tailorDBField: z.ZodString;
1341
+ scimPath: z.ZodString;
1342
+ }, z.core.$strip>>;
1343
+ }, z.core.$strip>>;
1344
+ }, z.core.$strip>;
1345
+ declare const TenantProviderSchema: z.ZodObject<{
1346
+ namespace: z.ZodString;
1347
+ type: z.ZodString;
1348
+ signatureField: z.ZodString;
1349
+ }, z.core.$strip>;
1350
+ //#endregion
1351
+ //#region src/parser/service/auth/types.d.ts
1352
+ type AuthInvoker = z.output<typeof AuthInvokerSchema>;
1353
+ type AuthInvokerWithName<M extends string> = Omit<AuthInvoker, "machineUserName"> & {
1354
+ machineUserName: M;
1355
+ };
1356
+ type OIDC = z.output<typeof OIDCSchema>;
1357
+ type SAML = z.output<typeof SAMLSchema>;
1358
+ type IDToken = z.output<typeof IDTokenSchema>;
1359
+ type BuiltinIdP = z.output<typeof BuiltinIdPSchema>;
1360
+ type IdProviderConfig = z.output<typeof IdProviderSchema>;
1361
+ type OAuth2ClientGrantType = z.output<typeof OAuth2ClientGrantTypeSchema>;
1362
+ type OAuth2ClientInput = z.input<typeof OAuth2ClientSchema>;
1363
+ type SCIMAuthorization = z.output<typeof SCIMAuthorizationSchema>;
1364
+ type SCIMAttributeType = z.output<typeof SCIMAttributeTypeSchema>;
1365
+ type SCIMAttribute = z.output<typeof SCIMAttributeSchema>;
1366
+ type SCIMAttributeMapping = z.output<typeof SCIMAttributeMappingSchema>;
1367
+ type SCIMResource = z.output<typeof SCIMResourceSchema>;
1368
+ type SCIMConfig = z.output<typeof SCIMSchema>;
1369
+ type TenantProviderConfig = z.output<typeof TenantProviderSchema>;
1370
+ type ValueOperand = string | boolean | string[] | boolean[];
1371
+ type AuthAttributeValue = ValueOperand | null | undefined;
1372
+ type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
1373
+ type FieldDefined<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = User["fields"][Key] extends {
1374
+ _defined: infer Defined;
1375
+ } ? Defined : never;
1376
+ type FieldOutput<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = output<User>[Key];
1377
+ type FieldIsRequired<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = undefined extends FieldOutput<User, Key> ? false : true;
1378
+ type FieldIsOfType<User extends TailorDBInstance, Key extends UserFieldKeys<User>, Type extends string> = FieldDefined<User, Key> extends {
1379
+ type: Type;
1380
+ } ? true : false;
1381
+ type FieldIsArray<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
1382
+ array: true;
1383
+ } ? true : false;
1384
+ type FieldIsUnique<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
1385
+ unique: true;
1386
+ } ? true : false;
1387
+ type FieldSupportsValueOperand<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldOutput<User, Key> extends ValueOperand | null | undefined ? true : false;
1388
+ type UsernameFieldKey<User extends TailorDBInstance> = IsAny<User> extends true ? string : { [K in UserFieldKeys<User>]: FieldIsRequired<User, K> extends true ? FieldIsOfType<User, K, "string"> extends true ? FieldIsArray<User, K> extends true ? never : FieldIsUnique<User, K> extends true ? K : never : never : never }[UserFieldKeys<User>];
1389
+ 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>];
1390
+ 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>];
1391
+ type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
1392
+ type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
1393
+ type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
1394
+ 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 };
1395
+ 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>>;
1396
+ type UserProfile<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[]> = {
1412
1397
  /**
1413
- * Additional TailorDB types to generate, keyed by kind identifier.
1414
- * The kind is used to generate distinct TypeScript type files.
1415
- * @example { request: changeRequest, step: changeStep }
1398
+ * TailorDB namespace where the user type is defined.
1399
+ *
1400
+ * Usually auto-resolved, so you don't need to specify this.
1401
+ * Required only when multiple TailorDBs exist and the type is in an external TailorDB.
1416
1402
  */
1417
- types?: PluginGeneratedTypes;
1418
- /** Additional resolvers to generate */
1419
- resolvers?: PluginGeneratedResolver[];
1420
- /** Additional executors to generate */
1421
- executors?: PluginGeneratedExecutor[];
1422
- }
1423
- /**
1424
- * Output returned by a plugin's processType method.
1425
- * Extends PluginOutput with the ability to add fields to the source type.
1426
- */
1427
- interface TypePluginOutput extends PluginOutput {
1428
- /** Extensions to apply to the source type */
1429
- extends?: PluginExtends;
1430
- }
1403
+ namespace?: string;
1404
+ type: User;
1405
+ usernameField: UsernameFieldKey<User>;
1406
+ attributes?: DisallowExtraKeys<AttributeMap$1, UserAttributeKey<User>>;
1407
+ attributeList?: AttributeList$1;
1408
+ };
1409
+ type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
1410
+ type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
1411
+ type MachineUserAttributeValues<Fields extends MachineUserAttributeFields> = { [K in keyof Fields]: TailorFieldOutputValue<Fields[K]> extends ValueOperand | null | undefined ? TailorFieldOutputValue<Fields[K]> : never };
1412
+ type MachineUserFromAttributes<Fields extends MachineUserAttributeFields> = (keyof Fields extends never ? {
1413
+ attributes?: never;
1414
+ } : {
1415
+ attributes: DisallowExtraKeys<MachineUserAttributeValues<Fields>, keyof Fields>;
1416
+ }) & {
1417
+ attributeList?: string[];
1418
+ };
1419
+ type MachineUser<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
1420
+ attributes: Record<string, AuthAttributeValue>;
1421
+ attributeList?: string[];
1422
+ } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
1423
+ attributes?: never;
1424
+ } : {
1425
+ 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 };
1426
+ }) & ([] extends AttributeList$1 ? {
1427
+ attributeList?: never;
1428
+ } : {
1429
+ attributeList: AttributeListToTuple<User, AttributeList$1>;
1430
+ }) : [MachineUserAttributes] extends [MachineUserAttributeFields] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
1431
+ attributes: Record<string, AuthAttributeValue>;
1432
+ attributeList?: string[];
1433
+ } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
1434
+ attributes?: never;
1435
+ } : {
1436
+ 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 };
1437
+ }) & ([] extends AttributeList$1 ? {
1438
+ attributeList?: never;
1439
+ } : {
1440
+ attributeList: AttributeListToTuple<User, AttributeList$1>;
1441
+ });
1442
+ type AuthServiceInput<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined> = {
1443
+ userProfile?: UserProfile<User, AttributeMap$1, AttributeList$1>;
1444
+ machineUserAttributes?: MachineUserAttributes;
1445
+ machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap$1, AttributeList$1, MachineUserAttributes>>;
1446
+ oauth2Clients?: Record<string, OAuth2ClientInput>;
1447
+ idProvider?: IdProviderConfig;
1448
+ scim?: SCIMConfig;
1449
+ tenantProvider?: TenantProviderConfig;
1450
+ publishSessionEvents?: boolean;
1451
+ };
1452
+ declare const authDefinitionBrand: unique symbol;
1453
+ type AuthDefinitionBrand = {
1454
+ readonly [authDefinitionBrand]: true;
1455
+ };
1456
+ type DefinedAuth<Name extends string, Config, MachineUserNames extends string> = Config & {
1457
+ name: Name;
1458
+ invoker<M extends MachineUserNames>(machineUser: M): AuthInvokerWithName<M>;
1459
+ } & AuthDefinitionBrand;
1460
+ type AuthExternalConfig = {
1461
+ name: string;
1462
+ external: true;
1463
+ };
1464
+ type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
1465
+ type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
1466
+ type AuthConfig = AuthOwnConfig | AuthExternalConfig;
1467
+ //#endregion
1468
+ //#region src/parser/service/executor/schema.d.ts
1469
+ declare const RecordTriggerSchema: z.ZodObject<{
1470
+ kind: z.ZodEnum<{
1471
+ recordCreated: "recordCreated";
1472
+ recordUpdated: "recordUpdated";
1473
+ recordDeleted: "recordDeleted";
1474
+ }>;
1475
+ typeName: z.ZodString;
1476
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1477
+ }, z.core.$strip>;
1478
+ declare const ResolverExecutedTriggerSchema: z.ZodObject<{
1479
+ kind: z.ZodLiteral<"resolverExecuted">;
1480
+ resolverName: z.ZodString;
1481
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1482
+ }, z.core.$strip>;
1483
+ declare const ScheduleTriggerSchema: z.ZodObject<{
1484
+ kind: z.ZodLiteral<"schedule">;
1485
+ cron: z.ZodString;
1486
+ timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1487
+ }, z.core.$strip>;
1488
+ declare const IncomingWebhookTriggerSchema: z.ZodObject<{
1489
+ kind: z.ZodLiteral<"incomingWebhook">;
1490
+ }, z.core.$strip>;
1491
+ declare const IdpUserTriggerSchema: z.ZodObject<{
1492
+ kind: z.ZodEnum<{
1493
+ idpUserCreated: "idpUserCreated";
1494
+ idpUserUpdated: "idpUserUpdated";
1495
+ idpUserDeleted: "idpUserDeleted";
1496
+ }>;
1497
+ }, z.core.$strip>;
1498
+ declare const AuthAccessTokenTriggerSchema: z.ZodObject<{
1499
+ kind: z.ZodEnum<{
1500
+ authAccessTokenIssued: "authAccessTokenIssued";
1501
+ authAccessTokenRefreshed: "authAccessTokenRefreshed";
1502
+ authAccessTokenRevoked: "authAccessTokenRevoked";
1503
+ }>;
1504
+ }, z.core.$strip>;
1505
+ declare const FunctionOperationSchema: z.ZodObject<{
1506
+ kind: z.ZodEnum<{
1507
+ function: "function";
1508
+ jobFunction: "jobFunction";
1509
+ }>;
1510
+ body: z.ZodCustom<Function, Function>;
1511
+ authInvoker: z.ZodOptional<z.ZodObject<{
1512
+ namespace: z.ZodString;
1513
+ machineUserName: z.ZodString;
1514
+ }, z.core.$strip>>;
1515
+ }, z.core.$strip>;
1516
+ declare const GqlOperationSchema: z.ZodObject<{
1517
+ kind: z.ZodLiteral<"graphql">;
1518
+ appName: z.ZodOptional<z.ZodString>;
1519
+ query: z.ZodPipe<z.ZodTransform<string, unknown>, z.ZodString>;
1520
+ variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
1521
+ authInvoker: z.ZodOptional<z.ZodObject<{
1522
+ namespace: z.ZodString;
1523
+ machineUserName: z.ZodString;
1524
+ }, z.core.$strip>>;
1525
+ }, z.core.$strip>;
1526
+ declare const WebhookOperationSchema: z.ZodObject<{
1527
+ kind: z.ZodLiteral<"webhook">;
1528
+ url: z.ZodCustom<Function, Function>;
1529
+ requestBody: z.ZodOptional<z.ZodCustom<Function, Function>>;
1530
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1531
+ vault: z.ZodString;
1532
+ key: z.ZodString;
1533
+ }, z.core.$strip>]>>>;
1534
+ }, z.core.$strip>;
1535
+ declare const WorkflowOperationSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
1536
+ kind: z.ZodLiteral<"workflow">;
1537
+ workflowName: z.ZodString;
1538
+ args: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<Function, Function>]>>;
1539
+ authInvoker: z.ZodOptional<z.ZodObject<{
1540
+ namespace: z.ZodString;
1541
+ machineUserName: z.ZodString;
1542
+ }, z.core.$strip>>;
1543
+ }, z.core.$strip>>;
1544
+ declare const ExecutorSchema: z.ZodObject<{
1545
+ name: z.ZodString;
1546
+ description: z.ZodOptional<z.ZodString>;
1547
+ disabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1548
+ trigger: z.ZodDiscriminatedUnion<[z.ZodObject<{
1549
+ kind: z.ZodEnum<{
1550
+ recordCreated: "recordCreated";
1551
+ recordUpdated: "recordUpdated";
1552
+ recordDeleted: "recordDeleted";
1553
+ }>;
1554
+ typeName: z.ZodString;
1555
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1556
+ }, z.core.$strip>, z.ZodObject<{
1557
+ kind: z.ZodLiteral<"resolverExecuted">;
1558
+ resolverName: z.ZodString;
1559
+ condition: z.ZodOptional<z.ZodCustom<Function, Function>>;
1560
+ }, z.core.$strip>, z.ZodObject<{
1561
+ kind: z.ZodLiteral<"schedule">;
1562
+ cron: z.ZodString;
1563
+ timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
1564
+ }, z.core.$strip>, z.ZodObject<{
1565
+ kind: z.ZodLiteral<"incomingWebhook">;
1566
+ }, z.core.$strip>, z.ZodObject<{
1567
+ kind: z.ZodEnum<{
1568
+ idpUserCreated: "idpUserCreated";
1569
+ idpUserUpdated: "idpUserUpdated";
1570
+ idpUserDeleted: "idpUserDeleted";
1571
+ }>;
1572
+ }, z.core.$strip>, z.ZodObject<{
1573
+ kind: z.ZodEnum<{
1574
+ authAccessTokenIssued: "authAccessTokenIssued";
1575
+ authAccessTokenRefreshed: "authAccessTokenRefreshed";
1576
+ authAccessTokenRevoked: "authAccessTokenRevoked";
1577
+ }>;
1578
+ }, z.core.$strip>], "kind">;
1579
+ operation: z.ZodUnion<readonly [z.ZodObject<{
1580
+ kind: z.ZodEnum<{
1581
+ function: "function";
1582
+ jobFunction: "jobFunction";
1583
+ }>;
1584
+ body: z.ZodCustom<Function, Function>;
1585
+ authInvoker: z.ZodOptional<z.ZodObject<{
1586
+ namespace: z.ZodString;
1587
+ machineUserName: z.ZodString;
1588
+ }, z.core.$strip>>;
1589
+ }, z.core.$strip>, z.ZodObject<{
1590
+ kind: z.ZodLiteral<"graphql">;
1591
+ appName: z.ZodOptional<z.ZodString>;
1592
+ query: z.ZodPipe<z.ZodTransform<string, unknown>, z.ZodString>;
1593
+ variables: z.ZodOptional<z.ZodCustom<Function, Function>>;
1594
+ authInvoker: z.ZodOptional<z.ZodObject<{
1595
+ namespace: z.ZodString;
1596
+ machineUserName: z.ZodString;
1597
+ }, z.core.$strip>>;
1598
+ }, z.core.$strip>, z.ZodObject<{
1599
+ kind: z.ZodLiteral<"webhook">;
1600
+ url: z.ZodCustom<Function, Function>;
1601
+ requestBody: z.ZodOptional<z.ZodCustom<Function, Function>>;
1602
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1603
+ vault: z.ZodString;
1604
+ key: z.ZodString;
1605
+ }, z.core.$strip>]>>>;
1606
+ }, z.core.$strip>, z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
1607
+ kind: z.ZodLiteral<"workflow">;
1608
+ workflowName: z.ZodString;
1609
+ args: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodCustom<Function, Function>]>>;
1610
+ authInvoker: z.ZodOptional<z.ZodObject<{
1611
+ namespace: z.ZodString;
1612
+ machineUserName: z.ZodString;
1613
+ }, z.core.$strip>>;
1614
+ }, z.core.$strip>>]>;
1615
+ }, z.core.$strip>;
1616
+ //#endregion
1617
+ //#region src/parser/service/executor/types.d.ts
1618
+ type RecordTrigger = z.infer<typeof RecordTriggerSchema>;
1619
+ type ResolverExecutedTrigger = z.infer<typeof ResolverExecutedTriggerSchema>;
1620
+ type ScheduleTriggerInput = z.input<typeof ScheduleTriggerSchema>;
1621
+ type IncomingWebhookTrigger = z.infer<typeof IncomingWebhookTriggerSchema>;
1622
+ type IdpUserTrigger = z.infer<typeof IdpUserTriggerSchema>;
1623
+ type AuthAccessTokenTrigger = z.infer<typeof AuthAccessTokenTriggerSchema>;
1624
+ type FunctionOperation = z.infer<typeof FunctionOperationSchema>;
1625
+ type GqlOperation = z.infer<typeof GqlOperationSchema>;
1626
+ type WebhookOperation = z.infer<typeof WebhookOperationSchema>;
1627
+ type WorkflowOperation = z.infer<typeof WorkflowOperationSchema>;
1628
+ type Executor = z.infer<typeof ExecutorSchema>;
1629
+ type ExecutorInput = z.input<typeof ExecutorSchema>;
1630
+ type ExecutorServiceConfig = {
1631
+ files: string[];
1632
+ ignores?: string[];
1633
+ };
1634
+ type ExecutorServiceInput = ExecutorServiceConfig;
1635
+ //#endregion
1636
+ //#region src/parser/plugin-config/generation-types.d.ts
1431
1637
  /**
1432
- * Output returned by a plugin's processNamespace method.
1433
- * Alias for PluginOutput (namespace plugins cannot extend a source type).
1638
+ * A single generated file to write to disk.
1434
1639
  */
1435
- type NamespacePluginOutput = PluginOutput;
1640
+ interface GeneratedFile {
1641
+ path: string;
1642
+ content: string;
1643
+ skipIfExists?: boolean;
1644
+ executable?: boolean;
1645
+ }
1436
1646
  /**
1437
- * Plugin interface that all plugins must implement.
1438
- * @template TypeConfig - Type for per-type configuration passed via .plugin() method
1439
- * @template PluginConfig - Type for plugin-level configuration passed via definePlugins()
1647
+ * Result returned by generation-time hooks.
1440
1648
  */
1441
- interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
1442
- /** Unique identifier for the plugin */
1443
- readonly id: string;
1444
- /** Human-readable description of the plugin */
1445
- readonly description: string;
1446
- /**
1447
- * Import path for this plugin's public API.
1448
- * Used by code generators to create correct import statements
1449
- * (e.g., plugin executors and seed schema generation).
1450
- */
1451
- readonly importPath: string;
1452
- /**
1453
- * Controls whether per-type plugin config is required when attaching via .plugin().
1454
- * If a function is provided, it receives pluginConfig from definePlugins().
1455
- * Default is optional when not provided.
1456
- */
1457
- readonly typeConfigRequired?: TypeConfigRequired<PluginConfig>;
1458
- /**
1459
- * Plugin-level configuration passed via definePlugins().
1460
- * This config is stored when the plugin is registered and made available
1461
- * to both processType() and processNamespace() methods.
1462
- */
1463
- readonly pluginConfig?: PluginConfig;
1464
- /**
1465
- * Process a single TailorDB type and generate outputs.
1466
- * This method is called for each type that has this plugin attached via .plugin().
1467
- * @param context - Context containing the type, config, pluginConfig, and namespace
1468
- * @returns Plugin output with generated types, resolvers, and executors
1469
- */
1470
- processType?(context: PluginProcessContext<TypeConfig, PluginConfig>): TypePluginOutput | Promise<TypePluginOutput>;
1471
- /**
1472
- * Process plugin for a namespace without requiring a source type.
1473
- * This method is called once per namespace for plugins configured via definePlugins().
1474
- * Use this for plugins that generate types independently of user-defined types.
1475
- * @param context - Context containing the plugin config, namespace, and types
1476
- * @returns Plugin output with generated types, resolvers, and executors
1477
- */
1478
- processNamespace?(context: PluginNamespaceProcessContext<PluginConfig>): NamespacePluginOutput | Promise<NamespacePluginOutput>;
1649
+ interface GeneratorResult {
1650
+ files: GeneratedFile[];
1651
+ errors?: string[];
1479
1652
  }
1480
- //#endregion
1481
- //#region src/configure/services/tailordb/schema.d.ts
1482
- interface RelationConfig<S extends RelationType, T extends TailorDBType$1> {
1483
- type: S;
1484
- toward: {
1485
- type: T;
1486
- as?: string;
1487
- key?: keyof T["fields"] & string;
1653
+ /**
1654
+ * Auth configuration available to generation-time hooks.
1655
+ */
1656
+ interface GeneratorAuthInput {
1657
+ name: string;
1658
+ userProfile?: {
1659
+ typeName: string;
1660
+ namespace: string;
1661
+ usernameField: string;
1488
1662
  };
1489
- backward?: string;
1663
+ machineUsers?: Record<string, {
1664
+ attributes: Record<string, unknown>;
1665
+ }>;
1666
+ oauth2Clients?: Record<string, OAuth2ClientInput>;
1667
+ idProvider?: IdProviderConfig;
1490
1668
  }
1491
- type RelationSelfConfig = {
1492
- type: RelationType;
1493
- toward: {
1494
- type: "self";
1495
- as?: string;
1496
- key?: string;
1497
- };
1498
- backward?: string;
1499
- };
1500
- type TailorAnyDBField = TailorDBField<any, any>;
1501
- type TailorAnyDBType = TailorDBType$1<any, any>;
1502
1669
  /**
1503
- * TailorDBField interface representing a database field with extended metadata.
1504
- * Extends TailorField with database-specific features like relations, indexes, and hooks.
1670
+ * Namespace-level TailorDB data available to generation-time hooks.
1505
1671
  */
1506
- interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends Omit<TailorField<Defined, Output, DBFieldMetadata, Defined["type"]>, "description" | "validate"> {
1507
- /** Returns a shallow copy of the raw relation config if set */
1508
- readonly rawRelation: Readonly<RawRelationConfig> | undefined;
1509
- /**
1510
- * Set a description for the field
1511
- * @param description - The description text
1512
- * @returns The field with updated metadata
1513
- */
1514
- description<CurrentDefined extends Defined>(this: CurrentDefined extends {
1515
- description: unknown;
1516
- } ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
1517
- description: true;
1518
- }>, Output>;
1519
- /**
1520
- * Define a relation to another type.
1521
- * Relation types: "n-1" (many-to-one), "1-1" (one-to-one), "keyOnly" (key only).
1522
- * Aliases "manyToOne", "oneToOne", and "N-1" are also accepted.
1523
- * @example db.uuid().relation({ type: "n-1", toward: { type: otherModel } })
1524
- * @example db.uuid().relation({ type: "1-1", toward: { type: profile } })
1525
- */
1526
- relation<S extends RelationType, T extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
1527
- relation: unknown;
1528
- } ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
1529
- unique: true;
1530
- index: true;
1531
- relation: true;
1532
- }> : Prettify<CurrentDefined & {
1533
- index: true;
1534
- relation: true;
1535
- }>, Output>;
1536
- /**
1537
- * Define a self-referencing relation
1538
- */
1539
- relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
1540
- relation: unknown;
1541
- } ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
1542
- unique: true;
1543
- index: true;
1544
- relation: true;
1545
- }> : Prettify<CurrentDefined & {
1546
- index: true;
1547
- relation: true;
1548
- }>, Output>;
1549
- /**
1550
- * Add an index to the field
1551
- */
1552
- index<CurrentDefined extends Defined>(this: CurrentDefined extends {
1553
- index: unknown;
1554
- } ? never : CurrentDefined extends {
1555
- array: true;
1556
- } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
1557
- index: true;
1558
- }>, Output>;
1559
- /**
1560
- * Make the field unique (also adds an index)
1561
- */
1562
- unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
1563
- unique: unknown;
1564
- } ? never : CurrentDefined extends {
1565
- array: true;
1566
- } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
1567
- unique: true;
1568
- index: true;
1569
- }>, Output>;
1570
- /**
1571
- * Enable vector search on the field (string type only)
1572
- */
1573
- vector<CurrentDefined extends Defined>(this: CurrentDefined extends {
1574
- vector: unknown;
1575
- } ? never : CurrentDefined extends {
1576
- type: "string";
1577
- array: false;
1578
- } ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
1579
- vector: true;
1580
- }>, Output>;
1581
- /**
1582
- * Add hooks for create/update operations on this field.
1583
- * The hook function receives `{ value, data, user }` and returns the computed value.
1584
- * @example db.string().hooks({ create: ({ data }) => data.firstName + " " + data.lastName })
1585
- * @example db.datetime().hooks({ create: () => new Date(), update: () => new Date() })
1586
- */
1587
- hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
1588
- hooks: unknown;
1589
- } ? never : CurrentDefined extends {
1590
- type: "nested";
1591
- } ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
1592
- hooks?: {
1593
- create: H extends {
1594
- create: unknown;
1595
- } ? true : false;
1596
- update: H extends {
1597
- update: unknown;
1598
- } ? true : false;
1599
- };
1600
- serial: false;
1601
- }>, Output>;
1602
- /**
1603
- * Add validation functions to the field.
1604
- * Accepts a function or a tuple of [function, errorMessage].
1605
- * Prefer the tuple form for diagnosable errors.
1606
- * @example
1607
- * // Function form (default error message):
1608
- * db.int().validate(({ value }) => value >= 0)
1609
- * @example
1610
- * // Tuple form with custom error message (recommended):
1611
- * db.string().validate([({ value }) => value.length >= 8, "Must be at least 8 characters"])
1612
- */
1613
- validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
1614
- validate: unknown;
1615
- } ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
1616
- validate: true;
1617
- }>, Output>;
1618
- /**
1619
- * Configure serial/auto-increment behavior
1620
- */
1621
- serial<CurrentDefined extends Defined>(this: CurrentDefined extends {
1622
- serial: unknown;
1623
- } ? never : Output extends null ? never : CurrentDefined extends {
1624
- type: "integer" | "string";
1625
- array: false;
1626
- } ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
1627
- serial: true;
1628
- hooks: {
1629
- create: false;
1630
- update: false;
1631
- };
1632
- }>, Output>;
1633
- /**
1634
- * Clone the field with optional overrides for field options
1635
- * @param options - Optional field options to override
1636
- * @returns A new TailorDBField instance with the same configuration
1637
- */
1638
- clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
1639
- array: NewOpt extends {
1640
- array: true;
1641
- } ? true : Defined["array"];
1642
- }>, FieldOutput$1<TailorToTs[Defined["type"]], NewOpt>>;
1672
+ interface TailorDBNamespaceData {
1673
+ /** Namespace name */
1674
+ namespace: string;
1675
+ /** All TailorDB types in this namespace, keyed by type name */
1676
+ types: Record<string, TailorDBType>;
1677
+ /** Source info for each type (file path, export name, plugin info) */
1678
+ sourceInfo: ReadonlyMap<string, TypeSourceInfoEntry>;
1679
+ /** Plugin attachments configured on each type via .plugin() method */
1680
+ pluginAttachments: ReadonlyMap<string, readonly PluginAttachment[]>;
1643
1681
  }
1644
1682
  /**
1645
- * Create a UUID field.
1646
- * @param options - Field configuration options
1647
- * @returns A UUID field
1648
- * @example db.uuid()
1649
- * @example db.uuid({ optional: true })
1683
+ * Namespace-level resolver data available to generation-time hooks.
1650
1684
  */
1651
- declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1652
- type: "uuid";
1653
- array: Opt extends {
1654
- array: true;
1655
- } ? true : false;
1656
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1685
+ interface ResolverNamespaceData {
1686
+ /** Namespace name */
1687
+ namespace: string;
1688
+ /** All resolvers in this namespace, keyed by resolver name */
1689
+ resolvers: Record<string, Resolver>;
1690
+ }
1657
1691
  /**
1658
- * Create a string field.
1659
- * @param options - Field configuration options
1660
- * @returns A string field
1661
- * @example db.string()
1662
- * @example db.string({ optional: true })
1692
+ * Context passed to plugin's onTailorDBReady hook.
1693
+ * Called after all TailorDB types are loaded and finalized.
1694
+ * @template PluginConfig - Plugin-level configuration type
1695
+ */
1696
+ interface TailorDBReadyContext<PluginConfig = unknown> {
1697
+ /** All TailorDB namespaces with their types and metadata */
1698
+ tailordb: TailorDBNamespaceData[];
1699
+ /** Auth configuration */
1700
+ auth?: GeneratorAuthInput;
1701
+ /** Base directory for generated files */
1702
+ baseDir: string;
1703
+ /** Path to tailor.config.ts */
1704
+ configPath: string;
1705
+ /** Plugin-level configuration passed via definePlugins() */
1706
+ pluginConfig: PluginConfig;
1707
+ }
1708
+ /**
1709
+ * Context passed to plugin's onResolverReady hook.
1710
+ * Called after all resolvers are loaded and finalized.
1711
+ * @template PluginConfig - Plugin-level configuration type
1712
+ */
1713
+ interface ResolverReadyContext<PluginConfig = unknown> {
1714
+ /** All TailorDB namespaces with their types and metadata */
1715
+ tailordb: TailorDBNamespaceData[];
1716
+ /** All resolver namespaces with their resolvers */
1717
+ resolvers: ResolverNamespaceData[];
1718
+ /** Auth configuration */
1719
+ auth?: GeneratorAuthInput;
1720
+ /** Base directory for generated files */
1721
+ baseDir: string;
1722
+ /** Path to tailor.config.ts */
1723
+ configPath: string;
1724
+ /** Plugin-level configuration passed via definePlugins() */
1725
+ pluginConfig: PluginConfig;
1726
+ }
1727
+ /**
1728
+ * Context passed to plugin's onExecutorReady hook.
1729
+ * Called after all executors are loaded and finalized.
1730
+ * @template PluginConfig - Plugin-level configuration type
1731
+ */
1732
+ interface ExecutorReadyContext<PluginConfig = unknown> {
1733
+ /** All TailorDB namespaces with their types and metadata */
1734
+ tailordb: TailorDBNamespaceData[];
1735
+ /** All resolver namespaces with their resolvers */
1736
+ resolvers: ResolverNamespaceData[];
1737
+ /** All executors, keyed by executor name */
1738
+ executors: Record<string, Executor>;
1739
+ /** Auth configuration */
1740
+ auth?: GeneratorAuthInput;
1741
+ /** Base directory for generated files */
1742
+ baseDir: string;
1743
+ /** Path to tailor.config.ts */
1744
+ configPath: string;
1745
+ /** Plugin-level configuration passed via definePlugins() */
1746
+ pluginConfig: PluginConfig;
1747
+ }
1748
+ //#endregion
1749
+ //#region src/parser/plugin-config/types.d.ts
1750
+ type TypeConfigRequired<PluginConfig = unknown> = boolean | ((pluginConfig: PluginConfig | undefined) => boolean);
1751
+ /**
1752
+ * Interface for plugin configuration mapping.
1753
+ * Extend this interface via declaration merging to add typed plugin configs.
1754
+ *
1755
+ * The `Fields` type parameter provides field names from the type being configured,
1756
+ * enabling type-safe field references in plugin configs.
1757
+ * @example
1758
+ * ```typescript
1759
+ * // In your plugin package or types file:
1760
+ * declare module "@tailor-platform/sdk" {
1761
+ * interface PluginConfigs<Fields extends string> {
1762
+ * "@my-company/i18n": {
1763
+ * labels: Partial<Record<Fields, { ja: string; en: string }>>;
1764
+ * };
1765
+ * }
1766
+ * }
1767
+ * ```
1663
1768
  */
1664
- declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1665
- type: "string";
1666
- array: Opt extends {
1667
- array: true;
1668
- } ? true : false;
1669
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1769
+ interface PluginConfigs<Fields extends string = string> {}
1670
1770
  /**
1671
- * Create a boolean field.
1672
- * Note: The method name is `bool` but creates a `boolean` type field.
1673
- * @param options - Field configuration options
1674
- * @returns A boolean field
1675
- * @example db.bool()
1676
- * @example db.bool({ optional: true })
1771
+ * Plugin attachment stored on TailorAnyDBType instances.
1772
+ * This is the configuration passed via `.plugin()` method.
1677
1773
  */
1678
- declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1679
- type: "boolean";
1680
- array: Opt extends {
1681
- array: true;
1682
- } ? true : false;
1683
- }, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
1774
+ interface PluginAttachment {
1775
+ pluginId: string;
1776
+ config: unknown;
1777
+ }
1684
1778
  /**
1685
- * Create an integer field.
1686
- * @param options - Field configuration options
1687
- * @returns An integer field
1688
- * @example db.int()
1689
- * @example db.int({ optional: true })
1779
+ * Context passed to plugin's process method
1690
1780
  */
1691
- declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1692
- type: "integer";
1693
- array: Opt extends {
1694
- array: true;
1695
- } ? true : false;
1696
- }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
1781
+ interface PluginProcessContext<TypeConfig = unknown, PluginConfig = unknown> {
1782
+ /** The raw TailorDB type being processed */
1783
+ type: TailorAnyDBType;
1784
+ /** Per-type configuration passed via .plugin() method */
1785
+ typeConfig: TypeConfig;
1786
+ /** Plugin-level configuration passed via definePlugins() */
1787
+ pluginConfig: PluginConfig;
1788
+ /** Namespace of the TailorDB type */
1789
+ namespace: string;
1790
+ }
1697
1791
  /**
1698
- * Create a float (decimal number) field.
1699
- * @param options - Field configuration options
1700
- * @returns A float field
1701
- * @example db.float()
1702
- * @example db.float({ optional: true })
1792
+ * Context passed to plugin's onNamespaceLoaded hook.
1793
+ * Used for plugins that operate on a namespace without requiring a source type.
1703
1794
  */
1704
- declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1705
- type: "float";
1706
- array: Opt extends {
1707
- array: true;
1708
- } ? true : false;
1709
- }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
1795
+ interface PluginNamespaceProcessContext<PluginConfig = unknown> {
1796
+ /** Plugin-level configuration passed via definePlugins() */
1797
+ pluginConfig: PluginConfig;
1798
+ /** Target namespace for generated types */
1799
+ namespace: string;
1800
+ }
1710
1801
  /**
1711
- * Create a date field (date only, no time component).
1712
- * Format: "yyyy-MM-dd"
1713
- * @param options - Field configuration options
1714
- * @returns A date field
1715
- * @example db.date()
1802
+ * Interface representing a TailorDB type for plugin output.
1803
+ * This interface is satisfied by db.type() instances.
1716
1804
  */
1717
- declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1718
- type: "date";
1719
- array: Opt extends {
1720
- array: true;
1721
- } ? true : false;
1722
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1805
+ interface TailorDBTypeForPlugin {
1806
+ /** The name of the type */
1807
+ readonly name: string;
1808
+ /** The field definitions */
1809
+ readonly fields: Record<string, unknown>;
1810
+ }
1723
1811
  /**
1724
- * Create a datetime field (date and time).
1725
- * Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
1726
- * @param options - Field configuration options
1727
- * @returns A datetime field
1728
- * @example db.datetime()
1812
+ * Type generated by a plugin - use db.type() to create these.
1729
1813
  */
1730
- declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1731
- type: "datetime";
1732
- array: Opt extends {
1733
- array: true;
1734
- } ? true : false;
1735
- }, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
1814
+ type PluginGeneratedType = TailorDBTypeForPlugin;
1736
1815
  /**
1737
- * Create a time field (time only, no date component).
1738
- * Format: "HH:mm"
1739
- * @param options - Field configuration options
1740
- * @returns A time field
1741
- * @example db.time()
1816
+ * Map of generated types keyed by kind identifier.
1817
+ * The kind is used to generate distinct TypeScript type files for each generated type.
1818
+ * @example
1819
+ * ```typescript
1820
+ * {
1821
+ * request: changeRequest,
1822
+ * step: changeStep,
1823
+ * approval: changeApproval,
1824
+ * }
1825
+ * ```
1742
1826
  */
1743
- declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1744
- type: "time";
1745
- array: Opt extends {
1746
- array: true;
1747
- } ? true : false;
1748
- }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1827
+ type PluginGeneratedTypes = Record<string, PluginGeneratedType>;
1749
1828
  /**
1750
- * Create an enum field with a fixed set of allowed string values.
1751
- * @param values - Array of allowed string values, or array of `{ value, description }` objects
1752
- * @param options - Field configuration options
1753
- * @returns An enum field
1754
- * @example db.enum(["active", "inactive", "suspended"])
1755
- * @example db.enum(["small", "medium", "large"], { optional: true })
1829
+ * Resolver definition generated by a plugin.
1830
+ * Fields can be TailorDB field instances or raw field definitions.
1756
1831
  */
1757
- declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
1758
- type: "enum";
1759
- array: Opt extends {
1760
- array: true;
1761
- } ? true : false;
1762
- }, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
1832
+ interface PluginGeneratedResolver {
1833
+ name: string;
1834
+ operation: "query" | "mutation";
1835
+ inputFields?: Record<string, unknown>;
1836
+ outputFields: Record<string, unknown>;
1837
+ /** Function body code as string */
1838
+ body: string;
1839
+ }
1763
1840
  /**
1764
- * Create a nested object field with sub-fields.
1765
- * @param fields - Record of nested field definitions
1766
- * @param options - Field configuration options
1767
- * @returns A nested object field
1768
- * @example db.object({ street: db.string(), city: db.string(), zip: db.string() })
1769
- * @example db.object({ name: db.string() }, { optional: true })
1841
+ * Record trigger configuration for plugin-generated executors
1770
1842
  */
1771
- declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
1772
- type: "nested";
1773
- array: Opt extends {
1774
- array: true;
1775
- } ? true : false;
1776
- }, FieldOutput$1<InferFieldsOutput<F>, Opt>>;
1843
+ interface PluginRecordTriggerConfig {
1844
+ kind: "recordCreated" | "recordUpdated" | "recordDeleted";
1845
+ /** TailorDB type name for record triggers */
1846
+ typeName: string;
1847
+ }
1777
1848
  /**
1778
- * TailorDBType interface representing a database type definition with fields, permissions, and settings.
1849
+ * Schedule trigger configuration for plugin-generated executors
1779
1850
  */
1780
- interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
1781
- readonly name: string;
1782
- readonly fields: Fields;
1783
- readonly _output: InferFieldsOutput<Fields>;
1784
- _description?: string;
1785
- /** Returns metadata for the type */
1786
- readonly metadata: TailorDBTypeMetadata;
1851
+ interface PluginScheduleTriggerConfig {
1852
+ kind: "schedule";
1853
+ /** Cron expression */
1854
+ cron: string;
1855
+ /** Timezone (defaults to UTC) */
1856
+ timezone?: string;
1857
+ }
1858
+ /**
1859
+ * Incoming webhook trigger configuration for plugin-generated executors
1860
+ */
1861
+ interface PluginIncomingWebhookTriggerConfig {
1862
+ kind: "incomingWebhook";
1863
+ }
1864
+ /**
1865
+ * Trigger configuration for plugin-generated executors
1866
+ */
1867
+ type PluginTriggerConfig = PluginRecordTriggerConfig | PluginScheduleTriggerConfig | PluginIncomingWebhookTriggerConfig;
1868
+ /**
1869
+ * Inject value types supported for plugin executor injection.
1870
+ * These values are serialized as const declarations in the generated file.
1871
+ */
1872
+ type PluginInjectValue = string | number | boolean | null;
1873
+ /**
1874
+ * Inject map for plugin executor.
1875
+ * Keys become const variable names in the generated file.
1876
+ */
1877
+ type PluginInjectMap = Record<string, PluginInjectValue>;
1878
+ /**
1879
+ * Function operation configuration for plugin-generated executors
1880
+ */
1881
+ interface PluginFunctionOperationConfig {
1882
+ kind: "function";
1883
+ /** Function body code as string */
1884
+ body: string;
1787
1885
  /**
1788
- * Add hooks for fields at the type level.
1789
- * Each key is a field name, and the value defines create/update hooks.
1790
- * @example
1791
- * db.type("Order", {
1792
- * total: db.float(),
1793
- * tax: db.float(),
1794
- * ...db.fields.timestamps(),
1795
- * }).hooks({
1796
- * tax: { create: ({ data }) => data.total * 0.1, update: ({ data }) => data.total * 0.1 },
1797
- * })
1886
+ * Variables to inject into the generated file scope.
1887
+ * These become const declarations at the top of the generated file,
1888
+ * allowing the function body to reference them.
1889
+ * @example { namespace: "tailordb", historyTypeName: "CustomerHistory" }
1798
1890
  */
1799
- hooks(hooks: Hooks<Fields>): TailorDBType$1<Fields, User>;
1891
+ inject?: PluginInjectMap;
1892
+ }
1893
+ /**
1894
+ * GraphQL operation configuration for plugin-generated executors
1895
+ */
1896
+ interface PluginGraphQLOperationConfig {
1897
+ kind: "graphql";
1898
+ /** GraphQL query string */
1899
+ query: string;
1900
+ /** App name for the GraphQL endpoint */
1901
+ appName?: string;
1800
1902
  /**
1801
- * Add validators for fields at the type level.
1802
- * Each key is a field name, and the value is a validator or array of validators.
1803
- * Prefer the tuple form [function, message] for diagnosable errors.
1804
- * @example
1805
- * db.type("User", { email: db.string() }).validate({
1806
- * email: [({ value }) => value.includes("@"), "Email must contain @"],
1807
- * })
1903
+ * Variables expression as a string function.
1904
+ * Receives the executor args object and returns the variables object.
1905
+ * @example "(args) => ({ input: { recordId: args.newRecord.id } })"
1808
1906
  */
1809
- validate(validators: Validators<Fields>): TailorDBType$1<Fields, User>;
1907
+ variables?: string;
1908
+ }
1909
+ /**
1910
+ * Webhook operation configuration for plugin-generated executors
1911
+ */
1912
+ interface PluginWebhookOperationConfig {
1913
+ kind: "webhook";
1914
+ /** Webhook URL */
1915
+ url: string;
1916
+ }
1917
+ /**
1918
+ * Workflow operation configuration for plugin-generated executors
1919
+ */
1920
+ interface PluginWorkflowOperationConfig {
1921
+ kind: "workflow";
1922
+ /** Workflow name */
1923
+ workflowName: string;
1924
+ }
1925
+ /**
1926
+ * Operation configuration for plugin-generated executors
1927
+ */
1928
+ type PluginOperationConfig = PluginFunctionOperationConfig | PluginGraphQLOperationConfig | PluginWebhookOperationConfig | PluginWorkflowOperationConfig;
1929
+ /**
1930
+ * Context value types for plugin executor context.
1931
+ * Supports primitive values and type references.
1932
+ */
1933
+ type PluginExecutorContextValue = TailorAnyDBType | string | number | boolean | null | undefined;
1934
+ /**
1935
+ * Base executor context that can include type references and other values.
1936
+ * Type objects (TailorAnyDBType) will be handled specially by the generator
1937
+ * to create appropriate import statements.
1938
+ *
1939
+ * Plugin authors should extend this interface for their specific context needs.
1940
+ */
1941
+ interface PluginExecutorContextBase {
1942
+ /** Source type that the plugin is attached to. Null for namespace executors. */
1943
+ sourceType: TailorAnyDBType | null;
1944
+ /** TailorDB namespace for data operations */
1945
+ namespace: string;
1946
+ }
1947
+ /**
1948
+ * Flexible executor context type that allows additional properties.
1949
+ * Used as the context type in PluginGeneratedExecutorWithFile.
1950
+ */
1951
+ type PluginExecutorContext = PluginExecutorContextBase & {
1952
+ [key: string]: PluginExecutorContextValue;
1953
+ };
1954
+ /**
1955
+ * Module shape returned by plugin executor resolve().
1956
+ * The concrete context type is intentionally erased at this boundary.
1957
+ */
1958
+ interface PluginExecutorModule {
1959
+ default: unknown;
1960
+ }
1961
+ /**
1962
+ * Executor definition with dynamic import reference (new format).
1963
+ * Used with withPluginContext for type-safe executor definitions in separate files.
1964
+ */
1965
+ interface PluginGeneratedExecutorWithFile<Ctx = PluginExecutorContext> {
1966
+ /** Executor name (used for generated file name) */
1967
+ name: string;
1810
1968
  /**
1811
- * Configure type features
1969
+ * Resolver function for the executor module.
1970
+ * Should return a dynamic import to the executor file.
1971
+ * Relative import specifiers are resolved from the plugin's importPath base.
1972
+ * @example `async () => await import("./executors/on-create")`
1812
1973
  */
1813
- features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType$1<Fields, User>;
1974
+ resolve: () => Promise<PluginExecutorModule>;
1814
1975
  /**
1815
- * Define composite indexes
1976
+ * Context to pass to the executor factory.
1977
+ * Can include TailorAnyDBType objects - these will be handled specially
1978
+ * by the generator to create appropriate import statements.
1816
1979
  */
1817
- indexes(...indexes: IndexDef<TailorDBType$1<Fields, User>>[]): TailorDBType$1<Fields, User>;
1980
+ context: Ctx;
1981
+ }
1982
+ /**
1983
+ * Executor definition generated by a plugin (legacy format).
1984
+ * @deprecated Use PluginGeneratedExecutorWithFile with withPluginContext instead.
1985
+ */
1986
+ interface PluginGeneratedExecutorLegacy {
1987
+ name: string;
1988
+ description?: string;
1989
+ trigger: PluginTriggerConfig;
1990
+ operation: PluginOperationConfig;
1991
+ }
1992
+ /**
1993
+ * Executor definition generated by a plugin.
1994
+ * Supports both legacy format (inline trigger/operation) and new format (executorFile/context).
1995
+ */
1996
+ type PluginGeneratedExecutor = PluginGeneratedExecutorWithFile | PluginGeneratedExecutorLegacy;
1997
+ /**
1998
+ * Extension options for modifying the source type
1999
+ */
2000
+ interface PluginExtends {
1818
2001
  /**
1819
- * Define file fields
2002
+ * Fields to add to the source type.
2003
+ * These fields will be merged into the original type's fields.
2004
+ * Existing fields (from original definition or earlier plugins) take precedence.
1820
2005
  */
1821
- files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<TailorDBType$1<Fields, User>>, never>>): TailorDBType$1<Fields, User>;
2006
+ fields?: Record<string, TailorAnyDBField>;
2007
+ }
2008
+ /**
2009
+ * Base output returned by a plugin's definition-time hooks.
2010
+ * Used by both onTypeLoaded and onNamespaceLoaded.
2011
+ */
2012
+ interface PluginOutput {
1822
2013
  /**
1823
- * Set record-level permissions for create, read, update, and delete operations.
1824
- * Prefer object format with explicit `conditions` and `permit` for readability.
1825
- * For update operations, use `newRecord` and `oldRecord` operands.
1826
- * @example
1827
- * .permission({
1828
- * create: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
1829
- * read: [{ conditions: [[{ record: "isPublic" }, "=", true]], permit: true }],
1830
- * update: [{ conditions: [[{ newRecord: "ownerId" }, "=", { user: "id" }]], permit: true }],
1831
- * delete: [{ conditions: [[{ record: "ownerId" }, "=", { user: "id" }]], permit: true }],
1832
- * })
2014
+ * Additional TailorDB types to generate, keyed by kind identifier.
2015
+ * The kind is used to generate distinct TypeScript type files.
2016
+ * @example { request: changeRequest, step: changeStep }
1833
2017
  */
1834
- permission<U$1 extends object = User, P$1 extends TailorTypePermission<U$1, output<TailorDBType$1<Fields, User>>> = TailorTypePermission<U$1, output<TailorDBType$1<Fields, User>>>>(permission: P$1): TailorDBType$1<Fields, U$1>;
2018
+ types?: PluginGeneratedTypes;
2019
+ /** Additional resolvers to generate */
2020
+ resolvers?: PluginGeneratedResolver[];
2021
+ /** Additional executors to generate */
2022
+ executors?: PluginGeneratedExecutor[];
2023
+ }
2024
+ /**
2025
+ * Output returned by a plugin's onTypeLoaded hook.
2026
+ * Extends PluginOutput with the ability to add fields to the source type.
2027
+ */
2028
+ interface TypePluginOutput extends PluginOutput {
2029
+ /** Extensions to apply to the source type */
2030
+ extends?: PluginExtends;
2031
+ }
2032
+ /**
2033
+ * Output returned by a plugin's onNamespaceLoaded hook.
2034
+ * Alias for PluginOutput (namespace plugins cannot extend a source type).
2035
+ */
2036
+ type NamespacePluginOutput = PluginOutput;
2037
+ /**
2038
+ * Plugin interface that all plugins must implement.
2039
+ * Plugins can hook into two lifecycle phases:
2040
+ * - **Definition-time hooks** (`onTypeLoaded`, `onNamespaceLoaded`): Generate TailorDB types, resolvers, and executors
2041
+ * - **Generation-time hooks** (`onTailorDBReady`, `onResolverReady`, `onExecutorReady`): Process finalized artifacts and produce output files
2042
+ * @template TypeConfig - Type for per-type configuration passed via .plugin() method
2043
+ * @template PluginConfig - Type for plugin-level configuration passed via definePlugins()
2044
+ */
2045
+ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
2046
+ /** Unique identifier for the plugin */
2047
+ readonly id: string;
2048
+ /** Human-readable description of the plugin */
2049
+ readonly description: string;
1835
2050
  /**
1836
- * Set GraphQL-level permissions controlling access to GraphQL operations.
1837
- * @example
1838
- * .gqlPermission([
1839
- * {
1840
- * conditions: [[{ user: "_loggedIn" }, "=", true]],
1841
- * actions: "all",
1842
- * permit: true,
1843
- * },
1844
- * ])
2051
+ * Import path for this plugin's public API.
2052
+ * Used by code generators to create correct import statements
2053
+ * (e.g., plugin executors and seed schema generation).
2054
+ * Required when plugin has definition-time hooks (onTypeLoaded/onNamespaceLoaded).
2055
+ * Optional for generation-only plugins.
1845
2056
  */
1846
- gqlPermission<U$1 extends object = User, P$1 extends TailorTypeGqlPermission<U$1> = TailorTypeGqlPermission<U$1>>(permission: P$1): TailorDBType$1<Fields, U$1>;
2057
+ readonly importPath?: string;
1847
2058
  /**
1848
- * Set type description
2059
+ * Controls whether per-type plugin config is required when attaching via .plugin().
2060
+ * If a function is provided, it receives pluginConfig from definePlugins().
2061
+ * Default is optional when not provided.
1849
2062
  */
1850
- description(description: string): TailorDBType$1<Fields, User>;
2063
+ readonly typeConfigRequired?: TypeConfigRequired<PluginConfig>;
1851
2064
  /**
1852
- * Pick specific fields from the type
2065
+ * Plugin-level configuration passed via definePlugins().
2066
+ * This config is stored when the plugin is registered and made available
2067
+ * to all hook methods.
1853
2068
  */
1854
- 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"> & {
1855
- array: Opt extends {
1856
- array: true;
1857
- } ? true : D["array"];
1858
- }, FieldOutput$1<TailorToTs[D["type"]], Opt>> : never };
2069
+ readonly pluginConfig?: PluginConfig;
1859
2070
  /**
1860
- * Omit specific fields from the type
2071
+ * Process a single TailorDB type and generate outputs.
2072
+ * Called for each type that has this plugin attached via .plugin().
2073
+ * @param context - Context containing the type, config, pluginConfig, and namespace
2074
+ * @returns Plugin output with generated types, resolvers, and executors
1861
2075
  */
1862
- omitFields<K$1 extends keyof Fields>(keys: K$1[]): Omit<Fields, K$1>;
2076
+ onTypeLoaded?(context: PluginProcessContext<TypeConfig, PluginConfig>): TypePluginOutput | Promise<TypePluginOutput>;
1863
2077
  /**
1864
- * Plugin attachments for this type
1865
- */
1866
- readonly plugins: PluginAttachment[];
2078
+ * Process plugin for a namespace without requiring a source type.
2079
+ * Called once per namespace for plugins configured via definePlugins().
2080
+ * Use this for plugins that generate types independently of user-defined types.
2081
+ * @param context - Context containing the plugin config and namespace
2082
+ * @returns Plugin output with generated types, resolvers, and executors
2083
+ */
2084
+ onNamespaceLoaded?(context: PluginNamespaceProcessContext<PluginConfig>): NamespacePluginOutput | Promise<NamespacePluginOutput>;
1867
2085
  /**
1868
- * Attach a plugin to this type
1869
- * @param config - Plugin configuration in the format { pluginId: config }
1870
- * @returns The type with the plugin attached
2086
+ * Called after all TailorDB types are loaded and finalized.
2087
+ * Receives all TailorDB namespaces and their types.
2088
+ * @param context - Context containing all TailorDB data, auth, and output paths
2089
+ * @returns Generated files and optional errors
1871
2090
  */
1872
- plugin<P$1 extends keyof PluginConfigs<keyof Fields & string>>(config: { [K in P$1]: PluginConfigs<keyof Fields & string>[K$1] }): TailorDBType$1<Fields, User>;
2091
+ onTailorDBReady?(context: TailorDBReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
2092
+ /**
2093
+ * Called after all resolvers are loaded and finalized.
2094
+ * Receives all TailorDB data plus resolver data.
2095
+ * @param context - Context containing TailorDB data, resolvers, auth, and output paths
2096
+ * @returns Generated files and optional errors
2097
+ */
2098
+ onResolverReady?(context: ResolverReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
2099
+ /**
2100
+ * Called after all executors are loaded and finalized.
2101
+ * Receives all TailorDB data, resolver data, plus executor data.
2102
+ * @param context - Context containing all service data, auth, and output paths
2103
+ * @returns Generated files and optional errors
2104
+ */
2105
+ onExecutorReady?(context: ExecutorReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
1873
2106
  }
1874
- type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType$1<Fields, User>;
1875
- declare const idField: TailorDBField<{
2107
+ //#endregion
2108
+ //#region src/configure/services/tailordb/schema.d.ts
2109
+ interface RelationConfig<S extends RelationType, T extends TailorDBType$1> {
2110
+ type: S;
2111
+ toward: {
2112
+ type: T;
2113
+ as?: string;
2114
+ key?: keyof T["fields"] & string;
2115
+ };
2116
+ backward?: string;
2117
+ }
2118
+ type RelationSelfConfig = {
2119
+ type: RelationType;
2120
+ toward: {
2121
+ type: "self";
2122
+ as?: string;
2123
+ key?: string;
2124
+ };
2125
+ backward?: string;
2126
+ };
2127
+ type TailorAnyDBField = TailorDBField<any, any>;
2128
+ type TailorAnyDBType = TailorDBType$1<any, any>;
2129
+ /**
2130
+ * TailorDBField interface representing a database field with extended metadata.
2131
+ * Extends TailorField with database-specific features like relations, indexes, and hooks.
2132
+ */
2133
+ interface TailorDBField<Defined extends DefinedDBFieldMetadata, Output> extends Omit<TailorField<Defined, Output, DBFieldMetadata, Defined["type"]>, "description" | "validate"> {
2134
+ /** Returns a shallow copy of the raw relation config if set */
2135
+ readonly rawRelation: Readonly<RawRelationConfig> | undefined;
2136
+ /**
2137
+ * Set a description for the field
2138
+ * @param description - The description text
2139
+ * @returns The field with updated metadata
2140
+ */
2141
+ description<CurrentDefined extends Defined>(this: CurrentDefined extends {
2142
+ description: unknown;
2143
+ } ? never : TailorField<CurrentDefined, Output>, description: string): TailorDBField<Prettify<CurrentDefined & {
2144
+ description: true;
2145
+ }>, Output>;
2146
+ /**
2147
+ * Define a relation to another type.
2148
+ * Relation types: "n-1" (many-to-one), "1-1" (one-to-one), "keyOnly" (key only).
2149
+ * Aliases "manyToOne", "oneToOne", and "N-1" are also accepted.
2150
+ * @example db.uuid().relation({ type: "n-1", toward: { type: otherModel } })
2151
+ * @example db.uuid().relation({ type: "1-1", toward: { type: profile } })
2152
+ */
2153
+ relation<S extends RelationType, T extends TailorAnyDBType, CurrentDefined extends Defined>(this: CurrentDefined extends {
2154
+ relation: unknown;
2155
+ } ? never : TailorDBField<CurrentDefined, Output>, config: RelationConfig<S, T>): TailorDBField<S extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
2156
+ unique: true;
2157
+ index: true;
2158
+ relation: true;
2159
+ }> : Prettify<CurrentDefined & {
2160
+ index: true;
2161
+ relation: true;
2162
+ }>, Output>;
2163
+ /**
2164
+ * Define a self-referencing relation
2165
+ */
2166
+ relation<S extends RelationSelfConfig, CurrentDefined extends Defined>(this: CurrentDefined extends {
2167
+ relation: unknown;
2168
+ } ? never : TailorDBField<CurrentDefined, Output>, config: S): TailorDBField<S["type"] extends "oneToOne" | "1-1" ? Prettify<CurrentDefined & {
2169
+ unique: true;
2170
+ index: true;
2171
+ relation: true;
2172
+ }> : Prettify<CurrentDefined & {
2173
+ index: true;
2174
+ relation: true;
2175
+ }>, Output>;
2176
+ /**
2177
+ * Add an index to the field
2178
+ */
2179
+ index<CurrentDefined extends Defined>(this: CurrentDefined extends {
2180
+ index: unknown;
2181
+ } ? never : CurrentDefined extends {
2182
+ array: true;
2183
+ } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
2184
+ index: true;
2185
+ }>, Output>;
2186
+ /**
2187
+ * Make the field unique (also adds an index)
2188
+ */
2189
+ unique<CurrentDefined extends Defined>(this: CurrentDefined extends {
2190
+ unique: unknown;
2191
+ } ? never : CurrentDefined extends {
2192
+ array: true;
2193
+ } ? never : TailorDBField<CurrentDefined, Output>): TailorDBField<Prettify<CurrentDefined & {
2194
+ unique: true;
2195
+ index: true;
2196
+ }>, Output>;
2197
+ /**
2198
+ * Enable vector search on the field (string type only)
2199
+ */
2200
+ vector<CurrentDefined extends Defined>(this: CurrentDefined extends {
2201
+ vector: unknown;
2202
+ } ? never : CurrentDefined extends {
2203
+ type: "string";
2204
+ array: false;
2205
+ } ? TailorDBField<CurrentDefined, Output> : never): TailorDBField<Prettify<CurrentDefined & {
2206
+ vector: true;
2207
+ }>, Output>;
2208
+ /**
2209
+ * Add hooks for create/update operations on this field.
2210
+ * The hook function receives `{ value, data, user }` and returns the computed value.
2211
+ * @example db.string().hooks({ create: ({ data }) => data.firstName + " " + data.lastName })
2212
+ * @example db.datetime().hooks({ create: () => new Date(), update: () => new Date() })
2213
+ */
2214
+ hooks<CurrentDefined extends Defined, const H extends Hook<unknown, Output>>(this: CurrentDefined extends {
2215
+ hooks: unknown;
2216
+ } ? never : CurrentDefined extends {
2217
+ type: "nested";
2218
+ } ? never : TailorDBField<CurrentDefined, Output>, hooks: H): TailorDBField<Prettify<CurrentDefined & {
2219
+ hooks?: {
2220
+ create: H extends {
2221
+ create: unknown;
2222
+ } ? true : false;
2223
+ update: H extends {
2224
+ update: unknown;
2225
+ } ? true : false;
2226
+ };
2227
+ serial: false;
2228
+ }>, Output>;
2229
+ /**
2230
+ * Add validation functions to the field.
2231
+ * Accepts a function or a tuple of [function, errorMessage].
2232
+ * Prefer the tuple form for diagnosable errors.
2233
+ * @example
2234
+ * // Function form (default error message):
2235
+ * db.int().validate(({ value }) => value >= 0)
2236
+ * @example
2237
+ * // Tuple form with custom error message (recommended):
2238
+ * db.string().validate([({ value }) => value.length >= 8, "Must be at least 8 characters"])
2239
+ */
2240
+ validate<CurrentDefined extends Defined>(this: CurrentDefined extends {
2241
+ validate: unknown;
2242
+ } ? never : TailorDBField<CurrentDefined, Output>, ...validate: FieldValidateInput<Output>[]): TailorDBField<Prettify<CurrentDefined & {
2243
+ validate: true;
2244
+ }>, Output>;
2245
+ /**
2246
+ * Configure serial/auto-increment behavior
2247
+ */
2248
+ serial<CurrentDefined extends Defined>(this: CurrentDefined extends {
2249
+ serial: unknown;
2250
+ } ? never : Output extends null ? never : CurrentDefined extends {
2251
+ type: "integer" | "string";
2252
+ array: false;
2253
+ } ? TailorDBField<CurrentDefined, Output> : never, config: SerialConfig<CurrentDefined["type"] & ("integer" | "string")>): TailorDBField<Prettify<CurrentDefined & {
2254
+ serial: true;
2255
+ hooks: {
2256
+ create: false;
2257
+ update: false;
2258
+ };
2259
+ }>, Output>;
2260
+ /**
2261
+ * Clone the field with optional overrides for field options
2262
+ * @param options - Optional field options to override
2263
+ * @returns A new TailorDBField instance with the same configuration
2264
+ */
2265
+ clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<Prettify<Omit<Defined, "array"> & {
2266
+ array: NewOpt extends {
2267
+ array: true;
2268
+ } ? true : Defined["array"];
2269
+ }>, FieldOutput$1<TailorToTs[Defined["type"]], NewOpt>>;
2270
+ }
2271
+ /**
2272
+ * Create a UUID field.
2273
+ * @param options - Field configuration options
2274
+ * @returns A UUID field
2275
+ * @example db.uuid()
2276
+ * @example db.uuid({ optional: true })
2277
+ */
2278
+ declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
1876
2279
  type: "uuid";
1877
- array: false;
1878
- }, string>;
1879
- type idField = typeof idField;
1880
- type DBType<F extends {
1881
- id?: never;
1882
- } & Record<string, TailorAnyDBField>> = TailorDBInstance<{
1883
- id: idField;
1884
- } & F>;
2280
+ array: Opt extends {
2281
+ array: true;
2282
+ } ? true : false;
2283
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1885
2284
  /**
1886
- * Creates a new database type with the specified fields.
1887
- * An `id` field (UUID) is automatically added to every type.
1888
- * @param name - The name of the type, or a tuple of [name, pluralForm]
1889
- * @param fields - The field definitions for the type
1890
- * @returns A new TailorDBType instance
1891
- * @example
1892
- * export const user = db.type("User", {
1893
- * name: db.string(),
1894
- * email: db.string(),
1895
- * age: db.int({ optional: true }),
1896
- * role: db.enum(["admin", "member"]),
1897
- * ...db.fields.timestamps(),
1898
- * });
1899
- * // Always export both the value and type:
1900
- * export type user = typeof user;
2285
+ * Create a string field.
2286
+ * @param options - Field configuration options
2287
+ * @returns A string field
2288
+ * @example db.string()
2289
+ * @example db.string({ optional: true })
1901
2290
  */
1902
- declare function dbType<const F extends {
1903
- id?: never;
1904
- } & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
2291
+ declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2292
+ type: "string";
2293
+ array: Opt extends {
2294
+ array: true;
2295
+ } ? true : false;
2296
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
1905
2297
  /**
1906
- * Creates a new database type with the specified fields and description.
1907
- * An `id` field (UUID) is automatically added to every type.
1908
- * @param name - The name of the type, or a tuple of [name, pluralForm]
1909
- * @param description - A description of the type
1910
- * @param fields - The field definitions for the type
1911
- * @returns A new TailorDBType instance
2298
+ * Create a boolean field.
2299
+ * Note: The method name is `bool` but creates a `boolean` type field.
2300
+ * @param options - Field configuration options
2301
+ * @returns A boolean field
2302
+ * @example db.bool()
2303
+ * @example db.bool({ optional: true })
1912
2304
  */
1913
- declare function dbType<const F extends {
1914
- id?: never;
1915
- } & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
1916
- declare const db: {
1917
- type: typeof dbType;
1918
- uuid: typeof uuid;
1919
- string: typeof string;
1920
- bool: typeof bool;
1921
- int: typeof int;
1922
- float: typeof float;
1923
- date: typeof date;
1924
- datetime: typeof datetime;
1925
- time: typeof time;
1926
- enum: typeof _enum;
1927
- object: typeof object;
1928
- fields: {
1929
- /**
1930
- * Creates standard timestamp fields (createdAt, updatedAt) with auto-hooks.
1931
- * createdAt is set on create, updatedAt is set on update.
1932
- * @returns An object with createdAt and updatedAt fields
1933
- * @example
1934
- * const model = db.type("Model", {
1935
- * name: db.string(),
1936
- * ...db.fields.timestamps(),
1937
- * });
1938
- */
1939
- timestamps: () => {
1940
- createdAt: TailorDBField<{
1941
- type: "datetime";
1942
- array: false;
1943
- hooks?: {
1944
- create: true;
1945
- update: false;
1946
- } | undefined;
1947
- serial: false;
1948
- description: true;
1949
- }, string | Date>;
1950
- updatedAt: TailorDBField<{
1951
- type: "datetime";
1952
- array: false;
1953
- hooks?: {
1954
- create: false;
1955
- update: true;
1956
- } | undefined;
1957
- serial: false;
1958
- description: true;
1959
- }, string | Date | null>;
1960
- };
1961
- };
1962
- };
1963
- //#endregion
1964
- //#region src/parser/service/auth/schema.d.ts
1965
- declare const AuthInvokerSchema: z.ZodObject<{
1966
- namespace: z.ZodString;
1967
- machineUserName: z.ZodString;
1968
- }, z.core.$strip>;
1969
- declare const OIDCSchema: z.ZodObject<{
1970
- name: z.ZodString;
1971
- kind: z.ZodLiteral<"OIDC">;
1972
- clientID: z.ZodString;
1973
- clientSecret: z.ZodObject<{
1974
- vaultName: z.ZodString;
1975
- secretKey: z.ZodString;
1976
- }, z.core.$strip>;
1977
- providerURL: z.ZodString;
1978
- issuerURL: z.ZodOptional<z.ZodString>;
1979
- usernameClaim: z.ZodOptional<z.ZodString>;
1980
- }, z.core.$strip>;
1981
- declare const SAMLSchema: z.ZodObject<{
1982
- name: z.ZodString;
1983
- kind: z.ZodLiteral<"SAML">;
1984
- enableSignRequest: z.ZodDefault<z.ZodBoolean>;
1985
- metadataURL: z.ZodOptional<z.ZodString>;
1986
- rawMetadata: z.ZodOptional<z.ZodString>;
1987
- }, z.core.$strip>;
1988
- declare const IDTokenSchema: z.ZodObject<{
1989
- name: z.ZodString;
1990
- kind: z.ZodLiteral<"IDToken">;
1991
- providerURL: z.ZodString;
1992
- issuerURL: z.ZodOptional<z.ZodString>;
1993
- clientID: z.ZodString;
1994
- usernameClaim: z.ZodOptional<z.ZodString>;
1995
- }, z.core.$strip>;
1996
- declare const BuiltinIdPSchema: z.ZodObject<{
1997
- name: z.ZodString;
1998
- kind: z.ZodLiteral<"BuiltInIdP">;
1999
- namespace: z.ZodString;
2000
- clientName: z.ZodString;
2001
- }, z.core.$strip>;
2002
- declare const IdProviderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2003
- name: z.ZodString;
2004
- kind: z.ZodLiteral<"OIDC">;
2005
- clientID: z.ZodString;
2006
- clientSecret: z.ZodObject<{
2007
- vaultName: z.ZodString;
2008
- secretKey: z.ZodString;
2009
- }, z.core.$strip>;
2010
- providerURL: z.ZodString;
2011
- issuerURL: z.ZodOptional<z.ZodString>;
2012
- usernameClaim: z.ZodOptional<z.ZodString>;
2013
- }, z.core.$strip>, z.ZodObject<{
2014
- name: z.ZodString;
2015
- kind: z.ZodLiteral<"SAML">;
2016
- enableSignRequest: z.ZodDefault<z.ZodBoolean>;
2017
- metadataURL: z.ZodOptional<z.ZodString>;
2018
- rawMetadata: z.ZodOptional<z.ZodString>;
2019
- }, z.core.$strip>, z.ZodObject<{
2020
- name: z.ZodString;
2021
- kind: z.ZodLiteral<"IDToken">;
2022
- providerURL: z.ZodString;
2023
- issuerURL: z.ZodOptional<z.ZodString>;
2024
- clientID: z.ZodString;
2025
- usernameClaim: z.ZodOptional<z.ZodString>;
2026
- }, z.core.$strip>, z.ZodObject<{
2027
- name: z.ZodString;
2028
- kind: z.ZodLiteral<"BuiltInIdP">;
2029
- namespace: z.ZodString;
2030
- clientName: z.ZodString;
2031
- }, z.core.$strip>], "kind">;
2032
- declare const OAuth2ClientGrantTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>;
2033
- declare const OAuth2ClientSchema: z.ZodObject<{
2034
- description: z.ZodOptional<z.ZodString>;
2035
- grantTypes: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>>>;
2036
- redirectURIs: z.ZodArray<z.ZodUnion<readonly [z.ZodTemplateLiteral<`https://${string}`>, z.ZodTemplateLiteral<`http://${string}`>, z.ZodTemplateLiteral<`${string}:url`>, z.ZodTemplateLiteral<`${string}:url/${string}`>]>>;
2037
- clientType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"confidential">, z.ZodLiteral<"public">, z.ZodLiteral<"browser">]>>;
2038
- accessTokenLifetimeSeconds: z.ZodPipe<z.ZodOptional<z.ZodNumber>, z.ZodTransform<{
2039
- seconds: bigint;
2040
- nanos: number;
2041
- } | undefined, number | undefined>>;
2042
- refreshTokenLifetimeSeconds: z.ZodPipe<z.ZodOptional<z.ZodNumber>, z.ZodTransform<{
2043
- seconds: bigint;
2044
- nanos: number;
2045
- } | undefined, number | undefined>>;
2046
- requireDpop: z.ZodOptional<z.ZodBoolean>;
2047
- }, z.core.$strip>;
2048
- declare const SCIMAuthorizationSchema: z.ZodObject<{
2049
- type: z.ZodUnion<readonly [z.ZodLiteral<"oauth2">, z.ZodLiteral<"bearer">]>;
2050
- bearerSecret: z.ZodOptional<z.ZodObject<{
2051
- vaultName: z.ZodString;
2052
- secretKey: z.ZodString;
2053
- }, z.core.$strip>>;
2054
- }, z.core.$strip>;
2055
- declare const SCIMAttributeTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
2056
- declare const SCIMAttributeSchema: z.ZodObject<{
2057
- type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
2058
- name: z.ZodString;
2059
- description: z.ZodOptional<z.ZodString>;
2060
- mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
2061
- required: z.ZodOptional<z.ZodBoolean>;
2062
- multiValued: z.ZodOptional<z.ZodBoolean>;
2063
- uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
2064
- canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2065
- subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
2066
- }, z.core.$strip>;
2067
- declare const SCIMAttributeMappingSchema: z.ZodObject<{
2068
- tailorDBField: z.ZodString;
2069
- scimPath: z.ZodString;
2070
- }, z.core.$strip>;
2071
- declare const SCIMResourceSchema: z.ZodObject<{
2072
- name: z.ZodString;
2073
- tailorDBNamespace: z.ZodString;
2074
- tailorDBType: z.ZodString;
2075
- coreSchema: z.ZodObject<{
2076
- name: z.ZodString;
2077
- attributes: z.ZodArray<z.ZodObject<{
2078
- type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
2079
- name: z.ZodString;
2080
- description: z.ZodOptional<z.ZodString>;
2081
- mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
2082
- required: z.ZodOptional<z.ZodBoolean>;
2083
- multiValued: z.ZodOptional<z.ZodBoolean>;
2084
- uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
2085
- canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2086
- subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
2087
- }, z.core.$strip>>;
2088
- }, z.core.$strip>;
2089
- attributeMapping: z.ZodArray<z.ZodObject<{
2090
- tailorDBField: z.ZodString;
2091
- scimPath: z.ZodString;
2092
- }, z.core.$strip>>;
2093
- }, z.core.$strip>;
2094
- declare const SCIMSchema: z.ZodObject<{
2095
- machineUserName: z.ZodString;
2096
- authorization: z.ZodObject<{
2097
- type: z.ZodUnion<readonly [z.ZodLiteral<"oauth2">, z.ZodLiteral<"bearer">]>;
2098
- bearerSecret: z.ZodOptional<z.ZodObject<{
2099
- vaultName: z.ZodString;
2100
- secretKey: z.ZodString;
2101
- }, z.core.$strip>>;
2102
- }, z.core.$strip>;
2103
- resources: z.ZodArray<z.ZodObject<{
2104
- name: z.ZodString;
2105
- tailorDBNamespace: z.ZodString;
2106
- tailorDBType: z.ZodString;
2107
- coreSchema: z.ZodObject<{
2108
- name: z.ZodString;
2109
- attributes: z.ZodArray<z.ZodObject<{
2110
- type: z.ZodUnion<readonly [z.ZodLiteral<"string">, z.ZodLiteral<"number">, z.ZodLiteral<"boolean">, z.ZodLiteral<"datetime">, z.ZodLiteral<"complex">]>;
2111
- name: z.ZodString;
2112
- description: z.ZodOptional<z.ZodString>;
2113
- mutability: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"readOnly">, z.ZodLiteral<"readWrite">, z.ZodLiteral<"writeOnly">]>>;
2114
- required: z.ZodOptional<z.ZodBoolean>;
2115
- multiValued: z.ZodOptional<z.ZodBoolean>;
2116
- uniqueness: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"none">, z.ZodLiteral<"server">, z.ZodLiteral<"global">]>>;
2117
- canonicalValues: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
2118
- subAttributes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject< /*elided*/any, z.core.$strip>>>>;
2119
- }, z.core.$strip>>;
2120
- }, z.core.$strip>;
2121
- attributeMapping: z.ZodArray<z.ZodObject<{
2122
- tailorDBField: z.ZodString;
2123
- scimPath: z.ZodString;
2124
- }, z.core.$strip>>;
2125
- }, z.core.$strip>>;
2126
- }, z.core.$strip>;
2127
- declare const TenantProviderSchema: z.ZodObject<{
2128
- namespace: z.ZodString;
2129
- type: z.ZodString;
2130
- signatureField: z.ZodString;
2131
- }, z.core.$strip>;
2132
- //#endregion
2133
- //#region src/parser/service/auth/types.d.ts
2134
- type AuthInvoker = z.output<typeof AuthInvokerSchema>;
2135
- type AuthInvokerWithName<M extends string> = Omit<AuthInvoker, "machineUserName"> & {
2136
- machineUserName: M;
2137
- };
2138
- type OIDC = z.output<typeof OIDCSchema>;
2139
- type SAML = z.output<typeof SAMLSchema>;
2140
- type IDToken = z.output<typeof IDTokenSchema>;
2141
- type BuiltinIdP = z.output<typeof BuiltinIdPSchema>;
2142
- type IdProviderConfig = z.output<typeof IdProviderSchema>;
2143
- type OAuth2ClientGrantType = z.output<typeof OAuth2ClientGrantTypeSchema>;
2144
- type OAuth2ClientInput = z.input<typeof OAuth2ClientSchema>;
2145
- type SCIMAuthorization = z.output<typeof SCIMAuthorizationSchema>;
2146
- type SCIMAttributeType = z.output<typeof SCIMAttributeTypeSchema>;
2147
- type SCIMAttribute = z.output<typeof SCIMAttributeSchema>;
2148
- type SCIMAttributeMapping = z.output<typeof SCIMAttributeMappingSchema>;
2149
- type SCIMResource = z.output<typeof SCIMResourceSchema>;
2150
- type SCIMConfig = z.output<typeof SCIMSchema>;
2151
- type TenantProviderConfig = z.output<typeof TenantProviderSchema>;
2152
- type ValueOperand = string | boolean | string[] | boolean[];
2153
- type AuthAttributeValue = ValueOperand | null | undefined;
2154
- type UserFieldKeys<User extends TailorDBInstance> = keyof output<User> & string;
2155
- type FieldDefined<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = User["fields"][Key] extends {
2156
- _defined: infer Defined;
2157
- } ? Defined : never;
2158
- type FieldOutput<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = output<User>[Key];
2159
- type FieldIsRequired<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = undefined extends FieldOutput<User, Key> ? false : true;
2160
- type FieldIsOfType<User extends TailorDBInstance, Key extends UserFieldKeys<User>, Type extends string> = FieldDefined<User, Key> extends {
2161
- type: Type;
2162
- } ? true : false;
2163
- type FieldIsArray<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
2164
- array: true;
2165
- } ? true : false;
2166
- type FieldIsUnique<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldDefined<User, Key> extends {
2167
- unique: true;
2168
- } ? true : false;
2169
- type FieldSupportsValueOperand<User extends TailorDBInstance, Key extends UserFieldKeys<User>> = FieldOutput<User, Key> extends ValueOperand | null | undefined ? true : false;
2170
- type UsernameFieldKey<User extends TailorDBInstance> = IsAny<User> extends true ? string : { [K in UserFieldKeys<User>]: FieldIsRequired<User, K> extends true ? FieldIsOfType<User, K, "string"> extends true ? FieldIsArray<User, K> extends true ? never : FieldIsUnique<User, K> extends true ? K : never : never : never }[UserFieldKeys<User>];
2171
- 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>];
2172
- 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>];
2173
- type UserAttributeMap<User extends TailorDBInstance> = { [K in UserAttributeKey<User>]?: true };
2174
- type DisallowExtraKeys<T, Allowed extends PropertyKey> = T & { [K in Exclude<keyof T, Allowed>]: never };
2175
- type AttributeListValue<User extends TailorDBInstance, Key extends UserAttributeListKey<User>> = Key extends keyof output<User> ? output<User>[Key] : never;
2176
- 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 };
2177
- 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>>;
2178
- type UserProfile<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[]> = {
2305
+ declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2306
+ type: "boolean";
2307
+ array: Opt extends {
2308
+ array: true;
2309
+ } ? true : false;
2310
+ }, Opt["optional"] extends true ? ArrayFieldOutput<boolean, Opt> | null : ArrayFieldOutput<boolean, Opt>>;
2311
+ /**
2312
+ * Create an integer field.
2313
+ * @param options - Field configuration options
2314
+ * @returns An integer field
2315
+ * @example db.int()
2316
+ * @example db.int({ optional: true })
2317
+ */
2318
+ declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2319
+ type: "integer";
2320
+ array: Opt extends {
2321
+ array: true;
2322
+ } ? true : false;
2323
+ }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
2324
+ /**
2325
+ * Create a float (decimal number) field.
2326
+ * @param options - Field configuration options
2327
+ * @returns A float field
2328
+ * @example db.float()
2329
+ * @example db.float({ optional: true })
2330
+ */
2331
+ declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2332
+ type: "float";
2333
+ array: Opt extends {
2334
+ array: true;
2335
+ } ? true : false;
2336
+ }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
2337
+ interface DecimalFieldOptions extends FieldOptions {
2338
+ scale?: number;
2339
+ }
2340
+ /**
2341
+ * Create a decimal field (stored as string for precision).
2342
+ * @param options - Field configuration options including optional scale (0-12)
2343
+ * @returns A decimal field
2344
+ * @example db.decimal()
2345
+ * @example db.decimal({ scale: 2 })
2346
+ * @example db.decimal({ scale: 2, optional: true })
2347
+ */
2348
+ declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBField<{
2349
+ type: "decimal";
2350
+ array: Opt extends {
2351
+ array: true;
2352
+ } ? true : false;
2353
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
2354
+ /**
2355
+ * Create a date field (date only, no time component).
2356
+ * Format: "yyyy-MM-dd"
2357
+ * @param options - Field configuration options
2358
+ * @returns A date field
2359
+ * @example db.date()
2360
+ */
2361
+ declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2362
+ type: "date";
2363
+ array: Opt extends {
2364
+ array: true;
2365
+ } ? true : false;
2366
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
2367
+ /**
2368
+ * Create a datetime field (date and time).
2369
+ * Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
2370
+ * @param options - Field configuration options
2371
+ * @returns A datetime field
2372
+ * @example db.datetime()
2373
+ */
2374
+ declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2375
+ type: "datetime";
2376
+ array: Opt extends {
2377
+ array: true;
2378
+ } ? true : false;
2379
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string | Date, Opt> | null : ArrayFieldOutput<string | Date, Opt>>;
2380
+ /**
2381
+ * Create a time field (time only, no date component).
2382
+ * Format: "HH:mm"
2383
+ * @param options - Field configuration options
2384
+ * @returns A time field
2385
+ * @example db.time()
2386
+ */
2387
+ declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBField<{
2388
+ type: "time";
2389
+ array: Opt extends {
2390
+ array: true;
2391
+ } ? true : false;
2392
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
2393
+ /**
2394
+ * Create an enum field with a fixed set of allowed string values.
2395
+ * @param values - Array of allowed string values, or array of `{ value, description }` objects
2396
+ * @param options - Field configuration options
2397
+ * @returns An enum field
2398
+ * @example db.enum(["active", "inactive", "suspended"])
2399
+ * @example db.enum(["small", "medium", "large"], { optional: true })
2400
+ */
2401
+ declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
2402
+ type: "enum";
2403
+ array: Opt extends {
2404
+ array: true;
2405
+ } ? true : false;
2406
+ }, FieldOutput$1<AllowedValuesOutput<V>, Opt>>;
2407
+ /**
2408
+ * Create a nested object field with sub-fields.
2409
+ * @param fields - Record of nested field definitions
2410
+ * @param options - Field configuration options
2411
+ * @returns A nested object field
2412
+ * @example db.object({ street: db.string(), city: db.string(), zip: db.string() })
2413
+ * @example db.object({ name: db.string() }, { optional: true })
2414
+ */
2415
+ declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
2416
+ type: "nested";
2417
+ array: Opt extends {
2418
+ array: true;
2419
+ } ? true : false;
2420
+ }, FieldOutput$1<InferFieldsOutput<F>, Opt>>;
2421
+ /**
2422
+ * TailorDBType interface representing a database type definition with fields, permissions, and settings.
2423
+ */
2424
+ interface TailorDBType$1<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> {
2425
+ readonly name: string;
2426
+ readonly fields: Fields;
2427
+ readonly _output: InferFieldsOutput<Fields>;
2428
+ _description?: string;
2429
+ /** Returns metadata for the type */
2430
+ readonly metadata: TailorDBTypeMetadata;
2179
2431
  /**
2180
- * TailorDB namespace where the user type is defined.
2181
- *
2182
- * Usually auto-resolved, so you don't need to specify this.
2183
- * Required only when multiple TailorDBs exist and the type is in an external TailorDB.
2432
+ * Add hooks for fields at the type level.
2433
+ * Each key is a field name, and the value defines create/update hooks.
2434
+ * @example
2435
+ * db.type("Order", {
2436
+ * total: db.float(),
2437
+ * tax: db.float(),
2438
+ * ...db.fields.timestamps(),
2439
+ * }).hooks({
2440
+ * tax: { create: ({ data }) => data.total * 0.1, update: ({ data }) => data.total * 0.1 },
2441
+ * })
2184
2442
  */
2185
- namespace?: string;
2186
- type: User;
2187
- usernameField: UsernameFieldKey<User>;
2188
- attributes?: DisallowExtraKeys<AttributeMap$1, UserAttributeKey<User>>;
2189
- attributeList?: AttributeList$1;
2190
- };
2191
- type MachineUserAttributeFields = Record<string, TailorField<DefinedFieldMetadata, unknown, FieldMetadata, TailorFieldType>>;
2192
- type TailorFieldOutputValue<Field> = Field extends TailorField<DefinedFieldMetadata, infer Output, FieldMetadata, TailorFieldType> ? Output : never;
2193
- type MachineUserAttributeValues<Fields extends MachineUserAttributeFields> = { [K in keyof Fields]: TailorFieldOutputValue<Fields[K]> extends ValueOperand | null | undefined ? TailorFieldOutputValue<Fields[K]> : never };
2194
- type MachineUserFromAttributes<Fields extends MachineUserAttributeFields> = (keyof Fields extends never ? {
2195
- attributes?: never;
2196
- } : {
2197
- attributes: DisallowExtraKeys<MachineUserAttributeValues<Fields>, keyof Fields>;
2198
- }) & {
2199
- attributeList?: string[];
2200
- };
2201
- type MachineUser<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User> = UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[] = [], MachineUserAttributes extends MachineUserAttributeFields | undefined = undefined> = IsAny<MachineUserAttributes> extends true ? IsAny<User> extends true ? {
2202
- attributes: Record<string, AuthAttributeValue>;
2203
- attributeList?: string[];
2204
- } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
2205
- attributes?: never;
2206
- } : {
2207
- 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 };
2208
- }) & ([] extends AttributeList$1 ? {
2209
- attributeList?: never;
2210
- } : {
2211
- attributeList: AttributeListToTuple<User, AttributeList$1>;
2212
- }) : [MachineUserAttributes] extends [MachineUserAttributeFields] ? MachineUserFromAttributes<MachineUserAttributes> : IsAny<User> extends true ? {
2213
- attributes: Record<string, AuthAttributeValue>;
2214
- attributeList?: string[];
2215
- } : (AttributeMapSelectedKeys<User, AttributeMap$1> extends never ? {
2216
- attributes?: never;
2217
- } : {
2218
- 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 };
2219
- }) & ([] extends AttributeList$1 ? {
2220
- attributeList?: never;
2221
- } : {
2222
- attributeList: AttributeListToTuple<User, AttributeList$1>;
2223
- });
2224
- type AuthServiceInput<User extends TailorDBInstance, AttributeMap$1 extends UserAttributeMap<User>, AttributeList$1 extends UserAttributeListKey<User>[], MachineUserNames extends string, MachineUserAttributes extends MachineUserAttributeFields | undefined = MachineUserAttributeFields | undefined> = {
2225
- userProfile?: UserProfile<User, AttributeMap$1, AttributeList$1>;
2226
- machineUserAttributes?: MachineUserAttributes;
2227
- machineUsers?: Record<MachineUserNames, MachineUser<User, AttributeMap$1, AttributeList$1, MachineUserAttributes>>;
2228
- oauth2Clients?: Record<string, OAuth2ClientInput>;
2229
- idProvider?: IdProviderConfig;
2230
- scim?: SCIMConfig;
2231
- tenantProvider?: TenantProviderConfig;
2232
- publishSessionEvents?: boolean;
2233
- };
2234
- declare const authDefinitionBrand: unique symbol;
2235
- type AuthDefinitionBrand = {
2236
- readonly [authDefinitionBrand]: true;
2237
- };
2238
- type DefinedAuth<Name extends string, Config, MachineUserNames extends string> = Config & {
2239
- name: Name;
2240
- invoker<M extends MachineUserNames>(machineUser: M): AuthInvokerWithName<M>;
2241
- } & AuthDefinitionBrand;
2242
- type AuthExternalConfig = {
2243
- name: string;
2244
- external: true;
2443
+ hooks(hooks: Hooks<Fields>): TailorDBType$1<Fields, User>;
2444
+ /**
2445
+ * Add validators for fields at the type level.
2446
+ * Each key is a field name, and the value is a validator or array of validators.
2447
+ * Prefer the tuple form [function, message] for diagnosable errors.
2448
+ * @example
2449
+ * db.type("User", { email: db.string() }).validate({
2450
+ * email: [({ value }) => value.includes("@"), "Email must contain @"],
2451
+ * })
2452
+ */
2453
+ validate(validators: Validators<Fields>): TailorDBType$1<Fields, User>;
2454
+ /**
2455
+ * Configure type features
2456
+ */
2457
+ features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType$1<Fields, User>;
2458
+ /**
2459
+ * Define composite indexes
2460
+ */
2461
+ indexes(...indexes: IndexDef<TailorDBType$1<Fields, User>>[]): TailorDBType$1<Fields, User>;
2462
+ /**
2463
+ * Define file fields
2464
+ */
2465
+ files<const F extends string>(files: Record<F, string> & Partial<Record<keyof output<TailorDBType$1<Fields, User>>, never>>): TailorDBType$1<Fields, User>;
2466
+ /**
2467
+ * Set record-level permissions for create, read, update, and delete operations.
2468
+ * Prefer object format with explicit `conditions` and `permit` for readability.
2469
+ * For update operations, use `newRecord` and `oldRecord` operands.
2470
+ * @example
2471
+ * .permission({
2472
+ * create: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
2473
+ * read: [{ conditions: [[{ record: "isPublic" }, "=", true]], permit: true }],
2474
+ * update: [{ conditions: [[{ newRecord: "ownerId" }, "=", { user: "id" }]], permit: true }],
2475
+ * delete: [{ conditions: [[{ record: "ownerId" }, "=", { user: "id" }]], permit: true }],
2476
+ * })
2477
+ */
2478
+ permission<U$1 extends object = User, P$1 extends TailorTypePermission<U$1, output<TailorDBType$1<Fields, User>>> = TailorTypePermission<U$1, output<TailorDBType$1<Fields, User>>>>(permission: P$1): TailorDBType$1<Fields, U$1>;
2479
+ /**
2480
+ * Set GraphQL-level permissions controlling access to GraphQL operations.
2481
+ * @example
2482
+ * .gqlPermission([
2483
+ * {
2484
+ * conditions: [[{ user: "_loggedIn" }, "=", true]],
2485
+ * actions: "all",
2486
+ * permit: true,
2487
+ * },
2488
+ * ])
2489
+ */
2490
+ gqlPermission<U$1 extends object = User, P$1 extends TailorTypeGqlPermission<U$1> = TailorTypeGqlPermission<U$1>>(permission: P$1): TailorDBType$1<Fields, U$1>;
2491
+ /**
2492
+ * Set type description
2493
+ */
2494
+ description(description: string): TailorDBType$1<Fields, User>;
2495
+ /**
2496
+ * Pick specific fields from the type
2497
+ */
2498
+ 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"> & {
2499
+ array: Opt extends {
2500
+ array: true;
2501
+ } ? true : D["array"];
2502
+ }, FieldOutput$1<TailorToTs[D["type"]], Opt>> : never };
2503
+ /**
2504
+ * Omit specific fields from the type
2505
+ */
2506
+ omitFields<K$1 extends keyof Fields>(keys: K$1[]): Omit<Fields, K$1>;
2507
+ /**
2508
+ * Plugin attachments for this type
2509
+ */
2510
+ readonly plugins: PluginAttachment[];
2511
+ /**
2512
+ * Attach a plugin to this type
2513
+ * @param config - Plugin configuration in the format { pluginId: config }
2514
+ * @returns The type with the plugin attached
2515
+ */
2516
+ plugin<P$1 extends keyof PluginConfigs<keyof Fields & string>>(config: { [K in P$1]: PluginConfigs<keyof Fields & string>[K$1] }): TailorDBType$1<Fields, User>;
2517
+ }
2518
+ type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType$1<Fields, User>;
2519
+ declare const idField: TailorDBField<{
2520
+ type: "uuid";
2521
+ array: false;
2522
+ }, string>;
2523
+ type idField = typeof idField;
2524
+ type DBType<F extends {
2525
+ id?: never;
2526
+ } & Record<string, TailorAnyDBField>> = TailorDBInstance<{
2527
+ id: idField;
2528
+ } & F>;
2529
+ /**
2530
+ * Creates a new database type with the specified fields.
2531
+ * An `id` field (UUID) is automatically added to every type.
2532
+ * @param name - The name of the type, or a tuple of [name, pluralForm]
2533
+ * @param fields - The field definitions for the type
2534
+ * @returns A new TailorDBType instance
2535
+ * @example
2536
+ * export const user = db.type("User", {
2537
+ * name: db.string(),
2538
+ * email: db.string(),
2539
+ * age: db.int({ optional: true }),
2540
+ * role: db.enum(["admin", "member"]),
2541
+ * ...db.fields.timestamps(),
2542
+ * });
2543
+ * // Always export both the value and type:
2544
+ * export type user = typeof user;
2545
+ */
2546
+ declare function dbType<const F extends {
2547
+ id?: never;
2548
+ } & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
2549
+ /**
2550
+ * Creates a new database type with the specified fields and description.
2551
+ * An `id` field (UUID) is automatically added to every type.
2552
+ * @param name - The name of the type, or a tuple of [name, pluralForm]
2553
+ * @param description - A description of the type
2554
+ * @param fields - The field definitions for the type
2555
+ * @returns A new TailorDBType instance
2556
+ */
2557
+ declare function dbType<const F extends {
2558
+ id?: never;
2559
+ } & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
2560
+ declare const db: {
2561
+ type: typeof dbType;
2562
+ uuid: typeof uuid;
2563
+ string: typeof string;
2564
+ bool: typeof bool;
2565
+ int: typeof int;
2566
+ float: typeof float;
2567
+ decimal: typeof decimal;
2568
+ date: typeof date;
2569
+ datetime: typeof datetime;
2570
+ time: typeof time;
2571
+ enum: typeof _enum;
2572
+ object: typeof object;
2573
+ fields: {
2574
+ /**
2575
+ * Creates standard timestamp fields (createdAt, updatedAt) with auto-hooks.
2576
+ * createdAt is set on create, updatedAt is set on update.
2577
+ * @returns An object with createdAt and updatedAt fields
2578
+ * @example
2579
+ * const model = db.type("Model", {
2580
+ * name: db.string(),
2581
+ * ...db.fields.timestamps(),
2582
+ * });
2583
+ */
2584
+ timestamps: () => {
2585
+ createdAt: TailorDBField<{
2586
+ type: "datetime";
2587
+ array: false;
2588
+ hooks?: {
2589
+ create: true;
2590
+ update: false;
2591
+ } | undefined;
2592
+ serial: false;
2593
+ description: true;
2594
+ }, string | Date>;
2595
+ updatedAt: TailorDBField<{
2596
+ type: "datetime";
2597
+ array: false;
2598
+ hooks?: {
2599
+ create: false;
2600
+ update: true;
2601
+ } | undefined;
2602
+ serial: false;
2603
+ description: true;
2604
+ }, string | Date | null>;
2605
+ };
2606
+ };
2245
2607
  };
2246
- type AuthServiceInputLoose = AuthServiceInput<any, any, any, string, any>;
2247
- type AuthOwnConfig = DefinedAuth<string, AuthServiceInputLoose, string>;
2248
- type AuthConfig = AuthOwnConfig | AuthExternalConfig;
2249
2608
  //#endregion
2250
2609
  //#region src/parser/service/tailordb/types.d.ts
2251
2610
  /**
@@ -2343,6 +2702,7 @@ interface OperatorFieldConfig {
2343
2702
  maxValue?: number;
2344
2703
  format?: string;
2345
2704
  };
2705
+ scale?: number;
2346
2706
  fields?: Record<string, OperatorFieldConfig>;
2347
2707
  }
2348
2708
  type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
@@ -2438,5 +2798,5 @@ interface TailorDBType {
2438
2798
  files?: TailorDBTypeMetadata["files"];
2439
2799
  }
2440
2800
  //#endregion
2441
- export { unsafeAllowAllTypePermission as $, TailorDBField as A, PluginGeneratedExecutor as B, UserAttributeKey as C, unauthenticatedTailorUser as Ct, ValueOperand as D, UsernameFieldKey as E, TailorDBServiceInput as Et, Plugin as F, PluginOutput as G, PluginGeneratedResolver as H, PluginAttachment as I, TypePluginOutput as J, PluginProcessContext as K, PluginConfigs as L, TailorDBType$1 as M, db as N, TailorAnyDBField as O, NamespacePluginOutput as P, unsafeAllowAllGqlPermission as Q, PluginExecutorContext as R, TenantProviderConfig as S, TailorUser as St, UserAttributeMap as T, AllowedValuesOutput as Tt, PluginGeneratedType as U, PluginGeneratedExecutorWithFile as V, PluginNamespaceProcessContext as W, TailorTypeGqlPermission as X, PermissionCondition as Y, TailorTypePermission as Z, SCIMAttributeMapping as _, Env as _t, AuthInvoker as a, TailorFieldType as at, SCIMConfig as b, AttributeList as bt, BuiltinIdP as c, QueryType as ct, IdProviderConfig as d, ResolverInput as dt, ArrayFieldOutput as et, OAuth2ClientGrantType as f, ResolverServiceConfig as ft, SCIMAttribute as g, output as gt, SAML as h, JsonCompatible as ht, AuthExternalConfig as i, FieldOutput$1 as it, TailorDBInstance as j, TailorAnyDBType as k, DefinedAuth as l, Resolver as lt, OIDC as m, InferFieldsOutput as mt, TypeSourceInfoEntry as n, FieldMetadata as nt, AuthOwnConfig as o, TailorAnyField as ot, OAuth2ClientInput as p, ResolverServiceInput as pt, TailorDBTypeForPlugin as q, AuthConfig as r, FieldOptions as rt, AuthServiceInput as s, TailorField as st, TailorDBType as t, DefinedFieldMetadata as tt, IDToken as u, ResolverExternalConfig as ut, SCIMAttributeType as v, TailorEnv as vt, UserAttributeListKey as w, AllowedValues as wt, SCIMResource as x, AttributeMap as xt, SCIMAuthorization as y, TailorActor as yt, PluginExecutorContextBase as z };
2442
- //# sourceMappingURL=types-CZZBCaxB.d.mts.map
2801
+ export { OAuth2ClientGrantType as $, AuthAccessTokenTrigger as A, Resolver as At, ResolverExecutedTrigger as B, TailorActor as Bt, TypePluginOutput as C, FieldMetadata as Ct, ResolverReadyContext as D, TailorAnyField as Dt, ResolverNamespaceData as E, TailorFieldType as Et, FunctionOperation as F, InferFieldsOutput as Ft, AuthExternalConfig as G, AllowedValues as Gt, WebhookOperation as H, AttributeMap as Ht, GqlOperation as I, JsonCompatible as It, AuthServiceInput as J, AuthInvoker as K, AllowedValuesOutput as Kt, IdpUserTrigger as L, output as Lt, ExecutorInput as M, ResolverInput as Mt, ExecutorServiceConfig as N, ResolverServiceConfig as Nt, TailorDBNamespaceData as O, TailorField as Ot, ExecutorServiceInput as P, ResolverServiceInput as Pt, IdProviderConfig as Q, IncomingWebhookTrigger as R, Env as Rt, TailorDBTypeForPlugin as S, DefinedFieldMetadata as St, GeneratorResult as T, FieldOutput$1 as Tt, WorkflowOperation as U, TailorUser as Ut, ScheduleTriggerInput as V, AttributeList as Vt, AuthConfig as W, unauthenticatedTailorUser as Wt, DefinedAuth as X, BuiltinIdP as Y, IDToken as Z, PluginGeneratedResolver as _, TailorTypeGqlPermission as _t, TailorDBField as a, SCIMAttributeType as at, PluginOutput as b, unsafeAllowAllTypePermission as bt, db as c, SCIMResource as ct, PluginAttachment as d, UserAttributeListKey as dt, OAuth2ClientInput as et, PluginConfigs as f, UserAttributeMap as ft, PluginGeneratedExecutorWithFile as g, PermissionCondition as gt, PluginGeneratedExecutor as h, GeneratorConfig as ht, TailorAnyDBType as i, SCIMAttributeMapping as it, Executor as j, ResolverExternalConfig as jt, TailorDBReadyContext as k, QueryType as kt, NamespacePluginOutput as l, TenantProviderConfig as lt, PluginExecutorContextBase as m, ValueOperand as mt, TypeSourceInfoEntry as n, SAML as nt, TailorDBInstance as o, SCIMAuthorization as ot, PluginExecutorContext as p, UsernameFieldKey as pt, AuthOwnConfig as q, TailorDBServiceInput as qt, TailorAnyDBField as r, SCIMAttribute as rt, TailorDBType$1 as s, SCIMConfig as st, TailorDBType as t, OIDC as tt, Plugin as u, UserAttributeKey as ut, PluginGeneratedType as v, TailorTypePermission as vt, ExecutorReadyContext as w, FieldOptions as wt, PluginProcessContext as x, ArrayFieldOutput as xt, PluginNamespaceProcessContext as y, unsafeAllowAllGqlPermission as yt, RecordTrigger as z, TailorEnv as zt };
2802
+ //# sourceMappingURL=types-CblXasFV.d.mts.map