@tailor-platform/sdk 1.76.1 → 1.76.2
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.
- package/CHANGELOG.md +34 -0
- package/dist/application-6zsDLGKv.mjs +3 -0
- package/dist/{application-BUfYmf0O.mjs → application-CqjCcZ2n.mjs} +372 -1673
- package/dist/application-CqjCcZ2n.mjs.map +1 -0
- package/dist/cli/cache/bundle-cache.d.mts +2 -1
- package/dist/cli/cache/store.d.mts +1 -1
- package/dist/cli/commands/api/index.d.mts +1 -0
- package/dist/cli/commands/deploy/aigateway.d.mts +5 -1
- package/dist/cli/commands/deploy/application.d.mts +7 -1
- package/dist/cli/commands/deploy/apply-phases.d.mts +14 -1
- package/dist/cli/commands/deploy/auth.d.mts +5 -1
- package/dist/cli/commands/deploy/deploy.d.mts +5 -0
- package/dist/cli/commands/deploy/executor.d.mts +7 -1
- package/dist/cli/commands/deploy/function-registry.d.mts +5 -0
- package/dist/cli/commands/deploy/idp.d.mts +5 -1
- package/dist/cli/commands/deploy/resolver.d.mts +5 -1
- package/dist/cli/commands/deploy/secret-manager.d.mts +5 -1
- package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -1
- package/dist/cli/commands/deploy/tailordb/index.d.mts +8 -1
- package/dist/cli/commands/deploy/types.d.mts +3 -1
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -1
- package/dist/cli/commands/deploy/workflow.d.mts +4 -1
- package/dist/cli/commands/executor/get.d.mts +0 -1
- package/dist/cli/commands/executor/jobs.d.mts +0 -1
- package/dist/cli/commands/executor/list.d.mts +0 -1
- package/dist/cli/commands/executor/transform.d.mts +1 -0
- package/dist/cli/commands/executor/trigger.d.mts +0 -1
- package/dist/cli/commands/executor/webhook.d.mts +0 -1
- package/dist/cli/commands/function/get.d.mts +0 -1
- package/dist/cli/commands/function/list.d.mts +0 -1
- package/dist/cli/commands/function/transform.d.mts +1 -0
- package/dist/cli/commands/generate/service.d.mts +5 -1
- package/dist/cli/commands/generate/types.d.mts +3 -1
- package/dist/cli/commands/machineuser/list.d.mts +0 -1
- package/dist/cli/commands/machineuser/token.d.mts +0 -1
- package/dist/cli/commands/oauth2client/get.d.mts +0 -1
- package/dist/cli/commands/oauth2client/list.d.mts +0 -1
- package/dist/cli/commands/oauth2client/transform.d.mts +1 -0
- package/dist/cli/commands/organization/folder/create.d.mts +0 -1
- package/dist/cli/commands/organization/folder/delete.d.mts +0 -1
- package/dist/cli/commands/organization/folder/get.d.mts +0 -1
- package/dist/cli/commands/organization/folder/list.d.mts +0 -1
- package/dist/cli/commands/organization/folder/update.d.mts +0 -1
- package/dist/cli/commands/organization/get.d.mts +0 -1
- package/dist/cli/commands/organization/list.d.mts +0 -1
- package/dist/cli/commands/organization/transform.d.mts +2 -0
- package/dist/cli/commands/organization/tree.d.mts +0 -1
- package/dist/cli/commands/organization/update.d.mts +0 -1
- package/dist/cli/commands/remove.d.mts +0 -1
- package/dist/cli/commands/show.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/config.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
- package/dist/cli/commands/tailordb/truncate.d.mts +0 -1
- package/dist/cli/commands/workflow/executions.d.mts +0 -1
- package/dist/cli/commands/workflow/get.d.mts +2 -1
- package/dist/cli/commands/workflow/list.d.mts +0 -1
- package/dist/cli/commands/workflow/resume.d.mts +0 -1
- package/dist/cli/commands/workflow/start.d.mts +0 -1
- package/dist/cli/commands/workflow/status.d.mts +1 -0
- package/dist/cli/commands/workflow/transform.d.mts +1 -0
- package/dist/cli/commands/workflow/wait.d.mts +0 -1
- package/dist/cli/commands/workflow/waiter.d.mts +1 -1
- package/dist/cli/commands/workspace/app/health.d.mts +0 -1
- package/dist/cli/commands/workspace/app/list.d.mts +0 -1
- package/dist/cli/commands/workspace/app/transform.d.mts +2 -0
- package/dist/cli/commands/workspace/create.d.mts +0 -1
- package/dist/cli/commands/workspace/delete.d.mts +0 -1
- package/dist/cli/commands/workspace/get.d.mts +0 -1
- package/dist/cli/commands/workspace/list.d.mts +0 -1
- package/dist/cli/commands/workspace/restore.d.mts +0 -1
- package/dist/cli/commands/workspace/transform.d.mts +2 -0
- package/dist/cli/commands/workspace/user/invite.d.mts +0 -1
- package/dist/cli/commands/workspace/user/list.d.mts +0 -1
- package/dist/cli/commands/workspace/user/remove.d.mts +0 -1
- package/dist/cli/commands/workspace/user/transform.d.mts +1 -0
- package/dist/cli/commands/workspace/user/update.d.mts +0 -1
- package/dist/cli/index.d.mts +3 -1
- package/dist/cli/index.mjs +599 -42
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +2 -0
- package/dist/cli/lib.mjs +3 -3
- package/dist/cli/query/index.d.mts +0 -1
- package/dist/cli/services/application.d.mts +12 -1
- package/dist/cli/services/auth/service.d.mts +2 -0
- package/dist/cli/services/executor/service.d.mts +1 -1
- package/dist/cli/services/http-adapter/bundler.d.mts +3 -1
- package/dist/cli/services/http-adapter/service.d.mts +2 -1
- package/dist/cli/services/resolver/service.d.mts +1 -1
- package/dist/cli/services/tailordb/service.d.mts +3 -1
- package/dist/cli/services/workflow/bundler.d.mts +2 -1
- package/dist/cli/services/workflow/service.d.mts +1 -1
- package/dist/cli/shared/args.d.mts +1 -1
- package/dist/cli/shared/client.d.mts +1 -1
- package/dist/cli/shared/config-loader.d.mts +0 -1
- package/dist/cli/shared/context.d.mts +2 -1
- package/dist/cli/shared/script-executor.d.mts +0 -1
- package/dist/cli/shared/seed-chunker.d.mts +7 -3
- package/dist/cli/shared/type-generator.d.mts +0 -1
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/config/index.d.mts +0 -1
- package/dist/configure/config/types.d.mts +2 -2
- package/dist/configure/index.d.mts +2 -1
- package/dist/configure/index.mjs +54 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/aigateway/index.d.mts +0 -1
- package/dist/configure/services/aigateway/types.d.mts +0 -1
- package/dist/configure/services/auth/index.d.mts +0 -1
- package/dist/configure/services/auth/types.d.mts +14 -13
- package/dist/configure/services/executor/executor.d.mts +0 -1
- package/dist/configure/services/executor/index.d.mts +1 -0
- package/dist/configure/services/executor/operation.d.mts +1 -2
- package/dist/configure/services/executor/trigger/event.d.mts +0 -1
- package/dist/configure/services/executor/trigger/index.d.mts +0 -1
- package/dist/configure/services/executor/trigger/schedule.d.mts +0 -1
- package/dist/configure/services/executor/trigger/webhook.d.mts +0 -1
- package/dist/configure/services/http-adapter/http-adapter.d.mts +1 -2
- package/dist/configure/services/idp/index.d.mts +0 -1
- package/dist/configure/services/idp/permission.d.mts +4 -5
- package/dist/configure/services/idp/types.d.mts +0 -1
- package/dist/configure/services/index.d.mts +5 -0
- package/dist/configure/services/resolver/resolver.d.mts +0 -1
- package/dist/configure/services/resolver/types.d.mts +0 -1
- package/dist/configure/services/secrets/index.d.mts +0 -1
- package/dist/configure/services/secrets/types.d.mts +0 -1
- package/dist/configure/services/staticwebsite/index.d.mts +0 -1
- package/dist/configure/services/staticwebsite/types.d.mts +0 -1
- package/dist/configure/services/tailordb/permission.d.mts +4 -5
- package/dist/configure/services/tailordb/schema.d.mts +21 -8
- package/dist/configure/services/tailordb/types.d.mts +4 -5
- package/dist/configure/services/workflow/execution-policy.d.mts +0 -1
- package/dist/configure/services/workflow/execution-policy.types.d.mts +0 -1
- package/dist/configure/services/workflow/index.d.mts +1 -0
- package/dist/configure/services/workflow/job.d.mts +0 -1
- package/dist/configure/services/workflow/wait-point.d.mts +0 -1
- package/dist/configure/services/workflow/workflow.d.mts +0 -1
- package/dist/configure/types/field-runtime.d.mts +1 -1
- package/dist/configure/types/field.d.mts +1 -2
- package/dist/configure/types/field.types.d.mts +1 -2
- package/dist/configure/types/type.d.mts +1 -1
- package/dist/configure/user.d.mts +0 -1
- package/dist/{crashreport-ayWANEZ6.mjs → crashreport-DZDr-TvH.mjs} +3 -2
- package/dist/{crashreport-ayWANEZ6.mjs.map → crashreport-DZDr-TvH.mjs.map} +1 -1
- package/dist/{crashreport-Dy4ZzSkd.mjs → crashreport-np4-_DX2.mjs} +1 -1
- package/dist/{field-runtime-9bfXBAOK.mjs → field-runtime-D4QWRiB1.mjs} +66 -46
- package/dist/field-runtime-D4QWRiB1.mjs.map +1 -0
- package/dist/{globals-CcU1ONiK.mjs → globals-z6zYMjlr.mjs} +2 -2
- package/dist/{globals-CcU1ONiK.mjs.map → globals-z6zYMjlr.mjs.map} +1 -1
- package/dist/kysely/index.d.mts +3 -4
- package/dist/parser/service/auth/index.d.mts +1 -1
- package/dist/parser/service/auth/schema.d.mts +1 -0
- package/dist/parser/service/http-adapter/index.d.mts +1 -1
- package/dist/parser/service/idp/types.d.mts +1 -0
- package/dist/parser/service/tailordb/types.d.mts +0 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +0 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +0 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +0 -1
- package/dist/plugin/builtin/seed/index.d.mts +0 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/get-generated-type.d.mts +0 -1
- package/dist/plugin/manager.d.mts +3 -1
- package/dist/plugin/types.d.mts +0 -1
- package/dist/plugin/with-context.d.mts +0 -1
- package/dist/{registry-NfSW0BRo.mjs → registry-CTgoVWc_.mjs} +4 -49
- package/dist/registry-CTgoVWc_.mjs.map +1 -0
- package/dist/runtime/aigateway.d.mts +0 -2
- package/dist/runtime/authconnection.d.mts +0 -2
- package/dist/runtime/globals.d.mts +0 -1
- package/dist/runtime/index.d.mts +0 -1
- package/dist/runtime/types.d.mts +16 -7
- package/dist/{runtime-_vUgjiqT.mjs → runtime-DlklyuHN.mjs} +1301 -716
- package/dist/runtime-DlklyuHN.mjs.map +1 -0
- package/dist/{schema-DrVyN-LP.mjs → schema-DbTR1c6M.mjs} +3 -2
- package/dist/schema-DbTR1c6M.mjs.map +1 -0
- package/dist/{secret-file-VSVGy1V0.mjs → secret-file-DBqZhjFQ.mjs} +2 -27
- package/dist/{secret-file-VSVGy1V0.mjs.map → secret-file-DBqZhjFQ.mjs.map} +1 -1
- package/dist/seed/index.d.mts +3 -2
- package/dist/{seed-fm0LeYP2.mjs → seed-DFFigL8V.mjs} +3 -13
- package/dist/seed-DFFigL8V.mjs.map +1 -0
- package/dist/service_pb-BoLM0X4K.mjs +167 -0
- package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
- package/dist/{service_pb-B2FF59sP.mjs → service_pb-r1T7kpJc.mjs} +1 -1
- package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +0 -1
- package/dist/test-env-key-IPapa1KJ.mjs +49 -0
- package/dist/test-env-key-IPapa1KJ.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/types/aigateway.generated.d.mts +5 -2
- package/dist/types/auth-connection.generated.d.mts +11 -5
- package/dist/types/auth.generated.d.mts +111 -51
- package/dist/types/executor.generated.d.mts +59 -27
- package/dist/types/helpers.d.mts +5 -5
- package/dist/types/http-adapter.generated.d.mts +11 -5
- package/dist/types/idp.generated.d.mts +20 -9
- package/dist/types/resolver.generated.d.mts +19 -9
- package/dist/types/staticwebsite.generated.d.mts +7 -3
- package/dist/types/tailordb.generated.d.mts +47 -22
- package/dist/types/workflow.generated.d.mts +9 -4
- package/dist/{types-BwzB2okW.mjs → types-BzJ7A_fn.mjs} +2 -2
- package/dist/{types-BwzB2okW.mjs.map → types-BzJ7A_fn.mjs.map} +1 -1
- package/dist/types-CG9H7HuE.mjs +4 -0
- package/dist/user-agent-DX2Jnw0-.mjs +28 -0
- package/dist/user-agent-DX2Jnw0-.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +0 -1
- package/dist/utils/test/index.mjs +1 -1
- package/dist/utils/test/mock.d.mts +0 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +1 -1
- package/dist/vitest/index.mjs +2 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock-kysely.d.mts +0 -1
- package/dist/vitest/mocks/aigateway.d.mts +2 -2
- package/dist/vitest/mocks/authconnection.d.mts +2 -2
- package/dist/vitest/mocks/idp.d.mts +2 -2
- package/dist/vitest/mocks/secretmanager.d.mts +3 -1
- package/dist/vitest/mocks/tailordb.d.mts +6 -3
- package/dist/vitest/mocks/workflow.d.mts +11 -6
- package/dist/vitest/setup.mjs +1 -1
- package/dist/{service_pb-B5w9rjPY.mjs → workspace_resource_pb-Db3fv68L.mjs} +57 -165
- package/dist/workspace_resource_pb-Db3fv68L.mjs.map +1 -0
- package/docs/services/tailordb.md +10 -1
- package/package.json +11 -11
- package/dist/application-BUfYmf0O.mjs.map +0 -1
- package/dist/application-DbvD5UUz.mjs +0 -3
- package/dist/cli/shared/trigger-context.d.mts +0 -1
- package/dist/field-runtime-9bfXBAOK.mjs.map +0 -1
- package/dist/job-D-PbD1P3.mjs +0 -55
- package/dist/job-D-PbD1P3.mjs.map +0 -1
- package/dist/registry-NfSW0BRo.mjs.map +0 -1
- package/dist/resource_pb-BRv7AMXK.mjs +0 -49
- package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
- package/dist/runtime-_vUgjiqT.mjs.map +0 -1
- package/dist/schema-DrVyN-LP.mjs.map +0 -1
- package/dist/seed-fm0LeYP2.mjs.map +0 -1
- package/dist/service_pb-B5w9rjPY.mjs.map +0 -1
- package/dist/types-KlawuVKa.mjs +0 -4
package/dist/cli/index.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { St as AuthInvokerSchema, T as CustomDomainStatus, U as FunctionExecution_Type, kt as PATScope } from "../workspace_resource_pb-Db3fv68L.mjs";
|
|
2
3
|
import { t as assertDefined } from "../assert-DBxo8jPo.mjs";
|
|
3
4
|
import { n as logger, r as styles } from "../logger-BEiZZ3qT.mjs";
|
|
4
|
-
import { A as
|
|
5
|
-
import {
|
|
5
|
+
import { $n as multiConfigArg, $t as compareSnapshotWithRemote, A as listCommand$13, An as apiCall, Bn as loadStoredUserTokens, C as listCommand$14, Cn as hasChanges, Dn as PluginManager, Dt as listCommand$7, E as waitCommand, En as sdkNameLabelKey, F as generateCommand$1, Fn as hasAnyUserTokenEntry, G as removeCommand$1, Gn as saveUserTokens, Gt as deploy, H as extractOwnedNamespaces, Hn as platformConfigFromProfile, Ht as formatKeyValueTable, I as generateMigrationScript, In as hasUserTokenEntry, It as getCommand$6, Jn as commonArgs, K as updateCommand$3, Kn as writePlatformConfig, Kt as ensureConfigId, L as writeDbTypesFile, Ln as loadAccessToken, Mn as loadConfig, N as truncateCommand, Nn as deleteUserTokens, O as resumeCommand, On as generateUserTypes, Pn as fetchLatestToken, Pt as startCommand, Q as getCommand$5, Qn as isVerbose, Qt as parseMigrationLabelNumber, R as getConfiguredEditorCommand, Rn as loadConsoleBaseUrl, Rt as executionsCommand, Sn as formatMigrationDiff, T as healthCommand, Tn as resourceTrn, Tt as triggerCommand, U as logBetaWarning, Un as readPlatformConfig, Ut as getCommand$1, V as showCommand, Vn as loadWorkspaceId, Vt as functionExecutionStatusToString, Wn as resolveUserTokenKey, X as listCommand$12, Xn as confirmationArgs, Xt as MIGRATION_LABEL_KEY, Y as treeCommand, Yn as configArg, Zn as deploymentArgs, Zt as handleOptionalToRequiredError, _n as loadDiff, b as createCommand$4, bn as parseMigrationNumberArg, c as listCommand$15, cn as compareLocalTypesWithSnapshot, ct as createCommand$3, dn as getLatestMigrationNumber, en as generateAllTypeManifestsFromSnapshot, er as pagedLogArgs, et as updateCommand$2, f as restoreCommand, ft as getCommand$3, g as getCommand$7, gn as isValidMigrationNumber, gt as listCommand$9, ht as tokenCommand, i as updateCommand$4, in as INITIAL_SCHEMA_NUMBER, ir as workspaceArgs, it as getCommand$4, jn as assertWritable, jt as jobsCommand, kn as prompt, m as listCommand$16, mn as getMigrationFiles, nr as resolveMachineUserInputSource, nt as listCommand$11, o as removeCommand, ot as deleteCommand$4, pn as getMigrationFilePath, qn as defineAppCommand, qt as executeScript, r as queryCommand, rr as toPageDirection, sn as assertValidMigrationFiles, t as isNativeTypeScriptRuntime, tn as protoGqlPermission, tr as paginationArgs, u as inviteCommand, un as createSnapshotFromLocalTypes, ut as listCommand$10, v as deleteCommand$5, vn as reconstructSnapshotFromMigrations, vt as generate, wn as getNamespacesWithMigrations, wt as webhookCommand, xt as getCommand$2, yn as formatMigrationNumber, yt as listCommand$8, z as openInConfiguredEditor, zn as loadMachineUserName } from "../runtime-DlklyuHN.mjs";
|
|
6
|
+
import { A as fetchAllTolerant, B as initOperatorClient, D as closeConnectionPool, L as getOrNull, M as fetchPaged, N as fetchPlatformMachineUserToken, O as defaultPlatformBaseUrl, P as fetchUserInfo, T as hashContent$1, V as isDefaultPlatform, _ as platformBundleDefinePlugin, a as resolveInlineSourcemap, b as resolveBundleLogLevel, c as ResolverSchema, k as fetchAll, s as WorkflowJobSchema, t as defineApplication, u as INVOKER_EXPR, v as composeFunctionTreeshakeOptions, w as getDistDir, y as createLogLevelTreeshakeOptions, z as initOAuth2Client } from "../application-CqjCcZ2n.mjs";
|
|
6
7
|
import { n as ExecutorSchema } from "../service-BCRJ-3NV.mjs";
|
|
7
8
|
import { t as multiline } from "../multiline-sfHpTZZK.mjs";
|
|
8
|
-
import {
|
|
9
|
+
import { t as isPluginGeneratedType } from "../type-source-DH_LH20p.mjs";
|
|
9
10
|
import { t as readPackageJson } from "../package-json-8b0O9TlX.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import { n as isCLIError } from "../errors-Dtf2WPaW.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-
|
|
11
|
+
import { t as userAgent } from "../user-agent-DX2Jnw0-.mjs";
|
|
12
|
+
import { n as isCLIError, t as createCLIError } from "../errors-Dtf2WPaW.mjs";
|
|
13
|
+
import { t as OperatorService } from "../service_pb-BoLM0X4K.mjs";
|
|
14
|
+
import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-DZDr-TvH.mjs";
|
|
14
15
|
import { arg, defineCommand, runCommand, runMain } from "politty";
|
|
15
16
|
import { withCompletionCommand } from "politty/completion";
|
|
16
17
|
import { z } from "zod";
|
|
17
|
-
import { create } from "@bufbuild/protobuf";
|
|
18
|
+
import { ScalarType, create } from "@bufbuild/protobuf";
|
|
18
19
|
import * as fs$1 from "node:fs";
|
|
19
20
|
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
20
21
|
import * as path from "pathe";
|
|
@@ -38,6 +39,561 @@ import { watch } from "chokidar";
|
|
|
38
39
|
import * as fs from "fs";
|
|
39
40
|
import { lookup } from "mime-types";
|
|
40
41
|
|
|
42
|
+
//#region src/cli/commands/api/proto-reflect.ts
|
|
43
|
+
const UNARY_METHODS = OperatorService.methods.filter((m) => m.methodKind === "unary");
|
|
44
|
+
function listMethodNames() {
|
|
45
|
+
return UNARY_METHODS.map((m) => m.name).toSorted();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns every accepted form of the `endpoint` positional — bare method name
|
|
49
|
+
* and fully-qualified `service/Method`. politty's expand completion keys its
|
|
50
|
+
* static table by the literal endpoint string, so both forms must appear in
|
|
51
|
+
* `choices` or the user typing the fully-qualified name gets no `--field`
|
|
52
|
+
* completion candidates back at TAB time.
|
|
53
|
+
* @returns Sorted list of accepted endpoint values
|
|
54
|
+
*/
|
|
55
|
+
function listMethodChoices() {
|
|
56
|
+
return UNARY_METHODS.flatMap((m) => [m.name, `${OperatorService.typeName}/${m.name}`]).toSorted();
|
|
57
|
+
}
|
|
58
|
+
function getMethodDescriptor(methodName) {
|
|
59
|
+
return UNARY_METHODS.find((m) => m.name === methodName);
|
|
60
|
+
}
|
|
61
|
+
function extractMethodName(endpoint) {
|
|
62
|
+
if (!endpoint.includes("/")) return endpoint;
|
|
63
|
+
return endpoint.split("/").pop() ?? endpoint;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Returns the nested message descriptor when the field is a message, a list of
|
|
67
|
+
* messages, or a map with message values. Otherwise returns undefined.
|
|
68
|
+
* @param field - The proto field descriptor to inspect
|
|
69
|
+
* @returns The nested message descriptor, or undefined when the field isn't message-shaped
|
|
70
|
+
*/
|
|
71
|
+
function nestedMessage(field) {
|
|
72
|
+
if (field.fieldKind === "message") return field.message;
|
|
73
|
+
if (field.fieldKind === "list" && field.listKind === "message") return field.message;
|
|
74
|
+
if (field.fieldKind === "map" && field.mapKind === "message") return field.message;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Most `google.protobuf.*` well-known types serialize as scalars in proto JSON
|
|
78
|
+
* (Timestamp/Duration → RFC3339/duration string, FieldMask → comma-joined
|
|
79
|
+
* string, *Value wrappers → underlying primitive, etc.), so we must not let
|
|
80
|
+
* `--field` drill into their internal fields. Treating them as leaves keeps
|
|
81
|
+
* the completion and the body shape consistent with what the server expects.
|
|
82
|
+
* @param message - The proto message descriptor to inspect
|
|
83
|
+
* @returns True when the message is a well-known type
|
|
84
|
+
*/
|
|
85
|
+
function isWellKnownType(message) {
|
|
86
|
+
return message.typeName.startsWith("google.protobuf.");
|
|
87
|
+
}
|
|
88
|
+
const UNREPRESENTABLE_WELL_KNOWN_TYPES = /* @__PURE__ */ new Set([
|
|
89
|
+
"google.protobuf.Struct",
|
|
90
|
+
"google.protobuf.Value",
|
|
91
|
+
"google.protobuf.ListValue",
|
|
92
|
+
"google.protobuf.NullValue",
|
|
93
|
+
"google.protobuf.Any",
|
|
94
|
+
"google.protobuf.Empty"
|
|
95
|
+
]);
|
|
96
|
+
/**
|
|
97
|
+
* @param message - The proto message descriptor to inspect
|
|
98
|
+
* @returns True when the message is a well-known type that `--field` cannot represent
|
|
99
|
+
*/
|
|
100
|
+
function isUnrepresentableWellKnownType(message) {
|
|
101
|
+
return UNREPRESENTABLE_WELL_KNOWN_TYPES.has(message.typeName);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Pre-enumerates every `--field` completion candidate for `methodName`,
|
|
105
|
+
* walking the input message tree to produce a flat list that the shell can
|
|
106
|
+
* prefix-filter at TAB time. Used by the `expand` completion variant so no
|
|
107
|
+
* Node process is spawned per keystroke.
|
|
108
|
+
*
|
|
109
|
+
* For each leaf field, emits `key=` (key completion). Enum leaves additionally
|
|
110
|
+
* emit `key=ENUM_VALUE` per value, bool leaves emit `key=true` and
|
|
111
|
+
* `key=false`. For nested messages, emits `key.` (drill-down) and recurses.
|
|
112
|
+
*
|
|
113
|
+
* Returns an empty array when `methodName` is unknown so the `expand`
|
|
114
|
+
* generator stays exception-free at script-generation time.
|
|
115
|
+
* @param methodName - Name of the unary RPC whose input message is being walked
|
|
116
|
+
* @returns Flat list of `{ value, description }` candidates
|
|
117
|
+
*/
|
|
118
|
+
function enumerateAllFieldCompletions(methodName) {
|
|
119
|
+
const method = getMethodDescriptor(methodName);
|
|
120
|
+
if (!method) return [];
|
|
121
|
+
const candidates = [];
|
|
122
|
+
const visited = /* @__PURE__ */ new Set();
|
|
123
|
+
function walk(message, prefix) {
|
|
124
|
+
visited.add(message);
|
|
125
|
+
for (const field of message.fields) {
|
|
126
|
+
if (field.fieldKind === "list" || field.fieldKind === "map") continue;
|
|
127
|
+
const fullKey = prefix + field.localName;
|
|
128
|
+
if (field.fieldKind === "message") {
|
|
129
|
+
if (isUnrepresentableWellKnownType(field.message)) continue;
|
|
130
|
+
if (!isWellKnownType(field.message)) {
|
|
131
|
+
const nested = field.message;
|
|
132
|
+
candidates.push({
|
|
133
|
+
value: `${fullKey}.`,
|
|
134
|
+
description: `${fullKey} (message)`
|
|
135
|
+
});
|
|
136
|
+
if (!visited.has(nested)) walk(nested, `${fullKey}.`);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
candidates.push({
|
|
141
|
+
value: `${fullKey}=`,
|
|
142
|
+
description: `Set ${fullKey}`
|
|
143
|
+
});
|
|
144
|
+
if (field.fieldKind === "enum") for (const v of field.enum.values) candidates.push({
|
|
145
|
+
value: `${fullKey}=${v.name}`,
|
|
146
|
+
description: v.name
|
|
147
|
+
});
|
|
148
|
+
else if (field.fieldKind === "scalar" && field.scalar === ScalarType.BOOL) {
|
|
149
|
+
candidates.push({
|
|
150
|
+
value: `${fullKey}=true`,
|
|
151
|
+
description: "true"
|
|
152
|
+
});
|
|
153
|
+
candidates.push({
|
|
154
|
+
value: `${fullKey}=false`,
|
|
155
|
+
description: "false"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
visited.delete(message);
|
|
160
|
+
}
|
|
161
|
+
walk(method.input, "");
|
|
162
|
+
return candidates;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Resolves the leaf `DescField` at a dotted `--field` path within an input
|
|
166
|
+
* message tree. Returns undefined when any segment is missing or when a
|
|
167
|
+
* non-leaf segment isn't a singular message — callers fall back to treating
|
|
168
|
+
* the value as a string in that case.
|
|
169
|
+
* @param input - The RPC input message descriptor
|
|
170
|
+
* @param path - Dot-split path segments to follow (e.g. ["application", "name"])
|
|
171
|
+
* @returns The leaf field descriptor, or undefined when the path doesn't resolve
|
|
172
|
+
*/
|
|
173
|
+
function resolveLeafField(input, path) {
|
|
174
|
+
let message = input;
|
|
175
|
+
for (let i = 0; i < path.length; i++) {
|
|
176
|
+
const field = message.fields.find((f) => f.localName === path[i]);
|
|
177
|
+
if (!field) return void 0;
|
|
178
|
+
if (i === path.length - 1) {
|
|
179
|
+
if (field.fieldKind === "message" && isUnrepresentableWellKnownType(field.message)) return;
|
|
180
|
+
return field;
|
|
181
|
+
}
|
|
182
|
+
if (field.fieldKind !== "message") return void 0;
|
|
183
|
+
if (isWellKnownType(field.message)) return void 0;
|
|
184
|
+
message = field.message;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/cli/commands/api/render.ts
|
|
190
|
+
const SCALAR_LABEL = {
|
|
191
|
+
[ScalarType.DOUBLE]: "double",
|
|
192
|
+
[ScalarType.FLOAT]: "float",
|
|
193
|
+
[ScalarType.INT64]: "int64",
|
|
194
|
+
[ScalarType.UINT64]: "uint64",
|
|
195
|
+
[ScalarType.INT32]: "int32",
|
|
196
|
+
[ScalarType.FIXED64]: "fixed64",
|
|
197
|
+
[ScalarType.FIXED32]: "fixed32",
|
|
198
|
+
[ScalarType.BOOL]: "bool",
|
|
199
|
+
[ScalarType.STRING]: "string",
|
|
200
|
+
[ScalarType.BYTES]: "bytes",
|
|
201
|
+
[ScalarType.UINT32]: "uint32",
|
|
202
|
+
[ScalarType.SFIXED32]: "sfixed32",
|
|
203
|
+
[ScalarType.SFIXED64]: "sfixed64",
|
|
204
|
+
[ScalarType.SINT32]: "sint32",
|
|
205
|
+
[ScalarType.SINT64]: "sint64"
|
|
206
|
+
};
|
|
207
|
+
function shortName(typeName) {
|
|
208
|
+
const dot = typeName.lastIndexOf(".");
|
|
209
|
+
return dot < 0 ? typeName : typeName.slice(dot + 1);
|
|
210
|
+
}
|
|
211
|
+
function scalarLabel(scalar) {
|
|
212
|
+
return SCALAR_LABEL[scalar] ?? `scalar(${scalar})`;
|
|
213
|
+
}
|
|
214
|
+
function enumLabel(enumDesc) {
|
|
215
|
+
return `enum ${shortName(enumDesc.typeName)}`;
|
|
216
|
+
}
|
|
217
|
+
function enumOf(field) {
|
|
218
|
+
if (field.fieldKind === "enum") return field.enum;
|
|
219
|
+
if (field.fieldKind === "list" && field.listKind === "enum") return field.enum;
|
|
220
|
+
}
|
|
221
|
+
function describeFieldType(field) {
|
|
222
|
+
switch (field.fieldKind) {
|
|
223
|
+
case "scalar": return scalarLabel(field.scalar);
|
|
224
|
+
case "enum": return enumLabel(field.enum);
|
|
225
|
+
case "message": return shortName(field.message.typeName);
|
|
226
|
+
case "list": {
|
|
227
|
+
let inner;
|
|
228
|
+
if (field.listKind === "scalar") inner = scalarLabel(field.scalar);
|
|
229
|
+
else if (field.listKind === "enum") inner = enumLabel(field.enum);
|
|
230
|
+
else inner = shortName(field.message.typeName);
|
|
231
|
+
return `repeated ${inner}`;
|
|
232
|
+
}
|
|
233
|
+
case "map": {
|
|
234
|
+
const keyType = scalarLabel(field.mapKey);
|
|
235
|
+
let valType;
|
|
236
|
+
if (field.mapKind === "scalar") valType = scalarLabel(field.scalar);
|
|
237
|
+
else if (field.mapKind === "enum") valType = enumLabel(field.enum);
|
|
238
|
+
else valType = shortName(field.message.typeName);
|
|
239
|
+
return `map<${keyType}, ${valType}>`;
|
|
240
|
+
}
|
|
241
|
+
default: return "<unknown>";
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function fieldToJson(field, visited) {
|
|
245
|
+
const json = {
|
|
246
|
+
name: field.localName,
|
|
247
|
+
protoName: field.name,
|
|
248
|
+
type: describeFieldType(field),
|
|
249
|
+
fieldKind: field.fieldKind,
|
|
250
|
+
repeated: field.fieldKind === "list"
|
|
251
|
+
};
|
|
252
|
+
if (field.oneof) json.oneof = field.oneof.name;
|
|
253
|
+
const fieldEnum = enumOf(field);
|
|
254
|
+
if (fieldEnum) json.enumValues = fieldEnum.values.map((v) => v.name);
|
|
255
|
+
const nested = nestedMessage(field);
|
|
256
|
+
if (nested && !visited.has(nested)) {
|
|
257
|
+
visited.add(nested);
|
|
258
|
+
json.message = {
|
|
259
|
+
typeName: nested.typeName,
|
|
260
|
+
fields: nested.fields.map((f) => fieldToJson(f, visited))
|
|
261
|
+
};
|
|
262
|
+
visited.delete(nested);
|
|
263
|
+
} else if (nested) json.message = {
|
|
264
|
+
typeName: nested.typeName,
|
|
265
|
+
fields: [],
|
|
266
|
+
recursive: true
|
|
267
|
+
};
|
|
268
|
+
return json;
|
|
269
|
+
}
|
|
270
|
+
function renderInspectJson(method) {
|
|
271
|
+
const visited = /* @__PURE__ */ new Set([method.input]);
|
|
272
|
+
return {
|
|
273
|
+
method: method.name,
|
|
274
|
+
input: {
|
|
275
|
+
typeName: method.input.typeName,
|
|
276
|
+
fields: method.input.fields.map((f) => fieldToJson(f, visited))
|
|
277
|
+
},
|
|
278
|
+
output: { typeName: method.output.typeName }
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function renderFieldText(field, indent, visited) {
|
|
282
|
+
const lines = [];
|
|
283
|
+
const oneofTag = field.oneof ? ` (oneof ${field.oneof.name})` : "";
|
|
284
|
+
lines.push(`${indent}${field.localName}: ${describeFieldType(field)}${oneofTag}`);
|
|
285
|
+
const fieldEnum = enumOf(field);
|
|
286
|
+
if (fieldEnum) {
|
|
287
|
+
const values = fieldEnum.values.map((v) => v.name).join(", ");
|
|
288
|
+
lines.push(`${indent} values: ${values}`);
|
|
289
|
+
}
|
|
290
|
+
const nested = nestedMessage(field);
|
|
291
|
+
if (nested && !visited.has(nested)) {
|
|
292
|
+
visited.add(nested);
|
|
293
|
+
for (const sub of nested.fields) lines.push(...renderFieldText(sub, `${indent} `, visited));
|
|
294
|
+
visited.delete(nested);
|
|
295
|
+
} else if (nested) lines.push(`${indent} …(recursive ${nested.typeName})`);
|
|
296
|
+
return lines;
|
|
297
|
+
}
|
|
298
|
+
function renderInspectText(method) {
|
|
299
|
+
const lines = [];
|
|
300
|
+
lines.push(`${method.name}`);
|
|
301
|
+
lines.push(` request: ${method.input.typeName}`);
|
|
302
|
+
const visited = /* @__PURE__ */ new Set([method.input]);
|
|
303
|
+
for (const f of method.input.fields) lines.push(...renderFieldText(f, " ", visited));
|
|
304
|
+
lines.push(` response: ${method.output.typeName}`);
|
|
305
|
+
return lines.join("\n");
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
//#endregion
|
|
309
|
+
//#region src/cli/commands/api/inspect.ts
|
|
310
|
+
const inspectCommand = defineAppCommand({
|
|
311
|
+
name: "inspect",
|
|
312
|
+
description: "Print the input message tree of an OperatorService endpoint.",
|
|
313
|
+
notes: "Combine with the global `--json` flag for a machine-readable descriptor. Recursive type references and `oneof` membership are annotated. Use `tailor-sdk api list` to discover endpoint names.",
|
|
314
|
+
examples: [{
|
|
315
|
+
cmd: "GetApplication",
|
|
316
|
+
desc: "Show fields of GetApplicationRequest."
|
|
317
|
+
}, {
|
|
318
|
+
cmd: "CreateExecutorExecutor",
|
|
319
|
+
desc: "Inspect a deeply nested input with `(oneof config)` annotations."
|
|
320
|
+
}],
|
|
321
|
+
args: z.object({ endpoint: arg(z.string(), {
|
|
322
|
+
positional: true,
|
|
323
|
+
description: "API endpoint to inspect (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').",
|
|
324
|
+
completion: { custom: { choices: listMethodNames() } }
|
|
325
|
+
}) }).strict(),
|
|
326
|
+
run: (args) => {
|
|
327
|
+
const methodName = extractMethodName(args.endpoint);
|
|
328
|
+
const method = getMethodDescriptor(methodName);
|
|
329
|
+
if (!method) throw createCLIError({
|
|
330
|
+
message: `unknown method: ${methodName}`,
|
|
331
|
+
suggestion: "Run `tailor-sdk api list` to see available methods.",
|
|
332
|
+
command: "api inspect"
|
|
333
|
+
});
|
|
334
|
+
if (logger.jsonMode) logger.out(renderInspectJson(method));
|
|
335
|
+
else logger.out(renderInspectText(method));
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/cli/commands/api/list.ts
|
|
341
|
+
const listCommand$6 = defineAppCommand({
|
|
342
|
+
name: "list",
|
|
343
|
+
description: "List all invocable OperatorService methods.",
|
|
344
|
+
notes: "Only single-request (non-streaming) methods are listed, because the CLI issues a single JSON request and reads one JSON response.",
|
|
345
|
+
args: z.object({}).strict(),
|
|
346
|
+
run: () => {
|
|
347
|
+
const names = listMethodNames();
|
|
348
|
+
if (logger.jsonMode) logger.out(names);
|
|
349
|
+
else for (const name of names) logger.out(name);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/cli/commands/api/index.ts
|
|
355
|
+
function resolveNamespaceName(methodName, config) {
|
|
356
|
+
if (/Auth|Tenant|UserProfile/.test(methodName)) return config.auth?.name;
|
|
357
|
+
if (/IdP/.test(methodName)) {
|
|
358
|
+
if (config.idp?.length === 1) return assertDefined(config.idp[0], "idp config missing").name;
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (/TailorDB/.test(methodName)) {
|
|
362
|
+
const keys = Object.keys(config.db ?? {});
|
|
363
|
+
if (keys.length === 1) return keys[0];
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (/Pipeline/.test(methodName)) {
|
|
367
|
+
const keys = Object.keys(config.resolver ?? {});
|
|
368
|
+
if (keys.length === 1) return keys[0];
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Parse a JSON body string as a plain object for field injection.
|
|
374
|
+
* Returns undefined for invalid JSON or non-object values (null, arrays, primitives),
|
|
375
|
+
* so callers can fall back to sending the raw string unchanged.
|
|
376
|
+
* @param body - Raw body string
|
|
377
|
+
* @returns Parsed object or undefined
|
|
378
|
+
*/
|
|
379
|
+
function parseBodyAsObject(body) {
|
|
380
|
+
let parsed;
|
|
381
|
+
try {
|
|
382
|
+
parsed = JSON.parse(body);
|
|
383
|
+
} catch {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
|
|
387
|
+
return parsed;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Set a dotted path on a body object, replacing non-object intermediates as
|
|
391
|
+
* needed. `--field` takes precedence over `--body`, so collisions overwrite.
|
|
392
|
+
* @param obj - The body object to mutate
|
|
393
|
+
* @param path - Dot-split path segments (e.g. ["application", "name"])
|
|
394
|
+
* @param value - Value to assign at the leaf
|
|
395
|
+
*/
|
|
396
|
+
function setNestedPath(obj, path, value) {
|
|
397
|
+
let cursor = obj;
|
|
398
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
399
|
+
const key = assertDefined(path[i], "path segment missing");
|
|
400
|
+
const next = cursor[key];
|
|
401
|
+
if (typeof next !== "object" || next === null || Array.isArray(next)) cursor[key] = {};
|
|
402
|
+
cursor = cursor[key];
|
|
403
|
+
}
|
|
404
|
+
cursor[assertDefined(path[path.length - 1], "path last segment missing")] = value;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Coerces a raw `--field` string value to match the leaf proto type so the
|
|
408
|
+
* JSON body sends a properly typed value. Today we only coerce bool — the
|
|
409
|
+
* completion candidates explicitly suggest `=true`/`=false`, so sending the
|
|
410
|
+
* literal string "true" would be a visible mismatch. Other scalars are left
|
|
411
|
+
* as strings: proto JSON accepts string forms for ints/floats/int64/etc.,
|
|
412
|
+
* and we'd rather pass through what the user typed than silently coerce.
|
|
413
|
+
* @param field - The resolved leaf field descriptor, or undefined when the path didn't resolve
|
|
414
|
+
* @param raw - The raw string value after `=`
|
|
415
|
+
* @returns The value to write into the body object
|
|
416
|
+
*/
|
|
417
|
+
function coerceFieldValue(field, raw) {
|
|
418
|
+
if (field && field.fieldKind === "scalar" && field.scalar === ScalarType.BOOL) {
|
|
419
|
+
if (raw === "true") return true;
|
|
420
|
+
if (raw === "false") return false;
|
|
421
|
+
throw new Error(`Invalid value for bool field: '${raw}'. Expected 'true' or 'false'.`);
|
|
422
|
+
}
|
|
423
|
+
return raw;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Collapse top-level body keys that address a known input field by its
|
|
427
|
+
* protobuf name (snake_case) or JSON name to the field's `localName`. protojson
|
|
428
|
+
* accepts every alias, so converging them here lets the presence checks below
|
|
429
|
+
* reason in a single namespace — otherwise a `--body` written as
|
|
430
|
+
* `{"workspace_id": ...}` slips past the camelCase check and we inject a second
|
|
431
|
+
* `workspaceId`, which the server rejects as a duplicate field. When both forms
|
|
432
|
+
* are present the canonical key wins and the alias is dropped.
|
|
433
|
+
* @param body - The parsed body object to mutate
|
|
434
|
+
* @param fields - The target endpoint's input fields
|
|
435
|
+
* @returns Whether any key was rewritten
|
|
436
|
+
*/
|
|
437
|
+
function normalizeBodyFieldKeys(body, fields) {
|
|
438
|
+
const aliasToLocal = /* @__PURE__ */ new Map();
|
|
439
|
+
for (const f of fields) {
|
|
440
|
+
aliasToLocal.set(f.name, f.localName);
|
|
441
|
+
aliasToLocal.set(f.jsonName, f.localName);
|
|
442
|
+
}
|
|
443
|
+
let changed = false;
|
|
444
|
+
for (const key of Object.keys(body)) {
|
|
445
|
+
const local = aliasToLocal.get(key);
|
|
446
|
+
if (!local || local === key) continue;
|
|
447
|
+
if (!Object.hasOwn(body, local)) body[local] = body[key];
|
|
448
|
+
delete body[key];
|
|
449
|
+
changed = true;
|
|
450
|
+
}
|
|
451
|
+
return changed;
|
|
452
|
+
}
|
|
453
|
+
const FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set([
|
|
454
|
+
"__proto__",
|
|
455
|
+
"constructor",
|
|
456
|
+
"prototype"
|
|
457
|
+
]);
|
|
458
|
+
const fieldArg = z.string().transform((val, ctx) => {
|
|
459
|
+
const eq = val.indexOf("=");
|
|
460
|
+
if (eq < 0) {
|
|
461
|
+
ctx.addIssue({
|
|
462
|
+
code: z.ZodIssueCode.custom,
|
|
463
|
+
message: `Invalid field format: '${val}'. Expected format: 'key=value' or 'a.b.c=value'`
|
|
464
|
+
});
|
|
465
|
+
return z.NEVER;
|
|
466
|
+
}
|
|
467
|
+
const key = val.slice(0, eq);
|
|
468
|
+
if (key.length === 0) {
|
|
469
|
+
ctx.addIssue({
|
|
470
|
+
code: z.ZodIssueCode.custom,
|
|
471
|
+
message: "Field key cannot be empty"
|
|
472
|
+
});
|
|
473
|
+
return z.NEVER;
|
|
474
|
+
}
|
|
475
|
+
const segments = key.split(".");
|
|
476
|
+
if (segments.some((seg) => seg.length === 0)) {
|
|
477
|
+
ctx.addIssue({
|
|
478
|
+
code: z.ZodIssueCode.custom,
|
|
479
|
+
message: `Invalid field key: '${key}'. Dotted segments cannot be empty`
|
|
480
|
+
});
|
|
481
|
+
return z.NEVER;
|
|
482
|
+
}
|
|
483
|
+
const forbidden = segments.find((seg) => FORBIDDEN_SEGMENTS.has(seg));
|
|
484
|
+
if (forbidden) {
|
|
485
|
+
ctx.addIssue({
|
|
486
|
+
code: z.ZodIssueCode.custom,
|
|
487
|
+
message: `Invalid field key: '${key}'. Segment '${forbidden}' is not allowed.`
|
|
488
|
+
});
|
|
489
|
+
return z.NEVER;
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
path: segments,
|
|
493
|
+
value: val.slice(eq + 1)
|
|
494
|
+
};
|
|
495
|
+
});
|
|
496
|
+
const apiCommand = defineAppCommand({
|
|
497
|
+
name: "api",
|
|
498
|
+
description: "Call Tailor Platform API endpoints directly.",
|
|
499
|
+
notes: `Use \`tailor-sdk api list\` to enumerate invocable methods and \`tailor-sdk api inspect <endpoint>\` to print an endpoint's input message tree (combine with \`--json\` for machine-readable output).
|
|
500
|
+
|
|
501
|
+
The request body is inferred from the target endpoint's request schema, and commonly required fields are auto-injected so they can be omitted from \`--body\`:
|
|
502
|
+
|
|
503
|
+
- \`workspaceId\` — resolved from \`-w\` / \`TAILOR_PLATFORM_WORKSPACE_ID\` / the selected profile.
|
|
504
|
+
- \`namespaceName\` — resolved from \`tailor.config.ts\` based on the endpoint's service:
|
|
505
|
+
- Auth / Tenant / UserProfile endpoints use \`auth.name\`.
|
|
506
|
+
- IdP / TailorDB / Pipeline endpoints use the sole configured namespace when exactly one is defined.
|
|
507
|
+
|
|
508
|
+
Values already present in \`--body\` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence.
|
|
509
|
+
|
|
510
|
+
Use \`--field key=value\` (repeatable) to set request body fields without writing JSON. Dotted keys (e.g. \`application.name=foo\`) build nested objects. \`--field\` overrides matching fields in \`--body\` and tab-completes from the endpoint's request schema.`,
|
|
511
|
+
examples: [
|
|
512
|
+
{
|
|
513
|
+
cmd: "GetApplication -b '{\"applicationName\":\"app-1\"}'",
|
|
514
|
+
desc: "Call an endpoint; workspaceId is auto-injected."
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
cmd: "GetApplication -f applicationName=app-1",
|
|
518
|
+
desc: "Same as above, using --field instead of --body."
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
cmd: "list",
|
|
522
|
+
desc: "List all invocable OperatorService methods."
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
cmd: "inspect GetApplication",
|
|
526
|
+
desc: "Show the input message tree for an endpoint."
|
|
527
|
+
}
|
|
528
|
+
],
|
|
529
|
+
subCommands: {
|
|
530
|
+
list: listCommand$6,
|
|
531
|
+
inspect: inspectCommand
|
|
532
|
+
},
|
|
533
|
+
args: z.object({
|
|
534
|
+
...workspaceArgs,
|
|
535
|
+
...configArg,
|
|
536
|
+
body: arg(z.string().default("{}"), {
|
|
537
|
+
alias: "b",
|
|
538
|
+
description: "Request body as JSON."
|
|
539
|
+
}),
|
|
540
|
+
field: arg(fieldArg.array().optional(), {
|
|
541
|
+
alias: "f",
|
|
542
|
+
description: "Set a body field as `key=value` (repeatable; dotted keys nest). Overrides --body.",
|
|
543
|
+
completion: { custom: { expand: {
|
|
544
|
+
dependsOn: ["endpoint"],
|
|
545
|
+
enumerate: ({ endpoint }) => enumerateAllFieldCompletions(extractMethodName(endpoint ?? ""))
|
|
546
|
+
} } }
|
|
547
|
+
}),
|
|
548
|
+
endpoint: arg(z.string(), {
|
|
549
|
+
positional: true,
|
|
550
|
+
description: "API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').",
|
|
551
|
+
completion: { custom: { choices: listMethodChoices() } }
|
|
552
|
+
})
|
|
553
|
+
}).strict(),
|
|
554
|
+
run: async (args) => {
|
|
555
|
+
await assertWritable({ profile: args.profile });
|
|
556
|
+
const methodName = extractMethodName(args.endpoint);
|
|
557
|
+
const method = getMethodDescriptor(methodName);
|
|
558
|
+
const parsedBody = parseBodyAsObject(args.body);
|
|
559
|
+
let mutated = false;
|
|
560
|
+
if (args.field && args.field.length > 0) {
|
|
561
|
+
if (!parsedBody) throw new Error("--field requires --body to be a JSON object (or omitted).");
|
|
562
|
+
for (const f of args.field) {
|
|
563
|
+
const leaf = method ? resolveLeafField(method.input, f.path) : void 0;
|
|
564
|
+
setNestedPath(parsedBody, f.path, coerceFieldValue(leaf, f.value));
|
|
565
|
+
}
|
|
566
|
+
mutated = true;
|
|
567
|
+
}
|
|
568
|
+
if (parsedBody && method) {
|
|
569
|
+
if (normalizeBodyFieldKeys(parsedBody, method.input.fields)) mutated = true;
|
|
570
|
+
const fieldNames = method.input.fields.map((f) => f.localName);
|
|
571
|
+
if (fieldNames.includes("workspaceId") && !Object.hasOwn(parsedBody, "workspaceId")) try {
|
|
572
|
+
parsedBody.workspaceId = await loadWorkspaceId({
|
|
573
|
+
workspaceId: args["workspace-id"],
|
|
574
|
+
profile: args.profile
|
|
575
|
+
});
|
|
576
|
+
mutated = true;
|
|
577
|
+
} catch {}
|
|
578
|
+
if (fieldNames.includes("namespaceName") && !Object.hasOwn(parsedBody, "namespaceName")) try {
|
|
579
|
+
const { config } = await loadConfig(args.config);
|
|
580
|
+
const ns = resolveNamespaceName(methodName, config);
|
|
581
|
+
if (ns) {
|
|
582
|
+
parsedBody.namespaceName = ns;
|
|
583
|
+
mutated = true;
|
|
584
|
+
}
|
|
585
|
+
} catch {}
|
|
586
|
+
}
|
|
587
|
+
const result = await apiCall({
|
|
588
|
+
profile: args.profile,
|
|
589
|
+
endpoint: args.endpoint,
|
|
590
|
+
body: mutated && parsedBody ? JSON.stringify(parsedBody) : args.body
|
|
591
|
+
});
|
|
592
|
+
logger.out(JSON.stringify(result.data, null, 2));
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
//#endregion
|
|
41
597
|
//#region src/cli/commands/authconnection/args.ts
|
|
42
598
|
/**
|
|
43
599
|
* Arguments for identifying an auth connection
|
|
@@ -512,12 +1068,12 @@ const executorCommand = defineCommand({
|
|
|
512
1068
|
subCommands: {
|
|
513
1069
|
trigger: triggerCommand,
|
|
514
1070
|
jobs: jobsCommand,
|
|
515
|
-
list: listCommand$
|
|
1071
|
+
list: listCommand$7,
|
|
516
1072
|
get: getCommand$1,
|
|
517
1073
|
webhook: webhookCommand
|
|
518
1074
|
},
|
|
519
1075
|
async run() {
|
|
520
|
-
await runCommand(listCommand$
|
|
1076
|
+
await runCommand(listCommand$7, []);
|
|
521
1077
|
}
|
|
522
1078
|
});
|
|
523
1079
|
|
|
@@ -1288,7 +1844,7 @@ async function detectFunctionType(options) {
|
|
|
1288
1844
|
const rawInput = module.default.input;
|
|
1289
1845
|
let inputSchema;
|
|
1290
1846
|
if (rawInput) {
|
|
1291
|
-
const { t } = await import("../types-
|
|
1847
|
+
const { t } = await import("../types-CG9H7HuE.mjs");
|
|
1292
1848
|
inputSchema = t.object(rawInput);
|
|
1293
1849
|
}
|
|
1294
1850
|
return {
|
|
@@ -1650,12 +2206,12 @@ const functionCommand = defineCommand({
|
|
|
1650
2206
|
description: "Manage functions",
|
|
1651
2207
|
subCommands: {
|
|
1652
2208
|
get: getCommand$2,
|
|
1653
|
-
list: listCommand$
|
|
2209
|
+
list: listCommand$8,
|
|
1654
2210
|
logs: logsCommand,
|
|
1655
2211
|
"test-run": testRunCommand
|
|
1656
2212
|
},
|
|
1657
2213
|
async run() {
|
|
1658
|
-
await runCommand(listCommand$
|
|
2214
|
+
await runCommand(listCommand$8, []);
|
|
1659
2215
|
}
|
|
1660
2216
|
});
|
|
1661
2217
|
|
|
@@ -1988,11 +2544,11 @@ const machineuserCommand = defineCommand({
|
|
|
1988
2544
|
name: "machineuser",
|
|
1989
2545
|
description: "Manage machine users in your Tailor Platform application.",
|
|
1990
2546
|
subCommands: {
|
|
1991
|
-
list: listCommand$
|
|
2547
|
+
list: listCommand$9,
|
|
1992
2548
|
token: tokenCommand
|
|
1993
2549
|
},
|
|
1994
2550
|
async run() {
|
|
1995
|
-
await runCommand(listCommand$
|
|
2551
|
+
await runCommand(listCommand$9, []);
|
|
1996
2552
|
}
|
|
1997
2553
|
});
|
|
1998
2554
|
|
|
@@ -2002,11 +2558,11 @@ const oauth2clientCommand = defineCommand({
|
|
|
2002
2558
|
name: "oauth2client",
|
|
2003
2559
|
description: "Manage OAuth2 clients in your Tailor Platform application.",
|
|
2004
2560
|
subCommands: {
|
|
2005
|
-
list: listCommand$
|
|
2561
|
+
list: listCommand$10,
|
|
2006
2562
|
get: getCommand$3
|
|
2007
2563
|
},
|
|
2008
2564
|
async run() {
|
|
2009
|
-
await runCommand(listCommand$
|
|
2565
|
+
await runCommand(listCommand$10, []);
|
|
2010
2566
|
}
|
|
2011
2567
|
});
|
|
2012
2568
|
|
|
@@ -2063,7 +2619,7 @@ const folderCommand = defineCommand({
|
|
|
2063
2619
|
create: createCommand$3,
|
|
2064
2620
|
delete: deleteCommand$4,
|
|
2065
2621
|
get: getCommand$4,
|
|
2066
|
-
list: listCommand$
|
|
2622
|
+
list: listCommand$11,
|
|
2067
2623
|
update: updateCommand$2
|
|
2068
2624
|
}
|
|
2069
2625
|
});
|
|
@@ -2076,12 +2632,12 @@ const organizationCommand = defineCommand({
|
|
|
2076
2632
|
subCommands: {
|
|
2077
2633
|
folder: folderCommand,
|
|
2078
2634
|
get: getCommand$5,
|
|
2079
|
-
list: listCommand$
|
|
2635
|
+
list: listCommand$12,
|
|
2080
2636
|
tree: treeCommand,
|
|
2081
2637
|
update: updateCommand$3
|
|
2082
2638
|
},
|
|
2083
2639
|
async run() {
|
|
2084
|
-
await runCommand(listCommand$
|
|
2640
|
+
await runCommand(listCommand$12, []);
|
|
2085
2641
|
}
|
|
2086
2642
|
});
|
|
2087
2643
|
|
|
@@ -2876,23 +3432,23 @@ function findTarget(lock, kind, workspaceName) {
|
|
|
2876
3432
|
|
|
2877
3433
|
//#endregion
|
|
2878
3434
|
//#region src/cli/commands/setup/action.yml
|
|
2879
|
-
var action_default = "# __HEADER__\nname: __WORKSPACE_NAME__\ndescription: >-\n Deploy __WORKSPACE_NAME__ to Tailor Platform.\n Checkout and dependency installation are expected to be handled by the caller.\n\ninputs:\n workspace-id:\n description: Tailor Platform workspace id\n required: true\n name:\n description: Workspace name (used in Slack notifications)\n required: true\n working-directory:\n description: App directory relative to the repository root\n required: false\n default: \".\"\n config:\n description: SDK config path, or comma-separated config paths for multi-config deploys\n required: false\n default: \"tailor.config.ts\"\n deploy:\n description: Whether to run the Tailor deploy step after build steps\n required: false\n default: \"true\"\n build-site:\n description: Whether to run the static website build slot when present\n required: false\n default: \"true\"\n platform-client-id:\n description: Machine-user client id\n required: true\n platform-client-secret:\n description: Machine-user client secret\n required: true\n slack-token:\n description: Slack bot token\n required: false\n slack-channel-id:\n description: Slack channel id\n required: false\n user-mapping:\n description: JSON string mapping GitHub usernames to Slack user IDs\n required: false\n package-manager:\n description: Package manager used for dependency installation (pnpm, npm, yarn, bun)\n required: false\n default: pnpm\n\noutputs:\n app-url:\n description: Deployed application URL\n value: ${{ steps.tailor-apply.outputs.app-url }}\n\nruns:\n using: composite\n steps:\n # __STATIC_WEBSITE_BUILD_START__\n - id: build-site\n if: inputs.build-site == 'true'\n shell: bash\n run: |\n # Replace with your static website build command.\n # Example: pnpm --filter <package-name> run build:static\n # Note: this run: command is user-editable. Custom build commands are preserved across\n # reruns and are not treated as drift by setup check. Other edits to this file are flagged\n # as drift and will be overwritten if you re-run setup action with --force.\n true\n # __STATIC_WEBSITE_BUILD_END__\n - id: tailor-apply\n if: inputs.deploy == 'true'\n uses: tailor-platform/actions/deploy@
|
|
3435
|
+
var action_default = "# __HEADER__\nname: __WORKSPACE_NAME__\ndescription: >-\n Deploy __WORKSPACE_NAME__ to Tailor Platform.\n Checkout and dependency installation are expected to be handled by the caller.\n\ninputs:\n workspace-id:\n description: Tailor Platform workspace id\n required: true\n name:\n description: Workspace name (used in Slack notifications)\n required: true\n working-directory:\n description: App directory relative to the repository root\n required: false\n default: \".\"\n config:\n description: SDK config path, or comma-separated config paths for multi-config deploys\n required: false\n default: \"tailor.config.ts\"\n deploy:\n description: Whether to run the Tailor deploy step after build steps\n required: false\n default: \"true\"\n build-site:\n description: Whether to run the static website build slot when present\n required: false\n default: \"true\"\n platform-client-id:\n description: Machine-user client id\n required: true\n platform-client-secret:\n description: Machine-user client secret\n required: true\n slack-token:\n description: Slack bot token\n required: false\n slack-channel-id:\n description: Slack channel id\n required: false\n user-mapping:\n description: JSON string mapping GitHub usernames to Slack user IDs\n required: false\n package-manager:\n description: Package manager used for dependency installation (pnpm, npm, yarn, bun)\n required: false\n default: pnpm\n\noutputs:\n app-url:\n description: Deployed application URL\n value: ${{ steps.tailor-apply.outputs.app-url }}\n\nruns:\n using: composite\n steps:\n # __STATIC_WEBSITE_BUILD_START__\n - id: build-site\n if: inputs.build-site == 'true'\n shell: bash\n run: |\n # Replace with your static website build command.\n # Example: pnpm --filter <package-name> run build:static\n # Note: this run: command is user-editable. Custom build commands are preserved across\n # reruns and are not treated as drift by setup check. Other edits to this file are flagged\n # as drift and will be overwritten if you re-run setup action with --force.\n true\n # __STATIC_WEBSITE_BUILD_END__\n - id: tailor-apply\n if: inputs.deploy == 'true'\n uses: tailor-platform/actions/deploy@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n env:\n TAILOR_PLATFORM_SDK_CONFIG_PATH: ${{ inputs.config }}\n with:\n workspace-id: ${{ inputs.workspace-id }}\n working-directory: ${{ inputs.working-directory }}\n package-manager: ${{ inputs.package-manager }}\n platform-client-id: ${{ inputs.platform-client-id }}\n platform-client-secret: ${{ inputs.platform-client-secret }}\n - id: tailor-notify\n if: failure() && inputs.slack-token != '' && inputs.slack-channel-id != ''\n uses: tailor-platform/actions/notify@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n provider: slack\n status: failure\n workspace-name: ${{ inputs.name }}\n slack-token: ${{ inputs.slack-token }}\n slack-channel-id: ${{ inputs.slack-channel-id }}\n user-mapping: ${{ inputs.user-mapping }}\n";
|
|
2880
3436
|
|
|
2881
3437
|
//#endregion
|
|
2882
3438
|
//#region src/cli/commands/setup/branch.workflow.yml
|
|
2883
|
-
var branch_workflow_default = "# __HEADER__\nname: Tailor (__WORKSPACE_NAME__)\n\non:\n # __PULL_REQUEST_START__\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PATHS__\n # __PULL_REQUEST_END__\n push:\n branches: [\"__BRANCH__\"]\n # __PATHS__\n workflow_dispatch:\n # __DISPATCH_INPUTS_START__\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n # __DISPATCH_INPUTS_END__\n\npermissions:\n contents: read\n\njobs:\n # __PLAN_JOB_START__\n tailor-plan:\n if: >-\n github.event_name == 'pull_request' ||\n (github.event_name == 'workflow_dispatch' && inputs['dry-run'])\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n concurrency:\n group: tailor-plan-__WORKSPACE_NAME__-${{ github.event.pull_request.number || github.run_id }}\n cancel-in-progress: true\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-generate-check\n uses: tailor-platform/actions/generate-check@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __SEED_VALIDATE_START__\n - id: tailor-seed-validate\n uses: tailor-platform/actions/seed-validate@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __SEED_VALIDATE_END__\n - id: tailor-drift-check\n uses: tailor-platform/actions/drift-check@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n # __MIGRATION_DRIFT_CHECK_START__\n - id: tailor-migration-drift-check\n uses: tailor-platform/actions/migration-drift-check@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __MIGRATION_DRIFT_CHECK_END__\n - id: tailor-plan\n # Fork PRs cannot read secrets; the checks above still run for them.\n if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork\n uses: tailor-platform/actions/plan@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n label: __WORKSPACE_NAME__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n # __PLAN_JOB_END__\n # __ERD_PREVIEW_JOB_START__\n tailor-erd-preview-matrix:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: 5\n permissions:\n contents: read\n outputs:\n namespaces: ${{ steps.tailor-erd-preview-matrix.outputs.namespaces }}\n base-app-dir: ${{ steps.tailor-erd-preview-matrix.outputs['base-app-dir'] }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n persist-credentials: false\n - id: tailor-checkout-base\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n repository: ${{ github.event.pull_request.base.repo.full_name }}\n ref: ${{ github.event.pull_request.base.sha }}\n path: .tailor-erd-base\n persist-credentials: false\n - id: tailor-erd-preview-matrix\n shell: bash\n env:\n APP_DIR: \"__APP_DIR__\"\n WORKSPACE_NAME: \"__WORKSPACE_NAME__\"\n run: |\n set -euo pipefail\n node <<'NODE'\n const fs = require(\"node:fs\");\n\n const appDir = process.env.APP_DIR || \".\";\n const workspaceName = process.env.WORKSPACE_NAME;\n const output = process.env.GITHUB_OUTPUT;\n const dirPattern = /^[A-Za-z0-9._/-]+$/;\n const namespacePattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\n\n function lockTarget(file) {\n try {\n const lock = JSON.parse(fs.readFileSync(file, \"utf8\"));\n return lock.targets?.find(\n (candidate) =>\n candidate.kind === \"branch\" &&\n candidate.workspaceName === workspaceName,\n );\n } catch (error) {\n if (error && error.code === \"ENOENT\") return undefined;\n throw error;\n }\n }\n\n function namespacesFromTarget(target, label) {\n const namespaces =\n target?.inputs?.erdPreview === true && Array.isArray(target.inputs?.erdNamespaces)\n ? target.inputs.erdNamespaces\n : [];\n for (const namespace of namespaces) {\n if (typeof namespace !== \"string\" || !namespacePattern.test(namespace)) {\n throw new Error(`Invalid ERD namespace in ${label}: ${String(namespace)}`);\n }\n }\n return namespaces;\n }\n\n function normalizeDir(value, label) {\n const raw = typeof value === \"string\" && value.length > 0 ? value : appDir;\n const normalized =\n raw.replaceAll(\"\\\\\", \"/\").replace(/\\/{2,}/g, \"/\").replace(/^\\.\\//, \"\").replace(/\\/$/, \"\") ||\n \".\";\n if (\n !dirPattern.test(normalized) ||\n normalized.startsWith(\"/\") ||\n normalized.split(\"/\").includes(\"..\")\n ) {\n throw new Error(`Invalid ERD app dir in ${label}: ${raw}`);\n }\n return normalized;\n }\n\n const headTarget = lockTarget(\".github/tailor-sdk.lock\");\n const baseTarget = lockTarget(\".tailor-erd-base/.github/tailor-sdk.lock\");\n const baseAppDir = normalizeDir(baseTarget?.inputs?.dir, \"base setup lock\");\n const namespaces = [\n ...new Set([\n ...namespacesFromTarget(headTarget, \"head setup lock\"),\n ...namespacesFromTarget(baseTarget, \"base setup lock\"),\n ]),\n ].sort((a, b) => a.localeCompare(b));\n\n if (namespaces.length === 0) {\n console.error(\"No ERD preview namespaces found in the head or base setup lock.\");\n process.exit(1);\n }\n\n fs.appendFileSync(output, `namespaces=${JSON.stringify(namespaces)}\\n`);\n fs.appendFileSync(output, `base-app-dir=${baseAppDir}\\n`);\n NODE\n\n tailor-erd-preview:\n needs: tailor-erd-preview-matrix\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: 15\n permissions:\n contents: read\n strategy:\n fail-fast: false\n matrix:\n namespace: ${{ fromJSON(needs.tailor-erd-preview-matrix.outputs.namespaces) }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n persist-credentials: false\n - id: tailor-setup\n uses: tailor-platform/actions/setup@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-checkout-base\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n repository: ${{ github.event.pull_request.base.repo.full_name }}\n ref: ${{ github.event.pull_request.base.sha }}\n path: .tailor-erd-base\n persist-credentials: false\n - id: tailor-detect-base-package-manager\n shell: bash\n run: |\n set -euo pipefail\n cd .tailor-erd-base\n base_package_manager=\"$(\n if [ -f pnpm-lock.yaml ]; then\n echo pnpm\n elif [ -f yarn.lock ]; then\n echo yarn\n elif [ -f bun.lockb ] || [ -f bun.lock ]; then\n echo bun\n elif [ -f package-lock.json ]; then\n echo npm\n else\n echo \"__PACKAGE_MANAGER__\"\n fi\n )\"\n echo \"package-manager=$base_package_manager\" >> \"$GITHUB_OUTPUT\"\n if [ \"$base_package_manager\" = \"pnpm\" ]; then\n base_pnpm_version=\"$(node <<'NODE'\n const fs = require(\"node:fs\");\n\n const fallback = \"10\";\n\n function readManifest(file) {\n try {\n return JSON.parse(fs.readFileSync(file, \"utf8\"));\n } catch {\n return {};\n }\n }\n\n function pnpmVersion(manifest) {\n const packageManager = manifest.packageManager;\n if (typeof packageManager === \"string\" && packageManager.startsWith(\"pnpm@\")) {\n return packageManager.slice(\"pnpm@\".length).split(\"+\")[0];\n }\n\n const devPackageManager = manifest.devEngines?.packageManager;\n if (devPackageManager?.name === \"pnpm\" && devPackageManager.version) {\n return devPackageManager.version;\n }\n\n return undefined;\n }\n\n process.stdout.write(\n pnpmVersion(readManifest(\"package.json\")) ?? fallback,\n );\n NODE\n )\"\n echo \"pnpm-version=$base_pnpm_version\" >> \"$GITHUB_OUTPUT\"\n fi\n - id: tailor-setup-base-pnpm\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] == 'pnpm'\n uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9\n with:\n version: ${{ steps.tailor-detect-base-package-manager.outputs['pnpm-version'] }}\n package_json_file: .tailor-erd-base/package.json\n run_install: false\n - id: tailor-setup-base-node\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] != 'bun'\n uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version-file: .tailor-erd-base/package.json\n - id: tailor-setup-base-yarn\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] == 'yarn'\n shell: bash\n working-directory: .tailor-erd-base\n run: |\n set -euo pipefail\n corepack enable\n - id: tailor-setup-base-bun\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] == 'bun'\n uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0\n - id: tailor-install-base\n shell: bash\n working-directory: .tailor-erd-base\n env:\n BASE_PACKAGE_MANAGER: ${{ steps.tailor-detect-base-package-manager.outputs['package-manager'] }}\n run: |\n set -euo pipefail\n case \"$BASE_PACKAGE_MANAGER\" in\n pnpm) pnpm install --frozen-lockfile ;;\n npm) npm ci ;;\n yarn)\n if grep -q '^__metadata:' yarn.lock; then\n yarn install --immutable\n else\n yarn install --frozen-lockfile\n fi\n ;;\n bun) bun install --frozen-lockfile ;;\n *)\n echo \"::error::Unsupported base package-manager '$BASE_PACKAGE_MANAGER' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n - id: tailor-restore-head-setup\n uses: tailor-platform/actions/setup@7817f37adf2891fbb2ebbe0a3b222a5fa2ed0c1f # v1.3.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-build-erd-preview\n shell: bash\n env:\n APP_DIR: \"__APP_DIR__\"\n BASE_APP_DIR: ${{ needs.tailor-erd-preview-matrix.outputs['base-app-dir'] }}\n BASE_PACKAGE_MANAGER: ${{ steps.tailor-detect-base-package-manager.outputs['package-manager'] }}\n NAMESPACE: ${{ matrix.namespace }}\n run: |\n set -euo pipefail\n\n run_tailor_sdk() {\n case \"__PACKAGE_MANAGER__\" in\n pnpm) pnpm exec tailor-sdk \"$@\" ;;\n npm) npx tailor-sdk \"$@\" ;;\n yarn) yarn tailor-sdk \"$@\" ;;\n bun) bunx tailor-sdk \"$@\" ;;\n *)\n echo \"::error::Unsupported package-manager '__PACKAGE_MANAGER__' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n }\n\n run_head_node() {\n case \"__PACKAGE_MANAGER__\" in\n pnpm) pnpm exec node \"$@\" ;;\n npm) node \"$@\" ;;\n yarn) yarn node \"$@\" ;;\n bun) node \"$@\" ;;\n *)\n echo \"::error::Unsupported package-manager '__PACKAGE_MANAGER__' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n }\n\n tailor_sdk_bin=\"$(\n run_head_node - <<'NODE'\n const path = require(\"node:path\");\n const { createRequire } = require(\"node:module\");\n const appDir = process.env.APP_DIR || \".\";\n const githubWorkspace = process.env.GITHUB_WORKSPACE;\n if (!githubWorkspace) {\n throw new Error(\"GITHUB_WORKSPACE is required.\");\n }\n\n let lastError;\n for (const manifestPath of [\n path.join(githubWorkspace, appDir, \"package.json\"),\n path.join(githubWorkspace, \"package.json\"),\n ]) {\n try {\n const requireFromManifest = createRequire(manifestPath);\n process.stdout.write(\n path.join(\n path.dirname(requireFromManifest.resolve(\"@tailor-platform/sdk/cli\")),\n \"index.mjs\",\n ),\n );\n process.exit(0);\n } catch (error) {\n lastError = error;\n }\n }\n throw lastError || new Error(\"Failed to resolve @tailor-platform/sdk/cli.\");\n NODE\n )\"\n\n run_head_tailor_sdk_bin() {\n local command_cwd=\"$1\"\n shift\n\n run_head_cli_env() {\n env TAILOR_SDK_BIN=\"$tailor_sdk_bin\" TAILOR_SDK_CWD=\"$command_cwd\" \"$@\"\n }\n\n (\n cd \"$GITHUB_WORKSPACE\" || exit 1\n case \"__PACKAGE_MANAGER__\" in\n pnpm) run_head_cli_env pnpm exec node \"$head_cli_runner\" \"$@\" ;;\n npm) run_head_cli_env node \"$head_cli_runner\" \"$@\" ;;\n yarn) run_head_cli_env yarn node \"$head_cli_runner\" \"$@\" ;;\n bun) run_head_cli_env bun \"$head_cli_runner\" \"$@\" ;;\n *)\n echo \"::error::Unsupported package-manager '__PACKAGE_MANAGER__' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n )\n }\n\n run_base_tailor_sdk_bin() {\n local command_cwd=\"$1\"\n shift\n\n run_head_cli_env() {\n env TAILOR_SDK_BIN=\"$tailor_sdk_bin\" TAILOR_SDK_CWD=\"$command_cwd\" \"$@\"\n }\n\n (\n cd \"$command_cwd\" || exit 1\n case \"$BASE_PACKAGE_MANAGER\" in\n pnpm) run_head_cli_env pnpm exec node \"$head_cli_runner\" \"$@\" ;;\n npm) run_head_cli_env node \"$head_cli_runner\" \"$@\" ;;\n yarn) run_head_cli_env yarn node \"$head_cli_runner\" \"$@\" ;;\n bun) run_head_cli_env bun \"$head_cli_runner\" \"$@\" ;;\n *)\n echo \"::error::Unsupported base package-manager '$BASE_PACKAGE_MANAGER' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n )\n }\n\n head_output=\"$RUNNER_TEMP/tailor-erd/head\"\n base_output=\"$RUNNER_TEMP/tailor-erd/base\"\n preview_output=\"$RUNNER_TEMP/tailor-erd/preview\"\n dts_output=\"$RUNNER_TEMP/tailor-erd/dts\"\n head_cli_runner=\"$RUNNER_TEMP/tailor-erd/run-head-tailor-sdk.mjs\"\n head_log=\"$RUNNER_TEMP/tailor-erd/head-$NAMESPACE.log\"\n base_log=\"$RUNNER_TEMP/tailor-erd/base-$NAMESPACE.log\"\n rm -rf \"$head_output\" \"$base_output\" \"$preview_output\" \"$dts_output\"\n mkdir -p \"$head_output\" \"$base_output\" \"$preview_output\" \"$dts_output\"\n cat > \"$head_cli_runner\" <<'NODE'\n import { pathToFileURL } from \"node:url\";\n\n const cliBin = process.env.TAILOR_SDK_BIN;\n const commandCwd = process.env.TAILOR_SDK_CWD;\n if (!cliBin || !commandCwd) {\n throw new Error(\"TAILOR_SDK_BIN and TAILOR_SDK_CWD are required.\");\n }\n\n process.chdir(commandCwd);\n process.argv = [process.argv[0], cliBin, ...process.argv.slice(2)];\n await import(pathToFileURL(cliBin).href);\n NODE\n\n head_config=\"$GITHUB_WORKSPACE/$APP_DIR/tailor.config.ts\"\n base_config=\"$GITHUB_WORKSPACE/.tailor-erd-base/$BASE_APP_DIR/tailor.config.ts\"\n head_html=\"$head_output/$NAMESPACE/dist/index.html\"\n base_html=\"$base_output/$NAMESPACE/dist/index.html\"\n preview_html=\"$preview_output/$NAMESPACE-viewer.html\"\n\n head_missing=\"false\"\n if [ ! -f \"$head_config\" ]; then\n echo \"Head ERD config not found; rendering base objects as removed.\"\n head_missing=\"true\"\n elif ! (\n cd \"$GITHUB_WORKSPACE/$APP_DIR\" || exit 1\n TAILOR_PLATFORM_SDK_DTS_PATH=\"$dts_output/head-$NAMESPACE.d.ts\" \\\n run_tailor_sdk tailordb erd export --config \"$head_config\" --namespace \"$NAMESPACE\" --output \"$head_output\"\n ) >\"$head_log\" 2>&1; then\n if grep -q 'not found in local config.db' \"$head_log\"; then\n cat \"$head_log\"\n echo \"Head ERD namespace '$NAMESPACE' not found; rendering base objects as removed.\"\n head_missing=\"true\"\n else\n cat \"$head_log\"\n exit 1\n fi\n elif [ -s \"$head_log\" ]; then\n cat \"$head_log\"\n fi\n\n base_missing=\"false\"\n if [ ! -f \"$base_config\" ]; then\n echo \"Base ERD config not found; rendering current objects as added.\"\n base_missing=\"true\"\n elif ! (\n TAILOR_PLATFORM_SDK_DTS_PATH=\"$dts_output/base-$NAMESPACE.d.ts\" \\\n run_base_tailor_sdk_bin \"$GITHUB_WORKSPACE/.tailor-erd-base/$BASE_APP_DIR\" tailordb erd export --config \"$base_config\" --namespace \"$NAMESPACE\" --output \"$base_output\"\n ) >\"$base_log\" 2>&1; then\n if grep -q 'not found in local config.db' \"$base_log\"; then\n cat \"$base_log\"\n echo \"Base ERD namespace '$NAMESPACE' not found; rendering current objects as added.\"\n base_missing=\"true\"\n else\n cat \"$base_log\"\n exit 1\n fi\n elif [ -s \"$base_log\" ]; then\n cat \"$base_log\"\n fi\n\n if [ \"$head_missing\" = \"true\" ] && [ \"$base_missing\" = \"true\" ]; then\n echo \"::error::ERD namespace '$NAMESPACE' was not found in head or base.\"\n exit 1\n fi\n if [ \"$head_missing\" = \"false\" ] && [ ! -f \"$head_html\" ]; then\n echo \"::error::Head ERD viewer was not generated at $head_html\"\n exit 1\n fi\n if [ \"$base_missing\" = \"false\" ] && [ ! -f \"$base_html\" ]; then\n echo \"::error::Base ERD viewer was not generated at $base_html\"\n exit 1\n fi\n\n diff_args=(--namespace \"$NAMESPACE\" --output \"$preview_html\")\n if [ \"$head_missing\" = \"false\" ]; then\n diff_args+=(--head-html \"$head_html\")\n fi\n if [ \"$base_missing\" = \"false\" ]; then\n diff_args+=(--base-html \"$base_html\")\n fi\n run_head_tailor_sdk_bin \"$GITHUB_WORKSPACE\" tailordb erd diff \"${diff_args[@]}\"\n - id: tailor-upload-erd-viewer\n uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1\n with:\n name: ${{ matrix.namespace }}-viewer.html\n path: ${{ runner.temp }}/tailor-erd/preview/${{ matrix.namespace }}-viewer.html\n if-no-files-found: error\n archive: false\n retention-days: 7\n\n # __ERD_PREVIEW_JOB_END__\n # __ERD_PREVIEW_COMMENT_JOB_START__\n tailor-erd-preview-comment:\n needs: tailor-erd-preview\n if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository\n runs-on: ubuntu-latest\n timeout-minutes: 5\n permissions:\n actions: read\n pull-requests: write\n steps:\n - id: tailor-comment-erd-preview\n env:\n GH_TOKEN: ${{ github.token }}\n REPO: ${{ github.repository }}\n RUN_ID: ${{ github.run_id }}\n SERVER: ${{ github.server_url }}\n PR_NUMBER: ${{ github.event.pull_request.number }}\n BASE_REF: ${{ github.event.pull_request.base.ref }}\n HEAD_SHA: ${{ github.event.pull_request.head.sha }}\n MARKER: \"<!-- tailor-erd-preview: __WORKSPACE_NAME__ -->\"\n run: |\n set -euo pipefail\n\n current_head=$(gh api \"repos/$REPO/pulls/$PR_NUMBER\" --jq '.head.sha')\n if [ \"$current_head\" != \"$HEAD_SHA\" ]; then\n echo \"Skipping stale ERD preview comment for $HEAD_SHA; current head is $current_head.\"\n exit 0\n fi\n\n body=\"$MARKER\"$'\\n'\"### TailorDB ERD preview (__WORKSPACE_NAME__)\"$'\\n\\n'\n body+=\"Self-contained ERD viewer HTML artifacts for this pull request. Each viewer can switch between the current schema and a diff against base branch \\`$BASE_REF\\`.\"$'\\n'\n\n while IFS=$'\\t' read -r name id; do\n [ -z \"$name\" ] && continue\n if [[ \"$name\" != *-viewer.html ]]; then\n continue\n fi\n ns=${name%-viewer.html}\n label=\"$ns viewer\"\n body+=$'\\n'\"- **$label**: [$name]($SERVER/$REPO/actions/runs/$RUN_ID/artifacts/$id)\"\n done < <(gh api \"repos/$REPO/actions/runs/$RUN_ID/artifacts\" --paginate \\\n --jq '.artifacts[] | select(.name | endswith(\"-viewer.html\")) | [.name, (.id|tostring)] | @tsv' | sort)\n\n existing=$(gh api \"repos/$REPO/issues/$PR_NUMBER/comments\" --paginate \\\n --jq 'map(select(.body | contains(env.MARKER))) | .[0].id // empty')\n if [ -n \"$existing\" ]; then\n gh api --method PATCH \"repos/$REPO/issues/comments/$existing\" -f body=\"$body\" >/dev/null\n else\n gh api --method POST \"repos/$REPO/issues/$PR_NUMBER/comments\" -f body=\"$body\" >/dev/null\n fi\n\n # __ERD_PREVIEW_COMMENT_JOB_END__\n tailor-deploy:\n # __DEPLOY_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n permissions:\n contents: read\n environment: __ENVIRONMENT__\n concurrency:\n group: tailor-deploy-__WORKSPACE_NAME__\n cancel-in-progress: false\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-apply\n uses: tailor-platform/actions/deploy@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n # __SEED_DATA_START__\n - id: seed-data\n if: false\n shell: bash\n # __WORKING_DIRECTORY__\n run: |\n # Uncomment and implement to seed data on deploy.\n # Run after apply so the schema is ready.\n # Example: node scripts/seed.mjs\n true\n # __SEED_DATA_END__\n - id: slack-prereq\n if: always()\n shell: bash\n env:\n SLACK_TOKEN: ${{ secrets.TAILOR_SLACK_BOT_TOKEN }}\n SLACK_CHANNEL_ID: ${{ vars.TAILOR_SLACK_CHANNEL_ID }}\n run: |\n if [[ -n \"$SLACK_TOKEN\" && -n \"$SLACK_CHANNEL_ID\" ]]; then\n echo \"ready=true\" >> \"$GITHUB_OUTPUT\"\n fi\n - id: tailor-notify\n if: always() && steps.slack-prereq.outputs.ready == 'true'\n uses: tailor-platform/actions/notify@e74173d4bdd931d036ad359cf5f7729fc6aa7067 # v1.5.1\n with:\n provider: slack\n status: ${{ job.status }}\n workspace-name: __WORKSPACE_NAME__\n slack-token: ${{ secrets.TAILOR_SLACK_BOT_TOKEN }}\n slack-channel-id: ${{ vars.TAILOR_SLACK_CHANNEL_ID }}\n # user-mapping: ${{ vars.TAILOR_SLACK_USER_MAPPING }}\n";
|
|
3439
|
+
var branch_workflow_default = "# __HEADER__\nname: Tailor (__WORKSPACE_NAME__)\n\non:\n # __PULL_REQUEST_START__\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PATHS__\n # __PULL_REQUEST_END__\n push:\n branches: [\"__BRANCH__\"]\n # __PATHS__\n workflow_dispatch:\n # __DISPATCH_INPUTS_START__\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n # __DISPATCH_INPUTS_END__\n\npermissions:\n contents: read\n\njobs:\n # __PLAN_JOB_START__\n tailor-plan:\n if: >-\n github.event_name == 'pull_request' ||\n (github.event_name == 'workflow_dispatch' && inputs['dry-run'])\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n concurrency:\n group: tailor-plan-__WORKSPACE_NAME__-${{ github.event.pull_request.number || github.run_id }}\n cancel-in-progress: true\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-generate-check\n uses: tailor-platform/actions/generate-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __SEED_VALIDATE_START__\n - id: tailor-seed-validate\n uses: tailor-platform/actions/seed-validate@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __SEED_VALIDATE_END__\n - id: tailor-drift-check\n uses: tailor-platform/actions/drift-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __MIGRATION_DRIFT_CHECK_START__\n - id: tailor-migration-drift-check\n uses: tailor-platform/actions/migration-drift-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __MIGRATION_DRIFT_CHECK_END__\n - id: tailor-plan\n # Fork PRs cannot read secrets; the checks above still run for them.\n if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork\n uses: tailor-platform/actions/plan@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n label: __WORKSPACE_NAME__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n # __PLAN_JOB_END__\n # __ERD_PREVIEW_JOB_START__\n tailor-erd-preview-matrix:\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: 5\n permissions:\n contents: read\n outputs:\n namespaces: ${{ steps.tailor-erd-preview-matrix.outputs.namespaces }}\n base-app-dir: ${{ steps.tailor-erd-preview-matrix.outputs['base-app-dir'] }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n persist-credentials: false\n - id: tailor-checkout-base\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n repository: ${{ github.event.pull_request.base.repo.full_name }}\n ref: ${{ github.event.pull_request.base.sha }}\n path: .tailor-erd-base\n persist-credentials: false\n - id: tailor-erd-preview-matrix\n shell: bash\n env:\n APP_DIR: \"__APP_DIR__\"\n WORKSPACE_NAME: \"__WORKSPACE_NAME__\"\n run: |\n set -euo pipefail\n node <<'NODE'\n const fs = require(\"node:fs\");\n\n const appDir = process.env.APP_DIR || \".\";\n const workspaceName = process.env.WORKSPACE_NAME;\n const output = process.env.GITHUB_OUTPUT;\n const dirPattern = /^[A-Za-z0-9._/-]+$/;\n const namespacePattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\n\n function lockTarget(file) {\n try {\n const lock = JSON.parse(fs.readFileSync(file, \"utf8\"));\n return lock.targets?.find(\n (candidate) =>\n candidate.kind === \"branch\" &&\n candidate.workspaceName === workspaceName,\n );\n } catch (error) {\n if (error && error.code === \"ENOENT\") return undefined;\n throw error;\n }\n }\n\n function namespacesFromTarget(target, label) {\n const namespaces =\n target?.inputs?.erdPreview === true && Array.isArray(target.inputs?.erdNamespaces)\n ? target.inputs.erdNamespaces\n : [];\n for (const namespace of namespaces) {\n if (typeof namespace !== \"string\" || !namespacePattern.test(namespace)) {\n throw new Error(`Invalid ERD namespace in ${label}: ${String(namespace)}`);\n }\n }\n return namespaces;\n }\n\n function normalizeDir(value, label) {\n const raw = typeof value === \"string\" && value.length > 0 ? value : appDir;\n const normalized =\n raw.replaceAll(\"\\\\\", \"/\").replace(/\\/{2,}/g, \"/\").replace(/^\\.\\//, \"\").replace(/\\/$/, \"\") ||\n \".\";\n if (\n !dirPattern.test(normalized) ||\n normalized.startsWith(\"/\") ||\n normalized.split(\"/\").includes(\"..\")\n ) {\n throw new Error(`Invalid ERD app dir in ${label}: ${raw}`);\n }\n return normalized;\n }\n\n const headTarget = lockTarget(\".github/tailor-sdk.lock\");\n const baseTarget = lockTarget(\".tailor-erd-base/.github/tailor-sdk.lock\");\n const baseAppDir = normalizeDir(baseTarget?.inputs?.dir, \"base setup lock\");\n const namespaces = [\n ...new Set([\n ...namespacesFromTarget(headTarget, \"head setup lock\"),\n ...namespacesFromTarget(baseTarget, \"base setup lock\"),\n ]),\n ].sort((a, b) => a.localeCompare(b));\n\n if (namespaces.length === 0) {\n console.error(\"No ERD preview namespaces found in the head or base setup lock.\");\n process.exit(1);\n }\n\n fs.appendFileSync(output, `namespaces=${JSON.stringify(namespaces)}\\n`);\n fs.appendFileSync(output, `base-app-dir=${baseAppDir}\\n`);\n NODE\n\n tailor-erd-preview:\n needs: tailor-erd-preview-matrix\n if: github.event_name == 'pull_request'\n runs-on: ubuntu-latest\n timeout-minutes: 15\n permissions:\n contents: read\n strategy:\n fail-fast: false\n matrix:\n namespace: ${{ fromJSON(needs.tailor-erd-preview-matrix.outputs.namespaces) }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n persist-credentials: false\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-checkout-base\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n repository: ${{ github.event.pull_request.base.repo.full_name }}\n ref: ${{ github.event.pull_request.base.sha }}\n path: .tailor-erd-base\n persist-credentials: false\n - id: tailor-detect-base-package-manager\n shell: bash\n run: |\n set -euo pipefail\n cd .tailor-erd-base\n base_package_manager=\"$(\n if [ -f pnpm-lock.yaml ]; then\n echo pnpm\n elif [ -f yarn.lock ]; then\n echo yarn\n elif [ -f bun.lockb ] || [ -f bun.lock ]; then\n echo bun\n elif [ -f package-lock.json ]; then\n echo npm\n else\n echo \"__PACKAGE_MANAGER__\"\n fi\n )\"\n echo \"package-manager=$base_package_manager\" >> \"$GITHUB_OUTPUT\"\n if [ \"$base_package_manager\" = \"pnpm\" ]; then\n base_pnpm_version=\"$(node <<'NODE'\n const fs = require(\"node:fs\");\n\n const fallback = \"10\";\n\n function readManifest(file) {\n try {\n return JSON.parse(fs.readFileSync(file, \"utf8\"));\n } catch {\n return {};\n }\n }\n\n function pnpmVersion(manifest) {\n const packageManager = manifest.packageManager;\n if (typeof packageManager === \"string\" && packageManager.startsWith(\"pnpm@\")) {\n return packageManager.slice(\"pnpm@\".length).split(\"+\")[0];\n }\n\n const devPackageManager = manifest.devEngines?.packageManager;\n if (devPackageManager?.name === \"pnpm\" && devPackageManager.version) {\n return devPackageManager.version;\n }\n\n return undefined;\n }\n\n process.stdout.write(\n pnpmVersion(readManifest(\"package.json\")) ?? fallback,\n );\n NODE\n )\"\n echo \"pnpm-version=$base_pnpm_version\" >> \"$GITHUB_OUTPUT\"\n fi\n - id: tailor-setup-base-pnpm\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] == 'pnpm'\n uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9\n with:\n version: ${{ steps.tailor-detect-base-package-manager.outputs['pnpm-version'] }}\n package_json_file: .tailor-erd-base/package.json\n run_install: false\n - id: tailor-setup-base-node\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] != 'bun'\n uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version-file: .tailor-erd-base/package.json\n - id: tailor-setup-base-yarn\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] == 'yarn'\n shell: bash\n working-directory: .tailor-erd-base\n run: |\n set -euo pipefail\n corepack enable\n - id: tailor-setup-base-bun\n if: steps.tailor-detect-base-package-manager.outputs['package-manager'] == 'bun'\n uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0\n - id: tailor-install-base\n shell: bash\n working-directory: .tailor-erd-base\n env:\n BASE_PACKAGE_MANAGER: ${{ steps.tailor-detect-base-package-manager.outputs['package-manager'] }}\n run: |\n set -euo pipefail\n case \"$BASE_PACKAGE_MANAGER\" in\n pnpm) pnpm install --frozen-lockfile ;;\n npm) npm ci ;;\n yarn)\n if grep -q '^__metadata:' yarn.lock; then\n yarn install --immutable\n else\n yarn install --frozen-lockfile\n fi\n ;;\n bun) bun install --frozen-lockfile ;;\n *)\n echo \"::error::Unsupported base package-manager '$BASE_PACKAGE_MANAGER' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n - id: tailor-restore-head-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-build-erd-preview\n shell: bash\n env:\n APP_DIR: \"__APP_DIR__\"\n BASE_APP_DIR: ${{ needs.tailor-erd-preview-matrix.outputs['base-app-dir'] }}\n BASE_PACKAGE_MANAGER: ${{ steps.tailor-detect-base-package-manager.outputs['package-manager'] }}\n NAMESPACE: ${{ matrix.namespace }}\n run: |\n set -euo pipefail\n\n run_tailor_sdk() {\n case \"__PACKAGE_MANAGER__\" in\n pnpm) pnpm exec tailor-sdk \"$@\" ;;\n npm) npx tailor-sdk \"$@\" ;;\n yarn) yarn tailor-sdk \"$@\" ;;\n bun) bunx tailor-sdk \"$@\" ;;\n *)\n echo \"::error::Unsupported package-manager '__PACKAGE_MANAGER__' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n }\n\n run_head_node() {\n case \"__PACKAGE_MANAGER__\" in\n pnpm) pnpm exec node \"$@\" ;;\n npm) node \"$@\" ;;\n yarn) yarn node \"$@\" ;;\n bun) node \"$@\" ;;\n *)\n echo \"::error::Unsupported package-manager '__PACKAGE_MANAGER__' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n }\n\n tailor_sdk_bin=\"$(\n run_head_node - <<'NODE'\n const path = require(\"node:path\");\n const { createRequire } = require(\"node:module\");\n const appDir = process.env.APP_DIR || \".\";\n const githubWorkspace = process.env.GITHUB_WORKSPACE;\n if (!githubWorkspace) {\n throw new Error(\"GITHUB_WORKSPACE is required.\");\n }\n\n let lastError;\n for (const manifestPath of [\n path.join(githubWorkspace, appDir, \"package.json\"),\n path.join(githubWorkspace, \"package.json\"),\n ]) {\n try {\n const requireFromManifest = createRequire(manifestPath);\n process.stdout.write(\n path.join(\n path.dirname(requireFromManifest.resolve(\"@tailor-platform/sdk/cli\")),\n \"index.mjs\",\n ),\n );\n process.exit(0);\n } catch (error) {\n lastError = error;\n }\n }\n throw lastError || new Error(\"Failed to resolve @tailor-platform/sdk/cli.\");\n NODE\n )\"\n\n run_head_tailor_sdk_bin() {\n local command_cwd=\"$1\"\n shift\n\n run_head_cli_env() {\n env TAILOR_SDK_BIN=\"$tailor_sdk_bin\" TAILOR_SDK_CWD=\"$command_cwd\" \"$@\"\n }\n\n (\n cd \"$GITHUB_WORKSPACE\" || exit 1\n case \"__PACKAGE_MANAGER__\" in\n pnpm) run_head_cli_env pnpm exec node \"$head_cli_runner\" \"$@\" ;;\n npm) run_head_cli_env node \"$head_cli_runner\" \"$@\" ;;\n yarn) run_head_cli_env yarn node \"$head_cli_runner\" \"$@\" ;;\n bun) run_head_cli_env bun \"$head_cli_runner\" \"$@\" ;;\n *)\n echo \"::error::Unsupported package-manager '__PACKAGE_MANAGER__' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n )\n }\n\n run_base_tailor_sdk_bin() {\n local command_cwd=\"$1\"\n shift\n\n run_head_cli_env() {\n env TAILOR_SDK_BIN=\"$tailor_sdk_bin\" TAILOR_SDK_CWD=\"$command_cwd\" \"$@\"\n }\n\n (\n cd \"$command_cwd\" || exit 1\n case \"$BASE_PACKAGE_MANAGER\" in\n pnpm) run_head_cli_env pnpm exec node \"$head_cli_runner\" \"$@\" ;;\n npm) run_head_cli_env node \"$head_cli_runner\" \"$@\" ;;\n yarn) run_head_cli_env yarn node \"$head_cli_runner\" \"$@\" ;;\n bun) run_head_cli_env bun \"$head_cli_runner\" \"$@\" ;;\n *)\n echo \"::error::Unsupported base package-manager '$BASE_PACKAGE_MANAGER' (expected pnpm, npm, yarn, or bun)\"\n exit 1\n ;;\n esac\n )\n }\n\n head_output=\"$RUNNER_TEMP/tailor-erd/head\"\n base_output=\"$RUNNER_TEMP/tailor-erd/base\"\n preview_output=\"$RUNNER_TEMP/tailor-erd/preview\"\n dts_output=\"$RUNNER_TEMP/tailor-erd/dts\"\n head_cli_runner=\"$RUNNER_TEMP/tailor-erd/run-head-tailor-sdk.mjs\"\n head_log=\"$RUNNER_TEMP/tailor-erd/head-$NAMESPACE.log\"\n base_log=\"$RUNNER_TEMP/tailor-erd/base-$NAMESPACE.log\"\n rm -rf \"$head_output\" \"$base_output\" \"$preview_output\" \"$dts_output\"\n mkdir -p \"$head_output\" \"$base_output\" \"$preview_output\" \"$dts_output\"\n cat > \"$head_cli_runner\" <<'NODE'\n import { pathToFileURL } from \"node:url\";\n\n const cliBin = process.env.TAILOR_SDK_BIN;\n const commandCwd = process.env.TAILOR_SDK_CWD;\n if (!cliBin || !commandCwd) {\n throw new Error(\"TAILOR_SDK_BIN and TAILOR_SDK_CWD are required.\");\n }\n\n process.chdir(commandCwd);\n process.argv = [process.argv[0], cliBin, ...process.argv.slice(2)];\n await import(pathToFileURL(cliBin).href);\n NODE\n\n head_config=\"$GITHUB_WORKSPACE/$APP_DIR/tailor.config.ts\"\n base_config=\"$GITHUB_WORKSPACE/.tailor-erd-base/$BASE_APP_DIR/tailor.config.ts\"\n head_html=\"$head_output/$NAMESPACE/dist/index.html\"\n base_html=\"$base_output/$NAMESPACE/dist/index.html\"\n preview_html=\"$preview_output/$NAMESPACE-viewer.html\"\n\n head_missing=\"false\"\n if [ ! -f \"$head_config\" ]; then\n echo \"Head ERD config not found; rendering base objects as removed.\"\n head_missing=\"true\"\n elif ! (\n cd \"$GITHUB_WORKSPACE/$APP_DIR\" || exit 1\n TAILOR_PLATFORM_SDK_DTS_PATH=\"$dts_output/head-$NAMESPACE.d.ts\" \\\n run_tailor_sdk tailordb erd export --config \"$head_config\" --namespace \"$NAMESPACE\" --output \"$head_output\"\n ) >\"$head_log\" 2>&1; then\n if grep -q 'not found in local config.db' \"$head_log\"; then\n cat \"$head_log\"\n echo \"Head ERD namespace '$NAMESPACE' not found; rendering base objects as removed.\"\n head_missing=\"true\"\n else\n cat \"$head_log\"\n exit 1\n fi\n elif [ -s \"$head_log\" ]; then\n cat \"$head_log\"\n fi\n\n base_missing=\"false\"\n if [ ! -f \"$base_config\" ]; then\n echo \"Base ERD config not found; rendering current objects as added.\"\n base_missing=\"true\"\n elif ! (\n TAILOR_PLATFORM_SDK_DTS_PATH=\"$dts_output/base-$NAMESPACE.d.ts\" \\\n run_base_tailor_sdk_bin \"$GITHUB_WORKSPACE/.tailor-erd-base/$BASE_APP_DIR\" tailordb erd export --config \"$base_config\" --namespace \"$NAMESPACE\" --output \"$base_output\"\n ) >\"$base_log\" 2>&1; then\n if grep -q 'not found in local config.db' \"$base_log\"; then\n cat \"$base_log\"\n echo \"Base ERD namespace '$NAMESPACE' not found; rendering current objects as added.\"\n base_missing=\"true\"\n else\n cat \"$base_log\"\n exit 1\n fi\n elif [ -s \"$base_log\" ]; then\n cat \"$base_log\"\n fi\n\n if [ \"$head_missing\" = \"true\" ] && [ \"$base_missing\" = \"true\" ]; then\n echo \"::error::ERD namespace '$NAMESPACE' was not found in head or base.\"\n exit 1\n fi\n if [ \"$head_missing\" = \"false\" ] && [ ! -f \"$head_html\" ]; then\n echo \"::error::Head ERD viewer was not generated at $head_html\"\n exit 1\n fi\n if [ \"$base_missing\" = \"false\" ] && [ ! -f \"$base_html\" ]; then\n echo \"::error::Base ERD viewer was not generated at $base_html\"\n exit 1\n fi\n\n diff_args=(--namespace \"$NAMESPACE\" --output \"$preview_html\")\n if [ \"$head_missing\" = \"false\" ]; then\n diff_args+=(--head-html \"$head_html\")\n fi\n if [ \"$base_missing\" = \"false\" ]; then\n diff_args+=(--base-html \"$base_html\")\n fi\n run_head_tailor_sdk_bin \"$GITHUB_WORKSPACE\" tailordb erd diff \"${diff_args[@]}\"\n - id: tailor-upload-erd-viewer\n uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1\n with:\n name: ${{ matrix.namespace }}-viewer.html\n path: ${{ runner.temp }}/tailor-erd/preview/${{ matrix.namespace }}-viewer.html\n if-no-files-found: error\n archive: false\n retention-days: 7\n\n # __ERD_PREVIEW_JOB_END__\n # __ERD_PREVIEW_COMMENT_JOB_START__\n tailor-erd-preview-comment:\n needs: tailor-erd-preview\n if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository\n runs-on: ubuntu-latest\n timeout-minutes: 5\n permissions:\n actions: read\n pull-requests: write\n steps:\n - id: tailor-comment-erd-preview\n env:\n GH_TOKEN: ${{ github.token }}\n REPO: ${{ github.repository }}\n RUN_ID: ${{ github.run_id }}\n SERVER: ${{ github.server_url }}\n PR_NUMBER: ${{ github.event.pull_request.number }}\n BASE_REF: ${{ github.event.pull_request.base.ref }}\n HEAD_SHA: ${{ github.event.pull_request.head.sha }}\n MARKER: \"<!-- tailor-erd-preview: __WORKSPACE_NAME__ -->\"\n run: |\n set -euo pipefail\n\n current_head=$(gh api \"repos/$REPO/pulls/$PR_NUMBER\" --jq '.head.sha')\n if [ \"$current_head\" != \"$HEAD_SHA\" ]; then\n echo \"Skipping stale ERD preview comment for $HEAD_SHA; current head is $current_head.\"\n exit 0\n fi\n\n body=\"$MARKER\"$'\\n'\"### TailorDB ERD preview (__WORKSPACE_NAME__)\"$'\\n\\n'\n body+=\"Self-contained ERD viewer HTML artifacts for this pull request. Each viewer can switch between the current schema and a diff against base branch \\`$BASE_REF\\`.\"$'\\n'\n\n while IFS=$'\\t' read -r name id; do\n [ -z \"$name\" ] && continue\n if [[ \"$name\" != *-viewer.html ]]; then\n continue\n fi\n ns=${name%-viewer.html}\n label=\"$ns viewer\"\n body+=$'\\n'\"- **$label**: [$name]($SERVER/$REPO/actions/runs/$RUN_ID/artifacts/$id)\"\n done < <(gh api \"repos/$REPO/actions/runs/$RUN_ID/artifacts\" --paginate \\\n --jq '.artifacts[] | select(.name | endswith(\"-viewer.html\")) | [.name, (.id|tostring)] | @tsv' | sort)\n\n existing=$(gh api \"repos/$REPO/issues/$PR_NUMBER/comments\" --paginate \\\n --jq 'map(select(.body | contains(env.MARKER))) | .[0].id // empty')\n if [ -n \"$existing\" ]; then\n gh api --method PATCH \"repos/$REPO/issues/comments/$existing\" -f body=\"$body\" >/dev/null\n else\n gh api --method POST \"repos/$REPO/issues/$PR_NUMBER/comments\" -f body=\"$body\" >/dev/null\n fi\n\n # __ERD_PREVIEW_COMMENT_JOB_END__\n tailor-deploy:\n # __DEPLOY_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n permissions:\n contents: read\n environment: __ENVIRONMENT__\n concurrency:\n group: tailor-deploy-__WORKSPACE_NAME__\n cancel-in-progress: false\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-apply\n uses: tailor-platform/actions/deploy@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n # __SEED_DATA_START__\n - id: seed-data\n if: false\n shell: bash\n # __WORKING_DIRECTORY__\n run: |\n # Uncomment and implement to seed data on deploy.\n # Run after apply so the schema is ready.\n # Example: node scripts/seed.mjs\n true\n # __SEED_DATA_END__\n - id: slack-prereq\n if: always()\n shell: bash\n env:\n SLACK_TOKEN: ${{ secrets.TAILOR_SLACK_BOT_TOKEN }}\n SLACK_CHANNEL_ID: ${{ vars.TAILOR_SLACK_CHANNEL_ID }}\n run: |\n if [[ -n \"$SLACK_TOKEN\" && -n \"$SLACK_CHANNEL_ID\" ]]; then\n echo \"ready=true\" >> \"$GITHUB_OUTPUT\"\n fi\n - id: tailor-notify\n if: always() && steps.slack-prereq.outputs.ready == 'true'\n uses: tailor-platform/actions/notify@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n provider: slack\n status: ${{ job.status }}\n workspace-name: __WORKSPACE_NAME__\n slack-token: ${{ secrets.TAILOR_SLACK_BOT_TOKEN }}\n slack-channel-id: ${{ vars.TAILOR_SLACK_CHANNEL_ID }}\n # user-mapping: ${{ vars.TAILOR_SLACK_USER_MAPPING }}\n";
|
|
2884
3440
|
|
|
2885
3441
|
//#endregion
|
|
2886
3442
|
//#region src/cli/commands/setup/coordinate.workflow.yml
|
|
2887
|
-
var coordinate_workflow_default = "# __HEADER__\nname: Tailor Coordinator (__WORKSPACE_NAME__)\n\non:\n # __PULL_REQUEST_START__\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PULL_REQUEST_END__\n push:\n # __PUSH_BRANCHES_START__\n branches: [\"__BRANCH__\"]\n # __PUSH_BRANCHES_END__\n # __PUSH_TAGS_START__\n tags: [__TAG_PATTERN__]\n # __PUSH_TAGS_END__\n workflow_dispatch:\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n\npermissions:\n contents: read\n\njobs:\n # __TAG_GUARD_JOB_START__\n tailor-tag-guard:\n runs-on: ubuntu-latest\n timeout-minutes: 5\n permissions:\n contents: read\n outputs:\n on-branch: ${{ steps.tailor-tag-guard.outputs.on-branch }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n fetch-depth: 0\n - id: tailor-tag-guard\n uses: tailor-platform/actions/tag-guard@
|
|
3443
|
+
var coordinate_workflow_default = "# __HEADER__\nname: Tailor Coordinator (__WORKSPACE_NAME__)\n\non:\n # __PULL_REQUEST_START__\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PULL_REQUEST_END__\n push:\n # __PUSH_BRANCHES_START__\n branches: [\"__BRANCH__\"]\n # __PUSH_BRANCHES_END__\n # __PUSH_TAGS_START__\n tags: [__TAG_PATTERN__]\n # __PUSH_TAGS_END__\n workflow_dispatch:\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n\npermissions:\n contents: read\n\njobs:\n # __TAG_GUARD_JOB_START__\n tailor-tag-guard:\n runs-on: ubuntu-latest\n timeout-minutes: 5\n permissions:\n contents: read\n outputs:\n on-branch: ${{ steps.tailor-tag-guard.outputs.on-branch }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n fetch-depth: 0\n - id: tailor-tag-guard\n uses: tailor-platform/actions/tag-guard@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n target-branch: __BRANCH__\n # __TAG_GUARD_JOB_END__\n\n tailor-plan:\n # __PLAN_NEEDS__\n # __PLAN_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 60\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n concurrency:\n group: tailor-plan-__WORKSPACE_NAME__-${{ github.event.pull_request.number || github.run_id }}\n cancel-in-progress: true\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: ./.github/actions/tailor-setup\n # __PER_APP_PLAN_STEPS__\n\n tailor-deploy:\n # __DEPLOY_NEEDS__\n # __DEPLOY_IF__\n # __DEPLOY_ENVIRONMENT__\n runs-on: ubuntu-latest\n timeout-minutes: 60\n permissions:\n contents: read\n concurrency:\n group: tailor-deploy-__WORKSPACE_NAME__\n cancel-in-progress: false\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: ./.github/actions/tailor-setup\n # __PER_APP_DEPLOY_STEPS__\n";
|
|
2888
3444
|
|
|
2889
3445
|
//#endregion
|
|
2890
3446
|
//#region src/cli/commands/setup/preview.workflow.yml
|
|
2891
|
-
var preview_workflow_default = "# __HEADER__\nname: Tailor Preview (__WORKSPACE_NAME__)\n\non:\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PR_TYPES__\n # To deploy only for PRs that carry the `tailor:preview` label instead of all PRs,\n # re-run: tailor-sdk setup --require-preview-label\n # __PATHS__\n\npermissions:\n contents: read\n pull-requests: write\n\njobs:\n tailor-preview-deploy:\n # __DEPLOY_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n concurrency:\n group: tailor-preview-__WORKSPACE_NAME__-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@
|
|
3447
|
+
var preview_workflow_default = "# __HEADER__\nname: Tailor Preview (__WORKSPACE_NAME__)\n\non:\n pull_request:\n branches: [\"__BRANCH__\"]\n # __PR_TYPES__\n # To deploy only for PRs that carry the `tailor:preview` label instead of all PRs,\n # re-run: tailor-sdk setup --require-preview-label\n # __PATHS__\n\npermissions:\n contents: read\n pull-requests: write\n\njobs:\n tailor-preview-deploy:\n # __DEPLOY_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n concurrency:\n group: tailor-preview-__WORKSPACE_NAME__-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-generate-check\n uses: tailor-platform/actions/generate-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n - id: tailor-preview-deploy\n uses: tailor-platform/actions/preview-deploy@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-name-prefix: __WORKSPACE_NAME__\n region: \"__REGION__\"\n organization-id: ${{ vars.TAILOR_PLATFORM_ORGANIZATION_ID }}\n folder-id: ${{ vars.TAILOR_PLATFORM_FOLDER_ID }}\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n - id: tailor-preview-comment\n if: always()\n uses: tailor-platform/actions/preview-comment@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-id: ${{ steps.tailor-preview-deploy.outputs.workspace-id }}\n workspace-name: ${{ steps.tailor-preview-deploy.outputs.workspace-name }}\n status: ${{ job.status == 'success' && 'success' || 'failure' }}\n app-url: ${{ steps.tailor-preview-deploy.outputs.app-url }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n\n tailor-preview-cleanup:\n # __CLEANUP_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 15\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n pull-requests: write\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-preview-cleanup\n uses: tailor-platform/actions/preview-cleanup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-name-prefix: __WORKSPACE_NAME__\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n github-token: ${{ secrets.GITHUB_TOKEN }}\n";
|
|
2892
3448
|
|
|
2893
3449
|
//#endregion
|
|
2894
3450
|
//#region src/cli/commands/setup/tag.workflow.yml
|
|
2895
|
-
var tag_workflow_default = "# __HEADER__\nname: Tailor (__WORKSPACE_NAME__)\n\non:\n push:\n tags: [\"__TAG_PATTERN__\"]\n workflow_dispatch:\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n\npermissions:\n contents: read\n\njobs:\n # __TAG_GUARD_JOB_START__\n tailor-tag-guard:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n permissions:\n contents: read\n outputs:\n on-branch: ${{ steps.tailor-tag-guard.outputs.on-branch }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n fetch-depth: 0\n - id: tailor-tag-guard\n uses: tailor-platform/actions/tag-guard@
|
|
3451
|
+
var tag_workflow_default = "# __HEADER__\nname: Tailor (__WORKSPACE_NAME__)\n\non:\n push:\n tags: [\"__TAG_PATTERN__\"]\n workflow_dispatch:\n inputs:\n dry-run:\n description: Preview changes without deploying\n type: boolean\n default: false\n\npermissions:\n contents: read\n\njobs:\n # __TAG_GUARD_JOB_START__\n tailor-tag-guard:\n runs-on: ubuntu-latest\n timeout-minutes: 10\n permissions:\n contents: read\n outputs:\n on-branch: ${{ steps.tailor-tag-guard.outputs.on-branch }}\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n with:\n fetch-depth: 0\n - id: tailor-tag-guard\n uses: tailor-platform/actions/tag-guard@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n target-branch: \"__BRANCH__\"\n # __TAG_GUARD_JOB_END__\n tailor-plan:\n # __PLAN_NEEDS__\n # __PLAN_IF__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n environment: __ENVIRONMENT__\n permissions:\n contents: read\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-generate-check\n uses: tailor-platform/actions/generate-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __SEED_VALIDATE_START__\n - id: tailor-seed-validate\n uses: tailor-platform/actions/seed-validate@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __SEED_VALIDATE_END__\n - id: tailor-drift-check\n uses: tailor-platform/actions/drift-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __MIGRATION_DRIFT_CHECK_START__\n - id: tailor-migration-drift-check\n uses: tailor-platform/actions/migration-drift-check@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n # __MIGRATION_DRIFT_CHECK_END__\n - id: tailor-plan\n uses: tailor-platform/actions/plan@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n label: __WORKSPACE_NAME__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n\n tailor-deploy:\n needs: tailor-plan\n if: ${{ !(github.event_name == 'workflow_dispatch' && inputs['dry-run']) }}\n environment: __ENVIRONMENT__\n runs-on: ubuntu-latest\n timeout-minutes: 30\n permissions:\n contents: read\n concurrency:\n group: tailor-deploy-__WORKSPACE_NAME__\n cancel-in-progress: false\n steps:\n - id: tailor-checkout\n uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n - id: tailor-setup\n uses: tailor-platform/actions/setup@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-install\n uses: tailor-platform/actions/install@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n package-manager: __PACKAGE_MANAGER__\n - id: tailor-apply\n uses: tailor-platform/actions/deploy@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n workspace-id: ${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}\n package-manager: __PACKAGE_MANAGER__\n # __WORKING_DIRECTORY__\n platform-client-id: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID }}\n platform-client-secret: ${{ secrets.TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET }}\n # __SEED_DATA_START__\n - id: seed-data\n if: false\n shell: bash\n # __WORKING_DIRECTORY__\n run: |\n # Uncomment and implement to seed data on deploy.\n # Run after apply so the schema is ready.\n # Example: node scripts/seed.mjs\n true\n # __SEED_DATA_END__\n - id: slack-prereq\n if: always()\n shell: bash\n env:\n SLACK_TOKEN: ${{ secrets.TAILOR_SLACK_BOT_TOKEN }}\n SLACK_CHANNEL_ID: ${{ vars.TAILOR_SLACK_CHANNEL_ID }}\n run: |\n if [[ -n \"$SLACK_TOKEN\" && -n \"$SLACK_CHANNEL_ID\" ]]; then\n echo \"ready=true\" >> \"$GITHUB_OUTPUT\"\n fi\n - id: tailor-notify\n if: always() && steps.slack-prereq.outputs.ready == 'true'\n uses: tailor-platform/actions/notify@a3c3032e14277e81039eb26ae1a425adb22eb532 # v1.7.0\n with:\n provider: slack\n status: ${{ job.status }}\n workspace-name: __WORKSPACE_NAME__\n slack-token: ${{ secrets.TAILOR_SLACK_BOT_TOKEN }}\n slack-channel-id: ${{ vars.TAILOR_SLACK_CHANNEL_ID }}\n # user-mapping: ${{ vars.TAILOR_SLACK_USER_MAPPING }}\n";
|
|
2896
3452
|
|
|
2897
3453
|
//#endregion
|
|
2898
3454
|
//#region src/cli/commands/setup/templates.ts
|
|
@@ -3062,7 +3618,8 @@ function renderActionWorkflow(params) {
|
|
|
3062
3618
|
generatedIds: ["tailor-apply", "tailor-notify"]
|
|
3063
3619
|
};
|
|
3064
3620
|
}
|
|
3065
|
-
const ACTIONS_SHA = "
|
|
3621
|
+
const ACTIONS_SHA = "a3c3032e14277e81039eb26ae1a425adb22eb532";
|
|
3622
|
+
const ACTIONS_VERSION = "v1.7.0";
|
|
3066
3623
|
/**
|
|
3067
3624
|
* Render the coordinator workflow that orchestrates per-app composite actions.
|
|
3068
3625
|
*
|
|
@@ -3104,7 +3661,7 @@ function renderCoordinateWorkflow(params) {
|
|
|
3104
3661
|
}
|
|
3105
3662
|
const driftCheckStep = [
|
|
3106
3663
|
`- id: tailor-drift-check`,
|
|
3107
|
-
` uses: tailor-platform/actions/drift-check@${ACTIONS_SHA} #
|
|
3664
|
+
` uses: tailor-platform/actions/drift-check@${ACTIONS_SHA} # ${ACTIONS_VERSION}`,
|
|
3108
3665
|
` with:`,
|
|
3109
3666
|
` package-manager: ${packageManager}`
|
|
3110
3667
|
].join("\n");
|
|
@@ -3121,7 +3678,7 @@ function renderCoordinateWorkflow(params) {
|
|
|
3121
3678
|
return [
|
|
3122
3679
|
`- id: tailor-plan-${group.id}`,
|
|
3123
3680
|
` if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork`,
|
|
3124
|
-
` uses: tailor-platform/actions/plan@${ACTIONS_SHA} #
|
|
3681
|
+
` uses: tailor-platform/actions/plan@${ACTIONS_SHA} # ${ACTIONS_VERSION}`,
|
|
3125
3682
|
` with:`,
|
|
3126
3683
|
` workspace-id: \${{ vars.TAILOR_PLATFORM_WORKSPACE_ID }}`,
|
|
3127
3684
|
` package-manager: ${packageManager}${wdLine}`,
|
|
@@ -3134,7 +3691,7 @@ function renderCoordinateWorkflow(params) {
|
|
|
3134
3691
|
const multiConfigPlanStep = (group) => [
|
|
3135
3692
|
`- id: tailor-plan-${group.id}`,
|
|
3136
3693
|
` if: github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork`,
|
|
3137
|
-
` uses: tailor-platform/actions/plan@${ACTIONS_SHA} #
|
|
3694
|
+
` uses: tailor-platform/actions/plan@${ACTIONS_SHA} # ${ACTIONS_VERSION}`,
|
|
3138
3695
|
` env:`,
|
|
3139
3696
|
` TAILOR_PLATFORM_SDK_CONFIG_PATH: ${groupConfigPath(group)}`,
|
|
3140
3697
|
` with:`,
|
|
@@ -3151,7 +3708,7 @@ function renderCoordinateWorkflow(params) {
|
|
|
3151
3708
|
const wdLine = wd ? `\n working-directory: ${wd}` : "";
|
|
3152
3709
|
return [
|
|
3153
3710
|
`- id: tailor-generate-check-${app.name}`,
|
|
3154
|
-
` uses: tailor-platform/actions/generate-check@${ACTIONS_SHA} #
|
|
3711
|
+
` uses: tailor-platform/actions/generate-check@${ACTIONS_SHA} # ${ACTIONS_VERSION}`,
|
|
3155
3712
|
` with:`,
|
|
3156
3713
|
` package-manager: ${packageManager}${wdLine}`
|
|
3157
3714
|
];
|
|
@@ -3246,11 +3803,11 @@ function renderTailorSetupAction(params) {
|
|
|
3246
3803
|
`runs:`,
|
|
3247
3804
|
` using: composite`,
|
|
3248
3805
|
` steps:`,
|
|
3249
|
-
` - uses: tailor-platform/actions/setup@${ACTIONS_SHA} #
|
|
3806
|
+
` - uses: tailor-platform/actions/setup@${ACTIONS_SHA} # ${ACTIONS_VERSION}`,
|
|
3250
3807
|
` with:`,
|
|
3251
3808
|
` package-manager: ${packageManager}`,
|
|
3252
3809
|
` # Add custom steps here (e.g. private registry authentication)`,
|
|
3253
|
-
` - uses: tailor-platform/actions/install@${ACTIONS_SHA} #
|
|
3810
|
+
` - uses: tailor-platform/actions/install@${ACTIONS_SHA} # ${ACTIONS_VERSION}`,
|
|
3254
3811
|
` with:`,
|
|
3255
3812
|
` package-manager: ${packageManager}`,
|
|
3256
3813
|
` # editable: install-command:`,
|
|
@@ -6222,7 +6779,7 @@ async function fetchRemoteTypes(client, workspaceId, namespace) {
|
|
|
6222
6779
|
async function assertMigrationsReproduceLocalTypes(loaded, target) {
|
|
6223
6780
|
const { config, plugins } = loaded;
|
|
6224
6781
|
const pluginManager = plugins.length > 0 ? new PluginManager(plugins) : void 0;
|
|
6225
|
-
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-
|
|
6782
|
+
const { defineApplication, generatePluginFilesIfNeeded } = await import("../application-6zsDLGKv.mjs");
|
|
6226
6783
|
const application = defineApplication({
|
|
6227
6784
|
config,
|
|
6228
6785
|
pluginManager
|
|
@@ -6848,7 +7405,7 @@ const workflowCommand = defineCommand({
|
|
|
6848
7405
|
name: "workflow",
|
|
6849
7406
|
description: "Manage workflows and workflow executions.",
|
|
6850
7407
|
subCommands: {
|
|
6851
|
-
list: listCommand$
|
|
7408
|
+
list: listCommand$13,
|
|
6852
7409
|
get: getCommand$6,
|
|
6853
7410
|
start: startCommand,
|
|
6854
7411
|
wait: waitCommand,
|
|
@@ -6856,7 +7413,7 @@ const workflowCommand = defineCommand({
|
|
|
6856
7413
|
resume: resumeCommand
|
|
6857
7414
|
},
|
|
6858
7415
|
async run() {
|
|
6859
|
-
await runCommand(listCommand$
|
|
7416
|
+
await runCommand(listCommand$13, []);
|
|
6860
7417
|
}
|
|
6861
7418
|
});
|
|
6862
7419
|
|
|
@@ -6867,10 +7424,10 @@ const appCommand = defineCommand({
|
|
|
6867
7424
|
description: "Manage workspace applications",
|
|
6868
7425
|
subCommands: {
|
|
6869
7426
|
health: healthCommand,
|
|
6870
|
-
list: listCommand$
|
|
7427
|
+
list: listCommand$14
|
|
6871
7428
|
},
|
|
6872
7429
|
async run() {
|
|
6873
|
-
await runCommand(listCommand$
|
|
7430
|
+
await runCommand(listCommand$14, []);
|
|
6874
7431
|
}
|
|
6875
7432
|
});
|
|
6876
7433
|
|
|
@@ -6881,12 +7438,12 @@ const userCommand = defineCommand({
|
|
|
6881
7438
|
description: "Manage workspace users",
|
|
6882
7439
|
subCommands: {
|
|
6883
7440
|
invite: inviteCommand,
|
|
6884
|
-
list: listCommand$
|
|
7441
|
+
list: listCommand$15,
|
|
6885
7442
|
remove: removeCommand,
|
|
6886
7443
|
update: updateCommand$4
|
|
6887
7444
|
},
|
|
6888
7445
|
async run() {
|
|
6889
|
-
await runCommand(listCommand$
|
|
7446
|
+
await runCommand(listCommand$15, []);
|
|
6890
7447
|
}
|
|
6891
7448
|
});
|
|
6892
7449
|
|
|
@@ -6900,12 +7457,12 @@ const workspaceCommand = defineCommand({
|
|
|
6900
7457
|
create: createCommand$4,
|
|
6901
7458
|
delete: deleteCommand$5,
|
|
6902
7459
|
get: getCommand$7,
|
|
6903
|
-
list: listCommand$
|
|
7460
|
+
list: listCommand$16,
|
|
6904
7461
|
restore: restoreCommand,
|
|
6905
7462
|
user: userCommand
|
|
6906
7463
|
},
|
|
6907
7464
|
async run() {
|
|
6908
|
-
await runCommand(listCommand$
|
|
7465
|
+
await runCommand(listCommand$16, []);
|
|
6909
7466
|
}
|
|
6910
7467
|
});
|
|
6911
7468
|
|
|
@@ -6965,7 +7522,7 @@ runMain(mainCommand, {
|
|
|
6965
7522
|
if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
|
|
6966
7523
|
} else logger.error(`Unknown error: ${error}`);
|
|
6967
7524
|
if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
|
|
6968
|
-
const { reportCrash } = await import("../crashreport-
|
|
7525
|
+
const { reportCrash } = await import("../crashreport-np4-_DX2.mjs");
|
|
6969
7526
|
await reportCrash(error, "handledError");
|
|
6970
7527
|
}
|
|
6971
7528
|
}
|