@tailor-platform/sdk 1.43.0 → 1.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/application-Cot5-3g3.mjs +4 -0
  3. package/dist/{application-DQpD_kHR.mjs → application-vJxYH5LE.mjs} +148 -11
  4. package/dist/application-vJxYH5LE.mjs.map +1 -0
  5. package/dist/cli/index.mjs +27 -19
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +349 -15
  8. package/dist/cli/lib.mjs +8 -8
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/cli/skills.mjs.map +1 -1
  11. package/dist/{client-CcV6Jjds.mjs → client-DcuQRqSd.mjs} +127 -54
  12. package/dist/client-DcuQRqSd.mjs.map +1 -0
  13. package/dist/{client-Cn9SqhZT.mjs → client-IsYnTV5A.mjs} +1 -1
  14. package/dist/configure/index.d.mts +3 -3
  15. package/dist/configure/index.mjs +1 -1
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crash-report-CSYupJ0T.mjs → crash-report-DQen2i_W.mjs} +1 -1
  18. package/dist/{crash-report-CUbm1ErM.mjs → crash-report-DVZsX1bs.mjs} +4 -4
  19. package/dist/{crash-report-CUbm1ErM.mjs.map → crash-report-DVZsX1bs.mjs.map} +1 -1
  20. package/dist/{enum-constants-Dx82rSjf.mjs → enum-constants-C3KSpsYj.mjs} +1 -1
  21. package/dist/{enum-constants-Dx82rSjf.mjs.map → enum-constants-C3KSpsYj.mjs.map} +1 -1
  22. package/dist/{errors-ChWX5ZG8.mjs → errors-_M2TVoWh.mjs} +1 -1
  23. package/dist/{errors-ChWX5ZG8.mjs.map → errors-_M2TVoWh.mjs.map} +1 -1
  24. package/dist/{file-utils-DeWpvq3T.mjs → file-utils-775qWKoo.mjs} +1 -1
  25. package/dist/{file-utils-DeWpvq3T.mjs.map → file-utils-775qWKoo.mjs.map} +1 -1
  26. package/dist/{index-Br4XCvX1.d.mts → index-BOfTiouP.d.mts} +5 -2
  27. package/dist/interceptor-4UC-KTno.mjs.map +1 -1
  28. package/dist/job-BOvKyNdT.mjs.map +1 -1
  29. package/dist/kysely/index.mjs.map +1 -1
  30. package/dist/{kysely-type-CwtvQuxh.mjs → kysely-type-BQsYEZoY.mjs} +1 -1
  31. package/dist/kysely-type-BQsYEZoY.mjs.map +1 -0
  32. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  33. package/dist/{package-json-CWp8s9dE.mjs → package-json-CRzw5eUf.mjs} +1 -1
  34. package/dist/{package-json-CWp8s9dE.mjs.map → package-json-CRzw5eUf.mjs.map} +1 -1
  35. package/dist/package-json-DR_mqrCW.mjs +4 -0
  36. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  37. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  38. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  39. package/dist/plugin/builtin/seed/index.mjs +1 -1
  40. package/dist/plugin/index.mjs.map +1 -1
  41. package/dist/repl-editor-DjycioU-.mjs.map +1 -1
  42. package/dist/{runtime-Bn68JXnL.mjs → runtime-DQqulWPm.mjs} +324 -126
  43. package/dist/runtime-DQqulWPm.mjs.map +1 -0
  44. package/dist/{schema-CEcfEyPN.mjs → schema-DBq6hr6h.mjs} +13 -2
  45. package/dist/{schema-CEcfEyPN.mjs.map → schema-DBq6hr6h.mjs.map} +1 -1
  46. package/dist/{seed-CyYPhvNL.mjs → seed-BkVKgsxf.mjs} +1 -1
  47. package/dist/{seed-CyYPhvNL.mjs.map → seed-BkVKgsxf.mjs.map} +1 -1
  48. package/dist/{service-SrG26B9T.mjs → service-CCnx_IFw.mjs} +2 -2
  49. package/dist/{service-SrG26B9T.mjs.map → service-CCnx_IFw.mjs.map} +1 -1
  50. package/dist/{telemetry-BuDto_2q.mjs → telemetry-B6Le9XT-.mjs} +2 -2
  51. package/dist/{telemetry-BuDto_2q.mjs.map → telemetry-B6Le9XT-.mjs.map} +1 -1
  52. package/dist/telemetry-C_WXxIo0.mjs +4 -0
  53. package/dist/types-Duhhsx3R.mjs.map +1 -1
  54. package/dist/utils/test/index.d.mts +2 -2
  55. package/dist/utils/test/index.mjs.map +1 -1
  56. package/dist/{workflow.generated-CDCnZNkH.d.mts → workflow.generated-B7Mupf5V.d.mts} +5 -2
  57. package/docs/cli/application.md +130 -5
  58. package/docs/cli/crash-report.md +12 -1
  59. package/docs/cli/executor.md +6 -4
  60. package/docs/cli/organization.md +6 -5
  61. package/docs/cli/workspace.md +16 -13
  62. package/docs/cli-reference.md +10 -9
  63. package/docs/services/workflow.md +20 -0
  64. package/package.json +9 -9
  65. package/dist/application-DQpD_kHR.mjs.map +0 -1
  66. package/dist/application-DUcmoFdc.mjs +0 -4
  67. package/dist/client-CcV6Jjds.mjs.map +0 -1
  68. package/dist/kysely-type-CwtvQuxh.mjs.map +0 -1
  69. package/dist/package-json-CPR7s5hf.mjs +0 -4
  70. package/dist/runtime-Bn68JXnL.mjs.map +0 -1
  71. package/dist/telemetry-C1hzFaiV.mjs +0 -4
@@ -1,6 +1,6 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
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-D_z185oq.mjs";
3
- import { n as AppConfig } from "../workflow.generated-CDCnZNkH.mjs";
3
+ import { r as AppConfig } from "../workflow.generated-B7Mupf5V.mjs";
4
4
  import { n as kyselyTypePlugin } from "../index-0Dk-fDWi.mjs";
5
5
  import { n as enumConstantsPlugin } from "../index-ZZYEd_0R.mjs";
6
6
  import { n as fileUtilsPlugin } from "../index-DdsUV-aA.mjs";
@@ -2376,6 +2376,51 @@ declare type GetPlatformAccountPlanResponse = Message<"tailor.v1.GetPlatformAcco
2376
2376
  */
2377
2377
  declare const GetPlatformAccountPlanResponseSchema: GenMessage<GetPlatformAccountPlanResponse>;
2378
2378
  //#endregion
2379
+ //#region ../tailor-proto/src/tailor/v1/gateway_filter_resource_pb.d.ts
2380
+ /**
2381
+ * @generated from message tailor.v1.GatewayFilter
2382
+ */
2383
+ declare type GatewayFilter = Message<"tailor.v1.GatewayFilter"> & {
2384
+ /**
2385
+ * @generated from field: string name = 1;
2386
+ */
2387
+ name: string;
2388
+ /**
2389
+ * @generated from field: string path_pattern = 2;
2390
+ */
2391
+ pathPattern: string;
2392
+ /**
2393
+ * @generated from field: repeated string methods = 3;
2394
+ */
2395
+ methods: string[];
2396
+ /**
2397
+ * @generated from field: string input_filter_script = 4;
2398
+ */
2399
+ inputFilterScript: string;
2400
+ /**
2401
+ * optional
2402
+ *
2403
+ * @generated from field: string output_filter_script = 5;
2404
+ */
2405
+ outputFilterScript: string;
2406
+ /**
2407
+ * @generated from field: bool enabled = 6;
2408
+ */
2409
+ enabled: boolean;
2410
+ /**
2411
+ * @generated from field: int32 priority = 7;
2412
+ */
2413
+ priority: number;
2414
+ /**
2415
+ * @generated from field: google.protobuf.Timestamp create_time = 8;
2416
+ */
2417
+ createTime?: Timestamp;
2418
+ /**
2419
+ * @generated from field: google.protobuf.Timestamp update_time = 9;
2420
+ */
2421
+ updateTime?: Timestamp;
2422
+ };
2423
+ //#endregion
2379
2424
  //#region ../tailor-proto/src/tailor/v1/application_resource_pb.d.ts
2380
2425
  /**
2381
2426
  * @generated from message tailor.v1.Application
@@ -2439,6 +2484,10 @@ declare type Application = Message<"tailor.v1.Application"> & {
2439
2484
  * @generated from field: string auth_idp_config_name = 14;
2440
2485
  */
2441
2486
  authIdpConfigName: string;
2487
+ /**
2488
+ * @generated from field: repeated tailor.v1.GatewayFilter filters = 15;
2489
+ */
2490
+ filters: GatewayFilter[];
2442
2491
  };
2443
2492
  /**
2444
2493
  * @generated from message tailor.v1.ApplicationSchemaUpdateAttempt
@@ -2572,6 +2621,10 @@ declare type CreateApplicationRequest = Message<"tailor.v1.CreateApplicationRequ
2572
2621
  * @generated from field: bool disabled = 9;
2573
2622
  */
2574
2623
  disabled: boolean;
2624
+ /**
2625
+ * @generated from field: repeated tailor.v1.GatewayFilter filters = 10;
2626
+ */
2627
+ filters: GatewayFilter[];
2575
2628
  };
2576
2629
  /**
2577
2630
  * Describes the message tailor.v1.CreateApplicationRequest.
@@ -2636,6 +2689,10 @@ declare type UpdateApplicationRequest = Message<"tailor.v1.UpdateApplicationRequ
2636
2689
  * @generated from field: bool disabled = 9;
2637
2690
  */
2638
2691
  disabled: boolean;
2692
+ /**
2693
+ * @generated from field: repeated tailor.v1.GatewayFilter filters = 10;
2694
+ */
2695
+ filters: GatewayFilter[];
2639
2696
  /**
2640
2697
  * @generated from field: google.protobuf.FieldMask update_mask = 100;
2641
2698
  */
@@ -9837,6 +9894,10 @@ declare type FunctionExecution = Message<"tailor.v1.FunctionExecution"> & {
9837
9894
  * @generated from field: tailor.v1.FunctionErrorKind error_kind = 11;
9838
9895
  */
9839
9896
  errorKind: FunctionErrorKind;
9897
+ /**
9898
+ * @generated from field: string content_hash = 12;
9899
+ */
9900
+ contentHash: string;
9840
9901
  };
9841
9902
  /**
9842
9903
  * @generated from enum tailor.v1.FunctionExecution.Status
@@ -11810,6 +11871,15 @@ declare type WorkflowJobFunction = Message<"tailor.v1.WorkflowJobFunction"> & {
11810
11871
  */
11811
11872
  scriptRef?: string;
11812
11873
  };
11874
+ /**
11875
+ * @generated from message tailor.v1.ConcurrencyPolicy
11876
+ */
11877
+ declare type ConcurrencyPolicy = Message<"tailor.v1.ConcurrencyPolicy"> & {
11878
+ /**
11879
+ * @generated from field: int32 max_concurrent_executions = 1;
11880
+ */
11881
+ maxConcurrentExecutions: number;
11882
+ };
11813
11883
  /**
11814
11884
  * @generated from message tailor.v1.RetryPolicy
11815
11885
  */
@@ -11867,6 +11937,10 @@ declare type Workflow = Message<"tailor.v1.Workflow"> & {
11867
11937
  * @generated from field: optional tailor.v1.RetryPolicy retry_policy = 7;
11868
11938
  */
11869
11939
  retryPolicy?: RetryPolicy;
11940
+ /**
11941
+ * @generated from field: optional tailor.v1.ConcurrencyPolicy concurrency_policy = 8;
11942
+ */
11943
+ concurrencyPolicy?: ConcurrencyPolicy;
11870
11944
  };
11871
11945
  /**
11872
11946
  * @generated from message tailor.v1.WorkflowJobExecution
@@ -12030,6 +12104,10 @@ declare type CreateWorkflowRequest = Message<"tailor.v1.CreateWorkflowRequest">
12030
12104
  * @generated from field: optional tailor.v1.RetryPolicy retry_policy = 5;
12031
12105
  */
12032
12106
  retryPolicy?: RetryPolicy;
12107
+ /**
12108
+ * @generated from field: optional tailor.v1.ConcurrencyPolicy concurrency_policy = 6;
12109
+ */
12110
+ concurrencyPolicy?: ConcurrencyPolicy;
12033
12111
  };
12034
12112
  /**
12035
12113
  * Describes the message tailor.v1.CreateWorkflowRequest.
@@ -12076,6 +12154,10 @@ declare type UpdateWorkflowRequest = Message<"tailor.v1.UpdateWorkflowRequest">
12076
12154
  * @generated from field: optional tailor.v1.RetryPolicy retry_policy = 5;
12077
12155
  */
12078
12156
  retryPolicy?: RetryPolicy;
12157
+ /**
12158
+ * @generated from field: optional tailor.v1.ConcurrencyPolicy concurrency_policy = 6;
12159
+ */
12160
+ concurrencyPolicy?: ConcurrencyPolicy;
12079
12161
  };
12080
12162
  /**
12081
12163
  * Describes the message tailor.v1.UpdateWorkflowRequest.
@@ -12798,6 +12880,40 @@ declare type TelemetryExportBearerTokenAuth = Message<"tailor.v1.TelemetryExport
12798
12880
  */
12799
12881
  secretValue?: SecretValue;
12800
12882
  };
12883
+ /**
12884
+ * ResourceAttributesConfig is a workspace-level singleton that controls
12885
+ * the resource attributes enriched onto outgoing telemetry signals.
12886
+ *
12887
+ * @generated from message tailor.v1.ResourceAttributesConfig
12888
+ */
12889
+ declare type ResourceAttributesConfig = Message<"tailor.v1.ResourceAttributesConfig"> & {
12890
+ /**
12891
+ * Developer-specified prefix prepended to each microservice's own
12892
+ * service.name (e.g. "gateway", "tailordb") to form the final
12893
+ * service.name resource attribute on outgoing signals:
12894
+ * "<service_name_prefix>-<service.name>".
12895
+ *
12896
+ * @generated from field: string service_name_prefix = 1;
12897
+ */
12898
+ serviceNamePrefix: string;
12899
+ /**
12900
+ * Customer-side deployment environment (e.g. "production", "staging").
12901
+ * Optional; when empty, the enricher leaves deployment.environment.name
12902
+ * untouched. Follows OTel semconv `deployment.environment.name` semantics
12903
+ * (free-form string; max 256 chars).
12904
+ *
12905
+ * @generated from field: string deployment_environment_name = 2;
12906
+ */
12907
+ deploymentEnvironmentName: string;
12908
+ /**
12909
+ * @generated from field: google.protobuf.Timestamp created_at = 3;
12910
+ */
12911
+ createdAt?: Timestamp;
12912
+ /**
12913
+ * @generated from field: google.protobuf.Timestamp updated_at = 4;
12914
+ */
12915
+ updatedAt?: Timestamp;
12916
+ };
12801
12917
  /**
12802
12918
  * @generated from enum tailor.v1.TelemetryExportProtocol
12803
12919
  */
@@ -13024,6 +13140,121 @@ declare type TestTelemetryExportResponse = Message<"tailor.v1.TestTelemetryExpor
13024
13140
  * Use `create(TestTelemetryExportResponseSchema)` to create a new message.
13025
13141
  */
13026
13142
  declare const TestTelemetryExportResponseSchema: GenMessage<TestTelemetryExportResponse>;
13143
+ /**
13144
+ * @generated from message tailor.v1.CreateResourceAttributesConfigRequest
13145
+ */
13146
+ declare type CreateResourceAttributesConfigRequest = Message<"tailor.v1.CreateResourceAttributesConfigRequest"> & {
13147
+ /**
13148
+ * @generated from field: string workspace_id = 1;
13149
+ */
13150
+ workspaceId: string;
13151
+ /**
13152
+ * @generated from field: tailor.v1.ResourceAttributesConfig resource_attributes_config = 2;
13153
+ */
13154
+ resourceAttributesConfig?: ResourceAttributesConfig;
13155
+ };
13156
+ /**
13157
+ * Describes the message tailor.v1.CreateResourceAttributesConfigRequest.
13158
+ * Use `create(CreateResourceAttributesConfigRequestSchema)` to create a new message.
13159
+ */
13160
+ declare const CreateResourceAttributesConfigRequestSchema: GenMessage<CreateResourceAttributesConfigRequest>;
13161
+ /**
13162
+ * @generated from message tailor.v1.CreateResourceAttributesConfigResponse
13163
+ */
13164
+ declare type CreateResourceAttributesConfigResponse = Message<"tailor.v1.CreateResourceAttributesConfigResponse"> & {
13165
+ /**
13166
+ * @generated from field: tailor.v1.ResourceAttributesConfig resource_attributes_config = 1;
13167
+ */
13168
+ resourceAttributesConfig?: ResourceAttributesConfig;
13169
+ };
13170
+ /**
13171
+ * Describes the message tailor.v1.CreateResourceAttributesConfigResponse.
13172
+ * Use `create(CreateResourceAttributesConfigResponseSchema)` to create a new message.
13173
+ */
13174
+ declare const CreateResourceAttributesConfigResponseSchema: GenMessage<CreateResourceAttributesConfigResponse>;
13175
+ /**
13176
+ * @generated from message tailor.v1.GetResourceAttributesConfigRequest
13177
+ */
13178
+ declare type GetResourceAttributesConfigRequest = Message<"tailor.v1.GetResourceAttributesConfigRequest"> & {
13179
+ /**
13180
+ * @generated from field: string workspace_id = 1;
13181
+ */
13182
+ workspaceId: string;
13183
+ };
13184
+ /**
13185
+ * Describes the message tailor.v1.GetResourceAttributesConfigRequest.
13186
+ * Use `create(GetResourceAttributesConfigRequestSchema)` to create a new message.
13187
+ */
13188
+ declare const GetResourceAttributesConfigRequestSchema: GenMessage<GetResourceAttributesConfigRequest>;
13189
+ /**
13190
+ * @generated from message tailor.v1.GetResourceAttributesConfigResponse
13191
+ */
13192
+ declare type GetResourceAttributesConfigResponse = Message<"tailor.v1.GetResourceAttributesConfigResponse"> & {
13193
+ /**
13194
+ * @generated from field: tailor.v1.ResourceAttributesConfig resource_attributes_config = 1;
13195
+ */
13196
+ resourceAttributesConfig?: ResourceAttributesConfig;
13197
+ };
13198
+ /**
13199
+ * Describes the message tailor.v1.GetResourceAttributesConfigResponse.
13200
+ * Use `create(GetResourceAttributesConfigResponseSchema)` to create a new message.
13201
+ */
13202
+ declare const GetResourceAttributesConfigResponseSchema: GenMessage<GetResourceAttributesConfigResponse>;
13203
+ /**
13204
+ * @generated from message tailor.v1.UpdateResourceAttributesConfigRequest
13205
+ */
13206
+ declare type UpdateResourceAttributesConfigRequest = Message<"tailor.v1.UpdateResourceAttributesConfigRequest"> & {
13207
+ /**
13208
+ * @generated from field: string workspace_id = 1;
13209
+ */
13210
+ workspaceId: string;
13211
+ /**
13212
+ * @generated from field: tailor.v1.ResourceAttributesConfig resource_attributes_config = 2;
13213
+ */
13214
+ resourceAttributesConfig?: ResourceAttributesConfig;
13215
+ };
13216
+ /**
13217
+ * Describes the message tailor.v1.UpdateResourceAttributesConfigRequest.
13218
+ * Use `create(UpdateResourceAttributesConfigRequestSchema)` to create a new message.
13219
+ */
13220
+ declare const UpdateResourceAttributesConfigRequestSchema: GenMessage<UpdateResourceAttributesConfigRequest>;
13221
+ /**
13222
+ * @generated from message tailor.v1.UpdateResourceAttributesConfigResponse
13223
+ */
13224
+ declare type UpdateResourceAttributesConfigResponse = Message<"tailor.v1.UpdateResourceAttributesConfigResponse"> & {
13225
+ /**
13226
+ * @generated from field: tailor.v1.ResourceAttributesConfig resource_attributes_config = 1;
13227
+ */
13228
+ resourceAttributesConfig?: ResourceAttributesConfig;
13229
+ };
13230
+ /**
13231
+ * Describes the message tailor.v1.UpdateResourceAttributesConfigResponse.
13232
+ * Use `create(UpdateResourceAttributesConfigResponseSchema)` to create a new message.
13233
+ */
13234
+ declare const UpdateResourceAttributesConfigResponseSchema: GenMessage<UpdateResourceAttributesConfigResponse>;
13235
+ /**
13236
+ * @generated from message tailor.v1.DeleteResourceAttributesConfigRequest
13237
+ */
13238
+ declare type DeleteResourceAttributesConfigRequest = Message<"tailor.v1.DeleteResourceAttributesConfigRequest"> & {
13239
+ /**
13240
+ * @generated from field: string workspace_id = 1;
13241
+ */
13242
+ workspaceId: string;
13243
+ };
13244
+ /**
13245
+ * Describes the message tailor.v1.DeleteResourceAttributesConfigRequest.
13246
+ * Use `create(DeleteResourceAttributesConfigRequestSchema)` to create a new message.
13247
+ */
13248
+ declare const DeleteResourceAttributesConfigRequestSchema: GenMessage<DeleteResourceAttributesConfigRequest>;
13249
+ /**
13250
+ * @generated from message tailor.v1.DeleteResourceAttributesConfigResponse
13251
+ */
13252
+ declare type DeleteResourceAttributesConfigResponse = Message<"tailor.v1.DeleteResourceAttributesConfigResponse"> & {};
13253
+ /**
13254
+ * Describes the message tailor.v1.DeleteResourceAttributesConfigResponse.
13255
+ * Use `create(DeleteResourceAttributesConfigResponseSchema)` to create a new message.
13256
+ */
13257
+ declare const DeleteResourceAttributesConfigResponseSchema: GenMessage<DeleteResourceAttributesConfigResponse>;
13027
13258
  //#endregion
13028
13259
  //#region ../tailor-proto/src/tailor/v1/service_pb.d.ts
13029
13260
  /**
@@ -16127,6 +16358,74 @@ declare const OperatorService: GenService<{
16127
16358
  input: typeof TestTelemetryExportRequestSchema;
16128
16359
  output: typeof TestTelemetryExportResponseSchema;
16129
16360
  };
16361
+ /**
16362
+ * CreateResourceAttributesConfig creates the workspace-level resource
16363
+ * attributes enrichment configuration (singleton per workspace).
16364
+ *
16365
+ * [Errors]
16366
+ * - Unauthenticated: token is missing, expired, or invalid
16367
+ * - InvalidArgument: request is invalid
16368
+ * - PermissionDenied: can view workspace but no permission to create
16369
+ * - AlreadyExists: config already exists for this workspace
16370
+ *
16371
+ * @generated from rpc tailor.v1.OperatorService.CreateResourceAttributesConfig
16372
+ */
16373
+ createResourceAttributesConfig: {
16374
+ methodKind: "unary";
16375
+ input: typeof CreateResourceAttributesConfigRequestSchema;
16376
+ output: typeof CreateResourceAttributesConfigResponseSchema;
16377
+ };
16378
+ /**
16379
+ * GetResourceAttributesConfig returns the workspace-level resource
16380
+ * attributes enrichment configuration.
16381
+ *
16382
+ * [Errors]
16383
+ * - Unauthenticated: token is missing, expired, or invalid
16384
+ * - InvalidArgument: request is invalid
16385
+ * - PermissionDenied: can view workspace but no permission to read
16386
+ * - NotFound: config does not exist for this workspace
16387
+ *
16388
+ * @generated from rpc tailor.v1.OperatorService.GetResourceAttributesConfig
16389
+ */
16390
+ getResourceAttributesConfig: {
16391
+ methodKind: "unary";
16392
+ input: typeof GetResourceAttributesConfigRequestSchema;
16393
+ output: typeof GetResourceAttributesConfigResponseSchema;
16394
+ };
16395
+ /**
16396
+ * UpdateResourceAttributesConfig updates the workspace-level resource
16397
+ * attributes enrichment configuration.
16398
+ *
16399
+ * [Errors]
16400
+ * - Unauthenticated: token is missing, expired, or invalid
16401
+ * - InvalidArgument: request is invalid
16402
+ * - PermissionDenied: can view workspace but no permission to update
16403
+ * - NotFound: config does not exist for this workspace
16404
+ *
16405
+ * @generated from rpc tailor.v1.OperatorService.UpdateResourceAttributesConfig
16406
+ */
16407
+ updateResourceAttributesConfig: {
16408
+ methodKind: "unary";
16409
+ input: typeof UpdateResourceAttributesConfigRequestSchema;
16410
+ output: typeof UpdateResourceAttributesConfigResponseSchema;
16411
+ };
16412
+ /**
16413
+ * DeleteResourceAttributesConfig deletes the workspace-level resource
16414
+ * attributes enrichment configuration.
16415
+ *
16416
+ * [Errors]
16417
+ * - Unauthenticated: token is missing, expired, or invalid
16418
+ * - InvalidArgument: request is invalid
16419
+ * - PermissionDenied: can view workspace but no permission to delete
16420
+ * - NotFound: config does not exist for this workspace
16421
+ *
16422
+ * @generated from rpc tailor.v1.OperatorService.DeleteResourceAttributesConfig
16423
+ */
16424
+ deleteResourceAttributesConfig: {
16425
+ methodKind: "unary";
16426
+ input: typeof DeleteResourceAttributesConfigRequestSchema;
16427
+ output: typeof DeleteResourceAttributesConfigResponseSchema;
16428
+ };
16130
16429
  }>;
16131
16430
  //#endregion
16132
16431
  //#region src/cli/shared/client.d.ts
@@ -17227,6 +17526,26 @@ declare function initOperatorClient(accessToken: string): Promise<Client<_$_bufb
17227
17526
  input: typeof TestTelemetryExportRequestSchema;
17228
17527
  output: typeof TestTelemetryExportResponseSchema;
17229
17528
  };
17529
+ createResourceAttributesConfig: {
17530
+ methodKind: "unary";
17531
+ input: typeof CreateResourceAttributesConfigRequestSchema;
17532
+ output: typeof CreateResourceAttributesConfigResponseSchema;
17533
+ };
17534
+ getResourceAttributesConfig: {
17535
+ methodKind: "unary";
17536
+ input: typeof GetResourceAttributesConfigRequestSchema;
17537
+ output: typeof GetResourceAttributesConfigResponseSchema;
17538
+ };
17539
+ updateResourceAttributesConfig: {
17540
+ methodKind: "unary";
17541
+ input: typeof UpdateResourceAttributesConfigRequestSchema;
17542
+ output: typeof UpdateResourceAttributesConfigResponseSchema;
17543
+ };
17544
+ deleteResourceAttributesConfig: {
17545
+ methodKind: "unary";
17546
+ input: typeof DeleteResourceAttributesConfigRequestSchema;
17547
+ output: typeof DeleteResourceAttributesConfigResponseSchema;
17548
+ };
17230
17549
  }>>>;
17231
17550
  //#endregion
17232
17551
  //#region src/cli/shared/config-loader.d.ts
@@ -17524,12 +17843,23 @@ type CreateWorkspaceOptions = z.input<typeof createWorkspaceOptionsSchema>;
17524
17843
  */
17525
17844
  declare function createWorkspace(options: CreateWorkspaceOptions): Promise<WorkspaceInfo>;
17526
17845
  //#endregion
17846
+ //#region src/cli/shared/args.d.ts
17847
+ /**
17848
+ * Schema for sort order (`asc` or `desc`).
17849
+ */
17850
+ declare const orderArg: z.ZodEnum<{
17851
+ asc: "asc";
17852
+ desc: "desc";
17853
+ }>;
17854
+ type Order = z.infer<typeof orderArg>;
17855
+ //#endregion
17527
17856
  //#region src/cli/commands/workspace/list.d.ts
17528
17857
  interface ListWorkspacesOptions {
17858
+ order?: Order;
17529
17859
  limit?: number;
17530
17860
  }
17531
17861
  /**
17532
- * List workspaces with an optional limit.
17862
+ * List workspaces with an optional order and limit.
17533
17863
  * @param options - Workspace listing options
17534
17864
  * @returns List of workspaces
17535
17865
  */
@@ -17583,11 +17913,15 @@ interface UserInfo {
17583
17913
  declare const listUsersOptionsSchema: z.ZodObject<{
17584
17914
  workspaceId: z.ZodOptional<z.ZodUUID>;
17585
17915
  profile: z.ZodOptional<z.ZodString>;
17916
+ order: z.ZodOptional<z.ZodEnum<{
17917
+ asc: "asc";
17918
+ desc: "desc";
17919
+ }>>;
17586
17920
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
17587
17921
  }, z.core.$strip>;
17588
17922
  type ListUsersOptions = z.input<typeof listUsersOptionsSchema>;
17589
17923
  /**
17590
- * List users in a workspace with an optional limit.
17924
+ * List users in a workspace with an optional order and limit.
17591
17925
  * @param options - User listing options
17592
17926
  * @returns List of workspace users
17593
17927
  */
@@ -17666,11 +18000,15 @@ interface AppHealthInfo {
17666
18000
  declare const listAppsOptionsSchema: z.ZodObject<{
17667
18001
  workspaceId: z.ZodOptional<z.ZodUUID>;
17668
18002
  profile: z.ZodOptional<z.ZodString>;
18003
+ order: z.ZodOptional<z.ZodEnum<{
18004
+ asc: "asc";
18005
+ desc: "desc";
18006
+ }>>;
17669
18007
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
17670
18008
  }, z.core.$strip>;
17671
18009
  type ListAppsOptions = z.input<typeof listAppsOptionsSchema>;
17672
18010
  /**
17673
- * List applications in a workspace with an optional limit.
18011
+ * List applications in a workspace with an optional order and limit.
17674
18012
  * @param options - Application listing options
17675
18013
  * @returns List of applications
17676
18014
  */
@@ -17732,16 +18070,6 @@ type ListFunctionRegistriesOptions = z.input<typeof listFunctionRegistriesOption
17732
18070
  */
17733
18071
  declare function listFunctionRegistries(options: ListFunctionRegistriesOptions): Promise<FunctionRegistryInfo[]>;
17734
18072
  //#endregion
17735
- //#region src/cli/shared/args.d.ts
17736
- /**
17737
- * Schema for sort order (`asc` or `desc`).
17738
- */
17739
- declare const orderArg: z.ZodEnum<{
17740
- asc: "asc";
17741
- desc: "desc";
17742
- }>;
17743
- type Order = z.infer<typeof orderArg>;
17744
- //#endregion
17745
18073
  //#region src/cli/commands/machineuser/list.d.ts
17746
18074
  interface ListMachineUsersOptions {
17747
18075
  workspaceId?: string;
@@ -18263,6 +18591,8 @@ interface WebhookExecutorInfo {
18263
18591
  interface ListWebhookExecutorsOptions {
18264
18592
  workspaceId?: string;
18265
18593
  profile?: string;
18594
+ order?: Order;
18595
+ limit?: number;
18266
18596
  }
18267
18597
  /**
18268
18598
  * List executors with incoming webhook triggers and return CLI-friendly info.
@@ -18359,6 +18689,10 @@ declare function organizationTree(options?: OrganizationTreeOptions): Promise<Or
18359
18689
  declare const listFoldersOptionsSchema: z.ZodObject<{
18360
18690
  organizationId: z.ZodUUID;
18361
18691
  parentFolderId: z.ZodOptional<z.ZodString>;
18692
+ order: z.ZodOptional<z.ZodEnum<{
18693
+ asc: "asc";
18694
+ desc: "desc";
18695
+ }>>;
18362
18696
  limit: z.ZodOptional<z.ZodNumber>;
18363
18697
  }, z.core.$strip>;
18364
18698
  type ListFoldersOptions = z.input<typeof listFoldersOptionsSchema>;
@@ -18453,7 +18787,7 @@ declare function loadWorkspaceId(opts?: LoadWorkspaceIdOptions): Promise<string>
18453
18787
  */
18454
18788
  declare function loadAccessToken(opts?: LoadAccessTokenOptions): Promise<string>;
18455
18789
  //#endregion
18456
- //#region src/cli/commands/api.d.ts
18790
+ //#region src/cli/commands/api/api-call.d.ts
18457
18791
  interface ApiCallOptions {
18458
18792
  profile?: string;
18459
18793
  endpoint: string;
package/dist/cli/lib.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
 
2
- import { d as initOperatorClient } from "../client-CcV6Jjds.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, ht as getFunctionRegistry, it as listOAuth2Clients, jt as getWorkflowExecution, k as listWorkflows, kt as getWorkflow, l as listUsers, ln as getNamespacesWithMigrations, mn as apiCall, 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-Bn68JXnL.mjs";
4
- import { C as loadWorkspaceId, S as loadAccessToken, _ as getDistDir, y as loadConfig } from "../application-DQpD_kHR.mjs";
5
- import { n as enumConstantsPlugin } from "../enum-constants-Dx82rSjf.mjs";
6
- import { n as fileUtilsPlugin } from "../file-utils-DeWpvq3T.mjs";
7
- import { n as kyselyTypePlugin } from "../kysely-type-CwtvQuxh.mjs";
8
- import { n as seedPlugin } from "../seed-CyYPhvNL.mjs";
2
+ import { d as initOperatorClient } from "../client-DcuQRqSd.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-DQqulWPm.mjs";
4
+ import { C as loadWorkspaceId, S as loadAccessToken, _ as getDistDir, y as loadConfig } from "../application-vJxYH5LE.mjs";
5
+ import { n as enumConstantsPlugin } from "../enum-constants-C3KSpsYj.mjs";
6
+ import { n as fileUtilsPlugin } from "../file-utils-775qWKoo.mjs";
7
+ import { n as kyselyTypePlugin } from "../kysely-type-BQsYEZoY.mjs";
8
+ import { n as seedPlugin } from "../seed-BkVKgsxf.mjs";
9
9
  import * as fs from "node:fs";
10
10
  import * as path from "pathe";
11
- import { resolveTSConfig } from "pkg-types";
12
11
  import ml from "multiline-ts";
12
+ import { resolveTSConfig } from "pkg-types";
13
13
  import * as rolldown from "rolldown";
14
14
 
15
15
  //#region src/cli/shared/seed-chunker.ts
@@ -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 ml from \"multiline-ts\";\nimport * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { getDistDir } from \"@/cli/shared/dist-dir\";\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":";;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA2B,MAAM,OAAO;;AAGrD,MAAM,oBAAoB;;;;;;;;;;;;;;;AAgB1B,SAAgB,cAAc,SAA4C;CACxE,MAAM,EAAE,MAAM,OAAO,cAAc,iBAAiB,6BAA6B;CAEjF,MAAM,YAAY,iBAAiB,eAAe;AAClD,KAAI,aAAa,EACf,OAAM,IAAI,MACR,cAAc,aAAa,0CAA0C,eAAe,uCAErF;CAIH,MAAM,gBAAgB,MAAM,QAAQ,SAAS,KAAK,SAAS,KAAK,MAAM,SAAS,EAAE;AAEjF,KAAI,cAAc,WAAW,EAC3B,QAAO,EAAE;AAKX,KAAI,SADY,KAAK,UAAU;EAAE;EAAM;EAAO,CAAC,CAC1B,IAAI,UACvB,QAAO,CAAC;EAAE;EAAM;EAAO,OAAO;EAAG,OAAO;EAAG,CAAC;CAI9C,MAAM,SAAqC,EAAE;CAC7C,IAAI,cAAwB,EAAE;CAC9B,IAAI,eAAyB,EAAE;AAE/B,MAAK,MAAM,QAAQ,eAAe;EAChC,MAAM,cAAc,KAAK;AAGzB,MAAI,aAAa,SAAS,GAAG;GAC3B,MAAM,WAAW;IAAE,GAAG;KAAc,OAAO;IAAa;GACxD,MAAM,YAAY,C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P,UAAU,YACX;IACF;GACD,UAAU,CAAC,WAAW;GACtB,SAAS,EACP,gBAAgB,CAAC,QAAQ,SAAS,EACnC;GACD;GACA,WAAW;IACT,mBAAmB;IACnB,aAAa;IACb,0BAA0B;IAC3B;GACD,UAAU;GACX,CAA0B,EAEA,OAAO,GAAG;EAKnC,eAAe;EAChB;;;;;AC9JH,IAAI,CAAC,2BAA2B,EAAE;CAChC,MAAM,EAAE,aAAa,MAAM,OAAO;AAClC,UAAS,OAAO,OAAO,KAAK,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC"}
1
+ {"version":3,"file":"lib.mjs","names":[],"sources":["../../src/cli/shared/seed-chunker.ts","../../src/cli/commands/generate/seed/bundler.ts","../../src/cli/lib.ts"],"sourcesContent":["/**\n * Seed data chunker for splitting large seed data into manageable message sizes.\n *\n * When seed data exceeds the gRPC message size limit, this module splits the data\n * into multiple chunks at type boundaries (or record boundaries for large types).\n */\n\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 ml from \"multiline-ts\";\nimport * as path from \"pathe\";\nimport { resolveTSConfig } from \"pkg-types\";\nimport * as rolldown from \"rolldown\";\nimport { getDistDir } from \"@/cli/shared/dist-dir\";\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":";;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA2B,MAAM,OAAO;;AAGrD,MAAM,oBAAoB;;;;;;;;;;;;;;;AAgB1B,SAAgB,cAAc,SAA4C;CACxE,MAAM,EAAE,MAAM,OAAO,cAAc,iBAAiB,6BAA6B;CAEjF,MAAM,YAAY,iBAAiB,eAAe;AAClD,KAAI,aAAa,EACf,OAAM,IA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