@tailor-platform/sdk 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +183 -0
- package/README.md +1 -1
- package/dist/{application-BpLeawBg.mjs → application-C8a0UJ-z.mjs} +312 -166
- package/dist/application-C8a0UJ-z.mjs.map +1 -0
- package/dist/application-D4zOiLLa.mjs +3 -0
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +47 -24
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +6 -0
- package/dist/cli/commands/tailordb/migrate/rename-detection.d.mts +22 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +1 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +30 -11
- package/dist/cli/commands/tailordb/truncate.d.mts +2 -2
- package/dist/cli/lib.mjs +2 -2
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +366 -137
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/ts-hook.mjs +55 -8
- package/dist/completion/zsh-worker.zsh +38 -10
- package/dist/configure/config/index.d.mts +1 -1
- package/dist/configure/index.d.mts +3 -2
- package/dist/configure/index.mjs +92 -25
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/aigateway/index.d.mts +5 -4
- package/dist/configure/services/aigateway/types.d.mts +6 -1
- package/dist/configure/services/auth/types.d.mts +2 -2
- package/dist/configure/services/index.d.mts +2 -2
- package/dist/configure/services/tailordb/permission.d.mts +1 -1
- package/dist/configure/services/tailordb/schema.d.mts +1 -1
- package/dist/configure/services/tailordb/types.d.mts +7 -4
- package/dist/configure/services/workflow/index.d.mts +2 -2
- package/dist/configure/services/workflow/wait-point.d.mts +72 -13
- package/dist/configure/types/auth-namespace-name.d.mts +18 -0
- package/dist/{crashreport-CINZ5dVN.mjs → crashreport-Cd4TqfZq.mjs} +1 -1
- package/dist/{crashreport-CIIfLnoO.mjs → crashreport-Q0pDAlrj.mjs} +8 -4
- package/dist/{crashreport-CIIfLnoO.mjs.map → crashreport-Q0pDAlrj.mjs.map} +1 -1
- package/dist/{errors-CWj21238.mjs → errors-Bxut5_Sy.mjs} +17 -3
- package/dist/{errors-CWj21238.mjs.map → errors-Bxut5_Sy.mjs.map} +1 -1
- package/dist/file-BUcmVIH2.mjs.map +1 -1
- package/dist/kysely/index.d.mts +2 -1
- package/dist/kysely/index.mjs +2 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{logger-DSdExfor.mjs → logger-D0bEznPv.mjs} +9 -5
- package/dist/{logger-DSdExfor.mjs.map → logger-D0bEznPv.mjs.map} +1 -1
- package/dist/package-json-8b0O9TlX.mjs.map +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +5 -5
- package/dist/plugin/builtin/enum-constants/index.mjs.map +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +14 -11
- package/dist/plugin/builtin/file-utils/index.mjs.map +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +9 -9
- package/dist/plugin/builtin/kysely-type/index.mjs.map +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/builtin/seed/seed-type-processor.d.mts +4 -4
- package/dist/plugin/get-generated-type.d.mts +4 -4
- package/dist/plugin/index.mjs +13 -13
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/types.d.mts +2 -2
- package/dist/plugin/with-context.d.mts +1 -1
- package/dist/{register-ts-hook-CTth1eqj.mjs → register-ts-hook-Vqjza10T.mjs} +2516 -857
- package/dist/register-ts-hook-Vqjza10T.mjs.map +1 -0
- package/dist/{repl-editor-BCozyiNq.mjs → repl-editor-F9LotMNx.mjs} +3 -2
- package/dist/{repl-editor-BCozyiNq.mjs.map → repl-editor-F9LotMNx.mjs.map} +1 -1
- package/dist/runtime/file.d.mts +14 -14
- package/dist/{schema--xYWRGfe.mjs → schema-D4TC4BC3.mjs} +4 -3
- package/dist/schema-D4TC4BC3.mjs.map +1 -0
- package/dist/seed/index.d.mts +4 -4
- package/dist/seed/index.mjs +3 -3
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-xqM9WIHP.mjs → seed-Cibjmtry.mjs} +46 -40
- package/dist/seed-Cibjmtry.mjs.map +1 -0
- package/dist/{service-goqlJJgA.mjs → service-2grcAOCJ.mjs} +61 -27
- package/dist/service-2grcAOCJ.mjs.map +1 -0
- package/dist/service-CaBPNDIZ.mjs +3 -0
- package/dist/{service-CCwl3Avt.mjs → service-LTfp03ZZ.mjs} +7 -5
- package/dist/{service-CCwl3Avt.mjs.map → service-LTfp03ZZ.mjs.map} +1 -1
- package/dist/types/aigateway.generated.d.mts +2 -2
- package/dist/types/auth.generated.d.mts +3 -3
- package/dist/types/executor.generated.d.mts +1 -1
- package/dist/types/tailordb.generated.d.mts +12 -12
- package/dist/utils/test/index.d.mts +4 -4
- package/dist/utils/test/index.mjs +4 -4
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/vitest/index.mjs +95 -7
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/workflow.d.mts +13 -1
- package/dist/wait-point-invoker-__oE88_P.mjs +148 -0
- package/dist/wait-point-invoker-__oE88_P.mjs.map +1 -0
- package/dist/wait-point-registry-TL99zotw.mjs +47 -0
- package/dist/wait-point-registry-TL99zotw.mjs.map +1 -0
- package/docs/cli/application.md +3 -1
- package/docs/cli/function.md +17 -13
- package/docs/cli/setup.md +14 -1
- package/docs/cli/tailordb.md +30 -27
- package/docs/cli/workspace.md +2 -2
- package/docs/cli-reference.md +23 -22
- package/docs/configuration.md +2 -2
- package/docs/github-actions.md +73 -28
- package/docs/migration/v2.md +58 -4
- package/docs/migration/v3.md +41 -0
- package/docs/quickstart.md +1 -1
- package/docs/services/aigateway.md +33 -9
- package/docs/services/executor.md +5 -1
- package/docs/services/tailordb-migration.md +146 -44
- package/docs/services/tailordb.md +7 -7
- package/docs/services/workflow.md +52 -2
- package/docs/testing.md +13 -1
- package/package.json +8 -8
- package/dist/application-BpLeawBg.mjs.map +0 -1
- package/dist/application-BxLLiLsr.mjs +0 -3
- package/dist/register-ts-hook-CTth1eqj.mjs.map +0 -1
- package/dist/schema--xYWRGfe.mjs.map +0 -1
- package/dist/seed-xqM9WIHP.mjs.map +0 -1
- package/dist/service-_XmjSEGr.mjs +0 -3
- package/dist/service-goqlJJgA.mjs.map +0 -1
- package/dist/test-env-key-D7UkZp99.mjs +0 -75
- package/dist/test-env-key-D7UkZp99.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ import { TailorEnv } from "../../runtime/types.mjs";
|
|
|
2
2
|
import { ExecJobFunctionOptions, StartWorkflowOptions } from "../../runtime/workflow.mjs";
|
|
3
3
|
import { WorkflowJob } from "../../configure/services/workflow/job.mjs";
|
|
4
4
|
import { Workflow } from "../../configure/services/workflow/workflow.mjs";
|
|
5
|
-
import { WaitPointInstance } from "../../configure/services/workflow/wait-point.mjs";
|
|
5
|
+
import { ParameterizedWaitPointInstance, WaitPointInstance } from "../../configure/services/workflow/wait-point.mjs";
|
|
6
6
|
import { Mock } from "vitest";
|
|
7
7
|
//#region src/vitest/mocks/workflow.d.ts
|
|
8
8
|
type JobHandler = (jobName: string, args: unknown, options?: ExecJobFunctionOptions) => unknown;
|
|
@@ -72,6 +72,18 @@ declare function mockWorkflow(): {
|
|
|
72
72
|
resolve: Mock<WaitPointInstance<Payload, Result>["resolve"]>;
|
|
73
73
|
setResolvePayload(payload: WaitPayload<Payload>): void;
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Get stable, typed mocks for one param binding of a parameterized wait point.
|
|
77
|
+
* Calls made with other bindings fall through to the platform mock.
|
|
78
|
+
* @param definition - Parameterized wait point definition to mock
|
|
79
|
+
* @param params - Param binding to intercept, as passed to `.with()`
|
|
80
|
+
* @returns Typed wait point mock control object
|
|
81
|
+
*/
|
|
82
|
+
waitPointWith<Params extends object, Payload, Result>(definition: ParameterizedWaitPointInstance<Params, Payload, Result>, params: Params): {
|
|
83
|
+
wait: Mock<WaitPointInstance<Payload, Result>["wait"]>;
|
|
84
|
+
resolve: Mock<WaitPointInstance<Payload, Result>["resolve"]>;
|
|
85
|
+
setResolvePayload(payload: WaitPayload<Payload>): void;
|
|
86
|
+
};
|
|
75
87
|
/**
|
|
76
88
|
* Set a fallback job handler. Called when the enqueue queue is empty.
|
|
77
89
|
* @param handler - Function returning a result for a job name, args, and options
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
//#region src/configure/services/workflow/test-env-key.ts
|
|
4
|
+
/**
|
|
5
|
+
* Typed accessors for the test-time globalThis slot used to pass `env` from
|
|
6
|
+
* `mockWorkflow().setEnv()` (in `@tailor-platform/sdk/vitest`) to
|
|
7
|
+
* `runWorkflowLocally()` job bodies. The slot key is private to this
|
|
8
|
+
* module; callers go through the get/set/clear functions below so both sides
|
|
9
|
+
* share the same access path.
|
|
10
|
+
*
|
|
11
|
+
* Lives in its own file (with no `@/` imports) so `vitest/mock.ts` can load
|
|
12
|
+
* it from nested Vitest configs that do not resolve `@/` aliases.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
const SLOT_KEY = "__tailorWorkflowTestEnv";
|
|
16
|
+
let invokerStorage;
|
|
17
|
+
function workflowInvokerStorage() {
|
|
18
|
+
if (!invokerStorage) invokerStorage = new AsyncLocalStorage();
|
|
19
|
+
return invokerStorage;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read the test-time env slot.
|
|
23
|
+
* @returns Current env, or `undefined` when unset.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
function readWorkflowTestEnv() {
|
|
27
|
+
return globalThis[SLOT_KEY];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Write the test-time env slot.
|
|
31
|
+
* @param env - Env value to expose to `runWorkflowLocally()` job bodies.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
function writeWorkflowTestEnv(env) {
|
|
35
|
+
globalThis[SLOT_KEY] = env;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Clear the test-time env slot.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
function clearWorkflowTestEnv() {
|
|
42
|
+
delete globalThis[SLOT_KEY];
|
|
43
|
+
}
|
|
44
|
+
function withWorkflowTestInvoker(invoker, run) {
|
|
45
|
+
return workflowInvokerStorage().run(invoker, run);
|
|
46
|
+
}
|
|
47
|
+
function readRuntimeInvoker() {
|
|
48
|
+
const runtime = globalThis.tailor?.context?.getInvoker;
|
|
49
|
+
const raw = runtime?.();
|
|
50
|
+
if (!raw) return null;
|
|
51
|
+
return {
|
|
52
|
+
id: raw.id,
|
|
53
|
+
type: raw.type,
|
|
54
|
+
workspaceId: raw.workspaceId,
|
|
55
|
+
attributes: raw.attributeMap ?? (Array.isArray(raw.attributes) ? {} : raw.attributes ?? {}),
|
|
56
|
+
attributeList: raw.attributeList ?? (Array.isArray(raw.attributes) ? raw.attributes : [])
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function buildJobContext() {
|
|
60
|
+
const storedInvoker = invokerStorage?.getStore();
|
|
61
|
+
const invoker = storedInvoker === void 0 ? readRuntimeInvoker() : storedInvoker;
|
|
62
|
+
const fromGlobal = readWorkflowTestEnv();
|
|
63
|
+
if (fromGlobal !== void 0) return {
|
|
64
|
+
env: { ...fromGlobal },
|
|
65
|
+
invoker
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
env: {},
|
|
69
|
+
invoker
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/configure/services/workflow/wait-point-invoker.ts
|
|
75
|
+
const WAIT_POINT_INVOKER = Symbol.for("tailor-platform/sdk:wait-point-invoker");
|
|
76
|
+
const WAIT_POINT_KEY = Symbol.for("tailor-platform/sdk:wait-point-key");
|
|
77
|
+
function getPlatformWorkflow() {
|
|
78
|
+
const workflow = globalThis.tailor?.workflow;
|
|
79
|
+
if (!workflow) throw new Error("tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment, or acquire mockWorkflow() from @tailor-platform/sdk/vitest and set a wait/resolve handler.");
|
|
80
|
+
return workflow;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Create the invoker a single wait point definition delegates to.
|
|
84
|
+
* @returns An invoker bound to the platform runtime
|
|
85
|
+
*/
|
|
86
|
+
function createWaitPointInvoker() {
|
|
87
|
+
return {
|
|
88
|
+
wait(key, payload) {
|
|
89
|
+
return getPlatformWorkflow().wait(key, payload);
|
|
90
|
+
},
|
|
91
|
+
async resolve(key, executionId, callback) {
|
|
92
|
+
await getPlatformWorkflow().resolve(executionId, key, callback);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Attach an invoker to a wait point definition so test doubles can intercept it.
|
|
98
|
+
*
|
|
99
|
+
* The slot itself is fixed once attached; a double swaps the invoker's `wait` /
|
|
100
|
+
* `resolve` methods rather than the invoker object.
|
|
101
|
+
* @param target - Wait point definition to attach to
|
|
102
|
+
* @param invoker - Invoker the definition delegates to
|
|
103
|
+
* @returns The same definition
|
|
104
|
+
*/
|
|
105
|
+
function attachWaitPointInvoker(target, invoker) {
|
|
106
|
+
Object.defineProperty(target, WAIT_POINT_INVOKER, {
|
|
107
|
+
value: invoker,
|
|
108
|
+
enumerable: false,
|
|
109
|
+
configurable: false,
|
|
110
|
+
writable: false
|
|
111
|
+
});
|
|
112
|
+
return target;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Read the invoker attached to a wait point definition.
|
|
116
|
+
* @param target - Wait point definition to read from
|
|
117
|
+
* @returns The attached invoker, or undefined when the value is not a wait point
|
|
118
|
+
*/
|
|
119
|
+
function getWaitPointInvoker(target) {
|
|
120
|
+
return target[WAIT_POINT_INVOKER];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Record the resolved key on a wait point bound by `.with()`.
|
|
124
|
+
* @param target - Bound wait point to attach to
|
|
125
|
+
* @param key - Resolved runtime key
|
|
126
|
+
* @returns The same bound wait point
|
|
127
|
+
*/
|
|
128
|
+
function attachWaitPointKey(target, key) {
|
|
129
|
+
Object.defineProperty(target, WAIT_POINT_KEY, {
|
|
130
|
+
value: key,
|
|
131
|
+
enumerable: false,
|
|
132
|
+
configurable: false,
|
|
133
|
+
writable: false
|
|
134
|
+
});
|
|
135
|
+
return target;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Read the resolved key recorded on a bound wait point.
|
|
139
|
+
* @param target - Bound wait point to read from
|
|
140
|
+
* @returns The resolved key, or undefined when the value is not a bound wait point
|
|
141
|
+
*/
|
|
142
|
+
function getWaitPointKey(target) {
|
|
143
|
+
return target[WAIT_POINT_KEY];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
export { getWaitPointKey as a, readWorkflowTestEnv as c, getWaitPointInvoker as i, withWorkflowTestInvoker as l, attachWaitPointKey as n, buildJobContext as o, createWaitPointInvoker as r, clearWorkflowTestEnv as s, attachWaitPointInvoker as t, writeWorkflowTestEnv as u };
|
|
148
|
+
//# sourceMappingURL=wait-point-invoker-__oE88_P.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-point-invoker-__oE88_P.mjs","names":["platform"],"sources":["../src/configure/services/workflow/test-env-key.ts","../src/configure/services/workflow/wait-point-invoker.ts"],"sourcesContent":["/**\n * Typed accessors for the test-time globalThis slot used to pass `env` from\n * `mockWorkflow().setEnv()` (in `@tailor-platform/sdk/vitest`) to\n * `runWorkflowLocally()` job bodies. The slot key is private to this\n * module; callers go through the get/set/clear functions below so both sides\n * share the same access path.\n *\n * Lives in its own file (with no `@/` imports) so `vitest/mock.ts` can load\n * it from nested Vitest configs that do not resolve `@/` aliases.\n * @internal\n */\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { TailorEnv, TailorPrincipal } from \"../../../runtime/types\";\n\nconst SLOT_KEY = \"__tailorWorkflowTestEnv\";\n\ntype AsyncLocalStorageLike<T> = {\n getStore(): T | undefined;\n run<R>(store: T, callback: () => R): R;\n};\n\nlet invokerStorage: AsyncLocalStorageLike<TailorPrincipal | null> | undefined;\n\nfunction workflowInvokerStorage(): AsyncLocalStorageLike<TailorPrincipal | null> {\n if (!invokerStorage) {\n invokerStorage = new AsyncLocalStorage<TailorPrincipal | null>();\n }\n return invokerStorage;\n}\n\n/**\n * Read the test-time env slot.\n * @returns Current env, or `undefined` when unset.\n * @internal\n */\nexport function readWorkflowTestEnv(): TailorEnv | undefined {\n return (globalThis as unknown as Record<string, TailorEnv | undefined>)[SLOT_KEY];\n}\n\n/**\n * Write the test-time env slot.\n * @param env - Env value to expose to `runWorkflowLocally()` job bodies.\n * @internal\n */\nexport function writeWorkflowTestEnv(env: TailorEnv): void {\n (globalThis as unknown as Record<string, TailorEnv>)[SLOT_KEY] = env;\n}\n\n/**\n * Clear the test-time env slot.\n * @internal\n */\nexport function clearWorkflowTestEnv(): void {\n delete (globalThis as unknown as Record<string, unknown>)[SLOT_KEY];\n}\n\nexport function withWorkflowTestInvoker<T>(invoker: TailorPrincipal | null, run: () => T): T {\n return workflowInvokerStorage().run(invoker, run);\n}\n\ntype RuntimeInvoker = {\n id: string;\n type: \"user\" | \"machine_user\";\n workspaceId: string;\n attributes?: string[] | TailorPrincipal[\"attributes\"];\n attributeMap?: TailorPrincipal[\"attributes\"];\n attributeList?: TailorPrincipal[\"attributeList\"];\n};\n\nfunction readRuntimeInvoker(): TailorPrincipal | null {\n const runtime = (\n globalThis as unknown as {\n tailor?: { context?: { getInvoker?: () => RuntimeInvoker | null } };\n }\n ).tailor?.context?.getInvoker;\n const raw = runtime?.();\n if (!raw) return null;\n return {\n id: raw.id,\n type: raw.type,\n workspaceId: raw.workspaceId,\n attributes: raw.attributeMap ?? (Array.isArray(raw.attributes) ? {} : (raw.attributes ?? {})),\n attributeList: (raw.attributeList ??\n (Array.isArray(raw.attributes) ? raw.attributes : [])) as TailorPrincipal[\"attributeList\"],\n };\n}\n\n// Shallow-copied to isolate against cross-trigger mutation.\nexport function buildJobContext(): { env: TailorEnv; invoker: TailorPrincipal | null } {\n const storedInvoker = invokerStorage?.getStore();\n const invoker = storedInvoker === undefined ? readRuntimeInvoker() : storedInvoker;\n const fromGlobal = readWorkflowTestEnv();\n if (fromGlobal !== undefined) return { env: { ...fromGlobal }, invoker };\n return { env: {} as TailorEnv, invoker };\n}\n","import type { PlatformWorkflowAPI } from \"#/runtime/workflow\";\n\n// Not re-exported from the workflow barrel: the slot exists so the Vitest mock\n// can intercept parameterized wait points, whose `wait`/`resolve` live on\n// short-lived objects returned by `.with()` rather than on the definition.\nconst WAIT_POINT_INVOKER: unique symbol = Symbol.for(\"tailor-platform/sdk:wait-point-invoker\");\nconst WAIT_POINT_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:wait-point-key\");\n\n/** Indirection every wait point call routes through, keyed by resolved key. */\nexport interface WaitPointInvoker {\n wait(key: string, payload: unknown): unknown;\n resolve(\n key: string,\n executionId: string,\n callback: (payload: unknown) => unknown | Promise<unknown>,\n ): Promise<void>;\n}\n\nfunction getPlatformWorkflow(): PlatformWorkflowAPI {\n const platform = globalThis as { tailor?: { workflow?: PlatformWorkflowAPI } };\n const workflow = platform.tailor?.workflow;\n if (!workflow) {\n throw new Error(\n \"tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment, \" +\n \"or acquire mockWorkflow() from @tailor-platform/sdk/vitest and set a wait/resolve handler.\",\n );\n }\n return workflow;\n}\n\n/**\n * Create the invoker a single wait point definition delegates to.\n * @returns An invoker bound to the platform runtime\n */\nexport function createWaitPointInvoker(): WaitPointInvoker {\n return {\n wait(key, payload) {\n return getPlatformWorkflow().wait(key, payload);\n },\n async resolve(key, executionId, callback) {\n await getPlatformWorkflow().resolve(executionId, key, callback);\n },\n };\n}\n\n/**\n * Attach an invoker to a wait point definition so test doubles can intercept it.\n *\n * The slot itself is fixed once attached; a double swaps the invoker's `wait` /\n * `resolve` methods rather than the invoker object.\n * @param target - Wait point definition to attach to\n * @param invoker - Invoker the definition delegates to\n * @returns The same definition\n */\nexport function attachWaitPointInvoker<T extends object>(target: T, invoker: WaitPointInvoker): T {\n Object.defineProperty(target, WAIT_POINT_INVOKER, {\n value: invoker,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return target;\n}\n\n/**\n * Read the invoker attached to a wait point definition.\n * @param target - Wait point definition to read from\n * @returns The attached invoker, or undefined when the value is not a wait point\n */\nexport function getWaitPointInvoker(target: object): WaitPointInvoker | undefined {\n return (target as Record<symbol, WaitPointInvoker | undefined>)[WAIT_POINT_INVOKER];\n}\n\n/**\n * Record the resolved key on a wait point bound by `.with()`.\n * @param target - Bound wait point to attach to\n * @param key - Resolved runtime key\n * @returns The same bound wait point\n */\nexport function attachWaitPointKey<T extends object>(target: T, key: string): T {\n Object.defineProperty(target, WAIT_POINT_KEY, {\n value: key,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return target;\n}\n\n/**\n * Read the resolved key recorded on a bound wait point.\n * @param target - Bound wait point to read from\n * @returns The resolved key, or undefined when the value is not a bound wait point\n */\nexport function getWaitPointKey(target: object): string | undefined {\n return (target as Record<symbol, string | undefined>)[WAIT_POINT_KEY];\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,WAAW;AAOjB,IAAI;AAEJ,SAAS,yBAAwE;CAC/E,IAAI,CAAC,gBACH,iBAAiB,IAAI,kBAA0C;CAEjE,OAAO;AACT;;;;;;AAOA,SAAgB,sBAA6C;CAC3D,OAAQ,WAAgE;AAC1E;;;;;;AAOA,SAAgB,qBAAqB,KAAsB;CACzD,AAAC,WAAoD,YAAY;AACnE;;;;;AAMA,SAAgB,uBAA6B;CAC3C,OAAQ,WAAkD;AAC5D;AAEA,SAAgB,wBAA2B,SAAiC,KAAiB;CAC3F,OAAO,uBAAuB,CAAC,CAAC,IAAI,SAAS,GAAG;AAClD;AAWA,SAAS,qBAA6C;CACpD,MAAM,UACJ,WAGA,QAAQ,SAAS;CACnB,MAAM,MAAM,UAAU;CACtB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,IAAI,IAAI;EACR,MAAM,IAAI;EACV,aAAa,IAAI;EACjB,YAAY,IAAI,iBAAiB,MAAM,QAAQ,IAAI,UAAU,IAAI,CAAC,IAAK,IAAI,cAAc,CAAC;EAC1F,eAAgB,IAAI,kBACjB,MAAM,QAAQ,IAAI,UAAU,IAAI,IAAI,aAAa,CAAC;CACvD;AACF;AAGA,SAAgB,kBAAuE;CACrF,MAAM,gBAAgB,gBAAgB,SAAS;CAC/C,MAAM,UAAU,kBAAkB,SAAY,mBAAmB,IAAI;CACrE,MAAM,aAAa,oBAAoB;CACvC,IAAI,eAAe,QAAW,OAAO;EAAE,KAAK,EAAE,GAAG,WAAW;EAAG;CAAQ;CACvE,OAAO;EAAE,KAAK,CAAC;EAAgB;CAAQ;AACzC;;;;ACzFA,MAAM,qBAAoC,OAAO,IAAI,wCAAwC;AAC7F,MAAM,iBAAgC,OAAO,IAAI,oCAAoC;AAYrF,SAAS,sBAA2C;CAElD,MAAM,WAAWA,WAAS,QAAQ;CAClC,IAAI,CAAC,UACH,MAAM,IAAI,MACR,oLAEF;CAEF,OAAO;AACT;;;;;AAMA,SAAgB,yBAA2C;CACzD,OAAO;EACL,KAAK,KAAK,SAAS;GACjB,OAAO,oBAAoB,CAAC,CAAC,KAAK,KAAK,OAAO;EAChD;EACA,MAAM,QAAQ,KAAK,aAAa,UAAU;GACxC,MAAM,oBAAoB,CAAC,CAAC,QAAQ,aAAa,KAAK,QAAQ;EAChE;CACF;AACF;;;;;;;;;;AAWA,SAAgB,uBAAyC,QAAW,SAA8B;CAChG,OAAO,eAAe,QAAQ,oBAAoB;EAChD,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;CACZ,CAAC;CACD,OAAO;AACT;;;;;;AAOA,SAAgB,oBAAoB,QAA8C;CAChF,OAAQ,OAAwD;AAClE;;;;;;;AAQA,SAAgB,mBAAqC,QAAW,KAAgB;CAC9E,OAAO,eAAe,QAAQ,gBAAgB;EAC5C,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;CACZ,CAAC;CACD,OAAO;AACT;;;;;;AAOA,SAAgB,gBAAgB,QAAoC;CAClE,OAAQ,OAA8C;AACxD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/utils/wait-point-registry.ts
|
|
2
|
+
const WAIT_POINT_REGISTRY_KEY = Symbol.for("tailor-platform/sdk:wait-point-registry");
|
|
3
|
+
function registry() {
|
|
4
|
+
const g = globalThis;
|
|
5
|
+
let state = g[WAIT_POINT_REGISTRY_KEY];
|
|
6
|
+
if (!state) {
|
|
7
|
+
state = {
|
|
8
|
+
entries: [],
|
|
9
|
+
scopeStart: 0
|
|
10
|
+
};
|
|
11
|
+
g[WAIT_POINT_REGISTRY_KEY] = state;
|
|
12
|
+
}
|
|
13
|
+
return state;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Record a declared wait point key so the CLI can check it against the key
|
|
17
|
+
* rules once the declaring module has loaded.
|
|
18
|
+
* @param entry - The key and the declaration it came from
|
|
19
|
+
*/
|
|
20
|
+
function registerWaitPoint(entry) {
|
|
21
|
+
registry().entries.push(entry);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Start a scope here, so what a run declares can be told apart from what an
|
|
25
|
+
* earlier one left behind.
|
|
26
|
+
*
|
|
27
|
+
* The registry is process-wide, and a run that fails partway still leaves its
|
|
28
|
+
* keys in it. Without a scope, a second run in the same process would be judged
|
|
29
|
+
* on the first run's keys as well as its own.
|
|
30
|
+
*/
|
|
31
|
+
function beginWaitPointScope() {
|
|
32
|
+
const state = registry();
|
|
33
|
+
state.scopeStart = state.entries.length;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Read the wait points declared since {@link beginWaitPointScope}, or every one
|
|
37
|
+
* of them when no scope was started.
|
|
38
|
+
* @returns The wait points registered in the current scope, in declaration order
|
|
39
|
+
*/
|
|
40
|
+
function getScopedWaitPoints() {
|
|
41
|
+
const state = registry();
|
|
42
|
+
return state.entries.slice(state.scopeStart);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { getScopedWaitPoints as n, registerWaitPoint as r, beginWaitPointScope as t };
|
|
47
|
+
//# sourceMappingURL=wait-point-registry-TL99zotw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-point-registry-TL99zotw.mjs","names":[],"sources":["../src/utils/wait-point-registry.ts"],"sourcesContent":["/**\n * How a wait point key reached the SDK. The declaration decides what the key\n * may contain: only `define` sees the key as a literal type, so only it can\n * type the `$params` a key carries.\n */\nexport type WaitPointDeclaration = \"createWaitPoint\" | \"define\" | \"property\";\n\n/** A wait point key as declared, before the deploy-time key rules run. */\nexport interface RegisteredWaitPoint {\n key: string;\n declaredBy: WaitPointDeclaration;\n}\n\nconst WAIT_POINT_REGISTRY_KEY: unique symbol = Symbol.for(\n \"tailor-platform/sdk:wait-point-registry\",\n);\n\ninterface Registry {\n entries: RegisteredWaitPoint[];\n scopeStart: number;\n}\n\ntype GlobalWithRegistry = typeof globalThis & {\n [WAIT_POINT_REGISTRY_KEY]?: Registry;\n};\n\nfunction registry(): Registry {\n const g = globalThis as GlobalWithRegistry;\n let state = g[WAIT_POINT_REGISTRY_KEY];\n if (!state) {\n state = { entries: [], scopeStart: 0 };\n g[WAIT_POINT_REGISTRY_KEY] = state;\n }\n return state;\n}\n\n/**\n * Record a declared wait point key so the CLI can check it against the key\n * rules once the declaring module has loaded.\n * @param entry - The key and the declaration it came from\n */\nexport function registerWaitPoint(entry: RegisteredWaitPoint): void {\n registry().entries.push(entry);\n}\n\n/**\n * Read every wait point declared by the modules loaded so far.\n * @returns The registered wait points, in declaration order\n */\nexport function getRegisteredWaitPoints(): readonly RegisteredWaitPoint[] {\n return registry().entries;\n}\n\n/**\n * Start a scope here, so what a run declares can be told apart from what an\n * earlier one left behind.\n *\n * The registry is process-wide, and a run that fails partway still leaves its\n * keys in it. Without a scope, a second run in the same process would be judged\n * on the first run's keys as well as its own.\n */\nexport function beginWaitPointScope(): void {\n const state = registry();\n state.scopeStart = state.entries.length;\n}\n\n/**\n * Read the wait points declared since {@link beginWaitPointScope}, or every one\n * of them when no scope was started.\n * @returns The wait points registered in the current scope, in declaration order\n */\nexport function getScopedWaitPoints(): readonly RegisteredWaitPoint[] {\n const state = registry();\n return state.entries.slice(state.scopeStart);\n}\n\n/**\n * Drop everything registered after a mark, where the mark is the length\n * {@link getRegisteredWaitPoints} returned earlier.\n *\n * The registry is process-wide, so a test that declares a key `deploy` rejects\n * would otherwise leave it for the deploy-time check another test file runs.\n * Nothing outside a test needs this: a CLI run declares one project's keys and\n * checks all of them.\n * @param mark - The registry length to return to\n */\nexport function restoreWaitPointRegistry(mark: number): void {\n const state = registry();\n state.entries.length = mark;\n if (state.scopeStart > mark) state.scopeStart = mark;\n}\n"],"mappings":";AAaA,MAAM,0BAAyC,OAAO,IACpD,yCACF;AAWA,SAAS,WAAqB;CAC5B,MAAM,IAAI;CACV,IAAI,QAAQ,EAAE;CACd,IAAI,CAAC,OAAO;EACV,QAAQ;GAAE,SAAS,CAAC;GAAG,YAAY;EAAE;EACrC,EAAE,2BAA2B;CAC/B;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,kBAAkB,OAAkC;CAClE,SAAS,CAAC,CAAC,QAAQ,KAAK,KAAK;AAC/B;;;;;;;;;AAkBA,SAAgB,sBAA4B;CAC1C,MAAM,QAAQ,SAAS;CACvB,MAAM,aAAa,MAAM,QAAQ;AACnC;;;;;;AAOA,SAAgB,sBAAsD;CACpE,MAAM,QAAQ,SAAS;CACvB,OAAO,MAAM,QAAQ,MAAM,MAAM,UAAU;AAC7C"}
|
package/docs/cli/application.md
CHANGED
|
@@ -190,7 +190,9 @@ Pass the global `--json` / `-j` flag to get machine-readable output.
|
|
|
190
190
|
```json
|
|
191
191
|
{
|
|
192
192
|
"summary": { "create": 2, "update": 1, "delete": 0, "replace": 0 },
|
|
193
|
-
"changes": [
|
|
193
|
+
"changes": [
|
|
194
|
+
{ "action": "create", "name": "Order", "labels": ["table"], "namespace": "tailordb" }
|
|
195
|
+
],
|
|
194
196
|
"warnings": [
|
|
195
197
|
{ "type": "unmanaged", "resourceType": "tailorDB", "name": "LegacyType" },
|
|
196
198
|
{ "type": "skippedSecret", "resourceType": "secret", "name": "DB_PASSWORD" }
|
package/docs/cli/function.md
CHANGED
|
@@ -16,12 +16,12 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
16
16
|
|
|
17
17
|
**Commands**
|
|
18
18
|
|
|
19
|
-
| Command
|
|
20
|
-
|
|
|
21
|
-
| [`function get`](#function-get)
|
|
22
|
-
| [`function list`](#function-list)
|
|
23
|
-
| [`function logs`](#function-logs)
|
|
24
|
-
| [`function
|
|
19
|
+
| Command | Aliases | Description |
|
|
20
|
+
| --------------------------------- | ---------- | --------------------------------------------------------------- |
|
|
21
|
+
| [`function get`](#function-get) | - | Get a function registry by name |
|
|
22
|
+
| [`function list`](#function-list) | - | List function registries in a workspace |
|
|
23
|
+
| [`function logs`](#function-logs) | - | List or get function execution logs. |
|
|
24
|
+
| [`function run`](#function-run) | `test-run` | Run a function on the Tailor Platform server without deploying. |
|
|
25
25
|
|
|
26
26
|
### function get
|
|
27
27
|
|
|
@@ -119,18 +119,20 @@ $ tailor function logs <execution-id> --json
|
|
|
119
119
|
|
|
120
120
|
**Notes**
|
|
121
121
|
|
|
122
|
-
When viewing a specific execution that failed, the command displays error details with the stack trace mapped back to your original source files (clickable file links and code snippets, matching `function
|
|
122
|
+
When viewing a specific execution that failed, the command displays error details with the stack trace mapped back to your original source files (clickable file links and code snippets, matching `function run` output).
|
|
123
123
|
|
|
124
124
|
Stack traces are mapped only when the execution includes a content hash for the exact build that ran. If the content hash is missing or the build is no longer available, the command falls back to a plain-text error display.
|
|
125
125
|
|
|
126
|
-
### function
|
|
126
|
+
### function run
|
|
127
127
|
|
|
128
128
|
Run a function on the Tailor Platform server without deploying.
|
|
129
129
|
|
|
130
|
+
**Aliases:** `test-run`
|
|
131
|
+
|
|
130
132
|
**Usage**
|
|
131
133
|
|
|
132
134
|
```
|
|
133
|
-
tailor function
|
|
135
|
+
tailor function run [options] <file>
|
|
134
136
|
```
|
|
135
137
|
|
|
136
138
|
**Arguments**
|
|
@@ -157,19 +159,19 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
157
159
|
**Run a resolver with input arguments**
|
|
158
160
|
|
|
159
161
|
```bash
|
|
160
|
-
$ tailor function
|
|
162
|
+
$ tailor function run resolvers/add.ts --arg '{"a":1,"b":2}'
|
|
161
163
|
```
|
|
162
164
|
|
|
163
165
|
**Run a specific workflow job by name**
|
|
164
166
|
|
|
165
167
|
```bash
|
|
166
|
-
$ tailor function
|
|
168
|
+
$ tailor function run workflows/sample.ts --name validate-order
|
|
167
169
|
```
|
|
168
170
|
|
|
169
171
|
**Run a pre-bundled .js file directly**
|
|
170
172
|
|
|
171
173
|
```bash
|
|
172
|
-
$ tailor function
|
|
174
|
+
$ tailor function run build/resolvers/add.js --arg '{"a":1,"b":2}'
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
**Notes**
|
|
@@ -177,6 +179,8 @@ $ tailor function test-run build/resolvers/add.js --arg '{"a":1,"b":2}'
|
|
|
177
179
|
You can pass either a source file (`.ts`) or a pre-bundled file (`.js`).
|
|
178
180
|
When a `.js` file is provided, detection and bundling are skipped and the file is executed as-is.
|
|
179
181
|
|
|
182
|
+
`test-run` is a deprecated alias of this command and will be removed in v3.
|
|
183
|
+
|
|
180
184
|
> [!WARNING]
|
|
181
|
-
> Workflow job `.start()` calls do not work in
|
|
185
|
+
> Workflow job `.start()` calls do not work in this mode.
|
|
182
186
|
> Started jobs are not executed; only the target job's `body` function runs in isolation.
|
package/docs/cli/setup.md
CHANGED
|
@@ -4,7 +4,7 @@ Commands for setting up project infrastructure.
|
|
|
4
4
|
|
|
5
5
|
## setup
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Set up repository automation for your project. (beta)
|
|
8
8
|
|
|
9
9
|
**Usage**
|
|
10
10
|
|
|
@@ -23,6 +23,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
|
|
|
23
23
|
| [`setup preview`](#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
|
|
24
24
|
| [`setup action`](#setup-action) | Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys). |
|
|
25
25
|
| [`setup coordinate`](#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
|
|
26
|
+
| [`setup renovate`](#setup-renovate) | Generate a Renovate config for Tailor dependency and workflow updates. |
|
|
26
27
|
| [`setup check`](#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
|
|
27
28
|
| [`setup delete`](#setup-delete) | Delete managed workflow/action file(s) and their .github/tailor.lock entries. |
|
|
28
29
|
|
|
@@ -159,6 +160,18 @@ tailor setup preview [options]
|
|
|
159
160
|
|
|
160
161
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
161
162
|
|
|
163
|
+
### setup renovate
|
|
164
|
+
|
|
165
|
+
Generate a Renovate config for Tailor dependency and workflow updates.
|
|
166
|
+
|
|
167
|
+
**Usage**
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
tailor setup renovate
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
174
|
+
|
|
162
175
|
### setup tag
|
|
163
176
|
|
|
164
177
|
Generate a tag-target deploy workflow (tag push triggers deploy).
|
package/docs/cli/tailordb.md
CHANGED
|
@@ -28,14 +28,14 @@ Truncate (delete all records from) TailorDB tables.
|
|
|
28
28
|
**Usage**
|
|
29
29
|
|
|
30
30
|
```
|
|
31
|
-
tailor tailordb truncate [options] [
|
|
31
|
+
tailor tailordb truncate [options] [tables]
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**Arguments**
|
|
35
35
|
|
|
36
|
-
| Argument | Description
|
|
37
|
-
| -------- |
|
|
38
|
-
| `
|
|
36
|
+
| Argument | Description | Required |
|
|
37
|
+
| -------- | ----------------------- | -------- |
|
|
38
|
+
| `tables` | Table names to truncate | No |
|
|
39
39
|
|
|
40
40
|
**Options**
|
|
41
41
|
|
|
@@ -62,21 +62,21 @@ tailor tailordb truncate --all --yes
|
|
|
62
62
|
# Truncate all tables in a specific namespace
|
|
63
63
|
tailor tailordb truncate --namespace myNamespace
|
|
64
64
|
|
|
65
|
-
# Truncate specific
|
|
65
|
+
# Truncate specific tables (namespace is auto-detected)
|
|
66
66
|
tailor tailordb truncate User Post Comment
|
|
67
67
|
|
|
68
|
-
# Truncate specific
|
|
68
|
+
# Truncate specific tables with confirmation skipped
|
|
69
69
|
tailor tailordb truncate User Post --yes
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
**Notes:**
|
|
73
73
|
|
|
74
|
-
- You must specify exactly one of: `--all`, `--namespace`, or
|
|
75
|
-
- When truncating specific
|
|
74
|
+
- You must specify exactly one of: `--all`, `--namespace`, or table names
|
|
75
|
+
- When truncating specific tables, the namespace is automatically detected from your config
|
|
76
76
|
- Confirmation prompts vary based on the operation:
|
|
77
77
|
- `--all`: requires typing `truncate all`
|
|
78
78
|
- `--namespace`: requires typing `truncate <namespace-name>`
|
|
79
|
-
- Specific
|
|
79
|
+
- Specific tables: requires typing `yes`
|
|
80
80
|
- Use `--yes` flag to skip confirmation prompts (useful for scripts and CI/CD)
|
|
81
81
|
- Namespaces declared with `{ external: true }` are skipped by `--all` and rejected with a dedicated error when targeted by `--namespace`. Run truncate from the app that owns the namespace.
|
|
82
82
|
|
|
@@ -94,22 +94,22 @@ tailor tailordb migration <command>
|
|
|
94
94
|
|
|
95
95
|
**Commands**
|
|
96
96
|
|
|
97
|
-
| Command | Description
|
|
98
|
-
| ----------------------------------------------------------------- |
|
|
99
|
-
| [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local
|
|
100
|
-
| [`tailordb migration rebaseline`](#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline.
|
|
101
|
-
| [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.
|
|
102
|
-
| [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number.
|
|
103
|
-
| [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations.
|
|
104
|
-
| [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
|
|
105
|
-
| [`tailordb migration test`](#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace.
|
|
106
|
-
| [`tailordb migration validate`](#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local
|
|
97
|
+
| Command | Description |
|
|
98
|
+
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
|
+
| [`tailordb migration generate`](#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local tables and the previous migration snapshot. |
|
|
100
|
+
| [`tailordb migration rebaseline`](#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
|
|
101
|
+
| [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
|
|
102
|
+
| [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
|
|
103
|
+
| [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
|
|
104
|
+
| [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
|
|
105
|
+
| [`tailordb migration test`](#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
|
|
106
|
+
| [`tailordb migration validate`](#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local tables vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
|
|
107
107
|
|
|
108
108
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
109
109
|
|
|
110
110
|
#### tailordb migration generate
|
|
111
111
|
|
|
112
|
-
Generate migration files by detecting schema differences between current local
|
|
112
|
+
Generate migration files by detecting schema differences between current local tables and the previous migration snapshot.
|
|
113
113
|
|
|
114
114
|
**Usage**
|
|
115
115
|
|
|
@@ -119,12 +119,15 @@ tailor tailordb migration generate [options]
|
|
|
119
119
|
|
|
120
120
|
**Options**
|
|
121
121
|
|
|
122
|
-
| Option
|
|
123
|
-
|
|
|
124
|
-
| `--yes`
|
|
125
|
-
| `--config <CONFIG>`
|
|
126
|
-
| `--name <NAME>`
|
|
127
|
-
| `--init`
|
|
122
|
+
| Option | Alias | Description | Required | Default | Env |
|
|
123
|
+
| ------------------------------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
|
|
124
|
+
| `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
|
|
125
|
+
| `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
|
|
126
|
+
| `--name <NAME>` | `-n` | Optional description for the migration | No | - | - |
|
|
127
|
+
| `--init` | - | Delete existing migrations and start fresh | No | `false` | - |
|
|
128
|
+
| `--rename <RENAME>` | - | Record a field or table rename instead of remove + add (format: "Table.oldField:newField" or "OldTable:NewTable"; repeatable). Renames require a migration script that copies the data. | No | - | - |
|
|
129
|
+
| `--drop <DROP>` | - | Confirm that a removed field or table is a genuine removal, not a rename (format: "Table.field" or "Table"; repeatable). Required in non-interactive runs for a removal with rename candidates. | No | - | - |
|
|
130
|
+
| `--expand-contract <EXPAND_CONTRACT>` | - | Convert a field type through a temporary field (format: "Table.field"; repeatable). Generates two migrations. | No | - | - |
|
|
128
131
|
|
|
129
132
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
130
133
|
|
|
@@ -306,7 +309,7 @@ The source workspace is read-only. Without --target-workspace-id, the command cr
|
|
|
306
309
|
|
|
307
310
|
#### tailordb migration validate
|
|
308
311
|
|
|
309
|
-
Validate the full migration history, unreviewed generated migration scripts, and schema drift (local
|
|
312
|
+
Validate the full migration history, unreviewed generated migration scripts, and schema drift (local tables vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found.
|
|
310
313
|
|
|
311
314
|
**Usage**
|
|
312
315
|
|
package/docs/cli/workspace.md
CHANGED
|
@@ -338,7 +338,7 @@ tailor profile create [options] <name>
|
|
|
338
338
|
| `--user <USER>` | `-u` | User email address or machine user client ID | Yes | - | - |
|
|
339
339
|
| `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | Yes | - | - |
|
|
340
340
|
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
|
|
341
|
-
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function
|
|
341
|
+
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function run, machineuser token). | No | - | - |
|
|
342
342
|
| `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user. | No | - | - |
|
|
343
343
|
| `--platform-url <PLATFORM_URL>` | - | Platform API base URL for this profile. | No | - | `TAILOR_PLATFORM_URL` |
|
|
344
344
|
| `--oauth2-client-id <OAUTH2_CLIENT_ID>` | - | OAuth2 client ID for logging in to this profile's platform. | No | - | `TAILOR_PLATFORM_OAUTH2_CLIENT_ID` |
|
|
@@ -399,7 +399,7 @@ tailor profile update [options] <name>
|
|
|
399
399
|
| `--user <USER>` | `-u` | New user email address or machine user client ID | No | - |
|
|
400
400
|
| `--workspace-id <WORKSPACE_ID>` | `-w` | New workspace ID | No | - |
|
|
401
401
|
| `--permission <PERMISSION>` | - | Profile permission. 'read' blocks all write commands; 'write' lifts the restriction. | No | - |
|
|
402
|
-
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function
|
|
402
|
+
| `--machine-user <MACHINE_USER>` | `-m` | Default machine user name for application-data commands (query, workflow start, function run, machineuser token). Pass an empty string to clear. | No | - |
|
|
403
403
|
| `--machine-user-override <MACHINE_USER_OVERRIDE>` | - | Whether the command line or TAILOR_PLATFORM_MACHINE_USER_NAME may override the profile's machine user. 'deny' requires --machine-user; 'allow' lifts the restriction. | No | - |
|
|
404
404
|
| `--platform-url <PLATFORM_URL>` | - | Platform API base URL for this profile. Pass an empty string to clear. | No | - |
|
|
405
405
|
| `--oauth2-client-id <OAUTH2_CLIENT_ID>` | - | OAuth2 client ID for logging in to this profile's platform. Pass an empty string to clear. | No | - |
|
package/docs/cli-reference.md
CHANGED
|
@@ -76,7 +76,7 @@ You can use environment variables to configure workspace and authentication:
|
|
|
76
76
|
| `TAILOR_DTS_PATH` | Output path for generated `tailor.d.ts` type definition file |
|
|
77
77
|
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | Client ID for `login --machine-user` |
|
|
78
78
|
| `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | Client secret for `login --machine-user` |
|
|
79
|
-
| `TAILOR_PLATFORM_MACHINE_USER_NAME` | Default machine user name for `query`, `workflow start`, `function
|
|
79
|
+
| `TAILOR_PLATFORM_MACHINE_USER_NAME` | Default machine user name for `query`, `workflow start`, `function run`, `machineuser token` |
|
|
80
80
|
| `TAILOR_PLATFORM_URL` | Platform API base URL. Saved into profiles created with `profile create --platform-url` |
|
|
81
81
|
| `TAILOR_PLATFORM_OAUTH2_CLIENT_ID` | OAuth2 client ID for user login. Saved into profiles created with `profile create --oauth2-client-id` |
|
|
82
82
|
| `TAILOR_PLATFORM_CONSOLE_URL` | Console base URL. Saved into profiles created with `profile create --console-url` |
|
|
@@ -200,19 +200,19 @@ Commands for managing Tailor Platform applications (work with `tailor.config.ts`
|
|
|
200
200
|
|
|
201
201
|
Commands for managing TailorDB tables, data, and schema migrations.
|
|
202
202
|
|
|
203
|
-
| Command | Description
|
|
204
|
-
| -------------------------------------------------------------------------------- |
|
|
205
|
-
| [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data.
|
|
206
|
-
| [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables.
|
|
207
|
-
| [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations.
|
|
208
|
-
| [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local
|
|
209
|
-
| [tailordb migration rebaseline](./cli/tailordb.md#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline.
|
|
210
|
-
| [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none.
|
|
211
|
-
| [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number.
|
|
212
|
-
| [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations.
|
|
213
|
-
| [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
|
|
214
|
-
| [tailordb migration test](./cli/tailordb.md#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace.
|
|
215
|
-
| [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local
|
|
203
|
+
| Command | Description |
|
|
204
|
+
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
205
|
+
| [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
|
|
206
|
+
| [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
|
|
207
|
+
| [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
|
|
208
|
+
| [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local tables and the previous migration snapshot. |
|
|
209
|
+
| [tailordb migration rebaseline](./cli/tailordb.md#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
|
|
210
|
+
| [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
|
|
211
|
+
| [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
|
|
212
|
+
| [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
|
|
213
|
+
| [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
|
|
214
|
+
| [tailordb migration test](./cli/tailordb.md#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
|
|
215
|
+
| [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local tables vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
|
|
216
216
|
|
|
217
217
|
### [Query Commands](./cli/query.md)
|
|
218
218
|
|
|
@@ -323,13 +323,13 @@ Commands for managing workflows and executions.
|
|
|
323
323
|
|
|
324
324
|
Commands for managing function registries and viewing function execution logs.
|
|
325
325
|
|
|
326
|
-
| Command
|
|
327
|
-
|
|
|
328
|
-
| [function](./cli/function.md#function)
|
|
329
|
-
| [function get](./cli/function.md#function-get)
|
|
330
|
-
| [function list](./cli/function.md#function-list)
|
|
331
|
-
| [function logs](./cli/function.md#function-logs)
|
|
332
|
-
| [function
|
|
326
|
+
| Command | Description |
|
|
327
|
+
| ------------------------------------------------ | --------------------------------------------------------------- |
|
|
328
|
+
| [function](./cli/function.md#function) | Manage functions |
|
|
329
|
+
| [function get](./cli/function.md#function-get) | Get a function registry by name |
|
|
330
|
+
| [function list](./cli/function.md#function-list) | List function registries in a workspace |
|
|
331
|
+
| [function logs](./cli/function.md#function-logs) | List or get function execution logs. |
|
|
332
|
+
| [function run](./cli/function.md#function-run) | Run a function on the Tailor Platform server without deploying. |
|
|
333
333
|
|
|
334
334
|
### [Executor Commands](./cli/executor.md)
|
|
335
335
|
|
|
@@ -391,13 +391,14 @@ Commands for setting up project infrastructure.
|
|
|
391
391
|
|
|
392
392
|
| Command | Description |
|
|
393
393
|
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
394
|
-
| [setup](./cli/setup.md#setup) |
|
|
394
|
+
| [setup](./cli/setup.md#setup) | Set up repository automation for your project. (beta) |
|
|
395
395
|
| [setup action](./cli/setup.md#setup-action) | Generate a per-app composite action for use with setup coordinate (monorepo multi-app deploys). |
|
|
396
396
|
| [setup branch](./cli/setup.md#setup-branch) | Generate a branch-target deploy workflow (push to branch triggers deploy). |
|
|
397
397
|
| [setup check](./cli/setup.md#setup-check) | Audit generated workflows for drift against the current config/repo (read-only). |
|
|
398
398
|
| [setup coordinate](./cli/setup.md#setup-coordinate) | Generate a coordinator workflow that orchestrates multiple --action-generated composite actions. |
|
|
399
399
|
| [setup delete](./cli/setup.md#setup-delete) | Delete managed workflow/action file(s) and their .github/tailor.lock entries. |
|
|
400
400
|
| [setup preview](./cli/setup.md#setup-preview) | Generate a preview workflow (PR open/sync triggers deploy to a per-PR workspace). |
|
|
401
|
+
| [setup renovate](./cli/setup.md#setup-renovate) | Generate a Renovate config for Tailor dependency and workflow updates. |
|
|
401
402
|
| [setup tag](./cli/setup.md#setup-tag) | Generate a tag-target deploy workflow (tag push triggers deploy). |
|
|
402
403
|
|
|
403
404
|
### [Upgrade Commands](./cli/upgrade.md)
|