@tailor-platform/sdk 2.0.0-next.4 → 2.0.0-next.6
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 +135 -0
- package/dist/{application-BX13RArL.mjs → application-BJXRpQj5.mjs} +602 -1842
- package/dist/application-BJXRpQj5.mjs.map +1 -0
- package/dist/application-BV-AXawv.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/options.d.mts +0 -1
- package/dist/cli/commands/generate/service.d.mts +6 -2
- 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/staticwebsite/deploy.d.mts +19 -0
- package/dist/cli/commands/tailordb/migrate/config.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +16 -3
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +0 -1
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +6 -0
- 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 +6 -3
- package/dist/cli/index.mjs +871 -1577
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +10 -4
- package/dist/cli/lib.mjs +50 -4
- 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 +1 -2
- package/dist/cli/shared/context.d.mts +2 -1
- package/dist/cli/shared/readonly-guard.d.mts +25 -0
- package/dist/cli/shared/script-executor.d.mts +0 -1
- package/dist/cli/shared/seed-chunker.d.mts +7 -3
- package/dist/cli/shared/tailordb-namespaces.d.mts +37 -0
- package/dist/cli/shared/type-generator.d.mts +0 -1
- package/dist/cli/shared/workspace-name.d.mts +1 -0
- package/dist/completion/zsh-worker.zsh +15 -303
- package/dist/configure/config/index.d.mts +0 -1
- package/dist/configure/config/types.d.mts +2 -2
- package/dist/configure/index.d.mts +14 -4
- package/dist/configure/index.mjs +201 -6
- 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 +15 -14
- package/dist/configure/services/executor/executor.d.mts +2 -13
- package/dist/configure/services/executor/index.d.mts +1 -0
- package/dist/configure/services/executor/operation.d.mts +9 -4
- 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 +1 -0
- 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 +86 -56
- package/dist/configure/services/tailordb/types.d.mts +66 -17
- package/dist/configure/services/workflow/execution-policy.d.mts +2 -3
- 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 +1 -1
- package/dist/configure/types/field.d.mts +1 -2
- package/dist/configure/types/field.types.d.mts +6 -45
- package/dist/configure/types/index.d.mts +1 -0
- package/dist/configure/types/type.d.mts +2 -11
- package/dist/{crashreport-D3RjuSYb.mjs → crashreport-0ioNRZ4K.mjs} +1 -1
- package/dist/{crashreport-Cg-pqRJV.mjs → crashreport-CxHne11E.mjs} +4 -3
- package/dist/{crashreport-Cg-pqRJV.mjs.map → crashreport-CxHne11E.mjs.map} +1 -1
- package/dist/errors-DfnF4ibq.mjs +100 -0
- package/dist/errors-DfnF4ibq.mjs.map +1 -0
- package/dist/{globals-BjhJJ2dN.mjs → globals-D-YbJKW-.mjs} +16 -10
- package/dist/globals-D-YbJKW-.mjs.map +1 -0
- package/dist/kysely/index.d.mts +3 -4
- package/dist/{kysely-type-D-zflMGf.mjs → kysely-type-DqIRgDYR.mjs} +4 -3
- package/dist/kysely-type-DqIRgDYR.mjs.map +1 -0
- 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 +2 -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/type-source.d.mts +10 -0
- package/dist/parser/service/tailordb/types.d.mts +6 -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/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +0 -1
- package/dist/plugin/get-generated-type.d.mts +0 -1
- package/dist/plugin/manager.d.mts +2 -1
- package/dist/plugin/types.d.mts +0 -1
- package/dist/plugin/with-context.d.mts +0 -1
- package/dist/{register-ts-hook-BM1caLT0.mjs → register-ts-hook-DL31O2W9.mjs} +3076 -1744
- package/dist/register-ts-hook-DL31O2W9.mjs.map +1 -0
- package/dist/{registry-BSbq6SPo.mjs → registry-CC3CbQiF.mjs} +3 -3
- package/dist/registry-CC3CbQiF.mjs.map +1 -0
- package/dist/runtime/aigateway.d.mts +0 -1
- package/dist/runtime/authconnection.d.mts +0 -1
- package/dist/runtime/context.d.mts +0 -1
- package/dist/runtime/field-parse.d.mts +10 -0
- package/dist/runtime/globals.d.mts +5 -3
- package/dist/runtime/index.d.mts +0 -1
- package/dist/runtime/index.mjs +1 -1
- package/dist/runtime/types.d.mts +9 -4
- package/dist/runtime/workflow.d.mts +70 -10
- package/dist/runtime/workflow.mjs +1 -1
- package/dist/{schema-C4LYbXVG.mjs → schema--xYWRGfe.mjs} +272 -51
- package/dist/schema--xYWRGfe.mjs.map +1 -0
- package/dist/{secret-file-aoNXJmKa.mjs → secret-file-C3J4Gy8r.mjs} +2 -27
- package/dist/secret-file-C3J4Gy8r.mjs.map +1 -0
- 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/{service-ufH7sS8o.mjs → service-CnHz9rwz.mjs} +47 -20
- package/dist/service-CnHz9rwz.mjs.map +1 -0
- package/dist/{service-DeZeYa06.mjs → service-DaeJlBoH.mjs} +3 -3
- package/dist/{service-DeZeYa06.mjs.map → service-DaeJlBoH.mjs.map} +1 -1
- package/dist/service-nU6ITOHL.mjs +3 -0
- package/dist/service_pb-BoLM0X4K.mjs +167 -0
- package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
- package/dist/{service_pb-B2FF59sP.mjs → service_pb-r1T7kpJc.mjs} +1 -1
- package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +0 -1
- package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +0 -1
- package/dist/types/aigateway.generated.d.mts +5 -2
- package/dist/types/auth-connection.generated.d.mts +24 -11
- package/dist/types/auth.generated.d.mts +115 -84
- package/dist/types/executor.generated.d.mts +133 -123
- package/dist/types/helpers.d.mts +7 -6
- 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 +26 -11
- package/dist/types/staticwebsite.generated.d.mts +7 -3
- package/dist/types/tailordb.generated.d.mts +57 -29
- package/dist/types/workflow.generated.d.mts +9 -4
- package/dist/user-agent-Bgsszb5I.mjs +28 -0
- package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +1 -2
- package/dist/utils/test/index.mjs +36 -10
- package/dist/utils/test/index.mjs.map +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 +591 -173
- 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 +23 -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 +72 -21
- package/dist/vitest/setup.mjs +2 -2
- package/dist/vitest/workflow-local.d.mts +1 -0
- package/dist/workflow-9kHGKxF2.mjs +64 -0
- package/dist/workflow-9kHGKxF2.mjs.map +1 -0
- 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 +61 -15
- package/docs/cli/setup.md +1 -1
- package/docs/cli/tailordb.md +8 -140
- package/docs/cli/workspace.md +6 -4
- package/docs/cli-reference.md +18 -14
- package/docs/github-actions.md +8 -0
- package/docs/migration/v2.md +247 -0
- package/docs/runtime.md +5 -6
- package/docs/services/aigateway.md +2 -0
- package/docs/services/executor.md +5 -0
- package/docs/services/tailordb.md +144 -68
- package/docs/services/workflow.md +3 -3
- package/docs/testing.md +105 -89
- package/package.json +22 -25
- package/dist/application-BO4ZF8wP.mjs +0 -3
- package/dist/application-BX13RArL.mjs.map +0 -1
- package/dist/cli/erd-viewer-assets/app.js +0 -1424
- package/dist/cli/erd-viewer-assets/index.html +0 -77
- package/dist/cli/erd-viewer-assets/serve.json +0 -13
- package/dist/cli/erd-viewer-assets/styles.css +0 -1036
- package/dist/cli/shared/trigger-context.d.mts +0 -1
- package/dist/configure/types/field-runtime.d.mts +0 -17
- package/dist/errors-118wUDRr.mjs +0 -42
- package/dist/errors-118wUDRr.mjs.map +0 -1
- package/dist/field-runtime-CAnh_oow.mjs +0 -183
- package/dist/field-runtime-CAnh_oow.mjs.map +0 -1
- package/dist/globals-BjhJJ2dN.mjs.map +0 -1
- package/dist/kysely-type-D-zflMGf.mjs.map +0 -1
- package/dist/logger-BEiZZ3qT.mjs.map +0 -1
- package/dist/register-ts-hook-BM1caLT0.mjs.map +0 -1
- package/dist/registry-BSbq6SPo.mjs.map +0 -1
- package/dist/resource_pb-BRv7AMXK.mjs +0 -49
- package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
- package/dist/schema-C4LYbXVG.mjs.map +0 -1
- package/dist/secret-file-aoNXJmKa.mjs.map +0 -1
- package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
- package/dist/service-CkIwEctX.mjs +0 -3
- package/dist/service-ufH7sS8o.mjs.map +0 -1
- package/dist/service_pb-B5w9rjPY.mjs.map +0 -1
- package/dist/types-C-lQ4se3.mjs +0 -4
- package/dist/types-CXF2OYdR.mjs +0 -199
- package/dist/types-CXF2OYdR.mjs.map +0 -1
- package/dist/workflow-GNuSnsTx.mjs +0 -22
- package/dist/workflow-GNuSnsTx.mjs.map +0 -1
package/docs/runtime.md
CHANGED
|
@@ -31,7 +31,7 @@ const token = await authconnection.getConnectionToken("google");
|
|
|
31
31
|
const client = new idp.Client({ namespace: "my-namespace" });
|
|
32
32
|
const { users } = await client.users({ first: 10 });
|
|
33
33
|
|
|
34
|
-
const executionId = await workflow.
|
|
34
|
+
const executionId = await workflow.startWorkflow("approval", { reportId });
|
|
35
35
|
|
|
36
36
|
const invoker = context.getInvoker();
|
|
37
37
|
|
|
@@ -81,7 +81,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
|
|
|
81
81
|
- `secretmanager` — secret-vault access (`getSecret`, `getSecrets`)
|
|
82
82
|
- `authconnection` — OAuth-style connection tokens (`getConnectionToken`)
|
|
83
83
|
- `idp` — IdP user management (`new Client({ namespace })`)
|
|
84
|
-
- `workflow` — workflow & job control (`
|
|
84
|
+
- `workflow` — workflow & job control (`startWorkflow`, `resumeWorkflowExecution`, `startJobFunction`, `wait`, `resolve`; the pre-alignment names `triggerWorkflow`, `resumeWorkflow`, `triggerJobFunction` are kept as frozen aliases)
|
|
85
85
|
- `context` — execution context (`getInvoker`)
|
|
86
86
|
- `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`)
|
|
87
87
|
- `aigateway` — AI Gateway URL resolution (`get`)
|
|
@@ -97,17 +97,16 @@ import { expect, test } from "vitest";
|
|
|
97
97
|
|
|
98
98
|
test("encodes via iconv", () => {
|
|
99
99
|
using iconvM = mockIconv();
|
|
100
|
-
iconvM.
|
|
100
|
+
iconvM.convert.mockReturnValue(new Uint8Array([0x82, 0xa0]));
|
|
101
101
|
|
|
102
102
|
const out = iconv.convert("あ", "UTF-8", "Shift_JIS");
|
|
103
103
|
|
|
104
104
|
expect(out).toEqual(new Uint8Array([0x82, 0xa0]));
|
|
105
|
-
expect(iconvM.
|
|
105
|
+
expect(iconvM.convert).toHaveBeenCalledWith("あ", "UTF-8", "Shift_JIS");
|
|
106
106
|
}); // iconvM disposed here — the iconv mock is removed (previous state restored)
|
|
107
107
|
|
|
108
108
|
test("reads from a vault", async () => {
|
|
109
|
-
using sm = mockSecretmanager();
|
|
110
|
-
sm.setSecrets({ "my-vault": { API_KEY: "sk-123" } });
|
|
109
|
+
using sm = mockSecretmanager({ secrets: { "my-vault": { API_KEY: "sk-123" } } });
|
|
111
110
|
|
|
112
111
|
await expect(secretmanager.getSecret("my-vault", "API_KEY")).resolves.toBe("sk-123");
|
|
113
112
|
});
|
|
@@ -111,3 +111,5 @@ const { url } = await aigateway.get("my-aigateway");
|
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
Type narrowing is provided by the generated `tailor.d.ts` (the `AIGatewayNameRegistry` interface). Run `tailor generate` (or `deploy`) after defining new AI Gateways to refresh it. Before the first generate run, `get()` accepts any string.
|
|
114
|
+
|
|
115
|
+
The same URL is also shown by `tailor show`, which lists the URL of each AI Gateway defined in `aiGateways` once it has been deployed.
|
|
@@ -329,6 +329,11 @@ createExecutor({
|
|
|
329
329
|
});
|
|
330
330
|
```
|
|
331
331
|
|
|
332
|
+
`args` must match the workflow's main job input. It is required when that input is required
|
|
333
|
+
and can be omitted when the workflow has no input. Static arguments can be JSON-compatible
|
|
334
|
+
primitives, arrays, or plain objects; top-level `null` is not supported. An argument callback
|
|
335
|
+
must return the same input type.
|
|
336
|
+
|
|
332
337
|
### Authentication for Operations
|
|
333
338
|
|
|
334
339
|
GraphQL and Workflow operations can specify an `invoker` to execute with machine user credentials. Pass the machine user name as a plain string — it is type-narrowed to the names defined in your auth config:
|
|
@@ -220,11 +220,14 @@ const user = db.table("User", {
|
|
|
220
220
|
const userProfile = db.table("UserProfile", {
|
|
221
221
|
userEmail: db.string().relation({
|
|
222
222
|
type: "1-1",
|
|
223
|
-
toward: { type: user, key: "email" },
|
|
223
|
+
toward: { type: user, key: "email", as: "user" },
|
|
224
224
|
}),
|
|
225
225
|
});
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
`userEmail` does not end in `ID`, `Id`, or `id`, so this example specifies the forward relation
|
|
229
|
+
name with `toward.as`.
|
|
230
|
+
|
|
228
231
|
Customize relation names using `toward.as` / `backward` options:
|
|
229
232
|
|
|
230
233
|
```typescript
|
|
@@ -255,52 +258,72 @@ type User {
|
|
|
255
258
|
- `backward` - Customizes the field name for accessing this type from the related type
|
|
256
259
|
|
|
257
260
|
Relation names share the same GraphQL field namespace as fields, files, and other relations on
|
|
258
|
-
the
|
|
259
|
-
|
|
260
|
-
|
|
261
|
+
the table. The SDK rejects duplicate or empty relation names. When `toward.as` is omitted, the
|
|
262
|
+
default forward name comes from the relation field name with a trailing `ID`, `Id`, or `id`
|
|
263
|
+
removed. This lets multiple fields point to the same target table with distinct forward names:
|
|
261
264
|
|
|
262
265
|
```typescript
|
|
263
266
|
const post = db.table("Post", {
|
|
264
267
|
authorID: db.uuid().relation({
|
|
265
268
|
type: "n-1",
|
|
266
|
-
toward: { type: user
|
|
269
|
+
toward: { type: user },
|
|
267
270
|
backward: "authoredPosts",
|
|
268
271
|
}),
|
|
269
272
|
reviewerID: db.uuid().relation({
|
|
270
273
|
type: "n-1",
|
|
271
|
-
toward: { type: user
|
|
274
|
+
toward: { type: user },
|
|
272
275
|
backward: "reviewedPosts",
|
|
273
276
|
}),
|
|
274
277
|
});
|
|
275
278
|
```
|
|
276
279
|
|
|
280
|
+
These fields generate the forward names `author` and `reviewer`. A relation field without one of
|
|
281
|
+
the recognized ID suffixes needs an explicit `toward.as`, because its generated forward name
|
|
282
|
+
would conflict with the field itself.
|
|
283
|
+
|
|
277
284
|
Use `toward.as` or `backward` when a generated relation name would conflict with an existing
|
|
278
|
-
field, files entry, or relation on the same
|
|
285
|
+
field, files entry, or relation on the same table.
|
|
279
286
|
|
|
280
287
|
### Hooks
|
|
281
288
|
|
|
282
|
-
Add hooks to execute functions during data creation or update.
|
|
289
|
+
Add hooks to execute functions during data creation or update.
|
|
290
|
+
|
|
291
|
+
#### Field-level Hooks
|
|
292
|
+
|
|
293
|
+
Set hooks directly on individual fields.
|
|
294
|
+
|
|
295
|
+
Create hooks receive:
|
|
283
296
|
|
|
284
|
-
- `
|
|
285
|
-
- `data`: Entire record data (for accessing other field values)
|
|
297
|
+
- `input`: The field value from the input (null when not provided)
|
|
286
298
|
- `invoker`: Principal performing the operation
|
|
299
|
+
- `now`: Operation timestamp (`Date`), shared across all hooks in the same operation
|
|
287
300
|
|
|
288
|
-
|
|
301
|
+
Update hooks receive the same arguments plus:
|
|
289
302
|
|
|
290
|
-
|
|
303
|
+
- `oldValue`: The previous field value (null only for optional fields)
|
|
291
304
|
|
|
292
305
|
```typescript
|
|
293
306
|
db.string().hooks({
|
|
294
307
|
create: ({ invoker }) => invoker?.id ?? "",
|
|
295
|
-
update: ({
|
|
308
|
+
update: ({ input, oldValue }) => input ?? oldValue,
|
|
296
309
|
});
|
|
297
310
|
```
|
|
298
311
|
|
|
299
|
-
|
|
312
|
+
Field-level hooks operate on a single field and cannot access other fields. Use type-level hooks for cross-field logic.
|
|
300
313
|
|
|
301
314
|
#### Type-level Hooks
|
|
302
315
|
|
|
303
|
-
Set hooks
|
|
316
|
+
Set hooks across multiple fields using `db.table().hooks()`. The hook returns an object with the fields to override. When both field-level and type-level hooks exist for the same field, type-level hooks take priority.
|
|
317
|
+
|
|
318
|
+
Create hooks receive:
|
|
319
|
+
|
|
320
|
+
- `input`: The submitted record data. When field-level hooks or defaults exist, `input` reflects their applied results
|
|
321
|
+
- `invoker`: Principal performing the operation
|
|
322
|
+
- `now`: Operation timestamp (`Date`), shared across all hooks in the same operation
|
|
323
|
+
|
|
324
|
+
Update hooks receive the same arguments plus:
|
|
325
|
+
|
|
326
|
+
- `oldRecord`: The existing record (non-null)
|
|
304
327
|
|
|
305
328
|
```typescript
|
|
306
329
|
export const customer = db
|
|
@@ -310,60 +333,56 @@ export const customer = db
|
|
|
310
333
|
fullName: db.string(),
|
|
311
334
|
})
|
|
312
335
|
.hooks({
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
336
|
+
create: ({ input }) => ({
|
|
337
|
+
fullName: `${input.firstName} ${input.lastName}`,
|
|
338
|
+
}),
|
|
339
|
+
update: ({ input, oldRecord }) => ({
|
|
340
|
+
fullName: `${input.firstName ?? oldRecord.firstName} ${input.lastName ?? oldRecord.lastName}`,
|
|
341
|
+
}),
|
|
317
342
|
});
|
|
318
343
|
```
|
|
319
344
|
|
|
320
|
-
|
|
345
|
+
Use `now` to stamp several fields with the exact same instant:
|
|
321
346
|
|
|
322
347
|
```typescript
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
348
|
+
export const order = db
|
|
349
|
+
.table("Order", {
|
|
350
|
+
createdAt: db.datetime(),
|
|
351
|
+
updatedAt: db.datetime(),
|
|
327
352
|
})
|
|
328
353
|
.hooks({
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
// OK - set hooks on different fields
|
|
333
|
-
export const user = db
|
|
334
|
-
.table("User", {
|
|
335
|
-
firstName: db.string().hooks({ create: () => "John" }), // Field-level on firstName
|
|
336
|
-
lastName: db.string(),
|
|
337
|
-
})
|
|
338
|
-
.hooks({
|
|
339
|
-
lastName: { create: () => "Doe" }, // Type-level on lastName
|
|
354
|
+
create: ({ now }) => ({ createdAt: now, updatedAt: now }),
|
|
355
|
+
update: ({ now }) => ({ updatedAt: now }),
|
|
340
356
|
});
|
|
341
357
|
```
|
|
342
358
|
|
|
359
|
+
**Note:** `.hooks()` can only be called once on a type. Duplicate type-level calls fail at compile time and throw at runtime.
|
|
360
|
+
|
|
343
361
|
### Validation
|
|
344
362
|
|
|
345
|
-
Add validation rules to fields. Validators
|
|
363
|
+
Add validation rules to fields. Validators run after hooks.
|
|
346
364
|
|
|
347
|
-
- `value
|
|
348
|
-
- `data`: Entire record data after hook transformations (for accessing other field values)
|
|
349
|
-
- `invoker`: Principal performing the operation
|
|
365
|
+
**Note:** Custom validators run only when built-in type validation succeeds, so `value` always has the field's declared type. For array fields, the validator is called once with the complete array, not per element:
|
|
350
366
|
|
|
351
|
-
|
|
367
|
+
```typescript
|
|
368
|
+
// value is string[], not string
|
|
369
|
+
db.string({ array: true }).validate(({ value }) => value.length >= 2);
|
|
370
|
+
```
|
|
352
371
|
|
|
353
372
|
#### Field-level Validation
|
|
354
373
|
|
|
355
|
-
Set validators directly on individual fields:
|
|
374
|
+
Set validators directly on individual fields. Each validator receives `{ value }` (the field value after hooks) and returns an error message string to fail, or void to pass:
|
|
356
375
|
|
|
357
376
|
```typescript
|
|
358
377
|
db.string().validate(
|
|
359
|
-
({ value }) => value.includes("@"),
|
|
360
|
-
|
|
378
|
+
({ value }) => (value.includes("@") ? undefined : "Must contain @"),
|
|
379
|
+
({ value }) => (value.length >= 5 ? undefined : "Must be at least 5 characters"),
|
|
361
380
|
);
|
|
362
381
|
```
|
|
363
382
|
|
|
364
383
|
#### Type-level Validation
|
|
365
384
|
|
|
366
|
-
Set
|
|
385
|
+
Set a validator across all fields using `db.table().validate()`. The validator receives `{ newRecord, oldRecord, invoker }` and an `issues()` callback to report errors per field:
|
|
367
386
|
|
|
368
387
|
```typescript
|
|
369
388
|
export const user = db
|
|
@@ -371,38 +390,33 @@ export const user = db
|
|
|
371
390
|
name: db.string(),
|
|
372
391
|
email: db.string(),
|
|
373
392
|
})
|
|
374
|
-
.validate({
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
393
|
+
.validate(({ newRecord }, issues) => {
|
|
394
|
+
if (newRecord.name.length <= 5) {
|
|
395
|
+
issues("name", "Name must be longer than 5 characters");
|
|
396
|
+
}
|
|
397
|
+
if (!newRecord.email.includes("@")) {
|
|
398
|
+
issues("email", "Must contain @");
|
|
399
|
+
}
|
|
380
400
|
});
|
|
381
401
|
```
|
|
382
402
|
|
|
383
|
-
|
|
403
|
+
### Defaults
|
|
404
|
+
|
|
405
|
+
Set a default value for a required field on create. The field becomes optional in the create input — the default fills in when no value is provided:
|
|
384
406
|
|
|
385
407
|
```typescript
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
name: db.string().validate(({ value }) => value.length > 0), // Field-level
|
|
390
|
-
})
|
|
391
|
-
.validate({
|
|
392
|
-
name: [({ value }) => value.length < 100, "Too long"], // Type-level - ERROR
|
|
393
|
-
});
|
|
408
|
+
db.int().default(0);
|
|
409
|
+
db.string().default("pending");
|
|
410
|
+
```
|
|
394
411
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
email: db.string(),
|
|
400
|
-
})
|
|
401
|
-
.validate({
|
|
402
|
-
email: [({ value }) => value.includes("@"), "Invalid email"], // Type-level on email
|
|
403
|
-
});
|
|
412
|
+
For datetime/date/time fields, pass `"now"` to use the operation timestamp:
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
db.datetime().default("now");
|
|
404
416
|
```
|
|
405
417
|
|
|
418
|
+
**Note:** `.validate()` can only be called once on a type. Duplicate type-level calls fail at compile time and throw at runtime.
|
|
419
|
+
|
|
406
420
|
### Vector Search
|
|
407
421
|
|
|
408
422
|
```typescript
|
|
@@ -436,6 +450,22 @@ export const user = db.table("User", {
|
|
|
436
450
|
|
|
437
451
|
## Type Modifiers
|
|
438
452
|
|
|
453
|
+
Type builder methods that set one type-level configuration can be called only once on the same type. Duplicate calls fail at compile time and throw at runtime. This applies to `.description()`, `.hooks()`, `.validate()`, `.features()`, `.indexes()`, `.files()`, `.permission()`, and `.gqlPermission()`.
|
|
454
|
+
|
|
455
|
+
Conditional assignment is still supported when only one branch calls the method:
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
let user = db.type("User", {
|
|
459
|
+
name: db.string(),
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
if (enableFiles) {
|
|
463
|
+
user = user.files({
|
|
464
|
+
avatar: "profile image",
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
439
469
|
### Composite Indexes
|
|
440
470
|
|
|
441
471
|
```typescript
|
|
@@ -525,6 +555,48 @@ db.table("User", {
|
|
|
525
555
|
});
|
|
526
556
|
```
|
|
527
557
|
|
|
558
|
+
#### GraphQL Operations
|
|
559
|
+
|
|
560
|
+
Control which GraphQL operations (`create`, `update`, `delete`, `read`) are exposed for a type. All operations are enabled by default.
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
db.type("Order", {
|
|
564
|
+
status: db.string(),
|
|
565
|
+
}).features({
|
|
566
|
+
gqlOperations: {
|
|
567
|
+
delete: false, // Disable the delete mutation
|
|
568
|
+
},
|
|
569
|
+
});
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
Use the `"query"` alias to disable all mutations at once (read-only type: `create`/`update`/`delete` false, `read` true):
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
db.type("AuditLog", {
|
|
576
|
+
action: db.string(),
|
|
577
|
+
}).features({
|
|
578
|
+
gqlOperations: "query",
|
|
579
|
+
});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
**Namespace-level default**
|
|
583
|
+
|
|
584
|
+
Set a default for every type in a TailorDB namespace in `tailor.config.ts`. A type's own `.features({ gqlOperations })` always takes precedence over this default.
|
|
585
|
+
|
|
586
|
+
```typescript
|
|
587
|
+
// tailor.config.ts
|
|
588
|
+
export default defineConfig({
|
|
589
|
+
db: {
|
|
590
|
+
tailordb: {
|
|
591
|
+
files: ["./tailordb/*.ts"],
|
|
592
|
+
gqlOperations: { delete: false }, // Default for every type in this namespace
|
|
593
|
+
},
|
|
594
|
+
},
|
|
595
|
+
});
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
This default is re-evaluated on every `tailor-sdk deploy`, so changing it also updates types that already exist on the platform, not only newly created ones.
|
|
599
|
+
|
|
528
600
|
### Field Extraction (`pickFields` / `omitFields`)
|
|
529
601
|
|
|
530
602
|
Extract subsets of fields from a `TailorDBType` for reuse in resolvers, executors, seed schemas, etc.
|
|
@@ -552,6 +624,8 @@ Available options:
|
|
|
552
624
|
| `optional` | Makes the selected fields optional |
|
|
553
625
|
| `array` | Makes the selected fields array types |
|
|
554
626
|
|
|
627
|
+
**Note:** The `array` option cannot change fields with custom validation — their validators expect the original value shape. Define a new field with a matching validator instead.
|
|
628
|
+
|
|
555
629
|
#### `omitFields(keys)`
|
|
556
630
|
|
|
557
631
|
Return all fields except the specified ones:
|
|
@@ -603,6 +677,8 @@ Configure Permission and GQLPermission. For details, see the [TailorDB Permissio
|
|
|
603
677
|
|
|
604
678
|
**Important**: Following the secure-by-default principle, all operations are denied if permissions are not configured. You must explicitly grant permissions for each operation (create, read, update, delete).
|
|
605
679
|
|
|
680
|
+
`generate`/`deploy` reject a type that has no `.permission()`, or no `.gqlPermission()` while GraphQL operations are enabled for it (see [GraphQL Operations](#graphql-operations) above). Disable GraphQL exposure entirely with `.features({ gqlOperations: { create: false, update: false, delete: false, read: false } })` if a type only needs record-level permission.
|
|
681
|
+
|
|
606
682
|
```typescript
|
|
607
683
|
db.table("User", {
|
|
608
684
|
name: db.string(),
|
|
@@ -397,11 +397,11 @@ export default defineConfig({
|
|
|
397
397
|
|
|
398
398
|
`key` accepts `[a-z0-9_:.-]` and must start with `[a-z0-9]`. An exact key must also end with `[a-z0-9]`; a wildcard prefix (`matchType: "prefix"`) may end with any of those characters, since the platform appends a trailing `*` after it. The platform-registered key — including that trailing `*` when wildcarded — is 2 to 64 characters long, so a wildcard prefix must be at most 63 characters. `foo:bar` is a valid exact key; `tenant-api` with `matchType: "prefix"` registers `tenant-api*` as a wildcard prefix.
|
|
399
399
|
|
|
400
|
-
An exact-key policy applies to dispatches whose runtime key equals the policy key. A wildcard policy applies to every dispatch whose runtime key begins with the prefix; each concrete resolved key gets its own independent pool of the declared size (a `cap = 3` wildcard yields three concurrent dispatches per resolved key, not three across every match).
|
|
400
|
+
An exact-key policy applies to dispatches whose runtime key equals the policy key. A wildcard policy applies to every dispatch whose runtime key begins with the prefix; each concrete resolved key gets its own independent pool of the declared size (a `cap = 3` wildcard yields three concurrent dispatches per resolved key, not three across every match). When a dispatch matches more than one policy (for example, an exact key that also falls under a wildcard prefix, or two wildcard prefixes where one starts with the other), every matching policy's cap is enforced independently, and the tightest one blocks.
|
|
401
401
|
|
|
402
402
|
### Referencing a Policy from a Workflow
|
|
403
403
|
|
|
404
|
-
Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.
|
|
404
|
+
Pass the runtime key through the `executionPolicyKey` option on `job.trigger()` or `tailor.workflow.startJobFunction()` (or its frozen alias `triggerJobFunction`). For exact-key policies, use `<policy>.key` directly — it's typed so only a value that came from a declared policy can be passed. For wildcard policies (`matchType: "prefix"`), there is no `<policy>.key` — call `<policy>.keyFor(suffix)` to build the concrete key. `keyFor` joins the prefix and suffix with `.` by default; override it with `separator` — the second argument to `defineWorkflowExecutionPolicies` (applies to every policy in the group), or a `def` field on a single `defineWorkflowExecutionPolicy`.
|
|
405
405
|
|
|
406
406
|
```typescript
|
|
407
407
|
import { createWorkflowJob } from "@tailor-platform/sdk";
|
|
@@ -427,7 +427,7 @@ export const mainJob = createWorkflowJob({
|
|
|
427
427
|
});
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
The same `executionPolicyKey` option is available on `tailor.workflow.
|
|
430
|
+
The same `executionPolicyKey` option is available on `tailor.workflow.startJobFunction(name, args, options)` (or the frozen alias `tailor.workflow.triggerJobFunction`) for jobs invoked by name.
|
|
431
431
|
|
|
432
432
|
## Triggering a Workflow from a Resolver
|
|
433
433
|
|