@tailor-platform/sdk 2.0.0-next.1 → 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 +869 -2
- 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-DqS1yBg3.mjs → application-miwiXtB4.mjs} +1892 -1968
- package/dist/application-miwiXtB4.mjs.map +1 -0
- package/dist/authconnection-CZvi9ANm.mjs +9 -0
- package/dist/authconnection-CZvi9ANm.mjs.map +1 -0
- package/dist/brand-Eo4pLXPJ.mjs.map +1 -1
- package/dist/cli/cache/bundle-cache.d.mts +2 -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 -5481
- package/dist/cli/lib.d.mts +90 -21048
- package/dist/cli/lib.mjs +154 -12
- 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 +1433 -1239
- 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 -8
- package/dist/configure/index.mjs +390 -36
- 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-Bd266-ru.mjs → context-DYQVYWqZ.mjs} +4 -5
- package/dist/context-DYQVYWqZ.mjs.map +1 -0
- package/dist/{crashreport-BsjAkFWw.mjs → crashreport-B5LqCTfF.mjs} +10 -11
- package/dist/{crashreport-BsjAkFWw.mjs.map → crashreport-B5LqCTfF.mjs.map} +1 -1
- package/dist/{crashreport-pr6Rhvza.mjs → crashreport-eI7ty7ok.mjs} +1 -1
- package/dist/enum-constants-j9QBF0cB.mjs.map +1 -1
- package/dist/{errors-Dtf2WPaW.mjs → errors-D7583Zz7.mjs} +18 -2
- package/dist/errors-D7583Zz7.mjs.map +1 -0
- package/dist/{file-_oUZo76X.mjs → file-BUcmVIH2.mjs} +12 -22
- package/dist/file-BUcmVIH2.mjs.map +1 -0
- package/dist/{file-utils-DcyIPFQh.mjs → file-utils-yEiIS4nJ.mjs} +6 -6
- package/dist/file-utils-yEiIS4nJ.mjs.map +1 -0
- package/dist/{globals-Crz8o65k.mjs → globals-DQotNuwK.mjs} +33 -55
- 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-BDbK5gjm.mjs → idp-RA_swu-h.mjs} +12 -5
- package/dist/idp-RA_swu-h.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 +5 -7
- package/dist/{kysely-type-DR8uzZTA.mjs → kysely-type-DqIRgDYR.mjs} +5 -4
- 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/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/file-utils/index.d.mts +15 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +15 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +46 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- 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 -117
- package/dist/plugin/index.mjs +1 -1
- 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-n9NCkjee.mjs → register-ts-hook-BAHMwxfG.mjs} +7812 -4094
- package/dist/register-ts-hook-BAHMwxfG.mjs.map +1 -0
- package/dist/{registry-DdsYlL_P.mjs → registry-BIGVUrMB.mjs} +12 -9
- package/dist/registry-BIGVUrMB.mjs.map +1 -0
- 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 +25 -0
- package/dist/runtime/aigateway.mjs +3 -0
- package/dist/runtime/authconnection.d.mts +21 -2
- package/dist/runtime/authconnection.mjs +2 -2
- package/dist/runtime/context.d.mts +54 -2
- package/dist/runtime/context.mjs +2 -2
- package/dist/runtime/field-parse.d.mts +10 -0
- package/dist/runtime/file.d.mts +170 -2
- package/dist/runtime/file.mjs +2 -2
- package/dist/runtime/globals.d.mts +38 -20
- package/dist/runtime/iconv.d.mts +73 -2
- package/dist/runtime/iconv.mjs +2 -2
- package/dist/runtime/idp.d.mts +129 -2
- package/dist/runtime/idp.mjs +2 -2
- package/dist/runtime/index.d.mts +48 -9
- package/dist/runtime/index.mjs +10 -8
- 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 -2
- package/dist/runtime/types.d.mts +25 -0
- package/dist/runtime/workflow.d.mts +124 -2
- package/dist/runtime/workflow.mjs +2 -2
- package/dist/{schema-BhkpP5Hw.mjs → schema--xYWRGfe.mjs} +288 -229
- package/dist/schema--xYWRGfe.mjs.map +1 -0
- package/dist/{secret-file-DBqZhjFQ.mjs → secret-file-C3J4Gy8r.mjs} +2 -2
- package/dist/{secret-file-DBqZhjFQ.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-LUVr7jHL.mjs +444 -0
- package/dist/seed-LUVr7jHL.mjs.map +1 -0
- package/dist/{service-DU1mVzri.mjs → service-B5WynBHQ.mjs} +3 -3
- package/dist/{service-DU1mVzri.mjs.map → service-B5WynBHQ.mjs.map} +1 -1
- 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-CdqJEzkj.mjs → telemetry-BRVdwh14.mjs} +3 -3
- 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/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 -100
- package/dist/utils/test/index.mjs +60 -39
- 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 -2
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.d.mts +15 -429
- package/dist/vitest/index.mjs +1240 -31
- 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 -2
- 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-z_oHGVNy.mjs → workspace_resource_pb-UGK1SSn_.mjs} +55 -619
- package/dist/workspace_resource_pb-UGK1SSn_.mjs.map +1 -0
- package/docs/cli/application.md +150 -250
- package/docs/cli/auth.md +51 -295
- package/docs/cli/completion.md +1 -25
- package/docs/cli/crashreport.md +3 -61
- package/docs/cli/executor.md +72 -183
- package/docs/cli/function.md +16 -132
- 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 -6
- 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 +4 -4
- package/docs/plugin/index.md +8 -8
- package/docs/quickstart.md +8 -7
- package/docs/runtime.md +18 -9
- package/docs/services/aigateway.md +20 -2
- package/docs/services/auth.md +51 -59
- package/docs/services/executor.md +8 -3
- package/docs/services/http-adapter.md +16 -1
- package/docs/services/idp.md +55 -2
- package/docs/services/resolver.md +62 -8
- 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 +133 -55
- package/docs/testing.md +244 -143
- package/package.json +59 -46
- package/postinstall.mjs +4 -6
- package/dist/application-DB2r36Et.mjs +0 -3
- package/dist/application-DqS1yBg3.mjs.map +0 -1
- package/dist/authconnection-D2MhtTN5.mjs +0 -15
- package/dist/authconnection-D2MhtTN5.mjs.map +0 -1
- package/dist/authconnection-DvUQAjQS.d.mts +0 -39
- 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/client-Dbohmtkv.mjs +0 -3
- package/dist/client-z_oHGVNy.mjs.map +0 -1
- package/dist/context-Bd266-ru.mjs.map +0 -1
- package/dist/context-BuuIb8CC.d.mts +0 -68
- 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-BB8Vs9O_.d.mts +0 -250
- package/dist/file-_oUZo76X.mjs.map +0 -1
- package/dist/file-utils-DcyIPFQh.mjs.map +0 -1
- package/dist/globals-Crz8o65k.mjs.map +0 -1
- package/dist/http-adapter.generated-WgMnb7Sb.d.mts +0 -580
- package/dist/iconv-Co-TOPuH.d.mts +0 -122
- package/dist/iconv-D2vi8G36.mjs +0 -63
- package/dist/iconv-D2vi8G36.mjs.map +0 -1
- package/dist/idp-BDbK5gjm.mjs.map +0 -1
- package/dist/idp-DrhVrLmV.d.mts +0 -160
- package/dist/index-5vPyRu1y.d.mts +0 -18
- package/dist/index-B7AKc18V.d.mts +0 -47
- package/dist/index-BlpzXncY.d.mts +0 -1016
- package/dist/index-CK7u9isy.d.mts +0 -46
- package/dist/index-CNYe5lnW.d.mts +0 -18
- package/dist/index-DjUdWlzf.d.mts +0 -18
- package/dist/index-ZePLwxw7.d.mts +0 -208
- package/dist/interceptor-D-q1rvRl.mjs.map +0 -1
- package/dist/job-fuc3j1Ma.mjs +0 -53
- package/dist/job-fuc3j1Ma.mjs.map +0 -1
- package/dist/kysely-type-DR8uzZTA.mjs.map +0 -1
- package/dist/logger-CxF-Ex5d.mjs +0 -220
- package/dist/logger-CxF-Ex5d.mjs.map +0 -1
- package/dist/mock-BjFj5o1I.mjs +0 -804
- package/dist/mock-BjFj5o1I.mjs.map +0 -1
- package/dist/registry-DdsYlL_P.mjs.map +0 -1
- package/dist/rolldown-runtime-DXywRVcq.mjs +0 -20
- package/dist/runtime-n9NCkjee.mjs.map +0 -1
- package/dist/schema-BhkpP5Hw.mjs.map +0 -1
- package/dist/secretmanager-B3n4KHfm.d.mts +0 -55
- package/dist/secretmanager-BVxw3ih_.mjs +0 -24
- package/dist/secretmanager-BVxw3ih_.mjs.map +0 -1
- package/dist/seed-jf3008-h.mjs +0 -1160
- package/dist/seed-jf3008-h.mjs.map +0 -1
- package/dist/service-CCL8ruDf.mjs +0 -459
- package/dist/service-CCL8ruDf.mjs.map +0 -1
- package/dist/service-D6yonf2I.mjs +0 -3
- package/dist/telemetry-CdqJEzkj.mjs.map +0 -1
- package/dist/telemetry-ClwW5ohF.mjs +0 -3
- package/dist/test-env-key-D9kM6ETE.mjs +0 -49
- package/dist/test-env-key-D9kM6ETE.mjs.map +0 -1
- package/dist/types-B2RpYyA_.mjs +0 -371
- package/dist/types-B2RpYyA_.mjs.map +0 -1
- package/dist/types-ClhIrW_C.mjs +0 -4
- package/dist/types-DCUhgpyI.d.mts +0 -784
- package/dist/types-DhO_VEZd.d.mts +0 -574
- package/dist/types-DwDgacni.d.mts +0 -338
- package/dist/workflow-BbKvGLQg.d.mts +0 -96
- package/dist/workflow-DgemCAz3.mjs +0 -38
- package/dist/workflow-DgemCAz3.mjs.map +0 -1
- package/dist/workflow.generated-DtQwEo-x.d.mts +0 -671
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { formatWithOptions } from "node:util";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { formatDistanceToNowStrict } from "date-fns";
|
|
4
|
+
import { eastAsianWidth } from "get-east-asian-width";
|
|
5
|
+
|
|
6
|
+
//#region src/cli/shared/ascii-table.ts
|
|
7
|
+
const ANSI_ESCAPE_PATTERN = /\x1b\[[0-9;]*m/g;
|
|
8
|
+
const CARRIAGE_RETURN_PATTERN = /\r\n?/g;
|
|
9
|
+
const graphemeSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
10
|
+
function maxOf(values, fallback = 0) {
|
|
11
|
+
return values.reduce((max, value) => value > max ? value : max, fallback);
|
|
12
|
+
}
|
|
13
|
+
const TAB_WIDTH = 8;
|
|
14
|
+
function isStrippableControlCharacter(char) {
|
|
15
|
+
const codePoint = char.codePointAt(0) ?? 0;
|
|
16
|
+
if (char === "\n") return false;
|
|
17
|
+
return codePoint <= 31 || codePoint === 127;
|
|
18
|
+
}
|
|
19
|
+
function normalizeControlCharacters(value) {
|
|
20
|
+
const sgrSequences = value.match(ANSI_ESCAPE_PATTERN) ?? [];
|
|
21
|
+
return value.split(ANSI_ESCAPE_PATTERN).map((segment) => {
|
|
22
|
+
const chars = [];
|
|
23
|
+
for (const char of segment) if (char === " ") chars.push(" ".repeat(TAB_WIDTH));
|
|
24
|
+
else if (!isStrippableControlCharacter(char)) chars.push(char);
|
|
25
|
+
return chars.join("");
|
|
26
|
+
}).reduce((result, segment, i) => result + segment + (sgrSequences[i] ?? ""), "");
|
|
27
|
+
}
|
|
28
|
+
function sanitizeCell(cell) {
|
|
29
|
+
return normalizeControlCharacters(String(cell ?? "").replace(CARRIAGE_RETURN_PATTERN, "\n"));
|
|
30
|
+
}
|
|
31
|
+
const ZERO_WIDTH_CLUSTER_PATTERN = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
|
|
32
|
+
const RGI_EMOJI_PATTERN = /^\p{RGI_Emoji}$/v;
|
|
33
|
+
function displayWidth(value) {
|
|
34
|
+
let width = 0;
|
|
35
|
+
for (const { segment } of graphemeSegmenter.segment(value.replace(ANSI_ESCAPE_PATTERN, ""))) {
|
|
36
|
+
if (ZERO_WIDTH_CLUSTER_PATTERN.test(segment)) continue;
|
|
37
|
+
if (RGI_EMOJI_PATTERN.test(segment)) {
|
|
38
|
+
width += 2;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const codePoint = segment.codePointAt(0);
|
|
42
|
+
width += codePoint === void 0 ? 0 : eastAsianWidth(codePoint);
|
|
43
|
+
}
|
|
44
|
+
return width;
|
|
45
|
+
}
|
|
46
|
+
function toCellLines(cell) {
|
|
47
|
+
return cell.split("\n").map((text) => ({
|
|
48
|
+
text,
|
|
49
|
+
width: displayWidth(text)
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
function padCell(cellLine, width) {
|
|
53
|
+
return cellLine.text + " ".repeat(Math.max(0, width - cellLine.width));
|
|
54
|
+
}
|
|
55
|
+
function renderBorder(left, join, right, columnWidths) {
|
|
56
|
+
return left + columnWidths.map((width) => "─".repeat(width + 2)).join(join) + right;
|
|
57
|
+
}
|
|
58
|
+
function validateConsistentColumnCount(rows) {
|
|
59
|
+
const columnCount = rows[0]?.length;
|
|
60
|
+
if (columnCount === void 0) return;
|
|
61
|
+
rows.forEach((row, index) => {
|
|
62
|
+
if (row.length !== columnCount) throw new Error(`renderTable: all rows must have the same number of columns (expected ${columnCount}, row ${index} has ${row.length}).`);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Renders a 2D array of values as a table using single-line Unicode box-drawing borders.
|
|
67
|
+
* Column widths account for East Asian wide characters (measured per grapheme cluster,
|
|
68
|
+
* so combining marks and ZWJ emoji sequences aren't overcounted, non-printing clusters
|
|
69
|
+
* such as a lone joiner or combining mark measure as 0, and flags, keycaps, and
|
|
70
|
+
* VS16-forced emoji presentation are measured as 2 columns) and strip ANSI SGR (color/style)
|
|
71
|
+
* escape codes before measuring. Use this instead of importing a table-rendering package
|
|
72
|
+
* directly.
|
|
73
|
+
* @param data - Table rows; every row must have the same number of columns. Each cell is
|
|
74
|
+
* stringified (`null`/`undefined` become an empty string rather than the literal text
|
|
75
|
+
* "null"/"undefined"), may contain embedded newlines, has `\r`/`\r\n` normalized to `\n`,
|
|
76
|
+
* has tabs expanded to spaces, and has other control characters stripped.
|
|
77
|
+
* @param config - Rendering options
|
|
78
|
+
* @returns The rendered table terminated with a trailing newline, or `""` when there are no
|
|
79
|
+
* rows or no columns to display
|
|
80
|
+
*/
|
|
81
|
+
function renderTable(data, config = {}) {
|
|
82
|
+
const rows = data.map((row) => row.map(sanitizeCell));
|
|
83
|
+
validateConsistentColumnCount(rows);
|
|
84
|
+
const rowCount = rows.length;
|
|
85
|
+
const columnCount = rows[0]?.length ?? 0;
|
|
86
|
+
if (rowCount === 0 || columnCount === 0) return "";
|
|
87
|
+
const rowsCellLines = rows.map((row) => Array.from({ length: columnCount }, (_, col) => toCellLines(row[col] ?? "")));
|
|
88
|
+
const columnWidths = Array.from({ length: columnCount }, (_, col) => maxOf(rowsCellLines.map((row) => maxOf((row[col] ?? []).map((line) => line.width)))));
|
|
89
|
+
const shouldDrawLine = (lineIndex) => config.singleLine ? lineIndex === 0 || lineIndex === rowCount : (config.drawHorizontalLine ?? (() => true))(lineIndex, rowCount);
|
|
90
|
+
const lines = [];
|
|
91
|
+
if (shouldDrawLine(0)) lines.push(renderBorder("┌", "┬", "┐", columnWidths));
|
|
92
|
+
rowsCellLines.forEach((cellLines, rowIndex) => {
|
|
93
|
+
const rowHeight = maxOf(cellLines.map((columnLines) => columnLines.length), 1);
|
|
94
|
+
for (let line = 0; line < rowHeight; line++) {
|
|
95
|
+
const cells = cellLines.map((columnLines, col) => padCell(columnLines[line] ?? {
|
|
96
|
+
text: "",
|
|
97
|
+
width: 0
|
|
98
|
+
}, columnWidths[col] ?? 0));
|
|
99
|
+
lines.push(`│ ${cells.join(" │ ")} │`);
|
|
100
|
+
}
|
|
101
|
+
if (rowIndex < rowCount - 1 && shouldDrawLine(rowIndex + 1)) lines.push(renderBorder("├", "┼", "┤", columnWidths));
|
|
102
|
+
});
|
|
103
|
+
if (shouldDrawLine(rowCount)) lines.push(renderBorder("└", "┴", "┘", columnWidths));
|
|
104
|
+
return `${lines.join("\n")}\n`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/cli/shared/parse-boolean.ts
|
|
109
|
+
const TRUTHY_VALUES = /* @__PURE__ */ new Set([
|
|
110
|
+
"true",
|
|
111
|
+
"t",
|
|
112
|
+
"yes",
|
|
113
|
+
"y",
|
|
114
|
+
"on",
|
|
115
|
+
"1"
|
|
116
|
+
]);
|
|
117
|
+
const FALSY_VALUES = /* @__PURE__ */ new Set([
|
|
118
|
+
"false",
|
|
119
|
+
"f",
|
|
120
|
+
"no",
|
|
121
|
+
"n",
|
|
122
|
+
"off",
|
|
123
|
+
"0"
|
|
124
|
+
]);
|
|
125
|
+
/**
|
|
126
|
+
* Parse a string value as a boolean.
|
|
127
|
+
*
|
|
128
|
+
* Recognized values (case-insensitive, trimmed) follow Python's
|
|
129
|
+
* `distutils.util.strtobool` convention:
|
|
130
|
+
* - truthy: `true, t, yes, y, on, 1`
|
|
131
|
+
* - falsy: `false, f, no, n, off, 0`
|
|
132
|
+
*
|
|
133
|
+
* Undefined, empty strings, and unrecognized values return `undefined` so
|
|
134
|
+
* that callers can fall back to their own defaults.
|
|
135
|
+
* @param value - The input string (e.g. an environment variable or CLI flag value)
|
|
136
|
+
* @returns `true`, `false`, or `undefined` when the value is unset or unrecognized
|
|
137
|
+
*/
|
|
138
|
+
function parseBoolean(value) {
|
|
139
|
+
if (value === void 0) return void 0;
|
|
140
|
+
const normalized = value.trim().toLowerCase();
|
|
141
|
+
if (normalized === "") return void 0;
|
|
142
|
+
if (TRUTHY_VALUES.has(normalized)) return true;
|
|
143
|
+
if (FALSY_VALUES.has(normalized)) return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/cli/shared/logger.ts
|
|
148
|
+
/**
|
|
149
|
+
* Error thrown when a prompt is attempted in a non-interactive environment
|
|
150
|
+
*/
|
|
151
|
+
var CIPromptError = class extends Error {
|
|
152
|
+
constructor(message) {
|
|
153
|
+
super(message ?? "Interactive prompts are not available in this environment. Provide the required options explicitly.");
|
|
154
|
+
this.name = "CIPromptError";
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Semantic style functions for inline text styling
|
|
159
|
+
*/
|
|
160
|
+
const styles = {
|
|
161
|
+
success: chalk.green,
|
|
162
|
+
error: chalk.red,
|
|
163
|
+
warning: chalk.yellow,
|
|
164
|
+
info: chalk.cyan,
|
|
165
|
+
create: chalk.green,
|
|
166
|
+
update: chalk.yellow,
|
|
167
|
+
delete: chalk.red,
|
|
168
|
+
unchanged: chalk.gray,
|
|
169
|
+
bold: chalk.bold,
|
|
170
|
+
dim: chalk.gray,
|
|
171
|
+
highlight: chalk.cyanBright,
|
|
172
|
+
successBright: chalk.greenBright,
|
|
173
|
+
errorBright: chalk.redBright,
|
|
174
|
+
resourceType: chalk.bold,
|
|
175
|
+
resourceName: chalk.cyan,
|
|
176
|
+
path: chalk.cyan,
|
|
177
|
+
value: chalk.white,
|
|
178
|
+
placeholder: chalk.gray.italic
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Standardized symbols for CLI output
|
|
182
|
+
*/
|
|
183
|
+
const symbols = {
|
|
184
|
+
success: chalk.green("✓"),
|
|
185
|
+
error: chalk.red("✖"),
|
|
186
|
+
warning: chalk.yellow("⚠"),
|
|
187
|
+
info: chalk.cyan("i"),
|
|
188
|
+
create: chalk.green("+"),
|
|
189
|
+
update: chalk.yellow("~"),
|
|
190
|
+
delete: chalk.red("-"),
|
|
191
|
+
replace: chalk.magenta("±"),
|
|
192
|
+
bullet: chalk.gray("•"),
|
|
193
|
+
arrow: chalk.gray("→")
|
|
194
|
+
};
|
|
195
|
+
let _jsonMode = false;
|
|
196
|
+
const TYPE_ICONS = {
|
|
197
|
+
info: "ℹ",
|
|
198
|
+
success: "✔",
|
|
199
|
+
warn: "⚠",
|
|
200
|
+
error: "✖",
|
|
201
|
+
debug: "⚙",
|
|
202
|
+
trace: "→",
|
|
203
|
+
log: ""
|
|
204
|
+
};
|
|
205
|
+
const TYPE_COLORS = {
|
|
206
|
+
info: chalk.cyan,
|
|
207
|
+
success: chalk.green,
|
|
208
|
+
warn: chalk.yellow,
|
|
209
|
+
error: chalk.red,
|
|
210
|
+
debug: chalk.gray,
|
|
211
|
+
trace: chalk.gray,
|
|
212
|
+
log: (text) => text
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Formats a log line with the appropriate prefix and indentation
|
|
216
|
+
* @param opts - Formatting options
|
|
217
|
+
* @returns Formatted log line
|
|
218
|
+
*/
|
|
219
|
+
function formatLogLine(opts) {
|
|
220
|
+
const { mode, indent, type, message, timestamp } = opts;
|
|
221
|
+
const indentPrefix = indent > 0 ? " ".repeat(indent) : "";
|
|
222
|
+
const colorFn = TYPE_COLORS[type] || ((text) => text);
|
|
223
|
+
if (mode === "plain") return `${indentPrefix}${colorFn(message)}\n`;
|
|
224
|
+
const icon = TYPE_ICONS[type] || "";
|
|
225
|
+
const coloredOutput = colorFn(`${icon ? `${icon} ` : ""}${message}`);
|
|
226
|
+
return `${indentPrefix}${timestamp ?? ""}${coloredOutput}\n`;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Writes a formatted log line to stderr.
|
|
230
|
+
* @param type - Log type (info, success, warn, error, log)
|
|
231
|
+
* @param message - Log message
|
|
232
|
+
* @param opts - Log options (mode and indent)
|
|
233
|
+
*/
|
|
234
|
+
function writeLog(type, message, opts) {
|
|
235
|
+
const mode = opts?.mode ?? "default";
|
|
236
|
+
const output = formatLogLine({
|
|
237
|
+
mode,
|
|
238
|
+
indent: opts?.indent ?? 0,
|
|
239
|
+
type,
|
|
240
|
+
message: formatWithOptions({ breakLength: process.stdout.columns || 80 }, message),
|
|
241
|
+
timestamp: mode === "stream" ? `${(/* @__PURE__ */ new Date()).toLocaleTimeString()} ` : ""
|
|
242
|
+
});
|
|
243
|
+
process.stderr.write(output);
|
|
244
|
+
}
|
|
245
|
+
const logger = {
|
|
246
|
+
get jsonMode() {
|
|
247
|
+
return _jsonMode;
|
|
248
|
+
},
|
|
249
|
+
set jsonMode(value) {
|
|
250
|
+
_jsonMode = value;
|
|
251
|
+
},
|
|
252
|
+
info(message, opts) {
|
|
253
|
+
writeLog("info", message, opts);
|
|
254
|
+
},
|
|
255
|
+
success(message, opts) {
|
|
256
|
+
writeLog("success", message, opts);
|
|
257
|
+
},
|
|
258
|
+
warn(message, opts) {
|
|
259
|
+
writeLog("warn", message, opts);
|
|
260
|
+
},
|
|
261
|
+
error(message, opts) {
|
|
262
|
+
writeLog("error", message, opts);
|
|
263
|
+
},
|
|
264
|
+
log(message) {
|
|
265
|
+
writeLog("log", message, { mode: "plain" });
|
|
266
|
+
},
|
|
267
|
+
newline() {
|
|
268
|
+
process.stderr.write("\n");
|
|
269
|
+
},
|
|
270
|
+
debug(message) {
|
|
271
|
+
if (parseBoolean(process.env.DEBUG) === true) writeLog("log", styles.dim(message), { mode: "plain" });
|
|
272
|
+
},
|
|
273
|
+
out(data, options) {
|
|
274
|
+
if (typeof data === "string") {
|
|
275
|
+
process.stdout.write(data.endsWith("\n") ? data : data + "\n");
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
if (this.jsonMode) {
|
|
279
|
+
console.log(JSON.stringify(data));
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const display = options?.display;
|
|
283
|
+
const formatValue = (value, pretty = false) => {
|
|
284
|
+
if (options?.showNull && value === null) return "NULL";
|
|
285
|
+
if (value === null || value === void 0) return "N/A";
|
|
286
|
+
if (value instanceof Date) return formatDistanceToNowStrict(value, { addSuffix: true });
|
|
287
|
+
if (typeof value === "object") return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);
|
|
288
|
+
return String(value);
|
|
289
|
+
};
|
|
290
|
+
const isExcluded = (key) => {
|
|
291
|
+
return display !== void 0 && key in display && display[key] === null;
|
|
292
|
+
};
|
|
293
|
+
const transformValue = (key, value, item, pretty = false) => {
|
|
294
|
+
if (display && key in display) {
|
|
295
|
+
const transformer = display[key];
|
|
296
|
+
if (transformer) return transformer(value, item);
|
|
297
|
+
}
|
|
298
|
+
return formatValue(value, pretty);
|
|
299
|
+
};
|
|
300
|
+
if (!Array.isArray(data)) {
|
|
301
|
+
const t = renderTable(Object.entries(data).filter(([key]) => !isExcluded(key)).map(([key, value]) => [key, transformValue(key, value, data, true)]), { singleLine: false });
|
|
302
|
+
process.stdout.write(t);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (data.length === 0) return;
|
|
306
|
+
const headers = Array.from(new Set(data.flatMap((item) => Object.keys(item)))).filter((h) => !isExcluded(h));
|
|
307
|
+
if (headers.length === 0) return;
|
|
308
|
+
const t = renderTable([headers, ...data.map((item) => headers.map((header) => transformValue(header, item[header], item)))], { drawHorizontalLine: (lineIndex, rowCount) => {
|
|
309
|
+
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
310
|
+
} });
|
|
311
|
+
process.stdout.write(t);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
//#endregion
|
|
316
|
+
export { parseBoolean as a, symbols as i, logger as n, renderTable as o, styles as r, CIPromptError as t };
|
|
317
|
+
//# sourceMappingURL=logger-CXQq9YIp.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-CXQq9YIp.mjs","names":[],"sources":["../src/cli/shared/ascii-table.ts","../src/cli/shared/parse-boolean.ts","../src/cli/shared/logger.ts"],"sourcesContent":["import { eastAsianWidth } from \"get-east-asian-width\";\n\n// eslint-disable-next-line no-control-regex\nconst ANSI_ESCAPE_PATTERN = /\\x1b\\[[0-9;]*m/g;\nconst CARRIAGE_RETURN_PATTERN = /\\r\\n?/g;\n\nconst graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n\nexport interface AsciiTableConfig {\n /** Suppress horizontal lines between rows, keeping only the outer border. */\n singleLine?: boolean;\n /** Decide whether to draw the horizontal line at `lineIndex` (range `[0, rowCount]` inclusive). */\n drawHorizontalLine?: (lineIndex: number, rowCount: number) => boolean;\n}\n\ninterface CellLine {\n text: string;\n width: number;\n}\n\nfunction maxOf(values: number[], fallback = 0): number {\n return values.reduce((max, value) => (value > max ? value : max), fallback);\n}\n\nconst TAB_WIDTH = 8;\n\nfunction isStrippableControlCharacter(char: string): boolean {\n const codePoint = char.codePointAt(0) ?? 0;\n if (char === \"\\n\") {\n return false;\n }\n return codePoint <= 0x1f || codePoint === 0x7f;\n}\n\n// Only SGR (color/style) escape sequences are meant to survive; a bare ESC\n// that isn't part of a recognized SGR sequence (e.g. a screen-clear CSI\n// sequence, or a BEL-terminated OSC sequence) is treated like any other\n// control character below and stripped, rather than passed through to the\n// terminal or left with its terminator removed.\nfunction normalizeControlCharacters(value: string): string {\n const sgrSequences = value.match(ANSI_ESCAPE_PATTERN) ?? [];\n return value\n .split(ANSI_ESCAPE_PATTERN)\n .map((segment) => {\n const chars: string[] = [];\n for (const char of segment) {\n if (char === \"\\t\") {\n chars.push(\" \".repeat(TAB_WIDTH));\n } else if (!isStrippableControlCharacter(char)) {\n chars.push(char);\n }\n }\n return chars.join(\"\");\n })\n .reduce((result, segment, i) => result + segment + (sgrSequences[i] ?? \"\"), \"\");\n}\n\nfunction sanitizeCell(cell: unknown): string {\n return normalizeControlCharacters(String(cell ?? \"\").replace(CARRIAGE_RETURN_PATTERN, \"\\n\"));\n}\n\n// Clusters made up entirely of non-printing code points (lone joiners,\n// variation selectors, combining marks, etc.) render with no visible glyph.\nconst ZERO_WIDTH_CLUSTER_PATTERN =\n /^(?:\\p{Default_Ignorable_Code_Point}|\\p{Control}|\\p{Format}|\\p{Nonspacing_Mark}|\\p{Enclosing_Mark}|\\p{Surrogate})+$/v;\n// RGI_Emoji covers flags, keycaps, and VS16-forced presentation sequences,\n// which render as 2 columns in terminals even though their first code point\n// alone would measure as narrow/neutral.\nconst RGI_EMOJI_PATTERN = /^\\p{RGI_Emoji}$/v;\n\nfunction displayWidth(value: string): number {\n let width = 0;\n for (const { segment } of graphemeSegmenter.segment(value.replace(ANSI_ESCAPE_PATTERN, \"\"))) {\n if (ZERO_WIDTH_CLUSTER_PATTERN.test(segment)) {\n continue;\n }\n if (RGI_EMOJI_PATTERN.test(segment)) {\n width += 2;\n continue;\n }\n const codePoint = segment.codePointAt(0);\n width += codePoint === undefined ? 0 : eastAsianWidth(codePoint);\n }\n return width;\n}\n\nfunction toCellLines(cell: string): CellLine[] {\n return cell.split(\"\\n\").map((text) => ({ text, width: displayWidth(text) }));\n}\n\nfunction padCell(cellLine: CellLine, width: number): string {\n return cellLine.text + \" \".repeat(Math.max(0, width - cellLine.width));\n}\n\nfunction renderBorder(left: string, join: string, right: string, columnWidths: number[]): string {\n return left + columnWidths.map((width) => \"─\".repeat(width + 2)).join(join) + right;\n}\n\nfunction validateConsistentColumnCount(rows: string[][]): void {\n const columnCount = rows[0]?.length;\n if (columnCount === undefined) {\n return;\n }\n rows.forEach((row, index) => {\n if (row.length !== columnCount) {\n throw new Error(\n `renderTable: all rows must have the same number of columns (expected ${columnCount}, row ${index} has ${row.length}).`,\n );\n }\n });\n}\n\n/**\n * Renders a 2D array of values as a table using single-line Unicode box-drawing borders.\n * Column widths account for East Asian wide characters (measured per grapheme cluster,\n * so combining marks and ZWJ emoji sequences aren't overcounted, non-printing clusters\n * such as a lone joiner or combining mark measure as 0, and flags, keycaps, and\n * VS16-forced emoji presentation are measured as 2 columns) and strip ANSI SGR (color/style)\n * escape codes before measuring. Use this instead of importing a table-rendering package\n * directly.\n * @param data - Table rows; every row must have the same number of columns. Each cell is\n * stringified (`null`/`undefined` become an empty string rather than the literal text\n * \"null\"/\"undefined\"), may contain embedded newlines, has `\\r`/`\\r\\n` normalized to `\\n`,\n * has tabs expanded to spaces, and has other control characters stripped.\n * @param config - Rendering options\n * @returns The rendered table terminated with a trailing newline, or `\"\"` when there are no\n * rows or no columns to display\n */\nexport function renderTable(data: unknown[][], config: AsciiTableConfig = {}): string {\n const rows = data.map((row) => row.map(sanitizeCell));\n validateConsistentColumnCount(rows);\n\n const rowCount = rows.length;\n const columnCount = rows[0]?.length ?? 0;\n if (rowCount === 0 || columnCount === 0) {\n return \"\";\n }\n\n const rowsCellLines = rows.map((row) =>\n Array.from({ length: columnCount }, (_, col) => toCellLines(row[col] ?? \"\")),\n );\n const columnWidths = Array.from({ length: columnCount }, (_, col) =>\n maxOf(rowsCellLines.map((row) => maxOf((row[col] ?? []).map((line) => line.width)))),\n );\n\n const shouldDrawLine = (lineIndex: number): boolean =>\n config.singleLine\n ? lineIndex === 0 || lineIndex === rowCount\n : (config.drawHorizontalLine ?? (() => true))(lineIndex, rowCount);\n\n const lines: string[] = [];\n if (shouldDrawLine(0)) {\n lines.push(renderBorder(\"┌\", \"┬\", \"┐\", columnWidths));\n }\n\n rowsCellLines.forEach((cellLines, rowIndex) => {\n const rowHeight = maxOf(\n cellLines.map((columnLines) => columnLines.length),\n 1,\n );\n for (let line = 0; line < rowHeight; line++) {\n const cells = cellLines.map((columnLines, col) =>\n padCell(columnLines[line] ?? { text: \"\", width: 0 }, columnWidths[col] ?? 0),\n );\n lines.push(`│ ${cells.join(\" │ \")} │`);\n }\n if (rowIndex < rowCount - 1 && shouldDrawLine(rowIndex + 1)) {\n lines.push(renderBorder(\"├\", \"┼\", \"┤\", columnWidths));\n }\n });\n\n if (shouldDrawLine(rowCount)) {\n lines.push(renderBorder(\"└\", \"┴\", \"┘\", columnWidths));\n }\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n","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 { renderTable } from \"./ascii-table\";\nimport { parseBoolean } from \"./parse-boolean\";\n\n/**\n * Error thrown when a prompt is attempted in a non-interactive environment\n */\nexport class CIPromptError extends Error {\n constructor(message?: string) {\n super(\n message ??\n \"Interactive prompts are not available in this environment. Provide the required options explicitly.\",\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 = renderTable(formattedEntries, { singleLine: false });\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 if (headers.length === 0) {\n return;\n }\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 = renderTable([headers, ...rows], {\n drawHorizontalLine: (lineIndex, rowCount) => {\n return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;\n },\n });\n process.stdout.write(t);\n },\n};\n"],"mappings":";;;;;;AAGA,MAAM,sBAAsB;AAC5B,MAAM,0BAA0B;AAEhC,MAAM,oBAAoB,IAAI,KAAK,UAAU,QAAW,EAAE,aAAa,WAAW,CAAC;AAcnF,SAAS,MAAM,QAAkB,WAAW,GAAW;CACrD,OAAO,OAAO,QAAQ,KAAK,UAAW,QAAQ,MAAM,QAAQ,KAAM,QAAQ;AAC5E;AAEA,MAAM,YAAY;AAElB,SAAS,6BAA6B,MAAuB;CAC3D,MAAM,YAAY,KAAK,YAAY,CAAC,KAAK;CACzC,IAAI,SAAS,MACX,OAAO;CAET,OAAO,aAAa,MAAQ,cAAc;AAC5C;AAOA,SAAS,2BAA2B,OAAuB;CACzD,MAAM,eAAe,MAAM,MAAM,mBAAmB,KAAK,CAAC;CAC1D,OAAO,MACJ,MAAM,mBAAmB,CAAC,CAC1B,KAAK,YAAY;EAChB,MAAM,QAAkB,CAAC;EACzB,KAAK,MAAM,QAAQ,SACjB,IAAI,SAAS,KACX,MAAM,KAAK,IAAI,OAAO,SAAS,CAAC;OAC3B,IAAI,CAAC,6BAA6B,IAAI,GAC3C,MAAM,KAAK,IAAI;EAGnB,OAAO,MAAM,KAAK,EAAE;CACtB,CAAC,CAAC,CACD,QAAQ,QAAQ,SAAS,MAAM,SAAS,WAAW,aAAa,MAAM,KAAK,EAAE;AAClF;AAEA,SAAS,aAAa,MAAuB;CAC3C,OAAO,2BAA2B,OAAO,QAAQ,EAAE,CAAC,CAAC,QAAQ,yBAAyB,IAAI,CAAC;AAC7F;AAIA,MAAM,6BACJ;AAIF,MAAM,oBAAoB;AAE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,KAAK,WAAW,CACrD,KACA,eAAe,KAAK,OAAO,MAAM,IAAI,CACvC,CACqC,GAAG,EAAE,YAAY,MAAM,CAAC;GAC7D,QAAQ,OAAO,MAAM,CAAC;GACtB;EACF;EAEA,IAAI,KAAK,WAAW,GAClB;EAIF,MAAM,UADa,MAAM,KAAK,IAAI,IAAI,KAAK,SAAS,SAAS,OAAO,KAAK,IAAI,CAAC,CAAC,CACtD,CAAC,CAAC,QAAQ,MAAM,CAAC,WAAW,CAAC,CAAC;EACvD,IAAI,QAAQ,WAAW,GACrB;EAQF,MAAM,IAAI,YAAY,CAAC,SAAS,GANnB,KAAK,KAAK,SACrB,QAAQ,KAAK,WACX,eAAe,QAAS,KAAiC,SAAS,IAAI,CACxE,CAGoC,CAAC,GAAG,EACxC,qBAAqB,WAAW,aAAa;GAC3C,OAAO,cAAc,KAAK,cAAc,KAAK,cAAc;EAC7D,EACF,CAAC;EACD,QAAQ,OAAO,MAAM,CAAC;CACxB;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./schema.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./schema.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PluginGeneratedTypeSource, TypeSourceInfoEntry } from "./types.mjs";
|
|
2
|
+
//#region src/parser/service/tailordb/type-source.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a type source is generated by a plugin.
|
|
5
|
+
* @param source - The type source entry to check.
|
|
6
|
+
* @returns True if the source was generated by a plugin.
|
|
7
|
+
*/
|
|
8
|
+
declare function isPluginGeneratedType(source: TypeSourceInfoEntry): source is PluginGeneratedTypeSource;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { isPluginGeneratedType };
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
//#region src/parser/service/tailordb/types.d.ts
|
|
6
|
+
interface UserDefinedTypeSource {
|
|
7
|
+
filePath: string;
|
|
8
|
+
exportName: string;
|
|
9
|
+
pluginId?: never;
|
|
10
|
+
}
|
|
11
|
+
interface PluginGeneratedTypeSource {
|
|
12
|
+
filePath?: never;
|
|
13
|
+
exportName: string;
|
|
14
|
+
pluginId: string;
|
|
15
|
+
pluginImportPath: string;
|
|
16
|
+
originalFilePath: string;
|
|
17
|
+
originalExportName: string;
|
|
18
|
+
generatedTypeKind?: string;
|
|
19
|
+
pluginConfig?: unknown;
|
|
20
|
+
namespace?: string;
|
|
21
|
+
}
|
|
22
|
+
type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;
|
|
23
|
+
interface Script {
|
|
24
|
+
expr: string;
|
|
25
|
+
}
|
|
26
|
+
interface OperatorValidateConfig {
|
|
27
|
+
script: Script;
|
|
28
|
+
errorMessage: string;
|
|
29
|
+
}
|
|
30
|
+
interface OperatorFieldHook {
|
|
31
|
+
create?: Script;
|
|
32
|
+
update?: Script;
|
|
33
|
+
}
|
|
34
|
+
interface OperatorFieldConfig {
|
|
35
|
+
type: string;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
description?: string;
|
|
38
|
+
allowedValues?: EnumValue[];
|
|
39
|
+
array?: boolean;
|
|
40
|
+
index?: boolean;
|
|
41
|
+
unique?: boolean;
|
|
42
|
+
vector?: boolean;
|
|
43
|
+
foreignKey?: boolean;
|
|
44
|
+
foreignKeyType?: string;
|
|
45
|
+
foreignKeyField?: string;
|
|
46
|
+
rawRelation?: RawRelationConfig;
|
|
47
|
+
validate?: OperatorValidateConfig[];
|
|
48
|
+
hooks?: OperatorFieldHook;
|
|
49
|
+
serial?: {
|
|
50
|
+
start: number;
|
|
51
|
+
maxValue?: number;
|
|
52
|
+
format?: string;
|
|
53
|
+
};
|
|
54
|
+
scale?: number;
|
|
55
|
+
default?: unknown;
|
|
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
|
+
typeHookExpr?: {
|
|
125
|
+
create?: string;
|
|
126
|
+
update?: string;
|
|
127
|
+
};
|
|
128
|
+
typeValidateExpr?: string;
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
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,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
//#region src/plugin/builtin/enum-constants/index.d.ts
|
|
3
|
+
/** Unique identifier for the enum constants generator plugin. */
|
|
4
|
+
declare const EnumConstantsGeneratorID = "@tailor-platform/enum-constants";
|
|
5
|
+
type EnumConstantsPluginOptions = {
|
|
6
|
+
distPath: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Plugin that generates enum constants from TailorDB type definitions.
|
|
10
|
+
* @param options - Plugin options
|
|
11
|
+
* @param options.distPath - Output file path for generated constants
|
|
12
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
13
|
+
*/
|
|
14
|
+
declare function enumConstantsPlugin(options: EnumConstantsPluginOptions): Plugin<unknown, EnumConstantsPluginOptions>;
|
|
15
|
+
//#endregion
|
|
2
16
|
export { EnumConstantsGeneratorID, enumConstantsPlugin };
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
//#region src/plugin/builtin/file-utils/index.d.ts
|
|
3
|
+
/** Unique identifier for the file utilities generator plugin. */
|
|
4
|
+
declare const FileUtilsGeneratorID = "@tailor-platform/file-utils";
|
|
5
|
+
type FileUtilsPluginOptions = {
|
|
6
|
+
distPath: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Plugin that generates TypeWithFiles interface from TailorDB type definitions.
|
|
10
|
+
* @param options - Plugin options
|
|
11
|
+
* @param options.distPath - Output file path for generated file utilities
|
|
12
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
13
|
+
*/
|
|
14
|
+
declare function fileUtilsPlugin(options: FileUtilsPluginOptions): Plugin<unknown, FileUtilsPluginOptions>;
|
|
15
|
+
//#endregion
|
|
2
16
|
export { FileUtilsGeneratorID, fileUtilsPlugin };
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from "../../types.mjs";
|
|
2
|
+
//#region src/plugin/builtin/kysely-type/index.d.ts
|
|
3
|
+
/** Unique identifier for the Kysely type generator plugin. */
|
|
4
|
+
declare const KyselyGeneratorID = "@tailor-platform/kysely-type";
|
|
5
|
+
type KyselyTypePluginOptions = {
|
|
6
|
+
distPath: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Plugin that generates Kysely type definitions for TailorDB types.
|
|
10
|
+
* @param options - Plugin options
|
|
11
|
+
* @param options.distPath - Output file path for generated types
|
|
12
|
+
* @returns Plugin instance with onTailorDBReady hook
|
|
13
|
+
*/
|
|
14
|
+
declare function kyselyTypePlugin(options: KyselyTypePluginOptions): Plugin<unknown, KyselyTypePluginOptions>;
|
|
15
|
+
//#endregion
|
|
2
16
|
export { KyselyGeneratorID, kyselyTypePlugin };
|