@tailor-platform/sdk 2.0.0-next.0 → 2.0.0-next.10
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 +972 -0
- package/README.md +9 -9
- package/agent-skills/{tailor-sdk → tailor}/SKILL.md +3 -1
- package/dist/aigateway-DR4Kwuik.mjs +9 -0
- package/dist/aigateway-DR4Kwuik.mjs.map +1 -0
- package/dist/application-DArFTTJ9.mjs +3 -0
- package/dist/{application-76hhIhnJ.mjs → application-miwiXtB4.mjs} +1963 -1953
- package/dist/application-miwiXtB4.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-CZvi9ANm.mjs +9 -0
- package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
- package/dist/{brand-DlnJ375c.mjs → brand-Eo4pLXPJ.mjs} +1 -2
- package/dist/brand-Eo4pLXPJ.mjs.map +1 -0
- package/dist/cli/cache/bundle-cache.d.mts +2 -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 +4 -0
- package/dist/cli/commands/deploy/aigateway.d.mts +5 -0
- package/dist/cli/commands/deploy/application.d.mts +7 -0
- package/dist/cli/commands/deploy/apply-phases.d.mts +14 -0
- package/dist/cli/commands/deploy/auth.d.mts +5 -0
- package/dist/cli/commands/deploy/deploy.d.mts +34 -0
- package/dist/cli/commands/deploy/executor.d.mts +7 -0
- package/dist/cli/commands/deploy/function-registry-types.d.mts +12 -0
- package/dist/cli/commands/deploy/function-registry.d.mts +7 -0
- package/dist/cli/commands/deploy/idp.d.mts +5 -0
- package/dist/cli/commands/deploy/resolver.d.mts +5 -0
- package/dist/cli/commands/deploy/secret-manager.d.mts +5 -0
- package/dist/cli/commands/deploy/staticwebsite.d.mts +5 -0
- package/dist/cli/commands/deploy/tailordb/index.d.mts +9 -0
- package/dist/cli/commands/deploy/types.d.mts +3 -0
- package/dist/cli/commands/deploy/workflow-execution-policy.d.mts +3 -0
- package/dist/cli/commands/deploy/workflow.d.mts +4 -0
- package/dist/cli/commands/executor/get.d.mts +28 -0
- package/dist/cli/commands/executor/jobs.d.mts +122 -0
- package/dist/cli/commands/executor/list.d.mts +18 -0
- package/dist/cli/commands/executor/transform.d.mts +42 -0
- package/dist/cli/commands/executor/trigger.d.mts +40 -0
- package/dist/cli/commands/executor/webhook.d.mts +21 -0
- package/dist/cli/commands/function/get.d.mts +17 -0
- package/dist/cli/commands/function/list.d.mts +21 -0
- package/dist/cli/commands/function/transform.d.mts +12 -0
- package/dist/cli/commands/generate/options.d.mts +6 -0
- package/dist/cli/commands/generate/seed/bundler.d.mts +26 -0
- package/dist/cli/commands/generate/service.d.mts +15 -0
- package/dist/cli/commands/machineuser/list.d.mts +26 -0
- package/dist/cli/commands/machineuser/token.d.mts +21 -0
- package/dist/cli/commands/oauth2client/get.d.mts +17 -0
- package/dist/cli/commands/oauth2client/list.d.mts +19 -0
- package/dist/cli/commands/oauth2client/transform.d.mts +21 -0
- package/dist/cli/commands/organization/folder/create.d.mts +17 -0
- package/dist/cli/commands/organization/folder/delete.d.mts +15 -0
- package/dist/cli/commands/organization/folder/get.d.mts +16 -0
- package/dist/cli/commands/organization/folder/list.d.mts +21 -0
- package/dist/cli/commands/organization/folder/update.d.mts +17 -0
- package/dist/cli/commands/organization/get.d.mts +15 -0
- package/dist/cli/commands/organization/list.d.mts +14 -0
- package/dist/cli/commands/organization/transform.d.mts +29 -0
- package/dist/cli/commands/organization/tree.d.mts +24 -0
- package/dist/cli/commands/organization/update.d.mts +16 -0
- package/dist/cli/commands/remove.d.mts +15 -0
- package/dist/cli/commands/show.d.mts +39 -0
- package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
- package/dist/cli/commands/tailordb/migrate/bundler.d.mts +29 -0
- package/dist/cli/commands/tailordb/migrate/config.d.mts +18 -0
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +246 -0
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +16 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +208 -0
- package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +98 -0
- package/dist/cli/commands/tailordb/migrate/types.d.mts +7 -0
- package/dist/cli/commands/tailordb/truncate.d.mts +18 -0
- package/dist/cli/commands/workflow/executions.d.mts +74 -0
- package/dist/cli/commands/workflow/get.d.mts +30 -0
- package/dist/cli/commands/workflow/list.d.mts +18 -0
- package/dist/cli/commands/workflow/resume.d.mts +22 -0
- package/dist/cli/commands/workflow/start.d.mts +60 -0
- package/dist/cli/commands/workflow/status.d.mts +6 -0
- package/dist/cli/commands/workflow/transform.d.mts +34 -0
- package/dist/cli/commands/workflow/wait.d.mts +15 -0
- package/dist/cli/commands/workflow/waiter.d.mts +23 -0
- package/dist/cli/commands/workspace/app/health.d.mts +17 -0
- package/dist/cli/commands/workspace/app/list.d.mts +21 -0
- package/dist/cli/commands/workspace/app/transform.d.mts +20 -0
- package/dist/cli/commands/workspace/create.d.mts +27 -0
- package/dist/cli/commands/workspace/delete.d.mts +14 -0
- package/dist/cli/commands/workspace/get.d.mts +16 -0
- package/dist/cli/commands/workspace/list.d.mts +17 -0
- package/dist/cli/commands/workspace/restore.d.mts +14 -0
- package/dist/cli/commands/workspace/transform.d.mts +20 -0
- package/dist/cli/commands/workspace/user/invite.d.mts +21 -0
- package/dist/cli/commands/workspace/user/list.d.mts +21 -0
- package/dist/cli/commands/workspace/user/remove.d.mts +16 -0
- package/dist/cli/commands/workspace/user/transform.d.mts +9 -0
- package/dist/cli/commands/workspace/user/update.d.mts +21 -0
- package/dist/cli/index.mjs +12 -5534
- package/dist/cli/lib.d.mts +90 -21180
- package/dist/cli/lib.mjs +157 -16
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.d.mts +23 -0
- package/dist/cli/main.mjs +6583 -0
- package/dist/cli/main.mjs.map +1 -0
- package/dist/cli/query/index.d.mts +38 -0
- package/dist/cli/services/application.d.mts +12 -0
- package/dist/cli/services/auth/service.d.mts +3 -0
- package/dist/cli/services/executor/service.d.mts +1 -0
- package/dist/cli/services/http-adapter/bundler.d.mts +3 -0
- package/dist/cli/services/http-adapter/service.d.mts +2 -0
- package/dist/cli/services/resolver/service.d.mts +1 -0
- package/dist/cli/services/tailordb/service.d.mts +3 -0
- package/dist/cli/services/workflow/bundler.d.mts +2 -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 +25 -0
- package/dist/cli/shared/context.d.mts +29 -0
- package/dist/cli/shared/error-json.d.mts +23 -0
- package/dist/cli/shared/readonly-guard.d.mts +25 -0
- package/dist/cli/shared/script-executor.d.mts +77 -0
- package/dist/cli/shared/seed-chunker.d.mts +45 -0
- package/dist/cli/shared/seed-context.d.mts +49 -0
- package/dist/cli/shared/tailordb-namespaces.d.mts +40 -0
- package/dist/cli/shared/type-generator.d.mts +19 -0
- package/dist/cli/shared/workspace-name.d.mts +1 -0
- package/dist/cli/ts-hook.d.mts +4 -0
- package/dist/cli/ts-hook.mjs +333 -0
- package/dist/completion/zsh-worker.zsh +4223 -0
- package/dist/configure/config/index.d.mts +20 -0
- package/dist/configure/config/types.d.mts +111 -0
- package/dist/configure/index.d.mts +135 -7
- package/dist/configure/index.mjs +409 -56
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/aigateway/index.d.mts +16 -0
- package/dist/configure/services/aigateway/types.d.mts +10 -0
- package/dist/configure/services/auth/index.d.mts +33 -0
- package/dist/configure/services/auth/types.d.mts +168 -0
- package/dist/configure/services/executor/executor.d.mts +70 -0
- package/dist/configure/services/executor/index.d.mts +9 -0
- package/dist/configure/services/executor/operation.d.mts +50 -0
- package/dist/configure/services/executor/trigger/event.d.mts +271 -0
- package/dist/configure/services/executor/trigger/index.d.mts +7 -0
- package/dist/configure/services/executor/trigger/schedule.d.mts +24 -0
- package/dist/configure/services/executor/trigger/webhook.d.mts +43 -0
- package/dist/configure/services/executor/types.d.mts +2 -0
- package/dist/configure/services/http-adapter/http-adapter.d.mts +124 -0
- package/dist/configure/services/http-adapter/index.d.mts +2 -0
- package/dist/configure/services/idp/index.d.mts +60 -0
- package/dist/configure/services/idp/permission.d.mts +64 -0
- package/dist/configure/services/idp/types.d.mts +23 -0
- package/dist/configure/services/index.d.mts +40 -0
- package/dist/configure/services/resolver/index.d.mts +6 -0
- package/dist/configure/services/resolver/permission.d.mts +64 -0
- package/dist/configure/services/resolver/resolver.d.mts +88 -0
- package/dist/configure/services/resolver/types.d.mts +5 -0
- package/dist/configure/services/secrets/index.d.mts +37 -0
- package/dist/configure/services/secrets/types.d.mts +10 -0
- package/dist/configure/services/staticwebsite/index.d.mts +18 -0
- package/dist/configure/services/staticwebsite/types.d.mts +10 -0
- package/dist/configure/services/tailordb/index.d.mts +4 -0
- package/dist/configure/services/tailordb/permission.d.mts +103 -0
- package/dist/configure/services/tailordb/schema.d.mts +486 -0
- package/dist/configure/services/tailordb/types.d.mts +198 -0
- package/dist/configure/services/workflow/execution-policy.d.mts +70 -0
- package/dist/configure/services/workflow/execution-policy.types.d.mts +103 -0
- package/dist/configure/services/workflow/index.d.mts +9 -0
- package/dist/configure/services/workflow/job.d.mts +83 -0
- package/dist/configure/services/workflow/types.d.mts +2 -0
- package/dist/configure/services/workflow/wait-point.d.mts +72 -0
- package/dist/configure/services/workflow/workflow.d.mts +56 -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 +8 -0
- package/dist/configure/types/field.types.d.mts +70 -0
- package/dist/configure/types/idp-name.d.mts +12 -0
- package/dist/configure/types/index.d.mts +5 -0
- package/dist/configure/types/machine-user.d.mts +2 -0
- package/dist/configure/types/permission-operand.types.d.mts +20 -0
- package/dist/configure/types/type.d.mts +73 -0
- package/dist/{context-s0lxhu8_.mjs → context-DYQVYWqZ.mjs} +4 -6
- package/dist/context-DYQVYWqZ.mjs.map +1 -0
- package/dist/{crashreport-BhD0y14F.mjs → crashreport-B5LqCTfF.mjs} +25 -17
- package/dist/{crashreport-BhD0y14F.mjs.map → crashreport-B5LqCTfF.mjs.map} +1 -1
- package/dist/{crashreport-D1wKBJ8N.mjs → crashreport-eI7ty7ok.mjs} +1 -2
- package/dist/{enum-constants-C7DaWeQo.mjs → enum-constants-j9QBF0cB.mjs} +1 -2
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -0
- package/dist/{errors-EsY4XO6O.mjs → errors-D7583Zz7.mjs} +18 -3
- package/dist/errors-D7583Zz7.mjs.map +1 -0
- package/dist/{file-B58Dm-2P.mjs → file-BUcmVIH2.mjs} +12 -23
- package/dist/file-BUcmVIH2.mjs.map +1 -0
- package/dist/{file-utils-BHPxPXmn.mjs → file-utils-yEiIS4nJ.mjs} +7 -8
- package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
- package/dist/{globals-ByrCoDip.mjs → globals-DQotNuwK.mjs} +32 -6
- package/dist/globals-DQotNuwK.mjs.map +1 -0
- package/dist/iconv-QWaZh0TT.mjs +38 -0
- package/dist/iconv-QWaZh0TT.mjs.map +1 -0
- package/dist/{idp-Ch95ag8h.mjs → idp-RA_swu-h.mjs} +12 -6
- package/dist/idp-RA_swu-h.mjs.map +1 -0
- package/dist/{interceptor-DOqRkCya.mjs → interceptor-e33JtsC-.mjs} +2 -3
- package/dist/interceptor-e33JtsC-.mjs.map +1 -0
- package/dist/kysely/index.d.mts +5 -7
- package/dist/kysely/index.mjs +0 -1
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-D1e0Vwkd.mjs → kysely-type-DqIRgDYR.mjs} +6 -6
- package/dist/kysely-type-DqIRgDYR.mjs.map +1 -0
- package/dist/logger-BtX0suGY.mjs +48 -0
- package/dist/logger-BtX0suGY.mjs.map +1 -0
- package/dist/logger-CXQq9YIp.mjs +317 -0
- package/dist/logger-CXQq9YIp.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/service/auth/index.d.mts +1 -0
- package/dist/parser/service/auth/schema.d.mts +3 -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 +5 -0
- package/dist/parser/service/tailordb/type-source.d.mts +10 -0
- package/dist/parser/service/tailordb/types.d.mts +131 -0
- package/dist/platform-serialize-RoRtBS0v.mjs +46 -0
- package/dist/platform-serialize-RoRtBS0v.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +15 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -2
- package/dist/plugin/builtin/file-utils/index.d.mts +15 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -2
- package/dist/plugin/builtin/kysely-type/index.d.mts +15 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -2
- package/dist/plugin/builtin/seed/index.d.mts +46 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -2
- package/dist/plugin/builtin/seed/seed-type-processor.d.mts +19 -0
- package/dist/plugin/builtin/seed/types.d.mts +2 -0
- package/dist/plugin/get-generated-type.d.mts +16 -0
- package/dist/plugin/index.d.mts +3 -119
- package/dist/plugin/index.mjs +1 -2
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/manager.d.mts +2 -0
- package/dist/plugin/types.d.mts +242 -0
- package/dist/plugin/with-context.d.mts +101 -0
- package/dist/{runtime-C7qTBDD2.mjs → register-ts-hook-BAHMwxfG.mjs} +12374 -8672
- package/dist/register-ts-hook-BAHMwxfG.mjs.map +1 -0
- package/dist/registry-BIGVUrMB.mjs +54 -0
- package/dist/registry-BIGVUrMB.mjs.map +1 -0
- package/dist/{repl-editor-CJG3sz7A.mjs → repl-editor-BCozyiNq.mjs} +7 -7
- package/dist/{repl-editor-CJG3sz7A.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -1
- package/dist/runtime/aigateway.d.mts +25 -0
- package/dist/runtime/aigateway.mjs +3 -0
- package/dist/runtime/authconnection.d.mts +21 -2
- package/dist/runtime/authconnection.mjs +2 -3
- package/dist/runtime/context.d.mts +54 -2
- package/dist/runtime/context.mjs +2 -3
- package/dist/runtime/field-parse.d.mts +10 -0
- package/dist/runtime/file.d.mts +170 -2
- package/dist/runtime/file.mjs +2 -3
- package/dist/runtime/globals.d.mts +38 -53
- package/dist/runtime/globals.mjs +0 -1
- package/dist/runtime/iconv.d.mts +73 -2
- package/dist/runtime/iconv.mjs +2 -3
- package/dist/runtime/idp.d.mts +129 -2
- package/dist/runtime/idp.mjs +2 -3
- package/dist/runtime/index.d.mts +48 -9
- package/dist/runtime/index.mjs +10 -9
- package/dist/runtime/logger.d.mts +98 -0
- package/dist/runtime/logger.mjs +3 -0
- package/dist/runtime/secretmanager.d.mts +41 -2
- package/dist/runtime/secretmanager.mjs +2 -3
- package/dist/runtime/types.d.mts +25 -0
- package/dist/runtime/workflow.d.mts +124 -2
- package/dist/runtime/workflow.mjs +2 -3
- package/dist/{schema-1msIhXwA.mjs → schema--xYWRGfe.mjs} +289 -231
- package/dist/schema--xYWRGfe.mjs.map +1 -0
- package/dist/{secret-file-CWzF8rry.mjs → secret-file-C3J4Gy8r.mjs} +2 -3
- package/dist/{secret-file-CWzF8rry.mjs.map → secret-file-C3J4Gy8r.mjs.map} +1 -1
- package/dist/secretmanager-CYlpffsz.mjs +13 -0
- package/dist/secretmanager-CYlpffsz.mjs.map +1 -0
- package/dist/secretmanager-IY4UvinW.mjs +131 -0
- package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
- package/dist/seed/index.d.mts +4 -4
- package/dist/seed/index.mjs +0 -1
- package/dist/seed/index.mjs.map +1 -1
- package/dist/seed-LUVr7jHL.mjs +444 -0
- package/dist/seed-LUVr7jHL.mjs.map +1 -0
- package/dist/{service-DMohAx8a2.mjs → service-B5WynBHQ.mjs} +3 -4
- package/dist/service-B5WynBHQ.mjs.map +1 -0
- package/dist/service-BNtPsK9Q.mjs +837 -0
- package/dist/service-BNtPsK9Q.mjs.map +1 -0
- package/dist/service-D5jn05ZI.mjs +3 -0
- package/dist/service_pb-BwZRiNug.mjs +167 -0
- package/dist/service_pb-BwZRiNug.mjs.map +1 -0
- package/dist/service_pb-wRkxUta6.mjs +3 -0
- package/dist/tailor-proto/src/tailor/v1/aigateway_pb.d.mts +203 -0
- package/dist/tailor-proto/src/tailor/v1/aigateway_resource_pb.d.mts +57 -0
- package/dist/tailor-proto/src/tailor/v1/application_pb.d.mts +315 -0
- package/dist/tailor-proto/src/tailor/v1/application_resource_pb.d.mts +160 -0
- package/dist/tailor-proto/src/tailor/v1/auth_pb.d.mts +2069 -0
- package/dist/tailor-proto/src/tailor/v1/auth_resource_pb.d.mts +865 -0
- package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +111 -0
- package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +68 -0
- package/dist/tailor-proto/src/tailor/v1/executor_pb.d.mts +438 -0
- package/dist/tailor-proto/src/tailor/v1/executor_resource_pb.d.mts +563 -0
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +144 -0
- package/dist/tailor-proto/src/tailor/v1/function_registry_pb.d.mts +450 -0
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +191 -0
- package/dist/tailor-proto/src/tailor/v1/http_adapter_resource_pb.d.mts +49 -0
- package/dist/tailor-proto/src/tailor/v1/idp_pb.d.mts +406 -0
- package/dist/tailor-proto/src/tailor/v1/idp_resource_pb.d.mts +429 -0
- package/dist/tailor-proto/src/tailor/v1/metadata_pb.d.mts +72 -0
- package/dist/tailor-proto/src/tailor/v1/metadata_resource_pb.d.mts +16 -0
- package/dist/tailor-proto/src/tailor/v1/meter_pb.d.mts +308 -0
- package/dist/tailor-proto/src/tailor/v1/pipeline_pb.d.mts +590 -0
- package/dist/tailor-proto/src/tailor/v1/pipeline_resource_pb.d.mts +329 -0
- package/dist/tailor-proto/src/tailor/v1/resource_pb.d.mts +112 -0
- package/dist/tailor-proto/src/tailor/v1/secret_manager_pb.d.mts +345 -0
- package/dist/tailor-proto/src/tailor/v1/secret_manager_resource_pb.d.mts +53 -0
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +3575 -0
- package/dist/tailor-proto/src/tailor/v1/stateflow_pb.d.mts +186 -0
- package/dist/tailor-proto/src/tailor/v1/stateflow_resource_pb.d.mts +28 -0
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_pb.d.mts +428 -0
- package/dist/tailor-proto/src/tailor/v1/staticwebsite_resource_pb.d.mts +89 -0
- package/dist/tailor-proto/src/tailor/v1/tailordb_pb.d.mts +683 -0
- package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +796 -0
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_pb.d.mts +329 -0
- package/dist/tailor-proto/src/tailor/v1/telemetryrouter_resource_pb.d.mts +182 -0
- package/dist/tailor-proto/src/tailor/v1/workflow_pb.d.mts +861 -0
- package/dist/tailor-proto/src/tailor/v1/workflow_resource_pb.d.mts +309 -0
- package/dist/tailor-proto/src/tailor/v1/workspace_pb.d.mts +2014 -0
- package/dist/tailor-proto/src/tailor/v1/workspace_resource_pb.d.mts +482 -0
- package/dist/{telemetry-BQbbVo2t.mjs → telemetry-BRVdwh14.mjs} +4 -5
- package/dist/telemetry-BRVdwh14.mjs.map +1 -0
- package/dist/telemetry-CkbkeJxl.mjs +3 -0
- package/dist/test-env-key-D7UkZp99.mjs +75 -0
- package/dist/test-env-key-D7UkZp99.mjs.map +1 -0
- package/dist/type-source-DH_LH20p.mjs +13 -0
- package/dist/type-source-DH_LH20p.mjs.map +1 -0
- package/dist/types/aigateway.generated.d.mts +12 -0
- package/dist/types/app-config.generated.d.mts +4 -0
- package/dist/types/auth-connection.generated.d.mts +33 -0
- package/dist/types/auth.generated.d.mts +188 -0
- package/dist/types/executor.generated.d.mts +209 -0
- package/dist/types/helpers.d.mts +40 -0
- package/dist/types/http-adapter.generated.d.mts +28 -0
- package/dist/types/idp.generated.d.mts +626 -0
- package/dist/types/resolver.generated.d.mts +82 -0
- package/dist/types/secrets.generated.d.mts +14 -0
- package/dist/types/staticwebsite.generated.d.mts +14 -0
- package/dist/types/tailordb.generated.d.mts +468 -0
- package/dist/types/workflow.generated.d.mts +17 -0
- package/dist/user-agent-Bgsszb5I.mjs +28 -0
- package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +6 -99
- package/dist/utils/test/index.mjs +60 -40
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/utils/test/mock.d.mts +86 -0
- package/dist/vitest/environment.d.mts +1 -2
- package/dist/vitest/environment.mjs +2 -3
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +15 -392
- package/dist/vitest/index.mjs +1347 -9
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock-kysely.d.mts +61 -0
- package/dist/vitest/mock.d.mts +10 -0
- package/dist/vitest/mocks/aigateway.d.mts +40 -0
- package/dist/vitest/mocks/authconnection.d.mts +38 -0
- package/dist/vitest/mocks/file.d.mts +58 -0
- package/dist/vitest/mocks/iconv.d.mts +51 -0
- package/dist/vitest/mocks/idp.d.mts +60 -0
- package/dist/vitest/mocks/logger.d.mts +45 -0
- package/dist/vitest/mocks/secretmanager.d.mts +44 -0
- package/dist/vitest/mocks/tailordb.d.mts +115 -0
- package/dist/vitest/mocks/workflow.d.mts +157 -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/vitest/workflow-local.d.mts +41 -0
- package/dist/workflow-CsaQ9qK-.mjs +42 -0
- package/dist/workflow-CsaQ9qK-.mjs.map +1 -0
- package/dist/{client-CobIRHl-.mjs → workspace_resource_pb-UGK1SSn_.mjs} +55 -616
- package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +1 -0
- package/docs/cli/application.md +150 -252
- package/docs/cli/auth.md +51 -295
- package/docs/cli/completion.md +4 -25
- package/docs/cli/crashreport.md +3 -63
- package/docs/cli/executor.md +72 -183
- package/docs/cli/function.md +17 -133
- package/docs/cli/organization.md +11 -221
- package/docs/cli/plugin.md +29 -0
- package/docs/cli/query.md +2 -22
- package/docs/cli/secret.md +71 -251
- package/docs/cli/setup.md +138 -40
- package/docs/cli/skills.md +50 -39
- package/docs/cli/staticwebsite.md +32 -180
- package/docs/cli/tailordb.md +71 -427
- package/docs/cli/upgrade.md +2 -22
- package/docs/cli/user.md +78 -247
- package/docs/cli/workflow.md +150 -172
- package/docs/cli/workspace.md +167 -538
- package/docs/cli-reference.md +213 -96
- package/docs/configuration.md +40 -8
- package/docs/github-actions.md +72 -24
- package/docs/migration/v2.md +1316 -0
- package/docs/multi-environment.md +29 -7
- package/docs/plugin/custom.md +6 -6
- package/docs/plugin/index.md +9 -9
- package/docs/quickstart.md +8 -7
- package/docs/runtime.md +21 -12
- package/docs/services/aigateway.md +115 -0
- package/docs/services/auth.md +70 -61
- package/docs/services/executor.md +8 -5
- package/docs/services/http-adapter.md +16 -1
- package/docs/services/idp.md +55 -2
- package/docs/services/resolver.md +63 -11
- package/docs/services/secret.md +11 -11
- package/docs/services/staticwebsite.md +8 -2
- package/docs/services/tailordb-migration.md +43 -28
- package/docs/services/tailordb.md +200 -99
- package/docs/services/workflow.md +135 -59
- package/docs/testing.md +253 -145
- package/package.json +61 -47
- package/postinstall.mjs +4 -6
- package/dist/actor-J2gJ0eK5.d.mts +0 -24
- package/dist/application-76hhIhnJ.mjs.map +0 -1
- package/dist/application-av2raLs6.mjs +0 -4
- package/dist/authconnection-BIYzEh2p.d.mts +0 -39
- package/dist/authconnection-D8SJGMpj.mjs +0 -16
- package/dist/authconnection-D8SJGMpj.mjs.map +0 -1
- package/dist/brand-DlnJ375c.mjs.map +0 -1
- package/dist/chunk-BkoGK1jX.mjs +0 -21
- package/dist/cli/erd-viewer-assets/app.js +0 -1181
- package/dist/cli/erd-viewer-assets/index.html +0 -73
- package/dist/cli/erd-viewer-assets/serve.json +0 -13
- package/dist/cli/erd-viewer-assets/styles.css +0 -789
- package/dist/cli/index.d.mts +0 -5
- package/dist/cli/index.mjs.map +0 -1
- package/dist/cli/skills.d.mts +0 -1
- package/dist/cli/skills.mjs +0 -22
- package/dist/cli/skills.mjs.map +0 -1
- package/dist/client-C68VWo4g.mjs +0 -4
- package/dist/client-CobIRHl-.mjs.map +0 -1
- package/dist/context-CUBwSBq4.d.mts +0 -68
- package/dist/context-s0lxhu8_.mjs.map +0 -1
- package/dist/enum-constants-C7DaWeQo.mjs.map +0 -1
- package/dist/env-B-g-qgE4.d.mts +0 -7
- package/dist/errors-EsY4XO6O.mjs.map +0 -1
- package/dist/field-C4zdJLW5.mjs +0 -23
- package/dist/field-C4zdJLW5.mjs.map +0 -1
- package/dist/file-B58Dm-2P.mjs.map +0 -1
- package/dist/file-BzK8z3X-.d.mts +0 -250
- package/dist/file-utils-BHPxPXmn.mjs.map +0 -1
- package/dist/globals-ByrCoDip.mjs.map +0 -1
- package/dist/iconv-DreIffeM.mjs +0 -64
- package/dist/iconv-DreIffeM.mjs.map +0 -1
- package/dist/iconv-kwrmd1U_.d.mts +0 -122
- package/dist/idp-BlBPtXJ-.d.mts +0 -160
- package/dist/idp-Ch95ag8h.mjs.map +0 -1
- package/dist/index-CLxubakC.d.mts +0 -1225
- package/dist/index-CPRnOjjt.d.mts +0 -18
- package/dist/index-CQZVJ5SX.d.mts +0 -18
- package/dist/index-CfRFkXIO.d.mts +0 -47
- package/dist/index-DRhMpdnA.d.mts +0 -46
- package/dist/index-DUupuPhZ.d.mts +0 -18
- package/dist/interceptor-DOqRkCya.mjs.map +0 -1
- package/dist/job-BpsFXPbi.mjs +0 -54
- package/dist/job-BpsFXPbi.mjs.map +0 -1
- package/dist/kysely-type-D1e0Vwkd.mjs.map +0 -1
- package/dist/logger-DpJyJvNz.mjs +0 -221
- package/dist/logger-DpJyJvNz.mjs.map +0 -1
- package/dist/mock-DMgIygjE.mjs +0 -806
- package/dist/mock-DMgIygjE.mjs.map +0 -1
- package/dist/package-json-wzO6nV9O.mjs +0 -4
- package/dist/plugin-C_FyVSdl.d.mts +0 -634
- package/dist/registry-D0uB0OrK.mjs +0 -178
- package/dist/registry-D0uB0OrK.mjs.map +0 -1
- package/dist/runtime-C7qTBDD2.mjs.map +0 -1
- package/dist/schema-1msIhXwA.mjs.map +0 -1
- package/dist/secretmanager-B9h-U_8U.mjs +0 -25
- package/dist/secretmanager-B9h-U_8U.mjs.map +0 -1
- package/dist/secretmanager-CKLB3wAQ.d.mts +0 -55
- package/dist/seed-BH2FbrPV.mjs +0 -1171
- package/dist/seed-BH2FbrPV.mjs.map +0 -1
- package/dist/service-BHQIerYh.mjs +0 -4
- package/dist/service-DMohAx8a2.mjs.map +0 -1
- package/dist/service-wI3Hvrgx.mjs +0 -460
- package/dist/service-wI3Hvrgx.mjs.map +0 -1
- package/dist/tailordb-BlBGmQK-.d.mts +0 -863
- package/dist/telemetry-BQbbVo2t.mjs.map +0 -1
- package/dist/telemetry-w92bvGdC.mjs +0 -4
- package/dist/types-2Be3wSMc.mjs +0 -5
- package/dist/types-CmzfQP_m.mjs +0 -372
- package/dist/types-CmzfQP_m.mjs.map +0 -1
- package/dist/workflow--aPbA8Uq.mjs +0 -39
- package/dist/workflow--aPbA8Uq.mjs.map +0 -1
- package/dist/workflow-CMamswkK.d.mts +0 -96
- package/dist/workflow.generated-Bf1tWylx.d.mts +0 -1416
- package/docs/generator/builtin.md +0 -257
- package/docs/generator/custom.md +0 -147
- package/docs/generator/index.md +0 -66
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/configure/services/workflow/registry.ts
|
|
2
|
+
const JOB_REGISTRY_KEY = Symbol.for("tailor-platform/sdk:job-registry");
|
|
3
|
+
function jobs() {
|
|
4
|
+
const g = globalThis;
|
|
5
|
+
let map = g[JOB_REGISTRY_KEY];
|
|
6
|
+
if (!map) {
|
|
7
|
+
map = /* @__PURE__ */ new Map();
|
|
8
|
+
g[JOB_REGISTRY_KEY] = map;
|
|
9
|
+
}
|
|
10
|
+
return map;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Register a job body keyed by job name. Called as a side effect by
|
|
14
|
+
* `createWorkflowJob` so `runWorkflowLocally()` can execute dependent job
|
|
15
|
+
* bodies when `globalThis.tailor.workflow.execJobFunction(name, args)` is invoked.
|
|
16
|
+
*
|
|
17
|
+
* In production builds the bundler rewrites `.start()` calls so this registry
|
|
18
|
+
* is never read; the gated write is dropped as dead code.
|
|
19
|
+
* @param name - Job name
|
|
20
|
+
* @param body - Job body function
|
|
21
|
+
*/
|
|
22
|
+
function registerJob(name, body) {
|
|
23
|
+
jobs().set(name, body);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Look up a registered job body by name.
|
|
27
|
+
* @param name - Job name
|
|
28
|
+
* @returns The registered body, or undefined when no job is registered
|
|
29
|
+
*/
|
|
30
|
+
function getRegisteredJob(name) {
|
|
31
|
+
return jobs().get(name);
|
|
32
|
+
}
|
|
33
|
+
function currentPlatformWorkflow() {
|
|
34
|
+
return globalThis.tailor?.workflow;
|
|
35
|
+
}
|
|
36
|
+
function requirePlatformWorkflow() {
|
|
37
|
+
const workflow = currentPlatformWorkflow();
|
|
38
|
+
if (!workflow) throw new Error("tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment and use mockWorkflow(), or use runWorkflowLocally() from @tailor-platform/sdk/vitest for local workflow execution.");
|
|
39
|
+
return workflow;
|
|
40
|
+
}
|
|
41
|
+
const START_DEFAULT = "00000000-0000-4000-8000-000000000000";
|
|
42
|
+
function dispatchStartJob(name, args, options) {
|
|
43
|
+
const workflow = requirePlatformWorkflow();
|
|
44
|
+
return arguments.length >= 3 ? workflow.execJobFunction(name, args, options) : workflow.execJobFunction(name, args);
|
|
45
|
+
}
|
|
46
|
+
function dispatchStartWorkflow(name, args, options) {
|
|
47
|
+
const workflow = requirePlatformWorkflow();
|
|
48
|
+
if (arguments.length < 3) return workflow.startWorkflow(name, args);
|
|
49
|
+
return workflow.startWorkflow(name, args, options?.invoker === void 0 ? options : { authInvoker: options.invoker });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { registerJob as a, getRegisteredJob as i, dispatchStartJob as n, dispatchStartWorkflow as r, START_DEFAULT as t };
|
|
54
|
+
//# sourceMappingURL=registry-BIGVUrMB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-BIGVUrMB.mjs","names":[],"sources":["../src/configure/services/workflow/registry.ts"],"sourcesContent":["import type { TailorEnv, TailorPrincipal } from \"#/runtime/types\";\nimport type { ExecJobFunctionOptions, StartWorkflowOptions } from \"#/runtime/workflow\";\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: TailorPrincipal | null },\n) => unknown | Promise<unknown>;\n\nconst JOB_REGISTRY_KEY: unique symbol = Symbol.for(\"tailor-platform/sdk:job-registry\");\n\ntype PlatformWorkflow = {\n startWorkflow: (name: string, args?: unknown, options?: StartWorkflowOptions) => Promise<string>;\n execJobFunction: (name: string, args?: unknown, options?: ExecJobFunctionOptions) => unknown;\n startJobFunction: (name: string, args?: unknown, options?: ExecJobFunctionOptions) => unknown;\n};\n\ntype GlobalWithRegistry = typeof globalThis & {\n [JOB_REGISTRY_KEY]?: Map<string, RegisteredJobBody>;\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\n/**\n * Register a job body keyed by job name. Called as a side effect by\n * `createWorkflowJob` so `runWorkflowLocally()` can execute dependent job\n * bodies when `globalThis.tailor.workflow.execJobFunction(name, args)` is invoked.\n *\n * In production builds the bundler rewrites `.start()` 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\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\nfunction requirePlatformWorkflow(): PlatformWorkflow {\n const workflow = currentPlatformWorkflow();\n if (!workflow) {\n throw new Error(\n \"tailor.workflow is not available. Run tests in the `tailor-runtime` Vitest environment and use mockWorkflow(), or use runWorkflowLocally() from @tailor-platform/sdk/vitest for local workflow execution.\",\n );\n }\n return 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 START_DEFAULT = \"00000000-0000-4000-8000-000000000000\";\n\n// `.start()` routes through the installed `tailor.workflow` shim. Local body\n// execution is intentionally available only through `runWorkflowLocally()`.\n// Preserve arity: the shim sees a 2-argument call when the caller supplied no\n// options, and a 3-argument call otherwise, mirroring the bundler rewrite so\n// mocks observe the same shape in local execution and in bundled workflows.\nexport function dispatchStartJob(\n name: string,\n args?: unknown,\n options?: ExecJobFunctionOptions,\n): unknown {\n const workflow = requirePlatformWorkflow();\n // oxlint-disable-next-line prefer-rest-params\n return arguments.length >= 3\n ? workflow.execJobFunction(name, args, options)\n : workflow.execJobFunction(name, args);\n}\n\n// Accepts `unknown` because the SDK-side `.start()` accepts a wider options\n// shape than the platform surface (e.g. `authInvoker` may be a machine-user\n// name string that the bundler normalizes at build time). Local execution\n// forwards the value verbatim; only the bundled path enforces the platform\n// contract.\nexport function dispatchStartWorkflow(\n name: string,\n args?: unknown,\n options?: { invoker?: unknown },\n): Promise<string> {\n const workflow = requirePlatformWorkflow();\n // oxlint-disable-next-line prefer-rest-params\n if (arguments.length < 3) {\n return workflow.startWorkflow(name, args);\n }\n return workflow.startWorkflow(\n name,\n args,\n options?.invoker === undefined\n ? (options as StartWorkflowOptions | undefined)\n : ({ authInvoker: options.invoker } as StartWorkflowOptions),\n );\n}\n"],"mappings":";AAaA,MAAM,mBAAkC,OAAO,IAAI,kCAAkC;AAarF,SAAS,OAAuC;CAC9C,MAAM,IAAI;CACV,IAAI,MAAM,EAAE;CACZ,IAAI,CAAC,KAAK;EACR,sBAAM,IAAI,IAAI;EACd,EAAE,oBAAoB;CACxB;CACA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,YAAY,MAAc,MAA+B;CACvE,KAAK,CAAC,CAAC,IAAI,MAAM,IAAI;AACvB;;;;;;AAOA,SAAgB,iBAAiB,MAA6C;CAC5E,OAAO,KAAK,CAAC,CAAC,IAAI,IAAI;AACxB;AAEA,SAAS,0BAAwD;CAG/D,OAAQ,WAAkC,QAAQ;AACpD;AAEA,SAAS,0BAA4C;CACnD,MAAM,WAAW,wBAAwB;CACzC,IAAI,CAAC,UACH,MAAM,IAAI,MACR,2MACF;CAEF,OAAO;AACT;AAIA,MAAa,gBAAgB;AAO7B,SAAgB,iBACd,MACA,MACA,SACS;CACT,MAAM,WAAW,wBAAwB;CAEzC,OAAO,UAAU,UAAU,IACvB,SAAS,gBAAgB,MAAM,MAAM,OAAO,IAC5C,SAAS,gBAAgB,MAAM,IAAI;AACzC;AAOA,SAAgB,sBACd,MACA,MACA,SACiB;CACjB,MAAM,WAAW,wBAAwB;CAEzC,IAAI,UAAU,SAAS,GACrB,OAAO,SAAS,cAAc,MAAM,IAAI;CAE1C,OAAO,SAAS,cACd,MACA,MACA,SAAS,YAAY,SAChB,UACA,EAAE,aAAa,QAAQ,QAAQ,CACtC;AACF"}
|
|
@@ -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
|
|
|
@@ -40,7 +39,7 @@ function highlightSqlLine(line) {
|
|
|
40
39
|
}
|
|
41
40
|
return result;
|
|
42
41
|
}
|
|
43
|
-
const GQL_KEYWORDS = new Set([
|
|
42
|
+
const GQL_KEYWORDS = /* @__PURE__ */ new Set([
|
|
44
43
|
"query",
|
|
45
44
|
"mutation",
|
|
46
45
|
"subscription",
|
|
@@ -57,13 +56,13 @@ const GQL_KEYWORDS = new Set([
|
|
|
57
56
|
"directive",
|
|
58
57
|
"implements"
|
|
59
58
|
]);
|
|
60
|
-
const GQL_DEF_KEYWORDS = new Set([
|
|
59
|
+
const GQL_DEF_KEYWORDS = /* @__PURE__ */ new Set([
|
|
61
60
|
"query",
|
|
62
61
|
"mutation",
|
|
63
62
|
"subscription",
|
|
64
63
|
"fragment"
|
|
65
64
|
]);
|
|
66
|
-
const GQL_BUILTINS = new Set([
|
|
65
|
+
const GQL_BUILTINS = /* @__PURE__ */ new Set([
|
|
67
66
|
"true",
|
|
68
67
|
"false",
|
|
69
68
|
"null"
|
|
@@ -230,7 +229,8 @@ function replTransform(state, event) {
|
|
|
230
229
|
};
|
|
231
230
|
}
|
|
232
231
|
if (endsWithOpen) {
|
|
233
|
-
const
|
|
232
|
+
const openChar = prevLine.trimEnd().slice(-1);
|
|
233
|
+
const closeChar = BRACKET_PAIRS[openChar] ?? "}";
|
|
234
234
|
const indent = baseIndent + " ";
|
|
235
235
|
return {
|
|
236
236
|
lines: lines.with(row, indent + currentLine).toSpliced(row + 1, 0, baseIndent + closeChar),
|
|
@@ -248,4 +248,4 @@ function replTransform(state, event) {
|
|
|
248
248
|
|
|
249
249
|
//#endregion
|
|
250
250
|
export { highlightGraphqlLine, highlightSqlLine, replTransform };
|
|
251
|
-
//# sourceMappingURL=repl-editor-
|
|
251
|
+
//# sourceMappingURL=repl-editor-BCozyiNq.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl-editor-CJG3sz7A.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,MAAM,OAAO;AACb,MAAM,UAAU;AAChB,MAAM,SAAS;AACf,MAAM,eAAe;AACrB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,aAAa;AAEnB,MAAM,gBAAwC;CAC5C,SAAS;CACT,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;AACX;;;;;;AAOA,SAAgB,iBAAiB,MAAsB;CACrD,MAAM,WAAW,YAAY,IAAI;CACjC,IAAI,SAAS;CACb,KAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,QAAQ,cAAc,IAAI;EAChC,UAAU,QAAQ,QAAQ,IAAI,UAAU,QAAQ,IAAI;CACtD;CACA,OAAO;AACT;AAEA,MAAM,eAAe,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AI,gBAAgB,iBAAiB;GAInC,MAAM,cAAc,aAAa;GAIjC,OAAO;IAAE,OAHQ,MACd,KAAK,KAAK,WAAW,CAAC,CACtB,UAAU,MAAM,GAAG,GAAG,aAAa,YAAY,UAAU,CACrC;IAAG;IAAK,KAAK,YAAY;GAAO;EACzD;EACA,IAAI,cAAc;GAIhB,MAAM,YAAY,cADD,SAAS,QAAQ,CAAC,CAAC,MAAM,EACH,MAAM;GAC7C,MAAM,SAAS,aAAa;GAI5B,OAAO;IAAE,OAHQ,MACd,KAAK,KAAK,SAAS,WAAW,CAAC,CAC/B,UAAU,MAAM,GAAG,GAAG,aAAa,SACf;IAAG;IAAK,KAAK,OAAO;GAAO;EACpD;EACA,IAAI,cAAc,QAAQ,GACxB,OAAO;GAAE,OAAO,MAAM,KAAK,KAAK,aAAa,WAAW;GAAG;GAAK,KAAK,WAAW;EAAO;CAE3F;AAGF"}
|
|
1
|
+
{"version":3,"file":"repl-editor-BCozyiNq.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,MAAM,OAAO;AACb,MAAM,UAAU;AAChB,MAAM,SAAS;AACf,MAAM,eAAe;AACrB,MAAM,OAAO;AACb,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,aAAa;AAEnB,MAAM,gBAAwC;CAC5C,SAAS;CACT,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;AACX;;;;;;AAOA,SAAgB,iBAAiB,MAAsB;CACrD,MAAM,WAAW,YAAY,IAAI;CACjC,IAAI,SAAS;CACb,KAAK,MAAM,OAAO,UAAU;EAC1B,MAAM,QAAQ,cAAc,IAAI;EAChC,UAAU,QAAQ,QAAQ,IAAI,UAAU,QAAQ,IAAI;CACt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AAU,KAAK,YAAY,UAAU,CAAC;EAE9D,IAAI,gBAAgB,iBAAiB;GAInC,MAAM,cAAc,aAAa;GAIjC,OAAO;IAAE,OAHQ,MACd,KAAK,KAAK,WAAW,CAAC,CACtB,UAAU,MAAM,GAAG,GAAG,aAAa,YAAY,UAAU,CACrC;IAAG;IAAK,KAAK,YAAY;GAAO;EACzD;EACA,IAAI,cAAc;GAGhB,MAAM,WAAW,SAAS,QAAQ,CAAC,CAAC,MAAM,EAAE;GAC5C,MAAM,YAAY,cAAc,aAAa;GAC7C,MAAM,SAAS,aAAa;GAI5B,OAAO;IAAE,OAHQ,MACd,KAAK,KAAK,SAAS,WAAW,CAAC,CAC/B,UAAU,MAAM,GAAG,GAAG,aAAa,SACf;IAAG;IAAK,KAAK,OAAO;GAAO;EACpD;EACA,IAAI,cAAc,QAAQ,GACxB,OAAO;GAAE,OAAO,MAAM,KAAK,KAAK,aAAa,WAAW;GAAG;GAAK,KAAK,WAAW;EAAO;CAE3F;AAGF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AIGatewayName } from "@tailor-platform/sdk";
|
|
2
|
+
//#region src/runtime/aigateway.d.ts
|
|
3
|
+
/** Result of {@link TailorAigatewayAPI.get}. */
|
|
4
|
+
interface GetAIGatewayResult {
|
|
5
|
+
/** The platform-assigned URL of the AI Gateway. */
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Platform API surface for `tailor.aigateway`. Describes the shape the
|
|
10
|
+
* platform runtime injects on `globalThis.tailor.aigateway`.
|
|
11
|
+
*/
|
|
12
|
+
interface TailorAigatewayAPI {
|
|
13
|
+
/**
|
|
14
|
+
* Resolves an AI Gateway defined in the caller's own workspace.
|
|
15
|
+
* @param name - AI Gateway name, as passed to `defineAIGateway()`
|
|
16
|
+
* @returns The resolved AI Gateway's platform-assigned URL
|
|
17
|
+
*/
|
|
18
|
+
get(name: AIGatewayName): Promise<GetAIGatewayResult>;
|
|
19
|
+
}
|
|
20
|
+
/** Runtime wrapper namespace for `tailor.aigateway`. */
|
|
21
|
+
declare const aigateway: {
|
|
22
|
+
readonly get: (name: AIGatewayName) => Promise<GetAIGatewayResult>;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { GetAIGatewayResult, TailorAigatewayAPI, aigateway };
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { AuthConnectionTokenResult as AuthConnectionTokenResult$1 } from "../configure/services/auth/types.mjs";
|
|
2
|
+
import { ConnectionName } from "@tailor-platform/sdk";
|
|
3
|
+
//#region src/runtime/authconnection.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Platform API surface for `tailor.authconnection`. Describes the shape the
|
|
6
|
+
* platform runtime injects on `globalThis.tailor.authconnection`.
|
|
7
|
+
*/
|
|
8
|
+
interface TailorAuthconnectionAPI {
|
|
9
|
+
/**
|
|
10
|
+
* Returns the access token for the given auth connection.
|
|
11
|
+
* @param connectionName - Auth connection name as defined in tailor.config
|
|
12
|
+
* @returns Token payload
|
|
13
|
+
*/
|
|
14
|
+
getConnectionToken(connectionName: ConnectionName): Promise<AuthConnectionTokenResult$1>;
|
|
15
|
+
}
|
|
16
|
+
/** Runtime wrapper namespace for `tailor.authconnection`. */
|
|
17
|
+
declare const authconnection: {
|
|
18
|
+
readonly getConnectionToken: (connectionName: ConnectionName) => Promise<AuthConnectionTokenResult$1>;
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { TailorAuthconnectionAPI, authconnection };
|
|
@@ -1,2 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { TailorPrincipal } from "./types.mjs";
|
|
2
|
+
//#region src/runtime/context.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Information about the invoker of the current function execution.
|
|
5
|
+
*
|
|
6
|
+
* Matches the public `TailorPrincipal` shape — `attributes` is the attribute
|
|
7
|
+
* map and `attributeList` is the array of attribute IDs.
|
|
8
|
+
*/
|
|
9
|
+
type Invoker = TailorPrincipal;
|
|
10
|
+
/**
|
|
11
|
+
* Raw platform-side invoker payload returned by `tailor.context.getInvoker()`.
|
|
12
|
+
* The wrapper normalizes this into {@link Invoker}.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
interface ContextInvoker {
|
|
16
|
+
/** The invoker's ID */
|
|
17
|
+
id: string;
|
|
18
|
+
/** The invoker's type */
|
|
19
|
+
type: "user" | "machine_user";
|
|
20
|
+
/** The workspace ID */
|
|
21
|
+
workspaceId: string;
|
|
22
|
+
/** The invoker's attribute IDs */
|
|
23
|
+
attributes: string[];
|
|
24
|
+
/** The invoker's attribute map */
|
|
25
|
+
attributeMap: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Platform API surface for `tailor.context`. Describes the shape the platform
|
|
29
|
+
* runtime injects on `globalThis.tailor.context`.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
interface PlatformContextAPI {
|
|
33
|
+
getInvoker(): ContextInvoker | null;
|
|
34
|
+
}
|
|
35
|
+
/** Runtime wrapper API for execution context utilities. */
|
|
36
|
+
interface TailorContextAPI {
|
|
37
|
+
/**
|
|
38
|
+
* Returns information about the current invoker.
|
|
39
|
+
* @returns Invoker details, or `null` for anonymous invocations
|
|
40
|
+
*/
|
|
41
|
+
getInvoker(): Invoker | null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Returns information about the invoker of the current function execution,
|
|
45
|
+
* or `null` for anonymous invocations.
|
|
46
|
+
* @returns Invoker details, or `null` when the call is anonymous
|
|
47
|
+
*/
|
|
48
|
+
declare function getInvoker(): Invoker | null;
|
|
49
|
+
/** Runtime wrapper namespace for `tailor.context`. */
|
|
50
|
+
declare const context: {
|
|
51
|
+
readonly getInvoker: typeof getInvoker;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { ContextInvoker, Invoker, PlatformContextAPI, TailorContextAPI, context };
|
package/dist/runtime/context.mjs
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TailorPrincipal } from "./types.mjs";
|
|
2
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
+
//#region src/runtime/field-parse.d.ts
|
|
4
|
+
type FieldParseArgs = {
|
|
5
|
+
value: unknown;
|
|
6
|
+
data: unknown;
|
|
7
|
+
invoker: TailorPrincipal | null;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { FieldParseArgs };
|
package/dist/runtime/file.d.mts
CHANGED
|
@@ -1,2 +1,170 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/runtime/file.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* TailorDB file (BLOB) utilities.
|
|
4
|
+
*
|
|
5
|
+
* Thin typed wrapper around the platform-provided `tailordb.file` runtime API.
|
|
6
|
+
* At runtime this delegates to `globalThis.tailordb.file`. Use `mockFile` from
|
|
7
|
+
* `@tailor-platform/sdk/vitest` to mock these calls in unit tests.
|
|
8
|
+
* @example
|
|
9
|
+
* import { file } from "@tailor-platform/sdk/runtime";
|
|
10
|
+
*
|
|
11
|
+
* const { metadata } = await file.upload(
|
|
12
|
+
* "my-namespace",
|
|
13
|
+
* "Document",
|
|
14
|
+
* "attachment",
|
|
15
|
+
* recordId,
|
|
16
|
+
* bytes,
|
|
17
|
+
* );
|
|
18
|
+
*/
|
|
19
|
+
/** Upload response metadata. */
|
|
20
|
+
interface UploadMetadata {
|
|
21
|
+
fileSize: number;
|
|
22
|
+
sha256sum: string;
|
|
23
|
+
}
|
|
24
|
+
/** Download response metadata. */
|
|
25
|
+
interface DownloadMetadata {
|
|
26
|
+
contentType: string;
|
|
27
|
+
fileSize: number;
|
|
28
|
+
sha256sum: string;
|
|
29
|
+
lastUploadedAt: string;
|
|
30
|
+
}
|
|
31
|
+
/** File metadata (for {@link TailorDBFileAPI.getMetadata}). */
|
|
32
|
+
interface FileMetadata {
|
|
33
|
+
contentType: string;
|
|
34
|
+
fileSize: number;
|
|
35
|
+
sha256sum: string;
|
|
36
|
+
urlPath: string;
|
|
37
|
+
lastUploadedAt?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Upload options. */
|
|
40
|
+
interface FileUploadOptions {
|
|
41
|
+
contentType?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Upload stream options. */
|
|
44
|
+
interface FileUploadStreamOptions {
|
|
45
|
+
contentType?: string;
|
|
46
|
+
fileSize?: number;
|
|
47
|
+
}
|
|
48
|
+
/** Upload response. */
|
|
49
|
+
interface FileUploadResponse {
|
|
50
|
+
metadata: UploadMetadata;
|
|
51
|
+
}
|
|
52
|
+
/** Download response. */
|
|
53
|
+
interface FileDownloadResponse {
|
|
54
|
+
data: Uint8Array;
|
|
55
|
+
metadata: DownloadMetadata;
|
|
56
|
+
}
|
|
57
|
+
/** Download-as-Base64 response. */
|
|
58
|
+
interface FileDownloadAsBase64Response {
|
|
59
|
+
data: string;
|
|
60
|
+
metadata: DownloadMetadata;
|
|
61
|
+
}
|
|
62
|
+
/** Download stream response. */
|
|
63
|
+
interface FileDownloadStreamResponse {
|
|
64
|
+
body: ReadableStream<Uint8Array>;
|
|
65
|
+
metadata: DownloadMetadata;
|
|
66
|
+
}
|
|
67
|
+
/** Error code emitted by {@link TailorDBFileError}. */
|
|
68
|
+
type TailorDBFileErrorCode = "INVALID_PARAMS" | "INVALID_DATA_TYPE" | "OPERATION_FAILED" | "DELETE_FAILED" | "STREAM_OPEN_FAILED" | "STREAM_READ_ERROR" | "STREAM_ERROR" | "FILE_TOO_LARGE";
|
|
69
|
+
/**
|
|
70
|
+
* Type-only shape of the `TailorDBFileError` runtime class. The class itself
|
|
71
|
+
* is provided by the platform runtime (and by `injectMocks` in tests); this
|
|
72
|
+
* interface mirrors it so callers can `import type { TailorDBFileError }` from
|
|
73
|
+
* the wrapper module without depending on any ambient declaration.
|
|
74
|
+
*/
|
|
75
|
+
interface TailorDBFileError extends Error {
|
|
76
|
+
name: "TailorDBFileError";
|
|
77
|
+
code?: TailorDBFileErrorCode;
|
|
78
|
+
cause?: unknown;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Platform API surface for `tailordb.file`. Describes the shape the platform
|
|
82
|
+
* runtime injects on `globalThis.tailordb.file`.
|
|
83
|
+
*/
|
|
84
|
+
interface TailorDBFileAPI {
|
|
85
|
+
/**
|
|
86
|
+
* Upload a file to TailorDB.
|
|
87
|
+
* @param namespace - TailorDB namespace
|
|
88
|
+
* @param typeName - TailorDB type name
|
|
89
|
+
* @param fieldName - File field name on the type
|
|
90
|
+
* @param recordId - Record ID owning the field
|
|
91
|
+
* @param data - File contents
|
|
92
|
+
* @param options - Upload options (e.g. `contentType`)
|
|
93
|
+
* @returns Upload response containing the file metadata
|
|
94
|
+
*/
|
|
95
|
+
upload(namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions): Promise<FileUploadResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Download a file from TailorDB.
|
|
98
|
+
*
|
|
99
|
+
* Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file
|
|
100
|
+
* exceeds 10MB — use {@link downloadStream} for large files.
|
|
101
|
+
* @param namespace - TailorDB namespace
|
|
102
|
+
* @param typeName - TailorDB type name
|
|
103
|
+
* @param fieldName - File field name on the type
|
|
104
|
+
* @param recordId - Record ID owning the field
|
|
105
|
+
* @returns Bytes and metadata for the file
|
|
106
|
+
*/
|
|
107
|
+
download(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Download a file from TailorDB as a Base64-encoded string.
|
|
110
|
+
*
|
|
111
|
+
* Throws `TailorDBFileError` with code `FILE_TOO_LARGE` when the file
|
|
112
|
+
* exceeds 10MB — use {@link downloadStream} for large files.
|
|
113
|
+
* @param namespace - TailorDB namespace
|
|
114
|
+
* @param typeName - TailorDB type name
|
|
115
|
+
* @param fieldName - File field name on the type
|
|
116
|
+
* @param recordId - Record ID owning the field
|
|
117
|
+
* @returns Base64-encoded contents and metadata for the file
|
|
118
|
+
*/
|
|
119
|
+
downloadAsBase64(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadAsBase64Response>;
|
|
120
|
+
/**
|
|
121
|
+
* Delete a file from TailorDB.
|
|
122
|
+
* @param namespace - TailorDB namespace
|
|
123
|
+
* @param typeName - TailorDB type name
|
|
124
|
+
* @param fieldName - File field name on the type
|
|
125
|
+
* @param recordId - Record ID owning the field
|
|
126
|
+
* @returns Resolves once the file has been deleted
|
|
127
|
+
*/
|
|
128
|
+
delete(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Get file metadata from TailorDB.
|
|
131
|
+
* @param namespace - TailorDB namespace
|
|
132
|
+
* @param typeName - TailorDB type name
|
|
133
|
+
* @param fieldName - File field name on the type
|
|
134
|
+
* @param recordId - Record ID owning the field
|
|
135
|
+
* @returns Metadata for the stored file
|
|
136
|
+
*/
|
|
137
|
+
getMetadata(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileMetadata>;
|
|
138
|
+
/**
|
|
139
|
+
* Download a file as a ReadableStream.
|
|
140
|
+
* @param namespace - TailorDB namespace
|
|
141
|
+
* @param typeName - TailorDB type name
|
|
142
|
+
* @param fieldName - File field name on the type
|
|
143
|
+
* @param recordId - Record ID owning the field
|
|
144
|
+
* @returns ReadableStream body and metadata for the file
|
|
145
|
+
*/
|
|
146
|
+
downloadStream(namespace: string, typeName: string, fieldName: string, recordId: string): Promise<FileDownloadStreamResponse>;
|
|
147
|
+
/**
|
|
148
|
+
* Upload a file using a ReadableStream.
|
|
149
|
+
* @param namespace - TailorDB namespace
|
|
150
|
+
* @param typeName - TailorDB type name
|
|
151
|
+
* @param fieldName - File field name on the type
|
|
152
|
+
* @param recordId - Record ID owning the field
|
|
153
|
+
* @param readableStream - ReadableStream providing the file data
|
|
154
|
+
* @param options - Upload stream options (e.g. `contentType`, `fileSize`)
|
|
155
|
+
* @returns Upload response containing the file metadata
|
|
156
|
+
*/
|
|
157
|
+
uploadStream(namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions): Promise<FileUploadResponse>;
|
|
158
|
+
}
|
|
159
|
+
/** Runtime wrapper namespace for `tailordb.file`. */
|
|
160
|
+
declare const file: {
|
|
161
|
+
readonly upload: (namespace: string, typeName: string, fieldName: string, recordId: string, data: string | ArrayBuffer | Uint8Array | number[], options?: FileUploadOptions) => Promise<FileUploadResponse>;
|
|
162
|
+
readonly download: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadResponse>;
|
|
163
|
+
readonly downloadAsBase64: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadAsBase64Response>;
|
|
164
|
+
readonly delete: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<void>;
|
|
165
|
+
readonly getMetadata: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileMetadata>;
|
|
166
|
+
readonly downloadStream: (namespace: string, typeName: string, fieldName: string, recordId: string) => Promise<FileDownloadStreamResponse>;
|
|
167
|
+
readonly uploadStream: (namespace: string, typeName: string, fieldName: string, recordId: string, readableStream: ReadableStream<Uint8Array | ArrayBuffer>, options?: FileUploadStreamOptions) => Promise<FileUploadResponse>;
|
|
168
|
+
};
|
|
169
|
+
//#endregion
|
|
170
|
+
export { DownloadMetadata, FileDownloadAsBase64Response, FileDownloadResponse, FileDownloadStreamResponse, FileMetadata, FileUploadOptions, FileUploadResponse, FileUploadStreamOptions, TailorDBFileAPI, TailorDBFileError, TailorDBFileErrorCode, UploadMetadata, file };
|
package/dist/runtime/file.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
+
import { t as file } from "../file-BUcmVIH2.mjs";
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { deleteFile as delete, deleteFile, download, downloadAsBase64, downloadStream, getMetadata, openDownloadStream, upload, uploadStream };
|
|
3
|
+
export { file };
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { Invoker, StartWorkflowOptions } from "./workflow.mjs";
|
|
2
|
+
import { ContextInvoker } from "./context.mjs";
|
|
3
|
+
import { TailorDBFileErrorCode } from "./file.mjs";
|
|
4
|
+
import { IconvInstance } from "./iconv.mjs";
|
|
5
|
+
import { ClientConfig, CreateUserInput, IdpClientInstance, ListUsersOptions, ListUsersResponse, SendPasswordResetEmailInput, UnenrollMfaInput, UpdateUserInput, User, UserQuery } from "./idp.mjs";
|
|
6
|
+
import { LogAttributeValue, LogAttributes } from "./logger.mjs";
|
|
7
|
+
import { TailorRuntime, TailordbClientInstance, TailordbCommandType, TailordbQueryResult, TailordbRuntime } from "./index.mjs";
|
|
8
8
|
//#region src/runtime/globals.d.ts
|
|
9
|
+
type TailorIdpClientConfig = ClientConfig;
|
|
10
|
+
type TailorIdpCreateUserInput = CreateUserInput;
|
|
11
|
+
type TailorIdpClientInstance = IdpClientInstance;
|
|
12
|
+
type TailorIdpListUsersOptions = ListUsersOptions;
|
|
13
|
+
type TailorIdpListUsersResponse = ListUsersResponse;
|
|
14
|
+
type TailorIdpSendPasswordResetEmailInput = SendPasswordResetEmailInput;
|
|
15
|
+
type TailorIdpUnenrollMfaInput = UnenrollMfaInput;
|
|
16
|
+
type TailorIdpUpdateUserInput = UpdateUserInput;
|
|
17
|
+
type TailorIdpUser = User;
|
|
18
|
+
type TailorIdpUserQuery = UserQuery;
|
|
19
|
+
type TailorWorkflowInvoker = Invoker;
|
|
20
|
+
type TailorWorkflowStartWorkflowOptions = StartWorkflowOptions;
|
|
21
|
+
type TailorLoggerLogAttributeValue = LogAttributeValue;
|
|
22
|
+
type TailorLoggerLogAttributes = LogAttributes;
|
|
9
23
|
declare global {
|
|
10
24
|
namespace tailordb {
|
|
11
25
|
type QueryResult<T> = TailordbQueryResult<T>;
|
|
@@ -13,61 +27,33 @@ declare global {
|
|
|
13
27
|
type Client = TailordbClientInstance;
|
|
14
28
|
}
|
|
15
29
|
var tailordb: TailordbRuntime;
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated Use the lowercase `tailordb.*` namespace instead (e.g.
|
|
18
|
-
* `tailordb.QueryResult`, `tailordb.CommandType`,
|
|
19
|
-
* `typeof tailordb.Client`). This capital-cased namespace is retained
|
|
20
|
-
* only for backwards compatibility with `@tailor-platform/function-types`
|
|
21
|
-
* and will be removed in v2. Run
|
|
22
|
-
* `pnpm dlx @tailor-platform/sdk-codemod v2/tailordb-namespace`
|
|
23
|
-
* to migrate.
|
|
24
|
-
*/
|
|
25
|
-
namespace Tailordb {
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated Use `tailordb.Client` (lowercase) instead.
|
|
28
|
-
* Will be removed in v2.
|
|
29
|
-
*/
|
|
30
|
-
class Client {
|
|
31
|
-
constructor(config: {
|
|
32
|
-
namespace: string;
|
|
33
|
-
});
|
|
34
|
-
connect(): Promise<void>;
|
|
35
|
-
end(): Promise<void>;
|
|
36
|
-
queryObject<O>(sql: string, args?: readonly unknown[]): Promise<TailordbQueryResult<O>>;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated Use `tailordb.QueryResult<T>` (lowercase) instead.
|
|
40
|
-
* Will be removed in v2.
|
|
41
|
-
*/
|
|
42
|
-
type QueryResult<T> = TailordbQueryResult<T>;
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use `tailordb.CommandType` (lowercase) instead.
|
|
45
|
-
* Will be removed in v2.
|
|
46
|
-
*/
|
|
47
|
-
type CommandType = TailordbCommandType;
|
|
48
|
-
}
|
|
49
30
|
namespace tailor {
|
|
50
31
|
namespace iconv {
|
|
51
32
|
type Iconv = IconvInstance;
|
|
52
33
|
}
|
|
53
34
|
namespace idp {
|
|
54
|
-
type Client =
|
|
55
|
-
type ClientConfig =
|
|
56
|
-
type User =
|
|
57
|
-
type UserQuery =
|
|
58
|
-
type ListUsersOptions =
|
|
59
|
-
type ListUsersResponse =
|
|
60
|
-
type CreateUserInput =
|
|
61
|
-
type UpdateUserInput =
|
|
62
|
-
type SendPasswordResetEmailInput =
|
|
35
|
+
type Client = TailorIdpClientInstance;
|
|
36
|
+
type ClientConfig = TailorIdpClientConfig;
|
|
37
|
+
type User = TailorIdpUser;
|
|
38
|
+
type UserQuery = TailorIdpUserQuery;
|
|
39
|
+
type ListUsersOptions = TailorIdpListUsersOptions;
|
|
40
|
+
type ListUsersResponse = TailorIdpListUsersResponse;
|
|
41
|
+
type CreateUserInput = TailorIdpCreateUserInput;
|
|
42
|
+
type UpdateUserInput = TailorIdpUpdateUserInput;
|
|
43
|
+
type SendPasswordResetEmailInput = TailorIdpSendPasswordResetEmailInput;
|
|
44
|
+
type UnenrollMfaInput = TailorIdpUnenrollMfaInput;
|
|
63
45
|
}
|
|
64
46
|
namespace workflow {
|
|
65
|
-
type
|
|
66
|
-
type
|
|
47
|
+
type Invoker = TailorWorkflowInvoker;
|
|
48
|
+
type StartWorkflowOptions = TailorWorkflowStartWorkflowOptions;
|
|
67
49
|
}
|
|
68
50
|
namespace context {
|
|
69
51
|
type Invoker = ContextInvoker;
|
|
70
52
|
}
|
|
53
|
+
namespace logger {
|
|
54
|
+
type LogAttributeValue = TailorLoggerLogAttributeValue;
|
|
55
|
+
type LogAttributes = TailorLoggerLogAttributes;
|
|
56
|
+
}
|
|
71
57
|
}
|
|
72
58
|
var tailor: TailorRuntime;
|
|
73
59
|
/** Custom error class for TailorDB File operations. */
|
|
@@ -99,5 +85,4 @@ declare global {
|
|
|
99
85
|
constructor(message: string);
|
|
100
86
|
name: "TailorErrorMessage";
|
|
101
87
|
}
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=globals.d.mts.map
|
|
88
|
+
}
|
package/dist/runtime/globals.mjs
CHANGED