@tailor-platform/sdk 1.71.0 → 1.73.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 +46 -0
- package/dist/aigateway-B3oZZE6v.mjs +15 -0
- package/dist/aigateway-B3oZZE6v.mjs.map +1 -0
- package/dist/application-BhRnH42h.mjs +3 -0
- package/dist/{application-DmjIKQ-a.mjs → application-Dxhdq_nu.mjs} +21 -19
- package/dist/application-Dxhdq_nu.mjs.map +1 -0
- package/dist/{assert-CKfwrmCV.mjs → assert-DBxo8jPo.mjs} +1 -2
- package/dist/{assert-CKfwrmCV.mjs.map → assert-DBxo8jPo.mjs.map} +1 -1
- package/dist/{authconnection-D7lsvsKY.mjs → authconnection-BGQM8FZI.mjs} +2 -3
- package/dist/{authconnection-D7lsvsKY.mjs.map → authconnection-BGQM8FZI.mjs.map} +1 -1
- package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
- package/dist/{brand-DlnJ375c.mjs.map → brand-Eo4pLXPJ.mjs.map} +1 -1
- package/dist/cli/cache/bundle-cache.d.mts +1 -0
- package/dist/cli/cache/store.d.mts +1 -0
- package/dist/cli/cache/types.d.mts +1 -0
- package/dist/cli/commands/api/api-call.d.mts +19 -0
- package/dist/cli/commands/api/index.d.mts +3 -0
- package/dist/cli/commands/deploy/aigateway.d.mts +1 -0
- package/dist/cli/commands/deploy/application.d.mts +1 -0
- package/dist/cli/commands/deploy/auth.d.mts +1 -0
- package/dist/cli/commands/deploy/deploy.d.mts +24 -0
- package/dist/cli/commands/deploy/executor.d.mts +1 -0
- package/dist/cli/commands/deploy/function-registry-types.d.mts +12 -0
- package/dist/cli/commands/deploy/function-registry.d.mts +2 -0
- package/dist/cli/commands/deploy/idp.d.mts +1 -0
- package/dist/cli/commands/deploy/resolver.d.mts +1 -0
- package/dist/cli/commands/deploy/secret-manager.d.mts +1 -0
- package/dist/cli/commands/deploy/staticwebsite.d.mts +1 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +1 -0
- package/dist/cli/commands/deploy/types.d.mts +1 -0
- package/dist/cli/commands/deploy/workflow.d.mts +1 -0
- package/dist/cli/commands/executor/get.d.mts +29 -0
- package/dist/cli/commands/executor/jobs.d.mts +123 -0
- package/dist/cli/commands/executor/list.d.mts +19 -0
- package/dist/cli/commands/executor/transform.d.mts +41 -0
- package/dist/cli/commands/executor/trigger.d.mts +41 -0
- package/dist/cli/commands/executor/webhook.d.mts +22 -0
- package/dist/cli/commands/function/get.d.mts +18 -0
- package/dist/cli/commands/function/list.d.mts +22 -0
- package/dist/cli/commands/function/transform.d.mts +11 -0
- package/dist/cli/commands/generate/options.d.mts +7 -0
- package/dist/cli/commands/generate/seed/bundler.d.mts +26 -0
- package/dist/cli/commands/generate/service.d.mts +12 -0
- package/dist/cli/commands/generate/types.d.mts +126 -0
- package/dist/cli/commands/machineuser/list.d.mts +27 -0
- package/dist/cli/commands/machineuser/token.d.mts +22 -0
- package/dist/cli/commands/oauth2client/get.d.mts +18 -0
- package/dist/cli/commands/oauth2client/list.d.mts +20 -0
- package/dist/cli/commands/oauth2client/transform.d.mts +20 -0
- package/dist/cli/commands/organization/folder/create.d.mts +18 -0
- package/dist/cli/commands/organization/folder/delete.d.mts +16 -0
- package/dist/cli/commands/organization/folder/get.d.mts +17 -0
- package/dist/cli/commands/organization/folder/list.d.mts +22 -0
- package/dist/cli/commands/organization/folder/update.d.mts +18 -0
- package/dist/cli/commands/organization/get.d.mts +16 -0
- package/dist/cli/commands/organization/list.d.mts +15 -0
- package/dist/cli/commands/organization/transform.d.mts +27 -0
- package/dist/cli/commands/organization/tree.d.mts +25 -0
- package/dist/cli/commands/organization/update.d.mts +17 -0
- package/dist/cli/commands/remove.d.mts +16 -0
- package/dist/cli/commands/show.d.mts +34 -0
- package/dist/cli/commands/tailordb/migrate/bundler.d.mts +28 -0
- package/dist/cli/commands/tailordb/migrate/config.d.mts +19 -0
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +211 -0
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +17 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +202 -0
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +113 -0
- package/dist/cli/commands/tailordb/migrate/types.d.mts +7 -0
- package/dist/cli/commands/tailordb/truncate.d.mts +19 -0
- package/dist/cli/commands/workflow/executions.d.mts +75 -0
- package/dist/cli/commands/workflow/get.d.mts +29 -0
- package/dist/cli/commands/workflow/list.d.mts +19 -0
- package/dist/cli/commands/workflow/resume.d.mts +23 -0
- package/dist/cli/commands/workflow/start.d.mts +63 -0
- package/dist/cli/commands/workflow/status.d.mts +5 -0
- package/dist/cli/commands/workflow/transform.d.mts +33 -0
- package/dist/cli/commands/workflow/wait.d.mts +16 -0
- package/dist/cli/commands/workflow/waiter.d.mts +23 -0
- package/dist/cli/commands/workspace/app/health.d.mts +18 -0
- package/dist/cli/commands/workspace/app/list.d.mts +22 -0
- package/dist/cli/commands/workspace/app/transform.d.mts +18 -0
- package/dist/cli/commands/workspace/create.d.mts +25 -0
- package/dist/cli/commands/workspace/delete.d.mts +15 -0
- package/dist/cli/commands/workspace/get.d.mts +17 -0
- package/dist/cli/commands/workspace/list.d.mts +17 -0
- package/dist/cli/commands/workspace/restore.d.mts +15 -0
- package/dist/cli/commands/workspace/transform.d.mts +16 -0
- package/dist/cli/commands/workspace/user/invite.d.mts +22 -0
- package/dist/cli/commands/workspace/user/list.d.mts +22 -0
- package/dist/cli/commands/workspace/user/remove.d.mts +17 -0
- package/dist/cli/commands/workspace/user/transform.d.mts +8 -0
- package/dist/cli/commands/workspace/user/update.d.mts +22 -0
- package/dist/cli/index.d.mts +1 -2
- package/dist/cli/index.mjs +801 -206
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +80 -21402
- package/dist/cli/lib.mjs +8 -9
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/query/index.d.mts +35 -0
- package/dist/cli/services/application.d.mts +1 -0
- package/dist/cli/services/auth/service.d.mts +1 -0
- package/dist/cli/services/executor/service.d.mts +1 -0
- package/dist/cli/services/http-adapter/bundler.d.mts +1 -0
- package/dist/cli/services/http-adapter/service.d.mts +1 -0
- package/dist/cli/services/resolver/service.d.mts +1 -0
- package/dist/cli/services/tailordb/service.d.mts +1 -0
- package/dist/cli/services/workflow/bundler.d.mts +1 -0
- package/dist/cli/services/workflow/service.d.mts +1 -0
- package/dist/cli/shared/args.d.mts +13 -0
- package/dist/cli/shared/client.d.mts +1273 -0
- package/dist/cli/shared/config-loader.d.mts +44 -0
- package/dist/cli/shared/context.d.mts +28 -0
- package/dist/cli/shared/script-executor.d.mts +74 -0
- package/dist/cli/shared/seed-chunker.d.mts +46 -0
- package/dist/cli/shared/trigger-context.d.mts +1 -0
- package/dist/cli/shared/type-generator.d.mts +20 -0
- package/dist/cli/skills.mjs +1 -2
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/completion/zsh-worker.zsh +124 -25
- package/dist/configure/config/index.d.mts +29 -0
- package/dist/configure/config/types.d.mts +103 -0
- package/dist/configure/index.d.mts +125 -7
- package/dist/configure/index.mjs +5 -6
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/aigateway/index.d.mts +17 -0
- package/dist/configure/services/aigateway/types.d.mts +11 -0
- package/dist/configure/services/auth/index.d.mts +43 -0
- package/dist/{types-v_ErzNUF.d.mts → configure/services/auth/types.d.mts} +7 -172
- package/dist/configure/services/executor/executor.d.mts +82 -0
- package/dist/configure/services/executor/index.d.mts +8 -0
- package/dist/configure/services/executor/operation.d.mts +46 -0
- package/dist/configure/services/executor/trigger/event.d.mts +272 -0
- package/dist/configure/services/executor/trigger/index.d.mts +8 -0
- package/dist/configure/services/executor/trigger/schedule.d.mts +25 -0
- package/dist/configure/services/executor/trigger/webhook.d.mts +44 -0
- package/dist/configure/services/executor/types.d.mts +2 -0
- package/dist/configure/services/http-adapter/http-adapter.d.mts +125 -0
- package/dist/configure/services/http-adapter/index.d.mts +2 -0
- package/dist/configure/services/idp/index.d.mts +64 -0
- package/dist/configure/services/idp/permission.d.mts +80 -0
- package/dist/configure/services/idp/types.d.mts +20 -0
- package/dist/configure/services/index.d.mts +33 -0
- package/dist/configure/services/resolver/index.d.mts +5 -0
- package/dist/configure/services/resolver/resolver.d.mts +77 -0
- package/dist/configure/services/resolver/types.d.mts +6 -0
- package/dist/configure/services/secrets/index.d.mts +38 -0
- package/dist/configure/services/secrets/types.d.mts +11 -0
- package/dist/configure/services/staticwebsite/index.d.mts +19 -0
- package/dist/configure/services/staticwebsite/types.d.mts +11 -0
- package/dist/configure/services/tailordb/index.d.mts +4 -0
- package/dist/configure/services/tailordb/permission.d.mts +119 -0
- package/dist/configure/services/tailordb/schema.d.mts +451 -0
- package/dist/configure/services/tailordb/types.d.mts +149 -0
- package/dist/configure/services/workflow/index.d.mts +7 -0
- package/dist/configure/services/workflow/job.d.mts +81 -0
- package/dist/configure/services/workflow/test-env-key.d.mts +9 -0
- package/dist/configure/services/workflow/types.d.mts +2 -0
- package/dist/configure/services/workflow/wait-point.d.mts +73 -0
- package/dist/configure/services/workflow/workflow.d.mts +55 -0
- package/dist/configure/types/aigateway-name.d.mts +12 -0
- package/dist/configure/types/connection-name.d.mts +12 -0
- package/dist/configure/types/field.d.mts +9 -0
- package/dist/configure/types/field.types.d.mts +109 -0
- package/dist/configure/types/idp-name.d.mts +12 -0
- package/dist/configure/types/index.d.mts +4 -0
- package/dist/configure/types/machine-user.d.mts +12 -0
- package/dist/configure/types/type.d.mts +99 -0
- package/dist/configure/user.d.mts +7 -0
- package/dist/{context-CDQqIv4u.mjs → context-Bd266-ru.mjs} +2 -3
- package/dist/{context-CDQqIv4u.mjs.map → context-Bd266-ru.mjs.map} +1 -1
- package/dist/{crashreport-BwF8cHF0.mjs → crashreport-Dy4ZzSkd.mjs} +1 -2
- package/dist/{crashreport-BqyvFk-_.mjs → crashreport-ayWANEZ6.mjs} +4 -5
- package/dist/{crashreport-BqyvFk-_.mjs.map → crashreport-ayWANEZ6.mjs.map} +1 -1
- package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
- package/dist/{enum-constants-C7DaWeQo.mjs.map → enum-constants-j9QBF0cB.mjs.map} +1 -1
- package/dist/{errors-EsY4XO6O.mjs → errors-Dtf2WPaW.mjs} +1 -2
- package/dist/{errors-EsY4XO6O.mjs.map → errors-Dtf2WPaW.mjs.map} +1 -1
- package/dist/{field-C4zdJLW5.mjs → field-DOsJCPFa.mjs} +1 -2
- package/dist/{field-C4zdJLW5.mjs.map → field-DOsJCPFa.mjs.map} +1 -1
- package/dist/{file-BkxupbYP.mjs → file-_oUZo76X.mjs} +2 -3
- package/dist/{file-BkxupbYP.mjs.map → file-_oUZo76X.mjs.map} +1 -1
- package/dist/{file-utils-BHPxPXmn.mjs → file-utils-DcyIPFQh.mjs} +2 -3
- package/dist/{file-utils-BHPxPXmn.mjs.map → file-utils-DcyIPFQh.mjs.map} +1 -1
- package/dist/{globals-ByrCoDip.mjs → globals-B8XX5TRB.mjs} +3 -3
- package/dist/globals-B8XX5TRB.mjs.map +1 -0
- package/dist/{iconv-D1zmPjvi.mjs → iconv-D2vi8G36.mjs} +2 -3
- package/dist/{iconv-D1zmPjvi.mjs.map → iconv-D2vi8G36.mjs.map} +1 -1
- package/dist/{idp-ynUfzwpz.mjs → idp-Bx25ZBdN.mjs} +2 -3
- package/dist/{idp-ynUfzwpz.mjs.map → idp-Bx25ZBdN.mjs.map} +1 -1
- package/dist/{interceptor-DOqRkCya.mjs → interceptor-D-q1rvRl.mjs} +1 -2
- package/dist/{interceptor-DOqRkCya.mjs.map → interceptor-D-q1rvRl.mjs.map} +1 -1
- package/dist/{job-BpsFXPbi.mjs → job-CtU73PGa.mjs} +3 -4
- package/dist/{job-BpsFXPbi.mjs.map → job-CtU73PGa.mjs.map} +1 -1
- package/dist/kysely/index.d.mts +2 -3
- package/dist/kysely/index.mjs +0 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-CSoZxVKN.mjs → kysely-type-D-zflMGf.mjs} +2 -3
- package/dist/{kysely-type-CSoZxVKN.mjs.map → kysely-type-D-zflMGf.mjs.map} +1 -1
- package/dist/{logger-DKF-JsAK.mjs → logger-BEiZZ3qT.mjs} +1 -2
- package/dist/{logger-DKF-JsAK.mjs.map → logger-BEiZZ3qT.mjs.map} +1 -1
- package/dist/{mock-wf5qeZLi.mjs → mock-Ce1GCi4-.mjs} +60 -5
- package/dist/mock-Ce1GCi4-.mjs.map +1 -0
- package/dist/{multiline-Cf9ODpr1.mjs → multiline-sfHpTZZK.mjs} +1 -2
- package/dist/{multiline-Cf9ODpr1.mjs.map → multiline-sfHpTZZK.mjs.map} +1 -1
- package/dist/{package-json-DcQApfPQ.mjs → package-json-8b0O9TlX.mjs} +1 -2
- package/dist/{package-json-DcQApfPQ.mjs.map → package-json-8b0O9TlX.mjs.map} +1 -1
- package/dist/package-json-Cv2Z-TqQ.mjs +3 -0
- package/dist/parser/generator-config/schema.d.mts +1 -0
- package/dist/parser/service/auth/index.d.mts +1 -0
- package/dist/parser/service/auth/schema.d.mts +1 -0
- package/dist/parser/service/http-adapter/index.d.mts +1 -0
- package/dist/parser/service/http-adapter/schema.d.mts +1 -0
- package/dist/parser/service/idp/types.d.mts +4 -0
- package/dist/parser/service/tailordb/types.d.mts +126 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +16 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +16 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +16 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
- package/dist/plugin/builtin/seed/index.d.mts +45 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -2
- package/dist/plugin/get-generated-type.d.mts +17 -0
- package/dist/plugin/index.d.mts +3 -118
- package/dist/plugin/index.mjs +0 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/manager.d.mts +1 -0
- package/dist/plugin/types.d.mts +245 -0
- package/dist/plugin/with-context.d.mts +102 -0
- package/dist/{registry-D0uB0OrK.mjs → registry-BozuxbPp.mjs} +1 -2
- package/dist/{registry-D0uB0OrK.mjs.map → registry-BozuxbPp.mjs.map} +1 -1
- package/dist/{repl-editor-DD5YP5mt.mjs → repl-editor-BmQOyZJd.mjs} +2 -3
- package/dist/{repl-editor-DD5YP5mt.mjs.map → repl-editor-BmQOyZJd.mjs.map} +1 -1
- package/dist/{rolldown-runtime-BkoGK1jX.mjs → rolldown-runtime-DXywRVcq.mjs} +0 -1
- package/dist/runtime/aigateway.d.mts +35 -0
- package/dist/runtime/aigateway.mjs +3 -0
- package/dist/runtime/authconnection.d.mts +31 -2
- package/dist/runtime/authconnection.mjs +1 -2
- package/dist/runtime/context.d.mts +67 -2
- package/dist/runtime/context.mjs +1 -2
- package/dist/runtime/file.d.mts +249 -2
- package/dist/runtime/file.mjs +1 -2
- package/dist/runtime/globals.d.mts +31 -20
- package/dist/runtime/globals.mjs +0 -1
- package/dist/runtime/iconv.d.mts +121 -2
- package/dist/runtime/iconv.mjs +1 -2
- package/dist/runtime/idp.d.mts +186 -2
- package/dist/runtime/idp.mjs +1 -2
- package/dist/runtime/index.d.mts +47 -9
- package/dist/runtime/index.mjs +9 -9
- package/dist/runtime/secretmanager.d.mts +54 -2
- package/dist/runtime/secretmanager.mjs +1 -2
- package/dist/{types-DTcZ2Yax.d.mts → runtime/types.d.mts} +1 -2
- package/dist/runtime/workflow.d.mts +107 -2
- package/dist/runtime/workflow.mjs +2 -3
- package/dist/{runtime-Cd375HD-.mjs → runtime-CEFC05qX.mjs} +81 -130
- package/dist/runtime-CEFC05qX.mjs.map +1 -0
- package/dist/{schema-C4fkpWV_.mjs → schema-DAdZSFOd.mjs} +3 -4
- package/dist/{schema-C4fkpWV_.mjs.map → schema-DAdZSFOd.mjs.map} +1 -1
- package/dist/{secret-file-eB3R3Fil.mjs → secret-file-VSVGy1V0.mjs} +2 -3
- package/dist/{secret-file-eB3R3Fil.mjs.map → secret-file-VSVGy1V0.mjs.map} +1 -1
- package/dist/{secretmanager-h3tBJV8f.mjs → secretmanager-BVxw3ih_.mjs} +2 -3
- package/dist/{secretmanager-h3tBJV8f.mjs.map → secretmanager-BVxw3ih_.mjs.map} +1 -1
- package/dist/seed/index.d.mts +1 -2
- package/dist/seed/index.mjs +0 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/{seed-YAbtMy65.mjs → seed-DoMTMLcm.mjs} +3 -4
- package/dist/{seed-YAbtMy65.mjs.map → seed-DoMTMLcm.mjs.map} +1 -1
- package/dist/service-BXmdFwSH.mjs +3 -0
- package/dist/{service-DDWgZL_L2.mjs → service-DBFZQloR.mjs} +3 -4
- package/dist/service-DBFZQloR.mjs.map +1 -0
- package/dist/{service-B2Jd9CxS.mjs → service-DiEtAsvc.mjs} +3 -4
- package/dist/{service-B2Jd9CxS.mjs.map → service-DiEtAsvc.mjs.map} +1 -1
- package/dist/{service_pb-BsBR6yW5.mjs → service_pb-CIrhGwHk.mjs} +1 -2
- package/dist/{service_pb-BsBR6yW5.mjs.map → service_pb-CIrhGwHk.mjs.map} +1 -1
- package/dist/{service_pb-BJ9GsAnW.mjs → service_pb-DjwIn4jO.mjs} +1 -2
- package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +204 -0
- package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +58 -0
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +316 -0
- package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +161 -0
- package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +2070 -0
- package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +861 -0
- package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +112 -0
- package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +69 -0
- package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +439 -0
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +564 -0
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +145 -0
- package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +451 -0
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +192 -0
- package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +50 -0
- package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +407 -0
- package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +430 -0
- package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +73 -0
- package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +17 -0
- package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +309 -0
- package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +591 -0
- package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +330 -0
- package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +113 -0
- package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +346 -0
- package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +54 -0
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +3576 -0
- package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +187 -0
- package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +29 -0
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +429 -0
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +90 -0
- package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +684 -0
- package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +797 -0
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +330 -0
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +183 -0
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +842 -0
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +276 -0
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2015 -0
- package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +483 -0
- package/dist/{telemetry-BQbbVo2t.mjs → telemetry-CdqJEzkj.mjs} +2 -3
- package/dist/{telemetry-BQbbVo2t.mjs.map → telemetry-CdqJEzkj.mjs.map} +1 -1
- package/dist/telemetry-ClwW5ohF.mjs +3 -0
- package/dist/types/aigateway.generated.d.mts +9 -0
- package/dist/types/app-config.generated.d.mts +4 -0
- package/dist/types/auth-connection.generated.d.mts +20 -0
- package/dist/types/auth.generated.d.mts +150 -0
- package/dist/types/executor.generated.d.mts +177 -0
- package/dist/types/generator-config.generated.d.mts +28 -0
- package/dist/types/helpers.d.mts +39 -0
- package/dist/types/http-adapter.generated.d.mts +17 -0
- package/dist/types/idp.generated.d.mts +584 -0
- package/dist/types/resolver.generated.d.mts +38 -0
- package/dist/types/secrets.generated.d.mts +14 -0
- package/dist/types/staticwebsite.generated.d.mts +10 -0
- package/dist/{types-rj8YJcEe.d.mts → types/tailordb.generated.d.mts} +2 -290
- package/dist/types/workflow.generated.d.mts +12 -0
- package/dist/types-qhFZ8y9B.mjs +4 -0
- package/dist/{types-D4QMmNWh.mjs → types-ywCGpzDZ.mjs} +2 -3
- package/dist/{types-D4QMmNWh.mjs.map → types-ywCGpzDZ.mjs.map} +1 -1
- package/dist/utils/test/index.d.mts +6 -89
- package/dist/utils/test/index.mjs +1 -2
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/utils/test/mock.d.mts +87 -0
- package/dist/vitest/environment.d.mts +1 -2
- package/dist/vitest/environment.mjs +1 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +4 -392
- package/dist/vitest/index.mjs +4 -5
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock-kysely.d.mts +62 -0
- package/dist/vitest/mock.d.mts +364 -0
- package/dist/vitest/setup.d.mts +1 -2
- package/dist/vitest/setup.mjs +2 -3
- package/dist/vitest/setup.mjs.map +1 -1
- package/dist/{workflow-C8I7shjM.mjs → workflow-DSwnYPPP.mjs} +10 -4
- package/dist/workflow-DSwnYPPP.mjs.map +1 -0
- package/docs/cli/setup.md +129 -19
- package/docs/cli-reference.md +9 -4
- package/docs/runtime.md +5 -1
- package/docs/services/aigateway.md +14 -0
- package/docs/testing.md +48 -2
- package/package.json +6 -1
- package/dist/application-DmjIKQ-a.mjs.map +0 -1
- package/dist/application-a_ApFuPh.mjs +0 -4
- package/dist/authconnection-CqfaJfrC.d.mts +0 -32
- package/dist/context-CUBwSBq4.d.mts +0 -68
- package/dist/file-BzK8z3X-.d.mts +0 -250
- package/dist/globals-ByrCoDip.mjs.map +0 -1
- package/dist/iconv-kwrmd1U_.d.mts +0 -122
- package/dist/idp-BmYwCXnJ.d.mts +0 -187
- package/dist/index-BDBU7x-i.d.mts +0 -18
- package/dist/index-BSlv_YrG.d.mts +0 -46
- package/dist/index-BzGqTY5x.d.mts +0 -1315
- package/dist/index-D3_Au3wu.d.mts +0 -47
- package/dist/index-DtFRlrww.d.mts +0 -18
- package/dist/index-jeE3UvF2.d.mts +0 -18
- package/dist/mock-wf5qeZLi.mjs.map +0 -1
- package/dist/package-json-wzO6nV9O.mjs +0 -4
- package/dist/runtime-Cd375HD-.mjs.map +0 -1
- package/dist/secretmanager-CKLB3wAQ.d.mts +0 -55
- package/dist/service-CRaa4Joe.mjs +0 -4
- package/dist/service-DDWgZL_L2.mjs.map +0 -1
- package/dist/telemetry-w92bvGdC.mjs +0 -4
- package/dist/types-32lUMToj.mjs +0 -5
- package/dist/types-aqnqTCfO.d.mts +0 -602
- package/dist/workflow-C8I7shjM.mjs.map +0 -1
- package/dist/workflow-CMamswkK.d.mts +0 -96
- package/dist/workflow.generated-Da1zECDw.d.mts +0 -1348
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { InferredAttributeMap } from "../../../runtime/types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/configure/services/tailordb/permission.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Record-level permission configuration for a TailorDB type.
|
|
6
|
+
* Defines create, read, update, and delete permissions.
|
|
7
|
+
*
|
|
8
|
+
* Prefer object format with explicit `conditions` and `permit` for readability.
|
|
9
|
+
* Shorthand array format is supported for compatibility, but less readable.
|
|
10
|
+
*
|
|
11
|
+
* For update operations, use `newRecord`/`oldRecord` operands instead of `record`.
|
|
12
|
+
* @example
|
|
13
|
+
* const permission: TailorTypePermission = {
|
|
14
|
+
* create: [{ conditions: [[{ user: "_loggedIn" }, "=", true]], permit: true }],
|
|
15
|
+
* read: [{ conditions: [[{ record: "isPublic" }, "=", true]], permit: true }],
|
|
16
|
+
* update: [{ conditions: [[{ newRecord: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
17
|
+
* delete: [{ conditions: [[{ record: "ownerId" }, "=", { user: "id" }]], permit: true }],
|
|
18
|
+
* };
|
|
19
|
+
*/
|
|
20
|
+
type TailorTypePermission<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
21
|
+
create: readonly ActionPermission<"record", User, Type, false>[];
|
|
22
|
+
read: readonly ActionPermission<"record", User, Type, false>[];
|
|
23
|
+
update: readonly ActionPermission<"record", User, Type, true>[];
|
|
24
|
+
delete: readonly ActionPermission<"record", User, Type, false>[];
|
|
25
|
+
};
|
|
26
|
+
type ActionPermission<Level extends "record" | "gql" = "record" | "gql", User extends object = InferredAttributeMap, Type extends object = object, Update extends boolean = boolean> = {
|
|
27
|
+
conditions: PermissionCondition<Level, User, Update, Type> | readonly PermissionCondition<Level, User, Update, Type>[];
|
|
28
|
+
description?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Whether matching records are granted (`true`) or denied (`false`).
|
|
31
|
+
* Omitting `permit` in this object form defaults to `deny` and emits a
|
|
32
|
+
* warning; set it explicitly. (The array shorthand defaults to `allow`.)
|
|
33
|
+
*/
|
|
34
|
+
permit?: boolean;
|
|
35
|
+
} | readonly [...PermissionCondition<Level, User, Update, Type>, ...([] | [boolean])] | readonly [...PermissionCondition<Level, User, Update, Type>[], ...([] | [boolean])];
|
|
36
|
+
type TailorTypeGqlPermission<User extends object = InferredAttributeMap, Type extends object = object> = readonly GqlPermissionPolicy<User, Type>[];
|
|
37
|
+
type GqlPermissionPolicy<User extends object = InferredAttributeMap, Type extends object = object> = {
|
|
38
|
+
conditions: readonly PermissionCondition<"gql", User, boolean, Type>[];
|
|
39
|
+
actions: "all" | readonly GqlPermissionAction[];
|
|
40
|
+
/**
|
|
41
|
+
* Whether matching requests are granted (`true`) or denied (`false`).
|
|
42
|
+
* Omitting `permit` defaults to `deny` and emits a warning; set it explicitly.
|
|
43
|
+
*/
|
|
44
|
+
permit?: boolean;
|
|
45
|
+
description?: string;
|
|
46
|
+
};
|
|
47
|
+
type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
48
|
+
type EqualityOperator = "=" | "!=";
|
|
49
|
+
type ContainsOperator = "in" | "not in";
|
|
50
|
+
type HasAnyOperator = "hasAny" | "not hasAny";
|
|
51
|
+
type StringFieldKeys<User extends object> = { [K in keyof User]: User[K] extends string ? K : never }[keyof User];
|
|
52
|
+
type StringArrayFieldKeys<User extends object> = { [K in keyof User]: User[K] extends string[] ? K : never }[keyof User];
|
|
53
|
+
type BooleanFieldKeys<User extends object> = { [K in keyof User]: User[K] extends boolean ? K : never }[keyof User];
|
|
54
|
+
type BooleanArrayFieldKeys<User extends object> = { [K in keyof User]: User[K] extends boolean[] ? K : never }[keyof User];
|
|
55
|
+
type UserStringOperand<User extends object = InferredAttributeMap> = {
|
|
56
|
+
user: StringFieldKeys<User> | "id";
|
|
57
|
+
};
|
|
58
|
+
type UserStringArrayOperand<User extends object = InferredAttributeMap> = {
|
|
59
|
+
user: StringArrayFieldKeys<User>;
|
|
60
|
+
};
|
|
61
|
+
type UserBooleanOperand<User extends object = InferredAttributeMap> = {
|
|
62
|
+
user: BooleanFieldKeys<User> | "_loggedIn";
|
|
63
|
+
};
|
|
64
|
+
type UserBooleanArrayOperand<User extends object = InferredAttributeMap> = {
|
|
65
|
+
user: BooleanArrayFieldKeys<User>;
|
|
66
|
+
};
|
|
67
|
+
type RecordOperand<Type extends object, Update extends boolean = false> = Update extends true ? {
|
|
68
|
+
oldRecord: (keyof Type & string) | "id";
|
|
69
|
+
} | {
|
|
70
|
+
newRecord: (keyof Type & string) | "id";
|
|
71
|
+
} : {
|
|
72
|
+
record: (keyof Type & string) | "id";
|
|
73
|
+
};
|
|
74
|
+
type StringEqualityCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = (Level extends "gql" ? readonly [string, EqualityOperator, boolean] : never) | readonly [string, EqualityOperator, string] | readonly [UserStringOperand<User>, EqualityOperator, string] | readonly [string, EqualityOperator, UserStringOperand<User>] | (Level extends "record" ? readonly [RecordOperand<Type, Update>, EqualityOperator, string | UserStringOperand<User>] | readonly [string | UserStringOperand<User>, EqualityOperator, RecordOperand<Type, Update>] : never);
|
|
75
|
+
type BooleanEqualityCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [boolean, EqualityOperator, boolean] | readonly [UserBooleanOperand<User>, EqualityOperator, boolean] | readonly [boolean, EqualityOperator, UserBooleanOperand<User>] | (Level extends "record" ? readonly [RecordOperand<Type, Update>, EqualityOperator, boolean | UserBooleanOperand<User>] | readonly [boolean | UserBooleanOperand<User>, EqualityOperator, RecordOperand<Type, Update>] : never);
|
|
76
|
+
type EqualityCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = StringEqualityCondition<Level, User, Update, Type> | BooleanEqualityCondition<Level, User, Update, Type>;
|
|
77
|
+
type StringContainsCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [string, ContainsOperator, string[]] | readonly [UserStringOperand<User>, ContainsOperator, string[]] | readonly [string, ContainsOperator, UserStringArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand<Type, Update>, ContainsOperator, string[] | UserStringArrayOperand<User>] | readonly [string | UserStringOperand<User>, ContainsOperator, RecordOperand<Type, Update>] : never);
|
|
78
|
+
type BooleanContainsCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = (Level extends "gql" ? readonly [string, ContainsOperator, boolean[]] : never) | readonly [boolean, ContainsOperator, boolean[]] | readonly [UserBooleanOperand<User>, ContainsOperator, boolean[]] | readonly [boolean, ContainsOperator, UserBooleanArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand<Type, Update>, ContainsOperator, boolean[] | UserBooleanArrayOperand<User>] | readonly [boolean | UserBooleanOperand<User>, ContainsOperator, RecordOperand<Type, Update>] : never);
|
|
79
|
+
type ContainsCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = StringContainsCondition<Level, User, Update, Type> | BooleanContainsCondition<Level, User, Update, Type>;
|
|
80
|
+
type HasAnyCondition<Level extends "record" | "gql", User extends object, Update extends boolean, Type extends object> = readonly [string[] | UserStringArrayOperand<User>, HasAnyOperator, string[] | UserStringArrayOperand<User>] | (Level extends "record" ? readonly [RecordOperand<Type, Update>, HasAnyOperator, string[] | UserStringArrayOperand<User>] | readonly [string[] | UserStringArrayOperand<User>, HasAnyOperator, RecordOperand<Type, Update>] : never);
|
|
81
|
+
/**
|
|
82
|
+
* Type representing a permission condition that combines user attributes, record fields, and literal values using comparison operators.
|
|
83
|
+
*
|
|
84
|
+
* The User type is extended by `tailor.d.ts`, which is automatically generated when running `tailor-sdk generate`.
|
|
85
|
+
* Attributes enabled in the config file's `auth.userProfile.attributes` (or
|
|
86
|
+
* `auth.machineUserAttributes` when userProfile is omitted) become available as types.
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* // tailor.config.ts
|
|
90
|
+
* export const auth = defineAuth("my-auth", {
|
|
91
|
+
* userProfile: {
|
|
92
|
+
* type: user,
|
|
93
|
+
* attributes: {
|
|
94
|
+
* isAdmin: true,
|
|
95
|
+
* roles: true,
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
type PermissionCondition<Level extends "record" | "gql" = "record", User extends object = InferredAttributeMap, Update extends boolean = boolean, Type extends object = object> = EqualityCondition<Level, User, Update, Type> | ContainsCondition<Level, User, Update, Type> | HasAnyCondition<Level, User, Update, Type>;
|
|
102
|
+
/**
|
|
103
|
+
* Grants full record-level access without any conditions.
|
|
104
|
+
*
|
|
105
|
+
* Unsafe and intended only for local development, prototyping, or tests.
|
|
106
|
+
* Do not use this in production environments, as it effectively disables
|
|
107
|
+
* authorization checks.
|
|
108
|
+
*/
|
|
109
|
+
declare const unsafeAllowAllTypePermission: TailorTypePermission;
|
|
110
|
+
/**
|
|
111
|
+
* Grants full GraphQL access (all actions) without any conditions.
|
|
112
|
+
*
|
|
113
|
+
* Unsafe and intended only for local development, prototyping, or tests.
|
|
114
|
+
* Do not use this in production environments, as it effectively disables
|
|
115
|
+
* authorization checks.
|
|
116
|
+
*/
|
|
117
|
+
declare const unsafeAllowAllGqlPermission: TailorTypeGqlPermission;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { PermissionCondition, TailorTypeGqlPermission, TailorTypePermission, unsafeAllowAllGqlPermission, unsafeAllowAllTypePermission };
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { InferredAttributeMap, TailorUser } from "../../../runtime/types.mjs";
|
|
2
|
+
import { InferFieldsOutput, TypeLevelError, output } from "../../../types/helpers.mjs";
|
|
3
|
+
import { FieldOptions, FieldOutput, FieldValidateInput, TailorFieldType, TailorToTs, Validators } from "../../types/field.types.mjs";
|
|
4
|
+
import { DBFieldMetadata, DefinedDBFieldMetadata, ExcludeNestedDBFields, Hook, Hooks, IndexDef, RelationType, SerialConfig, TailorDBField as TailorDBField$1, TailorDBType as TailorDBType$1, TypeFeatures } from "./types.mjs";
|
|
5
|
+
import { AllowedValues, AllowedValuesOutput } from "../../types/field.mjs";
|
|
6
|
+
import { PluginConfigs } from "../../../plugin/types.mjs";
|
|
7
|
+
import { TailorTypeGqlPermission, TailorTypePermission } from "./permission.mjs";
|
|
8
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
9
|
+
|
|
10
|
+
//#region src/configure/services/tailordb/schema.d.ts
|
|
11
|
+
type AnyBuilderMethod = any;
|
|
12
|
+
type TailorAnyDBField = Omit<TailorDBField$1<AnyBuilderMethod, AnyBuilderMethod>, "fields"> & {
|
|
13
|
+
readonly fields: Record<string, AnyBuilderMethod>;
|
|
14
|
+
_metadata: DBFieldMetadata;
|
|
15
|
+
parse: AnyBuilderMethod;
|
|
16
|
+
_parseInternal: AnyBuilderMethod;
|
|
17
|
+
readonly typeName: TypeLevelError<string>;
|
|
18
|
+
description: AnyBuilderMethod;
|
|
19
|
+
relation: AnyBuilderMethod;
|
|
20
|
+
index: AnyBuilderMethod;
|
|
21
|
+
unique: AnyBuilderMethod;
|
|
22
|
+
vector: AnyBuilderMethod;
|
|
23
|
+
hooks: AnyBuilderMethod;
|
|
24
|
+
validate: AnyBuilderMethod;
|
|
25
|
+
serial: AnyBuilderMethod;
|
|
26
|
+
clone: AnyBuilderMethod;
|
|
27
|
+
};
|
|
28
|
+
type TailorAnyDBType = TailorDBType<any, any>;
|
|
29
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
30
|
+
type DBFieldTypeNameMethod<Defined extends DefinedDBFieldMetadata> = IsAny<Defined> extends true ? TypeLevelError<string> : TypeLevelError<"typeName cannot be used on TailorDB fields">;
|
|
31
|
+
type WithDBFieldDescription<Defined> = Defined & {
|
|
32
|
+
description: true;
|
|
33
|
+
};
|
|
34
|
+
type WithDBFieldRelation<Defined, S extends RelationType | RelationSelfConfig> = S extends "oneToOne" | "1-1" ? Defined & {
|
|
35
|
+
unique: true;
|
|
36
|
+
index: true;
|
|
37
|
+
relation: true;
|
|
38
|
+
} : S extends {
|
|
39
|
+
type: "oneToOne" | "1-1";
|
|
40
|
+
} ? Defined & {
|
|
41
|
+
unique: true;
|
|
42
|
+
index: true;
|
|
43
|
+
relation: true;
|
|
44
|
+
} : Defined & {
|
|
45
|
+
index: true;
|
|
46
|
+
relation: true;
|
|
47
|
+
};
|
|
48
|
+
type WithDBFieldIndex<Defined> = Defined & {
|
|
49
|
+
index: true;
|
|
50
|
+
};
|
|
51
|
+
type WithDBFieldUnique<Defined> = Defined & {
|
|
52
|
+
unique: true;
|
|
53
|
+
index: true;
|
|
54
|
+
};
|
|
55
|
+
type WithDBFieldVector<Defined> = Defined & {
|
|
56
|
+
vector: true;
|
|
57
|
+
};
|
|
58
|
+
type WithDBFieldHooks<Defined, H> = Defined & {
|
|
59
|
+
hooks: {
|
|
60
|
+
create: H extends {
|
|
61
|
+
create: unknown;
|
|
62
|
+
} ? true : false;
|
|
63
|
+
update: H extends {
|
|
64
|
+
update: unknown;
|
|
65
|
+
} ? true : false;
|
|
66
|
+
};
|
|
67
|
+
serial: false;
|
|
68
|
+
};
|
|
69
|
+
type WithDBFieldValidate<Defined> = Defined & {
|
|
70
|
+
validate: true;
|
|
71
|
+
};
|
|
72
|
+
type WithDBFieldSerial<Defined> = Defined & {
|
|
73
|
+
serial: true;
|
|
74
|
+
hooks: {
|
|
75
|
+
create: false;
|
|
76
|
+
update: false;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type WithDBFieldCloneOptions<Defined extends DefinedDBFieldMetadata, NewOpt extends FieldOptions> = Omit<Defined, "array"> & {
|
|
80
|
+
array: NewOpt extends {
|
|
81
|
+
array: true;
|
|
82
|
+
} ? true : Defined["array"];
|
|
83
|
+
};
|
|
84
|
+
type FileKeyConflictError<Fields extends Record<string, TailorAnyDBField>, User extends object> = Partial<Record<keyof output<TailorDBType<Fields, User>> & string, TypeLevelError<"file keys cannot use existing field names">>>;
|
|
85
|
+
type DBFieldDescriptionFn<Defined extends DefinedDBFieldMetadata, Output> = (description: string) => TailorDBField<WithDBFieldDescription<Defined>, Output>;
|
|
86
|
+
type DBFieldRelationFn<Defined extends DefinedDBFieldMetadata, Output> = {
|
|
87
|
+
<S extends RelationType, T extends TailorAnyDBType>(config: RelationConfig<S, T>): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;
|
|
88
|
+
<S extends RelationSelfConfig>(config: S): TailorDBField<WithDBFieldRelation<Defined, S>, Output>;
|
|
89
|
+
};
|
|
90
|
+
type DBFieldIndexFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldIndex<Defined>, Output>;
|
|
91
|
+
type DBFieldUniqueFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldUnique<Defined>, Output>;
|
|
92
|
+
type DBFieldVectorFn<Defined extends DefinedDBFieldMetadata, Output> = () => TailorDBField<WithDBFieldVector<Defined>, Output>;
|
|
93
|
+
type DBFieldHooksFn<Defined extends DefinedDBFieldMetadata, Output> = <const H extends Hook<unknown, Output>>(hooks: H) => TailorDBField<WithDBFieldHooks<Defined, H>, Output>;
|
|
94
|
+
type DBFieldValidateFn<Defined extends DefinedDBFieldMetadata, Output> = (...validate: FieldValidateInput<Output>[]) => TailorDBField<WithDBFieldValidate<Defined>, Output>;
|
|
95
|
+
type DBFieldSerialFn<Defined extends DefinedDBFieldMetadata, Output> = (config: SerialConfig<Defined["type"] & ("integer" | "string")>) => TailorDBField<WithDBFieldSerial<Defined>, Output>;
|
|
96
|
+
type DBFieldDescriptionMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldDescriptionFn<Defined, Output> : Defined extends {
|
|
97
|
+
description: unknown;
|
|
98
|
+
} ? TypeLevelError<".description() has already been set"> : DBFieldDescriptionFn<Defined, Output>;
|
|
99
|
+
type DBFieldRelationMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldRelationFn<Defined, Output> : Defined extends {
|
|
100
|
+
relation: unknown;
|
|
101
|
+
} ? TypeLevelError<".relation() has already been set"> : DBFieldRelationFn<Defined, Output>;
|
|
102
|
+
type DBFieldIndexMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldIndexFn<Defined, Output> : Defined extends {
|
|
103
|
+
index: unknown;
|
|
104
|
+
} ? TypeLevelError<".index() has already been set"> : Defined extends {
|
|
105
|
+
array: true;
|
|
106
|
+
} ? TypeLevelError<"index cannot be set on array fields"> : DBFieldIndexFn<Defined, Output>;
|
|
107
|
+
type DBFieldUniqueMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldUniqueFn<Defined, Output> : Defined extends {
|
|
108
|
+
unique: unknown;
|
|
109
|
+
} ? TypeLevelError<".unique() has already been set"> : Defined extends {
|
|
110
|
+
array: true;
|
|
111
|
+
} ? TypeLevelError<"unique cannot be set on array fields"> : DBFieldUniqueFn<Defined, Output>;
|
|
112
|
+
type DBFieldVectorMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldVectorFn<Defined, Output> : Defined extends {
|
|
113
|
+
vector: unknown;
|
|
114
|
+
} ? TypeLevelError<".vector() has already been set"> : Defined extends {
|
|
115
|
+
type: "string";
|
|
116
|
+
array: false;
|
|
117
|
+
} ? DBFieldVectorFn<Defined, Output> : TypeLevelError<"vector can only be set on non-array string fields">;
|
|
118
|
+
type DBFieldHooksMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldHooksFn<Defined, Output> : Defined extends {
|
|
119
|
+
serial: true;
|
|
120
|
+
hooks: {
|
|
121
|
+
create: false;
|
|
122
|
+
update: false;
|
|
123
|
+
};
|
|
124
|
+
} ? TypeLevelError<"hooks cannot be set after serial"> : Defined extends {
|
|
125
|
+
hooks: unknown;
|
|
126
|
+
} ? TypeLevelError<".hooks() has already been set"> : Defined extends {
|
|
127
|
+
type: "nested";
|
|
128
|
+
} ? TypeLevelError<"hooks cannot be set on nested type fields"> : DBFieldHooksFn<Defined, Output>;
|
|
129
|
+
type DBFieldValidateMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldValidateFn<Defined, Output> : Defined extends {
|
|
130
|
+
validate: unknown;
|
|
131
|
+
} ? TypeLevelError<".validate() has already been set"> : DBFieldValidateFn<Defined, Output>;
|
|
132
|
+
type DBFieldSerialMethod<Defined extends DefinedDBFieldMetadata, Output> = IsAny<Defined> extends true ? DBFieldSerialFn<Defined, Output> : Defined extends {
|
|
133
|
+
serial: true;
|
|
134
|
+
} ? TypeLevelError<".serial() has already been set"> : Defined extends {
|
|
135
|
+
serial: false;
|
|
136
|
+
} ? TypeLevelError<"serial cannot be set after hooks"> : IsAny<Output> extends true ? Defined extends {
|
|
137
|
+
type: "integer" | "string";
|
|
138
|
+
array: false;
|
|
139
|
+
} ? DBFieldSerialFn<Defined, Output> : TypeLevelError<"serial can only be set on non-array integer or string fields"> : null extends Output ? TypeLevelError<"serial can only be set on non-array integer or string fields"> : Defined extends {
|
|
140
|
+
type: "integer" | "string";
|
|
141
|
+
array: false;
|
|
142
|
+
} ? DBFieldSerialFn<Defined, Output> : TypeLevelError<"serial can only be set on non-array integer or string fields">;
|
|
143
|
+
/**
|
|
144
|
+
* Full TailorDBField interface with builder methods.
|
|
145
|
+
* Extends the minimal structural interface from types/ with fluent API methods.
|
|
146
|
+
*/
|
|
147
|
+
interface TailorDBField<Defined extends DefinedDBFieldMetadata = DefinedDBFieldMetadata, Output = any> extends Omit<TailorDBField$1<Defined, Output>, "fields"> {
|
|
148
|
+
readonly fields: Record<string, TailorAnyDBField>;
|
|
149
|
+
_metadata: DBFieldMetadata;
|
|
150
|
+
/**
|
|
151
|
+
* Parse and validate a value against this field's validation rules
|
|
152
|
+
*/
|
|
153
|
+
parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;
|
|
154
|
+
/**
|
|
155
|
+
* Internal parse method that tracks field path for nested validation
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
_parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;
|
|
159
|
+
/**
|
|
160
|
+
* typeName is not available on TailorDB fields.
|
|
161
|
+
* Use typeName on pipeline fields (t.enum / t.object) instead.
|
|
162
|
+
*/
|
|
163
|
+
typeName: DBFieldTypeNameMethod<Defined>;
|
|
164
|
+
/**
|
|
165
|
+
* Set a description for the field
|
|
166
|
+
*/
|
|
167
|
+
description: DBFieldDescriptionMethod<Defined, Output>;
|
|
168
|
+
/**
|
|
169
|
+
* Define a relation to another type.
|
|
170
|
+
*/
|
|
171
|
+
relation: DBFieldRelationMethod<Defined, Output>;
|
|
172
|
+
/**
|
|
173
|
+
* Add an index to the field
|
|
174
|
+
*/
|
|
175
|
+
index: DBFieldIndexMethod<Defined, Output>;
|
|
176
|
+
/**
|
|
177
|
+
* Make the field unique (also adds an index)
|
|
178
|
+
*/
|
|
179
|
+
unique: DBFieldUniqueMethod<Defined, Output>;
|
|
180
|
+
/**
|
|
181
|
+
* Enable vector search on the field (string type only)
|
|
182
|
+
*/
|
|
183
|
+
vector: DBFieldVectorMethod<Defined, Output>;
|
|
184
|
+
/**
|
|
185
|
+
* Add hooks for create/update operations on this field.
|
|
186
|
+
*/
|
|
187
|
+
hooks: DBFieldHooksMethod<Defined, Output>;
|
|
188
|
+
/**
|
|
189
|
+
* Add validation functions to the field.
|
|
190
|
+
*/
|
|
191
|
+
validate: DBFieldValidateMethod<Defined, Output>;
|
|
192
|
+
/**
|
|
193
|
+
* Configure serial/auto-increment behavior
|
|
194
|
+
*/
|
|
195
|
+
serial: DBFieldSerialMethod<Defined, Output>;
|
|
196
|
+
/**
|
|
197
|
+
* Clone the field with optional overrides for field options
|
|
198
|
+
*/
|
|
199
|
+
clone<const NewOpt extends FieldOptions>(options?: NewOpt): TailorDBField<WithDBFieldCloneOptions<Defined, NewOpt>, FieldOutput<TailorToTs[Defined["type"]], NewOpt>>;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Full TailorDBType interface with builder methods.
|
|
203
|
+
* Extends the minimal structural interface from types/ with fluent API methods.
|
|
204
|
+
*/
|
|
205
|
+
interface TailorDBType<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> extends TailorDBType$1<Fields, User> {
|
|
206
|
+
_description?: string;
|
|
207
|
+
hooks(hooks: Hooks<Fields>): TailorDBType<Fields, User>;
|
|
208
|
+
validate(validators: Validators<Fields>): TailorDBType<Fields, User>;
|
|
209
|
+
features(features: Omit<TypeFeatures, "pluralForm">): TailorDBType<Fields, User>;
|
|
210
|
+
indexes(...indexes: IndexDef<TailorDBType<Fields, User>>[]): TailorDBType<Fields, User>;
|
|
211
|
+
files<const F extends string>(files: Record<F, string> & FileKeyConflictError<Fields, User>): TailorDBType<Fields, User>;
|
|
212
|
+
permission<U extends object = User, P extends TailorTypePermission<U, output<TailorDBType<Fields, User>>> = TailorTypePermission<U, output<TailorDBType<Fields, User>>>>(permission: P): TailorDBType<Fields, U>;
|
|
213
|
+
gqlPermission<U extends object = User, P extends TailorTypeGqlPermission<U> = TailorTypeGqlPermission<U>>(permission: P): TailorDBType<Fields, U>;
|
|
214
|
+
description(description: string): TailorDBType<Fields, User>;
|
|
215
|
+
pickFields<K extends keyof Fields>(keys: K[]): Pick<Fields, K>;
|
|
216
|
+
pickFields<K extends keyof Fields, const Opt extends FieldOptions>(keys: K[], options: Opt): { [P in K]: Fields[P] extends TailorDBField<infer D, infer _O> ? TailorDBField<Omit<D, "array"> & {
|
|
217
|
+
array: Opt extends {
|
|
218
|
+
array: true;
|
|
219
|
+
} ? true : D["array"];
|
|
220
|
+
}, FieldOutput<TailorToTs[D["type"]], Opt>> : never };
|
|
221
|
+
omitFields<K extends keyof Fields>(keys: K[]): Omit<Fields, K>;
|
|
222
|
+
plugin<P extends keyof PluginConfigs<keyof Fields & string>>(config: { [K in P]: PluginConfigs<keyof Fields & string>[K] }): TailorDBType<Fields, User>;
|
|
223
|
+
}
|
|
224
|
+
type TailorDBInstance<Fields extends Record<string, TailorAnyDBField> = any, User extends object = InferredAttributeMap> = TailorDBType<Fields, User>;
|
|
225
|
+
interface RelationConfig<S extends RelationType, T extends TailorDBType> {
|
|
226
|
+
type: S;
|
|
227
|
+
toward: {
|
|
228
|
+
type: T;
|
|
229
|
+
as?: string;
|
|
230
|
+
key?: keyof T["fields"] & string;
|
|
231
|
+
};
|
|
232
|
+
backward?: string;
|
|
233
|
+
}
|
|
234
|
+
type RelationSelfConfig = {
|
|
235
|
+
type: RelationType;
|
|
236
|
+
toward: {
|
|
237
|
+
type: "self";
|
|
238
|
+
as?: string;
|
|
239
|
+
key?: string;
|
|
240
|
+
};
|
|
241
|
+
backward?: string;
|
|
242
|
+
};
|
|
243
|
+
type FieldParseArgs = {
|
|
244
|
+
value: unknown;
|
|
245
|
+
data: unknown;
|
|
246
|
+
user: TailorUser;
|
|
247
|
+
};
|
|
248
|
+
type FieldParseInternalArgs = {
|
|
249
|
+
value: any;
|
|
250
|
+
data: unknown;
|
|
251
|
+
user: TailorUser;
|
|
252
|
+
pathArray: string[];
|
|
253
|
+
};
|
|
254
|
+
type DBFieldDefined<T extends TailorFieldType, Opt extends FieldOptions> = {
|
|
255
|
+
type: T;
|
|
256
|
+
array: Opt extends {
|
|
257
|
+
array: true;
|
|
258
|
+
} ? true : false;
|
|
259
|
+
};
|
|
260
|
+
type DBFieldOutput<T extends TailorFieldType, Opt extends FieldOptions, OutputBase = TailorToTs[T]> = FieldOutput<OutputBase, Opt>;
|
|
261
|
+
type TailorDBFieldInstance<T extends TailorFieldType, Opt extends FieldOptions, OutputBase = TailorToTs[T]> = TailorDBField<DBFieldDefined<T, Opt>, DBFieldOutput<T, Opt, OutputBase>>;
|
|
262
|
+
/**
|
|
263
|
+
* Create a UUID field.
|
|
264
|
+
* @param options - Field configuration options
|
|
265
|
+
* @returns A UUID field
|
|
266
|
+
* @example db.uuid()
|
|
267
|
+
* @example db.uuid({ optional: true })
|
|
268
|
+
*/
|
|
269
|
+
declare function uuid<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"uuid", Opt, string>;
|
|
270
|
+
/**
|
|
271
|
+
* Create a string field.
|
|
272
|
+
* @param options - Field configuration options
|
|
273
|
+
* @returns A string field
|
|
274
|
+
* @example db.string()
|
|
275
|
+
* @example db.string({ optional: true })
|
|
276
|
+
*/
|
|
277
|
+
declare function string<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"string", Opt, string>;
|
|
278
|
+
/**
|
|
279
|
+
* Create a boolean field.
|
|
280
|
+
* Note: The method name is `bool` but creates a `boolean` type field.
|
|
281
|
+
* @param options - Field configuration options
|
|
282
|
+
* @returns A boolean field
|
|
283
|
+
* @example db.bool()
|
|
284
|
+
* @example db.bool({ optional: true })
|
|
285
|
+
*/
|
|
286
|
+
declare function bool<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"boolean", Opt, boolean>;
|
|
287
|
+
/**
|
|
288
|
+
* Create an integer field.
|
|
289
|
+
* @param options - Field configuration options
|
|
290
|
+
* @returns An integer field
|
|
291
|
+
* @example db.int()
|
|
292
|
+
* @example db.int({ optional: true })
|
|
293
|
+
*/
|
|
294
|
+
declare function int<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"integer", Opt, number>;
|
|
295
|
+
/**
|
|
296
|
+
* Create a float (decimal number) field.
|
|
297
|
+
* @param options - Field configuration options
|
|
298
|
+
* @returns A float field
|
|
299
|
+
* @example db.float()
|
|
300
|
+
* @example db.float({ optional: true })
|
|
301
|
+
*/
|
|
302
|
+
declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"float", Opt, number>;
|
|
303
|
+
interface DecimalFieldOptions extends FieldOptions {
|
|
304
|
+
scale?: number;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Create a decimal field (stored as string for precision).
|
|
308
|
+
* @param options - Field configuration options including optional scale (0-12)
|
|
309
|
+
* @returns A decimal field
|
|
310
|
+
* @example db.decimal()
|
|
311
|
+
* @example db.decimal({ scale: 2 })
|
|
312
|
+
* @example db.decimal({ scale: 2, optional: true })
|
|
313
|
+
*/
|
|
314
|
+
declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBFieldInstance<"decimal", Opt, string>;
|
|
315
|
+
/**
|
|
316
|
+
* Create a date field (date only, no time component).
|
|
317
|
+
* Format: "yyyy-MM-dd"
|
|
318
|
+
* @param options - Field configuration options
|
|
319
|
+
* @returns A date field
|
|
320
|
+
* @example db.date()
|
|
321
|
+
*/
|
|
322
|
+
declare function date<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"date", Opt, string>;
|
|
323
|
+
/**
|
|
324
|
+
* Create a datetime field (date and time).
|
|
325
|
+
* Format: ISO 8601 "yyyy-MM-ddTHH:mm:ssZ"
|
|
326
|
+
* @param options - Field configuration options
|
|
327
|
+
* @returns A datetime field
|
|
328
|
+
* @example db.datetime()
|
|
329
|
+
*/
|
|
330
|
+
declare function datetime<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"datetime", Opt, string | Date>;
|
|
331
|
+
/**
|
|
332
|
+
* Create a time field (time only, no date component).
|
|
333
|
+
* Format: "HH:mm"
|
|
334
|
+
* @param options - Field configuration options
|
|
335
|
+
* @returns A time field
|
|
336
|
+
* @example db.time()
|
|
337
|
+
*/
|
|
338
|
+
declare function time<const Opt extends FieldOptions>(options?: Opt): TailorDBFieldInstance<"time", Opt, string>;
|
|
339
|
+
/**
|
|
340
|
+
* Create an enum field with a fixed set of allowed string values.
|
|
341
|
+
* @param values - Array of allowed string values, or array of `{ value, description }` objects
|
|
342
|
+
* @param options - Field configuration options
|
|
343
|
+
* @returns An enum field
|
|
344
|
+
* @example db.enum(["active", "inactive", "suspended"])
|
|
345
|
+
* @example db.enum(["small", "medium", "large"], { optional: true })
|
|
346
|
+
*/
|
|
347
|
+
declare function _enum<const V extends AllowedValues, const Opt extends FieldOptions>(values: V, options?: Opt): TailorDBField<{
|
|
348
|
+
type: "enum";
|
|
349
|
+
array: Opt extends {
|
|
350
|
+
array: true;
|
|
351
|
+
} ? true : false;
|
|
352
|
+
}, FieldOutput<AllowedValuesOutput<V>, Opt>>;
|
|
353
|
+
/**
|
|
354
|
+
* Create a nested object field with sub-fields.
|
|
355
|
+
* @param fields - Record of nested field definitions
|
|
356
|
+
* @param options - Field configuration options
|
|
357
|
+
* @returns A nested object field
|
|
358
|
+
* @example db.object({ street: db.string(), city: db.string(), zip: db.string() })
|
|
359
|
+
* @example db.object({ name: db.string() }, { optional: true })
|
|
360
|
+
*/
|
|
361
|
+
declare function object<const F extends Record<string, TailorAnyDBField> & ExcludeNestedDBFields<F>, const Opt extends FieldOptions>(fields: F, options?: Opt): TailorDBField<{
|
|
362
|
+
type: "nested";
|
|
363
|
+
array: Opt extends {
|
|
364
|
+
array: true;
|
|
365
|
+
} ? true : false;
|
|
366
|
+
}, FieldOutput<InferFieldsOutput<F>, Opt>>;
|
|
367
|
+
declare const idField: TailorDBFieldInstance<"uuid", FieldOptions, string>;
|
|
368
|
+
type idField = typeof idField;
|
|
369
|
+
type DBType<F extends {
|
|
370
|
+
id?: never;
|
|
371
|
+
} & Record<string, TailorAnyDBField>> = TailorDBInstance<{
|
|
372
|
+
id: idField;
|
|
373
|
+
} & F>;
|
|
374
|
+
/**
|
|
375
|
+
* Creates a new database type with the specified fields.
|
|
376
|
+
* An `id` field (UUID) is automatically added to every type.
|
|
377
|
+
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
378
|
+
* @param fields - The field definitions for the type
|
|
379
|
+
* @returns A new TailorDBType instance
|
|
380
|
+
* @example
|
|
381
|
+
* export const user = db.type("User", {
|
|
382
|
+
* name: db.string(),
|
|
383
|
+
* email: db.string(),
|
|
384
|
+
* age: db.int({ optional: true }),
|
|
385
|
+
* role: db.enum(["admin", "member"]),
|
|
386
|
+
* ...db.fields.timestamps(),
|
|
387
|
+
* });
|
|
388
|
+
* // Always export both the value and type:
|
|
389
|
+
* export type user = typeof user;
|
|
390
|
+
*/
|
|
391
|
+
declare function dbType<const F extends {
|
|
392
|
+
id?: never;
|
|
393
|
+
} & Record<string, TailorAnyDBField>>(name: string | [string, string], fields: F): DBType<F>;
|
|
394
|
+
/**
|
|
395
|
+
* Creates a new database type with the specified fields and description.
|
|
396
|
+
* An `id` field (UUID) is automatically added to every type.
|
|
397
|
+
* @param name - The name of the type, or a tuple of [name, pluralForm]
|
|
398
|
+
* @param description - A description of the type
|
|
399
|
+
* @param fields - The field definitions for the type
|
|
400
|
+
* @returns A new TailorDBType instance
|
|
401
|
+
*/
|
|
402
|
+
declare function dbType<const F extends {
|
|
403
|
+
id?: never;
|
|
404
|
+
} & Record<string, TailorAnyDBField>>(name: string | [string, string], description: string, fields: F): DBType<F>;
|
|
405
|
+
/** TailorDB schema builder utilities for defining types and fields. */
|
|
406
|
+
declare const db: {
|
|
407
|
+
type: typeof dbType;
|
|
408
|
+
uuid: typeof uuid;
|
|
409
|
+
string: typeof string;
|
|
410
|
+
bool: typeof bool;
|
|
411
|
+
int: typeof int;
|
|
412
|
+
float: typeof float;
|
|
413
|
+
decimal: typeof decimal;
|
|
414
|
+
date: typeof date;
|
|
415
|
+
datetime: typeof datetime;
|
|
416
|
+
time: typeof time;
|
|
417
|
+
enum: typeof _enum;
|
|
418
|
+
object: typeof object;
|
|
419
|
+
fields: {
|
|
420
|
+
/**
|
|
421
|
+
* Creates standard timestamp fields (createdAt, updatedAt) with auto-hooks.
|
|
422
|
+
* createdAt is set on create, updatedAt is set on update.
|
|
423
|
+
* A user-specified createdAt is respected when provided (e.g. seeding historical
|
|
424
|
+
* records); the current time is used only when the value is omitted.
|
|
425
|
+
* @returns An object with createdAt and updatedAt fields
|
|
426
|
+
* @example
|
|
427
|
+
* const model = db.type("Model", {
|
|
428
|
+
* name: db.string(),
|
|
429
|
+
* ...db.fields.timestamps(),
|
|
430
|
+
* });
|
|
431
|
+
*/
|
|
432
|
+
timestamps: () => {
|
|
433
|
+
createdAt: TailorDBField<WithDBFieldDescription<WithDBFieldHooks<DBFieldDefined<"datetime", FieldOptions>, {
|
|
434
|
+
readonly create: ({
|
|
435
|
+
value
|
|
436
|
+
}: {
|
|
437
|
+
value: string | Date | null;
|
|
438
|
+
data: unknown;
|
|
439
|
+
user: TailorUser;
|
|
440
|
+
}) => string | Date;
|
|
441
|
+
}>>, string | Date>;
|
|
442
|
+
updatedAt: TailorDBField<WithDBFieldDescription<WithDBFieldHooks<DBFieldDefined<"datetime", {
|
|
443
|
+
readonly optional: true;
|
|
444
|
+
}>, {
|
|
445
|
+
readonly update: () => Date;
|
|
446
|
+
}>>, string | Date | null>;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
//#endregion
|
|
451
|
+
export { TailorAnyDBField, TailorAnyDBType, TailorDBField, TailorDBInstance, TailorDBType, db };
|