@tailor-platform/sdk 2.0.0-next.3 → 2.0.0-next.5
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 +142 -0
- package/dist/aigateway-DR4Kwuik.mjs +9 -0
- package/dist/{aigateway-B3oZZE6v.mjs.map → aigateway-DR4Kwuik.mjs.map} +1 -1
- package/dist/{application-eHp9jXld.mjs → application-Bf8wxOi6.mjs} +701 -597
- package/dist/application-Bf8wxOi6.mjs.map +1 -0
- package/dist/application-CUkjzfij.mjs +3 -0
- package/dist/authconnection-CZvi9ANm.mjs +9 -0
- package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
- package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
- package/dist/cli/cache/bundle-cache.d.mts +2 -1
- package/dist/cli/cache/store.d.mts +1 -1
- package/dist/cli/commands/api/index.d.mts +1 -0
- package/dist/cli/commands/deploy/aigateway.d.mts +5 -1
- package/dist/cli/commands/deploy/application.d.mts +7 -1
- package/dist/cli/commands/deploy/apply-phases.d.mts +14 -1
- package/dist/cli/commands/deploy/auth.d.mts +5 -1
- package/dist/cli/commands/deploy/deploy.d.mts +5 -0
- package/dist/cli/commands/deploy/executor.d.mts +7 -1
- package/dist/cli/commands/deploy/function-registry.d.mts +5 -0
- package/dist/cli/commands/deploy/idp.d.mts +5 -1
- package/dist/cli/commands/deploy/resolver.d.mts +5 -1
- package/dist/cli/commands/deploy/secret-manager.d.mts +5 -1
- package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -1
- package/dist/cli/commands/deploy/tailordb/index.d.mts +8 -1
- package/dist/cli/commands/deploy/types.d.mts +3 -1
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -0
- 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/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 +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 +0 -1
- package/dist/cli/commands/workspace/delete.d.mts +0 -1
- package/dist/cli/commands/workspace/get.d.mts +0 -1
- package/dist/cli/commands/workspace/list.d.mts +0 -1
- package/dist/cli/commands/workspace/restore.d.mts +0 -1
- package/dist/cli/commands/workspace/transform.d.mts +2 -0
- package/dist/cli/commands/workspace/user/invite.d.mts +0 -1
- package/dist/cli/commands/workspace/user/list.d.mts +0 -1
- package/dist/cli/commands/workspace/user/remove.d.mts +0 -1
- package/dist/cli/commands/workspace/user/transform.d.mts +1 -0
- package/dist/cli/commands/workspace/user/update.d.mts +0 -1
- package/dist/cli/index.d.mts +6 -3
- package/dist/cli/index.mjs +273 -104
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +4 -2
- package/dist/cli/lib.mjs +4 -4
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/query/index.d.mts +4 -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/ts-hook.mjs +43 -13
- package/dist/completion/zsh-worker.zsh +10 -10
- package/dist/configure/config/index.d.mts +0 -1
- package/dist/configure/config/types.d.mts +3 -1
- package/dist/configure/index.d.mts +17 -5
- package/dist/configure/index.mjs +309 -5
- 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 +1 -1
- package/dist/configure/services/executor/index.d.mts +1 -0
- package/dist/configure/services/executor/operation.d.mts +2 -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 +8 -1
- 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 +104 -68
- package/dist/configure/services/tailordb/types.d.mts +66 -17
- package/dist/configure/services/workflow/execution-policy.d.mts +70 -0
- package/dist/configure/services/workflow/execution-policy.types.d.mts +103 -0
- package/dist/configure/services/workflow/index.d.mts +4 -1
- package/dist/configure/services/workflow/job.d.mts +7 -3
- 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-runtime.d.mts +0 -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 +1 -2
- package/dist/{context-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
- package/dist/{context-Bd266-ru.mjs.map → context-DYQVYWqZ.mjs.map} +1 -1
- package/dist/{file-BbdFGdMV.mjs → file-BUcmVIH2.mjs} +12 -14
- package/dist/file-BUcmVIH2.mjs.map +1 -0
- package/dist/{file-utils-CYZnO1pX.mjs → file-utils-yEiIS4nJ.mjs} +2 -2
- package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
- package/dist/{globals-DhwZj0RB.mjs → globals-BjhJJ2dN.mjs} +2 -2
- package/dist/globals-BjhJJ2dN.mjs.map +1 -0
- package/dist/iconv-QWaZh0TT.mjs +38 -0
- package/dist/iconv-QWaZh0TT.mjs.map +1 -0
- package/dist/{idp-Bx25ZBdN.mjs → idp-RA_swu-h.mjs} +4 -5
- package/dist/idp-RA_swu-h.mjs.map +1 -0
- package/dist/kysely/index.d.mts +3 -4
- package/dist/{kysely-type-5eAChaHO.mjs → kysely-type-DqIRgDYR.mjs} +4 -5
- package/dist/kysely-type-DqIRgDYR.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/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/file-utils/index.mjs +1 -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-ZpBacA07.mjs → register-ts-hook-BhzVkej0.mjs} +799 -446
- package/dist/register-ts-hook-BhzVkej0.mjs.map +1 -0
- package/dist/{registry-DH4m7eYo.mjs → registry-BSbq6SPo.mjs} +4 -3
- package/dist/registry-BSbq6SPo.mjs.map +1 -0
- package/dist/resource_pb-BRv7AMXK.mjs +49 -0
- package/dist/resource_pb-BRv7AMXK.mjs.map +1 -0
- package/dist/runtime/aigateway.d.mts +5 -15
- package/dist/runtime/aigateway.mjs +2 -2
- package/dist/runtime/authconnection.d.mts +5 -15
- package/dist/runtime/authconnection.mjs +2 -2
- package/dist/runtime/context.d.mts +14 -6
- package/dist/runtime/context.mjs +2 -2
- package/dist/runtime/file.d.mts +14 -54
- package/dist/runtime/file.mjs +2 -2
- package/dist/runtime/globals.d.mts +1 -2
- package/dist/runtime/iconv.d.mts +5 -53
- package/dist/runtime/iconv.mjs +2 -2
- package/dist/runtime/idp.d.mts +13 -70
- package/dist/runtime/idp.mjs +2 -2
- package/dist/runtime/index.d.mts +11 -12
- package/dist/runtime/index.mjs +9 -9
- package/dist/runtime/secretmanager.d.mts +7 -20
- package/dist/runtime/secretmanager.mjs +2 -2
- package/dist/runtime/types.d.mts +9 -4
- package/dist/runtime/workflow.d.mts +42 -41
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{schema-89dYxNC2.mjs → schema-iCd1ugGp.mjs} +257 -54
- package/dist/schema-iCd1ugGp.mjs.map +1 -0
- package/dist/secretmanager-CYlpffsz.mjs +13 -0
- package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
- package/dist/seed/index.d.mts +3 -2
- package/dist/service-BT0GPd01.mjs +3 -0
- package/dist/{service-ufH7sS8o.mjs → service-CzZEVrp9.mjs} +14 -9
- package/dist/service-CzZEVrp9.mjs.map +1 -0
- package/dist/{service_pb-CIrhGwHk.mjs → service_pb-Bk7dL-yT.mjs} +27 -50
- package/dist/service_pb-Bk7dL-yT.mjs.map +1 -0
- package/dist/{service_pb-DjwIn4jO.mjs → service_pb-DZkfjB_6.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 +1 -2
- 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 +29 -10
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +35 -2
- 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 +76 -84
- 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/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 +1 -1
- package/dist/vitest/index.mjs +11 -11
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock-kysely.d.mts +0 -1
- package/dist/vitest/mocks/aigateway.d.mts +2 -2
- package/dist/vitest/mocks/authconnection.d.mts +2 -2
- package/dist/vitest/mocks/idp.d.mts +2 -2
- package/dist/vitest/mocks/secretmanager.d.mts +3 -1
- package/dist/vitest/mocks/tailordb.d.mts +6 -3
- package/dist/vitest/mocks/workflow.d.mts +15 -8
- package/dist/vitest/setup.mjs +1 -1
- package/dist/vitest/workflow-local.d.mts +1 -0
- package/dist/workflow-GNuSnsTx.mjs +22 -0
- package/dist/workflow-GNuSnsTx.mjs.map +1 -0
- package/docs/cli/auth.md +3 -3
- package/docs/cli/setup.md +9 -9
- package/docs/cli-reference.md +7 -6
- package/docs/configuration.md +24 -0
- package/docs/migration/v2.md +317 -0
- package/docs/plugin/custom.md +4 -4
- package/docs/plugin/index.md +2 -2
- package/docs/runtime.md +4 -2
- package/docs/services/aigateway.md +2 -0
- package/docs/services/auth.md +2 -2
- package/docs/services/resolver.md +1 -1
- package/docs/services/tailordb-migration.md +1 -1
- package/docs/services/tailordb.md +125 -93
- package/docs/services/workflow.md +78 -0
- package/package.json +22 -22
- package/dist/aigateway-B3oZZE6v.mjs +0 -15
- package/dist/application-D2hSK1ZL.mjs +0 -3
- package/dist/application-eHp9jXld.mjs.map +0 -1
- package/dist/authconnection-BGQM8FZI.mjs +0 -15
- package/dist/authconnection-BGQM8FZI.mjs.map +0 -1
- package/dist/cli/shared/trigger-context.d.mts +0 -1
- package/dist/field-runtime-CAnh_oow.mjs +0 -183
- package/dist/field-runtime-CAnh_oow.mjs.map +0 -1
- package/dist/file-BbdFGdMV.mjs.map +0 -1
- package/dist/file-utils-CYZnO1pX.mjs.map +0 -1
- package/dist/globals-DhwZj0RB.mjs.map +0 -1
- package/dist/iconv-D2vi8G36.mjs +0 -63
- package/dist/iconv-D2vi8G36.mjs.map +0 -1
- package/dist/idp-Bx25ZBdN.mjs.map +0 -1
- package/dist/kysely-type-5eAChaHO.mjs.map +0 -1
- package/dist/register-ts-hook-ZpBacA07.mjs.map +0 -1
- package/dist/registry-DH4m7eYo.mjs.map +0 -1
- package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
- package/dist/schema-89dYxNC2.mjs.map +0 -1
- package/dist/secretmanager-BVxw3ih_.mjs +0 -24
- package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
- package/dist/service-CkIwEctX.mjs +0 -3
- package/dist/service-ufH7sS8o.mjs.map +0 -1
- package/dist/service_pb-CIrhGwHk.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-Bo59B75H.mjs +0 -50
- package/dist/workflow-Bo59B75H.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TailorEnv } from "../runtime/types.mjs";
|
|
2
2
|
import { WorkflowJob } from "../configure/services/workflow/job.mjs";
|
|
3
3
|
import { Workflow } from "../configure/services/workflow/workflow.mjs";
|
|
4
|
+
import "../configure/services/workflow/index.mjs";
|
|
4
5
|
//#region src/vitest/workflow-local.d.ts
|
|
5
6
|
type AnyWorkflowJob = WorkflowJob<string, any, any>;
|
|
6
7
|
type AnyWorkflow = Workflow<AnyWorkflowJob>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/runtime/workflow.ts
|
|
2
|
+
const api = () => globalThis.tailor.workflow;
|
|
3
|
+
function triggerWorkflow(workflowName, args, options) {
|
|
4
|
+
if (options?.invoker === void 0) return api().triggerWorkflow(workflowName, args);
|
|
5
|
+
return api().triggerWorkflow(workflowName, args, { authInvoker: options.invoker });
|
|
6
|
+
}
|
|
7
|
+
const resumeWorkflow = (...args) => api().resumeWorkflow(...args);
|
|
8
|
+
const triggerJobFunction = (...args) => api().triggerJobFunction(...args);
|
|
9
|
+
const wait = (...args) => api().wait(...args);
|
|
10
|
+
const resolve = (...args) => api().resolve(...args);
|
|
11
|
+
/** Runtime wrapper namespace for `tailor.workflow`. */
|
|
12
|
+
const workflow = {
|
|
13
|
+
triggerWorkflow,
|
|
14
|
+
resumeWorkflow,
|
|
15
|
+
triggerJobFunction,
|
|
16
|
+
wait,
|
|
17
|
+
resolve
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { workflow as t };
|
|
22
|
+
//# sourceMappingURL=workflow-GNuSnsTx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-GNuSnsTx.mjs","names":[],"sources":["../src/runtime/workflow.ts"],"sourcesContent":["/**\n * Workflow utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.\n * At runtime this delegates to `globalThis.tailor.workflow`. Use `mockWorkflow`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n * @example\n * import { workflow } from \"@tailor-platform/sdk/runtime\";\n *\n * const executionId = await workflow.triggerWorkflow(\"myWorkflow\", { data: \"value\" });\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Specifies the machine user that should be used to execute the workflow.\n * This allows workflows to run with specific authentication context.\n */\nexport interface Invoker {\n /** The namespace where the machine user is defined */\n namespace: string;\n /** The name of the machine user to use for workflow execution */\n machineUserName: string;\n}\n\n/** Options for {@link triggerWorkflow}. */\nexport interface TriggerWorkflowOptions {\n /** Optional invoker to specify which machine user should execute the workflow */\n invoker?: Invoker;\n}\n\nexport interface PlatformTriggerWorkflowOptions {\n authInvoker?: Invoker;\n}\n\ndeclare const executionPolicyKeyBrand: unique symbol;\n\n/**\n * A concrete runtime key produced by an execution policy instance — either an\n * exact-match policy's `.key`, or a wildcard policy's `.keyFor(suffix)` (see\n * `defineWorkflowExecutionPolicies`). Branded so an arbitrary string that\n * wasn't derived from a declared policy can't be passed as `executionPolicyKey`.\n */\nexport type ExecutionPolicyKey = string & { readonly [executionPolicyKeyBrand]: never };\n\n/** Options for {@link triggerJobFunction}. */\nexport interface TriggerJobFunctionOptions {\n /**\n * Execution policy key matched by the platform against the policies\n * declared with `defineWorkflowExecutionPolicies` in `tailor.config.ts`.\n */\n executionPolicyKey?: ExecutionPolicyKey;\n}\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n */\nexport interface PlatformWorkflowAPI {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional platform trigger options\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: PlatformTriggerWorkflowOptions,\n ): Promise<string>;\n\n /**\n * Resumes a failed or pending-retry workflow execution and returns its execution ID.\n * @param executionId - The execution to resume\n * @returns The execution ID of the resumed workflow\n */\n resumeWorkflow(executionId: string): Promise<string>;\n\n /**\n * Triggers a job function and returns its result.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @param options - Optional trigger options (e.g. `executionPolicyKey`)\n * @returns The job's return value\n */\n triggerJobFunction(jobName: string, args?: any, options?: TriggerJobFunctionOptions): any;\n\n /**\n * Suspends the current workflow execution and waits for an external signal to resume.\n * @param key - Wait point key\n * @param payload - Optional payload to record with the wait point\n * @returns The payload supplied by the corresponding `resolve` call\n */\n wait(key: string, payload?: any): any;\n\n /**\n * Resolves a waiting workflow execution, causing it to resume.\n * @param executionId - The execution to resume\n * @param key - Wait point key to resolve\n * @param callback - Callback receiving the wait payload; its return value is forwarded to `wait`\n * @returns A promise that resolves once the resolve has been recorded\n */\n resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;\n}\n\n/** Runtime wrapper API for workflow and job control. */\nexport interface TailorWorkflowAPI extends Omit<PlatformWorkflowAPI, \"triggerWorkflow\"> {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional SDK trigger options\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n ): Promise<string>;\n}\n\nconst api = (): PlatformWorkflowAPI =>\n (globalThis as unknown as { tailor: { workflow: PlatformWorkflowAPI } }).tailor.workflow;\n\nfunction triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n): Promise<string> {\n if (options?.invoker === undefined) {\n return api().triggerWorkflow(workflowName, args);\n }\n return api().triggerWorkflow(workflowName, args, { authInvoker: options.invoker });\n}\n\nconst resumeWorkflow: PlatformWorkflowAPI[\"resumeWorkflow\"] = (...args) =>\n api().resumeWorkflow(...args);\n\nconst triggerJobFunction: PlatformWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().triggerJobFunction(...args);\n\nconst wait: PlatformWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\nconst resolve: PlatformWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n\n/** Runtime wrapper namespace for `tailor.workflow`. */\nexport const workflow = {\n triggerWorkflow,\n resumeWorkflow,\n triggerJobFunction,\n wait,\n resolve,\n} as const satisfies TailorWorkflowAPI;\n"],"mappings":";AA0HA,MAAM,YACH,WAAwE,OAAO;AAElF,SAAS,gBACP,cACA,MACA,SACiB;CACjB,IAAI,SAAS,YAAY,QACvB,OAAO,IAAI,CAAC,CAAC,gBAAgB,cAAc,IAAI;CAEjD,OAAO,IAAI,CAAC,CAAC,gBAAgB,cAAc,MAAM,EAAE,aAAa,QAAQ,QAAQ,CAAC;AACnF;AAEA,MAAM,kBAAyD,GAAG,SAChE,IAAI,CAAC,CAAC,eAAe,GAAG,IAAI;AAE9B,MAAM,sBAAiE,GAAG,SACxE,IAAI,CAAC,CAAC,mBAAmB,GAAG,IAAI;AAElC,MAAM,QAAqC,GAAG,SAAS,IAAI,CAAC,CAAC,KAAK,GAAG,IAAI;AAEzE,MAAM,WAA2C,GAAG,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG,IAAI;;AAGlF,MAAa,WAAW;CACtB;CACA;CACA;CACA;CACA;AACF"}
|
package/docs/cli/auth.md
CHANGED
|
@@ -186,9 +186,9 @@ tailor machineuser token [options] [name]
|
|
|
186
186
|
|
|
187
187
|
**Arguments**
|
|
188
188
|
|
|
189
|
-
| Argument | Description
|
|
190
|
-
| -------- |
|
|
191
|
-
| `name` | Machine user name. Falls back to the active profile's default machine user. | No |
|
|
189
|
+
| Argument | Description | Required |
|
|
190
|
+
| -------- | ------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
191
|
+
| `name` | Machine user name. Falls back to TAILOR_PLATFORM_MACHINE_USER_NAME, then the active profile's default machine user. | No |
|
|
192
192
|
|
|
193
193
|
**Options**
|
|
194
194
|
|
package/docs/cli/setup.md
CHANGED
|
@@ -100,14 +100,14 @@ tailor setup coordinate [options]
|
|
|
100
100
|
|
|
101
101
|
**Options**
|
|
102
102
|
|
|
103
|
-
| Option | Alias | Description
|
|
104
|
-
| ----------------------------- | ----- |
|
|
105
|
-
| `--name <NAME>` | `-n` | Coordinator name (used in the generated workflow file name and job names)
|
|
106
|
-
| `--action <ACTION>` | - | Composite action to include
|
|
107
|
-
| `--branch <BRANCH>` | - | Branch target: deploy trigger branch (defaults to the detected default branch)
|
|
108
|
-
| `--tag` | - | Generate a tag target coordinator
|
|
109
|
-
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs
|
|
110
|
-
| `--force` | - | Discard hand edits and regenerate
|
|
103
|
+
| Option | Alias | Description | Required | Default |
|
|
104
|
+
| ----------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
|
|
105
|
+
| `--name <NAME>` | `-n` | Coordinator name (used in the generated workflow file name and job names) | Yes | - |
|
|
106
|
+
| `--action <ACTION>` | - | Composite action to include. Repeat for separate deploy steps, or use commas to deploy actions as one multi-config group. tailor- prefix optional. | Yes | - |
|
|
107
|
+
| `--branch <BRANCH>` | - | Branch target: deploy trigger branch (defaults to the detected default branch) | No | - |
|
|
108
|
+
| `--tag` | - | Generate a tag target coordinator | No | `false` |
|
|
109
|
+
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs | No | - |
|
|
110
|
+
| `--force` | - | Discard hand edits and regenerate | No | `false` |
|
|
111
111
|
|
|
112
112
|
See [Global Options](../cli-reference.md#global-options) for options available to all commands.
|
|
113
113
|
|
|
@@ -174,7 +174,7 @@ tailor setup tag [options]
|
|
|
174
174
|
| Option | Alias | Description | Required | Default |
|
|
175
175
|
| ----------------------------- | ----- | ---------------------------------------------------------------------------- | -------- | ------- |
|
|
176
176
|
| `--name <NAME>` | `-n` | Name (defaults to the config 'name') | No | - |
|
|
177
|
-
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v
|
|
177
|
+
| `--tag-pattern <TAG_PATTERN>` | - | Tag glob to match (defaults to v*) | No | `"v*"` |
|
|
178
178
|
| `--branch <BRANCH>` | - | Tag-reachability guard branch (no guard when omitted) | No | - |
|
|
179
179
|
| `--environment <ENVIRONMENT>` | - | GitHub Environment for the plan/deploy jobs (defaults to the workspace name) | No | - |
|
|
180
180
|
| `--dir <DIR>` | `-d` | App directory (for monorepo setups) | No | `"."` |
|
package/docs/cli-reference.md
CHANGED
|
@@ -11,12 +11,13 @@ tailor <command> [options]
|
|
|
11
11
|
## Global Options
|
|
12
12
|
|
|
13
13
|
<a id="global-options"></a>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
|
17
|
-
| `--env-file
|
|
18
|
-
| `--
|
|
19
|
-
| `--
|
|
14
|
+
|
|
15
|
+
| Option | Alias | Description | Required | Default |
|
|
16
|
+
| ------------------------------------------- | ----- | --------------------------------------------------- | -------- | ------- |
|
|
17
|
+
| `--env-file <ENV_FILE>` | `-e` | Path to the environment file (error if not found) | No | - |
|
|
18
|
+
| `--env-file-if-exists <ENV_FILE_IF_EXISTS>` | - | Path to the environment file (ignored if not found) | No | - |
|
|
19
|
+
| `--verbose` | - | Enable verbose logging | No | `false` |
|
|
20
|
+
| `--json` | `-j` | Output as JSON | No | `false` |
|
|
20
21
|
|
|
21
22
|
### JSON Output
|
|
22
23
|
|
package/docs/configuration.md
CHANGED
|
@@ -286,6 +286,30 @@ export default defineConfig({
|
|
|
286
286
|
|
|
287
287
|
**ignores**: Glob patterns to exclude files. Optional.
|
|
288
288
|
|
|
289
|
+
### Workflow Execution Policies
|
|
290
|
+
|
|
291
|
+
Register workspace-scoped execution policies that workflow job functions reference at runtime for per-key concurrency control. See [Execution Policies](./services/workflow.md#execution-policies) in the Workflow guide for the declaration API.
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
import { defineWorkflowExecutionPolicies } from "@tailor-platform/sdk";
|
|
295
|
+
|
|
296
|
+
const executionPolicies = defineWorkflowExecutionPolicies((define) => ({
|
|
297
|
+
premium: define({ concurrencyPolicy: { maxConcurrentExecutions: 5 } }),
|
|
298
|
+
tenantApi: define({
|
|
299
|
+
name: "tenant-api",
|
|
300
|
+
matchType: "prefix",
|
|
301
|
+
concurrencyPolicy: { maxConcurrentExecutions: 3 },
|
|
302
|
+
}),
|
|
303
|
+
}));
|
|
304
|
+
|
|
305
|
+
export default defineConfig({
|
|
306
|
+
workflow: {
|
|
307
|
+
files: ["workflows/**/*.ts"],
|
|
308
|
+
executionPolicies,
|
|
309
|
+
},
|
|
310
|
+
});
|
|
311
|
+
```
|
|
312
|
+
|
|
289
313
|
### Plugins
|
|
290
314
|
|
|
291
315
|
Configure plugins using `definePlugins()`. Plugins must be exported as a named export.
|
package/docs/migration/v2.md
CHANGED
|
@@ -436,6 +436,74 @@ wrapper or global tailor.authconnection.
|
|
|
436
436
|
|
|
437
437
|
</details>
|
|
438
438
|
|
|
439
|
+
## Runtime subpath imports use namespace objects
|
|
440
|
+
|
|
441
|
+
**Migration:** Partially automatic
|
|
442
|
+
|
|
443
|
+
Rewrite `@tailor-platform/sdk/runtime/*` namespace-star and flat value imports to self-named namespace imports, and aggregate `file.deleteFile` calls to `file.delete`. `TailorContextAPI` and `TailorWorkflowAPI` now describe SDK wrappers; direct platform globals use `PlatformContextAPI` and `PlatformWorkflowAPI`.
|
|
444
|
+
|
|
445
|
+
Before:
|
|
446
|
+
|
|
447
|
+
```ts
|
|
448
|
+
import * as iconv from "@tailor-platform/sdk/runtime/iconv";
|
|
449
|
+
iconv.convert(value, "UTF-8", "Shift_JIS");
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
After:
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
import { iconv } from "@tailor-platform/sdk/runtime/iconv";
|
|
456
|
+
iconv.convert(value, "UTF-8", "Shift_JIS");
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Before:
|
|
460
|
+
|
|
461
|
+
```ts
|
|
462
|
+
import { get } from "@tailor-platform/sdk/runtime/aigateway";
|
|
463
|
+
const gateway = await get("main");
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
After:
|
|
467
|
+
|
|
468
|
+
```ts
|
|
469
|
+
import { aigateway } from "@tailor-platform/sdk/runtime/aigateway";
|
|
470
|
+
const gateway = await aigateway.get("main");
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
Before:
|
|
474
|
+
|
|
475
|
+
```ts
|
|
476
|
+
import { file } from "@tailor-platform/sdk/runtime";
|
|
477
|
+
await file.deleteFile("ns", "Doc", "blob", "record-id");
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
After:
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
import { file } from "@tailor-platform/sdk/runtime";
|
|
484
|
+
await file.delete("ns", "Doc", "blob", "record-id");
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
<details>
|
|
488
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
489
|
+
|
|
490
|
+
```text
|
|
491
|
+
In Tailor SDK v2, runtime subpath modules export only a self-named namespace
|
|
492
|
+
object (for example, `iconv` from `@tailor-platform/sdk/runtime/iconv`).
|
|
493
|
+
Default and flat value imports such as
|
|
494
|
+
`import { get } from "@tailor-platform/sdk/runtime/aigateway"` are removed.
|
|
495
|
+
The codemod rewrites straightforward namespace-star imports and flat named value
|
|
496
|
+
imports. It also rewrites direct `file.deleteFile` calls on the aggregate runtime
|
|
497
|
+
namespace to `file.delete`. Destructured aggregate `deleteFile` references require
|
|
498
|
+
manual migration. Review any remaining runtime imports manually, especially when
|
|
499
|
+
a local binding or nested scope shadows an imported value, or when
|
|
500
|
+
type-position namespace member references need explicit top-level type imports.
|
|
501
|
+
For direct platform globals, replace `TailorContextAPI` and `TailorWorkflowAPI`
|
|
502
|
+
type references with `PlatformContextAPI` and `PlatformWorkflowAPI` respectively.
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
</details>
|
|
506
|
+
|
|
439
507
|
## Tailordb → tailordb (lowercase ambient namespace)
|
|
440
508
|
|
|
441
509
|
**Migration:** Partially automatic
|
|
@@ -471,6 +539,97 @@ declarations automatically on SDK import.
|
|
|
471
539
|
|
|
472
540
|
</details>
|
|
473
541
|
|
|
542
|
+
## db.type() → db.table()
|
|
543
|
+
|
|
544
|
+
**Migration:** Partially automatic
|
|
545
|
+
|
|
546
|
+
Rename TailorDB schema builder calls from `db.type()` to `db.table()`. TailorDB schema definitions now use table terminology in SDK projects.
|
|
547
|
+
|
|
548
|
+
Before:
|
|
549
|
+
|
|
550
|
+
```ts
|
|
551
|
+
import { db } from "@tailor-platform/sdk";
|
|
552
|
+
|
|
553
|
+
export const user = db.type("User", {
|
|
554
|
+
name: db.string(),
|
|
555
|
+
});
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
After:
|
|
559
|
+
|
|
560
|
+
```ts
|
|
561
|
+
import { db } from "@tailor-platform/sdk";
|
|
562
|
+
|
|
563
|
+
export const user = db.table("User", {
|
|
564
|
+
name: db.string(),
|
|
565
|
+
});
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
<details>
|
|
569
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
570
|
+
|
|
571
|
+
```text
|
|
572
|
+
In Tailor SDK v2, TailorDB schema definitions use db.table(...) instead of
|
|
573
|
+
db.type(...). The codemod rewrites member accesses on db imported from
|
|
574
|
+
@tailor-platform/sdk, including aliases such as `import { db as schema }`.
|
|
575
|
+
It flags destructured builder aliases such as `const { type } = db` and
|
|
576
|
+
local builder aliases such as `const schema = db`, `schema = db`, or
|
|
577
|
+
`function make(schema = db) { ... }` for manual review because the local
|
|
578
|
+
alias may require call-site renaming.
|
|
579
|
+
Review any remaining db.type references and rename SDK TailorDB schema builder
|
|
580
|
+
calls to db.table. Leave unrelated local objects with a .type() method unchanged.
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
</details>
|
|
584
|
+
|
|
585
|
+
## TailorDB forward relation names derive from field names
|
|
586
|
+
|
|
587
|
+
**Migration:** Partially automatic
|
|
588
|
+
|
|
589
|
+
Review TailorDB relations that omit `toward.as`. Their forward GraphQL field names now derive from the relation field name with a trailing `ID`, `Id`, or `id` removed, instead of from the target table name.
|
|
590
|
+
|
|
591
|
+
Preserve the v1 GraphQL field name by making it explicit:
|
|
592
|
+
|
|
593
|
+
Before:
|
|
594
|
+
|
|
595
|
+
```ts
|
|
596
|
+
ownerId: db.uuid().relation({
|
|
597
|
+
type: "n-1",
|
|
598
|
+
toward: { type: user },
|
|
599
|
+
}),
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
After:
|
|
603
|
+
|
|
604
|
+
```ts
|
|
605
|
+
ownerId: db.uuid().relation({
|
|
606
|
+
type: "n-1",
|
|
607
|
+
toward: { type: user, as: "user" },
|
|
608
|
+
}),
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
<details>
|
|
612
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
613
|
+
|
|
614
|
+
```text
|
|
615
|
+
Tailor SDK v2 derives a default forward GraphQL relation name from the source
|
|
616
|
+
field name by removing a trailing ID, Id, or id. V1 derived it from the target
|
|
617
|
+
table name. Review each reported non-self relation that omits toward.as.
|
|
618
|
+
|
|
619
|
+
If consumers must keep using the v1 GraphQL field name, inspect the v1 schema and
|
|
620
|
+
copy that exact field name into toward.as. Otherwise, update GraphQL operations
|
|
621
|
+
and consumer code to use the new field-based name. No change is needed when the old
|
|
622
|
+
and new names are identical. Relations with a guaranteed non-empty toward.as,
|
|
623
|
+
self-relations, and keyOnly relations are unchanged. For an empty or dynamic
|
|
624
|
+
toward.as, determine whether its runtime value can be falsy; if so, treat the
|
|
625
|
+
relation as using the default name.
|
|
626
|
+
|
|
627
|
+
A relation field without a trailing ID, Id, or id would default to its own scalar
|
|
628
|
+
field name and therefore conflict. Give that relation an explicit toward.as.
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
</details>
|
|
632
|
+
|
|
474
633
|
## executeScript arg JSON.stringify → value
|
|
475
634
|
|
|
476
635
|
**Migration:** Partially automatic
|
|
@@ -714,6 +873,164 @@ After:
|
|
|
714
873
|
.tailor/
|
|
715
874
|
```
|
|
716
875
|
|
|
876
|
+
## ValidateFn simplification and type-level validate
|
|
877
|
+
|
|
878
|
+
**Migration:** Manual
|
|
879
|
+
|
|
880
|
+
Field-level `ValidateFn` is simplified from `(args: { value, data, invoker }) => boolean` to `(args: { value }) => string | void` — the function now returns the error message directly instead of a separate `[fn, message]` tuple. The `ValidateConfig` tuple form and `Validators<F>` record syntax on `db.type().validate()` are removed. Type-level validation uses `db.type().validate((args, issues) => void)` with `{ newRecord, oldRecord, invoker }` args and an `issues(field, message)` callback for cross-field rules.
|
|
881
|
+
|
|
882
|
+
Field-level validate: return an error message string instead of a boolean (tuple form removed):
|
|
883
|
+
|
|
884
|
+
Before:
|
|
885
|
+
|
|
886
|
+
```ts
|
|
887
|
+
.validate(
|
|
888
|
+
[({ value }) => value.length > 5, "Name must be longer than 5 characters"],
|
|
889
|
+
)
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
After:
|
|
893
|
+
|
|
894
|
+
```ts
|
|
895
|
+
.validate(({ value }) =>
|
|
896
|
+
value.length <= 5 ? "Name must be longer than 5 characters" : undefined,
|
|
897
|
+
)
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
Type-level validate: per-field record syntax replaced by a single function with `issues()` callback:
|
|
901
|
+
|
|
902
|
+
Before:
|
|
903
|
+
|
|
904
|
+
```ts
|
|
905
|
+
.validate({
|
|
906
|
+
name: [({ value }) => value.length > 5, "Name must be longer than 5"],
|
|
907
|
+
})
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
After:
|
|
911
|
+
|
|
912
|
+
```ts
|
|
913
|
+
.validate(({ newRecord }, issues) => {
|
|
914
|
+
if (newRecord.name && newRecord.name.length <= 5) {
|
|
915
|
+
issues("name", "Name must be longer than 5");
|
|
916
|
+
}
|
|
917
|
+
})
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
<details>
|
|
921
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
922
|
+
|
|
923
|
+
```text
|
|
924
|
+
The v2 SDK simplifies field validation and introduces type-level validation.
|
|
925
|
+
|
|
926
|
+
Field-level `.validate()` changes:
|
|
927
|
+
- Signature: `(args: { value, data, invoker }) => boolean` → `(args: { value }) => string | void`
|
|
928
|
+
- The function now returns the error message string directly (or undefined/void to pass)
|
|
929
|
+
instead of returning a boolean with the message in a separate tuple.
|
|
930
|
+
- The `[fn, errorMessage]` tuple form (`ValidateConfig`) is removed.
|
|
931
|
+
- `data` and `invoker` are no longer available in field-level validators.
|
|
932
|
+
Use type-level `.validate()` for cross-field or invoker-dependent rules.
|
|
933
|
+
|
|
934
|
+
Type-level `.validate()` on `db.type()` changes:
|
|
935
|
+
- Old: `.validate({ fieldName: fn | [fn, msg] | fn[] })` (per-field record, `Validators<F>` type)
|
|
936
|
+
- New: `.validate((args, issues) => void)` (single function, `TypeValidateFn<F>` type)
|
|
937
|
+
- Args: `{ newRecord, oldRecord, invoker }` — `newRecord` is the record after hooks run
|
|
938
|
+
- Call `issues(field, message)` to report validation errors; `field` supports dotted paths
|
|
939
|
+
- Move per-field validators that need `data`/`invoker` to the type-level function
|
|
940
|
+
|
|
941
|
+
For each remaining `ValidateConfig`, `Validators<`, or old-signature `.validate()` usage:
|
|
942
|
+
1. Rewrite field-level validators to return the error string directly
|
|
943
|
+
2. Move cross-field / invoker-dependent validators to the type-level function
|
|
944
|
+
3. Remove unused `ValidateConfig` / `Validators` type imports
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
</details>
|
|
948
|
+
|
|
949
|
+
## TailorDB hook redesign: field-level args and type-level hooks
|
|
950
|
+
|
|
951
|
+
**Migration:** Manual
|
|
952
|
+
|
|
953
|
+
Field-level `HookFn` args change from `{ value, data, invoker }` to create `{ input, invoker, now }` / update `{ input, oldValue, invoker, now }` — `value` is renamed to `input`, matching the `input` arg on type-level hooks (same pre-hook data, narrowed to one field); `data` (the full record) is removed; `oldValue` (previous field value) is added for update hooks only; `now` (operation timestamp) is shared across all hooks. Type-level hooks on `db.type().hooks()` change from per-field mapping `{ fieldName: { create, update } }` (`Hooks<F>`) to a single `{ create, update }` object (`TypeHook<F>`) — create hooks take `{ input, invoker, now }`, update hooks take `{ input, oldRecord, invoker, now }` (oldRecord is always non-null). Both return partial field overrides.
|
|
954
|
+
|
|
955
|
+
Field-level hooks: `value` renamed to `input`, `data` replaced by `oldValue` and `now`; use `now` instead of `new Date()`:
|
|
956
|
+
|
|
957
|
+
Before:
|
|
958
|
+
|
|
959
|
+
```ts
|
|
960
|
+
db.datetime().hooks({
|
|
961
|
+
create: ({ value }) => value ?? new Date(),
|
|
962
|
+
update: () => new Date(),
|
|
963
|
+
})
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
After:
|
|
967
|
+
|
|
968
|
+
```ts
|
|
969
|
+
db.datetime().hooks({
|
|
970
|
+
create: ({ input, now }) => input ?? now,
|
|
971
|
+
update: ({ now }) => now,
|
|
972
|
+
})
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
Type-level hooks: per-field mapping replaced by single create/update functions:
|
|
976
|
+
|
|
977
|
+
Before:
|
|
978
|
+
|
|
979
|
+
```ts
|
|
980
|
+
.hooks({
|
|
981
|
+
fullAddress: {
|
|
982
|
+
create: ({ data }) => `${data.postalCode} ${data.address}`,
|
|
983
|
+
update: ({ data }) => `${data.postalCode} ${data.address}`,
|
|
984
|
+
},
|
|
985
|
+
})
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
After:
|
|
989
|
+
|
|
990
|
+
```ts
|
|
991
|
+
.hooks({
|
|
992
|
+
create: ({ input }) => ({
|
|
993
|
+
fullAddress: `${input.postalCode} ${input.address}`,
|
|
994
|
+
}),
|
|
995
|
+
update: ({ input }) => ({
|
|
996
|
+
fullAddress: `${input.postalCode} ${input.address}`,
|
|
997
|
+
}),
|
|
998
|
+
})
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
<details>
|
|
1002
|
+
<summary>Prompt for an AI agent (to perform this migration)</summary>
|
|
1003
|
+
|
|
1004
|
+
```text
|
|
1005
|
+
The v2 SDK redesigns TailorDB hooks at both field and type levels.
|
|
1006
|
+
|
|
1007
|
+
Field-level `.hooks()` on individual fields:
|
|
1008
|
+
- Create args: `{ value, data, invoker }` → `{ input, invoker, now }` (no `oldValue`)
|
|
1009
|
+
- Update args: `{ value, data, invoker }` → `{ input, oldValue, invoker, now }`
|
|
1010
|
+
- `value` is renamed to `input`, matching the type-level hook's `input` arg — both are
|
|
1011
|
+
the same pre-hook data, at different granularity
|
|
1012
|
+
- `data` (full record) is removed; update hooks get `oldValue` (previous field value) instead
|
|
1013
|
+
- `now` provides the operation timestamp — use `now` instead of `new Date()`
|
|
1014
|
+
- If a field-level hook needs the full record (other fields), move it to a type-level hook
|
|
1015
|
+
|
|
1016
|
+
Type-level `.hooks()` on `db.type()`:
|
|
1017
|
+
- Old: `.hooks({ fieldName: { create: fn, update: fn } })` (per-field mapping, `Hooks<F>` type)
|
|
1018
|
+
- New: `.hooks({ create: fn, update: fn })` (single object, `TypeHook<F>` type)
|
|
1019
|
+
- Each function: `({ input, oldRecord, invoker, now }) => ({ fieldName: value, ... })`
|
|
1020
|
+
- `input` is the pre-hook input (may have nullish values for optional/defaulted fields)
|
|
1021
|
+
- Create hooks do not receive `oldRecord`; update hooks receive `oldRecord` (always non-null)
|
|
1022
|
+
- Return an object with only the fields to override; unmentioned fields are unchanged
|
|
1023
|
+
|
|
1024
|
+
Migration steps for each `.hooks()` call on a `db.type()`:
|
|
1025
|
+
1. If the old per-field hooks only use `value`/`invoker` and don't reference `data`,
|
|
1026
|
+
convert them to field-level hooks with the new args (`value` → `input`, plus `oldValue`, `now`)
|
|
1027
|
+
2. If the old hooks reference `data` (cross-field access), convert to a type-level hook
|
|
1028
|
+
using `input`/`oldRecord`
|
|
1029
|
+
3. Remove unused `Hooks<F>` / `HookFn<>` type imports
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
</details>
|
|
1033
|
+
|
|
717
1034
|
## Behavioral changes (no migration required)
|
|
718
1035
|
|
|
719
1036
|
These v2 changes alter runtime or CLI behavior; no source change is needed.
|
package/docs/plugin/custom.md
CHANGED
|
@@ -93,7 +93,7 @@ interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
|
|
|
93
93
|
onTypeLoaded(context) {
|
|
94
94
|
const { type, typeConfig, namespace } = context;
|
|
95
95
|
return {
|
|
96
|
-
types: { archive: db.
|
|
96
|
+
types: { archive: db.table(`Deleted_${type.name}`, { ... }) },
|
|
97
97
|
extends: { fields: { deletedAt: db.datetime({ optional: true }) } },
|
|
98
98
|
executors: [{ name: `${type.name}-on-delete`, resolve: async () => await import("./on-delete"), context: { sourceType: type, namespace } }],
|
|
99
99
|
};
|
|
@@ -122,7 +122,7 @@ Same as `TypePluginOutput` but without `extends` (namespace plugins cannot exten
|
|
|
122
122
|
```typescript
|
|
123
123
|
onNamespaceLoaded(context) {
|
|
124
124
|
return {
|
|
125
|
-
types: { auditLog: db.
|
|
125
|
+
types: { auditLog: db.table("AuditLog", { action: db.string(), ... }) },
|
|
126
126
|
};
|
|
127
127
|
},
|
|
128
128
|
```
|
|
@@ -343,7 +343,7 @@ function processSoftDelete(
|
|
|
343
343
|
|
|
344
344
|
// Generate archive type
|
|
345
345
|
const archiveType = db
|
|
346
|
-
.
|
|
346
|
+
.table(`${prefix}${type.name}`, {
|
|
347
347
|
originalId: db.uuid().description("ID of the deleted record"),
|
|
348
348
|
originalData: db.string().description("JSON snapshot of deleted record"),
|
|
349
349
|
deletedAt: db.datetime().description("When the record was deleted"),
|
|
@@ -450,7 +450,7 @@ export const plugins = definePlugins(
|
|
|
450
450
|
|
|
451
451
|
// tailordb/customer.ts
|
|
452
452
|
export const customer = db
|
|
453
|
-
.
|
|
453
|
+
.table("Customer", {
|
|
454
454
|
name: db.string(),
|
|
455
455
|
email: db.string(),
|
|
456
456
|
})
|
package/docs/plugin/index.md
CHANGED
|
@@ -43,7 +43,7 @@ Use the `.plugin()` method to attach plugins to specific types:
|
|
|
43
43
|
import { db } from "@tailor-platform/sdk";
|
|
44
44
|
|
|
45
45
|
export const user = db
|
|
46
|
-
.
|
|
46
|
+
.table("User", {
|
|
47
47
|
name: db.string(),
|
|
48
48
|
email: db.string(),
|
|
49
49
|
})
|
|
@@ -58,7 +58,7 @@ Some plugins accept per-type configuration:
|
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
export const customer = db
|
|
61
|
-
.
|
|
61
|
+
.table("Customer", {
|
|
62
62
|
name: db.string(),
|
|
63
63
|
// ...
|
|
64
64
|
})
|
package/docs/runtime.md
CHANGED
|
@@ -45,10 +45,12 @@ const { url } = await aigateway.get("my-aigateway");
|
|
|
45
45
|
Each namespace can also be imported individually so you only pull what you need:
|
|
46
46
|
|
|
47
47
|
```ts
|
|
48
|
-
import
|
|
49
|
-
import type
|
|
48
|
+
import { iconv } from "@tailor-platform/sdk/runtime/iconv";
|
|
49
|
+
import { idp, type ListUsersResponse, type ClientConfig } from "@tailor-platform/sdk/runtime/idp";
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
`TailorContextAPI` and `TailorWorkflowAPI` describe the imported SDK wrapper objects. When typing direct access to the platform-provided globals or a runtime mock, use `PlatformContextAPI` or `PlatformWorkflowAPI` instead.
|
|
53
|
+
|
|
52
54
|
## Activating the global types
|
|
53
55
|
|
|
54
56
|
Most users do not need to touch the globals entry — `@tailor-platform/sdk/runtime` (and its subpath modules) cover the same surface without depending on any ambient declaration.
|
|
@@ -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.
|
package/docs/services/auth.md
CHANGED
|
@@ -86,7 +86,7 @@ Example TailorDB type for user profile:
|
|
|
86
86
|
// tailordb/user.ts
|
|
87
87
|
import { db } from "@tailor-platform/sdk";
|
|
88
88
|
|
|
89
|
-
export const user = db.
|
|
89
|
+
export const user = db.table("User", {
|
|
90
90
|
email: db.string().unique(), // usernameField must have unique constraint
|
|
91
91
|
role: db.enum(["admin", "user"]),
|
|
92
92
|
...db.fields.timestamps(),
|
|
@@ -130,7 +130,7 @@ Example TailorDB type with UUID fields for attribute list:
|
|
|
130
130
|
// tailordb/user.ts
|
|
131
131
|
import { db } from "@tailor-platform/sdk";
|
|
132
132
|
|
|
133
|
-
export const user = db.
|
|
133
|
+
export const user = db.table("User", {
|
|
134
134
|
email: db.string().unique(),
|
|
135
135
|
role: db.enum(["admin", "user"]),
|
|
136
136
|
organizationId: db.uuid(), // Can be used in attributeList
|
|
@@ -108,7 +108,7 @@ Define input/output schemas using methods of `t` object. Basic usage and support
|
|
|
108
108
|
You can reuse fields defined with `db` object, but note that unsupported options will be ignored:
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
|
-
const user = db.
|
|
111
|
+
const user = db.table("User", {
|
|
112
112
|
name: db.string().unique(),
|
|
113
113
|
age: db.int(),
|
|
114
114
|
});
|