@restforgejs/platform 4.1.1 → 4.3.1
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 +43 -4
- 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 +526 -0
- package/generators/cli/schema/describe.js +3 -2
- package/generators/cli/schema/diff.js +322 -0
- package/generators/cli/schema/generate-ddl.js +7 -10
- package/generators/cli/schema/init.js +95 -172
- package/generators/cli/schema/introspect.js +3 -2
- package/generators/cli/schema/list.js +3 -2
- package/generators/cli/schema/migrate.js +13 -18
- package/generators/cli/schema/models.js +8 -12
- package/generators/cli/schema/template.js +222 -0
- package/generators/cli/schema/validate.js +8 -12
- package/generators/cli-entry.js +17 -2
- package/generators/lib/dbschema-kit/apply-engine.js +582 -0
- package/generators/lib/dbschema-kit/diff-engine.js +703 -0
- package/generators/lib/dbschema-kit/diff-reporter.js +272 -0
- package/generators/lib/dbschema-kit/emitters/alter-table.js +275 -0
- package/generators/lib/migration/audit-table-runner.js +213 -215
- package/generators/lib/payload/endpoint-schema-validator.js +171 -0
- package/generators/lib/payload/payload-runner.js +137 -220
- package/generators/lib/payload/schema-diff.js +277 -0
- 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/audit-columns.js +181 -0
- package/generators/lib/utils/cli-output.js +17 -0
- package/generators/lib/utils/database-introspector.js +16 -13
- 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
|
@@ -22,8 +22,6 @@ const { splitStatements } = require('../../lib/dbschema-kit/statement-splitter')
|
|
|
22
22
|
const { applyIfNotExistsModifier } = require('../../lib/dbschema-kit/statement-modifier');
|
|
23
23
|
const { resolveConfig, printDefaultConfigWarning } = require('../../lib/utils/config-resolver');
|
|
24
24
|
|
|
25
|
-
const DEFAULT_PATH = './schema';
|
|
26
|
-
|
|
27
25
|
// Mapping dialect (internal naming di dbschema-kit) ke dbType (naming yang
|
|
28
26
|
// dipakai db-bootstrap helper). Hanya postgres dan mysql yang relevan untuk
|
|
29
27
|
// flow "create database if missing".
|
|
@@ -82,10 +80,16 @@ module.exports = {
|
|
|
82
80
|
description: 'Apply schema definition ke database (load → validate → generate DDL → execute). Destruktif.',
|
|
83
81
|
category: 'management',
|
|
84
82
|
flags: {
|
|
85
|
-
|
|
83
|
+
path: {
|
|
86
84
|
type: 'string',
|
|
87
85
|
required: true,
|
|
88
|
-
description: '
|
|
86
|
+
description: 'Path file atau folder schema (mis. ./schema atau ./schema/users.js)'
|
|
87
|
+
},
|
|
88
|
+
config: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
required: false,
|
|
91
|
+
default: null,
|
|
92
|
+
description: 'File config database (.env). Fallback ke `.restforge/defaults.json` bila tidak disediakan eksplisit (set via `config set-default`)'
|
|
89
93
|
},
|
|
90
94
|
drop: {
|
|
91
95
|
type: 'boolean',
|
|
@@ -112,18 +116,10 @@ module.exports = {
|
|
|
112
116
|
description: 'Khusus postgres/mysql. Otomatis buat database jika belum ada (skip konfirmasi interaktif). Berguna untuk mode non-interaktif (CI/CD).'
|
|
113
117
|
}
|
|
114
118
|
},
|
|
115
|
-
positional: [
|
|
116
|
-
{
|
|
117
|
-
name: 'path',
|
|
118
|
-
type: 'string',
|
|
119
|
-
required: false,
|
|
120
|
-
description: 'Path file atau folder schema (default: ./schema)'
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
119
|
examples: [
|
|
124
|
-
'npx restforge schema migrate
|
|
125
|
-
'npx restforge schema migrate
|
|
126
|
-
'npx restforge schema migrate
|
|
120
|
+
'npx restforge schema migrate --path=./schema --config=db.env --dry-run',
|
|
121
|
+
'npx restforge schema migrate --path=./schema --config=db.env',
|
|
122
|
+
'npx restforge schema migrate --path=./schema --config=db.env --auto-create-db'
|
|
127
123
|
],
|
|
128
124
|
async handler(args) {
|
|
129
125
|
const resolved = resolveConfig(args.config, process.cwd());
|
|
@@ -147,7 +143,7 @@ module.exports = {
|
|
|
147
143
|
throw err;
|
|
148
144
|
}
|
|
149
145
|
|
|
150
|
-
const schemaPathArg = args.path
|
|
146
|
+
const schemaPathArg = args.path;
|
|
151
147
|
const absPath = path.resolve(process.cwd(), schemaPathArg);
|
|
152
148
|
|
|
153
149
|
if (!fs.existsSync(absPath)) {
|
|
@@ -258,8 +254,7 @@ module.exports = {
|
|
|
258
254
|
}
|
|
259
255
|
|
|
260
256
|
if (testErr && isDbNotExistsError(targetDbType, testErr)) {
|
|
261
|
-
const
|
|
262
|
-
const hintParts = ['npx restforge schema migrate', schemaArg, `--config=${args.config}`];
|
|
257
|
+
const hintParts = ['npx restforge schema migrate', `--path=${args.path}`, `--config=${args.config}`];
|
|
263
258
|
if (args.drop === true) hintParts.push('--drop=true');
|
|
264
259
|
if (args['auto-create-db']) hintParts.push('--auto-create-db');
|
|
265
260
|
const commandHint = hintParts.join(' ');
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
const path = require('path');
|
|
15
15
|
const { loadSchemaPath } = require('../../lib/dbschema-kit/loader');
|
|
16
16
|
|
|
17
|
-
const DEFAULT_PATH = './schema';
|
|
18
|
-
|
|
19
17
|
const COL_SCHEMA = 12;
|
|
20
18
|
const COL_TABLE = 25;
|
|
21
19
|
const COL_FIELDS = 8;
|
|
@@ -71,21 +69,19 @@ module.exports = {
|
|
|
71
69
|
verb: 'models',
|
|
72
70
|
description: 'Menampilkan daftar schema models dengan ringkasan struktur (fields, primary key, indexes, uniques, relations)',
|
|
73
71
|
category: 'introspection',
|
|
74
|
-
flags: {
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
name: 'path',
|
|
72
|
+
flags: {
|
|
73
|
+
path: {
|
|
78
74
|
type: 'string',
|
|
79
|
-
required:
|
|
80
|
-
description: 'Path folder schema (
|
|
75
|
+
required: true,
|
|
76
|
+
description: 'Path file atau folder schema (mis. ./schema atau ./schema/users.js)'
|
|
81
77
|
}
|
|
82
|
-
|
|
78
|
+
},
|
|
83
79
|
examples: [
|
|
84
|
-
'npx restforge schema models',
|
|
85
|
-
'npx restforge schema models
|
|
80
|
+
'npx restforge schema models --path=./schema',
|
|
81
|
+
'npx restforge schema models --path=./custom-schema'
|
|
86
82
|
],
|
|
87
83
|
async handler(args) {
|
|
88
|
-
const schemaPath = args.path
|
|
84
|
+
const schemaPath = args.path;
|
|
89
85
|
const absPath = path.resolve(process.cwd(), schemaPath);
|
|
90
86
|
|
|
91
87
|
let models;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Contract: schema template
|
|
5
|
+
*
|
|
6
|
+
* Browse, preview, dan generate template schema dari koleksi RestForge Schema
|
|
7
|
+
* Reference (85 template, 30 domain, 33 section). Verb ini bertindak sebagai
|
|
8
|
+
* wrapper terhadap binary native `sdf-tools.exe` yang di-ship melalui folder
|
|
9
|
+
* bin/. Semua filter dan display flag diteruskan ke binary; help text di sisi
|
|
10
|
+
* Node mempertahankan kontrak CLI (contract validator + help generator).
|
|
11
|
+
*
|
|
12
|
+
* Binary lookup: <package-root>/bin/sdf-tools.exe relatif terhadap file ini
|
|
13
|
+
* (resolusi sama untuk source workspace dan installation di node_modules).
|
|
14
|
+
*
|
|
15
|
+
* Platform: saat ini hanya Windows (sdf-tools.exe). Pemanggilan di non-Windows
|
|
16
|
+
* akan return error eksplisit, bukan crash diam-diam.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const os = require('os');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
const { spawnSync } = require('child_process');
|
|
23
|
+
|
|
24
|
+
const VALUE_FLAGS = ['domain', 'table', 'category', 'pattern', 'section', 'lang', 'path', 'format'];
|
|
25
|
+
const BOOLEAN_FLAGS = [
|
|
26
|
+
'has-sdf',
|
|
27
|
+
'no-sdf',
|
|
28
|
+
'show',
|
|
29
|
+
'example',
|
|
30
|
+
'generate',
|
|
31
|
+
'force',
|
|
32
|
+
'list-domains',
|
|
33
|
+
'list-categories',
|
|
34
|
+
'list-sections',
|
|
35
|
+
'stats'
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
function resolveBinaryPath() {
|
|
39
|
+
if (os.platform() !== 'win32') return null;
|
|
40
|
+
return path.resolve(__dirname, '..', '..', '..', 'bin', 'sdf-tools.exe');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function buildBinaryArgs(args) {
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const name of VALUE_FLAGS) {
|
|
46
|
+
const value = args[name];
|
|
47
|
+
if (value === undefined || value === null || value === '') continue;
|
|
48
|
+
out.push(`--${name}=${value}`);
|
|
49
|
+
}
|
|
50
|
+
for (const name of BOOLEAN_FLAGS) {
|
|
51
|
+
if (args[name] === true) {
|
|
52
|
+
out.push(`--${name}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = {
|
|
59
|
+
resource: 'schema',
|
|
60
|
+
verb: 'template',
|
|
61
|
+
description: 'Browse, preview, dan generate template schema dari koleksi RestForge Schema Reference',
|
|
62
|
+
category: 'utility',
|
|
63
|
+
flags: {
|
|
64
|
+
domain: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
required: false,
|
|
67
|
+
default: null,
|
|
68
|
+
description: 'Filter berdasarkan domain (csv, mis. erp atau erp,finance)'
|
|
69
|
+
},
|
|
70
|
+
table: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
required: false,
|
|
73
|
+
default: null,
|
|
74
|
+
description: 'Filter nama tabel (wildcard glob: sales*, *_invoice)'
|
|
75
|
+
},
|
|
76
|
+
category: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
required: false,
|
|
79
|
+
default: null,
|
|
80
|
+
description: 'Filter category: master-data atau transactional'
|
|
81
|
+
},
|
|
82
|
+
pattern: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
required: false,
|
|
85
|
+
default: null,
|
|
86
|
+
description: 'Filter pattern: single-table atau master-detail'
|
|
87
|
+
},
|
|
88
|
+
section: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
required: false,
|
|
91
|
+
default: null,
|
|
92
|
+
description: 'Filter section code (lihat --list-sections)'
|
|
93
|
+
},
|
|
94
|
+
'has-sdf': {
|
|
95
|
+
type: 'boolean',
|
|
96
|
+
required: false,
|
|
97
|
+
default: false,
|
|
98
|
+
description: 'Filter hanya template yang sudah punya versi SDF'
|
|
99
|
+
},
|
|
100
|
+
'no-sdf': {
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
required: false,
|
|
103
|
+
default: false,
|
|
104
|
+
description: 'Filter hanya template yang belum punya SDF (gap analysis)'
|
|
105
|
+
},
|
|
106
|
+
show: {
|
|
107
|
+
type: 'boolean',
|
|
108
|
+
required: false,
|
|
109
|
+
default: false,
|
|
110
|
+
description: 'Cetak schema template (perlu --table=<nama_spesifik>)'
|
|
111
|
+
},
|
|
112
|
+
example: {
|
|
113
|
+
type: 'boolean',
|
|
114
|
+
required: false,
|
|
115
|
+
default: false,
|
|
116
|
+
description: 'Sertakan section CONTOH DATA (kombinasi dengan --show)'
|
|
117
|
+
},
|
|
118
|
+
lang: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
required: false,
|
|
121
|
+
default: null,
|
|
122
|
+
description: 'Format schema: sdf (default) atau sql'
|
|
123
|
+
},
|
|
124
|
+
generate: {
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
required: false,
|
|
127
|
+
default: false,
|
|
128
|
+
description: 'Generate template ke filesystem (perlu --table dan --path)'
|
|
129
|
+
},
|
|
130
|
+
path: {
|
|
131
|
+
type: 'string',
|
|
132
|
+
required: false,
|
|
133
|
+
default: null,
|
|
134
|
+
description: 'Path destination untuk --generate (direktori atau file)'
|
|
135
|
+
},
|
|
136
|
+
force: {
|
|
137
|
+
type: 'boolean',
|
|
138
|
+
required: false,
|
|
139
|
+
default: false,
|
|
140
|
+
description: 'Overwrite file destination existing saat --generate'
|
|
141
|
+
},
|
|
142
|
+
'list-domains': {
|
|
143
|
+
type: 'boolean',
|
|
144
|
+
required: false,
|
|
145
|
+
default: false,
|
|
146
|
+
description: 'List semua domain aplikasi yang tersedia'
|
|
147
|
+
},
|
|
148
|
+
'list-categories': {
|
|
149
|
+
type: 'boolean',
|
|
150
|
+
required: false,
|
|
151
|
+
default: false,
|
|
152
|
+
description: 'List semua category template'
|
|
153
|
+
},
|
|
154
|
+
'list-sections': {
|
|
155
|
+
type: 'boolean',
|
|
156
|
+
required: false,
|
|
157
|
+
default: false,
|
|
158
|
+
description: 'List semua section beserta category-nya'
|
|
159
|
+
},
|
|
160
|
+
stats: {
|
|
161
|
+
type: 'boolean',
|
|
162
|
+
required: false,
|
|
163
|
+
default: false,
|
|
164
|
+
description: 'Tampilkan statistik koleksi (per category, pattern, domain, section)'
|
|
165
|
+
},
|
|
166
|
+
format: {
|
|
167
|
+
type: 'string',
|
|
168
|
+
required: false,
|
|
169
|
+
default: null,
|
|
170
|
+
description: 'Format output: table (default), plain, atau json'
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
examples: [
|
|
174
|
+
'npx restforge schema template',
|
|
175
|
+
'npx restforge schema template --domain=erp',
|
|
176
|
+
'npx restforge schema template --domain=erp,inventory --category=master-data',
|
|
177
|
+
'npx restforge schema template --table=sales_order --show',
|
|
178
|
+
'npx restforge schema template --table=sales_order --show --lang=sql',
|
|
179
|
+
'npx restforge schema template --table=sales_order --generate --path=./schema --lang=sdf',
|
|
180
|
+
'npx restforge schema template --stats',
|
|
181
|
+
'npx restforge schema template --list-domains'
|
|
182
|
+
],
|
|
183
|
+
async handler(args) {
|
|
184
|
+
const binaryPath = resolveBinaryPath();
|
|
185
|
+
if (!binaryPath) {
|
|
186
|
+
const err = new Error(
|
|
187
|
+
`schema template hanya tersedia di Windows (sdf-tools.exe). Platform saat ini: ${os.platform()}`
|
|
188
|
+
);
|
|
189
|
+
err.exitCode = 3;
|
|
190
|
+
throw err;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (!fs.existsSync(binaryPath)) {
|
|
194
|
+
const err = new Error(
|
|
195
|
+
`sdf-tools.exe tidak ditemukan di ${binaryPath}. ` +
|
|
196
|
+
'Pastikan binary sudah di-build dan tersedia di folder bin/ package.'
|
|
197
|
+
);
|
|
198
|
+
err.exitCode = 3;
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const binaryArgs = buildBinaryArgs(args);
|
|
203
|
+
const result = spawnSync(binaryPath, binaryArgs, {
|
|
204
|
+
stdio: 'inherit',
|
|
205
|
+
windowsHide: true
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
if (result.error) {
|
|
209
|
+
const err = new Error(`Gagal menjalankan sdf-tools.exe: ${result.error.message}`);
|
|
210
|
+
err.exitCode = 1;
|
|
211
|
+
throw err;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const status = typeof result.status === 'number' ? result.status : 1;
|
|
215
|
+
if (status !== 0) {
|
|
216
|
+
const err = new Error(`sdf-tools.exe exit code ${status}`);
|
|
217
|
+
err.exitCode = status;
|
|
218
|
+
err.silent = true;
|
|
219
|
+
throw err;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
@@ -22,8 +22,6 @@ const { validateCheckCompatibility } = require('../../lib/dbschema-kit/validator
|
|
|
22
22
|
const { reportHuman, getExitCode } = require('../../lib/dbschema-kit/validator/validator-reporter');
|
|
23
23
|
const { defineModel } = require('../../lib/dbschema-kit/define-model');
|
|
24
24
|
|
|
25
|
-
const DEFAULT_PATH = './schema';
|
|
26
|
-
|
|
27
25
|
function listSchemaFiles(absPath) {
|
|
28
26
|
const fs = require('fs');
|
|
29
27
|
const stat = fs.statSync(absPath);
|
|
@@ -67,21 +65,19 @@ module.exports = {
|
|
|
67
65
|
verb: 'validate',
|
|
68
66
|
description: 'Memvalidasi file schema definition (single-model dan cross-model)',
|
|
69
67
|
category: 'introspection',
|
|
70
|
-
flags: {
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
name: 'path',
|
|
68
|
+
flags: {
|
|
69
|
+
path: {
|
|
74
70
|
type: 'string',
|
|
75
|
-
required:
|
|
76
|
-
description: 'Path file atau folder schema (
|
|
71
|
+
required: true,
|
|
72
|
+
description: 'Path file atau folder schema (mis. ./schema atau ./schema/users.js)'
|
|
77
73
|
}
|
|
78
|
-
|
|
74
|
+
},
|
|
79
75
|
examples: [
|
|
80
|
-
'npx restforge schema validate',
|
|
81
|
-
'npx restforge schema validate
|
|
76
|
+
'npx restforge schema validate --path=./schema',
|
|
77
|
+
'npx restforge schema validate --path=./my-schema'
|
|
82
78
|
],
|
|
83
79
|
async handler(args) {
|
|
84
|
-
const schemaPath = args.path
|
|
80
|
+
const schemaPath = args.path;
|
|
85
81
|
const absPath = path.resolve(process.cwd(), schemaPath);
|
|
86
82
|
|
|
87
83
|
let models;
|
package/generators/cli-entry.js
CHANGED
|
@@ -162,11 +162,26 @@ async function dispatch(argv, options = {}) {
|
|
|
162
162
|
await contract.handler(parseResult.args);
|
|
163
163
|
return 0;
|
|
164
164
|
} catch (handlerErr) {
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
// Handler dapat men-set property `silent: true` untuk men-suppress
|
|
166
|
+
// pesan "Error: ..." (mis. payload validate/diff/sync yang sudah
|
|
167
|
+
// print verdict lengkap dan tidak perlu redundant error message).
|
|
168
|
+
// DEBUG mode tetap tampilkan stack untuk troubleshooting.
|
|
169
|
+
if (!handlerErr || handlerErr.silent !== true) {
|
|
170
|
+
const message = handlerErr && handlerErr.message ? handlerErr.message : String(handlerErr);
|
|
171
|
+
writeLine(stderr, `Error: ${message}`);
|
|
172
|
+
}
|
|
167
173
|
if (process.env.DEBUG && handlerErr && handlerErr.stack) {
|
|
168
174
|
writeLine(stderr, handlerErr.stack);
|
|
169
175
|
}
|
|
176
|
+
// Handler dapat men-set property `exitCode` pada Error untuk override
|
|
177
|
+
// default exit code 1. Dipakai oleh validasi schema di `endpoint create`
|
|
178
|
+
// yang membedakan drift (1) vs usage (2) vs connection (3).
|
|
179
|
+
const customCode = handlerErr && Number.isInteger(handlerErr.exitCode)
|
|
180
|
+
? handlerErr.exitCode
|
|
181
|
+
: null;
|
|
182
|
+
if (customCode !== null && customCode >= 0 && customCode <= 255) {
|
|
183
|
+
return customCode;
|
|
184
|
+
}
|
|
170
185
|
return 1;
|
|
171
186
|
}
|
|
172
187
|
}
|