@tailor-platform/sdk 2.0.0-next.4 → 2.0.0-next.5

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 (258) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/dist/{application-BX13RArL.mjs → application-Bf8wxOi6.mjs} +417 -589
  3. package/dist/application-Bf8wxOi6.mjs.map +1 -0
  4. package/dist/application-CUkjzfij.mjs +3 -0
  5. package/dist/cli/cache/bundle-cache.d.mts +2 -1
  6. package/dist/cli/cache/store.d.mts +1 -1
  7. package/dist/cli/commands/api/index.d.mts +1 -0
  8. package/dist/cli/commands/deploy/aigateway.d.mts +5 -1
  9. package/dist/cli/commands/deploy/application.d.mts +7 -1
  10. package/dist/cli/commands/deploy/apply-phases.d.mts +14 -1
  11. package/dist/cli/commands/deploy/auth.d.mts +5 -1
  12. package/dist/cli/commands/deploy/deploy.d.mts +5 -0
  13. package/dist/cli/commands/deploy/executor.d.mts +7 -1
  14. package/dist/cli/commands/deploy/function-registry.d.mts +5 -0
  15. package/dist/cli/commands/deploy/idp.d.mts +5 -1
  16. package/dist/cli/commands/deploy/resolver.d.mts +5 -1
  17. package/dist/cli/commands/deploy/secret-manager.d.mts +5 -1
  18. package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -1
  19. package/dist/cli/commands/deploy/tailordb/index.d.mts +8 -1
  20. package/dist/cli/commands/deploy/types.d.mts +3 -1
  21. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -1
  22. package/dist/cli/commands/deploy/workflow.d.mts +4 -1
  23. package/dist/cli/commands/executor/get.d.mts +0 -1
  24. package/dist/cli/commands/executor/jobs.d.mts +0 -1
  25. package/dist/cli/commands/executor/list.d.mts +0 -1
  26. package/dist/cli/commands/executor/transform.d.mts +1 -0
  27. package/dist/cli/commands/executor/trigger.d.mts +0 -1
  28. package/dist/cli/commands/executor/webhook.d.mts +0 -1
  29. package/dist/cli/commands/function/get.d.mts +0 -1
  30. package/dist/cli/commands/function/list.d.mts +0 -1
  31. package/dist/cli/commands/function/transform.d.mts +1 -0
  32. package/dist/cli/commands/generate/service.d.mts +5 -1
  33. package/dist/cli/commands/machineuser/list.d.mts +0 -1
  34. package/dist/cli/commands/machineuser/token.d.mts +0 -1
  35. package/dist/cli/commands/oauth2client/get.d.mts +0 -1
  36. package/dist/cli/commands/oauth2client/list.d.mts +0 -1
  37. package/dist/cli/commands/oauth2client/transform.d.mts +1 -0
  38. package/dist/cli/commands/organization/folder/create.d.mts +0 -1
  39. package/dist/cli/commands/organization/folder/delete.d.mts +0 -1
  40. package/dist/cli/commands/organization/folder/get.d.mts +0 -1
  41. package/dist/cli/commands/organization/folder/list.d.mts +0 -1
  42. package/dist/cli/commands/organization/folder/update.d.mts +0 -1
  43. package/dist/cli/commands/organization/get.d.mts +0 -1
  44. package/dist/cli/commands/organization/list.d.mts +0 -1
  45. package/dist/cli/commands/organization/transform.d.mts +2 -0
  46. package/dist/cli/commands/organization/tree.d.mts +0 -1
  47. package/dist/cli/commands/organization/update.d.mts +0 -1
  48. package/dist/cli/commands/remove.d.mts +0 -1
  49. package/dist/cli/commands/show.d.mts +9 -4
  50. package/dist/cli/commands/tailordb/migrate/config.d.mts +0 -1
  51. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +16 -3
  52. package/dist/cli/commands/tailordb/migrate/generate.d.mts +0 -1
  53. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +6 -0
  54. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
  55. package/dist/cli/commands/tailordb/truncate.d.mts +0 -1
  56. package/dist/cli/commands/workflow/executions.d.mts +0 -1
  57. package/dist/cli/commands/workflow/get.d.mts +2 -1
  58. package/dist/cli/commands/workflow/list.d.mts +0 -1
  59. package/dist/cli/commands/workflow/resume.d.mts +0 -1
  60. package/dist/cli/commands/workflow/start.d.mts +0 -1
  61. package/dist/cli/commands/workflow/status.d.mts +1 -0
  62. package/dist/cli/commands/workflow/transform.d.mts +1 -0
  63. package/dist/cli/commands/workflow/wait.d.mts +0 -1
  64. package/dist/cli/commands/workflow/waiter.d.mts +1 -1
  65. package/dist/cli/commands/workspace/app/health.d.mts +0 -1
  66. package/dist/cli/commands/workspace/app/list.d.mts +0 -1
  67. package/dist/cli/commands/workspace/app/transform.d.mts +2 -0
  68. package/dist/cli/commands/workspace/create.d.mts +0 -1
  69. package/dist/cli/commands/workspace/delete.d.mts +0 -1
  70. package/dist/cli/commands/workspace/get.d.mts +0 -1
  71. package/dist/cli/commands/workspace/list.d.mts +0 -1
  72. package/dist/cli/commands/workspace/restore.d.mts +0 -1
  73. package/dist/cli/commands/workspace/transform.d.mts +2 -0
  74. package/dist/cli/commands/workspace/user/invite.d.mts +0 -1
  75. package/dist/cli/commands/workspace/user/list.d.mts +0 -1
  76. package/dist/cli/commands/workspace/user/remove.d.mts +0 -1
  77. package/dist/cli/commands/workspace/user/transform.d.mts +1 -0
  78. package/dist/cli/commands/workspace/user/update.d.mts +0 -1
  79. package/dist/cli/index.d.mts +6 -3
  80. package/dist/cli/index.mjs +142 -73
  81. package/dist/cli/index.mjs.map +1 -1
  82. package/dist/cli/lib.d.mts +4 -2
  83. package/dist/cli/lib.mjs +3 -3
  84. package/dist/cli/lib.mjs.map +1 -1
  85. package/dist/cli/query/index.d.mts +0 -1
  86. package/dist/cli/services/application.d.mts +12 -1
  87. package/dist/cli/services/auth/service.d.mts +2 -0
  88. package/dist/cli/services/executor/service.d.mts +1 -1
  89. package/dist/cli/services/http-adapter/bundler.d.mts +3 -1
  90. package/dist/cli/services/http-adapter/service.d.mts +2 -1
  91. package/dist/cli/services/resolver/service.d.mts +1 -1
  92. package/dist/cli/services/tailordb/service.d.mts +3 -1
  93. package/dist/cli/services/workflow/bundler.d.mts +2 -1
  94. package/dist/cli/services/workflow/service.d.mts +1 -1
  95. package/dist/cli/shared/args.d.mts +1 -1
  96. package/dist/cli/shared/client.d.mts +1 -1
  97. package/dist/cli/shared/config-loader.d.mts +0 -1
  98. package/dist/cli/shared/context.d.mts +2 -1
  99. package/dist/cli/shared/script-executor.d.mts +0 -1
  100. package/dist/cli/shared/seed-chunker.d.mts +7 -3
  101. package/dist/cli/shared/type-generator.d.mts +0 -1
  102. package/dist/completion/zsh-worker.zsh +1 -1
  103. package/dist/configure/config/index.d.mts +0 -1
  104. package/dist/configure/config/types.d.mts +2 -2
  105. package/dist/configure/index.d.mts +14 -4
  106. package/dist/configure/index.mjs +196 -2
  107. package/dist/configure/index.mjs.map +1 -1
  108. package/dist/configure/services/aigateway/index.d.mts +0 -1
  109. package/dist/configure/services/aigateway/types.d.mts +0 -1
  110. package/dist/configure/services/auth/index.d.mts +0 -1
  111. package/dist/configure/services/auth/types.d.mts +15 -14
  112. package/dist/configure/services/executor/executor.d.mts +1 -1
  113. package/dist/configure/services/executor/index.d.mts +1 -0
  114. package/dist/configure/services/executor/operation.d.mts +2 -2
  115. package/dist/configure/services/executor/trigger/event.d.mts +0 -1
  116. package/dist/configure/services/executor/trigger/index.d.mts +0 -1
  117. package/dist/configure/services/executor/trigger/schedule.d.mts +0 -1
  118. package/dist/configure/services/executor/trigger/webhook.d.mts +0 -1
  119. package/dist/configure/services/http-adapter/http-adapter.d.mts +1 -2
  120. package/dist/configure/services/idp/index.d.mts +1 -5
  121. package/dist/configure/services/idp/permission.d.mts +4 -5
  122. package/dist/configure/services/idp/types.d.mts +0 -1
  123. package/dist/configure/services/index.d.mts +5 -0
  124. package/dist/configure/services/resolver/resolver.d.mts +1 -0
  125. package/dist/configure/services/resolver/types.d.mts +0 -1
  126. package/dist/configure/services/secrets/index.d.mts +0 -1
  127. package/dist/configure/services/secrets/types.d.mts +0 -1
  128. package/dist/configure/services/staticwebsite/index.d.mts +0 -1
  129. package/dist/configure/services/staticwebsite/types.d.mts +0 -1
  130. package/dist/configure/services/tailordb/permission.d.mts +4 -5
  131. package/dist/configure/services/tailordb/schema.d.mts +85 -49
  132. package/dist/configure/services/tailordb/types.d.mts +66 -17
  133. package/dist/configure/services/workflow/execution-policy.d.mts +0 -1
  134. package/dist/configure/services/workflow/execution-policy.types.d.mts +0 -1
  135. package/dist/configure/services/workflow/index.d.mts +1 -0
  136. package/dist/configure/services/workflow/job.d.mts +0 -1
  137. package/dist/configure/services/workflow/wait-point.d.mts +0 -1
  138. package/dist/configure/services/workflow/workflow.d.mts +1 -1
  139. package/dist/configure/types/field-runtime.d.mts +0 -1
  140. package/dist/configure/types/field.d.mts +1 -2
  141. package/dist/configure/types/field.types.d.mts +6 -45
  142. package/dist/configure/types/index.d.mts +1 -0
  143. package/dist/configure/types/type.d.mts +1 -2
  144. package/dist/kysely/index.d.mts +3 -4
  145. package/dist/{kysely-type-D-zflMGf.mjs → kysely-type-DqIRgDYR.mjs} +4 -3
  146. package/dist/kysely-type-DqIRgDYR.mjs.map +1 -0
  147. package/dist/parser/service/auth/index.d.mts +1 -1
  148. package/dist/parser/service/auth/schema.d.mts +2 -0
  149. package/dist/parser/service/http-adapter/index.d.mts +1 -1
  150. package/dist/parser/service/idp/types.d.mts +1 -0
  151. package/dist/parser/service/tailordb/types.d.mts +6 -1
  152. package/dist/plugin/builtin/enum-constants/index.d.mts +0 -1
  153. package/dist/plugin/builtin/file-utils/index.d.mts +0 -1
  154. package/dist/plugin/builtin/kysely-type/index.d.mts +0 -1
  155. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  156. package/dist/plugin/builtin/seed/index.d.mts +0 -1
  157. package/dist/plugin/get-generated-type.d.mts +0 -1
  158. package/dist/plugin/manager.d.mts +2 -1
  159. package/dist/plugin/types.d.mts +0 -1
  160. package/dist/plugin/with-context.d.mts +0 -1
  161. package/dist/{register-ts-hook-BM1caLT0.mjs → register-ts-hook-BhzVkej0.mjs} +553 -199
  162. package/dist/register-ts-hook-BhzVkej0.mjs.map +1 -0
  163. package/dist/runtime/aigateway.d.mts +0 -1
  164. package/dist/runtime/authconnection.d.mts +0 -1
  165. package/dist/runtime/context.d.mts +0 -1
  166. package/dist/runtime/globals.d.mts +0 -1
  167. package/dist/runtime/index.d.mts +0 -1
  168. package/dist/runtime/types.d.mts +9 -4
  169. package/dist/{schema-C4LYbXVG.mjs → schema-iCd1ugGp.mjs} +253 -50
  170. package/dist/schema-iCd1ugGp.mjs.map +1 -0
  171. package/dist/seed/index.d.mts +3 -2
  172. package/dist/service-BT0GPd01.mjs +3 -0
  173. package/dist/{service-ufH7sS8o.mjs → service-CzZEVrp9.mjs} +14 -9
  174. package/dist/service-CzZEVrp9.mjs.map +1 -0
  175. package/dist/{service_pb-B5w9rjPY.mjs → service_pb-Bk7dL-yT.mjs} +12 -2
  176. package/dist/{service_pb-B5w9rjPY.mjs.map → service_pb-Bk7dL-yT.mjs.map} +1 -1
  177. package/dist/{service_pb-B2FF59sP.mjs → service_pb-DZkfjB_6.mjs} +1 -1
  178. package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +0 -1
  179. package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +0 -1
  180. package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +0 -1
  181. package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +0 -1
  182. package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +0 -1
  183. package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +0 -1
  184. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +0 -1
  185. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +0 -1
  186. package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +0 -1
  187. package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +0 -1
  188. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +0 -1
  189. package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +0 -1
  190. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -1
  191. package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +0 -1
  192. package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +0 -1
  193. package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +0 -1
  194. package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +0 -1
  195. package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +0 -1
  196. package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +0 -1
  197. package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +0 -1
  198. package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +0 -1
  199. package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +0 -1
  200. package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +0 -1
  201. package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +0 -1
  202. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +0 -1
  203. package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +0 -1
  204. package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +0 -1
  205. package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +0 -1
  206. package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +0 -1
  207. package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +0 -1
  208. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +0 -1
  209. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +0 -1
  210. package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +0 -1
  211. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +0 -1
  212. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +0 -1
  213. package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +0 -1
  214. package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +0 -1
  215. package/dist/types/aigateway.generated.d.mts +5 -2
  216. package/dist/types/auth-connection.generated.d.mts +24 -11
  217. package/dist/types/auth.generated.d.mts +115 -84
  218. package/dist/types/executor.generated.d.mts +76 -84
  219. package/dist/types/helpers.d.mts +7 -6
  220. package/dist/types/http-adapter.generated.d.mts +11 -5
  221. package/dist/types/idp.generated.d.mts +536 -524
  222. package/dist/types/resolver.generated.d.mts +26 -11
  223. package/dist/types/staticwebsite.generated.d.mts +7 -3
  224. package/dist/types/tailordb.generated.d.mts +57 -29
  225. package/dist/types/workflow.generated.d.mts +9 -4
  226. package/dist/utils/test/index.d.mts +1 -2
  227. package/dist/utils/test/index.mjs +36 -10
  228. package/dist/utils/test/index.mjs.map +1 -1
  229. package/dist/utils/test/mock.d.mts +0 -1
  230. package/dist/vitest/index.d.mts +1 -1
  231. package/dist/vitest/mock-kysely.d.mts +0 -1
  232. package/dist/vitest/mocks/aigateway.d.mts +2 -2
  233. package/dist/vitest/mocks/authconnection.d.mts +2 -2
  234. package/dist/vitest/mocks/idp.d.mts +2 -2
  235. package/dist/vitest/mocks/secretmanager.d.mts +3 -1
  236. package/dist/vitest/mocks/tailordb.d.mts +6 -3
  237. package/dist/vitest/mocks/workflow.d.mts +11 -6
  238. package/dist/vitest/workflow-local.d.mts +1 -0
  239. package/docs/cli/setup.md +1 -1
  240. package/docs/cli-reference.md +7 -6
  241. package/docs/migration/v2.md +206 -0
  242. package/docs/services/aigateway.md +2 -0
  243. package/docs/services/tailordb.md +100 -68
  244. package/docs/services/workflow.md +1 -1
  245. package/package.json +22 -22
  246. package/dist/application-BO4ZF8wP.mjs +0 -3
  247. package/dist/application-BX13RArL.mjs.map +0 -1
  248. package/dist/cli/shared/trigger-context.d.mts +0 -1
  249. package/dist/field-runtime-CAnh_oow.mjs +0 -183
  250. package/dist/field-runtime-CAnh_oow.mjs.map +0 -1
  251. package/dist/kysely-type-D-zflMGf.mjs.map +0 -1
  252. package/dist/register-ts-hook-BM1caLT0.mjs.map +0 -1
  253. package/dist/schema-C4LYbXVG.mjs.map +0 -1
  254. package/dist/service-CkIwEctX.mjs +0 -3
  255. package/dist/service-ufH7sS8o.mjs.map +0 -1
  256. package/dist/types-C-lQ4se3.mjs +0 -4
  257. package/dist/types-CXF2OYdR.mjs +0 -199
  258. package/dist/types-CXF2OYdR.mjs.map +0 -1
@@ -7,6 +7,7 @@ import { GeneratorResult } from "../plugin/types.mjs";
7
7
  import { LoadedConfig, loadConfig } from "./shared/config-loader.mjs";
8
8
  import { AuthInvoker } from "../tailor-proto/src/tailor/v1/auth_resource_pb.mjs";
9
9
  import { OperatorClient, initOperatorClient } from "./shared/client.mjs";
10
+ import "./commands/deploy/function-registry.mjs";
10
11
  import { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotFieldConfig, TailorDBSnapshotType } from "./commands/tailordb/migrate/snapshot-types.mjs";
11
12
  import { BreakingChangeInfo, MigrationDiff, formatDiffSummary, formatMigrationDiff, hasChanges } from "./commands/tailordb/migrate/diff-calculator.mjs";
12
13
  import { MIGRATION_LABEL_KEY } from "./commands/tailordb/migrate/types.mjs";
@@ -19,7 +20,7 @@ import { kyselyTypePlugin } from "../plugin/builtin/kysely-type/index.mjs";
19
20
  import { enumConstantsPlugin } from "../plugin/builtin/enum-constants/index.mjs";
20
21
  import { fileUtilsPlugin } from "../plugin/builtin/file-utils/index.mjs";
21
22
  import { seedPlugin } from "../plugin/builtin/seed/index.mjs";
22
- import { ApplicationInfo, ShowOptions, show } from "./commands/show.mjs";
23
+ import { AIGatewayInfo, ApplicationInfo, ShowInfo, ShowOptions, show } from "./commands/show.mjs";
23
24
  import { RemoveOptions, remove } from "./commands/remove.mjs";
24
25
  import { WorkspaceDetails, WorkspaceInfo } from "./commands/workspace/transform.mjs";
25
26
  import { CreateWorkspaceOptions, createWorkspace } from "./commands/workspace/create.mjs";
@@ -69,6 +70,7 @@ import { UpdateFolderOptions, updateFolder } from "./commands/organization/folde
69
70
  import { DeleteFolderOptions, deleteFolder } from "./commands/organization/folder/delete.mjs";
70
71
  import { loadAccessToken, loadWorkspaceId } from "./shared/context.mjs";
71
72
  import { ApiCallOptions, ApiCallResult, apiCall } from "./commands/api/api-call.mjs";
73
+ import "./commands/api/index.mjs";
72
74
  import { query } from "./query/index.mjs";
73
75
  import { TruncateOptions, truncate } from "./commands/tailordb/truncate.mjs";
74
76
  import { GenerateOptions as GenerateOptions$1, generate as generate$1 } from "./commands/tailordb/migrate/generate.mjs";
@@ -78,4 +80,4 @@ import { SeedBundleResult, bundleSeedScript } from "./commands/generate/seed/bun
78
80
  import { MigrationBundleResult, bundleMigrationScript } from "./commands/tailordb/migrate/bundler.mjs";
79
81
  import { ExecutionWaitResult, ScriptExecutionOptions, ScriptExecutionResult, executeScript, waitForExecution } from "./shared/script-executor.mjs";
80
82
  import { MachineUserName } from "@tailor-platform/sdk";
81
- export { type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CreateFolderOptions, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DeployOptions, type ExecutionWaitResult, type Executor, type ExecutorInfo, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FunctionRegistryInfo, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobOptions, type GetExecutorJobTypedOptions, type GetExecutorOptions, type GetExecutorTypedOptions, type GetFolderOptions, type GetFunctionRegistryOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetOrganizationOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowOptions, type GetWorkflowTypedOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsOptions, type ListExecutorJobsTypedOptions, type ListExecutorsOptions, type ListFoldersOptions, type ListFunctionRegistriesOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListOrganizationsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsOptions, type ListWorkflowExecutionsTypedOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadedConfig, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserName, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationBundleResult, type MigrationDiff, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OrganizationInfo, type OrganizationTreeOptions, type PluginAttachment, type RemoveOptions, type RemoveUserOptions, type Resolver, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type SeedBundleResult, type SeedChunk, type ShowOptions, type SnapshotFieldConfig, type StartWorkflowOptions, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type TailorDBSnapshotType, type TailorDBType, type TriggerExecutorOptions, type TriggerExecutorResult, type TriggerExecutorTypedOptions, type TruncateOptions, type TypeSourceInfoEntry, type UpdateFolderOptions, type UpdateOrganizationOptions, type UpdateUserOptions, type UserInfo, type UserOrganizationInfo, type WaitOptions, type WaitWorkflowExecutionOptions, type WatchExecutorJobOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowExecutionWaitInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkflowWaitOutput, type WorkflowWaitResult, type WorkspaceDetails, type WorkspaceInfo, apiCall, deploy as apply, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, deploy, enumConstantsPlugin, executeScript, fileUtilsPlugin, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getExecutorWaitFailureMessage, getFolder, getFunctionRegistry, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getOrganization, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, kyselyTypePlugin, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadWorkspaceId, generate$1 as migrateGenerate, organizationTree, query, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, seedPlugin, show, startWorkflow, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob };
83
+ export { type AIGatewayInfo, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CreateFolderOptions, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DeployOptions, type ExecutionWaitResult, type Executor, type ExecutorInfo, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FunctionRegistryInfo, type GenerateOptions, type GeneratorResult, type HealthOptions as GetAppHealthOptions, type GetExecutorJobOptions, type GetExecutorJobTypedOptions, type GetExecutorOptions, type GetExecutorTypedOptions, type GetFolderOptions, type GetFunctionRegistryOptions, type GetMachineUserTokenOptions, type GetOAuth2ClientOptions, type GetOrganizationOptions, type GetWorkflowExecutionOptions, type GetWorkflowExecutionResult, type GetWorkflowOptions, type GetWorkflowTypedOptions, type GetWorkspaceOptions, INITIAL_SCHEMA_NUMBER, type InviteUserOptions, type ListAppsOptions, type ListExecutorJobsOptions, type ListExecutorJobsTypedOptions, type ListExecutorsOptions, type ListFoldersOptions, type ListFunctionRegistriesOptions, type ListMachineUsersOptions, type ListOAuth2ClientsOptions, type ListOrganizationsOptions, type ListUsersOptions, type ListWebhookExecutorsOptions, type ListWorkflowExecutionsOptions, type ListWorkflowExecutionsTypedOptions, type ListWorkflowsOptions, type ListWorkspacesOptions, type LoadedConfig, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, type MachineUserInfo, type MachineUserName, type MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationBundleResult, type MigrationDiff, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OrganizationInfo, type OrganizationTreeOptions, type PluginAttachment, type RemoveOptions, type RemoveUserOptions, type Resolver, type RestoreWorkspaceOptions, type ResumeWorkflowOptions, type ResumeWorkflowResultWithWait, SCHEMA_FILE_NAME, type SchemaSnapshot, type ScriptExecutionOptions, type ScriptExecutionResult, type SeedBundleResult, type SeedChunk, type ShowInfo, type ShowOptions, type SnapshotFieldConfig, type StartWorkflowOptions, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type TailorDBSnapshotType, type TailorDBType, type TriggerExecutorOptions, type TriggerExecutorResult, type TriggerExecutorTypedOptions, type TruncateOptions, type TypeSourceInfoEntry, type UpdateFolderOptions, type UpdateOrganizationOptions, type UpdateUserOptions, type UserInfo, type UserOrganizationInfo, type WaitOptions, type WaitWorkflowExecutionOptions, type WatchExecutorJobOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowExecutionWaitInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkflowWaitOutput, type WorkflowWaitResult, type WorkspaceDetails, type WorkspaceInfo, apiCall, deploy as apply, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, deploy, enumConstantsPlugin, executeScript, fileUtilsPlugin, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, getExecutorWaitFailureMessage, getFolder, getFunctionRegistry, getLatestMigrationNumber, getMachineUserToken, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNamespacesWithMigrations, getNextMigrationNumber, getOAuth2Client, getOrganization, getWorkflow, getWorkflowExecution, getWorkspace, hasChanges, initOperatorClient, inviteUser, kyselyTypePlugin, listApps, listExecutorJobs, listExecutors, listFolders, listFunctionRegistries, listMachineUsers, listOAuth2Clients, listOrganizations, listUsers, listWebhookExecutors, listWorkflowExecutions, listWorkflows, listWorkspaces, loadAccessToken, loadConfig, loadWorkspaceId, generate$1 as migrateGenerate, organizationTree, query, reconstructSnapshotFromMigrations, remove, removeUser, restoreWorkspace, resumeWorkflow, seedPlugin, show, startWorkflow, triggerExecutor, truncate, updateFolder, updateOrganization, updateUser, waitForExecution, waitWorkflowExecution, watchExecutorJob };
package/dist/cli/lib.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
2
- import { D as loadConfig, M as loadAccessToken, R as loadWorkspaceId, _ as platformBundleDefinePlugin, at as initOperatorClient, w as getDistDir } from "../application-BX13RArL.mjs";
3
- import { $ as getOrganization, At as getExecutorWaitFailureMessage, B as show, Bt as listWorkflowExecutions, Cn as hasChanges, Ct as listWebhookExecutors, D as waitWorkflowExecution, Et as triggerExecutor, Ft as startWorkflow, Gt as deploy, J as organizationTree, Jt as waitForExecution, Lt as getWorkflow, M as truncate, Mt as listExecutorJobs, Nt as watchExecutorJob, On as generateUserTypes, Ot as listExecutors, P as generate$1, S as listApps, Sn as formatMigrationDiff, St as getFunctionRegistry, W as remove, Wt as getExecutor, Xt as MIGRATION_LABEL_KEY, Yt as bundleMigrationScript, Z as listOrganizations, _ as getWorkspace, _t as listMachineUsers, a as updateUser, an as MIGRATE_FILE_NAME, at as getFolder, bt as listFunctionRegistries, cn as compareLocalTypesWithSnapshot, d as inviteUser, dn as getLatestMigrationNumber, dt as listOAuth2Clients, fn as getMigrationDirPath, h as listWorkspaces, hn as getNextMigrationNumber, in as INITIAL_SCHEMA_NUMBER, j as listWorkflows, jn as apiCall, k as resumeWorkflow, kt as getExecutorJob, l as listUsers, ln as compareSnapshots, lt as createFolder, mn as getMigrationFiles, mt as getMachineUserToken, n as query, nn as DB_TYPES_FILE_NAME, on as SCHEMA_FILE_NAME, p as restoreWorkspace, pn as getMigrationFilePath, pt as getOAuth2Client, q as updateOrganization, qt as executeScript, rn as DIFF_FILE_NAME, rt as listFolders, s as removeUser, st as deleteFolder, t as registerTsHook, tt as updateFolder, un as createSnapshotFromLocalTypes, vn as reconstructSnapshotFromMigrations, vt as generate, w as getAppHealth, wn as getNamespacesWithMigrations, x as createWorkspace, xn as formatDiffSummary, y as deleteWorkspace, zt as getWorkflowExecution } from "../register-ts-hook-BM1caLT0.mjs";
2
+ import { D as loadConfig, M as loadAccessToken, R as loadWorkspaceId, _ as platformBundleDefinePlugin, at as initOperatorClient, w as getDistDir } from "../application-Bf8wxOi6.mjs";
3
+ import { $ as getOrganization, At as getExecutorWaitFailureMessage, B as show, Bt as listWorkflowExecutions, Cn as hasChanges, Ct as listWebhookExecutors, D as waitWorkflowExecution, Et as triggerExecutor, Ft as startWorkflow, Gt as deploy, J as organizationTree, Jt as waitForExecution, Lt as getWorkflow, M as truncate, Mt as listExecutorJobs, Nt as watchExecutorJob, On as generateUserTypes, Ot as listExecutors, P as generate$1, S as listApps, Sn as formatMigrationDiff, St as getFunctionRegistry, W as remove, Wt as getExecutor, Xt as MIGRATION_LABEL_KEY, Yt as bundleMigrationScript, Z as listOrganizations, _ as getWorkspace, _t as listMachineUsers, a as updateUser, an as MIGRATE_FILE_NAME, at as getFolder, bt as listFunctionRegistries, cn as compareLocalTypesWithSnapshot, d as inviteUser, dn as getLatestMigrationNumber, dt as listOAuth2Clients, fn as getMigrationDirPath, h as listWorkspaces, hn as getNextMigrationNumber, in as INITIAL_SCHEMA_NUMBER, j as listWorkflows, jn as apiCall, k as resumeWorkflow, kt as getExecutorJob, l as listUsers, ln as compareSnapshots, lt as createFolder, mn as getMigrationFiles, mt as getMachineUserToken, n as query, nn as DB_TYPES_FILE_NAME, on as SCHEMA_FILE_NAME, p as restoreWorkspace, pn as getMigrationFilePath, pt as getOAuth2Client, q as updateOrganization, qt as executeScript, rn as DIFF_FILE_NAME, rt as listFolders, s as removeUser, st as deleteFolder, t as registerTsHook, tt as updateFolder, un as createSnapshotFromLocalTypes, vn as reconstructSnapshotFromMigrations, vt as generate, w as getAppHealth, wn as getNamespacesWithMigrations, x as createWorkspace, xn as formatDiffSummary, y as deleteWorkspace, zt as getWorkflowExecution } from "../register-ts-hook-BhzVkej0.mjs";
4
4
  import { t as multiline } from "../multiline-sfHpTZZK.mjs";
5
- import { n as kyselyTypePlugin } from "../kysely-type-D-zflMGf.mjs";
5
+ import { n as kyselyTypePlugin } from "../kysely-type-DqIRgDYR.mjs";
6
6
  import { n as enumConstantsPlugin } from "../enum-constants-j9QBF0cB.mjs";
7
7
  import { n as fileUtilsPlugin } from "../file-utils-yEiIS4nJ.mjs";
8
8
  import { n as seedPlugin } from "../seed-CRSQJI_z.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"lib.mjs","names":[],"sources":["../../src/cli/shared/seed-chunker.ts","../../src/cli/commands/generate/seed/bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\n * Seed data chunker for splitting large seed data into manageable message sizes.\n *\n * When seed data exceeds the gRPC message size limit, this module splits the data\n * into multiple chunks at type boundaries (or record boundaries for large types).\n */\n\nimport { assertDefined } from \"#/utils/assert\";\n\n/**\n * Seed data keyed by type name, with an array of records per type.\n */\nexport type SeedData = Record<string, Record<string, unknown>[]>;\n\n/**\n * A single chunk of seed data with metadata for ordered execution.\n */\nexport type SeedChunk = {\n data: SeedData;\n order: string[];\n index: number;\n total: number;\n};\n\n/**\n * Options for chunking seed data.\n */\nexport type ChunkSeedDataOptions = {\n /** Seed data keyed by type name */\n data: SeedData;\n /** Ordered list of type names (dependency order) */\n order: string[];\n /** Byte size of the bundled seed script code */\n codeByteSize: number;\n /** Maximum gRPC message size in bytes (default: 3.5MB) */\n maxMessageSize?: number;\n};\n\n/** Default maximum message size: 3.5MB (conservative limit for gRPC) */\nexport const DEFAULT_MAX_MESSAGE_SIZE = 3.5 * 1024 * 1024;\n\n/** Reserved bytes for message metadata overhead */\nconst METADATA_OVERHEAD = 1024;\n\n/**\n * Split seed data into chunks that fit within the gRPC message size limit.\n *\n * Algorithm:\n * 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)\n * 2. If all data fits in one message, return a single chunk\n * 3. Otherwise, iterate through types in dependency order:\n * - If a type fits in the current chunk, add it\n * - If adding a type would exceed the budget, finalize the current chunk and start a new one\n * - If a single type exceeds the budget, split its records across multiple chunks\n * - If a single record exceeds the budget, throw an error\n * @param options - Chunking options\n * @returns Array of seed chunks\n */\nexport function chunkSeedData(options: ChunkSeedDataOptions): SeedChunk[] {\n const { data, order, codeByteSize, maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE } = options;\n\n const argBudget = maxMessageSize - codeByteSize - METADATA_OVERHEAD;\n if (argBudget <= 0) {\n throw new Error(\n `Code size (${codeByteSize} bytes) exceeds the message size limit (${maxMessageSize} bytes). ` +\n `No space left for seed data.`,\n );\n }\n\n // Filter to types that have data\n const typesWithData = order.filter((type) => (data[type]?.length ?? 0) > 0);\n\n if (typesWithData.length === 0) {\n return [];\n }\n\n // Check if all data fits in a single message\n const fullArg = JSON.stringify({ data, order });\n if (byteSize(fullArg) <= argBudget) {\n return [{ data, order, index: 0, total: 1 }];\n }\n\n // Split into multiple chunks\n const chunks: Omit<SeedChunk, \"total\">[] = [];\n let currentData: SeedData = {};\n let currentOrder: string[] = [];\n\n for (const type of typesWithData) {\n const typeRecords = assertDefined(data[type], `seed data missing for type: ${type}`);\n\n // Check if the type fits in the current chunk\n if (currentOrder.length > 0) {\n const testData = { ...currentData, [type]: typeRecords };\n const testOrder = [...currentOrder, type];\n if (byteSize(JSON.stringify({ data: testData, order: testOrder })) > argBudget) {\n // Finalize the current chunk\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n }\n\n // Check if the entire type fits in an empty chunk\n if (byteSize(JSON.stringify({ data: { [type]: typeRecords }, order: [type] })) <= argBudget) {\n currentData[type] = typeRecords;\n currentOrder.push(type);\n continue;\n }\n\n // Type is too large — split by records\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n\n let recordBatch: Record<string, unknown>[] = [];\n for (const record of typeRecords) {\n if (byteSize(JSON.stringify({ data: { [type]: [record] }, order: [type] })) > argBudget) {\n const singleRecordSize = byteSize(JSON.stringify(record));\n throw new Error(\n `A single record in type \"${type}\" (${singleRecordSize} bytes) exceeds the message size budget ` +\n `(${argBudget} bytes). Consider increasing maxMessageSize or reducing the record size.`,\n );\n }\n\n const testBatch = [...recordBatch, record];\n const testData = { ...currentData, [type]: testBatch };\n const testOrder = currentOrder.includes(type) ? currentOrder : [...currentOrder, type];\n const testSize = byteSize(JSON.stringify({ data: testData, order: testOrder }));\n\n if (testSize > argBudget && recordBatch.length > 0) {\n // Finalize current chunk with accumulated records\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n recordBatch = [record];\n } else {\n recordBatch = testBatch;\n }\n }\n\n // Add remaining records\n if (recordBatch.length > 0) {\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n }\n }\n\n // Finalize the last chunk\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n }\n\n const total = chunks.length;\n return chunks.map((chunk) => ({ ...chunk, total }));\n}\n\nfunction byteSize(str: string): number {\n return new TextEncoder().encode(str).length;\n}\n","/**\n * Seed script bundler for TailorDB seed data\n *\n * Bundles seed scripts to be executed via TestExecScript API\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { getDistDir } from \"#/cli/shared/dist-dir\";\nimport { platformBundleDefinePlugin } from \"#/cli/shared/platform-bundle-plugin\";\nimport ml from \"#/utils/multiline\";\n\nexport type SeedBundleResult = {\n namespace: string;\n bundledCode: string;\n typesIncluded: string[];\n};\n\nconst BATCH_SIZE = 100;\n\n/**\n * Generate seed script content for server-side execution\n * @param namespace - TailorDB namespace\n * @returns Generated seed script content\n */\nfunction generateSeedScriptContent(namespace: string): string {\n return ml /* ts */ `\n import { Kysely, TailordbDialect } from \"@tailor-platform/sdk/kysely\";\n\n type SeedInput = {\n data: Record<string, Record<string, unknown>[]>;\n order: string[];\n selfRefTypes: string[];\n };\n\n type SeedResult = {\n success: boolean;\n processed: Record<string, number>;\n errors: string[];\n };\n\n function getDB(namespace: string) {\n const client = new tailordb.Client({ namespace });\n return new Kysely<Record<string, Record<string, unknown>>>({\n dialect: new TailordbDialect(client),\n });\n }\n\n export async function main(input: SeedInput): Promise<SeedResult> {\n const db = getDB(\"${namespace}\");\n const processed: Record<string, number> = {};\n const errors: string[] = [];\n const BATCH_SIZE = ${String(BATCH_SIZE)};\n\n for (const typeName of input.order) {\n const records = input.data[typeName];\n if (!records || records.length === 0) {\n console.log(\\`[${namespace}] \\${typeName}: skipped (no data)\\`);\n continue;\n }\n\n processed[typeName] = 0;\n const hasSelfRef = (input.selfRefTypes || []).includes(typeName);\n\n try {\n if (hasSelfRef) {\n // Insert one-by-one to respect self-referencing foreign key order\n for (const record of records) {\n await db.insertInto(typeName).values(record).execute();\n processed[typeName] += 1;\n }\n console.log(\\`[${namespace}] \\${typeName}: \\${processed[typeName]}/\\${records.length} (one-by-one)\\`);\n } else {\n for (let i = 0; i < records.length; i += BATCH_SIZE) {\n const batch = records.slice(i, i + BATCH_SIZE);\n await db.insertInto(typeName).values(batch).execute();\n processed[typeName] += batch.length;\n console.log(\\`[${namespace}] \\${typeName}: \\${processed[typeName]}/\\${records.length}\\`);\n }\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`\\${typeName}: \\${message}\\`);\n console.error(\\`[${namespace}] \\${typeName}: failed - \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n processed,\n errors,\n };\n }\n `;\n}\n\n/**\n * Bundle a seed script for server-side execution\n *\n * Creates an entry that:\n * 1. Defines getDB() function inline\n * 2. Processes data in batches using Kysely\n * 3. Reports progress via console.log\n * 4. Exports as main() for TestExecScript\n * @param namespace - TailorDB namespace\n * @param typeNames - List of type names to include in the seed\n * @returns Bundled seed script result\n */\nexport async function bundleSeedScript(\n namespace: string,\n typeNames: string[],\n): Promise<SeedBundleResult> {\n // Output directory in .tailor (relative to project root)\n const outputDir = path.resolve(getDistDir(), \"seed\");\n fs.mkdirSync(outputDir, { recursive: true });\n\n // Entry file in output directory\n const entryPath = path.join(outputDir, `seed_${namespace}.entry.ts`);\n\n // Generate seed script content\n const entryContent = generateSeedScriptContent(namespace);\n fs.writeFileSync(entryPath, entryContent);\n\n let tsconfig: string | undefined;\n try {\n tsconfig = await resolveTSConfig();\n } catch {\n tsconfig = undefined;\n }\n\n // Bundle with tree-shaking (write: false to avoid unnecessary disk I/O)\n const result = await rolldown.build({\n plugins: [platformBundleDefinePlugin],\n input: entryPath,\n write: false,\n output: {\n format: \"esm\",\n sourcemap: false,\n minify: false,\n codeSplitting: false,\n globals: {\n tailordb: \"tailordb\",\n },\n },\n external: [\"tailordb\"],\n resolve: {\n conditionNames: [\"node\", \"import\"],\n },\n tsconfig,\n treeshake: {\n moduleSideEffects: false,\n annotations: true,\n unknownGlobalSideEffects: false,\n },\n logLevel: \"silent\",\n } as rolldown.BuildOptions);\n\n const bundledCode = result.output[0].code;\n\n return {\n namespace,\n bundledCode,\n typesIncluded: typeNames,\n };\n}\n","// CLI API exports for programmatic usage\nimport { registerTsHook } from \"./shared/register-ts-hook\";\n\nawait registerTsHook(new URL(\"./ts-hook.mjs\", import.meta.url));\n\nexport { deploy, deploy as apply } from \"./commands/deploy/deploy\";\nexport type { DeployOptions, DeployOptions as ApplyOptions } from \"./commands/deploy/deploy\";\nexport type { BundledScripts } from \"./commands/deploy/function-registry\";\nexport { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { generateUserTypes } from \"./shared/type-generator\";\nexport type { GeneratorResult, PluginAttachment } from \"#/plugin/types\";\nexport type { TailorDBType, TypeSourceInfoEntry } from \"#/parser/service/tailordb/types\";\nexport type { Resolver } from \"#/types/resolver.generated\";\nexport type { Executor } from \"#/types/executor.generated\";\n\n/** @deprecated Import from '@tailor-platform/sdk/plugin/kysely-type' instead */\nexport { kyselyTypePlugin } from \"#/plugin/builtin/kysely-type/index\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/enum-constants' instead */\nexport { enumConstantsPlugin } from \"#/plugin/builtin/enum-constants/index\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/file-utils' instead */\nexport { fileUtilsPlugin } from \"#/plugin/builtin/file-utils/index\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/seed' instead */\nexport { seedPlugin } from \"#/plugin/builtin/seed/index\";\n\nexport { show, type ShowOptions, type ApplicationInfo } from \"./commands/show\";\nexport { remove, type RemoveOptions } from \"./commands/remove\";\nexport { createWorkspace, type CreateWorkspaceOptions } from \"./commands/workspace/create\";\nexport { listWorkspaces, type ListWorkspacesOptions } from \"./commands/workspace/list\";\nexport { deleteWorkspace, type DeleteWorkspaceOptions } from \"./commands/workspace/delete\";\nexport { getWorkspace, type GetWorkspaceOptions } from \"./commands/workspace/get\";\nexport { restoreWorkspace, type RestoreWorkspaceOptions } from \"./commands/workspace/restore\";\nexport type { WorkspaceInfo, WorkspaceDetails } from \"./commands/workspace/transform\";\nexport { listUsers, type ListUsersOptions } from \"./commands/workspace/user/list\";\nexport { inviteUser, type InviteUserOptions } from \"./commands/workspace/user/invite\";\nexport { updateUser, type UpdateUserOptions } from \"./commands/workspace/user/update\";\nexport { removeUser, type RemoveUserOptions } from \"./commands/workspace/user/remove\";\nexport type { UserInfo } from \"./commands/workspace/user/transform\";\nexport { listApps, type ListAppsOptions } from \"./commands/workspace/app/list\";\nexport {\n getAppHealth,\n type HealthOptions as GetAppHealthOptions,\n} from \"./commands/workspace/app/health\";\nexport type { AppInfo, AppHealthInfo } from \"./commands/workspace/app/transform\";\nexport { getFunctionRegistry, type GetFunctionRegistryOptions } from \"./commands/function/get\";\nexport {\n listFunctionRegistries,\n type ListFunctionRegistriesOptions,\n} from \"./commands/function/list\";\nexport type { FunctionRegistryInfo } from \"./commands/function/transform\";\nexport {\n listMachineUsers,\n type ListMachineUsersOptions,\n type MachineUserInfo,\n} from \"./commands/machineuser/list\";\nexport {\n getMachineUserToken,\n type GetMachineUserTokenOptions,\n type MachineUserTokenInfo,\n} from \"./commands/machineuser/token\";\nexport { getOAuth2Client, type GetOAuth2ClientOptions } from \"./commands/oauth2client/get\";\nexport { listOAuth2Clients, type ListOAuth2ClientsOptions } from \"./commands/oauth2client/list\";\nexport type { OAuth2ClientInfo, OAuth2ClientCredentials } from \"./commands/oauth2client/transform\";\nexport { listWorkflows, type ListWorkflowsOptions } from \"./commands/workflow/list\";\nexport {\n getWorkflow,\n type GetWorkflowOptions,\n type GetWorkflowTypedOptions,\n} from \"./commands/workflow/get\";\nexport type { MachineUserName } from \"@tailor-platform/sdk\";\nexport {\n startWorkflow,\n type StartWorkflowOptions,\n type StartWorkflowTypedOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./commands/workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsOptions,\n type ListWorkflowExecutionsTypedOptions,\n type GetWorkflowExecutionOptions,\n type GetWorkflowExecutionResult,\n type WorkflowExecutionWaitInfo,\n} from \"./commands/workflow/executions\";\nexport { waitWorkflowExecution, type WorkflowWaitOutput } from \"./commands/workflow/wait\";\nexport type { WaitWorkflowExecutionOptions, WorkflowWaitResult } from \"./commands/workflow/waiter\";\nexport {\n resumeWorkflow,\n type ResumeWorkflowOptions,\n type ResumeWorkflowResultWithWait,\n} from \"./commands/workflow/resume\";\nexport type {\n WorkflowListInfo,\n WorkflowInfo,\n WorkflowExecutionInfo,\n WorkflowJobExecutionInfo,\n} from \"./commands/workflow/transform\";\nexport {\n triggerExecutor,\n type TriggerExecutorOptions,\n type TriggerExecutorTypedOptions,\n type TriggerExecutorResult,\n} from \"./commands/executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n getExecutorWaitFailureMessage,\n watchExecutorJob,\n type ListExecutorJobsOptions,\n type ListExecutorJobsTypedOptions,\n type GetExecutorJobOptions,\n type GetExecutorJobTypedOptions,\n type WatchExecutorJobOptions,\n type WatchExecutorJobTypedOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./commands/executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./commands/executor/list\";\nexport {\n getExecutor,\n type GetExecutorOptions,\n type GetExecutorTypedOptions,\n} from \"./commands/executor/get\";\nexport {\n listWebhookExecutors,\n type ListWebhookExecutorsOptions,\n type WebhookExecutorInfo,\n} from \"./commands/executor/webhook\";\nexport type {\n ExecutorJobListInfo,\n ExecutorJobInfo,\n ExecutorJobAttemptInfo,\n ExecutorListInfo,\n ExecutorInfo,\n} from \"./commands/executor/transform\";\nexport { listOrganizations, type ListOrganizationsOptions } from \"./commands/organization/list\";\nexport { getOrganization, type GetOrganizationOptions } from \"./commands/organization/get\";\nexport { updateOrganization, type UpdateOrganizationOptions } from \"./commands/organization/update\";\nexport { organizationTree, type OrganizationTreeOptions } from \"./commands/organization/tree\";\nexport type {\n UserOrganizationInfo,\n OrganizationInfo,\n FolderListInfo,\n FolderInfo,\n} from \"./commands/organization/transform\";\nexport { listFolders, type ListFoldersOptions } from \"./commands/organization/folder/list\";\nexport { getFolder, type GetFolderOptions } from \"./commands/organization/folder/get\";\nexport { createFolder, type CreateFolderOptions } from \"./commands/organization/folder/create\";\nexport { updateFolder, type UpdateFolderOptions } from \"./commands/organization/folder/update\";\nexport { deleteFolder, type DeleteFolderOptions } from \"./commands/organization/folder/delete\";\nexport { loadAccessToken, loadWorkspaceId } from \"./shared/context\";\nexport { apiCall, type ApiCallOptions, type ApiCallResult } from \"./commands/api\";\nexport { query } from \"./query\";\nexport { truncate, type TruncateOptions } from \"./commands/tailordb/truncate\";\n\n// Migration exports\nexport {\n generate as migrateGenerate,\n type GenerateOptions as MigrateGenerateOptions,\n} from \"./commands/tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./commands/tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./commands/tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n DB_TYPES_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type NormalizedSchemaSnapshot,\n type TailorDBSnapshotType,\n type SnapshotFieldConfig,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport { MIGRATION_LABEL_KEY } from \"./commands/tailordb/migrate/types\";\n\n// Seed exports\nexport { chunkSeedData, type SeedChunk, type ChunkSeedDataOptions } from \"./shared/seed-chunker\";\nexport { bundleSeedScript, type SeedBundleResult } from \"./commands/generate/seed/bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type ExecutionWaitResult,\n} from \"./shared/script-executor\";\nexport { initOperatorClient, type OperatorClient } from \"./shared/client\";\nexport type { AuthInvoker } from \"@tailor-platform/tailor-proto/auth_resource_pb\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,2BAA2B,MAAM,OAAO;;AAGrD,MAAM,oBAAoB;;;;;;;;;;;;;;;AAgB1B,SAAgB,cAAc,SAA4C;CACxE,MAAM,EAAE,MAAM,OAAO,cAAc,iBAAiB,6BAA6B;CAEjF,MAAM,YAAY,iBAAiB,eAAe;CAClD,IAAI,aAAa,GACf,MAAM,IAAI,MACR,cAAc,aAAa,0CAA0C,eAAe,sCAEtF;CAIF,MAAM,gBAAgB,MAAM,QAAQ,UAAU,KAAK,KAAK,EAAE,UAAU,KAAK,CAAC;CAE1E,IAAI,cAAc,WAAW,GAC3B,OAAO,CAAC;CAKV,IAAI,SADY,KAAK,UAAU;EAAE;EAAM;CAAM,CAC1B,CAAC,KAAK,WACvB,OAAO,CAAC;EAAE;EAAM;EAAO,OAAO;EAAG,OAAO;CAAE,CAAC;CAI7C,MAAM,SAAqC,CAAC;CAC5C,IAAI,cAAwB,CAAC;CAC7B,IAAI,eAAyB,CAAC;CAE9B,KAAK,MAAM,QAAQ,eAAe;EAChC,MAAM,cAAc,cAAc,KAAK,OAAO,+BAA+B,MAAM;EAGnF,IAAI,aAAa,SAAS,GAAG;GAC3B,MAAM,WAAW;IAA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AAS,CAAC,0BAA0B;GACpC,OAAO;GACP,OAAO;GACP,QAAQ;IACN,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,eAAe;IACf,SAAS,EACP,UAAU,WACZ;GACF;GACA,UAAU,CAAC,UAAU;GACrB,SAAS,EACP,gBAAgB,CAAC,QAAQ,QAAQ,EACnC;GACA;GACA,WAAW;IACT,mBAAmB;IACnB,aAAa;IACb,0BAA0B;GAC5B;GACA,UAAU;EACZ,CAA0B,EAEA,CAAC,OAAO,EAAE,CAAC;EAKnC,eAAe;CACjB;AACF;;;;ACnKA,MAAM,eAAe,IAAI,IAAI,iBAAiB,OAAO,KAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"lib.mjs","names":[],"sources":["../../src/cli/shared/seed-chunker.ts","../../src/cli/commands/generate/seed/bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\n * Seed data chunker for splitting large seed data into manageable message sizes.\n *\n * When seed data exceeds the gRPC message size limit, this module splits the data\n * into multiple chunks at type boundaries (or record boundaries for large types).\n */\n\nimport { assertDefined } from \"#/utils/assert\";\n\n/**\n * Seed data keyed by type name, with an array of records per type.\n */\nexport type SeedData = Record<string, Record<string, unknown>[]>;\n\n/**\n * A single chunk of seed data with metadata for ordered execution.\n */\nexport type SeedChunk = {\n data: SeedData;\n order: string[];\n index: number;\n total: number;\n};\n\n/**\n * Options for chunking seed data.\n */\nexport type ChunkSeedDataOptions = {\n /** Seed data keyed by type name */\n data: SeedData;\n /** Ordered list of type names (dependency order) */\n order: string[];\n /** Byte size of the bundled seed script code */\n codeByteSize: number;\n /** Maximum gRPC message size in bytes (default: 3.5MB) */\n maxMessageSize?: number;\n};\n\n/** Default maximum message size: 3.5MB (conservative limit for gRPC) */\nexport const DEFAULT_MAX_MESSAGE_SIZE = 3.5 * 1024 * 1024;\n\n/** Reserved bytes for message metadata overhead */\nconst METADATA_OVERHEAD = 1024;\n\n/**\n * Split seed data into chunks that fit within the gRPC message size limit.\n *\n * Algorithm:\n * 1. Calculate the available budget for the arg field (maxMessageSize - codeByteSize - overhead)\n * 2. If all data fits in one message, return a single chunk\n * 3. Otherwise, iterate through types in dependency order:\n * - If a type fits in the current chunk, add it\n * - If adding a type would exceed the budget, finalize the current chunk and start a new one\n * - If a single type exceeds the budget, split its records across multiple chunks\n * - If a single record exceeds the budget, throw an error\n * @param options - Chunking options\n * @returns Array of seed chunks\n */\nexport function chunkSeedData(options: ChunkSeedDataOptions): SeedChunk[] {\n const { data, order, codeByteSize, maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE } = options;\n\n const argBudget = maxMessageSize - codeByteSize - METADATA_OVERHEAD;\n if (argBudget <= 0) {\n throw new Error(\n `Code size (${codeByteSize} bytes) exceeds the message size limit (${maxMessageSize} bytes). ` +\n `No space left for seed data.`,\n );\n }\n\n // Filter to types that have data\n const typesWithData = order.filter((type) => (data[type]?.length ?? 0) > 0);\n\n if (typesWithData.length === 0) {\n return [];\n }\n\n // Check if all data fits in a single message\n const fullArg = JSON.stringify({ data, order });\n if (byteSize(fullArg) <= argBudget) {\n return [{ data, order, index: 0, total: 1 }];\n }\n\n // Split into multiple chunks\n const chunks: Omit<SeedChunk, \"total\">[] = [];\n let currentData: SeedData = {};\n let currentOrder: string[] = [];\n\n for (const type of typesWithData) {\n const typeRecords = assertDefined(data[type], `seed data missing for type: ${type}`);\n\n // Check if the type fits in the current chunk\n if (currentOrder.length > 0) {\n const testData = { ...currentData, [type]: typeRecords };\n const testOrder = [...currentOrder, type];\n if (byteSize(JSON.stringify({ data: testData, order: testOrder })) > argBudget) {\n // Finalize the current chunk\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n }\n\n // Check if the entire type fits in an empty chunk\n if (byteSize(JSON.stringify({ data: { [type]: typeRecords }, order: [type] })) <= argBudget) {\n currentData[type] = typeRecords;\n currentOrder.push(type);\n continue;\n }\n\n // Type is too large — split by records\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n }\n\n let recordBatch: Record<string, unknown>[] = [];\n for (const record of typeRecords) {\n if (byteSize(JSON.stringify({ data: { [type]: [record] }, order: [type] })) > argBudget) {\n const singleRecordSize = byteSize(JSON.stringify(record));\n throw new Error(\n `A single record in type \"${type}\" (${singleRecordSize} bytes) exceeds the message size budget ` +\n `(${argBudget} bytes). Consider increasing maxMessageSize or reducing the record size.`,\n );\n }\n\n const testBatch = [...recordBatch, record];\n const testData = { ...currentData, [type]: testBatch };\n const testOrder = currentOrder.includes(type) ? currentOrder : [...currentOrder, type];\n const testSize = byteSize(JSON.stringify({ data: testData, order: testOrder }));\n\n if (testSize > argBudget && recordBatch.length > 0) {\n // Finalize current chunk with accumulated records\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n currentData = {};\n currentOrder = [];\n recordBatch = [record];\n } else {\n recordBatch = testBatch;\n }\n }\n\n // Add remaining records\n if (recordBatch.length > 0) {\n currentData[type] = recordBatch;\n if (!currentOrder.includes(type)) {\n currentOrder.push(type);\n }\n }\n }\n\n // Finalize the last chunk\n if (currentOrder.length > 0) {\n chunks.push({ data: currentData, order: currentOrder, index: chunks.length });\n }\n\n const total = chunks.length;\n return chunks.map((chunk) => ({ ...chunk, total }));\n}\n\nfunction byteSize(str: string): number {\n return new TextEncoder().encode(str).length;\n}\n","/**\n * Seed script bundler for TailorDB seed data\n *\n * Bundles seed scripts to be executed via TestExecScript API\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { getDistDir } from \"#/cli/shared/dist-dir\";\nimport { platformBundleDefinePlugin } from \"#/cli/shared/platform-bundle-plugin\";\nimport ml from \"#/utils/multiline\";\n\nexport type SeedBundleResult = {\n namespace: string;\n bundledCode: string;\n typesIncluded: string[];\n};\n\nconst BATCH_SIZE = 100;\n\n/**\n * Generate seed script content for server-side execution\n * @param namespace - TailorDB namespace\n * @returns Generated seed script content\n */\nfunction generateSeedScriptContent(namespace: string): string {\n return ml /* ts */ `\n import { Kysely, TailordbDialect } from \"@tailor-platform/sdk/kysely\";\n\n type SeedInput = {\n data: Record<string, Record<string, unknown>[]>;\n order: string[];\n selfRefTypes: string[];\n };\n\n type SeedResult = {\n success: boolean;\n processed: Record<string, number>;\n errors: string[];\n };\n\n function getDB(namespace: string) {\n const client = new tailordb.Client({ namespace });\n return new Kysely<Record<string, Record<string, unknown>>>({\n dialect: new TailordbDialect(client),\n });\n }\n\n export async function main(input: SeedInput): Promise<SeedResult> {\n const db = getDB(\"${namespace}\");\n const processed: Record<string, number> = {};\n const errors: string[] = [];\n const BATCH_SIZE = ${String(BATCH_SIZE)};\n\n for (const typeName of input.order) {\n const records = input.data[typeName];\n if (!records || records.length === 0) {\n console.log(\\`[${namespace}] \\${typeName}: skipped (no data)\\`);\n continue;\n }\n\n processed[typeName] = 0;\n const hasSelfRef = (input.selfRefTypes || []).includes(typeName);\n\n try {\n if (hasSelfRef) {\n // Insert one-by-one to respect self-referencing foreign key order\n for (const record of records) {\n await db.insertInto(typeName).values(record).execute();\n processed[typeName] += 1;\n }\n console.log(\\`[${namespace}] \\${typeName}: \\${processed[typeName]}/\\${records.length} (one-by-one)\\`);\n } else {\n for (let i = 0; i < records.length; i += BATCH_SIZE) {\n const batch = records.slice(i, i + BATCH_SIZE);\n await db.insertInto(typeName).values(batch).execute();\n processed[typeName] += batch.length;\n console.log(\\`[${namespace}] \\${typeName}: \\${processed[typeName]}/\\${records.length}\\`);\n }\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`\\${typeName}: \\${message}\\`);\n console.error(\\`[${namespace}] \\${typeName}: failed - \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n processed,\n errors,\n };\n }\n `;\n}\n\n/**\n * Bundle a seed script for server-side execution\n *\n * Creates an entry that:\n * 1. Defines getDB() function inline\n * 2. Processes data in batches using Kysely\n * 3. Reports progress via console.log\n * 4. Exports as main() for TestExecScript\n * @param namespace - TailorDB namespace\n * @param typeNames - List of type names to include in the seed\n * @returns Bundled seed script result\n */\nexport async function bundleSeedScript(\n namespace: string,\n typeNames: string[],\n): Promise<SeedBundleResult> {\n // Output directory in .tailor (relative to project root)\n const outputDir = path.resolve(getDistDir(), \"seed\");\n fs.mkdirSync(outputDir, { recursive: true });\n\n // Entry file in output directory\n const entryPath = path.join(outputDir, `seed_${namespace}.entry.ts`);\n\n // Generate seed script content\n const entryContent = generateSeedScriptContent(namespace);\n fs.writeFileSync(entryPath, entryContent);\n\n let tsconfig: string | undefined;\n try {\n tsconfig = await resolveTSConfig();\n } catch {\n tsconfig = undefined;\n }\n\n // Bundle with tree-shaking (write: false to avoid unnecessary disk I/O)\n const result = await rolldown.build({\n plugins: [platformBundleDefinePlugin],\n input: entryPath,\n write: false,\n output: {\n format: \"esm\",\n sourcemap: false,\n minify: false,\n codeSplitting: false,\n globals: {\n tailordb: \"tailordb\",\n },\n },\n external: [\"tailordb\"],\n resolve: {\n conditionNames: [\"node\", \"import\"],\n },\n tsconfig,\n treeshake: {\n moduleSideEffects: false,\n annotations: true,\n unknownGlobalSideEffects: false,\n },\n logLevel: \"silent\",\n } as rolldown.BuildOptions);\n\n const bundledCode = result.output[0].code;\n\n return {\n namespace,\n bundledCode,\n typesIncluded: typeNames,\n };\n}\n","// CLI API exports for programmatic usage\nimport { registerTsHook } from \"./shared/register-ts-hook\";\n\nawait registerTsHook(new URL(\"./ts-hook.mjs\", import.meta.url));\n\nexport { deploy, deploy as apply } from \"./commands/deploy/deploy\";\nexport type { DeployOptions, DeployOptions as ApplyOptions } from \"./commands/deploy/deploy\";\nexport type { BundledScripts } from \"./commands/deploy/function-registry\";\nexport { generate } from \"./commands/generate/service\";\nexport type { GenerateOptions } from \"./commands/generate/options\";\nexport { loadConfig, type LoadedConfig } from \"./shared/config-loader\";\nexport { generateUserTypes } from \"./shared/type-generator\";\nexport type { GeneratorResult, PluginAttachment } from \"#/plugin/types\";\nexport type { TailorDBType, TypeSourceInfoEntry } from \"#/parser/service/tailordb/types\";\nexport type { Resolver } from \"#/types/resolver.generated\";\nexport type { Executor } from \"#/types/executor.generated\";\n\n/** @deprecated Import from '@tailor-platform/sdk/plugin/kysely-type' instead */\nexport { kyselyTypePlugin } from \"#/plugin/builtin/kysely-type/index\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/enum-constants' instead */\nexport { enumConstantsPlugin } from \"#/plugin/builtin/enum-constants/index\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/file-utils' instead */\nexport { fileUtilsPlugin } from \"#/plugin/builtin/file-utils/index\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/seed' instead */\nexport { seedPlugin } from \"#/plugin/builtin/seed/index\";\n\nexport {\n show,\n type ShowOptions,\n type ApplicationInfo,\n type ShowInfo,\n type AIGatewayInfo,\n} from \"./commands/show\";\nexport { remove, type RemoveOptions } from \"./commands/remove\";\nexport { createWorkspace, type CreateWorkspaceOptions } from \"./commands/workspace/create\";\nexport { listWorkspaces, type ListWorkspacesOptions } from \"./commands/workspace/list\";\nexport { deleteWorkspace, type DeleteWorkspaceOptions } from \"./commands/workspace/delete\";\nexport { getWorkspace, type GetWorkspaceOptions } from \"./commands/workspace/get\";\nexport { restoreWorkspace, type RestoreWorkspaceOptions } from \"./commands/workspace/restore\";\nexport type { WorkspaceInfo, WorkspaceDetails } from \"./commands/workspace/transform\";\nexport { listUsers, type ListUsersOptions } from \"./commands/workspace/user/list\";\nexport { inviteUser, type InviteUserOptions } from \"./commands/workspace/user/invite\";\nexport { updateUser, type UpdateUserOptions } from \"./commands/workspace/user/update\";\nexport { removeUser, type RemoveUserOptions } from \"./commands/workspace/user/remove\";\nexport type { UserInfo } from \"./commands/workspace/user/transform\";\nexport { listApps, type ListAppsOptions } from \"./commands/workspace/app/list\";\nexport {\n getAppHealth,\n type HealthOptions as GetAppHealthOptions,\n} from \"./commands/workspace/app/health\";\nexport type { AppInfo, AppHealthInfo } from \"./commands/workspace/app/transform\";\nexport { getFunctionRegistry, type GetFunctionRegistryOptions } from \"./commands/function/get\";\nexport {\n listFunctionRegistries,\n type ListFunctionRegistriesOptions,\n} from \"./commands/function/list\";\nexport type { FunctionRegistryInfo } from \"./commands/function/transform\";\nexport {\n listMachineUsers,\n type ListMachineUsersOptions,\n type MachineUserInfo,\n} from \"./commands/machineuser/list\";\nexport {\n getMachineUserToken,\n type GetMachineUserTokenOptions,\n type MachineUserTokenInfo,\n} from \"./commands/machineuser/token\";\nexport { getOAuth2Client, type GetOAuth2ClientOptions } from \"./commands/oauth2client/get\";\nexport { listOAuth2Clients, type ListOAuth2ClientsOptions } from \"./commands/oauth2client/list\";\nexport type { OAuth2ClientInfo, OAuth2ClientCredentials } from \"./commands/oauth2client/transform\";\nexport { listWorkflows, type ListWorkflowsOptions } from \"./commands/workflow/list\";\nexport {\n getWorkflow,\n type GetWorkflowOptions,\n type GetWorkflowTypedOptions,\n} from \"./commands/workflow/get\";\nexport type { MachineUserName } from \"@tailor-platform/sdk\";\nexport {\n startWorkflow,\n type StartWorkflowOptions,\n type StartWorkflowTypedOptions,\n type StartWorkflowResultWithWait,\n type WaitOptions,\n} from \"./commands/workflow/start\";\nexport {\n listWorkflowExecutions,\n getWorkflowExecution,\n type ListWorkflowExecutionsOptions,\n type ListWorkflowExecutionsTypedOptions,\n type GetWorkflowExecutionOptions,\n type GetWorkflowExecutionResult,\n type WorkflowExecutionWaitInfo,\n} from \"./commands/workflow/executions\";\nexport { waitWorkflowExecution, type WorkflowWaitOutput } from \"./commands/workflow/wait\";\nexport type { WaitWorkflowExecutionOptions, WorkflowWaitResult } from \"./commands/workflow/waiter\";\nexport {\n resumeWorkflow,\n type ResumeWorkflowOptions,\n type ResumeWorkflowResultWithWait,\n} from \"./commands/workflow/resume\";\nexport type {\n WorkflowListInfo,\n WorkflowInfo,\n WorkflowExecutionInfo,\n WorkflowJobExecutionInfo,\n} from \"./commands/workflow/transform\";\nexport {\n triggerExecutor,\n type TriggerExecutorOptions,\n type TriggerExecutorTypedOptions,\n type TriggerExecutorResult,\n} from \"./commands/executor/trigger\";\nexport {\n listExecutorJobs,\n getExecutorJob,\n getExecutorWaitFailureMessage,\n watchExecutorJob,\n type ListExecutorJobsOptions,\n type ListExecutorJobsTypedOptions,\n type GetExecutorJobOptions,\n type GetExecutorJobTypedOptions,\n type WatchExecutorJobOptions,\n type WatchExecutorJobTypedOptions,\n type ExecutorJobDetailInfo,\n type WatchExecutorJobResult,\n} from \"./commands/executor/jobs\";\nexport { listExecutors, type ListExecutorsOptions } from \"./commands/executor/list\";\nexport {\n getExecutor,\n type GetExecutorOptions,\n type GetExecutorTypedOptions,\n} from \"./commands/executor/get\";\nexport {\n listWebhookExecutors,\n type ListWebhookExecutorsOptions,\n type WebhookExecutorInfo,\n} from \"./commands/executor/webhook\";\nexport type {\n ExecutorJobListInfo,\n ExecutorJobInfo,\n ExecutorJobAttemptInfo,\n ExecutorListInfo,\n ExecutorInfo,\n} from \"./commands/executor/transform\";\nexport { listOrganizations, type ListOrganizationsOptions } from \"./commands/organization/list\";\nexport { getOrganization, type GetOrganizationOptions } from \"./commands/organization/get\";\nexport { updateOrganization, type UpdateOrganizationOptions } from \"./commands/organization/update\";\nexport { organizationTree, type OrganizationTreeOptions } from \"./commands/organization/tree\";\nexport type {\n UserOrganizationInfo,\n OrganizationInfo,\n FolderListInfo,\n FolderInfo,\n} from \"./commands/organization/transform\";\nexport { listFolders, type ListFoldersOptions } from \"./commands/organization/folder/list\";\nexport { getFolder, type GetFolderOptions } from \"./commands/organization/folder/get\";\nexport { createFolder, type CreateFolderOptions } from \"./commands/organization/folder/create\";\nexport { updateFolder, type UpdateFolderOptions } from \"./commands/organization/folder/update\";\nexport { deleteFolder, type DeleteFolderOptions } from \"./commands/organization/folder/delete\";\nexport { loadAccessToken, loadWorkspaceId } from \"./shared/context\";\nexport { apiCall, type ApiCallOptions, type ApiCallResult } from \"./commands/api\";\nexport { query } from \"./query\";\nexport { truncate, type TruncateOptions } from \"./commands/tailordb/truncate\";\n\n// Migration exports\nexport {\n generate as migrateGenerate,\n type GenerateOptions as MigrateGenerateOptions,\n} from \"./commands/tailordb/migrate/generate\";\nexport {\n createSnapshotFromLocalTypes,\n reconstructSnapshotFromMigrations,\n compareSnapshots,\n getNextMigrationNumber,\n getLatestMigrationNumber,\n getMigrationFiles,\n compareLocalTypesWithSnapshot,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport {\n getNamespacesWithMigrations,\n type NamespaceWithMigrations,\n} from \"./commands/tailordb/migrate/config\";\nexport {\n hasChanges,\n formatMigrationDiff,\n formatDiffSummary,\n type MigrationDiff,\n type BreakingChangeInfo,\n} from \"./commands/tailordb/migrate/diff-calculator\";\nexport {\n SCHEMA_FILE_NAME,\n DIFF_FILE_NAME,\n MIGRATE_FILE_NAME,\n DB_TYPES_FILE_NAME,\n INITIAL_SCHEMA_NUMBER,\n getMigrationDirPath,\n getMigrationFilePath,\n type SchemaSnapshot,\n type NormalizedSchemaSnapshot,\n type TailorDBSnapshotType,\n type SnapshotFieldConfig,\n} from \"./commands/tailordb/migrate/snapshot\";\nexport { MIGRATION_LABEL_KEY } from \"./commands/tailordb/migrate/types\";\n\n// Seed exports\nexport { chunkSeedData, type SeedChunk, type ChunkSeedDataOptions } from \"./shared/seed-chunker\";\nexport { bundleSeedScript, type SeedBundleResult } from \"./commands/generate/seed/bundler\";\nexport {\n bundleMigrationScript,\n type MigrationBundleResult,\n} from \"./commands/tailordb/migrate/bundler\";\nexport {\n executeScript,\n waitForExecution,\n type ScriptExecutionOptions,\n type ScriptExecutionResult,\n type ExecutionWaitResult,\n} from \"./shared/script-executor\";\nexport { initOperatorClient, type OperatorClient } from \"./shared/client\";\nexport type { AuthInvoker } from \"@tailor-platform/tailor-proto/auth_resource_pb\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuC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ema: z.ZodObject<{
5
4
  workspaceId: z.ZodOptional<z.ZodString>;
@@ -1 +1,12 @@
1
- export { };
1
+ import "../../plugin/manager.mjs";
2
+ import "./tailordb/service.mjs";
3
+ import "./auth/service.mjs";
4
+ import "../../configure/config/types.mjs";
5
+ import "./executor/service.mjs";
6
+ import "../cache/bundle-cache.mjs";
7
+ import "./http-adapter/bundler.mjs";
8
+ import "./http-adapter/service.mjs";
9
+ import "./resolver/service.mjs";
10
+ import "./workflow/bundler.mjs";
11
+ import "./workflow/service.mjs";
12
+ import "../shared/config-loader.mjs";
@@ -1 +1,3 @@
1
+ import "../tailordb/service.mjs";
2
+ import "../../../parser/service/auth/index.mjs";
1
3
  import { z } from "zod";
@@ -1 +1 @@
1
- export { };
1
+ import "../../../configure/config/types.mjs";
@@ -1 +1,3 @@
1
- export { };
1
+ import "../../../configure/config/types.mjs";
2
+ import "../../cache/bundle-cache.mjs";
3
+ import "../../../parser/service/http-adapter/index.mjs";
@@ -1 +1,2 @@
1
- export { };
1
+ import "../../../configure/config/types.mjs";
2
+ import "../../../parser/service/http-adapter/index.mjs";
@@ -1 +1 @@
1
- export { };
1
+ import "../../../configure/config/types.mjs";
@@ -1 +1,3 @@
1
- export { };
1
+ import "../../../parser/service/tailordb/types.mjs";
2
+ import "../../../plugin/types.mjs";
3
+ import "../../../plugin/manager.mjs";
@@ -1 +1,2 @@
1
- export { };
1
+ import "../../../configure/config/types.mjs";
2
+ import "../../cache/bundle-cache.mjs";
@@ -1 +1 @@
1
- export { };
1
+ import "../../../configure/config/types.mjs";
@@ -1,5 +1,5 @@
1
+ import "../../tailor-proto/src/tailor/v1/resource_pb.mjs";
1
2
  import { z } from "zod";
2
-
3
3
  //#region src/cli/shared/args.d.ts
4
4
  /**
5
5
  * Schema for sort order (`asc` or `desc`).
@@ -17,8 +17,8 @@ import { CreateWorkflowJobFunctionExecutionPolicyRequestSchema, CreateWorkflowJo
17
17
  import { GetMetadataRequestSchema, GetMetadataResponseSchema, SetMetadataRequestSchema, SetMetadataResponseSchema } from "../../tailor-proto/src/tailor/v1/metadata_pb.mjs";
18
18
  import { CreateOTLPExporterRequestSchema, CreateOTLPExporterResponseSchema, CreateResourceAttributesConfigRequestSchema, CreateResourceAttributesConfigResponseSchema, DeleteOTLPExporterRequestSchema, DeleteOTLPExporterResponseSchema, DeleteResourceAttributesConfigRequestSchema, DeleteResourceAttributesConfigResponseSchema, GetOTLPExporterRequestSchema, GetOTLPExporterResponseSchema, GetResourceAttributesConfigRequestSchema, GetResourceAttributesConfigResponseSchema, ListOTLPExportersRequestSchema, ListOTLPExportersResponseSchema, TestOTLPExporterRequestSchema, TestOTLPExporterResponseSchema, UpdateOTLPExporterRequestSchema, UpdateOTLPExporterResponseSchema, UpdateResourceAttributesConfigRequestSchema, UpdateResourceAttributesConfigResponseSchema } from "../../tailor-proto/src/tailor/v1/telemetryrouter_pb.mjs";
19
19
  import { OperatorService, PingRequestSchema, PingResponseSchema } from "../../tailor-proto/src/tailor/v1/service_pb.mjs";
20
+ import "@badgateway/oauth2-client";
20
21
  import { Client } from "@connectrpc/connect";
21
-
22
22
  //#region src/cli/shared/client.d.ts
23
23
  type PlatformClientConfig = {
24
24
  platformUrl?: string;
@@ -1,6 +1,5 @@
1
1
  import { Plugin } from "../../plugin/types.mjs";
2
2
  import { AppConfig } from "../../configure/config/types.mjs";
3
-
4
3
  //#region src/cli/shared/config-loader.d.ts
5
4
  /**
6
5
  * Loaded configuration with resolved path
@@ -1,5 +1,6 @@
1
+ import "./client.mjs";
2
+ import "./args.mjs";
1
3
  import { z } from "zod";
2
-
3
4
  //#region src/cli/shared/context.d.ts
4
5
  type LoadWorkspaceIdOptions = {
5
6
  workspaceId?: string;
@@ -2,7 +2,6 @@ import { AuthInvoker } from "../../tailor-proto/src/tailor/v1/auth_resource_pb.m
2
2
  import { FunctionExecution_Status } from "../../tailor-proto/src/tailor/v1/function_resource_pb.mjs";
3
3
  import { OperatorClient } from "./client.mjs";
4
4
  import { Jsonifiable } from "type-fest";
5
-
6
5
  //#region src/cli/shared/script-executor.d.ts
7
6
  /**
8
7
  * Options for script execution
@@ -22,9 +22,13 @@ type SeedChunk = {
22
22
  * Options for chunking seed data.
23
23
  */
24
24
  type ChunkSeedDataOptions = {
25
- /** Seed data keyed by type name */data: SeedData; /** Ordered list of type names (dependency order) */
26
- order: string[]; /** Byte size of the bundled seed script code */
27
- codeByteSize: number; /** Maximum gRPC message size in bytes (default: 3.5MB) */
25
+ /** Seed data keyed by type name */
26
+ data: SeedData;
27
+ /** Ordered list of type names (dependency order) */
28
+ order: string[];
29
+ /** Byte size of the bundled seed script code */
30
+ codeByteSize: number;
31
+ /** Maximum gRPC message size in bytes (default: 3.5MB) */
28
32
  maxMessageSize?: number;
29
33
  };
30
34
  /**
@@ -1,5 +1,4 @@
1
1
  import { AppConfig } from "../../configure/config/types.mjs";
2
-
3
2
  //#region src/cli/shared/type-generator.d.ts
4
3
  /**
5
4
  * Options for generating user type definitions
@@ -1,5 +1,5 @@
1
1
  # politty-completion-version: 1
2
- # politty-bin-sig: 1783686900
2
+ # politty-bin-sig: 1784091365
3
3
  # politty-bin-path: /home/runner/work/sdk/sdk/node_modules/.bin/tailor
4
4
  # program: tailor
5
5
  # shell: zsh
@@ -1,6 +1,5 @@
1
1
  import { Plugin } from "../../plugin/types.mjs";
2
2
  import { AppConfig } from "./types.mjs";
3
-
4
3
  //#region src/configure/config/index.d.ts
5
4
  /**
6
5
  * Define a Tailor SDK application configuration with shallow exactness.
@@ -6,7 +6,6 @@ import { SecretsConfig } from "../services/secrets/types.mjs";
6
6
  import { StaticWebsiteConfig } from "../services/staticwebsite/types.mjs";
7
7
  import { ExecutionPolicyInstance } from "../services/workflow/execution-policy.types.mjs";
8
8
  import { LogLevelEnum } from "../../types/app-config.generated.mjs";
9
-
10
9
  //#region src/configure/config/types.d.ts
11
10
  type LogLevel = LogLevelEnum;
12
11
  type LogLevelInput = LogLevel | (string & {});
@@ -33,7 +32,8 @@ type WorkflowServiceConfig = {
33
32
  files: string[];
34
33
  job_files?: string[];
35
34
  ignores?: string[];
36
- job_ignores?: string[]; /** Workspace-level execution policies for workflow job functions. */
35
+ job_ignores?: string[];
36
+ /** Workspace-level execution policies for workflow job functions. */
37
37
  executionPolicies?: Record<string, ExecutionPolicyInstance>;
38
38
  };
39
39
  type WorkflowServiceInput = WorkflowServiceConfig;
@@ -1,6 +1,6 @@
1
- import { AttributeList, Attributes, Env, TailorPrincipal } from "../runtime/types.mjs";
2
- import { InferFieldsOutput, output as output$1 } from "../types/helpers.mjs";
3
1
  import { ArrayFieldOutput, FieldMetadata, FieldOptions, FieldOutput, TailorFieldType } from "./types/field.types.mjs";
2
+ import { AttributeList, Attributes, Env, TailorPrincipal } from "../runtime/types.mjs";
3
+ import { DeepWritable, NullableToOptional, output as output$1 } from "../types/helpers.mjs";
4
4
  import { PluginAttachment } from "./services/tailordb/types.mjs";
5
5
  import { AuthConnectionConfig, AuthConnectionOAuth2Config } from "../types/auth-connection.generated.mjs";
6
6
  import { BuiltinIdP, IDToken, IdProvider, OAuth2ClientInput, OIDC, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAuthorization, SCIMConfig, SCIMResource, TenantProvider } from "../types/auth.generated.mjs";
@@ -19,6 +19,8 @@ import { ExecutionPolicyConcurrency, ExecutionPolicyDefInput, ExecutionPolicyExa
19
19
  import { ExecutorServiceConfig, ExecutorServiceInput, ResolverExternalConfig, ResolverServiceConfig, ResolverServiceInput, WorkflowServiceConfig, WorkflowServiceInput } from "./config/types.mjs";
20
20
  import { ConcurrencyPolicy, RetryPolicy } from "../types/workflow.generated.mjs";
21
21
  import { TailorAnyField, TailorField } from "./types/type.mjs";
22
+ import "./types/machine-user.mjs";
23
+ import "./types/index.mjs";
22
24
  import { IdpName, IdpNameRegistry } from "./types/idp-name.mjs";
23
25
  import { ConnectionName, ConnectionNameRegistry } from "./types/connection-name.mjs";
24
26
  import { AIGatewayName, AIGatewayNameRegistry } from "./types/aigateway-name.mjs";
@@ -41,8 +43,8 @@ import { IdPPermission, IdPPermissionCondition, unsafeAllowAllIdPPermission } fr
41
43
  import { defineIdp } from "./services/idp/index.mjs";
42
44
  import { defineSecretManager } from "./services/secrets/index.mjs";
43
45
  import { HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, createHttpAdapter } from "./services/http-adapter/http-adapter.mjs";
46
+ import "./services/index.mjs";
44
47
  import { defineConfig, definePlugins } from "./config/index.mjs";
45
-
46
48
  //#region src/configure/index.d.ts
47
49
  type TailorOutput<T> = output$1<T>;
48
50
  type infer<T> = TailorOutput<T>;
@@ -114,7 +116,15 @@ declare const t: {
114
116
  array: Opt extends {
115
117
  array: true;
116
118
  } ? true : false;
117
- }, FieldOutput<InferFieldsOutput<F>, Opt>, FieldMetadata, TailorFieldType>;
119
+ }, FieldOutput<Omit<DeepWritable<NullableToOptional<{ [K_2 in keyof F]: output$1<F[K_2]>; }> extends (infer T_1) ? { [K_1 in keyof T_1 as string extends K_1 ? never : K_1]: T_1[K_1]; } : never>, { [K_3 in keyof F]: F[K_3] extends {
120
+ _defined: {
121
+ default: true;
122
+ };
123
+ } ? K_3 : never; }[keyof F] & string> & { [K_4 in { [K_3 in keyof F]: F[K_3] extends {
124
+ _defined: {
125
+ default: true;
126
+ };
127
+ } ? K_3 : never; }[keyof F] & keyof F]?: output$1<F[K_4]> | undefined; } extends (infer T) ? { [K in keyof T as string extends K ? never : K]: T[K]; } : never, Opt>, FieldMetadata, TailorFieldType>;
118
128
  };
119
129
  declare namespace t {
120
130
  type output<T> = TailorOutput<T>;
@@ -1,9 +1,203 @@
1
- import { t as t$1 } from "../types-CXF2OYdR.mjs";
1
+ import { n as parseInternal, r as mapAllowedValues, t as db } from "../schema-iCd1ugGp.mjs";
2
2
  import { t as brandValue } from "../brand-Eo4pLXPJ.mjs";
3
- import { t as db } from "../schema-C4LYbXVG.mjs";
4
3
  import { a as registerJob, n as dispatchTriggerJob, r as dispatchTriggerWorkflow } from "../registry-BSbq6SPo.mjs";
5
4
  import { i as withWorkflowTestInvoker } from "../test-env-key-D7UkZp99.mjs";
6
5
 
6
+ //#region src/configure/types/type.ts
7
+ function createTailorField(type, options, fields, values, metadata) {
8
+ const _metadata = metadata ? {
9
+ ...metadata,
10
+ ...metadata.allowedValues && { allowedValues: metadata.allowedValues.map((v) => ({ ...v })) },
11
+ ...metadata.validate && { validate: metadata.validate.map((v) => Array.isArray(v) ? [...v] : v) }
12
+ } : { required: true };
13
+ if (!metadata) {
14
+ if (options) {
15
+ if (options.optional === true) _metadata.required = false;
16
+ if (options.array === true) _metadata.array = true;
17
+ }
18
+ if (values) _metadata.allowedValues = mapAllowedValues(values);
19
+ }
20
+ function parseInternal$1(args) {
21
+ return parseInternal({
22
+ ...args,
23
+ field
24
+ });
25
+ }
26
+ /**
27
+ * Clone the field and apply metadata updates to the clone.
28
+ * The original instance is never mutated, so a field shared across places
29
+ * cannot leak metadata between them.
30
+ * @param metadataUpdates - Metadata properties to overwrite on the clone
31
+ * @returns A new field with the updated metadata
32
+ */
33
+ function cloneWith(metadataUpdates) {
34
+ const cloned = field.clone();
35
+ Object.assign(cloned._metadata, metadataUpdates);
36
+ return cloned;
37
+ }
38
+ const field = {
39
+ type,
40
+ fields: fields ?? {},
41
+ _defined: void 0,
42
+ _output: void 0,
43
+ _metadata,
44
+ get metadata() {
45
+ return { ...this._metadata };
46
+ },
47
+ description(description) {
48
+ return cloneWith({ description });
49
+ },
50
+ typeName(typeName) {
51
+ return cloneWith({ typeName });
52
+ },
53
+ validate(...validateInputs) {
54
+ return cloneWith({ validate: validateInputs });
55
+ },
56
+ parse(args) {
57
+ return parseInternal$1({
58
+ value: args.value,
59
+ data: args.data,
60
+ invoker: args.invoker,
61
+ pathArray: []
62
+ });
63
+ },
64
+ _parseInternal: parseInternal$1,
65
+ clone() {
66
+ let clonedFields = fields;
67
+ if (fields) {
68
+ const cloned = {};
69
+ for (const [key, nestedField] of Object.entries(fields)) cloned[key] = nestedField.clone();
70
+ clonedFields = cloned;
71
+ }
72
+ return createTailorField(type, options, clonedFields, values, this._metadata);
73
+ }
74
+ };
75
+ return field;
76
+ }
77
+ /**
78
+ * Create a UUID field for resolver input/output.
79
+ * @param options - Field configuration options
80
+ * @returns A UUID field
81
+ * @example t.uuid()
82
+ */
83
+ function uuid(options) {
84
+ return createTailorField("uuid", options);
85
+ }
86
+ /**
87
+ * Create a string field for resolver input/output.
88
+ * @param options - Field configuration options
89
+ * @returns A string field
90
+ * @example t.string()
91
+ * @example t.string({ optional: true })
92
+ * @example t.string({ array: true })
93
+ */
94
+ function string(options) {
95
+ return createTailorField("string", options);
96
+ }
97
+ /**
98
+ * Create a boolean field for resolver input/output.
99
+ * @param options - Field configuration options
100
+ * @returns A boolean field
101
+ * @example t.bool()
102
+ */
103
+ function bool(options) {
104
+ return createTailorField("boolean", options);
105
+ }
106
+ /**
107
+ * Create an integer field for resolver input/output.
108
+ * @param options - Field configuration options
109
+ * @returns An integer field
110
+ * @example t.int()
111
+ */
112
+ function int(options) {
113
+ return createTailorField("integer", options);
114
+ }
115
+ /**
116
+ * Create a float field for resolver input/output.
117
+ * @param options - Field configuration options
118
+ * @returns A float field
119
+ * @example t.float()
120
+ */
121
+ function float(options) {
122
+ return createTailorField("float", options);
123
+ }
124
+ /**
125
+ * Create a decimal field for resolver input/output (stored as string for precision).
126
+ * @param options - Field configuration options
127
+ * @returns A decimal field
128
+ * @example t.decimal()
129
+ * @example t.decimal({ optional: true })
130
+ */
131
+ function decimal(options) {
132
+ return createTailorField("decimal", options);
133
+ }
134
+ /**
135
+ * Create a date field for resolver input/output.
136
+ * @param options - Field configuration options
137
+ * @returns A date field
138
+ * @example t.date()
139
+ */
140
+ function date(options) {
141
+ return createTailorField("date", options);
142
+ }
143
+ /**
144
+ * Create a datetime field for resolver input/output.
145
+ * @param options - Field configuration options
146
+ * @returns A datetime field
147
+ * @example t.datetime()
148
+ */
149
+ function datetime(options) {
150
+ return createTailorField("datetime", options);
151
+ }
152
+ /**
153
+ * Create a time field for resolver input/output.
154
+ * @param options - Field configuration options
155
+ * @returns A time field
156
+ * @example t.time()
157
+ */
158
+ function time(options) {
159
+ return createTailorField("time", options);
160
+ }
161
+ /**
162
+ * Create an enum field for resolver input/output.
163
+ * @param values - Array of allowed string values
164
+ * @param options - Field configuration options
165
+ * @returns An enum field
166
+ * @example t.enum(["active", "inactive"])
167
+ */
168
+ function _enum(values, options) {
169
+ return createTailorField("enum", options, void 0, values);
170
+ }
171
+ /**
172
+ * Create a nested object field for resolver input/output.
173
+ * @param fields - Record of field definitions
174
+ * @param options - Field options (optional, array)
175
+ * @returns A nested object field
176
+ * @example
177
+ * // Single object:
178
+ * output: t.object({ name: t.string(), email: t.string() })
179
+ * @example
180
+ * // Array of objects:
181
+ * items: t.object({ name: t.string() }, { array: true })
182
+ */
183
+ function object(fields, options) {
184
+ return createTailorField("nested", options, fields);
185
+ }
186
+ const t$1 = {
187
+ uuid,
188
+ string,
189
+ bool,
190
+ int,
191
+ float,
192
+ decimal,
193
+ date,
194
+ datetime,
195
+ time,
196
+ enum: _enum,
197
+ object
198
+ };
199
+
200
+ //#endregion
7
201
  //#region src/configure/services/auth/index.ts
8
202
  /* @__NO_SIDE_EFFECTS__ */
9
203
  function defineAuth(name, config) {