@tailor-platform/sdk 2.0.0-next.2 → 2.0.0-next.3
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 +466 -10
- package/README.md +9 -9
- package/agent-skills/{tailor-sdk → tailor}/SKILL.md +3 -1
- package/dist/aigateway-B3oZZE6v.mjs +15 -0
- package/dist/aigateway-B3oZZE6v.mjs.map +1 -0
- package/dist/application-D2hSK1ZL.mjs +3 -0
- package/dist/application-eHp9jXld.mjs +6393 -0
- package/dist/application-eHp9jXld.mjs.map +1 -0
- package/dist/{authconnection-D2MhtTN5.mjs → authconnection-BGQM8FZI.mjs} +2 -2
- package/dist/authconnection-BGQM8FZI.mjs.map +1 -0
- 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/apply-phases.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 +11 -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 +223 -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 +98 -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 +61 -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/erd-viewer-assets/app.js +279 -36
- package/dist/cli/erd-viewer-assets/index.html +4 -0
- package/dist/cli/erd-viewer-assets/styles.css +252 -5
- package/dist/cli/index.d.mts +18 -3
- package/dist/cli/index.mjs +2136 -519
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +81 -21107
- package/dist/cli/lib.mjs +6 -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 +26 -0
- package/dist/cli/shared/context.d.mts +28 -0
- package/dist/cli/shared/script-executor.d.mts +75 -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/ts-hook.d.mts +4 -0
- package/dist/cli/ts-hook.mjs +303 -0
- package/dist/completion/zsh-worker.zsh +1523 -1123
- package/dist/configure/config/index.d.mts +21 -0
- package/dist/configure/config/types.d.mts +103 -0
- package/dist/configure/index.d.mts +122 -9
- package/dist/configure/index.mjs +24 -21
- 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 +34 -0
- package/dist/configure/services/auth/types.d.mts +172 -0
- package/dist/configure/services/executor/executor.d.mts +81 -0
- package/dist/configure/services/executor/index.d.mts +8 -0
- package/dist/configure/services/executor/operation.d.mts +45 -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 +32 -0
- package/dist/configure/services/resolver/index.d.mts +5 -0
- package/dist/configure/services/resolver/resolver.d.mts +75 -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 +456 -0
- package/dist/configure/services/tailordb/types.d.mts +149 -0
- package/dist/configure/services/workflow/index.d.mts +6 -0
- package/dist/configure/services/workflow/job.d.mts +79 -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 +54 -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-runtime.d.mts +17 -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 +2 -0
- package/dist/configure/types/type.d.mts +82 -0
- package/dist/context-Bd266-ru.mjs.map +1 -1
- package/dist/{crashreport-DFq-vsU0.mjs → crashreport-Cg-pqRJV.mjs} +6 -6
- package/dist/{crashreport-DFq-vsU0.mjs.map → crashreport-Cg-pqRJV.mjs.map} +1 -1
- package/dist/{crashreport-BMWcxeSE.mjs → crashreport-D3RjuSYb.mjs} +1 -1
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -1
- package/dist/{errors-Dtf2WPaW.mjs → errors-118wUDRr.mjs} +2 -2
- package/dist/errors-118wUDRr.mjs.map +1 -0
- package/dist/field-runtime-CAnh_oow.mjs +183 -0
- package/dist/field-runtime-CAnh_oow.mjs.map +1 -0
- package/dist/file-utils-CYZnO1pX.mjs.map +1 -1
- package/dist/{globals-Cf0sxIt8.mjs → globals-DhwZj0RB.mjs} +4 -46
- package/dist/globals-DhwZj0RB.mjs.map +1 -0
- package/dist/{idp-BDbK5gjm.mjs → idp-Bx25ZBdN.mjs} +9 -1
- package/dist/idp-Bx25ZBdN.mjs.map +1 -0
- package/dist/{interceptor-D-q1rvRl.mjs → interceptor-e33JtsC-.mjs} +2 -2
- package/dist/interceptor-e33JtsC-.mjs.map +1 -0
- package/dist/kysely/index.d.mts +2 -3
- package/dist/{kysely-type-DR8uzZTA.mjs → kysely-type-5eAChaHO.mjs} +4 -2
- package/dist/kysely-type-5eAChaHO.mjs.map +1 -0
- package/dist/{logger-CxF-Ex5d.mjs → logger-BEiZZ3qT.mjs} +3 -3
- package/dist/{logger-CxF-Ex5d.mjs.map → logger-BEiZZ3qT.mjs.map} +1 -1
- 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/platform-serialize-RoRtBS0v.mjs +46 -0
- package/dist/platform-serialize-RoRtBS0v.mjs.map +1 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +16 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +16 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +16 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +45 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/get-generated-type.d.mts +17 -0
- package/dist/plugin/index.d.mts +3 -118
- package/dist/plugin/index.mjs +1 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/manager.d.mts +1 -0
- package/dist/plugin/types.d.mts +243 -0
- package/dist/plugin/with-context.d.mts +102 -0
- package/dist/{runtime-CY4JvrDj.mjs → register-ts-hook-ZpBacA07.mjs} +3426 -2041
- package/dist/register-ts-hook-ZpBacA07.mjs.map +1 -0
- package/dist/registry-DH4m7eYo.mjs.map +1 -1
- package/dist/{repl-editor-DmGr9zMw.mjs → repl-editor-BCozyiNq.mjs} +6 -5
- package/dist/{repl-editor-DmGr9zMw.mjs.map → repl-editor-BCozyiNq.mjs.map} +1 -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 -1
- package/dist/runtime/context.d.mts +46 -2
- package/dist/runtime/file.d.mts +210 -2
- package/dist/runtime/globals.d.mts +31 -19
- package/dist/runtime/iconv.d.mts +121 -2
- package/dist/runtime/idp.d.mts +186 -2
- package/dist/runtime/idp.mjs +1 -1
- package/dist/runtime/index.d.mts +47 -9
- package/dist/runtime/index.mjs +5 -4
- package/dist/runtime/secretmanager.d.mts +54 -2
- package/dist/{types-BZ7QKVE8.d.mts → runtime/types.d.mts} +4 -5
- package/dist/runtime/workflow.d.mts +112 -2
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{schema-Dtw9Orye.mjs → schema-89dYxNC2.mjs} +17 -182
- package/dist/schema-89dYxNC2.mjs.map +1 -0
- package/dist/{secret-file-VSVGy1V0.mjs → secret-file-aoNXJmKa.mjs} +3 -3
- package/dist/secret-file-aoNXJmKa.mjs.map +1 -0
- package/dist/secretmanager-Bd45j7an.mjs +98 -0
- package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
- package/dist/seed/index.d.mts +1 -2
- package/dist/{seed-izIEyP3z.mjs → seed-CRSQJI_z.mjs} +14 -3
- package/dist/seed-CRSQJI_z.mjs.map +1 -0
- package/dist/service-CkIwEctX.mjs +3 -0
- package/dist/{service-DU1mVzri2.mjs → service-DeZeYa06.mjs} +3 -3
- package/dist/service-DeZeYa06.mjs.map +1 -0
- package/dist/{service-DjyqbCaJ.mjs → service-ufH7sS8o.mjs} +396 -58
- package/dist/service-ufH7sS8o.mjs.map +1 -0
- package/dist/service_pb-CIrhGwHk.mjs +988 -0
- package/dist/service_pb-CIrhGwHk.mjs.map +1 -0
- package/dist/service_pb-DjwIn4jO.mjs +3 -0
- 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-CdqJEzkj.mjs → telemetry-BRVdwh14.mjs} +3 -3
- package/dist/telemetry-BRVdwh14.mjs.map +1 -0
- package/dist/telemetry-CkbkeJxl.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 +145 -0
- package/dist/types/executor.generated.d.mts +177 -0
- package/dist/types/helpers.d.mts +39 -0
- package/dist/types/http-adapter.generated.d.mts +17 -0
- package/dist/{workflow.generated-ClEjBYhm.d.mts → types/idp.generated.d.mts} +98 -185
- package/dist/types/resolver.generated.d.mts +39 -0
- package/dist/types/secrets.generated.d.mts +14 -0
- package/dist/types/staticwebsite.generated.d.mts +10 -0
- package/dist/{types-CdcQh4Z2.d.mts → types/tailordb.generated.d.mts} +2 -287
- package/dist/types/workflow.generated.d.mts +12 -0
- package/dist/types-C-lQ4se3.mjs +4 -0
- package/dist/types-CXF2OYdR.mjs +199 -0
- package/dist/types-CXF2OYdR.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +5 -89
- 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 +2 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +12 -428
- package/dist/vitest/index.mjs +739 -8
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/mock-kysely.d.mts +62 -0
- package/dist/vitest/mock.d.mts +9 -0
- package/dist/vitest/mocks/aigateway.d.mts +30 -0
- package/dist/vitest/mocks/authconnection.d.mts +28 -0
- package/dist/vitest/mocks/file.d.mts +41 -0
- package/dist/vitest/mocks/iconv.d.mts +27 -0
- package/dist/vitest/mocks/idp.d.mts +44 -0
- package/dist/vitest/mocks/secretmanager.d.mts +33 -0
- package/dist/vitest/mocks/tailordb.d.mts +71 -0
- package/dist/vitest/mocks/workflow.d.mts +115 -0
- package/dist/vitest/setup.d.mts +1 -2
- package/dist/vitest/setup.mjs +2 -2
- package/dist/vitest/workflow-local.d.mts +40 -0
- package/dist/{workflow-BOmaZwwG.mjs → workflow-Bo59B75H.mjs} +9 -2
- package/dist/workflow-Bo59B75H.mjs.map +1 -0
- package/docs/cli/application.md +98 -250
- package/docs/cli/auth.md +48 -292
- package/docs/cli/completion.md +1 -25
- package/docs/cli/crashreport.md +3 -61
- package/docs/cli/executor.md +23 -187
- package/docs/cli/function.md +14 -130
- 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 +137 -41
- package/docs/cli/skills.md +50 -39
- package/docs/cli/staticwebsite.md +32 -180
- package/docs/cli/tailordb.md +97 -323
- package/docs/cli/upgrade.md +2 -22
- package/docs/cli/user.md +78 -247
- package/docs/cli/workflow.md +44 -203
- package/docs/cli/workspace.md +165 -538
- package/docs/cli-reference.md +167 -67
- package/docs/configuration.md +10 -4
- package/docs/github-actions.md +46 -19
- package/docs/migration/v2.md +286 -26
- package/docs/multi-environment.md +29 -7
- package/docs/plugin/index.md +6 -6
- package/docs/quickstart.md +8 -7
- package/docs/runtime.md +5 -1
- package/docs/services/aigateway.md +18 -2
- package/docs/services/auth.md +32 -40
- package/docs/services/http-adapter.md +16 -1
- package/docs/services/idp.md +55 -2
- package/docs/services/resolver.md +1 -1
- package/docs/services/secret.md +11 -11
- package/docs/services/staticwebsite.md +8 -2
- package/docs/services/tailordb-migration.md +24 -22
- package/docs/services/tailordb.md +25 -2
- package/docs/services/workflow.md +14 -14
- package/docs/testing.md +49 -3
- package/package.json +42 -31
- package/postinstall.mjs +4 -6
- package/dist/application-Dtqap5jM.mjs +0 -3
- package/dist/application-XuMWK4eq.mjs +0 -7257
- package/dist/application-XuMWK4eq.mjs.map +0 -1
- package/dist/authconnection-D2MhtTN5.mjs.map +0 -1
- package/dist/authconnection-DvUQAjQS.d.mts +0 -39
- package/dist/context-C2lEi9uw.d.mts +0 -47
- package/dist/errors-Dtf2WPaW.mjs.map +0 -1
- package/dist/field-DOsJCPFa.mjs +0 -22
- package/dist/field-DOsJCPFa.mjs.map +0 -1
- package/dist/file-Dq3NIt_F.d.mts +0 -211
- package/dist/globals-Cf0sxIt8.mjs.map +0 -1
- package/dist/http-adapter.generated-DFsXDdm5.d.mts +0 -581
- package/dist/iconv-Co-TOPuH.d.mts +0 -122
- package/dist/idp-BDbK5gjm.mjs.map +0 -1
- package/dist/idp-DrhVrLmV.d.mts +0 -160
- package/dist/index-BI-_j9Z3.d.mts +0 -1013
- package/dist/index-C4JirJH8.d.mts +0 -18
- package/dist/index-CZfWhr0a.d.mts +0 -18
- package/dist/index-Cg8VKAdN.d.mts +0 -46
- package/dist/index-DYRjoLXD.d.mts +0 -47
- package/dist/index-lFpcjHPU.d.mts +0 -201
- package/dist/index-nW7hE6oE.d.mts +0 -18
- package/dist/interceptor-D-q1rvRl.mjs.map +0 -1
- package/dist/kysely-type-DR8uzZTA.mjs.map +0 -1
- package/dist/mock-FPxmnt-y.mjs +0 -759
- package/dist/mock-FPxmnt-y.mjs.map +0 -1
- package/dist/runtime-CY4JvrDj.mjs.map +0 -1
- package/dist/schema-Dtw9Orye.mjs.map +0 -1
- package/dist/secret-file-VSVGy1V0.mjs.map +0 -1
- package/dist/secretmanager-B3n4KHfm.d.mts +0 -55
- package/dist/seed-izIEyP3z.mjs.map +0 -1
- package/dist/service-DCqIWibD.mjs +0 -3
- package/dist/service-DU1mVzri2.mjs.map +0 -1
- package/dist/service-DjyqbCaJ.mjs.map +0 -1
- package/dist/telemetry-CdqJEzkj.mjs.map +0 -1
- package/dist/telemetry-ClwW5ohF.mjs +0 -3
- package/dist/types-74etvaxy.mjs +0 -4
- package/dist/types-BDRml5C3.d.mts +0 -574
- package/dist/types-BQijbo4m.mjs +0 -371
- package/dist/types-BQijbo4m.mjs.map +0 -1
- package/dist/types-BX4q6Mo6.d.mts +0 -339
- package/dist/workflow-BOmaZwwG.mjs.map +0 -1
- package/dist/workflow-BVy4XWjS.d.mts +0 -101
|
@@ -9,7 +9,7 @@ import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
|
9
9
|
*/
|
|
10
10
|
function createTracingInterceptor() {
|
|
11
11
|
return (next) => async (req) => {
|
|
12
|
-
return trace.getTracer("tailor
|
|
12
|
+
return trace.getTracer("tailor").startActiveSpan(`rpc.${req.method.name}`, async (span) => {
|
|
13
13
|
span.setAttribute("rpc.method", req.method.name);
|
|
14
14
|
span.setAttribute("rpc.service", "OperatorService");
|
|
15
15
|
span.setAttribute("rpc.system", "connect-rpc");
|
|
@@ -30,4 +30,4 @@ function createTracingInterceptor() {
|
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
32
|
export { createTracingInterceptor };
|
|
33
|
-
//# sourceMappingURL=interceptor-
|
|
33
|
+
//# sourceMappingURL=interceptor-e33JtsC-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor-e33JtsC-.mjs","names":[],"sources":["../src/cli/telemetry/interceptor.ts"],"sourcesContent":["import { trace, SpanStatusCode } from \"@opentelemetry/api\";\nimport type { Interceptor } from \"@connectrpc/connect\";\n\n/**\n * Create a Connect-RPC interceptor that records OTLP spans for each RPC call.\n * When no TracerProvider is registered, the OTel API automatically provides\n * noop spans with zero overhead.\n * @returns Tracing interceptor\n */\nexport function createTracingInterceptor(): Interceptor {\n return (next) => async (req) => {\n const tracer = trace.getTracer(\"tailor\");\n\n return tracer.startActiveSpan(`rpc.${req.method.name}`, async (span) => {\n span.setAttribute(\"rpc.method\", req.method.name);\n span.setAttribute(\"rpc.service\", \"OperatorService\");\n span.setAttribute(\"rpc.system\", \"connect-rpc\");\n\n try {\n const response = await next(req);\n span.setStatus({ code: SpanStatusCode.OK });\n return response;\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n if (error instanceof Error) {\n span.recordException(error);\n }\n throw error;\n } finally {\n span.end();\n }\n });\n };\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,2BAAwC;CACtD,QAAQ,SAAS,OAAO,QAAQ;EAG9B,OAFe,MAAM,UAAU,QAEnB,CAAC,CAAC,gBAAgB,OAAO,IAAI,OAAO,QAAQ,OAAO,SAAS;GACtE,KAAK,aAAa,cAAc,IAAI,OAAO,IAAI;GAC/C,KAAK,aAAa,eAAe,iBAAiB;GAClD,KAAK,aAAa,cAAc,aAAa;GAE7C,IAAI;IACF,MAAM,WAAW,MAAM,KAAK,GAAG;IAC/B,KAAK,UAAU,EAAE,MAAM,eAAe,GAAG,CAAC;IAC1C,OAAO;GACT,SAAS,OAAO;IACd,KAAK,UAAU,EAAE,MAAM,eAAe,MAAM,CAAC;IAC7C,IAAI,iBAAiB,OACnB,KAAK,gBAAgB,KAAK;IAE5B,MAAM;GACR,UAAU;IACR,KAAK,IAAI;GACX;EACF,CAAC;CACH;AACF"}
|
package/dist/kysely/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
2
1
|
import { ColumnType, ColumnType as ColumnType$1, Insertable, Insertable as Insertable$1, Kysely, Kysely as Kysely$1, KyselyConfig, KyselyConfig as KyselyConfig$1, Selectable, Selectable as Selectable$1, Transaction, Transaction as Transaction$1, Updateable, Updateable as Updateable$1, sql } from "kysely";
|
|
2
|
+
import { TailordbDialect } from "@tailor-platform/function-kysely-tailordb";
|
|
3
3
|
|
|
4
4
|
//#region src/kysely/index.d.ts
|
|
5
5
|
type Timestamp = ColumnType$1<Date, Date | string, Date | string>;
|
|
@@ -24,5 +24,4 @@ type NamespaceInsertable<NS, T extends NamespaceTableName<NS>> = Insertable$1<Na
|
|
|
24
24
|
type NamespaceSelectable<NS, T extends NamespaceTableName<NS>> = Selectable$1<NamespaceTable<NS, T>>;
|
|
25
25
|
type NamespaceUpdateable<NS, T extends NamespaceTableName<NS>> = Updateable$1<NamespaceTable<NS, T>>;
|
|
26
26
|
//#endregion
|
|
27
|
-
export { ArrayColumnType, type ColumnType, Generated, type Insertable, Kysely, type KyselyConfig, NamespaceDB, NamespaceInsertable, NamespaceSelectable, NamespaceTable, NamespaceTableName, NamespaceTransaction, NamespaceUpdateable, ObjectColumnType, type Selectable, Serial, TailordbDialect, TailordbKysely, Timestamp, type Transaction, type Updateable, createGetDB, sql };
|
|
28
|
-
//# sourceMappingURL=index.d.mts.map
|
|
27
|
+
export { ArrayColumnType, type ColumnType, Generated, type Insertable, Kysely, type KyselyConfig, NamespaceDB, NamespaceInsertable, NamespaceSelectable, NamespaceTable, NamespaceTableName, NamespaceTransaction, NamespaceUpdateable, ObjectColumnType, type Selectable, Serial, TailordbDialect, TailordbKysely, Timestamp, type Transaction, type Updateable, createGetDB, sql };
|
|
@@ -76,6 +76,8 @@ function getBaseType(fieldConfig) {
|
|
|
76
76
|
type = "number";
|
|
77
77
|
break;
|
|
78
78
|
case "date":
|
|
79
|
+
type = "string";
|
|
80
|
+
break;
|
|
79
81
|
case "datetime":
|
|
80
82
|
usedUtilityTypes.Timestamp = true;
|
|
81
83
|
type = "Timestamp";
|
|
@@ -107,7 +109,7 @@ function generateFieldType(fieldConfig) {
|
|
|
107
109
|
const usedUtilityTypes = { ...baseTypeResult.usedUtilityTypes };
|
|
108
110
|
const isArray = fieldConfig.array === true;
|
|
109
111
|
const isNullable = fieldConfig.required !== true;
|
|
110
|
-
const isColumnTypeBase = new Set(["Timestamp"]).has(baseTypeResult.type);
|
|
112
|
+
const isColumnTypeBase = (/* @__PURE__ */ new Set(["Timestamp"])).has(baseTypeResult.type);
|
|
111
113
|
let finalType = baseTypeResult.type;
|
|
112
114
|
if (isArray) if (isColumnTypeBase || finalType.startsWith("ObjectColumnType<")) finalType = `ArrayColumnType<${baseTypeResult.type}>`;
|
|
113
115
|
else finalType = fieldConfig.type === "enum" ? `(${baseTypeResult.type})[]` : `${baseTypeResult.type}[]`;
|
|
@@ -271,4 +273,4 @@ function kyselyTypePlugin(options) {
|
|
|
271
273
|
|
|
272
274
|
//#endregion
|
|
273
275
|
export { kyselyTypePlugin as n, KyselyGeneratorID as t };
|
|
274
|
-
//# sourceMappingURL=kysely-type-
|
|
276
|
+
//# sourceMappingURL=kysely-type-5eAChaHO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kysely-type-5eAChaHO.mjs","names":[],"sources":["../src/plugin/builtin/kysely-type/type-processor.ts","../src/plugin/builtin/kysely-type/index.ts"],"sourcesContent":["import multiline from \"#/utils/multiline\";\nimport { type KyselyNamespaceMetadata, type KyselyTypeMetadata } from \"./types\";\nimport type { OperatorFieldConfig, TailorDBType } from \"#/parser/service/tailordb/types\";\n\ntype UsedUtilityTypes = { Timestamp: boolean; Serial: boolean };\n\ntype FieldTypeResult = {\n type: string;\n usedUtilityTypes: UsedUtilityTypes;\n};\n\n/**\n * Get the enum type definition.\n * @param fieldConfig - The field configuration\n * @returns The enum type as a string union\n */\nfunction getEnumType(fieldConfig: OperatorFieldConfig): string {\n const allowedValues = fieldConfig.allowedValues;\n\n if (allowedValues && Array.isArray(allowedValues)) {\n return allowedValues\n .map((v: string | { value: string }) => {\n const value = typeof v === \"string\" ? v : v.value;\n return `\"${value}\"`;\n })\n .join(\" | \");\n }\n return \"string\";\n}\n\n/**\n * Get the nested object type definition.\n * @param fieldConfig - The field configuration\n * @returns The nested type with used utility types\n */\nfunction getNestedType(fieldConfig: OperatorFieldConfig): FieldTypeResult {\n const fields = fieldConfig.fields;\n if (!fields || typeof fields !== \"object\") {\n return {\n type: \"string\",\n usedUtilityTypes: { Timestamp: false, Serial: false },\n };\n }\n\n const fieldResults = Object.entries(fields).map(([fieldName, config]) => {\n const result = generateFieldType(config);\n const optional = config.required !== true ? \"?\" : \"\";\n return {\n fieldType: `${fieldName}${optional}: ${result.type}`,\n usedUtilityTypes: result.usedUtilityTypes,\n };\n });\n\n const aggregatedUtilityTypes = fieldResults.reduce(\n (acc, result) => ({\n Timestamp: acc.Timestamp || result.usedUtilityTypes.Timestamp,\n Serial: acc.Serial || result.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n const fieldTypes = fieldResults.map((r) => r.fieldType);\n const obj = `{\\n ${fieldTypes.join(\";\\n \")}${fieldTypes.length > 0 ? \";\" : \"\"}\\n}`;\n\n const hasOptionalFields = Object.values(fields).some((config) => config.required !== true);\n if (aggregatedUtilityTypes.Timestamp || hasOptionalFields) {\n return { type: `ObjectColumnType<${obj}>`, usedUtilityTypes: aggregatedUtilityTypes };\n }\n return { type: obj, usedUtilityTypes: aggregatedUtilityTypes };\n}\n\n/**\n * Get the base Kysely type for a field (without array/null modifiers).\n * @param fieldConfig - The field configuration\n * @returns The base type with used utility types\n */\nfunction getBaseType(fieldConfig: OperatorFieldConfig): FieldTypeResult {\n const fieldType = fieldConfig.type;\n const usedUtilityTypes = { Timestamp: false, Serial: false };\n\n let type: string;\n switch (fieldType) {\n case \"uuid\":\n case \"string\":\n case \"decimal\":\n type = \"string\";\n break;\n case \"integer\":\n case \"float\":\n type = \"number\";\n break;\n case \"date\":\n type = \"string\";\n break;\n case \"datetime\":\n usedUtilityTypes.Timestamp = true;\n type = \"Timestamp\";\n break;\n case \"bool\":\n case \"boolean\":\n type = \"boolean\";\n break;\n case \"enum\":\n type = getEnumType(fieldConfig);\n break;\n case \"nested\": {\n const nestedResult = getNestedType(fieldConfig);\n return nestedResult;\n }\n default:\n type = \"string\";\n break;\n }\n\n return { type, usedUtilityTypes };\n}\n\n/**\n * Generate the complete field type including array and null modifiers.\n * @param fieldConfig - The field configuration\n * @returns The complete field type with used utility types\n */\nfunction generateFieldType(fieldConfig: OperatorFieldConfig): FieldTypeResult {\n const baseTypeResult = getBaseType(fieldConfig);\n const usedUtilityTypes = { ...baseTypeResult.usedUtilityTypes };\n\n const isArray = fieldConfig.array === true;\n const isNullable = fieldConfig.required !== true;\n\n // Types that use ColumnType internally (Timestamp, ObjectColumnType) cannot be\n // directly wrapped with [] for arrays, because Kysely only resolves ColumnType at\n // the top-level table property. Use ArrayColumnType/ObjectArrayColumnType to keep\n // the ColumnType at the top level with arrays inside.\n const columnTypeBaseTypes = new Set([\"Timestamp\"]);\n const isColumnTypeBase = columnTypeBaseTypes.has(baseTypeResult.type);\n\n let finalType = baseTypeResult.type;\n if (isArray) {\n if (isColumnTypeBase || finalType.startsWith(\"ObjectColumnType<\")) {\n finalType = `ArrayColumnType<${baseTypeResult.type}>`;\n } else {\n const needsParens = fieldConfig.type === \"enum\";\n finalType = needsParens ? `(${baseTypeResult.type})[]` : `${baseTypeResult.type}[]`;\n }\n }\n if (isNullable) {\n finalType = `${finalType} | null`;\n }\n\n if (fieldConfig.serial) {\n usedUtilityTypes.Serial = true;\n finalType = `Serial<${finalType}>`;\n }\n if (fieldConfig.hooks?.create) {\n finalType = `Generated<${finalType}>`;\n }\n\n return { type: finalType, usedUtilityTypes };\n}\n\n/**\n * Generate the table interface.\n * @param type - The parsed TailorDB type\n * @returns The type definition and used utility types\n */\nfunction generateTableInterface(type: TailorDBType): {\n typeDef: string;\n usedUtilityTypes: UsedUtilityTypes;\n} {\n const fieldEntries = Object.entries(type.fields).filter(([fieldName]) => fieldName !== \"id\");\n\n const fieldResults = fieldEntries.map(([fieldName, parsedField]) => ({\n fieldName,\n ...generateFieldType(parsedField.config),\n }));\n\n const fields = [\n \"id: Generated<string>;\",\n ...fieldResults.map((result) => `${result.fieldName}: ${result.type};`),\n ];\n\n const aggregatedUtilityTypes = fieldResults.reduce(\n (acc, result) => ({\n Timestamp: acc.Timestamp || result.usedUtilityTypes.Timestamp,\n\n Serial: acc.Serial || result.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n const typeDef = multiline /* ts */ `\n ${type.name}: {\n ${fields.join(\"\\n\")}\n }\n `;\n\n return { typeDef, usedUtilityTypes: aggregatedUtilityTypes };\n}\n\n/**\n * Convert a TailorDBType into KyselyTypeMetadata.\n * @param type - Parsed TailorDB type\n * @returns Generated Kysely type metadata\n */\nexport async function processKyselyType(type: TailorDBType): Promise<KyselyTypeMetadata> {\n const result = generateTableInterface(type);\n\n return {\n name: type.name,\n typeDef: result.typeDef,\n usedUtilityTypes: result.usedUtilityTypes,\n };\n}\n\n/**\n * Generate unified types file from multiple namespaces.\n * @param namespaceData - Namespace metadata\n * @returns Generated types file contents\n */\nexport function generateUnifiedKyselyTypes(namespaceData: KyselyNamespaceMetadata[]): string {\n if (namespaceData.length === 0) {\n return \"\";\n }\n\n // Aggregate used utility types from all namespaces\n const globalUsedUtilityTypes = namespaceData.reduce(\n (acc, ns) => ({\n Timestamp: acc.Timestamp || ns.usedUtilityTypes.Timestamp,\n Serial: acc.Serial || ns.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n const utilityTypeImports: string[] = [\"type Generated\"];\n if (globalUsedUtilityTypes.Timestamp) {\n utilityTypeImports.push(\"type Timestamp\");\n }\n const hasObjectColumnType = namespaceData.some((ns) =>\n ns.types.some((t) => t.typeDef.includes(\"ObjectColumnType<\")),\n );\n if (hasObjectColumnType) {\n utilityTypeImports.push(\"type ObjectColumnType\");\n }\n const hasArrayColumnType = namespaceData.some((ns) =>\n ns.types.some((t) => t.typeDef.includes(\"ArrayColumnType<\")),\n );\n if (hasArrayColumnType) {\n utilityTypeImports.push(\"type ArrayColumnType\");\n }\n if (globalUsedUtilityTypes.Serial) {\n utilityTypeImports.push(\"type Serial\");\n }\n\n const importsSection = multiline /* ts */ `\n import {\n createGetDB,\n ${utilityTypeImports.join(\",\\n\")},\n type NamespaceDB,\n type NamespaceInsertable,\n type NamespaceSelectable,\n type NamespaceTable,\n type NamespaceTableName,\n type NamespaceTransaction,\n type NamespaceUpdateable,\n } from \"@tailor-platform/sdk/kysely\";\n `;\n\n // Generate Namespace interface with multiple namespaces\n const namespaceInterfaces = namespaceData\n .map(({ namespace, types }) => {\n const typeDefsWithIndent = types\n .map((type) => {\n return type.typeDef\n .split(\"\\n\")\n .map((line) => (line.trim() ? ` ${line}` : \"\"))\n .join(\"\\n\");\n })\n .join(\"\\n\\n\");\n\n return ` \"${namespace}\": {\\n${typeDefsWithIndent}\\n }`;\n })\n .join(\",\\n\");\n\n const namespaceInterface = `export interface Namespace {\\n${namespaceInterfaces}\\n}`;\n\n const getDBFunction = multiline /* ts */ `\n export const getDB = createGetDB<Namespace>();\n\n export type DB<N extends keyof Namespace = keyof Namespace> = NamespaceDB<Namespace, N>;\n `;\n\n const utilityTypeExports = multiline /* ts */ `\n export type Transaction<K extends keyof Namespace | DB = keyof Namespace> =\n NamespaceTransaction<Namespace, K>;\n\n type TableName = NamespaceTableName<Namespace>;\n export type Table<T extends TableName> = NamespaceTable<Namespace, T>;\n\n export type Insertable<T extends TableName> = NamespaceInsertable<Namespace, T>;\n export type Selectable<T extends TableName> = NamespaceSelectable<Namespace, T>;\n export type Updateable<T extends TableName> = NamespaceUpdateable<Namespace, T>;\n `;\n\n return (\n [importsSection, namespaceInterface, getDBFunction, utilityTypeExports].join(\"\\n\\n\") + \"\\n\"\n );\n}\n","import { processKyselyType, generateUnifiedKyselyTypes } from \"./type-processor\";\nimport type { Plugin, GeneratorResult, TailorDBReadyContext } from \"#/plugin/types\";\nimport type { KyselyTypeMetadata, KyselyNamespaceMetadata } from \"./types\";\n\n/** Unique identifier for the Kysely type generator plugin. */\nexport const KyselyGeneratorID = \"@tailor-platform/kysely-type\";\n\ntype KyselyTypePluginOptions = {\n distPath: string;\n};\n\n/**\n * Plugin that generates Kysely type definitions for TailorDB types.\n * @param options - Plugin options\n * @param options.distPath - Output file path for generated types\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function kyselyTypePlugin(\n options: KyselyTypePluginOptions,\n): Plugin<unknown, KyselyTypePluginOptions> {\n return {\n id: KyselyGeneratorID,\n description: \"Generates Kysely type definitions for TailorDB types\",\n pluginConfig: options,\n\n async onTailorDBReady(\n ctx: TailorDBReadyContext<KyselyTypePluginOptions>,\n ): Promise<GeneratorResult> {\n const allNamespaceData: KyselyNamespaceMetadata[] = [];\n\n for (const ns of ctx.tailordb) {\n const typeMetadataList: KyselyTypeMetadata[] = [];\n\n for (const type of Object.values(ns.types)) {\n const metadata = await processKyselyType(type);\n typeMetadataList.push(metadata);\n }\n\n if (typeMetadataList.length === 0) continue;\n\n const usedUtilityTypes = typeMetadataList.reduce(\n (acc, type) => ({\n Timestamp: acc.Timestamp || type.usedUtilityTypes.Timestamp,\n Serial: acc.Serial || type.usedUtilityTypes.Serial,\n }),\n { Timestamp: false, Serial: false },\n );\n\n allNamespaceData.push({\n namespace: ns.namespace,\n types: typeMetadataList,\n usedUtilityTypes,\n });\n }\n\n const files: GeneratorResult[\"files\"] = [];\n if (allNamespaceData.length > 0) {\n const content = generateUnifiedKyselyTypes(allNamespaceData);\n files.push({\n path: ctx.pluginConfig.distPath,\n content,\n });\n }\n\n return { files };\n },\n };\n}\n"],"mappings":";;;;;;;;AAgBA,SAAS,YAAY,aAA0C;CAC7D,MAAM,gBAAgB,YAAY;CAElC,IAAI,iBAAiB,MAAM,QAAQ,aAAa,GAC9C,OAAO,cACJ,KAAK,MAAkC;EAEtC,OAAO,IADO,OAAO,MAAM,WAAW,IAAI,EAAE,MAC3B;CACnB,CAAC,CAAC,CACD,KAAK,KAAK;CAEf,OAAO;AACT;;;;;;AAOA,SAAS,cAAc,aAAmD;CACxE,MAAM,SAAS,YAAY;CAC3B,IAAI,CAAC,UAAU,OAAO,WAAW,UAC/B,OAAO;EACL,MAAM;EACN,kBAAkB;GAAE,WAAW;GAAO,QAAQ;EAAM;CACtD;CAGF,MAAM,eAAe,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,YAAY;EACvE,MAAM,SAAS,kBAAkB,MAAM;EAEvC,OAAO;GACL,WAAW,GAAG,YAFC,OAAO,aAAa,OAAO,MAAM,GAEb,IAAI,OAAO;GAC9C,kBAAkB,OAAO;EAC3B;CACF,CAAC;CAED,MAAM,yBAAyB,aAAa,QACzC,KAAK,YAAY;EAChB,WAAW,IAAI,aAAa,OAAO,iBAAiB;EACpD,QAAQ,IAAI,UAAU,OAAO,iBAAiB;CAChD,IACA;EAAE,WAAW;EAAO,QAAQ;CAAM,CACpC;CAEA,MAAM,aAAa,aAAa,KAAK,MAAM,EAAE,SAAS;CACtD,MAAM,MAAM,QAAQ,WAAW,KAAK,OAAO,IAAI,WAAW,SAAS,IAAI,MAAM,GAAG;CAEhF,MAAM,oBAAoB,OAAO,OAAO,MAAM,CAAC,CAAC,MAAM,WAAW,OAAO,aAAa,IAAI;CACzF,IAAI,uBAAuB,aAAa,mBACtC,OAAO;EAAE,MAAM,oBAAoB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H;GAEA,MAAM,QAAkC,CAAC;GACzC,IAAI,iBAAiB,SAAS,GAAG;IAC/B,MAAM,UAAU,2BAA2B,gBAAgB;IAC3D,MAAM,KAAK;KACT,MAAM,IAAI,aAAa;KACvB;IACF,CAAC;GACH;GAEA,OAAO,EAAE,MAAM;EACjB;CACF;AACF"}
|
|
@@ -4,7 +4,7 @@ import { formatDistanceToNowStrict } from "date-fns";
|
|
|
4
4
|
import { getBorderCharacters, table } from "table";
|
|
5
5
|
|
|
6
6
|
//#region src/cli/shared/parse-boolean.ts
|
|
7
|
-
const TRUTHY_VALUES = new Set([
|
|
7
|
+
const TRUTHY_VALUES = /* @__PURE__ */ new Set([
|
|
8
8
|
"true",
|
|
9
9
|
"t",
|
|
10
10
|
"yes",
|
|
@@ -12,7 +12,7 @@ const TRUTHY_VALUES = new Set([
|
|
|
12
12
|
"on",
|
|
13
13
|
"1"
|
|
14
14
|
]);
|
|
15
|
-
const FALSY_VALUES = new Set([
|
|
15
|
+
const FALSY_VALUES = /* @__PURE__ */ new Set([
|
|
16
16
|
"false",
|
|
17
17
|
"f",
|
|
18
18
|
"no",
|
|
@@ -217,4 +217,4 @@ const logger = {
|
|
|
217
217
|
|
|
218
218
|
//#endregion
|
|
219
219
|
export { parseBoolean as a, symbols as i, logger as n, styles as r, CIPromptError as t };
|
|
220
|
-
//# sourceMappingURL=logger-
|
|
220
|
+
//# sourceMappingURL=logger-BEiZZ3qT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger-CxF-Ex5d.mjs","names":[],"sources":["../src/cli/shared/parse-boolean.ts","../src/cli/shared/logger.ts"],"sourcesContent":["const TRUTHY_VALUES = new Set([\"true\", \"t\", \"yes\", \"y\", \"on\", \"1\"]);\nconst FALSY_VALUES = new Set([\"false\", \"f\", \"no\", \"n\", \"off\", \"0\"]);\n\n/**\n * Parse a string value as a boolean.\n *\n * Recognized values (case-insensitive, trimmed) follow Python's\n * `distutils.util.strtobool` convention:\n * - truthy: `true, t, yes, y, on, 1`\n * - falsy: `false, f, no, n, off, 0`\n *\n * Undefined, empty strings, and unrecognized values return `undefined` so\n * that callers can fall back to their own defaults.\n * @param value - The input string (e.g. an environment variable or CLI flag value)\n * @returns `true`, `false`, or `undefined` when the value is unset or unrecognized\n */\nexport function parseBoolean(value: string | undefined): boolean | undefined {\n if (value === undefined) return undefined;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"\") return undefined;\n if (TRUTHY_VALUES.has(normalized)) return true;\n if (FALSY_VALUES.has(normalized)) return false;\n return undefined;\n}\n","import { formatWithOptions, type InspectOptions } from \"node:util\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns\";\nimport { getBorderCharacters, table } from \"table\";\nimport { parseBoolean } from \"./parse-boolean\";\n\n/**\n * Error thrown when a prompt is attempted in a CI environment\n */\nexport class CIPromptError extends Error {\n constructor(message?: string) {\n super(\n message ??\n \"Interactive prompts are not available in CI environments. Use --yes flag to skip confirmation prompts.\",\n );\n this.name = \"CIPromptError\";\n }\n}\n\n/**\n * Semantic style functions for inline text styling\n */\nexport const styles = {\n // Status colors\n success: chalk.green,\n error: chalk.red,\n warning: chalk.yellow,\n info: chalk.cyan,\n\n // Action colors (for change sets)\n create: chalk.green,\n update: chalk.yellow,\n delete: chalk.red,\n unchanged: chalk.gray,\n\n // Emphasis\n bold: chalk.bold,\n dim: chalk.gray,\n highlight: chalk.cyanBright,\n successBright: chalk.greenBright,\n errorBright: chalk.redBright,\n\n // Resource types\n resourceType: chalk.bold,\n resourceName: chalk.cyan,\n\n // File paths\n path: chalk.cyan,\n\n // Values\n value: chalk.white,\n placeholder: chalk.gray.italic,\n};\n\n/**\n * Standardized symbols for CLI output\n */\nexport const symbols = {\n success: chalk.green(\"\\u2713\"),\n error: chalk.red(\"\\u2716\"),\n warning: chalk.yellow(\"\\u26a0\"),\n info: chalk.cyan(\"i\"),\n create: chalk.green(\"+\"),\n update: chalk.yellow(\"~\"),\n delete: chalk.red(\"-\"),\n replace: chalk.magenta(\"\\u00b1\"),\n bullet: chalk.gray(\"\\u2022\"),\n arrow: chalk.gray(\"\\u2192\"),\n};\n\n/**\n * Log output modes\n */\nexport type LogMode = \"default\" | \"stream\" | \"plain\";\n\nexport interface LogOptions {\n /** Output mode (default: \"default\") */\n mode?: LogMode;\n /** Number of spaces to indent the entire line (default: 0) */\n indent?: number;\n}\n\n/** Field transformer function. null excludes the field from table output. */\nexport type FieldTransformer = ((value: unknown, item: object) => string) | null;\n\nexport interface OutOptions {\n /** Table display field transform/exclude settings. Only applied in table mode (not JSON). */\n display?: Record<string, FieldTransformer>;\n\n /** Show null values in table output (default: false) */\n showNull?: boolean;\n}\n\n// In JSON mode, all logs go to stderr to keep stdout clean for JSON data\nlet _jsonMode = false;\n\n// Type icons for log output\nconst TYPE_ICONS: Record<string, string> = {\n info: \"ℹ\",\n success: \"✔\",\n warn: \"⚠\",\n error: \"✖\",\n debug: \"⚙\",\n trace: \"→\",\n log: \"\",\n};\n\n// Color functions for icon and message text\nconst TYPE_COLORS: Record<string, (text: string) => string> = {\n info: chalk.cyan,\n success: chalk.green,\n warn: chalk.yellow,\n error: chalk.red,\n debug: chalk.gray,\n trace: chalk.gray,\n log: (text) => text,\n};\n\ninterface FormatLogLineOptions {\n mode: string;\n indent: number;\n type: string;\n message: string;\n timestamp?: string;\n}\n\n/**\n * Formats a log line with the appropriate prefix and indentation\n * @param opts - Formatting options\n * @returns Formatted log line\n */\nexport function formatLogLine(opts: FormatLogLineOptions): string {\n const { mode, indent, type, message, timestamp } = opts;\n const indentPrefix = indent > 0 ? \" \".repeat(indent) : \"\";\n const colorFn = TYPE_COLORS[type] || ((text: string) => text);\n\n // Plain mode: color only, no icon, no timestamp\n if (mode === \"plain\") {\n return `${indentPrefix}${colorFn(message)}\\n`;\n }\n\n // Default/Stream mode: with icon and color\n const icon = TYPE_ICONS[type] || \"\";\n const prefix = icon ? `${icon} ` : \"\";\n const coloredOutput = colorFn(`${prefix}${message}`);\n const timestampPrefix = timestamp ?? \"\";\n\n return `${indentPrefix}${timestampPrefix}${coloredOutput}\\n`;\n}\n\n/**\n * Writes a formatted log line to stderr.\n * @param type - Log type (info, success, warn, error, log)\n * @param message - Log message\n * @param opts - Log options (mode and indent)\n */\nfunction writeLog(type: string, message: string, opts?: LogOptions): void {\n const mode = opts?.mode ?? \"default\";\n const indent = opts?.indent ?? 0;\n const inspectOpts: InspectOptions = {\n breakLength: process.stdout.columns || 80,\n };\n const formattedMessage = formatWithOptions(inspectOpts, message);\n const timestamp = mode === \"stream\" ? `${new Date().toLocaleTimeString()} ` : \"\";\n const output = formatLogLine({ mode, indent, type, message: formattedMessage, timestamp });\n process.stderr.write(output);\n}\n\nexport const logger = {\n get jsonMode(): boolean {\n return _jsonMode;\n },\n set jsonMode(value: boolean) {\n _jsonMode = value;\n },\n\n info(message: string, opts?: LogOptions): void {\n writeLog(\"info\", message, opts);\n },\n\n success(message: string, opts?: LogOptions): void {\n writeLog(\"success\", message, opts);\n },\n\n warn(message: string, opts?: LogOptions): void {\n writeLog(\"warn\", message, opts);\n },\n\n error(message: string, opts?: LogOptions): void {\n writeLog(\"error\", message, opts);\n },\n\n log(message: string): void {\n writeLog(\"log\", message, { mode: \"plain\" });\n },\n\n newline(): void {\n process.stderr.write(\"\\n\");\n },\n\n debug(message: string): void {\n if (parseBoolean(process.env.DEBUG) === true) {\n writeLog(\"log\", styles.dim(message), { mode: \"plain\" });\n }\n },\n\n out(data: string | object | object[], options?: OutOptions): void {\n if (typeof data === \"string\") {\n process.stdout.write(data.endsWith(\"\\n\") ? data : data + \"\\n\");\n return;\n }\n\n if (this.jsonMode) {\n // eslint-disable-next-line no-restricted-syntax\n console.log(JSON.stringify(data));\n return;\n }\n\n const display = options?.display;\n\n // Helper to format a value for table display\n const formatValue = (value: unknown, pretty = false): string => {\n if (options?.showNull && value === null) return \"NULL\";\n if (value === null || value === undefined) return \"N/A\";\n if (value instanceof Date) {\n return formatDistanceToNowStrict(value, { addSuffix: true });\n }\n if (typeof value === \"object\") {\n return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);\n }\n return String(value);\n };\n\n // Helper to check if field should be excluded\n const isExcluded = (key: string): boolean => {\n return display !== undefined && key in display && display[key] === null;\n };\n\n // Helper to apply transformer or default formatting\n const transformValue = (key: string, value: unknown, item: object, pretty = false): string => {\n if (display && key in display) {\n const transformer = display[key];\n if (transformer) {\n return transformer(value, item);\n }\n }\n return formatValue(value, pretty);\n };\n\n if (!Array.isArray(data)) {\n const entries = Object.entries(data).filter(([key]) => !isExcluded(key));\n const formattedEntries = entries.map(([key, value]) => [\n key,\n transformValue(key, value, data, true),\n ]);\n const t = table(formattedEntries, {\n singleLine: false,\n border: getBorderCharacters(\"norc\"),\n });\n process.stdout.write(t);\n return;\n }\n\n if (data.length === 0) {\n return;\n }\n\n const allHeaders = Array.from(new Set(data.flatMap((item) => Object.keys(item))));\n const headers = allHeaders.filter((h) => !isExcluded(h));\n const rows = data.map((item) =>\n headers.map((header) =>\n transformValue(header, (item as Record<string, unknown>)[header], item),\n ),\n );\n\n const t = table([headers, ...rows], {\n border: getBorderCharacters(\"norc\"),\n drawHorizontalLine: (lineIndex, rowCount) => {\n return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;\n },\n });\n process.stdout.write(t);\n },\n};\n"],"mappings":";;;;;;AAAA,MAAM,gBAAgB,IAAI,IAAI;CAAC;CAAQ;CAAK;CAAO;CAAK;CAAM;AAAG,CAAC;AAClE,MAAM,eAAe,IAAI,IAAI;CAAC;CAAS;CAAK;CAAM;CAAK;CAAO;AAAG,CAAC;;;;;;;;;;;;;;AAelE,SAAgB,aAAa,OAAgD;CAC3E,IAAI,UAAU,QAAW,OAAO;CAChC,MAAM,aAAa,MAAM,KAAK,CAAC,CAAC,YAAY;CAC5C,IAAI,eAAe,IAAI,OAAO;CAC9B,IAAI,cAAc,IAAI,UAAU,GAAG,OAAO;CAC1C,IAAI,aAAa,IAAI,UAAU,GAAG,OAAO;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S,OAAO,KAAK,IAAI,CAAC,CAAC,CACtD,CAAC,CAAC,QAAQ,MAAM,CAAC,WAAW,CAAC,CAAC;EAOvD,MAAM,IAAI,MAAM,CAAC,SAAS,GANb,KAAK,KAAK,SACrB,QAAQ,KAAK,WACX,eAAe,QAAS,KAAiC,SAAS,IAAI,CACxE,CAG8B,CAAC,GAAG;GAClC,QAAQ,oBAAoB,MAAM;GAClC,qBAAqB,WAAW,aAAa;IAC3C,OAAO,cAAc,KAAK,cAAc,KAAK,cAAc;GAC7D;EACF,CAAC;EACD,QAAQ,OAAO,MAAM,CAAC;CACxB;AACF"}
|
|
1
|
+
{"version":3,"file":"logger-BEiZZ3qT.mjs","names":[],"sources":["../src/cli/shared/parse-boolean.ts","../src/cli/shared/logger.ts"],"sourcesContent":["const TRUTHY_VALUES = new Set([\"true\", \"t\", \"yes\", \"y\", \"on\", \"1\"]);\nconst FALSY_VALUES = new Set([\"false\", \"f\", \"no\", \"n\", \"off\", \"0\"]);\n\n/**\n * Parse a string value as a boolean.\n *\n * Recognized values (case-insensitive, trimmed) follow Python's\n * `distutils.util.strtobool` convention:\n * - truthy: `true, t, yes, y, on, 1`\n * - falsy: `false, f, no, n, off, 0`\n *\n * Undefined, empty strings, and unrecognized values return `undefined` so\n * that callers can fall back to their own defaults.\n * @param value - The input string (e.g. an environment variable or CLI flag value)\n * @returns `true`, `false`, or `undefined` when the value is unset or unrecognized\n */\nexport function parseBoolean(value: string | undefined): boolean | undefined {\n if (value === undefined) return undefined;\n const normalized = value.trim().toLowerCase();\n if (normalized === \"\") return undefined;\n if (TRUTHY_VALUES.has(normalized)) return true;\n if (FALSY_VALUES.has(normalized)) return false;\n return undefined;\n}\n","import { formatWithOptions, type InspectOptions } from \"node:util\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns\";\nimport { getBorderCharacters, table } from \"table\";\nimport { parseBoolean } from \"./parse-boolean\";\n\n/**\n * Error thrown when a prompt is attempted in a CI environment\n */\nexport class CIPromptError extends Error {\n constructor(message?: string) {\n super(\n message ??\n \"Interactive prompts are not available in CI environments. Use --yes flag to skip confirmation prompts.\",\n );\n this.name = \"CIPromptError\";\n }\n}\n\n/**\n * Semantic style functions for inline text styling\n */\nexport const styles = {\n // Status colors\n success: chalk.green,\n error: chalk.red,\n warning: chalk.yellow,\n info: chalk.cyan,\n\n // Action colors (for change sets)\n create: chalk.green,\n update: chalk.yellow,\n delete: chalk.red,\n unchanged: chalk.gray,\n\n // Emphasis\n bold: chalk.bold,\n dim: chalk.gray,\n highlight: chalk.cyanBright,\n successBright: chalk.greenBright,\n errorBright: chalk.redBright,\n\n // Resource types\n resourceType: chalk.bold,\n resourceName: chalk.cyan,\n\n // File paths\n path: chalk.cyan,\n\n // Values\n value: chalk.white,\n placeholder: chalk.gray.italic,\n};\n\n/**\n * Standardized symbols for CLI output\n */\nexport const symbols = {\n success: chalk.green(\"\\u2713\"),\n error: chalk.red(\"\\u2716\"),\n warning: chalk.yellow(\"\\u26a0\"),\n info: chalk.cyan(\"i\"),\n create: chalk.green(\"+\"),\n update: chalk.yellow(\"~\"),\n delete: chalk.red(\"-\"),\n replace: chalk.magenta(\"\\u00b1\"),\n bullet: chalk.gray(\"\\u2022\"),\n arrow: chalk.gray(\"\\u2192\"),\n};\n\n/**\n * Log output modes\n */\nexport type LogMode = \"default\" | \"stream\" | \"plain\";\n\nexport interface LogOptions {\n /** Output mode (default: \"default\") */\n mode?: LogMode;\n /** Number of spaces to indent the entire line (default: 0) */\n indent?: number;\n}\n\n/** Field transformer function. null excludes the field from table output. */\nexport type FieldTransformer = ((value: unknown, item: object) => string) | null;\n\nexport interface OutOptions {\n /** Table display field transform/exclude settings. Only applied in table mode (not JSON). */\n display?: Record<string, FieldTransformer>;\n\n /** Show null values in table output (default: false) */\n showNull?: boolean;\n}\n\n// In JSON mode, all logs go to stderr to keep stdout clean for JSON data\nlet _jsonMode = false;\n\n// Type icons for log output\nconst TYPE_ICONS: Record<string, string> = {\n info: \"ℹ\",\n success: \"✔\",\n warn: \"⚠\",\n error: \"✖\",\n debug: \"⚙\",\n trace: \"→\",\n log: \"\",\n};\n\n// Color functions for icon and message text\nconst TYPE_COLORS: Record<string, (text: string) => string> = {\n info: chalk.cyan,\n success: chalk.green,\n warn: chalk.yellow,\n error: chalk.red,\n debug: chalk.gray,\n trace: chalk.gray,\n log: (text) => text,\n};\n\ninterface FormatLogLineOptions {\n mode: string;\n indent: number;\n type: string;\n message: string;\n timestamp?: string;\n}\n\n/**\n * Formats a log line with the appropriate prefix and indentation\n * @param opts - Formatting options\n * @returns Formatted log line\n */\nexport function formatLogLine(opts: FormatLogLineOptions): string {\n const { mode, indent, type, message, timestamp } = opts;\n const indentPrefix = indent > 0 ? \" \".repeat(indent) : \"\";\n const colorFn = TYPE_COLORS[type] || ((text: string) => text);\n\n // Plain mode: color only, no icon, no timestamp\n if (mode === \"plain\") {\n return `${indentPrefix}${colorFn(message)}\\n`;\n }\n\n // Default/Stream mode: with icon and color\n const icon = TYPE_ICONS[type] || \"\";\n const prefix = icon ? `${icon} ` : \"\";\n const coloredOutput = colorFn(`${prefix}${message}`);\n const timestampPrefix = timestamp ?? \"\";\n\n return `${indentPrefix}${timestampPrefix}${coloredOutput}\\n`;\n}\n\n/**\n * Writes a formatted log line to stderr.\n * @param type - Log type (info, success, warn, error, log)\n * @param message - Log message\n * @param opts - Log options (mode and indent)\n */\nfunction writeLog(type: string, message: string, opts?: LogOptions): void {\n const mode = opts?.mode ?? \"default\";\n const indent = opts?.indent ?? 0;\n const inspectOpts: InspectOptions = {\n breakLength: process.stdout.columns || 80,\n };\n const formattedMessage = formatWithOptions(inspectOpts, message);\n const timestamp = mode === \"stream\" ? `${new Date().toLocaleTimeString()} ` : \"\";\n const output = formatLogLine({ mode, indent, type, message: formattedMessage, timestamp });\n process.stderr.write(output);\n}\n\nexport const logger = {\n get jsonMode(): boolean {\n return _jsonMode;\n },\n set jsonMode(value: boolean) {\n _jsonMode = value;\n },\n\n info(message: string, opts?: LogOptions): void {\n writeLog(\"info\", message, opts);\n },\n\n success(message: string, opts?: LogOptions): void {\n writeLog(\"success\", message, opts);\n },\n\n warn(message: string, opts?: LogOptions): void {\n writeLog(\"warn\", message, opts);\n },\n\n error(message: string, opts?: LogOptions): void {\n writeLog(\"error\", message, opts);\n },\n\n log(message: string): void {\n writeLog(\"log\", message, { mode: \"plain\" });\n },\n\n newline(): void {\n process.stderr.write(\"\\n\");\n },\n\n debug(message: string): void {\n if (parseBoolean(process.env.DEBUG) === true) {\n writeLog(\"log\", styles.dim(message), { mode: \"plain\" });\n }\n },\n\n out(data: string | object | object[], options?: OutOptions): void {\n if (typeof data === \"string\") {\n process.stdout.write(data.endsWith(\"\\n\") ? data : data + \"\\n\");\n return;\n }\n\n if (this.jsonMode) {\n // eslint-disable-next-line no-restricted-syntax\n console.log(JSON.stringify(data));\n return;\n }\n\n const display = options?.display;\n\n // Helper to format a value for table display\n const formatValue = (value: unknown, pretty = false): string => {\n if (options?.showNull && value === null) return \"NULL\";\n if (value === null || value === undefined) return \"N/A\";\n if (value instanceof Date) {\n return formatDistanceToNowStrict(value, { addSuffix: true });\n }\n if (typeof value === \"object\") {\n return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);\n }\n return String(value);\n };\n\n // Helper to check if field should be excluded\n const isExcluded = (key: string): boolean => {\n return display !== undefined && key in display && display[key] === null;\n };\n\n // Helper to apply transformer or default formatting\n const transformValue = (key: string, value: unknown, item: object, pretty = false): string => {\n if (display && key in display) {\n const transformer = display[key];\n if (transformer) {\n return transformer(value, item);\n }\n }\n return formatValue(value, pretty);\n };\n\n if (!Array.isArray(data)) {\n const entries = Object.entries(data).filter(([key]) => !isExcluded(key));\n const formattedEntries = entries.map(([key, value]) => [\n key,\n transformValue(key, value, data, true),\n ]);\n const t = table(formattedEntries, {\n singleLine: false,\n border: getBorderCharacters(\"norc\"),\n });\n process.stdout.write(t);\n return;\n }\n\n if (data.length === 0) {\n return;\n }\n\n const allHeaders = Array.from(new Set(data.flatMap((item) => Object.keys(item))));\n const headers = allHeaders.filter((h) => !isExcluded(h));\n const rows = data.map((item) =>\n headers.map((header) =>\n transformValue(header, (item as Record<string, unknown>)[header], item),\n ),\n );\n\n const t = table([headers, ...rows], {\n border: getBorderCharacters(\"norc\"),\n drawHorizontalLine: (lineIndex, rowCount) => {\n return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;\n },\n });\n process.stdout.write(t);\n },\n};\n"],"mappings":";;;;;;AAAA,MAAM,gCAAgB,IAAI,IAAI;CAAC;CAAQ;CAAK;CAAO;CAAK;CAAM;AAAG,CAAC;AAClE,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAS;CAAK;CAAM;CAAK;CAAO;AAAG,CAAC;;;;;;;;;;;;;;AAelE,SAAgB,aAAa,OAAgD;CAC3E,IAAI,UAAU,QAAW,OAAO;CAChC,MAAM,aAAa,MAAM,KAAK,CAAC,CAAC,YAAY;CAC5C,IAAI,eAAe,IAAI,OAAO;CAC9B,IAAI,cAAc,IAAI,UAAU,GAAG,OAAO;CAC1C,IAAI,aAAa,IAAI,UAAU,GAAG,OAAO;AAE3C;;;;;;;ACdA,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,SAAkB;EAC5B,MACE,WACE,wGACJ;EACA,KAAK,OAAO;CACd;AACF;;;;AAKA,MAAa,SAAS;CAEpB,SAAS,MAAM;CACf,OAAO,MAAM;CACb,SAAS,MAAM;CACf,MAAM,MAAM;CAGZ,QAAQ,MAAM;CACd,QAAQ,MAAM;CACd,QAAQ,MAAM;CACd,WAAW,MAAM;CAGjB,MAAM,MAAM;CACZ,KAAK,MAAM;CACX,WAAW,MAAM;CACjB,eAAe,MAAM;CACrB,aAAa,MAAM;CAGnB,cAAc,MAAM;CACpB,cAAc,MAAM;CAGpB,MAAM,MAAM;CAGZ,OAAO,MAAM;CACb,aAAa,MAAM,KAAK;AAC1B;;;;AAKA,MAAa,UAAU;CACrB,SAAS,MAAM,MAAM,GAAQ;CAC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
|
|
1
|
+
import { z } from "zod";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { EnumValue } from "../../../configure/types/field.types.mjs";
|
|
2
|
+
import { TailorDBTypeParsedSettings } from "../../../types/tailordb.generated.mjs";
|
|
3
|
+
import { RawRelationConfig, TailorDBTypeMetadata } from "../../../configure/services/tailordb/types.mjs";
|
|
4
|
+
import { ValueOperand } from "../../../configure/services/auth/types.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/parser/service/tailordb/types.d.ts
|
|
7
|
+
interface UserDefinedTypeSource {
|
|
8
|
+
filePath: string;
|
|
9
|
+
exportName: string;
|
|
10
|
+
pluginId?: never;
|
|
11
|
+
}
|
|
12
|
+
interface PluginGeneratedTypeSource {
|
|
13
|
+
filePath?: never;
|
|
14
|
+
exportName: string;
|
|
15
|
+
pluginId: string;
|
|
16
|
+
pluginImportPath: string;
|
|
17
|
+
originalFilePath: string;
|
|
18
|
+
originalExportName: string;
|
|
19
|
+
generatedTypeKind?: string;
|
|
20
|
+
pluginConfig?: unknown;
|
|
21
|
+
namespace?: string;
|
|
22
|
+
}
|
|
23
|
+
type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;
|
|
24
|
+
interface Script {
|
|
25
|
+
expr: string;
|
|
26
|
+
}
|
|
27
|
+
interface OperatorValidateConfig {
|
|
28
|
+
script: Script;
|
|
29
|
+
errorMessage: string;
|
|
30
|
+
}
|
|
31
|
+
interface OperatorFieldHook {
|
|
32
|
+
create?: Script;
|
|
33
|
+
update?: Script;
|
|
34
|
+
}
|
|
35
|
+
interface OperatorFieldConfig {
|
|
36
|
+
type: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
description?: string;
|
|
39
|
+
allowedValues?: EnumValue[];
|
|
40
|
+
array?: boolean;
|
|
41
|
+
index?: boolean;
|
|
42
|
+
unique?: boolean;
|
|
43
|
+
vector?: boolean;
|
|
44
|
+
foreignKey?: boolean;
|
|
45
|
+
foreignKeyType?: string;
|
|
46
|
+
foreignKeyField?: string;
|
|
47
|
+
rawRelation?: RawRelationConfig;
|
|
48
|
+
validate?: OperatorValidateConfig[];
|
|
49
|
+
hooks?: OperatorFieldHook;
|
|
50
|
+
serial?: {
|
|
51
|
+
start: number;
|
|
52
|
+
maxValue?: number;
|
|
53
|
+
format?: string;
|
|
54
|
+
};
|
|
55
|
+
scale?: number;
|
|
56
|
+
fields?: Record<string, OperatorFieldConfig>;
|
|
57
|
+
}
|
|
58
|
+
type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
|
|
59
|
+
type StandardPermissionOperator = "eq" | "ne" | "in" | "nin" | "hasAny" | "nhasAny";
|
|
60
|
+
type UserOperand = {
|
|
61
|
+
user: string;
|
|
62
|
+
};
|
|
63
|
+
type StandardRecordOperand<Update extends boolean = false> = Update extends true ? {
|
|
64
|
+
oldRecord: string;
|
|
65
|
+
} | {
|
|
66
|
+
newRecord: string;
|
|
67
|
+
} : {
|
|
68
|
+
record: string;
|
|
69
|
+
};
|
|
70
|
+
type PermissionOperand<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = UserOperand | ValueOperand | (Level extends "record" ? StandardRecordOperand<Update> : never);
|
|
71
|
+
type StandardPermissionCondition<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = readonly [PermissionOperand<Level, Update>, StandardPermissionOperator, PermissionOperand<Level, Update>];
|
|
72
|
+
type StandardActionPermission<Level extends "record" | "gql" = "record" | "gql", Update extends boolean = boolean> = {
|
|
73
|
+
conditions: readonly StandardPermissionCondition<Level, Update>[];
|
|
74
|
+
description?: string;
|
|
75
|
+
permit: "allow" | "deny";
|
|
76
|
+
};
|
|
77
|
+
type StandardTailorTypePermission = {
|
|
78
|
+
create: readonly StandardActionPermission<"record", false>[];
|
|
79
|
+
read: readonly StandardActionPermission<"record", false>[];
|
|
80
|
+
update: readonly StandardActionPermission<"record", true>[];
|
|
81
|
+
delete: readonly StandardActionPermission<"record", false>[];
|
|
82
|
+
};
|
|
83
|
+
type StandardGqlPermissionPolicy = {
|
|
84
|
+
conditions: readonly StandardPermissionCondition<"gql">[];
|
|
85
|
+
actions: readonly ["all"] | readonly GqlPermissionAction[];
|
|
86
|
+
permit: "allow" | "deny";
|
|
87
|
+
description?: string;
|
|
88
|
+
};
|
|
89
|
+
type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];
|
|
90
|
+
interface Permissions {
|
|
91
|
+
record?: StandardTailorTypePermission;
|
|
92
|
+
gql?: StandardTailorTypeGqlPermission;
|
|
93
|
+
}
|
|
94
|
+
interface ParsedField {
|
|
95
|
+
name: string;
|
|
96
|
+
config: OperatorFieldConfig;
|
|
97
|
+
relation?: {
|
|
98
|
+
targetType: string;
|
|
99
|
+
forwardName: string;
|
|
100
|
+
backwardName: string;
|
|
101
|
+
key: string;
|
|
102
|
+
unique: boolean;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
interface ParsedRelationship {
|
|
106
|
+
name: string;
|
|
107
|
+
targetType: string;
|
|
108
|
+
targetField: string;
|
|
109
|
+
sourceField: string;
|
|
110
|
+
isArray: boolean;
|
|
111
|
+
description: string;
|
|
112
|
+
}
|
|
113
|
+
interface TailorDBType {
|
|
114
|
+
name: string;
|
|
115
|
+
pluralForm: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
fields: Record<string, ParsedField>;
|
|
118
|
+
forwardRelationships: Record<string, ParsedRelationship>;
|
|
119
|
+
backwardRelationships: Record<string, ParsedRelationship>;
|
|
120
|
+
settings: TailorDBTypeParsedSettings;
|
|
121
|
+
permissions: Permissions;
|
|
122
|
+
indexes?: TailorDBTypeMetadata["indexes"];
|
|
123
|
+
files?: TailorDBTypeMetadata["files"];
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { OperatorFieldConfig, ParsedField, ParsedRelationship, PermissionOperand, Permissions, PluginGeneratedTypeSource, Script, StandardActionPermission, StandardGqlPermissionPolicy, StandardPermissionCondition, StandardTailorTypeGqlPermission, StandardTailorTypePermission, TailorDBType, TypeSourceInfoEntry, UserDefinedTypeSource };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/utils/test/platform-serialize.ts
|
|
2
|
+
/**
|
|
3
|
+
* Validate and serialize a value as it would cross the Platform JSON boundary.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the runtime checks the platform performs on workflow arguments,
|
|
6
|
+
* wait payloads, and trigger inputs so that local tests fail in the same
|
|
7
|
+
* places production fails.
|
|
8
|
+
*
|
|
9
|
+
* Throws on:
|
|
10
|
+
* - `NaN` / `Infinity` / `-Infinity` (`JSON.stringify` would silently emit `null`)
|
|
11
|
+
* - `BigInt` (TypeError is thrown by `JSON.stringify`; we emit a clearer message)
|
|
12
|
+
* - Non-plain objects (class instances, including `Date`, `Map`, `Set`, `Error`,
|
|
13
|
+
* and user-defined DTOs whose prototype is not `Object.prototype`)
|
|
14
|
+
*
|
|
15
|
+
* The replacer reads `this[key]` so the check sees the original value before
|
|
16
|
+
* any `toJSON` conversion (e.g. `Date.prototype.toJSON`).
|
|
17
|
+
* @param value - Value to validate and round-trip
|
|
18
|
+
* @returns The JSON-normalized value (undefined/function properties stripped, etc.)
|
|
19
|
+
*/
|
|
20
|
+
function platformSerialize(value) {
|
|
21
|
+
if (value === void 0) return void 0;
|
|
22
|
+
if (typeof value === "function") throw new TypeError("platformSerialize: function is not JSON-serializable at <root>");
|
|
23
|
+
if (typeof value === "symbol") throw new TypeError("platformSerialize: Symbol is not JSON-serializable at <root>");
|
|
24
|
+
const serialized = JSON.stringify(value, function(key, val) {
|
|
25
|
+
if (typeof val === "number" && !Number.isFinite(val)) throw new TypeError(`platformSerialize: non-finite number at ${formatPath(key)}: ${String(val)}`);
|
|
26
|
+
if (typeof val === "bigint") throw new TypeError(`platformSerialize: BigInt is not JSON-serializable at ${formatPath(key)}`);
|
|
27
|
+
const raw = this[key];
|
|
28
|
+
if (raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
|
|
29
|
+
const proto = Object.getPrototypeOf(raw);
|
|
30
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
31
|
+
const ctor = raw.constructor?.name ?? "anonymous";
|
|
32
|
+
throw new TypeError(`platformSerialize: non-plain object at ${formatPath(key)} (${ctor} instance)`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return val;
|
|
36
|
+
});
|
|
37
|
+
if (serialized === void 0) throw new TypeError("platformSerialize: value is not JSON-serializable at <root>");
|
|
38
|
+
return JSON.parse(serialized);
|
|
39
|
+
}
|
|
40
|
+
function formatPath(key) {
|
|
41
|
+
return key === "" ? "<root>" : `"${key}"`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { platformSerialize as t };
|
|
46
|
+
//# sourceMappingURL=platform-serialize-RoRtBS0v.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-serialize-RoRtBS0v.mjs","names":[],"sources":["../src/utils/test/platform-serialize.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"],"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,2CAA2C,WAAW,GAAG,EAAE,IAAI,OAAO,GAAG,GAC3E;EAEF,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,UACR,yDAAyD,WAAW,GAAG,GACzE;EAGF,MAAM,MAAO,KAAiC;EAC9C,IAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG,GAAG;GAClE,MAAM,QAAQ,OAAO,eAAe,GAAG;GACvC,IAAI,UAAU,OAAO,aAAa,UAAU,MAAM;IAChD,MAAM,OAAQ,IAA4C,aAAa,QAAQ;IAC/E,MAAM,IAAI,UACR,0CAA0C,WAAW,GAAG,EAAE,IAAI,KAAK,WACrE;GACF;EACF;EACA,OAAO;CACT,CAAC;CAMD,IAAI,eAAe,QACjB,MAAM,IAAI,UAAU,6DAA6D;CAGnF,OAAO,KAAK,MAAM,UAAU;AAC9B;AAEA,SAAS,WAAW,KAAqB;CACvC,OAAO,QAAQ,KAAK,WAAW,IAAI,IAAI;AACzC"}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/builtin/enum-constants/index.d.ts
|
|
4
|
+
/** Unique identifier for the enum constants generator plugin. */
|
|
5
|
+
declare const EnumConstantsGeneratorID = "@tailor-platform/enum-constants";
|
|
6
|
+
type EnumConstantsPluginOptions = {
|
|
7
|
+
distPath: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Plugin that generates enum constants from TailorDB type definitions.
|
|
11
|
+
* @param options - Plugin options
|
|
12
|
+
* @param options.distPath - Output file path for generated constants
|
|
13
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
14
|
+
*/
|
|
15
|
+
declare function enumConstantsPlugin(options: EnumConstantsPluginOptions): Plugin<unknown, EnumConstantsPluginOptions>;
|
|
16
|
+
//#endregion
|
|
2
17
|
export { EnumConstantsGeneratorID, enumConstantsPlugin };
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/builtin/file-utils/index.d.ts
|
|
4
|
+
/** Unique identifier for the file utilities generator plugin. */
|
|
5
|
+
declare const FileUtilsGeneratorID = "@tailor-platform/file-utils";
|
|
6
|
+
type FileUtilsPluginOptions = {
|
|
7
|
+
distPath: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Plugin that generates TypeWithFiles interface from TailorDB type definitions.
|
|
11
|
+
* @param options - Plugin options
|
|
12
|
+
* @param options.distPath - Output file path for generated file utilities
|
|
13
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
14
|
+
*/
|
|
15
|
+
declare function fileUtilsPlugin(options: FileUtilsPluginOptions): Plugin<unknown, FileUtilsPluginOptions>;
|
|
16
|
+
//#endregion
|
|
2
17
|
export { FileUtilsGeneratorID, fileUtilsPlugin };
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/builtin/kysely-type/index.d.ts
|
|
4
|
+
/** Unique identifier for the Kysely type generator plugin. */
|
|
5
|
+
declare const KyselyGeneratorID = "@tailor-platform/kysely-type";
|
|
6
|
+
type KyselyTypePluginOptions = {
|
|
7
|
+
distPath: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Plugin that generates Kysely type definitions for TailorDB types.
|
|
11
|
+
* @param options - Plugin options
|
|
12
|
+
* @param options.distPath - Output file path for generated types
|
|
13
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
14
|
+
*/
|
|
15
|
+
declare function kyselyTypePlugin(options: KyselyTypePluginOptions): Plugin<unknown, KyselyTypePluginOptions>;
|
|
16
|
+
//#endregion
|
|
2
17
|
export { KyselyGeneratorID, kyselyTypePlugin };
|
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/builtin/seed/index.d.ts
|
|
4
|
+
/** Unique identifier for the seed generator plugin. */
|
|
5
|
+
declare const SeedGeneratorID = "@tailor-platform/seed";
|
|
6
|
+
type DisableIdpUserSyncDirections = {
|
|
7
|
+
/**
|
|
8
|
+
* Skip emitting the foreign key from `<userProfile>.<usernameField>` to
|
|
9
|
+
* `_User.name`. Defaults to `false` (FK emitted).
|
|
10
|
+
*
|
|
11
|
+
* Set to `true` to seed pre-registration states such as
|
|
12
|
+
* invited-but-not-registered users.
|
|
13
|
+
*/
|
|
14
|
+
userToIdp?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Skip emitting the foreign key from `_User.name` to
|
|
17
|
+
* `<userProfile>.<usernameField>`. Defaults to `false` (FK emitted).
|
|
18
|
+
*
|
|
19
|
+
* Set to `true` to seed `_User` rows that do not yet have a corresponding
|
|
20
|
+
* userProfile row.
|
|
21
|
+
*/
|
|
22
|
+
idpToUser?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type SeedPluginOptions = {
|
|
25
|
+
distPath: string;
|
|
26
|
+
machineUserName?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Disable individual `_User <-> userProfile` foreign keys emitted into
|
|
29
|
+
* the generated seed schema. Both directions are emitted by default.
|
|
30
|
+
*
|
|
31
|
+
* Set a direction to `true` to relax it — for example to seed invited
|
|
32
|
+
* users that do not yet have an IdP credential.
|
|
33
|
+
*/
|
|
34
|
+
disableIdpUserSync?: DisableIdpUserSyncDirections;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Plugin that generates seed data files with Kysely batch insert and tailor.idp.Client for _User.
|
|
38
|
+
* @param options - Plugin options
|
|
39
|
+
* @param options.distPath - Output directory path for generated seed files
|
|
40
|
+
* @param options.machineUserName - Default machine user name for authentication
|
|
41
|
+
* @param options.disableIdpUserSync - Skip emitting individual `_User <-> userProfile` foreign keys. Both directions are emitted by default; set a direction to `true` to relax that side.
|
|
42
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
43
|
+
*/
|
|
44
|
+
declare function seedPlugin(options: SeedPluginOptions): Plugin<unknown, SeedPluginOptions>;
|
|
45
|
+
//#endregion
|
|
2
46
|
export { SeedGeneratorID, seedPlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TailorAnyDBType } from "../configure/services/tailordb/types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugin/get-generated-type.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Get a generated type from a plugin by loading the config and resolving everything automatically.
|
|
6
|
+
* For type-attached plugins, calls onTypeLoaded() with the sourceType.
|
|
7
|
+
* For namespace plugins, calls onNamespaceLoaded() with auto-resolved namespace.
|
|
8
|
+
* Results are cached per config path, plugin, namespace, and pluginConfig to avoid redundant processing.
|
|
9
|
+
* @param configPath - Path to tailor.config.ts (absolute or relative to cwd)
|
|
10
|
+
* @param pluginId - The plugin's unique identifier
|
|
11
|
+
* @param sourceType - The source TailorDB type (null for namespace plugins)
|
|
12
|
+
* @param kind - The generated type kind (e.g., "request", "step")
|
|
13
|
+
* @returns The generated TailorDB type
|
|
14
|
+
*/
|
|
15
|
+
declare function getGeneratedType(configPath: string, pluginId: string, sourceType: TailorAnyDBType | null, kind: string): Promise<TailorAnyDBType>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getGeneratedType };
|