@tailor-platform/sdk 2.13.0 → 2.14.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 (44) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/{application-D3HlhR3i.mjs → application-CiN_er9X.mjs} +15 -11
  3. package/dist/application-CiN_er9X.mjs.map +1 -0
  4. package/dist/application-_8rjQRx8.mjs +1 -0
  5. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +1 -0
  6. package/dist/cli/lib.mjs +1 -1
  7. package/dist/cli/lib.mjs.map +1 -1
  8. package/dist/cli/main.mjs +43 -41
  9. package/dist/cli/main.mjs.map +1 -1
  10. package/dist/completion/zsh-worker.zsh +1 -1
  11. package/dist/configure/index.d.mts +4 -4
  12. package/dist/configure/index.mjs +1 -1
  13. package/dist/configure/index.mjs.map +1 -1
  14. package/dist/configure/services/tailordb/schema.d.mts +1 -1
  15. package/dist/configure/types/field.types.d.mts +8 -1
  16. package/dist/date-DrUO8rOJ.mjs +2 -0
  17. package/dist/date-DrUO8rOJ.mjs.map +1 -0
  18. package/dist/plugin/builtin/seed/index.mjs +1 -1
  19. package/dist/{register-ts-hook-CoZS-8Mx.mjs → register-ts-hook-DS1zYiCV.mjs} +35 -35
  20. package/dist/register-ts-hook-DS1zYiCV.mjs.map +1 -0
  21. package/dist/runtime/date.d.mts +17 -0
  22. package/dist/runtime/index.d.mts +2 -1
  23. package/dist/runtime/index.mjs +1 -1
  24. package/dist/schema-DMlLMsWA.mjs +2 -0
  25. package/dist/schema-DMlLMsWA.mjs.map +1 -0
  26. package/dist/{seed-CMkupmX8.mjs → seed-CCc9Xk66.mjs} +2 -2
  27. package/dist/seed-CCc9Xk66.mjs.map +1 -0
  28. package/dist/service-7SCy2bhm.mjs +7 -0
  29. package/dist/service-7SCy2bhm.mjs.map +1 -0
  30. package/dist/service-CWFQ8EVo.mjs +1 -0
  31. package/dist/types/resolver.generated.d.mts +2 -0
  32. package/docs/services/resolver.md +21 -0
  33. package/docs/services/tailordb-migration.md +25 -3
  34. package/docs/services/tailordb.md +2 -0
  35. package/package.json +6 -6
  36. package/dist/application-BFTkaW6X.mjs +0 -1
  37. package/dist/application-D3HlhR3i.mjs.map +0 -1
  38. package/dist/register-ts-hook-CoZS-8Mx.mjs.map +0 -1
  39. package/dist/schema-6d_OHyZf.mjs +0 -2
  40. package/dist/schema-6d_OHyZf.mjs.map +0 -1
  41. package/dist/seed-CMkupmX8.mjs.map +0 -1
  42. package/dist/service-BzsSm2f6.mjs +0 -7
  43. package/dist/service-BzsSm2f6.mjs.map +0 -1
  44. package/dist/service-CmwD9bwv.mjs +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-7SCy2bhm.mjs","names":["TailorFieldTypeSchema","AllowedValueSchema"],"sources":["../src/parser/service/common.ts","../src/cli/shared/user-modules.ts","../src/cli/services/file-loader.ts","../src/parser/service/tailordb/relation.ts","../src/parser/service/tailordb/schema.ts","../src/parser/service/tailordb/builder-helpers.ts","../src/parser/service/auth-connection/schema.ts","../src/parser/service/field/schema.ts","../src/parser/service/auth/schema.ts","../src/parser/service/executor/schema.ts","../src/cli/services/executor/loader.ts","../src/cli/services/executor/service.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// Use `z.custom` instead of `z.function`, since `z.function` changes `toString` representation.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport const functionSchema: z.ZodType<Function, Function> = z.custom<Function>(\n (val) => typeof val === \"function\",\n);\n","import { pathToFileURL } from \"node:url\";\n\nexport const IMPORT_NONCE_PARAM = \"tailorImportNonce\";\n\nlet runCounter = 0;\n\n/**\n * Start a fresh user-module run. Modules imported through\n * {@link importUserModule} after this call bypass the ESM cache entries of\n * earlier runs, so a repeated in-process run re-evaluates user code instead\n * of reusing stale modules.\n */\nexport function beginUserModuleRun(): void {\n runCounter += 1;\n}\n\n/**\n * Read the cache-busting nonce of the current user-module run.\n * @returns The nonce, or undefined when no run was started\n */\nexport function currentImportNonce(): string | undefined {\n return runCounter === 0 ? undefined : String(runCounter);\n}\n\n/**\n * Import a user module (config, workflow, resolver, executor, ...) with the\n * current run's cache-busting nonce applied. Outside a run this is a plain\n * import.\n * @param filePath - Absolute path of the user module\n * @returns The imported module namespace\n */\nexport function importUserModule(filePath: string): Promise<Record<string, unknown>> {\n const url = pathToFileURL(filePath);\n const nonce = currentImportNonce();\n if (nonce) {\n url.searchParams.set(IMPORT_NONCE_PARAM, nonce);\n }\n return import(url.href);\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"pathe\";\nimport { logger } from \"#/cli/shared/logger\";\n\nexport interface FileLoadConfig {\n files: string[];\n ignores?: string[];\n}\n\nconst DEFAULT_IGNORE_PATTERNS = [\"**/*.test.ts\", \"**/*.spec.ts\"];\n\n// loadFilesWithIgnores is called once per service/bundler, so a single\n// generate/apply run can call it multiple times for the same baseDir (once\n// per resolver/executor/tailordb/etc. config sharing that directory). Track\n// which (baseDir, patterns) pairs have already warned so each one only warns\n// once per run — keyed by patterns too, since different services sharing a\n// baseDir can have different `files` patterns each needing their own warning.\nconst warnedFallbacks = new Set<string>();\n\n/**\n * Load files matching the given patterns, excluding files that match ignore patterns.\n * By default, test files (*.test.ts, *.spec.ts) are excluded unless ignores is explicitly specified.\n * @param config - Configuration with files patterns and optional ignores patterns\n * @param baseDir - Directory relative patterns are resolved against\n * @returns Array of absolute file paths\n */\nexport function loadFilesWithIgnores(config: FileLoadConfig, baseDir: string): string[] {\n if (config.files.length === 0) {\n return [];\n }\n\n const resolved = resolveFiles(config, baseDir);\n const allPatternsAbsolute = config.files.every((pattern) => path.isAbsolute(pattern));\n if (resolved.matchedAnyPattern || baseDir === process.cwd() || allPatternsAbsolute) {\n return resolved.files;\n }\n\n // v1 compatibility fallback: pre-existing configs may have relative\n // patterns written against the invocation cwd rather than baseDir. Only\n // triggers when baseDir's patterns matched nothing at all (not merely\n // \"matched, but every hit got filtered out by ignores\") — otherwise this\n // fallback would reintroduce the same cross-app file bleed this baseDir\n // resolution is meant to prevent. Also skipped when every pattern is\n // already absolute, since baseDir can't change an absolute pattern's\n // resolution — re-running against cwd would just repeat the same glob.\n // Remove this fallback in v2, once such configs are expected to have\n // migrated.\n const fallbackKey = `${baseDir}\\0${config.files.join(\"\\0\")}`;\n if (!warnedFallbacks.has(fallbackKey)) {\n warnedFallbacks.add(fallbackKey);\n logger.warn(\n `No files matched \"${config.files.join(\", \")}\" relative to \"${baseDir}\"; falling back to ` +\n `process.cwd(). Update this config's file patterns to be relative to its own directory ` +\n `before v2, when this fallback will be removed.`,\n );\n }\n return resolveFiles(config, process.cwd()).files;\n}\n\ninterface ResolvedFiles {\n files: string[];\n /** Whether any `files` pattern matched anything under baseDir, before ignore filtering. */\n matchedAnyPattern: boolean;\n}\n\nfunction resolveFiles(config: FileLoadConfig, baseDir: string): ResolvedFiles {\n // Use user-provided patterns if specified, otherwise use defaults. Default\n // patterns are left unanchored (\"**/*.test.ts\") so they match a test file\n // regardless of which directory a `files` pattern's matches actually came\n // from — this matters when a pattern is absolute or otherwise escapes\n // baseDir. User-provided patterns are baseDir-relative, matching `files`.\n const isDefaultIgnores = config.ignores === undefined;\n const ignorePatterns = config.ignores ?? DEFAULT_IGNORE_PATTERNS;\n const resolvedIgnorePatterns = isDefaultIgnores\n ? ignorePatterns\n : ignorePatterns.map((ignorePattern) => path.resolve(baseDir, ignorePattern));\n\n const files: string[] = [];\n let matchedAnyPattern = false;\n for (const pattern of config.files) {\n const absolutePattern = path.resolve(baseDir, pattern);\n try {\n const matchedFiles = fs.globSync(absolutePattern);\n if (matchedFiles.length > 0) {\n matchedAnyPattern = true;\n }\n // Filter out ignored files\n const filteredFiles = matchedFiles.filter(\n (file) =>\n !resolvedIgnorePatterns.some((ignorePattern) => path.matchesGlob(file, ignorePattern)),\n );\n files.push(...filteredFiles);\n } catch (error) {\n // A glob failure means we don't know whether baseDir has matching\n // files, not that it has none — treat it as a match so it can't\n // trigger the v1 compatibility fallback below.\n matchedAnyPattern = true;\n logger.warn(`Failed to glob pattern \"${pattern}\": ${String(error)}`);\n }\n }\n\n return { files, matchedAnyPattern };\n}\n","import type { RawRelationConfig } from \"#/configure/services/tailordb/types\";\nimport type { OperatorFieldConfig } from \"#/parser/service/tailordb/types\";\nimport type { UnionToTuple } from \"type-fest\";\n\nconst relationTypes = {\n \"1-1\": \"1-1\",\n oneToOne: \"1-1\",\n \"n-1\": \"n-1\",\n manyToOne: \"n-1\",\n \"N-1\": \"n-1\",\n keyOnly: \"keyOnly\",\n} as const;\nexport const relationTypesKeys = Object.keys(relationTypes) as UnionToTuple<\n keyof typeof relationTypes\n>;\n\nexport interface RelationProcessingContext {\n tableName: string;\n fieldName: string;\n allTableNames: Set<string>;\n}\n\nexport interface ProcessedRelationMetadata {\n index: boolean;\n foreignKey: boolean;\n relationType: string;\n unique: boolean;\n foreignKeyType: string;\n foreignKeyField: string;\n}\n\nexport interface RelationInfo {\n targetType: string;\n forwardName: string;\n backwardName: string;\n key: string;\n unique: boolean;\n}\n\nfunction fieldRef(context: RelationProcessingContext): string {\n return `Field \"${context.fieldName}\" on table \"${context.tableName}\"`;\n}\n\n/**\n * Validate relation configuration.\n * @param rawRelation - Raw relation configuration from TailorDB table definition\n * @param context - Context information for the relation (table name, field name, all type names)\n */\nexport function validateRelationConfig(\n rawRelation: RawRelationConfig,\n context: RelationProcessingContext,\n): void {\n // raw user config may omit the field\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (!rawRelation.type) {\n throw new Error(\n `${fieldRef(context)} has a relation but is missing the required 'type' property. ` +\n `Valid values: ${relationTypesKeys.join(\", \")}.`,\n );\n }\n if (!(rawRelation.type in relationTypes)) {\n throw new Error(\n `${fieldRef(context)} has invalid relation type '${rawRelation.type}'. ` +\n `Valid values: ${relationTypesKeys.join(\", \")}.`,\n );\n }\n\n // Validate target table exists (for non-self relations)\n if (rawRelation.toward.table !== \"self\" && !context.allTableNames.has(rawRelation.toward.table)) {\n throw new Error(`${fieldRef(context)} references unknown table \"${rawRelation.toward.table}\".`);\n }\n}\n\n/**\n * Process raw relation config and compute derived metadata values.\n * @param rawRelation - Raw relation configuration\n * @param context - Context information for the relation\n * @param isArrayField - Whether the target field is an array field\n * @returns Computed relation metadata to apply to field config\n */\nexport function processRelationMetadata(\n rawRelation: RawRelationConfig,\n context: RelationProcessingContext,\n isArrayField: boolean = false,\n): ProcessedRelationMetadata {\n const isUnique = relationTypes[rawRelation.type] === \"1-1\";\n const key = rawRelation.toward.key ?? \"id\";\n\n // Resolve target table name (handle \"self\" reference)\n const targetTypeName =\n rawRelation.toward.table === \"self\" ? context.tableName : rawRelation.toward.table;\n\n // Index and unique are not supported on array fields\n const shouldSetIndex = !isArrayField;\n const shouldSetUnique = !isArrayField && isUnique;\n\n return {\n index: shouldSetIndex,\n foreignKey: true,\n relationType: rawRelation.type,\n unique: shouldSetUnique,\n foreignKeyType: targetTypeName,\n foreignKeyField: key,\n };\n}\n\n/**\n * Build relation info for creating forward/backward relationships.\n * Returns undefined for keyOnly relations.\n * @param rawRelation - Raw relation configuration\n * @param context - Context information for the relation\n * @returns Relation information or undefined for keyOnly relations\n */\nexport function buildRelationInfo(\n rawRelation: RawRelationConfig,\n context: RelationProcessingContext,\n): RelationInfo | undefined {\n // keyOnly relations don't create forward/backward relationships\n if (rawRelation.type === \"keyOnly\") {\n return undefined;\n }\n\n const isUnique = relationTypes[rawRelation.type] === \"1-1\";\n const key = rawRelation.toward.key ?? \"id\";\n\n // Resolve target table name (handle \"self\" reference)\n const targetTypeName =\n rawRelation.toward.table === \"self\" ? context.tableName : rawRelation.toward.table;\n\n let forwardName = rawRelation.toward.as;\n if (!forwardName) {\n forwardName = context.fieldName.replace(/(ID|Id|id)$/u, \"\");\n }\n\n return {\n targetType: targetTypeName,\n forwardName,\n backwardName: rawRelation.backward ?? \"\",\n key,\n unique: isUnique,\n };\n}\n\n/**\n * Apply processed relation metadata to field config.\n * @param fieldConfig - Original operator field configuration\n * @param metadata - Processed relation metadata to apply\n * @returns Field config with relation metadata applied\n */\nexport function applyRelationMetadataToFieldConfig(\n fieldConfig: OperatorFieldConfig,\n metadata: ProcessedRelationMetadata,\n): OperatorFieldConfig {\n return {\n ...fieldConfig,\n index: metadata.index,\n foreignKey: metadata.foreignKey,\n unique: metadata.unique,\n foreignKeyType: metadata.foreignKeyType,\n foreignKeyField: metadata.foreignKeyField,\n };\n}\n","import { z } from \"zod\";\nimport { functionSchema } from \"../common\";\nimport { relationTypesKeys } from \"./relation\";\nimport type { TailorDBFieldOutput } from \"#/parser/service/tailordb/types\";\n\n/**\n * Normalize GqlOperationsConfig (alias or object) to GqlOperations object.\n * \"query\" alias expands to read-only mode: { create: false, update: false, delete: false, read: true }\n * @param config - The config to normalize\n * @returns The normalized GqlOperations object\n */\nfunction normalizeGqlOperations(\n config: \"query\" | { create?: boolean; update?: boolean; delete?: boolean; read?: boolean },\n) {\n if (config === \"query\") {\n return { create: false, update: false, delete: false, read: true };\n }\n return config;\n}\n\n/**\n * Zod schema for GqlOperations configuration with normalization transform.\n * Accepts \"query\" alias or detailed object, normalizes to GqlOperations object.\n */\nexport const GqlOperationsSchema = z\n .union([\n z.literal(\"query\"),\n z.strictObject({\n create: z.boolean().optional().describe(\"Enable create mutation (default: true)\"),\n update: z.boolean().optional().describe(\"Enable update mutation (default: true)\"),\n delete: z.boolean().optional().describe(\"Enable delete mutation (default: true)\"),\n read: z\n .boolean()\n .optional()\n .describe(\"Enable read queries - get, list, aggregation (default: true)\"),\n }),\n ])\n .describe(\n \"Configuration for GraphQL operations on a TailorDB table.\\nAll operations are enabled by default (undefined or true = enabled, false = disabled).\",\n )\n .transform((val) => normalizeGqlOperations(val));\n\nconst TailorFieldTypeSchema = z.enum([\n \"uuid\",\n \"string\",\n \"boolean\",\n \"integer\",\n \"float\",\n \"decimal\",\n \"enum\",\n \"date\",\n \"datetime\",\n \"time\",\n \"nested\",\n]);\n\nconst AllowedValueSchema = z.strictObject({\n value: z.string(),\n description: z.string().optional(),\n});\n\nexport const DBFieldMetadataSchema = z.strictObject({\n required: z.boolean().optional().describe(\"Whether the field is required\"),\n array: z.boolean().optional().describe(\"Whether the field is an array\"),\n description: z.string().optional().describe(\"Field description\"),\n typeName: z.string().optional().describe(\"Type name for nested or enum fields\"),\n allowedValues: z.array(AllowedValueSchema).optional().describe(\"Allowed values for enum fields\"),\n index: z.boolean().optional().describe(\"Whether the field is indexed for faster queries\"),\n unique: z.boolean().optional().describe(\"Whether the field value must be unique\"),\n vector: z\n .boolean()\n .optional()\n .describe(\"Whether the field is a vector field for similarity search\"),\n foreignKey: z.boolean().optional().describe(\"Whether the field is a foreign key\"),\n foreignKeyType: z.string().optional().describe(\"Target table name for foreign key relations\"),\n foreignKeyField: z.string().optional().describe(\"Target field name for foreign key relations\"),\n hooks: z\n .strictObject({\n create: functionSchema.optional().describe(\"Hook function called on record creation\"),\n update: functionSchema.optional().describe(\"Hook function called on record update\"),\n })\n .optional()\n .describe(\"Lifecycle hooks for the field\"),\n validate: z.array(functionSchema).optional().describe(\"Validation functions for the field\"),\n serial: z\n .strictObject({\n start: z.number().describe(\"Starting value for the serial sequence\"),\n maxValue: z.number().optional().describe(\"Maximum value for the serial sequence\"),\n format: z.string().optional().describe(\"Format string for serial value (string type only)\"),\n })\n .optional()\n .describe(\"Serial (auto-increment) configuration\"),\n scale: z\n .number()\n .int()\n .min(0)\n .max(12)\n .optional()\n .describe(\"Decimal scale (number of digits after decimal point, 0-12)\"),\n default: z.unknown().optional().describe(\"Default value for the field on create\"),\n});\n\nconst RelationTypeSchema = z.enum(relationTypesKeys);\n\nexport const RawRelationConfigSchema = z.strictObject({\n type: RelationTypeSchema.describe(\"Relation cardinality type\"),\n toward: z.strictObject({\n table: z.string().describe(\"Target table name, or 'self' for self-relations\"),\n as: z.string().optional().describe(\"Custom forward relation name\"),\n key: z.string().optional().describe(\"Target field to join on (default: 'id')\"),\n }),\n backward: z.string().optional().describe(\"Backward relation name on the target table\"),\n});\n\nconst TailorDBFieldSchema: z.ZodType<TailorDBFieldOutput> = z.lazy(() =>\n // strip unknown keys\n z.object({\n type: TailorFieldTypeSchema,\n fields: z.record(z.string(), TailorDBFieldSchema).optional(),\n metadata: DBFieldMetadataSchema,\n rawRelation: RawRelationConfigSchema.optional(),\n }),\n);\n\n/**\n * Schema for TailorDB table settings.\n * Normalizes gqlOperations from alias (\"query\") to object format.\n */\nexport const TailorDBTypeSettingsSchema = z.strictObject({\n pluralForm: z.string().optional().describe(\"Custom plural form of the table name for GraphQL\"),\n aggregation: z.boolean().optional().describe(\"Enable aggregation queries for this table\"),\n bulkUpsert: z.boolean().optional().describe(\"Enable bulk upsert mutation for this table\"),\n gqlOperations: GqlOperationsSchema.optional().describe(\n 'Configure GraphQL operations for this table. Use \"query\" for read-only mode, or an object for granular control.',\n ),\n publishEvents: z\n .boolean()\n .optional()\n .describe(\n \"Enable publishing events for this table.\\nWhen enabled, record creation/update/deletion events are published.\\nIf not specified, this is automatically set to true when an executor uses this table\\nwith recordCreated/recordUpdated/recordDeleted triggers. If explicitly set to false\\nwhile an executor uses this table, an error will be thrown during apply.\",\n ),\n});\n\nexport const GQL_PERMISSION_INVALID_OPERAND_MESSAGE =\n \"operand is not supported in gqlPermission. Use permission() for record-level conditions.\";\n\nconst GqlPermissionOperandSchema = z.union(\n [\n z.strictObject({ user: z.string() }),\n z.string(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.boolean()),\n ],\n {\n error: (issue) => {\n if (typeof issue.input === \"object\" && issue.input !== null) {\n const keys = Object.keys(issue.input);\n if (keys.length === 1) {\n return `\"${keys[0]}\" ${GQL_PERMISSION_INVALID_OPERAND_MESSAGE}`;\n }\n return \"Operand object must have exactly 1 key\";\n }\n return \"Invalid operand in gqlPermission\";\n },\n },\n);\n\nconst RecordPermissionOperandSchema = z.union([\n GqlPermissionOperandSchema,\n z.strictObject({ record: z.string() }),\n z.strictObject({ oldRecord: z.string() }),\n z.strictObject({ newRecord: z.string() }),\n]);\n\nconst PermissionOperatorSchema = z.enum([\"=\", \"!=\", \"in\", \"not in\", \"hasAny\", \"not hasAny\"]);\n\nconst RecordPermissionConditionSchema = z\n .tuple([RecordPermissionOperandSchema, PermissionOperatorSchema, RecordPermissionOperandSchema])\n .readonly();\n\nconst GqlPermissionConditionSchema = z\n .tuple([GqlPermissionOperandSchema, PermissionOperatorSchema, GqlPermissionOperandSchema])\n .readonly();\n\nconst ActionPermissionSchema = z.union([\n // Object format: { conditions, description?, permit? }\n z.strictObject({\n conditions: z.union([\n RecordPermissionConditionSchema,\n z.array(RecordPermissionConditionSchema).readonly(),\n ]),\n description: z.string().optional(),\n permit: z.boolean().optional(),\n }),\n // Single condition tuple: [operand, operator, operand]\n z\n .tuple([RecordPermissionOperandSchema, PermissionOperatorSchema, RecordPermissionOperandSchema])\n .readonly(),\n // Single condition tuple with permit: [operand, operator, operand, permit]\n z\n .tuple([\n RecordPermissionOperandSchema,\n PermissionOperatorSchema,\n RecordPermissionOperandSchema,\n z.boolean(),\n ])\n .readonly(),\n // Multiple conditions with optional trailing permit\n z\n .array(z.union([RecordPermissionConditionSchema, z.boolean()]))\n .refine(\n (arr) => {\n const boolIndex = arr.findIndex((item) => typeof item === \"boolean\");\n return boolIndex === -1 || boolIndex === arr.length - 1;\n },\n { message: \"Boolean permit flag must only appear at the end\" },\n )\n .readonly(),\n]);\n\nconst GqlPermissionActionSchema = z.enum([\n \"read\",\n \"create\",\n \"update\",\n \"delete\",\n \"aggregate\",\n \"bulkUpsert\",\n]);\n\nconst GqlPermissionPolicySchema = z.strictObject({\n conditions: z.array(GqlPermissionConditionSchema).readonly(),\n actions: z.union([z.literal(\"all\"), z.array(GqlPermissionActionSchema).readonly()]),\n permit: z.boolean().optional(),\n description: z.string().optional(),\n});\n\nexport const RawPermissionsSchema = z.strictObject({\n record: z\n .strictObject({\n create: z.array(ActionPermissionSchema).readonly(),\n read: z.array(ActionPermissionSchema).readonly(),\n update: z.array(ActionPermissionSchema).readonly(),\n delete: z.array(ActionPermissionSchema).readonly(),\n })\n .optional(),\n gql: z.array(GqlPermissionPolicySchema).readonly().optional(),\n});\n\nexport const TailorDBTypeSchema = z.strictObject({\n name: z.string(),\n fields: z.record(z.string(), TailorDBFieldSchema),\n // oxlint-disable-next-line zod/prefer-strict-object, tailor-zod/require-object-policy-comment -- Keep z.object().strict() so zinfer preserves the RawPermissions alias in generated types.\n metadata: z\n .object({\n name: z.string(),\n description: z.string().optional(),\n settings: TailorDBTypeSettingsSchema.optional(),\n permissions: RawPermissionsSchema,\n files: z.record(z.string(), z.string()),\n indexes: z\n .record(\n z.string(),\n z.strictObject({\n fields: z.array(z.string()),\n unique: z.boolean().optional(),\n }),\n )\n .optional(),\n typeHook: z\n .strictObject({\n create: functionSchema.optional(),\n update: functionSchema.optional(),\n })\n .optional(),\n typeValidate: functionSchema.optional(),\n })\n .strict(),\n});\n\nconst TailorDBMigrationConfigSchema = z.strictObject({\n directory: z.string().describe(\"Directory containing migration files\"),\n machineUser: z.string().optional().describe(\"Machine user name for migration execution\"),\n});\n\n/**\n * Schema for TailorDB service configuration.\n * Normalizes gqlOperations from alias (\"query\") to object format.\n */\nexport const TailorDBServiceConfigSchema = z.strictObject({\n files: z.array(z.string()).describe(\"Glob patterns for TailorDB table definition files\"),\n ignores: z.array(z.string()).optional().describe(\"Glob patterns to exclude from table discovery\"),\n migration: TailorDBMigrationConfigSchema.optional().describe(\"Migration configuration\"),\n gqlOperations: GqlOperationsSchema.optional().describe(\n \"Default GraphQL operations for all tables in this service\",\n ),\n});\n","import { isSdkBranded } from \"#/utils/brand\";\nimport { TailorDBTypeSchema } from \"./schema\";\n\nconst TAILORDB_TYPE_SCHEMA_KEYS = TailorDBTypeSchema.keyof().options;\n\nexport function stripTailorDBTypeBuilderHelpers(type: unknown): unknown {\n if (!isSdkBranded(type, \"tailordb-type\")) {\n return type;\n }\n\n return pickTailorDBTypeSchemaKeys(type);\n}\n\n/**\n * Keep only the TailorDBTypeSchema keys of an object, regardless of SDK\n * branding. Structural copies of builder tables (e.g. spread clones from\n * plugins) lose the non-enumerable brand but still carry builder helper\n * methods that a strict schema parse would reject.\n * @param type - Candidate table value\n * @returns An object with only schema keys, or the value itself when it is not an object\n */\nexport function pickTailorDBTypeSchemaKeys(type: unknown): unknown {\n if (typeof type !== \"object\" || type === null) {\n return type;\n }\n\n const config: Record<string, unknown> = {};\n const input = type as Record<string, unknown>;\n for (const key of TAILORDB_TYPE_SCHEMA_KEYS) {\n if (Object.prototype.hasOwnProperty.call(input, key)) {\n config[key] = input[key];\n }\n }\n return config;\n}\n","import { z } from \"zod\";\n\nexport const AuthConnectionOAuth2ConfigSchema = z.strictObject({\n providerUrl: z.string().describe(\"OAuth2 provider URL\"),\n issuerUrl: z.string().describe(\"OAuth2 issuer URL\"),\n clientId: z.string().describe(\"OAuth2 client ID\"),\n clientSecret: z.string().describe(\"OAuth2 client secret\"),\n authUrl: z.string().optional().describe(\"OAuth2 authorization endpoint override\"),\n tokenUrl: z.string().optional().describe(\"OAuth2 token endpoint override\"),\n});\n\nexport const AuthConnectionConfigSchema = AuthConnectionOAuth2ConfigSchema.extend({\n type: z.literal(\"oauth2\").describe(\"Connection type\"),\n});\n","import { z } from \"zod\";\nimport { functionSchema } from \"../common\";\n\nconst TailorFieldTypeSchema = z.enum([\n \"uuid\",\n \"string\",\n \"boolean\",\n \"integer\",\n \"float\",\n \"decimal\",\n \"enum\",\n \"date\",\n \"datetime\",\n \"time\",\n \"nested\",\n]);\n\nconst AllowedValueSchema = z.strictObject({\n value: z.string().describe(\"The allowed value\"),\n description: z.string().optional().describe(\"Description of the allowed value\"),\n});\n\nconst FieldMetadataSchema = z.strictObject({\n as: z.enum([\"string\", \"date\"]).optional().describe(\"Date value representation\"),\n required: z.boolean().optional().describe(\"Whether the field is required\"),\n array: z.boolean().optional().describe(\"Whether the field is an array\"),\n description: z.string().optional().describe(\"Field description\"),\n allowedValues: z.array(AllowedValueSchema).optional().describe(\"Allowed values for enum fields\"),\n hooks: z\n .strictObject({\n create: functionSchema.optional().describe(\"Hook function called on creation\"),\n update: functionSchema.optional().describe(\"Hook function called on update\"),\n })\n .optional()\n .describe(\"Lifecycle hooks\"),\n validate: z.array(functionSchema).optional().describe(\"Validation functions for the field\"),\n typeName: z.string().optional().describe(\"Type name for nested or enum fields\"),\n default: z.unknown().optional().describe(\"Default value for the field on create\"),\n});\n\n// strip unknown keys\nexport const TailorFieldSchema = z.object({\n type: TailorFieldTypeSchema.describe(\"Field data type\"),\n metadata: FieldMetadataSchema.describe(\"Field metadata configuration\"),\n get fields() {\n return z.record(z.string(), TailorFieldSchema);\n },\n});\n","import { z } from \"zod\";\nimport { AuthConnectionConfigSchema } from \"#/parser/service/auth-connection/index\";\nimport { TailorFieldSchema } from \"#/parser/service/field/schema\";\nimport { stripTailorDBTypeBuilderHelpers } from \"#/parser/service/tailordb/builder-helpers\";\nimport { TailorDBTypeSchema } from \"#/parser/service/tailordb/index\";\nimport type { ValueOperand } from \"#/configure/services/auth/types\";\nimport type { TailorDBInstance } from \"#/configure/services/tailordb/types\";\n\nexport const AuthInvokerObjectSchema = z.strictObject({\n namespace: z.string().describe(\"Auth namespace\"),\n machineUserName: z.string().describe(\"Machine user name for authentication\"),\n});\n\nexport const AuthInvokerSchema = z.union([\n z.string().describe(\"Machine user name (namespace auto-resolved from auth service)\"),\n AuthInvokerObjectSchema,\n]);\n\nconst secretValueSchema = z.strictObject({\n vaultName: z.string().describe(\"Vault name containing the secret\"),\n secretKey: z.string().describe(\"Key of the secret in the vault\"),\n});\n\nexport const OIDCSchema = z.strictObject({\n name: z.string().describe(\"Identity provider name\"),\n kind: z.literal(\"OIDC\"),\n clientID: z.string().describe(\"OAuth2 client ID\"),\n clientSecret: secretValueSchema.describe(\"OAuth2 client secret\"),\n providerURL: z.string().describe(\"OIDC provider URL\"),\n issuerURL: z.string().optional().describe(\"OIDC issuer URL (defaults to providerURL)\"),\n usernameClaim: z.string().optional().describe(\"JWT claim to use as username\"),\n});\n\nexport const SAMLSchema = z\n .strictObject({\n name: z.string().describe(\"Identity provider name\"),\n kind: z.literal(\"SAML\"),\n enableSignRequest: z.boolean().default(false).describe(\"Enable signing of SAML requests\"),\n metadataURL: z\n .string()\n .optional()\n .describe(\"URL to fetch SAML metadata (mutually exclusive with rawMetadata)\"),\n rawMetadata: z\n .string()\n .optional()\n .describe(\"Raw SAML metadata XML (mutually exclusive with metadataURL)\"),\n defaultRedirectURL: z\n .string()\n .optional()\n .describe(\"URL to redirect to when SAML ACS receives a response with an empty RelayState.\"),\n })\n\n .refine((value) => {\n const hasMetadata = value.metadataURL !== undefined;\n const hasRaw = value.rawMetadata !== undefined;\n return hasMetadata !== hasRaw;\n }, \"Provide either metadataURL or rawMetadata\");\n\nexport const IDTokenSchema = z.strictObject({\n name: z.string().describe(\"Identity provider name\"),\n kind: z.literal(\"IDToken\"),\n providerURL: z.string().describe(\"ID token provider URL\"),\n issuerURL: z.string().optional().describe(\"ID token issuer URL\"),\n clientID: z.string().describe(\"Client ID for ID token validation\"),\n usernameClaim: z.string().optional().describe(\"JWT claim to use as username\"),\n});\n\nexport const BuiltinIdPSchema = z.strictObject({\n name: z.string().describe(\"Identity provider name\"),\n kind: z.literal(\"BuiltInIdP\"),\n namespace: z.string().describe(\"IdP namespace\"),\n clientName: z.string().describe(\"OAuth2 client name in the IdP\"),\n});\n\nexport const IdProviderSchema = z.discriminatedUnion(\"kind\", [\n OIDCSchema,\n SAMLSchema,\n IDTokenSchema,\n BuiltinIdPSchema,\n]);\n\nexport const OAuth2ClientGrantTypeSchema = z\n .union([z.literal(\"authorization_code\"), z.literal(\"refresh_token\")])\n .describe(\"OAuth2 grant type\");\n\nexport const OAuth2ClientSchema = z\n .strictObject({\n description: z.string().optional().describe(\"Client description\"),\n grantTypes: z\n .array(OAuth2ClientGrantTypeSchema)\n .default([\"authorization_code\", \"refresh_token\"])\n .describe(\"Allowed OAuth2 grant types\"),\n redirectURIs: z\n .array(\n z.union([\n z.templateLiteral([\"https://\", z.string()]),\n z.templateLiteral([\"http://\", z.string()]),\n z.templateLiteral([z.string(), \":url\"]),\n z.templateLiteral([z.string(), \":url/\", z.string()]),\n ]),\n )\n .describe(\"Allowed redirect URIs\"),\n clientType: z\n .union([z.literal(\"confidential\"), z.literal(\"public\"), z.literal(\"browser\")])\n .optional()\n .describe(\"OAuth2 client type\"),\n accessTokenLifetimeSeconds: z\n .number()\n .int()\n .min(60, \"Minimum access token lifetime is 60 seconds\")\n .max(86400, \"Maximum access token lifetime is 1 day (86400 seconds)\")\n .optional()\n .describe(\"Access token lifetime in seconds (60-86400)\")\n .transform((val) => (val ? { seconds: BigInt(val), nanos: 0 } : undefined)),\n refreshTokenLifetimeSeconds: z\n .number()\n .int()\n .min(60, \"Minimum refresh token lifetime is 60 seconds\")\n .max(604800, \"Maximum refresh token lifetime is 7 days (604800 seconds)\")\n .optional()\n .describe(\"Refresh token lifetime in seconds (60-604800)\")\n .transform((val) => (val ? { seconds: BigInt(val), nanos: 0 } : undefined)),\n requireDpop: z\n .boolean()\n .optional()\n .describe(\"Require DPoP (Demonstrating Proof-of-Possession) for token requests\"),\n })\n\n .refine((data) => !(data.clientType === \"browser\" && data.requireDpop === true), {\n message: \"requireDpop cannot be set to true for browser clients as they don't support DPoP\",\n path: [\"requireDpop\"],\n });\n\nexport const SCIMAuthorizationSchema = z.strictObject({\n type: z.union([z.literal(\"oauth2\"), z.literal(\"bearer\")]).describe(\"SCIM authorization type\"),\n bearerSecret: secretValueSchema\n .optional()\n .describe(\"Bearer token secret (required for bearer type)\"),\n});\n\nexport const SCIMAttributeTypeSchema = z\n .union([\n z.literal(\"string\"),\n z.literal(\"number\"),\n z.literal(\"boolean\"),\n z.literal(\"datetime\"),\n z.literal(\"complex\"),\n ])\n .describe(\"SCIM attribute data type\");\n\nexport const SCIMAttributeSchema = z.strictObject({\n type: SCIMAttributeTypeSchema.describe(\"Attribute data type\"),\n name: z.string().describe(\"Attribute name\"),\n description: z.string().optional().describe(\"Attribute description\"),\n mutability: z\n .union([z.literal(\"readOnly\"), z.literal(\"readWrite\"), z.literal(\"writeOnly\")])\n .optional()\n .describe(\"Attribute mutability\"),\n required: z.boolean().optional().describe(\"Whether the attribute is required\"),\n multiValued: z.boolean().optional().describe(\"Whether the attribute can have multiple values\"),\n uniqueness: z\n .union([z.literal(\"none\"), z.literal(\"server\"), z.literal(\"global\")])\n .optional()\n .describe(\"Uniqueness constraint\"),\n canonicalValues: z.array(z.string()).nullable().optional().describe(\"List of canonical values\"),\n get subAttributes() {\n return z.array(SCIMAttributeSchema).nullable().optional();\n },\n});\n\nconst SCIMSchemaSchema = z.strictObject({\n name: z.string().describe(\"SCIM schema name\"),\n attributes: z.array(SCIMAttributeSchema).describe(\"Schema attributes\"),\n});\n\nexport const SCIMAttributeMappingSchema = z.strictObject({\n tailorDBField: z.string().describe(\"TailorDB field name to map to\"),\n scimPath: z.string().describe(\"SCIM attribute path\"),\n});\n\nexport const SCIMResourceSchema = z.strictObject({\n name: z.string().describe(\"SCIM resource name\"),\n tailorDBNamespace: z.string().describe(\"TailorDB namespace for the resource\"),\n tailorDBType: z.string().describe(\"TailorDB table name for the resource\"),\n coreSchema: SCIMSchemaSchema.describe(\"Core SCIM schema definition\"),\n attributeMapping: z.array(SCIMAttributeMappingSchema).describe(\"Attribute mapping configuration\"),\n});\n\nexport const SCIMSchema = z.strictObject({\n machineUserName: z.string().describe(\"Machine user name for SCIM operations\"),\n authorization: SCIMAuthorizationSchema.describe(\"SCIM authorization configuration\"),\n resources: z.array(SCIMResourceSchema).describe(\"SCIM resource definitions\"),\n});\n\nexport const TenantProviderSchema = z.strictObject({\n namespace: z.string().describe(\"TailorDB namespace for the tenant table\"),\n type: z.string().describe(\"TailorDB table name for tenants\"),\n signatureField: z.string().describe(\"Field used as the tenant signature\"),\n});\n\nconst UserProfileSchema = z.strictObject({\n namespace: z.string().optional().describe(\"TailorDB namespace where the user table is defined\"),\n type: z\n .custom<TailorDBInstance>()\n .transform(stripTailorDBTypeBuilderHelpers)\n .pipe(TailorDBTypeSchema),\n usernameField: z.string(),\n attributes: z.record(z.string(), z.literal(true)).optional(),\n attributeList: z.array(z.string()).optional(),\n});\n\nconst ValueOperandSchema: z.ZodType<ValueOperand> = z.union([\n z.string(),\n z.boolean(),\n z.array(z.string()),\n z.array(z.boolean()),\n]);\n\nconst MachineUserSchema = z.strictObject({\n // null/undefined values mean \"attribute not set\" and are dropped so\n // downstream (deploy, drift diff) only ever sees concrete values.\n attributes: z\n .record(z.string(), ValueOperandSchema.nullish())\n .transform((attributes): Record<string, ValueOperand> =>\n Object.fromEntries(\n Object.entries(attributes).filter(\n (entry): entry is [string, ValueOperand] => entry[1] != null,\n ),\n ),\n )\n .optional(),\n attributeList: z.array(z.uuid()).optional(),\n});\n\nconst BeforeLoginHookSchema = z.strictObject({\n handler: z.function(),\n invoker: z.string(),\n});\n\nconst AuthConfigBaseSchema = z.strictObject({\n name: z.string().describe(\"Auth service name\"),\n hooks: z\n .strictObject({\n beforeLogin: BeforeLoginHookSchema.optional().describe(\"Before login auth hook\"),\n })\n .optional()\n .describe(\"Auth hooks\"),\n machineUsers: z\n .record(z.string(), MachineUserSchema)\n .optional()\n .describe(\"Machine user definitions\"),\n oauth2Clients: z\n .record(z.string(), OAuth2ClientSchema)\n .optional()\n .describe(\"OAuth2 client definitions\"),\n idProvider: IdProviderSchema.optional().describe(\"Identity provider configuration\"),\n scim: SCIMSchema.optional().describe(\"SCIM provisioning configuration\"),\n tenantProvider: TenantProviderSchema.optional().describe(\"Multi-tenant provider configuration\"),\n connections: z\n .record(z.string(), AuthConnectionConfigSchema)\n .optional()\n .describe(\"Auth connection definitions for external OAuth2 providers\"),\n publishSessionEvents: z.boolean().optional().describe(\"Enable publishing session events\"),\n});\n\nexport const AuthConfigSchema = z.xor(\n [\n AuthConfigBaseSchema.extend({\n userProfile: UserProfileSchema.optional().describe(\"User profile configuration\"),\n machineUserAttributes: z.undefined().optional(),\n }),\n AuthConfigBaseSchema.extend({\n userProfile: z.undefined().optional(),\n machineUserAttributes: z\n .record(z.string(), TailorFieldSchema)\n .describe(\"Machine user attribute fields\"),\n }),\n ],\n {\n error: (iss) => {\n // zod may report error codes not covered by its type definitions\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (iss.code !== \"invalid_union\") return undefined;\n // zod may report error codes not covered by its type definitions\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (iss.errors.length < 2) return undefined;\n const isOnlyMutexViolation = iss.errors.every((variantErrors) =>\n variantErrors.every(\n (e) =>\n e.path.length === 1 &&\n (e.path[0] === \"userProfile\" || e.path[0] === \"machineUserAttributes\"),\n ),\n );\n if (isOnlyMutexViolation) {\n return \"Specify either `userProfile` or `machineUserAttributes`, not both.\";\n }\n return undefined;\n },\n },\n);\n","import { z } from \"zod\";\nimport { AuthInvokerSchema } from \"../auth\";\nimport { functionSchema } from \"../common\";\nimport type { JsonValue } from \"#/types/helpers\";\n\nexport const TailorDBTriggerSchema = z.strictObject({\n kind: z.literal(\"tailordb\").describe(\"TailorDB record event trigger\"),\n events: z\n .array(\n z.enum([\n \"tailordb.type_record.created\",\n \"tailordb.type_record.updated\",\n \"tailordb.type_record.deleted\",\n ]),\n )\n .min(1)\n .transform((arr) => [...new Set(arr)])\n .describe(\"TailorDB event types to trigger on\"),\n tableName: z.string().describe(\"TailorDB table name to watch for events\"),\n condition: functionSchema.optional().describe(\"Condition function to filter events\"),\n});\n\nexport const ResolverExecutedTriggerSchema = z.strictObject({\n kind: z.literal(\"resolverExecuted\"),\n resolverName: z.string().describe(\"Name of the resolver to trigger on\"),\n condition: functionSchema.optional().describe(\"Condition function to filter events\"),\n});\n\nexport const ScheduleTriggerSchema = z.strictObject({\n kind: z.literal(\"schedule\"),\n cron: z.string().describe(\"CRON expression for the schedule\"),\n timezone: z\n .string()\n .optional()\n .default(\"UTC\")\n .describe(\"Timezone for the CRON schedule (default: UTC)\"),\n});\n\nexport const IncomingWebhookTriggerResponseSchema = z.strictObject({\n body: functionSchema.optional().describe(\"Function returning the response body\"),\n statusCode: z.number().int().optional().describe(\"HTTP status code for the response\"),\n});\n\nexport const IncomingWebhookTriggerSchema = z.strictObject({\n kind: z.literal(\"incomingWebhook\"),\n response: IncomingWebhookTriggerResponseSchema.optional().describe(\"Response configuration\"),\n});\n\nexport const IdpUserTriggerSchema = z.strictObject({\n kind: z.literal(\"idpUser\").describe(\"IdP user event trigger\"),\n events: z\n .array(z.enum([\"idp.user.created\", \"idp.user.updated\", \"idp.user.deleted\"]))\n .min(1)\n .transform((arr) => [...new Set(arr)])\n .describe(\"IdP user event types to trigger on\"),\n idp: z\n .string()\n .optional()\n .describe(\n \"IdP namespace name to subscribe to. If omitted, the project's only IdP is used; throws when multiple IdPs exist.\",\n ),\n});\n\nexport const AuthAccessTokenTriggerSchema = z.strictObject({\n kind: z.literal(\"authAccessToken\").describe(\"Auth access token event trigger\"),\n events: z\n .array(\n z.enum([\n \"auth.access_token.issued\",\n \"auth.access_token.refreshed\",\n \"auth.access_token.revoked\",\n ]),\n )\n .min(1)\n .transform((arr) => [...new Set(arr)])\n .describe(\"Auth access token event types to trigger on\"),\n});\n\nconst workflowNameSchema = z\n .string()\n .refine((value) => value.trim().length > 0, \"Workflow name cannot be blank\")\n .describe(\"Workflow name to subscribe to.\");\n\nexport const WorkflowExecutionTriggerSchema = z.strictObject({\n kind: z.literal(\"workflowExecution\").describe(\"Workflow execution event trigger\"),\n events: z\n .array(\n z.enum([\n \"workflow.workflow_execution.started\",\n \"workflow.workflow_execution.completed\",\n \"workflow.workflow_execution.retried\",\n \"workflow.workflow_execution.resumed\",\n \"workflow.workflow_execution.wait_started\",\n \"workflow.workflow_execution.wait_resolved\",\n ]),\n )\n .min(1)\n .transform((arr) => [...new Set(arr)])\n .describe(\"Workflow execution event types to trigger on\"),\n workflowName: workflowNameSchema,\n condition: functionSchema.optional().describe(\"Condition function to filter events\"),\n});\n\nexport const WorkflowJobExecutionTriggerSchema = z.strictObject({\n kind: z.literal(\"workflowJobExecution\").describe(\"Workflow job execution event trigger\"),\n events: z\n .array(\n z.enum([\n \"workflow.workflow_execution.job_execution.started\",\n \"workflow.workflow_execution.job_execution.completed\",\n \"workflow.workflow_execution.job_execution.wait_started\",\n \"workflow.workflow_execution.job_execution.wait_resolved\",\n ]),\n )\n .min(1)\n .transform((arr) => [...new Set(arr)])\n .describe(\"Workflow job execution event types to trigger on\"),\n workflowName: workflowNameSchema,\n condition: functionSchema.optional().describe(\"Condition function to filter events\"),\n});\n\nexport const TriggerSchema = z.discriminatedUnion(\"kind\", [\n TailorDBTriggerSchema,\n ResolverExecutedTriggerSchema,\n ScheduleTriggerSchema,\n IncomingWebhookTriggerSchema,\n IdpUserTriggerSchema,\n AuthAccessTokenTriggerSchema,\n WorkflowExecutionTriggerSchema,\n WorkflowJobExecutionTriggerSchema,\n]);\n\nexport const FunctionOperationSchema = z.strictObject({\n kind: z.enum([\"function\", \"jobFunction\"]),\n body: functionSchema.describe(\"Function implementation\"),\n invoker: AuthInvokerSchema.optional().describe(\"Invoker for the function execution\"),\n});\n\nexport const GqlOperationSchema = z.strictObject({\n kind: z.literal(\"graphql\"),\n appName: z.string().optional().describe(\"Target application name for the GraphQL query\"),\n query: z.preprocess((val) => String(val), z.string().describe(\"GraphQL query string\")),\n variables: functionSchema.optional().describe(\"Function to compute GraphQL variables\"),\n invoker: AuthInvokerSchema.optional().describe(\"Invoker for the GraphQL execution\"),\n});\n\nexport const WebhookOperationSchema = z.strictObject({\n kind: z.literal(\"webhook\"),\n url: functionSchema.describe(\"Function returning the webhook URL\"),\n requestBody: functionSchema.optional().describe(\"Function to compute the request body\"),\n headers: z\n .record(\n z.string(),\n z.union([z.string(), z.strictObject({ vault: z.string(), key: z.string() })]),\n )\n .optional()\n .describe(\"HTTP headers for the webhook request\"),\n});\n\nexport const JsonValueSchema: z.ZodType<JsonValue, JsonValue> = z.lazy(() =>\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(JsonValueSchema),\n z.record(z.string(), JsonValueSchema),\n ]),\n);\n\nexport const WorkflowInputSchema: z.ZodType<\n Exclude<JsonValue, null>,\n Exclude<JsonValue, null>\n> = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(JsonValueSchema),\n z.record(z.string(), JsonValueSchema),\n]);\n\nexport const WorkflowOperationArgsSchema = z\n .union([WorkflowInputSchema, functionSchema])\n .describe(\"Arguments to pass to the workflow\");\n\nconst workflowOperationShape = {\n kind: z.literal(\"workflow\"),\n args: WorkflowOperationArgsSchema.optional(),\n invoker: AuthInvokerSchema.optional().describe(\"Invoker for the workflow execution\"),\n};\n\nconst WorkflowOperationByNameSchema = z.strictObject({\n ...workflowOperationShape,\n workflowName: z.string().describe(\"Name of the workflow to execute\"),\n workflow: z.never().optional(),\n});\n\nconst WorkflowOperationByReferenceSchema = z\n .strictObject({\n ...workflowOperationShape,\n workflow: z.looseObject({ name: z.string() }),\n workflowName: z.string().optional(),\n })\n .transform(({ workflow, ...operation }) => ({\n ...operation,\n workflowName: workflow.name,\n }));\n\nexport const WorkflowOperationSchema = z.union([\n WorkflowOperationByReferenceSchema,\n WorkflowOperationByNameSchema,\n]);\n\nexport const OperationSchema = z.union([\n FunctionOperationSchema,\n GqlOperationSchema,\n WebhookOperationSchema,\n WorkflowOperationSchema,\n]);\n\nexport const ExecutorSchema = z.strictObject({\n name: z.string().describe(\"Executor name\"),\n description: z.string().optional().describe(\"Executor description\"),\n disabled: z.boolean().optional().default(false).describe(\"Whether the executor is disabled\"),\n trigger: TriggerSchema.describe(\"Event trigger configuration\"),\n operation: OperationSchema.describe(\"Operation to execute when triggered\"),\n});\n","import { importUserModule } from \"#/cli/shared/user-modules\";\nimport { ExecutorSchema } from \"#/parser/service/executor/index\";\nimport { isSdkBranded } from \"#/utils/brand\";\nimport type { Executor } from \"#/types/executor.generated\";\n\nexport function stripExecutorTriggerArgs(executor: unknown): unknown {\n if (!isSdkBranded(executor, \"executor\")) {\n return executor;\n }\n\n const trigger = (executor as { trigger?: unknown }).trigger;\n if (trigger === null || typeof trigger !== \"object\" || !(\"__args\" in trigger)) {\n return executor;\n }\n\n const { __args: _args, ...triggerConfig } = trigger as Record<string, unknown>;\n return { ...(executor as Record<string, unknown>), trigger: triggerConfig };\n}\n\n/**\n * Load and validate an executor definition from a file.\n * @param executorFilePath - Path to the executor file\n * @returns Parsed executor or null if invalid\n */\nexport async function loadExecutor(executorFilePath: string): Promise<Executor | null> {\n const executorModule = await importUserModule(executorFilePath);\n const executor = executorModule.default;\n\n const parseResult = ExecutorSchema.safeParse(stripExecutorTriggerArgs(executor));\n if (!parseResult.success) {\n return null;\n }\n\n return parseResult.data;\n}\n","import * as path from \"pathe\";\nimport { loadFilesWithIgnores } from \"#/cli/services/file-loader\";\nimport { logger, styles } from \"#/cli/shared/logger\";\nimport { importUserModule } from \"#/cli/shared/user-modules\";\nimport { ExecutorSchema } from \"#/parser/service/executor/index\";\nimport { isSdkBranded } from \"#/utils/brand\";\nimport { stripExecutorTriggerArgs } from \"./loader\";\nimport type { ExecutorServiceConfig } from \"#/configure/config/types\";\nimport type { Executor } from \"#/types/executor.generated\";\n\n/**\n * Information about a plugin-generated executor converted to Executor format\n */\nexport interface PluginExecutor {\n /** The executor in standard Executor format */\n executor: Executor;\n /** Plugin ID that generated this executor */\n pluginId: string;\n /** Source table name (for table-attached executors) */\n sourceTableName?: string;\n}\n\nexport type ExecutorService = {\n readonly config: ExecutorServiceConfig;\n readonly executors: Record<string, Executor>;\n readonly pluginExecutors: ReadonlyArray<PluginExecutor>;\n /**\n * Loads executor files once and resolves to the executor record loaded so\n * far. Resolves to undefined only when the config declares no files and no\n * plugin executor has been loaded yet; plugin executors appear in calls\n * made after loadPluginExecutorFiles() has completed.\n */\n loadExecutors: () => Promise<Record<string, Executor> | undefined>;\n loadPluginExecutorFiles: (filePaths: string[]) => Promise<void>;\n};\n\n/**\n * Parameters for creating an ExecutorService\n */\nexport interface CreateExecutorServiceParams {\n /** The executor service configuration */\n config: ExecutorServiceConfig;\n /** Directory the config's file patterns are resolved against */\n baseDir: string;\n}\n\n/**\n * Creates a new ExecutorService instance.\n * @param params - Parameters for creating the service\n * @returns A new ExecutorService instance\n */\nexport function createExecutorService(params: CreateExecutorServiceParams): ExecutorService {\n const { config, baseDir } = params;\n const executors: Record<string, Executor> = {};\n const pluginExecutors: PluginExecutor[] = [];\n let loadPromise: Promise<Record<string, Executor> | undefined> | undefined;\n\n const loadExecutorForFile = async (executorFile: string): Promise<Executor | undefined> => {\n try {\n const executorModule = await importUserModule(executorFile);\n const result = ExecutorSchema.safeParse(stripExecutorTriggerArgs(executorModule.default));\n if (result.success) {\n const relativePath = path.relative(process.cwd(), executorFile);\n logger.log(\n `Executor: ${styles.successBright(`\"${result.data.name}\"`)} loaded from ${styles.path(relativePath)}`,\n );\n executors[executorFile] = result.data;\n return result.data;\n }\n if (isSdkBranded(executorModule.default, \"executor\")) {\n throw result.error;\n }\n } catch (error) {\n const relativePath = path.relative(process.cwd(), executorFile);\n logger.error(`Failed to load executor from ${styles.bold(relativePath)}`);\n logger.error(String(error));\n throw error;\n }\n return undefined;\n };\n\n return {\n config,\n get executors() {\n return executors;\n },\n get pluginExecutors() {\n return pluginExecutors;\n },\n loadExecutors: async () => {\n if (!loadPromise) {\n loadPromise = (async () => {\n if (config.files.length === 0) {\n return undefined;\n }\n\n const executorFiles = loadFilesWithIgnores(config, baseDir);\n\n logger.newline();\n logger.log(`Found ${styles.highlight(executorFiles.length.toString())} executor files`);\n\n await Promise.all(executorFiles.map((executorFile) => loadExecutorForFile(executorFile)));\n assertUniqueExecutorNames(executors);\n return executors;\n })();\n }\n const loaded = await loadPromise;\n // Files are loaded only once, but plugin executors registered by\n // loadPluginExecutorFiles() after that first load must reach callers\n // that re-invoke loadExecutors(), such as deployment planning.\n return loaded ?? (Object.keys(executors).length > 0 ? executors : undefined);\n },\n loadPluginExecutorFiles: async (filePaths: string[]) => {\n if (filePaths.length === 0) return;\n\n logger.newline();\n logger.log(\n `Loading ${styles.highlight(filePaths.length.toString())} plugin-generated executor files`,\n );\n\n for (const filePath of filePaths) {\n const executor = await loadExecutorForFile(filePath);\n if (executor) {\n // Track as plugin executor (plugin ID is extracted from file path)\n // File path format: .tailor/plugin/{executor-name}.ts\n pluginExecutors.push({\n executor,\n pluginId: \"plugin-generated\",\n sourceTableName: undefined,\n });\n }\n }\n assertUniqueExecutorNames(executors);\n },\n };\n}\n\n/**\n * Assert that every loaded executor has a unique name.\n * Executors are stored by source file, so two files declaring the same\n * `name` would otherwise silently share a single bundle cache entry.\n * @param executors - Loaded executors keyed by source file\n */\nfunction assertUniqueExecutorNames(executors: Record<string, Executor>): void {\n const seenNames = new Map<string, string>();\n for (const [file, executor] of Object.entries(executors)) {\n const relativePath = path.relative(process.cwd(), file);\n const existing = seenNames.get(executor.name);\n if (existing) {\n throw new Error(\n `Duplicate executor name \"${executor.name}\" found:\\n` +\n ` - ${existing}\\n` +\n ` - ${relativePath}\\n` +\n `Each executor must have a unique name.`,\n );\n }\n seenNames.set(executor.name, relativePath);\n }\n}\n"],"mappings":"6MAIA,MAAa,EAAgD,EAAE,OAC5D,GAAQ,OAAO,GAAQ,UAC1B,ECJa,EAAqB,oBAElC,IAAI,EAAa,EAQjB,SAAgB,oBAA2B,CACzC,GAAc,CAChB,CAMA,SAAgB,oBAAyC,CACvD,OAAO,IAAe,EAAI,IAAA,GAAY,OAAO,CAAU,CACzD,CASA,SAAgB,iBAAiB,EAAoD,CACnF,IAAM,EAAM,EAAc,CAAQ,EAC5B,EAAQ,mBAAmB,EAIjC,OAHI,GACF,EAAI,aAAa,IAAI,EAAoB,CAAK,EAEzC,OAAO,EAAI,KACpB,CC7BA,MAAM,GAA0B,CAAC,eAAgB,cAAc,EAQzD,EAAkB,IAAI,IAS5B,SAAgB,qBAAqB,EAAwB,EAA2B,CACtF,GAAI,EAAO,MAAM,SAAW,EAC1B,MAAO,CAAC,EAGV,IAAM,EAAW,aAAa,EAAQ,CAAO,EACvC,EAAsB,EAAO,MAAM,MAAO,GAAY,EAAK,WAAW,C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utorService};
@@ -16,6 +16,8 @@ type Resolver = {
16
16
  type: "string" | "boolean" | "date" | "enum" | "uuid" | "integer" | "float" | "decimal" | "datetime" | "time" | "nested";
17
17
  /** Field metadata configuration */
18
18
  metadata: {
19
+ /** Date value representation */
20
+ as?: "string" | "date" | undefined;
19
21
  /** Whether the field is required */
20
22
  required?: boolean | undefined;
21
23
  /** Whether the field is an array */
@@ -120,6 +120,27 @@ createResolver({
120
120
  });
121
121
  ```
122
122
 
123
+ ### Date Values
124
+
125
+ `t.date()` uses `YYYY-MM-DD` strings by default. Use `t.date({ as: "date" })` to work with JavaScript `Date` values in the resolver body and input validators:
126
+
127
+ ```typescript
128
+ createResolver({
129
+ name: "nextDay",
130
+ operation: "query",
131
+ input: { day: t.date({ as: "date" }) },
132
+ body: ({ input }) => {
133
+ input.day.setUTCDate(input.day.getUTCDate() + 1);
134
+ return input.day;
135
+ },
136
+ output: t.date({ as: "date" }),
137
+ });
138
+ ```
139
+
140
+ GraphQL still accepts and returns `YYYY-MM-DD` strings. The SDK converts input to a `Date` at midnight UTC and formats output using its UTC year, month, and day. Use UTC getters and setters for date arithmetic; local getters and setters depend on the runtime's timezone. Any time component in the returned `Date` is discarded according to UTC, so `new Date("2026-09-07T00:00:00+09:00")` returns `"2026-09-06"`.
141
+
142
+ This option also works in nested objects and with `array: true` or `optional: true`. Input must be a valid calendar date, and output must be a valid `Date` with a UTC year between 0000 and 9999. Both deployed resolvers and `tailor function run` perform these conversions.
143
+
123
144
  ### Custom Type Name (`typeName`)
124
145
 
125
146
  Enum and nested object fields in input/output schemas generate protobuf type names automatically (e.g., `{ResolverName}{FieldName}`). Use `typeName()` to set a custom name:
@@ -115,7 +115,7 @@ A typical change cycle:
115
115
 
116
116
  ### Warnings and optional migration scripts
117
117
 
118
- Some non-breaking changes can still cause data loss — most notably removing a field (`field_removed`) or removing a table (`table_removed`). `migration generate` reports these as **warnings**:
118
+ Some non-breaking changes can still cause data loss — most notably removing a field (`field_removed`), removing a table (`table_removed`), or removing a member inside a nested field (reported on the nested field's `field_modified` change). `migration generate` reports these as **warnings**:
119
119
 
120
120
  ```
121
121
  Warning: data loss possible:
@@ -164,7 +164,15 @@ During deploy, the pre-migration phase keeps the old field and adds the new fiel
164
164
 
165
165
  If you decline the prompt (or confirm the removal with `--drop`), the change stays a plain removal + addition with the usual data-loss warning.
166
166
 
167
- Renaming a member inside a **nested field** is not detected, and it is quieter: `User.address.zip` → `zipCode` becomes a single `field_modified` on `address` with no breaking change, no warning, and no generated script, so the member's values are not carried over. Copy them with a custom `tailordb migration script` if they must survive.
167
+ Renaming a member inside a **nested field** is not detected as a rename: `User.address.zip` → `zipCode` becomes a single `field_modified` on `address`, so no `field_renamed` change is recorded and no copy script is generated. The removed member is reported as a data-loss warning instead, which `migration validate --strict` picks up like any other warning; when a compatible member was added at the same level, the warning names it as a possible rename target:
168
+
169
+ ```
170
+ Warning: data loss possible:
171
+
172
+ - User.address.zip: Nested member removed (existing values will no longer be accessible through the schema). Possibly renamed to zipCode: nested renames are not detected, so copy its values with a migration script if it was renamed
173
+ ```
174
+
175
+ To carry the values over, add a custom `tailordb migration script` to the migration. The pre-migration phase keeps the removed member on the nested field until the script finishes, exactly like a removed top-level field, so the script can read `zip` and write `zipCode`. Nested fields reach the script as objects, so the copy rewrites the whole `address` value; keep the old member in what you write, because it is still part of the schema until the post-migration phase drops it. Declare the new member as optional: the platform rejects a nested member that is required while existing records lack it, and nested member constraints are not relaxed during the pre-migration phase.
168
176
 
169
177
  ### Renaming a table
170
178
 
@@ -544,7 +552,7 @@ When you run `tailor deploy`, the SDK detects pending migrations (anything past
544
552
 
545
553
  For each pending migration:
546
554
 
547
- 1. **Pre-migration**: Schema changes that would be breaking are applied in a relaxed form first. A verified in-place field type change keeps its complete previous field contract until Post-migration, including field and table-level hooks or validators changed by the same migration. Newly-required fields are added as optional; fields whose `optional → required` transition is breaking are temporarily kept optional. Fields that are being removed in this migration are temporarily kept on the table so that `migrate.ts` can still read them (for example, to `innerJoin` through a foreign key that is about to be dropped). For a renamed field, the old field is kept and the new field is added with its constraints relaxed, so the script can read the old field and write the new one. For a renamed table, the new table is created with its full constraints while the old table stays on the namespace until post-migration cleanup, so the script can copy rows between them. Breaking table-level index changes are relaxed the same way: a newly-added unique index is withheld, and an index gaining a unique constraint (or a unique index changing its field set) keeps its previous definition, so `migrate.ts` can resolve duplicates first. Non-breaking changes that are part of the same migration are also applied here.
555
+ 1. **Pre-migration**: Schema changes that would be breaking are applied in a relaxed form first. A verified in-place field type change keeps its complete previous field contract until Post-migration, including field and table-level hooks or validators changed by the same migration. Newly-required fields are added as optional; fields whose `optional → required` transition is breaking are temporarily kept optional. Fields that are being removed in this migration are temporarily kept on the table so that `migrate.ts` can still read them (for example, to `innerJoin` through a foreign key that is about to be dropped); members removed from a nested field are kept the same way. For a renamed field, the old field is kept and the new field is added with its constraints relaxed, so the script can read the old field and write the new one. For a renamed table, the new table is created with its full constraints while the old table stays on the namespace until post-migration cleanup, so the script can copy rows between them. Breaking table-level index changes are relaxed the same way: a newly-added unique index is withheld, and an index gaining a unique constraint (or a unique index changing its field set) keeps its previous definition, so `migrate.ts` can resolve duplicates first. Non-breaking changes that are part of the same migration are also applied here.
548
556
  2. **Script execution**: If `migrate.ts` exists on disk for this migration, it is bundled and sent to the platform via the script execution API and runs as the configured machine user inside a transaction. The script is hard-required for breaking changes (`diff.requiresMigrationScript`) — deploy fails if the file is missing, unless a `--no-script` acknowledgment was recorded (see [Breaking changes without a script](#breaking-changes-without-a-script)). It is also executed when present for warning-tier diffs — see [Warnings and optional migration scripts](#warnings-and-optional-migration-scripts).
549
557
  3. **Post-migration schema**: Required constraints and the target field definitions are applied. Do not assume that removing a field clears its underlying stored JSON value.
550
558
  4. **Checkpoint and cleanup**: The `sdk-migration` label is bumped to this migration's number, then removed GQL permissions and tables — including the old table left behind by a rename — are deleted. Advancing the checkpoint first prevents a failed checkpoint write from requiring the SDK to recreate irreversibly deleted records.
@@ -898,6 +906,20 @@ For genuinely different schemas across environments, prefer separate workspaces
898
906
  4. To force the remote schema back to a known snapshot, use `migration sync <N>` (see [`migration sync` Semantics](#migration-sync-semantics)).
899
907
  5. As a last resort in non-production environments, `--no-schema-check` skips both checks. Do not use this as a routine workaround.
900
908
 
909
+ ### "Remote migration checkpoint is not in the local migration history" error
910
+
911
+ **Cause:** The deployed namespace's checkpoint refers to a migration number, or a migration history ID, that the local `migrations/` directory no longer has a record of. This is a different code path from schema drift above: it fires before any schema comparison, because the CLI cannot even locate the remote's recorded position in the local history.
912
+
913
+ One specific cause is a `migration rebaseline` run on a different environment while this one had not yet caught up to the latest pre-rebaseline migration. `migration rebaseline` requires every other environment to already be at the latest migration (see [Re-baselining a deployed migration history](#re-baselining-a-deployed-migration-history)), but the CLI only verifies the one workspace it runs against. If this environment was behind, the error message names the migration this environment must reach (the migration every environment was required to be at before the rebaseline) alongside the migration it is actually at.
914
+
915
+ **Resolution (fell behind before a rebaseline):**
916
+
917
+ 1. Restore the pre-rebaseline `migrations/` directory from git history — check out the commit before `migration rebaseline` ran. Re-baselining removes migration files after `0000` from the working tree but Git history retains everything that was committed.
918
+ 2. Deploy this environment against that restored history until its checkpoint reaches the migration named in the error, running any `migrate.ts` scripts it still needs.
919
+ 3. Switch back to the current (rebaselined) migration files and deploy again. The remote schema now matches the new baseline, so this deploy offers the automatic checkpoint reset to `0000` under the new history ID.
920
+
921
+ **Resolution (any other cause):** Run `tailor tailordb migration status` to compare local and remote, or pull the latest migration files if your checkout is stale.
922
+
901
923
  ### "Invalid schema snapshot" or "Invalid migration diff" error
902
924
 
903
925
  **Cause:** A `schema.json` or `diff.json` file in the `migrations/` directory is corrupted or does not match the expected structure. Merge conflicts left in these files are a common cause.
@@ -116,6 +116,8 @@ Negative values follow the same rule based on absolute magnitude:
116
116
 
117
117
  ### Enum Fields
118
118
 
119
+ Enum fields must define at least one allowed value. Empty arrays are rejected during `tailor deploy` and `tailor tailordb migration generate`.
120
+
119
121
  ```typescript
120
122
  db.enum(["red", "green", "blue"]);
121
123
  db.enum([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -158,13 +158,13 @@
158
158
  "@inquirer/core": "12.0.1",
159
159
  "@inquirer/prompts": "8.7.0",
160
160
  "@jridgewell/trace-mapping": "0.3.31",
161
- "@napi-rs/keyring": "1.3.0",
161
+ "@napi-rs/keyring": "2.0.0",
162
162
  "@opentelemetry/api": "1.9.1",
163
163
  "@opentelemetry/exporter-trace-otlp-proto": "0.221.0",
164
164
  "@opentelemetry/resources": "2.10.0",
165
165
  "@opentelemetry/sdk-trace-node": "2.10.0",
166
166
  "@opentelemetry/semantic-conventions": "1.43.0",
167
- "@oxc-project/types": "0.147.0",
167
+ "@oxc-project/types": "0.148.0",
168
168
  "@secretlint/core": "13.0.5",
169
169
  "@secretlint/secretlint-rule-preset-recommend": "13.0.5",
170
170
  "@standard-schema/spec": "1.1.0",
@@ -185,7 +185,7 @@
185
185
  "kysely": "0.29.5",
186
186
  "mime-types": "3.0.2",
187
187
  "open": "11.0.2",
188
- "oxc-parser": "0.147.0",
188
+ "oxc-parser": "0.148.0",
189
189
  "p-limit": "7.3.2",
190
190
  "pathe": "2.0.3",
191
191
  "pgsql-ast-parser": "12.0.2",
@@ -210,8 +210,8 @@
210
210
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
211
211
  "@vitest/coverage-v8": "4.1.11",
212
212
  "eslint-plugin-zod": "4.12.0",
213
- "oxfmt": "0.65.0",
214
- "oxlint": "1.80.0",
213
+ "oxfmt": "0.66.0",
214
+ "oxlint": "1.81.0",
215
215
  "oxlint-tsgolint": "7.0.2001",
216
216
  "sonda": "0.14.0",
217
217
  "tsdown": "0.22.14",
@@ -1 +0,0 @@
1
- import{n as e,t}from"./application-D3HlhR3i.mjs";export{t as defineApplication,e as generatePluginFilesIfNeeded};