@tailor-platform/sdk 1.78.0 → 1.80.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 +40 -0
- package/dist/{application-CUxVA7Fs.mjs → application-C1d52JP9.mjs} +290 -224
- package/dist/application-C1d52JP9.mjs.map +1 -0
- package/dist/application-Nlh9BHQf.mjs +3 -0
- package/dist/cli/commands/tailordb/migrate/bundler.d.mts +3 -2
- package/dist/cli/index.mjs +27 -53
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +3 -6
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/tsconfig-paths-hook.d.mts +1 -0
- package/dist/cli/tsconfig-paths-hook.mjs +153 -0
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/config/types.d.mts +5 -1
- package/dist/configure/index.mjs +7 -6
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/auth/types.d.mts +18 -23
- package/dist/configure/services/tailordb/schema.d.mts +1 -7
- package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
- package/dist/configure/types/type.d.mts +1 -9
- package/dist/{globals-CvizbGLY.mjs → globals-B-n_3uYu.mjs} +11 -5
- package/dist/globals-B-n_3uYu.mjs.map +1 -0
- package/dist/{runtime-BD2vYJFT.mjs → register-typescript-runtime-Bd4bcLbW.mjs} +399 -124
- package/dist/register-typescript-runtime-Bd4bcLbW.mjs.map +1 -0
- package/dist/{registry-CYBRvfaU.mjs → registry-CXi7rJq7.mjs} +3 -2
- package/dist/registry-CXi7rJq7.mjs.map +1 -0
- package/dist/runtime/field-parse.d.mts +11 -0
- package/dist/runtime/globals.d.mts +4 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/workflow.d.mts +79 -15
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{schema-U6DxoZ8D.mjs → schema-CYrle8JZ.mjs} +42 -24
- package/dist/schema-CYrle8JZ.mjs.map +1 -0
- package/dist/{service-D12iQGcS.mjs → service-CDPatibu.mjs} +31 -17
- package/dist/service-CDPatibu.mjs.map +1 -0
- package/dist/service-Cg7Qibit.mjs +3 -0
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.mjs +36 -10
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mocks/workflow.d.mts +29 -15
- package/dist/vitest/setup.mjs +1 -1
- package/dist/workflow-CkIDJpdg.mjs +69 -0
- package/dist/workflow-CkIDJpdg.mjs.map +1 -0
- package/docs/cli/application.md +6 -0
- package/docs/cli-reference.md +21 -21
- package/docs/configuration.md +2 -0
- package/docs/runtime.md +2 -2
- package/docs/services/auth.md +2 -2
- package/docs/services/tailordb.md +2 -0
- package/docs/services/workflow.md +2 -2
- package/docs/testing.md +2 -2
- package/package.json +7 -6
- package/dist/application-CUxVA7Fs.mjs.map +0 -1
- package/dist/application-Dp_-ioiP.mjs +0 -3
- package/dist/configure/types/field-runtime.d.mts +0 -17
- package/dist/globals-CvizbGLY.mjs.map +0 -1
- package/dist/registry-CYBRvfaU.mjs.map +0 -1
- package/dist/runtime-BD2vYJFT.mjs.map +0 -1
- package/dist/schema-U6DxoZ8D.mjs.map +0 -1
- package/dist/service-CghpdV-9.mjs +0 -3
- package/dist/service-D12iQGcS.mjs.map +0 -1
- package/dist/workflow-DSwnYPPP.mjs +0 -45
- package/dist/workflow-DSwnYPPP.mjs.map +0 -1
|
@@ -125,9 +125,10 @@ function dispatchTriggerJob(name, args, options) {
|
|
|
125
125
|
}
|
|
126
126
|
function dispatchTriggerWorkflow(name, args, options) {
|
|
127
127
|
const workflow = currentPlatformWorkflow();
|
|
128
|
-
|
|
128
|
+
if (!workflow) return runRegisteredWorkflow(name, args);
|
|
129
|
+
return arguments.length >= 3 ? workflow.triggerWorkflow(name, args, options) : workflow.triggerWorkflow(name, args);
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
//#endregion
|
|
132
133
|
export { getRegisteredWorkflow as a, runRegisteredJob as c, getRegisteredJob as i, runRegisteredWorkflow as l, dispatchTriggerJob as n, registerJob as o, dispatchTriggerWorkflow as r, registerWorkflow as s, TRIGGER_DEFAULT as t, platformSerialize as u };
|
|
133
|
-
//# sourceMappingURL=registry-
|
|
134
|
+
//# sourceMappingURL=registry-CXi7rJq7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-CXi7rJq7.mjs","names":[],"sources":["../src/utils/test/platform-serialize.ts","../src/configure/services/workflow/registry.ts"],"sourcesContent":["/**\n * Validate and serialize a value as it would cross the Platform JSON boundary.\n *\n * Mirrors the runtime checks the platform performs on workflow arguments,\n * wait payloads, and trigger inputs so that local tests fail in the same\n * places production fails.\n *\n * Throws on:\n * - `NaN` / `Infinity` / `-Infinity` (`JSON.stringify` would silently emit `null`)\n * - `BigInt` (TypeError is thrown by `JSON.stringify`; we emit a clearer message)\n * - Non-plain objects (class instances, including `Date`, `Map`, `Set`, `Error`,\n * and user-defined DTOs whose prototype is not `Object.prototype`)\n *\n * The replacer reads `this[key]` so the check sees the original value before\n * any `toJSON` conversion (e.g. `Date.prototype.toJSON`).\n * @param value - Value to validate and round-trip\n * @returns The JSON-normalized value (undefined/function properties stripped, etc.)\n */\nexport function platformSerialize<T>(value: T): T {\n // Top-level undefined is allowed (jobs may take no input).\n if (value === undefined) return undefined as T;\n\n // Root function/symbol stringify to `undefined`; throw a specific message here.\n if (typeof value === \"function\") {\n throw new TypeError(\"platformSerialize: function is not JSON-serializable at <root>\");\n }\n if (typeof value === \"symbol\") {\n throw new TypeError(\"platformSerialize: Symbol is not JSON-serializable at <root>\");\n }\n\n const serialized = JSON.stringify(value, function (key, val) {\n if (typeof val === \"number\" && !Number.isFinite(val)) {\n throw new TypeError(\n `platformSerialize: non-finite number at ${formatPath(key)}: ${String(val)}`,\n );\n }\n if (typeof val === \"bigint\") {\n throw new TypeError(\n `platformSerialize: BigInt is not JSON-serializable at ${formatPath(key)}`,\n );\n }\n // Look at the pre-toJSON value so Date/Map/Set/etc. can be detected.\n const raw = (this as Record<string, unknown>)[key];\n if (raw !== null && typeof raw === \"object\" && !Array.isArray(raw)) {\n const proto = Object.getPrototypeOf(raw);\n if (proto !== Object.prototype && proto !== null) {\n const ctor = (raw as { constructor?: { name?: string } }).constructor?.name ?? \"anonymous\";\n throw new TypeError(\n `platformSerialize: non-plain object at ${formatPath(key)} (${ctor} instance)`,\n );\n }\n }\n return val;\n });\n\n // `JSON.stringify` returns `undefined` when the root collapses (e.g. a `toJSON`\n // returning `undefined`); parsing that would throw opaquely.\n // JSON.stringify returns undefined for non-serializable values\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (serialized === undefined) {\n throw new TypeError(\"platformSerialize: value is not JSON-serializable at <root>\");\n }\n\n return JSON.parse(serialized) as T;\n}\n\nfunction formatPath(key: string): string {\n return key === \"\" ? \"<root>\" : `\"${key}\"`;\n}\n","import { platformSerialize } from \"#/utils/test/platform-serialize\";\nimport { buildJobContext } from \"./test-env-key\";\nimport type { TailorEnv, TailorInvoker } from \"#/runtime/types\";\nimport type { StartJobFunctionOptions, StartWorkflowOptions } from \"#/runtime/workflow\";\n\n/**\n * Body signature shared by workflow jobs at registry-write time.\n * The user's `createWorkflowJob`/`createWorkflow` body uses concrete types,\n * but the registry erases them for storage.\n */\nexport type RegisteredJobBody = (\n args: unknown,\n context: { env: TailorEnv; invoker?: TailorInvoker },\n) => unknown | Promise<unknown>;\n\nexport interface RegisteredWorkflow {\n mainJobName: string;\n}\n\nconst JOB_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:job-registry\");\nconst WORKFLOW_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:workflow-registry\");\n\ntype PlatformWorkflow = {\n startWorkflow: (name: string, args?: unknown, options?: StartWorkflowOptions) => Promise<string>;\n triggerWorkflow: (\n name: string,\n args?: unknown,\n options?: StartWorkflowOptions,\n ) => Promise<string>;\n startJobFunction: (name: string, args?: unknown, options?: StartJobFunctionOptions) => unknown;\n triggerJobFunction: (name: string, args?: unknown, options?: StartJobFunctionOptions) => unknown;\n};\n\ntype GlobalWithRegistry = typeof globalThis & {\n [JOB_REGISTRY_KEY]?: Map<string, RegisteredJobBody>;\n [WORKFLOW_REGISTRY_KEY]?: Map<string, RegisteredWorkflow>;\n tailor?: { workflow?: PlatformWorkflow };\n};\n\nfunction jobs(): Map<string, RegisteredJobBody> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[JOB_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[JOB_REGISTRY_KEY] = map;\n }\n return map;\n}\n\nfunction workflows(): Map<string, RegisteredWorkflow> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[WORKFLOW_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[WORKFLOW_REGISTRY_KEY] = map;\n }\n return map;\n}\n\n/**\n * Register a job body keyed by job name. Called as a side effect by\n * `createWorkflowJob` so the vitest mock can execute the body when\n * `globalThis.tailor.workflow.triggerJobFunction(name, args)` is invoked.\n *\n * In production builds the bundler rewrites `.trigger()` calls so this registry\n * is never read; the gated write is dropped as dead code.\n * @param name - Job name\n * @param body - Job body function\n */\nexport function registerJob(name: string, body: RegisteredJobBody): void {\n jobs().set(name, body);\n}\n\n/**\n * Look up a registered job body by name.\n * @param name - Job name\n * @returns The registered body, or undefined when no job is registered\n */\nexport function getRegisteredJob(name: string): RegisteredJobBody | undefined {\n return jobs().get(name);\n}\n\n/**\n * Register a workflow's main job name so the mock can run the workflow locally.\n * @param name - Workflow name\n * @param mainJobName - Name of the workflow's main job\n */\nexport function registerWorkflow(name: string, mainJobName: string): void {\n workflows().set(name, { mainJobName });\n}\n\n/**\n * Look up a registered workflow by name.\n * @param name - Workflow name\n * @returns The registered workflow, or undefined\n */\nexport function getRegisteredWorkflow(name: string): RegisteredWorkflow | undefined {\n return workflows().get(name);\n}\n\nfunction currentPlatformWorkflow(): PlatformWorkflow | undefined {\n // globalThis may not have the tailor property at runtime\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n return (globalThis as GlobalWithRegistry).tailor?.workflow;\n}\n\n// A valid placeholder UUID, so callers that validate the execution id behave the\n// same locally as against the platform.\nexport const TRIGGER_DEFAULT = \"00000000-0000-4000-8000-000000000000\";\n\nfunction serializeReturn(out: unknown): unknown {\n return out instanceof Promise ? out.then((v) => platformSerialize(v)) : platformSerialize(out);\n}\n\n// Runs the registered body across the platform JSON boundary. Shared by the\n// `tailor-runtime` default runner and the no-shim `.trigger()` fallback below.\nexport function runRegisteredJob(name: string, args?: unknown): unknown {\n const body = getRegisteredJob(name);\n const out = body ? body(platformSerialize(args), buildJobContext()) : null;\n return serializeReturn(out);\n}\n\nexport async function runRegisteredWorkflow(name: string, args?: unknown): Promise<string> {\n const workflow = getRegisteredWorkflow(name);\n if (workflow) await runRegisteredJob(workflow.mainJobName, args);\n return TRIGGER_DEFAULT;\n}\n\n// `.trigger()` routes through the installed `tailor.workflow` shim, falling back\n// to running the registered body/workflow locally when none is installed.\n// Preserve arity: the shim sees a 2-argument call when the caller supplied no\n// options, and a 3-argument call otherwise, mirroring the bundler rewrite so\n// mocks observe the same shape in local execution and in bundled workflows.\nexport function dispatchTriggerJob(\n name: string,\n args?: unknown,\n options?: StartJobFunctionOptions,\n): unknown {\n const workflow = currentPlatformWorkflow();\n if (!workflow) return runRegisteredJob(name, args);\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 3\n ? workflow.triggerJobFunction(name, args, options)\n : workflow.triggerJobFunction(name, args);\n}\n\n// Accepts `unknown` because the SDK-side `.trigger()` accepts a wider options\n// shape than the platform surface (e.g. `authInvoker` may be a machine-user\n// name string that the bundler normalizes at build time). Local execution\n// forwards the value verbatim; only the bundled path enforces the platform\n// contract.\nexport function dispatchTriggerWorkflow(\n name: string,\n args?: unknown,\n options?: unknown,\n): Promise<string> {\n const workflow = currentPlatformWorkflow();\n if (!workflow) return runRegisteredWorkflow(name, args);\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 3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,MAAM,IAAI;AAC5C;AAOA,SAAgB,wBACd,MACA,MACA,SACiB;CACjB,MAAM,WAAW,wBAAwB;CACzC,IAAI,CAAC,UAAU,OAAO,sBAAsB,MAAM,IAAI;CAEtD,OAAO,UAAU,UAAU,IACvB,SAAS,gBAAgB,MAAM,MAAM,OAA2C,IAChF,SAAS,gBAAgB,MAAM,IAAI;AACzC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TailorUser } from "./types.mjs";
|
|
2
|
+
import "../configure/types/field.types.mjs";
|
|
3
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
|
+
//#region src/runtime/field-parse.d.ts
|
|
5
|
+
type FieldParseArgs = {
|
|
6
|
+
value: unknown;
|
|
7
|
+
data: unknown;
|
|
8
|
+
user: TailorUser;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { FieldParseArgs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthInvoker, TriggerWorkflowOptions } from "./workflow.mjs";
|
|
1
|
+
import { AuthInvoker, StartWorkflowOptions, TriggerWorkflowOptions } from "./workflow.mjs";
|
|
2
2
|
import { ContextInvoker } from "./context.mjs";
|
|
3
3
|
import { TailorDBFileErrorCode } from "./file.mjs";
|
|
4
4
|
import { IconvInstance } from "./iconv.mjs";
|
|
@@ -17,6 +17,7 @@ type TailorIdpUser = User;
|
|
|
17
17
|
type TailorIdpUserQuery = UserQuery;
|
|
18
18
|
type TailorWorkflowAuthInvoker = AuthInvoker;
|
|
19
19
|
type TailorWorkflowTriggerWorkflowOptions = TriggerWorkflowOptions;
|
|
20
|
+
type TailorWorkflowStartWorkflowOptions = StartWorkflowOptions;
|
|
20
21
|
declare global {
|
|
21
22
|
namespace tailordb {
|
|
22
23
|
type QueryResult<T> = TailordbQueryResult<T>;
|
|
@@ -75,6 +76,8 @@ declare global {
|
|
|
75
76
|
}
|
|
76
77
|
namespace workflow {
|
|
77
78
|
type AuthInvoker = TailorWorkflowAuthInvoker;
|
|
79
|
+
type StartWorkflowOptions = TailorWorkflowStartWorkflowOptions;
|
|
80
|
+
/** @deprecated Use `StartWorkflowOptions` instead. */
|
|
78
81
|
type TriggerWorkflowOptions = TailorWorkflowTriggerWorkflowOptions;
|
|
79
82
|
}
|
|
80
83
|
namespace context {
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { s as iconv_exports } from "../iconv-D2vi8G36.mjs";
|
|
|
2
2
|
import { r as secretmanager_exports } from "../secretmanager-BVxw3ih_.mjs";
|
|
3
3
|
import { t as authconnection_exports } from "../authconnection-BGQM8FZI.mjs";
|
|
4
4
|
import { n as idp_exports } from "../idp-Bx25ZBdN.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { l as workflow_exports } from "../workflow-CkIDJpdg.mjs";
|
|
6
6
|
import { t as context_exports } from "../context-Bd266-ru.mjs";
|
|
7
7
|
import { a as file_exports } from "../file-_oUZo76X.mjs";
|
|
8
8
|
import { t as aigateway_exports } from "../aigateway-B3oZZE6v.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare namespace workflow_d_exports {
|
|
2
|
-
export { AuthInvoker, ExecutionPolicyKey, TailorWorkflowAPI, TriggerJobFunctionOptions, TriggerWorkflowOptions, resolve, resumeWorkflow, triggerJobFunction, triggerWorkflow, wait };
|
|
2
|
+
export { AuthInvoker, ExecutionPolicyKey, StartJobFunctionOptions, StartWorkflowOptions, TailorWorkflowAPI, TriggerJobFunctionOptions, TriggerWorkflowOptions, resolve, resumeWorkflow, resumeWorkflowExecution, startJobFunction, startWorkflow, triggerJobFunction, triggerWorkflow, wait };
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* Workflow utilities.
|
|
@@ -7,10 +7,16 @@ declare namespace workflow_d_exports {
|
|
|
7
7
|
* Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.
|
|
8
8
|
* At runtime this delegates to `globalThis.tailor.workflow`. Use `mockWorkflow`
|
|
9
9
|
* from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.
|
|
10
|
+
*
|
|
11
|
+
* The canonical names (`startWorkflow`, `startJobFunction`,
|
|
12
|
+
* `resumeWorkflowExecution`) mirror the public `tailor.v1` RPC vocabulary.
|
|
13
|
+
* The pre-alignment names (`triggerWorkflow`, `triggerJobFunction`,
|
|
14
|
+
* `resumeWorkflow`) are kept as frozen aliases that reference the same platform
|
|
15
|
+
* implementations, so existing code continues to work unchanged.
|
|
10
16
|
* @example
|
|
11
17
|
* import { workflow } from "@tailor-platform/sdk/runtime";
|
|
12
18
|
*
|
|
13
|
-
* const executionId = await workflow.
|
|
19
|
+
* const executionId = await workflow.startWorkflow("myWorkflow", { data: "value" });
|
|
14
20
|
*/
|
|
15
21
|
/**
|
|
16
22
|
* Specifies the machine user that should be used to execute the workflow.
|
|
@@ -22,11 +28,16 @@ interface AuthInvoker {
|
|
|
22
28
|
/** The name of the machine user to use for workflow execution */
|
|
23
29
|
machineUserName: string;
|
|
24
30
|
}
|
|
25
|
-
/** Options for {@link
|
|
26
|
-
interface
|
|
31
|
+
/** Options for {@link startWorkflow}. */
|
|
32
|
+
interface StartWorkflowOptions {
|
|
27
33
|
/** Optional authentication invoker to specify which machine user should execute the workflow */
|
|
28
34
|
authInvoker?: AuthInvoker;
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Frozen alias for {@link StartWorkflowOptions}. Kept for backward compatibility.
|
|
38
|
+
* @deprecated Use {@link StartWorkflowOptions} instead.
|
|
39
|
+
*/
|
|
40
|
+
type TriggerWorkflowOptions = StartWorkflowOptions;
|
|
30
41
|
declare const executionPolicyKeyBrand: unique symbol;
|
|
31
42
|
/**
|
|
32
43
|
* A concrete runtime key produced by an execution policy instance — either an
|
|
@@ -37,14 +48,19 @@ declare const executionPolicyKeyBrand: unique symbol;
|
|
|
37
48
|
type ExecutionPolicyKey = string & {
|
|
38
49
|
readonly [executionPolicyKeyBrand]: never;
|
|
39
50
|
};
|
|
40
|
-
/** Options for {@link
|
|
41
|
-
interface
|
|
51
|
+
/** Options for {@link startJobFunction}. */
|
|
52
|
+
interface StartJobFunctionOptions {
|
|
42
53
|
/**
|
|
43
54
|
* Execution policy key matched by the platform against the policies
|
|
44
55
|
* declared with `defineWorkflowExecutionPolicies` in `tailor.config.ts`.
|
|
45
56
|
*/
|
|
46
57
|
executionPolicyKey?: ExecutionPolicyKey;
|
|
47
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Frozen alias for {@link StartJobFunctionOptions}. Kept for backward compatibility.
|
|
61
|
+
* @deprecated Use {@link StartJobFunctionOptions} instead.
|
|
62
|
+
*/
|
|
63
|
+
type TriggerJobFunctionOptions = StartJobFunctionOptions;
|
|
48
64
|
/**
|
|
49
65
|
* Platform API surface for `tailor.workflow`. Describes the shape the platform
|
|
50
66
|
* runtime injects on `globalThis.tailor.workflow`.
|
|
@@ -55,26 +71,53 @@ interface TriggerJobFunctionOptions {
|
|
|
55
71
|
*/
|
|
56
72
|
interface TailorWorkflowAPI {
|
|
57
73
|
/**
|
|
58
|
-
*
|
|
74
|
+
* Starts a workflow and returns its execution ID.
|
|
75
|
+
*
|
|
76
|
+
* Canonical name that mirrors the `tailor.v1` RPC vocabulary.
|
|
77
|
+
* {@link triggerWorkflow} is a frozen alias that resolves to the same
|
|
78
|
+
* platform implementation.
|
|
59
79
|
* @param workflowName - Workflow name as defined in tailor.config
|
|
60
80
|
* @param args - Arguments forwarded to the workflow's main job
|
|
61
|
-
* @param options - Optional
|
|
62
|
-
* @returns The execution ID of the
|
|
81
|
+
* @param options - Optional start options (e.g. `authInvoker`)
|
|
82
|
+
* @returns The execution ID of the started workflow
|
|
83
|
+
*/
|
|
84
|
+
startWorkflow(workflowName: string, args?: any, options?: StartWorkflowOptions): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Frozen alias for {@link startWorkflow}. Kept for backward compatibility.
|
|
87
|
+
* @deprecated Use {@link startWorkflow} instead.
|
|
63
88
|
*/
|
|
64
89
|
triggerWorkflow(workflowName: string, args?: any, options?: TriggerWorkflowOptions): Promise<string>;
|
|
65
90
|
/**
|
|
66
91
|
* Resumes a failed or pending-retry workflow execution and returns its execution ID.
|
|
92
|
+
*
|
|
93
|
+
* Canonical name that mirrors the `tailor.v1` RPC vocabulary.
|
|
94
|
+
* {@link resumeWorkflow} is a frozen alias that resolves to the same
|
|
95
|
+
* platform implementation.
|
|
67
96
|
* @param executionId - The execution to resume
|
|
68
97
|
* @returns The execution ID of the resumed workflow
|
|
69
98
|
*/
|
|
99
|
+
resumeWorkflowExecution(executionId: string): Promise<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.
|
|
102
|
+
* @deprecated Use {@link resumeWorkflowExecution} instead.
|
|
103
|
+
*/
|
|
70
104
|
resumeWorkflow(executionId: string): Promise<string>;
|
|
71
105
|
/**
|
|
72
|
-
*
|
|
106
|
+
* Starts a job function and returns its result.
|
|
107
|
+
*
|
|
108
|
+
* Canonical name that mirrors the `tailor.v1` RPC vocabulary.
|
|
109
|
+
* {@link triggerJobFunction} is a frozen alias that resolves to the same
|
|
110
|
+
* platform implementation.
|
|
73
111
|
* @param jobName - Job name as defined in the workflow
|
|
74
112
|
* @param args - Arguments forwarded to the job
|
|
75
|
-
* @param options - Optional
|
|
113
|
+
* @param options - Optional start options (e.g. `executionPolicyKey`)
|
|
76
114
|
* @returns The job's return value
|
|
77
115
|
*/
|
|
116
|
+
startJobFunction(jobName: string, args?: any, options?: StartJobFunctionOptions): any;
|
|
117
|
+
/**
|
|
118
|
+
* Frozen alias for {@link startJobFunction}. Kept for backward compatibility.
|
|
119
|
+
* @deprecated Use {@link startJobFunction} instead.
|
|
120
|
+
*/
|
|
78
121
|
triggerJobFunction(jobName: string, args?: any, options?: TriggerJobFunctionOptions): any;
|
|
79
122
|
/**
|
|
80
123
|
* Suspends the current workflow execution and waits for an external signal to resume.
|
|
@@ -93,19 +136,40 @@ interface TailorWorkflowAPI {
|
|
|
93
136
|
resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;
|
|
94
137
|
}
|
|
95
138
|
/**
|
|
96
|
-
* See {@link TailorWorkflowAPI.
|
|
139
|
+
* See {@link TailorWorkflowAPI.startWorkflow}.
|
|
140
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.startWorkflow}
|
|
141
|
+
* @returns The execution ID of the started workflow
|
|
142
|
+
*/
|
|
143
|
+
declare const startWorkflow: TailorWorkflowAPI["startWorkflow"];
|
|
144
|
+
/**
|
|
145
|
+
* Frozen alias for {@link startWorkflow}. Kept for backward compatibility.
|
|
146
|
+
* @deprecated Use {@link startWorkflow} instead.
|
|
97
147
|
* @param args - Forwarded to {@link TailorWorkflowAPI.triggerWorkflow}
|
|
98
148
|
* @returns The execution ID of the triggered workflow
|
|
99
149
|
*/
|
|
100
150
|
declare const triggerWorkflow: TailorWorkflowAPI["triggerWorkflow"];
|
|
101
151
|
/**
|
|
102
|
-
* See {@link TailorWorkflowAPI.
|
|
152
|
+
* See {@link TailorWorkflowAPI.resumeWorkflowExecution}.
|
|
153
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflowExecution}
|
|
154
|
+
* @returns The execution ID of the resumed workflow
|
|
155
|
+
*/
|
|
156
|
+
declare const resumeWorkflowExecution: TailorWorkflowAPI["resumeWorkflowExecution"];
|
|
157
|
+
/**
|
|
158
|
+
* Frozen alias for {@link resumeWorkflowExecution}. Kept for backward compatibility.
|
|
159
|
+
* @deprecated Use {@link resumeWorkflowExecution} instead.
|
|
103
160
|
* @param args - Forwarded to {@link TailorWorkflowAPI.resumeWorkflow}
|
|
104
161
|
* @returns The execution ID of the resumed workflow
|
|
105
162
|
*/
|
|
106
163
|
declare const resumeWorkflow: TailorWorkflowAPI["resumeWorkflow"];
|
|
107
164
|
/**
|
|
108
|
-
* See {@link TailorWorkflowAPI.
|
|
165
|
+
* See {@link TailorWorkflowAPI.startJobFunction}.
|
|
166
|
+
* @param args - Forwarded to {@link TailorWorkflowAPI.startJobFunction}
|
|
167
|
+
* @returns The job's return value
|
|
168
|
+
*/
|
|
169
|
+
declare const startJobFunction: TailorWorkflowAPI["startJobFunction"];
|
|
170
|
+
/**
|
|
171
|
+
* Frozen alias for {@link startJobFunction}. Kept for backward compatibility.
|
|
172
|
+
* @deprecated Use {@link startJobFunction} instead.
|
|
109
173
|
* @param args - Forwarded to {@link TailorWorkflowAPI.triggerJobFunction}
|
|
110
174
|
* @returns The job's return value
|
|
111
175
|
*/
|
|
@@ -123,4 +187,4 @@ declare const wait: TailorWorkflowAPI["wait"];
|
|
|
123
187
|
*/
|
|
124
188
|
declare const resolve: TailorWorkflowAPI["resolve"];
|
|
125
189
|
//#endregion
|
|
126
|
-
export { AuthInvoker, ExecutionPolicyKey, TailorWorkflowAPI, TriggerJobFunctionOptions, TriggerWorkflowOptions, resolve, resumeWorkflow, triggerJobFunction, triggerWorkflow, wait, workflow_d_exports };
|
|
190
|
+
export { AuthInvoker, ExecutionPolicyKey, StartJobFunctionOptions, StartWorkflowOptions, TailorWorkflowAPI, TriggerJobFunctionOptions, TriggerWorkflowOptions, resolve, resumeWorkflow, resumeWorkflowExecution, startJobFunction, startWorkflow, triggerJobFunction, triggerWorkflow, wait, workflow_d_exports };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as wait, i as
|
|
1
|
+
import { a as startWorkflow, c as wait, i as startJobFunction, n as resumeWorkflow, o as triggerJobFunction, r as resumeWorkflowExecution, s as triggerWorkflow, t as resolve } from "../workflow-CkIDJpdg.mjs";
|
|
2
2
|
|
|
3
|
-
export { resolve, resumeWorkflow, triggerJobFunction, triggerWorkflow, wait };
|
|
3
|
+
export { resolve, resumeWorkflow, resumeWorkflowExecution, startJobFunction, startWorkflow, triggerJobFunction, triggerWorkflow, wait };
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import { t as brandValue } from "./brand-Eo4pLXPJ.mjs";
|
|
2
2
|
import { cloneDeep } from "es-toolkit";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
5
|
-
/**
|
|
6
|
-
* Normalize allowed values into EnumValue objects with descriptions.
|
|
7
|
-
* @param values - Allowed values as strings or EnumValue objects
|
|
8
|
-
* @returns Normalized allowed values
|
|
9
|
-
*/
|
|
10
|
-
function mapAllowedValues(values) {
|
|
11
|
-
return values.map((value) => {
|
|
12
|
-
if (typeof value === "string") return {
|
|
13
|
-
value,
|
|
14
|
-
description: ""
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
...value,
|
|
18
|
-
description: value.description ?? ""
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/configure/types/field-runtime.ts
|
|
4
|
+
//#region src/runtime/field-parse.ts
|
|
25
5
|
const regex = {
|
|
26
6
|
uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
27
7
|
date: /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})$/,
|
|
@@ -200,6 +180,45 @@ function parseInternal(args) {
|
|
|
200
180
|
if (issues.length > 0) return { issues };
|
|
201
181
|
return { value: value ?? null };
|
|
202
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Validate a value against a record of input fields, treating the record as a
|
|
185
|
+
* single required object — the same code path deployed functions run via
|
|
186
|
+
* `t.object(fields).parse(...)`, so local validation matches platform behavior.
|
|
187
|
+
* @param args - Input field definitions plus the value, context data, and user
|
|
188
|
+
* @returns Validation result
|
|
189
|
+
*/
|
|
190
|
+
function parseInputFields(args) {
|
|
191
|
+
const { fields, ...parseArgs } = args;
|
|
192
|
+
return parseInternal({
|
|
193
|
+
...parseArgs,
|
|
194
|
+
field: {
|
|
195
|
+
type: "nested",
|
|
196
|
+
fields,
|
|
197
|
+
_metadata: { required: true }
|
|
198
|
+
},
|
|
199
|
+
pathArray: []
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/configure/types/field.ts
|
|
205
|
+
/**
|
|
206
|
+
* Normalize allowed values into EnumValue objects with descriptions.
|
|
207
|
+
* @param values - Allowed values as strings or EnumValue objects
|
|
208
|
+
* @returns Normalized allowed values
|
|
209
|
+
*/
|
|
210
|
+
function mapAllowedValues(values) {
|
|
211
|
+
return values.map((value) => {
|
|
212
|
+
if (typeof value === "string") return {
|
|
213
|
+
value,
|
|
214
|
+
description: ""
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
...value,
|
|
218
|
+
description: value.description ?? ""
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
203
222
|
|
|
204
223
|
//#endregion
|
|
205
224
|
//#region src/configure/services/tailordb/schema.ts
|
|
@@ -260,7 +279,6 @@ function createTailorDBFieldRuntime(type, options, fields, values) {
|
|
|
260
279
|
pathArray: []
|
|
261
280
|
});
|
|
262
281
|
},
|
|
263
|
-
_parseInternal: parseInternal$1,
|
|
264
282
|
relation(config) {
|
|
265
283
|
const cloned = field.clone();
|
|
266
284
|
const targetType = isRelationSelfConfig(config) ? "self" : config.toward.type.name;
|
|
@@ -636,5 +654,5 @@ timestamps: () => ({
|
|
|
636
654
|
};
|
|
637
655
|
|
|
638
656
|
//#endregion
|
|
639
|
-
export { parseInternal as
|
|
640
|
-
//# sourceMappingURL=schema-
|
|
657
|
+
export { parseInternal as i, mapAllowedValues as n, parseInputFields as r, db as t };
|
|
658
|
+
//# sourceMappingURL=schema-CYrle8JZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-CYrle8JZ.mjs","names":["parseInternal","parseFieldInternal"],"sources":["../src/runtime/field-parse.ts","../src/configure/types/field.ts","../src/configure/services/tailordb/schema.ts"],"sourcesContent":["import type { FieldMetadata, TailorFieldType } from \"#/configure/types/field.types\";\nimport type { TailorUser } from \"./types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nconst regex = {\n uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n date: /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/,\n time: /^(?<hour>\\d{2}):(?<minute>\\d{2})$/,\n datetime:\n /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})T(?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2})(\\.(?<millisec>\\d{3}))?Z$/,\n decimal: /^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/,\n} as const;\n\nexport type FieldParseArgs = {\n value: unknown;\n data: unknown;\n user: TailorUser;\n};\n\nexport type FieldParseInternalArgs = {\n value: unknown;\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\nexport type FieldRuntime<T extends TailorFieldType = TailorFieldType> = {\n readonly type: T;\n readonly fields: Record<string, FieldRuntime>;\n _metadata: FieldMetadata;\n};\n\ntype FieldParseRuntimeArgs<T extends TailorFieldType> = FieldParseInternalArgs & {\n field: FieldRuntime<T>;\n};\n\ntype FieldValidationArgs<T extends TailorFieldType> = FieldParseRuntimeArgs<T> & {\n issues: StandardSchemaV1.Issue[];\n};\n\nfunction validateBaseValue<T extends TailorFieldType>(args: FieldValidationArgs<T>): boolean {\n const { field, value, pathArray, issues } = args;\n const path = pathArray.length > 0 ? pathArray : undefined;\n const initialIssueCount = issues.length;\n\n switch (field.type) {\n case \"string\":\n if (typeof value !== \"string\") {\n issues.push({\n message: `Expected a string: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"integer\":\n if (typeof value !== \"number\" || !Number.isInteger(value)) {\n issues.push({\n message: `Expected an integer: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"float\":\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n issues.push({\n message: `Expected a number: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"boolean\":\n if (typeof value !== \"boolean\") {\n issues.push({\n message: `Expected a boolean: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"uuid\":\n if (typeof value !== \"string\" || !regex.uuid.test(value)) {\n issues.push({\n message: `Expected a valid UUID: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"date\":\n if (typeof value !== \"string\" || !regex.date.test(value)) {\n issues.push({\n message: `Expected to match \"yyyy-MM-dd\" format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"datetime\":\n if (typeof value !== \"string\" || !regex.datetime.test(value)) {\n issues.push({\n message: `Expected to match ISO format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"time\":\n if (typeof value !== \"string\" || !regex.time.test(value)) {\n issues.push({\n message: `Expected to match \"HH:mm\" format: received ${String(value)}`,\n path,\n });\n }\n break;\n case \"decimal\":\n if (typeof value !== \"string\" || !regex.decimal.test(value)) {\n issues.push({\n message: `Expected a decimal string: received ${String(value)}`,\n path,\n });\n }\n break;\n\n case \"enum\":\n if (field._metadata.allowedValues) {\n const allowedValues = field._metadata.allowedValues.map((v) => v.value);\n if (typeof value !== \"string\" || !allowedValues.includes(value)) {\n issues.push({\n message: `Must be one of [${allowedValues.join(\", \")}]: received ${String(value)}`,\n path,\n });\n }\n }\n break;\n\n case \"nested\": {\n // Runtime input may not match the declared field type.\n // oxlint-disable typescript/no-unnecessary-condition\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value) ||\n value instanceof Date\n ) {\n // oxlint-enable typescript/no-unnecessary-condition\n issues.push({\n message: `Expected an object: received ${String(value)}`,\n path,\n });\n return false;\n }\n\n let nestedBaseValid = true;\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n const fieldValue = (value as Record<string, unknown>)[fieldName];\n if (\n !validateBaseField({\n ...args,\n field: nestedField,\n value: fieldValue,\n pathArray: pathArray.concat(fieldName),\n })\n ) {\n nestedBaseValid = false;\n }\n }\n return nestedBaseValid;\n }\n }\n\n return issues.length === initialIssueCount;\n}\n\nfunction validateCustomValue<T extends TailorFieldType>(\n args: FieldValidationArgs<T>,\n validateFns: NonNullable<FieldMetadata[\"validate\"]>,\n): void {\n const { value, data, user, pathArray, issues } = args;\n const path = pathArray.length > 0 ? pathArray : undefined;\n\n for (const validateInput of validateFns) {\n const { fn, message } =\n typeof validateInput === \"function\"\n ? { fn: validateInput, message: \"Validation failed\" }\n : { fn: validateInput[0], message: validateInput[1] };\n\n if (!fn({ value, data, user })) {\n issues.push({\n message,\n path,\n });\n }\n }\n}\n\nfunction validateBaseField<T extends TailorFieldType>(args: FieldValidationArgs<T>): boolean {\n const { field, value, pathArray, issues } = args;\n const path = pathArray.length > 0 ? pathArray : undefined;\n\n const isNullOrUndefined = value === null || value === undefined;\n if (field._metadata.required && isNullOrUndefined) {\n issues.push({\n message: \"Required field is missing\",\n path,\n });\n return false;\n }\n\n if (!field._metadata.required && isNullOrUndefined) {\n return true;\n }\n\n let baseValid = true;\n if (field._metadata.array) {\n if (!Array.isArray(value)) {\n issues.push({\n message: \"Expected an array\",\n path,\n });\n return false;\n }\n\n for (let i = 0; i < value.length; i++) {\n if (\n !validateBaseValue({\n ...args,\n value: value[i],\n pathArray: pathArray.concat(`[${i}]`),\n })\n ) {\n baseValid = false;\n }\n }\n } else {\n baseValid = validateBaseValue(args);\n }\n\n return baseValid;\n}\n\nfunction validateCustomField<T extends TailorFieldType>(args: FieldValidationArgs<T>): void {\n const { field, value, pathArray } = args;\n if (value === null || value === undefined) {\n return;\n }\n\n if (field.type === \"nested\") {\n const records = field._metadata.array\n ? (value as Record<string, unknown>[])\n : [value as Record<string, unknown>];\n\n for (let i = 0; i < records.length; i++) {\n const record = records[i] as Record<string, unknown>;\n const recordPath = field._metadata.array ? pathArray.concat(`[${i}]`) : pathArray;\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n validateCustomField({\n ...args,\n field: nestedField,\n value: record[fieldName],\n pathArray: recordPath.concat(fieldName),\n });\n }\n }\n }\n\n const validateFns = field._metadata.validate;\n if (validateFns?.length) {\n validateCustomValue(args, validateFns);\n }\n}\n\nexport function parseInternal<T extends TailorFieldType, Output>(\n args: FieldParseRuntimeArgs<T>,\n): StandardSchemaV1.Result<Output> {\n const { value } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n const validationArgs = { ...args, issues };\n const baseValid = validateBaseField(validationArgs);\n if (baseValid) {\n validateCustomField(validationArgs);\n }\n if (issues.length > 0) {\n return { issues };\n }\n\n return { value: (value ?? null) as Output };\n}\n\ntype ParseInputFieldsArgs = FieldParseArgs & {\n fields: Record<string, FieldRuntime>;\n};\n\n/**\n * Validate a value against a record of input fields, treating the record as a\n * single required object — the same code path deployed functions run via\n * `t.object(fields).parse(...)`, so local validation matches platform behavior.\n * @param args - Input field definitions plus the value, context data, and user\n * @returns Validation result\n */\nexport function parseInputFields(args: ParseInputFieldsArgs): StandardSchemaV1.Result<unknown> {\n const { fields, ...parseArgs } = args;\n return parseInternal({\n ...parseArgs,\n field: { type: \"nested\", fields, _metadata: { required: true } },\n pathArray: [],\n });\n}\n","import type { EnumValue } from \"#/configure/types/field.types\";\n\nexport type AllowedValues = readonly [string | EnumValue, ...(string | EnumValue)[]];\n\n/**\n * Normalize allowed values into EnumValue objects with descriptions.\n * @param values - Allowed values as strings or EnumValue objects\n * @returns Normalized allowed values\n */\nexport function mapAllowedValues(values: AllowedValues): EnumValue[] {\n return values.map((value) => {\n if (typeof value === \"string\") {\n return { value, description: \"\" };\n }\n return { ...value, description: value.description ?? \"\" };\n });\n}\n\nexport type AllowedValuesOutput<V extends AllowedValues> = V[number] extends infer T\n ? T extends string\n ? T\n : T extends { value: infer K }\n ? K\n : never\n : never;\n","import { cloneDeep } from \"es-toolkit\";\nimport {\n type AllowedValues,\n type AllowedValuesOutput,\n mapAllowedValues,\n} from \"#/configure/types/field\";\nimport {\n parseInternal as parseFieldInternal,\n type FieldParseArgs,\n type FieldParseInternalArgs,\n} from \"#/runtime/field-parse\";\nimport { brandValue } from \"#/utils/brand\";\nimport type {\n TailorDBField as TailorDBFieldBase,\n TailorDBType as TailorDBTypeBase,\n DBFieldMetadata,\n DefinedDBFieldMetadata,\n SerialConfig,\n IndexDef,\n TailorDBTypeMetadata,\n RawRelationConfig,\n RelationType,\n} from \"#/configure/services/tailordb/types\";\nimport type {\n FieldOptions,\n FieldOutput,\n TailorFieldType,\n TailorToTs,\n FieldValidateInput,\n ValidateConfig,\n Validators,\n} from \"#/configure/types/field.types\";\nimport type { PluginAttachment, PluginConfigs } from \"#/plugin/types\";\nimport type { InferredAttributeMap } from \"#/runtime/types\";\nimport type { output, InferFieldsOutput, TypeLevelError } from \"#/types/helpers\";\nimport type { RawPermissions } from \"#/types/tailordb.generated\";\nimport type { TailorTypeGqlPermission, TailorTypePermission } from \"./permission\";\nimport type { Hook, Hooks, ExcludeNestedDBFields, TypeFeatures } from \"./types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// Erased DB fields stay assignable across builder method-state changes.\n// oxlint-disable-next-line no-explicit-any\ntype AnyBuilderMethod = any;\n\nexport type TailorAnyDBField = Omit<\n TailorDBFieldBase<AnyBuilderMethod, AnyBuilderMethod>,\n \"fields\"\n> & {\n readonly fields: Record<string, AnyBuilderMethod>;\n _metadata: DBFieldMetadata;\n parse: AnyBuilderMethod;\n readonly typeName: TypeLevelError<string>;\n description: AnyBuilderMethod;\n relation: AnyBuilderMethod;\n index: AnyBuilderMethod;\n unique: AnyBuilderMethod;\n vector: AnyBuilderMethod;\n hooks: AnyBuilderMethod;\n validate: AnyBuilderMethod;\n serial: AnyBuilderMethod;\n clone: AnyBuilderMethod;\n};\n\n// Helper alias\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyDBType = TailorDBType<any, any, any>;\n\ntype IsAny<T> = 0 extends 1 & T ? true : false;\ntype DBFieldTypeNameMethod<Defined extends DefinedDBFieldMetadata> =\n IsAny<Defined> extends true\n ? TypeLevelError<string>\n : TypeLevelError<\"typeName cannot be used on TailorDB fields\">;\n\ntype WithDBFieldDescription<Defined> = Defined & { description: true };\ntype WithDBFieldRelation<Defined, S extends RelationType | RelationSelfConfig> = S extends\n | \"oneToOne\"\n | \"1-1\"\n ? Defined & { unique: true; index: true; relation: true }\n : S extends { type: \"oneToOne\" | \"1-1\" }\n ? Defined & { unique: true; index: true; relation: true }\n : Defined & { index: true; relation: true };\ntype WithDBFieldIndex<Defined> = Defined & { index: true };\ntype WithDBFieldUnique<Defined> = Defined & { unique: true; index: true };\ntype WithDBFieldVector<Defined> = Defined & { vector: true };\ntype WithDBFieldHooks<Defined, H> = Defined & {\n hooks: {\n create: H extends { create: unknown } ? true : false;\n update: H extends { update: unknown } ? true : false;\n };\n serial: false;\n};\ntype WithDBFieldValidate<Defined> = Defined & { validate: true };\ntype WithDBFieldSerial<Defined> = Defined & {\n serial: true;\n hooks: { create: false; update: false };\n};\ntype WithDBFieldCloneOptions<Defined extends DefinedDBFieldMetadata, NewOpt extends FieldOptions> =\n IsAny<Defined> extends true\n ? Defined\n : Omit<Defined, \"array\"> & {\n array: NewOpt extends { array: true } ? true : Defined[\"array\"];\n };\ntype DBFieldCloneOptions<Defined extends DefinedDBFieldMetadata> = Omit<FieldOptions, \"array\"> & {\n array?: Defined extends { validate: unknown } ? Defined[\"array\"] : boolean;\n};\ntype InvalidValidatedArrayCloneKeys<\n Fields extends Record<string, TailorAnyDBField>,\n K extends keyof Fields,\n Opt extends FieldOptions,\n> = Opt extends { array: infer ArrayOption }\n ? {\n [P in K]: Fields[P] extends TailorDBField<infer Defined, infer _Output>\n ? Defined extends { validate: unknown }\n ? ArrayOption extends Defined[\"array\"]\n ? never\n : P\n : never\n : never;\n }[K]\n : never;\ntype DBFieldsCloneOptionsGuard<\n Fields extends Record<string, TailorAnyDBField>,\n K extends keyof Fields,\n Opt extends FieldOptions,\n> = [InvalidValidatedArrayCloneKeys<Fields, K, Opt>] extends [never]\n ? unknown\n : TypeLevelError<\"array cannot be changed on fields with custom validation\">;\ntype DefinedDBTypeMetadata = {\n hooks?: true;\n validate?: true;\n features?: true;\n indexes?: true;\n files?: true;\n permission?: true;\n gqlPermission?: true;\n description?: true;\n};\ntype WithDBTypeMetadata<\n Defined extends DefinedDBTypeMetadata,\n Key extends keyof DefinedDBTypeMetadata,\n> = Defined & Record<Key, true>;\ntype DBTypeDuplicateInputGuard<\n Defined extends DefinedDBTypeMetadata,\n Key extends keyof DefinedDBTypeMetadata,\n Input,\n Message extends string,\n> =\n IsAny<Defined> extends true\n ? Input\n : Defined extends Record<Key, unknown>\n ? TypeLevelError<Message>\n : Input;\ntype DBTypeDuplicateRestGuard<\n Defined extends DefinedDBTypeMetadata,\n Key extends keyof DefinedDBTypeMetadata,\n Input extends unknown[],\n Message extends string,\n> =\n IsAny<Defined> extends true\n ? Input\n : Defined extends Record<Key, unknown>\n ? [TypeLevelError<Message>, ...TypeLevelError<Message>[]]\n : Input;\ntype FileKeyConflictError<\n Fields extends Record<string, TailorAnyDBField>,\n User extends object,\n> = Partial<\n Record<\n keyof output<TailorDBType<Fields, User>> & string,\n TypeLevelError<\"file keys cannot use existing field names\">\n >\n>;\ntype DBFieldDescriptionFn<Defined extends DefinedDBFieldMetadata, Output> = (\n description: string,\n) => TailorDBField<WithDBFieldDescription<Defined>, Output>;\ntype DBFieldRelationFn<Defined extends DefinedDBFieldMetadata, Output> = {\n <S extends RelationType, T extends TailorAnyDBType>(\n config: RelationConfig<S, T>,\n ): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;\n <S extends RelationSelfConfig>(config: S): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;\n};\ntype DBFieldIndexFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<\n WithDBFieldIndex<Defined>,\n Output\n>;\ntype DBFieldUniqueFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<\n WithDBFieldUnique<Defined>,\n Output\n>;\ntype DBFieldVectorFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<\n WithDBFieldVector<Defined>,\n Output\n>;\ntype DBFieldHooksFn<Defined extends DefinedDBFieldMetadata, Output> = <\n const H extends Hook<unknown, Output>,\n>(\n hooks: H,\n) => TailorDBField<WithDBFieldHooks<Defined, H>, Output>;\ntype DBFieldValidateFn<Defined extends DefinedDBFieldMetadata, Output> = (\n ...validate: FieldValidateInput<Output>[]\n) => TailorDBField<WithDBFieldValidate<Defined>, Output>;\ntype DBFieldSerialFn<Defined extends DefinedDBFieldMetadata, Output> = (\n config: SerialConfig<Defined[\"type\"] & (\"integer\" | \"string\")>,\n) => TailorDBField<WithDBFieldSerial<Defined>, Output>;\ntype DBFieldDescriptionMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldDescriptionFn<Defined, Output>\n : Defined extends { description: unknown }\n ? TypeLevelError<\".description() has already been set\">\n : DBFieldDescriptionFn<Defined, Output>;\ntype DBFieldRelationMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldRelationFn<Defined, Output>\n : Defined extends { relation: unknown }\n ? TypeLevelError<\".relation() has already been set\">\n : DBFieldRelationFn<Defined, Output>;\ntype DBFieldArrayCheck<A extends boolean, Ok, Msg extends string> = A extends true\n ? TypeLevelError<Msg>\n : Ok;\ntype DBFieldIndexMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldIndexFn<Defined, Output>\n : Defined extends { index: unknown }\n ? TypeLevelError<\".index() has already been set\">\n : DBFieldArrayCheck<\n Defined[\"array\"],\n DBFieldIndexFn<Defined, Output>,\n \"index cannot be set on array fields\"\n >;\ntype DBFieldUniqueMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldUniqueFn<Defined, Output>\n : Defined extends { unique: unknown }\n ? TypeLevelError<\".unique() has already been set\">\n : DBFieldArrayCheck<\n Defined[\"array\"],\n DBFieldUniqueFn<Defined, Output>,\n \"unique cannot be set on array fields\"\n >;\ntype DBFieldVectorMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldVectorFn<Defined, Output>\n : Defined extends { vector: unknown }\n ? TypeLevelError<\".vector() has already been set\">\n : Defined extends { type: \"string\"; array: false }\n ? DBFieldVectorFn<Defined, Output>\n : TypeLevelError<\"vector can only be set on non-array string fields\">;\ntype DBFieldHooksMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldHooksFn<Defined, Output>\n : Defined extends {\n serial: true;\n hooks: { create: false; update: false };\n }\n ? TypeLevelError<\"hooks cannot be set after serial\">\n : Defined extends {\n hooks: unknown;\n }\n ? TypeLevelError<\".hooks() has already been set\">\n : Defined extends { type: \"nested\" }\n ? TypeLevelError<\"hooks cannot be set on nested type fields\">\n : DBFieldHooksFn<Defined, Output>;\ntype DBFieldValidateMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldValidateFn<Defined, Output>\n : Defined extends { validate: unknown }\n ? TypeLevelError<\".validate() has already been set\">\n : DBFieldValidateFn<Defined, Output>;\ntype DBFieldSerialMethod<Defined extends DefinedDBFieldMetadata, Output> =\n IsAny<Defined> extends true\n ? DBFieldSerialFn<Defined, Output>\n : Defined extends { serial: true }\n ? TypeLevelError<\".serial() has already been set\">\n : Defined extends { serial: false }\n ? TypeLevelError<\"serial cannot be set after hooks\">\n : IsAny<Output> extends true\n ? Defined extends { type: \"integer\" | \"string\"; array: false }\n ? DBFieldSerialFn<Defined, Output>\n : TypeLevelError<\"serial can only be set on non-array integer or string fields\">\n : null extends Output\n ? TypeLevelError<\"serial can only be set on non-array integer or string fields\">\n : Defined extends { type: \"integer\" | \"string\"; array: false }\n ? DBFieldSerialFn<Defined, Output>\n : TypeLevelError<\"serial can only be set on non-array integer or string fields\">;\n/**\n * Full TailorDBField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorDBField<\n Defined extends DefinedDBFieldMetadata = DefinedDBFieldMetadata,\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n> extends Omit<TailorDBFieldBase<Defined, Output>, \"fields\"> {\n readonly fields: Record<string, TailorAnyDBField>;\n _metadata: DBFieldMetadata;\n\n /**\n * Parse and validate a value against this field's validation rules\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n\n /**\n * typeName is not available on TailorDB fields.\n * Use typeName on pipeline fields (t.enum / t.object) instead.\n */\n typeName: DBFieldTypeNameMethod<Defined>;\n\n /**\n * Set a description for the field\n */\n description: DBFieldDescriptionMethod<Defined, Output>;\n\n /**\n * Define a relation to another type.\n */\n relation: DBFieldRelationMethod<Defined, Output>;\n\n /**\n * Add an index to the field\n */\n index: DBFieldIndexMethod<Defined, Output>;\n\n /**\n * Make the field unique (also adds an index)\n */\n unique: DBFieldUniqueMethod<Defined, Output>;\n\n /**\n * Enable vector search on the field (string type only)\n */\n vector: DBFieldVectorMethod<Defined, Output>;\n\n /**\n * Add hooks for create/update operations on this field.\n */\n hooks: DBFieldHooksMethod<Defined, Output>;\n\n /**\n * Add validation functions to the field.\n *\n * Validators receive `{ value, data, user }` and run after hooks and\n * built-in type validation; they are skipped when built-in validation\n * fails. For array fields, `value` is the complete array.\n */\n validate: DBFieldValidateMethod<Defined, Output>;\n\n /**\n * Configure serial/auto-increment behavior\n */\n serial: DBFieldSerialMethod<Defined, Output>;\n\n /**\n * Clone the field with optional overrides for field options.\n * The `array` option cannot change on fields with custom validation.\n */\n clone<const NewOpt extends DBFieldCloneOptions<Defined>>(\n options?: NewOpt,\n ): TailorDBField<\n WithDBFieldCloneOptions<Defined, NewOpt>,\n FieldOutput<TailorToTs[Defined[\"type\"]], NewOpt>\n >;\n}\n\n/**\n * Full TailorDBType interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorDBType<\n // oxlint-disable-next-line no-explicit-any\n Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributeMap,\n // oxlint-disable-next-line no-explicit-any\n Defined extends DefinedDBTypeMetadata = any,\n> extends TailorDBTypeBase<Fields, User> {\n _description?: string;\n\n hooks(\n hooks: DBTypeDuplicateInputGuard<\n Defined,\n \"hooks\",\n Hooks<Fields>,\n \".hooks() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"hooks\">>;\n validate(\n validators: DBTypeDuplicateInputGuard<\n Defined,\n \"validate\",\n Validators<Fields>,\n \".validate() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"validate\">>;\n features(\n features: DBTypeDuplicateInputGuard<\n Defined,\n \"features\",\n Omit<TypeFeatures, \"pluralForm\">,\n \".features() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"features\">>;\n indexes(\n ...indexes: DBTypeDuplicateRestGuard<\n Defined,\n \"indexes\",\n IndexDef<TailorDBType<Fields, User, Defined>>[],\n \".indexes() has already been set\"\n >\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"indexes\">>;\n files<const F extends string>(\n files: DBTypeDuplicateInputGuard<\n Defined,\n \"files\",\n Record<F, string> & FileKeyConflictError<Fields, User>,\n \".files() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"files\">>;\n permission<\n U extends object = User,\n P extends TailorTypePermission<U, output<TailorDBType<Fields, User, Defined>>> =\n TailorTypePermission<U, output<TailorDBType<Fields, User, Defined>>>,\n >(\n permission: DBTypeDuplicateInputGuard<\n Defined,\n \"permission\",\n P,\n \".permission() has already been set\"\n >,\n ): TailorDBType<Fields, U, WithDBTypeMetadata<Defined, \"permission\">>;\n gqlPermission<\n U extends object = User,\n P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>,\n >(\n permission: DBTypeDuplicateInputGuard<\n Defined,\n \"gqlPermission\",\n P,\n \".gqlPermission() has already been set\"\n >,\n ): TailorDBType<Fields, U, WithDBTypeMetadata<Defined, \"gqlPermission\">>;\n description(\n description: DBTypeDuplicateInputGuard<\n Defined,\n \"description\",\n string,\n \".description() has already been set\"\n >,\n ): TailorDBType<Fields, User, WithDBTypeMetadata<Defined, \"description\">>;\n pickFields<K extends keyof Fields>(keys: K[]): Pick<Fields, K>;\n pickFields<K extends keyof Fields, const Opt extends FieldOptions>(\n keys: K[],\n options: Opt & DBFieldsCloneOptionsGuard<Fields, K, Opt>,\n ): {\n [P in K]: Fields[P] extends TailorDBField<infer D, infer _O>\n ? TailorDBField<WithDBFieldCloneOptions<D, Opt>, FieldOutput<TailorToTs[D[\"type\"]], Opt>>\n : never;\n };\n omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K>;\n plugin<P extends keyof PluginConfigs<keyof Fields & string>>(config: {\n [K in P]: PluginConfigs<keyof Fields & string>[K];\n }): TailorDBType<Fields, User, Defined>;\n}\n\nexport type TailorDBInstance<\n // oxlint-disable-next-line no-explicit-any\n Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributeMap,\n // oxlint-disable-next-line no-explicit-any\n Defined extends DefinedDBTypeMetadata = any,\n> = TailorDBType<Fields, User, Defined>;\n\ninterface RelationConfig<S extends RelationType, T extends TailorDBType> {\n type: S;\n toward: {\n type: T;\n as?: string;\n key?: keyof T[\"fields\"] & string;\n };\n backward?: string;\n}\n\n// Special config variant for self-referencing relations\ntype RelationSelfConfig = {\n type: RelationType;\n toward: {\n type: \"self\";\n as?: string;\n key?: string;\n };\n backward?: string;\n};\n\nfunction isRelationSelfConfig(\n config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig,\n): config is RelationSelfConfig {\n return config.toward.type === \"self\";\n}\n\ntype DBFieldDefined<T extends TailorFieldType, Opt extends FieldOptions> = {\n type: T;\n array: Opt extends { array: true } ? true : false;\n};\ntype DBFieldOutput<\n T extends TailorFieldType,\n Opt extends FieldOptions,\n OutputBase = TailorToTs[T],\n> = FieldOutput<OutputBase, Opt>;\ntype TailorDBFieldInstance<\n T extends TailorFieldType,\n Opt extends FieldOptions,\n OutputBase = TailorToTs[T],\n> = TailorDBField<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;\ntype TailorDBFieldRuntimeInstance<\n T extends TailorFieldType,\n Opt extends FieldOptions,\n OutputBase = TailorToTs[T],\n> = TailorDBFieldRuntime<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;\ntype TailorDBFieldRuntime<Defined extends DefinedDBFieldMetadata, Output> = Omit<\n TailorDBFieldBase<Defined, Output>,\n \"fields\"\n> & {\n readonly fields: Record<string, TailorAnyDBField>;\n _metadata: DBFieldMetadata;\n description(description: string): object;\n typeName(typeName: string): object;\n validate(...validate: FieldValidateInput<Output>[]): object;\n relation(config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig): object;\n index(): object;\n unique(): object;\n vector(): object;\n hooks(hooks: Hook<unknown, Output>): object;\n serial(config: SerialConfig): object;\n clone(options?: FieldOptions): TailorDBFieldRuntime<DefinedDBFieldMetadata, AnyBuilderMethod>;\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n _setRawRelation(relation: RawRelationConfig): void;\n};\n\n/**\n * Creates a new TailorDBField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @returns A new TailorDBField\n */\nfunction createTailorDBField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n): TailorDBFieldInstance<T, TOptions, OutputBase>;\nfunction createTailorDBField<const T extends TailorFieldType, const TOptions extends FieldOptions>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n): object {\n return createTailorDBFieldRuntime(type, options, fields, values);\n}\n\nfunction createTailorDBFieldRuntime<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyDBField>,\n values?: AllowedValues,\n): TailorDBFieldRuntimeInstance<T, TOptions, OutputBase> {\n type FieldValue = DBFieldOutput<T, TOptions, OutputBase>;\n type FieldType = TailorDBFieldRuntimeInstance<T, TOptions, OutputBase>;\n\n const _metadata: DBFieldMetadata = { required: true };\n let _rawRelation: RawRelationConfig | undefined;\n\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n\n function parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<FieldValue> {\n return parseFieldInternal<T, FieldValue>({\n ...args,\n field,\n });\n }\n\n function cloneWith(metadataUpdates: Partial<DBFieldMetadata>) {\n const cloned = field.clone();\n Object.assign(cloned._metadata, metadataUpdates);\n return cloned;\n }\n\n const field: FieldType = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as DBFieldDefined<T, TOptions>,\n _output: undefined as FieldValue,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n get rawRelation(): Readonly<RawRelationConfig> | undefined {\n return _rawRelation ? { ..._rawRelation, toward: { ..._rawRelation.toward } } : undefined;\n },\n\n description(description: string) {\n return cloneWith({ description });\n },\n\n typeName(typeName: string) {\n return cloneWith({ typeName });\n },\n\n validate(...validateInputs: FieldValidateInput<FieldValue>[]) {\n return cloneWith({ validate: validateInputs });\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldValue> {\n return parseInternal({\n value: args.value,\n data: args.data,\n user: args.user,\n pathArray: [],\n });\n },\n\n // TailorDBField specific methods\n relation(config: RelationConfig<RelationType, TailorDBType> | RelationSelfConfig) {\n const cloned = field.clone();\n const targetType = isRelationSelfConfig(config) ? \"self\" : config.toward.type.name;\n cloned._setRawRelation({\n type: config.type,\n toward: {\n type: targetType,\n as: config.toward.as,\n key: config.toward.key,\n },\n backward: config.backward,\n });\n return cloned;\n },\n\n index() {\n return cloneWith({ index: true });\n },\n\n unique() {\n return cloneWith({ unique: true, index: true });\n },\n\n vector() {\n return cloneWith({ vector: true });\n },\n\n hooks(hooks: Hook<unknown, FieldValue>) {\n return cloneWith({ hooks });\n },\n\n serial(config: SerialConfig) {\n return cloneWith({ serial: config });\n },\n\n clone(cloneOptions?: FieldOptions) {\n if (\n this._metadata.validate?.length &&\n cloneOptions?.array !== undefined &&\n cloneOptions.array !== (this._metadata.array === true)\n ) {\n throw new Error(\"Cannot change the array option on a field with custom validation\");\n }\n\n // Deep clone nested object fields if present\n let clonedFields = fields;\n if (fields) {\n const cloned: Record<string, TailorAnyDBField> = {};\n for (const [key, field] of Object.entries(fields)) {\n cloned[key] = field.clone();\n }\n clonedFields = cloned;\n }\n\n // Create a new field with cloned configuration\n const clonedField = createTailorDBFieldRuntime(type, options, clonedFields, values);\n\n // Deep copy metadata using cloneDeep (preserves function references)\n Object.assign(clonedField._metadata, cloneDeep(this._metadata));\n\n // Apply new options if provided\n if (cloneOptions) {\n if (cloneOptions.optional !== undefined) {\n clonedField._metadata.required = !cloneOptions.optional;\n }\n if (cloneOptions.array !== undefined) {\n clonedField._metadata.array = cloneOptions.array;\n }\n }\n\n // Copy raw relation if exists\n if (_rawRelation) {\n clonedField._setRawRelation(cloneDeep(_rawRelation));\n }\n\n return clonedField;\n },\n\n _setRawRelation(relation: RawRelationConfig) {\n _rawRelation = relation;\n },\n };\n\n return field;\n}\n\nconst createField = createTailorDBField;\n\n/**\n * Create a UUID field.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example db.uuid()\n * @example db.uuid({ optional: true })\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"uuid\", options);\n}\n\n/**\n * Create a string field.\n * @param options - Field configuration options\n * @returns A string field\n * @example db.string()\n * @example db.string({ optional: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"string\", options);\n}\n\n/**\n * Create a boolean field.\n * Note: The method name is `bool` but creates a `boolean` type field.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example db.bool()\n * @example db.bool({ optional: true })\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"boolean\", options);\n}\n\n/**\n * Create an integer field.\n * @param options - Field configuration options\n * @returns An integer field\n * @example db.int()\n * @example db.int({ optional: true })\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"integer\", options);\n}\n\n/**\n * Create a float (decimal number) field.\n * @param options - Field configuration options\n * @returns A float field\n * @example db.float()\n * @example db.float({ optional: true })\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"float\", options);\n}\n\ninterface DecimalFieldOptions extends FieldOptions {\n scale?: number;\n}\n\n/**\n * Create a decimal field (stored as string for precision).\n * @param options - Field configuration options including optional scale (0-12)\n * @returns A decimal field\n * @example db.decimal()\n * @example db.decimal({ scale: 2 })\n * @example db.decimal({ scale: 2, optional: true })\n */\nfunction decimal<const Opt extends DecimalFieldOptions>(options?: Opt) {\n if (options?.scale !== undefined) {\n if (!Number.isInteger(options.scale) || options.scale < 0 || options.scale > 12) {\n throw new Error(\"scale must be an integer between 0 and 12\");\n }\n }\n const field = createField(\"decimal\", options);\n if (options?.scale !== undefined) {\n field._metadata.scale = options.scale;\n }\n return field;\n}\n\n/**\n * Create a date field (date only, no time component).\n * Format: \"yyyy-MM-dd\"\n * @param options - Field configuration options\n * @returns A date field\n * @example db.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"date\", options);\n}\n\n/**\n * Create a datetime field (date and time).\n * Format: ISO 8601 \"yyyy-MM-ddTHH:mm:ssZ\"\n * @param options - Field configuration options\n * @returns A datetime field\n * @example db.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"datetime\", options);\n}\n\n/**\n * Create a time field (time only, no date component).\n * Format: \"HH:mm\"\n * @param options - Field configuration options\n * @returns A time field\n * @example db.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createField(\"time\", options);\n}\n\n/**\n * Create an enum field with a fixed set of allowed string values.\n * @param values - Array of allowed string values, or array of `{ value, description }` objects\n * @param options - Field configuration options\n * @returns An enum field\n * @example db.enum([\"active\", \"inactive\", \"suspended\"])\n * @example db.enum([\"small\", \"medium\", \"large\"], { optional: true })\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorDBField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\n/**\n * Create a nested object field with sub-fields.\n * @param fields - Record of nested field definitions\n * @param options - Field configuration options\n * @returns A nested object field\n * @example db.object({ street: db.string(), city: db.string(), zip: db.string() })\n * @example db.object({ name: db.string() }, { optional: true })\n */\nfunction object<\n const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>,\n const Opt extends FieldOptions,\n>(fields: F, options?: Opt) {\n return createField(\"nested\", options, fields) as unknown as TailorDBField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutput<F>, Opt>\n >;\n}\n\n/**\n * Creates a new TailorDBType instance.\n * @param name - Type name\n * @param fields - Field definitions\n * @param options - Type options\n * @param options.pluralForm - Optional plural form\n * @param options.description - Optional description\n * @returns A new TailorDBType\n */\nfunction createTailorDBType<\n // oxlint-disable-next-line no-explicit-any\n const Fields extends Record<string, TailorAnyDBField> = any,\n User extends object = InferredAttributeMap,\n>(\n name: string,\n fields: Fields,\n options: { pluralForm?: string; description?: string },\n): TailorDBType<Fields, User, DefinedDBTypeMetadata> {\n let _description = options.description;\n let _settings: TypeFeatures = {};\n let _indexes: IndexDef<TailorDBType<Fields, User, DefinedDBTypeMetadata>>[] = [];\n const _permissions: RawPermissions = {};\n let _files: Record<string, string> = {};\n const _plugins: PluginAttachment[] = [];\n const _definedMethods = new Set<keyof DefinedDBTypeMetadata>();\n if (options.description !== undefined) {\n _definedMethods.add(\"description\");\n }\n\n function runMethodOnce<T>(method: keyof DefinedDBTypeMetadata, action: () => T): T {\n if (_definedMethods.has(method)) {\n throw new Error(`.${method}() has already been set`);\n }\n const result = action();\n _definedMethods.add(method);\n return result;\n }\n type TypeAfter<Key extends keyof DefinedDBTypeMetadata> = TailorDBType<\n Fields,\n User,\n WithDBTypeMetadata<DefinedDBTypeMetadata, Key>\n >;\n type TypeAfterUser<\n NextUser extends object,\n Key extends keyof DefinedDBTypeMetadata,\n > = TailorDBType<Fields, NextUser, WithDBTypeMetadata<DefinedDBTypeMetadata, Key>>;\n\n if (options.pluralForm) {\n if (name === options.pluralForm) {\n throw new Error(`The name and the plural form must be different. name=${name}`);\n }\n _settings.pluralForm = options.pluralForm;\n }\n\n const dbType: TailorDBType<Fields, User, DefinedDBTypeMetadata> = {\n name,\n fields: { ...fields },\n _output: null as unknown as InferFieldsOutput<Fields>,\n _description,\n\n get metadata(): TailorDBTypeMetadata {\n // Convert indexes to the format expected by the manifest\n const indexes: Record<string, { fields: string[]; unique?: boolean }> = {};\n if (_indexes.length > 0) {\n _indexes.forEach((index) => {\n const fieldNames = index.fields.map((field) => String(field));\n const key = index.name || `idx_${fieldNames.join(\"_\")}`;\n indexes[key] = {\n fields: fieldNames,\n unique: index.unique,\n };\n });\n }\n\n return {\n name: this.name,\n description: _description,\n settings: _settings,\n permissions: _permissions,\n files: _files,\n ...(Object.keys(indexes).length > 0 && { indexes }),\n };\n },\n\n hooks(hooks: Hooks<Fields>): TypeAfter<\"hooks\"> {\n return runMethodOnce(\"hooks\", () => {\n // `Hooks<Fields>` is strongly typed, but `Object.entries()` loses that information.\n // oxlint-disable-next-line no-explicit-any\n Object.entries(hooks).forEach(([fieldName, fieldHooks]: [string, any]) => {\n const field = this.fields[fieldName];\n if (field === undefined) throw new Error(`field not found: ${fieldName}`);\n (this.fields as Record<string, TailorAnyDBField>)[fieldName] = (\n field as TailorAnyDBField\n ).hooks(fieldHooks);\n });\n return this as TypeAfter<\"hooks\">;\n });\n },\n\n validate(validators: Validators<Fields>): TypeAfter<\"validate\"> {\n return runMethodOnce(\"validate\", () => {\n Object.entries(validators).forEach(([fieldName, fieldValidators]) => {\n const field = this.fields[fieldName] as TailorAnyDBField;\n\n const validators = fieldValidators as\n | FieldValidateInput<unknown>\n | FieldValidateInput<unknown>[];\n\n const isValidateConfig = (v: unknown): v is ValidateConfig<unknown> => {\n return Array.isArray(v) && v.length === 2 && typeof v[1] === \"string\";\n };\n\n let updatedField: TailorAnyDBField;\n if (Array.isArray(validators)) {\n if (isValidateConfig(validators)) {\n updatedField = field.validate(validators);\n } else {\n updatedField = field.validate(...validators);\n }\n } else {\n updatedField = field.validate(validators);\n }\n (this.fields as Record<string, TailorAnyDBField>)[fieldName] = updatedField;\n });\n return this as TypeAfter<\"validate\">;\n });\n },\n\n features(features: Omit<TypeFeatures, \"pluralForm\">): TypeAfter<\"features\"> {\n return runMethodOnce(\"features\", () => {\n _settings = {\n ..._settings,\n ...features,\n };\n return this as TypeAfter<\"features\">;\n });\n },\n\n indexes(\n ...indexes: IndexDef<TailorDBType<Fields, User, DefinedDBTypeMetadata>>[]\n ): TypeAfter<\"indexes\"> {\n return runMethodOnce(\"indexes\", () => {\n _indexes = indexes;\n return this as TypeAfter<\"indexes\">;\n });\n },\n\n files<const F extends string>(\n files: Record<F, string> & FileKeyConflictError<Fields, User>,\n ): TypeAfter<\"files\"> {\n return runMethodOnce(\"files\", () => {\n _files = files;\n return this as TypeAfter<\"files\">;\n });\n },\n\n permission<\n U extends object = User,\n P extends TailorTypePermission<U, output<TailorDBType<Fields, User, DefinedDBTypeMetadata>>> =\n TailorTypePermission<U, output<TailorDBType<Fields, User, DefinedDBTypeMetadata>>>,\n >(permission: P): TypeAfterUser<U, \"permission\"> {\n return runMethodOnce(\"permission\", () => {\n const ret = this as unknown as TypeAfterUser<U, \"permission\">;\n _permissions.record = permission as RawPermissions[\"record\"];\n return ret;\n });\n },\n\n gqlPermission<\n U extends object = User,\n P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>,\n >(permission: P): TypeAfterUser<U, \"gqlPermission\"> {\n return runMethodOnce(\"gqlPermission\", () => {\n const ret = this as unknown as TypeAfterUser<U, \"gqlPermission\">;\n _permissions.gql = permission as RawPermissions[\"gql\"];\n return ret;\n });\n },\n\n description(description: string): TypeAfter<\"description\"> {\n return runMethodOnce(\"description\", () => {\n _description = description;\n this._description = description;\n return this as TypeAfter<\"description\">;\n });\n },\n\n pickFields<K extends keyof Fields, const Opt extends FieldOptions>(keys: K[], options?: Opt) {\n const result = {} as Record<K, TailorAnyDBField>;\n for (const key of keys) {\n const field = this.fields[key] as TailorAnyDBField;\n if (options) {\n result[key] = field.clone(options);\n } else {\n result[key] = field;\n }\n }\n // oxlint-disable-next-line no-explicit-any\n return result as any;\n },\n\n omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K> {\n const keysSet = new Set(keys);\n const result = {} as Record<string, TailorAnyDBField>;\n for (const key in this.fields) {\n if (Object.hasOwn(this.fields, key) && !keysSet.has(key as unknown as K)) {\n result[key] = this.fields[key] as TailorAnyDBField;\n }\n }\n return result as Omit<Fields, K>;\n },\n\n get plugins(): PluginAttachment[] {\n return _plugins;\n },\n\n plugin<P extends keyof PluginConfigs<keyof Fields & string>>(config: {\n [K in P]: PluginConfigs<keyof Fields & string>[K];\n }): TailorDBType<Fields, User, AnyBuilderMethod> {\n for (const [pluginId, pluginConfig] of Object.entries(config)) {\n _plugins.push({ pluginId, config: pluginConfig });\n }\n return this;\n },\n };\n\n return brandValue(dbType, \"tailordb-type\");\n}\n\nconst idField = uuid();\ntype idField = typeof idField;\ntype DBType<\n F extends { id?: never } & Record<string, TailorAnyDBField>,\n Defined extends DefinedDBTypeMetadata = DefinedDBTypeMetadata,\n> = TailorDBInstance<{ id: idField } & F, InferredAttributeMap, Defined>;\n\n/**\n * Creates a new database type with the specified fields.\n * An `id` field (UUID) is automatically added to every type.\n * @param name - The name of the type, or a tuple of [name, pluralForm]\n * @param fields - The field definitions for the type\n * @returns A new TailorDBType instance\n * @example\n * export const user = db.type(\"User\", {\n * name: db.string(),\n * email: db.string(),\n * age: db.int({ optional: true }),\n * role: db.enum([\"admin\", \"member\"]),\n * ...db.fields.timestamps(),\n * });\n * // Always export both the value and type:\n * export type user = typeof user;\n */\nfunction dbType<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n fields: F,\n): DBType<F>;\n/**\n * Creates a new database type with the specified fields and description.\n * An `id` field (UUID) is automatically added to every type.\n * @param name - The name of the type, or a tuple of [name, pluralForm]\n * @param description - A description of the type\n * @param fields - The field definitions for the type\n * @returns A new TailorDBType instance\n */\nfunction dbType<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n description: string,\n fields: F,\n): DBType<F, WithDBTypeMetadata<DefinedDBTypeMetadata, \"description\">>;\nfunction dbType<const F extends { id?: never } & Record<string, TailorAnyDBField>>(\n name: string | [string, string],\n fieldsOrDescription: string | F,\n fields?: F,\n): DBType<F> | DBType<F, WithDBTypeMetadata<DefinedDBTypeMetadata, \"description\">> {\n const typeName = Array.isArray(name) ? name[0] : name;\n const pluralForm = Array.isArray(name) ? name[1] : undefined;\n\n let description: string | undefined;\n let fieldDef: F;\n if (typeof fieldsOrDescription === \"string\") {\n description = fieldsOrDescription;\n fieldDef = fields as F;\n } else {\n fieldDef = fieldsOrDescription;\n }\n return createTailorDBType<{ id: idField } & F>(\n typeName,\n {\n id: idField,\n ...fieldDef,\n },\n { pluralForm, description },\n ) as DBType<F>;\n}\n\n/** TailorDB schema builder utilities for defining types and fields. */\nexport const db = {\n type: dbType,\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n fields: {\n /**\n * Creates standard timestamp fields (createdAt, updatedAt) with auto-hooks.\n * createdAt is set on create, updatedAt is set on update.\n * A user-specified createdAt is respected when provided (e.g. seeding historical\n * records); the current time is used only when the value is omitted.\n * @returns An object with createdAt and updatedAt fields\n * @example\n * const model = db.type(\"Model\", {\n * name: db.string(),\n * ...db.fields.timestamps(),\n * });\n */\n timestamps: () => ({\n createdAt: datetime()\n .hooks({ create: ({ value }) => value ?? new Date() })\n .description(\"Record creation timestamp\"),\n updatedAt: datetime({ optional: true })\n .hooks({ update: () => new Date() })\n .description(\"Record last update timestamp\"),\n }),\n },\n};\n"],"mappings":";;;;AAIA,MAAM,QAAQ;CACZ,MAAM;CACN,MAAM;CACN,MAAM;CACN,UACE;CACF,SAAS;AACX;AA6BA,SAAS,kBAA6C,MAAuC;CAC3F,MAAM,EAAE,OAAO,OAAO,WAAW,WAAW;CAC5C,MAAM,OAAO,UAAU,SAAS,IAAI,YAAY;CAChD,MAAM,oBAAoB,OAAO;CAEjC,QAAQ,MAAM,MAAd;EACE,KAAK;GACH,IAAI,OAAO,UAAU,UACnB,OAAO,KAAK;IACV,SAAS,+BAA+B,OAAO,KAAK;IACpD;GACF,CAAC;GAEH;EAEF,KAAK;GACH,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,KAAK,GACtD,OAAO,KAAK;IACV,SAAS,iCAAiC,OAAO,KAAK;IACtD;GACF,CAAC;GAEH;EAEF,KAAK;GACH,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,GACrD,OAAO,KAAK;IACV,SAAS,+BAA+B,OAAO,KAAK;IACpD;GACF,CAAC;GAEH;EAEF,KAAK;GACH,IAAI,OAAO,UAAU,WACnB,OAAO,KAAK;IACV,SAAS,gCAAgC,OAAO,KAAK;IACrD;GACF,CAAC;GAEH;EAEF,KAAK;GACH,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,KAAK,KAAK,GACrD,OAAO,KAAK;IACV,SAAS,mCAAmC,OAAO,KAAK;IACxD;GACF,CAAC;GAEH;EACF,KAAK;GACH,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,KAAK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B,KAAK,MAAM,OAAO,KAAK,QACrB,IAAI,OAAO,OAAO,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,GAAmB,GACrE,OAAO,OAAO,KAAK,OAAO;GAG9B,OAAO;EACT;EAEA,IAAI,UAA8B;GAChC,OAAO;EACT;EAEA,OAA6D,QAEZ;GAC/C,KAAK,MAAM,CAAC,UAAU,iBAAiB,OAAO,QAAQ,MAAM,GAC1D,SAAS,KAAK;IAAE;IAAU,QAAQ;GAAa,CAAC;GAElD,OAAO;EACT;CAGqB,GAAG,eAAe;AAC3C;AAEA,MAAM,UAAU,KAAK;AAyCrB,SAAS,OACP,MACA,qBACA,QACiF;CACjF,MAAM,WAAW,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK;CACjD,MAAM,aAAa,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK;CAEnD,IAAI;CACJ,IAAI;CACJ,IAAI,OAAO,wBAAwB,UAAU;EAC3C,cAAc;EACd,WAAW;CACb,OACE,WAAW;CAEb,OAAO,mBACL,UACA;EACE,IAAI;EACJ,GAAG;CACL,GACA;EAAE;EAAY;CAAY,CAC5B;AACF;;AAGA,MAAa,KAAK;CAChB,MAAM;CACN;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,MAAM;CACN;CACA,QAAQ;;;;;;;;;;;;;AAaN,mBAAmB;EACjB,WAAW,SAAS,CAAC,CAClB,MAAM,EAAE,SAAS,EAAE,YAAY,yBAAS,IAAI,KAAK,EAAE,CAAC,CAAC,CACrD,YAAY,2BAA2B;EAC1C,WAAW,SAAS,EAAE,UAAU,KAAK,CAAC,CAAC,CACpC,MAAM,EAAE,8BAAc,IAAI,KAAK,EAAE,CAAC,CAAC,CACnC,YAAY,8BAA8B;CAC/C,GACF;AACF"}
|
|
@@ -11,34 +11,48 @@ const functionSchema = z.custom((val) => typeof val === "function");
|
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/cli/services/file-loader.ts
|
|
13
13
|
const DEFAULT_IGNORE_PATTERNS = ["**/*.test.ts", "**/*.spec.ts"];
|
|
14
|
+
const warnedFallbacks = /* @__PURE__ */ new Set();
|
|
14
15
|
/**
|
|
15
16
|
* Load files matching the given patterns, excluding files that match ignore patterns.
|
|
16
17
|
* By default, test files (*.test.ts, *.spec.ts) are excluded unless ignores is explicitly specified.
|
|
17
18
|
* @param config - Configuration with files patterns and optional ignores patterns
|
|
19
|
+
* @param baseDir - Directory relative patterns are resolved against
|
|
18
20
|
* @returns Array of absolute file paths
|
|
19
21
|
*/
|
|
20
|
-
function loadFilesWithIgnores(config) {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
22
|
+
function loadFilesWithIgnores(config, baseDir) {
|
|
23
|
+
if (config.files.length === 0) return [];
|
|
24
|
+
const resolved = resolveFiles(config, baseDir);
|
|
25
|
+
const allPatternsAbsolute = config.files.every((pattern) => path.isAbsolute(pattern));
|
|
26
|
+
if (resolved.matchedAnyPattern || baseDir === process.cwd() || allPatternsAbsolute) return resolved.files;
|
|
27
|
+
const fallbackKey = `${baseDir}\0${config.files.join("\0")}`;
|
|
28
|
+
if (!warnedFallbacks.has(fallbackKey)) {
|
|
29
|
+
warnedFallbacks.add(fallbackKey);
|
|
30
|
+
logger.warn(`No files matched "${config.files.join(", ")}" relative to "${baseDir}"; falling back to process.cwd(). Update this config's file patterns to be relative to its own directory before v2, when this fallback will be removed.`);
|
|
30
31
|
}
|
|
32
|
+
return resolveFiles(config, process.cwd()).files;
|
|
33
|
+
}
|
|
34
|
+
function resolveFiles(config, baseDir) {
|
|
35
|
+
const isDefaultIgnores = config.ignores === void 0;
|
|
36
|
+
const ignorePatterns = config.ignores ?? DEFAULT_IGNORE_PATTERNS;
|
|
37
|
+
const resolvedIgnorePatterns = isDefaultIgnores ? ignorePatterns : ignorePatterns.map((ignorePattern) => path.resolve(baseDir, ignorePattern));
|
|
31
38
|
const files = [];
|
|
39
|
+
let matchedAnyPattern = false;
|
|
32
40
|
for (const pattern of config.files) {
|
|
33
|
-
const absolutePattern = path.resolve(
|
|
41
|
+
const absolutePattern = path.resolve(baseDir, pattern);
|
|
34
42
|
try {
|
|
35
|
-
const
|
|
43
|
+
const matchedFiles = fs.globSync(absolutePattern);
|
|
44
|
+
if (matchedFiles.length > 0) matchedAnyPattern = true;
|
|
45
|
+
const filteredFiles = matchedFiles.filter((file) => !resolvedIgnorePatterns.some((ignorePattern) => path.matchesGlob(file, ignorePattern)));
|
|
36
46
|
files.push(...filteredFiles);
|
|
37
47
|
} catch (error) {
|
|
48
|
+
matchedAnyPattern = true;
|
|
38
49
|
logger.warn(`Failed to glob pattern "${pattern}": ${String(error)}`);
|
|
39
50
|
}
|
|
40
51
|
}
|
|
41
|
-
return
|
|
52
|
+
return {
|
|
53
|
+
files,
|
|
54
|
+
matchedAnyPattern
|
|
55
|
+
};
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
//#endregion
|
|
@@ -256,7 +270,7 @@ const ValueOperandSchema = z.union([
|
|
|
256
270
|
z.array(z.boolean())
|
|
257
271
|
]);
|
|
258
272
|
const MachineUserSchema = z.object({
|
|
259
|
-
attributes: z.record(z.string(), ValueOperandSchema).optional(),
|
|
273
|
+
attributes: z.record(z.string(), ValueOperandSchema.nullish()).transform((attributes) => Object.fromEntries(Object.entries(attributes).filter((entry) => entry[1] != null))).optional(),
|
|
260
274
|
attributeList: z.array(z.uuid()).optional()
|
|
261
275
|
});
|
|
262
276
|
const BeforeLoginHookSchema = z.object({
|
|
@@ -397,7 +411,7 @@ const ExecutorSchema = z.object({
|
|
|
397
411
|
* @returns A new ExecutorService instance
|
|
398
412
|
*/
|
|
399
413
|
function createExecutorService(params) {
|
|
400
|
-
const { config } = params;
|
|
414
|
+
const { config, baseDir } = params;
|
|
401
415
|
const executors = {};
|
|
402
416
|
const pluginExecutors = [];
|
|
403
417
|
let loadPromise;
|
|
@@ -430,7 +444,7 @@ function createExecutorService(params) {
|
|
|
430
444
|
loadExecutors: async () => {
|
|
431
445
|
if (!loadPromise) loadPromise = (async () => {
|
|
432
446
|
if (config.files.length === 0) return;
|
|
433
|
-
const executorFiles = loadFilesWithIgnores(config);
|
|
447
|
+
const executorFiles = loadFilesWithIgnores(config, baseDir);
|
|
434
448
|
logger.newline();
|
|
435
449
|
logger.log(`Found ${styles.highlight(executorFiles.length.toString())} executor files`);
|
|
436
450
|
await Promise.all(executorFiles.map((executorFile) => loadExecutorForFile(executorFile)));
|
|
@@ -473,4 +487,4 @@ function assertUniqueExecutorNames(executors) {
|
|
|
473
487
|
|
|
474
488
|
//#endregion
|
|
475
489
|
export { TailorFieldSchema as a, AuthInvokerSchema as i, ExecutorSchema as n, loadFilesWithIgnores as o, AuthConfigSchema as r, functionSchema as s, createExecutorService as t };
|
|
476
|
-
//# sourceMappingURL=service-
|
|
490
|
+
//# sourceMappingURL=service-CDPatibu.mjs.map
|