@tailor-platform/sdk 1.76.1 → 1.78.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 +60 -0
- package/dist/{application-BUfYmf0O.mjs → application-CUxVA7Fs.mjs} +378 -1679
- package/dist/application-CUxVA7Fs.mjs.map +1 -0
- package/dist/application-Dp_-ioiP.mjs +3 -0
- package/dist/cli/cache/bundle-cache.d.mts +2 -1
- package/dist/cli/cache/store.d.mts +1 -1
- package/dist/cli/commands/api/index.d.mts +1 -0
- package/dist/cli/commands/deploy/aigateway.d.mts +5 -1
- package/dist/cli/commands/deploy/application.d.mts +7 -1
- package/dist/cli/commands/deploy/apply-phases.d.mts +14 -1
- package/dist/cli/commands/deploy/auth.d.mts +5 -1
- package/dist/cli/commands/deploy/deploy.d.mts +13 -3
- package/dist/cli/commands/deploy/executor.d.mts +7 -1
- package/dist/cli/commands/deploy/function-registry.d.mts +5 -0
- package/dist/cli/commands/deploy/idp.d.mts +5 -1
- package/dist/cli/commands/deploy/resolver.d.mts +5 -1
- package/dist/cli/commands/deploy/secret-manager.d.mts +5 -1
- package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -1
- package/dist/cli/commands/deploy/tailordb/index.d.mts +8 -1
- package/dist/cli/commands/deploy/types.d.mts +3 -1
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -1
- package/dist/cli/commands/deploy/workflow.d.mts +4 -1
- package/dist/cli/commands/executor/get.d.mts +0 -1
- package/dist/cli/commands/executor/jobs.d.mts +0 -1
- package/dist/cli/commands/executor/list.d.mts +0 -1
- package/dist/cli/commands/executor/transform.d.mts +1 -0
- package/dist/cli/commands/executor/trigger.d.mts +0 -1
- package/dist/cli/commands/executor/webhook.d.mts +0 -1
- package/dist/cli/commands/function/get.d.mts +0 -1
- package/dist/cli/commands/function/list.d.mts +0 -1
- package/dist/cli/commands/function/transform.d.mts +1 -0
- package/dist/cli/commands/generate/service.d.mts +5 -1
- package/dist/cli/commands/generate/types.d.mts +3 -1
- package/dist/cli/commands/machineuser/list.d.mts +0 -1
- package/dist/cli/commands/machineuser/token.d.mts +0 -1
- package/dist/cli/commands/oauth2client/get.d.mts +0 -1
- package/dist/cli/commands/oauth2client/list.d.mts +0 -1
- package/dist/cli/commands/oauth2client/transform.d.mts +1 -0
- package/dist/cli/commands/organization/folder/create.d.mts +0 -1
- package/dist/cli/commands/organization/folder/delete.d.mts +0 -1
- package/dist/cli/commands/organization/folder/get.d.mts +0 -1
- package/dist/cli/commands/organization/folder/list.d.mts +0 -1
- package/dist/cli/commands/organization/folder/update.d.mts +0 -1
- package/dist/cli/commands/organization/get.d.mts +0 -1
- package/dist/cli/commands/organization/list.d.mts +0 -1
- package/dist/cli/commands/organization/transform.d.mts +2 -0
- package/dist/cli/commands/organization/tree.d.mts +0 -1
- package/dist/cli/commands/organization/update.d.mts +0 -1
- package/dist/cli/commands/remove.d.mts +0 -1
- package/dist/cli/commands/show.d.mts +9 -4
- package/dist/cli/commands/tailordb/migrate/config.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -1
- package/dist/cli/commands/tailordb/truncate.d.mts +0 -1
- package/dist/cli/commands/workflow/executions.d.mts +0 -1
- package/dist/cli/commands/workflow/get.d.mts +2 -1
- package/dist/cli/commands/workflow/list.d.mts +0 -1
- package/dist/cli/commands/workflow/resume.d.mts +0 -1
- package/dist/cli/commands/workflow/start.d.mts +0 -1
- package/dist/cli/commands/workflow/status.d.mts +1 -0
- package/dist/cli/commands/workflow/transform.d.mts +1 -0
- package/dist/cli/commands/workflow/wait.d.mts +0 -1
- package/dist/cli/commands/workflow/waiter.d.mts +1 -1
- package/dist/cli/commands/workspace/app/health.d.mts +0 -1
- package/dist/cli/commands/workspace/app/list.d.mts +0 -1
- package/dist/cli/commands/workspace/app/transform.d.mts +2 -0
- package/dist/cli/commands/workspace/create.d.mts +3 -1
- package/dist/cli/commands/workspace/delete.d.mts +0 -1
- package/dist/cli/commands/workspace/get.d.mts +0 -1
- package/dist/cli/commands/workspace/list.d.mts +1 -1
- package/dist/cli/commands/workspace/restore.d.mts +0 -1
- package/dist/cli/commands/workspace/transform.d.mts +4 -0
- package/dist/cli/commands/workspace/user/invite.d.mts +0 -1
- package/dist/cli/commands/workspace/user/list.d.mts +0 -1
- package/dist/cli/commands/workspace/user/remove.d.mts +0 -1
- package/dist/cli/commands/workspace/user/transform.d.mts +1 -0
- package/dist/cli/commands/workspace/user/update.d.mts +0 -1
- package/dist/cli/index.d.mts +3 -1
- package/dist/cli/index.mjs +660 -56
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +4 -2
- package/dist/cli/lib.mjs +3 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/query/index.d.mts +0 -1
- package/dist/cli/services/application.d.mts +12 -1
- package/dist/cli/services/auth/service.d.mts +2 -0
- package/dist/cli/services/executor/service.d.mts +1 -1
- package/dist/cli/services/http-adapter/bundler.d.mts +3 -1
- package/dist/cli/services/http-adapter/service.d.mts +2 -1
- package/dist/cli/services/resolver/service.d.mts +1 -1
- package/dist/cli/services/tailordb/service.d.mts +3 -1
- package/dist/cli/services/workflow/bundler.d.mts +2 -1
- package/dist/cli/services/workflow/service.d.mts +1 -1
- package/dist/cli/shared/args.d.mts +1 -1
- package/dist/cli/shared/client.d.mts +1 -1
- package/dist/cli/shared/config-loader.d.mts +0 -1
- package/dist/cli/shared/context.d.mts +2 -1
- package/dist/cli/shared/script-executor.d.mts +0 -1
- package/dist/cli/shared/seed-chunker.d.mts +7 -3
- package/dist/cli/shared/type-generator.d.mts +0 -1
- package/dist/cli/shared/workspace-name.d.mts +1 -0
- package/dist/cli/skills.mjs +1 -1
- package/dist/completion/zsh-worker.zsh +18 -1
- package/dist/configure/config/index.d.mts +0 -1
- package/dist/configure/config/types.d.mts +2 -2
- package/dist/configure/index.d.mts +2 -1
- package/dist/configure/index.mjs +248 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/aigateway/index.d.mts +0 -1
- package/dist/configure/services/aigateway/types.d.mts +0 -1
- package/dist/configure/services/auth/index.d.mts +0 -1
- package/dist/configure/services/auth/types.d.mts +14 -13
- package/dist/configure/services/executor/executor.d.mts +0 -1
- package/dist/configure/services/executor/index.d.mts +1 -0
- package/dist/configure/services/executor/operation.d.mts +1 -2
- package/dist/configure/services/executor/trigger/event.d.mts +0 -1
- package/dist/configure/services/executor/trigger/index.d.mts +0 -1
- package/dist/configure/services/executor/trigger/schedule.d.mts +0 -1
- package/dist/configure/services/executor/trigger/webhook.d.mts +0 -1
- package/dist/configure/services/http-adapter/http-adapter.d.mts +1 -2
- package/dist/configure/services/idp/index.d.mts +1 -5
- package/dist/configure/services/idp/permission.d.mts +4 -5
- package/dist/configure/services/idp/types.d.mts +0 -1
- package/dist/configure/services/index.d.mts +5 -0
- package/dist/configure/services/resolver/resolver.d.mts +0 -1
- package/dist/configure/services/resolver/types.d.mts +0 -1
- package/dist/configure/services/secrets/index.d.mts +0 -1
- package/dist/configure/services/secrets/types.d.mts +0 -1
- package/dist/configure/services/staticwebsite/index.d.mts +0 -1
- package/dist/configure/services/staticwebsite/types.d.mts +0 -1
- package/dist/configure/services/tailordb/permission.d.mts +4 -5
- package/dist/configure/services/tailordb/schema.d.mts +21 -8
- package/dist/configure/services/tailordb/types.d.mts +4 -5
- package/dist/configure/services/workflow/execution-policy.d.mts +0 -1
- package/dist/configure/services/workflow/execution-policy.types.d.mts +0 -1
- package/dist/configure/services/workflow/index.d.mts +1 -0
- package/dist/configure/services/workflow/job.d.mts +0 -1
- package/dist/configure/services/workflow/wait-point.d.mts +0 -1
- package/dist/configure/services/workflow/workflow.d.mts +0 -1
- package/dist/configure/types/field-runtime.d.mts +1 -1
- package/dist/configure/types/field.d.mts +1 -2
- package/dist/configure/types/field.types.d.mts +1 -2
- package/dist/configure/types/type.d.mts +1 -1
- package/dist/configure/user.d.mts +0 -1
- package/dist/{crashreport-ayWANEZ6.mjs → crashreport-BNWUM6Kf.mjs} +4 -3
- package/dist/{crashreport-ayWANEZ6.mjs.map → crashreport-BNWUM6Kf.mjs.map} +1 -1
- package/dist/{crashreport-Dy4ZzSkd.mjs → crashreport-BafWvjjX.mjs} +1 -1
- package/dist/errors-DVFS0AZk.mjs +100 -0
- package/dist/errors-DVFS0AZk.mjs.map +1 -0
- package/dist/{globals-CcU1ONiK.mjs → globals-CvizbGLY.mjs} +2 -2
- package/dist/{globals-CcU1ONiK.mjs.map → globals-CvizbGLY.mjs.map} +1 -1
- package/dist/kysely/index.d.mts +3 -4
- package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
- package/dist/logger-BwS4ppwO.mjs.map +1 -0
- package/dist/parser/service/auth/index.d.mts +1 -1
- package/dist/parser/service/auth/schema.d.mts +1 -0
- package/dist/parser/service/http-adapter/index.d.mts +1 -1
- package/dist/parser/service/idp/types.d.mts +1 -0
- package/dist/parser/service/tailordb/types.d.mts +0 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +0 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +0 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +0 -1
- package/dist/plugin/builtin/seed/index.d.mts +0 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/get-generated-type.d.mts +0 -1
- package/dist/plugin/manager.d.mts +3 -1
- package/dist/plugin/types.d.mts +0 -1
- package/dist/plugin/with-context.d.mts +0 -1
- package/dist/{registry-NfSW0BRo.mjs → registry-CYBRvfaU.mjs} +4 -49
- package/dist/registry-CYBRvfaU.mjs.map +1 -0
- package/dist/runtime/aigateway.d.mts +0 -2
- package/dist/runtime/authconnection.d.mts +0 -2
- package/dist/runtime/globals.d.mts +0 -1
- package/dist/runtime/index.d.mts +0 -1
- package/dist/runtime/types.d.mts +16 -7
- package/dist/{runtime-_vUgjiqT.mjs → runtime-BD2vYJFT.mjs} +2382 -1167
- package/dist/runtime-BD2vYJFT.mjs.map +1 -0
- package/dist/{schema-DrVyN-LP.mjs → schema-U6DxoZ8D.mjs} +204 -3
- package/dist/schema-U6DxoZ8D.mjs.map +1 -0
- package/dist/{secret-file-VSVGy1V0.mjs → secret-file-DBqZhjFQ.mjs} +2 -27
- package/dist/{secret-file-VSVGy1V0.mjs.map → secret-file-DBqZhjFQ.mjs.map} +1 -1
- package/dist/{secretmanager-Bd45j7an.mjs → secretmanager-IY4UvinW.mjs} +42 -9
- package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
- package/dist/seed/index.d.mts +3 -2
- package/dist/{seed-fm0LeYP2.mjs → seed-DFFigL8V.mjs} +3 -13
- package/dist/seed-DFFigL8V.mjs.map +1 -0
- package/dist/service-CghpdV-9.mjs +3 -0
- package/dist/{service-DBFZQloR.mjs → service-Cp0I7ZFe.mjs} +3 -3
- package/dist/{service-DBFZQloR.mjs.map → service-Cp0I7ZFe.mjs.map} +1 -1
- package/dist/{service-BCRJ-3NV.mjs → service-D12iQGcS.mjs} +2 -2
- package/dist/{service-BCRJ-3NV.mjs.map → service-D12iQGcS.mjs.map} +1 -1
- package/dist/service_pb-BoLM0X4K.mjs +167 -0
- package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
- package/dist/{service_pb-B2FF59sP.mjs → service_pb-r1T7kpJc.mjs} +1 -1
- package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +0 -1
- package/dist/test-env-key-DuZycyWM.mjs +49 -0
- package/dist/test-env-key-DuZycyWM.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/types/aigateway.generated.d.mts +5 -2
- package/dist/types/auth-connection.generated.d.mts +11 -5
- package/dist/types/auth.generated.d.mts +118 -85
- package/dist/types/executor.generated.d.mts +76 -84
- package/dist/types/helpers.d.mts +5 -5
- package/dist/types/http-adapter.generated.d.mts +11 -5
- package/dist/types/idp.generated.d.mts +536 -524
- package/dist/types/resolver.generated.d.mts +24 -10
- package/dist/types/staticwebsite.generated.d.mts +7 -3
- package/dist/types/tailordb.generated.d.mts +55 -29
- package/dist/types/workflow.generated.d.mts +9 -4
- package/dist/user-agent-DX2Jnw0-.mjs +28 -0
- package/dist/user-agent-DX2Jnw0-.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +0 -1
- package/dist/utils/test/index.mjs +1 -1
- package/dist/utils/test/mock.d.mts +0 -1
- package/dist/vitest/environment.mjs +1 -1
- package/dist/vitest/index.d.mts +9 -9
- package/dist/vitest/index.mjs +600 -185
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock-kysely.d.mts +0 -1
- package/dist/vitest/mock.d.mts +8 -8
- package/dist/vitest/mocks/aigateway.d.mts +16 -6
- package/dist/vitest/mocks/authconnection.d.mts +16 -6
- package/dist/vitest/mocks/file.d.mts +24 -6
- package/dist/vitest/mocks/iconv.d.mts +28 -4
- package/dist/vitest/mocks/idp.d.mts +26 -10
- package/dist/vitest/mocks/secretmanager.d.mts +16 -5
- package/dist/vitest/mocks/tailordb.d.mts +54 -10
- package/dist/vitest/mocks/workflow.d.mts +48 -11
- package/dist/vitest/setup.mjs +2 -2
- package/dist/{service_pb-B5w9rjPY.mjs → workspace_resource_pb-Db3fv68L.mjs} +57 -165
- package/dist/workspace_resource_pb-Db3fv68L.mjs.map +1 -0
- package/docs/cli/application.md +58 -11
- package/docs/cli/setup.md +1 -1
- package/docs/cli/workspace.md +6 -4
- package/docs/cli-reference.md +12 -8
- package/docs/runtime.md +3 -4
- package/docs/services/aigateway.md +2 -0
- package/docs/services/tailordb.md +52 -1
- package/docs/services/workflow.md +1 -1
- package/docs/testing.md +103 -89
- package/package.json +16 -16
- package/dist/application-BUfYmf0O.mjs.map +0 -1
- package/dist/application-DbvD5UUz.mjs +0 -3
- package/dist/cli/shared/trigger-context.d.mts +0 -1
- package/dist/errors-Dtf2WPaW.mjs +0 -42
- package/dist/errors-Dtf2WPaW.mjs.map +0 -1
- package/dist/field-runtime-9bfXBAOK.mjs +0 -183
- package/dist/field-runtime-9bfXBAOK.mjs.map +0 -1
- package/dist/job-D-PbD1P3.mjs +0 -55
- package/dist/job-D-PbD1P3.mjs.map +0 -1
- package/dist/logger-BEiZZ3qT.mjs.map +0 -1
- package/dist/registry-NfSW0BRo.mjs.map +0 -1
- package/dist/resource_pb-BRv7AMXK.mjs +0 -49
- package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
- package/dist/runtime-_vUgjiqT.mjs.map +0 -1
- package/dist/schema-DrVyN-LP.mjs.map +0 -1
- package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
- package/dist/seed-fm0LeYP2.mjs.map +0 -1
- package/dist/service-CPMlIg3X.mjs +0 -3
- package/dist/service_pb-B5w9rjPY.mjs.map +0 -1
- package/dist/types-BwzB2okW.mjs +0 -199
- package/dist/types-BwzB2okW.mjs.map +0 -1
- package/dist/types-KlawuVKa.mjs +0 -4
package/dist/configure/index.mjs
CHANGED
|
@@ -1,9 +1,203 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as parseInternal, r as mapAllowedValues, t as db } from "../schema-U6DxoZ8D.mjs";
|
|
2
2
|
import { t as brandValue } from "../brand-Eo4pLXPJ.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as createWorkflowJob } from "../job-D-PbD1P3.mjs";
|
|
3
|
+
import { n as dispatchTriggerJob, o as registerJob, r as dispatchTriggerWorkflow, s as registerWorkflow } from "../registry-CYBRvfaU.mjs";
|
|
4
|
+
import { t as WORKFLOW_TEST_ENV_KEY } from "../test-env-key-DuZycyWM.mjs";
|
|
6
5
|
|
|
6
|
+
//#region src/configure/types/type.ts
|
|
7
|
+
function createTailorField(type, options, fields, values, metadata) {
|
|
8
|
+
const _metadata = metadata ? {
|
|
9
|
+
...metadata,
|
|
10
|
+
...metadata.allowedValues && { allowedValues: metadata.allowedValues.map((v) => ({ ...v })) },
|
|
11
|
+
...metadata.validate && { validate: metadata.validate.map((v) => Array.isArray(v) ? [...v] : v) }
|
|
12
|
+
} : { required: true };
|
|
13
|
+
if (!metadata) {
|
|
14
|
+
if (options) {
|
|
15
|
+
if (options.optional === true) _metadata.required = false;
|
|
16
|
+
if (options.array === true) _metadata.array = true;
|
|
17
|
+
}
|
|
18
|
+
if (values) _metadata.allowedValues = mapAllowedValues(values);
|
|
19
|
+
}
|
|
20
|
+
function parseInternal$1(args) {
|
|
21
|
+
return parseInternal({
|
|
22
|
+
...args,
|
|
23
|
+
field
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Clone the field and apply metadata updates to the clone.
|
|
28
|
+
* The original instance is never mutated, so a field shared across places
|
|
29
|
+
* cannot leak metadata between them.
|
|
30
|
+
* @param metadataUpdates - Metadata properties to overwrite on the clone
|
|
31
|
+
* @returns A new field with the updated metadata
|
|
32
|
+
*/
|
|
33
|
+
function cloneWith(metadataUpdates) {
|
|
34
|
+
const cloned = field.clone();
|
|
35
|
+
Object.assign(cloned._metadata, metadataUpdates);
|
|
36
|
+
return cloned;
|
|
37
|
+
}
|
|
38
|
+
const field = {
|
|
39
|
+
type,
|
|
40
|
+
fields: fields ?? {},
|
|
41
|
+
_defined: void 0,
|
|
42
|
+
_output: void 0,
|
|
43
|
+
_metadata,
|
|
44
|
+
get metadata() {
|
|
45
|
+
return { ...this._metadata };
|
|
46
|
+
},
|
|
47
|
+
description(description) {
|
|
48
|
+
return cloneWith({ description });
|
|
49
|
+
},
|
|
50
|
+
typeName(typeName) {
|
|
51
|
+
return cloneWith({ typeName });
|
|
52
|
+
},
|
|
53
|
+
validate(...validateInputs) {
|
|
54
|
+
return cloneWith({ validate: validateInputs });
|
|
55
|
+
},
|
|
56
|
+
parse(args) {
|
|
57
|
+
return parseInternal$1({
|
|
58
|
+
value: args.value,
|
|
59
|
+
data: args.data,
|
|
60
|
+
user: args.user,
|
|
61
|
+
pathArray: []
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
_parseInternal: parseInternal$1,
|
|
65
|
+
clone() {
|
|
66
|
+
let clonedFields = fields;
|
|
67
|
+
if (fields) {
|
|
68
|
+
const cloned = {};
|
|
69
|
+
for (const [key, nestedField] of Object.entries(fields)) cloned[key] = nestedField.clone();
|
|
70
|
+
clonedFields = cloned;
|
|
71
|
+
}
|
|
72
|
+
return createTailorField(type, options, clonedFields, values, this._metadata);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return field;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a UUID field for resolver input/output.
|
|
79
|
+
* @param options - Field configuration options
|
|
80
|
+
* @returns A UUID field
|
|
81
|
+
* @example t.uuid()
|
|
82
|
+
*/
|
|
83
|
+
function uuid(options) {
|
|
84
|
+
return createTailorField("uuid", options);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create a string field for resolver input/output.
|
|
88
|
+
* @param options - Field configuration options
|
|
89
|
+
* @returns A string field
|
|
90
|
+
* @example t.string()
|
|
91
|
+
* @example t.string({ optional: true })
|
|
92
|
+
* @example t.string({ array: true })
|
|
93
|
+
*/
|
|
94
|
+
function string(options) {
|
|
95
|
+
return createTailorField("string", options);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create a boolean field for resolver input/output.
|
|
99
|
+
* @param options - Field configuration options
|
|
100
|
+
* @returns A boolean field
|
|
101
|
+
* @example t.bool()
|
|
102
|
+
*/
|
|
103
|
+
function bool(options) {
|
|
104
|
+
return createTailorField("boolean", options);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Create an integer field for resolver input/output.
|
|
108
|
+
* @param options - Field configuration options
|
|
109
|
+
* @returns An integer field
|
|
110
|
+
* @example t.int()
|
|
111
|
+
*/
|
|
112
|
+
function int(options) {
|
|
113
|
+
return createTailorField("integer", options);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Create a float field for resolver input/output.
|
|
117
|
+
* @param options - Field configuration options
|
|
118
|
+
* @returns A float field
|
|
119
|
+
* @example t.float()
|
|
120
|
+
*/
|
|
121
|
+
function float(options) {
|
|
122
|
+
return createTailorField("float", options);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Create a decimal field for resolver input/output (stored as string for precision).
|
|
126
|
+
* @param options - Field configuration options
|
|
127
|
+
* @returns A decimal field
|
|
128
|
+
* @example t.decimal()
|
|
129
|
+
* @example t.decimal({ optional: true })
|
|
130
|
+
*/
|
|
131
|
+
function decimal(options) {
|
|
132
|
+
return createTailorField("decimal", options);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a date field for resolver input/output.
|
|
136
|
+
* @param options - Field configuration options
|
|
137
|
+
* @returns A date field
|
|
138
|
+
* @example t.date()
|
|
139
|
+
*/
|
|
140
|
+
function date(options) {
|
|
141
|
+
return createTailorField("date", options);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Create a datetime field for resolver input/output.
|
|
145
|
+
* @param options - Field configuration options
|
|
146
|
+
* @returns A datetime field
|
|
147
|
+
* @example t.datetime()
|
|
148
|
+
*/
|
|
149
|
+
function datetime(options) {
|
|
150
|
+
return createTailorField("datetime", options);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create a time field for resolver input/output.
|
|
154
|
+
* @param options - Field configuration options
|
|
155
|
+
* @returns A time field
|
|
156
|
+
* @example t.time()
|
|
157
|
+
*/
|
|
158
|
+
function time(options) {
|
|
159
|
+
return createTailorField("time", options);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Create an enum field for resolver input/output.
|
|
163
|
+
* @param values - Array of allowed string values
|
|
164
|
+
* @param options - Field configuration options
|
|
165
|
+
* @returns An enum field
|
|
166
|
+
* @example t.enum(["active", "inactive"])
|
|
167
|
+
*/
|
|
168
|
+
function _enum(values, options) {
|
|
169
|
+
return createTailorField("enum", options, void 0, values);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create a nested object field for resolver input/output.
|
|
173
|
+
* @param fields - Record of field definitions
|
|
174
|
+
* @param options - Field options (optional, array)
|
|
175
|
+
* @returns A nested object field
|
|
176
|
+
* @example
|
|
177
|
+
* // Single object:
|
|
178
|
+
* output: t.object({ name: t.string(), email: t.string() })
|
|
179
|
+
* @example
|
|
180
|
+
* // Array of objects:
|
|
181
|
+
* items: t.object({ name: t.string() }, { array: true })
|
|
182
|
+
*/
|
|
183
|
+
function object(fields, options) {
|
|
184
|
+
return createTailorField("nested", options, fields);
|
|
185
|
+
}
|
|
186
|
+
const t$1 = {
|
|
187
|
+
uuid,
|
|
188
|
+
string,
|
|
189
|
+
bool,
|
|
190
|
+
int,
|
|
191
|
+
float,
|
|
192
|
+
decimal,
|
|
193
|
+
date,
|
|
194
|
+
datetime,
|
|
195
|
+
time,
|
|
196
|
+
enum: _enum,
|
|
197
|
+
object
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
//#endregion
|
|
7
201
|
//#region src/configure/user.ts
|
|
8
202
|
/** Represents an unauthenticated user in the Tailor platform. */
|
|
9
203
|
const unauthenticatedTailorUser = {
|
|
@@ -477,6 +671,56 @@ function defineWorkflowExecutionPolicies(builder, options) {
|
|
|
477
671
|
return result;
|
|
478
672
|
}
|
|
479
673
|
|
|
674
|
+
//#endregion
|
|
675
|
+
//#region src/configure/services/workflow/job.ts
|
|
676
|
+
/**
|
|
677
|
+
* Create a workflow job definition.
|
|
678
|
+
*
|
|
679
|
+
* All jobs must be named exports from the workflow file.
|
|
680
|
+
* Job names must be unique across the entire project.
|
|
681
|
+
*
|
|
682
|
+
* Input and output must be JsonValue-compatible (primitives, plain objects, arrays).
|
|
683
|
+
* Functions and objects with a `toJSON` method are rejected at the type level;
|
|
684
|
+
* class instances exposing methods are rejected via the property walk.
|
|
685
|
+
* @param config - Job configuration with name and body function.
|
|
686
|
+
* @param config.name - Unique job name across the project.
|
|
687
|
+
* @param config.body - Async function that processes the job input.
|
|
688
|
+
* @returns A WorkflowJob that can be triggered from other jobs.
|
|
689
|
+
* @example
|
|
690
|
+
* // Simple job with async body:
|
|
691
|
+
* export const fetchData = createWorkflowJob({
|
|
692
|
+
* name: "fetch-data",
|
|
693
|
+
* body: async (input: { id: string }) => {
|
|
694
|
+
* const db = getDB("tailordb");
|
|
695
|
+
* return await db.selectFrom("Table").selectAll().where("id", "=", input.id).executeTakeFirst();
|
|
696
|
+
* },
|
|
697
|
+
* });
|
|
698
|
+
* @example
|
|
699
|
+
* // Orchestrator job that fans out to other jobs.
|
|
700
|
+
* export const orchestrate = createWorkflowJob({
|
|
701
|
+
* name: "orchestrate",
|
|
702
|
+
* body: async (input: { orderId: string }) => {
|
|
703
|
+
* const inventory = await checkInventory.trigger({ orderId: input.orderId });
|
|
704
|
+
* const payment = await processPayment.trigger({ orderId: input.orderId });
|
|
705
|
+
* return { inventory, payment };
|
|
706
|
+
* },
|
|
707
|
+
* });
|
|
708
|
+
*/
|
|
709
|
+
function createWorkflowJob(config) {
|
|
710
|
+
const body = config.body;
|
|
711
|
+
if (!process.env.TAILOR_PLATFORM_BUNDLE) registerJob(config.name, body);
|
|
712
|
+
const trigger = process.env.TAILOR_PLATFORM_BUNDLE ? async () => {
|
|
713
|
+
throw new Error("This workflow job's .trigger() is rewritten at build time and is unavailable in the bundle");
|
|
714
|
+
} : async function trigger(args, options) {
|
|
715
|
+
return arguments.length >= 2 ? await dispatchTriggerJob(config.name, args, options) : await dispatchTriggerJob(config.name, args);
|
|
716
|
+
};
|
|
717
|
+
return brandValue({
|
|
718
|
+
name: config.name,
|
|
719
|
+
trigger,
|
|
720
|
+
body
|
|
721
|
+
}, "workflow-job");
|
|
722
|
+
}
|
|
723
|
+
|
|
480
724
|
//#endregion
|
|
481
725
|
//#region src/configure/services/workflow/wait-point.ts
|
|
482
726
|
function getPlatformWorkflow() {
|