@tailor-platform/sdk 1.45.2 → 1.47.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 (82) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/dist/{actor-BmxQeMFP.d.mts → actor-DhXSqWTW.d.mts} +2 -2
  3. package/dist/application-CN9Htzup.mjs +4 -0
  4. package/dist/{application-B4zVVNRS.mjs → application-TasSqBTD.mjs} +22 -41
  5. package/dist/application-TasSqBTD.mjs.map +1 -0
  6. package/dist/cli/index.mjs +101 -61
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +13 -13
  9. package/dist/cli/lib.mjs +4 -4
  10. package/dist/cli/lib.mjs.map +1 -1
  11. package/dist/{client-BwXkoiMq.mjs → client-COfsXV69.mjs} +31 -120
  12. package/dist/client-COfsXV69.mjs.map +1 -0
  13. package/dist/{client-DTaArWQr.mjs → client-DYSkSLRr.mjs} +1 -1
  14. package/dist/configure/index.d.mts +4 -4
  15. package/dist/configure/index.mjs +4 -43
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crash-report-BUHzuzDn.mjs → crashreport-B8lVOx0U.mjs} +1 -1
  18. package/dist/{crash-report-CtYCva4d.mjs → crashreport-CKJwnWsX.mjs} +9 -9
  19. package/dist/crashreport-CKJwnWsX.mjs.map +1 -0
  20. package/dist/{index-DV-5OIEv.d.mts → index-BRvNi5q9.d.mts} +2 -2
  21. package/dist/{index-BBvPd9Uv.d.mts → index-BXyS7xKC.d.mts} +2 -2
  22. package/dist/{index-Dxe6alSZ.d.mts → index-BbOTbZFf.d.mts} +2 -2
  23. package/dist/{index-DUKJPEwq.d.mts → index-BoU_52Du.d.mts} +6 -6
  24. package/dist/{index-B5_4Tzm2.d.mts → index-iy-hNfGp.d.mts} +2 -2
  25. package/dist/{interceptor-CrcDfLPq.mjs → interceptor-CBsqEWDK.mjs} +1 -1
  26. package/dist/{interceptor-CrcDfLPq.mjs.map → interceptor-CBsqEWDK.mjs.map} +1 -1
  27. package/dist/mock-BP-9O5On.mjs +796 -0
  28. package/dist/mock-BP-9O5On.mjs.map +1 -0
  29. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  30. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  31. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  32. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  33. package/dist/plugin/index.d.mts +2 -2
  34. package/dist/{repl-editor-BlT2dFtm.mjs → repl-editor-CZpLlOBj.mjs} +1 -1
  35. package/dist/{repl-editor-BlT2dFtm.mjs.map → repl-editor-CZpLlOBj.mjs.map} +1 -1
  36. package/dist/{runtime-D97Ydu2S.mjs → runtime-DDYL2Zf1.mjs} +148 -70
  37. package/dist/runtime-DDYL2Zf1.mjs.map +1 -0
  38. package/dist/{service-CCgw66c6.mjs → service-obEU5gSM.mjs} +1 -1
  39. package/dist/{service-CCgw66c6.mjs.map → service-obEU5gSM.mjs.map} +1 -1
  40. package/dist/{tailor-db-field-Hx9OqPWY.d.mts → tailor-db-field-Bn8ZC5lK.d.mts} +1 -1
  41. package/dist/{schema-DBq6hr6h.mjs → tailordb-Bg9-TZj1.mjs} +42 -2
  42. package/dist/tailordb-Bg9-TZj1.mjs.map +1 -0
  43. package/dist/telemetry-21afNV9_.mjs +4 -0
  44. package/dist/{telemetry-DXitz4RH.mjs → telemetry-DcL8Fsm_.mjs} +1 -1
  45. package/dist/{telemetry-DXitz4RH.mjs.map → telemetry-DcL8Fsm_.mjs.map} +1 -1
  46. package/dist/utils/test/index.d.mts +13 -4
  47. package/dist/utils/test/index.mjs +12 -3
  48. package/dist/utils/test/index.mjs.map +1 -1
  49. package/dist/vitest/environment.d.mts +12 -0
  50. package/dist/vitest/environment.mjs +44 -0
  51. package/dist/vitest/environment.mjs.map +1 -0
  52. package/dist/vitest/index.d.mts +345 -0
  53. package/dist/vitest/index.mjs +350 -0
  54. package/dist/vitest/index.mjs.map +1 -0
  55. package/dist/vitest/setup.d.mts +64 -0
  56. package/dist/vitest/setup.mjs +141 -0
  57. package/dist/vitest/setup.mjs.map +1 -0
  58. package/dist/{workflow.generated-DFljpJh7.d.mts → workflow.generated-i7PK4fg-.d.mts} +2 -2
  59. package/docs/cli/application.md +19 -17
  60. package/docs/cli/crashreport.md +119 -0
  61. package/docs/cli/executor.md +9 -9
  62. package/docs/cli/function.md +5 -5
  63. package/docs/cli/setup.md +1 -0
  64. package/docs/cli/tailordb.md +1 -1
  65. package/docs/cli/workflow.md +8 -8
  66. package/docs/cli-reference.md +8 -8
  67. package/docs/quickstart.md +2 -2
  68. package/docs/services/auth.md +2 -2
  69. package/docs/services/secret.md +4 -4
  70. package/docs/services/tailordb-migration.md +10 -10
  71. package/docs/services/tailordb.md +44 -13
  72. package/docs/services/workflow.md +1 -1
  73. package/docs/testing.md +530 -243
  74. package/package.json +32 -6
  75. package/dist/application-B4zVVNRS.mjs.map +0 -1
  76. package/dist/application-BIzicxMA.mjs +0 -4
  77. package/dist/client-BwXkoiMq.mjs.map +0 -1
  78. package/dist/crash-report-CtYCva4d.mjs.map +0 -1
  79. package/dist/runtime-D97Ydu2S.mjs.map +0 -1
  80. package/dist/schema-DBq6hr6h.mjs.map +0 -1
  81. package/dist/telemetry-BvI1EgMG.mjs +0 -4
  82. package/docs/cli/crash-report.md +0 -118
@@ -1,10 +1,10 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { N as TailorDBType, P as TypeSourceInfoEntry, Q as Resolver, _t as IdProvider, ct as IncomingWebhookTrigger, o as Plugin, rt as Executor, s as PluginAttachment, ut as ScheduleTriggerInput, vt as OAuth2ClientInput } from "../tailor-db-field-Hx9OqPWY.mjs";
3
- import { r as AppConfig } from "../workflow.generated-DFljpJh7.mjs";
4
- import { n as kyselyTypePlugin } from "../index-DV-5OIEv.mjs";
5
- import { n as enumConstantsPlugin } from "../index-Dxe6alSZ.mjs";
6
- import { n as fileUtilsPlugin } from "../index-B5_4Tzm2.mjs";
7
- import { n as seedPlugin } from "../index-BBvPd9Uv.mjs";
2
+ import { N as TailorDBType, P as TypeSourceInfoEntry, Q as Resolver, _t as IdProvider, ct as IncomingWebhookTrigger, o as Plugin, rt as Executor, s as PluginAttachment, ut as ScheduleTriggerInput, vt as OAuth2ClientInput } from "../tailor-db-field-Bn8ZC5lK.mjs";
3
+ import { r as AppConfig } from "../workflow.generated-i7PK4fg-.mjs";
4
+ import { n as kyselyTypePlugin } from "../index-BRvNi5q9.mjs";
5
+ import { n as enumConstantsPlugin } from "../index-BbOTbZFf.mjs";
6
+ import { n as fileUtilsPlugin } from "../index-iy-hNfGp.mjs";
7
+ import { n as seedPlugin } from "../index-BXyS7xKC.mjs";
8
8
  import { z } from "zod";
9
9
  import * as _$_bufbuild_protobuf_codegenv20 from "@bufbuild/protobuf/codegenv2";
10
10
  import { GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
@@ -17582,7 +17582,7 @@ declare function loadConfig(configPath?: string): Promise<{
17582
17582
  plugins: Plugin[];
17583
17583
  }>;
17584
17584
  //#endregion
17585
- //#region src/cli/commands/apply/function-registry.d.ts
17585
+ //#region src/cli/commands/deploy/function-registry.d.ts
17586
17586
  /**
17587
17587
  * In-memory bundled scripts organized by kind.
17588
17588
  */
@@ -17593,8 +17593,8 @@ type BundledScripts = {
17593
17593
  authHooks: Map<string, string>;
17594
17594
  };
17595
17595
  //#endregion
17596
- //#region src/cli/commands/apply/apply.d.ts
17597
- interface ApplyOptions {
17596
+ //#region src/cli/commands/deploy/deploy.d.ts
17597
+ interface DeployOptions {
17598
17598
  workspaceId?: string;
17599
17599
  profile?: string;
17600
17600
  configPath?: string;
@@ -17606,11 +17606,11 @@ interface ApplyOptions {
17606
17606
  buildOnly?: boolean;
17607
17607
  }
17608
17608
  /**
17609
- * Apply the configured application to the Tailor platform.
17610
- * @param options - Options for apply execution
17609
+ * Deploy the configured application to the Tailor platform.
17610
+ * @param options - Options for deploy execution
17611
17611
  * @returns Promise that resolves to `{ bundledScripts }` when `buildOnly` is true, otherwise void
17612
17612
  */
17613
- declare function apply(options?: ApplyOptions): Promise<{
17613
+ declare function deploy(options?: DeployOptions): Promise<{
17614
17614
  bundledScripts: BundledScripts;
17615
17615
  } | undefined>;
17616
17616
  //#endregion
@@ -19404,5 +19404,5 @@ declare function waitForExecution(client: OperatorClient, workspaceId: string, e
19404
19404
  */
19405
19405
  declare function executeScript(options: ScriptExecutionOptions): Promise<ScriptExecutionResult>;
19406
19406
  //#endregion
19407
- export { type AggregateArgs, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type 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 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 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 SnapshotType, type StartWorkflowOptions, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type TailorDBGenerator, type TailorDBInput, type TailorDBResolverGenerator, 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 WatchExecutorJobOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkspaceDetails, type WorkspaceInfo, apiCall, apply, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, enumConstantsPlugin, executeScript, fileUtilsPlugin, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, 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, watchExecutorJob };
19407
+ export { type AggregateArgs, type ApiCallOptions, type ApiCallResult, type AppHealthInfo, type AppInfo, type ApplicationInfo, type DeployOptions as ApplyOptions, type DeployOptions, 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 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 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 SnapshotType, type StartWorkflowOptions, type StartWorkflowResultWithWait, type StartWorkflowTypedOptions, type TailorDBGenerator, type TailorDBInput, type TailorDBResolverGenerator, 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 WatchExecutorJobOptions, type WatchExecutorJobResult, type WatchExecutorJobTypedOptions, type WebhookExecutorInfo, type WorkflowExecutionInfo, type WorkflowInfo, type WorkflowJobExecutionInfo, type WorkflowListInfo, type WorkspaceDetails, type WorkspaceInfo, apiCall, deploy as apply, deploy, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, enumConstantsPlugin, executeScript, fileUtilsPlugin, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, 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, watchExecutorJob };
19408
19408
  //# sourceMappingURL=lib.d.mts.map
package/dist/cli/lib.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
- import { d as initOperatorClient } from "../client-BwXkoiMq.mjs";
3
- import { $t as getMigrationDirPath, A as truncate, B as updateOrganization, Bt as MIGRATION_LABEL_KEY, D as resumeWorkflow, Dt as startWorkflow, Gt as INITIAL_SCHEMA_NUMBER, Ht as bundleMigrationScript, It as getExecutor, J as updateFolder, Jt as compareLocalTypesWithSnapshot, K as getOrganization, Kt as MIGRATE_FILE_NAME, L as remove, Lt as apply, M as generate$1, Mt as listWorkflowExecutions, P as show, Q as getFolder, Qt as getLatestMigrationNumber, Rt as executeScript, S as listApps, St as getExecutorJob, Tt as watchExecutorJob, Ut as DB_TYPES_FILE_NAME, V as organizationTree, W as listOrganizations, Wt as DIFF_FILE_NAME, X as listFolders, Xt as createSnapshotFromLocalTypes, Yt as compareSnapshots, _ as getWorkspace, a as updateUser, an as reconstructSnapshotFromMigrations, cn as hasChanges, d as inviteUser, dt as generate, en as getMigrationFilePath, et as deleteFolder, gt as listWebhookExecutors, h as listWorkspaces, hn as apiCall, ht as getFunctionRegistry, it as listOAuth2Clients, jt as getWorkflowExecution, k as listWorkflows, kt as getWorkflow, l as listUsers, ln as getNamespacesWithMigrations, n as query, nn as getNextMigrationNumber, nt as createFolder, on as formatDiffSummary, ot as getOAuth2Client, p as restoreWorkspace, pn as generateUserTypes, pt as listFunctionRegistries, qt as SCHEMA_FILE_NAME, s as removeUser, sn as formatMigrationDiff, st as getMachineUserToken, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, ut as listMachineUsers, w as getAppHealth, wt as listExecutorJobs, x as createWorkspace, xt as listExecutors, y as deleteWorkspace, yt as triggerExecutor, zt as waitForExecution } from "../runtime-D97Ydu2S.mjs";
4
- import { C as loadWorkspaceId, S as loadAccessToken, _ as getDistDir, y as loadConfig } from "../application-B4zVVNRS.mjs";
2
+ import { d as initOperatorClient } from "../client-COfsXV69.mjs";
3
+ import { $t as getMigrationDirPath, A as truncate, B as updateOrganization, Bt as MIGRATION_LABEL_KEY, D as resumeWorkflow, Dt as startWorkflow, Gt as INITIAL_SCHEMA_NUMBER, Ht as bundleMigrationScript, It as getExecutor, J as updateFolder, Jt as compareLocalTypesWithSnapshot, K as getOrganization, Kt as MIGRATE_FILE_NAME, L as remove, Lt as deploy, M as generate$1, Mt as listWorkflowExecutions, P as show, Q as getFolder, Qt as getLatestMigrationNumber, Rt as executeScript, S as listApps, St as getExecutorJob, Tt as watchExecutorJob, Ut as DB_TYPES_FILE_NAME, V as organizationTree, W as listOrganizations, Wt as DIFF_FILE_NAME, X as listFolders, Xt as createSnapshotFromLocalTypes, Yt as compareSnapshots, _ as getWorkspace, a as updateUser, an as reconstructSnapshotFromMigrations, cn as hasChanges, d as inviteUser, dt as generate, en as getMigrationFilePath, et as deleteFolder, fn as generateUserTypes, gt as listWebhookExecutors, h as listWorkspaces, hn as apiCall, ht as getFunctionRegistry, it as listOAuth2Clients, jt as getWorkflowExecution, k as listWorkflows, kt as getWorkflow, l as listUsers, ln as getNamespacesWithMigrations, n as query, nn as getNextMigrationNumber, nt as createFolder, on as formatDiffSummary, ot as getOAuth2Client, p as restoreWorkspace, pt as listFunctionRegistries, qt as SCHEMA_FILE_NAME, s as removeUser, sn as formatMigrationDiff, st as getMachineUserToken, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, ut as listMachineUsers, w as getAppHealth, wt as listExecutorJobs, x as createWorkspace, xt as listExecutors, y as deleteWorkspace, yt as triggerExecutor, zt as waitForExecution } from "../runtime-DDYL2Zf1.mjs";
4
+ import { C as loadWorkspaceId, S as loadAccessToken, _ as getDistDir, y as loadConfig } from "../application-TasSqBTD.mjs";
5
5
  import { n as enumConstantsPlugin } from "../enum-constants-C3KSpsYj.mjs";
6
6
  import { t as multiline } from "../multiline-e3IpANmS.mjs";
7
7
  import { n as fileUtilsPlugin } from "../file-utils-DjNi_3U_.mjs";
@@ -279,5 +279,5 @@ if (!isNativeTypeScriptRuntime()) {
279
279
  }
280
280
 
281
281
  //#endregion
282
- export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, SCHEMA_FILE_NAME, apiCall, apply, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, enumConstantsPlugin, executeScript, fileUtilsPlugin, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, 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, watchExecutorJob };
282
+ export { DB_TYPES_FILE_NAME, DIFF_FILE_NAME, INITIAL_SCHEMA_NUMBER, MIGRATE_FILE_NAME, MIGRATION_LABEL_KEY, SCHEMA_FILE_NAME, apiCall, deploy as apply, deploy, bundleMigrationScript, bundleSeedScript, chunkSeedData, compareLocalTypesWithSnapshot, compareSnapshots, createFolder, createSnapshotFromLocalTypes, createWorkspace, deleteFolder, deleteWorkspace, enumConstantsPlugin, executeScript, fileUtilsPlugin, formatDiffSummary, formatMigrationDiff, generate, generateUserTypes, getAppHealth, getExecutor, getExecutorJob, 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, watchExecutorJob };
283
283
  //# sourceMappingURL=lib.mjs.map
@@ -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\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] && data[type].length > 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 = data[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 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 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.\nif (!isNativeTypeScriptRuntime()) {\n const { register } = await import(\"node:module\");\n register(\"tsx\", import.meta.url, { data: {} });\n}\n\nexport { apply } from \"./commands/apply/apply\";\nexport type { ApplyOptions } from \"./commands/apply/apply\";\nexport type { BundledScripts } from \"./commands/apply/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 \"@/types/tailordb\";\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\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/enum-constants' instead */\nexport { enumConstantsPlugin } from \"@/plugin/builtin/enum-constants\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/file-utils' instead */\nexport { fileUtilsPlugin } from \"@/plugin/builtin/file-utils\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/seed' instead */\nexport { seedPlugin } from \"@/plugin/builtin/seed\";\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} from \"./commands/workflow/executions\";\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 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 SnapshotType,\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-proto/tailor/v1/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\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] && data[type].length > 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 = data[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 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 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.\nif (!isNativeTypeScriptRuntime()) {\n const { register } = await import(\"node:module\");\n register(\"tsx\", import.meta.url, { data: {} });\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 \"@/types/tailordb\";\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\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/enum-constants' instead */\nexport { enumConstantsPlugin } from \"@/plugin/builtin/enum-constants\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/file-utils' instead */\nexport { fileUtilsPlugin } from \"@/plugin/builtin/file-utils\";\n/** @deprecated Import from '@tailor-platform/sdk/plugin/seed' instead */\nexport { seedPlugin } from \"@/plugin/builtin/seed\";\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} from \"./commands/workflow/executions\";\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 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 SnapshotType,\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-proto/tailor/v1/auth_resource_pb\";\n"],"mappings":"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"}
@@ -1119,21 +1119,6 @@ var require_errors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1119
1119
  }
1120
1120
  [kSecureProxyConnectionError] = true;
1121
1121
  };
1122
- const kMessageSizeExceededError = Symbol.for("undici.error.UND_ERR_WS_MESSAGE_SIZE_EXCEEDED");
1123
- var MessageSizeExceededError = class extends UndiciError {
1124
- constructor(message) {
1125
- super(message);
1126
- this.name = "MessageSizeExceededError";
1127
- this.message = message || "Max decompressed message size exceeded";
1128
- this.code = "UND_ERR_WS_MESSAGE_SIZE_EXCEEDED";
1129
- }
1130
- static [Symbol.hasInstance](instance) {
1131
- return instance && instance[kMessageSizeExceededError] === true;
1132
- }
1133
- get [kMessageSizeExceededError]() {
1134
- return true;
1135
- }
1136
- };
1137
1122
  module.exports = {
1138
1123
  AbortError,
1139
1124
  HTTPParserError,
@@ -1157,8 +1142,7 @@ var require_errors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1157
1142
  ResponseExceededMaxSizeError,
1158
1143
  RequestRetryError,
1159
1144
  ResponseError,
1160
- SecureProxyConnectionError,
1161
- MessageSizeExceededError
1145
+ SecureProxyConnectionError
1162
1146
  };
1163
1147
  }));
1164
1148
 
@@ -1958,7 +1942,6 @@ var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1958
1942
  if (typeof method !== "string") throw new InvalidArgumentError("method must be a string");
1959
1943
  else if (normalizedMethodRecords[method] === void 0 && !isValidHTTPToken(method)) throw new InvalidArgumentError("invalid request method");
1960
1944
  if (upgrade && typeof upgrade !== "string") throw new InvalidArgumentError("upgrade must be a string");
1961
- if (upgrade && !isValidHeaderValue(upgrade)) throw new InvalidArgumentError("invalid upgrade header");
1962
1945
  if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) throw new InvalidArgumentError("invalid headersTimeout");
1963
1946
  if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) throw new InvalidArgumentError("invalid bodyTimeout");
1964
1947
  if (reset != null && typeof reset !== "boolean") throw new InvalidArgumentError("invalid reset");
@@ -2138,12 +2121,10 @@ var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2138
2121
  if (!isValidHeaderValue(val)) throw new InvalidArgumentError(`invalid ${key} header`);
2139
2122
  } else if (val === null) val = "";
2140
2123
  else val = `${val}`;
2141
- if (headerName === "host") {
2142
- if (request.host !== null) throw new InvalidArgumentError("duplicate host header");
2124
+ if (request.host === null && headerName === "host") {
2143
2125
  if (typeof val !== "string") throw new InvalidArgumentError("invalid host header");
2144
2126
  request.host = val;
2145
- } else if (headerName === "content-length") {
2146
- if (request.contentLength !== null) throw new InvalidArgumentError("duplicate content-length header");
2127
+ } else if (request.contentLength === null && headerName === "content-length") {
2147
2128
  request.contentLength = parseInt(val, 10);
2148
2129
  if (!Number.isFinite(request.contentLength)) throw new InvalidArgumentError("invalid content-length header");
2149
2130
  } else if (request.contentType === null && headerName === "content-type") {
@@ -2216,18 +2197,13 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
2216
2197
  const kOnDestroyed = Symbol("onDestroyed");
2217
2198
  const kOnClosed = Symbol("onClosed");
2218
2199
  const kInterceptedDispatch = Symbol("Intercepted Dispatch");
2219
- const kWebSocketOptions = Symbol("webSocketOptions");
2220
2200
  var DispatcherBase = class extends Dispatcher {
2221
- constructor(opts) {
2201
+ constructor() {
2222
2202
  super();
2223
2203
  this[kDestroyed] = false;
2224
2204
  this[kOnDestroyed] = null;
2225
2205
  this[kClosed] = false;
2226
2206
  this[kOnClosed] = [];
2227
- this[kWebSocketOptions] = opts?.webSocket ?? {};
2228
- }
2229
- get webSocketOptions() {
2230
- return { maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024 };
2231
2207
  }
2232
2208
  get destroyed() {
2233
2209
  return this[kDestroyed];
@@ -6932,8 +6908,8 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6932
6908
  * @param {string|URL} url
6933
6909
  * @param {import('../../types/client.js').Client.Options} options
6934
6910
  */
6935
- constructor(url, { interceptors, maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, maxRedirections, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, webSocket } = {}) {
6936
- super({ webSocket });
6911
+ constructor(url, { interceptors, maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, maxRedirections, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2 } = {}) {
6912
+ super();
6937
6913
  if (keepAlive !== void 0) throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
6938
6914
  if (socketTimeout !== void 0) throw new InvalidArgumentError("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");
6939
6915
  if (requestTimeout !== void 0) throw new InvalidArgumentError("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");
@@ -7339,8 +7315,8 @@ var require_pool_base = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7339
7315
  const kRemoveClient = Symbol("remove client");
7340
7316
  const kStats = Symbol("stats");
7341
7317
  var PoolBase = class extends DispatcherBase {
7342
- constructor(opts) {
7343
- super(opts);
7318
+ constructor() {
7319
+ super();
7344
7320
  this[kQueue] = new FixedQueue();
7345
7321
  this[kClients] = [];
7346
7322
  this[kQueued] = 0;
@@ -7471,6 +7447,7 @@ var require_pool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7471
7447
  }
7472
7448
  var Pool = class extends PoolBase {
7473
7449
  constructor(origin, { connections, factory = defaultFactory, connect, connectTimeout, tls, maxCachedSessions, socketPath, autoSelectFamily, autoSelectFamilyAttemptTimeout, allowH2, ...options } = {}) {
7450
+ super();
7474
7451
  if (connections != null && (!Number.isFinite(connections) || connections < 0)) throw new InvalidArgumentError("invalid connections");
7475
7452
  if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
7476
7453
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
@@ -7486,7 +7463,6 @@ var require_pool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7486
7463
  } : void 0,
7487
7464
  ...connect
7488
7465
  });
7489
- super(options);
7490
7466
  this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool) ? options.interceptors.Pool : [];
7491
7467
  this[kConnections] = connections || null;
7492
7468
  this[kUrl] = util.parseOrigin(origin);
@@ -7650,10 +7626,10 @@ var require_agent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7650
7626
  }
7651
7627
  var Agent = class extends DispatcherBase {
7652
7628
  constructor({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
7629
+ super();
7653
7630
  if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
7654
7631
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
7655
7632
  if (!Number.isInteger(maxRedirections) || maxRedirections < 0) throw new InvalidArgumentError("maxRedirections must be a positive number");
7656
- super(options);
7657
7633
  if (connect && typeof connect !== "function") connect = { ...connect };
7658
7634
  this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent) ? options.interceptors.Agent : [createRedirectInterceptor({ maxRedirections })];
7659
7635
  this[kOptions] = {
@@ -14464,13 +14440,11 @@ var require_util$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14464
14440
  * @param {string} value
14465
14441
  */
14466
14442
  function isValidClientWindowBits(value) {
14467
- if (value.length === 0) return false;
14468
14443
  for (let i = 0; i < value.length; i++) {
14469
14444
  const byte = value.charCodeAt(i);
14470
14445
  if (byte < 48 || byte > 57) return false;
14471
14446
  }
14472
- const num = Number.parseInt(value, 10);
14473
- return num >= 8 && num <= 15;
14447
+ return true;
14474
14448
  }
14475
14449
  const hasIntl = typeof process.versions.icu === "string";
14476
14450
  const fatalDecoder = hasIntl ? new TextDecoder("utf-8", { fatal: true }) : void 0;
@@ -14746,7 +14720,6 @@ var require_connection = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14746
14720
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14747
14721
  const { createInflateRaw, Z_DEFAULT_WINDOWBITS } = __require("node:zlib");
14748
14722
  const { isValidClientWindowBits } = require_util$1();
14749
- const { MessageSizeExceededError } = require_errors();
14750
14723
  const tail = Buffer.from([
14751
14724
  0,
14752
14725
  0,
@@ -14759,21 +14732,10 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14759
14732
  /** @type {import('node:zlib').InflateRaw} */
14760
14733
  #inflate;
14761
14734
  #options = {};
14762
- #maxPayloadSize = 0;
14763
- /**
14764
- * @param {Map<string, string>} extensions
14765
- */
14766
- constructor(extensions, options) {
14735
+ constructor(extensions) {
14767
14736
  this.#options.serverNoContextTakeover = extensions.has("server_no_context_takeover");
14768
14737
  this.#options.serverMaxWindowBits = extensions.get("server_max_window_bits");
14769
- this.#maxPayloadSize = options.maxPayloadSize;
14770
14738
  }
14771
- /**
14772
- * Decompress a compressed payload.
14773
- * @param {Buffer} chunk Compressed data
14774
- * @param {boolean} fin Final fragment flag
14775
- * @param {Function} callback Callback function
14776
- */
14777
14739
  decompress(chunk, fin, callback) {
14778
14740
  if (!this.#inflate) {
14779
14741
  let windowBits = Z_DEFAULT_WINDOWBITS;
@@ -14784,23 +14746,12 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14784
14746
  }
14785
14747
  windowBits = Number.parseInt(this.#options.serverMaxWindowBits);
14786
14748
  }
14787
- try {
14788
- this.#inflate = createInflateRaw({ windowBits });
14789
- } catch (err) {
14790
- callback(err);
14791
- return;
14792
- }
14749
+ this.#inflate = createInflateRaw({ windowBits });
14793
14750
  this.#inflate[kBuffer] = [];
14794
14751
  this.#inflate[kLength] = 0;
14795
14752
  this.#inflate.on("data", (data) => {
14796
- this.#inflate[kLength] += data.length;
14797
- if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
14798
- callback(new MessageSizeExceededError());
14799
- this.#inflate.removeAllListeners();
14800
- this.#inflate = null;
14801
- return;
14802
- }
14803
14753
  this.#inflate[kBuffer].push(data);
14754
+ this.#inflate[kLength] += data.length;
14804
14755
  });
14805
14756
  this.#inflate.on("error", (err) => {
14806
14757
  this.#inflate = null;
@@ -14810,7 +14761,6 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14810
14761
  this.#inflate.write(chunk);
14811
14762
  if (fin) this.#inflate.write(tail);
14812
14763
  this.#inflate.flush(() => {
14813
- if (!this.#inflate) return;
14814
14764
  const full = Buffer.concat(this.#inflate[kBuffer], this.#inflate[kLength]);
14815
14765
  this.#inflate[kBuffer].length = 0;
14816
14766
  this.#inflate[kLength] = 0;
@@ -14833,10 +14783,8 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14833
14783
  const { WebsocketFrameSend } = require_frame();
14834
14784
  const { closeWebSocketConnection } = require_connection();
14835
14785
  const { PerMessageDeflate } = require_permessage_deflate();
14836
- const { MessageSizeExceededError } = require_errors();
14837
14786
  var ByteParser = class extends Writable {
14838
14787
  #buffers = [];
14839
- #fragmentsBytes = 0;
14840
14788
  #byteOffset = 0;
14841
14789
  #loop = false;
14842
14790
  #state = parserStates.INFO;
@@ -14844,19 +14792,11 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14844
14792
  #fragments = [];
14845
14793
  /** @type {Map<string, PerMessageDeflate>} */
14846
14794
  #extensions;
14847
- /** @type {number} */
14848
- #maxPayloadSize;
14849
- /**
14850
- * @param {import('./websocket').WebSocket} ws
14851
- * @param {Map<string, string>|null} extensions
14852
- * @param {{ maxPayloadSize?: number }} [options]
14853
- */
14854
- constructor(ws, extensions, options = {}) {
14795
+ constructor(ws, extensions) {
14855
14796
  super();
14856
14797
  this.ws = ws;
14857
14798
  this.#extensions = extensions == null ? /* @__PURE__ */ new Map() : extensions;
14858
- this.#maxPayloadSize = options.maxPayloadSize ?? 0;
14859
- if (this.#extensions.has("permessage-deflate")) this.#extensions.set("permessage-deflate", new PerMessageDeflate(extensions, options));
14799
+ if (this.#extensions.has("permessage-deflate")) this.#extensions.set("permessage-deflate", new PerMessageDeflate(extensions));
14860
14800
  }
14861
14801
  /**
14862
14802
  * @param {Buffer} chunk
@@ -14868,13 +14808,6 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14868
14808
  this.#loop = true;
14869
14809
  this.run(callback);
14870
14810
  }
14871
- #validatePayloadLength() {
14872
- if (this.#maxPayloadSize > 0 && !isControlFrame(this.#info.opcode) && this.#info.payloadLength > this.#maxPayloadSize) {
14873
- failWebsocketConnection(this.ws, "Payload size exceeds maximum allowed size");
14874
- return false;
14875
- }
14876
- return true;
14877
- }
14878
14811
  /**
14879
14812
  * Runs whenever a new chunk is received.
14880
14813
  * Callback is called whenever there are no more chunks buffering,
@@ -14931,7 +14864,6 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14931
14864
  if (payloadLength <= 125) {
14932
14865
  this.#info.payloadLength = payloadLength;
14933
14866
  this.#state = parserStates.READ_DATA;
14934
- if (!this.#validatePayloadLength()) return;
14935
14867
  } else if (payloadLength === 126) this.#state = parserStates.PAYLOADLENGTH_16;
14936
14868
  else if (payloadLength === 127) this.#state = parserStates.PAYLOADLENGTH_64;
14937
14869
  if (isTextBinaryFrame(opcode)) {
@@ -14947,19 +14879,17 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14947
14879
  const buffer = this.consume(2);
14948
14880
  this.#info.payloadLength = buffer.readUInt16BE(0);
14949
14881
  this.#state = parserStates.READ_DATA;
14950
- if (!this.#validatePayloadLength()) return;
14951
14882
  } else if (this.#state === parserStates.PAYLOADLENGTH_64) {
14952
14883
  if (this.#byteOffset < 8) return callback();
14953
14884
  const buffer = this.consume(8);
14954
14885
  const upper = buffer.readUInt32BE(0);
14955
- const lower = buffer.readUInt32BE(4);
14956
- if (upper !== 0 || lower > 2 ** 31 - 1) {
14886
+ if (upper > 2 ** 31 - 1) {
14957
14887
  failWebsocketConnection(this.ws, "Received payload length > 2^31 bytes.");
14958
14888
  return;
14959
14889
  }
14960
- this.#info.payloadLength = lower;
14890
+ const lower = buffer.readUInt32BE(4);
14891
+ this.#info.payloadLength = (upper << 8) + lower;
14961
14892
  this.#state = parserStates.READ_DATA;
14962
- if (!this.#validatePayloadLength()) return;
14963
14893
  } else if (this.#state === parserStates.READ_DATA) {
14964
14894
  if (this.#byteOffset < this.#info.payloadLength) return callback();
14965
14895
  const body = this.consume(this.#info.payloadLength);
@@ -14967,33 +14897,30 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14967
14897
  this.#loop = this.parseControlFrame(body);
14968
14898
  this.#state = parserStates.INFO;
14969
14899
  } else if (!this.#info.compressed) {
14970
- this.writeFragments(body);
14971
- if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
14972
- failWebsocketConnection(this.ws, new MessageSizeExceededError().message);
14973
- return;
14900
+ this.#fragments.push(body);
14901
+ if (!this.#info.fragmented && this.#info.fin) {
14902
+ const fullMessage = Buffer.concat(this.#fragments);
14903
+ websocketMessageReceived(this.ws, this.#info.binaryType, fullMessage);
14904
+ this.#fragments.length = 0;
14974
14905
  }
14975
- if (!this.#info.fragmented && this.#info.fin) websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
14976
14906
  this.#state = parserStates.INFO;
14977
14907
  } else {
14978
14908
  this.#extensions.get("permessage-deflate").decompress(body, this.#info.fin, (error, data) => {
14979
14909
  if (error) {
14980
- failWebsocketConnection(this.ws, error.message);
14981
- return;
14982
- }
14983
- this.writeFragments(data);
14984
- if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
14985
- failWebsocketConnection(this.ws, new MessageSizeExceededError().message);
14910
+ closeWebSocketConnection(this.ws, 1007, error.message, error.message.length);
14986
14911
  return;
14987
14912
  }
14913
+ this.#fragments.push(data);
14988
14914
  if (!this.#info.fin) {
14989
14915
  this.#state = parserStates.INFO;
14990
14916
  this.#loop = true;
14991
14917
  this.run(callback);
14992
14918
  return;
14993
14919
  }
14994
- websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
14920
+ websocketMessageReceived(this.ws, this.#info.binaryType, Buffer.concat(this.#fragments));
14995
14921
  this.#loop = true;
14996
14922
  this.#state = parserStates.INFO;
14923
+ this.#fragments.length = 0;
14997
14924
  this.run(callback);
14998
14925
  });
14999
14926
  this.#loop = false;
@@ -15033,21 +14960,6 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15033
14960
  this.#byteOffset -= n;
15034
14961
  return buffer;
15035
14962
  }
15036
- writeFragments(fragment) {
15037
- this.#fragmentsBytes += fragment.length;
15038
- this.#fragments.push(fragment);
15039
- }
15040
- consumeFragments() {
15041
- const fragments = this.#fragments;
15042
- if (fragments.length === 1) {
15043
- this.#fragmentsBytes = 0;
15044
- return fragments.shift();
15045
- }
15046
- const output = Buffer.concat(fragments, this.#fragmentsBytes);
15047
- this.#fragments = [];
15048
- this.#fragmentsBytes = 0;
15049
- return output;
15050
- }
15051
14963
  parseCloseBody(data) {
15052
14964
  assert(data.length !== 1);
15053
14965
  /** @type {number|undefined} */
@@ -15404,8 +15316,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15404
15316
  */
15405
15317
  #onConnectionEstablished(response, parsedExtensions) {
15406
15318
  this[kResponse] = response;
15407
- const maxPayloadSize = this[kController]?.dispatcher?.webSocketOptions?.maxPayloadSize;
15408
- const parser = new ByteParser(this, parsedExtensions, { maxPayloadSize });
15319
+ const parser = new ByteParser(this, parsedExtensions);
15409
15320
  parser.on("drain", onParserDrain);
15410
15321
  parser.on("error", onParserError.bind(this));
15411
15322
  response.socket.ws = this;
@@ -16223,7 +16134,7 @@ function initOAuth2Client() {
16223
16134
  * @returns Configured Operator client
16224
16135
  */
16225
16136
  async function initOperatorClient(accessToken) {
16226
- const { createTracingInterceptor } = await import("./interceptor-CrcDfLPq.mjs");
16137
+ const { createTracingInterceptor } = await import("./interceptor-CBsqEWDK.mjs");
16227
16138
  return createClient(OperatorService, await createTransport(platformBaseUrl, [
16228
16139
  await userAgentInterceptor(),
16229
16140
  await bearerTokenInterceptor(accessToken),
@@ -16533,4 +16444,4 @@ async function closeConnectionPool() {
16533
16444
 
16534
16445
  //#endregion
16535
16446
  export { FilterSchema as $, FunctionExecution_Status as A, AuthOAuth2Client_GrantType as B, TailorDBType_Permission_Operator as C, IdPLang as D, PipelineResolver_OperationType as E, AuthConnection_Type as F, PATScope as G, AuthSCIMAttribute_Type as H, AuthHookPoint as I, GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus as J, TenantProviderConfig_TenantProviderType as K, AuthIDPConfig_AuthType as L, ExecutorJobStatus as M, ExecutorTargetType as N, IdPPermissionOperator as O, ExecutorTriggerType as P, Condition_Operator as Q, AuthInvokerSchema as R, TailorDBGQLPermission_Permit as S, TailorDBType_PermitAction as T, AuthSCIMAttribute_Uniqueness as U, AuthSCIMAttribute_Mutability as V, AuthSCIMConfig_AuthorizationType as W, Subgraph_ServiceType as X, ApplicationSchemaUpdateAttemptStatus as Y, ConditionSchema as Z, WorkspacePlatformUserRole as _, fetchMachineUserToken as a, TailorDBGQLPermission_Action as b, fetchUserInfo as c, initOperatorClient as d, PageDirection as et, parseMethodName as f, OperatorService as g, userAgent as h, fetchAll as i, FunctionExecution_Type as j, IdPPermissionPermit as k, formatRequestParams as l, resolveStaticWebsiteUrls as m, closeConnectionPool as n, fetchPaged as o, platformBaseUrl as p, UserProfileProviderConfig_UserProfileProviderType as q, createTransport as r, fetchPlatformMachineUserToken as s, MAX_PAGE_SIZE as t, initOAuth2Client as u, WorkflowExecution_Status as v, TailorDBType_Permission_Permit as w, TailorDBGQLPermission_Operator as x, WorkflowJobExecution_Status as y, AuthOAuth2Client_ClientType as z };
16536
- //# sourceMappingURL=client-BwXkoiMq.mjs.map
16447
+ //# sourceMappingURL=client-COfsXV69.mjs.map