@restforgejs/platform 4.2.8 → 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 +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/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,118 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"projectName": "test-pg",
|
|
3
|
-
"databaseType": "postgres",
|
|
4
|
-
"endpoints": {
|
|
5
|
-
"category": {
|
|
6
|
-
"tableName": "category",
|
|
7
|
-
"displayName": "Category",
|
|
8
|
-
"action": {
|
|
9
|
-
"datatables": true,
|
|
10
|
-
"create": true,
|
|
11
|
-
"update": true,
|
|
12
|
-
"delete": true,
|
|
13
|
-
"get": true,
|
|
14
|
-
"lookup": true,
|
|
15
|
-
"read": true,
|
|
16
|
-
"export": true,
|
|
17
|
-
"import": true,
|
|
18
|
-
"adjust": false,
|
|
19
|
-
"aggregate": false,
|
|
20
|
-
"createComposite": false,
|
|
21
|
-
"updateComposite": false,
|
|
22
|
-
"readComposite": false
|
|
23
|
-
},
|
|
24
|
-
"primaryKey": "category_id",
|
|
25
|
-
"fieldName": [
|
|
26
|
-
"category_id",
|
|
27
|
-
"category_code",
|
|
28
|
-
"category_name",
|
|
29
|
-
"description",
|
|
30
|
-
"is_active"
|
|
31
|
-
],
|
|
32
|
-
"fieldValidation": [
|
|
33
|
-
{
|
|
34
|
-
"name": "category_id",
|
|
35
|
-
"type": "uuid",
|
|
36
|
-
"constraints": {
|
|
37
|
-
"primaryKey": true,
|
|
38
|
-
"autoGenerate": true
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "is_active",
|
|
43
|
-
"type": "boolean",
|
|
44
|
-
"constraints": {
|
|
45
|
-
"default": true
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"name": "category_name",
|
|
50
|
-
"type": "string",
|
|
51
|
-
"constraints": {
|
|
52
|
-
"uppercase": true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"samples": {
|
|
57
|
-
"create": {
|
|
58
|
-
"category_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
59
|
-
"category_code": "DMO001",
|
|
60
|
-
"category_name": "Demo Name",
|
|
61
|
-
"description": "Demo description text",
|
|
62
|
-
"is_active": true
|
|
63
|
-
},
|
|
64
|
-
"update": {
|
|
65
|
-
"category_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
66
|
-
"category_code": "DMO001",
|
|
67
|
-
"category_name": "Updated Demo Name",
|
|
68
|
-
"description": "Demo description text",
|
|
69
|
-
"is_active": true
|
|
70
|
-
},
|
|
71
|
-
"delete": {
|
|
72
|
-
"where": [
|
|
73
|
-
{
|
|
74
|
-
"key": "category_id",
|
|
75
|
-
"value": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
"get": {
|
|
80
|
-
"where": [
|
|
81
|
-
{
|
|
82
|
-
"key": "category_id",
|
|
83
|
-
"value": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
"select": [
|
|
87
|
-
"category_id",
|
|
88
|
-
"category_code",
|
|
89
|
-
"category_name",
|
|
90
|
-
"description",
|
|
91
|
-
"is_active"
|
|
92
|
-
]
|
|
93
|
-
},
|
|
94
|
-
"read": {
|
|
95
|
-
"page": 1,
|
|
96
|
-
"per_page": 10,
|
|
97
|
-
"search_value": "",
|
|
98
|
-
"search_by": "category_code"
|
|
99
|
-
},
|
|
100
|
-
"datatables": {
|
|
101
|
-
"draw": 1,
|
|
102
|
-
"start": 0,
|
|
103
|
-
"length": 10,
|
|
104
|
-
"search": {
|
|
105
|
-
"value": ""
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"lookup": {
|
|
109
|
-
"select": [
|
|
110
|
-
"category_id",
|
|
111
|
-
"category_code"
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
"processors": {}
|
|
118
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"moduleName": "test-pg",
|
|
4
|
-
"createdAt": "2026-02-26T19:32:57.513Z",
|
|
5
|
-
"updatedAt": "2026-02-26T19:32:57.522Z",
|
|
6
|
-
"databaseType": "postgres",
|
|
7
|
-
"endpoints": {
|
|
8
|
-
"category": {
|
|
9
|
-
"version": "2.0.0",
|
|
10
|
-
"type": "module",
|
|
11
|
-
"createdAt": "2026-02-26T19:32:57.522Z",
|
|
12
|
-
"updatedAt": "2026-02-26T19:32:57.522Z",
|
|
13
|
-
"path": "src/modules/test-pg/category.js",
|
|
14
|
-
"modelPath": "src/models/test-pg/category.js",
|
|
15
|
-
"tableName": "category",
|
|
16
|
-
"databaseType": "postgres",
|
|
17
|
-
"actions": {
|
|
18
|
-
"datatables": true,
|
|
19
|
-
"create": true,
|
|
20
|
-
"update": true,
|
|
21
|
-
"delete": true,
|
|
22
|
-
"get": true,
|
|
23
|
-
"lookup": true,
|
|
24
|
-
"read": true,
|
|
25
|
-
"export": true,
|
|
26
|
-
"import": true,
|
|
27
|
-
"adjust": false,
|
|
28
|
-
"aggregate": false,
|
|
29
|
-
"createComposite": false,
|
|
30
|
-
"updateComposite": false,
|
|
31
|
-
"readComposite": false
|
|
32
|
-
},
|
|
33
|
-
"fieldCount": 5,
|
|
34
|
-
"hasAdvancedQueries": false,
|
|
35
|
-
"hasNestedQueries": false,
|
|
36
|
-
"hasFilters": false,
|
|
37
|
-
"hasSearchColumns": false,
|
|
38
|
-
"statistics": {
|
|
39
|
-
"timesGenerated": 1,
|
|
40
|
-
"lastGenerated": "2026-02-26T19:32:57.522Z",
|
|
41
|
-
"lastModified": "2026-02-26T19:32:57.522Z"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"statistics": {
|
|
46
|
-
"totalEndpoints": 1,
|
|
47
|
-
"endpointsByType": {
|
|
48
|
-
"module": 1
|
|
49
|
-
},
|
|
50
|
-
"lastGenerated": "2026-02-26T19:32:57.522Z"
|
|
51
|
-
},
|
|
52
|
-
"config": {
|
|
53
|
-
"autoBackup": false,
|
|
54
|
-
"maxBackups": 5
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Pre-build obfuscation script untuk restforge-cli.
|
|
4
|
-
*
|
|
5
|
-
* Workflow:
|
|
6
|
-
* 1. Cleanup build-temp/
|
|
7
|
-
* 2. Walk source tree, apply EXCLUDE filter
|
|
8
|
-
* 3. Per file:
|
|
9
|
-
* - SKIP_OBFUSCATION match -> copy byte-for-byte
|
|
10
|
-
* - .js file -> obfuscate sesuai FILE_PROFILES
|
|
11
|
-
* - Lainnya -> copy byte-for-byte (safe default)
|
|
12
|
-
* 4. Output ke build-temp/
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* node scripts/obfuscate-source.js [--verbose]
|
|
16
|
-
*
|
|
17
|
-
* Output:
|
|
18
|
-
* build-temp/ (di project root)
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const fs = require('fs');
|
|
22
|
-
const path = require('path');
|
|
23
|
-
const JavaScriptObfuscator = require('javascript-obfuscator');
|
|
24
|
-
|
|
25
|
-
const PROJECT_ROOT = path.resolve(__dirname, '..');
|
|
26
|
-
const BUILD_TEMP = path.join(PROJECT_ROOT, 'build-temp');
|
|
27
|
-
|
|
28
|
-
const args = process.argv.slice(2);
|
|
29
|
-
const VERBOSE = args.includes('--verbose');
|
|
30
|
-
|
|
31
|
-
// === Profile configs ===
|
|
32
|
-
|
|
33
|
-
// Module specifier strings yang HARUS preserve literal di output. javascript-obfuscator
|
|
34
|
-
// `reservedStrings` accept array of regex pattern. String match akan exclude dari
|
|
35
|
-
// string array encoding sehingga bun bundler bisa statically resolve require() args.
|
|
36
|
-
// Tanpa ini, bun --compile tidak bundle modul yang di-require dan binary crash di runtime
|
|
37
|
-
// dengan "Cannot find module '<path>'".
|
|
38
|
-
const RESERVED_REQUIRE_PATTERNS = [
|
|
39
|
-
// Relative paths: './foo', '../bar/baz', './a.js', dll.
|
|
40
|
-
'^\\.\\.?[\\\\/].+',
|
|
41
|
-
// Bare module names (3rd party deps + node built-ins commonly used)
|
|
42
|
-
'^(dotenv|mysql2|oracledb|pg|prompt-sync)$',
|
|
43
|
-
'^(fs|path|os|child_process|crypto|util|stream|url|http|https|net|zlib|readline|events|querystring|buffer|assert|tty|module|timers|vm)$',
|
|
44
|
-
// Node 'node:' URI scheme builtin
|
|
45
|
-
'^node:[a-z]+$',
|
|
46
|
-
// Scoped npm packages
|
|
47
|
-
'^@[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._-]*$',
|
|
48
|
-
// Sub-path imports (e.g. 'pg/lib/something')
|
|
49
|
-
'^[a-z][a-z0-9._-]*\\/[a-zA-Z0-9._/-]+$'
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
const lightObfuscationConfig = {
|
|
53
|
-
compact: true,
|
|
54
|
-
controlFlowFlattening: false,
|
|
55
|
-
deadCodeInjection: false,
|
|
56
|
-
debugProtection: false,
|
|
57
|
-
disableConsoleOutput: false,
|
|
58
|
-
identifierNamesGenerator: 'hexadecimal',
|
|
59
|
-
log: false,
|
|
60
|
-
numbersToExpressions: false,
|
|
61
|
-
renameGlobals: false,
|
|
62
|
-
selfDefending: false,
|
|
63
|
-
simplify: true,
|
|
64
|
-
splitStrings: false,
|
|
65
|
-
stringArray: true,
|
|
66
|
-
stringArrayCallsTransform: false,
|
|
67
|
-
stringArrayEncoding: ['base64'],
|
|
68
|
-
stringArrayThreshold: 0.5,
|
|
69
|
-
transformObjectKeys: false,
|
|
70
|
-
unicodeEscapeSequence: false,
|
|
71
|
-
reservedStrings: RESERVED_REQUIRE_PATTERNS
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const mediumObfuscationConfig = {
|
|
75
|
-
compact: true,
|
|
76
|
-
controlFlowFlattening: true,
|
|
77
|
-
controlFlowFlatteningThreshold: 0.5,
|
|
78
|
-
deadCodeInjection: true,
|
|
79
|
-
deadCodeInjectionThreshold: 0.2,
|
|
80
|
-
debugProtection: false,
|
|
81
|
-
disableConsoleOutput: false,
|
|
82
|
-
identifierNamesGenerator: 'hexadecimal',
|
|
83
|
-
log: false,
|
|
84
|
-
numbersToExpressions: true,
|
|
85
|
-
renameGlobals: false,
|
|
86
|
-
selfDefending: true,
|
|
87
|
-
simplify: true,
|
|
88
|
-
splitStrings: true,
|
|
89
|
-
splitStringsChunkLength: 10,
|
|
90
|
-
stringArray: true,
|
|
91
|
-
stringArrayCallsTransform: true,
|
|
92
|
-
stringArrayCallsTransformThreshold: 0.5,
|
|
93
|
-
stringArrayEncoding: ['base64'],
|
|
94
|
-
stringArrayIndexShift: true,
|
|
95
|
-
stringArrayRotate: true,
|
|
96
|
-
stringArrayShuffle: true,
|
|
97
|
-
stringArrayWrappersCount: 2,
|
|
98
|
-
stringArrayWrappersChainedCalls: true,
|
|
99
|
-
stringArrayWrappersParametersMaxCount: 4,
|
|
100
|
-
stringArrayWrappersType: 'function',
|
|
101
|
-
stringArrayThreshold: 0.75,
|
|
102
|
-
transformObjectKeys: true,
|
|
103
|
-
unicodeEscapeSequence: false,
|
|
104
|
-
reservedStrings: RESERVED_REQUIRE_PATTERNS
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const heavyObfuscationConfig = {
|
|
108
|
-
compact: true,
|
|
109
|
-
controlFlowFlattening: true,
|
|
110
|
-
controlFlowFlatteningThreshold: 1,
|
|
111
|
-
deadCodeInjection: true,
|
|
112
|
-
deadCodeInjectionThreshold: 0.4,
|
|
113
|
-
// debugProtection + interval menambahkan setInterval(debugger, ...) yang
|
|
114
|
-
// mempertahankan event loop tetap hidup sehingga CLI tidak exit clean.
|
|
115
|
-
// Anti-debug yang proper akan ditangani di Fase 5 di level entry point.
|
|
116
|
-
debugProtection: false,
|
|
117
|
-
// disableConsoleOutput menonaktifkan console GLOBAL begitu file Heavy dimuat.
|
|
118
|
-
// Karena Heavy file (key-generator, sensitive-field-masker) di-require transitif
|
|
119
|
-
// dari entry point, opsi ini mematikan output CLI sepenuhnya. Matikan.
|
|
120
|
-
disableConsoleOutput: false,
|
|
121
|
-
identifierNamesGenerator: 'hexadecimal',
|
|
122
|
-
log: false,
|
|
123
|
-
numbersToExpressions: true,
|
|
124
|
-
renameGlobals: false,
|
|
125
|
-
selfDefending: true,
|
|
126
|
-
simplify: true,
|
|
127
|
-
splitStrings: true,
|
|
128
|
-
splitStringsChunkLength: 5,
|
|
129
|
-
stringArray: true,
|
|
130
|
-
stringArrayCallsTransform: true,
|
|
131
|
-
stringArrayCallsTransformThreshold: 1,
|
|
132
|
-
stringArrayEncoding: ['rc4'],
|
|
133
|
-
stringArrayIndexShift: true,
|
|
134
|
-
stringArrayRotate: true,
|
|
135
|
-
stringArrayShuffle: true,
|
|
136
|
-
stringArrayWrappersCount: 5,
|
|
137
|
-
stringArrayWrappersChainedCalls: true,
|
|
138
|
-
stringArrayWrappersParametersMaxCount: 5,
|
|
139
|
-
stringArrayWrappersType: 'function',
|
|
140
|
-
stringArrayThreshold: 1,
|
|
141
|
-
transformObjectKeys: true,
|
|
142
|
-
unicodeEscapeSequence: false,
|
|
143
|
-
reservedStrings: RESERVED_REQUIRE_PATTERNS
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// Profile metadata untuk identifikasi saat counting
|
|
147
|
-
const PROFILE_LIGHT = { name: 'LIGHT', config: lightObfuscationConfig };
|
|
148
|
-
const PROFILE_MEDIUM = { name: 'MEDIUM', config: mediumObfuscationConfig };
|
|
149
|
-
const PROFILE_HEAVY = { name: 'HEAVY', config: heavyObfuscationConfig };
|
|
150
|
-
|
|
151
|
-
// === File mapping ===
|
|
152
|
-
|
|
153
|
-
const FILE_PROFILES = [
|
|
154
|
-
// Heavy: critical security
|
|
155
|
-
{ pattern: /^lib[/\\]utils[/\\]key-generator\.js$/, profile: PROFILE_HEAVY },
|
|
156
|
-
{ pattern: /^lib[/\\]utils[/\\]sensitive-field-masker\.js$/, profile: PROFILE_HEAVY },
|
|
157
|
-
|
|
158
|
-
// Light: dispatcher / dynamic require / dialect registry / template literal besar / catalog data
|
|
159
|
-
{ pattern: /^restforge-cli\.js$/, profile: PROFILE_LIGHT },
|
|
160
|
-
{ pattern: /^cli[/\\]create-processor\.js$/, profile: PROFILE_LIGHT },
|
|
161
|
-
{ pattern: /^cli[/\\]dbschema-introspect\.js$/, profile: PROFILE_LIGHT },
|
|
162
|
-
{ pattern: /^cli[/\\]dbschema-migrate\.js$/, profile: PROFILE_LIGHT },
|
|
163
|
-
{ pattern: /^cli[/\\](dashboard|dbschema|field-validation|query-declarative)-catalog\.js$/, profile: PROFILE_LIGHT },
|
|
164
|
-
{ pattern: /^lib[/\\]dbschema-kit[/\\]loader\.js$/, profile: PROFILE_LIGHT },
|
|
165
|
-
{ pattern: /^lib[/\\]dbschema-kit[/\\]connection\.js$/, profile: PROFILE_LIGHT },
|
|
166
|
-
{ pattern: /^lib[/\\]dbschema-kit[/\\]driver-loader\.js$/, profile: PROFILE_LIGHT },
|
|
167
|
-
{ pattern: /^lib[/\\]dbschema-kit[/\\]dialect[/\\].*\.js$/, profile: PROFILE_LIGHT },
|
|
168
|
-
{ pattern: /^lib[/\\]templates[/\\](oracle|mysql|postgres|sqlite)-template\.js$/, profile: PROFILE_LIGHT },
|
|
169
|
-
{ pattern: /^lib[/\\]templates[/\\].*-catalog\.js$/, profile: PROFILE_LIGHT },
|
|
170
|
-
|
|
171
|
-
// Default: semua file lain
|
|
172
|
-
{ pattern: /\.js$/, profile: PROFILE_MEDIUM }
|
|
173
|
-
];
|
|
174
|
-
|
|
175
|
-
const SKIP_OBFUSCATION = [
|
|
176
|
-
/\.json$/,
|
|
177
|
-
/\.md$/,
|
|
178
|
-
/\.txt$/,
|
|
179
|
-
/\.ico$/,
|
|
180
|
-
/\.png$/,
|
|
181
|
-
/\.jpg$/,
|
|
182
|
-
/\.jpeg$/,
|
|
183
|
-
/\.gif$/,
|
|
184
|
-
/\.svg$/,
|
|
185
|
-
/\.lock$/
|
|
186
|
-
];
|
|
187
|
-
|
|
188
|
-
const EXCLUDE = [
|
|
189
|
-
/^node_modules([/\\]|$)/,
|
|
190
|
-
/^\.git([/\\]|$)/,
|
|
191
|
-
/^\.claude([/\\]|$)/,
|
|
192
|
-
/^tests([/\\]|$)/,
|
|
193
|
-
/^docs([/\\]|$)/,
|
|
194
|
-
/^examples([/\\]|$)/,
|
|
195
|
-
/^metadata([/\\]|$)/,
|
|
196
|
-
/^payload([/\\]|$)/,
|
|
197
|
-
/^scripts([/\\]|$)/,
|
|
198
|
-
/^dist([/\\]|$)/,
|
|
199
|
-
/^build-temp([/\\]|$)/,
|
|
200
|
-
/^\.gitignore$/,
|
|
201
|
-
/^\.npmignore$/,
|
|
202
|
-
/^\.restforge([/\\]|$)/,
|
|
203
|
-
/^package-lock\.json$/,
|
|
204
|
-
/^README\.md$/,
|
|
205
|
-
/^build-bun\.(js|bat|sh)$/,
|
|
206
|
-
/^sync-version\.js$/,
|
|
207
|
-
/^git-release(-upload)?\.bat$/
|
|
208
|
-
];
|
|
209
|
-
|
|
210
|
-
// === Helpers ===
|
|
211
|
-
|
|
212
|
-
function normalizeRelPath(relPath) {
|
|
213
|
-
return relPath.replace(/\\/g, '/');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function getProfileForFile(relPath) {
|
|
217
|
-
for (const entry of FILE_PROFILES) {
|
|
218
|
-
if (entry.pattern.test(relPath)) {
|
|
219
|
-
return entry.profile;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return PROFILE_MEDIUM;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function shouldSkipObfuscation(relPath) {
|
|
226
|
-
return SKIP_OBFUSCATION.some((rx) => rx.test(relPath));
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function isExcluded(relPath) {
|
|
230
|
-
return EXCLUDE.some((rx) => rx.test(relPath));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// === Core ===
|
|
234
|
-
|
|
235
|
-
function obfuscateFile(srcPath, destPath, relPath, stats) {
|
|
236
|
-
const code = fs.readFileSync(srcPath, 'utf8');
|
|
237
|
-
|
|
238
|
-
const hasShebang = code.startsWith('#!');
|
|
239
|
-
let codeBody = code;
|
|
240
|
-
let shebangLine = '';
|
|
241
|
-
|
|
242
|
-
if (hasShebang) {
|
|
243
|
-
const newlineIdx = code.indexOf('\n');
|
|
244
|
-
if (newlineIdx !== -1) {
|
|
245
|
-
shebangLine = code.slice(0, newlineIdx + 1);
|
|
246
|
-
codeBody = code.slice(newlineIdx + 1);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const profile = getProfileForFile(relPath);
|
|
251
|
-
|
|
252
|
-
// Mute console.log selama obfuscate call agar promotional banner
|
|
253
|
-
// javascript-obfuscator v5.x ("JavaScript Obfuscator Pro is now available...")
|
|
254
|
-
// tidak ikut ke build output. Package tidak menyediakan env var atau config
|
|
255
|
-
// option untuk disable banner ini, sehingga harus mute di call-site.
|
|
256
|
-
const originalConsoleLog = console.log;
|
|
257
|
-
console.log = () => {};
|
|
258
|
-
let obfuscated;
|
|
259
|
-
try {
|
|
260
|
-
obfuscated = JavaScriptObfuscator.obfuscate(codeBody, profile.config).getObfuscatedCode();
|
|
261
|
-
} finally {
|
|
262
|
-
console.log = originalConsoleLog;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const finalCode = shebangLine + obfuscated;
|
|
266
|
-
fs.writeFileSync(destPath, finalCode, 'utf8');
|
|
267
|
-
|
|
268
|
-
stats.obfuscated += 1;
|
|
269
|
-
if (profile.name === 'HEAVY') stats.heavy += 1;
|
|
270
|
-
else if (profile.name === 'LIGHT') stats.light += 1;
|
|
271
|
-
else stats.medium += 1;
|
|
272
|
-
|
|
273
|
-
if (VERBOSE) {
|
|
274
|
-
console.log(`[${profile.name}] ${relPath}`);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function copyFile(srcPath, destPath, relPath, stats) {
|
|
279
|
-
fs.copyFileSync(srcPath, destPath);
|
|
280
|
-
stats.copied += 1;
|
|
281
|
-
if (VERBOSE) {
|
|
282
|
-
console.log(`[COPY ] ${relPath}`);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function processDirectory(srcDir, destDir, stats, relDirFromRoot = '') {
|
|
287
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
288
|
-
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
|
|
289
|
-
|
|
290
|
-
for (const entry of entries) {
|
|
291
|
-
const srcPath = path.join(srcDir, entry.name);
|
|
292
|
-
const destPath = path.join(destDir, entry.name);
|
|
293
|
-
const relPath = relDirFromRoot ? `${relDirFromRoot}/${entry.name}` : entry.name;
|
|
294
|
-
const normalizedRel = normalizeRelPath(relPath);
|
|
295
|
-
|
|
296
|
-
if (isExcluded(normalizedRel)) {
|
|
297
|
-
stats.excluded += 1;
|
|
298
|
-
if (VERBOSE) {
|
|
299
|
-
console.log(`[SKIP ] ${normalizedRel} (excluded)`);
|
|
300
|
-
}
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (entry.isDirectory()) {
|
|
305
|
-
processDirectory(srcPath, destPath, stats, relPath);
|
|
306
|
-
} else if (entry.isFile()) {
|
|
307
|
-
if (shouldSkipObfuscation(normalizedRel)) {
|
|
308
|
-
copyFile(srcPath, destPath, normalizedRel, stats);
|
|
309
|
-
} else if (entry.name.endsWith('.js')) {
|
|
310
|
-
obfuscateFile(srcPath, destPath, normalizedRel, stats);
|
|
311
|
-
} else {
|
|
312
|
-
// Safe default: copy as-is for unknown extensions
|
|
313
|
-
copyFile(srcPath, destPath, normalizedRel, stats);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// === Main ===
|
|
320
|
-
|
|
321
|
-
function main() {
|
|
322
|
-
console.log('============================================');
|
|
323
|
-
console.log(' Pre-Build Obfuscation');
|
|
324
|
-
console.log('============================================');
|
|
325
|
-
|
|
326
|
-
if (fs.existsSync(BUILD_TEMP)) {
|
|
327
|
-
console.log('Cleaning build-temp/...');
|
|
328
|
-
fs.rmSync(BUILD_TEMP, { recursive: true, force: true });
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const startTime = Date.now();
|
|
332
|
-
const stats = {
|
|
333
|
-
obfuscated: 0,
|
|
334
|
-
heavy: 0,
|
|
335
|
-
medium: 0,
|
|
336
|
-
light: 0,
|
|
337
|
-
copied: 0,
|
|
338
|
-
excluded: 0
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
processDirectory(PROJECT_ROOT, BUILD_TEMP, stats);
|
|
342
|
-
|
|
343
|
-
const duration = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
344
|
-
const totalProcessed = stats.obfuscated + stats.copied;
|
|
345
|
-
|
|
346
|
-
console.log('');
|
|
347
|
-
console.log(
|
|
348
|
-
`Processed ${totalProcessed} files: ${stats.obfuscated} obfuscated ` +
|
|
349
|
-
`(${stats.heavy} heavy + ${stats.light} light + ${stats.medium} medium), ` +
|
|
350
|
-
`${stats.copied} copied`
|
|
351
|
-
);
|
|
352
|
-
console.log(`Obfuscation completed in ${duration}s`);
|
|
353
|
-
console.log(`Output: ${BUILD_TEMP}`);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
main();
|