@tailor-platform/sdk 2.13.1 → 2.14.1

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 (259) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/application-BWOMdL3D.mjs +1 -0
  3. package/dist/{application-D3HlhR3i.mjs → application-CfevPO-k.mjs} +21 -17
  4. package/dist/application-CfevPO-k.mjs.map +1 -0
  5. package/dist/cli/commands/api/api-call.d.mts +4 -5
  6. package/dist/cli/commands/deploy/config-id-injector.d.mts +3 -4
  7. package/dist/cli/commands/deploy/deploy.d.mts +3 -4
  8. package/dist/cli/commands/deploy/function-registry-types.d.mts +2 -3
  9. package/dist/cli/commands/executor/get.d.mts +3 -4
  10. package/dist/cli/commands/executor/jobs.d.mts +10 -11
  11. package/dist/cli/commands/executor/list.d.mts +3 -4
  12. package/dist/cli/commands/executor/transform.d.mts +6 -7
  13. package/dist/cli/commands/executor/trigger.d.mts +4 -5
  14. package/dist/cli/commands/executor/webhook.d.mts +4 -5
  15. package/dist/cli/commands/function/get.d.mts +3 -4
  16. package/dist/cli/commands/function/list.d.mts +3 -4
  17. package/dist/cli/commands/function/transform.d.mts +2 -3
  18. package/dist/cli/commands/generate/options.d.mts +2 -3
  19. package/dist/cli/commands/generate/seed/bundler.d.mts +3 -4
  20. package/dist/cli/commands/generate/service.d.mts +2 -3
  21. package/dist/cli/commands/machineuser/list.d.mts +4 -5
  22. package/dist/cli/commands/machineuser/token.d.mts +4 -5
  23. package/dist/cli/commands/oauth2client/get.d.mts +3 -4
  24. package/dist/cli/commands/oauth2client/list.d.mts +3 -4
  25. package/dist/cli/commands/oauth2client/transform.d.mts +3 -4
  26. package/dist/cli/commands/organization/folder/create.d.mts +3 -4
  27. package/dist/cli/commands/organization/folder/delete.d.mts +3 -4
  28. package/dist/cli/commands/organization/folder/get.d.mts +3 -4
  29. package/dist/cli/commands/organization/folder/list.d.mts +3 -4
  30. package/dist/cli/commands/organization/folder/update.d.mts +3 -4
  31. package/dist/cli/commands/organization/get.d.mts +3 -4
  32. package/dist/cli/commands/organization/list.d.mts +3 -4
  33. package/dist/cli/commands/organization/transform.d.mts +5 -6
  34. package/dist/cli/commands/organization/tree.d.mts +3 -4
  35. package/dist/cli/commands/organization/update.d.mts +3 -4
  36. package/dist/cli/commands/remove.d.mts +3 -4
  37. package/dist/cli/commands/show.d.mts +6 -7
  38. package/dist/cli/commands/staticwebsite/deploy.d.mts +3 -4
  39. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +3 -4
  40. package/dist/cli/commands/tailordb/migrate/config.d.mts +3 -4
  41. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +35 -35
  42. package/dist/cli/commands/tailordb/migrate/generate.d.mts +3 -4
  43. package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +3 -4
  44. package/dist/cli/commands/tailordb/migrate/snapshot-comparison.d.mts +4 -5
  45. package/dist/cli/commands/tailordb/migrate/snapshot-files.d.mts +13 -14
  46. package/dist/cli/commands/tailordb/migrate/snapshot-local.d.mts +2 -3
  47. package/dist/cli/commands/tailordb/migrate/snapshot-migrations.d.mts +2 -3
  48. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +21 -22
  49. package/dist/cli/commands/tailordb/migrate/types.d.mts +2 -3
  50. package/dist/cli/commands/tailordb/truncate.d.mts +3 -4
  51. package/dist/cli/commands/workflow/executions.d.mts +8 -9
  52. package/dist/cli/commands/workflow/get.d.mts +3 -4
  53. package/dist/cli/commands/workflow/list.d.mts +3 -4
  54. package/dist/cli/commands/workflow/resume.d.mts +4 -5
  55. package/dist/cli/commands/workflow/start.d.mts +5 -6
  56. package/dist/cli/commands/workflow/status.d.mts +3 -4
  57. package/dist/cli/commands/workflow/transform.d.mts +5 -6
  58. package/dist/cli/commands/workflow/wait.d.mts +3 -4
  59. package/dist/cli/commands/workflow/waiter.d.mts +3 -4
  60. package/dist/cli/commands/workspace/app/health.d.mts +3 -4
  61. package/dist/cli/commands/workspace/app/list.d.mts +3 -4
  62. package/dist/cli/commands/workspace/app/transform.d.mts +3 -4
  63. package/dist/cli/commands/workspace/create.d.mts +3 -4
  64. package/dist/cli/commands/workspace/delete.d.mts +3 -4
  65. package/dist/cli/commands/workspace/get.d.mts +3 -4
  66. package/dist/cli/commands/workspace/list.d.mts +3 -4
  67. package/dist/cli/commands/workspace/restore.d.mts +3 -4
  68. package/dist/cli/commands/workspace/transform.d.mts +3 -4
  69. package/dist/cli/commands/workspace/user/invite.d.mts +3 -4
  70. package/dist/cli/commands/workspace/user/list.d.mts +3 -4
  71. package/dist/cli/commands/workspace/user/remove.d.mts +3 -4
  72. package/dist/cli/commands/workspace/user/transform.d.mts +2 -3
  73. package/dist/cli/commands/workspace/user/update.d.mts +3 -4
  74. package/dist/cli/lib.mjs +1 -1
  75. package/dist/cli/lib.mjs.map +1 -1
  76. package/dist/cli/main.d.mts +2 -3
  77. package/dist/cli/main.mjs +43 -41
  78. package/dist/cli/main.mjs.map +1 -1
  79. package/dist/cli/query/index.d.mts +2 -3
  80. package/dist/cli/shared/args.d.mts +11 -12
  81. package/dist/cli/shared/beta.d.mts +2 -3
  82. package/dist/cli/shared/client.d.mts +4 -5
  83. package/dist/cli/shared/command.d.mts +2 -3
  84. package/dist/cli/shared/config-loader.d.mts +5 -6
  85. package/dist/cli/shared/config.d.mts +2 -3
  86. package/dist/cli/shared/context.d.mts +3 -4
  87. package/dist/cli/shared/error-json.d.mts +4 -5
  88. package/dist/cli/shared/logger.d.mts +7 -8
  89. package/dist/cli/shared/prompt.d.mts +7 -8
  90. package/dist/cli/shared/readonly-guard.d.mts +2 -3
  91. package/dist/cli/shared/script-executor.d.mts +7 -8
  92. package/dist/cli/shared/seed-chunker.d.mts +5 -6
  93. package/dist/cli/shared/seed-context.d.mts +5 -5
  94. package/dist/cli/shared/tailordb-namespaces.d.mts +5 -6
  95. package/dist/cli/shared/type-generator.d.mts +2 -3
  96. package/dist/cli/shared/workspace-name.d.mts +2 -3
  97. package/dist/completion/zsh-worker.zsh +1 -1
  98. package/dist/configure/config/index.d.mts +3 -4
  99. package/dist/configure/config/types.d.mts +14 -15
  100. package/dist/configure/index.d.mts +10 -10
  101. package/dist/configure/index.mjs +1 -1
  102. package/dist/configure/index.mjs.map +1 -1
  103. package/dist/configure/services/aigateway/index.d.mts +2 -2
  104. package/dist/configure/services/aigateway/types.d.mts +4 -5
  105. package/dist/configure/services/auth/index.d.mts +3 -3
  106. package/dist/configure/services/auth/types.d.mts +24 -25
  107. package/dist/configure/services/executor/executor.d.mts +3 -4
  108. package/dist/configure/services/executor/operation.d.mts +6 -7
  109. package/dist/configure/services/executor/trigger/event.d.mts +56 -57
  110. package/dist/configure/services/executor/trigger/index.d.mts +2 -2
  111. package/dist/configure/services/executor/trigger/schedule.d.mts +4 -5
  112. package/dist/configure/services/executor/trigger/webhook.d.mts +8 -9
  113. package/dist/configure/services/http-adapter/http-adapter.d.mts +12 -13
  114. package/dist/configure/services/idp/index.d.mts +2 -2
  115. package/dist/configure/services/idp/permission.d.mts +4 -5
  116. package/dist/configure/services/idp/types.d.mts +5 -6
  117. package/dist/configure/services/resolver/permission.d.mts +4 -5
  118. package/dist/configure/services/resolver/resolver.d.mts +3 -4
  119. package/dist/configure/services/resolver/types.d.mts +2 -3
  120. package/dist/configure/services/secrets/index.d.mts +3 -3
  121. package/dist/configure/services/secrets/types.d.mts +3 -4
  122. package/dist/configure/services/staticwebsite/index.d.mts +2 -2
  123. package/dist/configure/services/staticwebsite/types.d.mts +3 -4
  124. package/dist/configure/services/tailordb/permission.d.mts +6 -7
  125. package/dist/configure/services/tailordb/schema.d.mts +8 -9
  126. package/dist/configure/services/tailordb/types.d.mts +25 -26
  127. package/dist/configure/services/workflow/execution-policy.d.mts +3 -3
  128. package/dist/configure/services/workflow/execution-policy.types.d.mts +8 -9
  129. package/dist/configure/services/workflow/job.d.mts +4 -5
  130. package/dist/configure/services/workflow/wait-point.d.mts +5 -6
  131. package/dist/configure/services/workflow/workflow.d.mts +4 -4
  132. package/dist/configure/types/aigateway-name.d.mts +3 -4
  133. package/dist/configure/types/auth-namespace-name.d.mts +3 -4
  134. package/dist/configure/types/connection-name.d.mts +3 -4
  135. package/dist/configure/types/field.d.mts +3 -4
  136. package/dist/configure/types/field.types.d.mts +18 -12
  137. package/dist/configure/types/idp-name.d.mts +3 -4
  138. package/dist/configure/types/permission-operand.types.d.mts +7 -8
  139. package/dist/configure/types/type.d.mts +3 -4
  140. package/dist/date-DrUO8rOJ.mjs +2 -0
  141. package/dist/date-DrUO8rOJ.mjs.map +1 -0
  142. package/dist/kysely/index.d.mts +18 -18
  143. package/dist/parser/service/idp/types.d.mts +2 -3
  144. package/dist/parser/service/tailordb/type-source.d.mts +2 -3
  145. package/dist/parser/service/tailordb/types.d.mts +13 -14
  146. package/dist/plugin/builtin/enum-constants/index.d.mts +3 -4
  147. package/dist/plugin/builtin/file-utils/index.d.mts +3 -4
  148. package/dist/plugin/builtin/kysely-type/index.d.mts +4 -5
  149. package/dist/plugin/builtin/seed/index.d.mts +4 -5
  150. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +2 -3
  151. package/dist/plugin/get-generated-table.d.mts +2 -3
  152. package/dist/plugin/index.mjs +1 -1
  153. package/dist/plugin/index.mjs.map +1 -1
  154. package/dist/plugin/types.d.mts +29 -29
  155. package/dist/plugin/with-context.d.mts +9 -10
  156. package/dist/register-ts-hook-DZ1Kpt4s.mjs +642 -0
  157. package/dist/register-ts-hook-DZ1Kpt4s.mjs.map +1 -0
  158. package/dist/runtime/aigateway.d.mts +4 -5
  159. package/dist/runtime/authconnection.d.mts +3 -4
  160. package/dist/runtime/context.d.mts +6 -7
  161. package/dist/runtime/date.d.mts +16 -0
  162. package/dist/runtime/field-parse.d.mts +2 -3
  163. package/dist/runtime/file.d.mts +14 -15
  164. package/dist/runtime/globals.d.mts +2 -1
  165. package/dist/runtime/iconv.d.mts +5 -6
  166. package/dist/runtime/idp.d.mts +14 -15
  167. package/dist/runtime/index.d.mts +8 -7
  168. package/dist/runtime/index.mjs +1 -1
  169. package/dist/runtime/logger.d.mts +10 -11
  170. package/dist/runtime/secretmanager.d.mts +3 -4
  171. package/dist/runtime/types.d.mts +7 -8
  172. package/dist/runtime/workflow.d.mts +7 -8
  173. package/dist/schema-DMlLMsWA.mjs +2 -0
  174. package/dist/schema-DMlLMsWA.mjs.map +1 -0
  175. package/dist/seed/index.d.mts +3 -3
  176. package/dist/service-7SCy2bhm.mjs +7 -0
  177. package/dist/service-7SCy2bhm.mjs.map +1 -0
  178. package/dist/service-CWFQ8EVo.mjs +1 -0
  179. package/dist/shared/src/color.d.mts +2 -3
  180. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +21 -22
  181. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +2 -3
  182. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +35 -36
  183. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +6 -7
  184. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +229 -230
  185. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +40 -41
  186. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +9 -10
  187. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +3 -4
  188. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +45 -46
  189. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +24 -25
  190. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +17 -18
  191. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +29 -30
  192. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +8 -9
  193. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +2 -3
  194. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +37 -38
  195. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +13 -14
  196. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +19 -20
  197. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +2 -3
  198. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +25 -26
  199. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +59 -60
  200. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +10 -11
  201. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +7 -8
  202. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +37 -38
  203. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +4 -5
  204. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +6 -7
  205. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +21 -22
  206. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +3 -4
  207. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +50 -51
  208. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +4 -5
  209. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +74 -75
  210. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +35 -36
  211. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +41 -42
  212. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +11 -12
  213. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +97 -98
  214. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +11 -12
  215. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +209 -210
  216. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +24 -25
  217. package/dist/types/aigateway.generated.d.mts +3 -4
  218. package/dist/types/app-config.generated.d.mts +2 -3
  219. package/dist/types/auth-connection.generated.d.mts +3 -4
  220. package/dist/types/auth.generated.d.mts +15 -16
  221. package/dist/types/executor.generated.d.mts +26 -27
  222. package/dist/types/helpers.d.mts +15 -13
  223. package/dist/types/http-adapter.generated.d.mts +2 -3
  224. package/dist/types/idp.generated.d.mts +7 -8
  225. package/dist/types/resolver.generated.d.mts +6 -5
  226. package/dist/types/secrets.generated.d.mts +3 -4
  227. package/dist/types/staticwebsite.generated.d.mts +3 -4
  228. package/dist/types/tailordb.generated.d.mts +7 -8
  229. package/dist/types/workflow.generated.d.mts +3 -4
  230. package/dist/utils/test/index.d.mts +3 -4
  231. package/dist/vitest/index.d.mts +2 -2
  232. package/dist/vitest/mock-kysely.d.mts +4 -5
  233. package/dist/vitest/mocks/aigateway.d.mts +3 -4
  234. package/dist/vitest/mocks/authconnection.d.mts +3 -4
  235. package/dist/vitest/mocks/file.d.mts +3 -4
  236. package/dist/vitest/mocks/iconv.d.mts +3 -4
  237. package/dist/vitest/mocks/idp.d.mts +3 -4
  238. package/dist/vitest/mocks/logger.d.mts +3 -4
  239. package/dist/vitest/mocks/secretmanager.d.mts +3 -4
  240. package/dist/vitest/mocks/tailordb-pglite.d.mts +4 -5
  241. package/dist/vitest/mocks/tailordb.d.mts +6 -7
  242. package/dist/vitest/mocks/workflow.d.mts +2 -3
  243. package/dist/vitest/pglite-kysely.d.mts +5 -6
  244. package/dist/vitest/setup.d.mts +6 -7
  245. package/dist/vitest/workflow-local.d.mts +5 -6
  246. package/docs/services/idp.md +6 -3
  247. package/docs/services/resolver.md +21 -0
  248. package/docs/services/tailordb-migration.md +25 -3
  249. package/docs/services/tailordb.md +2 -0
  250. package/package.json +13 -13
  251. package/dist/application-BFTkaW6X.mjs +0 -1
  252. package/dist/application-D3HlhR3i.mjs.map +0 -1
  253. package/dist/register-ts-hook-BJmGCQAA.mjs +0 -642
  254. package/dist/register-ts-hook-BJmGCQAA.mjs.map +0 -1
  255. package/dist/schema-6d_OHyZf.mjs +0 -2
  256. package/dist/schema-6d_OHyZf.mjs.map +0 -1
  257. package/dist/service-BzsSm2f6.mjs +0 -7
  258. package/dist/service-BzsSm2f6.mjs.map +0 -1
  259. package/dist/service-CmwD9bwv.mjs +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-DMlLMsWA.mjs","names":["parseInternal","parseFieldInternal"],"sources":["../src/runtime/field-parse.ts","../src/configure/types/field.ts","../src/configure/services/tailordb/schema.ts"],"sourcesContent":["import { formatDate } from \"./date\";\nimport type { FieldMetadata, TailorFieldType } from \"#/configure/types/field.types\";\nimport type { TailorPrincipal } from \"#/runtime/types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nconst regex = {\n uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n date: /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/,\n time: /^(?<hour>[01]\\d|2[0-3]):(?<minute>[0-5]\\d)$/,\n datetime:\n /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})[Tt](?<hour>[01]\\d|2[0-3]):(?<minute>[0-5]\\d):(?<second>[0-5]\\d|60)(\\.(?<fraction>\\d+))?(?<offset>[Zz]|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$/,\n decimal: /^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/,\n} as const;\n\nexport type FieldParseArgs = {\n value: unknown;\n data: unknown;\n invoker: TailorPrincipal | null;\n};\n\nexport type FieldParseInternalArgs = {\n value: unknown;\n data: unknown;\n invoker: TailorPrincipal | null;\n pathArray: string[];\n};\n\nexport type FieldRuntime<T extends TailorFieldType = TailorFieldType> = {\n readonly type: T;\n readonly fields: Record<string, FieldRuntime>;\n _metadata: FieldMetadata;\n};\n\ntype FieldParseRuntimeArgs<T extends TailorFieldType> = FieldParseInternalArgs & {\n field: FieldRuntime<T>;\n};\n\ntype FieldValidationArgs<T extends TailorFieldType> = FieldParseRuntimeArgs<T> & {\n issues: StandardSchemaV1.Issue[];\n};\n\nfunction validateBaseValue<T extends TailorFieldType>(args: FieldValidationArgs<T>): boolean {\n const { field, value, pathArray, issues } = args;\n const path = pathArray.length > 0 ? pathArray : undefined;\n const initialIssueCount = issues.length;\n\n switch (field.type) {\n case \"string\":\n if (typeof value !== \"string\") {\n issues.push({\n message: `Expected a string: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"integer\":\n if (typeof value !== \"number\" || !Number.isInteger(value)) {\n issues.push({\n message: `Expected an integer: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"float\":\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n issues.push({\n message: `Expected a number: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"boolean\":\n if (typeof value !== \"boolean\") {\n issues.push({\n message: `Expected a boolean: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"uuid\":\n if (typeof value !== \"string\" || !regex.uuid.test(value)) {\n issues.push({\n message: `Expected a valid UUID: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"date\":\n if (typeof value !== \"string\" || !regex.date.test(value)) {\n issues.push({\n message: `Expected to match \"yyyy-MM-dd\" format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"datetime\":\n if (typeof value !== \"string\" || !regex.datetime.test(value)) {\n issues.push({\n message: `Expected to match ISO format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"time\":\n if (typeof value !== \"string\" || !regex.time.test(value)) {\n issues.push({\n message: `Expected to match \"HH:mm\" format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"decimal\":\n if (typeof value !== \"string\" || !regex.decimal.test(value)) {\n issues.push({\n message: `Expected a decimal string: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"enum\":\n if (field._metadata.allowedValues) {\n const allowedValues = field._metadata.allowedValues.map((v) => v.value);\n if (typeof value !== \"string\" || !allowedValues.includes(value)) {\n issues.push({\n message: `Must be one of [${allowedValues.join(\", \")}]: received ${String(value)}`,\n path,\n });\n }\n }\n break;\n\n case \"nested\": {\n // Runtime input may not match the declared field type.\n // oxlint-disable typescript/no-unnecessary-condition\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value) ||\n value instanceof Date\n ) {\n // oxlint-enable typescript/no-unnecessary-condition\n issues.push({\n message: `Expected an object: received ${String(value)}`,\n path,\n });\n return false;\n }\n\n let nestedBaseValid = true;\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n const fieldValue = (value as Record<string, unknown>)[fieldName];\n if (\n !validateBaseField({\n ...args,\n field: nestedField,\n value: fieldValue,\n pathArray: pathArray.concat(fieldName),\n })\n ) {\n nestedBaseValid = false;\n }\n }\n return nestedBaseValid;\n }\n }\n\n return issues.length === initialIssueCount;\n}\n\nfunction validateCustomValue<T extends TailorFieldType>(\n args: FieldValidationArgs<T>,\n validateFns: NonNullable<FieldMetadata[\"validate\"]>,\n): void {\n const { value, pathArray, issues } = args;\n const path = pathArray.length > 0 ? pathArray : undefined;\n\n for (const fn of validateFns) {\n const result = fn({ value });\n if (typeof result === \"string\") {\n issues.push({\n message: result,\n path,\n });\n }\n }\n}\n\nfunction validateBaseField<T extends TailorFieldType>(args: FieldValidationArgs<T>): boolean {\n const { field, value, pathArray, issues } = args;\n const path = pathArray.length > 0 ? pathArray : undefined;\n\n const isNullOrUndefined = value === null || value === undefined;\n if (field._metadata.required && isNullOrUndefined) {\n issues.push({\n message: \"Required field is missing\",\n path,\n });\n return false;\n }\n\n if (!field._metadata.required && isNullOrUndefined) {\n return true;\n }\n\n let baseValid = true;\n if (field._metadata.array) {\n if (!Array.isArray(value)) {\n issues.push({\n message: \"Expected an array\",\n path,\n });\n return false;\n }\n\n for (let i = 0; i < value.length; i++) {\n if (\n !validateBaseValue({\n ...args,\n value: value[i],\n pathArray: pathArray.concat(`[${i}]`),\n })\n ) {\n baseValid = false;\n }\n }\n } else {\n baseValid = validateBaseValue(args);\n }\n\n return baseValid;\n}\n\nfunction validateCustomField<T extends TailorFieldType>(args: FieldValidationArgs<T>): void {\n const { field, value, pathArray } = args;\n if (value === null || value === undefined) {\n return;\n }\n\n if (field.type === \"nested\") {\n const records = field._metadata.array\n ? (value as Record<string, unknown>[])\n : [value as Record<string, unknown>];\n\n for (let i = 0; i < records.length; i++) {\n const record = records[i] as Record<string, unknown>;\n const recordPath = field._metadata.array ? pathArray.concat(`[${i}]`) : pathArray;\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n validateCustomField({\n ...args,\n field: nestedField,\n value: record[fieldName],\n pathArray: recordPath.concat(fieldName),\n });\n }\n }\n }\n\n const validateFns = field._metadata.validate;\n if (validateFns?.length) {\n validateCustomValue(args, validateFns);\n }\n}\n\nexport function parseInternal<T extends TailorFieldType, Output>(\n args: FieldParseRuntimeArgs<T>,\n): StandardSchemaV1.Result<Output> {\n let { value } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n const validationArgs = { ...args, issues };\n const baseValid = validateBaseField(validationArgs);\n if (baseValid) {\n value = deserializeDates(validationArgs);\n if (issues.length === 0) {\n validateCustomField({ ...validationArgs, value });\n }\n }\n if (issues.length > 0) {\n return { issues };\n }\n\n return { value: (value ?? null) as Output };\n}\n\nfunction deserializeDates(args: FieldValidationArgs<TailorFieldType>): unknown {\n const { field, value, issues, pathArray } = args;\n if (value === null || value === undefined) return value;\n const convert = (item: unknown, itemPath: string[]): unknown => {\n if (field.type === \"date\" && field._metadata.as === \"date\") {\n const date = new Date(`${item}T00:00:00.000Z`);\n if (!Number.isFinite(date.getTime()) || formatDate(date) !== item) {\n issues.push({\n message: `Expected a valid calendar date: received ${item}`,\n path: itemPath.length > 0 ? itemPath : undefined,\n });\n }\n return date;\n }\n if (field.type !== \"nested\") return item;\n const record = item as Record<string, unknown>;\n let result = record;\n for (const [key, child] of Object.entries(field.fields)) {\n const converted = deserializeDates({\n ...args,\n field: child,\n value: record[key],\n pathArray: itemPath.concat(key),\n });\n if (converted !== record[key]) {\n if (result === record) result = { ...record };\n Object.defineProperty(result, key, {\n value: converted,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n }\n }\n return result;\n };\n if (!field._metadata.array) return convert(value, pathArray);\n const values = value as unknown[];\n const converted = values.map((item, index) => convert(item, pathArray.concat(`[${index}]`)));\n return converted.every((item, index) => item === values[index]) ? value : converted;\n}\n\ntype ParseInputFieldsArgs = FieldParseArgs & {\n fields: Record<string, FieldRuntime>;\n};\n\n/**\n * Validate a value against a record of input fields, treating the record as a\n * single required object — the same code path deployed functions run via\n * `t.object(fields).parse(...)`, so local validation matches platform behavior.\n * @param args - Input field definitions plus the value, context data, and user\n * @returns Validation result\n */\nexport function parseInputFields(args: ParseInputFieldsArgs): StandardSchemaV1.Result<unknown> {\n const { fields, ...parseArgs } = args;\n return parseInternal({\n ...parseArgs,\n field: { type: \"nested\", fields, _metadata: { required: true } },\n pathArray: [],\n });\n}\n","import type { EnumValue } from \"#/configure/types/field.types\";\n\nexport type AllowedValues = readonly [string | EnumValue, ...(string | EnumValue)[]];\n\n/**\n * Normalize allowed values into EnumValue objects with descriptions.\n * @param values - Allowed values as strings or EnumValue objects\n * @returns Normalized allowed values\n */\nexport function mapAllowedValues(values: AllowedValues): EnumValue[] {\n return values.map((value) => {\n if (typeof value === \"string\") {\n return { value, description: \"\" };\n }\n return { ...value, description: value.description ?? \"\" };\n });\n}\n\nexport type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T\n ? T extends string\n ? T\n : T extends { value: infer K }\n ? K\n : never\n : never;\n","import { cloneDeep } from \"es-toolkit\";\nimport {\n type AllowedValues,\n type AllowedValuesOutput,\n mapAllowedValues,\n} from \"#/configure/types/field\";\nimport {\n parseInternal as parseFieldInternal,\n type FieldParseArgs,\n type FieldParseInternalArgs,\n} from \"#/runtime/field-parse\";\nimport { brandValue } from \"#/utils/brand\";\nimport type {\n FieldOptions,\n FieldOutput,\n TailorFieldType,\n TailorToTs,\n FieldValidateInput,\n} from \"#/configure/types/field.types\";\nimport type {\n PrecompiledScriptExprKey,\n PrecompiledScriptExprMap,\n} from \"#/parser/service/tailordb/types\";\nimport type { PluginAttachment, PluginConfigs, PluginFieldExtensions } from \"#/plugin/types\";\nimport type { InferredAttributes } from \"#/runtime/types\";\nimport type {\n output,\n InferFieldsOutput,\n IsUnion,\n TypeLevelError,\n UnionToIntersection,\n} from \"#/types/helpers\";\nimport type { RawPermissions } from \"#/types/tailordb.generated\";\nimport type { TailorTypeGqlPermission, TailorTypePermission } from \"./permission\";\nimport type {\n TailorDBField as TailorDBFieldBase,\n TailorDBType as TailorDBTypeBase,\n DBFieldMetadata,\n DefinedDBFieldMetadata,\n SerialConfig,\n IndexDef,\n TailorDBTypeMetadata,\n RawRelationConfig,\n RelationType,\n Hook,\n TypeHook,\n UpdateHookFn,\n ExcludeNestedDBFields,\n ExcludeHookedDBFields,\n ExcludeDefaultedDBFields,\n TypeFeatures,\n TypeValidateFn,\n} from \"./types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// Erased DB fields stay assignable across builder method-state changes.\n// oxlint-disable-next-line no-explicit-any\ntype AnyBuilderMethod = any;\n\nexport type TailorAnyDBField = Omit<\n TailorDBFieldBase<AnyBuilderMethod, AnyBuilderMethod>,\n \"fields\"\n> & {\n readonly fields: Record<string, AnyBuilderMethod>;\n _metadata: DBFieldMetadata;\n parse: AnyBuilderMethod;\n readonly typeName: TypeLevelError<string>;\n description: AnyBuilderMethod;\n relation: AnyBuilderMethod;\n index: AnyBuilderMethod;\n unique: AnyBuilderMethod;\n vector: AnyBuilderMethod;\n default: AnyBuilderMethod;\n hooks: AnyBuilderMethod;\n validate: AnyBuilderMethod;\n serial: AnyBuilderMethod;\n clone: AnyBuilderMethod;\n};\n\n// Helper alias\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyDBType = TailorDBType<any, any, any>;\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype DBFieldTypeNameMethod<Defined extends DefinedDBFieldMetadata> =\n IsAny<Defined> extends true\n ? TypeLevelError<string>\n : TypeLevelError<\"typeName cannot be used on TailorDB fields\">;\n\ntype WithDBFieldDescription<Defined> = Defined & { description: true };\ntype WithDBFieldRelation<Defined, S extends RelationType | RelationSelfConfig> = S extends\n | \"oneToOne\"\n | \"1-1\"\n ? Defined & { unique: true; index: true; relation: true }\n : S extends { type: \"oneToOne\" | \"1-1\" }\n ? Defined & { unique: true; index: true; relation: true }\n : Defined & { index: true; relation: true };\ntype WithDBFieldIndex<Defined> = Defined & { index: true };\ntype WithDBFieldUnique<Defined> = Defined & { unique: true; index: true };\ntype WithDBFieldVector<Defined> = Defined & { vector: true };\ntype WithDBFieldHooks<Defined, H> = Defined & {\n hooks: {\n create: H extends { create: unknown } ? true : false;\n update: H extends { update: unknown } ? true : false;\n };\n serial: false;\n};\ntype WithDBFieldDefault<Defined> = Defined & { default: true };\ntype WithDBFieldValidate<Defined> = Defined & { validate: true };\ntype WithDBFieldSerial<Defined> = Defined & {\n serial: true;\n hooks: { create: false; update: false };\n};\ntype WithDBFieldCloneOptions<Defined extends DefinedDBFieldMetadata, NewOpt extends FieldOptions> =\n IsAny<Defined> extends true\n ? Defined\n : Omit<Defined, \"array\"> & {\n array: NewOpt extends { array: true }\n ? true\n : NewOpt extends { array: false }\n ? false\n : Defined[\"array\"];\n };\ntype NonNullableDBFieldOutput<Output> = Exclude<Output, null>;\ntype DBFieldScalarOutput<Output> =\n NonNullableDBFieldOutput<Output> extends (infer Item)[] ? Item : NonNullableDBFieldOutput<Output>;\ntype DBFieldCloneArrayOutput<Output, NewOpt extends FieldOptions> = NewOpt extends {\n array: true;\n}\n ? DBFieldScalarOutput<Output>[]\n : NewOpt extends { array: false }\n ? DBFieldScalarOutput<Output>\n : NonNullableDBFieldOutput<Output>;\ntype DBFieldCloneOutput<Output, NewOpt extends FieldOptions> = NewOpt extends { optional: true }\n ? DBFieldCloneArrayOutput<Output, NewOpt> | null\n : NewOpt extends { optional: false }\n ? DBFieldCloneArrayOutput<Output, NewOpt>\n : null extends Output\n ? DBFieldCloneArrayOutput<Output, NewOpt> | null\n : DBFieldCloneArrayOutput<Output, NewOpt>;\ntype DBFieldCloneOptions<Defined extends DefinedDBFieldMetadata> = Omit<FieldOptions, \"array\"> & {\n array?: Defined extends { validate: unknown } ? Defined[\"array\"] : boolean;\n};\ntype InvalidValidatedArrayCloneKeys<\n Fields extends Record<string, TailorAnyDBField>,\n K extends keyof Fields,\n Opt extends FieldOptions,\n> = Opt extends { array: infer ArrayOption }\n ? {\n [P in K]: Fields[P] extends TailorDBField<infer Defined, infer _Output>\n ? Defined extends { validate: unknown }\n ? ArrayOption extends Defined[\"array\"]\n ? never\n : P\n : never\n : never;\n }[K]\n : never;\ntype DBFieldsCloneOptionsGuard<\n Fields extends Record<string, TailorAnyDBField>,\n K extends keyof Fields,\n Opt extends FieldOptions,\n> = [InvalidValidatedArrayCloneKeys<Fields, K, Opt>] extends [never]\n ? unknown\n : TypeLevelError<\"array cannot be changed on fields with custom validation\">;\ntype DefinedDBTypeMetadata = {\n hooks?: true;\n validate?: true;\n features?: true;\n indexes?: true;\n files?: true;\n permission?: true;\n gqlPermission?: true;\n description?: true;\n};\ntype WithDBTypeMetadata<\n Defined extends DefinedDBTypeMetadata,\n Key extends keyof DefinedDBTypeMetadata,\n> = Defined & Record<Key, true>;\ntype DBTypeDuplicateInputGuard<\n Defined extends DefinedDBTypeMetadata,\n Key extends keyof DefinedDBTypeMetadata,\n Input,\n Message extends string,\n> =\n IsAny<Defined> extends true\n ? Input\n : Defined extends Record<Key, unknown>\n ? TypeLevelError<Message>\n : Input;\ntype DBTypeDuplicateRestGuard<\n Defined extends DefinedDBTypeMetadata,\n Key extends keyof DefinedDBTypeMetadata,\n Input extends unknown[],\n Message extends string,\n> =\n IsAny<Defined> extends true\n ? Input\n : Defined extends Record<Key, unknown>\n ? [TypeLevelError<Message>, ...TypeLevelError<Message>[]]\n : Input;\ntype FileKeyConflictError<\n Fields extends Record<string, TailorAnyDBField>,\n User extends object,\n> = Partial<\n Record<\n keyof output<TailorDBType<Fields, User>> & string,\n TypeLevelError<\"file keys cannot use existing field names\">\n >\n>;\n// A plugin id with no PluginFieldExtensions entry contributes no keys — using\n// Record<never, never> (rather than Record<string, never>) keeps its `keyof`\n// empty so it can't spuriously collide with every existing field.\ntype PluginFieldExtensionFor<\n Fields extends Record<string, TailorAnyDBField>,\n Id extends string,\n IdConfig,\n> = Id extends keyof PluginFieldExtensions<keyof Fields & string, IdConfig>\n ? PluginFieldExtensions<keyof Fields & string, IdConfig>[Id]\n : Record<never, never>;\ntype PluginFieldExtensionsUnion<\n Fields extends Record<string, TailorAnyDBField>,\n Config extends Record<string, unknown>,\n> = {\n [Id in keyof Config & string]: PluginFieldExtensionFor<Fields, Id, Config[Id]>;\n}[keyof Config & string];\ntype AllExtensionKeys<Ext> = Ext extends unknown ? keyof Ext : never;\n// True when plugin `Id` has a PluginFieldExtensions entry whose type does not\n// extend Record<string, TailorAnyDBField> — e.g. a plugin author registered\n// a non-record shape by mistake. Checked ahead of PluginFieldConflict, since\n// `keyof` on a non-record shape (e.g. `keyof string`) would otherwise produce\n// nonsense candidate keys for the collision check.\n// `Id extends string` (not `keyof Config & string`) deliberately: a mapped\n// type's key variable, used inside a nested conditional branch and then\n// intersected with `string`, does not structurally satisfy a `keyof Config &\n// string`-constrained type parameter under `skipLibCheck: false` (verified\n// against a standalone consumer — TS2344 on both call sites otherwise, even\n// for code that never calls .plugin()). `Config[Id & keyof Config]` recovers\n// the same indexed-access result without that constraint.\ntype PluginFieldExtensionShapeError<\n Fields extends Record<string, TailorAnyDBField>,\n Config extends Record<string, unknown>,\n Id extends string,\n> =\n PluginFieldExtensionFor<Fields, Id, Config[Id & keyof Config]> extends Record<\n string,\n TailorAnyDBField\n >\n ? false\n : true;\n// True when the fields plugin `Id` would inject collide with an existing\n// field, or with a field injected by another plugin id attached in the same\n// .plugin() call.\ntype PluginFieldConflict<\n Fields extends Record<string, TailorAnyDBField>,\n Config extends Record<string, unknown>,\n Id extends string,\n FileKeys extends string,\n> = [\n AllExtensionKeys<PluginFieldExtensionFor<Fields, Id, Config[Id & keyof Config]>> &\n (\n | keyof Fields\n | FileKeys\n | AllExtensionKeys<PluginFieldExtensionsUnion<Fields, Omit<Config, Id>>>\n ),\n] extends [never]\n ? false\n : true;\n// Rejects a property on the caller's config literal for plugin `Id` that\n// isn't part of its registered PluginConfigs shape. `Config` is captured by\n// a `const` type parameter from the argument itself, so intersecting the\n// success branch with `PluginConfigs<...>[Id]` alone would not trigger\n// TypeScript's excess-property check — that check only fires when an object\n// literal is validated directly against a target type, not after its shape\n// has already been inferred through a generic parameter.\ntype PluginConfigExcessProps<\n Fields extends Record<string, TailorAnyDBField>,\n Config extends Record<string, unknown>,\n Id extends string,\n> = Record<\n Exclude<\n keyof Config[Id & keyof Config],\n keyof PluginConfigs<keyof Fields & string>[Id & keyof PluginConfigs<keyof Fields & string>]\n >,\n never\n>;\ntype PluginExtendedFields<\n Fields extends Record<string, TailorAnyDBField>,\n Config extends Record<string, unknown>,\n> =\n IsAny<Fields> extends true\n ? Fields\n : // For `Config = {}`, PluginFieldExtensionsUnion is `never`, and\n // UnionToIntersection<never> is `unknown` (not `never`), so this\n // correctly reduces to `Fields` — see the \"empty config\" test.\n Fields & UnionToIntersection<PluginFieldExtensionsUnion<Fields, Config>>;\n// Validates each key of the passed config object against PluginConfigs and\n// flags field-extension conflicts (see PluginFieldConflict above), keeping\n// type errors localized to the offending plugin id instead of requiring\n// every registered plugin id to be present (as a `P extends keyof\n// PluginConfigs<...>` generic would need, defeating inference of which\n// plugin ids were actually passed).\ntype PluginConfigGuard<\n Fields extends Record<string, TailorAnyDBField>,\n Config extends Record<string, unknown>,\n FileKeys extends string,\n> =\n IsAny<Fields> extends true\n ? unknown\n : {\n [K in keyof Config]: K extends keyof PluginConfigs<keyof Fields & string>\n ? // A union config (e.g. from a ternary passed directly as a plugin's\n // value) distributes through PluginFieldExtensionFor's conditional\n // and silently collapses the injected field to `never` once\n // intersected back together — reject it here instead, before it\n // can produce that confusing downstream error.\n IsUnion<Config[K]> extends true\n ? TypeLevelError<\"plugin config must be a single object literal, not a union — assign the config to a variable first if it comes from a conditional expression\">\n : PluginFieldExtensionShapeError<Fields, Config, K & string> extends true\n ? TypeLevelError<\"PluginFieldExtensions entry must be a Record<string, TailorAnyDBField>\">\n : PluginFieldConflict<Fields, Config, K & string, FileKeys> extends true\n ? TypeLevelError<\"plugin field extension conflicts with an existing field, a file key declared via .files(), or another plugin's field\">\n : PluginConfigs<keyof Fields & string>[K] &\n PluginConfigExcessProps<Fields, Config, K & string>\n : TypeLevelError<\"unknown plugin id\">;\n };\ntype DBFieldDescriptionFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = (description: string) => TailorDBField<WithDBFieldDescription<Defined>, Output, Nested>;\ntype DBFieldRelationFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = {\n <S extends RelationType, T extends TailorAnyDBType>(\n config: RelationConfig<S, T>,\n ): TailorDBField<WithDBFieldRelation<Defined, S>, Output, Nested>;\n <S extends RelationSelfConfig>(\n config: S,\n ): TailorDBField<WithDBFieldRelation<Defined, S>, Output, Nested>;\n};\ntype DBFieldIndexFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = () => TailorDBField<WithDBFieldIndex<Defined>, Output, Nested>;\ntype DBFieldUniqueFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = () => TailorDBField<WithDBFieldUnique<Defined>, Output, Nested>;\ntype DBFieldVectorFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = () => TailorDBField<WithDBFieldVector<Defined>, Output, Nested>;\ntype DBFieldHooksFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = <\n const H extends Hook<\n Output,\n Defined extends { default: true } ? Output | null | undefined : Output\n >,\n>(\n hooks: H,\n) => TailorDBField<WithDBFieldHooks<Defined, H>, Output, Nested>;\ntype DBFieldValidateFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = (\n ...validate: FieldValidateInput<Output>[]\n) => TailorDBField<WithDBFieldValidate<Defined>, Output, Nested>;\ntype DBFieldSerialFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = (\n config: SerialConfig<Defined[\"type\"] & (\"integer\" | \"string\")>,\n) => TailorDBField<WithDBFieldSerial<Defined>, Output, Nested>;\ntype DBFieldDescriptionMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldDescriptionFn<Defined, Output, Nested>\n : Defined extends { description: unknown }\n ? TypeLevelError<\".description() has already been set\">\n : DBFieldDescriptionFn<Defined, Output, Nested>;\ntype DBFieldRelationMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldRelationFn<Defined, Output, Nested>\n : Defined extends { relation: unknown }\n ? TypeLevelError<\".relation() has already been set\">\n : DBFieldRelationFn<Defined, Output, Nested>;\ntype DBFieldArrayCheck<A extends boolean, Ok, Msg extends string> = A extends true\n ? TypeLevelError<Msg>\n : Ok;\ntype DBFieldIndexMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldIndexFn<Defined, Output, Nested>\n : Defined extends { index: unknown }\n ? TypeLevelError<\".index() has already been set\">\n : DBFieldArrayCheck<\n Defined[\"array\"],\n DBFieldIndexFn<Defined, Output, Nested>,\n \"index cannot be set on array fields\"\n >;\ntype DBFieldUniqueMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldUniqueFn<Defined, Output, Nested>\n : Defined extends { unique: unknown }\n ? TypeLevelError<\".unique() has already been set\">\n : DBFieldArrayCheck<\n Defined[\"array\"],\n DBFieldUniqueFn<Defined, Output, Nested>,\n \"unique cannot be set on array fields\"\n >;\ntype DBFieldVectorMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldVectorFn<Defined, Output, Nested>\n : Defined extends { vector: unknown }\n ? TypeLevelError<\".vector() has already been set\">\n : Defined extends { type: \"string\"; array: false }\n ? DBFieldVectorFn<Defined, Output, Nested>\n : TypeLevelError<\"vector can only be set on non-array string fields\">;\ntype DBFieldHooksMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldHooksFn<Defined, Output, Nested>\n : Defined extends {\n serial: true;\n hooks: { create: false; update: false };\n }\n ? TypeLevelError<\"hooks cannot be set after serial\">\n : Defined extends {\n hooks: unknown;\n }\n ? TypeLevelError<\".hooks() has already been set\">\n : Defined extends { type: \"nested\" }\n ? TypeLevelError<\"hooks cannot be set on nested type fields\">\n : DBFieldHooksFn<Defined, Output, Nested>;\ntype DBFieldValidateMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldValidateFn<Defined, Output, Nested>\n : Defined extends { validate: unknown }\n ? TypeLevelError<\".validate() has already been set\">\n : DBFieldValidateFn<Defined, Output, Nested>;\ntype DBFieldSerialMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldSerialFn<Defined, Output, Nested>\n : Defined extends { serial: true }\n ? TypeLevelError<\".serial() has already been set\">\n : Defined extends { serial: false }\n ? TypeLevelError<\"serial cannot be set after hooks\">\n : IsAny<Output> extends true\n ? Defined extends { type: \"integer\" | \"string\"; array: false }\n ? DBFieldSerialFn<Defined, Output, Nested>\n : TypeLevelError<\"serial can only be set on non-array integer or string fields\">\n : null extends Output\n ? TypeLevelError<\"serial can only be set on non-array integer or string fields\">\n : Defined extends { type: \"integer\" | \"string\"; array: false }\n ? DBFieldSerialFn<Defined, Output, Nested>\n : TypeLevelError<\"serial can only be set on non-array integer or string fields\">;\ntype DBFieldDefaultFn<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> = (\n value: Output extends null ? NonNullable<Output> : Output,\n) => TailorDBField<WithDBFieldDefault<Defined>, Output, Nested>;\ntype DBFieldDefaultMethod<\n Defined extends DefinedDBFieldMetadata,\n Output,\n Nested extends Record<string, TailorAnyDBField>,\n> =\n IsAny<Defined> extends true\n ? DBFieldDefaultFn<Defined, Output, Nested>\n : Defined extends { default: unknown }\n ? TypeLevelError<\".default() has already been set\">\n : Defined extends { type: \"nested\" }\n ? TypeLevelError<\"default cannot be set on nested type fields\">\n : Defined extends { serial: true }\n ? TypeLevelError<\"default cannot be set on serial fields\">\n : null extends Output\n ? TypeLevelError<\"default cannot be set on optional fields\">\n : DBFieldDefaultFn<Defined, Output, Nested>;\n\n/**\n * Full TailorDBField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorDBField<\n Defined extends DefinedDBFieldMetadata = DefinedDBFieldMetadata,\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n // Nested object fields, so a `db.object()` field keeps the shape it was declared with.\n // Every builder method passes it through; dropping it here would erase the shape as\n // soon as one is chained.\n Nested extends Record<string, TailorAnyDBField> = Record<string, TailorAnyDBField>,\n> extends Omit<TailorDBFieldBase<Defined, Output, Nested>, \"fields\"> {\n readonly fields: Nested;\n _metadata: DBFieldMetadata;\n\n /**\n * Parse and validate a value against this field's validation rules\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n\n /**\n * typeName is not available on TailorDB fields.\n * Use typeName on pipeline fields (t.enum / t.object) instead.\n */\n typeName: DBFieldTypeNameMethod<Defined>;\n\n /**\n * Set a description for the field\n */\n description: DBFieldDescriptionMethod<Defined, Output, Nested>;\n\n /**\n * Define a relation to another table.\n */\n relation: DBFieldRelationMethod<Defined, Output, Nested>;\n\n /**\n * Add an index to the field\n */\n index: DBFieldIndexMethod<Defined, Output, Nested>;\n\n /**\n * Make the field unique (also adds an index)\n */\n unique: DBFieldUniqueMethod<Defined, Output, Nested>;\n\n /**\n * Enable vector search on the field (string type only)\n */\n vector: DBFieldVectorMethod<Defined, Output, Nested>;\n\n /**\n * Set a default value for the field on create. When the field is required,\n * this makes it optional in the Create input — the default fills in when\n * no value (or a nullish hook result) is provided.\n *\n * For datetime/date/time fields, pass `\"now\"` to use the operation timestamp.\n */\n default: DBFieldDefaultMethod<Defined, Output, Nested>;\n\n /**\n * Add hooks for create/update operations on this field.\n */\n hooks: DBFieldHooksMethod<Defined, Output, Nested>;\n\n /**\n * Add validation functions to the field.\n *\n * Validators receive `{ value, data, user }` and run after hooks and\n * built-in type validation; they are skipped when built-in validation\n * fails. For array fields, `value` is the complete array.\n */\n validate: DBFieldValidateMethod<Defined, Output, Nested>;\n\n /**\n * Configure serial/auto-increment behavior\n */\n serial: DBFieldSerialMethod<Defined, Output, Nested>;\n\n /**\n * Clone the field with optional overrides for field options.\n * The `array` option cannot change on fields with custom validation.\n */\n clone<const NewOpt extends DBFieldCloneOptions<Defined>>(\n options?: NewOpt,\n ): TailorDBField<\n WithDBFieldCloneOptions<Defined, NewOpt>,\n DBFieldCloneOutput<Output, NewOpt>,\n Nested\n >;\n}\n\n/**\n * Full TailorDBType interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorDBType<\n // oxlint-disable-next-line no-explicit-any\n Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributes,\n // oxlint-disable-next-line no-explicit-any\n Defined extends DefinedDBTypeMetadata = any,\n FileKeys extends string = never,\n> extends TailorDBTypeBase<Fields, User> {\n _description?: string;\n\n hooks(\n hook: DBTypeDuplicateInputGuard<\n Defined,\n \"hooks\",\n TypeHook<Fields>,\n \".hooks() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"hooks\">, FileKeys>;\n validate(\n fn: DBTypeDuplicateInputGuard<\n Defined,\n \"validate\",\n TypeValidateFn<Fields>,\n \".validate() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"validate\">, FileKeys>;\n features(\n features: DBTypeDuplicateInputGuard<\n Defined,\n \"features\",\n Omit<TypeFeatures, \"pluralForm\">,\n \".features() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"features\">, FileKeys>;\n indexes(\n ...indexes: DBTypeDuplicateRestGuard<\n Defined,\n \"indexes\",\n IndexDef<TailorDBType<Fields, User, Defined, FileKeys>>[],\n \".indexes() has already been set\"\n >\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"indexes\">, FileKeys>;\n files<const F extends string>(\n files: DBTypeDuplicateInputGuard<\n Defined,\n \"files\",\n Record<F, string> & FileKeyConflictError<Fields, User>,\n \".files() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"files\">, FileKeys | F>;\n permission<\n U extends object = User,\n P extends TailorTypePermission<U, output<TailorDBType<Fields, User, Defined>>> =\n TailorTypePermission<U, output<TailorDBType<Fields, User, Defined>>>,\n >(\n permission: DBTypeDuplicateInputGuard<\n Defined,\n \"permission\",\n P,\n \".permission() has already been set\"\n >,\n ): TailorDBType<Fields, U, WithDBTypeMetadata<Defined, \"permission\">, FileKeys>;\n gqlPermission<\n U extends object = User,\n P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>,\n >(\n permission: DBTypeDuplicateInputGuard<\n Defined,\n \"gqlPermission\",\n P,\n \".gqlPermission() has already been set\"\n >,\n ): TailorDBType<Fields, U, WithDBTypeMetadata<Defined, \"gqlPermission\">, FileKeys>;\n description(\n description: DBTypeDuplicateInputGuard<\n Defined,\n \"description\",\n string,\n \".description() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"description\">, FileKeys>;\n pickFields<K extends keyof Fields>(keys: K[]): Pick<Fields, K>;\n pickFields<K extends keyof Fields, const Opt extends FieldOptions>(\n keys: K[],\n options: Opt & DBFieldsCloneOptionsGuard<Fields, K, Opt>,\n ): {\n [P in K]: Fields[P] extends TailorDBField<infer D, infer O>\n ? TailorDBField<WithDBFieldCloneOptions<D, Opt>, DBFieldCloneOutput<O, Opt>>\n : never;\n };\n omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K>;\n plugin<const Config extends Record<string, unknown>>(\n config: Config & PluginConfigGuard<Fields, Config, FileKeys>,\n ): TailorDBType<PluginExtendedFields<Fields, Config>, User, Defined, FileKeys>;\n}\n\nexport type TailorDBInstance<\n // oxlint-disable-next-line no-explicit-any\n Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributes,\n // oxlint-disable-next-line no-explicit-any\n Defined extends DefinedDBTypeMetadata = any,\n FileKeys extends string = never,\n> = TailorDBType<Fields, User, Defined, FileKeys>;\n\ninterface RelationConfig<S extends RelationType, T extends TailorDBType> {\n type: S;\n toward:\n | {\n table: T;\n as?: string;\n key?: keyof T[\"fields\"] & string;\n type?: never;\n }\n | {\n /**\n * @deprecated since 2.6.0 — use `table` instead. codemod: v3/relation-toward-table\n */\n type: T;\n as?: string;\n key?: keyof T[\"fields\"] & string;\n table?: never;\n };\n backward?: string;\n}\n\n// Special config variant for self-referencing relations\ntype RelationSelfConfig = {\n type: RelationType;\n toward:\n | {\n table: \"self\";\n as?: string;\n key?: string;\n type?: never;\n }\n | {\n /**\n * @deprecated since 2.6.0 — use `table` instead. codemod: v3/relation-toward-table\n */\n type: \"self\";\n as?: string;\n key?: string;\n table?: never;\n };\n backward?: string;\n};\n\ntype DBFieldDefined<T extends TailorFieldType, Opt extends FieldOptions> = {\n type: T;\n array: Opt extends { array: true } ? true : false;\n};\ntype DBFieldOutput<\n T extends TailorFieldType,\n Opt extends FieldOptions,\n OutputBase = TailorToTs[T],\n> = FieldOutput<OutputBase, Opt>;\ntype TailorDBFieldInstance<\n T extends TailorFieldType,\n Opt extends FieldOptions,\n OutputBase = TailorToTs[T],\n> = TailorDBField<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;\ntype TailorDBFieldRuntimeInstance<\n T extends TailorFieldType,\n Opt extends FieldOptions,\n OutputBase = TailorToTs[T],\n> = TailorDBFieldRuntime<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;\ntype TailorDBFieldRuntime<Defined extends DefinedDBFieldMetadata, Output> = Omit<\n TailorDBFieldBase<Defined, Output>,\n \"fields\"\n> & {\n readonly fields: Record<string, TailorAnyDBField>;\n _metadata: DBFieldMetadata;\n description(description: string): object;\n typeName(typeName: string): object;\n validate(...validate: FieldValidateInput<Output>[]): object;\n relation(config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig): object;\n index(): object;\n unique(): object;\n vector(): object;\n default(value: unknown): object;\n hooks(hooks: Hook<Output>): object;\n serial(config: SerialConfig): object;\n clone(options?: FieldOptions): TailorDBFieldRuntime<DefinedDBFieldMetadata, AnyBuilderMethod>;\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n _setRawRelation(relation: RawRelationConfig): void;\n};\n\n/**\n * Creates a new TailorDBField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @returns A new TailorDBField\n */\nfunction createTailorDBField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n): TailorDBFieldInstance<T, TOptions, OutputBase>;\nfunction createTailorDBField<const T extends TailorFieldType, const TOptions extends FieldOptions>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n): object {\n return createTailorDBFieldRuntime(type, options, fields, values);\n}\n\nfunction createTailorDBFieldRuntime<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n): TailorDBFieldRuntimeInstance<T, TOptions, OutputBase> {\n type FieldValue = DBFieldOutput<T, TOptions, OutputBase>;\n type FieldType = TailorDBFieldRuntimeInstance<T, TOptions, OutputBase>;\n\n const _metadata: DBFieldMetadata = { required: true };\n let _rawRelation: RawRelationConfig | undefined;\n\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n\n function parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<FieldValue> {\n return parseFieldInternal<T, FieldValue>({\n ...args,\n field,\n });\n }\n\n function cloneWith(metadataUpdates: Partial<DBFieldMetadata>) {\n const cloned = field.clone();\n Object.assign(cloned._metadata, metadataUpdates);\n return cloned;\n }\n\n const field: FieldType = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as DBFieldDefined<T, TOptions>,\n _output: undefined as FieldValue,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n get rawRelation(): Readonly<RawRelationConfig> | undefined {\n return _rawRelation ? { ..._rawRelation, toward: { ..._rawRelation.toward } } : undefined;\n },\n\n description(description: string) {\n return cloneWith({ description });\n },\n\n typeName(typeName: string) {\n return cloneWith({ typeName });\n },\n\n validate(...validateInputs: FieldValidateInput<FieldValue>[]) {\n return cloneWith({ validate: validateInputs });\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldValue> {\n return parseInternal({\n value: args.value,\n data: args.data,\n invoker: args.invoker,\n pathArray: [],\n });\n },\n\n // TailorDBField specific methods\n relation(config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig) {\n const cloned = field.clone();\n // The public type is a nested union (RelationConfig | RelationSelfConfig,\n // each with a `{ table } | { type }` toward), which TS's \"in\" narrowing\n // can't discriminate across cleanly. Re-view it as the flat two-branch\n // shape it always is at runtime — the `table?: never` / `type?: never`\n // markers above already forbid both keys from being set together.\n const toward = config.toward as\n | { table: TailorDBType | \"self\" }\n | { type: TailorDBType | \"self\" };\n const towardTarget = \"table\" in toward ? toward.table : toward.type;\n const targetTable = towardTarget === \"self\" ? \"self\" : towardTarget.name;\n cloned._setRawRelation({\n type: config.type,\n toward: {\n table: targetTable,\n as: config.toward.as,\n key: config.toward.key,\n },\n backward: config.backward,\n });\n return cloned;\n },\n\n index() {\n return cloneWith({ index: true });\n },\n\n unique() {\n return cloneWith({ unique: true, index: true });\n },\n\n vector() {\n return cloneWith({ vector: true });\n },\n\n // oxlint-disable-next-line no-explicit-any\n default(value: any) {\n // oxlint-disable-next-line no-explicit-any\n return cloneWith({ default: value }) as any;\n },\n\n hooks(hooks: Hook<FieldValue>) {\n return cloneWith({ hooks });\n },\n\n serial(config: SerialConfig) {\n return cloneWith({ serial: config });\n },\n\n clone(cloneOptions?: FieldOptions) {\n if (\n this._metadata.validate?.length &&\n cloneOptions?.array !== undefined &&\n cloneOptions.array !== (this._metadata.array === true)\n ) {\n throw new Error(\"Cannot change the array option on a field with custom validation\");\n }\n\n // Deep clone nested object fields if present\n let clonedFields = fields;\n if (fields) {\n const cloned: Record<string, TailorAnyDBField> = {};\n for (const [key, field] of Object.entries(fields)) {\n cloned[key] = field.clone();\n }\n clonedFields = cloned;\n }\n\n // Create a new field with cloned configuration\n const clonedField = createTailorDBFieldRuntime(type, options, clonedFields, values);\n\n // Deep copy metadata using cloneDeep (preserves function references)\n Object.assign(clonedField._metadata, cloneDeep(this._metadata));\n\n // Apply new options if provided\n if (cloneOptions) {\n if (cloneOptions.optional !== undefined) {\n clonedField._metadata.required = !cloneOptions.optional;\n }\n if (cloneOptions.array !== undefined) {\n clonedField._metadata.array = cloneOptions.array;\n }\n }\n\n // Copy raw relation if exists\n if (_rawRelation) {\n clonedField._setRawRelation(cloneDeep(_rawRelation));\n }\n\n return clonedField;\n },\n\n _setRawRelation(relation: RawRelationConfig) {\n _rawRelation = relation;\n },\n };\n\n return field;\n}\n\nconst createField = createTailorDBField;\n\n/**\n * Create a UUID field.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example db.uuid()\n * @example db.uuid({ optional: true })\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"uuid\", options);\n}\n\n/**\n * Create a string field.\n * @param options - Field configuration options\n * @returns A string field\n * @example db.string()\n * @example db.string({ optional: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"string\", options);\n}\n\n/**\n * Create a boolean field.\n * Note: The method name is `bool` but creates a `boolean` type field.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example db.bool()\n * @example db.bool({ optional: true })\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"boolean\", options);\n}\n\n/**\n * Create an integer field.\n * @param options - Field configuration options\n * @returns An integer field\n * @example db.int()\n * @example db.int({ optional: true })\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"integer\", options);\n}\n\n/**\n * Create a float (decimal number) field.\n * @param options - Field configuration options\n * @returns A float field\n * @example db.float()\n * @example db.float({ optional: true })\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"float\", options);\n}\n\ninterface DecimalFieldOptions extends FieldOptions {\n scale?: number;\n}\n\n/**\n * Create a decimal field (stored as string for precision).\n * @param options - Field configuration options including optional scale (0-12)\n * @returns A decimal field\n * @example db.decimal()\n * @example db.decimal({ scale: 2 })\n * @example db.decimal({ scale: 2, optional: true })\n */\nfunction decimal<const Opt extends DecimalFieldOptions>(options?: Opt) {\n if (options?.scale !== undefined) {\n if (!Number.isInteger(options.scale) || options.scale < 0 || options.scale > 12) {\n throw new Error(\"scale must be an integer between 0 and 12\");\n }\n }\n const field = createField(\"decimal\", options);\n if (options?.scale !== undefined) {\n field._metadata.scale = options.scale;\n }\n return field;\n}\n\n/**\n * Create a date field (date only, no time component).\n * Format: \"yyyy-MM-dd\"\n * @param options - Field configuration options\n * @returns A date field\n * @example db.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"date\", options);\n}\n\n/**\n * Create a datetime field (date and time).\n * Format: ISO 8601, such as \"yyyy-MM-ddTHH:mm:ssZ\" or \"yyyy-MM-ddTHH:mm:ss+09:00\"\n * @param options - Field configuration options\n * @returns A datetime field\n * @example db.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"datetime\", options);\n}\n\n/**\n * Create a time field (time only, no date component).\n * Format: \"HH:mm\"\n * @param options - Field configuration options\n * @returns A time field\n * @example db.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"time\", options);\n}\n\n/**\n * Create an enum field with at least one allowed string value.\n * @param values - Array of allowed string values, or array of `{ value, description }` objects\n * @param options - Field configuration options\n * @returns An enum field\n * @example db.enum([\"active\", \"inactive\", \"suspended\"])\n * @example db.enum([\"small\", \"medium\", \"large\"], { optional: true })\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorDBField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\n/**\n * Create a nested object field with sub-fields.\n * @param fields - Record of nested field definitions\n * @param options - Field configuration options\n * @returns A nested object field\n * @example db.object({ street: db.string(), city: db.string(), zip: db.string() })\n * @example db.object({ name: db.string() }, { optional: true })\n */\nfunction object<\n const F extends Record<string, TailorAnyDBField> &\n ExcludeNestedDBFields<F> &\n ExcludeHookedDBFields<F> &\n ExcludeDefaultedDBFields<F>,\n const Opt extends FieldOptions,\n>(fields: F, options?: Opt) {\n return createField(\"nested\", options, fields) as unknown as TailorDBField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutput<F>, Opt>,\n F\n >;\n}\n\n/**\n * Creates a new TailorDBType instance.\n * @param name - Table name\n * @param fields - Field definitions\n * @param options - Table options\n * @param options.pluralForm - Optional plural form\n * @param options.description - Optional description\n * @returns A new TailorDBType\n */\nfunction createTailorDBType<\n // oxlint-disable-next-line no-explicit-any\n const Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributes,\n>(\n name: string,\n fields: Fields,\n options: { pluralForm?: string; description?: string },\n): TailorDBType<Fields, User, DefinedDBTypeMetadata> {\n let _description = options.description;\n let _settings: TypeFeatures = {};\n let _indexes: IndexDef<TailorDBType<Fields, User, DefinedDBTypeMetadata>>[] = [];\n const _permissions: RawPermissions = {};\n let _files: Record<string, string> = {};\n const _plugins: PluginAttachment[] = [];\n // oxlint-disable-next-line typescript/no-unsafe-function-type\n let _typeHook: { create?: Function; update?: Function } | undefined;\n // oxlint-disable-next-line typescript/no-unsafe-function-type\n let _typeValidate: Function | undefined;\n const _definedMethods = new Set<keyof DefinedDBTypeMetadata>();\n if (options.description !== undefined) {\n _definedMethods.add(\"description\");\n }\n\n function runMethodOnce<T>(method: keyof DefinedDBTypeMetadata, action: () => T): T {\n if (_definedMethods.has(method)) {\n throw new Error(`.${method}() has already been set`);\n }\n const result = action();\n _definedMethods.add(method);\n return result;\n }\n type TypeAfter<Key extends keyof DefinedDBTypeMetadata> = TailorDBType<\n Fields,\n User,\n WithDBTypeMetadata<DefinedDBTypeMetadata, Key>\n >;\n type TypeAfterUser<\n NextUser extends object,\n Key extends keyof DefinedDBTypeMetadata,\n > = TailorDBType<Fields, NextUser, WithDBTypeMetadata<DefinedDBTypeMetadata, Key>>;\n type TypeAfterPlugin<Config extends Record<string, unknown>> = TailorDBType<\n PluginExtendedFields<Fields, Config>,\n User,\n DefinedDBTypeMetadata\n >;\n\n if (options.pluralForm) {\n if (name === options.pluralForm) {\n throw new Error(`The name and the plural form must be different. name=${name}`);\n }\n _settings.pluralForm = options.pluralForm;\n }\n\n const dbType: TailorDBType<Fields, User, DefinedDBTypeMetadata> = {\n name,\n fields: { ...fields },\n _output: null as unknown as InferFieldsOutput<Fields>,\n _description,\n\n get metadata(): TailorDBTypeMetadata {\n // Convert indexes to the format expected by the manifest\n const indexes: Record<string, { fields: string[]; unique?: boolean }> = {};\n if (_indexes.length > 0) {\n _indexes.forEach((index) => {\n const fieldNames = index.fields.map((field) => String(field));\n const key = index.name || `idx_${fieldNames.join(\"_\")}`;\n indexes[key] = {\n fields: fieldNames,\n unique: index.unique,\n };\n });\n }\n\n return {\n name: this.name,\n description: _description,\n settings: _settings,\n permissions: _permissions,\n files: _files,\n ...(Object.keys(indexes).length > 0 && { indexes }),\n ...(_typeHook && { typeHook: _typeHook }),\n ...(_typeValidate && { typeValidate: _typeValidate }),\n };\n },\n\n hooks(hook: TypeHook<Fields>): TypeAfter<\"hooks\"> {\n return runMethodOnce(\"hooks\", () => {\n _typeHook = hook;\n return this as TypeAfter<\"hooks\">;\n });\n },\n\n validate(fn: TypeValidateFn<Fields>): TypeAfter<\"validate\"> {\n return runMethodOnce(\"validate\", () => {\n _typeValidate = fn;\n return this as TypeAfter<\"validate\">;\n });\n },\n\n features(features: Omit<TypeFeatures, \"pluralForm\">): TypeAfter<\"features\"> {\n return runMethodOnce(\"features\", () => {\n _settings = {\n ..._settings,\n ...features,\n };\n return this as TypeAfter<\"features\">;\n });\n },\n\n indexes(\n ...indexes: IndexDef<TailorDBType<Fields, User, DefinedDBTypeMetadata>>[]\n ): TypeAfter<\"indexes\"> {\n return runMethodOnce(\"indexes\", () => {\n _indexes = indexes;\n return this as TypeAfter<\"indexes\">;\n });\n },\n\n files<const F extends string>(\n files: Record<F, string> & FileKeyConflictError<Fields, User>,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<DefinedDBTypeMetadata, \"files\">, F> {\n return runMethodOnce(\"files\", () => {\n _files = files;\n return this as TailorDBType<\n Fields,\n User,\n WithDBTypeMetadata<DefinedDBTypeMetadata, \"files\">,\n F\n >;\n });\n },\n\n permission<\n U extends object = User,\n P extends TailorTypePermission<U, output<TailorDBType<Fields, User, DefinedDBTypeMetadata>>> =\n TailorTypePermission<U, output<TailorDBType<Fields, User, DefinedDBTypeMetadata>>>,\n >(permission: P): TypeAfterUser<U, \"permission\"> {\n return runMethodOnce(\"permission\", () => {\n const ret = this as unknown as TypeAfterUser<U, \"permission\">;\n _permissions.record = permission as RawPermissions[\"record\"];\n return ret;\n });\n },\n\n gqlPermission<\n U extends object = User,\n P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>,\n >(permission: P): TypeAfterUser<U, \"gqlPermission\"> {\n return runMethodOnce(\"gqlPermission\", () => {\n const ret = this as unknown as TypeAfterUser<U, \"gqlPermission\">;\n _permissions.gql = permission as RawPermissions[\"gql\"];\n return ret;\n });\n },\n\n description(description: string): TypeAfter<\"description\"> {\n return runMethodOnce(\"description\", () => {\n _description = description;\n this._description = description;\n return this as TypeAfter<\"description\">;\n });\n },\n\n pickFields<K extends keyof Fields, const Opt extends FieldOptions>(keys: K[], options?: Opt) {\n const result = {} as Record<K, TailorAnyDBField>;\n for (const key of keys) {\n const field = this.fields[key] as TailorAnyDBField | undefined;\n if (!field) {\n // A plugin-injected field is only added to `fields` after `tailor\n // generate` runs — see the \"Injecting fields into the attached\n // table's type\" section of the plugin docs.\n throw new Error(\n `pickFields(): field \"${String(key)}\" does not exist on this table yet. If it comes from a plugin's .plugin() call, it is only added to the table after \\`tailor generate\\` runs.`,\n );\n }\n if (options) {\n result[key] = field.clone(options);\n } else {\n result[key] = field;\n }\n }\n // oxlint-disable-next-line no-explicit-any\n return result as any;\n },\n\n omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K> {\n const keysSet = new Set(keys);\n const result = {} as Record<string, TailorAnyDBField>;\n for (const key in this.fields) {\n if (Object.hasOwn(this.fields, key) && !keysSet.has(key as unknown as K)) {\n result[key] = this.fields[key] as TailorAnyDBField;\n }\n }\n return result as Omit<Fields, K>;\n },\n\n get plugins(): PluginAttachment[] {\n return _plugins;\n },\n\n plugin<const Config extends Record<string, unknown>>(\n config: Config & PluginConfigGuard<Fields, Config, never>,\n ): TypeAfterPlugin<Config> {\n for (const [pluginId, pluginConfig] of Object.entries(config)) {\n _plugins.push({ pluginId, config: pluginConfig });\n }\n return this as unknown as TypeAfterPlugin<Config>;\n },\n };\n\n return brandValue(dbType, \"tailordb-type\");\n}\n\nconst idField = uuid();\ntype idField = typeof idField;\ntype DBTable<\n F extends { id?: never } & Record<string, TailorAnyDBField>,\n Defined extends DefinedDBTypeMetadata = DefinedDBTypeMetadata,\n> = TailorDBInstance<{ id: idField } & F, InferredAttributes, Defined>;\n\n/**\n * Creates a new database table with the specified fields.\n * An `id` field (UUID) is automatically added to every table.\n * @param name - The name of the table, or a tuple of [name, pluralForm]\n * @param fields - The field definitions for the table\n * @returns A new TailorDB table instance\n * @example\n * export const user = db.table(\"User\", {\n * name: db.string(),\n * email: db.string(),\n * age: db.int({ optional: true }),\n * role: db.enum([\"admin\", \"member\"]),\n * ...db.fields.timestamps(),\n * });\n * // Always export both the value and type:\n * export type user = typeof user;\n */\nfunction dbTable<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n fields: F,\n): DBTable<F>;\n/**\n * Creates a new database table with the specified fields and description.\n * An `id` field (UUID) is automatically added to every table.\n * @param name - The name of the table, or a tuple of [name, pluralForm]\n * @param description - A description of the table\n * @param fields - The field definitions for the table\n * @returns A new TailorDB table instance\n */\nfunction dbTable<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n description: string,\n fields: F,\n): DBTable<F, WithDBTypeMetadata<DefinedDBTypeMetadata, \"description\">>;\nfunction dbTable<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n fieldsOrDescription: string | F,\n fields?: F,\n): DBTable<F> | DBTable<F, WithDBTypeMetadata<DefinedDBTypeMetadata, \"description\">> {\n const typeName = Array.isArray(name) ? name[0] : name;\n const pluralForm = Array.isArray(name) ? name[1] : undefined;\n\n let description: string | undefined;\n let fieldDef: F;\n if (typeof fieldsOrDescription === \"string\") {\n description = fieldsOrDescription;\n fieldDef = fields as F;\n } else {\n fieldDef = fieldsOrDescription;\n }\n return createTailorDBType<{ id: idField } & F>(\n typeName,\n {\n id: idField,\n ...fieldDef,\n },\n { pluralForm, description },\n );\n}\n\n// `Function.prototype.toString()` of this hook is embedded verbatim into deployed\n// schemas and migration diffs (see parser/service/tailordb/hooks-validate-precompiled-expr.ts\n// and field.ts). Its source text depends on how the SDK itself was built (e.g.\n// minification), so a fixed expression is pinned onto it directly here instead -\n// configure cannot import parser's `setPrecompiledScriptExpr` runtime helper across\n// the module boundary, only the symbol registry key and map types. Keep\n// this literal in sync with the \"timestamps() updatedAt hook resolves to the pinned\n// expr\" test in parser/service/tailordb/field.precompiled.test.ts, which fails if it\n// ever drifts from what this hook's own source naturally produces.\ntype TimestampsUpdatedAtHookFn = UpdateHookFn<string | Date | null, string | Date>;\nconst timestampsUpdatedAtHook: TimestampsUpdatedAtHookFn = ({ input, now }) => input ?? now;\nconst PRECOMPILED_EXPR_KEY: PrecompiledScriptExprKey =\n \"tailor-platform/sdk:precompiled-script-expr\";\nconst PRECOMPILED_EXPR_SYMBOL = Symbol.for(PRECOMPILED_EXPR_KEY);\n(timestampsUpdatedAtHook as unknown as Record<symbol, PrecompiledScriptExprMap>)[\n PRECOMPILED_EXPR_SYMBOL\n] = {\n \"hooks.update\":\n \"(({ input, now }) => input ?? now)({ input: _value, oldValue: _oldValue, invoker: _principal, now: _now })\",\n};\n\n/** TailorDB schema builder utilities for defining tables and fields. */\nexport const db = {\n table: dbTable,\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n fields: {\n /**\n * Creates standard timestamp fields (createdAt, updatedAt) with automatic defaults.\n * Both fields default to the current time on create. updatedAt is also refreshed on update.\n * User-specified values are respected when provided (e.g. seeding historical records).\n * @returns An object with createdAt and updatedAt fields\n * @example\n * const model = db.table(\"Model\", {\n * name: db.string(),\n * ...db.fields.timestamps(),\n * });\n */\n timestamps: () => ({\n createdAt: datetime().default(\"now\").description(\"Record creation timestamp\"),\n updatedAt: datetime()\n .default(\"now\")\n .hooks({ update: timestampsUpdatedAtHook })\n .description(\"Record update timestamp\"),\n }),\n },\n};\n"],"mappings":"mHAKA,MAAM,EAAQ,CACZ,KAAM,kEACN,KAAM,iDACN,KAAM,8CACN,SACE,sLACF,QAAS,sCACX,EA6BA,SAAS,kBAA6C,EAAuC,CAC3F,GAAM,CAAE,QAAO,QAAO,YAAW,UAAW,EACtC,EAAO,EAAU,OAAS,EAAI,EAAY,IAAA,GAC1C,EAAoB,EAAO,OAEjC,OAAQ,EAAM,KAAd,CACE,IAAK,SACC,OAAO,GAAU,UACnB,EAAO,KAAK,CACV,QAAS,+BAA+B,OAAO,CAAK,IACpD,MACF,CAAC,EAEH,MAEF,IAAK,WACC,OAAO,GAAU,UAAY,CAAC,OAAO,UAAU,CAAK,IACtD,EAAO,KAAK,CACV,QAAS,iCAAiC,OAAO,CAAK,IACtD,MACF,CAAC,EAEH,MAEF,IAAK,SACC,OAAO,GAAU,UAAY,CAAC,OAAO,SAAS,CAAK,IACrD,EAAO,KAAK,CACV,QAAS,+BAA+B,OAAO,CAAK,IACpD,MACF,CAAC,EAEH,MAEF,IAAK,UACC,OAAO,GAAU,WACnB,EAAO,KAAK,CACV,QAAS,gCAAgC,OAAO,CAAK,IACrD,MACF,CAAC,EAEH,MAEF,IAAK,QACC,OAAO,GAAU,UAAY,CAAC,EAAM,KAAK,KAAK,CAAK,IACrD,EAAO,KAAK,CACV,QAAS,mCAAmC,OAAO,CAAK,IACxD,MACF,CAAC,EAEH,MACF,IAAK,QACC,OAAO,GAAU,UAAY,CAAC,EAAM,KAAK,KAAK,CAA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K,OACjB,OAAO,OAAO,KAAK,OAAQ,CAAG,GAAK,CAAC,EAAQ,IAAI,CAAmB,IACrE,EAAO,GAAO,KAAK,OAAO,IAG9B,OAAO,CACT,EAEA,IAAI,SAA8B,CAChC,OAAO,CACT,EAEA,OACE,EACyB,CACzB,IAAK,GAAM,CAAC,EAAU,KAAiB,OAAO,QAAQ,CAAM,EAC1D,EAAS,KAAK,CAAE,WAAU,OAAQ,CAAa,CAAC,EAElD,OAAO,IACT,CACF,EAEA,OAAO,EAAW,EAAQ,eAAe,CAC3C,CAEA,MAAM,EAAU,KAAK,EAyCrB,SAAS,QACP,EACA,EACA,EACmF,CACnF,IAAM,EAAW,MAAM,QAAQ,CAAI,EAAI,EAAK,GAAK,EAC3C,EAAa,MAAM,QAAQ,CAAI,EAAI,EAAK,GAAK,IAAA,GAE/C,EACA,EAOJ,OANI,OAAO,GAAwB,UACjC,EAAc,EACd,EAAW,GAEX,EAAW,EAEN,mBACL,EACA,CACE,GAAI,EACJ,GAAG,CACL,EACA,CAAE,aAAY,aAAY,CAC5B,CACF,CAYA,MAAM,yBAAsD,CAAE,QAAO,SAAU,GAAS,EAGlF,EAA0B,OAAO,IAAI,6CAAoB,EAC/D,wBACE,GACE,CACF,eACE,4GACJ,EAGA,MAAa,EAAK,CAChB,MAAO,QACP,KACA,OACA,KACA,IACA,MACA,QACA,KACA,SACA,KACA,KAAM,MACN,OACA,OAAQ,CAYN,gBAAmB,CACjB,UAAW,SAAS,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,YAAY,2BAA2B,EAC5E,UAAW,SAAS,CAAC,CAClB,QAAQ,KAAK,CAAC,CACd,MAAM,CAAE,OAAQ,uBAAwB,CAAC,CAAC,CAC1C,YAAY,yBAAyB,CAC1C,EACF,CACF"}
@@ -44,7 +44,7 @@ type FillSeedDataResult = {
44
44
  * @param options - Validation options including path and verbose flag
45
45
  * @returns Validation result with output messages and optional error details
46
46
  */
47
- declare function validateSeedData(options: ValidateSeedDataOptions): Promise<ValidateSeedResult>;
47
+ export declare function validateSeedData(options: ValidateSeedDataOptions): Promise<ValidateSeedResult>;
48
48
  /**
49
49
  * Fill in the values a record gets on create for the JSONL seed data rows that
50
50
  * are missing them, so a row can be referenced by `id` or carry a timestamp
@@ -70,6 +70,6 @@ declare function validateSeedData(options: ValidateSeedDataOptions): Promise<Val
70
70
  * @param options - Fill options including path and fields
71
71
  * @returns Which files received which fields
72
72
  */
73
- declare function fillSeedData(options: FillSeedDataOptions): Promise<FillSeedDataResult>;
73
+ export declare function fillSeedData(options: FillSeedDataOptions): Promise<FillSeedDataResult>;
74
74
  //#endregion
75
- export { type ForeignKeyDefinition, type IndexDefinition, defineSchema, fillSeedData, validateSeedData };
75
+ export { type ForeignKeyDefinition, type IndexDefinition, defineSchema };
@@ -0,0 +1,7 @@
1
+ import{n as e}from"./brand-C8nMKhJC.mjs";import{n as t,r as n}from"./logger-CCjs1DuH.mjs";import*as r from"pathe";import{z as i}from"zod";import*as a from"node:fs";import{pathToFileURL as o}from"node:url";const s=i.custom(e=>typeof e==`function`),c=`tailorImportNonce`;let l=0;function beginUserModuleRun(){l+=1}function currentImportNonce(){return l===0?void 0:String(l)}function importUserModule(e){let t=o(e),n=currentImportNonce();return n&&t.searchParams.set(c,n),import(t.href)}const ee=[`**/*.test.ts`,`**/*.spec.ts`],u=new Set;function loadFilesWithIgnores(e,n){if(e.files.length===0)return[];let i=resolveFiles(e,n),a=e.files.every(e=>r.isAbsolute(e));if(i.matchedAnyPattern||n===process.cwd()||a)return i.files;let o=`${n}\0${e.files.join(`\0`)}`;return u.has(o)||(u.add(o),t.warn(`No files matched "${e.files.join(`, `)}" relative to "${n}"; falling back to process.cwd(). Update this config's file patterns to be relative to its own directory before v2, when this fallback will be removed.`)),resolveFiles(e,process.cwd()).files}function resolveFiles(e,n){let i=e.ignores===void 0,o=e.ignores??ee,s=i?o:o.map(e=>r.resolve(n,e)),c=[],l=!1;for(let i of e.files){let e=r.resolve(n,i);try{let t=a.globSync(e);t.length>0&&(l=!0);let n=t.filter(e=>!s.some(t=>r.matchesGlob(e,t)));c.push(...n)}catch(e){l=!0,t.warn(`Failed to glob pattern "${i}": ${String(e)}`)}}return{files:c,matchedAnyPattern:l}}const d={"1-1":`1-1`,oneToOne:`1-1`,"n-1":`n-1`,manyToOne:`n-1`,"N-1":`n-1`,keyOnly:`keyOnly`},f=Object.keys(d);function fieldRef(e){return`Field "${e.fieldName}" on table "${e.tableName}"`}function validateRelationConfig(e,t){if(!e.type)throw Error(`${fieldRef(t)} has a relation but is missing the required 'type' property. Valid values: ${f.join(`, `)}.`);if(!(e.type in d))throw Error(`${fieldRef(t)} has invalid relation type '${e.type}'. Valid values: ${f.join(`, `)}.`);if(e.toward.table!==`self`&&!t.allTableNames.has(e.toward.table))throw Error(`${fieldRef(t)} references unknown table "${e.toward.table}".`)}function processRelationMetadata(e,t,n=!1){let r=d[e.type]===`1-1`,i=e.toward.key??`id`,a=e.toward.table===`self`?t.tableName:e.toward.table,o=!n,s=!n&&r;return{index:o,foreignKey:!0,relationType:e.type,unique:s,foreignKeyType:a,foreignKeyField:i}}function buildRelationInfo(e,t){if(e.type===`keyOnly`)return;let n=d[e.type]===`1-1`,r=e.toward.key??`id`,i=e.toward.table===`self`?t.tableName:e.toward.table,a=e.toward.as;return a||=t.fieldName.replace(/(ID|Id|id)$/u,``),{targetType:i,forwardName:a,backwardName:e.backward??``,key:r,unique:n}}function applyRelationMetadataToFieldConfig(e,t){return{...e,index:t.index,foreignKey:t.foreignKey,unique:t.unique,foreignKeyType:t.foreignKeyType,foreignKeyField:t.foreignKeyField}}function normalizeGqlOperations(e){return e===`query`?{create:!1,update:!1,delete:!1,read:!0}:e}const p=i.union([i.literal(`query`),i.strictObject({create:i.boolean().optional().describe(`Enable create mutation (default: true)`),update:i.boolean().optional().describe(`Enable update mutation (default: true)`),delete:i.boolean().optional().describe(`Enable delete mutation (default: true)`),read:i.boolean().optional().describe(`Enable read queries - get, list, aggregation (default: true)`)})]).describe(`Configuration for GraphQL operations on a TailorDB table.
2
+ All operations are enabled by default (undefined or true = enabled, false = disabled).`).transform(e=>normalizeGqlOperations(e)),m=i.enum([`uuid`,`string`,`boolean`,`integer`,`float`,`decimal`,`enum`,`date`,`datetime`,`time`,`nested`]),h=i.strictObject({value:i.string(),description:i.string().optional()}),g=i.strictObject({required:i.boolean().optional().describe(`Whether the field is required`),array:i.boolean().optional().describe(`Whether the field is an array`),description:i.string().optional().describe(`Field description`),typeName:i.string().optional().describe(`Type name for nested or enum fields`),allowedValues:i.array(h).optional().describe(`Allowed values for enum fields`),index:i.boolean().optional().describe(`Whether the field is indexed for faster queries`),unique:i.boolean().optional().describe(`Whether the field value must be unique`),vector:i.boolean().optional().describe(`Whether the field is a vector field for similarity search`),foreignKey:i.boolean().optional().describe(`Whether the field is a foreign key`),foreignKeyType:i.string().optional().describe(`Target table name for foreign key relations`),foreignKeyField:i.string().optional().describe(`Target field name for foreign key relations`),hooks:i.strictObject({create:s.optional().describe(`Hook function called on record creation`),update:s.optional().describe(`Hook function called on record update`)}).optional().describe(`Lifecycle hooks for the field`),validate:i.array(s).optional().describe(`Validation functions for the field`),serial:i.strictObject({start:i.number().describe(`Starting value for the serial sequence`),maxValue:i.number().optional().describe(`Maximum value for the serial sequence`),format:i.string().optional().describe(`Format string for serial value (string type only)`)}).optional().describe(`Serial (auto-increment) configuration`),scale:i.number().int().min(0).max(12).optional().describe(`Decimal scale (number of digits after decimal point, 0-12)`),default:i.unknown().optional().describe(`Default value for the field on create`)}),te=i.enum(f),ne=i.strictObject({type:te.describe(`Relation cardinality type`),toward:i.strictObject({table:i.string().describe(`Target table name, or 'self' for self-relations`),as:i.string().optional().describe(`Custom forward relation name`),key:i.string().optional().describe(`Target field to join on (default: 'id')`)}),backward:i.string().optional().describe(`Backward relation name on the target table`)}),_=i.lazy(()=>i.object({type:m,fields:i.record(i.string(),_).optional(),metadata:g,rawRelation:ne.optional()})),v=i.strictObject({pluralForm:i.string().optional().describe(`Custom plural form of the table name for GraphQL`),aggregation:i.boolean().optional().describe(`Enable aggregation queries for this table`),bulkUpsert:i.boolean().optional().describe(`Enable bulk upsert mutation for this table`),gqlOperations:p.optional().describe(`Configure GraphQL operations for this table. Use "query" for read-only mode, or an object for granular control.`),publishEvents:i.boolean().optional().describe(`Enable publishing events for this table.
3
+ When enabled, record creation/update/deletion events are published.
4
+ If not specified, this is automatically set to true when an executor uses this table
5
+ with recordCreated/recordUpdated/recordDeleted triggers. If explicitly set to false
6
+ while an executor uses this table, an error will be thrown during apply.`)}),y=i.union([i.strictObject({user:i.string()}),i.string(),i.boolean(),i.array(i.string()),i.array(i.boolean())],{error:e=>{if(typeof e.input==`object`&&e.input!==null){let t=Object.keys(e.input);return t.length===1?`"${t[0]}" operand is not supported in gqlPermission. Use permission() for record-level conditions.`:`Operand object must have exactly 1 key`}return`Invalid operand in gqlPermission`}}),b=i.union([y,i.strictObject({record:i.string()}),i.strictObject({oldRecord:i.string()}),i.strictObject({newRecord:i.string()})]),x=i.enum([`=`,`!=`,`in`,`not in`,`hasAny`,`not hasAny`]),S=i.tuple([b,x,b]).readonly(),re=i.tuple([y,x,y]).readonly(),C=i.union([i.strictObject({conditions:i.union([S,i.array(S).readonly()]),description:i.string().optional(),permit:i.boolean().optional()}),i.tuple([b,x,b]).readonly(),i.tuple([b,x,b,i.boolean()]).readonly(),i.array(i.union([S,i.boolean()])).refine(e=>{let t=e.findIndex(e=>typeof e==`boolean`);return t===-1||t===e.length-1},{message:`Boolean permit flag must only appear at the end`}).readonly()]),ie=i.enum([`read`,`create`,`update`,`delete`,`aggregate`,`bulkUpsert`]),ae=i.strictObject({conditions:i.array(re).readonly(),actions:i.union([i.literal(`all`),i.array(ie).readonly()]),permit:i.boolean().optional(),description:i.string().optional()}),oe=i.strictObject({record:i.strictObject({create:i.array(C).readonly(),read:i.array(C).readonly(),update:i.array(C).readonly(),delete:i.array(C).readonly()}).optional(),gql:i.array(ae).readonly().optional()}),w=i.strictObject({name:i.string(),fields:i.record(i.string(),_),metadata:i.object({name:i.string(),description:i.string().optional(),settings:v.optional(),permissions:oe,files:i.record(i.string(),i.string()),indexes:i.record(i.string(),i.strictObject({fields:i.array(i.string()),unique:i.boolean().optional()})).optional(),typeHook:i.strictObject({create:s.optional(),update:s.optional()}).optional(),typeValidate:s.optional()}).strict()}),T=i.strictObject({directory:i.string().describe(`Directory containing migration files`),machineUser:i.string().optional().describe(`Machine user name for migration execution`)}),E=i.strictObject({files:i.array(i.string()).describe(`Glob patterns for TailorDB table definition files`),ignores:i.array(i.string()).optional().describe(`Glob patterns to exclude from table discovery`),migration:T.optional().describe(`Migration configuration`),gqlOperations:p.optional().describe(`Default GraphQL operations for all tables in this service`)}),D=w.keyof().options;function stripTailorDBTypeBuilderHelpers(t){return e(t,`tailordb-type`)?pickTailorDBTypeSchemaKeys(t):t}function pickTailorDBTypeSchemaKeys(e){if(typeof e!=`object`||!e)return e;let t={},n=e;for(let e of D)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t}const O=i.strictObject({providerUrl:i.string().describe(`OAuth2 provider URL`),issuerUrl:i.string().describe(`OAuth2 issuer URL`),clientId:i.string().describe(`OAuth2 client ID`),clientSecret:i.string().describe(`OAuth2 client secret`),authUrl:i.string().optional().describe(`OAuth2 authorization endpoint override`),tokenUrl:i.string().optional().describe(`OAuth2 token endpoint override`)}).extend({type:i.literal(`oauth2`).describe(`Connection type`)}),k=i.enum([`uuid`,`string`,`boolean`,`integer`,`float`,`decimal`,`enum`,`date`,`datetime`,`time`,`nested`]),A=i.strictObject({value:i.string().describe(`The allowed value`),description:i.string().optional().describe(`Description of the allowed value`)}),j=i.strictObject({as:i.enum([`string`,`date`]).optional().describe(`Date value representation`),required:i.boolean().optional().describe(`Whether the field is required`),array:i.boolean().optional().describe(`Whether the field is an array`),description:i.string().optional().describe(`Field description`),allowedValues:i.array(A).optional().describe(`Allowed values for enum fields`),hooks:i.strictObject({create:s.optional().describe(`Hook function called on creation`),update:s.optional().describe(`Hook function called on update`)}).optional().describe(`Lifecycle hooks`),validate:i.array(s).optional().describe(`Validation functions for the field`),typeName:i.string().optional().describe(`Type name for nested or enum fields`),default:i.unknown().optional().describe(`Default value for the field on create`)}),M=i.object({type:k.describe(`Field data type`),metadata:j.describe(`Field metadata configuration`),get fields(){return i.record(i.string(),M)}}),N=i.strictObject({namespace:i.string().describe(`Auth namespace`),machineUserName:i.string().describe(`Machine user name for authentication`)}),P=i.union([i.string().describe(`Machine user name (namespace auto-resolved from auth service)`),N]),F=i.strictObject({vaultName:i.string().describe(`Vault name containing the secret`),secretKey:i.string().describe(`Key of the secret in the vault`)}),I=i.strictObject({name:i.string().describe(`Identity provider name`),kind:i.literal(`OIDC`),clientID:i.string().describe(`OAuth2 client ID`),clientSecret:F.describe(`OAuth2 client secret`),providerURL:i.string().describe(`OIDC provider URL`),issuerURL:i.string().optional().describe(`OIDC issuer URL (defaults to providerURL)`),usernameClaim:i.string().optional().describe(`JWT claim to use as username`)}),L=i.strictObject({name:i.string().describe(`Identity provider name`),kind:i.literal(`SAML`),enableSignRequest:i.boolean().default(!1).describe(`Enable signing of SAML requests`),metadataURL:i.string().optional().describe(`URL to fetch SAML metadata (mutually exclusive with rawMetadata)`),rawMetadata:i.string().optional().describe(`Raw SAML metadata XML (mutually exclusive with metadataURL)`),defaultRedirectURL:i.string().optional().describe(`URL to redirect to when SAML ACS receives a response with an empty RelayState.`)}).refine(e=>e.metadataURL!==void 0!=(e.rawMetadata!==void 0),`Provide either metadataURL or rawMetadata`),R=i.strictObject({name:i.string().describe(`Identity provider name`),kind:i.literal(`IDToken`),providerURL:i.string().describe(`ID token provider URL`),issuerURL:i.string().optional().describe(`ID token issuer URL`),clientID:i.string().describe(`Client ID for ID token validation`),usernameClaim:i.string().optional().describe(`JWT claim to use as username`)}),z=i.strictObject({name:i.string().describe(`Identity provider name`),kind:i.literal(`BuiltInIdP`),namespace:i.string().describe(`IdP namespace`),clientName:i.string().describe(`OAuth2 client name in the IdP`)}),B=i.discriminatedUnion(`kind`,[I,L,R,z]),V=i.union([i.literal(`authorization_code`),i.literal(`refresh_token`)]).describe(`OAuth2 grant type`),H=i.strictObject({description:i.string().optional().describe(`Client description`),grantTypes:i.array(V).default([`authorization_code`,`refresh_token`]).describe(`Allowed OAuth2 grant types`),redirectURIs:i.array(i.union([i.templateLiteral([`https://`,i.string()]),i.templateLiteral([`http://`,i.string()]),i.templateLiteral([i.string(),`:url`]),i.templateLiteral([i.string(),`:url/`,i.string()])])).describe(`Allowed redirect URIs`),clientType:i.union([i.literal(`confidential`),i.literal(`public`),i.literal(`browser`)]).optional().describe(`OAuth2 client type`),accessTokenLifetimeSeconds:i.number().int().min(60,`Minimum access token lifetime is 60 seconds`).max(86400,`Maximum access token lifetime is 1 day (86400 seconds)`).optional().describe(`Access token lifetime in seconds (60-86400)`).transform(e=>e?{seconds:BigInt(e),nanos:0}:void 0),refreshTokenLifetimeSeconds:i.number().int().min(60,`Minimum refresh token lifetime is 60 seconds`).max(604800,`Maximum refresh token lifetime is 7 days (604800 seconds)`).optional().describe(`Refresh token lifetime in seconds (60-604800)`).transform(e=>e?{seconds:BigInt(e),nanos:0}:void 0),requireDpop:i.boolean().optional().describe(`Require DPoP (Demonstrating Proof-of-Possession) for token requests`)}).refine(e=>e.clientType!==`browser`||e.requireDpop!==!0,{message:`requireDpop cannot be set to true for browser clients as they don't support DPoP`,path:[`requireDpop`]}),U=i.strictObject({type:i.union([i.literal(`oauth2`),i.literal(`bearer`)]).describe(`SCIM authorization type`),bearerSecret:F.optional().describe(`Bearer token secret (required for bearer type)`)}),W=i.union([i.literal(`string`),i.literal(`number`),i.literal(`boolean`),i.literal(`datetime`),i.literal(`complex`)]).describe(`SCIM attribute data type`),G=i.strictObject({type:W.describe(`Attribute data type`),name:i.string().describe(`Attribute name`),description:i.string().optional().describe(`Attribute description`),mutability:i.union([i.literal(`readOnly`),i.literal(`readWrite`),i.literal(`writeOnly`)]).optional().describe(`Attribute mutability`),required:i.boolean().optional().describe(`Whether the attribute is required`),multiValued:i.boolean().optional().describe(`Whether the attribute can have multiple values`),uniqueness:i.union([i.literal(`none`),i.literal(`server`),i.literal(`global`)]).optional().describe(`Uniqueness constraint`),canonicalValues:i.array(i.string()).nullable().optional().describe(`List of canonical values`),get subAttributes(){return i.array(G).nullable().optional()}}),K=i.strictObject({name:i.string().describe(`SCIM schema name`),attributes:i.array(G).describe(`Schema attributes`)}),q=i.strictObject({tailorDBField:i.string().describe(`TailorDB field name to map to`),scimPath:i.string().describe(`SCIM attribute path`)}),se=i.strictObject({name:i.string().describe(`SCIM resource name`),tailorDBNamespace:i.string().describe(`TailorDB namespace for the resource`),tailorDBType:i.string().describe(`TailorDB table name for the resource`),coreSchema:K.describe(`Core SCIM schema definition`),attributeMapping:i.array(q).describe(`Attribute mapping configuration`)}),ce=i.strictObject({machineUserName:i.string().describe(`Machine user name for SCIM operations`),authorization:U.describe(`SCIM authorization configuration`),resources:i.array(se).describe(`SCIM resource definitions`)}),le=i.strictObject({namespace:i.string().describe(`TailorDB namespace for the tenant table`),type:i.string().describe(`TailorDB table name for tenants`),signatureField:i.string().describe(`Field used as the tenant signature`)}),ue=i.strictObject({namespace:i.string().optional().describe(`TailorDB namespace where the user table is defined`),type:i.custom().transform(stripTailorDBTypeBuilderHelpers).pipe(w),usernameField:i.string(),attributes:i.record(i.string(),i.literal(!0)).optional(),attributeList:i.array(i.string()).optional()}),de=i.union([i.string(),i.boolean(),i.array(i.string()),i.array(i.boolean())]),fe=i.strictObject({attributes:i.record(i.string(),de.nullish()).transform(e=>Object.fromEntries(Object.entries(e).filter(e=>e[1]!=null))).optional(),attributeList:i.array(i.uuid()).optional()}),pe=i.strictObject({handler:i.function(),invoker:i.string()}),J=i.strictObject({name:i.string().describe(`Auth service name`),hooks:i.strictObject({beforeLogin:pe.optional().describe(`Before login auth hook`)}).optional().describe(`Auth hooks`),machineUsers:i.record(i.string(),fe).optional().describe(`Machine user definitions`),oauth2Clients:i.record(i.string(),H).optional().describe(`OAuth2 client definitions`),idProvider:B.optional().describe(`Identity provider configuration`),scim:ce.optional().describe(`SCIM provisioning configuration`),tenantProvider:le.optional().describe(`Multi-tenant provider configuration`),connections:i.record(i.string(),O).optional().describe(`Auth connection definitions for external OAuth2 providers`),publishSessionEvents:i.boolean().optional().describe(`Enable publishing session events`)}),me=i.xor([J.extend({userProfile:ue.optional().describe(`User profile configuration`),machineUserAttributes:i.undefined().optional()}),J.extend({userProfile:i.undefined().optional(),machineUserAttributes:i.record(i.string(),M).describe(`Machine user attribute fields`)})],{error:e=>{if(e.code===`invalid_union`&&!(e.errors.length<2)&&e.errors.every(e=>e.every(e=>e.path.length===1&&(e.path[0]===`userProfile`||e.path[0]===`machineUserAttributes`))))return"Specify either `userProfile` or `machineUserAttributes`, not both."}}),he=i.strictObject({kind:i.literal(`tailordb`).describe(`TailorDB record event trigger`),events:i.array(i.enum([`tailordb.type_record.created`,`tailordb.type_record.updated`,`tailordb.type_record.deleted`])).min(1).transform(e=>[...new Set(e)]).describe(`TailorDB event types to trigger on`),tableName:i.string().describe(`TailorDB table name to watch for events`),condition:s.optional().describe(`Condition function to filter events`)}),ge=i.strictObject({kind:i.literal(`resolverExecuted`),resolverName:i.string().describe(`Name of the resolver to trigger on`),condition:s.optional().describe(`Condition function to filter events`)}),_e=i.strictObject({kind:i.literal(`schedule`),cron:i.string().describe(`CRON expression for the schedule`),timezone:i.string().optional().default(`UTC`).describe(`Timezone for the CRON schedule (default: UTC)`)}),ve=i.strictObject({body:s.optional().describe(`Function returning the response body`),statusCode:i.number().int().optional().describe(`HTTP status code for the response`)}),ye=i.strictObject({kind:i.literal(`incomingWebhook`),response:ve.optional().describe(`Response configuration`)}),be=i.strictObject({kind:i.literal(`idpUser`).describe(`IdP user event trigger`),events:i.array(i.enum([`idp.user.created`,`idp.user.updated`,`idp.user.deleted`])).min(1).transform(e=>[...new Set(e)]).describe(`IdP user event types to trigger on`),idp:i.string().optional().describe(`IdP namespace name to subscribe to. If omitted, the project's only IdP is used; throws when multiple IdPs exist.`)}),xe=i.strictObject({kind:i.literal(`authAccessToken`).describe(`Auth access token event trigger`),events:i.array(i.enum([`auth.access_token.issued`,`auth.access_token.refreshed`,`auth.access_token.revoked`])).min(1).transform(e=>[...new Set(e)]).describe(`Auth access token event types to trigger on`)}),Y=i.string().refine(e=>e.trim().length>0,`Workflow name cannot be blank`).describe(`Workflow name to subscribe to.`),Se=i.strictObject({kind:i.literal(`workflowExecution`).describe(`Workflow execution event trigger`),events:i.array(i.enum([`workflow.workflow_execution.started`,`workflow.workflow_execution.completed`,`workflow.workflow_execution.retried`,`workflow.workflow_execution.resumed`,`workflow.workflow_execution.wait_started`,`workflow.workflow_execution.wait_resolved`])).min(1).transform(e=>[...new Set(e)]).describe(`Workflow execution event types to trigger on`),workflowName:Y,condition:s.optional().describe(`Condition function to filter events`)}),Ce=i.strictObject({kind:i.literal(`workflowJobExecution`).describe(`Workflow job execution event trigger`),events:i.array(i.enum([`workflow.workflow_execution.job_execution.started`,`workflow.workflow_execution.job_execution.completed`,`workflow.workflow_execution.job_execution.wait_started`,`workflow.workflow_execution.job_execution.wait_resolved`])).min(1).transform(e=>[...new Set(e)]).describe(`Workflow job execution event types to trigger on`),workflowName:Y,condition:s.optional().describe(`Condition function to filter events`)}),X=i.discriminatedUnion(`kind`,[he,ge,_e,ye,be,xe,Se,Ce]),we=i.strictObject({kind:i.enum([`function`,`jobFunction`]),body:s.describe(`Function implementation`),invoker:P.optional().describe(`Invoker for the function execution`)}),Te=i.strictObject({kind:i.literal(`graphql`),appName:i.string().optional().describe(`Target application name for the GraphQL query`),query:i.preprocess(e=>String(e),i.string().describe(`GraphQL query string`)),variables:s.optional().describe(`Function to compute GraphQL variables`),invoker:P.optional().describe(`Invoker for the GraphQL execution`)}),Ee=i.strictObject({kind:i.literal(`webhook`),url:s.describe(`Function returning the webhook URL`),requestBody:s.optional().describe(`Function to compute the request body`),headers:i.record(i.string(),i.union([i.string(),i.strictObject({vault:i.string(),key:i.string()})])).optional().describe(`HTTP headers for the webhook request`)}),Z=i.lazy(()=>i.union([i.string(),i.number(),i.boolean(),i.null(),i.array(Z),i.record(i.string(),Z)])),De=i.union([i.string(),i.number(),i.boolean(),i.array(Z),i.record(i.string(),Z)]),Oe=i.union([De,s]).describe(`Arguments to pass to the workflow`),Q={kind:i.literal(`workflow`),args:Oe.optional(),invoker:P.optional().describe(`Invoker for the workflow execution`)},ke=i.strictObject({...Q,workflowName:i.string().describe(`Name of the workflow to execute`),workflow:i.never().optional()}),Ae=i.strictObject({...Q,workflow:i.looseObject({name:i.string()}),workflowName:i.string().optional()}).transform(({workflow:e,...t})=>({...t,workflowName:e.name})),je=i.union([Ae,ke]),Me=i.union([we,Te,Ee,je]),$=i.strictObject({name:i.string().describe(`Executor name`),description:i.string().optional().describe(`Executor description`),disabled:i.boolean().optional().default(!1).describe(`Whether the executor is disabled`),trigger:X.describe(`Event trigger configuration`),operation:Me.describe(`Operation to execute when triggered`)});function stripExecutorTriggerArgs(t){if(!e(t,`executor`))return t;let n=t.trigger;if(typeof n!=`object`||!n||!(`__args`in n))return t;let{__args:r,...i}=n;return{...t,trigger:i}}async function loadExecutor(e){let t=(await importUserModule(e)).default,n=$.safeParse(stripExecutorTriggerArgs(t));return n.success?n.data:null}function createExecutorService(i){let{config:a,baseDir:o}=i,s={},c=[],l,loadExecutorForFile=async i=>{try{let a=await importUserModule(i),o=$.safeParse(stripExecutorTriggerArgs(a.default));if(o.success){let e=r.relative(process.cwd(),i);return t.log(`Executor: ${n.successBright(`"${o.data.name}"`)} loaded from ${n.path(e)}`),s[i]=o.data,o.data}if(e(a.default,`executor`))throw o.error}catch(e){let a=r.relative(process.cwd(),i);throw t.error(`Failed to load executor from ${n.bold(a)}`),t.error(String(e)),e}};return{config:a,get executors(){return s},get pluginExecutors(){return c},loadExecutors:async()=>(l||=(async()=>{if(a.files.length===0)return;let e=loadFilesWithIgnores(a,o);return t.newline(),t.log(`Found ${n.highlight(e.length.toString())} executor files`),await Promise.all(e.map(e=>loadExecutorForFile(e))),assertUniqueExecutorNames(s),s})(),await l??(Object.keys(s).length>0?s:void 0)),loadPluginExecutorFiles:async e=>{if(e.length!==0){t.newline(),t.log(`Loading ${n.highlight(e.length.toString())} plugin-generated executor files`);for(let t of e){let e=await loadExecutorForFile(t);e&&c.push({executor:e,pluginId:`plugin-generated`,sourceTableName:void 0})}assertUniqueExecutorNames(s)}}}}function assertUniqueExecutorNames(e){let t=new Map;for(let[n,i]of Object.entries(e)){let e=r.relative(process.cwd(),n),a=t.get(i.name);if(a)throw Error(`Duplicate executor name "${i.name}" found:\n - ${a}\n - ${e}\nEach executor must have a unique name.`);t.set(i.name,e)}}export{c as _,me as a,importUserModule as b,pickTailorDBTypeSchemaKeys as c,w as d,applyRelationMetadataToFieldConfig as f,loadFilesWithIgnores as g,validateRelationConfig as h,$ as i,stripTailorDBTypeBuilderHelpers as l,processRelationMetadata as m,loadExecutor as n,P as o,buildRelationInfo as p,stripExecutorTriggerArgs as r,M as s,createExecutorService as t,E as u,beginUserModuleRun as v,s as x,currentImportNonce as y};
7
+ //# sourceMappingURL=service-7SCy2bhm.mjs.map
@@ -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,E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S,EAAG,CACxD,IAAM,EAAe,EAAK,SAAS,QAAQ,IAAI,EAAG,CAAI,EAChD,EAAW,EAAU,IAAI,EAAS,IAAI,EAC5C,GAAI,EACF,MAAU,MACR,4BAA4B,EAAS,KAAK,gBACjC,EAAS,QACT,EAAa,yCAExB,EAEF,EAAU,IAAI,EAAS,KAAM,CAAY,CAC3C,CACF"}
@@ -0,0 +1 @@
1
+ import{t as e}from"./service-7SCy2bhm.mjs";export{e as createExecutorService};
@@ -1,5 +1,4 @@
1
1
  //#region ../shared/src/color.d.ts
2
2
  /** Applies a style to text */
3
- type StyleFn = (text: string) => string;
4
- //#endregion
5
- export { StyleFn };
3
+ export type StyleFn = (text: string) => string;
4
+ //#endregion