@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,245 @@
|
|
|
1
|
+
import { PluginAttachment, TailorAnyDBField, TailorAnyDBType } from "../configure/services/tailordb/types.mjs";
|
|
2
|
+
import { IdProvider, OAuth2Client } from "../types/auth.generated.mjs";
|
|
3
|
+
import { TailorDBType, TypeSourceInfoEntry } from "../parser/service/tailordb/types.mjs";
|
|
4
|
+
import { BaseGeneratorConfigInput } from "../types/generator-config.generated.mjs";
|
|
5
|
+
import { Executor } from "../types/executor.generated.mjs";
|
|
6
|
+
import { Resolver } from "../types/resolver.generated.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/plugin/types.d.ts
|
|
9
|
+
type GeneratorConfig = BaseGeneratorConfigInput;
|
|
10
|
+
/**
|
|
11
|
+
* A single generated file to write to disk.
|
|
12
|
+
*/
|
|
13
|
+
interface GeneratedFile {
|
|
14
|
+
path: string;
|
|
15
|
+
content: string;
|
|
16
|
+
skipIfExists?: boolean;
|
|
17
|
+
executable?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result returned by generation-time hooks.
|
|
21
|
+
*/
|
|
22
|
+
interface GeneratorResult {
|
|
23
|
+
files: GeneratedFile[];
|
|
24
|
+
errors?: string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Auth configuration available to generation-time hooks.
|
|
28
|
+
*/
|
|
29
|
+
interface GeneratorAuthInput {
|
|
30
|
+
name: string;
|
|
31
|
+
userProfile?: {
|
|
32
|
+
typeName: string;
|
|
33
|
+
namespace: string;
|
|
34
|
+
usernameField: string;
|
|
35
|
+
};
|
|
36
|
+
machineUsers?: Record<string, {
|
|
37
|
+
attributes?: Record<string, unknown>;
|
|
38
|
+
}>;
|
|
39
|
+
oauth2Clients?: Record<string, OAuth2Client>;
|
|
40
|
+
idProvider?: IdProvider;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Namespace-level TailorDB data available to generation-time hooks.
|
|
44
|
+
*/
|
|
45
|
+
interface TailorDBNamespaceData {
|
|
46
|
+
/** Namespace name */
|
|
47
|
+
namespace: string;
|
|
48
|
+
/** All TailorDB types in this namespace, keyed by type name */
|
|
49
|
+
types: Record<string, TailorDBType>;
|
|
50
|
+
/** Source info for each type (file path, export name, plugin info) */
|
|
51
|
+
sourceInfo: ReadonlyMap<string, TypeSourceInfoEntry>;
|
|
52
|
+
/** Plugin attachments configured on each type via .plugin() method */
|
|
53
|
+
pluginAttachments: ReadonlyMap<string, readonly PluginAttachment[]>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Namespace-level resolver data available to generation-time hooks.
|
|
57
|
+
*/
|
|
58
|
+
interface ResolverNamespaceData {
|
|
59
|
+
/** Namespace name */
|
|
60
|
+
namespace: string;
|
|
61
|
+
/** All resolvers in this namespace, keyed by resolver name */
|
|
62
|
+
resolvers: Record<string, Resolver>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Context passed to plugin's onTailorDBReady hook.
|
|
66
|
+
* @template PluginConfig - Plugin-level configuration type
|
|
67
|
+
*/
|
|
68
|
+
interface TailorDBReadyContext<PluginConfig = unknown> {
|
|
69
|
+
/** All TailorDB namespaces with their types and metadata */
|
|
70
|
+
tailordb: TailorDBNamespaceData[];
|
|
71
|
+
/** Auth configuration */
|
|
72
|
+
auth?: GeneratorAuthInput;
|
|
73
|
+
/** Base directory for generated files */
|
|
74
|
+
baseDir: string;
|
|
75
|
+
/** Path to tailor.config.ts */
|
|
76
|
+
configPath: string;
|
|
77
|
+
/** Plugin-level configuration passed via definePlugins() */
|
|
78
|
+
pluginConfig: PluginConfig;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Context passed to plugin's onResolverReady hook.
|
|
82
|
+
* @template PluginConfig - Plugin-level configuration type
|
|
83
|
+
*/
|
|
84
|
+
interface ResolverReadyContext<PluginConfig = unknown> {
|
|
85
|
+
/** All TailorDB namespaces with their types and metadata */
|
|
86
|
+
tailordb: TailorDBNamespaceData[];
|
|
87
|
+
/** All resolver namespaces with their resolvers */
|
|
88
|
+
resolvers: ResolverNamespaceData[];
|
|
89
|
+
/** Auth configuration */
|
|
90
|
+
auth?: GeneratorAuthInput;
|
|
91
|
+
/** Base directory for generated files */
|
|
92
|
+
baseDir: string;
|
|
93
|
+
/** Path to tailor.config.ts */
|
|
94
|
+
configPath: string;
|
|
95
|
+
/** Plugin-level configuration passed via definePlugins() */
|
|
96
|
+
pluginConfig: PluginConfig;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Context passed to plugin's onExecutorReady hook.
|
|
100
|
+
* @template PluginConfig - Plugin-level configuration type
|
|
101
|
+
*/
|
|
102
|
+
interface ExecutorReadyContext<PluginConfig = unknown> {
|
|
103
|
+
/** All TailorDB namespaces with their types and metadata */
|
|
104
|
+
tailordb: TailorDBNamespaceData[];
|
|
105
|
+
/** All resolver namespaces with their resolvers */
|
|
106
|
+
resolvers: ResolverNamespaceData[];
|
|
107
|
+
/** All executors, keyed by executor name */
|
|
108
|
+
executors: Record<string, Executor>;
|
|
109
|
+
/** Auth configuration */
|
|
110
|
+
auth?: GeneratorAuthInput;
|
|
111
|
+
/** Base directory for generated files */
|
|
112
|
+
baseDir: string;
|
|
113
|
+
/** Path to tailor.config.ts */
|
|
114
|
+
configPath: string;
|
|
115
|
+
/** Plugin-level configuration passed via definePlugins() */
|
|
116
|
+
pluginConfig: PluginConfig;
|
|
117
|
+
}
|
|
118
|
+
type TypeConfigRequired<PluginConfig = unknown> = boolean | ((pluginConfig: PluginConfig | undefined) => boolean);
|
|
119
|
+
/**
|
|
120
|
+
* Interface for plugin configuration mapping.
|
|
121
|
+
* Extend this interface via declaration merging to add typed plugin configs.
|
|
122
|
+
*/
|
|
123
|
+
interface PluginConfigs<Fields extends string = string> {}
|
|
124
|
+
/**
|
|
125
|
+
* Context passed to plugin's process method
|
|
126
|
+
*/
|
|
127
|
+
interface PluginProcessContext<TypeConfig = unknown, PluginConfig = unknown> {
|
|
128
|
+
type: TailorAnyDBType;
|
|
129
|
+
typeConfig: TypeConfig;
|
|
130
|
+
pluginConfig: PluginConfig;
|
|
131
|
+
namespace: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Context passed to plugin's onNamespaceLoaded hook.
|
|
135
|
+
*/
|
|
136
|
+
interface PluginNamespaceProcessContext<PluginConfig = unknown> {
|
|
137
|
+
pluginConfig: PluginConfig;
|
|
138
|
+
namespace: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Interface representing a TailorDB type for plugin output.
|
|
142
|
+
*/
|
|
143
|
+
interface TailorDBTypeForPlugin {
|
|
144
|
+
readonly name: string;
|
|
145
|
+
readonly fields: Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
type PluginGeneratedType = TailorDBTypeForPlugin;
|
|
148
|
+
type PluginGeneratedTypes = Record<string, PluginGeneratedType>;
|
|
149
|
+
interface PluginGeneratedResolver {
|
|
150
|
+
name: string;
|
|
151
|
+
operation: "query" | "mutation";
|
|
152
|
+
inputFields?: Record<string, unknown>;
|
|
153
|
+
outputFields: Record<string, unknown>;
|
|
154
|
+
body: string;
|
|
155
|
+
}
|
|
156
|
+
interface PluginRecordTriggerConfig {
|
|
157
|
+
kind: "tailordb";
|
|
158
|
+
events: ("tailordb.type_record.created" | "tailordb.type_record.updated" | "tailordb.type_record.deleted")[];
|
|
159
|
+
typeName: string;
|
|
160
|
+
}
|
|
161
|
+
interface PluginScheduleTriggerConfig {
|
|
162
|
+
kind: "schedule";
|
|
163
|
+
cron: string;
|
|
164
|
+
timezone?: string;
|
|
165
|
+
}
|
|
166
|
+
interface PluginIncomingWebhookTriggerConfig {
|
|
167
|
+
kind: "incomingWebhook";
|
|
168
|
+
}
|
|
169
|
+
type PluginTriggerConfig = PluginRecordTriggerConfig | PluginScheduleTriggerConfig | PluginIncomingWebhookTriggerConfig;
|
|
170
|
+
type PluginInjectValue = string | number | boolean | null;
|
|
171
|
+
type PluginInjectMap = Record<string, PluginInjectValue>;
|
|
172
|
+
interface PluginFunctionOperationConfig {
|
|
173
|
+
kind: "function";
|
|
174
|
+
body: string;
|
|
175
|
+
inject?: PluginInjectMap;
|
|
176
|
+
}
|
|
177
|
+
interface PluginGraphQLOperationConfig {
|
|
178
|
+
kind: "graphql";
|
|
179
|
+
query: string;
|
|
180
|
+
appName?: string;
|
|
181
|
+
variables?: string;
|
|
182
|
+
}
|
|
183
|
+
interface PluginWebhookOperationConfig {
|
|
184
|
+
kind: "webhook";
|
|
185
|
+
url: string;
|
|
186
|
+
}
|
|
187
|
+
interface PluginWorkflowOperationConfig {
|
|
188
|
+
kind: "workflow";
|
|
189
|
+
workflowName: string;
|
|
190
|
+
}
|
|
191
|
+
type PluginOperationConfig = PluginFunctionOperationConfig | PluginGraphQLOperationConfig | PluginWebhookOperationConfig | PluginWorkflowOperationConfig;
|
|
192
|
+
type PluginExecutorContextValue = TailorAnyDBType | string | number | boolean | null | undefined;
|
|
193
|
+
interface PluginExecutorContextBase {
|
|
194
|
+
sourceType: TailorAnyDBType | null;
|
|
195
|
+
namespace: string;
|
|
196
|
+
}
|
|
197
|
+
type PluginExecutorContext = PluginExecutorContextBase & {
|
|
198
|
+
[key: string]: PluginExecutorContextValue;
|
|
199
|
+
};
|
|
200
|
+
interface PluginExecutorModule {
|
|
201
|
+
default: unknown;
|
|
202
|
+
}
|
|
203
|
+
interface PluginGeneratedExecutorWithFile<Ctx = PluginExecutorContext> {
|
|
204
|
+
name: string;
|
|
205
|
+
resolve: () => Promise<PluginExecutorModule>;
|
|
206
|
+
context: Ctx;
|
|
207
|
+
}
|
|
208
|
+
interface PluginGeneratedExecutorLegacy {
|
|
209
|
+
name: string;
|
|
210
|
+
description?: string;
|
|
211
|
+
trigger: PluginTriggerConfig;
|
|
212
|
+
operation: PluginOperationConfig;
|
|
213
|
+
}
|
|
214
|
+
type PluginGeneratedExecutor = PluginGeneratedExecutorWithFile | PluginGeneratedExecutorLegacy;
|
|
215
|
+
interface PluginExtends {
|
|
216
|
+
fields?: Record<string, TailorAnyDBField>;
|
|
217
|
+
}
|
|
218
|
+
interface PluginOutput {
|
|
219
|
+
types?: PluginGeneratedTypes;
|
|
220
|
+
resolvers?: PluginGeneratedResolver[];
|
|
221
|
+
executors?: PluginGeneratedExecutor[];
|
|
222
|
+
}
|
|
223
|
+
interface TypePluginOutput extends PluginOutput {
|
|
224
|
+
extends?: PluginExtends;
|
|
225
|
+
}
|
|
226
|
+
type NamespacePluginOutput = PluginOutput;
|
|
227
|
+
/**
|
|
228
|
+
* Plugin interface that all plugins must implement.
|
|
229
|
+
* @template TypeConfig - Type for per-type configuration passed via .plugin() method
|
|
230
|
+
* @template PluginConfig - Type for plugin-level configuration passed via definePlugins()
|
|
231
|
+
*/
|
|
232
|
+
interface Plugin<TypeConfig = unknown, PluginConfig = unknown> {
|
|
233
|
+
readonly id: string;
|
|
234
|
+
readonly description: string;
|
|
235
|
+
readonly importPath?: string;
|
|
236
|
+
readonly typeConfigRequired?: TypeConfigRequired<PluginConfig>;
|
|
237
|
+
readonly pluginConfig?: PluginConfig;
|
|
238
|
+
onTypeLoaded?(context: PluginProcessContext<TypeConfig, PluginConfig>): TypePluginOutput | Promise<TypePluginOutput>;
|
|
239
|
+
onNamespaceLoaded?(context: PluginNamespaceProcessContext<PluginConfig>): NamespacePluginOutput | Promise<NamespacePluginOutput>;
|
|
240
|
+
onTailorDBReady?(context: TailorDBReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
241
|
+
onResolverReady?(context: ResolverReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
242
|
+
onExecutorReady?(context: ExecutorReadyContext<PluginConfig>): GeneratorResult | Promise<GeneratorResult>;
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
export { ExecutorReadyContext, GeneratedFile, GeneratorAuthInput, GeneratorConfig, GeneratorResult, NamespacePluginOutput, Plugin, type PluginAttachment, PluginConfigs, PluginExecutorContext, PluginExecutorContextBase, PluginExecutorContextValue, PluginExecutorModule, PluginExtends, PluginFunctionOperationConfig, PluginGeneratedExecutor, PluginGeneratedExecutorLegacy, PluginGeneratedExecutorWithFile, PluginGeneratedResolver, PluginGeneratedType, PluginGeneratedTypes, PluginGraphQLOperationConfig, PluginIncomingWebhookTriggerConfig, PluginInjectMap, PluginInjectValue, PluginNamespaceProcessContext, PluginOperationConfig, PluginOutput, PluginProcessContext, PluginRecordTriggerConfig, PluginScheduleTriggerConfig, PluginTriggerConfig, PluginWebhookOperationConfig, PluginWorkflowOperationConfig, ResolverNamespaceData, ResolverReadyContext, TailorDBNamespaceData, TailorDBReadyContext, TailorDBTypeForPlugin, TypeConfigRequired, TypePluginOutput };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { TailorActor, TailorEnv } from "../runtime/types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/with-context.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Plugin executor factory function type.
|
|
6
|
+
* Takes context and returns an executor configuration.
|
|
7
|
+
* Returns unknown since the exact return type depends on createExecutor's generic params.
|
|
8
|
+
*/
|
|
9
|
+
type PluginExecutorFactory<Ctx> = (ctx: Ctx) => unknown;
|
|
10
|
+
/**
|
|
11
|
+
* Base args for plugin executor function operations.
|
|
12
|
+
* Provides typed access to runtime context without requiring specific record types.
|
|
13
|
+
*/
|
|
14
|
+
interface PluginFunctionArgs {
|
|
15
|
+
/** Workspace ID where the executor runs */
|
|
16
|
+
workspaceId: string;
|
|
17
|
+
/** Application namespace */
|
|
18
|
+
appNamespace: string;
|
|
19
|
+
/** Environment variables */
|
|
20
|
+
env: TailorEnv;
|
|
21
|
+
/** Actor (user) who triggered the event, null for system events */
|
|
22
|
+
actor: TailorActor | null;
|
|
23
|
+
/** Name of the TailorDB type */
|
|
24
|
+
typeName: string;
|
|
25
|
+
/** TailorDB connections by namespace */
|
|
26
|
+
tailordb: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Args for plugin executors triggered on record creation.
|
|
30
|
+
*/
|
|
31
|
+
interface PluginRecordCreatedArgs extends PluginFunctionArgs {
|
|
32
|
+
/** The newly created record */
|
|
33
|
+
newRecord: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Args for plugin executors triggered on record update.
|
|
37
|
+
*/
|
|
38
|
+
interface PluginRecordUpdatedArgs extends PluginFunctionArgs {
|
|
39
|
+
/** The record after update */
|
|
40
|
+
newRecord: Record<string, unknown>;
|
|
41
|
+
/** The record before update */
|
|
42
|
+
oldRecord: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Args for plugin executors triggered on record deletion.
|
|
46
|
+
*/
|
|
47
|
+
interface PluginRecordDeletedArgs extends PluginFunctionArgs {
|
|
48
|
+
/** The deleted record */
|
|
49
|
+
oldRecord: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Database schema type for plugins.
|
|
53
|
+
* Since plugins work with dynamic types, the schema uses Record types.
|
|
54
|
+
*/
|
|
55
|
+
type PluginDBSchema = Record<string, Record<string, unknown>>;
|
|
56
|
+
/**
|
|
57
|
+
* Base record type for TailorDB records.
|
|
58
|
+
* All records have an id field.
|
|
59
|
+
*/
|
|
60
|
+
type PluginRecord = {
|
|
61
|
+
id: string;
|
|
62
|
+
} & Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Define a plugin executor that receives context at runtime.
|
|
65
|
+
* This allows executor definitions to be in separate files while
|
|
66
|
+
* still receiving dynamic values like typeName, generated types, and namespace.
|
|
67
|
+
* @param factory - Function that takes context and returns executor configuration
|
|
68
|
+
* @returns The same factory function (for type inference)
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* // executors/on-create.ts
|
|
72
|
+
* import { withPluginContext } from "@tailor-platform/sdk/plugin";
|
|
73
|
+
* import { createExecutor, recordCreatedTrigger } from "@tailor-platform/sdk";
|
|
74
|
+
* import { getDB } from "@tailor-platform/function-kysely-tailordb";
|
|
75
|
+
*
|
|
76
|
+
* interface MyContext {
|
|
77
|
+
* sourceType: TailorAnyDBType;
|
|
78
|
+
* historyType: TailorAnyDBType;
|
|
79
|
+
* namespace: string;
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* export default withPluginContext<MyContext>((ctx) =>
|
|
83
|
+
* createExecutor({
|
|
84
|
+
* name: `${ctx.sourceType.name.toLowerCase()}-on-create`,
|
|
85
|
+
* trigger: recordCreatedTrigger({ type: ctx.sourceType }),
|
|
86
|
+
* operation: {
|
|
87
|
+
* kind: "function",
|
|
88
|
+
* body: async (args) => {
|
|
89
|
+
* const db = getDB(ctx.namespace);
|
|
90
|
+
* await db.insertInto(ctx.historyType.name).values({
|
|
91
|
+
* recordId: args.newRecord.id,
|
|
92
|
+
* // ...
|
|
93
|
+
* }).execute();
|
|
94
|
+
* },
|
|
95
|
+
* },
|
|
96
|
+
* })
|
|
97
|
+
* );
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare function withPluginContext<Ctx>(factory: PluginExecutorFactory<Ctx>): PluginExecutorFactory<Ctx>;
|
|
101
|
+
//#endregion
|
|
102
|
+
export { PluginDBSchema, PluginExecutorFactory, PluginFunctionArgs, PluginRecord, PluginRecordCreatedArgs, PluginRecordDeletedArgs, PluginRecordUpdatedArgs, withPluginContext };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
//#region src/utils/test/platform-serialize.ts
|
|
3
2
|
/**
|
|
4
3
|
* Validate and serialize a value as it would cross the Platform JSON boundary.
|
|
@@ -175,4 +174,4 @@ function dispatchTriggerWorkflow(name, args, options) {
|
|
|
175
174
|
|
|
176
175
|
//#endregion
|
|
177
176
|
export { getRegisteredWorkflow as a, runRegisteredJob as c, buildJobContext as d, clearWorkflowTestEnv as f, getRegisteredJob as i, runRegisteredWorkflow as l, platformSerialize as m, dispatchTriggerJob as n, registerJob as o, writeWorkflowTestEnv as p, dispatchTriggerWorkflow as r, registerWorkflow as s, TRIGGER_DEFAULT as t, WORKFLOW_TEST_ENV_KEY as u };
|
|
178
|
-
//# sourceMappingURL=registry-
|
|
177
|
+
//# sourceMappingURL=registry-BozuxbPp.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-D0uB0OrK.mjs","names":[],"sources":["../src/utils/test/platform-serialize.ts","../src/configure/services/workflow/test-env-key.ts","../src/configure/services/workflow/registry.ts"],"sourcesContent":["/**\n * Validate and serialize a value as it would cross the Platform JSON boundary.\n *\n * Mirrors the runtime checks the platform performs on workflow arguments,\n * wait payloads, and trigger inputs so that local tests fail in the same\n * places production fails.\n *\n * Throws on:\n * - `NaN` / `Infinity` / `-Infinity` (`JSON.stringify` would silently emit `null`)\n * - `BigInt` (TypeError is thrown by `JSON.stringify`; we emit a clearer message)\n * - Non-plain objects (class instances, including `Date`, `Map`, `Set`, `Error`,\n * and user-defined DTOs whose prototype is not `Object.prototype`)\n *\n * The replacer reads `this[key]` so the check sees the original value before\n * any `toJSON` conversion (e.g. `Date.prototype.toJSON`).\n * @param value - Value to validate and round-trip\n * @returns The JSON-normalized value (undefined/function properties stripped, etc.)\n */\nexport function platformSerialize<T>(value: T): T {\n // Top-level undefined is allowed (jobs may take no input).\n if (value === undefined) return undefined as T;\n\n // Root function/symbol stringify to `undefined`; throw a specific message here.\n if (typeof value === \"function\") {\n throw new TypeError(\"platformSerialize: function is not JSON-serializable at <root>\");\n }\n if (typeof value === \"symbol\") {\n throw new TypeError(\"platformSerialize: Symbol is not JSON-serializable at <root>\");\n }\n\n const serialized = JSON.stringify(value, function (key, val) {\n if (typeof val === \"number\" && !Number.isFinite(val)) {\n throw new TypeError(\n `platformSerialize: non-finite number at ${formatPath(key)}: ${String(val)}`,\n );\n }\n if (typeof val === \"bigint\") {\n throw new TypeError(\n `platformSerialize: BigInt is not JSON-serializable at ${formatPath(key)}`,\n );\n }\n // Look at the pre-toJSON value so Date/Map/Set/etc. can be detected.\n const raw = (this as Record<string, unknown>)[key];\n if (raw !== null && typeof raw === \"object\" && !Array.isArray(raw)) {\n const proto = Object.getPrototypeOf(raw);\n if (proto !== Object.prototype && proto !== null) {\n const ctor = (raw as { constructor?: { name?: string } }).constructor?.name ?? \"anonymous\";\n throw new TypeError(\n `platformSerialize: non-plain object at ${formatPath(key)} (${ctor} instance)`,\n );\n }\n }\n return val;\n });\n\n // `JSON.stringify` returns `undefined` when the root collapses (e.g. a `toJSON`\n // returning `undefined`); parsing that would throw opaquely.\n // JSON.stringify returns undefined for non-serializable values\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (serialized === undefined) {\n throw new TypeError(\"platformSerialize: value is not JSON-serializable at <root>\");\n }\n\n return JSON.parse(serialized) as T;\n}\n\nfunction formatPath(key: string): string {\n return key === \"\" ? \"<root>\" : `\"${key}\"`;\n}\n","/**\n * Typed accessors for the test-time globalThis slot used to pass `env` from\n * `mockWorkflow().setEnv()` (in `@tailor-platform/sdk/vitest`) to\n * `createWorkflowJob().trigger()` bodies. The slot key is private to this\n * module; callers go through the get/set/clear functions below so both sides\n * share the same access path.\n *\n * Lives in its own file (with no `@/` imports) so `vitest/mock.ts` can load\n * it from nested Vitest configs that do not resolve `@/` aliases.\n * @internal\n */\nimport type { TailorEnv, TailorInvoker } from \"../../../runtime/types\";\n\nconst SLOT_KEY = \"__tailorWorkflowTestEnv\";\n\n/**\n * Read the test-time env slot.\n * @returns Current env, or `undefined` when unset.\n * @internal\n */\nexport function readWorkflowTestEnv(): TailorEnv | undefined {\n return (globalThis as unknown as Record<string, TailorEnv | undefined>)[SLOT_KEY];\n}\n\n/**\n * Write the test-time env slot.\n * @param env - Env value to expose to `.trigger()` bodies.\n * @internal\n */\nexport function writeWorkflowTestEnv(env: TailorEnv): void {\n (globalThis as unknown as Record<string, TailorEnv>)[SLOT_KEY] = env;\n}\n\n/**\n * Clear the test-time env slot.\n * @internal\n */\nexport function clearWorkflowTestEnv(): void {\n delete (globalThis as unknown as Record<string, unknown>)[SLOT_KEY];\n}\n\n/**\n * Env-var fallback read by `.trigger()` when `mockWorkflow().setEnv()` is unset.\n * @deprecated Use `mockWorkflow().setEnv()` from `@tailor-platform/sdk/vitest`.\n * @internal\n */\nexport const WORKFLOW_TEST_ENV_KEY = \"TAILOR_TEST_WORKFLOW_ENV\";\n\n// env from `mockWorkflow().setEnv()`, else the deprecated env-var. Shallow-copied\n// to isolate against cross-trigger mutation.\nexport function buildJobContext(): { env: TailorEnv; invoker?: TailorInvoker } {\n const fromGlobal = readWorkflowTestEnv();\n if (fromGlobal !== undefined) return { env: { ...fromGlobal } };\n const raw = process.env[WORKFLOW_TEST_ENV_KEY];\n if (!raw) return { env: {} as TailorEnv };\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (cause) {\n throw new Error(\n `Invalid JSON in ${WORKFLOW_TEST_ENV_KEY}; provide valid JSON or use mockWorkflow().setEnv().`,\n { cause },\n );\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new Error(\n `${WORKFLOW_TEST_ENV_KEY} must be a JSON object; provide a record or use mockWorkflow().setEnv().`,\n );\n }\n return { env: { ...(parsed as TailorEnv) } };\n}\n","import { platformSerialize } from \"#/utils/test/platform-serialize\";\nimport { buildJobContext } from \"./test-env-key\";\nimport type { TailorEnv, TailorInvoker } from \"#/runtime/types\";\n\n/**\n * Body signature shared by workflow jobs at registry-write time.\n * The user's `createWorkflowJob`/`createWorkflow` body uses concrete types,\n * but the registry erases them for storage.\n */\nexport type RegisteredJobBody = (\n args: unknown,\n context: { env: TailorEnv; invoker?: TailorInvoker },\n) => unknown | Promise<unknown>;\n\nexport interface RegisteredWorkflow {\n mainJobName: string;\n}\n\nconst JOB_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:job-registry\");\nconst WORKFLOW_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:workflow-registry\");\n\ntype PlatformWorkflow = {\n triggerWorkflow: (name: string, args?: unknown, options?: unknown) => Promise<string>;\n triggerJobFunction: (name: string, args?: unknown) => unknown;\n};\n\ntype GlobalWithRegistry = typeof globalThis & {\n [JOB_REGISTRY_KEY]?: Map<string, RegisteredJobBody>;\n [WORKFLOW_REGISTRY_KEY]?: Map<string, RegisteredWorkflow>;\n tailor?: { workflow?: PlatformWorkflow };\n};\n\nfunction jobs(): Map<string, RegisteredJobBody> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[JOB_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[JOB_REGISTRY_KEY] = map;\n }\n return map;\n}\n\nfunction workflows(): Map<string, RegisteredWorkflow> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[WORKFLOW_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[WORKFLOW_REGISTRY_KEY] = map;\n }\n return map;\n}\n\n/**\n * Register a job body keyed by job name. Called as a side effect by\n * `createWorkflowJob` so the vitest mock can execute the body when\n * `globalThis.tailor.workflow.triggerJobFunction(name, args)` is invoked.\n *\n * In production builds the bundler rewrites `.trigger()` calls so this registry\n * is never read; the gated write is dropped as dead code.\n * @param name - Job name\n * @param body - Job body function\n */\nexport function registerJob(name: string, body: RegisteredJobBody): void {\n jobs().set(name, body);\n}\n\n/**\n * Look up a registered job body by name.\n * @param name - Job name\n * @returns The registered body, or undefined when no job is registered\n */\nexport function getRegisteredJob(name: string): RegisteredJobBody | undefined {\n return jobs().get(name);\n}\n\n/**\n * Register a workflow's main job name so the mock can run the workflow locally.\n * @param name - Workflow name\n * @param mainJobName - Name of the workflow's main job\n */\nexport function registerWorkflow(name: string, mainJobName: string): void {\n workflows().set(name, { mainJobName });\n}\n\n/**\n * Look up a registered workflow by name.\n * @param name - Workflow name\n * @returns The registered workflow, or undefined\n */\nexport function getRegisteredWorkflow(name: string): RegisteredWorkflow | undefined {\n return workflows().get(name);\n}\n\nfunction currentPlatformWorkflow(): PlatformWorkflow | undefined {\n // globalThis may not have the tailor property at runtime\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n return (globalThis as GlobalWithRegistry).tailor?.workflow;\n}\n\n// A valid placeholder UUID, so callers that validate the execution id behave the\n// same locally as against the platform.\nexport const TRIGGER_DEFAULT = \"00000000-0000-4000-8000-000000000000\";\n\nfunction serializeReturn(out: unknown): unknown {\n return out instanceof Promise ? out.then((v) => platformSerialize(v)) : platformSerialize(out);\n}\n\n// Runs the registered body across the platform JSON boundary. Shared by the\n// `tailor-runtime` default runner and the no-shim `.trigger()` fallback below.\nexport function runRegisteredJob(name: string, args?: unknown): unknown {\n const body = getRegisteredJob(name);\n const out = body ? body(platformSerialize(args), buildJobContext()) : null;\n return serializeReturn(out);\n}\n\nexport async function runRegisteredWorkflow(name: string, args?: unknown): Promise<string> {\n const workflow = getRegisteredWorkflow(name);\n if (workflow) await runRegisteredJob(workflow.mainJobName, args);\n return TRIGGER_DEFAULT;\n}\n\n// `.trigger()` routes through the installed `tailor.workflow` shim, falling back\n// to running the registered body/workflow locally when none is installed.\nexport function dispatchTriggerJob(name: string, args?: unknown): unknown {\n const workflow = currentPlatformWorkflow();\n return workflow ? workflow.triggerJobFunction(name, args) : runRegisteredJob(name, args);\n}\n\nexport function dispatchTriggerWorkflow(\n name: string,\n args?: unknown,\n options?: unknown,\n): Promise<string> {\n const workflow = currentPlatformWorkflow();\n return workflow\n ? workflow.triggerWorkflow(name, args, options)\n : runRegisteredWorkflow(name, args);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,kBAAqB,OAAa;CAEhD,IAAI,UAAU,QAAW,OAAO;CAGhC,IAAI,OAAO,UAAU,YACnB,MAAM,IAAI,UAAU,gEAAgE;CAEtF,IAAI,OAAO,UAAU,UACnB,MAAM,IAAI,UAAU,8DAA8D;CAGpF,MAAM,aAAa,KAAK,UAAU,OAAO,SAAU,KAAK,KAAK;EAC3D,IAAI,OAAO,QAAQ,YAAY,CAAC,OAAO,SAAS,GAAG,GACjD,MAAM,IAAI,UACR,2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B,MAAc,MAAiC;CACzF,MAAM,WAAW,sBAAsB,IAAI;CAC3C,IAAI,UAAU,MAAM,iBAAiB,SAAS,aAAa,IAAI;CAC/D,OAAO;AACT;AAIA,SAAgB,mBAAmB,MAAc,MAAyB;CACxE,MAAM,WAAW,wBAAwB;CACzC,OAAO,WAAW,SAAS,mBAAmB,MAAM,IAAI,IAAI,iBAAiB,MAAM,IAAI;AACzF;AAEA,SAAgB,wBACd,MACA,MACA,SACiB;CACjB,MAAM,WAAW,wBAAwB;CACzC,OAAO,WACH,SAAS,gBAAgB,MAAM,MAAM,OAAO,IAC5C,sBAAsB,MAAM,IAAI;AACtC"}
|
|
1
|
+
{"version":3,"file":"registry-BozuxbPp.mjs","names":[],"sources":["../src/utils/test/platform-serialize.ts","../src/configure/services/workflow/test-env-key.ts","../src/configure/services/workflow/registry.ts"],"sourcesContent":["/**\n * Validate and serialize a value as it would cross the Platform JSON boundary.\n *\n * Mirrors the runtime checks the platform performs on workflow arguments,\n * wait payloads, and trigger inputs so that local tests fail in the same\n * places production fails.\n *\n * Throws on:\n * - `NaN` / `Infinity` / `-Infinity` (`JSON.stringify` would silently emit `null`)\n * - `BigInt` (TypeError is thrown by `JSON.stringify`; we emit a clearer message)\n * - Non-plain objects (class instances, including `Date`, `Map`, `Set`, `Error`,\n * and user-defined DTOs whose prototype is not `Object.prototype`)\n *\n * The replacer reads `this[key]` so the check sees the original value before\n * any `toJSON` conversion (e.g. `Date.prototype.toJSON`).\n * @param value - Value to validate and round-trip\n * @returns The JSON-normalized value (undefined/function properties stripped, etc.)\n */\nexport function platformSerialize<T>(value: T): T {\n // Top-level undefined is allowed (jobs may take no input).\n if (value === undefined) return undefined as T;\n\n // Root function/symbol stringify to `undefined`; throw a specific message here.\n if (typeof value === \"function\") {\n throw new TypeError(\"platformSerialize: function is not JSON-serializable at <root>\");\n }\n if (typeof value === \"symbol\") {\n throw new TypeError(\"platformSerialize: Symbol is not JSON-serializable at <root>\");\n }\n\n const serialized = JSON.stringify(value, function (key, val) {\n if (typeof val === \"number\" && !Number.isFinite(val)) {\n throw new TypeError(\n `platformSerialize: non-finite number at ${formatPath(key)}: ${String(val)}`,\n );\n }\n if (typeof val === \"bigint\") {\n throw new TypeError(\n `platformSerialize: BigInt is not JSON-serializable at ${formatPath(key)}`,\n );\n }\n // Look at the pre-toJSON value so Date/Map/Set/etc. can be detected.\n const raw = (this as Record<string, unknown>)[key];\n if (raw !== null && typeof raw === \"object\" && !Array.isArray(raw)) {\n const proto = Object.getPrototypeOf(raw);\n if (proto !== Object.prototype && proto !== null) {\n const ctor = (raw as { constructor?: { name?: string } }).constructor?.name ?? \"anonymous\";\n throw new TypeError(\n `platformSerialize: non-plain object at ${formatPath(key)} (${ctor} instance)`,\n );\n }\n }\n return val;\n });\n\n // `JSON.stringify` returns `undefined` when the root collapses (e.g. a `toJSON`\n // returning `undefined`); parsing that would throw opaquely.\n // JSON.stringify returns undefined for non-serializable values\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n if (serialized === undefined) {\n throw new TypeError(\"platformSerialize: value is not JSON-serializable at <root>\");\n }\n\n return JSON.parse(serialized) as T;\n}\n\nfunction formatPath(key: string): string {\n return key === \"\" ? \"<root>\" : `\"${key}\"`;\n}\n","/**\n * Typed accessors for the test-time globalThis slot used to pass `env` from\n * `mockWorkflow().setEnv()` (in `@tailor-platform/sdk/vitest`) to\n * `createWorkflowJob().trigger()` bodies. The slot key is private to this\n * module; callers go through the get/set/clear functions below so both sides\n * share the same access path.\n *\n * Lives in its own file (with no `@/` imports) so `vitest/mock.ts` can load\n * it from nested Vitest configs that do not resolve `@/` aliases.\n * @internal\n */\nimport type { TailorEnv, TailorInvoker } from \"../../../runtime/types\";\n\nconst SLOT_KEY = \"__tailorWorkflowTestEnv\";\n\n/**\n * Read the test-time env slot.\n * @returns Current env, or `undefined` when unset.\n * @internal\n */\nexport function readWorkflowTestEnv(): TailorEnv | undefined {\n return (globalThis as unknown as Record<string, TailorEnv | undefined>)[SLOT_KEY];\n}\n\n/**\n * Write the test-time env slot.\n * @param env - Env value to expose to `.trigger()` bodies.\n * @internal\n */\nexport function writeWorkflowTestEnv(env: TailorEnv): void {\n (globalThis as unknown as Record<string, TailorEnv>)[SLOT_KEY] = env;\n}\n\n/**\n * Clear the test-time env slot.\n * @internal\n */\nexport function clearWorkflowTestEnv(): void {\n delete (globalThis as unknown as Record<string, unknown>)[SLOT_KEY];\n}\n\n/**\n * Env-var fallback read by `.trigger()` when `mockWorkflow().setEnv()` is unset.\n * @deprecated Use `mockWorkflow().setEnv()` from `@tailor-platform/sdk/vitest`.\n * @internal\n */\nexport const WORKFLOW_TEST_ENV_KEY = \"TAILOR_TEST_WORKFLOW_ENV\";\n\n// env from `mockWorkflow().setEnv()`, else the deprecated env-var. Shallow-copied\n// to isolate against cross-trigger mutation.\nexport function buildJobContext(): { env: TailorEnv; invoker?: TailorInvoker } {\n const fromGlobal = readWorkflowTestEnv();\n if (fromGlobal !== undefined) return { env: { ...fromGlobal } };\n const raw = process.env[WORKFLOW_TEST_ENV_KEY];\n if (!raw) return { env: {} as TailorEnv };\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (cause) {\n throw new Error(\n `Invalid JSON in ${WORKFLOW_TEST_ENV_KEY}; provide valid JSON or use mockWorkflow().setEnv().`,\n { cause },\n );\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new Error(\n `${WORKFLOW_TEST_ENV_KEY} must be a JSON object; provide a record or use mockWorkflow().setEnv().`,\n );\n }\n return { env: { ...(parsed as TailorEnv) } };\n}\n","import { platformSerialize } from \"#/utils/test/platform-serialize\";\nimport { buildJobContext } from \"./test-env-key\";\nimport type { TailorEnv, TailorInvoker } from \"#/runtime/types\";\n\n/**\n * Body signature shared by workflow jobs at registry-write time.\n * The user's `createWorkflowJob`/`createWorkflow` body uses concrete types,\n * but the registry erases them for storage.\n */\nexport type RegisteredJobBody = (\n args: unknown,\n context: { env: TailorEnv; invoker?: TailorInvoker },\n) => unknown | Promise<unknown>;\n\nexport interface RegisteredWorkflow {\n mainJobName: string;\n}\n\nconst JOB_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:job-registry\");\nconst WORKFLOW_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:workflow-registry\");\n\ntype PlatformWorkflow = {\n triggerWorkflow: (name: string, args?: unknown, options?: unknown) => Promise<string>;\n triggerJobFunction: (name: string, args?: unknown) => unknown;\n};\n\ntype GlobalWithRegistry = typeof globalThis & {\n [JOB_REGISTRY_KEY]?: Map<string, RegisteredJobBody>;\n [WORKFLOW_REGISTRY_KEY]?: Map<string, RegisteredWorkflow>;\n tailor?: { workflow?: PlatformWorkflow };\n};\n\nfunction jobs(): Map<string, RegisteredJobBody> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[JOB_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[JOB_REGISTRY_KEY] = map;\n }\n return map;\n}\n\nfunction workflows(): Map<string, RegisteredWorkflow> {\n const g = globalThis as GlobalWithRegistry;\n let map = g[WORKFLOW_REGISTRY_KEY];\n if (!map) {\n map = new Map();\n g[WORKFLOW_REGISTRY_KEY] = map;\n }\n return map;\n}\n\n/**\n * Register a job body keyed by job name. Called as a side effect by\n * `createWorkflowJob` so the vitest mock can execute the body when\n * `globalThis.tailor.workflow.triggerJobFunction(name, args)` is invoked.\n *\n * In production builds the bundler rewrites `.trigger()` calls so this registry\n * is never read; the gated write is dropped as dead code.\n * @param name - Job name\n * @param body - Job body function\n */\nexport function registerJob(name: string, body: RegisteredJobBody): void {\n jobs().set(name, body);\n}\n\n/**\n * Look up a registered job body by name.\n * @param name - Job name\n * @returns The registered body, or undefined when no job is registered\n */\nexport function getRegisteredJob(name: string): RegisteredJobBody | undefined {\n return jobs().get(name);\n}\n\n/**\n * Register a workflow's main job name so the mock can run the workflow locally.\n * @param name - Workflow name\n * @param mainJobName - Name of the workflow's main job\n */\nexport function registerWorkflow(name: string, mainJobName: string): void {\n workflows().set(name, { mainJobName });\n}\n\n/**\n * Look up a registered workflow by name.\n * @param name - Workflow name\n * @returns The registered workflow, or undefined\n */\nexport function getRegisteredWorkflow(name: string): RegisteredWorkflow | undefined {\n return workflows().get(name);\n}\n\nfunction currentPlatformWorkflow(): PlatformWorkflow | undefined {\n // globalThis may not have the tailor property at runtime\n // oxlint-disable-next-line typescript/no-unnecessary-condition\n return (globalThis as GlobalWithRegistry).tailor?.workflow;\n}\n\n// A valid placeholder UUID, so callers that validate the execution id behave the\n// same locally as against the platform.\nexport const TRIGGER_DEFAULT = \"00000000-0000-4000-8000-000000000000\";\n\nfunction serializeReturn(out: unknown): unknown {\n return out instanceof Promise ? out.then((v) => platformSerialize(v)) : platformSerialize(out);\n}\n\n// Runs the registered body across the platform JSON boundary. Shared by the\n// `tailor-runtime` default runner and the no-shim `.trigger()` fallback below.\nexport function runRegisteredJob(name: string, args?: unknown): unknown {\n const body = getRegisteredJob(name);\n const out = body ? body(platformSerialize(args), buildJobContext()) : null;\n return serializeReturn(out);\n}\n\nexport async function runRegisteredWorkflow(name: string, args?: unknown): Promise<string> {\n const workflow = getRegisteredWorkflow(name);\n if (workflow) await runRegisteredJob(workflow.mainJobName, args);\n return TRIGGER_DEFAULT;\n}\n\n// `.trigger()` routes through the installed `tailor.workflow` shim, falling back\n// to running the registered body/workflow locally when none is installed.\nexport function dispatchTriggerJob(name: string, args?: unknown): unknown {\n const workflow = currentPlatformWorkflow();\n return workflow ? workflow.triggerJobFunction(name, args) : runRegisteredJob(name, args);\n}\n\nexport function dispatchTriggerWorkflow(\n name: string,\n args?: unknown,\n options?: unknown,\n): Promise<string> {\n const workflow = currentPlatformWorkflow();\n return workflow\n ? workflow.triggerWorkflow(name, args, options)\n : runRegisteredWorkflow(name, args);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,SAAgB,kBAAqB,OAAa;CAEhD,IAAI,UAAU,QAAW,OAAO;CAGhC,IAAI,OAAO,UAAU,YACn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M,kBAAkB,CAAC,CAAC,IAAI,kBAAkB,GAAG;AAC/F;AAIA,SAAgB,iBAAiB,MAAc,MAAyB;CACtE,MAAM,OAAO,iBAAiB,IAAI;CAElC,OAAO,gBADK,OAAO,KAAK,kBAAkB,IAAI,GAAG,gBAAgB,CAAC,IAAI,IAC5C;AAC5B;AAEA,eAAsB,sBAAsB,MAAc,MAAiC;CACzF,MAAM,WAAW,sBAAsB,IAAI;CAC3C,IAAI,UAAU,MAAM,iBAAiB,SAAS,aAAa,IAAI;CAC/D,OAAO;AACT;AAIA,SAAgB,mBAAmB,MAAc,MAAyB;CACxE,MAAM,WAAW,wBAAwB;CACzC,OAAO,WAAW,SAAS,mBAAmB,MAAM,IAAI,IAAI,iBAAiB,MAAM,IAAI;AACzF;AAEA,SAAgB,wBACd,MACA,MACA,SACiB;CACjB,MAAM,WAAW,wBAAwB;CACzC,OAAO,WACH,SAAS,gBAAgB,MAAM,MAAM,OAAO,IAC5C,sBAAsB,MAAM,IAAI;AACtC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as assertDefined } from "./assert-CKfwrmCV.mjs";
|
|
1
|
+
import { t as assertDefined } from "./assert-DBxo8jPo.mjs";
|
|
3
2
|
import { GraphQLError, Lexer, Source, TokenKind } from "graphql";
|
|
4
3
|
import { getSegments } from "sql-highlight";
|
|
5
4
|
|
|
@@ -248,4 +247,4 @@ function replTransform(state, event) {
|
|
|
248
247
|
|
|
249
248
|
//#endregion
|
|
250
249
|
export { highlightGraphqlLine, highlightSqlLine, replTransform };
|
|
251
|
-
//# sourceMappingURL=repl-editor-
|
|
250
|
+
//# sourceMappingURL=repl-editor-BmQOyZJd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl-editor-DD5YP5mt.mjs","names":[],"sources":["../src/cli/query/repl-editor.ts"],"sourcesContent":["import { GraphQLError, Lexer, Source, TokenKind } from \"graphql\";\nimport { getSegments } from \"sql-highlight\";\nimport { assertDefined } from \"#/utils/assert\";\nimport type { TransformEvent, TransformState } from \"@toiroakr/read-multiline\";\n\n// ANSI colour sequences. Kept inline (rather than going through `node:util`\n// styleText) so that tests running outside a TTY still produce deterministic\n// escape sequences regardless of detected colour support.\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst MAGENTA = \"\\x1b[35m\";\nconst YELLOW = \"\\x1b[33m\";\nconst BRIGHT_GREEN = \"\\x1b[92m\";\nconst CYAN = \"\\x1b[36m\";\nconst BRIGHT_BLUE = \"\\x1b[94m\";\nconst BOLD_CYAN = \"\\x1b[1;36m\";\nconst BOLD_MAGENTA = \"\\x1b[1;35m\";\nconst ITALIC_YELLOW = \"\\x1b[3;33m\";\nconst GREEN = \"\\x1b[32m\";\nconst DIM = \"\\x1b[90m\";\nconst DIM_YELLOW = \"\\x1b[2;33m\";\n\nconst SQL_STYLE_MAP: Record<string, string> = {\n keyword: BLUE,\n function: MAGENTA,\n identifier: YELLOW,\n string: BRIGHT_GREEN,\n number: CYAN,\n bracket: DIM_YELLOW,\n special: DIM,\n};\n\n/**\n * Highlight a single SQL line using the `sql-highlight` tokenizer.\n * @param line - SQL text for a single editor line\n * @returns ANSI-decorated line safe for terminal output\n */\nexport function highlightSqlLine(line: string): string {\n const segments = getSegments(line);\n let result = \"\";\n for (const seg of segments) {\n const style = SQL_STYLE_MAP[seg.name];\n result += style ? style + seg.content + RESET : seg.content;\n }\n return result;\n}\n\nconst GQL_KEYWORDS = new Set([\n \"query\",\n \"mutation\",\n \"subscription\",\n \"fragment\",\n \"on\",\n \"type\",\n \"input\",\n \"enum\",\n \"interface\",\n \"union\",\n \"scalar\",\n \"extend\",\n \"schema\",\n \"directive\",\n \"implements\",\n]);\n\n// Keywords that introduce a definition name (next NAME token is the def).\nconst GQL_DEF_KEYWORDS = new Set([\"query\", \"mutation\", \"subscription\", \"fragment\"]);\n\nconst GQL_BUILTINS = new Set([\"true\", \"false\", \"null\"]);\n\n/**\n * Highlight a single GraphQL line using the official `graphql` Lexer. Tracks\n * paren depth and the previous token to provide semantic-level colouring\n * (field names vs argument names vs types).\n * @param line - GraphQL text for a single editor line\n * @returns ANSI-decorated line, or the input unchanged when the lexer rejects it\n */\nexport function highlightGraphqlLine(line: string): string {\n if (line.trimStart().startsWith(\"#\")) {\n return `${DIM}${line}${RESET}`;\n }\n\n try {\n const source = new Source(line);\n const lexer = new Lexer(source);\n let result = \"\";\n let pos = 0;\n\n let parenDepth = 0;\n let prevKind: string = \"\";\n let prevText = \"\";\n let afterColon = false;\n\n let token = lexer.advance();\n while (token.kind !== TokenKind.EOF) {\n if (token.start > pos) {\n result += line.slice(pos, token.start);\n }\n\n const text = line.slice(token.start, token.end);\n switch (token.kind) {\n case TokenKind.NAME: {\n if (prevKind === TokenKind.DOLLAR) {\n result += `${MAGENTA}${text}${RESET}`;\n } else if (prevKind === TokenKind.AT) {\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n } else if (GQL_BUILTINS.has(text) || GQL_KEYWORDS.has(text)) {\n result += `${BLUE}${text}${RESET}`;\n } else if (GQL_DEF_KEYWORDS.has(prevText)) {\n result += `${BOLD_CYAN}${text}${RESET}`;\n } else if (afterColon) {\n result += `${CYAN}${text}${RESET}`;\n } else if (parenDepth > 0) {\n result += `${ITALIC_YELLOW}${text}${RESET}`;\n } else {\n result += `${BRIGHT_BLUE}${text}${RESET}`;\n }\n afterColon = false;\n break;\n }\n case TokenKind.INT:\n case TokenKind.FLOAT:\n result += `${BLUE}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n result += `${GREEN}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.DOLLAR:\n result += `${MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.AT:\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACE_L:\n case TokenKind.BRACE_R:\n result += `${YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_L:\n parenDepth += 1;\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_R:\n parenDepth = Math.max(0, parenDepth - 1);\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACKET_L:\n case TokenKind.BRACKET_R:\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.COLON:\n result += `${DIM}${text}${RESET}`;\n afterColon = true;\n break;\n case TokenKind.BANG:\n case TokenKind.EQUALS:\n case TokenKind.PIPE:\n case TokenKind.AMP:\n case TokenKind.SPREAD:\n result += `${DIM}${text}${RESET}`;\n afterColon = false;\n break;\n default:\n result += text;\n afterColon = false;\n }\n\n prevKind = token.kind;\n prevText = text;\n pos = token.end;\n token = lexer.advance();\n }\n\n if (pos < line.length) {\n result += line.slice(pos);\n }\n return result;\n } catch (error) {\n // The lexer throws GraphQLError on partial or invalid input (e.g. an\n // unterminated string while the user is still typing). Fall back to the\n // raw line so the editor keeps rendering without colour until the input\n // is valid. Any other error is a real bug and should surface.\n if (error instanceof GraphQLError) {\n return line;\n }\n throw error;\n }\n}\n\nconst BRACKET_PAIRS: Record<string, string> = { \"(\": \")\", \"[\": \"]\", \"{\": \"}\" };\nconst CLOSE_BRACKETS = new Set(Object.values(BRACKET_PAIRS));\n\n/**\n * Apply auto-close brackets and auto-indent on newline. Works for both SQL\n * and GraphQL because both languages share the `()`, `[]`, `{}` bracket set.\n * @param state - Editor state after the last edit\n * @param event - Event describing the edit that just occurred\n * @returns A new editor state to apply, or `undefined` to leave the state unchanged\n */\nexport function replTransform(\n state: TransformState,\n event: TransformEvent,\n): TransformState | undefined {\n const { lines, row, col } = state;\n\n if (event.type === \"insert\" && event.char in BRACKET_PAIRS) {\n const close = BRACKET_PAIRS[event.char];\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const newLine = line.slice(0, col) + close + line.slice(col);\n return { lines: lines.with(row, newLine), row, col };\n }\n\n if (event.type === \"insert\" && CLOSE_BRACKETS.has(event.char)) {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n if (line[col] === event.char) {\n const newLine = line.slice(0, col) + line.slice(col + 1);\n return { lines: lines.with(row, newLine), row, col };\n }\n }\n\n if (event.type === \"backspace\") {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const beforeCursor = line.slice(0, col);\n if (beforeCursor.length >= 1 && /^ +$/.test(beforeCursor)) {\n const newIndent = beforeCursor.slice(0, -1);\n const newLine = newIndent + line.slice(col);\n return { lines: lines.with(row, newLine), row, col: newIndent.length };\n }\n }\n\n if (event.type === \"newline\" && row > 0) {\n const prevLine = assertDefined(lines[row - 1], `line at row ${row - 1} missing`);\n const baseIndent = prevLine.match(/^(\\s*)/)?.[1] ?? \"\";\n const endsWithOpen = /[{([]$/.test(prevLine.trimEnd());\n const currentLine = assertDefined(lines[row], `line at row ${row} missing`);\n const startsWithClose = /^[}\\])]/.test(currentLine.trimStart());\n\n if (endsWithOpen && startsWithClose) {\n // Bracket expansion: the cursor sits between a matching open/close\n // pair (e.g. `{|}`). Expand into a three-line block with the cursor\n // on an indented middle line.\n const innerIndent = baseIndent + \" \";\n const newLines = lines\n .with(row, innerIndent)\n .toSpliced(row + 1, 0, baseIndent + currentLine.trimStart());\n return { lines: newLines, row, col: innerIndent.length };\n }\n if (endsWithOpen) {\n // A lone open bracket on the previous line: drop an extra indent for\n // the new line and auto-insert the matching closing bracket below.\n const openChar = prevLine.trimEnd().slice(-1);\n const closeChar = BRACKET_PAIRS[openChar] ?? \"}\";\n const indent = baseIndent + \" \";\n const newLines = lines\n .with(row, indent + currentLine)\n .toSpliced(row + 1, 0, baseIndent + closeChar);\n return { lines: newLines, row, col: indent.length };\n }\n if (baseIndent && col === 0) {\n return { lines: lines.with(row, baseIndent + currentLine), row, col: baseIndent.length };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;AAQA,MAAM,QAAQ;AACd,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Kind } from \"graphql\";\nimport { getSegments } from \"sql-highlight\";\nimport { assertDefined } from \"#/utils/assert\";\nimport type { TransformEvent, TransformState } from \"@toiroakr/read-multiline\";\n\n// ANSI colour sequences. Kept inline (rather than going through `node:util`\n// styleText) so that tests running outside a TTY still produce deterministic\n// escape sequences regardless of detected colour support.\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst MAGENTA = \"\\x1b[35m\";\nconst YELLOW = \"\\x1b[33m\";\nconst BRIGHT_GREEN = \"\\x1b[92m\";\nconst CYAN = \"\\x1b[36m\";\nconst BRIGHT_BLUE = \"\\x1b[94m\";\nconst BOLD_CYAN = \"\\x1b[1;36m\";\nconst BOLD_MAGENTA = \"\\x1b[1;35m\";\nconst ITALIC_YELLOW = \"\\x1b[3;33m\";\nconst GREEN = \"\\x1b[32m\";\nconst DIM = \"\\x1b[90m\";\nconst DIM_YELLOW = \"\\x1b[2;33m\";\n\nconst SQL_STYLE_MAP: Record<string, string> = {\n keyword: BLUE,\n function: MAGENTA,\n identifier: YELLOW,\n string: BRIGHT_GREEN,\n number: CYAN,\n bracket: DIM_YELLOW,\n special: DIM,\n};\n\n/**\n * Highlight a single SQL line using the `sql-highlight` tokenizer.\n * @param line - SQL text for a single editor line\n * @returns ANSI-decorated line safe for terminal output\n */\nexport function highlightSqlLine(line: string): string {\n const segments = getSegments(line);\n let result = \"\";\n for (const seg of segments) {\n const style = SQL_STYLE_MAP[seg.name];\n result += style ? style + seg.content + RESET : seg.content;\n }\n return result;\n}\n\nconst GQL_KEYWORDS = new Set([\n \"query\",\n \"mutation\",\n \"subscription\",\n \"fragment\",\n \"on\",\n \"type\",\n \"input\",\n \"enum\",\n \"interface\",\n \"union\",\n \"scalar\",\n \"extend\",\n \"schema\",\n \"directive\",\n \"implements\",\n]);\n\n// Keywords that introduce a definition name (next NAME token is the def).\nconst GQL_DEF_KEYWORDS = new Set([\"query\", \"mutation\", \"subscription\", \"fragment\"]);\n\nconst GQL_BUILTINS = new Set([\"true\", \"false\", \"null\"]);\n\n/**\n * Highlight a single GraphQL line using the official `graphql` Lexer. Tracks\n * paren depth and the previous token to provide semantic-level colouring\n * (field names vs argument names vs types).\n * @param line - GraphQL text for a single editor line\n * @returns ANSI-decorated line, or the input unchanged when the lexer rejects it\n */\nexport function highlightGraphqlLine(line: string): string {\n if (line.trimStart().startsWith(\"#\")) {\n return `${DIM}${line}${RESET}`;\n }\n\n try {\n const source = new Source(line);\n const lexer = new Lexer(source);\n let result = \"\";\n let pos = 0;\n\n let parenDepth = 0;\n let prevKind: string = \"\";\n let prevText = \"\";\n let afterColon = false;\n\n let token = lexer.advance();\n while (token.kind !== TokenKind.EOF) {\n if (token.start > pos) {\n result += line.slice(pos, token.start);\n }\n\n const text = line.slice(token.start, token.end);\n switch (token.kind) {\n case TokenKind.NAME: {\n if (prevKind === TokenKind.DOLLAR) {\n result += `${MAGENTA}${text}${RESET}`;\n } else if (prevKind === TokenKind.AT) {\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n } else if (GQL_BUILTINS.has(text) || GQL_KEYWORDS.has(text)) {\n result += `${BLUE}${text}${RESET}`;\n } else if (GQL_DEF_KEYWORDS.has(prevText)) {\n result += `${BOLD_CYAN}${text}${RESET}`;\n } else if (afterColon) {\n result += `${CYAN}${text}${RESET}`;\n } else if (parenDepth > 0) {\n result += `${ITALIC_YELLOW}${text}${RESET}`;\n } else {\n result += `${BRIGHT_BLUE}${text}${RESET}`;\n }\n afterColon = false;\n break;\n }\n case TokenKind.INT:\n case TokenKind.FLOAT:\n result += `${BLUE}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n result += `${GREEN}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.DOLLAR:\n result += `${MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.AT:\n result += `${BOLD_MAGENTA}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACE_L:\n case TokenKind.BRACE_R:\n result += `${YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_L:\n parenDepth += 1;\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.PAREN_R:\n parenDepth = Math.max(0, parenDepth - 1);\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.BRACKET_L:\n case TokenKind.BRACKET_R:\n result += `${DIM_YELLOW}${text}${RESET}`;\n afterColon = false;\n break;\n case TokenKind.COLON:\n result += `${DIM}${text}${RESET}`;\n afterColon = true;\n break;\n case TokenKind.BANG:\n case TokenKind.EQUALS:\n case TokenKind.PIPE:\n case TokenKind.AMP:\n case TokenKind.SPREAD:\n result += `${DIM}${text}${RESET}`;\n afterColon = false;\n break;\n default:\n result += text;\n afterColon = false;\n }\n\n prevKind = token.kind;\n prevText = text;\n pos = token.end;\n token = lexer.advance();\n }\n\n if (pos < line.length) {\n result += line.slice(pos);\n }\n return result;\n } catch (error) {\n // The lexer throws GraphQLError on partial or invalid input (e.g. an\n // unterminated string while the user is still typing). Fall back to the\n // raw line so the editor keeps rendering without colour until the input\n // is valid. Any other error is a real bug and should surface.\n if (error instanceof GraphQLError) {\n return line;\n }\n throw error;\n }\n}\n\nconst BRACKET_PAIRS: Record<string, string> = { \"(\": \")\", \"[\": \"]\", \"{\": \"}\" };\nconst CLOSE_BRACKETS = new Set(Object.values(BRACKET_PAIRS));\n\n/**\n * Apply auto-close brackets and auto-indent on newline. Works for both SQL\n * and GraphQL because both languages share the `()`, `[]`, `{}` bracket set.\n * @param state - Editor state after the last edit\n * @param event - Event describing the edit that just occurred\n * @returns A new editor state to apply, or `undefined` to leave the state unchanged\n */\nexport function replTransform(\n state: TransformState,\n event: TransformEvent,\n): TransformState | undefined {\n const { lines, row, col } = state;\n\n if (event.type === \"insert\" && event.char in BRACKET_PAIRS) {\n const close = BRACKET_PAIRS[event.char];\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const newLine = line.slice(0, col) + close + line.slice(col);\n return { lines: lines.with(row, newLine), row, col };\n }\n\n if (event.type === \"insert\" && CLOSE_BRACKETS.has(event.char)) {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n if (line[col] === event.char) {\n const newLine = line.slice(0, col) + line.slice(col + 1);\n return { lines: lines.with(row, newLine), row, col };\n }\n }\n\n if (event.type === \"backspace\") {\n const line = assertDefined(lines[row], `line at row ${row} missing`);\n const beforeCursor = line.slice(0, col);\n if (beforeCursor.length >= 1 && /^ +$/.test(beforeCursor)) {\n const newIndent = beforeCursor.slice(0, -1);\n const newLine = newIndent + line.slice(col);\n return { lines: lines.with(row, newLine), row, col: newIndent.length };\n }\n }\n\n if (event.type === \"newline\" && row > 0) {\n const prevLine = assertDefined(lines[row - 1], `line at row ${row - 1} missing`);\n const baseIndent = prevLine.match(/^(\\s*)/)?.[1] ?? \"\";\n const endsWithOpen = /[{([]$/.test(prevLine.trimEnd());\n const currentLine = assertDefined(lines[row], `line at row ${row} missing`);\n const startsWithClose = /^[}\\])]/.test(currentLine.trimStart());\n\n if (endsWithOpen && startsWithClose) {\n // Bracket expansion: the cursor sits between a matching open/close\n // pair (e.g. `{|}`). Expand into a three-line block with the cursor\n // on an indented middle line.\n const innerIndent = baseIndent + \" \";\n const newLines = lines\n .with(row, innerIndent)\n .toSpliced(row + 1, 0, baseIndent + currentLine.trimStart());\n return { lines: newLines, row, col: innerIndent.length };\n }\n if (endsWithOpen) {\n // A lone open bracket on the previous line: drop an extra indent for\n // the new line and auto-insert the matching closing bracket below.\n const openChar = prevLine.trimEnd().slice(-1);\n const closeChar = BRACKET_PAIRS[openChar] ?? \"}\";\n const indent = baseIndent + \" \";\n const newLines = lines\n .with(row, indent + currentLine)\n .toSpliced(row + 1, 0, baseIndent + closeChar);\n return { lines: newLines, row, col: indent.length };\n }\n if (baseIndent && col === 0) {\n return { lines: lines.with(row, baseIndent + currentLine), row, col: baseIndent.length };\n }\n }\n\n return undefined;\n}\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
|
+
|
|
3
|
+
//#region src/runtime/aigateway.d.ts
|
|
4
|
+
declare namespace aigateway_d_exports {
|
|
5
|
+
export { GetAIGatewayResult, TailorAigatewayAPI, get };
|
|
6
|
+
}
|
|
7
|
+
/** Result of {@link TailorAigatewayAPI.get}. */
|
|
8
|
+
interface GetAIGatewayResult {
|
|
9
|
+
/** The platform-assigned URL of the AI Gateway. */
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Platform API surface for `tailor.aigateway`. Describes the shape the
|
|
14
|
+
* platform runtime injects on `globalThis.tailor.aigateway`.
|
|
15
|
+
*
|
|
16
|
+
* Each method below is also re-exported as a top-level named export from this
|
|
17
|
+
* module so callers can either `import * as aigateway from
|
|
18
|
+
* "@tailor-platform/sdk/runtime/aigateway"` or pick individual methods.
|
|
19
|
+
*/
|
|
20
|
+
interface TailorAigatewayAPI {
|
|
21
|
+
/**
|
|
22
|
+
* Resolves an AI Gateway defined in the caller's own workspace.
|
|
23
|
+
* @param name - AI Gateway name, as passed to `defineAIGateway()`
|
|
24
|
+
* @returns The resolved AI Gateway's platform-assigned URL
|
|
25
|
+
*/
|
|
26
|
+
get(name: AIGatewayName): Promise<GetAIGatewayResult>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* See {@link TailorAigatewayAPI.get}.
|
|
30
|
+
* @param args - Forwarded to {@link TailorAigatewayAPI.get}
|
|
31
|
+
* @returns The resolved AI Gateway's platform-assigned URL
|
|
32
|
+
*/
|
|
33
|
+
declare const get: TailorAigatewayAPI["get"];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { GetAIGatewayResult, TailorAigatewayAPI, aigateway_d_exports, get };
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { AuthConnectionTokenResult as AuthConnectionTokenResult$1 } from "../configure/services/auth/types.mjs";
|
|
2
|
+
import { ConnectionName } from "@tailor-platform/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/authconnection.d.ts
|
|
5
|
+
declare namespace authconnection_d_exports {
|
|
6
|
+
export { TailorAuthconnectionAPI, getConnectionToken };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Platform API surface for `tailor.authconnection`. Describes the shape the
|
|
10
|
+
* platform runtime injects on `globalThis.tailor.authconnection`.
|
|
11
|
+
*
|
|
12
|
+
* Each method below is also re-exported as a top-level named export from this
|
|
13
|
+
* module so callers can either `import * as authconnection from
|
|
14
|
+
* "@tailor-platform/sdk/runtime/authconnection"` or pick individual methods.
|
|
15
|
+
*/
|
|
16
|
+
interface TailorAuthconnectionAPI {
|
|
17
|
+
/**
|
|
18
|
+
* Returns the access token for the given auth connection.
|
|
19
|
+
* @param connectionName - Auth connection name as defined in tailor.config
|
|
20
|
+
* @returns Token payload
|
|
21
|
+
*/
|
|
22
|
+
getConnectionToken(connectionName: ConnectionName): Promise<AuthConnectionTokenResult$1>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* See {@link TailorAuthconnectionAPI.getConnectionToken}.
|
|
26
|
+
* @param args - Forwarded to {@link TailorAuthconnectionAPI.getConnectionToken}
|
|
27
|
+
* @returns Token payload
|
|
28
|
+
*/
|
|
29
|
+
declare const getConnectionToken: TailorAuthconnectionAPI["getConnectionToken"];
|
|
30
|
+
//#endregion
|
|
31
|
+
export { TailorAuthconnectionAPI, authconnection_d_exports, getConnectionToken };
|