@tailor-platform/sdk 1.74.0 → 1.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/application-BJKNlv8c.mjs +3 -0
  3. package/dist/{application-DwmoI6ZQ.mjs → application-DYshsH-K.mjs} +61 -11
  4. package/dist/application-DYshsH-K.mjs.map +1 -0
  5. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  6. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
  7. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -16
  8. package/dist/cli/index.mjs +23 -34
  9. package/dist/cli/index.mjs.map +1 -1
  10. package/dist/cli/lib.d.mts +2 -2
  11. package/dist/cli/lib.mjs +3 -3
  12. package/dist/cli/lib.mjs.map +1 -1
  13. package/dist/completion/zsh-worker.zsh +9 -9
  14. package/dist/configure/config/types.d.mts +3 -1
  15. package/dist/configure/index.d.mts +3 -1
  16. package/dist/configure/index.mjs +113 -5
  17. package/dist/configure/index.mjs.map +1 -1
  18. package/dist/configure/services/index.d.mts +3 -1
  19. package/dist/configure/services/tailordb/schema.d.mts +5 -19
  20. package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
  21. package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
  22. package/dist/configure/services/workflow/index.d.mts +3 -1
  23. package/dist/configure/services/workflow/job.d.mts +7 -3
  24. package/dist/configure/types/field-runtime.d.mts +17 -0
  25. package/dist/configure/types/type.d.mts +1 -18
  26. package/dist/field-runtime-9bfXBAOK.mjs +183 -0
  27. package/dist/field-runtime-9bfXBAOK.mjs.map +1 -0
  28. package/dist/{globals-B8XX5TRB.mjs → globals-CcU1ONiK.mjs} +2 -2
  29. package/dist/globals-CcU1ONiK.mjs.map +1 -0
  30. package/dist/{job-CtU73PGa.mjs → job-D-PbD1P3.mjs} +5 -3
  31. package/dist/job-D-PbD1P3.mjs.map +1 -0
  32. package/dist/plugin/builtin/seed/index.mjs +1 -1
  33. package/dist/{registry-BozuxbPp.mjs → registry-NfSW0BRo.mjs} +4 -3
  34. package/dist/registry-NfSW0BRo.mjs.map +1 -0
  35. package/dist/runtime/globals.d.mts +1 -1
  36. package/dist/runtime/index.d.mts +1 -1
  37. package/dist/runtime/workflow.d.mts +22 -3
  38. package/dist/{runtime-Zkg3SUwi.mjs → runtime-CJ5usBOu.mjs} +456 -397
  39. package/dist/runtime-CJ5usBOu.mjs.map +1 -0
  40. package/dist/{schema-DAdZSFOd.mjs → schema-Dl_y0m9e.mjs} +8 -167
  41. package/dist/schema-Dl_y0m9e.mjs.map +1 -0
  42. package/dist/secretmanager-Bd45j7an.mjs +98 -0
  43. package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
  44. package/dist/{seed-DoMTMLcm.mjs → seed-fm0LeYP2.mjs} +14 -3
  45. package/dist/seed-fm0LeYP2.mjs.map +1 -0
  46. package/dist/{service_pb-CIrhGwHk.mjs → service_pb-4unFyubn.mjs} +16 -6
  47. package/dist/{service_pb-CIrhGwHk.mjs.map → service_pb-4unFyubn.mjs.map} +1 -1
  48. package/dist/{service_pb-DjwIn4jO.mjs → service_pb-D-PXRoMg.mjs} +1 -1
  49. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -1
  50. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -9
  51. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -1
  52. package/dist/types-BwzB2okW.mjs +199 -0
  53. package/dist/types-BwzB2okW.mjs.map +1 -0
  54. package/dist/types-KlawuVKa.mjs +4 -0
  55. package/dist/utils/test/index.mjs +1 -1
  56. package/dist/utils/test/index.mjs.map +1 -1
  57. package/dist/vitest/environment.mjs +1 -1
  58. package/dist/vitest/index.d.mts +8 -1
  59. package/dist/vitest/index.mjs +779 -1
  60. package/dist/vitest/index.mjs.map +1 -1
  61. package/dist/vitest/mock.d.mts +8 -363
  62. package/dist/vitest/mocks/aigateway.d.mts +30 -0
  63. package/dist/vitest/mocks/authconnection.d.mts +28 -0
  64. package/dist/vitest/mocks/file.d.mts +41 -0
  65. package/dist/vitest/mocks/iconv.d.mts +27 -0
  66. package/dist/vitest/mocks/idp.d.mts +44 -0
  67. package/dist/vitest/mocks/secretmanager.d.mts +33 -0
  68. package/dist/vitest/mocks/tailordb.d.mts +71 -0
  69. package/dist/vitest/mocks/workflow.d.mts +117 -0
  70. package/dist/vitest/setup.mjs +2 -2
  71. package/dist/workflow-DSwnYPPP.mjs.map +1 -1
  72. package/docs/configuration.md +24 -0
  73. package/docs/services/workflow.md +78 -0
  74. package/package.json +8 -8
  75. package/dist/application-BndtMTFY.mjs +0 -3
  76. package/dist/application-DwmoI6ZQ.mjs.map +0 -1
  77. package/dist/field-DOsJCPFa.mjs +0 -22
  78. package/dist/field-DOsJCPFa.mjs.map +0 -1
  79. package/dist/globals-B8XX5TRB.mjs.map +0 -1
  80. package/dist/job-CtU73PGa.mjs.map +0 -1
  81. package/dist/mock-Ce1GCi4-.mjs +0 -871
  82. package/dist/mock-Ce1GCi4-.mjs.map +0 -1
  83. package/dist/registry-BozuxbPp.mjs.map +0 -1
  84. package/dist/runtime-Zkg3SUwi.mjs.map +0 -1
  85. package/dist/schema-DAdZSFOd.mjs.map +0 -1
  86. package/dist/seed-DoMTMLcm.mjs.map +0 -1
  87. package/dist/types-qhFZ8y9B.mjs +0 -4
  88. package/dist/types-ywCGpzDZ.mjs +0 -360
  89. package/dist/types-ywCGpzDZ.mjs.map +0 -1
@@ -9,7 +9,7 @@ import { OperatorClient, initOperatorClient } from "./shared/client.mjs";
9
9
  import { NormalizedSchemaSnapshot, SchemaSnapshot, SnapshotFieldConfig, TailorDBSnapshotType } from "./commands/tailordb/migrate/snapshot-types.mjs";
10
10
  import { BreakingChangeInfo, MigrationDiff, formatDiffSummary, formatMigrationDiff, hasChanges } from "./commands/tailordb/migrate/diff-calculator.mjs";
11
11
  import { MIGRATION_LABEL_KEY } from "./commands/tailordb/migrate/types.mjs";
12
- import { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MigrationInfo, SCHEMA_FILE_NAME, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations } from "./commands/tailordb/migrate/snapshot.mjs";
12
+ import { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, SCHEMA_FILE_NAME, compareLocalTypesWithSnapshot, compareSnapshots, createSnapshotFromLocalTypes, getLatestMigrationNumber, getMigrationDirPath, getMigrationFilePath, getMigrationFiles, getNextMigrationNumber, reconstructSnapshotFromMigrations } from "./commands/tailordb/migrate/snapshot.mjs";
13
13
  import { DeployOptions, deploy } from "./commands/deploy/deploy.mjs";
14
14
  import { AggregateArgs, CodeGenerator, DependencyKind, ExecutorGenerator, ExecutorInput, FullCodeGenerator, FullInput, GeneratorResult, ResolverGenerator, ResolverInput, TailorDBGenerator, TailorDBInput, TailorDBResolverGenerator } from "./commands/generate/types.mjs";
15
15
  import { GenerateOptions } from "./commands/generate/options.mjs";
@@ -77,4 +77,4 @@ import { ChunkSeedDataOptions, SeedChunk, chunkSeedData } from "./shared/seed-ch
77
77
  import { SeedBundleResult, bundleSeedScript } from "./commands/generate/seed/bundler.mjs";
78
78
  import { MigrationBundleResult, bundleMigrationScript } from "./commands/tailordb/migrate/bundler.mjs";
79
79
  import { ExecutionWaitResult, ScriptExecutionOptions, ScriptExecutionResult, executeScript, waitForExecution } from "./shared/script-executor.mjs";
80
- export { type AggregateArgs, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CodeGenerator, type CreateFolderOptions, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DependencyKind, type DeployOptions, type ExecutionWaitResult, type Executor, type ExecutorGenerator, type ExecutorInfo, type ExecutorInput, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FullCodeGenerator, type FullInput, 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 MachineUserTokenInfo, type GenerateOptions$1 as MigrateGenerateOptions, type MigrationBundleResult, type MigrationDiff, type MigrationInfo, type NamespaceWithMigrations, type NormalizedSchemaSnapshot, type OAuth2ClientCredentials, type OAuth2ClientInfo, type OperatorClient, type OrganizationInfo, type OrganizationTreeOptions, type PluginAttachment, type RemoveOptions, type RemoveUserOptions, type Resolver, type ResolverGenerator, type ResolverInput, 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 TailorDBGenerator, type TailorDBInput, type TailorDBResolverGenerator, 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 };
80
+ export { type AggregateArgs, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type AuthInvoker, type BreakingChangeInfo, type BundledScripts, type ChunkSeedDataOptions, type CodeGenerator, type CreateFolderOptions, type CreateWorkspaceOptions, DB_TYPES_FILE_NAME, DIFF_FILE_NAME, type DeleteFolderOptions, type DeleteWorkspaceOptions, type DependencyKind, type DeployOptions, type ExecutionWaitResult, type Executor, type ExecutorGenerator, type ExecutorInfo, type ExecutorInput, type ExecutorJobAttemptInfo, type ExecutorJobDetailInfo, type ExecutorJobInfo, type ExecutorJobListInfo, type ExecutorListInfo, type FolderInfo, type FolderListInfo, type FullCodeGenerator, type FullInput, 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 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 ResolverGenerator, type ResolverInput, 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 TailorDBGenerator, type TailorDBInput, type TailorDBResolverGenerator, 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,11 +1,11 @@
1
1
  import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
2
- 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 isNativeTypeScriptRuntime, 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 "../runtime-Zkg3SUwi.mjs";
3
- import { C as getDistDir, E as loadConfig, L as loadWorkspaceId, et as initOperatorClient, g as platformBundleDefinePlugin, j as loadAccessToken } from "../application-DwmoI6ZQ.mjs";
2
+ 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 isNativeTypeScriptRuntime, 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 "../runtime-CJ5usBOu.mjs";
3
+ import { D as loadConfig, M as loadAccessToken, R as loadWorkspaceId, _ as platformBundleDefinePlugin, rt as initOperatorClient, w as getDistDir } from "../application-DYshsH-K.mjs";
4
4
  import { n as enumConstantsPlugin } from "../enum-constants-j9QBF0cB.mjs";
5
5
  import { t as multiline } from "../multiline-sfHpTZZK.mjs";
6
6
  import { n as fileUtilsPlugin } from "../file-utils-DcyIPFQh.mjs";
7
7
  import { n as kyselyTypePlugin } from "../kysely-type-D-zflMGf.mjs";
8
- import { n as seedPlugin } from "../seed-DoMTMLcm.mjs";
8
+ import { n as seedPlugin } from "../seed-fm0LeYP2.mjs";
9
9
  import * as fs from "node:fs";
10
10
  import * as path from "pathe";
11
11
  import { resolveTSConfig } from "pkg-types";
@@ -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-sdk (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 { isNativeTypeScriptRuntime } from \"./shared/runtime\";\n\n// Register tsx to handle TypeScript files when using CLI API programmatically.\n// Bun and Deno handle TypeScript natively, so registration is skipped.\n// tsx's own register() picks `module.registerHooks` on Node ≥ 24.11.1 / 25.1 / 26\n// (avoiding the DEP0205 deprecation) and falls back to `module.register` on older runtimes.\nif (!isNativeTypeScriptRuntime()) {\n const { register } = await import(\"tsx/esm/api\");\n register();\n}\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 {\n CodeGenerator,\n TailorDBGenerator,\n ResolverGenerator,\n ExecutorGenerator,\n TailorDBResolverGenerator,\n FullCodeGenerator,\n TailorDBInput,\n ResolverInput,\n ExecutorInput,\n FullInput,\n AggregateArgs,\n GeneratorResult,\n DependencyKind,\n PluginAttachment,\n TypeSourceInfoEntry,\n} from \"./commands/generate/types\";\nexport type { TailorDBType } 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 {\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 type MigrationInfo,\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":"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"}
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-sdk (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 { isNativeTypeScriptRuntime } from \"./shared/runtime\";\n\n// Register tsx to handle TypeScript files when using CLI API programmatically.\n// Bun and Deno handle TypeScript natively, so registration is skipped.\n// tsx's own register() picks `module.registerHooks` on Node ≥ 24.11.1 / 25.1 / 26\n// (avoiding the DEP0205 deprecation) and falls back to `module.register` on older runtimes.\nif (!isNativeTypeScriptRuntime()) {\n const { register } = await import(\"tsx/esm/api\");\n register();\n}\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 {\n CodeGenerator,\n TailorDBGenerator,\n ResolverGenerator,\n ExecutorGenerator,\n TailorDBResolverGenerator,\n FullCodeGenerator,\n TailorDBInput,\n ResolverInput,\n ExecutorInput,\n FullInput,\n AggregateArgs,\n GeneratorResult,\n DependencyKind,\n PluginAttachment,\n TypeSourceInfoEntry,\n} from \"./commands/generate/types\";\nexport type { TailorDBType } 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 {\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":"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"}
@@ -1,5 +1,5 @@
1
1
  # politty-completion-version: 1
2
- # politty-bin-sig: 1783311178
2
+ # politty-bin-sig: 1783561224
3
3
  # politty-bin-path: /home/runner/work/sdk/sdk/node_modules/.bin/tailor-sdk
4
4
  # program: tailor-sdk
5
5
  # shell: zsh
@@ -45,7 +45,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
45
45
  $'CreateUserProfileConfig' $'workspaceId=:Set workspaceId\nnamespaceName=:Set namespaceName\nuserProfileProviderConfig.:userProfileProviderConfig (message)\nuserProfileProviderConfig.provider=:Set userProfileProviderConfig.provider\nuserProfileProviderConfig.providerType=:Set userProfileProviderConfig.providerType\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED:USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_TAILORDB:USER_PROFILE_PROVIDER_TYPE_TAILORDB\nuserProfileProviderConfig.config.:userProfileProviderConfig.config (message)\nuserProfileProviderConfig.config.tailordb.:userProfileProviderConfig.config.tailordb (message)\nuserProfileProviderConfig.config.tailordb.namespace=:Set userProfileProviderConfig.config.tailordb.namespace\nuserProfileProviderConfig.config.tailordb.type=:Set userProfileProviderConfig.config.tailordb.type\nuserProfileProviderConfig.config.tailordb.usernameField=:Set userProfileProviderConfig.config.tailordb.usernameField\nuserProfileProviderConfig.config.tailordb.tenantIdField=:Set userProfileProviderConfig.config.tailordb.tenantIdField'
46
46
  $'CreateWorkflow' $'workspaceId=:Set workspaceId\nworkflowName=:Set workflowName\nmainJobFunctionName=:Set mainJobFunctionName\nretryPolicy.:retryPolicy (message)\nretryPolicy.maxRetries=:Set retryPolicy.maxRetries\nretryPolicy.initialBackoff=:Set retryPolicy.initialBackoff\nretryPolicy.maxBackoff=:Set retryPolicy.maxBackoff\nretryPolicy.backoffMultiplier=:Set retryPolicy.backoffMultiplier\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
47
47
  $'CreateWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName\nscript=:Set script\nscriptRef=:Set scriptRef'
48
- $'CreateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
48
+ $'CreateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions\nexecutionPolicyName=:Set executionPolicyName'
49
49
  $'CreateWorkspace' $'workspaceName=:Set workspaceName\nworkspaceRegion=:Set workspaceRegion\norganizationId=:Set organizationId\nfolderId=:Set folderId\ndeleteProtection=:Set deleteProtection\ndeleteProtection=true:true\ndeleteProtection=false:false'
50
50
  $'DeleteAIGateway' $'workspaceId=:Set workspaceId\naigatewayName=:Set aigatewayName'
51
51
  $'DeleteApplication' $'workspaceId=:Set workspaceId\napplicationName=:Set applicationName'
@@ -82,7 +82,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
82
82
  $'DeleteUserProfileConfig' $'workspaceId=:Set workspaceId\nnamespaceName=:Set namespaceName'
83
83
  $'DeleteWorkflow' $'workspaceId=:Set workspaceId\nworkflowId=:Set workflowId'
84
84
  $'DeleteWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName'
85
- $'DeleteWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nid=:Set id'
85
+ $'DeleteWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyName=:Set executionPolicyName'
86
86
  $'DeleteWorkspace' $'workspaceId=:Set workspaceId'
87
87
  $'ExchangeAuthConnectionAuthorizationCode' $'workspaceId=:Set workspaceId\nconnectionName=:Set connectionName\nauthorizationCode=:Set authorizationCode\nredirectUri=:Set redirectUri'
88
88
  $'GetAIGateway' $'workspaceId=:Set workspaceId\naigatewayName=:Set aigatewayName'
@@ -134,7 +134,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
134
134
  $'GetWorkflowExecution' $'workspaceId=:Set workspaceId\nexecutionId=:Set executionId'
135
135
  $'GetWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionId=:Set jobFunctionId'
136
136
  $'GetWorkflowJobFunctionByName' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName'
137
- $'GetWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nid=:Set id'
137
+ $'GetWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyName=:Set executionPolicyName'
138
138
  $'GetWorkflowJobFunctionExecutionPolicyByKey' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey'
139
139
  $'GetWorkspace' $'workspaceId=:Set workspaceId'
140
140
  $'GetWorkspacePlatformUser' $'workspaceId=:Set workspaceId'
@@ -241,7 +241,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
241
241
  $'UpdateUserProfileConfig' $'workspaceId=:Set workspaceId\nnamespaceName=:Set namespaceName\nuserProfileProviderConfig.:userProfileProviderConfig (message)\nuserProfileProviderConfig.provider=:Set userProfileProviderConfig.provider\nuserProfileProviderConfig.providerType=:Set userProfileProviderConfig.providerType\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED:USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_TAILORDB:USER_PROFILE_PROVIDER_TYPE_TAILORDB\nuserProfileProviderConfig.config.:userProfileProviderConfig.config (message)\nuserProfileProviderConfig.config.tailordb.:userProfileProviderConfig.config.tailordb (message)\nuserProfileProviderConfig.config.tailordb.namespace=:Set userProfileProviderConfig.config.tailordb.namespace\nuserProfileProviderConfig.config.tailordb.type=:Set userProfileProviderConfig.config.tailordb.type\nuserProfileProviderConfig.config.tailordb.usernameField=:Set userProfileProviderConfig.config.tailordb.usernameField\nuserProfileProviderConfig.config.tailordb.tenantIdField=:Set userProfileProviderConfig.config.tailordb.tenantIdField'
242
242
  $'UpdateWorkflow' $'workspaceId=:Set workspaceId\nworkflowName=:Set workflowName\nmainJobFunctionName=:Set mainJobFunctionName\nretryPolicy.:retryPolicy (message)\nretryPolicy.maxRetries=:Set retryPolicy.maxRetries\nretryPolicy.initialBackoff=:Set retryPolicy.initialBackoff\nretryPolicy.maxBackoff=:Set retryPolicy.maxBackoff\nretryPolicy.backoffMultiplier=:Set retryPolicy.backoffMultiplier\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
243
243
  $'UpdateWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName\nscript=:Set script\nscriptRef=:Set scriptRef'
244
- $'UpdateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
244
+ $'UpdateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyName=:Set executionPolicyName\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
245
245
  $'UpdateWorkspace' $'workspaceId=:Set workspaceId\nworkspaceName=:Set workspaceName\norganizationId=:Set organizationId\nfolderId=:Set folderId\ndeleteProtection=:Set deleteProtection\ndeleteProtection=true:true\ndeleteProtection=false:false\nupdateMask=:Set updateMask'
246
246
  $'UpdateWorkspacePlatformUser' $'workspaceId=:Set workspaceId\nemail=:Set email\nrole=:Set role\nrole=WORKSPACE_PLATFORM_USER_ROLE_UNSPECIFIED:WORKSPACE_PLATFORM_USER_ROLE_UNSPECIFIED\nrole=WORKSPACE_PLATFORM_USER_ROLE_ADMIN:WORKSPACE_PLATFORM_USER_ROLE_ADMIN\nrole=WORKSPACE_PLATFORM_USER_ROLE_EDITOR:WORKSPACE_PLATFORM_USER_ROLE_EDITOR\nrole=WORKSPACE_PLATFORM_USER_ROLE_VIEWER:WORKSPACE_PLATFORM_USER_ROLE_VIEWER'
247
247
  $'UpsertOrganizationFolderIPRestriction' $'organizationId=:Set organizationId\nfolderId=:Set folderId'
@@ -283,7 +283,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
283
283
  $'tailor.v1.OperatorService/CreateUserProfileConfig' $'workspaceId=:Set workspaceId\nnamespaceName=:Set namespaceName\nuserProfileProviderConfig.:userProfileProviderConfig (message)\nuserProfileProviderConfig.provider=:Set userProfileProviderConfig.provider\nuserProfileProviderConfig.providerType=:Set userProfileProviderConfig.providerType\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED:USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_TAILORDB:USER_PROFILE_PROVIDER_TYPE_TAILORDB\nuserProfileProviderConfig.config.:userProfileProviderConfig.config (message)\nuserProfileProviderConfig.config.tailordb.:userProfileProviderConfig.config.tailordb (message)\nuserProfileProviderConfig.config.tailordb.namespace=:Set userProfileProviderConfig.config.tailordb.namespace\nuserProfileProviderConfig.config.tailordb.type=:Set userProfileProviderConfig.config.tailordb.type\nuserProfileProviderConfig.config.tailordb.usernameField=:Set userProfileProviderConfig.config.tailordb.usernameField\nuserProfileProviderConfig.config.tailordb.tenantIdField=:Set userProfileProviderConfig.config.tailordb.tenantIdField'
284
284
  $'tailor.v1.OperatorService/CreateWorkflow' $'workspaceId=:Set workspaceId\nworkflowName=:Set workflowName\nmainJobFunctionName=:Set mainJobFunctionName\nretryPolicy.:retryPolicy (message)\nretryPolicy.maxRetries=:Set retryPolicy.maxRetries\nretryPolicy.initialBackoff=:Set retryPolicy.initialBackoff\nretryPolicy.maxBackoff=:Set retryPolicy.maxBackoff\nretryPolicy.backoffMultiplier=:Set retryPolicy.backoffMultiplier\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
285
285
  $'tailor.v1.OperatorService/CreateWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName\nscript=:Set script\nscriptRef=:Set scriptRef'
286
- $'tailor.v1.OperatorService/CreateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
286
+ $'tailor.v1.OperatorService/CreateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions\nexecutionPolicyName=:Set executionPolicyName'
287
287
  $'tailor.v1.OperatorService/CreateWorkspace' $'workspaceName=:Set workspaceName\nworkspaceRegion=:Set workspaceRegion\norganizationId=:Set organizationId\nfolderId=:Set folderId\ndeleteProtection=:Set deleteProtection\ndeleteProtection=true:true\ndeleteProtection=false:false'
288
288
  $'tailor.v1.OperatorService/DeleteAIGateway' $'workspaceId=:Set workspaceId\naigatewayName=:Set aigatewayName'
289
289
  $'tailor.v1.OperatorService/DeleteApplication' $'workspaceId=:Set workspaceId\napplicationName=:Set applicationName'
@@ -320,7 +320,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
320
320
  $'tailor.v1.OperatorService/DeleteUserProfileConfig' $'workspaceId=:Set workspaceId\nnamespaceName=:Set namespaceName'
321
321
  $'tailor.v1.OperatorService/DeleteWorkflow' $'workspaceId=:Set workspaceId\nworkflowId=:Set workflowId'
322
322
  $'tailor.v1.OperatorService/DeleteWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName'
323
- $'tailor.v1.OperatorService/DeleteWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nid=:Set id'
323
+ $'tailor.v1.OperatorService/DeleteWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyName=:Set executionPolicyName'
324
324
  $'tailor.v1.OperatorService/DeleteWorkspace' $'workspaceId=:Set workspaceId'
325
325
  $'tailor.v1.OperatorService/ExchangeAuthConnectionAuthorizationCode' $'workspaceId=:Set workspaceId\nconnectionName=:Set connectionName\nauthorizationCode=:Set authorizationCode\nredirectUri=:Set redirectUri'
326
326
  $'tailor.v1.OperatorService/GetAIGateway' $'workspaceId=:Set workspaceId\naigatewayName=:Set aigatewayName'
@@ -372,7 +372,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
372
372
  $'tailor.v1.OperatorService/GetWorkflowExecution' $'workspaceId=:Set workspaceId\nexecutionId=:Set executionId'
373
373
  $'tailor.v1.OperatorService/GetWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionId=:Set jobFunctionId'
374
374
  $'tailor.v1.OperatorService/GetWorkflowJobFunctionByName' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName'
375
- $'tailor.v1.OperatorService/GetWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nid=:Set id'
375
+ $'tailor.v1.OperatorService/GetWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyName=:Set executionPolicyName'
376
376
  $'tailor.v1.OperatorService/GetWorkflowJobFunctionExecutionPolicyByKey' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey'
377
377
  $'tailor.v1.OperatorService/GetWorkspace' $'workspaceId=:Set workspaceId'
378
378
  $'tailor.v1.OperatorService/GetWorkspacePlatformUser' $'workspaceId=:Set workspaceId'
@@ -479,7 +479,7 @@ typeset -gA __tailor_sdk_worker_expand_api__field=(
479
479
  $'tailor.v1.OperatorService/UpdateUserProfileConfig' $'workspaceId=:Set workspaceId\nnamespaceName=:Set namespaceName\nuserProfileProviderConfig.:userProfileProviderConfig (message)\nuserProfileProviderConfig.provider=:Set userProfileProviderConfig.provider\nuserProfileProviderConfig.providerType=:Set userProfileProviderConfig.providerType\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED:USER_PROFILE_PROVIDER_TYPE_UNSPECIFIED\nuserProfileProviderConfig.providerType=USER_PROFILE_PROVIDER_TYPE_TAILORDB:USER_PROFILE_PROVIDER_TYPE_TAILORDB\nuserProfileProviderConfig.config.:userProfileProviderConfig.config (message)\nuserProfileProviderConfig.config.tailordb.:userProfileProviderConfig.config.tailordb (message)\nuserProfileProviderConfig.config.tailordb.namespace=:Set userProfileProviderConfig.config.tailordb.namespace\nuserProfileProviderConfig.config.tailordb.type=:Set userProfileProviderConfig.config.tailordb.type\nuserProfileProviderConfig.config.tailordb.usernameField=:Set userProfileProviderConfig.config.tailordb.usernameField\nuserProfileProviderConfig.config.tailordb.tenantIdField=:Set userProfileProviderConfig.config.tailordb.tenantIdField'
480
480
  $'tailor.v1.OperatorService/UpdateWorkflow' $'workspaceId=:Set workspaceId\nworkflowName=:Set workflowName\nmainJobFunctionName=:Set mainJobFunctionName\nretryPolicy.:retryPolicy (message)\nretryPolicy.maxRetries=:Set retryPolicy.maxRetries\nretryPolicy.initialBackoff=:Set retryPolicy.initialBackoff\nretryPolicy.maxBackoff=:Set retryPolicy.maxBackoff\nretryPolicy.backoffMultiplier=:Set retryPolicy.backoffMultiplier\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
481
481
  $'tailor.v1.OperatorService/UpdateWorkflowJobFunction' $'workspaceId=:Set workspaceId\njobFunctionName=:Set jobFunctionName\nscript=:Set script\nscriptRef=:Set scriptRef'
482
- $'tailor.v1.OperatorService/UpdateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyKey=:Set executionPolicyKey\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
482
+ $'tailor.v1.OperatorService/UpdateWorkflowJobFunctionExecutionPolicy' $'workspaceId=:Set workspaceId\nexecutionPolicyName=:Set executionPolicyName\nconcurrencyPolicy.:concurrencyPolicy (message)\nconcurrencyPolicy.maxConcurrentExecutions=:Set concurrencyPolicy.maxConcurrentExecutions'
483
483
  $'tailor.v1.OperatorService/UpdateWorkspace' $'workspaceId=:Set workspaceId\nworkspaceName=:Set workspaceName\norganizationId=:Set organizationId\nfolderId=:Set folderId\ndeleteProtection=:Set deleteProtection\ndeleteProtection=true:true\ndeleteProtection=false:false\nupdateMask=:Set updateMask'
484
484
  $'tailor.v1.OperatorService/UpdateWorkspacePlatformUser' $'workspaceId=:Set workspaceId\nemail=:Set email\nrole=:Set role\nrole=WORKSPACE_PLATFORM_USER_ROLE_UNSPECIFIED:WORKSPACE_PLATFORM_USER_ROLE_UNSPECIFIED\nrole=WORKSPACE_PLATFORM_USER_ROLE_ADMIN:WORKSPACE_PLATFORM_USER_ROLE_ADMIN\nrole=WORKSPACE_PLATFORM_USER_ROLE_EDITOR:WORKSPACE_PLATFORM_USER_ROLE_EDITOR\nrole=WORKSPACE_PLATFORM_USER_ROLE_VIEWER:WORKSPACE_PLATFORM_USER_ROLE_VIEWER'
485
485
  $'tailor.v1.OperatorService/UpsertOrganizationFolderIPRestriction' $'organizationId=:Set organizationId\nfolderId=:Set folderId'
@@ -4,6 +4,7 @@ import { AIGatewayConfig } from "../services/aigateway/types.mjs";
4
4
  import { IdPConfig } from "../services/idp/types.mjs";
5
5
  import { SecretsConfig } from "../services/secrets/types.mjs";
6
6
  import { StaticWebsiteConfig } from "../services/staticwebsite/types.mjs";
7
+ import { ExecutionPolicyInstance } from "../services/workflow/execution-policy.types.mjs";
7
8
  import { LogLevelEnum } from "../../types/app-config.generated.mjs";
8
9
 
9
10
  //#region src/configure/config/types.d.ts
@@ -32,7 +33,8 @@ type WorkflowServiceConfig = {
32
33
  files: string[];
33
34
  job_files?: string[];
34
35
  ignores?: string[];
35
- job_ignores?: string[];
36
+ job_ignores?: string[]; /** Workspace-level execution policies for workflow job functions. */
37
+ executionPolicies?: Record<string, ExecutionPolicyInstance>;
36
38
  };
37
39
  type WorkflowServiceInput = WorkflowServiceConfig;
38
40
  /**
@@ -16,6 +16,7 @@ import { IdPEmailConfig, IdPGqlOperations, IdPGqlOperationsInput } from "../type
16
16
  import { IdPConfig, IdPExternalConfig } from "./services/idp/types.mjs";
17
17
  import { SecretsConfig } from "./services/secrets/types.mjs";
18
18
  import { StaticWebsiteConfig } from "./services/staticwebsite/types.mjs";
19
+ import { ExecutionPolicyConcurrency, ExecutionPolicyDefInput, ExecutionPolicyExactInstance, ExecutionPolicyGroupOptions, ExecutionPolicyInstance, ExecutionPolicyWildcardInstance, ResolvedExecutionPolicyInstance } from "./services/workflow/execution-policy.types.mjs";
19
20
  import { ExecutorServiceConfig, ExecutorServiceInput, ResolverExternalConfig, ResolverServiceConfig, ResolverServiceInput, WorkflowServiceConfig, WorkflowServiceInput } from "./config/types.mjs";
20
21
  import { ConcurrencyPolicy, RetryPolicy } from "../types/workflow.generated.mjs";
21
22
  import { TailorAnyField, TailorField } from "./types/type.mjs";
@@ -36,6 +37,7 @@ import { ScheduleArgs, ScheduleTrigger, scheduleTrigger } from "./services/execu
36
37
  import { IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, incomingWebhookTrigger } from "./services/executor/trigger/webhook.mjs";
37
38
  import { Trigger } from "./services/executor/trigger/index.mjs";
38
39
  import { createExecutor } from "./services/executor/executor.mjs";
40
+ import { defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy } from "./services/workflow/execution-policy.mjs";
39
41
  import { WaitPointInstance, defineWaitPoint, defineWaitPoints } from "./services/workflow/wait-point.mjs";
40
42
  import { defineStaticWebSite } from "./services/staticwebsite/index.mjs";
41
43
  import { defineAIGateway } from "./services/aigateway/index.mjs";
@@ -123,4 +125,4 @@ declare namespace t {
123
125
  type infer<T> = TailorOutput<T>;
124
126
  }
125
127
  //#endregion
126
- export { type AIGatewayConfig, type AIGatewayName, type AIGatewayNameRegistry, type AttributeList, type AttributeMap, AuthAccessTokenArgs, AuthAccessTokenIssuedArgs, AuthAccessTokenRefreshedArgs, AuthAccessTokenRevokedArgs, AuthAccessTokenTrigger, type AuthConfig, type AuthConnectionConfig, type AuthConnectionOAuth2Config, type AuthConnectionTokenResult, type AuthExternalConfig, AuthInvoker, type AuthOwnConfig, type AuthServiceInput, type BeforeLoginClaims, type BeforeLoginHookArgs, type BuiltinIdP, type ConcurrencyPolicy, type ConnectionName, type ConnectionNameRegistry, type DefinedAuth, type Env, type ExecutorReadyContext, type ExecutorServiceConfig, type ExecutorServiceInput, type FederatedIdentity, type FederatedIdentityClaims, type FederatedIdentityProvider, FunctionOperation, type GeneratorResult, GqlOperation, HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, type IDToken, type IdPConfig, type IdPEmailConfig, type IdPExternalConfig, type IdPGqlOperations, type IdPGqlOperationsInput as IdPGqlOperationsConfig, type IdPPermission, type IdPPermissionCondition, type IdProvider as IdProviderConfig, type IdpName, type IdpNameRegistry, IdpUserArgs, IdpUserCreatedArgs, IdpUserDeletedArgs, IdpUserTrigger, IdpUserUpdatedArgs, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, type MachineUserName, type MachineUserNameRegistry, type NamespacePluginOutput, type OAuth2ClientInput as OAuth2Client, type OAuth2ClientGrantType, type OIDC, Operation, type PermissionCondition, type Plugin, type PluginAttachment, type PluginConfigs, type PluginExecutorContext, type PluginExecutorContextBase, type PluginGeneratedExecutor, type PluginGeneratedExecutorWithFile, type PluginGeneratedResolver, type PluginGeneratedType, type PluginNamespaceProcessContext, type PluginOutput, type PluginProcessContext, type QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordUpdatedArgs, type Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, type ResolverExternalConfig, type ResolverNamespaceData, type ResolverReadyContext, type ResolverServiceConfig, type ResolverServiceInput, type RetryPolicy, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleArgs, ScheduleTrigger, type SecretsConfig, type StaticWebsiteConfig, type TailorAnyDBField, type TailorAnyDBType, type TailorDBField, type TailorDBInstance, type TailorDBNamespaceData, type TailorDBReadyContext, TailorDBTrigger, type TailorDBType, type TailorDBTypeForPlugin, type TailorField, type TailorInvoker, type TailorTypeGqlPermission, type TailorTypePermission, type TailorUser, type TenantProvider as TenantProviderConfig, Trigger, type TypePluginOutput, type UserAttributeKey, type UserAttributeListKey, type UserAttributeMap, type UsernameFieldKey, type ValueOperand, WORKFLOW_TEST_ENV_KEY, WaitPointInstance, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowOperation, type WorkflowServiceConfig, type WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWaitPoint, defineWaitPoints, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission };
128
+ export { type AIGatewayConfig, type AIGatewayName, type AIGatewayNameRegistry, type AttributeList, type AttributeMap, AuthAccessTokenArgs, AuthAccessTokenIssuedArgs, AuthAccessTokenRefreshedArgs, AuthAccessTokenRevokedArgs, AuthAccessTokenTrigger, type AuthConfig, type AuthConnectionConfig, type AuthConnectionOAuth2Config, type AuthConnectionTokenResult, type AuthExternalConfig, AuthInvoker, type AuthOwnConfig, type AuthServiceInput, type BeforeLoginClaims, type BeforeLoginHookArgs, type BuiltinIdP, type ConcurrencyPolicy, type ConnectionName, type ConnectionNameRegistry, type DefinedAuth, type Env, type ExecutionPolicyConcurrency, type ExecutionPolicyDefInput, type ExecutionPolicyExactInstance, type ExecutionPolicyGroupOptions, type ExecutionPolicyInstance, type ExecutionPolicyWildcardInstance, type ExecutorReadyContext, type ExecutorServiceConfig, type ExecutorServiceInput, type FederatedIdentity, type FederatedIdentityClaims, type FederatedIdentityProvider, FunctionOperation, type GeneratorResult, GqlOperation, HttpAdapter, HttpAdapterGraphQLQuery, HttpAdapterGraphQLRequest, HttpAdapterGraphQLResponse, HttpAdapterInput, HttpAdapterInputFn, HttpAdapterOutputFn, HttpAdapterRequest, HttpAdapterResponse, HttpAdapterTypedDocumentNode, type IDToken, type IdPConfig, type IdPEmailConfig, type IdPExternalConfig, type IdPGqlOperations, type IdPGqlOperationsInput as IdPGqlOperationsConfig, type IdPPermission, type IdPPermissionCondition, type IdProvider as IdProviderConfig, type IdpName, type IdpNameRegistry, IdpUserArgs, IdpUserCreatedArgs, IdpUserDeletedArgs, IdpUserTrigger, IdpUserUpdatedArgs, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookResponse, IncomingWebhookResponseConfig, IncomingWebhookTrigger, IncomingWebhookTriggerOptions, type MachineUserName, type MachineUserNameRegistry, type NamespacePluginOutput, type OAuth2ClientInput as OAuth2Client, type OAuth2ClientGrantType, type OIDC, Operation, type PermissionCondition, type Plugin, type PluginAttachment, type PluginConfigs, type PluginExecutorContext, type PluginExecutorContextBase, type PluginGeneratedExecutor, type PluginGeneratedExecutorWithFile, type PluginGeneratedResolver, type PluginGeneratedType, type PluginNamespaceProcessContext, type PluginOutput, type PluginProcessContext, type QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordUpdatedArgs, type ResolvedExecutionPolicyInstance, type Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, type ResolverExternalConfig, type ResolverNamespaceData, type ResolverReadyContext, type ResolverServiceConfig, type ResolverServiceInput, type RetryPolicy, type SAML, type SCIMAttribute, type SCIMAttributeMapping, type SCIMAttributeType, type SCIMAuthorization, type SCIMConfig, type SCIMResource, ScheduleArgs, ScheduleTrigger, type SecretsConfig, type StaticWebsiteConfig, type TailorAnyDBField, type TailorAnyDBType, type TailorDBField, type TailorDBInstance, type TailorDBNamespaceData, type TailorDBReadyContext, TailorDBTrigger, type TailorDBType, type TailorDBTypeForPlugin, type TailorField, type TailorInvoker, type TailorTypeGqlPermission, type TailorTypePermission, type TailorUser, type TenantProvider as TenantProviderConfig, Trigger, type TypePluginOutput, type UserAttributeKey, type UserAttributeListKey, type UserAttributeMap, type UsernameFieldKey, type ValueOperand, WORKFLOW_TEST_ENV_KEY, WaitPointInstance, WebhookOperation, Workflow, WorkflowConfig, WorkflowJob, WorkflowJobContext, WorkflowOperation, type WorkflowServiceConfig, type WorkflowServiceInput, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWaitPoint, defineWaitPoints, defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission };
@@ -1,8 +1,8 @@
1
- import { t as t$1 } from "../types-ywCGpzDZ.mjs";
1
+ import { t as t$1 } from "../types-BwzB2okW.mjs";
2
2
  import { t as brandValue } from "../brand-Eo4pLXPJ.mjs";
3
- import { t as db } from "../schema-DAdZSFOd.mjs";
4
- import { r as dispatchTriggerWorkflow, s as registerWorkflow, u as WORKFLOW_TEST_ENV_KEY } from "../registry-BozuxbPp.mjs";
5
- import { t as createWorkflowJob } from "../job-CtU73PGa.mjs";
3
+ import { t as db } from "../schema-Dl_y0m9e.mjs";
4
+ import { r as dispatchTriggerWorkflow, s as registerWorkflow, u as WORKFLOW_TEST_ENV_KEY } from "../registry-NfSW0BRo.mjs";
5
+ import { t as createWorkflowJob } from "../job-D-PbD1P3.mjs";
6
6
 
7
7
  //#region src/configure/user.ts
8
8
  /** Represents an unauthenticated user in the Tailor platform. */
@@ -369,6 +369,114 @@ function incomingWebhookTrigger(options) {
369
369
  };
370
370
  }
371
371
 
372
+ //#endregion
373
+ //#region src/configure/services/workflow/execution-policy.ts
374
+ const EXECUTION_POLICY_EXACT_KEY_REGEX = /^[a-z0-9][a-z0-9_:.-]{0,62}[a-z0-9]$/;
375
+ function createExecutionPolicyInstance(initialName, initialKey, concurrencyPolicy, matchType, separator, allowNameSetter, allowKeySetter) {
376
+ const isPrefix = matchType === "prefix";
377
+ const raw = {
378
+ name: initialName,
379
+ key: initialKey,
380
+ matchType,
381
+ ...concurrencyPolicy && { concurrencyPolicy },
382
+ ...isPrefix && { keyFor: (suffix) => {
383
+ const key = `${raw.key}${separator}${suffix}`;
384
+ if (!EXECUTION_POLICY_EXACT_KEY_REGEX.test(key)) throw new Error(`Invalid execution policy key "${key}" built by keyFor("${suffix}"): must match [a-z0-9_:.-] (2-64 chars; must start and end with [a-z0-9]).`);
385
+ return key;
386
+ } }
387
+ };
388
+ return {
389
+ instance: brandValue(raw, "execution-policy"),
390
+ setName: allowNameSetter ? (n) => {
391
+ raw.name = n;
392
+ } : void 0,
393
+ setKey: allowKeySetter ? (k) => {
394
+ raw.key = k;
395
+ } : void 0
396
+ };
397
+ }
398
+ /**
399
+ * Define a single workflow job function execution policy.
400
+ *
401
+ * Use this when declaring a policy outside the
402
+ * {@link defineWorkflowExecutionPolicies} builder — for example, when the
403
+ * runtime key prefix needs to differ from the corresponding workspace-unique
404
+ * name.
405
+ *
406
+ * When `matchType: "prefix"` is set, the returned instance has `keyFor(suffix)`
407
+ * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}).
408
+ * @param name - Workspace-unique name. Must match `^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$`.
409
+ * @param def - Optional overrides for `key` (defaults to `name`), `matchType`, `separator` (the `keyFor` join character, defaults to `.`), and concurrency
410
+ * @returns An execution policy instance
411
+ * @example
412
+ * export const perTenant = defineWorkflowExecutionPolicy("tenant-api", {
413
+ * matchType: "prefix",
414
+ * concurrencyPolicy: { maxConcurrentExecutions: 3 },
415
+ * });
416
+ *
417
+ * perTenant.keyFor(tenantId); // "tenant-api.<tenantId>"
418
+ */
419
+ /* @__NO_SIDE_EFFECTS__ */
420
+ function defineWorkflowExecutionPolicy(name, def) {
421
+ return createExecutionPolicyInstance(name, def?.key ?? name, def?.concurrencyPolicy, def?.matchType ?? "exact", def?.separator ?? ".", false, false).instance;
422
+ }
423
+ /**
424
+ * Define a group of workflow job function execution policies. Property names
425
+ * become the workspace-unique `name` and default `key` verbatim, matching the
426
+ * mental model of {@link defineWaitPoints}. Provide `name` / `key` explicitly
427
+ * to override the property-name default (for example, when the property name
428
+ * is not valid for the execution policy grammar or when the runtime key
429
+ * prefix needs to differ).
430
+ *
431
+ * When `matchType: "prefix"` is set, the returned instance has `keyFor(suffix)`
432
+ * instead of a directly-usable `key` (see {@link ExecutionPolicyWildcardInstance}).
433
+ * `matchType` can be combined with an explicit `key`, or left to apply to
434
+ * the property-name-derived prefix.
435
+ *
436
+ * The return type mirrors the builder's return type so JSDoc on each property
437
+ * is preserved in IDE autocompletion.
438
+ * @param builder - Callback that receives a `define` factory and returns a record of policies
439
+ * @param options - Group-wide options; `separator` overrides the `.` `keyFor` uses to join the prefix and suffix for every prefix policy in the group
440
+ * @returns The same object returned by the builder (with `name` / `key` resolved on each instance)
441
+ * @example
442
+ * export const executionPolicies = defineWorkflowExecutionPolicies((define) => ({
443
+ * premium: define({ concurrencyPolicy: { maxConcurrentExecutions: 5 } }),
444
+ * "tenant-api": define({
445
+ * matchType: "prefix",
446
+ * concurrencyPolicy: { maxConcurrentExecutions: 3 },
447
+ * }),
448
+ * }));
449
+ *
450
+ * // In a workflow job function:
451
+ * await tailor.workflow.triggerJobFunction("worker", args, {
452
+ * executionPolicyKey: executionPolicies.premium.key,
453
+ * });
454
+ * await tailor.workflow.triggerJobFunction("worker", args, {
455
+ * executionPolicyKey: executionPolicies["tenant-api"].keyFor(input.tenantId),
456
+ * });
457
+ */
458
+ /* @__NO_SIDE_EFFECTS__ */
459
+ function defineWorkflowExecutionPolicies(builder, options) {
460
+ const separator = options?.separator ?? ".";
461
+ const nameSetters = /* @__PURE__ */ new Map();
462
+ const keySetters = /* @__PURE__ */ new Map();
463
+ const define = (def) => {
464
+ const explicitName = def?.name;
465
+ const explicitKey = def?.key;
466
+ const { instance, setName, setKey } = createExecutionPolicyInstance(explicitName ?? "__pending__", explicitKey ?? explicitName ?? "__pending__", def?.concurrencyPolicy, def?.matchType ?? "exact", separator, explicitName === void 0, explicitKey === void 0 && explicitName === void 0);
467
+ if (setName) nameSetters.set(instance, setName);
468
+ if (setKey) keySetters.set(instance, setKey);
469
+ return instance;
470
+ };
471
+ const result = builder(define);
472
+ for (const propName of Object.keys(result)) {
473
+ const instance = result[propName];
474
+ nameSetters.get(instance)?.(propName);
475
+ keySetters.get(instance)?.(propName);
476
+ }
477
+ return result;
478
+ }
479
+
372
480
  //#endregion
373
481
  //#region src/configure/services/workflow/wait-point.ts
374
482
  function getPlatformWorkflow() {
@@ -697,5 +805,5 @@ function definePlugins(...configs) {
697
805
  const t = t$1;
698
806
 
699
807
  //#endregion
700
- export { WORKFLOW_TEST_ENV_KEY, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWaitPoint, defineWaitPoints, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission };
808
+ export { WORKFLOW_TEST_ENV_KEY, authAccessTokenIssuedTrigger, authAccessTokenRefreshedTrigger, authAccessTokenRevokedTrigger, authAccessTokenTrigger, createExecutor, createHttpAdapter, createResolver, createWorkflow, createWorkflowJob, db, defineAIGateway, defineAuth, defineConfig, defineGenerators, defineIdp, definePlugins, defineSecretManager, defineStaticWebSite, defineWaitPoint, defineWaitPoints, defineWorkflowExecutionPolicies, defineWorkflowExecutionPolicy, idpUserCreatedTrigger, idpUserDeletedTrigger, idpUserTrigger, idpUserUpdatedTrigger, incomingWebhookTrigger, recordCreatedTrigger, recordDeletedTrigger, recordTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser, unsafeAllowAllGqlPermission, unsafeAllowAllIdPPermission, unsafeAllowAllTypePermission };
701
809
  //# sourceMappingURL=index.mjs.map