@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.
Files changed (325) hide show
  1. package/SECURITY.md +83 -4
  2. package/bin/sdf-tools.exe +0 -0
  3. package/build-info.json +2 -2
  4. package/cli/consumer-deploy.js +1 -1
  5. package/cli/consumer.js +1 -1
  6. package/generators/cli/dashboard/create.js +4 -1
  7. package/generators/cli/endpoint/create.js +1 -1
  8. package/generators/cli/key/generate.js +2 -1
  9. package/generators/cli/key/revoke.js +2 -1
  10. package/generators/cli/payload/diff.js +3 -2
  11. package/generators/cli/payload/generate.js +3 -2
  12. package/generators/cli/payload/sync.js +3 -2
  13. package/generators/cli/payload/validate.js +3 -2
  14. package/generators/cli/processor/create.js +14 -3
  15. package/generators/cli/project/delete.js +2 -1
  16. package/generators/cli/query/validate.js +3 -2
  17. package/generators/cli/schema/apply.js +3 -2
  18. package/generators/cli/schema/describe.js +3 -2
  19. package/generators/cli/schema/diff.js +3 -2
  20. package/generators/cli/schema/introspect.js +3 -2
  21. package/generators/cli/schema/list.js +3 -2
  22. package/generators/cli/schema/migrate.js +3 -2
  23. package/generators/lib/migration/audit-table-runner.js +213 -215
  24. package/generators/lib/payload/payload-runner.js +1 -1
  25. package/generators/lib/templates/dashboard-catalog.js +1 -437
  26. package/generators/lib/templates/db-connection-env.js +1 -212
  27. package/generators/lib/templates/dbschema-catalog.js +1 -489
  28. package/generators/lib/templates/field-validation-catalog.js +1 -531
  29. package/generators/lib/templates/mysql-template.js +1 -3863
  30. package/generators/lib/templates/oracle-template.js +1 -3915
  31. package/generators/lib/templates/postgres-template.js +1 -5838
  32. package/generators/lib/templates/query-declarative-catalog.js +1 -199
  33. package/generators/lib/templates/sqlite-template.js +1 -3440
  34. package/generators/lib/utils/env-manager.js +6 -0
  35. package/generators/lib/utils/path-validator.js +71 -0
  36. package/generators/lib/validators/payload-validator.js +1 -2
  37. package/integrity-manifest.json +28 -10
  38. package/package.json +11 -3
  39. package/scripts/verify-integrity.js +1 -1
  40. package/server.js +1 -1
  41. package/src/components/handlers/adjust_handler.js +1 -1
  42. package/src/components/handlers/audit_handler.js +1 -1
  43. package/src/components/handlers/delete_handler.js +1 -1
  44. package/src/components/handlers/export_handler.js +1 -1
  45. package/src/components/handlers/import_handler.js +1 -1
  46. package/src/components/handlers/insert_handler.js +1 -1
  47. package/src/components/handlers/update_handler.js +1 -1
  48. package/src/components/handlers/upload_handler.js +1 -1
  49. package/src/components/handlers/workflow_handler.js +1 -1
  50. package/src/components/integrations/webhook.js +1 -1
  51. package/src/consumers/baseConsumer.js +1 -1
  52. package/src/consumers/declarativeMapper.js +1 -1
  53. package/src/consumers/handlers/apiHandler.js +1 -1
  54. package/src/consumers/handlers/consoleHandler.js +1 -1
  55. package/src/consumers/handlers/databaseHandler.js +1 -1
  56. package/src/consumers/handlers/index.js +1 -1
  57. package/src/consumers/handlers/kafkaHandler.js +1 -1
  58. package/src/consumers/index.js +1 -1
  59. package/src/consumers/messageTransformer.js +1 -1
  60. package/src/consumers/validator.js +1 -1
  61. package/src/core/db/dialect/base-dialect.js +1 -1
  62. package/src/core/db/dialect/index.js +1 -1
  63. package/src/core/db/dialect/mysql-dialect.js +1 -1
  64. package/src/core/db/dialect/oracle-dialect.js +1 -1
  65. package/src/core/db/dialect/postgres-dialect.js +1 -1
  66. package/src/core/db/dialect/sqlite-dialect.js +1 -1
  67. package/src/core/db/flatten-helper.js +1 -1
  68. package/src/core/db/query-builder-error.js +1 -1
  69. package/src/core/db/query-builder.js +1 -1
  70. package/src/core/db/relation-helper.js +1 -1
  71. package/src/core/handlers/delete_handler.js +1 -1
  72. package/src/core/handlers/insert_handler.js +1 -1
  73. package/src/core/handlers/update_handler.js +1 -1
  74. package/src/core/models/base-model.js +1 -1
  75. package/src/core/utils/cache-manager.js +1 -1
  76. package/src/core/utils/component-engine.js +1 -1
  77. package/src/core/utils/context-builder.js +1 -1
  78. package/src/core/utils/datetime-formatter.js +1 -1
  79. package/src/core/utils/datetime-parser.js +1 -1
  80. package/src/core/utils/db.js +1 -1
  81. package/src/core/utils/logger.js +1 -1
  82. package/src/core/utils/payload-loader.js +1 -1
  83. package/src/core/utils/security-checks.js +1 -1
  84. package/src/middleware/body-options.js +1 -1
  85. package/src/middleware/cors.js +1 -1
  86. package/src/middleware/idempotency.js +1 -1
  87. package/src/middleware/rate-limiter.js +1 -1
  88. package/src/middleware/request-logger.js +1 -1
  89. package/src/middleware/security-headers.js +1 -1
  90. package/src/models/base-model-mysql.js +1 -1
  91. package/src/models/base-model-oracle.js +1 -1
  92. package/src/models/base-model-sqlite.js +1 -1
  93. package/src/models/base-model.js +1 -1
  94. package/src/pro/caching/redis-client.js +1 -1
  95. package/src/pro/caching/redis-helper.js +1 -1
  96. package/src/pro/consumers/baseConsumer.js +1 -1
  97. package/src/pro/consumers/declarativeMapper.js +1 -1
  98. package/src/pro/consumers/handlers/apiHandler.js +1 -1
  99. package/src/pro/consumers/handlers/consoleHandler.js +1 -1
  100. package/src/pro/consumers/handlers/databaseHandler.js +1 -1
  101. package/src/pro/consumers/handlers/index.js +1 -1
  102. package/src/pro/consumers/handlers/kafkaHandler.js +1 -1
  103. package/src/pro/consumers/index.js +1 -1
  104. package/src/pro/consumers/messageTransformer.js +1 -1
  105. package/src/pro/consumers/validator.js +1 -1
  106. package/src/pro/database/base-model-mysql.js +1 -1
  107. package/src/pro/database/base-model-oracle.js +1 -1
  108. package/src/pro/database/base-model-sqlite.js +1 -1
  109. package/src/pro/database/db-mysql.js +1 -1
  110. package/src/pro/database/db-oracle.js +1 -1
  111. package/src/pro/database/db-sqlite.js +1 -1
  112. package/src/pro/excel/excel-generator.js +1 -1
  113. package/src/pro/excel/excel-parser.js +1 -1
  114. package/src/pro/excel/export-service.js +1 -1
  115. package/src/pro/excel/export_handler.js +1 -1
  116. package/src/pro/excel/import-service.js +1 -1
  117. package/src/pro/excel/import-validator.js +1 -1
  118. package/src/pro/excel/import_handler.js +1 -1
  119. package/src/pro/excel/upsert-builder.js +1 -1
  120. package/src/pro/idgen/idgen-routes.js +1 -1
  121. package/src/pro/integrations/lookup-resolver.js +1 -1
  122. package/src/pro/integrations/upload-handler-v2.js +1 -1
  123. package/src/pro/integrations/upload-handler.js +1 -1
  124. package/src/pro/integrations/webhook.js +1 -1
  125. package/src/pro/locking/lock-routes.js +1 -1
  126. package/src/pro/locking/resource-lock-manager.js +1 -1
  127. package/src/pro/messaging/kafkaConsumerService.js +1 -1
  128. package/src/pro/messaging/kafkaService.js +1 -1
  129. package/src/pro/messaging/messagehubService.js +1 -1
  130. package/src/pro/messaging/rabbitmqService.js +1 -1
  131. package/src/pro/scheduler/job-manager.js +1 -1
  132. package/src/pro/scheduler/job-routes.js +1 -1
  133. package/src/pro/scheduler/job-validator.js +1 -1
  134. package/src/pro/storage/base-storage-provider.js +1 -1
  135. package/src/pro/storage/file-metadata-helper.js +1 -1
  136. package/src/pro/storage/index.js +1 -1
  137. package/src/pro/storage/local-storage-provider.js +1 -1
  138. package/src/pro/storage/s3-storage-provider.js +1 -1
  139. package/src/pro/storage/upload-cleanup-job.js +1 -1
  140. package/src/pro/storage/upload-cleanup-scheduler.js +1 -1
  141. package/src/pro/storage/upload-pending-tracker.js +1 -1
  142. package/src/pro/websocket/broadcast-helper.js +1 -1
  143. package/src/pro/websocket/index.js +1 -1
  144. package/src/pro/websocket/livesync-server.js +1 -1
  145. package/src/pro/websocket/ws-broadcaster.js +1 -1
  146. package/src/services/export-service.js +1 -1
  147. package/src/services/import-service.js +1 -1
  148. package/src/services/kafkaConsumerService.js +1 -1
  149. package/src/services/kafkaService.js +1 -1
  150. package/src/services/messagehubService.js +1 -1
  151. package/src/services/rabbitmqService.js +1 -1
  152. package/src/utils/cache-invalidation-registry.js +1 -1
  153. package/src/utils/cache-manager.js +1 -1
  154. package/src/utils/component-engine.js +1 -1
  155. package/src/utils/config-extractor.js +1 -1
  156. package/src/utils/consumerLogger.js +1 -1
  157. package/src/utils/context-builder.js +1 -1
  158. package/src/utils/dashboard-helpers.js +1 -1
  159. package/src/utils/dateHelper.js +1 -1
  160. package/src/utils/datetime-formatter.js +1 -1
  161. package/src/utils/datetime-parser.js +1 -1
  162. package/src/utils/db-bootstrap.js +1 -1
  163. package/src/utils/db-mysql.js +1 -1
  164. package/src/utils/db-oracle.js +1 -1
  165. package/src/utils/db-sqlite.js +1 -1
  166. package/src/utils/db.js +1 -1
  167. package/src/utils/demo-generator.js +1 -1
  168. package/src/utils/excel-generator.js +1 -1
  169. package/src/utils/excel-parser.js +1 -1
  170. package/src/utils/file-watcher.js +1 -1
  171. package/src/utils/id-generator.js +1 -1
  172. package/src/utils/idempotency-manager.js +1 -1
  173. package/src/utils/import-validator.js +1 -1
  174. package/src/utils/license-client.js +1 -1
  175. package/src/utils/lock-manager.js +1 -1
  176. package/src/utils/logger.js +1 -1
  177. package/src/utils/lookup-resolver.js +1 -1
  178. package/src/utils/payload-loader.js +1 -1
  179. package/src/utils/processor-response.js +1 -1
  180. package/src/utils/rabbitmq.js +1 -1
  181. package/src/utils/redis-client.js +1 -1
  182. package/src/utils/redis-helper.js +1 -1
  183. package/src/utils/request-scope.js +1 -1
  184. package/src/utils/security-checks.js +1 -1
  185. package/src/utils/service-resolver.js +1 -1
  186. package/src/utils/shutdown-coordinator.js +1 -1
  187. package/src/utils/trusted-keys.js +1 -1
  188. package/src/utils/upload-handler.js +1 -1
  189. package/src/utils/upsert-builder.js +1 -1
  190. package/src/utils/workflow-hook-executor.js +1 -1
  191. package/generators/metadata/global.json +0 -58
  192. package/generators/metadata/test-mysql-workbench.json +0 -118
  193. package/generators/metadata/test-mysql.json +0 -56
  194. package/generators/metadata/test-oracle-workbench.json +0 -118
  195. package/generators/metadata/test-oracle.json +0 -56
  196. package/generators/metadata/test-pg-workbench.json +0 -118
  197. package/generators/metadata/test-pg.json +0 -56
  198. package/generators/scripts/obfuscate-source.js +0 -356
  199. package/generators/scripts/validate-catalog.js +0 -430
  200. package/generators/scripts/validate-dbschema-catalog.js +0 -708
  201. package/generators/tests/baseline/mysql/mini_inventory_item/src/models/mini-inventory/item.js +0 -944
  202. package/generators/tests/baseline/mysql/mini_inventory_item/src/modules/mini-inventory/item.js +0 -740
  203. package/generators/tests/baseline/mysql/mini_inventory_item/src/modules/mini-inventory.js +0 -336
  204. package/generators/tests/baseline/oracle/mini_inventory_item/src/models/mini-inventory/item.js +0 -1002
  205. package/generators/tests/baseline/oracle/mini_inventory_item/src/modules/mini-inventory/item.js +0 -740
  206. package/generators/tests/baseline/oracle/mini_inventory_item/src/modules/mini-inventory.js +0 -336
  207. package/generators/tests/baseline/postgres/mini_inventory_item/src/models/mini-inventory/item.js +0 -1333
  208. package/generators/tests/baseline/postgres/mini_inventory_item/src/modules/mini-inventory/item.js +0 -1173
  209. package/generators/tests/baseline/postgres/mini_inventory_item/src/modules/mini-inventory.js +0 -496
  210. package/generators/tests/fixtures/payloads/custom-sensitive.json +0 -27
  211. package/generators/tests/fixtures/payloads/dynamic-search-optout.json +0 -23
  212. package/generators/tests/fixtures/payloads/login-with-password.json +0 -22
  213. package/generators/tests/fixtures/payloads/order-process.json +0 -52
  214. package/generators/tests/fixtures/payloads/with-inline-sql.json +0 -26
  215. package/generators/tests/integration-tahap4b/README.md +0 -145
  216. package/generators/tests/integration-tahap4b/run-concurrent.js +0 -77
  217. package/generators/tests/integration-tahap4b/seed.sql +0 -53
  218. package/generators/tests/integration-tahap4b/verify.sql +0 -110
  219. package/generators/tests/unit/cli/create-dashboard.test.js +0 -505
  220. package/generators/tests/unit/cli/create-processor.test.js +0 -319
  221. package/generators/tests/unit/cli/dispatch-dashboard.test.js +0 -149
  222. package/generators/tests/unit/lib/dashboard-generator.test.js +0 -895
  223. package/generators/tests/unit/lib/dashboard-validator.test.js +0 -354
  224. package/generators/tests/unit/lib/dbschema-kit/apply-executor.test.js +0 -437
  225. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-introspect.test.js +0 -393
  226. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-generate-ddl.test.js +0 -104
  227. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-init.test.js +0 -119
  228. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-list.test.js +0 -48
  229. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-migrate.test.js +0 -175
  230. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-validate.test.js +0 -102
  231. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-models.test.js +0 -43
  232. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/all-schemas-listing.js +0 -84
  233. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/connection-error.js +0 -13
  234. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/empty.js +0 -12
  235. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/multi-schema.js +0 -124
  236. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/single-schema-inventory.js +0 -64
  237. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/two-tables.js +0 -66
  238. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/connection-error.js +0 -9
  239. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/partial.js +0 -29
  240. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/rollback.js +0 -26
  241. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/success.js +0 -43
  242. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/audit/events.js +0 -18
  243. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/inventory/products.js +0 -9
  244. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/users.js +0 -8
  245. package/generators/tests/unit/lib/dbschema-kit/connection.test.js +0 -112
  246. package/generators/tests/unit/lib/dbschema-kit/ddl-generator.test.js +0 -205
  247. package/generators/tests/unit/lib/dbschema-kit/define-model.test.js +0 -56
  248. package/generators/tests/unit/lib/dbschema-kit/dialect/index.test.js +0 -46
  249. package/generators/tests/unit/lib/dbschema-kit/dialect/mysql.test.js +0 -126
  250. package/generators/tests/unit/lib/dbschema-kit/dialect/oracle.test.js +0 -126
  251. package/generators/tests/unit/lib/dbschema-kit/dialect/postgres.test.js +0 -131
  252. package/generators/tests/unit/lib/dbschema-kit/dialect/sqlite.test.js +0 -126
  253. package/generators/tests/unit/lib/dbschema-kit/driver-loader.test.js +0 -93
  254. package/generators/tests/unit/lib/dbschema-kit/emitters/create-index.test.js +0 -173
  255. package/generators/tests/unit/lib/dbschema-kit/emitters/create-table.test.js +0 -376
  256. package/generators/tests/unit/lib/dbschema-kit/emitters/drop-table.test.js +0 -78
  257. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/invalid-dialect.env +0 -6
  258. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/missing-dialect.env +0 -5
  259. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/missing-host.env +0 -5
  260. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/oracle-valid.env +0 -6
  261. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/postgres-valid.env +0 -7
  262. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/sqlite-valid.env +0 -2
  263. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/category.js +0 -11
  264. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/item_product.js +0 -11
  265. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/stock_inbound.js +0 -24
  266. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/stock_inbound_item.js +0 -28
  267. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/supplier.js +0 -9
  268. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/warehouse.js +0 -9
  269. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-invalid/orphan.js +0 -17
  270. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/category.js +0 -11
  271. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/item_product.js +0 -11
  272. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/supplier.js +0 -9
  273. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/warehouse.js +0 -9
  274. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/transactions/stock_inbound.js +0 -24
  275. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/transactions/stock_inbound_item.js +0 -28
  276. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/audit/events.js +0 -18
  277. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/inventory/products.js +0 -9
  278. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/public/users.js +0 -9
  279. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-subfolder/extra/category.js +0 -8
  280. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-subfolder/master/category.js +0 -8
  281. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-tablename/bar.js +0 -8
  282. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-tablename/foo.js +0 -8
  283. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/empty-folder/README.md +0 -1
  284. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/invalid-export/plain.js +0 -3
  285. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/invalid-schema/bad.js +0 -6
  286. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/legacy-pattern/legacy.js +0 -12
  287. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-distinct/audit/products.js +0 -9
  288. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-distinct/inventory/products.js +0 -9
  289. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-duplicate/a/products.js +0 -8
  290. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-duplicate/b/products.js +0 -8
  291. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/nested-deep/a/b/c/deep_table.js +0 -8
  292. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/.hidden/ignored.js +0 -7
  293. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/master/category.js +0 -8
  294. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/master/supplier.js +0 -8
  295. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/transactions/stock_inbound.js +0 -8
  296. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/transactions/stock_inbound_item.js +0 -8
  297. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-multiple/category.js +0 -8
  298. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-multiple/item_product.js +0 -9
  299. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-single/category.js +0 -8
  300. package/generators/tests/unit/lib/dbschema-kit/integration.test.js +0 -217
  301. package/generators/tests/unit/lib/dbschema-kit/introspect-mapper.test.js +0 -403
  302. package/generators/tests/unit/lib/dbschema-kit/ir-builder.test.js +0 -390
  303. package/generators/tests/unit/lib/dbschema-kit/loader.test.js +0 -128
  304. package/generators/tests/unit/lib/dbschema-kit/naming.test.js +0 -170
  305. package/generators/tests/unit/lib/dbschema-kit/parser/shorthand-parser.test.js +0 -237
  306. package/generators/tests/unit/lib/dbschema-kit/schema-printer.test.js +0 -251
  307. package/generators/tests/unit/lib/dbschema-kit/statement-modifier.test.js +0 -105
  308. package/generators/tests/unit/lib/dbschema-kit/statement-splitter.test.js +0 -165
  309. package/generators/tests/unit/lib/dbschema-kit/topological-sort.test.js +0 -135
  310. package/generators/tests/unit/lib/dbschema-kit/validator/check-compatibility-validator.test.js +0 -373
  311. package/generators/tests/unit/lib/dbschema-kit/validator/circular-relation-validator.test.js +0 -454
  312. package/generators/tests/unit/lib/dbschema-kit/validator/cross-model-validator.test.js +0 -512
  313. package/generators/tests/unit/lib/dbschema-kit/validator/enhanced-validate-integration.test.js +0 -390
  314. package/generators/tests/unit/lib/dbschema-kit/validator/naming-convention-validator.test.js +0 -306
  315. package/generators/tests/unit/lib/dbschema-kit/validator/schema-validator.test.js +0 -443
  316. package/generators/tests/unit/lib/dbschema-kit/validator/type-compatibility-validator.test.js +0 -440
  317. package/generators/tests/unit/lib/dbschema-kit/validator/validator-reporter.test.js +0 -172
  318. package/generators/tests/unit/lib/metadata-manager-dashboard.test.js +0 -256
  319. package/generators/tests/unit/lib/payload-validator-fieldpolicy.test.js +0 -240
  320. package/generators/tests/unit/lib/processor-validation-generator.test.js +0 -300
  321. package/generators/tests/unit/lib/sensitive-field-masker.test.js +0 -170
  322. package/generators/tests/unit/lib/sql-table-extractor.test.js +0 -119
  323. package/scripts/generate-integrity-manifest.js +0 -124
  324. package/scripts/snapshot-cli-contracts.js +0 -194
  325. package/scripts/verify-publish.js +0 -56
@@ -1,124 +0,0 @@
1
- /**
2
- * Generate Integrity Manifest - FIX-004
3
- *
4
- * Generate SHA-256 hashes untuk file critical sebagai bagian dari
5
- * code integrity verification system.
6
- *
7
- * File ini dipanggil saat build process untuk generate manifest yang
8
- * kemudian diverifikasi saat server startup.
9
- */
10
-
11
- const crypto = require('crypto');
12
- const fs = require('fs');
13
- const path = require('path');
14
-
15
- // ========================================
16
- // CRITICAL FILES (Protected Files)
17
- // ========================================
18
-
19
- /**
20
- * Daftar file yang harus di-protect dengan integrity verification.
21
- *
22
- * CRITICAL: File-file ini adalah target utama bypass attack.
23
- * Semua file di-hash SETELAH strip shebang line dan normalisasi line endings,
24
- * sehingga perubahan yang dilakukan npm saat install tidak mempengaruhi hash.
25
- */
26
- const CRITICAL_FILES = [
27
- 'server.js',
28
- 'src/utils/license-client.js',
29
- 'src/utils/trusted-keys.js',
30
- 'cli/consumer.js',
31
- 'src/utils/security-checks.js',
32
- 'scripts/verify-integrity.js'
33
- ];
34
-
35
- // ========================================
36
- // HASH GENERATION
37
- // ========================================
38
-
39
- /**
40
- * Generate SHA-256 hash untuk single file
41
- *
42
- * PENTING: Line endings dinormalisasi ke LF sebelum hashing untuk
43
- * memastikan hash konsisten di semua platform. Shebang line (#!/usr/bin/env node)
44
- * juga di-strip sebelum hashing karena npm dapat memodifikasi shebang
45
- * pada bin entry files saat install di Windows.
46
- *
47
- * @param {string} filePath - Absolute path ke file
48
- * @returns {string} SHA-256 hash (hex format)
49
- */
50
- function generateHash(filePath) {
51
- // Baca sebagai text dan normalize line endings ke LF
52
- const content = fs.readFileSync(filePath, 'utf8');
53
- let normalized = content.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
54
-
55
- // Strip shebang line jika ada — npm dapat memodifikasi shebang saat install
56
- // sehingga hash harus dihitung TANPA shebang agar konsisten lintas platform
57
- if (normalized.startsWith('#!')) {
58
- const firstNewline = normalized.indexOf('\n');
59
- if (firstNewline !== -1) {
60
- normalized = normalized.substring(firstNewline + 1);
61
- }
62
- }
63
-
64
- return crypto.createHash('sha256').update(normalized, 'utf8').digest('hex');
65
- }
66
-
67
- // ========================================
68
- // MANIFEST GENERATION
69
- // ========================================
70
-
71
- /**
72
- * Generate integrity manifest untuk semua critical files
73
- *
74
- * @param {string} baseDir - Base directory (biasanya DIST_DIR)
75
- * @returns {object} Manifest object dengan file hashes
76
- */
77
- function generateManifest(baseDir) {
78
- const packageJson = require(path.join(baseDir, 'package.json'));
79
-
80
- const manifest = {
81
- version: packageJson.version,
82
- generated: new Date().toISOString(),
83
- generator: 'restforge-build-system',
84
- algorithm: 'sha256',
85
- files: {}
86
- };
87
-
88
- let protectedCount = 0;
89
- let missingCount = 0;
90
-
91
- for (const file of CRITICAL_FILES) {
92
- const fullPath = path.join(baseDir, file);
93
-
94
- if (fs.existsSync(fullPath)) {
95
- manifest.files[file] = generateHash(fullPath);
96
- protectedCount++;
97
- } else {
98
- console.warn(`[Integrity] Warning: Critical file not found: ${file}`);
99
- missingCount++;
100
- }
101
- }
102
-
103
- // Metadata
104
- manifest.stats = {
105
- totalFiles: CRITICAL_FILES.length,
106
- protectedFiles: protectedCount,
107
- missingFiles: missingCount
108
- };
109
-
110
- return manifest;
111
- }
112
-
113
- // ========================================
114
- // EXPORT
115
- // ========================================
116
-
117
- module.exports = {
118
- generateManifest,
119
- generateHash,
120
- CRITICAL_FILES
121
- };
122
-
123
- // CLI USAGE dihapus dari distribusi.
124
- // Manifest hanya bisa di-generate melalui build system internal.
@@ -1,194 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- // Suppress dev-mode noise dari modul seperti config-reader yang print
5
- // "Working directory" / "Is Bun" ke stderr saat NODE_ENV !== 'production'.
6
- // Snapshot tool tujuannya capture state, bukan run dev tooling.
7
- process.env.NODE_ENV = 'production';
8
-
9
- /**
10
- * Snapshot CLI Contracts
11
- *
12
- * Scan seluruh contract di generators/cli/**, extract flag definitions per
13
- * command, lalu tulis hasil ke tests/snapshots/cli-contracts.json.
14
- *
15
- * Fungsi: catch regression saat inline migration v4.0.0. Bila inline tidak
16
- * sengaja menghilangkan / mengubah flag definition, diff snapshot akan
17
- * gagal di test contract-snapshot.test.js.
18
- *
19
- * Usage:
20
- * node scripts/snapshot-cli-contracts.js # generate / overwrite
21
- * node scripts/snapshot-cli-contracts.js --check # bandingkan dengan file existing, exit 1 jika beda
22
- *
23
- * Output JSON shape:
24
- * {
25
- * "meta": { "version": "<pkg version>", "generated": "<iso>" },
26
- * "contracts": {
27
- * "<resource>/<verb>": { resource, verb, category, flags, positional },
28
- * "<global-verb>": { resource: null, verb, category, flags, positional }
29
- * }
30
- * }
31
- */
32
-
33
- const fs = require('node:fs');
34
- const path = require('node:path');
35
- const { discoverCommands, loadCommand } = require('../generators/lib/command-discovery');
36
-
37
- const ROOT = path.resolve(__dirname, '..');
38
- const CLI_DIR = path.join(ROOT, 'generators', 'cli');
39
- const SNAPSHOT_PATH = path.join(ROOT, 'tests', 'snapshots', 'cli-contracts.json');
40
- const PKG_PATH = path.join(ROOT, 'package.json');
41
-
42
- function loadPackageVersion() {
43
- try {
44
- const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
45
- return pkg.version || 'unknown';
46
- } catch (_err) {
47
- return 'unknown';
48
- }
49
- }
50
-
51
- function normalizeFlag(flagDef) {
52
- const out = {
53
- type: flagDef.type,
54
- required: flagDef.required,
55
- description: flagDef.description
56
- };
57
- if (Object.prototype.hasOwnProperty.call(flagDef, 'default')) {
58
- out.default = flagDef.default;
59
- }
60
- return out;
61
- }
62
-
63
- function normalizePositional(posDef) {
64
- return {
65
- name: posDef.name,
66
- type: posDef.type,
67
- required: posDef.required,
68
- description: posDef.description
69
- };
70
- }
71
-
72
- function buildEntry(contract) {
73
- const entry = {
74
- resource: contract.resource || null,
75
- verb: contract.verb,
76
- category: contract.category,
77
- flags: {}
78
- };
79
-
80
- const flagNames = Object.keys(contract.flags || {}).sort();
81
- for (const name of flagNames) {
82
- entry.flags[name] = normalizeFlag(contract.flags[name]);
83
- }
84
-
85
- if (Array.isArray(contract.positional) && contract.positional.length > 0) {
86
- entry.positional = contract.positional.map(normalizePositional);
87
- }
88
-
89
- return entry;
90
- }
91
-
92
- function collectContracts() {
93
- const manifest = discoverCommands(CLI_DIR);
94
- const contracts = {};
95
- const keys = [];
96
-
97
- if (manifest.resources) {
98
- for (const resource of Object.keys(manifest.resources)) {
99
- for (const verb of Object.keys(manifest.resources[resource])) {
100
- const filePath = manifest.resources[resource][verb];
101
- const contract = loadCommand(filePath);
102
- const key = `${resource}/${verb}`;
103
- contracts[key] = buildEntry(contract);
104
- keys.push(key);
105
- }
106
- }
107
- }
108
-
109
- if (manifest.globalVerbs) {
110
- for (const verb of Object.keys(manifest.globalVerbs)) {
111
- const filePath = manifest.globalVerbs[verb];
112
- const contract = loadCommand(filePath);
113
- contracts[verb] = buildEntry(contract);
114
- keys.push(verb);
115
- }
116
- }
117
-
118
- keys.sort();
119
- const sorted = {};
120
- for (const k of keys) sorted[k] = contracts[k];
121
- return sorted;
122
- }
123
-
124
- function buildSnapshot() {
125
- return {
126
- meta: {
127
- version: loadPackageVersion(),
128
- generated: new Date().toISOString()
129
- },
130
- contracts: collectContracts()
131
- };
132
- }
133
-
134
- function writeSnapshot(snapshot) {
135
- fs.mkdirSync(path.dirname(SNAPSHOT_PATH), { recursive: true });
136
- fs.writeFileSync(SNAPSHOT_PATH, JSON.stringify(snapshot, null, 2) + '\n', 'utf8');
137
- }
138
-
139
- function readExistingSnapshot() {
140
- if (!fs.existsSync(SNAPSHOT_PATH)) return null;
141
- try {
142
- return JSON.parse(fs.readFileSync(SNAPSHOT_PATH, 'utf8'));
143
- } catch (_err) {
144
- return null;
145
- }
146
- }
147
-
148
- function main() {
149
- const argv = process.argv.slice(2);
150
- const isCheck = argv.includes('--check');
151
-
152
- const snapshot = buildSnapshot();
153
-
154
- if (isCheck) {
155
- const existing = readExistingSnapshot();
156
- if (!existing) {
157
- console.error(`Snapshot file not found: ${SNAPSHOT_PATH}`);
158
- process.exit(1);
159
- }
160
- const existingContracts = JSON.stringify(existing.contracts, null, 2);
161
- const currentContracts = JSON.stringify(snapshot.contracts, null, 2);
162
- if (existingContracts !== currentContracts) {
163
- console.error('Snapshot drift detected.');
164
- console.error(`Run: node scripts/snapshot-cli-contracts.js`);
165
- process.exit(1);
166
- }
167
- console.log(`Snapshot OK — ${Object.keys(snapshot.contracts).length} contract(s)`);
168
- return;
169
- }
170
-
171
- writeSnapshot(snapshot);
172
- const count = Object.keys(snapshot.contracts).length;
173
- console.log(`Snapshot written: ${SNAPSHOT_PATH}`);
174
- console.log(`Contracts captured: ${count}`);
175
- console.log(`Version: ${snapshot.meta.version}`);
176
- }
177
-
178
- if (require.main === module) {
179
- try {
180
- main();
181
- } catch (err) {
182
- console.error(`Fatal: ${err && err.message ? err.message : String(err)}`);
183
- if (process.env.DEBUG && err && err.stack) {
184
- console.error(err.stack);
185
- }
186
- process.exit(1);
187
- }
188
- }
189
-
190
- module.exports = {
191
- buildSnapshot,
192
- collectContracts,
193
- SNAPSHOT_PATH
194
- };
@@ -1,56 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Pre-publish safety check.
5
- * Memastikan npm publish hanya dijalankan dari DIST directory (bukan source).
6
- *
7
- * Validasi:
8
- * 1. build-info.json harus ada dan memiliki field `version`
9
- * 2. File development (CLAUDE.md, build-npm.js, tests/) TIDAK boleh ada
10
- */
11
-
12
- const fs = require('fs');
13
- const path = require('path');
14
-
15
- const ROOT = path.resolve(__dirname, '..');
16
-
17
- // === Check 1: build-info.json ===
18
- const buildInfoPath = path.join(ROOT, 'build-info.json');
19
- if (!fs.existsSync(buildInfoPath)) {
20
- console.error('[BLOCKED] build-info.json not found.');
21
- console.error(' Publish is only allowed from DIST directory, not from source.');
22
- process.exit(1);
23
- }
24
-
25
- try {
26
- const buildInfo = JSON.parse(fs.readFileSync(buildInfoPath, 'utf8'));
27
- if (!buildInfo.version) {
28
- console.error('[BLOCKED] build-info.json is not valid (field "version" is empty).');
29
- process.exit(1);
30
- }
31
- } catch (e) {
32
- console.error('[BLOCKED] build-info.json cannot be read: ' + e.message);
33
- process.exit(1);
34
- }
35
-
36
- // === Check 2: File development tidak boleh ada ===
37
- const forbidden = [
38
- 'CLAUDE.md',
39
- 'build-npm.js',
40
- 'build-final.bat',
41
- 'build-test.bat',
42
- 'obfuscator-strong.json',
43
- 'obfuscator-moderate.json',
44
- 'tests',
45
- ];
46
-
47
- const found = forbidden.filter(f => fs.existsSync(path.join(ROOT, f)));
48
- if (found.length > 0) {
49
- console.error('[BLOCKED] Development files found in publish directory:');
50
- found.forEach(f => console.error(' - ' + f));
51
- console.error(' Publish is only allowed from DIST directory, not from source.');
52
- process.exit(1);
53
- }
54
-
55
- // === All checks passed ===
56
- console.log('[OK] Publish safety check passed.');