pure-orm 4.0.0-4 → 4.0.0-7
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/README.md +11 -11
- package/coverage/clover.xml +367 -581
- package/coverage/coverage-final.json +18 -20
- package/coverage/lcov-report/dist/src/core.js.html +1014 -0
- package/coverage/lcov-report/dist/src/drivers/index.html +97 -0
- package/coverage/lcov-report/dist/src/drivers/pgp.js.html +240 -0
- package/coverage/lcov-report/dist/src/factory.js.html +298 -187
- package/coverage/lcov-report/dist/src/index.html +20 -33
- package/coverage/lcov-report/dist/src/index.js.html +16 -10
- package/coverage/lcov-report/dist/src/orm.js.html +645 -0
- package/coverage/lcov-report/dist/test-utils/blog/entities.js.html +108 -0
- package/coverage/lcov-report/dist/test-utils/blog/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/blog/models/article.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/blog/models/article_tag.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/blog/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/blog/models/person.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/blog/models/tag.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/blog/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/entities.js.html +114 -0
- package/coverage/lcov-report/dist/test-utils/five/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/five/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/models/line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/models/order.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/models/parcel-event.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/models/parcel-line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/models/parcel.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/five/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/nine/entities.js.html +84 -0
- package/coverage/lcov-report/dist/test-utils/nine/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/nine/models/feature-switch.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/nine/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/nine/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/entities.js.html +114 -0
- package/coverage/lcov-report/dist/test-utils/order/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/order/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/models/line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/models/order.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/models/product-variant.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/models/product.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/models/utm-source.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/entities.js.html +204 -0
- package/coverage/lcov-report/dist/test-utils/order-more/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/order-more/models/actual-product-variant.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/color.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/customer.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/gender.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/inventory-level.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/order.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/parcel-event.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/parcel-line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/parcel.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/physical-address.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/product-variant-image.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/product-variant.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/product.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/refund.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/shipment-actual-product-variant.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/shipment.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/size.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/utm-medium.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/models/utm-source.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/order-more/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/entities.js.html +114 -0
- package/coverage/lcov-report/dist/test-utils/six/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/six/models/customer.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/models/line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/models/order.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/models/parcel-line-item.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/models/parcel.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/six/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/entities.js.html +132 -0
- package/coverage/lcov-report/dist/test-utils/thirteen/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/thirteen/models/audience.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/brand.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/category.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/member.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/passion.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/product.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/recommendation-audience.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/models/recommendation.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/thirteen/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/three/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/three/results.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/twelve/entities.js.html +87 -0
- package/coverage/lcov-report/dist/test-utils/twelve/index.html +6 -6
- package/coverage/lcov-report/dist/test-utils/twelve/models/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/twelve/models/member.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/twelve/models/prompt.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/twelve/orm.js.html +1 -1
- package/coverage/lcov-report/dist/test-utils/two/index.html +1 -1
- package/coverage/lcov-report/dist/test-utils/two/results.js.html +1 -1
- package/coverage/lcov-report/index.html +47 -47
- package/coverage/lcov-report/src/core.ts.html +1527 -0
- package/coverage/lcov-report/src/drivers/index.html +97 -0
- package/coverage/lcov-report/src/drivers/pgp.ts.html +516 -0
- package/coverage/lcov-report/src/factory.ts.html +448 -247
- package/coverage/lcov-report/src/index.html +20 -33
- package/coverage/lcov-report/src/index.ts.html +23 -5
- package/coverage/lcov-report/src/orm.ts.html +954 -0
- package/coverage/lcov-report/test-utils/blog/entities.ts.html +102 -0
- package/coverage/lcov-report/test-utils/blog/index.html +6 -6
- package/coverage/lcov-report/test-utils/blog/models/article.ts.html +1 -1
- package/coverage/lcov-report/test-utils/blog/models/article_tag.ts.html +1 -1
- package/coverage/lcov-report/test-utils/blog/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/blog/models/person.ts.html +1 -1
- package/coverage/lcov-report/test-utils/blog/models/tag.ts.html +1 -1
- package/coverage/lcov-report/test-utils/blog/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/five/entities.ts.html +105 -0
- package/coverage/lcov-report/test-utils/five/index.html +2 -2
- package/coverage/lcov-report/test-utils/five/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/five/models/line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/five/models/order.ts.html +1 -1
- package/coverage/lcov-report/test-utils/five/models/parcel-event.ts.html +1 -1
- package/coverage/lcov-report/test-utils/five/models/parcel-line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/five/models/parcel.ts.html +1 -1
- package/coverage/lcov-report/test-utils/five/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/nine/entities.ts.html +75 -0
- package/coverage/lcov-report/test-utils/nine/index.html +2 -2
- package/coverage/lcov-report/test-utils/nine/models/feature-switch.ts.html +1 -1
- package/coverage/lcov-report/test-utils/nine/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/nine/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order/entities.ts.html +108 -0
- package/coverage/lcov-report/test-utils/order/index.html +2 -2
- package/coverage/lcov-report/test-utils/order/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/order/models/line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order/models/order.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order/models/product-variant.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order/models/product.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order/models/utm-source.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/entities.ts.html +198 -0
- package/coverage/lcov-report/test-utils/order-more/index.html +2 -2
- package/coverage/lcov-report/test-utils/order-more/models/actual-product-variant.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/color.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/customer.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/gender.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/inventory-level.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/order.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/parcel-event.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/parcel-line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/parcel.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/physical-address.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/product-variant-image.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/product-variant.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/product.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/refund.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/shipment-actual-product-variant.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/shipment.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/size.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/utm-medium.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/models/utm-source.ts.html +1 -1
- package/coverage/lcov-report/test-utils/order-more/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/six/entities.ts.html +105 -0
- package/coverage/lcov-report/test-utils/six/index.html +2 -2
- package/coverage/lcov-report/test-utils/six/models/customer.ts.html +1 -1
- package/coverage/lcov-report/test-utils/six/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/six/models/line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/six/models/order.ts.html +1 -1
- package/coverage/lcov-report/test-utils/six/models/parcel-line-item.ts.html +1 -1
- package/coverage/lcov-report/test-utils/six/models/parcel.ts.html +1 -1
- package/coverage/lcov-report/test-utils/six/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/entities.ts.html +123 -0
- package/coverage/lcov-report/test-utils/thirteen/index.html +2 -2
- package/coverage/lcov-report/test-utils/thirteen/models/audience.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/brand.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/category.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/member.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/passion.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/product.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/recommendation-audience.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/models/recommendation.ts.html +1 -1
- package/coverage/lcov-report/test-utils/thirteen/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/three/index.html +1 -1
- package/coverage/lcov-report/test-utils/three/results.js.html +1 -1
- package/coverage/lcov-report/test-utils/twelve/entities.ts.html +78 -0
- package/coverage/lcov-report/test-utils/twelve/index.html +2 -2
- package/coverage/lcov-report/test-utils/twelve/models/index.html +1 -1
- package/coverage/lcov-report/test-utils/twelve/models/member.ts.html +1 -1
- package/coverage/lcov-report/test-utils/twelve/models/prompt.ts.html +1 -1
- package/coverage/lcov-report/test-utils/twelve/orm.ts.html +1 -1
- package/coverage/lcov-report/test-utils/two/index.html +1 -1
- package/coverage/lcov-report/test-utils/two/results.js.html +1 -1
- package/coverage/lcov.info +713 -1142
- package/dist/example/factories/orm.d.ts +1 -46
- package/dist/example/models/employer.d.ts +1 -1
- package/dist/example/models/job.d.ts +1 -1
- package/dist/example/models/person.d.ts +1 -1
- package/dist/src/core.d.ts +66 -0
- package/dist/src/{factory.js → core.js} +43 -240
- package/dist/src/{factory.spec.d.ts → core.spec.d.ts} +0 -0
- package/dist/src/{factory.spec.js → core.spec.js} +56 -43
- package/dist/src/driver-integrations/index.d.ts +13 -0
- package/dist/src/driver-integrations/index.js +2 -0
- package/dist/src/driver-integrations/pgp.d.ts +2 -0
- package/dist/src/driver-integrations/pgp.js +57 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +5 -3
- package/dist/src/orm.d.ts +20 -0
- package/dist/src/orm.js +190 -0
- package/dist/test-utils/blog/entities.d.ts +1 -0
- package/dist/test-utils/blog/{orm.js → entities.js} +7 -6
- package/dist/test-utils/blog/{orm.ts → entities.ts} +6 -6
- package/dist/test-utils/blog/models/article.d.ts +1 -1
- package/dist/test-utils/blog/models/article_tag.d.ts +1 -1
- package/dist/test-utils/blog/models/person.d.ts +1 -1
- package/dist/test-utils/blog/models/tag.d.ts +1 -1
- package/dist/test-utils/five/entities.d.ts +6 -0
- package/dist/test-utils/five/{orm.js → entities.js} +8 -12
- package/dist/test-utils/five/{orm.ts → entities.ts} +7 -12
- package/dist/test-utils/five/models/line-item.d.ts +1 -1
- package/dist/test-utils/five/models/order.d.ts +1 -1
- package/dist/test-utils/five/models/parcel-event.d.ts +1 -1
- package/dist/test-utils/five/models/parcel-line-item.d.ts +1 -1
- package/dist/test-utils/five/models/parcel.d.ts +1 -1
- package/dist/test-utils/nine/entities.d.ts +6 -0
- package/dist/test-utils/nine/entities.js +5 -0
- package/dist/test-utils/nine/entities.ts +2 -0
- package/dist/test-utils/nine/models/feature-switch.d.ts +1 -1
- package/dist/test-utils/order/entities.d.ts +26 -0
- package/dist/test-utils/order/{orm.js → entities.js} +8 -12
- package/{test-utils/order/orm.ts → dist/test-utils/order/entities.ts} +7 -12
- package/dist/test-utils/order/models/line-item.d.ts +1 -1
- package/dist/test-utils/order/models/order.d.ts +1 -1
- package/dist/test-utils/order/models/product-variant.d.ts +1 -1
- package/dist/test-utils/order/models/product.d.ts +1 -1
- package/dist/test-utils/order/models/utm-source.d.ts +1 -1
- package/dist/test-utils/order-more/entities.d.ts +6 -0
- package/dist/test-utils/order-more/{orm.js → entities.js} +23 -27
- package/dist/test-utils/order-more/{orm.ts → entities.ts} +22 -27
- package/dist/test-utils/order-more/models/actual-product-variant.d.ts +1 -1
- package/dist/test-utils/order-more/models/color.d.ts +1 -1
- package/dist/test-utils/order-more/models/customer.d.ts +1 -1
- package/dist/test-utils/order-more/models/gender.d.ts +1 -1
- package/dist/test-utils/order-more/models/inventory-level.d.ts +1 -1
- package/dist/test-utils/order-more/models/line-item.d.ts +1 -1
- package/dist/test-utils/order-more/models/order.d.ts +1 -1
- package/dist/test-utils/order-more/models/parcel-event.d.ts +1 -1
- package/dist/test-utils/order-more/models/parcel-line-item.d.ts +1 -1
- package/dist/test-utils/order-more/models/parcel.d.ts +1 -1
- package/dist/test-utils/order-more/models/physical-address.d.ts +1 -1
- package/dist/test-utils/order-more/models/product-variant-image.d.ts +1 -1
- package/dist/test-utils/order-more/models/product-variant.d.ts +1 -1
- package/dist/test-utils/order-more/models/product.d.ts +1 -1
- package/dist/test-utils/order-more/models/refund.d.ts +1 -1
- package/dist/test-utils/order-more/models/shipment-actual-product-variant.d.ts +1 -1
- package/dist/test-utils/order-more/models/shipment.d.ts +1 -1
- package/dist/test-utils/order-more/models/size.d.ts +1 -1
- package/dist/test-utils/order-more/models/utm-medium.d.ts +1 -1
- package/dist/test-utils/order-more/models/utm-source.d.ts +1 -1
- package/dist/test-utils/six/entities.d.ts +6 -0
- package/dist/test-utils/six/{orm.js → entities.js} +8 -12
- package/{test-utils/six/orm.ts → dist/test-utils/six/entities.ts} +7 -12
- package/dist/test-utils/six/models/customer.d.ts +1 -1
- package/dist/test-utils/six/models/line-item.d.ts +1 -1
- package/dist/test-utils/six/models/order.d.ts +1 -1
- package/dist/test-utils/six/models/parcel-line-item.d.ts +1 -1
- package/dist/test-utils/six/models/parcel.d.ts +1 -1
- package/dist/test-utils/thirteen/entities.d.ts +6 -0
- package/dist/test-utils/thirteen/{orm.js → entities.js} +11 -15
- package/dist/test-utils/thirteen/{orm.ts → entities.ts} +10 -15
- package/dist/test-utils/thirteen/models/audience.d.ts +1 -1
- package/dist/test-utils/thirteen/models/brand.d.ts +1 -1
- package/dist/test-utils/thirteen/models/category.d.ts +1 -1
- package/dist/test-utils/thirteen/models/member.d.ts +1 -1
- package/dist/test-utils/thirteen/models/passion.d.ts +1 -1
- package/dist/test-utils/thirteen/models/product.d.ts +1 -1
- package/dist/test-utils/thirteen/models/recommendation-audience.d.ts +1 -1
- package/dist/test-utils/thirteen/models/recommendation.d.ts +1 -1
- package/dist/test-utils/twelve/entities.d.ts +6 -0
- package/dist/test-utils/twelve/entities.js +6 -0
- package/dist/test-utils/twelve/entities.ts +3 -0
- package/dist/test-utils/twelve/models/member.d.ts +1 -1
- package/dist/test-utils/twelve/models/prompt.d.ts +1 -1
- package/package.json +4 -3
- package/src/{factory.spec.ts → core.spec.ts} +55 -41
- package/src/{factory.ts → core.ts} +86 -339
- package/src/driver-integrations/index.ts +56 -0
- package/src/driver-integrations/pgp.ts +92 -0
- package/src/index.ts +5 -3
- package/src/orm.ts +291 -0
- package/test-utils/blog/{orm.ts → entities.ts} +6 -6
- package/test-utils/five/{orm.ts → entities.ts} +7 -12
- package/test-utils/nine/entities.ts +2 -0
- package/{dist/test-utils/order/orm.ts → test-utils/order/entities.ts} +7 -12
- package/test-utils/order-more/{orm.ts → entities.ts} +22 -27
- package/{dist/test-utils/six/orm.ts → test-utils/six/entities.ts} +7 -12
- package/test-utils/thirteen/{orm.ts → entities.ts} +10 -15
- package/test-utils/twelve/entities.ts +3 -0
- package/dist/src/factory.d.ts +0 -99
- package/dist/test-utils/blog/orm.d.ts +0 -2
- package/dist/test-utils/five/orm.d.ts +0 -47
- package/dist/test-utils/nine/orm.d.ts +0 -47
- package/dist/test-utils/nine/orm.js +0 -9
- package/dist/test-utils/nine/orm.ts +0 -7
- package/dist/test-utils/order/orm.d.ts +0 -47
- package/dist/test-utils/order-more/orm.d.ts +0 -47
- package/dist/test-utils/six/orm.d.ts +0 -47
- package/dist/test-utils/thirteen/orm.d.ts +0 -47
- package/dist/test-utils/twelve/orm.d.ts +0 -47
- package/dist/test-utils/twelve/orm.js +0 -10
- package/dist/test-utils/twelve/orm.ts +0 -8
- package/test-utils/nine/orm.ts +0 -7
- package/test-utils/twelve/orm.ts +0 -8
|
@@ -20,24 +20,24 @@
|
|
|
20
20
|
</h1>
|
|
21
21
|
<div class='clearfix'>
|
|
22
22
|
<div class='fl pad1y space-right2'>
|
|
23
|
-
<span class="strong">
|
|
23
|
+
<span class="strong">63.73% </span>
|
|
24
24
|
<span class="quiet">Statements</span>
|
|
25
|
-
<span class='fraction'>
|
|
25
|
+
<span class='fraction'>181/284</span>
|
|
26
26
|
</div>
|
|
27
27
|
<div class='fl pad1y space-right2'>
|
|
28
|
-
<span class="strong">
|
|
28
|
+
<span class="strong">58.12% </span>
|
|
29
29
|
<span class="quiet">Branches</span>
|
|
30
|
-
<span class='fraction'>
|
|
30
|
+
<span class='fraction'>68/117</span>
|
|
31
31
|
</div>
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">46.
|
|
33
|
+
<span class="strong">46.88% </span>
|
|
34
34
|
<span class="quiet">Functions</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>45/96</span>
|
|
36
36
|
</div>
|
|
37
37
|
<div class='fl pad1y space-right2'>
|
|
38
|
-
<span class="strong">62.
|
|
38
|
+
<span class="strong">62.91% </span>
|
|
39
39
|
<span class="quiet">Lines</span>
|
|
40
|
-
<span class='fraction'>
|
|
40
|
+
<span class='fraction'>173/275</span>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
43
|
<p class="quiet">
|
|
@@ -785,9 +785,74 @@
|
|
|
785
785
|
<a name='L737'></a><a href='#L737'>737</a>
|
|
786
786
|
<a name='L738'></a><a href='#L738'>738</a>
|
|
787
787
|
<a name='L739'></a><a href='#L739'>739</a>
|
|
788
|
-
<a name='L740'></a><a href='#L740'>740</a
|
|
789
|
-
<
|
|
790
|
-
<
|
|
788
|
+
<a name='L740'></a><a href='#L740'>740</a>
|
|
789
|
+
<a name='L741'></a><a href='#L741'>741</a>
|
|
790
|
+
<a name='L742'></a><a href='#L742'>742</a>
|
|
791
|
+
<a name='L743'></a><a href='#L743'>743</a>
|
|
792
|
+
<a name='L744'></a><a href='#L744'>744</a>
|
|
793
|
+
<a name='L745'></a><a href='#L745'>745</a>
|
|
794
|
+
<a name='L746'></a><a href='#L746'>746</a>
|
|
795
|
+
<a name='L747'></a><a href='#L747'>747</a>
|
|
796
|
+
<a name='L748'></a><a href='#L748'>748</a>
|
|
797
|
+
<a name='L749'></a><a href='#L749'>749</a>
|
|
798
|
+
<a name='L750'></a><a href='#L750'>750</a>
|
|
799
|
+
<a name='L751'></a><a href='#L751'>751</a>
|
|
800
|
+
<a name='L752'></a><a href='#L752'>752</a>
|
|
801
|
+
<a name='L753'></a><a href='#L753'>753</a>
|
|
802
|
+
<a name='L754'></a><a href='#L754'>754</a>
|
|
803
|
+
<a name='L755'></a><a href='#L755'>755</a>
|
|
804
|
+
<a name='L756'></a><a href='#L756'>756</a>
|
|
805
|
+
<a name='L757'></a><a href='#L757'>757</a>
|
|
806
|
+
<a name='L758'></a><a href='#L758'>758</a>
|
|
807
|
+
<a name='L759'></a><a href='#L759'>759</a>
|
|
808
|
+
<a name='L760'></a><a href='#L760'>760</a>
|
|
809
|
+
<a name='L761'></a><a href='#L761'>761</a>
|
|
810
|
+
<a name='L762'></a><a href='#L762'>762</a>
|
|
811
|
+
<a name='L763'></a><a href='#L763'>763</a>
|
|
812
|
+
<a name='L764'></a><a href='#L764'>764</a>
|
|
813
|
+
<a name='L765'></a><a href='#L765'>765</a>
|
|
814
|
+
<a name='L766'></a><a href='#L766'>766</a>
|
|
815
|
+
<a name='L767'></a><a href='#L767'>767</a>
|
|
816
|
+
<a name='L768'></a><a href='#L768'>768</a>
|
|
817
|
+
<a name='L769'></a><a href='#L769'>769</a>
|
|
818
|
+
<a name='L770'></a><a href='#L770'>770</a>
|
|
819
|
+
<a name='L771'></a><a href='#L771'>771</a>
|
|
820
|
+
<a name='L772'></a><a href='#L772'>772</a>
|
|
821
|
+
<a name='L773'></a><a href='#L773'>773</a>
|
|
822
|
+
<a name='L774'></a><a href='#L774'>774</a>
|
|
823
|
+
<a name='L775'></a><a href='#L775'>775</a>
|
|
824
|
+
<a name='L776'></a><a href='#L776'>776</a>
|
|
825
|
+
<a name='L777'></a><a href='#L777'>777</a>
|
|
826
|
+
<a name='L778'></a><a href='#L778'>778</a>
|
|
827
|
+
<a name='L779'></a><a href='#L779'>779</a>
|
|
828
|
+
<a name='L780'></a><a href='#L780'>780</a>
|
|
829
|
+
<a name='L781'></a><a href='#L781'>781</a>
|
|
830
|
+
<a name='L782'></a><a href='#L782'>782</a>
|
|
831
|
+
<a name='L783'></a><a href='#L783'>783</a>
|
|
832
|
+
<a name='L784'></a><a href='#L784'>784</a>
|
|
833
|
+
<a name='L785'></a><a href='#L785'>785</a>
|
|
834
|
+
<a name='L786'></a><a href='#L786'>786</a>
|
|
835
|
+
<a name='L787'></a><a href='#L787'>787</a>
|
|
836
|
+
<a name='L788'></a><a href='#L788'>788</a>
|
|
837
|
+
<a name='L789'></a><a href='#L789'>789</a>
|
|
838
|
+
<a name='L790'></a><a href='#L790'>790</a>
|
|
839
|
+
<a name='L791'></a><a href='#L791'>791</a>
|
|
840
|
+
<a name='L792'></a><a href='#L792'>792</a>
|
|
841
|
+
<a name='L793'></a><a href='#L793'>793</a>
|
|
842
|
+
<a name='L794'></a><a href='#L794'>794</a>
|
|
843
|
+
<a name='L795'></a><a href='#L795'>795</a>
|
|
844
|
+
<a name='L796'></a><a href='#L796'>796</a>
|
|
845
|
+
<a name='L797'></a><a href='#L797'>797</a>
|
|
846
|
+
<a name='L798'></a><a href='#L798'>798</a>
|
|
847
|
+
<a name='L799'></a><a href='#L799'>799</a>
|
|
848
|
+
<a name='L800'></a><a href='#L800'>800</a>
|
|
849
|
+
<a name='L801'></a><a href='#L801'>801</a>
|
|
850
|
+
<a name='L802'></a><a href='#L802'>802</a>
|
|
851
|
+
<a name='L803'></a><a href='#L803'>803</a>
|
|
852
|
+
<a name='L804'></a><a href='#L804'>804</a>
|
|
853
|
+
<a name='L805'></a><a href='#L805'>805</a>
|
|
854
|
+
<a name='L806'></a><a href='#L806'>806</a>
|
|
855
|
+
<a name='L807'></a><a href='#L807'>807</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
791
856
|
<span class="cline-any cline-neutral"> </span>
|
|
792
857
|
<span class="cline-any cline-neutral"> </span>
|
|
793
858
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -848,10 +913,6 @@
|
|
|
848
913
|
<span class="cline-any cline-neutral"> </span>
|
|
849
914
|
<span class="cline-any cline-neutral"> </span>
|
|
850
915
|
<span class="cline-any cline-yes">1x</span>
|
|
851
|
-
<span class="cline-any cline-neutral"> </span>
|
|
852
|
-
<span class="cline-any cline-neutral"> </span>
|
|
853
|
-
<span class="cline-any cline-neutral"> </span>
|
|
854
|
-
<span class="cline-any cline-neutral"> </span>
|
|
855
916
|
<span class="cline-any cline-yes">8x</span>
|
|
856
917
|
<span class="cline-any cline-neutral"> </span>
|
|
857
918
|
<span class="cline-any cline-yes">50x</span>
|
|
@@ -949,15 +1010,6 @@
|
|
|
949
1010
|
<span class="cline-any cline-yes">38207x</span>
|
|
950
1011
|
<span class="cline-any cline-neutral"> </span>
|
|
951
1012
|
<span class="cline-any cline-neutral"> </span>
|
|
952
|
-
<span class="cline-any cline-yes">8x</span>
|
|
953
|
-
<span class="cline-any cline-no"> </span>
|
|
954
|
-
<span class="cline-any cline-no"> </span>
|
|
955
|
-
<span class="cline-any cline-no"> </span>
|
|
956
|
-
<span class="cline-any cline-neutral"> </span>
|
|
957
|
-
<span class="cline-any cline-neutral"> </span>
|
|
958
|
-
<span class="cline-any cline-no"> </span>
|
|
959
|
-
<span class="cline-any cline-neutral"> </span>
|
|
960
|
-
<span class="cline-any cline-neutral"> </span>
|
|
961
1013
|
<span class="cline-any cline-neutral"> </span>
|
|
962
1014
|
<span class="cline-any cline-neutral"> </span>
|
|
963
1015
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -1167,14 +1219,15 @@
|
|
|
1167
1219
|
<span class="cline-any cline-yes">3703x</span>
|
|
1168
1220
|
<span class="cline-any cline-yes">3703x</span>
|
|
1169
1221
|
<span class="cline-any cline-yes">3703x</span>
|
|
1222
|
+
<span class="cline-any cline-no"> </span>
|
|
1223
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1224
|
+
<span class="cline-any cline-yes">3703x</span>
|
|
1170
1225
|
<span class="cline-any cline-yes">3703x</span>
|
|
1171
1226
|
<span class="cline-any cline-yes">3703x</span>
|
|
1172
1227
|
<span class="cline-any cline-neutral"> </span>
|
|
1173
1228
|
<span class="cline-any cline-neutral"> </span>
|
|
1174
1229
|
<span class="cline-any cline-neutral"> </span>
|
|
1175
1230
|
<span class="cline-any cline-yes">8x</span>
|
|
1176
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1177
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1178
1231
|
<span class="cline-any cline-yes">13x</span>
|
|
1179
1232
|
<span class="cline-any cline-yes">13x</span>
|
|
1180
1233
|
<span class="cline-any cline-yes">13x</span>
|
|
@@ -1186,11 +1239,25 @@
|
|
|
1186
1239
|
<span class="cline-any cline-neutral"> </span>
|
|
1187
1240
|
<span class="cline-any cline-neutral"> </span>
|
|
1188
1241
|
<span class="cline-any cline-yes">8x</span>
|
|
1189
|
-
<span class="cline-any cline-
|
|
1242
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1243
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1244
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1245
|
+
<span class="cline-any cline-no"> </span>
|
|
1246
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1247
|
+
<span class="cline-any cline-no"> </span>
|
|
1248
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1249
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1250
|
+
<span class="cline-any cline-no"> </span>
|
|
1251
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1252
|
+
<span class="cline-any cline-no"> </span>
|
|
1253
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1254
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1255
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1190
1256
|
<span class="cline-any cline-yes">4x</span>
|
|
1191
1257
|
<span class="cline-any cline-no"> </span>
|
|
1192
1258
|
<span class="cline-any cline-neutral"> </span>
|
|
1193
1259
|
<span class="cline-any cline-yes">4x</span>
|
|
1260
|
+
<span class="cline-any cline-yes">4x</span>
|
|
1194
1261
|
<span class="cline-any cline-no"> </span>
|
|
1195
1262
|
<span class="cline-any cline-yes">4x</span>
|
|
1196
1263
|
<span class="cline-any cline-no"> </span>
|
|
@@ -1205,6 +1272,11 @@
|
|
|
1205
1272
|
<span class="cline-any cline-no"> </span>
|
|
1206
1273
|
<span class="cline-any cline-neutral"> </span>
|
|
1207
1274
|
<span class="cline-any cline-no"> </span>
|
|
1275
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1276
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1277
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1278
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1279
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1208
1280
|
<span class="cline-any cline-no"> </span>
|
|
1209
1281
|
<span class="cline-any cline-no"> </span>
|
|
1210
1282
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -1214,35 +1286,84 @@
|
|
|
1214
1286
|
<span class="cline-any cline-yes">8x</span>
|
|
1215
1287
|
<span class="cline-any cline-neutral"> </span>
|
|
1216
1288
|
<span class="cline-any cline-neutral"> </span>
|
|
1289
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1290
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1291
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1292
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1293
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1294
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1295
|
+
<span class="cline-any cline-yes">50x</span>
|
|
1296
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1297
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1298
|
+
<span class="cline-any cline-yes">50x</span>
|
|
1299
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1300
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1301
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1302
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1303
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1304
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1305
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1306
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1307
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1308
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1309
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1310
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1311
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1312
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1313
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1314
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1315
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1316
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1217
1317
|
<span class="cline-any cline-no"> </span>
|
|
1218
1318
|
<span class="cline-any cline-no"> </span>
|
|
1219
1319
|
<span class="cline-any cline-no"> </span>
|
|
1220
1320
|
<span class="cline-any cline-neutral"> </span>
|
|
1321
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1221
1322
|
<span class="cline-any cline-no"> </span>
|
|
1222
1323
|
<span class="cline-any cline-neutral"> </span>
|
|
1223
1324
|
<span class="cline-any cline-neutral"> </span>
|
|
1224
|
-
<span class="cline-any cline-yes">8x</span>
|
|
1225
|
-
<span class="cline-any cline-no"> </span>
|
|
1226
1325
|
<span class="cline-any cline-neutral"> </span>
|
|
1227
1326
|
<span class="cline-any cline-neutral"> </span>
|
|
1228
|
-
<span class="cline-any cline-
|
|
1327
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1328
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1329
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1229
1330
|
<span class="cline-any cline-neutral"> </span>
|
|
1230
1331
|
<span class="cline-any cline-neutral"> </span>
|
|
1231
1332
|
<span class="cline-any cline-neutral"> </span>
|
|
1232
|
-
<span class="cline-any cline-no"> </span>
|
|
1233
1333
|
<span class="cline-any cline-neutral"> </span>
|
|
1234
1334
|
<span class="cline-any cline-no"> </span>
|
|
1235
1335
|
<span class="cline-any cline-neutral"> </span>
|
|
1236
1336
|
<span class="cline-any cline-no"> </span>
|
|
1237
1337
|
<span class="cline-any cline-neutral"> </span>
|
|
1338
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1339
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1340
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1341
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1342
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1343
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1344
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1238
1345
|
<span class="cline-any cline-no"> </span>
|
|
1346
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1239
1347
|
<span class="cline-any cline-no"> </span>
|
|
1348
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1349
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1350
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1351
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1352
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1353
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1354
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1355
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1240
1356
|
<span class="cline-any cline-no"> </span>
|
|
1241
1357
|
<span class="cline-any cline-neutral"> </span>
|
|
1242
1358
|
<span class="cline-any cline-no"> </span>
|
|
1243
1359
|
<span class="cline-any cline-neutral"> </span>
|
|
1244
1360
|
<span class="cline-any cline-neutral"> </span>
|
|
1361
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1245
1362
|
<span class="cline-any cline-yes">8x</span>
|
|
1363
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1364
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1365
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1366
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1246
1367
|
<span class="cline-any cline-no"> </span>
|
|
1247
1368
|
<span class="cline-any cline-neutral"> </span>
|
|
1248
1369
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -1251,151 +1372,182 @@
|
|
|
1251
1372
|
<span class="cline-any cline-neutral"> </span>
|
|
1252
1373
|
<span class="cline-any cline-neutral"> </span>
|
|
1253
1374
|
<span class="cline-any cline-neutral"> </span>
|
|
1254
|
-
<span class="cline-any cline-no"> </span>
|
|
1255
1375
|
<span class="cline-any cline-neutral"> </span>
|
|
1256
|
-
<span class="cline-any cline-no"> </span>
|
|
1257
|
-
<span class="cline-any cline-no"> </span>
|
|
1258
|
-
<span class="cline-any cline-no"> </span>
|
|
1259
1376
|
<span class="cline-any cline-neutral"> </span>
|
|
1260
|
-
<span class="cline-any cline-
|
|
1377
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1378
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1379
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1380
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1381
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1261
1382
|
<span class="cline-any cline-neutral"> </span>
|
|
1262
1383
|
<span class="cline-any cline-no"> </span>
|
|
1263
|
-
<span class="cline-any cline-
|
|
1384
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1264
1385
|
<span class="cline-any cline-no"> </span>
|
|
1265
1386
|
<span class="cline-any cline-neutral"> </span>
|
|
1266
1387
|
<span class="cline-any cline-neutral"> </span>
|
|
1388
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1267
1389
|
<span class="cline-any cline-yes">8x</span>
|
|
1268
|
-
<span class="cline-any cline-no"> </span>
|
|
1269
1390
|
<span class="cline-any cline-neutral"> </span>
|
|
1270
|
-
<span class="cline-any cline-no"> </span>
|
|
1271
1391
|
<span class="cline-any cline-neutral"> </span>
|
|
1272
1392
|
<span class="cline-any cline-neutral"> </span>
|
|
1273
1393
|
<span class="cline-any cline-neutral"> </span>
|
|
1274
1394
|
<span class="cline-any cline-neutral"> </span>
|
|
1275
1395
|
<span class="cline-any cline-neutral"> </span>
|
|
1276
|
-
<span class="cline-any cline-no"> </span>
|
|
1277
|
-
<span class="cline-any cline-no"> </span>
|
|
1278
1396
|
<span class="cline-any cline-neutral"> </span>
|
|
1279
|
-
<span class="cline-any cline-no"> </span>
|
|
1280
1397
|
<span class="cline-any cline-neutral"> </span>
|
|
1281
|
-
<span class="cline-any cline-no"> </span>
|
|
1282
1398
|
<span class="cline-any cline-neutral"> </span>
|
|
1283
1399
|
<span class="cline-any cline-neutral"> </span>
|
|
1284
1400
|
<span class="cline-any cline-neutral"> </span>
|
|
1285
|
-
<span class="cline-any cline-
|
|
1286
|
-
<span class="cline-any cline-
|
|
1401
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1402
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1403
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1404
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1405
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1406
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1407
|
+
<span class="cline-any cline-yes">1x</span>
|
|
1287
1408
|
<span class="cline-any cline-neutral"> </span>
|
|
1288
1409
|
<span class="cline-any cline-neutral"> </span>
|
|
1289
1410
|
<span class="cline-any cline-neutral"> </span>
|
|
1290
1411
|
<span class="cline-any cline-neutral"> </span>
|
|
1291
1412
|
<span class="cline-any cline-yes">8x</span>
|
|
1292
|
-
<span class="cline-any cline-no"> </span>
|
|
1293
1413
|
<span class="cline-any cline-neutral"> </span>
|
|
1294
|
-
<span class="cline-any cline-no"> </span>
|
|
1295
1414
|
<span class="cline-any cline-neutral"> </span>
|
|
1296
1415
|
<span class="cline-any cline-neutral"> </span>
|
|
1297
1416
|
<span class="cline-any cline-neutral"> </span>
|
|
1298
1417
|
<span class="cline-any cline-neutral"> </span>
|
|
1299
1418
|
<span class="cline-any cline-neutral"> </span>
|
|
1300
|
-
<span class="cline-any cline-no"> </span>
|
|
1301
|
-
<span class="cline-any cline-no"> </span>
|
|
1302
1419
|
<span class="cline-any cline-neutral"> </span>
|
|
1420
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1421
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1422
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1303
1423
|
<span class="cline-any cline-no"> </span>
|
|
1304
1424
|
<span class="cline-any cline-neutral"> </span>
|
|
1425
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1426
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1305
1427
|
<span class="cline-any cline-no"> </span>
|
|
1306
1428
|
<span class="cline-any cline-neutral"> </span>
|
|
1307
1429
|
<span class="cline-any cline-neutral"> </span>
|
|
1308
1430
|
<span class="cline-any cline-neutral"> </span>
|
|
1431
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1432
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1433
|
+
<span class="cline-any cline-no"> </span>
|
|
1434
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1309
1435
|
<span class="cline-any cline-no"> </span>
|
|
1310
1436
|
<span class="cline-any cline-neutral"> </span>
|
|
1311
1437
|
<span class="cline-any cline-neutral"> </span>
|
|
1312
1438
|
<span class="cline-any cline-no"> </span>
|
|
1313
1439
|
<span class="cline-any cline-neutral"> </span>
|
|
1440
|
+
<span class="cline-any cline-no"> </span>
|
|
1441
|
+
<span class="cline-any cline-no"> </span>
|
|
1442
|
+
<span class="cline-any cline-no"> </span>
|
|
1314
1443
|
<span class="cline-any cline-neutral"> </span>
|
|
1315
1444
|
<span class="cline-any cline-no"> </span>
|
|
1316
1445
|
<span class="cline-any cline-neutral"> </span>
|
|
1317
1446
|
<span class="cline-any cline-neutral"> </span>
|
|
1318
1447
|
<span class="cline-any cline-yes">8x</span>
|
|
1319
1448
|
<span class="cline-any cline-no"> </span>
|
|
1320
|
-
<span class="cline-any cline-
|
|
1449
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1450
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1321
1451
|
<span class="cline-any cline-neutral"> </span>
|
|
1322
1452
|
<span class="cline-any cline-no"> </span>
|
|
1323
1453
|
<span class="cline-any cline-neutral"> </span>
|
|
1324
1454
|
<span class="cline-any cline-neutral"> </span>
|
|
1325
1455
|
<span class="cline-any cline-neutral"> </span>
|
|
1456
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1457
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1458
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1326
1459
|
<span class="cline-any cline-no"> </span>
|
|
1327
1460
|
<span class="cline-any cline-neutral"> </span>
|
|
1328
1461
|
<span class="cline-any cline-no"> </span>
|
|
1329
1462
|
<span class="cline-any cline-no"> </span>
|
|
1463
|
+
<span class="cline-any cline-no"> </span>
|
|
1330
1464
|
<span class="cline-any cline-neutral"> </span>
|
|
1331
1465
|
<span class="cline-any cline-neutral"> </span>
|
|
1466
|
+
<span class="cline-any cline-no"> </span>
|
|
1332
1467
|
<span class="cline-any cline-neutral"> </span>
|
|
1333
1468
|
<span class="cline-any cline-no"> </span>
|
|
1469
|
+
<span class="cline-any cline-no"> </span>
|
|
1470
|
+
<span class="cline-any cline-no"> </span>
|
|
1334
1471
|
<span class="cline-any cline-neutral"> </span>
|
|
1335
1472
|
<span class="cline-any cline-neutral"> </span>
|
|
1336
1473
|
<span class="cline-any cline-yes">8x</span>
|
|
1337
1474
|
<span class="cline-any cline-no"> </span>
|
|
1338
1475
|
<span class="cline-any cline-neutral"> </span>
|
|
1339
1476
|
<span class="cline-any cline-neutral"> </span>
|
|
1477
|
+
<span class="cline-any cline-no"> </span>
|
|
1340
1478
|
<span class="cline-any cline-neutral"> </span>
|
|
1341
1479
|
<span class="cline-any cline-neutral"> </span>
|
|
1342
1480
|
<span class="cline-any cline-neutral"> </span>
|
|
1343
1481
|
<span class="cline-any cline-neutral"> </span>
|
|
1344
1482
|
<span class="cline-any cline-neutral"> </span>
|
|
1483
|
+
<span class="cline-any cline-no"> </span>
|
|
1484
|
+
<span class="cline-any cline-no"> </span>
|
|
1345
1485
|
<span class="cline-any cline-neutral"> </span>
|
|
1486
|
+
<span class="cline-any cline-no"> </span>
|
|
1346
1487
|
<span class="cline-any cline-neutral"> </span>
|
|
1347
|
-
<span class="cline-any cline-yes">8x</span>
|
|
1348
1488
|
<span class="cline-any cline-neutral"> </span>
|
|
1489
|
+
<span class="cline-any cline-no"> </span>
|
|
1349
1490
|
<span class="cline-any cline-neutral"> </span>
|
|
1350
1491
|
<span class="cline-any cline-neutral"> </span>
|
|
1351
1492
|
<span class="cline-any cline-neutral"> </span>
|
|
1352
1493
|
<span class="cline-any cline-no"> </span>
|
|
1353
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1354
1494
|
<span class="cline-any cline-no"> </span>
|
|
1355
1495
|
<span class="cline-any cline-neutral"> </span>
|
|
1356
1496
|
<span class="cline-any cline-neutral"> </span>
|
|
1357
1497
|
<span class="cline-any cline-neutral"> </span>
|
|
1498
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1358
1499
|
<span class="cline-any cline-yes">8x</span>
|
|
1500
|
+
<span class="cline-any cline-no"> </span>
|
|
1501
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1502
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1503
|
+
<span class="cline-any cline-no"> </span>
|
|
1504
|
+
<span class="cline-any cline-neutral"> </span>
|
|
1359
1505
|
<span class="cline-any cline-neutral"> </span>
|
|
1360
1506
|
<span class="cline-any cline-neutral"> </span>
|
|
1361
1507
|
<span class="cline-any cline-neutral"> </span>
|
|
1362
1508
|
<span class="cline-any cline-neutral"> </span>
|
|
1363
1509
|
<span class="cline-any cline-no"> </span>
|
|
1510
|
+
<span class="cline-any cline-no"> </span>
|
|
1364
1511
|
<span class="cline-any cline-neutral"> </span>
|
|
1365
1512
|
<span class="cline-any cline-no"> </span>
|
|
1366
1513
|
<span class="cline-any cline-neutral"> </span>
|
|
1367
1514
|
<span class="cline-any cline-neutral"> </span>
|
|
1515
|
+
<span class="cline-any cline-no"> </span>
|
|
1368
1516
|
<span class="cline-any cline-neutral"> </span>
|
|
1369
|
-
<span class="cline-any cline-yes">8x</span>
|
|
1370
1517
|
<span class="cline-any cline-neutral"> </span>
|
|
1371
1518
|
<span class="cline-any cline-neutral"> </span>
|
|
1519
|
+
<span class="cline-any cline-no"> </span>
|
|
1372
1520
|
<span class="cline-any cline-neutral"> </span>
|
|
1373
1521
|
<span class="cline-any cline-neutral"> </span>
|
|
1374
1522
|
<span class="cline-any cline-no"> </span>
|
|
1375
1523
|
<span class="cline-any cline-neutral"> </span>
|
|
1376
|
-
<span class="cline-any cline-no"> </span>
|
|
1377
1524
|
<span class="cline-any cline-neutral"> </span>
|
|
1525
|
+
<span class="cline-any cline-no"> </span>
|
|
1378
1526
|
<span class="cline-any cline-neutral"> </span>
|
|
1379
1527
|
<span class="cline-any cline-neutral"> </span>
|
|
1380
1528
|
<span class="cline-any cline-yes">8x</span>
|
|
1529
|
+
<span class="cline-any cline-no"> </span>
|
|
1530
|
+
<span class="cline-any cline-no"> </span>
|
|
1381
1531
|
<span class="cline-any cline-neutral"> </span>
|
|
1532
|
+
<span class="cline-any cline-no"> </span>
|
|
1382
1533
|
<span class="cline-any cline-neutral"> </span>
|
|
1383
1534
|
<span class="cline-any cline-neutral"> </span>
|
|
1384
1535
|
<span class="cline-any cline-neutral"> </span>
|
|
1385
1536
|
<span class="cline-any cline-no"> </span>
|
|
1386
1537
|
<span class="cline-any cline-neutral"> </span>
|
|
1387
1538
|
<span class="cline-any cline-no"> </span>
|
|
1539
|
+
<span class="cline-any cline-no"> </span>
|
|
1388
1540
|
<span class="cline-any cline-neutral"> </span>
|
|
1389
1541
|
<span class="cline-any cline-neutral"> </span>
|
|
1390
1542
|
<span class="cline-any cline-neutral"> </span>
|
|
1391
|
-
<span class="cline-any cline-
|
|
1543
|
+
<span class="cline-any cline-no"> </span>
|
|
1392
1544
|
<span class="cline-any cline-neutral"> </span>
|
|
1393
1545
|
<span class="cline-any cline-neutral"> </span>
|
|
1546
|
+
<span class="cline-any cline-yes">8x</span>
|
|
1547
|
+
<span class="cline-any cline-no"> </span>
|
|
1394
1548
|
<span class="cline-any cline-neutral"> </span>
|
|
1395
1549
|
<span class="cline-any cline-neutral"> </span>
|
|
1396
|
-
<span class="cline-any cline-no"> </span>
|
|
1397
1550
|
<span class="cline-any cline-neutral"> </span>
|
|
1398
|
-
<span class="cline-any cline-no"> </span>
|
|
1399
1551
|
<span class="cline-any cline-neutral"> </span>
|
|
1400
1552
|
<span class="cline-any cline-neutral"> </span>
|
|
1401
1553
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -1506,24 +1658,6 @@
|
|
|
1506
1658
|
<span class="cline-any cline-neutral"> </span>
|
|
1507
1659
|
<span class="cline-any cline-neutral"> </span>
|
|
1508
1660
|
<span class="cline-any cline-neutral"> </span>
|
|
1509
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1510
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1511
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1512
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1513
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1514
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1515
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1516
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1517
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1518
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1519
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1520
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1521
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1522
|
-
<span class="cline-any cline-yes">50x</span>
|
|
1523
|
-
<span class="cline-any cline-yes">50x</span>
|
|
1524
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1525
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1526
|
-
<span class="cline-any cline-neutral"> </span>
|
|
1527
1661
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const camelCase = require('camelcase');
|
|
1528
1662
|
|
|
1529
1663
|
export interface IColumnData {
|
|
@@ -1580,19 +1714,13 @@ export interface IEntityInternal<T extends IModel> {
|
|
|
1580
1714
|
}
|
|
1581
1715
|
export type IEntitiesInternal<T extends IModel> = Array<IEntityInternal<T>>;
|
|
1582
1716
|
|
|
1583
|
-
export interface
|
|
1584
|
-
entities: IEntities<
|
|
1585
|
-
db: any;
|
|
1586
|
-
logError?: (err: Error) => void;
|
|
1717
|
+
export interface CreateOrmOptions {
|
|
1718
|
+
entities: IEntities<IModel>;
|
|
1587
1719
|
}
|
|
1588
1720
|
|
|
1589
|
-
export const
|
|
1590
|
-
entities: externalEntities
|
|
1591
|
-
|
|
1592
|
-
logError
|
|
1593
|
-
}: CreateOptions) => {
|
|
1594
|
-
const entities: IEntitiesInternal<any> = externalEntities.map(
|
|
1595
|
-
(d: IEntity<any>) => {
|
|
1721
|
+
export const createOrm = ({ entities: externalEntities }: CreateOrmOptions) => {
|
|
1722
|
+
const entities: IEntitiesInternal<IModel> = externalEntities.map(
|
|
1723
|
+
(d: IEntity<IModel>) => {
|
|
1596
1724
|
const tableName = d.tableName;
|
|
1597
1725
|
const displayName = d.displayName || camelCase(d.tableName);
|
|
1598
1726
|
const collectionDisplayName =
|
|
@@ -1672,7 +1800,7 @@ export const create = ({
|
|
|
1672
1800
|
}
|
|
1673
1801
|
);
|
|
1674
1802
|
|
|
1675
|
-
const getEntityByTableName = (tableName: string): IEntityInternal<
|
|
1803
|
+
const getEntityByTableName = (tableName: string): IEntityInternal<IModel> => {
|
|
1676
1804
|
const entity = entities.find((data) => data.tableName == tableName);
|
|
1677
1805
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (!entity) {
|
|
1678
1806
|
<span class="cstat-no" title="statement not covered" > throw new Error(`Could not find entity for table ${tableName}`);</span>
|
|
@@ -1680,22 +1808,13 @@ export const create = ({
|
|
|
1680
1808
|
return entity;
|
|
1681
1809
|
};
|
|
1682
1810
|
|
|
1683
|
-
const getEntityByModel = (model: IModel): IEntityInternal<
|
|
1811
|
+
const getEntityByModel = (model: IModel): IEntityInternal<IModel> => {
|
|
1684
1812
|
const entity = entities.find((data) => data.Model == model.constructor);
|
|
1685
1813
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (!entity) {
|
|
1686
1814
|
<span class="cstat-no" title="statement not covered" > throw new Error(`Could not find entity for class ${model.constructor}`);</span>
|
|
1687
1815
|
}
|
|
1688
1816
|
return entity;
|
|
1689
1817
|
};
|
|
1690
|
-
|
|
1691
|
-
const defaultErrorHandler = <span class="fstat-no" title="function not covered" >(e</span>rr: Error) => {
|
|
1692
|
-
<span class="cstat-no" title="statement not covered" > if (!(err.name === 'QueryResultError')) {</span>
|
|
1693
|
-
<span class="cstat-no" title="statement not covered" > if (logError) {</span>
|
|
1694
|
-
<span class="cstat-no" title="statement not covered" > logError(err);</span>
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
<span class="cstat-no" title="statement not covered" > throw err;</span>
|
|
1698
|
-
};
|
|
1699
1818
|
|
|
1700
1819
|
/*
|
|
1701
1820
|
* In:
|
|
@@ -1905,72 +2024,222 @@ export const create = ({
|
|
|
1905
2024
|
return Object.keys(result).reduce((obj: any, text: string) => {
|
|
1906
2025
|
const tableName = text.split('#')[0];
|
|
1907
2026
|
const column = text.split('#')[1];
|
|
2027
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (!tableName || !column) {
|
|
2028
|
+
<span class="cstat-no" title="statement not covered" > throw new Error('Column names must be namespaced to table');</span>
|
|
2029
|
+
}
|
|
1908
2030
|
obj[tableName] = obj[tableName] || {};
|
|
1909
2031
|
obj[tableName][column] = result[text as keyof typeof result];
|
|
1910
2032
|
return obj;
|
|
1911
2033
|
}, {});
|
|
1912
2034
|
};
|
|
1913
2035
|
|
|
1914
|
-
const createFromDatabase = <T extends ICollection<IModel>>(
|
|
1915
|
-
|
|
1916
|
-
): T | undefined => {
|
|
1917
|
-
const result = Array.isArray(_result) ? _result : <span class="branch-1 cbranch-no" title="branch not covered" >[_result];</span>
|
|
2036
|
+
const createFromDatabase = <T extends ICollection<IModel>>(rows: any): T => {
|
|
2037
|
+
const result = Array.isArray(rows) ? rows : <span class="branch-1 cbranch-no" title="branch not covered" >[rows];</span>
|
|
1918
2038
|
const objectified = result.map(objectifyDatabaseResult);
|
|
1919
2039
|
const boified = objectified.map(mapToBos);
|
|
1920
2040
|
const clumps = clumpIntoGroups(boified);
|
|
1921
2041
|
const nested = clumps.map(nestClump);
|
|
1922
2042
|
const models = nested.map((n) => Object.values(n)[0]);
|
|
1923
2043
|
const Collection = getEntityByModel(models[0]).Collection;
|
|
1924
|
-
return
|
|
2044
|
+
return <T>new Collection({ models });
|
|
1925
2045
|
};
|
|
1926
2046
|
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
|
|
2047
|
+
const createAnyFromDatabase = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
2048
|
+
rows: any,
|
|
2049
|
+
rootKey: string | IModel
|
|
2050
|
+
): T => {
|
|
2051
|
+
<span class="cstat-no" title="statement not covered" > if (!rows || !rows.length) {</span>
|
|
2052
|
+
const Collection =
|
|
2053
|
+
<span class="cstat-no" title="statement not covered" > typeof rootKey === 'string'</span>
|
|
2054
|
+
? getEntityByTableName(rootKey).Collection
|
|
2055
|
+
: getEntityByModel(rootKey).Collection;
|
|
2056
|
+
<span class="cstat-no" title="statement not covered" > return new Collection({ models: [] }) as T;</span>
|
|
2057
|
+
}
|
|
2058
|
+
<span class="cstat-no" title="statement not covered" > return <T>createFromDatabase<T>(rows);</span>
|
|
2059
|
+
};
|
|
2060
|
+
|
|
2061
|
+
const createOneFromDatabase = <T extends IModel>(rows: any): T => {
|
|
2062
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (!rows || !rows.length) {
|
|
1930
2063
|
<span class="cstat-no" title="statement not covered" > throw Error('Did not get one.');</span>
|
|
1931
2064
|
}
|
|
1932
|
-
|
|
2065
|
+
const collection = createFromDatabase<ICollection<IModel>>(rows);
|
|
2066
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (!collection || !collection.models || collection.models.length === 0) {
|
|
1933
2067
|
<span class="cstat-no" title="statement not covered" > throw Error('Did not get one.');</span>
|
|
1934
2068
|
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (collection.models.length > 1) {
|
|
1935
2069
|
<span class="cstat-no" title="statement not covered" > throw Error('Got more than one.');</span>
|
|
1936
2070
|
}
|
|
1937
|
-
return collection.models[0]
|
|
2071
|
+
return <T>collection.models[0];
|
|
1938
2072
|
};
|
|
1939
2073
|
|
|
1940
2074
|
const createOneOrNoneFromDatabase = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(
|
|
1941
|
-
|
|
2075
|
+
rows: any
|
|
1942
2076
|
): T | void => {
|
|
1943
|
-
<span class="cstat-no" title="statement not covered" > if (!
|
|
1944
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
1945
|
-
}
|
|
1946
|
-
const collection = <span class="cstat-no" title="statement not covered" >createFromDatabase(_result);</span>
|
|
1947
|
-
<span class="cstat-no" title="statement not covered" > if (collection && collection.models.length > 1) {</span>
|
|
1948
|
-
<span class="cstat-no" title="statement not covered" > throw Error('Got more than one.');</span>
|
|
2077
|
+
<span class="cstat-no" title="statement not covered" > if (!rows || !rows.length) {</span>
|
|
2078
|
+
<span class="cstat-no" title="statement not covered" > return void 0;</span>
|
|
1949
2079
|
}
|
|
1950
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
2080
|
+
<span class="cstat-no" title="statement not covered" > return <T>createOneFromDatabase(rows);</span>
|
|
1951
2081
|
};
|
|
1952
2082
|
|
|
1953
2083
|
const createManyFromDatabase = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
1954
|
-
|
|
2084
|
+
rows: any
|
|
1955
2085
|
): T => {
|
|
1956
|
-
|
|
1957
|
-
<span class="cstat-no" title="statement not covered" > if (!collection || collection.models.length === 0) {</span>
|
|
2086
|
+
<span class="cstat-no" title="statement not covered" > if (!rows || !rows.length) {</span>
|
|
1958
2087
|
<span class="cstat-no" title="statement not covered" > throw Error('Did not get at least one.');</span>
|
|
1959
2088
|
}
|
|
1960
|
-
<span class="cstat-no" title="statement not covered" > return
|
|
2089
|
+
<span class="cstat-no" title="statement not covered" > return <T>createFromDatabase(rows);</span>
|
|
2090
|
+
};
|
|
2091
|
+
|
|
2092
|
+
return {
|
|
2093
|
+
getEntityByModel,
|
|
2094
|
+
createFromDatabase,
|
|
2095
|
+
createAnyFromDatabase,
|
|
2096
|
+
createOneFromDatabase,
|
|
2097
|
+
createOneOrNoneFromDatabase,
|
|
2098
|
+
createManyFromDatabase,
|
|
2099
|
+
// tables property for access to select columns clause string
|
|
2100
|
+
tables: entities.reduce((accum: any, data: IEntityInternal<IModel>) => {
|
|
2101
|
+
accum[data.displayName] = {
|
|
2102
|
+
columns: data.selectColumnsClause
|
|
2103
|
+
};
|
|
2104
|
+
return accum;
|
|
2105
|
+
}, {})
|
|
2106
|
+
};
|
|
2107
|
+
};
|
|
2108
|
+
|
|
2109
|
+
export interface CreateAbstractionLayerOptions {
|
|
2110
|
+
entities: IEntities<IModel>;
|
|
2111
|
+
db: any;
|
|
2112
|
+
logError?: (err: Error) => void;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
export const createAbstractionLayer = ({
|
|
2116
|
+
entities: externalEntities,
|
|
2117
|
+
db,
|
|
2118
|
+
logError
|
|
2119
|
+
}: CreateAbstractionLayerOptions) => {
|
|
2120
|
+
const orm = createOrm({ entities: externalEntities });
|
|
2121
|
+
|
|
2122
|
+
const defaultErrorHandler = <span class="fstat-no" title="function not covered" >(e</span>rr: Error) => {
|
|
2123
|
+
<span class="cstat-no" title="statement not covered" > if (!(err.name === 'QueryResultError')) {</span>
|
|
2124
|
+
<span class="cstat-no" title="statement not covered" > if (logError) {</span>
|
|
2125
|
+
<span class="cstat-no" title="statement not covered" > logError(err);</span>
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
<span class="cstat-no" title="statement not covered" > throw err;</span>
|
|
2129
|
+
};
|
|
2130
|
+
|
|
2131
|
+
/* ------------------------------------------------------------------------*/
|
|
2132
|
+
/* Query functions --------------------------------------------------------*/
|
|
2133
|
+
/* ------------------------------------------------------------------------*/
|
|
2134
|
+
|
|
2135
|
+
const one = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(
|
|
2136
|
+
query: string,
|
|
2137
|
+
values?: object,
|
|
2138
|
+
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2139
|
+
): T => {
|
|
2140
|
+
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2141
|
+
.many(query, values)
|
|
2142
|
+
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >orm.createOneFromDatabase(rows))</span>
|
|
2143
|
+
.catch(errorHandler);
|
|
2144
|
+
};
|
|
2145
|
+
|
|
2146
|
+
const oneOrNone = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(
|
|
2147
|
+
query: string,
|
|
2148
|
+
values?: object,
|
|
2149
|
+
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2150
|
+
): T | void => {
|
|
2151
|
+
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2152
|
+
.any(query, values)
|
|
2153
|
+
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >orm.createOneOrNoneFromDatabase(rows))</span>
|
|
2154
|
+
.catch(errorHandler);
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
const many = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
2158
|
+
query: string,
|
|
2159
|
+
values?: object,
|
|
2160
|
+
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2161
|
+
): T => {
|
|
2162
|
+
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2163
|
+
.any(query, values)
|
|
2164
|
+
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >orm.createManyFromDatabase(rows))</span>
|
|
2165
|
+
.catch(errorHandler);
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
const any = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
2169
|
+
query: string,
|
|
2170
|
+
values?: object,
|
|
2171
|
+
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2172
|
+
): T | void => {
|
|
2173
|
+
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2174
|
+
.result(query, values)
|
|
2175
|
+
.then(<span class="fstat-no" title="function not covered" >(r</span>esult: any) =>
|
|
2176
|
+
<span class="cstat-no" title="statement not covered" > orm.createAnyFromDatabase(</span>
|
|
2177
|
+
result.rows,
|
|
2178
|
+
result.fields[0].name.split('#')[0]
|
|
2179
|
+
)
|
|
2180
|
+
)
|
|
2181
|
+
.catch(errorHandler);
|
|
2182
|
+
};
|
|
2183
|
+
|
|
2184
|
+
const none = <span class="fstat-no" title="function not covered" >(</span>
|
|
2185
|
+
query: string,
|
|
2186
|
+
values?: object,
|
|
2187
|
+
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2188
|
+
): void => {
|
|
2189
|
+
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2190
|
+
.none(query, values)
|
|
2191
|
+
.then(<span class="fstat-no" title="function not covered" >()</span> => <span class="cstat-no" title="statement not covered" >null)</span>
|
|
2192
|
+
.catch(errorHandler);
|
|
1961
2193
|
};
|
|
2194
|
+
|
|
2195
|
+
return Object.assign({}, orm, {
|
|
2196
|
+
// Query Functions
|
|
2197
|
+
one,
|
|
2198
|
+
oneOrNone,
|
|
2199
|
+
many,
|
|
2200
|
+
any,
|
|
2201
|
+
none,
|
|
2202
|
+
// provide direct access to db
|
|
2203
|
+
db
|
|
2204
|
+
});
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
export interface CreateOptions {
|
|
2208
|
+
entities: IEntities<IModel>;
|
|
2209
|
+
db: any;
|
|
2210
|
+
logError?: (err: Error) => void;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
export const create = ({
|
|
2214
|
+
entities: externalEntities,
|
|
2215
|
+
db,
|
|
2216
|
+
logError
|
|
2217
|
+
}: CreateOptions) => {
|
|
2218
|
+
const orm = createAbstractionLayer({
|
|
2219
|
+
entities: externalEntities,
|
|
2220
|
+
db,
|
|
2221
|
+
logError
|
|
2222
|
+
});
|
|
2223
|
+
|
|
2224
|
+
/* ------------------------------------------------------------------------*/
|
|
2225
|
+
/* Helper Utilities for CRUD functions ------------------------------------*/
|
|
2226
|
+
/* ------------------------------------------------------------------------*/
|
|
1962
2227
|
|
|
1963
2228
|
const getSqlInsertParts = <span class="fstat-no" title="function not covered" >(m</span>odel: IModel) => {
|
|
1964
|
-
const columns = <span class="cstat-no" title="statement not covered" >
|
|
2229
|
+
const columns = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2230
|
+
.getEntityByModel(model)
|
|
1965
2231
|
.columnNames.filter(
|
|
1966
2232
|
<span class="fstat-no" title="function not covered" > (c</span>olumn: string, index: number) =>
|
|
1967
2233
|
<span class="cstat-no" title="statement not covered" > model[</span>
|
|
1968
|
-
getEntityByModel(model).propertyNames[
|
|
2234
|
+
orm.getEntityByModel(model).propertyNames[
|
|
2235
|
+
index
|
|
2236
|
+
] as keyof typeof model
|
|
1969
2237
|
] !== void 0
|
|
1970
2238
|
)
|
|
1971
2239
|
.map(<span class="fstat-no" title="function not covered" >(c</span>ol: string) => <span class="cstat-no" title="statement not covered" >`"${col}"`)</span>
|
|
1972
2240
|
.join(', ');
|
|
1973
|
-
const values = <span class="cstat-no" title="statement not covered" >
|
|
2241
|
+
const values = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2242
|
+
.getEntityByModel(model)
|
|
1974
2243
|
.propertyNames.map(
|
|
1975
2244
|
<span class="fstat-no" title="function not covered" > (p</span>roperty: string) => <span class="cstat-no" title="statement not covered" >model[property as keyof typeof model]</span>
|
|
1976
2245
|
)
|
|
@@ -1982,11 +2251,14 @@ export const create = ({
|
|
|
1982
2251
|
};
|
|
1983
2252
|
|
|
1984
2253
|
const getSqlUpdateParts = <span class="fstat-no" title="function not covered" >(m</span>odel: IModel, on = <span class="branch-0 cbranch-no" title="branch not covered" >'id')</span> => {
|
|
1985
|
-
const clauseArray = <span class="cstat-no" title="statement not covered" >
|
|
2254
|
+
const clauseArray = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2255
|
+
.getEntityByModel(model)
|
|
1986
2256
|
.columnNames.filter(
|
|
1987
2257
|
<span class="fstat-no" title="function not covered" > (s</span>qlColumn: string, index: number) =>
|
|
1988
2258
|
<span class="cstat-no" title="statement not covered" > model[</span>
|
|
1989
|
-
getEntityByModel(model).propertyNames[
|
|
2259
|
+
orm.getEntityByModel(model).propertyNames[
|
|
2260
|
+
index
|
|
2261
|
+
] as keyof typeof model
|
|
1990
2262
|
] !== void 0
|
|
1991
2263
|
)
|
|
1992
2264
|
.map(
|
|
@@ -1994,7 +2266,8 @@ export const create = ({
|
|
|
1994
2266
|
);
|
|
1995
2267
|
const clause = <span class="cstat-no" title="statement not covered" >clauseArray.join(', ');</span>
|
|
1996
2268
|
const idVar = <span class="cstat-no" title="statement not covered" >`$${clauseArray.length + 1}`;</span>
|
|
1997
|
-
const _values = <span class="cstat-no" title="statement not covered" >
|
|
2269
|
+
const _values = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2270
|
+
.getEntityByModel(model)
|
|
1998
2271
|
.propertyNames.map(
|
|
1999
2272
|
<span class="fstat-no" title="function not covered" > (p</span>roperty: string) => <span class="cstat-no" title="statement not covered" >model[property as keyof typeof model]</span>
|
|
2000
2273
|
)
|
|
@@ -2004,18 +2277,20 @@ export const create = ({
|
|
|
2004
2277
|
};
|
|
2005
2278
|
|
|
2006
2279
|
const getMatchingParts = <span class="fstat-no" title="function not covered" >(m</span>odel: IModel) => {
|
|
2007
|
-
const whereClause = <span class="cstat-no" title="statement not covered" >
|
|
2280
|
+
const whereClause = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2281
|
+
.getEntityByModel(model)
|
|
2008
2282
|
.propertyNames.map(<span class="fstat-no" title="function not covered" >(p</span>roperty: string, index: number) =>
|
|
2009
2283
|
<span class="cstat-no" title="statement not covered" > model[property as keyof typeof model] != null</span>
|
|
2010
|
-
? `"${getEntityByModel(model).tableName}"."${
|
|
2011
|
-
getEntityByModel(model).columnNames[index]
|
|
2284
|
+
? `"${orm.getEntityByModel(model).tableName}"."${
|
|
2285
|
+
orm.getEntityByModel(model).columnNames[index]
|
|
2012
2286
|
}"`
|
|
2013
2287
|
: null
|
|
2014
2288
|
)
|
|
2015
2289
|
.filter(<span class="fstat-no" title="function not covered" >(x</span>: string | null) => <span class="cstat-no" title="statement not covered" >x != null)</span>
|
|
2016
2290
|
.map(<span class="fstat-no" title="function not covered" >(x</span>: string | null, i: number) => <span class="cstat-no" title="statement not covered" >`${x} = $${i + 1}`)</span>
|
|
2017
2291
|
.join(' AND ');
|
|
2018
|
-
const values = <span class="cstat-no" title="statement not covered" >
|
|
2292
|
+
const values = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2293
|
+
.getEntityByModel(model)
|
|
2019
2294
|
.propertyNames.map(<span class="fstat-no" title="function not covered" >(p</span>roperty: string) =>
|
|
2020
2295
|
<span class="cstat-no" title="statement not covered" > model[property as keyof typeof model] != null</span>
|
|
2021
2296
|
? model[property as keyof typeof model]
|
|
@@ -2028,18 +2303,20 @@ export const create = ({
|
|
|
2028
2303
|
// This one returns an object, which allows it to be more versatile.
|
|
2029
2304
|
// To-do: make this one even better and use it instead of the one above.
|
|
2030
2305
|
const getMatchingPartsObject = <span class="fstat-no" title="function not covered" >(m</span>odel: IModel) => {
|
|
2031
|
-
const whereClause = <span class="cstat-no" title="statement not covered" >
|
|
2306
|
+
const whereClause = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2307
|
+
.getEntityByModel(model)
|
|
2032
2308
|
.propertyNames.map(<span class="fstat-no" title="function not covered" >(p</span>roperty: string, index: number) =>
|
|
2033
2309
|
<span class="cstat-no" title="statement not covered" > model[property as keyof typeof model] != null</span>
|
|
2034
|
-
? `"${getEntityByModel(model).tableName}"."${
|
|
2035
|
-
getEntityByModel(model).columnNames[index]
|
|
2310
|
+
? `"${orm.getEntityByModel(model).tableName}"."${
|
|
2311
|
+
orm.getEntityByModel(model).columnNames[index]
|
|
2036
2312
|
}"`
|
|
2037
2313
|
: null
|
|
2038
2314
|
)
|
|
2039
2315
|
.filter(<span class="fstat-no" title="function not covered" >(x</span>: string | null) => <span class="cstat-no" title="statement not covered" >x != null)</span>
|
|
2040
2316
|
.map(<span class="fstat-no" title="function not covered" >(x</span>: string | null, i: number) => <span class="cstat-no" title="statement not covered" >`${x} = $(${i + 1})`)</span>
|
|
2041
2317
|
.join(' AND ');
|
|
2042
|
-
const values = <span class="cstat-no" title="statement not covered" >
|
|
2318
|
+
const values = <span class="cstat-no" title="statement not covered" >orm</span>
|
|
2319
|
+
.getEntityByModel(model)
|
|
2043
2320
|
.propertyNames.map(<span class="fstat-no" title="function not covered" >(p</span>roperty: string) =>
|
|
2044
2321
|
<span class="cstat-no" title="statement not covered" > model[property as keyof typeof model] != null</span>
|
|
2045
2322
|
? model[property as keyof typeof model]
|
|
@@ -2058,8 +2335,8 @@ export const create = ({
|
|
|
2058
2335
|
const Constructor = <span class="cstat-no" title="statement not covered" >model.constructor as any;</span>
|
|
2059
2336
|
const modelKeys = <span class="cstat-no" title="statement not covered" >sqlColumns.map(</span>
|
|
2060
2337
|
<span class="fstat-no" title="function not covered" > (k</span>ey: string) =>
|
|
2061
|
-
<span class="cstat-no" title="statement not covered" > getEntityByModel(model).propertyNames[</span>
|
|
2062
|
-
getEntityByModel(model).columnNames.indexOf(key)
|
|
2338
|
+
<span class="cstat-no" title="statement not covered" > orm.getEntityByModel(model).propertyNames[</span>
|
|
2339
|
+
orm.getEntityByModel(model).columnNames.indexOf(key)
|
|
2063
2340
|
]
|
|
2064
2341
|
);
|
|
2065
2342
|
const modelData = <span class="cstat-no" title="statement not covered" >modelKeys.reduce(</span>
|
|
@@ -2074,69 +2351,11 @@ export const create = ({
|
|
|
2074
2351
|
|
|
2075
2352
|
const getValueBySqlColumn = <span class="fstat-no" title="function not covered" >(m</span>odel: IModel, sqlColumn: string) => {
|
|
2076
2353
|
<span class="cstat-no" title="statement not covered" > return model[</span>
|
|
2077
|
-
getEntityByModel(model).propertyNames[
|
|
2078
|
-
getEntityByModel(model).columnNames.indexOf(sqlColumn)
|
|
2354
|
+
orm.getEntityByModel(model).propertyNames[
|
|
2355
|
+
orm.getEntityByModel(model).columnNames.indexOf(sqlColumn)
|
|
2079
2356
|
] as keyof typeof model
|
|
2080
2357
|
];
|
|
2081
2358
|
};
|
|
2082
|
-
/* ------------------------------------------------------------------------*/
|
|
2083
|
-
/* Query functions --------------------------------------------------------*/
|
|
2084
|
-
/* ------------------------------------------------------------------------*/
|
|
2085
|
-
|
|
2086
|
-
const one = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(
|
|
2087
|
-
query: string,
|
|
2088
|
-
values?: object,
|
|
2089
|
-
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2090
|
-
): T => {
|
|
2091
|
-
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2092
|
-
.many(query, values)
|
|
2093
|
-
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >createOneFromDatabase(rows))</span>
|
|
2094
|
-
.catch(errorHandler);
|
|
2095
|
-
};
|
|
2096
|
-
|
|
2097
|
-
const oneOrNone = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(
|
|
2098
|
-
query: string,
|
|
2099
|
-
values?: object,
|
|
2100
|
-
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2101
|
-
): T | void => {
|
|
2102
|
-
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2103
|
-
.any(query, values)
|
|
2104
|
-
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >createOneOrNoneFromDatabase(rows))</span>
|
|
2105
|
-
.catch(errorHandler);
|
|
2106
|
-
};
|
|
2107
|
-
|
|
2108
|
-
const many = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
2109
|
-
query: string,
|
|
2110
|
-
values?: object,
|
|
2111
|
-
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2112
|
-
): T => {
|
|
2113
|
-
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2114
|
-
.any(query, values)
|
|
2115
|
-
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >createManyFromDatabase(rows))</span>
|
|
2116
|
-
.catch(errorHandler);
|
|
2117
|
-
};
|
|
2118
|
-
|
|
2119
|
-
const any = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
2120
|
-
query: string,
|
|
2121
|
-
values?: object,
|
|
2122
|
-
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2123
|
-
): T | void => {
|
|
2124
|
-
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2125
|
-
.any(query, values)
|
|
2126
|
-
.then(<span class="fstat-no" title="function not covered" >(r</span>ows: any) => <span class="cstat-no" title="statement not covered" >createFromDatabase(rows))</span>
|
|
2127
|
-
.catch(errorHandler);
|
|
2128
|
-
};
|
|
2129
|
-
|
|
2130
|
-
const none = <span class="fstat-no" title="function not covered" >(</span>
|
|
2131
|
-
query: string,
|
|
2132
|
-
values?: object,
|
|
2133
|
-
errorHandler = <span class="branch-0 cbranch-no" title="branch not covered" >defaultErrorHandler</span>
|
|
2134
|
-
): void => {
|
|
2135
|
-
<span class="cstat-no" title="statement not covered" > return db</span>
|
|
2136
|
-
.none(query, values)
|
|
2137
|
-
.then(<span class="fstat-no" title="function not covered" >()</span> => <span class="cstat-no" title="statement not covered" >null)</span>
|
|
2138
|
-
.catch(errorHandler);
|
|
2139
|
-
};
|
|
2140
2359
|
|
|
2141
2360
|
/* ------------------------------------------------------------------------*/
|
|
2142
2361
|
/* Built-in basic CRUD functions ------------------------------------------*/
|
|
@@ -2146,62 +2365,62 @@ export const create = ({
|
|
|
2146
2365
|
const create = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(model: T): T => {
|
|
2147
2366
|
const { columns, values, valuesVar } = <span class="cstat-no" title="statement not covered" >getSqlInsertParts(model);</span>
|
|
2148
2367
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2149
|
-
INSERT INTO "${getEntityByModel(model).tableName}" ( ${columns} )
|
|
2368
|
+
INSERT INTO "${orm.getEntityByModel(model).tableName}" ( ${columns} )
|
|
2150
2369
|
VALUES ( ${valuesVar} )
|
|
2151
|
-
RETURNING ${getEntityByModel(model).selectColumnsClause};
|
|
2370
|
+
RETURNING ${orm.getEntityByModel(model).selectColumnsClause};
|
|
2152
2371
|
`;
|
|
2153
|
-
<span class="cstat-no" title="statement not covered" > return one<T>(query, values);</span>
|
|
2372
|
+
<span class="cstat-no" title="statement not covered" > return orm.one<T>(query, values);</span>
|
|
2154
2373
|
};
|
|
2155
2374
|
|
|
2156
2375
|
// Standard update
|
|
2157
2376
|
const update = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(model: T, { on = <span class="branch-0 cbranch-no" title="branch not covered" >'id' </span>} = <span class="branch-0 cbranch-no" title="branch not covered" >{})</span>: T => {
|
|
2158
2377
|
const { clause, idVar, values } = <span class="cstat-no" title="statement not covered" >getSqlUpdateParts(model, on);</span>
|
|
2159
2378
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2160
|
-
UPDATE "${getEntityByModel(model).tableName}"
|
|
2379
|
+
UPDATE "${orm.getEntityByModel(model).tableName}"
|
|
2161
2380
|
SET ${clause}
|
|
2162
|
-
WHERE "${getEntityByModel(model).tableName}".${on} = ${idVar}
|
|
2163
|
-
RETURNING ${getEntityByModel(model).selectColumnsClause};
|
|
2381
|
+
WHERE "${orm.getEntityByModel(model).tableName}".${on} = ${idVar}
|
|
2382
|
+
RETURNING ${orm.getEntityByModel(model).selectColumnsClause};
|
|
2164
2383
|
`;
|
|
2165
|
-
<span class="cstat-no" title="statement not covered" > return one<T>(query, values);</span>
|
|
2384
|
+
<span class="cstat-no" title="statement not covered" > return orm.one<T>(query, values);</span>
|
|
2166
2385
|
};
|
|
2167
2386
|
|
|
2168
2387
|
// Standard delete
|
|
2169
2388
|
const _delete = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(model: T): void => {
|
|
2170
2389
|
const id = <span class="cstat-no" title="statement not covered" >(model as any).id;</span>
|
|
2171
2390
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2172
|
-
DELETE FROM "${getEntityByModel(model).tableName}"
|
|
2173
|
-
WHERE "${getEntityByModel(model).tableName}".id = $(id)
|
|
2391
|
+
DELETE FROM "${orm.getEntityByModel(model).tableName}"
|
|
2392
|
+
WHERE "${orm.getEntityByModel(model).tableName}".id = $(id)
|
|
2174
2393
|
`;
|
|
2175
|
-
<span class="cstat-no" title="statement not covered" > return none(query, { id });</span>
|
|
2394
|
+
<span class="cstat-no" title="statement not covered" > return orm.none(query, { id });</span>
|
|
2176
2395
|
};
|
|
2177
2396
|
|
|
2178
2397
|
const deleteMatching = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(model: T) => {
|
|
2179
2398
|
const { whereClause, values } = <span class="cstat-no" title="statement not covered" >getMatchingParts(model);</span>
|
|
2180
2399
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2181
|
-
DELETE FROM "${getEntityByModel(model).tableName}"
|
|
2400
|
+
DELETE FROM "${orm.getEntityByModel(model).tableName}"
|
|
2182
2401
|
WHERE ${whereClause};
|
|
2183
2402
|
`;
|
|
2184
|
-
<span class="cstat-no" title="statement not covered" > return none(query, values);</span>
|
|
2403
|
+
<span class="cstat-no" title="statement not covered" > return orm.none(query, values);</span>
|
|
2185
2404
|
};
|
|
2186
2405
|
|
|
2187
2406
|
const getMatching = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(model: T): T => {
|
|
2188
2407
|
const { whereClause, values } = <span class="cstat-no" title="statement not covered" >getMatchingParts(model);</span>
|
|
2189
2408
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2190
|
-
SELECT ${getEntityByModel(model).selectColumnsClause}
|
|
2191
|
-
FROM "${getEntityByModel(model).tableName}"
|
|
2409
|
+
SELECT ${orm.getEntityByModel(model).selectColumnsClause}
|
|
2410
|
+
FROM "${orm.getEntityByModel(model).tableName}"
|
|
2192
2411
|
WHERE ${whereClause};
|
|
2193
2412
|
`;
|
|
2194
|
-
<span class="cstat-no" title="statement not covered" > return one<T>(query, values);</span>
|
|
2413
|
+
<span class="cstat-no" title="statement not covered" > return orm.one<T>(query, values);</span>
|
|
2195
2414
|
};
|
|
2196
2415
|
|
|
2197
2416
|
const getOneOrNoneMatching = <span class="fstat-no" title="function not covered" ><T</span> extends IModel>(model: T): T | void => {
|
|
2198
2417
|
const { whereClause, values } = <span class="cstat-no" title="statement not covered" >getMatchingParts(model);</span>
|
|
2199
2418
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2200
|
-
SELECT ${getEntityByModel(model).selectColumnsClause}
|
|
2201
|
-
FROM "${getEntityByModel(model).tableName}"
|
|
2419
|
+
SELECT ${orm.getEntityByModel(model).selectColumnsClause}
|
|
2420
|
+
FROM "${orm.getEntityByModel(model).tableName}"
|
|
2202
2421
|
WHERE ${whereClause};
|
|
2203
2422
|
`;
|
|
2204
|
-
<span class="cstat-no" title="statement not covered" > return oneOrNone<T>(query, values);</span>
|
|
2423
|
+
<span class="cstat-no" title="statement not covered" > return orm.oneOrNone<T>(query, values);</span>
|
|
2205
2424
|
};
|
|
2206
2425
|
|
|
2207
2426
|
const getAnyMatching = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(
|
|
@@ -2209,45 +2428,24 @@ export const create = ({
|
|
|
2209
2428
|
): T | void => {
|
|
2210
2429
|
const { whereClause, values } = <span class="cstat-no" title="statement not covered" >getMatchingParts(model);</span>
|
|
2211
2430
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2212
|
-
SELECT ${getEntityByModel(model).selectColumnsClause}
|
|
2213
|
-
FROM "${getEntityByModel(model).tableName}"
|
|
2431
|
+
SELECT ${orm.getEntityByModel(model).selectColumnsClause}
|
|
2432
|
+
FROM "${orm.getEntityByModel(model).tableName}"
|
|
2214
2433
|
WHERE ${whereClause};
|
|
2215
2434
|
`;
|
|
2216
|
-
<span class="cstat-no" title="statement not covered" > return any<T>(query, values);</span>
|
|
2435
|
+
<span class="cstat-no" title="statement not covered" > return orm.any<T>(query, values);</span>
|
|
2217
2436
|
};
|
|
2218
2437
|
|
|
2219
2438
|
const getAllMatching = <span class="fstat-no" title="function not covered" ><T</span> extends ICollection<IModel>>(model: IModel): T => {
|
|
2220
2439
|
const { whereClause, values } = <span class="cstat-no" title="statement not covered" >getMatchingParts(model);</span>
|
|
2221
2440
|
const query = <span class="cstat-no" title="statement not covered" >`</span>
|
|
2222
|
-
SELECT ${getEntityByModel(model).selectColumnsClause}
|
|
2223
|
-
FROM "${getEntityByModel(model).tableName}"
|
|
2441
|
+
SELECT ${orm.getEntityByModel(model).selectColumnsClause}
|
|
2442
|
+
FROM "${orm.getEntityByModel(model).tableName}"
|
|
2224
2443
|
WHERE ${whereClause};
|
|
2225
2444
|
`;
|
|
2226
|
-
<span class="cstat-no" title="statement not covered" > return many<T>(query, values);</span>
|
|
2445
|
+
<span class="cstat-no" title="statement not covered" > return orm.many<T>(query, values);</span>
|
|
2227
2446
|
};
|
|
2228
2447
|
|
|
2229
|
-
return {
|
|
2230
|
-
// Query Helper Function
|
|
2231
|
-
nestClump,
|
|
2232
|
-
clumpIntoGroups,
|
|
2233
|
-
mapToBos,
|
|
2234
|
-
objectifyDatabaseResult,
|
|
2235
|
-
createFromDatabase,
|
|
2236
|
-
createOneFromDatabase,
|
|
2237
|
-
createOneOrNoneFromDatabase,
|
|
2238
|
-
createManyFromDatabase,
|
|
2239
|
-
getSqlInsertParts,
|
|
2240
|
-
getSqlUpdateParts,
|
|
2241
|
-
getMatchingParts,
|
|
2242
|
-
getMatchingPartsObject,
|
|
2243
|
-
getNewWith,
|
|
2244
|
-
getValueBySqlColumn,
|
|
2245
|
-
// Query Functions
|
|
2246
|
-
one,
|
|
2247
|
-
oneOrNone,
|
|
2248
|
-
many,
|
|
2249
|
-
any,
|
|
2250
|
-
none,
|
|
2448
|
+
return Object.assign({}, orm, {
|
|
2251
2449
|
// Built-in basic CRUD functions
|
|
2252
2450
|
create,
|
|
2253
2451
|
update,
|
|
@@ -2257,11 +2455,14 @@ export const create = ({
|
|
|
2257
2455
|
getOneOrNoneMatching,
|
|
2258
2456
|
getAnyMatching,
|
|
2259
2457
|
getAllMatching,
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2458
|
+
// Helper Utility functions
|
|
2459
|
+
getSqlInsertParts,
|
|
2460
|
+
getSqlUpdateParts,
|
|
2461
|
+
getMatchingParts,
|
|
2462
|
+
getMatchingPartsObject,
|
|
2463
|
+
getNewWith,
|
|
2464
|
+
getValueBySqlColumn
|
|
2465
|
+
});
|
|
2265
2466
|
};
|
|
2266
2467
|
</pre></td></tr>
|
|
2267
2468
|
</table></pre>
|
|
@@ -2269,7 +2470,7 @@ export const create = ({
|
|
|
2269
2470
|
</div><!-- /wrapper -->
|
|
2270
2471
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
2271
2472
|
Code coverage
|
|
2272
|
-
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at
|
|
2473
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sat May 07 2022 10:17:08 GMT-0400 (Eastern Daylight Time)
|
|
2273
2474
|
</div>
|
|
2274
2475
|
</div>
|
|
2275
2476
|
<script src="../prettify.js"></script>
|