@tailor-platform/sdk 1.74.1 → 1.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/application-BJKNlv8c.mjs +3 -0
  3. package/dist/{application-BsH6tkZC.mjs → application-DYshsH-K.mjs} +20 -8
  4. package/dist/application-DYshsH-K.mjs.map +1 -0
  5. package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
  6. package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +1 -0
  7. package/dist/cli/index.mjs +4 -4
  8. package/dist/cli/lib.mjs +2 -2
  9. package/dist/completion/zsh-worker.zsh +9 -9
  10. package/dist/configure/config/types.d.mts +3 -1
  11. package/dist/configure/index.d.mts +3 -1
  12. package/dist/configure/index.mjs +111 -3
  13. package/dist/configure/index.mjs.map +1 -1
  14. package/dist/configure/services/index.d.mts +3 -1
  15. package/dist/configure/services/workflow/execution-policy.d.mts +71 -0
  16. package/dist/configure/services/workflow/execution-policy.types.d.mts +104 -0
  17. package/dist/configure/services/workflow/index.d.mts +3 -1
  18. package/dist/configure/services/workflow/job.d.mts +7 -3
  19. package/dist/{globals-B8XX5TRB.mjs → globals-CcU1ONiK.mjs} +2 -2
  20. package/dist/globals-CcU1ONiK.mjs.map +1 -0
  21. package/dist/{job-CtU73PGa.mjs → job-D-PbD1P3.mjs} +5 -3
  22. package/dist/job-D-PbD1P3.mjs.map +1 -0
  23. package/dist/{registry-BozuxbPp.mjs → registry-NfSW0BRo.mjs} +4 -3
  24. package/dist/registry-NfSW0BRo.mjs.map +1 -0
  25. package/dist/runtime/globals.d.mts +1 -1
  26. package/dist/runtime/index.d.mts +1 -1
  27. package/dist/runtime/workflow.d.mts +22 -3
  28. package/dist/{runtime-DV1EnfMs.mjs → runtime-CJ5usBOu.mjs} +230 -6
  29. package/dist/runtime-CJ5usBOu.mjs.map +1 -0
  30. package/dist/{service_pb-CIrhGwHk.mjs → service_pb-4unFyubn.mjs} +16 -6
  31. package/dist/{service_pb-CIrhGwHk.mjs.map → service_pb-4unFyubn.mjs.map} +1 -1
  32. package/dist/{service_pb-DjwIn4jO.mjs → service_pb-D-PXRoMg.mjs} +1 -1
  33. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +1 -1
  34. package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +29 -9
  35. package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -1
  36. package/dist/utils/test/index.mjs +1 -1
  37. package/dist/utils/test/index.mjs.map +1 -1
  38. package/dist/vitest/environment.mjs +1 -1
  39. package/dist/vitest/index.mjs +15 -12
  40. package/dist/vitest/index.mjs.map +1 -1
  41. package/dist/vitest/mocks/workflow.d.mts +5 -3
  42. package/dist/vitest/setup.mjs +1 -1
  43. package/dist/workflow-DSwnYPPP.mjs.map +1 -1
  44. package/docs/configuration.md +24 -0
  45. package/docs/services/workflow.md +78 -0
  46. package/package.json +1 -1
  47. package/dist/application-BsH6tkZC.mjs.map +0 -1
  48. package/dist/application-CSUhZMb5.mjs +0 -3
  49. package/dist/globals-B8XX5TRB.mjs.map +0 -1
  50. package/dist/job-CtU73PGa.mjs.map +0 -1
  51. package/dist/registry-BozuxbPp.mjs.map +0 -1
  52. package/dist/runtime-DV1EnfMs.mjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { t as db } from "./schema-Dl_y0m9e.mjs";
2
- import { $ as CreateUserProfileConfigRequestSchema, A as UpdatePipelineServiceRequestSchema, At as Condition_Operator, B as UpdateExecutorExecutorRequestSchema, Ct as UserProfileProviderConfig_UserProfileProviderType, D as CreatePipelineResolverRequestSchema, Dt as ApplicationSchemaUpdateAttemptStatus, E as UpdateSecretManagerSecretRequestSchema, Et as UpdateApplicationRequestSchema, F as IdPPermissionOperator, G as CreateAuthHookRequestSchema, H as ExecutorTargetType, I as IdPPermissionPermit, J as CreateAuthOAuth2ClientRequestSchema, K as CreateAuthIDPConfigRequestSchema, L as FunctionExecution_Status, M as CreateIdPServiceRequestSchema, Mt as PageDirection, N as UpdateIdPServiceRequestSchema, O as CreatePipelineServiceRequestSchema, Ot as Subgraph_ServiceType, P as IdPLang, Q as CreateTenantConfigRequestSchema, S as UpdateStaticWebsiteRequestSchema, St as TenantProviderConfig_TenantProviderType, T as CreateSecretManagerVaultRequestSchema, Tt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, U as ExecutorTriggerType, V as ExecutorJobStatus, W as CreateAuthConnectionRequestSchema, X as CreateAuthSCIMResourceRequestSchema, Y as CreateAuthSCIMConfigRequestSchema, Z as CreateAuthServiceRequestSchema, _ as TailorDBType_Permission_Operator, _t as AuthSCIMAttribute_Mutability, a as WorkspacePlatformUserRole, at as UpdateAuthSCIMConfigRequestSchema, b as AddCustomDomainRequestSchema, bt as AuthSCIMConfig_AuthorizationType, c as UpdateWorkflowRequestSchema, ct as UpdateTenantConfigRequestSchema, d as CreateTailorDBServiceRequestSchema, dt as AuthConnection_Type, et as UpdateAuthConnectionRequestSchema, f as CreateTailorDBTypeRequestSchema, ft as AuthHookPoint, g as TailorDBGQLPermission_Permit, gt as AuthOAuth2Client_GrantType, h as TailorDBGQLPermission_Operator, ht as AuthOAuth2Client_ClientType, it as UpdateAuthOAuth2ClientRequestSchema, j as PipelineResolver_OperationType, jt as FilterSchema, k as UpdatePipelineResolverRequestSchema, kt as ConditionSchema, l as WorkflowExecution_Status, lt as UpdateUserProfileConfigRequestSchema, m as TailorDBGQLPermission_Action, mt as AuthInvokerSchema, nt as UpdateAuthIDPConfigRequestSchema, o as CreateWorkflowJobFunctionRequestSchema, ot as UpdateAuthSCIMResourceRequestSchema, p as UpdateTailorDBTypeRequestSchema, pt as AuthIDPConfig_AuthType, q as CreateAuthMachineUserRequestSchema, rt as UpdateAuthMachineUserRequestSchema, s as CreateWorkflowRequestSchema, st as UpdateAuthServiceRequestSchema, t as OperatorService, tt as UpdateAuthHookRequestSchema, u as WorkflowJobExecution_Status, ut as AuthConnection_Status, v as TailorDBType_Permission_Permit, vt as AuthSCIMAttribute_Type, w as CreateSecretManagerSecretRequestSchema, wt as CreateApplicationRequestSchema, x as CreateStaticWebsiteRequestSchema, y as TailorDBType_PermitAction, yt as AuthSCIMAttribute_Uniqueness, z as CreateExecutorExecutorRequestSchema } from "./service_pb-CIrhGwHk.mjs";
2
+ import { $ as CreateAuthServiceRequestSchema, A as CreatePipelineServiceRequestSchema, At as Subgraph_ServiceType, C as CreateStaticWebsiteRequestSchema, D as CreateSecretManagerVaultRequestSchema, Dt as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, E as CreateSecretManagerSecretRequestSchema, Et as CreateApplicationRequestSchema, F as UpdateIdPServiceRequestSchema, G as ExecutorTriggerType, H as UpdateExecutorExecutorRequestSchema, I as IdPLang, J as CreateAuthIDPConfigRequestSchema, K as CreateAuthConnectionRequestSchema, L as IdPPermissionOperator, M as UpdatePipelineServiceRequestSchema, Mt as Condition_Operator, N as PipelineResolver_OperationType, Nt as FilterSchema, O as UpdateSecretManagerSecretRequestSchema, Ot as UpdateApplicationRequestSchema, P as CreateIdPServiceRequestSchema, Pt as PageDirection, Q as CreateAuthSCIMResourceRequestSchema, R as IdPPermissionPermit, S as AddCustomDomainRequestSchema, St as AuthSCIMConfig_AuthorizationType, Tt as UserProfileProviderConfig_UserProfileProviderType, U as ExecutorJobStatus, V as CreateExecutorExecutorRequestSchema, W as ExecutorTargetType, X as CreateAuthOAuth2ClientRequestSchema, Y as CreateAuthMachineUserRequestSchema, Z as CreateAuthSCIMConfigRequestSchema, _ as TailorDBGQLPermission_Operator, _t as AuthOAuth2Client_ClientType, a as WorkspacePlatformUserRole, at as UpdateAuthMachineUserRequestSchema, b as TailorDBType_Permission_Permit, bt as AuthSCIMAttribute_Type, c as CreateWorkflowRequestSchema, ct as UpdateAuthSCIMResourceRequestSchema, d as WorkflowExecution_Status, dt as UpdateUserProfileConfigRequestSchema, et as CreateTenantConfigRequestSchema, f as WorkflowJobExecution_Status, ft as AuthConnection_Status, g as TailorDBGQLPermission_Action, gt as AuthInvokerSchema, h as UpdateTailorDBTypeRequestSchema, ht as AuthIDPConfig_AuthType, it as UpdateAuthIDPConfigRequestSchema, j as UpdatePipelineResolverRequestSchema, jt as ConditionSchema, k as CreatePipelineResolverRequestSchema, kt as ApplicationSchemaUpdateAttemptStatus, l as UpdateWorkflowJobFunctionExecutionPolicyRequestSchema, lt as UpdateAuthServiceRequestSchema, m as CreateTailorDBTypeRequestSchema, mt as AuthHookPoint, nt as UpdateAuthConnectionRequestSchema, o as CreateWorkflowJobFunctionExecutionPolicyRequestSchema, ot as UpdateAuthOAuth2ClientRequestSchema, p as CreateTailorDBServiceRequestSchema, pt as AuthConnection_Type, q as CreateAuthHookRequestSchema, rt as UpdateAuthHookRequestSchema, s as CreateWorkflowJobFunctionRequestSchema, st as UpdateAuthSCIMConfigRequestSchema, t as OperatorService, tt as CreateUserProfileConfigRequestSchema, u as UpdateWorkflowRequestSchema, ut as UpdateTenantConfigRequestSchema, v as TailorDBGQLPermission_Permit, vt as AuthOAuth2Client_GrantType, w as UpdateStaticWebsiteRequestSchema, wt as TenantProviderConfig_TenantProviderType, x as TailorDBType_PermitAction, xt as AuthSCIMAttribute_Uniqueness, y as TailorDBType_Permission_Operator, yt as AuthSCIMAttribute_Mutability, z as FunctionExecution_Status } from "./service_pb-4unFyubn.mjs";
3
3
  import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
4
4
  import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-BEiZZ3qT.mjs";
5
- import { $ as getOrNull, A as hasUserTokenEntry, C as getDistDir, E as loadConfig, F as loadPlatformClientConfig, G as fetchAll, H as writePlatformConfig, J as fetchPaged, K as fetchAllTolerant, L as loadWorkspaceId, M as loadConfigPath, P as loadMachineUserName, Q as getOAuth2ClientId, R as platformConfigFromProfile, S as createBundleCache, T as hashFile, Z as getConsoleBaseUrl, at as byName, b as getPluginGenerationDependencies, c as HTTP_METHODS, d as buildResolverOperationHookExpr, et as getPlatformBaseUrl, f as assertUniqueLocalTailorDBTypeNames, g as platformBundleDefinePlugin, h as stringifyFunction, i as resolverBundleKey, it as resolveStaticWebsiteUrls, j as loadAccessToken, m as TailorDBTypeSchema, n as generatePluginFilesIfNeeded, nt as initOperatorClient, p as assertUniqueTailorDBTypeNamesWithExternal, q as fetchMachineUserToken, r as loadApplication, rt as isDefaultPlatform, t as defineApplication, u as buildExecutorArgsExpr, w as hashContent, x as hasGenerationHooks, z as readPlatformConfig } from "./application-BsH6tkZC.mjs";
5
+ import { $ as getOAuth2ClientId, B as readPlatformConfig, C as createBundleCache, D as loadConfig, E as hashFile, F as loadMachineUserName, I as loadPlatformClientConfig, J as fetchMachineUserToken, K as fetchAll, M as loadAccessToken, N as loadConfigPath, Q as getConsoleBaseUrl, R as loadWorkspaceId, S as hasGenerationHooks, T as hashContent, U as writePlatformConfig, Y as fetchPaged, _ as platformBundleDefinePlugin, at as resolveStaticWebsiteUrls, d as buildExecutorArgsExpr, et as getOrNull, f as buildResolverOperationHookExpr, g as stringifyFunction, h as TailorDBTypeSchema, i as resolverBundleKey, it as isDefaultPlatform, j as hasUserTokenEntry, l as HTTP_METHODS, m as assertUniqueTailorDBTypeNamesWithExternal, n as generatePluginFilesIfNeeded, o as WorkflowJobFunctionExecutionPolicySchema, ot as byName, p as assertUniqueLocalTailorDBTypeNames, q as fetchAllTolerant, r as loadApplication, rt as initOperatorClient, t as defineApplication, tt as getPlatformBaseUrl, w as getDistDir, x as getPluginGenerationDependencies, z as platformConfigFromProfile } from "./application-DYshsH-K.mjs";
6
6
  import { o as loadFilesWithIgnores, t as createExecutorService } from "./service-BCRJ-3NV.mjs";
7
7
  import { t as multiline } from "./multiline-sfHpTZZK.mjs";
8
8
  import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
@@ -10813,6 +10813,198 @@ function normalizeRetryPolicyForCompare(policy) {
10813
10813
  };
10814
10814
  }
10815
10815
 
10816
+ //#endregion
10817
+ //#region src/cli/commands/deploy/workflow-execution-policy.ts
10818
+ function toConcurrencyPolicyInit(policy) {
10819
+ if (!policy) return void 0;
10820
+ return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
10821
+ }
10822
+ function normalizeComparableConcurrency(policy) {
10823
+ if (!policy || !policy.maxConcurrentExecutions) return void 0;
10824
+ return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
10825
+ }
10826
+ /**
10827
+ * The declared key prefix, regardless of variant. `ExecutionPolicyWildcardInstance`
10828
+ * omits `key` from its public type to force callers through `keyFor()`, but
10829
+ * the underlying value always carries it when produced by
10830
+ * `defineWorkflowExecutionPolicy()` or `defineWorkflowExecutionPolicies()`.
10831
+ * @param policy - Declared policy from the config
10832
+ * @returns The declared key prefix
10833
+ */
10834
+ function declaredKey(policy) {
10835
+ if (policy.matchType === "exact") return policy.key;
10836
+ const key = policy.key;
10837
+ if (typeof key !== "string") throw new Error(`Invalid workflow execution policy "${policy.name}": prefix policies must be created via defineWorkflowExecutionPolicy() or defineWorkflowExecutionPolicies(), not a hand-constructed object.`);
10838
+ return key;
10839
+ }
10840
+ /**
10841
+ * The literal key the platform registers for a declared policy: `key` with a
10842
+ * trailing `*` appended when `matchType` is `"prefix"`.
10843
+ * @param policy - Declared policy from the config
10844
+ * @returns The platform-facing execution policy key
10845
+ */
10846
+ function toPlatformExecutionPolicyKey(policy) {
10847
+ const key = declaredKey(policy);
10848
+ return policy.matchType === "prefix" ? `${key}*` : key;
10849
+ }
10850
+ /**
10851
+ * Validate a declared execution policy against the parser schema. Throws with
10852
+ * a descriptive error when `name` or the platform-facing key violates the
10853
+ * platform grammar.
10854
+ * @param policy - Declared policy from the config
10855
+ */
10856
+ function validatePolicy(policy) {
10857
+ if (declaredKey(policy).endsWith("*")) throw new Error(`Invalid workflow execution policy "${policy.name}": key must not end with '*'; omit the '*' and set matchType: "prefix" for wildcard policies (the SDK appends '*' automatically).`);
10858
+ const parsed = WorkflowJobFunctionExecutionPolicySchema.safeParse({
10859
+ name: policy.name,
10860
+ key: toPlatformExecutionPolicyKey(policy),
10861
+ concurrencyPolicy: policy.concurrencyPolicy
10862
+ });
10863
+ if (!parsed.success) throw new Error(`Invalid workflow execution policy "${policy.name}": ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
10864
+ }
10865
+ /**
10866
+ * Plan workflow job function execution policy changes based on desired
10867
+ * declarations and current remote state.
10868
+ * @param client - Operator client instance
10869
+ * @param workspaceId - Workspace ID
10870
+ * @param appName - Application name
10871
+ * @param appId - Application ID for ownership metadata
10872
+ * @param declared - Policies declared in the config (property name → instance)
10873
+ * @returns Planned execution policy changes
10874
+ */
10875
+ async function planWorkflowJobFunctionExecutionPolicy(client, workspaceId, appName, appId, declared) {
10876
+ const changeSet = createChangeSet("Workflow execution policies");
10877
+ const conflicts = [];
10878
+ const unmanaged = [];
10879
+ const resourceOwners = /* @__PURE__ */ new Set();
10880
+ const declaredList = Object.values(declared);
10881
+ for (const policy of declaredList) validatePolicy(policy);
10882
+ const existing = await fetchExistingResourcesWithLabels({
10883
+ client,
10884
+ fetchPage: async (pageToken, pageSize) => {
10885
+ const response = await client.listWorkflowJobFunctionExecutionPolicies({
10886
+ workspaceId,
10887
+ pageToken,
10888
+ pageSize
10889
+ });
10890
+ return [response.policies, response.nextPageToken];
10891
+ },
10892
+ getName: (resource) => resource.name,
10893
+ getTrn: (name) => resourceTrn(workspaceId, "workflow_job_function_execution_policy", name)
10894
+ });
10895
+ const seenNames = /* @__PURE__ */ new Set();
10896
+ for (const policy of declaredList) {
10897
+ if (seenNames.has(policy.name)) throw new Error(`Duplicate workflow execution policy name "${policy.name}". Each policy must have a unique name within the workspace.`);
10898
+ seenNames.add(policy.name);
10899
+ const metaRequest = await buildMetaRequest({
10900
+ trn: resourceTrn(workspaceId, "workflow_job_function_execution_policy", policy.name),
10901
+ appName,
10902
+ appId
10903
+ });
10904
+ const found = existing[policy.name];
10905
+ if (found) {
10906
+ const owned = trackDesiredResourceOwnership({
10907
+ labels: found.allLabels,
10908
+ ownerLabel: found.label,
10909
+ appName,
10910
+ appId,
10911
+ resourceType: "Workflow execution policy",
10912
+ resourceName: policy.name,
10913
+ conflicts,
10914
+ unmanaged
10915
+ });
10916
+ const remoteKey = found.resource.executionPolicyKey;
10917
+ const desiredKey = toPlatformExecutionPolicyKey(policy);
10918
+ const remoteConcurrency = normalizeComparableConcurrency(found.resource.concurrencyPolicy);
10919
+ const desiredConcurrency = normalizeComparableConcurrency(policy.concurrencyPolicy);
10920
+ if (owned && hasMatchingSdkVersion(found.allLabels, metaRequest.labels) && remoteKey === desiredKey && areNormalizedEqual(remoteConcurrency, desiredConcurrency)) changeSet.unchanged.push({ name: policy.name });
10921
+ else if (remoteKey !== desiredKey) changeSet.replaces.push({
10922
+ name: policy.name,
10923
+ workspaceId,
10924
+ policy,
10925
+ metaRequest
10926
+ });
10927
+ else changeSet.updates.push({
10928
+ name: policy.name,
10929
+ workspaceId,
10930
+ policy,
10931
+ metaRequest
10932
+ });
10933
+ delete existing[policy.name];
10934
+ } else changeSet.creates.push({
10935
+ name: policy.name,
10936
+ workspaceId,
10937
+ policy,
10938
+ metaRequest
10939
+ });
10940
+ }
10941
+ for (const [name, remaining] of Object.entries(existing)) {
10942
+ if (!remaining) continue;
10943
+ if (trackRemainingResourceOwner({
10944
+ labels: remaining.allLabels,
10945
+ ownerLabel: remaining.label,
10946
+ appName,
10947
+ appId,
10948
+ resourceOwners
10949
+ })) changeSet.deletes.push({
10950
+ name,
10951
+ workspaceId
10952
+ });
10953
+ }
10954
+ return {
10955
+ changeSet,
10956
+ conflicts,
10957
+ unmanaged,
10958
+ resourceOwners
10959
+ };
10960
+ }
10961
+ /**
10962
+ * Apply planned workflow execution policy changes for the given phase.
10963
+ * @param client - Operator client instance
10964
+ * @param plan - Result of `planWorkflowJobFunctionExecutionPolicy`
10965
+ * @param phase - Apply phase
10966
+ * @returns Promise that resolves when policies are applied
10967
+ */
10968
+ async function applyWorkflowJobFunctionExecutionPolicy(client, plan, phase = "create-update") {
10969
+ const { changeSet } = plan;
10970
+ if (phase === "create-update") await Promise.all([
10971
+ ...changeSet.replaces.map(async (replace) => {
10972
+ await client.deleteWorkflowJobFunctionExecutionPolicy({
10973
+ workspaceId: replace.workspaceId,
10974
+ executionPolicyName: replace.name
10975
+ });
10976
+ await client.createWorkflowJobFunctionExecutionPolicy({
10977
+ workspaceId: replace.workspaceId,
10978
+ executionPolicyName: replace.policy.name,
10979
+ executionPolicyKey: toPlatformExecutionPolicyKey(replace.policy),
10980
+ concurrencyPolicy: toConcurrencyPolicyInit(replace.policy.concurrencyPolicy)
10981
+ });
10982
+ await client.setMetadata(replace.metaRequest);
10983
+ }),
10984
+ ...changeSet.creates.map(async (create) => {
10985
+ await client.createWorkflowJobFunctionExecutionPolicy({
10986
+ workspaceId: create.workspaceId,
10987
+ executionPolicyName: create.policy.name,
10988
+ executionPolicyKey: toPlatformExecutionPolicyKey(create.policy),
10989
+ concurrencyPolicy: toConcurrencyPolicyInit(create.policy.concurrencyPolicy)
10990
+ });
10991
+ await client.setMetadata(create.metaRequest);
10992
+ }),
10993
+ ...changeSet.updates.map(async (update) => {
10994
+ await client.updateWorkflowJobFunctionExecutionPolicy({
10995
+ workspaceId: update.workspaceId,
10996
+ executionPolicyName: update.policy.name,
10997
+ concurrencyPolicy: toConcurrencyPolicyInit(update.policy.concurrencyPolicy)
10998
+ });
10999
+ await client.setMetadata(update.metaRequest);
11000
+ })
11001
+ ]);
11002
+ else await Promise.all(changeSet.deletes.map((del) => client.deleteWorkflowJobFunctionExecutionPolicy({
11003
+ workspaceId: del.workspaceId,
11004
+ executionPolicyName: del.name
11005
+ })));
11006
+ }
11007
+
10816
11008
  //#endregion
10817
11009
  //#region src/cli/commands/deploy/apply-phases.ts
10818
11010
  /**
@@ -10846,10 +11038,12 @@ async function applyDeploymentPlans(client, workspaceId, deployments) {
10846
11038
  });
10847
11039
  await withSpan("apply.createUpdateDependentServices", async () => {
10848
11040
  await forEachDeployment((d) => applyExecutor(client, d.executor, "create-update"));
11041
+ await forEachDeployment((d) => applyWorkflowJobFunctionExecutionPolicy(client, d.workflowExecutionPolicy, "create-update"));
10849
11042
  await forEachDeployment((d) => applyWorkflow(client, d.workflow, "create-update"));
10850
11043
  });
10851
11044
  await withSpan("apply.deleteDependentServices", async () => {
10852
11045
  await forEachDeployment((d) => applyWorkflow(client, d.workflow, "delete"));
11046
+ await forEachDeployment((d) => applyWorkflowJobFunctionExecutionPolicy(client, d.workflowExecutionPolicy, "delete"));
10853
11047
  await forEachDeployment((d) => applyExecutor(client, d.executor, "delete"));
10854
11048
  await forEachDeployment((d) => applyStaticWebsite(client, d.staticWebsite, "delete"));
10855
11049
  await forEachDeployment((d) => applyAIGateway(client, d.aiGateway, "delete"));
@@ -11174,7 +11368,7 @@ function validateItems(params) {
11174
11368
  * @param input - Plan results from the plan phase
11175
11369
  */
11176
11370
  async function validatePlan(input) {
11177
- const { tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = input;
11371
+ const { tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, workflowExecutionPolicy, secretManager } = input;
11178
11372
  const validator = createValidator();
11179
11373
  const violations = [];
11180
11374
  function creates(schema, kind, items) {
@@ -11317,6 +11511,23 @@ async function validatePlan(input) {
11317
11511
  }
11318
11512
  })));
11319
11513
  }
11514
+ creates(CreateWorkflowJobFunctionExecutionPolicyRequestSchema, "Workflow execution policy", [...workflowExecutionPolicy.changeSet.creates, ...workflowExecutionPolicy.changeSet.replaces].map((item) => ({
11515
+ name: item.name,
11516
+ request: {
11517
+ workspaceId: item.workspaceId,
11518
+ executionPolicyName: item.policy.name,
11519
+ executionPolicyKey: toPlatformExecutionPolicyKey(item.policy),
11520
+ ...item.policy.concurrencyPolicy && { concurrencyPolicy: { maxConcurrentExecutions: item.policy.concurrencyPolicy.maxConcurrentExecutions } }
11521
+ }
11522
+ })));
11523
+ updates(UpdateWorkflowJobFunctionExecutionPolicyRequestSchema, "Workflow execution policy", workflowExecutionPolicy.changeSet.updates.map((item) => ({
11524
+ name: item.name,
11525
+ request: {
11526
+ workspaceId: item.workspaceId,
11527
+ executionPolicyName: item.policy.name,
11528
+ ...item.policy.concurrencyPolicy && { concurrencyPolicy: { maxConcurrentExecutions: item.policy.concurrencyPolicy.maxConcurrentExecutions } }
11529
+ }
11530
+ })));
11320
11531
  creates(CreateSecretManagerVaultRequestSchema, "Secret Manager vault", secretManager.vaultChangeSet.creates.map((item) => ({
11321
11532
  name: item.name,
11322
11533
  request: vaultCreateRequest(item)
@@ -11549,6 +11760,7 @@ function buildPlanReport(results) {
11549
11760
  const executorEntries = formatExecutorChangeEntries(results.executor.changeSet, buildPlannedExecutorsByName(results.executor.changeSet), results.functionRegistry.executorFunctionChanges);
11550
11761
  const resolverEntries = formatResolverChangeEntries(results.pipeline.changeSet.resolver, results.functionRegistry.resolverFunctionChanges);
11551
11762
  const workflowEntries = formatWorkflowChangeEntries(results.workflow.changeSet, results.functionRegistry.workflowJobChanges);
11763
+ const workflowExecutionPolicyEntries = formatChangeSetEntries(results.workflowExecutionPolicy.changeSet, ["executionPolicy"]);
11552
11764
  const authHookEntries = formatAuthHookChangeEntries(results.auth.changeSet.authHook, results.functionRegistry.authHookFunctionChanges);
11553
11765
  const tailorDBEntries = [...formatTailorDBResourceChangeEntries(results.tailorDB.changeSet.type, results.tailorDB.changeSet.gqlPermission)];
11554
11766
  const pipelineEntries = [...resolverEntries];
@@ -11579,6 +11791,7 @@ function buildPlanReport(results) {
11579
11791
  ...pipelineEntries,
11580
11792
  ...executorEntries,
11581
11793
  ...workflowEntries,
11794
+ ...workflowExecutionPolicyEntries,
11582
11795
  ...idpEntries,
11583
11796
  ...authEntries
11584
11797
  ];
@@ -11951,7 +12164,7 @@ async function planDeploymentTarget(params) {
11951
12164
  };
11952
12165
  const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, application.id, functionEntries));
11953
12166
  const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
11954
- const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, secretManager] = await Promise.all([
12167
+ const [tailorDB, staticWebsite, aiGateway, idp, auth, pipeline, app, executor, workflow, workflowExecutionPolicy, secretManager] = await Promise.all([
11955
12168
  withSpan("plan.tailorDB", () => planTailorDB(ctx)),
11956
12169
  withSpan("plan.staticWebsite", () => planStaticWebsite(ctx)),
11957
12170
  withSpan("plan.aiGateway", () => planAIGateway(ctx)),
@@ -11961,6 +12174,7 @@ async function planDeploymentTarget(params) {
11961
12174
  withSpan("plan.application", () => planApplication(ctx, httpAdapterBuildResult)),
11962
12175
  withSpan("plan.executor", () => planExecutor(ctx)),
11963
12176
  withSpan("plan.workflow", () => planWorkflow(client, workspaceId, application.name, application.id, workflowService?.workflows ?? {}, workflowBuildResult?.mainJobDeps ?? {}, unchangedWorkflowJobs)),
12177
+ withSpan("plan.workflowExecutionPolicy", () => planWorkflowJobFunctionExecutionPolicy(client, workspaceId, application.name, application.id, config.workflow?.executionPolicies ?? {})),
11964
12178
  withSpan("plan.secretManager", () => planSecretManager(ctx))
11965
12179
  ]);
11966
12180
  return {
@@ -11975,6 +12189,7 @@ async function planDeploymentTarget(params) {
11975
12189
  app,
11976
12190
  executor,
11977
12191
  workflow,
12192
+ workflowExecutionPolicy,
11978
12193
  secretManager
11979
12194
  };
11980
12195
  });
@@ -12002,6 +12217,7 @@ function collectOwnerConflicts(results) {
12002
12217
  ...results.pipeline.conflicts,
12003
12218
  ...results.executor.conflicts,
12004
12219
  ...results.workflow.conflicts,
12220
+ ...results.workflowExecutionPolicy.conflicts,
12005
12221
  ...results.secretManager.conflicts
12006
12222
  ];
12007
12223
  }
@@ -12016,6 +12232,7 @@ function collectUnmanagedResources(results) {
12016
12232
  ...results.pipeline.unmanaged,
12017
12233
  ...results.executor.unmanaged,
12018
12234
  ...results.workflow.unmanaged,
12235
+ ...results.workflowExecutionPolicy.unmanaged,
12019
12236
  ...results.secretManager.unmanaged
12020
12237
  ];
12021
12238
  }
@@ -12030,6 +12247,7 @@ function collectResourceOwners(results) {
12030
12247
  ...results.pipeline.resourceOwners,
12031
12248
  ...results.executor.resourceOwners,
12032
12249
  ...results.workflow.resourceOwners,
12250
+ ...results.workflowExecutionPolicy.resourceOwners,
12033
12251
  ...results.secretManager.resourceOwners
12034
12252
  ]);
12035
12253
  }
@@ -12175,6 +12393,12 @@ const DEPLOY_MANAGED_RESOURCE_DEFINITIONS = [
12175
12393
  namesOf: (target) => Object.values(target.application.workflowService?.workflows ?? {}).map((workflow) => workflow.name),
12176
12394
  changeSetOf: (results) => results.workflow.changeSet
12177
12395
  },
12396
+ {
12397
+ resourceLabel: "Workflow execution policy",
12398
+ resourceType: "workflow_job_function_execution_policy",
12399
+ namesOf: (target) => Object.values(target.config.workflow?.executionPolicies ?? {}).map((policy) => policy.name),
12400
+ changeSetOf: (results) => results.workflowExecutionPolicy.changeSet
12401
+ },
12178
12402
  {
12179
12403
  resourceLabel: "Auth connection",
12180
12404
  resourceType: "auth.connection",
@@ -17297,7 +17521,7 @@ async function generate(options) {
17297
17521
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
17298
17522
  let pluginManager;
17299
17523
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
17300
- const { defineApplication } = await import("./application-CSUhZMb5.mjs");
17524
+ const { defineApplication } = await import("./application-BJKNlv8c.mjs");
17301
17525
  const application = defineApplication({
17302
17526
  config,
17303
17527
  pluginManager
@@ -19562,4 +19786,4 @@ function isDeno() {
19562
19786
 
19563
19787
  //#endregion
19564
19788
  export { getOrganization as $, compareSnapshotWithRemote as $t, listCommand$3 as A, apiCommand as An, getExecutorWaitFailureMessage as At, show as B, pagedLogArgs as Bn, listWorkflowExecutions as Bt, listCommand$2 as C, hasChanges as Cn, listWebhookExecutors as Ct, waitWorkflowExecution as D, PluginManager as Dn, listCommand$9 as Dt, waitCommand as E, sdkNameLabelKey as En, triggerExecutor as Et, generateCommand as F, configArg as Fn, startWorkflow as Ft, removeCommand$1 as G, deploy as Gt, extractOwnedNamespaces as H, toPageDirection as Hn, formatKeyValueTable as Ht, generateMigrationScript as I, confirmationArgs as In, getCommand$5 as It, organizationTree as J, waitForExecution as Jt, updateCommand$1 as K, ensureConfigId as Kt, writeDbTypesFile as L, deploymentArgs as Ln, getWorkflow as Lt, truncate as M, assertWritable as Mn, listExecutorJobs as Mt, truncateCommand as N, defineAppCommand as Nn, watchExecutorJob as Nt, resumeCommand as O, generateUserTypes as On, listExecutors as Ot, generate as P, commonArgs as Pn, startCommand as Pt, getCommand$1 as Q, parseMigrationLabelNumber as Qt, getConfiguredEditorCommand as R, isVerbose as Rn, executionsCommand as Rt, listApps as S, formatMigrationDiff as Sn, getFunctionRegistry as St, healthCommand as T, resourceTrn as Tn, triggerCommand as Tt, logBetaWarning as U, workspaceArgs as Un, getCommand$6 as Ut, showCommand as V, paginationArgs as Vn, functionExecutionStatusToString as Vt, remove as W, getExecutor as Wt, listCommand$4 as X, MIGRATION_LABEL_KEY as Xt, treeCommand as Y, bundleMigrationScript as Yt, listOrganizations as Z, handleOptionalToRequiredError as Zt, getWorkspace as _, loadDiff as _n, listMachineUsers as _t, updateUser as a, MIGRATE_FILE_NAME as an, getFolder as at, createCommand as b, parseMigrationNumberArg as bn, listFunctionRegistries as bt, listCommand as c, compareLocalTypesWithSnapshot as cn, createCommand$1 as ct, inviteUser as d, getLatestMigrationNumber as dn, listOAuth2Clients as dt, generateAllTypeManifestsFromSnapshot as en, updateCommand$2 as et, restoreCommand as f, getMigrationDirPath as fn, getCommand$3 as ft, getCommand as g, isValidMigrationNumber as gn, listCommand$7 as gt, listWorkspaces as h, getNextMigrationNumber as hn, tokenCommand as ht, updateCommand as i, INITIAL_SCHEMA_NUMBER as in, getCommand$2 as it, listWorkflows as j, apiCall as jn, jobsCommand as jt, resumeWorkflow as k, prompt as kn, getExecutorJob as kt, listUsers as l, compareSnapshots as ln, createFolder as lt, listCommand$1 as m, getMigrationFiles as mn, getMachineUserToken as mt, query as n, DB_TYPES_FILE_NAME as nn, listCommand$5 as nt, removeCommand as o, SCHEMA_FILE_NAME as on, deleteCommand$1 as ot, restoreWorkspace as p, getMigrationFilePath as pn, getOAuth2Client as pt, updateOrganization as q, executeScript as qt, queryCommand as r, DIFF_FILE_NAME as rn, listFolders as rt, removeUser as s, assertValidMigrationFiles as sn, deleteFolder as st, isNativeTypeScriptRuntime as t, protoGqlPermission as tn, updateFolder as tt, inviteCommand as u, createSnapshotFromLocalTypes as un, listCommand$6 as ut, deleteCommand as v, reconstructSnapshotFromMigrations as vn, generate$1 as vt, getAppHealth as w, getNamespacesWithMigrations as wn, webhookCommand as wt, createWorkspace as x, formatDiffSummary as xn, getCommand$4 as xt, deleteWorkspace as y, formatMigrationNumber as yn, listCommand$8 as yt, openInConfiguredEditor as z, multiConfigArg as zn, getWorkflowExecution as zt };
19565
- //# sourceMappingURL=runtime-DV1EnfMs.mjs.map
19789
+ //# sourceMappingURL=runtime-CJ5usBOu.mjs.map