@restforgejs/platform 4.2.8 → 4.3.2
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/SECURITY.md +83 -4
- package/bin/sdf-tools.exe +0 -0
- package/build-info.json +2 -2
- package/cli/consumer-deploy.js +1 -1
- package/cli/consumer.js +1 -1
- package/generators/cli/dashboard/create.js +4 -1
- package/generators/cli/endpoint/create.js +1 -1
- package/generators/cli/key/generate.js +2 -1
- package/generators/cli/key/revoke.js +2 -1
- package/generators/cli/payload/diff.js +3 -2
- package/generators/cli/payload/generate.js +3 -2
- package/generators/cli/payload/sync.js +3 -2
- package/generators/cli/payload/validate.js +3 -2
- package/generators/cli/processor/create.js +14 -3
- package/generators/cli/project/delete.js +2 -1
- package/generators/cli/query/validate.js +3 -2
- package/generators/cli/schema/apply.js +3 -2
- package/generators/cli/schema/describe.js +3 -2
- package/generators/cli/schema/diff.js +3 -2
- package/generators/cli/schema/introspect.js +3 -2
- package/generators/cli/schema/list.js +3 -2
- package/generators/cli/schema/migrate.js +3 -2
- package/generators/lib/migration/audit-table-runner.js +213 -215
- package/generators/lib/payload/payload-runner.js +1 -1
- package/generators/lib/templates/dashboard-catalog.js +1 -437
- package/generators/lib/templates/db-connection-env.js +1 -212
- package/generators/lib/templates/dbschema-catalog.js +1 -489
- package/generators/lib/templates/field-validation-catalog.js +1 -531
- package/generators/lib/templates/mysql-template.js +1 -3863
- package/generators/lib/templates/oracle-template.js +1 -3915
- package/generators/lib/templates/postgres-template.js +1 -5838
- package/generators/lib/templates/query-declarative-catalog.js +1 -199
- package/generators/lib/templates/sqlite-template.js +1 -3440
- package/generators/lib/utils/env-manager.js +6 -0
- package/generators/lib/utils/path-validator.js +71 -0
- package/generators/lib/validators/payload-validator.js +1 -2
- package/integrity-manifest.json +28 -10
- package/package.json +11 -3
- package/scripts/verify-integrity.js +1 -1
- package/server.js +1 -1
- package/src/components/handlers/adjust_handler.js +1 -1
- package/src/components/handlers/audit_handler.js +1 -1
- package/src/components/handlers/delete_handler.js +1 -1
- package/src/components/handlers/export_handler.js +1 -1
- package/src/components/handlers/import_handler.js +1 -1
- package/src/components/handlers/insert_handler.js +1 -1
- package/src/components/handlers/update_handler.js +1 -1
- package/src/components/handlers/upload_handler.js +1 -1
- package/src/components/handlers/workflow_handler.js +1 -1
- package/src/components/integrations/webhook.js +1 -1
- package/src/consumers/baseConsumer.js +1 -1
- package/src/consumers/declarativeMapper.js +1 -1
- package/src/consumers/handlers/apiHandler.js +1 -1
- package/src/consumers/handlers/consoleHandler.js +1 -1
- package/src/consumers/handlers/databaseHandler.js +1 -1
- package/src/consumers/handlers/index.js +1 -1
- package/src/consumers/handlers/kafkaHandler.js +1 -1
- package/src/consumers/index.js +1 -1
- package/src/consumers/messageTransformer.js +1 -1
- package/src/consumers/validator.js +1 -1
- package/src/core/db/dialect/base-dialect.js +1 -1
- package/src/core/db/dialect/index.js +1 -1
- package/src/core/db/dialect/mysql-dialect.js +1 -1
- package/src/core/db/dialect/oracle-dialect.js +1 -1
- package/src/core/db/dialect/postgres-dialect.js +1 -1
- package/src/core/db/dialect/sqlite-dialect.js +1 -1
- package/src/core/db/flatten-helper.js +1 -1
- package/src/core/db/query-builder-error.js +1 -1
- package/src/core/db/query-builder.js +1 -1
- package/src/core/db/relation-helper.js +1 -1
- package/src/core/handlers/delete_handler.js +1 -1
- package/src/core/handlers/insert_handler.js +1 -1
- package/src/core/handlers/update_handler.js +1 -1
- package/src/core/models/base-model.js +1 -1
- package/src/core/utils/cache-manager.js +1 -1
- package/src/core/utils/component-engine.js +1 -1
- package/src/core/utils/context-builder.js +1 -1
- package/src/core/utils/datetime-formatter.js +1 -1
- package/src/core/utils/datetime-parser.js +1 -1
- package/src/core/utils/db.js +1 -1
- package/src/core/utils/logger.js +1 -1
- package/src/core/utils/payload-loader.js +1 -1
- package/src/core/utils/security-checks.js +1 -1
- package/src/middleware/body-options.js +1 -1
- package/src/middleware/cors.js +1 -1
- package/src/middleware/idempotency.js +1 -1
- package/src/middleware/rate-limiter.js +1 -1
- package/src/middleware/request-logger.js +1 -1
- package/src/middleware/security-headers.js +1 -1
- package/src/models/base-model-mysql.js +1 -1
- package/src/models/base-model-oracle.js +1 -1
- package/src/models/base-model-sqlite.js +1 -1
- package/src/models/base-model.js +1 -1
- package/src/pro/caching/redis-client.js +1 -1
- package/src/pro/caching/redis-helper.js +1 -1
- package/src/pro/consumers/baseConsumer.js +1 -1
- package/src/pro/consumers/declarativeMapper.js +1 -1
- package/src/pro/consumers/handlers/apiHandler.js +1 -1
- package/src/pro/consumers/handlers/consoleHandler.js +1 -1
- package/src/pro/consumers/handlers/databaseHandler.js +1 -1
- package/src/pro/consumers/handlers/index.js +1 -1
- package/src/pro/consumers/handlers/kafkaHandler.js +1 -1
- package/src/pro/consumers/index.js +1 -1
- package/src/pro/consumers/messageTransformer.js +1 -1
- package/src/pro/consumers/validator.js +1 -1
- package/src/pro/database/base-model-mysql.js +1 -1
- package/src/pro/database/base-model-oracle.js +1 -1
- package/src/pro/database/base-model-sqlite.js +1 -1
- package/src/pro/database/db-mysql.js +1 -1
- package/src/pro/database/db-oracle.js +1 -1
- package/src/pro/database/db-sqlite.js +1 -1
- package/src/pro/excel/excel-generator.js +1 -1
- package/src/pro/excel/excel-parser.js +1 -1
- package/src/pro/excel/export-service.js +1 -1
- package/src/pro/excel/export_handler.js +1 -1
- package/src/pro/excel/import-service.js +1 -1
- package/src/pro/excel/import-validator.js +1 -1
- package/src/pro/excel/import_handler.js +1 -1
- package/src/pro/excel/upsert-builder.js +1 -1
- package/src/pro/idgen/idgen-routes.js +1 -1
- package/src/pro/integrations/lookup-resolver.js +1 -1
- package/src/pro/integrations/upload-handler-v2.js +1 -1
- package/src/pro/integrations/upload-handler.js +1 -1
- package/src/pro/integrations/webhook.js +1 -1
- package/src/pro/locking/lock-routes.js +1 -1
- package/src/pro/locking/resource-lock-manager.js +1 -1
- package/src/pro/messaging/kafkaConsumerService.js +1 -1
- package/src/pro/messaging/kafkaService.js +1 -1
- package/src/pro/messaging/messagehubService.js +1 -1
- package/src/pro/messaging/rabbitmqService.js +1 -1
- package/src/pro/scheduler/job-manager.js +1 -1
- package/src/pro/scheduler/job-routes.js +1 -1
- package/src/pro/scheduler/job-validator.js +1 -1
- package/src/pro/storage/base-storage-provider.js +1 -1
- package/src/pro/storage/file-metadata-helper.js +1 -1
- package/src/pro/storage/index.js +1 -1
- package/src/pro/storage/local-storage-provider.js +1 -1
- package/src/pro/storage/s3-storage-provider.js +1 -1
- package/src/pro/storage/upload-cleanup-job.js +1 -1
- package/src/pro/storage/upload-cleanup-scheduler.js +1 -1
- package/src/pro/storage/upload-pending-tracker.js +1 -1
- package/src/pro/websocket/broadcast-helper.js +1 -1
- package/src/pro/websocket/index.js +1 -1
- package/src/pro/websocket/livesync-server.js +1 -1
- package/src/pro/websocket/ws-broadcaster.js +1 -1
- package/src/services/export-service.js +1 -1
- package/src/services/import-service.js +1 -1
- package/src/services/kafkaConsumerService.js +1 -1
- package/src/services/kafkaService.js +1 -1
- package/src/services/messagehubService.js +1 -1
- package/src/services/rabbitmqService.js +1 -1
- package/src/utils/cache-invalidation-registry.js +1 -1
- package/src/utils/cache-manager.js +1 -1
- package/src/utils/component-engine.js +1 -1
- package/src/utils/config-extractor.js +1 -1
- package/src/utils/consumerLogger.js +1 -1
- package/src/utils/context-builder.js +1 -1
- package/src/utils/dashboard-helpers.js +1 -1
- package/src/utils/dateHelper.js +1 -1
- package/src/utils/datetime-formatter.js +1 -1
- package/src/utils/datetime-parser.js +1 -1
- package/src/utils/db-bootstrap.js +1 -1
- package/src/utils/db-mysql.js +1 -1
- package/src/utils/db-oracle.js +1 -1
- package/src/utils/db-sqlite.js +1 -1
- package/src/utils/db.js +1 -1
- package/src/utils/demo-generator.js +1 -1
- package/src/utils/excel-generator.js +1 -1
- package/src/utils/excel-parser.js +1 -1
- package/src/utils/file-watcher.js +1 -1
- package/src/utils/id-generator.js +1 -1
- package/src/utils/idempotency-manager.js +1 -1
- package/src/utils/import-validator.js +1 -1
- package/src/utils/license-client.js +1 -1
- package/src/utils/lock-manager.js +1 -1
- package/src/utils/logger.js +1 -1
- package/src/utils/lookup-resolver.js +1 -1
- package/src/utils/payload-loader.js +1 -1
- package/src/utils/processor-response.js +1 -1
- package/src/utils/rabbitmq.js +1 -1
- package/src/utils/redis-client.js +1 -1
- package/src/utils/redis-helper.js +1 -1
- package/src/utils/request-scope.js +1 -1
- package/src/utils/security-checks.js +1 -1
- package/src/utils/service-resolver.js +1 -1
- package/src/utils/shutdown-coordinator.js +1 -1
- package/src/utils/trusted-keys.js +1 -1
- package/src/utils/upload-handler.js +1 -1
- package/src/utils/upsert-builder.js +1 -1
- package/src/utils/workflow-hook-executor.js +1 -1
- package/generators/metadata/global.json +0 -58
- package/generators/metadata/test-mysql-workbench.json +0 -118
- package/generators/metadata/test-mysql.json +0 -56
- package/generators/metadata/test-oracle-workbench.json +0 -118
- package/generators/metadata/test-oracle.json +0 -56
- package/generators/metadata/test-pg-workbench.json +0 -118
- package/generators/metadata/test-pg.json +0 -56
- package/generators/scripts/obfuscate-source.js +0 -356
- package/generators/scripts/validate-catalog.js +0 -430
- package/generators/scripts/validate-dbschema-catalog.js +0 -708
- package/generators/tests/baseline/mysql/mini_inventory_item/src/models/mini-inventory/item.js +0 -944
- package/generators/tests/baseline/mysql/mini_inventory_item/src/modules/mini-inventory/item.js +0 -740
- package/generators/tests/baseline/mysql/mini_inventory_item/src/modules/mini-inventory.js +0 -336
- package/generators/tests/baseline/oracle/mini_inventory_item/src/models/mini-inventory/item.js +0 -1002
- package/generators/tests/baseline/oracle/mini_inventory_item/src/modules/mini-inventory/item.js +0 -740
- package/generators/tests/baseline/oracle/mini_inventory_item/src/modules/mini-inventory.js +0 -336
- package/generators/tests/baseline/postgres/mini_inventory_item/src/models/mini-inventory/item.js +0 -1333
- package/generators/tests/baseline/postgres/mini_inventory_item/src/modules/mini-inventory/item.js +0 -1173
- package/generators/tests/baseline/postgres/mini_inventory_item/src/modules/mini-inventory.js +0 -496
- package/generators/tests/fixtures/payloads/custom-sensitive.json +0 -27
- package/generators/tests/fixtures/payloads/dynamic-search-optout.json +0 -23
- package/generators/tests/fixtures/payloads/login-with-password.json +0 -22
- package/generators/tests/fixtures/payloads/order-process.json +0 -52
- package/generators/tests/fixtures/payloads/with-inline-sql.json +0 -26
- package/generators/tests/integration-tahap4b/README.md +0 -145
- package/generators/tests/integration-tahap4b/run-concurrent.js +0 -77
- package/generators/tests/integration-tahap4b/seed.sql +0 -53
- package/generators/tests/integration-tahap4b/verify.sql +0 -110
- package/generators/tests/unit/cli/create-dashboard.test.js +0 -505
- package/generators/tests/unit/cli/create-processor.test.js +0 -319
- package/generators/tests/unit/cli/dispatch-dashboard.test.js +0 -149
- package/generators/tests/unit/lib/dashboard-generator.test.js +0 -895
- package/generators/tests/unit/lib/dashboard-validator.test.js +0 -354
- package/generators/tests/unit/lib/dbschema-kit/apply-executor.test.js +0 -437
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-introspect.test.js +0 -393
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-generate-ddl.test.js +0 -104
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-init.test.js +0 -119
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-list.test.js +0 -48
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-migrate.test.js +0 -175
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-validate.test.js +0 -102
- package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-models.test.js +0 -43
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/all-schemas-listing.js +0 -84
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/connection-error.js +0 -13
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/empty.js +0 -12
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/multi-schema.js +0 -124
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/single-schema-inventory.js +0 -64
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/two-tables.js +0 -66
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/connection-error.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/partial.js +0 -29
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/rollback.js +0 -26
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/success.js +0 -43
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/audit/events.js +0 -18
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/inventory/products.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/users.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/connection.test.js +0 -112
- package/generators/tests/unit/lib/dbschema-kit/ddl-generator.test.js +0 -205
- package/generators/tests/unit/lib/dbschema-kit/define-model.test.js +0 -56
- package/generators/tests/unit/lib/dbschema-kit/dialect/index.test.js +0 -46
- package/generators/tests/unit/lib/dbschema-kit/dialect/mysql.test.js +0 -126
- package/generators/tests/unit/lib/dbschema-kit/dialect/oracle.test.js +0 -126
- package/generators/tests/unit/lib/dbschema-kit/dialect/postgres.test.js +0 -131
- package/generators/tests/unit/lib/dbschema-kit/dialect/sqlite.test.js +0 -126
- package/generators/tests/unit/lib/dbschema-kit/driver-loader.test.js +0 -93
- package/generators/tests/unit/lib/dbschema-kit/emitters/create-index.test.js +0 -173
- package/generators/tests/unit/lib/dbschema-kit/emitters/create-table.test.js +0 -376
- package/generators/tests/unit/lib/dbschema-kit/emitters/drop-table.test.js +0 -78
- package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/invalid-dialect.env +0 -6
- package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/missing-dialect.env +0 -5
- package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/missing-host.env +0 -5
- package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/oracle-valid.env +0 -6
- package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/postgres-valid.env +0 -7
- package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/sqlite-valid.env +0 -2
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/category.js +0 -11
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/item_product.js +0 -11
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/stock_inbound.js +0 -24
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/stock_inbound_item.js +0 -28
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/supplier.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/warehouse.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-invalid/orphan.js +0 -17
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/category.js +0 -11
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/item_product.js +0 -11
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/supplier.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/warehouse.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/transactions/stock_inbound.js +0 -24
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/transactions/stock_inbound_item.js +0 -28
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/audit/events.js +0 -18
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/inventory/products.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/public/users.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-subfolder/extra/category.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-subfolder/master/category.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-tablename/bar.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-tablename/foo.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/empty-folder/README.md +0 -1
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/invalid-export/plain.js +0 -3
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/invalid-schema/bad.js +0 -6
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/legacy-pattern/legacy.js +0 -12
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-distinct/audit/products.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-distinct/inventory/products.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-duplicate/a/products.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-duplicate/b/products.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/nested-deep/a/b/c/deep_table.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/.hidden/ignored.js +0 -7
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/master/category.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/master/supplier.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/transactions/stock_inbound.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/transactions/stock_inbound_item.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-multiple/category.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-multiple/item_product.js +0 -9
- package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-single/category.js +0 -8
- package/generators/tests/unit/lib/dbschema-kit/integration.test.js +0 -217
- package/generators/tests/unit/lib/dbschema-kit/introspect-mapper.test.js +0 -403
- package/generators/tests/unit/lib/dbschema-kit/ir-builder.test.js +0 -390
- package/generators/tests/unit/lib/dbschema-kit/loader.test.js +0 -128
- package/generators/tests/unit/lib/dbschema-kit/naming.test.js +0 -170
- package/generators/tests/unit/lib/dbschema-kit/parser/shorthand-parser.test.js +0 -237
- package/generators/tests/unit/lib/dbschema-kit/schema-printer.test.js +0 -251
- package/generators/tests/unit/lib/dbschema-kit/statement-modifier.test.js +0 -105
- package/generators/tests/unit/lib/dbschema-kit/statement-splitter.test.js +0 -165
- package/generators/tests/unit/lib/dbschema-kit/topological-sort.test.js +0 -135
- package/generators/tests/unit/lib/dbschema-kit/validator/check-compatibility-validator.test.js +0 -373
- package/generators/tests/unit/lib/dbschema-kit/validator/circular-relation-validator.test.js +0 -454
- package/generators/tests/unit/lib/dbschema-kit/validator/cross-model-validator.test.js +0 -512
- package/generators/tests/unit/lib/dbschema-kit/validator/enhanced-validate-integration.test.js +0 -390
- package/generators/tests/unit/lib/dbschema-kit/validator/naming-convention-validator.test.js +0 -306
- package/generators/tests/unit/lib/dbschema-kit/validator/schema-validator.test.js +0 -443
- package/generators/tests/unit/lib/dbschema-kit/validator/type-compatibility-validator.test.js +0 -440
- package/generators/tests/unit/lib/dbschema-kit/validator/validator-reporter.test.js +0 -172
- package/generators/tests/unit/lib/metadata-manager-dashboard.test.js +0 -256
- package/generators/tests/unit/lib/payload-validator-fieldpolicy.test.js +0 -240
- package/generators/tests/unit/lib/processor-validation-generator.test.js +0 -300
- package/generators/tests/unit/lib/sensitive-field-masker.test.js +0 -170
- package/generators/tests/unit/lib/sql-table-extractor.test.js +0 -119
- package/scripts/generate-integrity-manifest.js +0 -124
- package/scripts/snapshot-cli-contracts.js +0 -194
- package/scripts/verify-publish.js +0 -56
|
@@ -1,489 +1 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Authoritative source for dbschema-catalog content.
|
|
5
|
-
* Used by:
|
|
6
|
-
* - cli/dbschema-catalog.js (CLI introspection command)
|
|
7
|
-
* - (future) MCP server tool for dbschema-kit grounding
|
|
8
|
-
*
|
|
9
|
-
* SINGLE SOURCE OF TRUTH: Modify only this file when adding/changing
|
|
10
|
-
* dbschema-kit defineModel API spec. Keep in sync with:
|
|
11
|
-
* - lib/dbschema-kit/define-model.js
|
|
12
|
-
* - lib/dbschema-kit/parser/shorthand-parser.js
|
|
13
|
-
* - lib/dbschema-kit/validator/schema-validator.js
|
|
14
|
-
* - lib/dbschema-kit/validator/cross-model-validator.js
|
|
15
|
-
* - lib/dbschema-kit/ir-builder.js
|
|
16
|
-
* - lib/dbschema-kit/naming.js
|
|
17
|
-
*
|
|
18
|
-
* Reference: docs/schema-definition.md (single source of truth, human-readable)
|
|
19
|
-
*
|
|
20
|
-
* @module lib/templates/dbschema-catalog
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const SCHEMA_VERSION = '1.0';
|
|
24
|
-
const SOURCE = 'dbschema-catalog';
|
|
25
|
-
const DOCUMENTATION_URL = 'https://restforge.dev/docs/cli/schema-definition';
|
|
26
|
-
|
|
27
|
-
// ============================================================================
|
|
28
|
-
// DEFINE MODEL OPTIONS
|
|
29
|
-
// ============================================================================
|
|
30
|
-
|
|
31
|
-
// Note: defineModel signature is `defineModel(tableName, options)`.
|
|
32
|
-
// `tableName` is a positional first argument (snake_case), not a property of `options`.
|
|
33
|
-
// Schema files use factory pattern:
|
|
34
|
-
// module.exports = ({ defineModel }) => defineModel('table_name', { fields: { ... } });
|
|
35
|
-
// Auto-derive from filename happens at the CLI loader level, not in defineModel itself.
|
|
36
|
-
const DEFINE_MODEL_OPTIONS = [
|
|
37
|
-
{
|
|
38
|
-
name: 'schema',
|
|
39
|
-
required: false,
|
|
40
|
-
type: 'string|null',
|
|
41
|
-
description: 'Database schema namespace (multi-schema database).',
|
|
42
|
-
notes: 'null or empty string means default schema.'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'fields',
|
|
46
|
-
required: true,
|
|
47
|
-
type: 'object',
|
|
48
|
-
description: 'Object of field definitions in shorthand string format.',
|
|
49
|
-
example: '{ id: "string:36 pk", name: "string:255 notnull" }'
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'primaryKey',
|
|
53
|
-
required: false,
|
|
54
|
-
type: 'string|array',
|
|
55
|
-
description: 'Override primary key. Single field name or composite array.',
|
|
56
|
-
notes: 'Auto-detected from field shorthand "pk" when not specified.'
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'relations',
|
|
60
|
-
required: false,
|
|
61
|
-
type: 'object',
|
|
62
|
-
description: 'Inter-table relations (belongsTo, hasOne, hasMany).',
|
|
63
|
-
example: '{ category: { type: "belongsTo", references: "category(id)" } }'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: 'indexes',
|
|
67
|
-
required: false,
|
|
68
|
-
type: 'array',
|
|
69
|
-
description: 'Non-unique indexes. Each entry is array of column names or object { name, columns }.',
|
|
70
|
-
example: '[["status", "created_at"]]'
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: 'uniques',
|
|
74
|
-
required: false,
|
|
75
|
-
type: 'array',
|
|
76
|
-
description: 'Unique constraints (single or composite).',
|
|
77
|
-
example: '[["category_code"], ["tenant_id", "category_code"]]'
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'checks',
|
|
81
|
-
required: false,
|
|
82
|
-
type: 'array',
|
|
83
|
-
description: 'CHECK constraints. Each entry uses operator-as-key shape: { name?, field, <operator>: <value> } where <operator> is one of checkOperations (in, eq, neq, gt, gte, lt, lte). The internal IR shape after ir-builder normalization is { name?, field, op, value }, but that is NOT the user input format.',
|
|
84
|
-
example: '[{ field: "status", in: ["active", "inactive"] }, { field: "qty", gte: 0 }]'
|
|
85
|
-
}
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
// ============================================================================
|
|
89
|
-
// FIELD TYPES (10 entries)
|
|
90
|
-
// Source: lib/dbschema-kit/parser/shorthand-parser.js (VALID_TYPES)
|
|
91
|
-
// ============================================================================
|
|
92
|
-
|
|
93
|
-
const FIELD_TYPES = [
|
|
94
|
-
{
|
|
95
|
-
name: 'string',
|
|
96
|
-
description: 'Variable-length text. Length modifier required.',
|
|
97
|
-
requiresModifier: true,
|
|
98
|
-
modifierFormat: 'string:<length>',
|
|
99
|
-
example: 'string:255',
|
|
100
|
-
notes: 'Explicit length required for cross-dialect portability.'
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'text',
|
|
104
|
-
description: 'Long-form text without length limit (TEXT/CLOB).',
|
|
105
|
-
requiresModifier: false,
|
|
106
|
-
example: 'text'
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'integer',
|
|
110
|
-
description: '32-bit signed integer (INT/INTEGER).',
|
|
111
|
-
requiresModifier: false,
|
|
112
|
-
example: 'integer'
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: 'bigint',
|
|
116
|
-
description: '64-bit signed integer (BIGINT).',
|
|
117
|
-
requiresModifier: false,
|
|
118
|
-
example: 'bigint'
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'decimal',
|
|
122
|
-
description: 'Fixed-point decimal. Precision and scale required.',
|
|
123
|
-
requiresModifier: true,
|
|
124
|
-
modifierFormat: 'decimal:<precision>,<scale>',
|
|
125
|
-
example: 'decimal:15,2',
|
|
126
|
-
notes: 'Precision and scale required for cross-dialect portability.'
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: 'boolean',
|
|
130
|
-
description: 'Boolean value (native BOOLEAN on PostgreSQL, VARCHAR on others).',
|
|
131
|
-
requiresModifier: false,
|
|
132
|
-
example: 'boolean'
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: 'date',
|
|
136
|
-
description: 'Date only (no time component).',
|
|
137
|
-
requiresModifier: false,
|
|
138
|
-
example: 'date'
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: 'timestamp',
|
|
142
|
-
description: 'Date and time (TIMESTAMP).',
|
|
143
|
-
requiresModifier: false,
|
|
144
|
-
example: 'timestamp',
|
|
145
|
-
notes: 'Default timezone behavior is dialect-specific.'
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'uuid',
|
|
149
|
-
description: 'UUID. Native UUID on PostgreSQL, VARCHAR(36) on others.',
|
|
150
|
-
requiresModifier: false,
|
|
151
|
-
example: 'uuid'
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
name: 'json',
|
|
155
|
-
description: 'JSON column (JSONB on PostgreSQL, JSON on MySQL, CLOB on Oracle).',
|
|
156
|
-
requiresModifier: false,
|
|
157
|
-
example: 'json'
|
|
158
|
-
}
|
|
159
|
-
];
|
|
160
|
-
|
|
161
|
-
// ============================================================================
|
|
162
|
-
// CONSTRAINTS (shorthand)
|
|
163
|
-
// Source: lib/dbschema-kit/parser/shorthand-parser.js
|
|
164
|
-
// STANDALONE_CONSTRAINTS, VALUE_CONSTRAINTS
|
|
165
|
-
// ============================================================================
|
|
166
|
-
|
|
167
|
-
const CONSTRAINTS = [
|
|
168
|
-
{
|
|
169
|
-
name: 'pk',
|
|
170
|
-
kind: 'standalone',
|
|
171
|
-
description: 'Marks field as primary key.',
|
|
172
|
-
example: 'string:36 pk'
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: 'notnull',
|
|
176
|
-
kind: 'standalone',
|
|
177
|
-
description: 'NOT NULL constraint.',
|
|
178
|
-
example: 'string:255 notnull'
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
name: 'unique',
|
|
182
|
-
kind: 'standalone',
|
|
183
|
-
description: 'Single-column unique constraint.',
|
|
184
|
-
example: 'string:32 unique'
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
name: 'index',
|
|
188
|
-
kind: 'standalone',
|
|
189
|
-
description: 'Single-column non-unique index.',
|
|
190
|
-
example: 'string:64 index'
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
name: 'autoUpdate',
|
|
194
|
-
kind: 'standalone',
|
|
195
|
-
description: 'Marker for audit timestamp columns. RESTForge generator injects this column = <native_now> on every UPDATE statement.',
|
|
196
|
-
example: 'timestamp autoUpdate',
|
|
197
|
-
notes: 'Only valid for type \'timestamp\' or \'date\'. Cannot coexist with \'default:\' constraint. Pre-processed in ir-builder before parser.'
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: 'default',
|
|
201
|
-
kind: 'value',
|
|
202
|
-
description: 'Default value. Single-quoted for strings, raw for numeric/boolean, bare identifier for SQL constants, identifier() for native function calls.',
|
|
203
|
-
valueFormat: "default:<literal> | default:'<string>' | default:<constant> | default:<function>()",
|
|
204
|
-
example: 'boolean default:true'
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
name: 'fk',
|
|
208
|
-
kind: 'value',
|
|
209
|
-
description: 'Foreign key reference. Auto-generates a belongsTo relation entry.',
|
|
210
|
-
valueFormat: 'fk:<table>.<column>',
|
|
211
|
-
example: 'string:36 fk:category.id',
|
|
212
|
-
notes: 'Cannot coexist with explicit relation entry referencing the same field.'
|
|
213
|
-
}
|
|
214
|
-
];
|
|
215
|
-
|
|
216
|
-
// ============================================================================
|
|
217
|
-
// RELATION TYPES
|
|
218
|
-
// Source: lib/dbschema-kit/validator/schema-validator.js (VALID_RELATION_TYPES)
|
|
219
|
-
// ============================================================================
|
|
220
|
-
|
|
221
|
-
const RELATION_TYPES = [
|
|
222
|
-
{
|
|
223
|
-
name: 'belongsTo',
|
|
224
|
-
description: 'Many-to-one. This table holds the FK column referencing the parent table.',
|
|
225
|
-
requiredFields: ['type', 'localKey', 'references'],
|
|
226
|
-
optionalFields: ['target', 'onDelete', 'onUpdate'],
|
|
227
|
-
example: '{ type: "belongsTo", localKey: "category_id", references: "category_id", onDelete: "restrict" }',
|
|
228
|
-
notes: '`references` is the bare column name in the target table. Target table is auto-derived from the relation key name, or override with `target`.'
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
name: 'hasOne',
|
|
232
|
-
description: 'One-to-one (inverse of belongsTo). Optional inverse declaration on the parent side; does not affect DDL.',
|
|
233
|
-
requiredFields: ['type', 'localKey', 'references'],
|
|
234
|
-
optionalFields: ['target', 'onDelete', 'onUpdate'],
|
|
235
|
-
example: '{ type: "hasOne", target: "profile", localKey: "user_id", references: "user_id" }'
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: 'hasMany',
|
|
239
|
-
description: 'One-to-many (inverse of belongsTo). Optional inverse declaration on the parent side; does not affect DDL.',
|
|
240
|
-
requiredFields: ['type', 'localKey', 'references'],
|
|
241
|
-
optionalFields: ['target', 'onDelete', 'onUpdate'],
|
|
242
|
-
example: '{ type: "hasMany", target: "order_item", localKey: "order_id", references: "order_id" }'
|
|
243
|
-
}
|
|
244
|
-
];
|
|
245
|
-
|
|
246
|
-
// ============================================================================
|
|
247
|
-
// REFERENTIAL ACTIONS (onDelete / onUpdate)
|
|
248
|
-
// Source: lib/dbschema-kit/validator/schema-validator.js (VALID_REFERENTIAL_ACTIONS)
|
|
249
|
-
// ============================================================================
|
|
250
|
-
|
|
251
|
-
const REFERENTIAL_ACTIONS = [
|
|
252
|
-
{
|
|
253
|
-
name: 'cascade',
|
|
254
|
-
description: 'Cascade delete/update to child rows.',
|
|
255
|
-
appliesTo: ['onDelete', 'onUpdate']
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: 'restrict',
|
|
259
|
-
description: 'Reject delete/update when child rows exist.',
|
|
260
|
-
appliesTo: ['onDelete', 'onUpdate']
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: 'setNull',
|
|
264
|
-
description: 'Set FK column to NULL on child rows.',
|
|
265
|
-
appliesTo: ['onDelete', 'onUpdate'],
|
|
266
|
-
notes: 'FK field must be nullable.'
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
name: 'noAction',
|
|
270
|
-
description: 'Defer constraint check (semantically similar to restrict on most dialects).',
|
|
271
|
-
appliesTo: ['onDelete', 'onUpdate']
|
|
272
|
-
}
|
|
273
|
-
];
|
|
274
|
-
|
|
275
|
-
// ============================================================================
|
|
276
|
-
// CHECK OPERATIONS
|
|
277
|
-
// Source: lib/dbschema-kit/ir-builder.js (VALID_CHECK_OPS)
|
|
278
|
-
// ============================================================================
|
|
279
|
-
|
|
280
|
-
const CHECK_OPERATIONS = [
|
|
281
|
-
{
|
|
282
|
-
name: 'in',
|
|
283
|
-
description: 'Value must be one of a list.',
|
|
284
|
-
valueType: 'array',
|
|
285
|
-
example: '{ field: "status", in: ["active", "inactive"] }'
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: 'eq',
|
|
289
|
-
description: 'Equal to.',
|
|
290
|
-
valueType: 'scalar',
|
|
291
|
-
example: '{ field: "type", eq: "user" }'
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: 'neq',
|
|
295
|
-
description: 'Not equal to.',
|
|
296
|
-
valueType: 'scalar',
|
|
297
|
-
example: '{ field: "type", neq: "system" }'
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
name: 'gt',
|
|
301
|
-
description: 'Greater than.',
|
|
302
|
-
valueType: 'numeric',
|
|
303
|
-
example: '{ field: "qty", gt: 0 }'
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
name: 'gte',
|
|
307
|
-
description: 'Greater than or equal to.',
|
|
308
|
-
valueType: 'numeric',
|
|
309
|
-
example: '{ field: "qty", gte: 0 }'
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
name: 'lt',
|
|
313
|
-
description: 'Less than.',
|
|
314
|
-
valueType: 'numeric',
|
|
315
|
-
example: '{ field: "discount", lt: 100 }'
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
name: 'lte',
|
|
319
|
-
description: 'Less than or equal to.',
|
|
320
|
-
valueType: 'numeric',
|
|
321
|
-
example: '{ field: "discount", lte: 100 }'
|
|
322
|
-
}
|
|
323
|
-
];
|
|
324
|
-
|
|
325
|
-
// ============================================================================
|
|
326
|
-
// AUDIT COLUMNS CONVENTION
|
|
327
|
-
// Cross-reference: lib/templates/field-validation-catalog.js (AUDIT_COLUMNS)
|
|
328
|
-
// ============================================================================
|
|
329
|
-
|
|
330
|
-
const AUDIT_COLUMNS = {
|
|
331
|
-
description: 'Standard 4-column audit convention for tables managed by RESTForge. The same convention is documented in field-validation:catalog (auditColumns section) for the RDF/backend layer. SDF and RDF stay aligned when both declare these 4 columns.',
|
|
332
|
-
columns: [
|
|
333
|
-
{
|
|
334
|
-
name: 'created_at',
|
|
335
|
-
shorthand: 'timestamp default:now()',
|
|
336
|
-
nullable: true,
|
|
337
|
-
purpose: 'Record creation timestamp. Auto-set on INSERT via DEFAULT now(). Native function translates per dialect (postgres: CURRENT_TIMESTAMP, mysql: NOW(), oracle: SYSTIMESTAMP, sqlite: CURRENT_TIMESTAMP).'
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
name: 'created_by',
|
|
341
|
-
shorthand: 'string:100',
|
|
342
|
-
nullable: true,
|
|
343
|
-
purpose: 'User identifier (username, user_id, or composite token) of the record creator. Set by application layer on INSERT, not by database default.'
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
name: 'updated_at',
|
|
347
|
-
shorthand: 'timestamp autoUpdate',
|
|
348
|
-
nullable: true,
|
|
349
|
-
purpose: 'Last modification timestamp. autoUpdate is a marker constraint — the RESTForge generator injects updated_at = <native_now> into every UPDATE statement. Initial INSERT value is the application layer responsibility.'
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
name: 'updated_by',
|
|
353
|
-
shorthand: 'string:100',
|
|
354
|
-
nullable: true,
|
|
355
|
-
purpose: 'User identifier of the last modifier. Set by application layer on UPDATE, not by database default.'
|
|
356
|
-
}
|
|
357
|
-
],
|
|
358
|
-
convention: {
|
|
359
|
-
emitInSkeleton: 'Yes — dbschema:init emits all 4 columns by default. Tables that do not need audit (lookup tables, system tables) can manually remove these fields from the generated skeleton.',
|
|
360
|
-
nullablePolicy: 'All 4 columns are nullable. The created_by/updated_by columns may be empty for rows inserted by system seeds, migrations, or batch imports that do not have a user context.',
|
|
361
|
-
relationToRdf: 'The RDF generator (codegen_create_endpoint) assumes these 4 columns exist when the payload.auditColumns key is absent. See field-validation:catalog auditColumns for the RDF-side behavior. Drift between SDF (missing audit columns) and RDF (assumes audit columns) causes runtime errors when the generated endpoint tries to write created_by/updated_by to a non-existent column.'
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// ============================================================================
|
|
366
|
-
// SHORTHAND SYNTAX
|
|
367
|
-
// Source: lib/dbschema-kit/parser/shorthand-parser.js
|
|
368
|
-
// ============================================================================
|
|
369
|
-
|
|
370
|
-
const SHORTHAND_SYNTAX = {
|
|
371
|
-
format: '<type>[:<modifier>] [<constraint>[:<value>]]...',
|
|
372
|
-
description: 'String shorthand for field definition. Type required at start, followed by optional modifier and space-separated constraints.',
|
|
373
|
-
rules: [
|
|
374
|
-
'Type is mandatory at the beginning and must be one of fieldTypes.',
|
|
375
|
-
'Modifier is mandatory for type "string" (length) and "decimal" (precision,scale).',
|
|
376
|
-
'Standalone constraints (pk, notnull, unique, index, autoUpdate) take no value. autoUpdate is pre-processed in ir-builder before parser tokenization.',
|
|
377
|
-
'Value constraints (default, fk) require constraint:value format.',
|
|
378
|
-
'Default value format depends on type: raw for boolean (default:true), raw for integer (default:0), single-quoted for string (default:\'value\'), bare identifier for SQL constants (default:current_date), identifier() for native function calls (default:now()).',
|
|
379
|
-
'Foreign key uses dot notation: fk:<table>.<column> (e.g., fk:category.id). The parser rejects parentheses syntax.'
|
|
380
|
-
],
|
|
381
|
-
examples: [
|
|
382
|
-
{ input: 'string:36 pk', meaning: 'VARCHAR(36) PRIMARY KEY' },
|
|
383
|
-
{ input: 'string:255 notnull', meaning: 'VARCHAR(255) NOT NULL' },
|
|
384
|
-
{ input: 'decimal:15,2 notnull default:0', meaning: 'DECIMAL(15,2) NOT NULL DEFAULT 0' },
|
|
385
|
-
{ input: 'boolean default:true', meaning: 'BOOLEAN DEFAULT TRUE' },
|
|
386
|
-
{ input: "string:100 default:'pending'", meaning: "VARCHAR(100) DEFAULT 'pending'" },
|
|
387
|
-
{ input: 'timestamp default:now()', meaning: 'TIMESTAMP DEFAULT <native_now per dialect>' },
|
|
388
|
-
{ input: 'timestamp autoUpdate', meaning: 'TIMESTAMP (generator injects = <native_now> on UPDATE)' },
|
|
389
|
-
{ input: 'string:36 fk:category.id', meaning: 'VARCHAR(36) with FK to category(id), auto belongsTo relation' },
|
|
390
|
-
{ input: 'string:64 index', meaning: 'VARCHAR(64) with single-column index' }
|
|
391
|
-
]
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
// ============================================================================
|
|
395
|
-
// NAMING RULES
|
|
396
|
-
// Source: lib/dbschema-kit/naming.js, validator/schema-validator.js
|
|
397
|
-
// ============================================================================
|
|
398
|
-
|
|
399
|
-
const NAMING_RULES = {
|
|
400
|
-
tableName: {
|
|
401
|
-
format: 'snake_case',
|
|
402
|
-
description: 'Table name must be lowercase, digits, and underscores only.'
|
|
403
|
-
},
|
|
404
|
-
fieldName: {
|
|
405
|
-
format: 'snake_case',
|
|
406
|
-
description: 'Column name must be snake_case.'
|
|
407
|
-
},
|
|
408
|
-
constraintName: {
|
|
409
|
-
format: '<prefix>_<table>_<suffix>',
|
|
410
|
-
defaultMaxLength: 30,
|
|
411
|
-
fallbackStrategy: 'MD5 hash 8-character suffix when name exceeds maxLength',
|
|
412
|
-
description: 'Constraint names auto-generated with type-specific prefix (pk, fk, idx, uq, ck) and dialect-specific max length.'
|
|
413
|
-
},
|
|
414
|
-
compositeShortName: {
|
|
415
|
-
description: 'For composite indexes/uniques, name is derived by joining columns with underscore and truncating when needed.'
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
// ============================================================================
|
|
420
|
-
// DIALECT SUPPORT
|
|
421
|
-
// Source: lib/dbschema-kit/dialect/{postgres,mysql,oracle,sqlite}.js
|
|
422
|
-
// ============================================================================
|
|
423
|
-
|
|
424
|
-
const DIALECT_SUPPORT = [
|
|
425
|
-
{
|
|
426
|
-
name: 'postgres',
|
|
427
|
-
driver: 'pg',
|
|
428
|
-
booleanStorage: 'native BOOLEAN'
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
name: 'mysql',
|
|
432
|
-
driver: 'mysql2',
|
|
433
|
-
booleanStorage: 'VARCHAR (literal "true"/"false")'
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
name: 'oracle',
|
|
437
|
-
driver: 'oracledb',
|
|
438
|
-
booleanStorage: 'VARCHAR2 with CHECK constraint'
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
name: 'sqlite',
|
|
442
|
-
driver: 'better-sqlite3',
|
|
443
|
-
booleanStorage: 'TEXT'
|
|
444
|
-
}
|
|
445
|
-
];
|
|
446
|
-
|
|
447
|
-
// ============================================================================
|
|
448
|
-
// EXPORT
|
|
449
|
-
// ============================================================================
|
|
450
|
-
|
|
451
|
-
const DBSCHEMA_CATALOG = {
|
|
452
|
-
schemaVersion: SCHEMA_VERSION,
|
|
453
|
-
source: SOURCE,
|
|
454
|
-
summary: {
|
|
455
|
-
totalDefineModelOptions: DEFINE_MODEL_OPTIONS.length,
|
|
456
|
-
totalFieldTypes: FIELD_TYPES.length,
|
|
457
|
-
totalConstraints: CONSTRAINTS.length,
|
|
458
|
-
totalRelationTypes: RELATION_TYPES.length,
|
|
459
|
-
totalReferentialActions: REFERENTIAL_ACTIONS.length,
|
|
460
|
-
totalCheckOperations: CHECK_OPERATIONS.length,
|
|
461
|
-
totalAuditColumns: AUDIT_COLUMNS.columns.length,
|
|
462
|
-
totalDialects: DIALECT_SUPPORT.length
|
|
463
|
-
},
|
|
464
|
-
defineModelOptions: DEFINE_MODEL_OPTIONS,
|
|
465
|
-
fieldTypes: FIELD_TYPES,
|
|
466
|
-
constraints: CONSTRAINTS,
|
|
467
|
-
relationTypes: RELATION_TYPES,
|
|
468
|
-
referentialActions: REFERENTIAL_ACTIONS,
|
|
469
|
-
checkOperations: CHECK_OPERATIONS,
|
|
470
|
-
auditColumns: AUDIT_COLUMNS,
|
|
471
|
-
shorthandSyntax: SHORTHAND_SYNTAX,
|
|
472
|
-
namingRules: NAMING_RULES,
|
|
473
|
-
dialectSupport: DIALECT_SUPPORT,
|
|
474
|
-
documentationUrl: DOCUMENTATION_URL
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
module.exports = {
|
|
478
|
-
DBSCHEMA_CATALOG,
|
|
479
|
-
DEFINE_MODEL_OPTIONS,
|
|
480
|
-
FIELD_TYPES,
|
|
481
|
-
CONSTRAINTS,
|
|
482
|
-
RELATION_TYPES,
|
|
483
|
-
REFERENTIAL_ACTIONS,
|
|
484
|
-
CHECK_OPERATIONS,
|
|
485
|
-
AUDIT_COLUMNS,
|
|
486
|
-
SHORTHAND_SYNTAX,
|
|
487
|
-
NAMING_RULES,
|
|
488
|
-
DIALECT_SUPPORT
|
|
489
|
-
};
|
|
1
|
+
'use strict';function a0_0x4142(_0x283d5b,_0x1e7f34){_0x283d5b=_0x283d5b-0x1d5;const _0x2048e8=a0_0x2048();let _0x414206=_0x2048e8[_0x283d5b];if(a0_0x4142['iFpwGZ']===undefined){var _0x14b98f=function(_0x580ebd){const _0x47cf31='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x439ffb='',_0x58fdd8='';for(let _0x326ef3=0x0,_0x23582b,_0x3b8ffe,_0x509933=0x0;_0x3b8ffe=_0x580ebd['charAt'](_0x509933++);~_0x3b8ffe&&(_0x23582b=_0x326ef3%0x4?_0x23582b*0x40+_0x3b8ffe:_0x3b8ffe,_0x326ef3++%0x4)?_0x439ffb+=String['fromCharCode'](0xff&_0x23582b>>(-0x2*_0x326ef3&0x6)):0x0){_0x3b8ffe=_0x47cf31['indexOf'](_0x3b8ffe);}for(let _0x3b29dc=0x0,_0x571d07=_0x439ffb['length'];_0x3b29dc<_0x571d07;_0x3b29dc++){_0x58fdd8+='%'+('00'+_0x439ffb['charCodeAt'](_0x3b29dc)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x58fdd8);};a0_0x4142['Mbkjar']=_0x14b98f,a0_0x4142['vhKQba']={},a0_0x4142['iFpwGZ']=!![];}const _0x15fa02=_0x2048e8[0x0],_0x5126d5=_0x283d5b+_0x15fa02,_0x412bfb=a0_0x4142['vhKQba'][_0x5126d5];return!_0x412bfb?(_0x414206=a0_0x4142['Mbkjar'](_0x414206),a0_0x4142['vhKQba'][_0x5126d5]=_0x414206):_0x414206=_0x412bfb,_0x414206;}const a0_0xb18477=a0_0x4142;function a0_0x2048(){const _0x146c8c=['rgf0zsbHBMqGDgLTzsaOveLnrvnuqu1qks4','ouXIsKnTqW','qM9VBgvHBIb2ywX1zsaOBMf0AxzLiejpt0Xfqu4GB24Gug9ZDgDYzvnrtcWGvKfsq0HbuIbVBIbVDgHLCNmPlG','zgvJAw1HBdOXnsWYig5VDg51BgWGzgvMyxvSDdOW','zgvMyxvSDdO8BgL0zxjHBd4GFcbKzwzHDwX0oIC8C3rYAw5NpICGFcbKzwzHDwX0oJXJB25ZDgfUDd4GFcbKzwzHDwX0oJXMDw5JDgLVBJ4Okq','C3rHBMrHBg9Uzq','wwvZiokaLcbKyNnJAgvTytPPBML0igvTAxrZigfSBca0ignVBhvTBNmGyNKGzgvMyxvSDc4GvgfIBgvZihrOyxqGzg8GBM90ig5LzwqGyxvKAxqGkgXVB2T1Ccb0ywjSzxmSihn5C3rLBsb0ywjSzxmPignHBIbTyw51ywXSEsbYzw1VDMuGDgHLC2uGzMLLBgrZigzYB20GDgHLigDLBMvYyxrLzcbZA2vSzxrVBI4','uMvJB3jKignYzwf0Aw9UihrPBwvZDgfTCc4Gqxv0BY1ZzxqGB24Gsu5trvjuihzPysberuzbvuXuig5VDYGPlIboyxrPDMuGzNvUy3rPB24GDhjHBNnSyxrLCYbWzxiGzgLHBgvJDcaOCg9ZDgDYzxm6ienvuLjftLrFveLnrvnuqu1qlcbTExnXBdOGtK9xkcKSig9YywnSztOGu1LtveLnrvnuqu1qlcbZCwXPDgu6ienvuLjftLrFveLnrvnuqu1qks4','mJu4D1Dgwfbc','EYbMAwvSzdOGiMrPC2nVDw50iIWGBhq6ideWmcb9','vevyva','B25vCgrHDgu','t2jQzwn0ig9MigzPzwXKigrLzMLUAxrPB25ZigLUihnOB3j0AgfUzcbZDhjPBMCGzM9YBwf0lG','y2HLy2TZ','rgvMyxvSDcb0Aw1LEM9UzsbIzwHHDMLVCIbPCYbKAwfSzwn0lxnWzwnPzMLJlG','revquKvdqvrfrdOGvgHPCYbTB2rPzMLLCIbUBYbSB25NzxiGAgfZigz1BMn0Aw9UywWGzwzMzwn0igf0ihrOzsbereWGB3iGCNvUDgLTzsbSzxzLBc4Gqxv0BY11CgrHDguGzM9YihvWzgf0zwrFyxqGAxmGAgfUzgXLzcbIEsb0AguGuKrgigXHEwvYicHHDwrPDenVBhvTBNmGy29UDMvUDgLVBIbPBIbcyxnLtw9KzwWGCNvUDgLTzsKGyMfZzwqGB24GzMLLBgqGBMfTAw5NignVBNzLBNrPB24Sig5VDcbIEsb0AgLZifnerIbTyxjRzxiUiev4Axn0Aw5NihvZywDLigLZihbYzxnLCNzLzcbMB3iGyMfJA3DHCMqGy29TCgf0AwjPBgL0EsbIDxqGC2HVDwXKigjLihjLBw92zwqGzNjVBsbUzxCGDgvTCgXHDgvZlG','C3rYAw5NoJm2igzRoMnHDgvNB3j5lMLK','rgvMyxvSDcb2ywX1zs4Gu2LUz2XLlxf1B3rLzcbMB3iGC3rYAw5NCYWGCMf3igzVCIbUDw1LCMLJl2jVB2XLyw4SigjHCMuGAwrLBNrPzMLLCIbMB3iGu1fmignVBNn0yw50CYWGAwrLBNrPzMLLCIGPigzVCIbUyxrPDMuGzNvUy3rPB24Gy2fSBhmU','EYb0ExbLoIaIAgfZtwfUEsiSihrHCMDLDdOGiM9YzgvYx2L0zw0IlcbSB2nHBeTLEtOGiM9YzgvYx2LKiIWGCMvMzxjLBMnLCZOGiM9YzgvYx2LKiIb9','vMfSDwuGBxvZDcbIzsbVBMuGB2yGysbSAxn0lG','rgvMzxiGy29UC3rYywLUDcbJAgvJAYaOC2vTyw50AwnHBgX5ihnPBwLSyxiGDg8GCMvZDhjPy3qGB24GBw9ZDcbKAwfSzwn0CYKU','uMvQzwn0igrLBgv0zs91CgrHDguGD2HLBIbJAgLSzcbYB3DZigv4Axn0lG','tK9uie5vteWGy29UC3rYywLUDc4','C3rYAw5NoJmYihvUAxf1zq','yxv0B1vWzgf0zq','C3rYAw5NoJy0igLUzgv4','tM90igvXDwfSihrVlG','veLnrvnuqu1qierfrKfvtfqGpg5HDgL2zv9UB3CGCgvYigrPywXLy3q+','u3rHBMrHBg9UzsbJB25ZDhjHAw50CYaOCgSSig5VDg51BgWSihvUAxf1zsWGAw5KzxGPihrHA2uGBM8GDMfSDwuUifrOzsbSzwDHy3KGyxv0B1vWzgf0zsb0B2TLBIbPCYbZDgLSBcbWyxjZzwqGzM9YigjHy2T3yxjKignVBxbHDgLIAwXPDhKGyNv0igLZigrLChjLy2f0zwqGyw5KigHHCYbUBYbMDw5JDgLVBMfSigvMzMvJDc4','DgLTzxn0yw1W','mJHXsLHRA0m','DgLTzxn0yw1WigrLzMf1Bhq6BM93kcK','BhrL','rgf0ywjHC2uGC2nOzw1Hig5HBwvZCgfJzsaOBxvSDgKTC2nOzw1HigrHDgfIyxnLks4','twfYA3mGzMLLBgqGyxmGChjPBwfYEsbRzxKU','q29UC3rYywLUDcbUyw1LCYbHDxrVlwDLBMvYyxrLzcb3AxrOihr5CguTC3bLy2LMAwmGChjLzML4icHWAYWGzMSSigLKEcWGDxeSignRksbHBMqGzgLHBgvJDc1ZCgvJAwzPyYbTyxGGBgvUz3rOlG','nJqTyML0ihnPz25LzcbPBNrLz2vYicHcsuDjtLqPlG','EYbPzdOGiNn0CMLUzZOZnIbWAYiSig5HBwu6icjZDhjPBMC6mJu1ig5VDg51BgWIih0','Dw5PCxvLCW','tuq1igHHC2GGoc1JAgfYywn0zxiGC3vMzML4ihDOzw4GBMfTzsbLEgnLzwrZig1HEeXLBMD0Aa','B25ezwXLDgu','otKXnhvNqNjuyW','Ahr0Chm6lY9Yzxn0zM9Yz2uUzgv2l2rVy3mVy2XPl3nJAgvTys1KzwzPBML0Aw9U','nZeZmZe0n1Lou2H2AW','C3rYAw5NoJeWmcbKzwzHDwX0oIDWzw5KAw5NjW','phr5Cgu+wZO8Bw9KAwzPzxi+xsbBpgnVBNn0CMfPBNq+wZO8DMfSDwu+xv0UlI4','mtK4ntuXmZbQqMLduvy','mJCZmde1Du9qywPk','Bg9JywXlzxK','C3rYAw5NoJeWma','rM9YignVBxbVC2L0zsbPBMrLEgvZl3vUAxf1zxmSig5HBwuGAxmGzgvYAxzLzcbIEsbQB2LUAw5NignVBhvTBNmGD2L0Acb1BMrLCNnJB3jLigfUzcb0CNvUy2f0Aw5NihDOzw4GBMvLzgvKlG','DhLWzq','t25LlxrVlw9UzsaOAw52zxjZzsbVzIbIzwXVBMDZvg8PlIbpChrPB25HBcbPBNzLCNnLigrLy2XHCMf0Aw9Uig9UihrOzsbWyxjLBNqGC2LKztSGzg9LCYbUB3qGywzMzwn0ieretc4','zxHWB3j0CW','tgvZCYb0AgfUig9YigvXDwfSihrVlG','EYbJyxrLz29YEtOGEYb0ExbLoIaIyMvSB25NC1rViIWGCMvMzxjLBMnLCZOGiMnHDgvNB3j5kgLKksiGFsb9','DxbKyxrLzf9HDa','y3jLyxrLzf9HDa','rKSGzMLLBgqGBxvZDcbIzsbUDwXSywjSzs4','rgf0zsbVBMX5icHUBYb0Aw1LignVBxbVBMvUDcKU','B2jQzwn0','zgvJAw1HBdOXnsWY','zMS6phrHyMXLpI48y29SDw1UpG','rM9YzwLNBIbRzxKGDxnLCYbKB3qGBM90yxrPB246igzRoJX0ywjSzt4UpgnVBhvTBJ4GkguUzY4SigzRoMnHDgvNB3j5lMLKks4GvgHLihbHCNnLCIbYzwPLy3rZihbHCMvUDgHLC2vZihn5BNrHEc4','BxLZCwWY','r3jLyxrLCIb0AgfUig9YigvXDwfSihrVlG','vKfsq0HbuIG2ncKGD2L0AcbZAw5NBguTy29SDw1UigLUzgv4','mJiWntK5mhzguML1DG','DMfSDwu','vMfSDwuGy29UC3rYywLUDhmGkgrLzMf1BhqSigzRksbYzxf1AxjLignVBNn0CMfPBNq6DMfSDwuGzM9YBwf0lG','mJG0mJq5nLHwCu5uCa','yhjLzMvYzw5JzxnGigLZihrOzsbIyxjLignVBhvTBIbUyw1LigLUihrOzsb0yxjNzxqGDgfIBguUifrHCMDLDcb0ywjSzsbPCYbHDxrVlwrLCML2zwqGzNjVBsb0AguGCMvSyxrPB24GA2v5ig5HBwuSig9Yig92zxjYAwrLihDPDgGGyhrHCMDLDgaU','DgfYz2v0','yxjYyxK','qxv0BY1KzxrLy3rLzcbMCM9TigzPzwXKihnOB3j0AgfUzcaICgSIihDOzw4GBM90ihnWzwnPzMLLzc4','vKfsq0HbuIGZnIKGufjjtufswsblrvK','uhjLy2LZAw9UigfUzcbZy2fSzsbYzxf1AxjLzcbMB3iGy3jVC3mTzgLHBgvJDcbWB3j0ywjPBgL0Es4','yMLNAw50','EYb0ExbLoIaIyMvSB25NC1rViIWGBg9JywXlzxK6icjJyxrLz29YEv9PzciSihjLzMvYzw5Jzxm6icjJyxrLz29YEv9PzciSig9UrgvSzxrLoIaICMvZDhjPy3qIih0','Dgv4Da','yM9VBgvHBIbKzwzHDwX0oNrYDwu','Aw50zwDLCG','u3rYAw5NihnOB3j0AgfUzcbMB3iGzMLLBgqGzgvMAw5PDgLVBI4GvhLWzsbYzxf1AxjLzcbHDcbZDgfYDcWGzM9SBg93zwqGyNKGB3b0Aw9UywWGBw9KAwzPzxiGyw5KihnWywnLlxnLCgfYyxrLzcbJB25ZDhjHAw50CY4','vKfsq0HbuIGXmdaPierfrKfvtfqGj3bLBMrPBMCN','EYbMAwvSzdOGiNf0EsiSigD0ztOGmcb9','BM9by3rPB24','y3jLyxrLzf9IEq','C2v0tNvSBa','vKfsq0HbuJiGD2L0AcbdsevdsYbJB25ZDhjHAw50','u2LUz2XLlwnVBhvTBIb1BMLXDwuGy29UC3rYywLUDc4','qK9ptevbtIberuzbvuXuifrsvuu','BxLZCwW','ChjPBwfYEuTLEq','BgvUz3rO','vvvjrc4GtMf0AxzLifvvsuqGB24Gug9ZDgDYzvnrtcWGvKfsq0HbuIGZnIKGB24GB3rOzxjZlG','EYbMAwvSzdOGiMrPC2nVDw50iIWGBhrLoIaXmdaGFq','tM9UlxvUAxf1zsbPBMrLEgvZlIbfywnOigvUDhj5igLZigfYCMf5ig9MignVBhvTBIbUyw1LCYbVCIbVyMPLy3qGEYbUyw1LlcbJB2X1Bw5Zih0U','C2nOzw1H','mJu0otC5q0TstwfV','DxbKyxrLzf9IEq','mZiTyML0ihnPz25LzcbPBNrLz2vYicHjtLqVsu5uruDfuIKU','CMvMzxjLBMnLCW'];a0_0x2048=function(){return _0x146c8c;};return a0_0x2048();}(function(_0x33cbc2,_0x27e63e){const _0x354ab6=a0_0x4142,_0x24b695=_0x33cbc2();while(!![]){try{const _0x12f86c=-parseInt(_0x354ab6(0x1f0))/0x1*(-parseInt(_0x354ab6(0x211))/0x2)+parseInt(_0x354ab6(0x1e4))/0x3+parseInt(_0x354ab6(0x206))/0x4*(-parseInt(_0x354ab6(0x217))/0x5)+parseInt(_0x354ab6(0x22b))/0x6+parseInt(_0x354ab6(0x213))/0x7+parseInt(_0x354ab6(0x22e))/0x8+-parseInt(_0x354ab6(0x1e9))/0x9*(parseInt(_0x354ab6(0x216))/0xa);if(_0x12f86c===_0x27e63e)break;else _0x24b695['push'](_0x24b695['shift']());}catch(_0x7f8d39){_0x24b695['push'](_0x24b695['shift']());}}}(a0_0x2048,0xb4373));const SCHEMA_VERSION='1.0',SOURCE='dbschema-catalog',DOCUMENTATION_URL=a0_0xb18477(0x212),DEFINE_MODEL_OPTIONS=[{'name':a0_0xb18477(0x1e3),'required':![],'type':'string|null','description':a0_0xb18477(0x209),'notes':'null\x20or\x20empty\x20string\x20means\x20default\x20schema.'},{'name':'fields','required':!![],'type':a0_0xb18477(0x224),'description':a0_0xb18477(0x1f4),'example':a0_0xb18477(0x20d)},{'name':a0_0xb18477(0x1de),'required':![],'type':'string|array','description':'Override\x20primary\x20key.\x20Single\x20field\x20name\x20or\x20composite\x20array.','notes':a0_0xb18477(0x232)},{'name':'relations','required':![],'type':'object','description':'Inter-table\x20relations\x20(belongsTo,\x20hasOne,\x20hasMany).','example':a0_0xb18477(0x21f)},{'name':'indexes','required':![],'type':'array','description':a0_0xb18477(0x1e2),'example':'[[\x22status\x22,\x20\x22created_at\x22]]'},{'name':a0_0xb18477(0x20e),'required':![],'type':'array','description':'Unique\x20constraints\x20(single\x20or\x20composite).','example':'[[\x22category_code\x22],\x20[\x22tenant_id\x22,\x20\x22category_code\x22]]'},{'name':a0_0xb18477(0x1f5),'required':![],'type':'array','description':'CHECK\x20constraints.\x20Each\x20entry\x20uses\x20operator-as-key\x20shape:\x20{\x20name?,\x20field,\x20<operator>:\x20<value>\x20}\x20where\x20<operator>\x20is\x20one\x20of\x20checkOperations\x20(in,\x20eq,\x20neq,\x20gt,\x20gte,\x20lt,\x20lte).\x20The\x20internal\x20IR\x20shape\x20after\x20ir-builder\x20normalization\x20is\x20{\x20name?,\x20field,\x20op,\x20value\x20},\x20but\x20that\x20is\x20NOT\x20the\x20user\x20input\x20format.','example':'[{\x20field:\x20\x22status\x22,\x20in:\x20[\x22active\x22,\x20\x22inactive\x22]\x20},\x20{\x20field:\x20\x22qty\x22,\x20gte:\x200\x20}]'}],FIELD_TYPES=[{'name':'string','description':'Variable-length\x20text.\x20Length\x20modifier\x20required.','requiresModifier':!![],'modifierFormat':'string:<length>','example':'string:255','notes':'Explicit\x20length\x20required\x20for\x20cross-dialect\x20portability.'},{'name':a0_0xb18477(0x237),'description':'Long-form\x20text\x20without\x20length\x20limit\x20(TEXT/CLOB).','requiresModifier':![],'example':a0_0xb18477(0x237)},{'name':a0_0xb18477(0x239),'description':a0_0xb18477(0x1e6),'requiresModifier':![],'example':'integer'},{'name':'bigint','description':a0_0xb18477(0x20c),'requiresModifier':![],'example':a0_0xb18477(0x235)},{'name':'decimal','description':'Fixed-point\x20decimal.\x20Precision\x20and\x20scale\x20required.','requiresModifier':!![],'modifierFormat':'decimal:<precision>,<scale>','example':a0_0xb18477(0x225),'notes':a0_0xb18477(0x234)},{'name':'boolean','description':a0_0xb18477(0x1ea),'requiresModifier':![],'example':'boolean'},{'name':'date','description':a0_0xb18477(0x223),'requiresModifier':![],'example':'date'},{'name':'timestamp','description':a0_0xb18477(0x1e8),'requiresModifier':![],'example':'timestamp','notes':a0_0xb18477(0x1f6)},{'name':'uuid','description':a0_0xb18477(0x1e0),'requiresModifier':![],'example':'uuid'},{'name':'json','description':'JSON\x20column\x20(JSONB\x20on\x20PostgreSQL,\x20JSON\x20on\x20MySQL,\x20CLOB\x20on\x20Oracle).','requiresModifier':![],'example':'json'}],CONSTRAINTS=[{'name':'pk','kind':a0_0xb18477(0x1ed),'description':a0_0xb18477(0x20a),'example':'string:36\x20pk'},{'name':'notnull','kind':'standalone','description':a0_0xb18477(0x1fe),'example':'string:255\x20notnull'},{'name':'unique','kind':'standalone','description':a0_0xb18477(0x1db),'example':a0_0xb18477(0x1ff)},{'name':'index','kind':a0_0xb18477(0x1ed),'description':'Single-column\x20non-unique\x20index.','example':'string:64\x20index'},{'name':a0_0xb18477(0x200),'kind':a0_0xb18477(0x1ed),'deprecated':!![],'description':a0_0xb18477(0x1f7),'example':'timestamp','notes':'Engine\x20still\x20parses\x20this\x20token\x20(backward\x20compatibility),\x20but\x20DDL\x20output\x20is\x20identical\x20to\x20plain\x20\x27timestamp\x27.\x20Use\x20\x27timestamp\x27\x20alone.\x20The\x20actual\x20auto-update\x20behavior\x20is\x20documented\x20in\x20the\x20RDF\x20auditColumns\x20catalog\x20(field-validation:catalog).'},{'name':'default','kind':a0_0xb18477(0x22c),'description':a0_0xb18477(0x1f9),'valueFormat':a0_0xb18477(0x1ec),'example':a0_0xb18477(0x238)},{'name':'fk','kind':'value','description':'Foreign\x20key\x20reference.\x20Auto-generates\x20a\x20belongsTo\x20relation\x20entry.','valueFormat':a0_0xb18477(0x226),'example':'string:36\x20fk:category.id','notes':'Cannot\x20coexist\x20with\x20explicit\x20relation\x20entry\x20referencing\x20the\x20same\x20field.'}],RELATION_TYPES=[{'name':'belongsTo','description':'Many-to-one.\x20This\x20table\x20holds\x20the\x20FK\x20column\x20referencing\x20the\x20parent\x20table.','requiredFields':[a0_0xb18477(0x21b),'localKey',a0_0xb18477(0x1e7)],'optionalFields':[a0_0xb18477(0x230),a0_0xb18477(0x210),a0_0xb18477(0x1f3)],'example':a0_0xb18477(0x236),'notes':a0_0xb18477(0x22f)},{'name':'hasOne','description':a0_0xb18477(0x21c),'requiredFields':['type','localKey',a0_0xb18477(0x1e7)],'optionalFields':[a0_0xb18477(0x230),'onDelete','onUpdate'],'example':'{\x20type:\x20\x22hasOne\x22,\x20target:\x20\x22profile\x22,\x20localKey:\x20\x22user_id\x22,\x20references:\x20\x22user_id\x22\x20}'},{'name':'hasMany','description':'One-to-many\x20(inverse\x20of\x20belongsTo).\x20Optional\x20inverse\x20declaration\x20on\x20the\x20parent\x20side;\x20does\x20not\x20affect\x20DDL.','requiredFields':[a0_0xb18477(0x21b),a0_0xb18477(0x218),a0_0xb18477(0x1e7)],'optionalFields':[a0_0xb18477(0x230),a0_0xb18477(0x210),a0_0xb18477(0x1f3)],'example':a0_0xb18477(0x1fa)}],REFERENTIAL_ACTIONS=[{'name':'cascade','description':'Cascade\x20delete/update\x20to\x20child\x20rows.','appliesTo':[a0_0xb18477(0x210),'onUpdate']},{'name':'restrict','description':a0_0xb18477(0x1fd),'appliesTo':['onDelete','onUpdate']},{'name':a0_0xb18477(0x1d9),'description':'Set\x20FK\x20column\x20to\x20NULL\x20on\x20child\x20rows.','appliesTo':[a0_0xb18477(0x210),a0_0xb18477(0x1f3)],'notes':a0_0xb18477(0x222)},{'name':a0_0xb18477(0x1d7),'description':a0_0xb18477(0x1fc),'appliesTo':['onDelete','onUpdate']}],CHECK_OPERATIONS=[{'name':'in','description':a0_0xb18477(0x1fb),'valueType':a0_0xb18477(0x231),'example':'{\x20field:\x20\x22status\x22,\x20in:\x20[\x22active\x22,\x20\x22inactive\x22]\x20}'},{'name':'eq','description':'Equal\x20to.','valueType':'scalar','example':'{\x20field:\x20\x22type\x22,\x20eq:\x20\x22user\x22\x20}'},{'name':'neq','description':a0_0xb18477(0x202),'valueType':'scalar','example':'{\x20field:\x20\x22type\x22,\x20neq:\x20\x22system\x22\x20}'},{'name':'gt','description':'Greater\x20than.','valueType':'numeric','example':'{\x20field:\x20\x22qty\x22,\x20gt:\x200\x20}'},{'name':'gte','description':a0_0xb18477(0x229),'valueType':'numeric','example':a0_0xb18477(0x1d6)},{'name':'lt','description':'Less\x20than.','valueType':'numeric','example':a0_0xb18477(0x1f1)},{'name':a0_0xb18477(0x208),'description':a0_0xb18477(0x21e),'valueType':'numeric','example':a0_0xb18477(0x1e1)}],AUDIT_COLUMNS={'description':'Standard\x204-column\x20audit\x20convention\x20for\x20tables\x20managed\x20by\x20RESTForge.\x20The\x20same\x20convention\x20is\x20documented\x20in\x20field-validation:catalog\x20(auditColumns\x20section)\x20for\x20the\x20RDF/backend\x20layer.\x20SDF\x20and\x20RDF\x20stay\x20aligned\x20when\x20both\x20declare\x20these\x204\x20columns.','columns':[{'name':a0_0xb18477(0x221),'shorthand':a0_0xb18477(0x207),'nullable':!![],'purpose':a0_0xb18477(0x1ef)},{'name':a0_0xb18477(0x1d8),'shorthand':a0_0xb18477(0x219),'nullable':!![],'purpose':'User\x20identifier\x20(username,\x20user_id,\x20or\x20composite\x20token)\x20of\x20the\x20record\x20creator.\x20Set\x20by\x20application\x20layer\x20on\x20INSERT,\x20not\x20by\x20database\x20default.'},{'name':a0_0xb18477(0x220),'shorthand':a0_0xb18477(0x205),'nullable':!![],'purpose':'Last\x20modification\x20timestamp.\x20Auto-update\x20is\x20handled\x20by\x20the\x20RDF\x20runtime\x20(BaseModel\x20auditColumns\x20convention)\x20which\x20injects\x20updated_at\x20=\x20CURRENT_TIMESTAMP\x20into\x20every\x20UPDATE\x20statement\x20based\x20on\x20field\x20naming,\x20not\x20by\x20any\x20SDF\x20marker.\x20Initial\x20INSERT\x20value\x20is\x20also\x20handled\x20by\x20the\x20RDF\x20runtime\x20auditColumns\x20helper.'},{'name':a0_0xb18477(0x1e5),'shorthand':'string:100','nullable':!![],'purpose':'User\x20identifier\x20of\x20the\x20last\x20modifier.\x20Set\x20by\x20application\x20layer\x20on\x20UPDATE,\x20not\x20by\x20database\x20default.'}],'convention':{'emitInSkeleton':a0_0xb18477(0x1ee),'nullablePolicy':'All\x204\x20columns\x20are\x20nullable.\x20The\x20created_by/updated_by\x20columns\x20may\x20be\x20empty\x20for\x20rows\x20inserted\x20by\x20system\x20seeds,\x20migrations,\x20or\x20batch\x20imports\x20that\x20do\x20not\x20have\x20a\x20user\x20context.','relationToRdf':'The\x20RDF\x20generator\x20(codegen_create_endpoint)\x20assumes\x20these\x204\x20columns\x20exist\x20when\x20the\x20payload.auditColumns\x20key\x20is\x20absent.\x20See\x20field-validation:catalog\x20auditColumns\x20for\x20the\x20RDF-side\x20behavior.\x20Drift\x20between\x20SDF\x20(missing\x20audit\x20columns)\x20and\x20RDF\x20(assumes\x20audit\x20columns)\x20causes\x20runtime\x20errors\x20when\x20the\x20generated\x20endpoint\x20tries\x20to\x20write\x20created_by/updated_by\x20to\x20a\x20non-existent\x20column.'}},SHORTHAND_SYNTAX={'format':a0_0xb18477(0x215),'description':a0_0xb18477(0x23a),'rules':['Type\x20is\x20mandatory\x20at\x20the\x20beginning\x20and\x20must\x20be\x20one\x20of\x20fieldTypes.','Modifier\x20is\x20mandatory\x20for\x20type\x20\x22string\x22\x20(length)\x20and\x20\x22decimal\x22\x20(precision,scale).',a0_0xb18477(0x204),a0_0xb18477(0x22d),'Default\x20value\x20format\x20depends\x20on\x20type:\x20raw\x20for\x20boolean\x20(default:true),\x20raw\x20for\x20integer\x20(default:0),\x20single-quoted\x20for\x20string\x20(default:\x27value\x27),\x20bare\x20identifier\x20for\x20SQL\x20constants\x20(default:current_date),\x20identifier()\x20for\x20native\x20function\x20calls\x20(default:now()).',a0_0xb18477(0x227)],'examples':[{'input':'string:36\x20pk','meaning':a0_0xb18477(0x233)},{'input':'string:255\x20notnull','meaning':'VARCHAR(255)\x20NOT\x20NULL'},{'input':a0_0xb18477(0x1eb),'meaning':'DECIMAL(15,2)\x20NOT\x20NULL\x20DEFAULT\x200'},{'input':a0_0xb18477(0x238),'meaning':a0_0xb18477(0x1dc)},{'input':a0_0xb18477(0x214),'meaning':a0_0xb18477(0x1d5)},{'input':a0_0xb18477(0x207),'meaning':a0_0xb18477(0x203)},{'input':a0_0xb18477(0x1f8),'meaning':'VARCHAR(36)\x20with\x20FK\x20to\x20category(id),\x20auto\x20belongsTo\x20relation'},{'input':a0_0xb18477(0x201),'meaning':a0_0xb18477(0x22a)}]},NAMING_RULES={'tableName':{'format':'snake_case','description':'Table\x20name\x20must\x20be\x20lowercase,\x20digits,\x20and\x20underscores\x20only.'},'fieldName':{'format':'snake_case','description':'Column\x20name\x20must\x20be\x20snake_case.'},'constraintName':{'format':'<prefix>_<table>_<suffix>','defaultMaxLength':0x1e,'fallbackStrategy':a0_0xb18477(0x20f),'description':a0_0xb18477(0x20b)},'compositeShortName':{'description':a0_0xb18477(0x21a)}},DIALECT_SUPPORT=[{'name':'postgres','driver':'pg','booleanStorage':'native\x20BOOLEAN'},{'name':a0_0xb18477(0x1dd),'driver':a0_0xb18477(0x228),'booleanStorage':'VARCHAR\x20(literal\x20\x22true\x22/\x22false\x22)'},{'name':'oracle','driver':'oracledb','booleanStorage':a0_0xb18477(0x1da)},{'name':'sqlite','driver':'better-sqlite3','booleanStorage':a0_0xb18477(0x1f2)}],DBSCHEMA_CATALOG={'schemaVersion':SCHEMA_VERSION,'source':SOURCE,'summary':{'totalDefineModelOptions':DEFINE_MODEL_OPTIONS['length'],'totalFieldTypes':FIELD_TYPES['length'],'totalConstraints':CONSTRAINTS[a0_0xb18477(0x1df)],'totalRelationTypes':RELATION_TYPES[a0_0xb18477(0x1df)],'totalReferentialActions':REFERENTIAL_ACTIONS['length'],'totalCheckOperations':CHECK_OPERATIONS[a0_0xb18477(0x1df)],'totalAuditColumns':AUDIT_COLUMNS['columns'][a0_0xb18477(0x1df)],'totalDialects':DIALECT_SUPPORT['length']},'defineModelOptions':DEFINE_MODEL_OPTIONS,'fieldTypes':FIELD_TYPES,'constraints':CONSTRAINTS,'relationTypes':RELATION_TYPES,'referentialActions':REFERENTIAL_ACTIONS,'checkOperations':CHECK_OPERATIONS,'auditColumns':AUDIT_COLUMNS,'shorthandSyntax':SHORTHAND_SYNTAX,'namingRules':NAMING_RULES,'dialectSupport':DIALECT_SUPPORT,'documentationUrl':DOCUMENTATION_URL};module[a0_0xb18477(0x21d)]={'DBSCHEMA_CATALOG':DBSCHEMA_CATALOG,'DEFINE_MODEL_OPTIONS':DEFINE_MODEL_OPTIONS,'FIELD_TYPES':FIELD_TYPES,'CONSTRAINTS':CONSTRAINTS,'RELATION_TYPES':RELATION_TYPES,'REFERENTIAL_ACTIONS':REFERENTIAL_ACTIONS,'CHECK_OPERATIONS':CHECK_OPERATIONS,'AUDIT_COLUMNS':AUDIT_COLUMNS,'SHORTHAND_SYNTAX':SHORTHAND_SYNTAX,'NAMING_RULES':NAMING_RULES,'DIALECT_SUPPORT':DIALECT_SUPPORT};
|