@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.
Files changed (324) 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/templates/dashboard-catalog.js +1 -437
  25. package/generators/lib/templates/db-connection-env.js +1 -212
  26. package/generators/lib/templates/dbschema-catalog.js +1 -489
  27. package/generators/lib/templates/field-validation-catalog.js +1 -531
  28. package/generators/lib/templates/mysql-template.js +1 -3863
  29. package/generators/lib/templates/oracle-template.js +1 -3915
  30. package/generators/lib/templates/postgres-template.js +1 -5838
  31. package/generators/lib/templates/query-declarative-catalog.js +1 -199
  32. package/generators/lib/templates/sqlite-template.js +1 -3440
  33. package/generators/lib/utils/env-manager.js +6 -0
  34. package/generators/lib/utils/path-validator.js +71 -0
  35. package/generators/lib/validators/payload-validator.js +1 -2
  36. package/integrity-manifest.json +28 -10
  37. package/package.json +11 -3
  38. package/scripts/verify-integrity.js +1 -1
  39. package/server.js +1 -1
  40. package/src/components/handlers/adjust_handler.js +1 -1
  41. package/src/components/handlers/audit_handler.js +1 -1
  42. package/src/components/handlers/delete_handler.js +1 -1
  43. package/src/components/handlers/export_handler.js +1 -1
  44. package/src/components/handlers/import_handler.js +1 -1
  45. package/src/components/handlers/insert_handler.js +1 -1
  46. package/src/components/handlers/update_handler.js +1 -1
  47. package/src/components/handlers/upload_handler.js +1 -1
  48. package/src/components/handlers/workflow_handler.js +1 -1
  49. package/src/components/integrations/webhook.js +1 -1
  50. package/src/consumers/baseConsumer.js +1 -1
  51. package/src/consumers/declarativeMapper.js +1 -1
  52. package/src/consumers/handlers/apiHandler.js +1 -1
  53. package/src/consumers/handlers/consoleHandler.js +1 -1
  54. package/src/consumers/handlers/databaseHandler.js +1 -1
  55. package/src/consumers/handlers/index.js +1 -1
  56. package/src/consumers/handlers/kafkaHandler.js +1 -1
  57. package/src/consumers/index.js +1 -1
  58. package/src/consumers/messageTransformer.js +1 -1
  59. package/src/consumers/validator.js +1 -1
  60. package/src/core/db/dialect/base-dialect.js +1 -1
  61. package/src/core/db/dialect/index.js +1 -1
  62. package/src/core/db/dialect/mysql-dialect.js +1 -1
  63. package/src/core/db/dialect/oracle-dialect.js +1 -1
  64. package/src/core/db/dialect/postgres-dialect.js +1 -1
  65. package/src/core/db/dialect/sqlite-dialect.js +1 -1
  66. package/src/core/db/flatten-helper.js +1 -1
  67. package/src/core/db/query-builder-error.js +1 -1
  68. package/src/core/db/query-builder.js +1 -1
  69. package/src/core/db/relation-helper.js +1 -1
  70. package/src/core/handlers/delete_handler.js +1 -1
  71. package/src/core/handlers/insert_handler.js +1 -1
  72. package/src/core/handlers/update_handler.js +1 -1
  73. package/src/core/models/base-model.js +1 -1
  74. package/src/core/utils/cache-manager.js +1 -1
  75. package/src/core/utils/component-engine.js +1 -1
  76. package/src/core/utils/context-builder.js +1 -1
  77. package/src/core/utils/datetime-formatter.js +1 -1
  78. package/src/core/utils/datetime-parser.js +1 -1
  79. package/src/core/utils/db.js +1 -1
  80. package/src/core/utils/logger.js +1 -1
  81. package/src/core/utils/payload-loader.js +1 -1
  82. package/src/core/utils/security-checks.js +1 -1
  83. package/src/middleware/body-options.js +1 -1
  84. package/src/middleware/cors.js +1 -1
  85. package/src/middleware/idempotency.js +1 -1
  86. package/src/middleware/rate-limiter.js +1 -1
  87. package/src/middleware/request-logger.js +1 -1
  88. package/src/middleware/security-headers.js +1 -1
  89. package/src/models/base-model-mysql.js +1 -1
  90. package/src/models/base-model-oracle.js +1 -1
  91. package/src/models/base-model-sqlite.js +1 -1
  92. package/src/models/base-model.js +1 -1
  93. package/src/pro/caching/redis-client.js +1 -1
  94. package/src/pro/caching/redis-helper.js +1 -1
  95. package/src/pro/consumers/baseConsumer.js +1 -1
  96. package/src/pro/consumers/declarativeMapper.js +1 -1
  97. package/src/pro/consumers/handlers/apiHandler.js +1 -1
  98. package/src/pro/consumers/handlers/consoleHandler.js +1 -1
  99. package/src/pro/consumers/handlers/databaseHandler.js +1 -1
  100. package/src/pro/consumers/handlers/index.js +1 -1
  101. package/src/pro/consumers/handlers/kafkaHandler.js +1 -1
  102. package/src/pro/consumers/index.js +1 -1
  103. package/src/pro/consumers/messageTransformer.js +1 -1
  104. package/src/pro/consumers/validator.js +1 -1
  105. package/src/pro/database/base-model-mysql.js +1 -1
  106. package/src/pro/database/base-model-oracle.js +1 -1
  107. package/src/pro/database/base-model-sqlite.js +1 -1
  108. package/src/pro/database/db-mysql.js +1 -1
  109. package/src/pro/database/db-oracle.js +1 -1
  110. package/src/pro/database/db-sqlite.js +1 -1
  111. package/src/pro/excel/excel-generator.js +1 -1
  112. package/src/pro/excel/excel-parser.js +1 -1
  113. package/src/pro/excel/export-service.js +1 -1
  114. package/src/pro/excel/export_handler.js +1 -1
  115. package/src/pro/excel/import-service.js +1 -1
  116. package/src/pro/excel/import-validator.js +1 -1
  117. package/src/pro/excel/import_handler.js +1 -1
  118. package/src/pro/excel/upsert-builder.js +1 -1
  119. package/src/pro/idgen/idgen-routes.js +1 -1
  120. package/src/pro/integrations/lookup-resolver.js +1 -1
  121. package/src/pro/integrations/upload-handler-v2.js +1 -1
  122. package/src/pro/integrations/upload-handler.js +1 -1
  123. package/src/pro/integrations/webhook.js +1 -1
  124. package/src/pro/locking/lock-routes.js +1 -1
  125. package/src/pro/locking/resource-lock-manager.js +1 -1
  126. package/src/pro/messaging/kafkaConsumerService.js +1 -1
  127. package/src/pro/messaging/kafkaService.js +1 -1
  128. package/src/pro/messaging/messagehubService.js +1 -1
  129. package/src/pro/messaging/rabbitmqService.js +1 -1
  130. package/src/pro/scheduler/job-manager.js +1 -1
  131. package/src/pro/scheduler/job-routes.js +1 -1
  132. package/src/pro/scheduler/job-validator.js +1 -1
  133. package/src/pro/storage/base-storage-provider.js +1 -1
  134. package/src/pro/storage/file-metadata-helper.js +1 -1
  135. package/src/pro/storage/index.js +1 -1
  136. package/src/pro/storage/local-storage-provider.js +1 -1
  137. package/src/pro/storage/s3-storage-provider.js +1 -1
  138. package/src/pro/storage/upload-cleanup-job.js +1 -1
  139. package/src/pro/storage/upload-cleanup-scheduler.js +1 -1
  140. package/src/pro/storage/upload-pending-tracker.js +1 -1
  141. package/src/pro/websocket/broadcast-helper.js +1 -1
  142. package/src/pro/websocket/index.js +1 -1
  143. package/src/pro/websocket/livesync-server.js +1 -1
  144. package/src/pro/websocket/ws-broadcaster.js +1 -1
  145. package/src/services/export-service.js +1 -1
  146. package/src/services/import-service.js +1 -1
  147. package/src/services/kafkaConsumerService.js +1 -1
  148. package/src/services/kafkaService.js +1 -1
  149. package/src/services/messagehubService.js +1 -1
  150. package/src/services/rabbitmqService.js +1 -1
  151. package/src/utils/cache-invalidation-registry.js +1 -1
  152. package/src/utils/cache-manager.js +1 -1
  153. package/src/utils/component-engine.js +1 -1
  154. package/src/utils/config-extractor.js +1 -1
  155. package/src/utils/consumerLogger.js +1 -1
  156. package/src/utils/context-builder.js +1 -1
  157. package/src/utils/dashboard-helpers.js +1 -1
  158. package/src/utils/dateHelper.js +1 -1
  159. package/src/utils/datetime-formatter.js +1 -1
  160. package/src/utils/datetime-parser.js +1 -1
  161. package/src/utils/db-bootstrap.js +1 -1
  162. package/src/utils/db-mysql.js +1 -1
  163. package/src/utils/db-oracle.js +1 -1
  164. package/src/utils/db-sqlite.js +1 -1
  165. package/src/utils/db.js +1 -1
  166. package/src/utils/demo-generator.js +1 -1
  167. package/src/utils/excel-generator.js +1 -1
  168. package/src/utils/excel-parser.js +1 -1
  169. package/src/utils/file-watcher.js +1 -1
  170. package/src/utils/id-generator.js +1 -1
  171. package/src/utils/idempotency-manager.js +1 -1
  172. package/src/utils/import-validator.js +1 -1
  173. package/src/utils/license-client.js +1 -1
  174. package/src/utils/lock-manager.js +1 -1
  175. package/src/utils/logger.js +1 -1
  176. package/src/utils/lookup-resolver.js +1 -1
  177. package/src/utils/payload-loader.js +1 -1
  178. package/src/utils/processor-response.js +1 -1
  179. package/src/utils/rabbitmq.js +1 -1
  180. package/src/utils/redis-client.js +1 -1
  181. package/src/utils/redis-helper.js +1 -1
  182. package/src/utils/request-scope.js +1 -1
  183. package/src/utils/security-checks.js +1 -1
  184. package/src/utils/service-resolver.js +1 -1
  185. package/src/utils/shutdown-coordinator.js +1 -1
  186. package/src/utils/trusted-keys.js +1 -1
  187. package/src/utils/upload-handler.js +1 -1
  188. package/src/utils/upsert-builder.js +1 -1
  189. package/src/utils/workflow-hook-executor.js +1 -1
  190. package/generators/metadata/global.json +0 -58
  191. package/generators/metadata/test-mysql-workbench.json +0 -118
  192. package/generators/metadata/test-mysql.json +0 -56
  193. package/generators/metadata/test-oracle-workbench.json +0 -118
  194. package/generators/metadata/test-oracle.json +0 -56
  195. package/generators/metadata/test-pg-workbench.json +0 -118
  196. package/generators/metadata/test-pg.json +0 -56
  197. package/generators/scripts/obfuscate-source.js +0 -356
  198. package/generators/scripts/validate-catalog.js +0 -430
  199. package/generators/scripts/validate-dbschema-catalog.js +0 -708
  200. package/generators/tests/baseline/mysql/mini_inventory_item/src/models/mini-inventory/item.js +0 -944
  201. package/generators/tests/baseline/mysql/mini_inventory_item/src/modules/mini-inventory/item.js +0 -740
  202. package/generators/tests/baseline/mysql/mini_inventory_item/src/modules/mini-inventory.js +0 -336
  203. package/generators/tests/baseline/oracle/mini_inventory_item/src/models/mini-inventory/item.js +0 -1002
  204. package/generators/tests/baseline/oracle/mini_inventory_item/src/modules/mini-inventory/item.js +0 -740
  205. package/generators/tests/baseline/oracle/mini_inventory_item/src/modules/mini-inventory.js +0 -336
  206. package/generators/tests/baseline/postgres/mini_inventory_item/src/models/mini-inventory/item.js +0 -1333
  207. package/generators/tests/baseline/postgres/mini_inventory_item/src/modules/mini-inventory/item.js +0 -1173
  208. package/generators/tests/baseline/postgres/mini_inventory_item/src/modules/mini-inventory.js +0 -496
  209. package/generators/tests/fixtures/payloads/custom-sensitive.json +0 -27
  210. package/generators/tests/fixtures/payloads/dynamic-search-optout.json +0 -23
  211. package/generators/tests/fixtures/payloads/login-with-password.json +0 -22
  212. package/generators/tests/fixtures/payloads/order-process.json +0 -52
  213. package/generators/tests/fixtures/payloads/with-inline-sql.json +0 -26
  214. package/generators/tests/integration-tahap4b/README.md +0 -145
  215. package/generators/tests/integration-tahap4b/run-concurrent.js +0 -77
  216. package/generators/tests/integration-tahap4b/seed.sql +0 -53
  217. package/generators/tests/integration-tahap4b/verify.sql +0 -110
  218. package/generators/tests/unit/cli/create-dashboard.test.js +0 -505
  219. package/generators/tests/unit/cli/create-processor.test.js +0 -319
  220. package/generators/tests/unit/cli/dispatch-dashboard.test.js +0 -149
  221. package/generators/tests/unit/lib/dashboard-generator.test.js +0 -895
  222. package/generators/tests/unit/lib/dashboard-validator.test.js +0 -354
  223. package/generators/tests/unit/lib/dbschema-kit/apply-executor.test.js +0 -437
  224. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-introspect.test.js +0 -393
  225. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-generate-ddl.test.js +0 -104
  226. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-init.test.js +0 -119
  227. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-list.test.js +0 -48
  228. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-migrate.test.js +0 -175
  229. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-kit-validate.test.js +0 -102
  230. package/generators/tests/unit/lib/dbschema-kit/cli/dbschema-models.test.js +0 -43
  231. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/all-schemas-listing.js +0 -84
  232. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/connection-error.js +0 -13
  233. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/empty.js +0 -12
  234. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/multi-schema.js +0 -124
  235. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/single-schema-inventory.js +0 -64
  236. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/introspect-stubs/two-tables.js +0 -66
  237. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/connection-error.js +0 -9
  238. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/partial.js +0 -29
  239. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/rollback.js +0 -26
  240. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/migrate-stubs/success.js +0 -43
  241. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/audit/events.js +0 -18
  242. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/inventory/products.js +0 -9
  243. package/generators/tests/unit/lib/dbschema-kit/cli/fixtures/multi-schema/users.js +0 -8
  244. package/generators/tests/unit/lib/dbschema-kit/connection.test.js +0 -112
  245. package/generators/tests/unit/lib/dbschema-kit/ddl-generator.test.js +0 -205
  246. package/generators/tests/unit/lib/dbschema-kit/define-model.test.js +0 -56
  247. package/generators/tests/unit/lib/dbschema-kit/dialect/index.test.js +0 -46
  248. package/generators/tests/unit/lib/dbschema-kit/dialect/mysql.test.js +0 -126
  249. package/generators/tests/unit/lib/dbschema-kit/dialect/oracle.test.js +0 -126
  250. package/generators/tests/unit/lib/dbschema-kit/dialect/postgres.test.js +0 -131
  251. package/generators/tests/unit/lib/dbschema-kit/dialect/sqlite.test.js +0 -126
  252. package/generators/tests/unit/lib/dbschema-kit/driver-loader.test.js +0 -93
  253. package/generators/tests/unit/lib/dbschema-kit/emitters/create-index.test.js +0 -173
  254. package/generators/tests/unit/lib/dbschema-kit/emitters/create-table.test.js +0 -376
  255. package/generators/tests/unit/lib/dbschema-kit/emitters/drop-table.test.js +0 -78
  256. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/invalid-dialect.env +0 -6
  257. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/missing-dialect.env +0 -5
  258. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/missing-host.env +0 -5
  259. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/oracle-valid.env +0 -6
  260. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/postgres-valid.env +0 -7
  261. package/generators/tests/unit/lib/dbschema-kit/fixtures/connection/sqlite-valid.env +0 -2
  262. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/category.js +0 -11
  263. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/item_product.js +0 -11
  264. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/stock_inbound.js +0 -24
  265. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/stock_inbound_item.js +0 -28
  266. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/supplier.js +0 -9
  267. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory/warehouse.js +0 -9
  268. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-invalid/orphan.js +0 -17
  269. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/category.js +0 -11
  270. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/item_product.js +0 -11
  271. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/supplier.js +0 -9
  272. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/master/warehouse.js +0 -9
  273. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/transactions/stock_inbound.js +0 -24
  274. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/mini-inventory-multifolder/transactions/stock_inbound_item.js +0 -28
  275. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/audit/events.js +0 -18
  276. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/inventory/products.js +0 -9
  277. package/generators/tests/unit/lib/dbschema-kit/fixtures/integration/multi-schema/public/users.js +0 -9
  278. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-subfolder/extra/category.js +0 -8
  279. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-subfolder/master/category.js +0 -8
  280. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-tablename/bar.js +0 -8
  281. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/duplicate-tablename/foo.js +0 -8
  282. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/empty-folder/README.md +0 -1
  283. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/invalid-export/plain.js +0 -3
  284. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/invalid-schema/bad.js +0 -6
  285. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/legacy-pattern/legacy.js +0 -12
  286. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-distinct/audit/products.js +0 -9
  287. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-distinct/inventory/products.js +0 -9
  288. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-duplicate/a/products.js +0 -8
  289. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/multi-schema-duplicate/b/products.js +0 -8
  290. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/nested-deep/a/b/c/deep_table.js +0 -8
  291. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/.hidden/ignored.js +0 -7
  292. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/master/category.js +0 -8
  293. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/master/supplier.js +0 -8
  294. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/transactions/stock_inbound.js +0 -8
  295. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/recursive-multi-folder/transactions/stock_inbound_item.js +0 -8
  296. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-multiple/category.js +0 -8
  297. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-multiple/item_product.js +0 -9
  298. package/generators/tests/unit/lib/dbschema-kit/fixtures/loader/valid-single/category.js +0 -8
  299. package/generators/tests/unit/lib/dbschema-kit/integration.test.js +0 -217
  300. package/generators/tests/unit/lib/dbschema-kit/introspect-mapper.test.js +0 -403
  301. package/generators/tests/unit/lib/dbschema-kit/ir-builder.test.js +0 -390
  302. package/generators/tests/unit/lib/dbschema-kit/loader.test.js +0 -128
  303. package/generators/tests/unit/lib/dbschema-kit/naming.test.js +0 -170
  304. package/generators/tests/unit/lib/dbschema-kit/parser/shorthand-parser.test.js +0 -237
  305. package/generators/tests/unit/lib/dbschema-kit/schema-printer.test.js +0 -251
  306. package/generators/tests/unit/lib/dbschema-kit/statement-modifier.test.js +0 -105
  307. package/generators/tests/unit/lib/dbschema-kit/statement-splitter.test.js +0 -165
  308. package/generators/tests/unit/lib/dbschema-kit/topological-sort.test.js +0 -135
  309. package/generators/tests/unit/lib/dbschema-kit/validator/check-compatibility-validator.test.js +0 -373
  310. package/generators/tests/unit/lib/dbschema-kit/validator/circular-relation-validator.test.js +0 -454
  311. package/generators/tests/unit/lib/dbschema-kit/validator/cross-model-validator.test.js +0 -512
  312. package/generators/tests/unit/lib/dbschema-kit/validator/enhanced-validate-integration.test.js +0 -390
  313. package/generators/tests/unit/lib/dbschema-kit/validator/naming-convention-validator.test.js +0 -306
  314. package/generators/tests/unit/lib/dbschema-kit/validator/schema-validator.test.js +0 -443
  315. package/generators/tests/unit/lib/dbschema-kit/validator/type-compatibility-validator.test.js +0 -440
  316. package/generators/tests/unit/lib/dbschema-kit/validator/validator-reporter.test.js +0 -172
  317. package/generators/tests/unit/lib/metadata-manager-dashboard.test.js +0 -256
  318. package/generators/tests/unit/lib/payload-validator-fieldpolicy.test.js +0 -240
  319. package/generators/tests/unit/lib/processor-validation-generator.test.js +0 -300
  320. package/generators/tests/unit/lib/sensitive-field-masker.test.js +0 -170
  321. package/generators/tests/unit/lib/sql-table-extractor.test.js +0 -119
  322. package/scripts/generate-integrity-manifest.js +0 -124
  323. package/scripts/snapshot-cli-contracts.js +0 -194
  324. package/scripts/verify-publish.js +0 -56
@@ -1,126 +0,0 @@
1
- 'use strict';
2
-
3
- const test = require('node:test');
4
- const assert = require('node:assert');
5
-
6
- const mysql = require('../../../../../lib/dbschema-kit/dialect/mysql');
7
-
8
- test('mysql: name identifier dialect adalah mysql', () => {
9
- assert.strictEqual(mysql.name, 'mysql');
10
- });
11
-
12
- test('mysql: mapType integer menghasilkan INT (bukan INTEGER)', () => {
13
- assert.strictEqual(mysql.mapType({ type: 'integer' }), 'INT');
14
- });
15
-
16
- test('mysql: mapType bigint menghasilkan BIGINT', () => {
17
- assert.strictEqual(mysql.mapType({ type: 'bigint' }), 'BIGINT');
18
- });
19
-
20
- test('mysql: mapType text menghasilkan TEXT', () => {
21
- assert.strictEqual(mysql.mapType({ type: 'text' }), 'TEXT');
22
- });
23
-
24
- test('mysql: mapType string dengan length menghasilkan VARCHAR(N)', () => {
25
- assert.strictEqual(mysql.mapType({ type: 'string', length: 36 }), 'VARCHAR(36)');
26
- });
27
-
28
- test('mysql: mapType decimal menghasilkan DECIMAL(M,N)', () => {
29
- assert.strictEqual(mysql.mapType({ type: 'decimal', precision: 15, scale: 2 }), 'DECIMAL(15,2)');
30
- });
31
-
32
- test('mysql: mapType boolean menghasilkan VARCHAR(5) sesuai konvensi runtime', () => {
33
- assert.strictEqual(mysql.mapType({ type: 'boolean' }), 'VARCHAR(5)');
34
- });
35
-
36
- test('mysql: mapType uuid menghasilkan VARCHAR(36)', () => {
37
- assert.strictEqual(mysql.mapType({ type: 'uuid' }), 'VARCHAR(36)');
38
- });
39
-
40
- test('mysql: mapType json native menghasilkan JSON', () => {
41
- assert.strictEqual(mysql.mapType({ type: 'json' }), 'JSON');
42
- });
43
-
44
- test('mysql: mapType date menghasilkan DATE', () => {
45
- assert.strictEqual(mysql.mapType({ type: 'date' }), 'DATE');
46
- });
47
-
48
- test('mysql: mapType timestamp menghasilkan TIMESTAMP', () => {
49
- assert.strictEqual(mysql.mapType({ type: 'timestamp' }), 'TIMESTAMP');
50
- });
51
-
52
- test('mysql: mapType throw bila type tidak dikenal', () => {
53
- assert.throws(() => mysql.mapType({ type: 'binary' }), /Unknown type: 'binary'/);
54
- });
55
-
56
- test("mysql: formatDefault literal boolean true menghasilkan 'true'", () => {
57
- assert.strictEqual(mysql.formatDefault({ kind: 'literal', value: true }), "'true'");
58
- });
59
-
60
- test("mysql: formatDefault literal boolean false menghasilkan 'false'", () => {
61
- assert.strictEqual(mysql.formatDefault({ kind: 'literal', value: false }), "'false'");
62
- });
63
-
64
- test('mysql: formatDefault literal angka menghasilkan literal tanpa quote', () => {
65
- assert.strictEqual(mysql.formatDefault({ kind: 'literal', value: 0 }), '0');
66
- assert.strictEqual(mysql.formatDefault({ kind: 'literal', value: 100 }), '100');
67
- });
68
-
69
- test('mysql: formatDefault literal string menghasilkan single quote wrapped', () => {
70
- assert.strictEqual(mysql.formatDefault({ kind: 'literal', value: 'INDONESIA' }), "'INDONESIA'");
71
- });
72
-
73
- test('mysql: formatDefault function now menghasilkan CURRENT_TIMESTAMP', () => {
74
- assert.strictEqual(
75
- mysql.formatDefault({ kind: 'function', name: 'now', args: [] }),
76
- 'CURRENT_TIMESTAMP'
77
- );
78
- });
79
-
80
- test('mysql: formatDefault constant current_date menghasilkan CURRENT_DATE', () => {
81
- assert.strictEqual(
82
- mysql.formatDefault({ kind: 'constant', value: 'current_date' }),
83
- 'CURRENT_DATE'
84
- );
85
- });
86
-
87
- test('mysql: formatDefault throw bila function bukan whitelist', () => {
88
- assert.throws(
89
- () => mysql.formatDefault({ kind: 'function', name: 'uuid', args: [] }),
90
- /Unknown function: 'uuid'/
91
- );
92
- });
93
-
94
- test('mysql: formatDefault throw bila constant bukan whitelist', () => {
95
- assert.throws(
96
- () => mysql.formatDefault({ kind: 'constant', value: 'sysdate' }),
97
- /Unknown constant: 'sysdate'/
98
- );
99
- });
100
-
101
- test('mysql: quoteIdentifier identifier biasa return as-is tanpa quote', () => {
102
- assert.strictEqual(mysql.quoteIdentifier('category'), 'category');
103
- });
104
-
105
- test('mysql: quoteIdentifier reserved word return as-is tanpa quote', () => {
106
- assert.strictEqual(mysql.quoteIdentifier('user'), 'user');
107
- assert.strictEqual(mysql.quoteIdentifier('order'), 'order');
108
- });
109
-
110
- test('mysql: quoteIdentifier throw bila identifier empty string', () => {
111
- assert.throws(() => mysql.quoteIdentifier(''), /Identifier must be a non-empty string/);
112
- });
113
-
114
- test('mysql: formatReferentialAction memetakan semua action ke SQL', () => {
115
- assert.strictEqual(mysql.formatReferentialAction('cascade'), 'CASCADE');
116
- assert.strictEqual(mysql.formatReferentialAction('restrict'), 'RESTRICT');
117
- assert.strictEqual(mysql.formatReferentialAction('setNull'), 'SET NULL');
118
- assert.strictEqual(mysql.formatReferentialAction('noAction'), 'NO ACTION');
119
- });
120
-
121
- test('mysql: formatReferentialAction throw bila action tidak dikenal', () => {
122
- assert.throws(
123
- () => mysql.formatReferentialAction('unknown'),
124
- /Unknown referential action: 'unknown'/
125
- );
126
- });
@@ -1,126 +0,0 @@
1
- 'use strict';
2
-
3
- const test = require('node:test');
4
- const assert = require('node:assert');
5
-
6
- const oracle = require('../../../../../lib/dbschema-kit/dialect/oracle');
7
-
8
- test('oracle: name identifier dialect adalah oracle', () => {
9
- assert.strictEqual(oracle.name, 'oracle');
10
- });
11
-
12
- test('oracle: mapType integer menghasilkan NUMBER(10)', () => {
13
- assert.strictEqual(oracle.mapType({ type: 'integer' }), 'NUMBER(10)');
14
- });
15
-
16
- test('oracle: mapType bigint menghasilkan NUMBER(19)', () => {
17
- assert.strictEqual(oracle.mapType({ type: 'bigint' }), 'NUMBER(19)');
18
- });
19
-
20
- test('oracle: mapType text menghasilkan CLOB', () => {
21
- assert.strictEqual(oracle.mapType({ type: 'text' }), 'CLOB');
22
- });
23
-
24
- test('oracle: mapType string dengan length menghasilkan VARCHAR2(N)', () => {
25
- assert.strictEqual(oracle.mapType({ type: 'string', length: 36 }), 'VARCHAR2(36)');
26
- });
27
-
28
- test('oracle: mapType decimal menghasilkan NUMBER(M,N)', () => {
29
- assert.strictEqual(oracle.mapType({ type: 'decimal', precision: 15, scale: 2 }), 'NUMBER(15,2)');
30
- });
31
-
32
- test('oracle: mapType boolean menghasilkan VARCHAR2(5) sesuai konvensi runtime', () => {
33
- assert.strictEqual(oracle.mapType({ type: 'boolean' }), 'VARCHAR2(5)');
34
- });
35
-
36
- test('oracle: mapType uuid menghasilkan VARCHAR2(36)', () => {
37
- assert.strictEqual(oracle.mapType({ type: 'uuid' }), 'VARCHAR2(36)');
38
- });
39
-
40
- test('oracle: mapType json menghasilkan CLOB', () => {
41
- assert.strictEqual(oracle.mapType({ type: 'json' }), 'CLOB');
42
- });
43
-
44
- test('oracle: mapType date menghasilkan DATE', () => {
45
- assert.strictEqual(oracle.mapType({ type: 'date' }), 'DATE');
46
- });
47
-
48
- test('oracle: mapType timestamp menghasilkan TIMESTAMP', () => {
49
- assert.strictEqual(oracle.mapType({ type: 'timestamp' }), 'TIMESTAMP');
50
- });
51
-
52
- test('oracle: mapType throw bila type tidak dikenal', () => {
53
- assert.throws(() => oracle.mapType({ type: 'binary' }), /Unknown type: 'binary'/);
54
- });
55
-
56
- test("oracle: formatDefault literal boolean true menghasilkan 'true'", () => {
57
- assert.strictEqual(oracle.formatDefault({ kind: 'literal', value: true }), "'true'");
58
- });
59
-
60
- test("oracle: formatDefault literal boolean false menghasilkan 'false'", () => {
61
- assert.strictEqual(oracle.formatDefault({ kind: 'literal', value: false }), "'false'");
62
- });
63
-
64
- test('oracle: formatDefault literal angka menghasilkan literal tanpa quote', () => {
65
- assert.strictEqual(oracle.formatDefault({ kind: 'literal', value: 0 }), '0');
66
- assert.strictEqual(oracle.formatDefault({ kind: 'literal', value: 100 }), '100');
67
- });
68
-
69
- test('oracle: formatDefault literal string menghasilkan single quote wrapped', () => {
70
- assert.strictEqual(oracle.formatDefault({ kind: 'literal', value: 'INDONESIA' }), "'INDONESIA'");
71
- });
72
-
73
- test('oracle: formatDefault function now menghasilkan SYSTIMESTAMP (native)', () => {
74
- assert.strictEqual(
75
- oracle.formatDefault({ kind: 'function', name: 'now', args: [] }),
76
- 'SYSTIMESTAMP'
77
- );
78
- });
79
-
80
- test('oracle: formatDefault constant current_date menghasilkan CURRENT_DATE', () => {
81
- assert.strictEqual(
82
- oracle.formatDefault({ kind: 'constant', value: 'current_date' }),
83
- 'CURRENT_DATE'
84
- );
85
- });
86
-
87
- test('oracle: formatDefault throw bila function bukan whitelist', () => {
88
- assert.throws(
89
- () => oracle.formatDefault({ kind: 'function', name: 'sysdate', args: [] }),
90
- /Unknown function: 'sysdate'/
91
- );
92
- });
93
-
94
- test('oracle: formatDefault throw bila constant bukan whitelist', () => {
95
- assert.throws(
96
- () => oracle.formatDefault({ kind: 'constant', value: 'sysdate' }),
97
- /Unknown constant: 'sysdate'/
98
- );
99
- });
100
-
101
- test('oracle: quoteIdentifier identifier biasa return as-is tanpa quote', () => {
102
- assert.strictEqual(oracle.quoteIdentifier('category'), 'category');
103
- });
104
-
105
- test('oracle: quoteIdentifier reserved word return as-is tanpa quote', () => {
106
- assert.strictEqual(oracle.quoteIdentifier('user'), 'user');
107
- assert.strictEqual(oracle.quoteIdentifier('order'), 'order');
108
- });
109
-
110
- test('oracle: quoteIdentifier throw bila identifier empty string', () => {
111
- assert.throws(() => oracle.quoteIdentifier(''), /Identifier must be a non-empty string/);
112
- });
113
-
114
- test('oracle: formatReferentialAction memetakan semua action ke SQL', () => {
115
- assert.strictEqual(oracle.formatReferentialAction('cascade'), 'CASCADE');
116
- assert.strictEqual(oracle.formatReferentialAction('restrict'), 'RESTRICT');
117
- assert.strictEqual(oracle.formatReferentialAction('setNull'), 'SET NULL');
118
- assert.strictEqual(oracle.formatReferentialAction('noAction'), 'NO ACTION');
119
- });
120
-
121
- test('oracle: formatReferentialAction throw bila action tidak dikenal', () => {
122
- assert.throws(
123
- () => oracle.formatReferentialAction('unknown'),
124
- /Unknown referential action: 'unknown'/
125
- );
126
- });
@@ -1,131 +0,0 @@
1
- 'use strict';
2
-
3
- const test = require('node:test');
4
- const assert = require('node:assert');
5
-
6
- const postgres = require('../../../../../lib/dbschema-kit/dialect/postgres');
7
-
8
- test('postgres: name identifier dialect adalah postgres', () => {
9
- assert.strictEqual(postgres.name, 'postgres');
10
- });
11
-
12
- test('postgres: mapType integer menghasilkan INTEGER', () => {
13
- assert.strictEqual(postgres.mapType({ type: 'integer' }), 'INTEGER');
14
- });
15
-
16
- test('postgres: mapType bigint menghasilkan BIGINT', () => {
17
- assert.strictEqual(postgres.mapType({ type: 'bigint' }), 'BIGINT');
18
- });
19
-
20
- test('postgres: mapType text menghasilkan TEXT', () => {
21
- assert.strictEqual(postgres.mapType({ type: 'text' }), 'TEXT');
22
- });
23
-
24
- test('postgres: mapType string dengan length menghasilkan VARCHAR(N)', () => {
25
- assert.strictEqual(postgres.mapType({ type: 'string', length: 36 }), 'VARCHAR(36)');
26
- });
27
-
28
- test('postgres: mapType decimal dengan precision dan scale menghasilkan DECIMAL(M,N)', () => {
29
- assert.strictEqual(postgres.mapType({ type: 'decimal', precision: 15, scale: 2 }), 'DECIMAL(15,2)');
30
- });
31
-
32
- test('postgres: mapType boolean native menghasilkan BOOLEAN', () => {
33
- assert.strictEqual(postgres.mapType({ type: 'boolean' }), 'BOOLEAN');
34
- });
35
-
36
- test('postgres: mapType uuid native menghasilkan UUID', () => {
37
- assert.strictEqual(postgres.mapType({ type: 'uuid' }), 'UUID');
38
- });
39
-
40
- test('postgres: mapType json menghasilkan JSONB', () => {
41
- assert.strictEqual(postgres.mapType({ type: 'json' }), 'JSONB');
42
- });
43
-
44
- test('postgres: mapType date menghasilkan DATE', () => {
45
- assert.strictEqual(postgres.mapType({ type: 'date' }), 'DATE');
46
- });
47
-
48
- test('postgres: mapType timestamp menghasilkan TIMESTAMP', () => {
49
- assert.strictEqual(postgres.mapType({ type: 'timestamp' }), 'TIMESTAMP');
50
- });
51
-
52
- test('postgres: mapType throw bila type tidak dikenal', () => {
53
- assert.throws(() => postgres.mapType({ type: 'binary' }), /Unknown type: 'binary'/);
54
- });
55
-
56
- test('postgres: formatDefault literal boolean true menghasilkan TRUE', () => {
57
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: true }), 'TRUE');
58
- });
59
-
60
- test('postgres: formatDefault literal boolean false menghasilkan FALSE', () => {
61
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: false }), 'FALSE');
62
- });
63
-
64
- test('postgres: formatDefault literal angka menghasilkan literal tanpa quote', () => {
65
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: 0 }), '0');
66
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: -5 }), '-5');
67
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: 100 }), '100');
68
- });
69
-
70
- test('postgres: formatDefault literal string menghasilkan single quote wrapped', () => {
71
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: 'INDONESIA' }), "'INDONESIA'");
72
- });
73
-
74
- test('postgres: formatDefault literal string escape single quote dengan double-up', () => {
75
- assert.strictEqual(postgres.formatDefault({ kind: 'literal', value: "O'Brien" }), "'O''Brien'");
76
- });
77
-
78
- test('postgres: formatDefault function now menghasilkan CURRENT_TIMESTAMP', () => {
79
- assert.strictEqual(
80
- postgres.formatDefault({ kind: 'function', name: 'now', args: [] }),
81
- 'CURRENT_TIMESTAMP'
82
- );
83
- });
84
-
85
- test('postgres: formatDefault constant current_date menghasilkan CURRENT_DATE', () => {
86
- assert.strictEqual(
87
- postgres.formatDefault({ kind: 'constant', value: 'current_date' }),
88
- 'CURRENT_DATE'
89
- );
90
- });
91
-
92
- test('postgres: formatDefault throw bila function bukan whitelist', () => {
93
- assert.throws(
94
- () => postgres.formatDefault({ kind: 'function', name: 'uuid_generate_v4', args: [] }),
95
- /Unknown function: 'uuid_generate_v4'/
96
- );
97
- });
98
-
99
- test('postgres: formatDefault throw bila constant bukan whitelist', () => {
100
- assert.throws(
101
- () => postgres.formatDefault({ kind: 'constant', value: 'current_user' }),
102
- /Unknown constant: 'current_user'/
103
- );
104
- });
105
-
106
- test('postgres: quoteIdentifier identifier biasa return as-is tanpa quote', () => {
107
- assert.strictEqual(postgres.quoteIdentifier('category'), 'category');
108
- });
109
-
110
- test('postgres: quoteIdentifier reserved word return as-is tanpa quote', () => {
111
- assert.strictEqual(postgres.quoteIdentifier('user'), 'user');
112
- assert.strictEqual(postgres.quoteIdentifier('order'), 'order');
113
- });
114
-
115
- test('postgres: quoteIdentifier throw bila identifier empty string', () => {
116
- assert.throws(() => postgres.quoteIdentifier(''), /Identifier must be a non-empty string/);
117
- });
118
-
119
- test('postgres: formatReferentialAction memetakan semua action ke SQL', () => {
120
- assert.strictEqual(postgres.formatReferentialAction('cascade'), 'CASCADE');
121
- assert.strictEqual(postgres.formatReferentialAction('restrict'), 'RESTRICT');
122
- assert.strictEqual(postgres.formatReferentialAction('setNull'), 'SET NULL');
123
- assert.strictEqual(postgres.formatReferentialAction('noAction'), 'NO ACTION');
124
- });
125
-
126
- test('postgres: formatReferentialAction throw bila action tidak dikenal', () => {
127
- assert.throws(
128
- () => postgres.formatReferentialAction('unknown'),
129
- /Unknown referential action: 'unknown'/
130
- );
131
- });
@@ -1,126 +0,0 @@
1
- 'use strict';
2
-
3
- const test = require('node:test');
4
- const assert = require('node:assert');
5
-
6
- const sqlite = require('../../../../../lib/dbschema-kit/dialect/sqlite');
7
-
8
- test('sqlite: name identifier dialect adalah sqlite', () => {
9
- assert.strictEqual(sqlite.name, 'sqlite');
10
- });
11
-
12
- test('sqlite: mapType integer menghasilkan INTEGER', () => {
13
- assert.strictEqual(sqlite.mapType({ type: 'integer' }), 'INTEGER');
14
- });
15
-
16
- test('sqlite: mapType bigint menghasilkan BIGINT', () => {
17
- assert.strictEqual(sqlite.mapType({ type: 'bigint' }), 'BIGINT');
18
- });
19
-
20
- test('sqlite: mapType text menghasilkan TEXT', () => {
21
- assert.strictEqual(sqlite.mapType({ type: 'text' }), 'TEXT');
22
- });
23
-
24
- test('sqlite: mapType string dengan length menghasilkan VARCHAR(N)', () => {
25
- assert.strictEqual(sqlite.mapType({ type: 'string', length: 36 }), 'VARCHAR(36)');
26
- });
27
-
28
- test('sqlite: mapType decimal menghasilkan DECIMAL(M,N)', () => {
29
- assert.strictEqual(sqlite.mapType({ type: 'decimal', precision: 15, scale: 2 }), 'DECIMAL(15,2)');
30
- });
31
-
32
- test('sqlite: mapType boolean menghasilkan VARCHAR(5) sesuai konvensi runtime', () => {
33
- assert.strictEqual(sqlite.mapType({ type: 'boolean' }), 'VARCHAR(5)');
34
- });
35
-
36
- test('sqlite: mapType uuid menghasilkan VARCHAR(36)', () => {
37
- assert.strictEqual(sqlite.mapType({ type: 'uuid' }), 'VARCHAR(36)');
38
- });
39
-
40
- test('sqlite: mapType json menghasilkan TEXT', () => {
41
- assert.strictEqual(sqlite.mapType({ type: 'json' }), 'TEXT');
42
- });
43
-
44
- test('sqlite: mapType date menghasilkan DATE', () => {
45
- assert.strictEqual(sqlite.mapType({ type: 'date' }), 'DATE');
46
- });
47
-
48
- test('sqlite: mapType timestamp menghasilkan TIMESTAMP', () => {
49
- assert.strictEqual(sqlite.mapType({ type: 'timestamp' }), 'TIMESTAMP');
50
- });
51
-
52
- test('sqlite: mapType throw bila type tidak dikenal', () => {
53
- assert.throws(() => sqlite.mapType({ type: 'binary' }), /Unknown type: 'binary'/);
54
- });
55
-
56
- test("sqlite: formatDefault literal boolean true menghasilkan 'true'", () => {
57
- assert.strictEqual(sqlite.formatDefault({ kind: 'literal', value: true }), "'true'");
58
- });
59
-
60
- test("sqlite: formatDefault literal boolean false menghasilkan 'false'", () => {
61
- assert.strictEqual(sqlite.formatDefault({ kind: 'literal', value: false }), "'false'");
62
- });
63
-
64
- test('sqlite: formatDefault literal angka menghasilkan literal tanpa quote', () => {
65
- assert.strictEqual(sqlite.formatDefault({ kind: 'literal', value: 0 }), '0');
66
- assert.strictEqual(sqlite.formatDefault({ kind: 'literal', value: 100 }), '100');
67
- });
68
-
69
- test('sqlite: formatDefault literal string menghasilkan single quote wrapped', () => {
70
- assert.strictEqual(sqlite.formatDefault({ kind: 'literal', value: 'INDONESIA' }), "'INDONESIA'");
71
- });
72
-
73
- test('sqlite: formatDefault function now menghasilkan CURRENT_TIMESTAMP', () => {
74
- assert.strictEqual(
75
- sqlite.formatDefault({ kind: 'function', name: 'now', args: [] }),
76
- 'CURRENT_TIMESTAMP'
77
- );
78
- });
79
-
80
- test('sqlite: formatDefault constant current_date menghasilkan CURRENT_DATE', () => {
81
- assert.strictEqual(
82
- sqlite.formatDefault({ kind: 'constant', value: 'current_date' }),
83
- 'CURRENT_DATE'
84
- );
85
- });
86
-
87
- test('sqlite: formatDefault throw bila function bukan whitelist', () => {
88
- assert.throws(
89
- () => sqlite.formatDefault({ kind: 'function', name: 'datetime', args: [] }),
90
- /Unknown function: 'datetime'/
91
- );
92
- });
93
-
94
- test('sqlite: formatDefault throw bila constant bukan whitelist', () => {
95
- assert.throws(
96
- () => sqlite.formatDefault({ kind: 'constant', value: 'current_time' }),
97
- /Unknown constant: 'current_time'/
98
- );
99
- });
100
-
101
- test('sqlite: quoteIdentifier identifier biasa return as-is tanpa quote', () => {
102
- assert.strictEqual(sqlite.quoteIdentifier('category'), 'category');
103
- });
104
-
105
- test('sqlite: quoteIdentifier reserved word return as-is tanpa quote', () => {
106
- assert.strictEqual(sqlite.quoteIdentifier('user'), 'user');
107
- assert.strictEqual(sqlite.quoteIdentifier('order'), 'order');
108
- });
109
-
110
- test('sqlite: quoteIdentifier throw bila identifier empty string', () => {
111
- assert.throws(() => sqlite.quoteIdentifier(''), /Identifier must be a non-empty string/);
112
- });
113
-
114
- test('sqlite: formatReferentialAction memetakan semua action ke SQL', () => {
115
- assert.strictEqual(sqlite.formatReferentialAction('cascade'), 'CASCADE');
116
- assert.strictEqual(sqlite.formatReferentialAction('restrict'), 'RESTRICT');
117
- assert.strictEqual(sqlite.formatReferentialAction('setNull'), 'SET NULL');
118
- assert.strictEqual(sqlite.formatReferentialAction('noAction'), 'NO ACTION');
119
- });
120
-
121
- test('sqlite: formatReferentialAction throw bila action tidak dikenal', () => {
122
- assert.throws(
123
- () => sqlite.formatReferentialAction('unknown'),
124
- /Unknown referential action: 'unknown'/
125
- );
126
- });
@@ -1,93 +0,0 @@
1
- 'use strict';
2
-
3
- const test = require('node:test');
4
- const assert = require('node:assert');
5
-
6
- const { loadDriver, DIALECT_TO_PACKAGE } = require('../../../../lib/dbschema-kit/driver-loader');
7
-
8
- function makeMockRequire(behavior) {
9
- return function mockRequire(packageName) {
10
- if (typeof behavior === 'function') return behavior(packageName);
11
- if (behavior && Object.prototype.hasOwnProperty.call(behavior, packageName)) {
12
- const result = behavior[packageName];
13
- if (result instanceof Error) throw result;
14
- return result;
15
- }
16
- const err = new Error(`Cannot find module '${packageName}'`);
17
- err.code = 'MODULE_NOT_FOUND';
18
- throw err;
19
- };
20
- }
21
-
22
- test('driver-loader: DIALECT_TO_PACKAGE mapping mencakup keempat dialect resmi', () => {
23
- assert.deepStrictEqual(Object.keys(DIALECT_TO_PACKAGE).sort(), [
24
- 'mysql',
25
- 'oracle',
26
- 'postgres',
27
- 'sqlite'
28
- ]);
29
- assert.strictEqual(DIALECT_TO_PACKAGE.postgres, 'pg');
30
- assert.strictEqual(DIALECT_TO_PACKAGE.mysql, 'mysql2/promise');
31
- assert.strictEqual(DIALECT_TO_PACKAGE.oracle, 'oracledb');
32
- assert.strictEqual(DIALECT_TO_PACKAGE.sqlite, 'better-sqlite3');
33
- });
34
-
35
- test('driver-loader: loadDriver return modul bila package tersedia (mock require)', () => {
36
- const fakePg = { Client: function FakeClient() {} };
37
- const _requireFn = makeMockRequire({ pg: fakePg });
38
- const result = loadDriver('postgres', { _requireFn });
39
- assert.strictEqual(result, fakePg);
40
- });
41
-
42
- test('driver-loader: loadDriver throw "Unknown dialect" untuk dialect tidak dikenal', () => {
43
- assert.throws(
44
- () => loadDriver('unknown'),
45
- /Unknown dialect: 'unknown'\. Supported: postgres, mysql, oracle, sqlite/
46
- );
47
- });
48
-
49
- test('driver-loader: loadDriver throw dengan instruksi install bila MODULE_NOT_FOUND', () => {
50
- const _requireFn = makeMockRequire({}); // semua package throw MODULE_NOT_FOUND
51
- let caught;
52
- try {
53
- loadDriver('postgres', { _requireFn });
54
- } catch (err) {
55
- caught = err;
56
- }
57
- assert.ok(caught, 'harus throw error');
58
- assert.match(caught.message, /Database driver 'pg' not found/);
59
- assert.match(caught.message, /Install with: npm install pg/);
60
- assert.strictEqual(caught.code, 'DRIVER_NOT_FOUND');
61
- assert.strictEqual(caught.dialect, 'postgres');
62
- assert.strictEqual(caught.packageName, 'pg');
63
- });
64
-
65
- test('driver-loader: instruksi install untuk mysql pakai nama package "mysql2" (bukan "mysql2/promise")', () => {
66
- const _requireFn = makeMockRequire({});
67
- let caught;
68
- try {
69
- loadDriver('mysql', { _requireFn });
70
- } catch (err) {
71
- caught = err;
72
- }
73
- assert.match(caught.message, /Database driver 'mysql2' not found/);
74
- assert.match(caught.message, /Install with: npm install mysql2/);
75
- assert.strictEqual(caught.packageName, 'mysql2');
76
- });
77
-
78
- test('driver-loader: error non-MODULE_NOT_FOUND di-bubble up apa adanya', () => {
79
- const syntaxErr = new SyntaxError('Unexpected token in driver internals');
80
- const _requireFn = makeMockRequire({ pg: syntaxErr });
81
- assert.throws(() => loadDriver('postgres', { _requireFn }), (err) => {
82
- assert.ok(err instanceof SyntaxError);
83
- assert.strictEqual(err.message, 'Unexpected token in driver internals');
84
- return true;
85
- });
86
- });
87
-
88
- test('driver-loader: loadDriver tanpa options pakai require Node default', () => {
89
- // dependency 'pg' terdaftar di package.json runtime, jadi panggilan ini harus sukses.
90
- const driver = loadDriver('postgres');
91
- assert.ok(driver, 'pg module harus loadable');
92
- assert.strictEqual(typeof driver.Client, 'function');
93
- });