@dyrected/core 2.8.3 → 2.10.0
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/dist/{app-config-BccpBUqJ.d.cts → app-config-DQhcrGDE.d.cts} +472 -85
- package/dist/{app-config-BccpBUqJ.d.ts → app-config-DQhcrGDE.d.ts} +472 -85
- package/dist/chunk-JSBRDJBE.js +30 -0
- package/dist/{chunk-GFFGDHST.js → chunk-TYPDQTE2.js} +1879 -42
- package/dist/index.cjs +1954 -41
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +87 -9
- package/dist/{observability-KCMTV7GO.js → observability-HQF4EUSV.js} +1 -0
- package/dist/server.cjs +2109 -45
- package/dist/server.d.cts +38 -16
- package/dist/server.d.ts +38 -16
- package/dist/server.js +250 -17
- package/dist/{where-sanitizer-WJ2W2QCE.js → where-sanitizer-3MNFMYA2.js} +2 -0
- package/package.json +3 -3
- package/dist/__tests__/access-features.test.d.ts +0 -2
- package/dist/__tests__/access-features.test.d.ts.map +0 -1
- package/dist/__tests__/access-features.test.js +0 -159
- package/dist/__tests__/access-features.test.js.map +0 -1
- package/dist/__tests__/access-parity.test.d.ts +0 -2
- package/dist/__tests__/access-parity.test.d.ts.map +0 -1
- package/dist/__tests__/access-parity.test.js +0 -338
- package/dist/__tests__/access-parity.test.js.map +0 -1
- package/dist/__tests__/access.test.d.ts +0 -2
- package/dist/__tests__/access.test.d.ts.map +0 -1
- package/dist/__tests__/access.test.js +0 -137
- package/dist/__tests__/access.test.js.map +0 -1
- package/dist/__tests__/admin-auth.test.d.ts +0 -2
- package/dist/__tests__/admin-auth.test.d.ts.map +0 -1
- package/dist/__tests__/admin-auth.test.js +0 -440
- package/dist/__tests__/admin-auth.test.js.map +0 -1
- package/dist/__tests__/app.test.d.ts +0 -2
- package/dist/__tests__/app.test.d.ts.map +0 -1
- package/dist/__tests__/app.test.js +0 -112
- package/dist/__tests__/app.test.js.map +0 -1
- package/dist/__tests__/audit.test.d.ts +0 -2
- package/dist/__tests__/audit.test.d.ts.map +0 -1
- package/dist/__tests__/audit.test.js +0 -125
- package/dist/__tests__/audit.test.js.map +0 -1
- package/dist/__tests__/auth-hydration.test.d.ts +0 -2
- package/dist/__tests__/auth-hydration.test.d.ts.map +0 -1
- package/dist/__tests__/auth-hydration.test.js +0 -90
- package/dist/__tests__/auth-hydration.test.js.map +0 -1
- package/dist/__tests__/auth-invite.test.d.ts +0 -2
- package/dist/__tests__/auth-invite.test.d.ts.map +0 -1
- package/dist/__tests__/auth-invite.test.js +0 -152
- package/dist/__tests__/auth-invite.test.js.map +0 -1
- package/dist/__tests__/auth-lockout.test.d.ts +0 -2
- package/dist/__tests__/auth-lockout.test.d.ts.map +0 -1
- package/dist/__tests__/auth-lockout.test.js +0 -154
- package/dist/__tests__/auth-lockout.test.js.map +0 -1
- package/dist/__tests__/auth-sessions.test.d.ts +0 -2
- package/dist/__tests__/auth-sessions.test.d.ts.map +0 -1
- package/dist/__tests__/auth-sessions.test.js +0 -118
- package/dist/__tests__/auth-sessions.test.js.map +0 -1
- package/dist/__tests__/config.test.d.ts +0 -2
- package/dist/__tests__/config.test.d.ts.map +0 -1
- package/dist/__tests__/config.test.js +0 -402
- package/dist/__tests__/config.test.js.map +0 -1
- package/dist/__tests__/define-field.test.d.ts +0 -2
- package/dist/__tests__/define-field.test.d.ts.map +0 -1
- package/dist/__tests__/define-field.test.js +0 -121
- package/dist/__tests__/define-field.test.js.map +0 -1
- package/dist/__tests__/deleteMany.test.d.ts +0 -2
- package/dist/__tests__/deleteMany.test.d.ts.map +0 -1
- package/dist/__tests__/deleteMany.test.js +0 -75
- package/dist/__tests__/deleteMany.test.js.map +0 -1
- package/dist/__tests__/depth.test.d.ts +0 -2
- package/dist/__tests__/depth.test.d.ts.map +0 -1
- package/dist/__tests__/depth.test.js +0 -115
- package/dist/__tests__/depth.test.js.map +0 -1
- package/dist/__tests__/dynamic-options.test.d.ts +0 -2
- package/dist/__tests__/dynamic-options.test.d.ts.map +0 -1
- package/dist/__tests__/dynamic-options.test.js +0 -168
- package/dist/__tests__/dynamic-options.test.js.map +0 -1
- package/dist/__tests__/email.service.test.d.ts +0 -2
- package/dist/__tests__/email.service.test.d.ts.map +0 -1
- package/dist/__tests__/email.service.test.js +0 -52
- package/dist/__tests__/email.service.test.js.map +0 -1
- package/dist/__tests__/field-inference.test-types.d.ts +0 -161
- package/dist/__tests__/field-inference.test-types.d.ts.map +0 -1
- package/dist/__tests__/field-inference.test-types.js +0 -87
- package/dist/__tests__/field-inference.test-types.js.map +0 -1
- package/dist/__tests__/fixtures/editorial-workflow.d.ts +0 -14
- package/dist/__tests__/fixtures/editorial-workflow.d.ts.map +0 -1
- package/dist/__tests__/fixtures/editorial-workflow.js +0 -12
- package/dist/__tests__/fixtures/editorial-workflow.js.map +0 -1
- package/dist/__tests__/hooks.test.d.ts +0 -2
- package/dist/__tests__/hooks.test.d.ts.map +0 -1
- package/dist/__tests__/hooks.test.js +0 -320
- package/dist/__tests__/hooks.test.js.map +0 -1
- package/dist/__tests__/mocks.d.ts +0 -75
- package/dist/__tests__/mocks.d.ts.map +0 -1
- package/dist/__tests__/mocks.js +0 -170
- package/dist/__tests__/mocks.js.map +0 -1
- package/dist/__tests__/observability.test.d.ts +0 -2
- package/dist/__tests__/observability.test.d.ts.map +0 -1
- package/dist/__tests__/observability.test.js +0 -233
- package/dist/__tests__/observability.test.js.map +0 -1
- package/dist/__tests__/openapi.test.d.ts +0 -2
- package/dist/__tests__/openapi.test.d.ts.map +0 -1
- package/dist/__tests__/openapi.test.js +0 -105
- package/dist/__tests__/openapi.test.js.map +0 -1
- package/dist/__tests__/parse-sort.test.d.ts +0 -2
- package/dist/__tests__/parse-sort.test.d.ts.map +0 -1
- package/dist/__tests__/parse-sort.test.js +0 -24
- package/dist/__tests__/parse-sort.test.js.map +0 -1
- package/dist/__tests__/preferences.test.d.ts +0 -2
- package/dist/__tests__/preferences.test.d.ts.map +0 -1
- package/dist/__tests__/preferences.test.js +0 -168
- package/dist/__tests__/preferences.test.js.map +0 -1
- package/dist/__tests__/router.test.d.ts +0 -2
- package/dist/__tests__/router.test.d.ts.map +0 -1
- package/dist/__tests__/router.test.js +0 -70
- package/dist/__tests__/router.test.js.map +0 -1
- package/dist/__tests__/search.test.d.ts +0 -2
- package/dist/__tests__/search.test.d.ts.map +0 -1
- package/dist/__tests__/search.test.js +0 -174
- package/dist/__tests__/search.test.js.map +0 -1
- package/dist/__tests__/upload-validation.test.d.ts +0 -2
- package/dist/__tests__/upload-validation.test.d.ts.map +0 -1
- package/dist/__tests__/upload-validation.test.js +0 -41
- package/dist/__tests__/upload-validation.test.js.map +0 -1
- package/dist/__tests__/where.test.d.ts +0 -2
- package/dist/__tests__/where.test.d.ts.map +0 -1
- package/dist/__tests__/where.test.js +0 -105
- package/dist/__tests__/where.test.js.map +0 -1
- package/dist/__tests__/workflow.test.d.ts +0 -2
- package/dist/__tests__/workflow.test.d.ts.map +0 -1
- package/dist/__tests__/workflow.test.js +0 -684
- package/dist/__tests__/workflow.test.js.map +0 -1
- package/dist/app-config-7G-3tF_I.d.cts +0 -2259
- package/dist/app-config-7G-3tF_I.d.ts +0 -2259
- package/dist/app-config-9hs8DRED.d.cts +0 -1718
- package/dist/app-config-9hs8DRED.d.ts +0 -1718
- package/dist/app-config-B3ByBjCN.d.cts +0 -2222
- package/dist/app-config-B3ByBjCN.d.ts +0 -2222
- package/dist/app-config-B5tYsZaH.d.cts +0 -2404
- package/dist/app-config-B5tYsZaH.d.ts +0 -2404
- package/dist/app-config-BEuyPktb.d.cts +0 -2556
- package/dist/app-config-BEuyPktb.d.ts +0 -2556
- package/dist/app-config-BIkjQWzU.d.cts +0 -2218
- package/dist/app-config-BIkjQWzU.d.ts +0 -2218
- package/dist/app-config-BcuZIpvL.d.cts +0 -1951
- package/dist/app-config-BcuZIpvL.d.ts +0 -1951
- package/dist/app-config-BfpeE3bF.d.cts +0 -2100
- package/dist/app-config-BfpeE3bF.d.ts +0 -2100
- package/dist/app-config-Bm9-2Am6.d.cts +0 -1875
- package/dist/app-config-Bm9-2Am6.d.ts +0 -1875
- package/dist/app-config-BqhrBrSM.d.cts +0 -1522
- package/dist/app-config-BqhrBrSM.d.ts +0 -1522
- package/dist/app-config-Bxg_DVxv.d.cts +0 -1413
- package/dist/app-config-Bxg_DVxv.d.ts +0 -1413
- package/dist/app-config-C0twGIaF.d.cts +0 -1597
- package/dist/app-config-C0twGIaF.d.ts +0 -1597
- package/dist/app-config-C0uxEU7Q.d.cts +0 -1874
- package/dist/app-config-C0uxEU7Q.d.ts +0 -1874
- package/dist/app-config-C3X5BAyK.d.cts +0 -1539
- package/dist/app-config-C3X5BAyK.d.ts +0 -1539
- package/dist/app-config-C9VJ6rTv.d.cts +0 -2092
- package/dist/app-config-C9VJ6rTv.d.ts +0 -2092
- package/dist/app-config-CBOn8IyZ.d.cts +0 -1838
- package/dist/app-config-CBOn8IyZ.d.ts +0 -1838
- package/dist/app-config-CCe-yq9q.d.cts +0 -2222
- package/dist/app-config-CCe-yq9q.d.ts +0 -2222
- package/dist/app-config-CJAGGPrk.d.cts +0 -1900
- package/dist/app-config-CJAGGPrk.d.ts +0 -1900
- package/dist/app-config-CPOs7THF.d.cts +0 -2217
- package/dist/app-config-CPOs7THF.d.ts +0 -2217
- package/dist/app-config-CYV70eoF.d.cts +0 -2100
- package/dist/app-config-CYV70eoF.d.ts +0 -2100
- package/dist/app-config-ChsrBB7p.d.cts +0 -2100
- package/dist/app-config-ChsrBB7p.d.ts +0 -2100
- package/dist/app-config-CiEDJm0e.d.cts +0 -1912
- package/dist/app-config-CiEDJm0e.d.ts +0 -1912
- package/dist/app-config-CstocO9M.d.cts +0 -1580
- package/dist/app-config-CstocO9M.d.ts +0 -1580
- package/dist/app-config-Ctp454zB.d.cts +0 -2214
- package/dist/app-config-Ctp454zB.d.ts +0 -2214
- package/dist/app-config-CwaU1de2.d.cts +0 -1868
- package/dist/app-config-CwaU1de2.d.ts +0 -1868
- package/dist/app-config-DCDh8Gbx.d.cts +0 -1926
- package/dist/app-config-DCDh8Gbx.d.ts +0 -1926
- package/dist/app-config-DCWinlNK.d.cts +0 -2091
- package/dist/app-config-DCWinlNK.d.ts +0 -2091
- package/dist/app-config-DIwvzbpe.d.cts +0 -1555
- package/dist/app-config-DIwvzbpe.d.ts +0 -1555
- package/dist/app-config-DJmNYgYh.d.cts +0 -2305
- package/dist/app-config-DJmNYgYh.d.ts +0 -2305
- package/dist/app-config-DO3laV58.d.cts +0 -2397
- package/dist/app-config-DO3laV58.d.ts +0 -2397
- package/dist/app-config-DVdSospO.d.cts +0 -1842
- package/dist/app-config-DVdSospO.d.ts +0 -1842
- package/dist/app-config-DZf_mmi9.d.cts +0 -2211
- package/dist/app-config-DZf_mmi9.d.ts +0 -2211
- package/dist/app-config-DbK2Tv6i.d.cts +0 -2080
- package/dist/app-config-DbK2Tv6i.d.ts +0 -2080
- package/dist/app-config-Dkndq5ni.d.cts +0 -1580
- package/dist/app-config-Dkndq5ni.d.ts +0 -1580
- package/dist/app-config-Dms6kvE-.d.cts +0 -2072
- package/dist/app-config-Dms6kvE-.d.ts +0 -2072
- package/dist/app-config-DqCipvSI.d.cts +0 -1411
- package/dist/app-config-DqCipvSI.d.ts +0 -1411
- package/dist/app-config-Dv5XACR4.d.cts +0 -2065
- package/dist/app-config-Dv5XACR4.d.ts +0 -2065
- package/dist/app-config-P-SF5nnR.d.cts +0 -1568
- package/dist/app-config-P-SF5nnR.d.ts +0 -1568
- package/dist/app-config-SkUoN5JU.d.cts +0 -2192
- package/dist/app-config-SkUoN5JU.d.ts +0 -2192
- package/dist/app-config-WzqpuZMr.d.cts +0 -2566
- package/dist/app-config-WzqpuZMr.d.ts +0 -2566
- package/dist/app-config-_kkj71CB.d.cts +0 -2010
- package/dist/app-config-_kkj71CB.d.ts +0 -2010
- package/dist/app-config-fEjRm1o9.d.cts +0 -2402
- package/dist/app-config-fEjRm1o9.d.ts +0 -2402
- package/dist/app-config-oU1EGHND.d.cts +0 -1538
- package/dist/app-config-oU1EGHND.d.ts +0 -1538
- package/dist/app-config-ouBRb6Bf.d.cts +0 -1716
- package/dist/app-config-ouBRb6Bf.d.ts +0 -1716
- package/dist/app-config-oz8H_MOX.d.cts +0 -2224
- package/dist/app-config-oz8H_MOX.d.ts +0 -2224
- package/dist/app-config-tITj_0sn.d.cts +0 -1926
- package/dist/app-config-tITj_0sn.d.ts +0 -1926
- package/dist/app-config-wnLtFu6c.d.cts +0 -1538
- package/dist/app-config-wnLtFu6c.d.ts +0 -1538
- package/dist/app-config-x-CnipcA.d.cts +0 -2072
- package/dist/app-config-x-CnipcA.d.ts +0 -2072
- package/dist/app.d.ts +0 -35
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -164
- package/dist/app.js.map +0 -1
- package/dist/auth/access.d.ts +0 -5
- package/dist/auth/access.d.ts.map +0 -1
- package/dist/auth/access.js +0 -59
- package/dist/auth/access.js.map +0 -1
- package/dist/auth/jexl.d.ts +0 -13
- package/dist/auth/jexl.d.ts.map +0 -1
- package/dist/auth/jexl.js +0 -30
- package/dist/auth/jexl.js.map +0 -1
- package/dist/auth/lockout.d.ts +0 -11
- package/dist/auth/lockout.d.ts.map +0 -1
- package/dist/auth/lockout.js +0 -37
- package/dist/auth/lockout.js.map +0 -1
- package/dist/auth/password.d.ts +0 -10
- package/dist/auth/password.d.ts.map +0 -1
- package/dist/auth/password.js +0 -28
- package/dist/auth/password.js.map +0 -1
- package/dist/auth/sessions.d.ts +0 -39
- package/dist/auth/sessions.d.ts.map +0 -1
- package/dist/auth/sessions.js +0 -126
- package/dist/auth/sessions.js.map +0 -1
- package/dist/auth/token.d.ts +0 -23
- package/dist/auth/token.d.ts.map +0 -1
- package/dist/auth/token.js +0 -40
- package/dist/auth/token.js.map +0 -1
- package/dist/chunk-23NM4LDU.js +0 -2883
- package/dist/chunk-2TKDCCIR.js +0 -2622
- package/dist/chunk-2UXLA4YN.js +0 -3139
- package/dist/chunk-2WODKOUB.js +0 -1627
- package/dist/chunk-35NM2WPO.js +0 -1658
- package/dist/chunk-3CMG2BH2.js +0 -1618
- package/dist/chunk-3SFITPX4.js +0 -2628
- package/dist/chunk-3TRRTN6U.js +0 -3441
- package/dist/chunk-57FNM42D.js +0 -2392
- package/dist/chunk-5U2WRCNH.js +0 -3140
- package/dist/chunk-5ZIA5COH.js +0 -3414
- package/dist/chunk-6TWQ6GTD.js +0 -3480
- package/dist/chunk-AKYYGMFS.js +0 -3365
- package/dist/chunk-AQO4HI2Y.js +0 -3204
- package/dist/chunk-BAMX7YUC.js +0 -1815
- package/dist/chunk-BQV3QW3Y.js +0 -2588
- package/dist/chunk-CQVTQ67D.js +0 -2632
- package/dist/chunk-CUOPCOU2.js +0 -1644
- package/dist/chunk-DCY7QHRB.js +0 -1637
- package/dist/chunk-DFBLNYUH.js +0 -3402
- package/dist/chunk-EH3MJGB5.js +0 -2571
- package/dist/chunk-EJG6AMYB.js +0 -3537
- package/dist/chunk-ELHRRPKX.js +0 -2863
- package/dist/chunk-EOW4YMAV.js +0 -1637
- package/dist/chunk-G43REXPX.js +0 -3147
- package/dist/chunk-GFKBPBJJ.js +0 -3637
- package/dist/chunk-HRLSFTLR.js +0 -3061
- package/dist/chunk-JFA22YFB.js +0 -1625
- package/dist/chunk-K3ASMUKV.js +0 -2601
- package/dist/chunk-KEKOEAX6.js +0 -3139
- package/dist/chunk-L65PQYDP.js +0 -1536
- package/dist/chunk-LFGSRQLX.js +0 -3568
- package/dist/chunk-M3HKRN7E.js +0 -1665
- package/dist/chunk-MQZH7RQC.js +0 -1667
- package/dist/chunk-NNZRYF3U.js +0 -3537
- package/dist/chunk-PRQ2RF5C.js +0 -3485
- package/dist/chunk-PYE2JSY4.js +0 -3568
- package/dist/chunk-PZMDK3MH.js +0 -3203
- package/dist/chunk-QCXLDKZO.js +0 -3272
- package/dist/chunk-QTIAQBNH.js +0 -3097
- package/dist/chunk-ROECUARS.js +0 -2615
- package/dist/chunk-SM32ND5M.js +0 -3472
- package/dist/chunk-T2DGC4MD.js +0 -3008
- package/dist/chunk-T626OZMH.js +0 -2602
- package/dist/chunk-TEGRS6J7.js +0 -2609
- package/dist/chunk-TLU77TLE.js +0 -3203
- package/dist/chunk-UKUEKTAO.js +0 -513
- package/dist/chunk-VCYYBN5J.js +0 -1873
- package/dist/chunk-VM43G3IG.js +0 -506
- package/dist/chunk-VWJKFZQU.js +0 -3139
- package/dist/chunk-WF5A6PDJ.js +0 -1618
- package/dist/chunk-WVD7PORQ.js +0 -1672
- package/dist/chunk-XX7N64NL.js +0 -3550
- package/dist/chunk-XZLIBQSO.js +0 -2397
- package/dist/chunk-YEBCT77K.js +0 -3269
- package/dist/chunk-YSSHLGQ6.js +0 -3139
- package/dist/chunk-YXEKNN5X.js +0 -3085
- package/dist/chunk-Z7CFUYVP.js +0 -3653
- package/dist/chunk-ZISFMAEL.js +0 -3550
- package/dist/controllers/admin-auth.controller.d.ts +0 -71
- package/dist/controllers/admin-auth.controller.d.ts.map +0 -1
- package/dist/controllers/admin-auth.controller.js +0 -450
- package/dist/controllers/admin-auth.controller.js.map +0 -1
- package/dist/controllers/audit.controller.d.ts +0 -42
- package/dist/controllers/audit.controller.d.ts.map +0 -1
- package/dist/controllers/audit.controller.js +0 -149
- package/dist/controllers/audit.controller.js.map +0 -1
- package/dist/controllers/auth.controller.d.ts +0 -143
- package/dist/controllers/auth.controller.d.ts.map +0 -1
- package/dist/controllers/auth.controller.js +0 -572
- package/dist/controllers/auth.controller.js.map +0 -1
- package/dist/controllers/collection.controller.d.ts +0 -170
- package/dist/controllers/collection.controller.d.ts.map +0 -1
- package/dist/controllers/collection.controller.js +0 -1033
- package/dist/controllers/collection.controller.js.map +0 -1
- package/dist/controllers/global.controller.d.ts +0 -20
- package/dist/controllers/global.controller.d.ts.map +0 -1
- package/dist/controllers/global.controller.js +0 -182
- package/dist/controllers/global.controller.js.map +0 -1
- package/dist/controllers/media.controller.d.ts +0 -39
- package/dist/controllers/media.controller.d.ts.map +0 -1
- package/dist/controllers/media.controller.js +0 -178
- package/dist/controllers/media.controller.js.map +0 -1
- package/dist/controllers/preview.controller.d.ts +0 -37
- package/dist/controllers/preview.controller.d.ts.map +0 -1
- package/dist/controllers/preview.controller.js +0 -48
- package/dist/controllers/preview.controller.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/middleware/auth.d.ts +0 -19
- package/dist/middleware/auth.d.ts.map +0 -1
- package/dist/middleware/auth.js +0 -157
- package/dist/middleware/auth.js.map +0 -1
- package/dist/middleware/rate-limit.d.ts +0 -9
- package/dist/middleware/rate-limit.d.ts.map +0 -1
- package/dist/middleware/rate-limit.js +0 -75
- package/dist/middleware/rate-limit.js.map +0 -1
- package/dist/network.d.ts +0 -6
- package/dist/network.d.ts.map +0 -1
- package/dist/network.js +0 -70
- package/dist/network.js.map +0 -1
- package/dist/observability-CNM4QFE4.js +0 -34
- package/dist/observability-L5BORBB2.js +0 -34
- package/dist/observability.d.ts +0 -113
- package/dist/observability.d.ts.map +0 -1
- package/dist/observability.js +0 -497
- package/dist/observability.js.map +0 -1
- package/dist/router.d.ts +0 -8
- package/dist/router.d.ts.map +0 -1
- package/dist/router.js +0 -704
- package/dist/router.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/services/audit.service.d.ts +0 -23
- package/dist/services/audit.service.d.ts.map +0 -1
- package/dist/services/audit.service.js +0 -39
- package/dist/services/audit.service.js.map +0 -1
- package/dist/services/defaults.service.d.ts +0 -8
- package/dist/services/defaults.service.d.ts.map +0 -1
- package/dist/services/defaults.service.js +0 -55
- package/dist/services/defaults.service.js.map +0 -1
- package/dist/services/email-template.d.ts +0 -46
- package/dist/services/email-template.d.ts.map +0 -1
- package/dist/services/email-template.js +0 -88
- package/dist/services/email-template.js.map +0 -1
- package/dist/services/email.service.d.ts +0 -34
- package/dist/services/email.service.d.ts.map +0 -1
- package/dist/services/email.service.js +0 -129
- package/dist/services/email.service.js.map +0 -1
- package/dist/services/media.service.d.ts +0 -20
- package/dist/services/media.service.d.ts.map +0 -1
- package/dist/services/media.service.js +0 -49
- package/dist/services/media.service.js.map +0 -1
- package/dist/services/population.service.d.ts +0 -20
- package/dist/services/population.service.d.ts.map +0 -1
- package/dist/services/population.service.js +0 -224
- package/dist/services/population.service.js.map +0 -1
- package/dist/types/access.d.ts +0 -48
- package/dist/types/access.d.ts.map +0 -1
- package/dist/types/access.js +0 -2
- package/dist/types/access.js.map +0 -1
- package/dist/types/adapters.d.ts +0 -152
- package/dist/types/adapters.d.ts.map +0 -1
- package/dist/types/adapters.js +0 -2
- package/dist/types/adapters.js.map +0 -1
- package/dist/types/admin-auth.d.ts +0 -132
- package/dist/types/admin-auth.d.ts.map +0 -1
- package/dist/types/admin-auth.js +0 -2
- package/dist/types/admin-auth.js.map +0 -1
- package/dist/types/admin.d.ts +0 -86
- package/dist/types/admin.d.ts.map +0 -1
- package/dist/types/admin.js +0 -2
- package/dist/types/admin.js.map +0 -1
- package/dist/types/app-config.d.ts +0 -279
- package/dist/types/app-config.d.ts.map +0 -1
- package/dist/types/app-config.js +0 -2
- package/dist/types/app-config.js.map +0 -1
- package/dist/types/documents.d.ts +0 -65
- package/dist/types/documents.d.ts.map +0 -1
- package/dist/types/documents.js +0 -2
- package/dist/types/documents.js.map +0 -1
- package/dist/types/hooks.d.ts +0 -122
- package/dist/types/hooks.d.ts.map +0 -1
- package/dist/types/hooks.js +0 -2
- package/dist/types/hooks.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -13
- package/dist/types/index.js.map +0 -1
- package/dist/types/request.d.ts +0 -42
- package/dist/types/request.d.ts.map +0 -1
- package/dist/types/request.js +0 -2
- package/dist/types/request.js.map +0 -1
- package/dist/types/schema-config.d.ts +0 -443
- package/dist/types/schema-config.d.ts.map +0 -1
- package/dist/types/schema-config.js +0 -2
- package/dist/types/schema-config.js.map +0 -1
- package/dist/types/schema-core.d.ts +0 -628
- package/dist/types/schema-core.d.ts.map +0 -1
- package/dist/types/schema-core.js +0 -2
- package/dist/types/schema-core.js.map +0 -1
- package/dist/types/schema-inference.d.ts +0 -73
- package/dist/types/schema-inference.d.ts.map +0 -1
- package/dist/types/schema-inference.js +0 -2
- package/dist/types/schema-inference.js.map +0 -1
- package/dist/types/workflows.d.ts +0 -121
- package/dist/types/workflows.d.ts.map +0 -1
- package/dist/types/workflows.js +0 -7
- package/dist/types/workflows.js.map +0 -1
- package/dist/utils/access-control.d.ts +0 -35
- package/dist/utils/access-control.d.ts.map +0 -1
- package/dist/utils/access-control.js +0 -161
- package/dist/utils/access-control.js.map +0 -1
- package/dist/utils/admin-auth.d.ts +0 -5
- package/dist/utils/admin-auth.d.ts.map +0 -1
- package/dist/utils/admin-auth.js +0 -39
- package/dist/utils/admin-auth.js.map +0 -1
- package/dist/utils/block-references.d.ts +0 -10
- package/dist/utils/block-references.d.ts.map +0 -1
- package/dist/utils/block-references.js +0 -100
- package/dist/utils/block-references.js.map +0 -1
- package/dist/utils/collection-search.d.ts +0 -11
- package/dist/utils/collection-search.d.ts.map +0 -1
- package/dist/utils/collection-search.js +0 -204
- package/dist/utils/collection-search.js.map +0 -1
- package/dist/utils/config.d.ts +0 -8
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -336
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/hooks.d.ts +0 -41
- package/dist/utils/hooks.d.ts.map +0 -1
- package/dist/utils/hooks.js +0 -177
- package/dist/utils/hooks.js.map +0 -1
- package/dist/utils/openapi.d.ts +0 -6
- package/dist/utils/openapi.d.ts.map +0 -1
- package/dist/utils/openapi.js +0 -981
- package/dist/utils/openapi.js.map +0 -1
- package/dist/utils/parse-sort.d.ts +0 -43
- package/dist/utils/parse-sort.d.ts.map +0 -1
- package/dist/utils/parse-sort.js +0 -70
- package/dist/utils/parse-sort.js.map +0 -1
- package/dist/utils/parse-where.d.ts +0 -69
- package/dist/utils/parse-where.d.ts.map +0 -1
- package/dist/utils/parse-where.js +0 -202
- package/dist/utils/parse-where.js.map +0 -1
- package/dist/utils/readonly-db.d.ts +0 -9
- package/dist/utils/readonly-db.d.ts.map +0 -1
- package/dist/utils/readonly-db.js +0 -21
- package/dist/utils/readonly-db.js.map +0 -1
- package/dist/utils/swagger.d.ts +0 -11
- package/dist/utils/swagger.d.ts.map +0 -1
- package/dist/utils/swagger.js +0 -62
- package/dist/utils/swagger.js.map +0 -1
- package/dist/utils/upload-validation.d.ts +0 -23
- package/dist/utils/upload-validation.d.ts.map +0 -1
- package/dist/utils/upload-validation.js +0 -46
- package/dist/utils/upload-validation.js.map +0 -1
- package/dist/utils/where-sanitizer.d.ts +0 -10
- package/dist/utils/where-sanitizer.d.ts.map +0 -1
- package/dist/utils/where-sanitizer.js +0 -67
- package/dist/utils/where-sanitizer.js.map +0 -1
- package/dist/workflows.d.ts +0 -86
- package/dist/workflows.d.ts.map +0 -1
- package/dist/workflows.js +0 -405
- package/dist/workflows.js.map +0 -1
package/dist/server.cjs
CHANGED
|
@@ -8,6 +8,9 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
8
8
|
var __esm = (fn, res) => function __init() {
|
|
9
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
10
|
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
11
14
|
var __export = (target, all) => {
|
|
12
15
|
for (var name in all)
|
|
13
16
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,6 +33,1757 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
33
|
));
|
|
31
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
35
|
|
|
36
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/interopRequireDefault.js
|
|
37
|
+
var require_interopRequireDefault = __commonJS({
|
|
38
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/interopRequireDefault.js"(exports2, module2) {
|
|
39
|
+
"use strict";
|
|
40
|
+
function _interopRequireDefault(e) {
|
|
41
|
+
return e && e.__esModule ? e : {
|
|
42
|
+
"default": e
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
module2.exports = _interopRequireDefault, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/typeof.js
|
|
50
|
+
var require_typeof = __commonJS({
|
|
51
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/typeof.js"(exports2, module2) {
|
|
52
|
+
"use strict";
|
|
53
|
+
function _typeof(o) {
|
|
54
|
+
"@babel/helpers - typeof";
|
|
55
|
+
return module2.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
56
|
+
return typeof o2;
|
|
57
|
+
} : function(o2) {
|
|
58
|
+
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
59
|
+
}, module2.exports.__esModule = true, module2.exports["default"] = module2.exports, _typeof(o);
|
|
60
|
+
}
|
|
61
|
+
module2.exports = _typeof, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/toPrimitive.js
|
|
66
|
+
var require_toPrimitive = __commonJS({
|
|
67
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/toPrimitive.js"(exports2, module2) {
|
|
68
|
+
"use strict";
|
|
69
|
+
var _typeof = require_typeof()["default"];
|
|
70
|
+
function toPrimitive(t, r) {
|
|
71
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
72
|
+
var e = t[Symbol.toPrimitive];
|
|
73
|
+
if (void 0 !== e) {
|
|
74
|
+
var i = e.call(t, r || "default");
|
|
75
|
+
if ("object" != _typeof(i)) return i;
|
|
76
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
77
|
+
}
|
|
78
|
+
return ("string" === r ? String : Number)(t);
|
|
79
|
+
}
|
|
80
|
+
module2.exports = toPrimitive, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/toPropertyKey.js
|
|
85
|
+
var require_toPropertyKey = __commonJS({
|
|
86
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/toPropertyKey.js"(exports2, module2) {
|
|
87
|
+
"use strict";
|
|
88
|
+
var _typeof = require_typeof()["default"];
|
|
89
|
+
var toPrimitive = require_toPrimitive();
|
|
90
|
+
function toPropertyKey(t) {
|
|
91
|
+
var i = toPrimitive(t, "string");
|
|
92
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
93
|
+
}
|
|
94
|
+
module2.exports = toPropertyKey, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/defineProperty.js
|
|
99
|
+
var require_defineProperty = __commonJS({
|
|
100
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/defineProperty.js"(exports2, module2) {
|
|
101
|
+
"use strict";
|
|
102
|
+
var toPropertyKey = require_toPropertyKey();
|
|
103
|
+
function _defineProperty(e, r, t) {
|
|
104
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
105
|
+
value: t,
|
|
106
|
+
enumerable: true,
|
|
107
|
+
configurable: true,
|
|
108
|
+
writable: true
|
|
109
|
+
}) : e[r] = t, e;
|
|
110
|
+
}
|
|
111
|
+
module2.exports = _defineProperty, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/classCallCheck.js
|
|
116
|
+
var require_classCallCheck = __commonJS({
|
|
117
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/classCallCheck.js"(exports2, module2) {
|
|
118
|
+
"use strict";
|
|
119
|
+
function _classCallCheck(a, n) {
|
|
120
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
121
|
+
}
|
|
122
|
+
module2.exports = _classCallCheck, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/createClass.js
|
|
127
|
+
var require_createClass = __commonJS({
|
|
128
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/createClass.js"(exports2, module2) {
|
|
129
|
+
"use strict";
|
|
130
|
+
var toPropertyKey = require_toPropertyKey();
|
|
131
|
+
function _defineProperties(e, r) {
|
|
132
|
+
for (var t = 0; t < r.length; t++) {
|
|
133
|
+
var o = r[t];
|
|
134
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function _createClass(e, r, t) {
|
|
138
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
139
|
+
writable: false
|
|
140
|
+
}), e;
|
|
141
|
+
}
|
|
142
|
+
module2.exports = _createClass, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/arrayLikeToArray.js
|
|
147
|
+
var require_arrayLikeToArray = __commonJS({
|
|
148
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/arrayLikeToArray.js"(exports2, module2) {
|
|
149
|
+
"use strict";
|
|
150
|
+
function _arrayLikeToArray(r, a) {
|
|
151
|
+
(null == a || a > r.length) && (a = r.length);
|
|
152
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
153
|
+
return n;
|
|
154
|
+
}
|
|
155
|
+
module2.exports = _arrayLikeToArray, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js
|
|
160
|
+
var require_arrayWithoutHoles = __commonJS({
|
|
161
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js"(exports2, module2) {
|
|
162
|
+
"use strict";
|
|
163
|
+
var arrayLikeToArray = require_arrayLikeToArray();
|
|
164
|
+
function _arrayWithoutHoles(r) {
|
|
165
|
+
if (Array.isArray(r)) return arrayLikeToArray(r);
|
|
166
|
+
}
|
|
167
|
+
module2.exports = _arrayWithoutHoles, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/iterableToArray.js
|
|
172
|
+
var require_iterableToArray = __commonJS({
|
|
173
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/iterableToArray.js"(exports2, module2) {
|
|
174
|
+
"use strict";
|
|
175
|
+
function _iterableToArray(r) {
|
|
176
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
177
|
+
}
|
|
178
|
+
module2.exports = _iterableToArray, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js
|
|
183
|
+
var require_unsupportedIterableToArray = __commonJS({
|
|
184
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"(exports2, module2) {
|
|
185
|
+
"use strict";
|
|
186
|
+
var arrayLikeToArray = require_arrayLikeToArray();
|
|
187
|
+
function _unsupportedIterableToArray(r, a) {
|
|
188
|
+
if (r) {
|
|
189
|
+
if ("string" == typeof r) return arrayLikeToArray(r, a);
|
|
190
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
191
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
module2.exports = _unsupportedIterableToArray, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/nonIterableSpread.js
|
|
199
|
+
var require_nonIterableSpread = __commonJS({
|
|
200
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/nonIterableSpread.js"(exports2, module2) {
|
|
201
|
+
"use strict";
|
|
202
|
+
function _nonIterableSpread() {
|
|
203
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
204
|
+
}
|
|
205
|
+
module2.exports = _nonIterableSpread, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// ../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/toConsumableArray.js
|
|
210
|
+
var require_toConsumableArray = __commonJS({
|
|
211
|
+
"../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/toConsumableArray.js"(exports2, module2) {
|
|
212
|
+
"use strict";
|
|
213
|
+
var arrayWithoutHoles = require_arrayWithoutHoles();
|
|
214
|
+
var iterableToArray = require_iterableToArray();
|
|
215
|
+
var unsupportedIterableToArray = require_unsupportedIterableToArray();
|
|
216
|
+
var nonIterableSpread = require_nonIterableSpread();
|
|
217
|
+
function _toConsumableArray(r) {
|
|
218
|
+
return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread();
|
|
219
|
+
}
|
|
220
|
+
module2.exports = _toConsumableArray, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/evaluator/handlers.js
|
|
225
|
+
var require_handlers = __commonJS({
|
|
226
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/evaluator/handlers.js"(exports2) {
|
|
227
|
+
"use strict";
|
|
228
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
229
|
+
var _toConsumableArray2 = _interopRequireDefault(require_toConsumableArray());
|
|
230
|
+
var poolNames = {
|
|
231
|
+
functions: "Jexl Function",
|
|
232
|
+
transforms: "Transform"
|
|
233
|
+
};
|
|
234
|
+
exports2.ArrayLiteral = function(ast) {
|
|
235
|
+
return this.evalArray(ast.value);
|
|
236
|
+
};
|
|
237
|
+
exports2.BinaryExpression = function(ast) {
|
|
238
|
+
var _this = this;
|
|
239
|
+
var grammarOp = this._grammar.elements[ast.operator];
|
|
240
|
+
if (grammarOp.evalOnDemand) {
|
|
241
|
+
var wrap = function wrap2(subAst) {
|
|
242
|
+
return {
|
|
243
|
+
eval: function _eval() {
|
|
244
|
+
return _this.eval(subAst);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
return grammarOp.evalOnDemand(wrap(ast.left), wrap(ast.right));
|
|
249
|
+
}
|
|
250
|
+
return this.Promise.all([this.eval(ast.left), this.eval(ast.right)]).then(function(arr) {
|
|
251
|
+
return grammarOp.eval(arr[0], arr[1]);
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
exports2.ConditionalExpression = function(ast) {
|
|
255
|
+
var _this2 = this;
|
|
256
|
+
return this.eval(ast.test).then(function(res) {
|
|
257
|
+
if (res) {
|
|
258
|
+
if (ast.consequent) {
|
|
259
|
+
return _this2.eval(ast.consequent);
|
|
260
|
+
}
|
|
261
|
+
return res;
|
|
262
|
+
}
|
|
263
|
+
return _this2.eval(ast.alternate);
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
exports2.FilterExpression = function(ast) {
|
|
267
|
+
var _this3 = this;
|
|
268
|
+
return this.eval(ast.subject).then(function(subject) {
|
|
269
|
+
if (ast.relative) {
|
|
270
|
+
return _this3._filterRelative(subject, ast.expr);
|
|
271
|
+
}
|
|
272
|
+
return _this3._filterStatic(subject, ast.expr);
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
exports2.Identifier = function(ast) {
|
|
276
|
+
if (!ast.from) {
|
|
277
|
+
return ast.relative ? this._relContext[ast.value] : this._context[ast.value];
|
|
278
|
+
}
|
|
279
|
+
return this.eval(ast.from).then(function(context) {
|
|
280
|
+
if (context === void 0 || context === null) {
|
|
281
|
+
return void 0;
|
|
282
|
+
}
|
|
283
|
+
if (Array.isArray(context)) {
|
|
284
|
+
context = context[0];
|
|
285
|
+
}
|
|
286
|
+
return context[ast.value];
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
exports2.Literal = function(ast) {
|
|
290
|
+
return ast.value;
|
|
291
|
+
};
|
|
292
|
+
exports2.ObjectLiteral = function(ast) {
|
|
293
|
+
return this.evalMap(ast.value);
|
|
294
|
+
};
|
|
295
|
+
exports2.FunctionCall = function(ast) {
|
|
296
|
+
var poolName = poolNames[ast.pool];
|
|
297
|
+
if (!poolName) {
|
|
298
|
+
throw new Error("Corrupt AST: Pool '".concat(ast.pool, "' not found"));
|
|
299
|
+
}
|
|
300
|
+
var pool = this._grammar[ast.pool];
|
|
301
|
+
var func = pool[ast.name];
|
|
302
|
+
if (!func) {
|
|
303
|
+
throw new Error("".concat(poolName, " ").concat(ast.name, " is not defined."));
|
|
304
|
+
}
|
|
305
|
+
return this.evalArray(ast.args || []).then(function(args) {
|
|
306
|
+
return func.apply(void 0, (0, _toConsumableArray2.default)(args));
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
exports2.UnaryExpression = function(ast) {
|
|
310
|
+
var _this4 = this;
|
|
311
|
+
return this.eval(ast.right).then(function(right) {
|
|
312
|
+
return _this4._grammar.elements[ast.operator].eval(right);
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/evaluator/Evaluator.js
|
|
319
|
+
var require_Evaluator = __commonJS({
|
|
320
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/evaluator/Evaluator.js"(exports2, module2) {
|
|
321
|
+
"use strict";
|
|
322
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
323
|
+
var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
|
|
324
|
+
var _createClass2 = _interopRequireDefault(require_createClass());
|
|
325
|
+
var handlers = require_handlers();
|
|
326
|
+
var Evaluator = /* @__PURE__ */ (function() {
|
|
327
|
+
function Evaluator2(grammar, context, relativeContext) {
|
|
328
|
+
var promise = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : Promise;
|
|
329
|
+
(0, _classCallCheck2.default)(this, Evaluator2);
|
|
330
|
+
this._grammar = grammar;
|
|
331
|
+
this._context = context || {};
|
|
332
|
+
this._relContext = relativeContext || this._context;
|
|
333
|
+
this.Promise = promise;
|
|
334
|
+
}
|
|
335
|
+
(0, _createClass2.default)(Evaluator2, [{
|
|
336
|
+
key: "eval",
|
|
337
|
+
value: function _eval(ast) {
|
|
338
|
+
var _this = this;
|
|
339
|
+
return this.Promise.resolve().then(function() {
|
|
340
|
+
return handlers[ast.type].call(_this, ast);
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Simultaneously evaluates each expression within an array, and delivers the
|
|
345
|
+
* response as an array with the resulting values at the same indexes as their
|
|
346
|
+
* originating expressions.
|
|
347
|
+
* @param {Array<string>} arr An array of expression strings to be evaluated
|
|
348
|
+
* @returns {Promise<Array<{}>>} resolves with the result array
|
|
349
|
+
*/
|
|
350
|
+
}, {
|
|
351
|
+
key: "evalArray",
|
|
352
|
+
value: function evalArray(arr) {
|
|
353
|
+
var _this2 = this;
|
|
354
|
+
return this.Promise.all(arr.map(function(elem) {
|
|
355
|
+
return _this2.eval(elem);
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Simultaneously evaluates each expression within a map, and delivers the
|
|
360
|
+
* response as a map with the same keys, but with the evaluated result for each
|
|
361
|
+
* as their value.
|
|
362
|
+
* @param {{}} map A map of expression names to expression trees to be
|
|
363
|
+
* evaluated
|
|
364
|
+
* @returns {Promise<{}>} resolves with the result map.
|
|
365
|
+
*/
|
|
366
|
+
}, {
|
|
367
|
+
key: "evalMap",
|
|
368
|
+
value: function evalMap(map) {
|
|
369
|
+
var _this3 = this;
|
|
370
|
+
var keys = Object.keys(map);
|
|
371
|
+
var result = {};
|
|
372
|
+
var asts = keys.map(function(key) {
|
|
373
|
+
return _this3.eval(map[key]);
|
|
374
|
+
});
|
|
375
|
+
return this.Promise.all(asts).then(function(vals) {
|
|
376
|
+
vals.forEach(function(val, idx) {
|
|
377
|
+
result[keys[idx]] = val;
|
|
378
|
+
});
|
|
379
|
+
return result;
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Applies a filter expression with relative identifier elements to a subject.
|
|
384
|
+
* The intent is for the subject to be an array of subjects that will be
|
|
385
|
+
* individually used as the relative context against the provided expression
|
|
386
|
+
* tree. Only the elements whose expressions result in a truthy value will be
|
|
387
|
+
* included in the resulting array.
|
|
388
|
+
*
|
|
389
|
+
* If the subject is not an array of values, it will be converted to a single-
|
|
390
|
+
* element array before running the filter.
|
|
391
|
+
* @param {*} subject The value to be filtered usually an array. If this value is
|
|
392
|
+
* not an array, it will be converted to an array with this value as the
|
|
393
|
+
* only element.
|
|
394
|
+
* @param {{}} expr The expression tree to run against each subject. If the
|
|
395
|
+
* tree evaluates to a truthy result, then the value will be included in
|
|
396
|
+
* the returned array otherwise, it will be eliminated.
|
|
397
|
+
* @returns {Promise<Array>} resolves with an array of values that passed the
|
|
398
|
+
* expression filter.
|
|
399
|
+
* @private
|
|
400
|
+
*/
|
|
401
|
+
}, {
|
|
402
|
+
key: "_filterRelative",
|
|
403
|
+
value: function _filterRelative(subject, expr) {
|
|
404
|
+
var _this4 = this;
|
|
405
|
+
var promises = [];
|
|
406
|
+
if (!Array.isArray(subject)) {
|
|
407
|
+
subject = subject === void 0 ? [] : [subject];
|
|
408
|
+
}
|
|
409
|
+
subject.forEach(function(elem) {
|
|
410
|
+
var evalInst = new Evaluator2(_this4._grammar, _this4._context, elem, _this4.Promise);
|
|
411
|
+
promises.push(evalInst.eval(expr));
|
|
412
|
+
});
|
|
413
|
+
return this.Promise.all(promises).then(function(values) {
|
|
414
|
+
var results = [];
|
|
415
|
+
values.forEach(function(value, idx) {
|
|
416
|
+
if (value) {
|
|
417
|
+
results.push(subject[idx]);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
return results;
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Applies a static filter expression to a subject value. If the filter
|
|
425
|
+
* expression evaluates to boolean true, the subject is returned if false,
|
|
426
|
+
* undefined.
|
|
427
|
+
*
|
|
428
|
+
* For any other resulting value of the expression, this function will attempt
|
|
429
|
+
* to respond with the property at that name or index of the subject.
|
|
430
|
+
* @param {*} subject The value to be filtered. Usually an Array (for which
|
|
431
|
+
* the expression would generally resolve to a numeric index) or an
|
|
432
|
+
* Object (for which the expression would generally resolve to a string
|
|
433
|
+
* indicating a property name)
|
|
434
|
+
* @param {{}} expr The expression tree to run against the subject
|
|
435
|
+
* @returns {Promise<*>} resolves with the value of the drill-down.
|
|
436
|
+
* @private
|
|
437
|
+
*/
|
|
438
|
+
}, {
|
|
439
|
+
key: "_filterStatic",
|
|
440
|
+
value: function _filterStatic(subject, expr) {
|
|
441
|
+
return this.eval(expr).then(function(res) {
|
|
442
|
+
if (typeof res === "boolean") {
|
|
443
|
+
return res ? subject : void 0;
|
|
444
|
+
}
|
|
445
|
+
return subject[res];
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}]);
|
|
449
|
+
return Evaluator2;
|
|
450
|
+
})();
|
|
451
|
+
module2.exports = Evaluator;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Lexer.js
|
|
456
|
+
var require_Lexer = __commonJS({
|
|
457
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Lexer.js"(exports2, module2) {
|
|
458
|
+
"use strict";
|
|
459
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
460
|
+
var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
|
|
461
|
+
var _createClass2 = _interopRequireDefault(require_createClass());
|
|
462
|
+
var numericRegex = /^-?(?:(?:[0-9]*\.[0-9]+)|[0-9]+)$/;
|
|
463
|
+
var identRegex = /^[a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$][a-zA-Zа-яА-Я0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$]*$/;
|
|
464
|
+
var escEscRegex = /\\\\/;
|
|
465
|
+
var whitespaceRegex = /^\s*$/;
|
|
466
|
+
var preOpRegexElems = [
|
|
467
|
+
// Strings
|
|
468
|
+
"'(?:(?:\\\\')|[^'])*'",
|
|
469
|
+
'"(?:(?:\\\\")|[^"])*"',
|
|
470
|
+
// Whitespace
|
|
471
|
+
"\\s+",
|
|
472
|
+
// Booleans
|
|
473
|
+
"\\btrue\\b",
|
|
474
|
+
"\\bfalse\\b"
|
|
475
|
+
];
|
|
476
|
+
var postOpRegexElems = [
|
|
477
|
+
// Identifiers
|
|
478
|
+
"[a-zA-Z\u0430-\u044F\u0410-\u042F_\xC0-\xD6\xD8-\xF6\xF8-\xFF\\$][a-zA-Z0-9\u0430-\u044F\u0410-\u042F_\xC0-\xD6\xD8-\xF6\xF8-\xFF\\$]*",
|
|
479
|
+
// Numerics (without negative symbol)
|
|
480
|
+
"(?:(?:[0-9]*\\.[0-9]+)|[0-9]+)"
|
|
481
|
+
];
|
|
482
|
+
var minusNegatesAfter = ["binaryOp", "unaryOp", "openParen", "openBracket", "question", "colon"];
|
|
483
|
+
var Lexer = /* @__PURE__ */ (function() {
|
|
484
|
+
function Lexer2(grammar) {
|
|
485
|
+
(0, _classCallCheck2.default)(this, Lexer2);
|
|
486
|
+
this._grammar = grammar;
|
|
487
|
+
}
|
|
488
|
+
(0, _createClass2.default)(Lexer2, [{
|
|
489
|
+
key: "getElements",
|
|
490
|
+
value: function getElements(str) {
|
|
491
|
+
var regex = this._getSplitRegex();
|
|
492
|
+
return str.split(regex).filter(function(elem) {
|
|
493
|
+
return elem;
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Converts an array of expression elements into an array of tokens. Note that
|
|
498
|
+
* the resulting array may not equal the element array in length, as any
|
|
499
|
+
* elements that consist only of whitespace get appended to the previous
|
|
500
|
+
* token's "raw" property. For the structure of a token object, please see
|
|
501
|
+
* {@link Lexer#tokenize}.
|
|
502
|
+
* @param {Array<string>} elements An array of Jexl expression elements to be
|
|
503
|
+
* converted to tokens
|
|
504
|
+
* @returns {Array<{type, value, raw}>} an array of token objects.
|
|
505
|
+
*/
|
|
506
|
+
}, {
|
|
507
|
+
key: "getTokens",
|
|
508
|
+
value: function getTokens(elements) {
|
|
509
|
+
var tokens = [];
|
|
510
|
+
var negate = false;
|
|
511
|
+
for (var i = 0; i < elements.length; i++) {
|
|
512
|
+
if (this._isWhitespace(elements[i])) {
|
|
513
|
+
if (tokens.length) {
|
|
514
|
+
tokens[tokens.length - 1].raw += elements[i];
|
|
515
|
+
}
|
|
516
|
+
} else if (elements[i] === "-" && this._isNegative(tokens)) {
|
|
517
|
+
negate = true;
|
|
518
|
+
} else {
|
|
519
|
+
if (negate) {
|
|
520
|
+
elements[i] = "-" + elements[i];
|
|
521
|
+
negate = false;
|
|
522
|
+
}
|
|
523
|
+
tokens.push(this._createToken(elements[i]));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (negate) {
|
|
527
|
+
tokens.push(this._createToken("-"));
|
|
528
|
+
}
|
|
529
|
+
return tokens;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Converts a Jexl string into an array of tokens. Each token is an object
|
|
533
|
+
* in the following format:
|
|
534
|
+
*
|
|
535
|
+
* {
|
|
536
|
+
* type: <string>,
|
|
537
|
+
* [name]: <string>,
|
|
538
|
+
* value: <boolean|number|string>,
|
|
539
|
+
* raw: <string>
|
|
540
|
+
* }
|
|
541
|
+
*
|
|
542
|
+
* Type is one of the following:
|
|
543
|
+
*
|
|
544
|
+
* literal, identifier, binaryOp, unaryOp
|
|
545
|
+
*
|
|
546
|
+
* OR, if the token is a control character its type is the name of the element
|
|
547
|
+
* defined in the Grammar.
|
|
548
|
+
*
|
|
549
|
+
* Name appears only if the token is a control string found in
|
|
550
|
+
* {@link grammar#elements}, and is set to the name of the element.
|
|
551
|
+
*
|
|
552
|
+
* Value is the value of the token in the correct type (boolean or numeric as
|
|
553
|
+
* appropriate). Raw is the string representation of this value taken directly
|
|
554
|
+
* from the expression string, including any trailing spaces.
|
|
555
|
+
* @param {string} str The Jexl string to be tokenized
|
|
556
|
+
* @returns {Array<{type, value, raw}>} an array of token objects.
|
|
557
|
+
* @throws {Error} if the provided string contains an invalid token.
|
|
558
|
+
*/
|
|
559
|
+
}, {
|
|
560
|
+
key: "tokenize",
|
|
561
|
+
value: function tokenize(str) {
|
|
562
|
+
var elements = this.getElements(str);
|
|
563
|
+
return this.getTokens(elements);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Creates a new token object from an element of a Jexl string. See
|
|
567
|
+
* {@link Lexer#tokenize} for a description of the token object.
|
|
568
|
+
* @param {string} element The element from which a token should be made
|
|
569
|
+
* @returns {{value: number|boolean|string, [name]: string, type: string,
|
|
570
|
+
* raw: string}} a token object describing the provided element.
|
|
571
|
+
* @throws {Error} if the provided string is not a valid expression element.
|
|
572
|
+
* @private
|
|
573
|
+
*/
|
|
574
|
+
}, {
|
|
575
|
+
key: "_createToken",
|
|
576
|
+
value: function _createToken(element) {
|
|
577
|
+
var token = {
|
|
578
|
+
type: "literal",
|
|
579
|
+
value: element,
|
|
580
|
+
raw: element
|
|
581
|
+
};
|
|
582
|
+
if (element[0] === '"' || element[0] === "'") {
|
|
583
|
+
token.value = this._unquote(element);
|
|
584
|
+
} else if (element.match(numericRegex)) {
|
|
585
|
+
token.value = parseFloat(element);
|
|
586
|
+
} else if (element === "true" || element === "false") {
|
|
587
|
+
token.value = element === "true";
|
|
588
|
+
} else if (this._grammar.elements[element]) {
|
|
589
|
+
token.type = this._grammar.elements[element].type;
|
|
590
|
+
} else if (element.match(identRegex)) {
|
|
591
|
+
token.type = "identifier";
|
|
592
|
+
} else {
|
|
593
|
+
throw new Error("Invalid expression token: ".concat(element));
|
|
594
|
+
}
|
|
595
|
+
return token;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Escapes a string so that it can be treated as a string literal within a
|
|
599
|
+
* regular expression.
|
|
600
|
+
* @param {string} str The string to be escaped
|
|
601
|
+
* @returns {string} the RegExp-escaped string.
|
|
602
|
+
* @see https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions
|
|
603
|
+
* @private
|
|
604
|
+
*/
|
|
605
|
+
}, {
|
|
606
|
+
key: "_escapeRegExp",
|
|
607
|
+
value: function _escapeRegExp(str) {
|
|
608
|
+
str = str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
609
|
+
if (str.match(identRegex)) {
|
|
610
|
+
str = "\\b" + str + "\\b";
|
|
611
|
+
}
|
|
612
|
+
return str;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Gets a RegEx object appropriate for splitting a Jexl string into its core
|
|
616
|
+
* elements.
|
|
617
|
+
* @returns {RegExp} An element-splitting RegExp object
|
|
618
|
+
* @private
|
|
619
|
+
*/
|
|
620
|
+
}, {
|
|
621
|
+
key: "_getSplitRegex",
|
|
622
|
+
value: function _getSplitRegex() {
|
|
623
|
+
var _this = this;
|
|
624
|
+
if (!this._splitRegex) {
|
|
625
|
+
var elemArray = Object.keys(this._grammar.elements).sort(function(a, b) {
|
|
626
|
+
return b.length - a.length;
|
|
627
|
+
}).map(function(elem) {
|
|
628
|
+
return _this._escapeRegExp(elem);
|
|
629
|
+
}, this);
|
|
630
|
+
this._splitRegex = new RegExp("(" + [preOpRegexElems.join("|"), elemArray.join("|"), postOpRegexElems.join("|")].join("|") + ")");
|
|
631
|
+
}
|
|
632
|
+
return this._splitRegex;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Determines whether the addition of a '-' token should be interpreted as a
|
|
636
|
+
* negative symbol for an upcoming number, given an array of tokens already
|
|
637
|
+
* processed.
|
|
638
|
+
* @param {Array<Object>} tokens An array of tokens already processed
|
|
639
|
+
* @returns {boolean} true if adding a '-' should be considered a negative
|
|
640
|
+
* symbol; false otherwise
|
|
641
|
+
* @private
|
|
642
|
+
*/
|
|
643
|
+
}, {
|
|
644
|
+
key: "_isNegative",
|
|
645
|
+
value: function _isNegative(tokens) {
|
|
646
|
+
if (!tokens.length) return true;
|
|
647
|
+
return minusNegatesAfter.some(function(type) {
|
|
648
|
+
return type === tokens[tokens.length - 1].type;
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* A utility function to determine if a string consists of only space
|
|
653
|
+
* characters.
|
|
654
|
+
* @param {string} str A string to be tested
|
|
655
|
+
* @returns {boolean} true if the string is empty or consists of only spaces;
|
|
656
|
+
* false otherwise.
|
|
657
|
+
* @private
|
|
658
|
+
*/
|
|
659
|
+
}, {
|
|
660
|
+
key: "_isWhitespace",
|
|
661
|
+
value: function _isWhitespace(str) {
|
|
662
|
+
return !!str.match(whitespaceRegex);
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Removes the beginning and trailing quotes from a string, unescapes any
|
|
666
|
+
* escaped quotes on its interior, and unescapes any escaped escape
|
|
667
|
+
* characters. Note that this function is not defensive; it assumes that the
|
|
668
|
+
* provided string is not empty, and that its first and last characters are
|
|
669
|
+
* actually quotes.
|
|
670
|
+
* @param {string} str A string whose first and last characters are quotes
|
|
671
|
+
* @returns {string} a string with the surrounding quotes stripped and escapes
|
|
672
|
+
* properly processed.
|
|
673
|
+
* @private
|
|
674
|
+
*/
|
|
675
|
+
}, {
|
|
676
|
+
key: "_unquote",
|
|
677
|
+
value: function _unquote(str) {
|
|
678
|
+
var quote = str[0];
|
|
679
|
+
var escQuoteRegex = new RegExp("\\\\" + quote, "g");
|
|
680
|
+
return str.substr(1, str.length - 2).replace(escQuoteRegex, quote).replace(escEscRegex, "\\");
|
|
681
|
+
}
|
|
682
|
+
}]);
|
|
683
|
+
return Lexer2;
|
|
684
|
+
})();
|
|
685
|
+
module2.exports = Lexer;
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/handlers.js
|
|
690
|
+
var require_handlers2 = __commonJS({
|
|
691
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/handlers.js"(exports2) {
|
|
692
|
+
"use strict";
|
|
693
|
+
exports2.argVal = function(ast) {
|
|
694
|
+
if (ast) this._cursor.args.push(ast);
|
|
695
|
+
};
|
|
696
|
+
exports2.arrayStart = function() {
|
|
697
|
+
this._placeAtCursor({
|
|
698
|
+
type: "ArrayLiteral",
|
|
699
|
+
value: []
|
|
700
|
+
});
|
|
701
|
+
};
|
|
702
|
+
exports2.arrayVal = function(ast) {
|
|
703
|
+
if (ast) {
|
|
704
|
+
this._cursor.value.push(ast);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
exports2.binaryOp = function(token) {
|
|
708
|
+
var precedence = this._grammar.elements[token.value].precedence || 0;
|
|
709
|
+
var parent = this._cursor._parent;
|
|
710
|
+
while (parent && parent.operator && this._grammar.elements[parent.operator].precedence >= precedence) {
|
|
711
|
+
this._cursor = parent;
|
|
712
|
+
parent = parent._parent;
|
|
713
|
+
}
|
|
714
|
+
var node = {
|
|
715
|
+
type: "BinaryExpression",
|
|
716
|
+
operator: token.value,
|
|
717
|
+
left: this._cursor
|
|
718
|
+
};
|
|
719
|
+
this._setParent(this._cursor, node);
|
|
720
|
+
this._cursor = parent;
|
|
721
|
+
this._placeAtCursor(node);
|
|
722
|
+
};
|
|
723
|
+
exports2.dot = function() {
|
|
724
|
+
this._nextIdentEncapsulate = this._cursor && this._cursor.type !== "UnaryExpression" && (this._cursor.type !== "BinaryExpression" || this._cursor.type === "BinaryExpression" && this._cursor.right);
|
|
725
|
+
this._nextIdentRelative = !this._cursor || this._cursor && !this._nextIdentEncapsulate;
|
|
726
|
+
if (this._nextIdentRelative) {
|
|
727
|
+
this._relative = true;
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
exports2.filter = function(ast) {
|
|
731
|
+
this._placeBeforeCursor({
|
|
732
|
+
type: "FilterExpression",
|
|
733
|
+
expr: ast,
|
|
734
|
+
relative: this._subParser.isRelative(),
|
|
735
|
+
subject: this._cursor
|
|
736
|
+
});
|
|
737
|
+
};
|
|
738
|
+
exports2.functionCall = function() {
|
|
739
|
+
this._placeBeforeCursor({
|
|
740
|
+
type: "FunctionCall",
|
|
741
|
+
name: this._cursor.value,
|
|
742
|
+
args: [],
|
|
743
|
+
pool: "functions"
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
exports2.identifier = function(token) {
|
|
747
|
+
var node = {
|
|
748
|
+
type: "Identifier",
|
|
749
|
+
value: token.value
|
|
750
|
+
};
|
|
751
|
+
if (this._nextIdentEncapsulate) {
|
|
752
|
+
node.from = this._cursor;
|
|
753
|
+
this._placeBeforeCursor(node);
|
|
754
|
+
this._nextIdentEncapsulate = false;
|
|
755
|
+
} else {
|
|
756
|
+
if (this._nextIdentRelative) {
|
|
757
|
+
node.relative = true;
|
|
758
|
+
this._nextIdentRelative = false;
|
|
759
|
+
}
|
|
760
|
+
this._placeAtCursor(node);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
exports2.literal = function(token) {
|
|
764
|
+
this._placeAtCursor({
|
|
765
|
+
type: "Literal",
|
|
766
|
+
value: token.value
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
exports2.objKey = function(token) {
|
|
770
|
+
this._curObjKey = token.value;
|
|
771
|
+
};
|
|
772
|
+
exports2.objStart = function() {
|
|
773
|
+
this._placeAtCursor({
|
|
774
|
+
type: "ObjectLiteral",
|
|
775
|
+
value: {}
|
|
776
|
+
});
|
|
777
|
+
};
|
|
778
|
+
exports2.objVal = function(ast) {
|
|
779
|
+
this._cursor.value[this._curObjKey] = ast;
|
|
780
|
+
};
|
|
781
|
+
exports2.subExpression = function(ast) {
|
|
782
|
+
this._placeAtCursor(ast);
|
|
783
|
+
};
|
|
784
|
+
exports2.ternaryEnd = function(ast) {
|
|
785
|
+
this._cursor.alternate = ast;
|
|
786
|
+
};
|
|
787
|
+
exports2.ternaryMid = function(ast) {
|
|
788
|
+
this._cursor.consequent = ast;
|
|
789
|
+
};
|
|
790
|
+
exports2.ternaryStart = function() {
|
|
791
|
+
this._tree = {
|
|
792
|
+
type: "ConditionalExpression",
|
|
793
|
+
test: this._tree
|
|
794
|
+
};
|
|
795
|
+
this._cursor = this._tree;
|
|
796
|
+
};
|
|
797
|
+
exports2.transform = function(token) {
|
|
798
|
+
this._placeBeforeCursor({
|
|
799
|
+
type: "FunctionCall",
|
|
800
|
+
name: token.value,
|
|
801
|
+
args: [this._cursor],
|
|
802
|
+
pool: "transforms"
|
|
803
|
+
});
|
|
804
|
+
};
|
|
805
|
+
exports2.unaryOp = function(token) {
|
|
806
|
+
this._placeAtCursor({
|
|
807
|
+
type: "UnaryExpression",
|
|
808
|
+
operator: token.value
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/states.js
|
|
815
|
+
var require_states = __commonJS({
|
|
816
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/states.js"(exports2) {
|
|
817
|
+
"use strict";
|
|
818
|
+
var h = require_handlers2();
|
|
819
|
+
exports2.states = {
|
|
820
|
+
expectOperand: {
|
|
821
|
+
tokenTypes: {
|
|
822
|
+
literal: {
|
|
823
|
+
toState: "expectBinOp"
|
|
824
|
+
},
|
|
825
|
+
identifier: {
|
|
826
|
+
toState: "identifier"
|
|
827
|
+
},
|
|
828
|
+
unaryOp: {},
|
|
829
|
+
openParen: {
|
|
830
|
+
toState: "subExpression"
|
|
831
|
+
},
|
|
832
|
+
openCurl: {
|
|
833
|
+
toState: "expectObjKey",
|
|
834
|
+
handler: h.objStart
|
|
835
|
+
},
|
|
836
|
+
dot: {
|
|
837
|
+
toState: "traverse"
|
|
838
|
+
},
|
|
839
|
+
openBracket: {
|
|
840
|
+
toState: "arrayVal",
|
|
841
|
+
handler: h.arrayStart
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
expectBinOp: {
|
|
846
|
+
tokenTypes: {
|
|
847
|
+
binaryOp: {
|
|
848
|
+
toState: "expectOperand"
|
|
849
|
+
},
|
|
850
|
+
pipe: {
|
|
851
|
+
toState: "expectTransform"
|
|
852
|
+
},
|
|
853
|
+
dot: {
|
|
854
|
+
toState: "traverse"
|
|
855
|
+
},
|
|
856
|
+
question: {
|
|
857
|
+
toState: "ternaryMid",
|
|
858
|
+
handler: h.ternaryStart
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
completable: true
|
|
862
|
+
},
|
|
863
|
+
expectTransform: {
|
|
864
|
+
tokenTypes: {
|
|
865
|
+
identifier: {
|
|
866
|
+
toState: "postTransform",
|
|
867
|
+
handler: h.transform
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
},
|
|
871
|
+
expectObjKey: {
|
|
872
|
+
tokenTypes: {
|
|
873
|
+
identifier: {
|
|
874
|
+
toState: "expectKeyValSep",
|
|
875
|
+
handler: h.objKey
|
|
876
|
+
},
|
|
877
|
+
closeCurl: {
|
|
878
|
+
toState: "expectBinOp"
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
expectKeyValSep: {
|
|
883
|
+
tokenTypes: {
|
|
884
|
+
colon: {
|
|
885
|
+
toState: "objVal"
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
postTransform: {
|
|
890
|
+
tokenTypes: {
|
|
891
|
+
openParen: {
|
|
892
|
+
toState: "argVal"
|
|
893
|
+
},
|
|
894
|
+
binaryOp: {
|
|
895
|
+
toState: "expectOperand"
|
|
896
|
+
},
|
|
897
|
+
dot: {
|
|
898
|
+
toState: "traverse"
|
|
899
|
+
},
|
|
900
|
+
openBracket: {
|
|
901
|
+
toState: "filter"
|
|
902
|
+
},
|
|
903
|
+
pipe: {
|
|
904
|
+
toState: "expectTransform"
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
completable: true
|
|
908
|
+
},
|
|
909
|
+
postArgs: {
|
|
910
|
+
tokenTypes: {
|
|
911
|
+
binaryOp: {
|
|
912
|
+
toState: "expectOperand"
|
|
913
|
+
},
|
|
914
|
+
dot: {
|
|
915
|
+
toState: "traverse"
|
|
916
|
+
},
|
|
917
|
+
openBracket: {
|
|
918
|
+
toState: "filter"
|
|
919
|
+
},
|
|
920
|
+
pipe: {
|
|
921
|
+
toState: "expectTransform"
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
completable: true
|
|
925
|
+
},
|
|
926
|
+
identifier: {
|
|
927
|
+
tokenTypes: {
|
|
928
|
+
binaryOp: {
|
|
929
|
+
toState: "expectOperand"
|
|
930
|
+
},
|
|
931
|
+
dot: {
|
|
932
|
+
toState: "traverse"
|
|
933
|
+
},
|
|
934
|
+
openBracket: {
|
|
935
|
+
toState: "filter"
|
|
936
|
+
},
|
|
937
|
+
openParen: {
|
|
938
|
+
toState: "argVal",
|
|
939
|
+
handler: h.functionCall
|
|
940
|
+
},
|
|
941
|
+
pipe: {
|
|
942
|
+
toState: "expectTransform"
|
|
943
|
+
},
|
|
944
|
+
question: {
|
|
945
|
+
toState: "ternaryMid",
|
|
946
|
+
handler: h.ternaryStart
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
completable: true
|
|
950
|
+
},
|
|
951
|
+
traverse: {
|
|
952
|
+
tokenTypes: {
|
|
953
|
+
identifier: {
|
|
954
|
+
toState: "identifier"
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
filter: {
|
|
959
|
+
subHandler: h.filter,
|
|
960
|
+
endStates: {
|
|
961
|
+
closeBracket: "identifier"
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
subExpression: {
|
|
965
|
+
subHandler: h.subExpression,
|
|
966
|
+
endStates: {
|
|
967
|
+
closeParen: "expectBinOp"
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
argVal: {
|
|
971
|
+
subHandler: h.argVal,
|
|
972
|
+
endStates: {
|
|
973
|
+
comma: "argVal",
|
|
974
|
+
closeParen: "postArgs"
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
objVal: {
|
|
978
|
+
subHandler: h.objVal,
|
|
979
|
+
endStates: {
|
|
980
|
+
comma: "expectObjKey",
|
|
981
|
+
closeCurl: "expectBinOp"
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
arrayVal: {
|
|
985
|
+
subHandler: h.arrayVal,
|
|
986
|
+
endStates: {
|
|
987
|
+
comma: "arrayVal",
|
|
988
|
+
closeBracket: "expectBinOp"
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
ternaryMid: {
|
|
992
|
+
subHandler: h.ternaryMid,
|
|
993
|
+
endStates: {
|
|
994
|
+
colon: "ternaryEnd"
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
ternaryEnd: {
|
|
998
|
+
subHandler: h.ternaryEnd,
|
|
999
|
+
completable: true
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/Parser.js
|
|
1006
|
+
var require_Parser = __commonJS({
|
|
1007
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/parser/Parser.js"(exports2, module2) {
|
|
1008
|
+
"use strict";
|
|
1009
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
1010
|
+
var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
|
|
1011
|
+
var _createClass2 = _interopRequireDefault(require_createClass());
|
|
1012
|
+
var handlers = require_handlers2();
|
|
1013
|
+
var states = require_states().states;
|
|
1014
|
+
var Parser = /* @__PURE__ */ (function() {
|
|
1015
|
+
function Parser2(grammar, prefix, stopMap) {
|
|
1016
|
+
(0, _classCallCheck2.default)(this, Parser2);
|
|
1017
|
+
this._grammar = grammar;
|
|
1018
|
+
this._state = "expectOperand";
|
|
1019
|
+
this._tree = null;
|
|
1020
|
+
this._exprStr = prefix || "";
|
|
1021
|
+
this._relative = false;
|
|
1022
|
+
this._stopMap = stopMap || {};
|
|
1023
|
+
}
|
|
1024
|
+
(0, _createClass2.default)(Parser2, [{
|
|
1025
|
+
key: "addToken",
|
|
1026
|
+
value: function addToken(token) {
|
|
1027
|
+
if (this._state === "complete") {
|
|
1028
|
+
throw new Error("Cannot add a new token to a completed Parser");
|
|
1029
|
+
}
|
|
1030
|
+
var state = states[this._state];
|
|
1031
|
+
var startExpr = this._exprStr;
|
|
1032
|
+
this._exprStr += token.raw;
|
|
1033
|
+
if (state.subHandler) {
|
|
1034
|
+
if (!this._subParser) {
|
|
1035
|
+
this._startSubExpression(startExpr);
|
|
1036
|
+
}
|
|
1037
|
+
var stopState = this._subParser.addToken(token);
|
|
1038
|
+
if (stopState) {
|
|
1039
|
+
this._endSubExpression();
|
|
1040
|
+
if (this._parentStop) return stopState;
|
|
1041
|
+
this._state = stopState;
|
|
1042
|
+
}
|
|
1043
|
+
} else if (state.tokenTypes[token.type]) {
|
|
1044
|
+
var typeOpts = state.tokenTypes[token.type];
|
|
1045
|
+
var handleFunc = handlers[token.type];
|
|
1046
|
+
if (typeOpts.handler) {
|
|
1047
|
+
handleFunc = typeOpts.handler;
|
|
1048
|
+
}
|
|
1049
|
+
if (handleFunc) {
|
|
1050
|
+
handleFunc.call(this, token);
|
|
1051
|
+
}
|
|
1052
|
+
if (typeOpts.toState) {
|
|
1053
|
+
this._state = typeOpts.toState;
|
|
1054
|
+
}
|
|
1055
|
+
} else if (this._stopMap[token.type]) {
|
|
1056
|
+
return this._stopMap[token.type];
|
|
1057
|
+
} else {
|
|
1058
|
+
throw new Error("Token ".concat(token.raw, " (").concat(token.type, ") unexpected in expression: ").concat(this._exprStr));
|
|
1059
|
+
}
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Processes an array of tokens iteratively through the {@link #addToken}
|
|
1064
|
+
* function.
|
|
1065
|
+
* @param {Array<{type: <string>}>} tokens An array of tokens, as provided by
|
|
1066
|
+
* the {@link Lexer#tokenize} function.
|
|
1067
|
+
*/
|
|
1068
|
+
}, {
|
|
1069
|
+
key: "addTokens",
|
|
1070
|
+
value: function addTokens(tokens) {
|
|
1071
|
+
tokens.forEach(this.addToken, this);
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Marks this Parser instance as completed and retrieves the full AST.
|
|
1075
|
+
* @returns {{}|null} a full expression tree, ready for evaluation by the
|
|
1076
|
+
* {@link Evaluator#eval} function, or null if no tokens were passed to
|
|
1077
|
+
* the parser before complete was called
|
|
1078
|
+
* @throws {Error} if the parser is not in a state where it's legal to end
|
|
1079
|
+
* the expression, indicating that the expression is incomplete
|
|
1080
|
+
*/
|
|
1081
|
+
}, {
|
|
1082
|
+
key: "complete",
|
|
1083
|
+
value: function complete() {
|
|
1084
|
+
if (this._cursor && !states[this._state].completable) {
|
|
1085
|
+
throw new Error("Unexpected end of expression: ".concat(this._exprStr));
|
|
1086
|
+
}
|
|
1087
|
+
if (this._subParser) {
|
|
1088
|
+
this._endSubExpression();
|
|
1089
|
+
}
|
|
1090
|
+
this._state = "complete";
|
|
1091
|
+
return this._cursor ? this._tree : null;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Indicates whether the expression tree contains a relative path identifier.
|
|
1095
|
+
* @returns {boolean} true if a relative identifier exists false otherwise.
|
|
1096
|
+
*/
|
|
1097
|
+
}, {
|
|
1098
|
+
key: "isRelative",
|
|
1099
|
+
value: function isRelative() {
|
|
1100
|
+
return this._relative;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Ends a subexpression by completing the subParser and passing its result
|
|
1104
|
+
* to the subHandler configured in the current state.
|
|
1105
|
+
* @private
|
|
1106
|
+
*/
|
|
1107
|
+
}, {
|
|
1108
|
+
key: "_endSubExpression",
|
|
1109
|
+
value: function _endSubExpression() {
|
|
1110
|
+
states[this._state].subHandler.call(this, this._subParser.complete());
|
|
1111
|
+
this._subParser = null;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Places a new tree node at the current position of the cursor (to the 'right'
|
|
1115
|
+
* property) and then advances the cursor to the new node. This function also
|
|
1116
|
+
* handles setting the parent of the new node.
|
|
1117
|
+
* @param {{type: <string>}} node A node to be added to the AST
|
|
1118
|
+
* @private
|
|
1119
|
+
*/
|
|
1120
|
+
}, {
|
|
1121
|
+
key: "_placeAtCursor",
|
|
1122
|
+
value: function _placeAtCursor(node) {
|
|
1123
|
+
if (!this._cursor) {
|
|
1124
|
+
this._tree = node;
|
|
1125
|
+
} else {
|
|
1126
|
+
this._cursor.right = node;
|
|
1127
|
+
this._setParent(node, this._cursor);
|
|
1128
|
+
}
|
|
1129
|
+
this._cursor = node;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Places a tree node before the current position of the cursor, replacing
|
|
1133
|
+
* the node that the cursor currently points to. This should only be called in
|
|
1134
|
+
* cases where the cursor is known to exist, and the provided node already
|
|
1135
|
+
* contains a pointer to what's at the cursor currently.
|
|
1136
|
+
* @param {{type: <string>}} node A node to be added to the AST
|
|
1137
|
+
* @private
|
|
1138
|
+
*/
|
|
1139
|
+
}, {
|
|
1140
|
+
key: "_placeBeforeCursor",
|
|
1141
|
+
value: function _placeBeforeCursor(node) {
|
|
1142
|
+
this._cursor = this._cursor._parent;
|
|
1143
|
+
this._placeAtCursor(node);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Sets the parent of a node by creating a non-enumerable _parent property
|
|
1147
|
+
* that points to the supplied parent argument.
|
|
1148
|
+
* @param {{type: <string>}} node A node of the AST on which to set a new
|
|
1149
|
+
* parent
|
|
1150
|
+
* @param {{type: <string>}} parent An existing node of the AST to serve as the
|
|
1151
|
+
* parent of the new node
|
|
1152
|
+
* @private
|
|
1153
|
+
*/
|
|
1154
|
+
}, {
|
|
1155
|
+
key: "_setParent",
|
|
1156
|
+
value: function _setParent(node, parent) {
|
|
1157
|
+
Object.defineProperty(node, "_parent", {
|
|
1158
|
+
value: parent,
|
|
1159
|
+
writable: true
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Prepares the Parser to accept a subexpression by (re)instantiating the
|
|
1164
|
+
* subParser.
|
|
1165
|
+
* @param {string} [exprStr] The expression string to prefix to the new Parser
|
|
1166
|
+
* @private
|
|
1167
|
+
*/
|
|
1168
|
+
}, {
|
|
1169
|
+
key: "_startSubExpression",
|
|
1170
|
+
value: function _startSubExpression(exprStr) {
|
|
1171
|
+
var endStates = states[this._state].endStates;
|
|
1172
|
+
if (!endStates) {
|
|
1173
|
+
this._parentStop = true;
|
|
1174
|
+
endStates = this._stopMap;
|
|
1175
|
+
}
|
|
1176
|
+
this._subParser = new Parser2(this._grammar, exprStr, endStates);
|
|
1177
|
+
}
|
|
1178
|
+
}]);
|
|
1179
|
+
return Parser2;
|
|
1180
|
+
})();
|
|
1181
|
+
module2.exports = Parser;
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/PromiseSync.js
|
|
1186
|
+
var require_PromiseSync = __commonJS({
|
|
1187
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/PromiseSync.js"(exports2, module2) {
|
|
1188
|
+
"use strict";
|
|
1189
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
1190
|
+
var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
|
|
1191
|
+
var _createClass2 = _interopRequireDefault(require_createClass());
|
|
1192
|
+
var PromiseSync = /* @__PURE__ */ (function() {
|
|
1193
|
+
function PromiseSync2(fn) {
|
|
1194
|
+
(0, _classCallCheck2.default)(this, PromiseSync2);
|
|
1195
|
+
fn(this._resolve.bind(this), this._reject.bind(this));
|
|
1196
|
+
}
|
|
1197
|
+
(0, _createClass2.default)(PromiseSync2, [{
|
|
1198
|
+
key: "catch",
|
|
1199
|
+
value: function _catch(rejected) {
|
|
1200
|
+
if (this.error) {
|
|
1201
|
+
try {
|
|
1202
|
+
this._resolve(rejected(this.error));
|
|
1203
|
+
} catch (e) {
|
|
1204
|
+
this._reject(e);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
return this;
|
|
1208
|
+
}
|
|
1209
|
+
}, {
|
|
1210
|
+
key: "then",
|
|
1211
|
+
value: function then(resolved, rejected) {
|
|
1212
|
+
if (!this.error) {
|
|
1213
|
+
try {
|
|
1214
|
+
this._resolve(resolved(this.value));
|
|
1215
|
+
} catch (e) {
|
|
1216
|
+
this._reject(e);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
if (rejected) this.catch(rejected);
|
|
1220
|
+
return this;
|
|
1221
|
+
}
|
|
1222
|
+
}, {
|
|
1223
|
+
key: "_reject",
|
|
1224
|
+
value: function _reject(error) {
|
|
1225
|
+
this.value = void 0;
|
|
1226
|
+
this.error = error;
|
|
1227
|
+
}
|
|
1228
|
+
}, {
|
|
1229
|
+
key: "_resolve",
|
|
1230
|
+
value: function _resolve(val) {
|
|
1231
|
+
if (val instanceof PromiseSync2) {
|
|
1232
|
+
if (val.error) {
|
|
1233
|
+
this._reject(val.error);
|
|
1234
|
+
} else {
|
|
1235
|
+
this._resolve(val.value);
|
|
1236
|
+
}
|
|
1237
|
+
} else {
|
|
1238
|
+
this.value = val;
|
|
1239
|
+
this.error = void 0;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}]);
|
|
1243
|
+
return PromiseSync2;
|
|
1244
|
+
})();
|
|
1245
|
+
PromiseSync.all = function(vals) {
|
|
1246
|
+
return new PromiseSync(function(resolve) {
|
|
1247
|
+
var resolved = vals.map(function(val) {
|
|
1248
|
+
while (val instanceof PromiseSync) {
|
|
1249
|
+
if (val.error) throw Error(val.error);
|
|
1250
|
+
val = val.value;
|
|
1251
|
+
}
|
|
1252
|
+
return val;
|
|
1253
|
+
});
|
|
1254
|
+
resolve(resolved);
|
|
1255
|
+
});
|
|
1256
|
+
};
|
|
1257
|
+
PromiseSync.resolve = function(val) {
|
|
1258
|
+
return new PromiseSync(function(resolve) {
|
|
1259
|
+
return resolve(val);
|
|
1260
|
+
});
|
|
1261
|
+
};
|
|
1262
|
+
PromiseSync.reject = function(error) {
|
|
1263
|
+
return new PromiseSync(function(resolve, reject) {
|
|
1264
|
+
return reject(error);
|
|
1265
|
+
});
|
|
1266
|
+
};
|
|
1267
|
+
module2.exports = PromiseSync;
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Expression.js
|
|
1272
|
+
var require_Expression = __commonJS({
|
|
1273
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Expression.js"(exports2, module2) {
|
|
1274
|
+
"use strict";
|
|
1275
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
1276
|
+
var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
|
|
1277
|
+
var _createClass2 = _interopRequireDefault(require_createClass());
|
|
1278
|
+
var Evaluator = require_Evaluator();
|
|
1279
|
+
var Lexer = require_Lexer();
|
|
1280
|
+
var Parser = require_Parser();
|
|
1281
|
+
var PromiseSync = require_PromiseSync();
|
|
1282
|
+
var Expression = /* @__PURE__ */ (function() {
|
|
1283
|
+
function Expression2(grammar, exprStr) {
|
|
1284
|
+
(0, _classCallCheck2.default)(this, Expression2);
|
|
1285
|
+
this._grammar = grammar;
|
|
1286
|
+
this._exprStr = exprStr;
|
|
1287
|
+
this._ast = null;
|
|
1288
|
+
}
|
|
1289
|
+
(0, _createClass2.default)(Expression2, [{
|
|
1290
|
+
key: "compile",
|
|
1291
|
+
value: function compile() {
|
|
1292
|
+
var lexer = new Lexer(this._grammar);
|
|
1293
|
+
var parser = new Parser(this._grammar);
|
|
1294
|
+
var tokens = lexer.tokenize(this._exprStr);
|
|
1295
|
+
parser.addTokens(tokens);
|
|
1296
|
+
this._ast = parser.complete();
|
|
1297
|
+
return this;
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Asynchronously evaluates the expression within an optional context.
|
|
1301
|
+
* @param {Object} [context] A mapping of variables to values, which will be
|
|
1302
|
+
* made accessible to the Jexl expression when evaluating it
|
|
1303
|
+
* @returns {Promise<*>} resolves with the result of the evaluation.
|
|
1304
|
+
*/
|
|
1305
|
+
}, {
|
|
1306
|
+
key: "eval",
|
|
1307
|
+
value: function _eval() {
|
|
1308
|
+
var context = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1309
|
+
return this._eval(context, Promise);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Synchronously evaluates the expression within an optional context.
|
|
1313
|
+
* @param {Object} [context] A mapping of variables to values, which will be
|
|
1314
|
+
* made accessible to the Jexl expression when evaluating it
|
|
1315
|
+
* @returns {*} the result of the evaluation.
|
|
1316
|
+
* @throws {*} on error
|
|
1317
|
+
*/
|
|
1318
|
+
}, {
|
|
1319
|
+
key: "evalSync",
|
|
1320
|
+
value: function evalSync() {
|
|
1321
|
+
var context = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1322
|
+
var res = this._eval(context, PromiseSync);
|
|
1323
|
+
if (res.error) throw res.error;
|
|
1324
|
+
return res.value;
|
|
1325
|
+
}
|
|
1326
|
+
}, {
|
|
1327
|
+
key: "_eval",
|
|
1328
|
+
value: function _eval(context, promise) {
|
|
1329
|
+
var _this = this;
|
|
1330
|
+
return promise.resolve().then(function() {
|
|
1331
|
+
var ast = _this._getAst();
|
|
1332
|
+
var evaluator = new Evaluator(_this._grammar, context, void 0, promise);
|
|
1333
|
+
return evaluator.eval(ast);
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
}, {
|
|
1337
|
+
key: "_getAst",
|
|
1338
|
+
value: function _getAst() {
|
|
1339
|
+
if (!this._ast) this.compile();
|
|
1340
|
+
return this._ast;
|
|
1341
|
+
}
|
|
1342
|
+
}]);
|
|
1343
|
+
return Expression2;
|
|
1344
|
+
})();
|
|
1345
|
+
module2.exports = Expression;
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/grammar.js
|
|
1350
|
+
var require_grammar = __commonJS({
|
|
1351
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/grammar.js"(exports2) {
|
|
1352
|
+
"use strict";
|
|
1353
|
+
exports2.getGrammar = function() {
|
|
1354
|
+
return {
|
|
1355
|
+
/**
|
|
1356
|
+
* A map of all expression elements to their properties. Note that changes
|
|
1357
|
+
* here may require changes in the Lexer or Parser.
|
|
1358
|
+
* @type {{}}
|
|
1359
|
+
*/
|
|
1360
|
+
elements: {
|
|
1361
|
+
".": {
|
|
1362
|
+
type: "dot"
|
|
1363
|
+
},
|
|
1364
|
+
"[": {
|
|
1365
|
+
type: "openBracket"
|
|
1366
|
+
},
|
|
1367
|
+
"]": {
|
|
1368
|
+
type: "closeBracket"
|
|
1369
|
+
},
|
|
1370
|
+
"|": {
|
|
1371
|
+
type: "pipe"
|
|
1372
|
+
},
|
|
1373
|
+
"{": {
|
|
1374
|
+
type: "openCurl"
|
|
1375
|
+
},
|
|
1376
|
+
"}": {
|
|
1377
|
+
type: "closeCurl"
|
|
1378
|
+
},
|
|
1379
|
+
":": {
|
|
1380
|
+
type: "colon"
|
|
1381
|
+
},
|
|
1382
|
+
",": {
|
|
1383
|
+
type: "comma"
|
|
1384
|
+
},
|
|
1385
|
+
"(": {
|
|
1386
|
+
type: "openParen"
|
|
1387
|
+
},
|
|
1388
|
+
")": {
|
|
1389
|
+
type: "closeParen"
|
|
1390
|
+
},
|
|
1391
|
+
"?": {
|
|
1392
|
+
type: "question"
|
|
1393
|
+
},
|
|
1394
|
+
"+": {
|
|
1395
|
+
type: "binaryOp",
|
|
1396
|
+
precedence: 30,
|
|
1397
|
+
eval: function _eval(left, right) {
|
|
1398
|
+
return left + right;
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1401
|
+
"-": {
|
|
1402
|
+
type: "binaryOp",
|
|
1403
|
+
precedence: 30,
|
|
1404
|
+
eval: function _eval(left, right) {
|
|
1405
|
+
return left - right;
|
|
1406
|
+
}
|
|
1407
|
+
},
|
|
1408
|
+
"*": {
|
|
1409
|
+
type: "binaryOp",
|
|
1410
|
+
precedence: 40,
|
|
1411
|
+
eval: function _eval(left, right) {
|
|
1412
|
+
return left * right;
|
|
1413
|
+
}
|
|
1414
|
+
},
|
|
1415
|
+
"/": {
|
|
1416
|
+
type: "binaryOp",
|
|
1417
|
+
precedence: 40,
|
|
1418
|
+
eval: function _eval(left, right) {
|
|
1419
|
+
return left / right;
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1422
|
+
"//": {
|
|
1423
|
+
type: "binaryOp",
|
|
1424
|
+
precedence: 40,
|
|
1425
|
+
eval: function _eval(left, right) {
|
|
1426
|
+
return Math.floor(left / right);
|
|
1427
|
+
}
|
|
1428
|
+
},
|
|
1429
|
+
"%": {
|
|
1430
|
+
type: "binaryOp",
|
|
1431
|
+
precedence: 50,
|
|
1432
|
+
eval: function _eval(left, right) {
|
|
1433
|
+
return left % right;
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
"^": {
|
|
1437
|
+
type: "binaryOp",
|
|
1438
|
+
precedence: 50,
|
|
1439
|
+
eval: function _eval(left, right) {
|
|
1440
|
+
return Math.pow(left, right);
|
|
1441
|
+
}
|
|
1442
|
+
},
|
|
1443
|
+
"==": {
|
|
1444
|
+
type: "binaryOp",
|
|
1445
|
+
precedence: 20,
|
|
1446
|
+
eval: function _eval(left, right) {
|
|
1447
|
+
return left == right;
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
"!=": {
|
|
1451
|
+
type: "binaryOp",
|
|
1452
|
+
precedence: 20,
|
|
1453
|
+
eval: function _eval(left, right) {
|
|
1454
|
+
return left != right;
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
">": {
|
|
1458
|
+
type: "binaryOp",
|
|
1459
|
+
precedence: 20,
|
|
1460
|
+
eval: function _eval(left, right) {
|
|
1461
|
+
return left > right;
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
">=": {
|
|
1465
|
+
type: "binaryOp",
|
|
1466
|
+
precedence: 20,
|
|
1467
|
+
eval: function _eval(left, right) {
|
|
1468
|
+
return left >= right;
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
"<": {
|
|
1472
|
+
type: "binaryOp",
|
|
1473
|
+
precedence: 20,
|
|
1474
|
+
eval: function _eval(left, right) {
|
|
1475
|
+
return left < right;
|
|
1476
|
+
}
|
|
1477
|
+
},
|
|
1478
|
+
"<=": {
|
|
1479
|
+
type: "binaryOp",
|
|
1480
|
+
precedence: 20,
|
|
1481
|
+
eval: function _eval(left, right) {
|
|
1482
|
+
return left <= right;
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
"&&": {
|
|
1486
|
+
type: "binaryOp",
|
|
1487
|
+
precedence: 10,
|
|
1488
|
+
evalOnDemand: function evalOnDemand(left, right) {
|
|
1489
|
+
return left.eval().then(function(leftVal) {
|
|
1490
|
+
if (!leftVal) return leftVal;
|
|
1491
|
+
return right.eval();
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
},
|
|
1495
|
+
"||": {
|
|
1496
|
+
type: "binaryOp",
|
|
1497
|
+
precedence: 10,
|
|
1498
|
+
evalOnDemand: function evalOnDemand(left, right) {
|
|
1499
|
+
return left.eval().then(function(leftVal) {
|
|
1500
|
+
if (leftVal) return leftVal;
|
|
1501
|
+
return right.eval();
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
in: {
|
|
1506
|
+
type: "binaryOp",
|
|
1507
|
+
precedence: 20,
|
|
1508
|
+
eval: function _eval(left, right) {
|
|
1509
|
+
if (typeof right === "string") {
|
|
1510
|
+
return right.indexOf(left) !== -1;
|
|
1511
|
+
}
|
|
1512
|
+
if (Array.isArray(right)) {
|
|
1513
|
+
return right.some(function(elem) {
|
|
1514
|
+
return elem === left;
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
return false;
|
|
1518
|
+
}
|
|
1519
|
+
},
|
|
1520
|
+
"!": {
|
|
1521
|
+
type: "unaryOp",
|
|
1522
|
+
precedence: Infinity,
|
|
1523
|
+
eval: function _eval(right) {
|
|
1524
|
+
return !right;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
},
|
|
1528
|
+
/**
|
|
1529
|
+
* A map of function names to javascript functions. A Jexl function
|
|
1530
|
+
* takes zero ore more arguemnts:
|
|
1531
|
+
*
|
|
1532
|
+
* - {*} ...args: A variable number of arguments passed to this function.
|
|
1533
|
+
* All of these are pre-evaluated to their actual values before calling
|
|
1534
|
+
* the function.
|
|
1535
|
+
*
|
|
1536
|
+
* The Jexl function should return either the transformed value, or
|
|
1537
|
+
* a Promises/A+ Promise object that resolves with the value and rejects
|
|
1538
|
+
* or throws only when an unrecoverable error occurs. Functions should
|
|
1539
|
+
* generally return undefined when they don't make sense to be used on the
|
|
1540
|
+
* given value type, rather than throw/reject. An error is only
|
|
1541
|
+
* appropriate when the function would normally return a value, but
|
|
1542
|
+
* cannot due to some other failure.
|
|
1543
|
+
*/
|
|
1544
|
+
functions: {},
|
|
1545
|
+
/**
|
|
1546
|
+
* A map of transform names to transform functions. A transform function
|
|
1547
|
+
* takes one ore more arguemnts:
|
|
1548
|
+
*
|
|
1549
|
+
* - {*} val: A value to be transformed
|
|
1550
|
+
* - {*} ...args: A variable number of arguments passed to this transform.
|
|
1551
|
+
* All of these are pre-evaluated to their actual values before calling
|
|
1552
|
+
* the function.
|
|
1553
|
+
*
|
|
1554
|
+
* The transform function should return either the transformed value, or
|
|
1555
|
+
* a Promises/A+ Promise object that resolves with the value and rejects
|
|
1556
|
+
* or throws only when an unrecoverable error occurs. Transforms should
|
|
1557
|
+
* generally return undefined when they don't make sense to be used on the
|
|
1558
|
+
* given value type, rather than throw/reject. An error is only
|
|
1559
|
+
* appropriate when the transform would normally return a value, but
|
|
1560
|
+
* cannot due to some other failure.
|
|
1561
|
+
*/
|
|
1562
|
+
transforms: {}
|
|
1563
|
+
};
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1568
|
+
// ../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Jexl.js
|
|
1569
|
+
var require_Jexl = __commonJS({
|
|
1570
|
+
"../../node_modules/.pnpm/jexl@2.3.0/node_modules/jexl/dist/Jexl.js"(exports2, module2) {
|
|
1571
|
+
"use strict";
|
|
1572
|
+
var _interopRequireDefault = require_interopRequireDefault();
|
|
1573
|
+
var _defineProperty2 = _interopRequireDefault(require_defineProperty());
|
|
1574
|
+
var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
|
|
1575
|
+
var _createClass2 = _interopRequireDefault(require_createClass());
|
|
1576
|
+
var Expression = require_Expression();
|
|
1577
|
+
var _require = require_grammar();
|
|
1578
|
+
var getGrammar = _require.getGrammar;
|
|
1579
|
+
var Jexl = /* @__PURE__ */ (function() {
|
|
1580
|
+
function Jexl2() {
|
|
1581
|
+
(0, _classCallCheck2.default)(this, Jexl2);
|
|
1582
|
+
this.expr = this.expr.bind(this);
|
|
1583
|
+
this._grammar = getGrammar();
|
|
1584
|
+
}
|
|
1585
|
+
(0, _createClass2.default)(Jexl2, [{
|
|
1586
|
+
key: "addBinaryOp",
|
|
1587
|
+
value: function addBinaryOp(operator, precedence, fn, manualEval) {
|
|
1588
|
+
this._addGrammarElement(operator, (0, _defineProperty2.default)({
|
|
1589
|
+
type: "binaryOp",
|
|
1590
|
+
precedence
|
|
1591
|
+
}, manualEval ? "evalOnDemand" : "eval", fn));
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Adds or replaces an expression function in this Jexl instance.
|
|
1595
|
+
* @param {string} name The name of the expression function, as it will be
|
|
1596
|
+
* used within Jexl expressions
|
|
1597
|
+
* @param {function} fn The javascript function to be executed when this
|
|
1598
|
+
* expression function is invoked. It will be provided with each argument
|
|
1599
|
+
* supplied in the expression, in the same order.
|
|
1600
|
+
*/
|
|
1601
|
+
}, {
|
|
1602
|
+
key: "addFunction",
|
|
1603
|
+
value: function addFunction(name, fn) {
|
|
1604
|
+
this._grammar.functions[name] = fn;
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Syntactic sugar for calling {@link #addFunction} repeatedly. This function
|
|
1608
|
+
* accepts a map of one or more expression function names to their javascript
|
|
1609
|
+
* function counterpart.
|
|
1610
|
+
* @param {{}} map A map of expression function names to javascript functions
|
|
1611
|
+
*/
|
|
1612
|
+
}, {
|
|
1613
|
+
key: "addFunctions",
|
|
1614
|
+
value: function addFunctions(map) {
|
|
1615
|
+
for (var key in map) {
|
|
1616
|
+
this._grammar.functions[key] = map[key];
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Adds a unary operator to Jexl. Unary operators are currently only supported
|
|
1621
|
+
* on the left side of the value on which it will operate.
|
|
1622
|
+
* @param {string} operator The operator string to be added
|
|
1623
|
+
* @param {function} fn A function to run to calculate the result. The function
|
|
1624
|
+
* will be called with one argument: the literal value to the right of the
|
|
1625
|
+
* operator. It should return either the resulting value, or a Promise
|
|
1626
|
+
* that resolves with the resulting value.
|
|
1627
|
+
*/
|
|
1628
|
+
}, {
|
|
1629
|
+
key: "addUnaryOp",
|
|
1630
|
+
value: function addUnaryOp(operator, fn) {
|
|
1631
|
+
this._addGrammarElement(operator, {
|
|
1632
|
+
type: "unaryOp",
|
|
1633
|
+
weight: Infinity,
|
|
1634
|
+
eval: fn
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Adds or replaces a transform function in this Jexl instance.
|
|
1639
|
+
* @param {string} name The name of the transform function, as it will be used
|
|
1640
|
+
* within Jexl expressions
|
|
1641
|
+
* @param {function} fn The function to be executed when this transform is
|
|
1642
|
+
* invoked. It will be provided with at least one argument:
|
|
1643
|
+
* - {*} value: The value to be transformed
|
|
1644
|
+
* - {...*} args: The arguments for this transform
|
|
1645
|
+
*/
|
|
1646
|
+
}, {
|
|
1647
|
+
key: "addTransform",
|
|
1648
|
+
value: function addTransform(name, fn) {
|
|
1649
|
+
this._grammar.transforms[name] = fn;
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Syntactic sugar for calling {@link #addTransform} repeatedly. This function
|
|
1653
|
+
* accepts a map of one or more transform names to their transform function.
|
|
1654
|
+
* @param {{}} map A map of transform names to transform functions
|
|
1655
|
+
*/
|
|
1656
|
+
}, {
|
|
1657
|
+
key: "addTransforms",
|
|
1658
|
+
value: function addTransforms(map) {
|
|
1659
|
+
for (var key in map) {
|
|
1660
|
+
this._grammar.transforms[key] = map[key];
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Creates an Expression object from the given Jexl expression string, and
|
|
1665
|
+
* immediately compiles it. The returned Expression object can then be
|
|
1666
|
+
* evaluated multiple times with new contexts, without generating any
|
|
1667
|
+
* additional string processing overhead.
|
|
1668
|
+
* @param {string} expression The Jexl expression to be compiled
|
|
1669
|
+
* @returns {Expression} The compiled Expression object
|
|
1670
|
+
*/
|
|
1671
|
+
}, {
|
|
1672
|
+
key: "compile",
|
|
1673
|
+
value: function compile(expression) {
|
|
1674
|
+
var exprObj = this.createExpression(expression);
|
|
1675
|
+
return exprObj.compile();
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Constructs an Expression object from a Jexl expression string.
|
|
1679
|
+
* @param {string} expression The Jexl expression to be wrapped in an
|
|
1680
|
+
* Expression object
|
|
1681
|
+
* @returns {Expression} The Expression object representing the given string
|
|
1682
|
+
*/
|
|
1683
|
+
}, {
|
|
1684
|
+
key: "createExpression",
|
|
1685
|
+
value: function createExpression(expression) {
|
|
1686
|
+
return new Expression(this._grammar, expression);
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Retrieves a previously set expression function.
|
|
1690
|
+
* @param {string} name The name of the expression function
|
|
1691
|
+
* @returns {function} The expression function
|
|
1692
|
+
*/
|
|
1693
|
+
}, {
|
|
1694
|
+
key: "getFunction",
|
|
1695
|
+
value: function getFunction(name) {
|
|
1696
|
+
return this._grammar.functions[name];
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Retrieves a previously set transform function.
|
|
1700
|
+
* @param {string} name The name of the transform function
|
|
1701
|
+
* @returns {function} The transform function
|
|
1702
|
+
*/
|
|
1703
|
+
}, {
|
|
1704
|
+
key: "getTransform",
|
|
1705
|
+
value: function getTransform(name) {
|
|
1706
|
+
return this._grammar.transforms[name];
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Asynchronously evaluates a Jexl string within an optional context.
|
|
1710
|
+
* @param {string} expression The Jexl expression to be evaluated
|
|
1711
|
+
* @param {Object} [context] A mapping of variables to values, which will be
|
|
1712
|
+
* made accessible to the Jexl expression when evaluating it
|
|
1713
|
+
* @returns {Promise<*>} resolves with the result of the evaluation.
|
|
1714
|
+
*/
|
|
1715
|
+
}, {
|
|
1716
|
+
key: "eval",
|
|
1717
|
+
value: function _eval(expression) {
|
|
1718
|
+
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1719
|
+
var exprObj = this.createExpression(expression);
|
|
1720
|
+
return exprObj.eval(context);
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Synchronously evaluates a Jexl string within an optional context.
|
|
1724
|
+
* @param {string} expression The Jexl expression to be evaluated
|
|
1725
|
+
* @param {Object} [context] A mapping of variables to values, which will be
|
|
1726
|
+
* made accessible to the Jexl expression when evaluating it
|
|
1727
|
+
* @returns {*} the result of the evaluation.
|
|
1728
|
+
* @throws {*} on error
|
|
1729
|
+
*/
|
|
1730
|
+
}, {
|
|
1731
|
+
key: "evalSync",
|
|
1732
|
+
value: function evalSync(expression) {
|
|
1733
|
+
var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1734
|
+
var exprObj = this.createExpression(expression);
|
|
1735
|
+
return exprObj.evalSync(context);
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* A JavaScript template literal to allow expressions to be defined by the
|
|
1739
|
+
* syntax: expr`40 + 2`
|
|
1740
|
+
* @param {Array<string>} strs
|
|
1741
|
+
* @param {...any} args
|
|
1742
|
+
*/
|
|
1743
|
+
}, {
|
|
1744
|
+
key: "expr",
|
|
1745
|
+
value: function expr(strs) {
|
|
1746
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1747
|
+
args[_key - 1] = arguments[_key];
|
|
1748
|
+
}
|
|
1749
|
+
var exprStr = strs.reduce(function(acc, str, idx) {
|
|
1750
|
+
var arg = idx < args.length ? args[idx] : "";
|
|
1751
|
+
acc += str + arg;
|
|
1752
|
+
return acc;
|
|
1753
|
+
}, "");
|
|
1754
|
+
return this.createExpression(exprStr);
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Removes a binary or unary operator from the Jexl grammar.
|
|
1758
|
+
* @param {string} operator The operator string to be removed
|
|
1759
|
+
*/
|
|
1760
|
+
}, {
|
|
1761
|
+
key: "removeOp",
|
|
1762
|
+
value: function removeOp(operator) {
|
|
1763
|
+
if (this._grammar.elements[operator] && (this._grammar.elements[operator].type === "binaryOp" || this._grammar.elements[operator].type === "unaryOp")) {
|
|
1764
|
+
delete this._grammar.elements[operator];
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Adds an element to the grammar map used by this Jexl instance.
|
|
1769
|
+
* @param {string} str The key string to be added
|
|
1770
|
+
* @param {{type: <string>}} obj A map of configuration options for this
|
|
1771
|
+
* grammar element
|
|
1772
|
+
* @private
|
|
1773
|
+
*/
|
|
1774
|
+
}, {
|
|
1775
|
+
key: "_addGrammarElement",
|
|
1776
|
+
value: function _addGrammarElement(str, obj) {
|
|
1777
|
+
this._grammar.elements[str] = obj;
|
|
1778
|
+
}
|
|
1779
|
+
}]);
|
|
1780
|
+
return Jexl2;
|
|
1781
|
+
})();
|
|
1782
|
+
module2.exports = new Jexl();
|
|
1783
|
+
module2.exports.Jexl = Jexl;
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
|
|
33
1787
|
// src/observability.ts
|
|
34
1788
|
var observability_exports = {};
|
|
35
1789
|
__export(observability_exports, {
|
|
@@ -628,6 +2382,7 @@ __export(server_exports, {
|
|
|
628
2382
|
renderPrometheusMetrics: () => renderPrometheusMetrics,
|
|
629
2383
|
resolveObservabilityConfig: () => resolveObservabilityConfig,
|
|
630
2384
|
serializeDetailForApi: () => serializeDetailForApi,
|
|
2385
|
+
serializeViewForApi: () => serializeViewForApi,
|
|
631
2386
|
shouldSampleRequest: () => shouldSampleRequest
|
|
632
2387
|
});
|
|
633
2388
|
module.exports = __toCommonJS(server_exports);
|
|
@@ -681,7 +2436,7 @@ var DefaultsService = class {
|
|
|
681
2436
|
};
|
|
682
2437
|
|
|
683
2438
|
// src/services/population.service.ts
|
|
684
|
-
var import_jexl = __toESM(
|
|
2439
|
+
var import_jexl = __toESM(require_Jexl(), 1);
|
|
685
2440
|
var PopulationService = class {
|
|
686
2441
|
db;
|
|
687
2442
|
collections;
|
|
@@ -1115,13 +2870,13 @@ function createSessionId() {
|
|
|
1115
2870
|
}
|
|
1116
2871
|
|
|
1117
2872
|
// src/utils/hooks.ts
|
|
1118
|
-
var import_jexl4 = __toESM(
|
|
2873
|
+
var import_jexl4 = __toESM(require_Jexl(), 1);
|
|
1119
2874
|
|
|
1120
2875
|
// src/utils/declarative-hooks.ts
|
|
1121
|
-
var import_jexl3 = __toESM(
|
|
2876
|
+
var import_jexl3 = __toESM(require_Jexl(), 1);
|
|
1122
2877
|
|
|
1123
2878
|
// src/utils/jexl-helpers.ts
|
|
1124
|
-
var import_jexl2 = __toESM(
|
|
2879
|
+
var import_jexl2 = __toESM(require_Jexl(), 1);
|
|
1125
2880
|
function slugify(val) {
|
|
1126
2881
|
if (val === void 0 || val === null) return "";
|
|
1127
2882
|
return String(val).normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -2283,7 +4038,7 @@ function validateUpload(file, config) {
|
|
|
2283
4038
|
}
|
|
2284
4039
|
|
|
2285
4040
|
// src/auth/jexl.ts
|
|
2286
|
-
var import_jexl5 = __toESM(
|
|
4041
|
+
var import_jexl5 = __toESM(require_Jexl(), 1);
|
|
2287
4042
|
async function evaluateAccess(expression, context) {
|
|
2288
4043
|
if (expression === void 0 || expression === null) return false;
|
|
2289
4044
|
if (typeof expression === "boolean") return expression;
|
|
@@ -2737,6 +4492,45 @@ function mergeWhereConstraint(where, constraint) {
|
|
|
2737
4492
|
return where ? { AND: [where, constraint] } : constraint;
|
|
2738
4493
|
}
|
|
2739
4494
|
|
|
4495
|
+
// src/utils/action-mutation.ts
|
|
4496
|
+
function resolveActionMutation(mutation, ctx) {
|
|
4497
|
+
if (!mutation) return {};
|
|
4498
|
+
return resolveValue(mutation, ctx);
|
|
4499
|
+
}
|
|
4500
|
+
function resolveValue(value, ctx) {
|
|
4501
|
+
if (typeof value === "string") return resolveExpression(value, ctx);
|
|
4502
|
+
if (Array.isArray(value)) return value.map((item) => resolveValue(item, ctx));
|
|
4503
|
+
if (isPlainObject2(value)) {
|
|
4504
|
+
const out = {};
|
|
4505
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
4506
|
+
out[key] = resolveValue(entry, ctx);
|
|
4507
|
+
}
|
|
4508
|
+
return out;
|
|
4509
|
+
}
|
|
4510
|
+
return value;
|
|
4511
|
+
}
|
|
4512
|
+
function resolveExpression(expression, ctx) {
|
|
4513
|
+
if (expression === "now()") return (/* @__PURE__ */ new Date()).toISOString();
|
|
4514
|
+
const inputPath = expression.match(/^input\.([A-Za-z0-9_.-]+)$/)?.[1];
|
|
4515
|
+
if (inputPath !== void 0) return getPath(ctx.input, inputPath);
|
|
4516
|
+
const docPath = expression.match(/^doc\.([A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*)$/)?.[1];
|
|
4517
|
+
if (docPath !== void 0) return getPath(ctx.doc, docPath);
|
|
4518
|
+
const userPath = expression.match(/^user\.([A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*)$/)?.[1];
|
|
4519
|
+
if (userPath !== void 0 && ctx.user) return getPath(ctx.user, userPath);
|
|
4520
|
+
return expression;
|
|
4521
|
+
}
|
|
4522
|
+
function getPath(source, path) {
|
|
4523
|
+
let cursor = source;
|
|
4524
|
+
for (const segment of path.split(".")) {
|
|
4525
|
+
if (!cursor || typeof cursor !== "object") return void 0;
|
|
4526
|
+
cursor = cursor[segment];
|
|
4527
|
+
}
|
|
4528
|
+
return cursor;
|
|
4529
|
+
}
|
|
4530
|
+
function isPlainObject2(value) {
|
|
4531
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4532
|
+
}
|
|
4533
|
+
|
|
2740
4534
|
// src/workflows.ts
|
|
2741
4535
|
var WORKFLOW_HISTORY_COLLECTION = "__workflow_history";
|
|
2742
4536
|
var LIFECYCLE_EVENTS_COLLECTION = "__lifecycle_events";
|
|
@@ -3822,12 +5616,24 @@ var CollectionController = class {
|
|
|
3822
5616
|
externalSubject: member.id
|
|
3823
5617
|
});
|
|
3824
5618
|
}
|
|
3825
|
-
const readonlyDb = createReadonlyDb(db);
|
|
3826
5619
|
const id = c.req.param("id");
|
|
3827
5620
|
if (!id) return c.json({ message: "Missing ID" }, 400);
|
|
3828
5621
|
const body = await c.req.json();
|
|
5622
|
+
return this.performUpdate(c, id, body);
|
|
5623
|
+
}
|
|
5624
|
+
/**
|
|
5625
|
+
* Core update pipeline shared by PATCH requests and operational actions:
|
|
5626
|
+
* auth-field stripping, timestamps, access enforcement, field write access,
|
|
5627
|
+
* beforeChange hooks, persistence (or workflow draft), audit logging,
|
|
5628
|
+
* afterChange/afterRead hooks, and field read access on the response.
|
|
5629
|
+
*/
|
|
5630
|
+
async performUpdate(c, id, rawData) {
|
|
5631
|
+
const config = c.get("config");
|
|
5632
|
+
const db = config.db;
|
|
5633
|
+
if (!db) return c.json({ message: "Database not configured" }, 500);
|
|
5634
|
+
const readonlyDb = createReadonlyDb(db);
|
|
3829
5635
|
const user = c.get("user");
|
|
3830
|
-
let data = { ...
|
|
5636
|
+
let data = { ...rawData };
|
|
3831
5637
|
if (this.collection.auth) {
|
|
3832
5638
|
delete data.password;
|
|
3833
5639
|
delete data.oldPassword;
|
|
@@ -3947,6 +5753,119 @@ var CollectionController = class {
|
|
|
3947
5753
|
);
|
|
3948
5754
|
return c.json(accessibleDoc);
|
|
3949
5755
|
}
|
|
5756
|
+
/**
|
|
5757
|
+
* Runs an operational view action (`defineAction`) against one or more documents.
|
|
5758
|
+
* Declarative mutations are resolved server-side (`now()`, `input.*`, `doc.*`)
|
|
5759
|
+
* and every write flows through the standard update pipeline so the
|
|
5760
|
+
* collection's lifecycle hooks and audit trail still apply.
|
|
5761
|
+
*/
|
|
5762
|
+
async runViewAction(c) {
|
|
5763
|
+
const config = c.get("config");
|
|
5764
|
+
const db = config.db;
|
|
5765
|
+
if (!db) return c.json({ message: "Database not configured" }, 500);
|
|
5766
|
+
if (!this.collection.views?.length) {
|
|
5767
|
+
return c.json({ error: true, message: `Collection ${this.collection.slug} has no views` }, 404);
|
|
5768
|
+
}
|
|
5769
|
+
const actionName = c.req.param("action");
|
|
5770
|
+
const viewSlugParam = c.req.param("viewSlug");
|
|
5771
|
+
let action;
|
|
5772
|
+
for (const view2 of this.collection.views) {
|
|
5773
|
+
if (viewSlugParam && view2.slug !== viewSlugParam) continue;
|
|
5774
|
+
const match = view2.actions?.find((candidate) => candidate.name === actionName);
|
|
5775
|
+
if (match) {
|
|
5776
|
+
action = match;
|
|
5777
|
+
break;
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
if (!action) {
|
|
5781
|
+
return c.json(
|
|
5782
|
+
{ error: true, message: `Action "${actionName}" was not found${viewSlugParam ? ` in view "${viewSlugParam}"` : ""}` },
|
|
5783
|
+
404
|
|
5784
|
+
);
|
|
5785
|
+
}
|
|
5786
|
+
const body = await c.req.json().catch(() => ({}));
|
|
5787
|
+
const requestedIds = Array.isArray(body?.ids) ? body.ids.filter((value) => typeof value === "string") : typeof body?.id === "string" ? [body.id] : [];
|
|
5788
|
+
if (!requestedIds.length) {
|
|
5789
|
+
return c.json(
|
|
5790
|
+
{ error: true, message: "Provide an `id` or an `ids` array of documents to act on." },
|
|
5791
|
+
400
|
|
5792
|
+
);
|
|
5793
|
+
}
|
|
5794
|
+
const input = body?.input ?? {};
|
|
5795
|
+
const user = c.get("user");
|
|
5796
|
+
const accessArgs = { user, req: this.toHookRequestContext(c) };
|
|
5797
|
+
const view = viewSlugParam ? this.collection.views.find((candidate) => candidate.slug === viewSlugParam) : void 0;
|
|
5798
|
+
if (view?.access) {
|
|
5799
|
+
const allowed = await resolveBooleanAccess(config, view.access.update ?? view.access.read ?? true, {
|
|
5800
|
+
...accessArgs,
|
|
5801
|
+
data: input
|
|
5802
|
+
});
|
|
5803
|
+
if (!allowed) {
|
|
5804
|
+
return c.json({ error: true, message: `Access denied: view "${view.slug}"` }, 403);
|
|
5805
|
+
}
|
|
5806
|
+
}
|
|
5807
|
+
if (action.access) {
|
|
5808
|
+
const actionAccess = await resolveBooleanAccess(config, action.access.update ?? true, {
|
|
5809
|
+
...accessArgs,
|
|
5810
|
+
data: input
|
|
5811
|
+
});
|
|
5812
|
+
if (!actionAccess) {
|
|
5813
|
+
return c.json({ error: true, message: `Access denied: action "${action.name}"` }, 403);
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
const results = [];
|
|
5817
|
+
for (const id of requestedIds) {
|
|
5818
|
+
const targetDoc = await db.findOne({ collection: this.collection.slug, id });
|
|
5819
|
+
if (!targetDoc) {
|
|
5820
|
+
results.push({ id, ok: false, status: 404, error: "Not Found" });
|
|
5821
|
+
continue;
|
|
5822
|
+
}
|
|
5823
|
+
let resolvedData;
|
|
5824
|
+
if (typeof action.handler === "function") {
|
|
5825
|
+
try {
|
|
5826
|
+
const handlerResult = await action.handler({
|
|
5827
|
+
doc: targetDoc,
|
|
5828
|
+
docs: [targetDoc],
|
|
5829
|
+
user: user ?? null,
|
|
5830
|
+
input,
|
|
5831
|
+
collection: { slug: this.collection.slug, label: this.collection.labels?.singular ?? this.collection.slug }
|
|
5832
|
+
});
|
|
5833
|
+
resolvedData = handlerResult ?? {};
|
|
5834
|
+
} catch (error) {
|
|
5835
|
+
results.push({ id, ok: false, status: 500, error: error instanceof Error ? error.message : String(error) });
|
|
5836
|
+
continue;
|
|
5837
|
+
}
|
|
5838
|
+
} else {
|
|
5839
|
+
resolvedData = resolveActionMutation(action.mutation, {
|
|
5840
|
+
doc: targetDoc,
|
|
5841
|
+
input,
|
|
5842
|
+
user: user ?? null
|
|
5843
|
+
});
|
|
5844
|
+
}
|
|
5845
|
+
const response = await this.performUpdate(c, id, resolvedData);
|
|
5846
|
+
const ok = response.ok;
|
|
5847
|
+
let payload;
|
|
5848
|
+
try {
|
|
5849
|
+
payload = await response.clone().json();
|
|
5850
|
+
} catch {
|
|
5851
|
+
payload = void 0;
|
|
5852
|
+
}
|
|
5853
|
+
results.push({ id, ok, status: response.status, ...ok ? { doc: payload } : { error: payload } });
|
|
5854
|
+
}
|
|
5855
|
+
if (requestedIds.length === 1) {
|
|
5856
|
+
const single = results[0];
|
|
5857
|
+
if (!single.ok) {
|
|
5858
|
+
return c.json(single.error ?? { error: true, message: "Action failed" }, single.status ?? 500);
|
|
5859
|
+
}
|
|
5860
|
+
return c.json(single.doc);
|
|
5861
|
+
}
|
|
5862
|
+
const failed = results.filter((result) => !result.ok).length;
|
|
5863
|
+
return c.json({
|
|
5864
|
+
updated: results.length - failed,
|
|
5865
|
+
failed,
|
|
5866
|
+
results
|
|
5867
|
+
});
|
|
5868
|
+
}
|
|
3950
5869
|
async transition(c) {
|
|
3951
5870
|
const config = c.get("config");
|
|
3952
5871
|
if (!config.db) return c.json({ message: "Database not configured" }, 500);
|
|
@@ -4328,9 +6247,23 @@ var CollectionController = class {
|
|
|
4328
6247
|
400
|
|
4329
6248
|
);
|
|
4330
6249
|
}
|
|
6250
|
+
let rawAggregates;
|
|
6251
|
+
let groupBy;
|
|
6252
|
+
if ("aggregates" in body && typeof body.aggregates === "object" && body.aggregates !== null && !Array.isArray(body.aggregates)) {
|
|
6253
|
+
rawAggregates = body.aggregates;
|
|
6254
|
+
if (typeof body.groupBy === "string" && body.groupBy.trim()) {
|
|
6255
|
+
groupBy = body.groupBy.trim();
|
|
6256
|
+
}
|
|
6257
|
+
} else {
|
|
6258
|
+
rawAggregates = body;
|
|
6259
|
+
const queryGroupBy = c.req.query("groupBy");
|
|
6260
|
+
if (typeof queryGroupBy === "string" && queryGroupBy.trim()) {
|
|
6261
|
+
groupBy = queryGroupBy.trim();
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
4331
6264
|
const { sanitizeWhereClause: sanitizeWhereClause2 } = await Promise.resolve().then(() => (init_where_sanitizer(), where_sanitizer_exports));
|
|
4332
6265
|
const sanitizedAggregates = {};
|
|
4333
|
-
for (const [key, op] of Object.entries(
|
|
6266
|
+
for (const [key, op] of Object.entries(rawAggregates)) {
|
|
4334
6267
|
if (!op || typeof op !== "object" || Array.isArray(op)) {
|
|
4335
6268
|
return c.json(
|
|
4336
6269
|
{
|
|
@@ -4355,7 +6288,8 @@ var CollectionController = class {
|
|
|
4355
6288
|
}
|
|
4356
6289
|
const result = await db.aggregate({
|
|
4357
6290
|
collection: this.collection.slug,
|
|
4358
|
-
aggregates: sanitizedAggregates
|
|
6291
|
+
aggregates: sanitizedAggregates,
|
|
6292
|
+
...groupBy ? { groupBy } : {}
|
|
4359
6293
|
});
|
|
4360
6294
|
return c.json(result);
|
|
4361
6295
|
}
|
|
@@ -7040,39 +8974,94 @@ function generateOpenApi(config) {
|
|
|
7040
8974
|
post: {
|
|
7041
8975
|
tags: [collectionTag],
|
|
7042
8976
|
summary: `Aggregate ${labels.plural}`,
|
|
7043
|
-
description: `Compute statistical aggregations (count, sum, avg, min, max) across ${labels.plural}.`,
|
|
8977
|
+
description: `Compute statistical aggregations (count, countDistinct, distinct, sum, avg, min, max, groupBy) across ${labels.plural}.`,
|
|
8978
|
+
parameters: [
|
|
8979
|
+
{
|
|
8980
|
+
name: "groupBy",
|
|
8981
|
+
in: "query",
|
|
8982
|
+
description: "Optional field name to compute aggregates grouped by distinct values",
|
|
8983
|
+
required: false,
|
|
8984
|
+
schema: { type: "string" }
|
|
8985
|
+
}
|
|
8986
|
+
],
|
|
7044
8987
|
requestBody: {
|
|
7045
8988
|
required: true,
|
|
7046
8989
|
content: {
|
|
7047
8990
|
"application/json": {
|
|
7048
8991
|
schema: {
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
sum: { type: "string", description: "Field to sum" },
|
|
7055
|
-
avg: { type: "string", description: "Field to average" },
|
|
7056
|
-
min: { type: "string", description: "Field for minimum" },
|
|
7057
|
-
max: { type: "string", description: "Field for maximum" },
|
|
7058
|
-
cast: {
|
|
7059
|
-
type: "string",
|
|
7060
|
-
enum: [
|
|
7061
|
-
"number",
|
|
7062
|
-
"integer",
|
|
7063
|
-
"float",
|
|
7064
|
-
"boolean",
|
|
7065
|
-
"date",
|
|
7066
|
-
"string"
|
|
7067
|
-
]
|
|
7068
|
-
},
|
|
7069
|
-
where: {
|
|
8992
|
+
oneOf: [
|
|
8993
|
+
{
|
|
8994
|
+
type: "object",
|
|
8995
|
+
description: "Flat aggregate operations dictionary",
|
|
8996
|
+
additionalProperties: {
|
|
7070
8997
|
type: "object",
|
|
7071
|
-
|
|
7072
|
-
|
|
8998
|
+
properties: {
|
|
8999
|
+
count: { type: "string", example: "*" },
|
|
9000
|
+
countDistinct: { type: "string", description: "Field to count unique non-null values" },
|
|
9001
|
+
distinct: { type: "string", description: "Field to extract unique non-null values" },
|
|
9002
|
+
sum: { type: "string", description: "Field to sum" },
|
|
9003
|
+
avg: { type: "string", description: "Field to average" },
|
|
9004
|
+
min: { type: "string", description: "Field for minimum" },
|
|
9005
|
+
max: { type: "string", description: "Field for maximum" },
|
|
9006
|
+
cast: {
|
|
9007
|
+
type: "string",
|
|
9008
|
+
enum: [
|
|
9009
|
+
"number",
|
|
9010
|
+
"integer",
|
|
9011
|
+
"float",
|
|
9012
|
+
"boolean",
|
|
9013
|
+
"date",
|
|
9014
|
+
"string"
|
|
9015
|
+
]
|
|
9016
|
+
},
|
|
9017
|
+
where: {
|
|
9018
|
+
type: "object",
|
|
9019
|
+
description: "Per-aggregate filter condition",
|
|
9020
|
+
additionalProperties: true
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
7073
9023
|
}
|
|
9024
|
+
},
|
|
9025
|
+
{
|
|
9026
|
+
type: "object",
|
|
9027
|
+
description: "Grouped aggregate payload with explicit groupBy property",
|
|
9028
|
+
properties: {
|
|
9029
|
+
groupBy: { type: "string", description: "Field name to group aggregates by" },
|
|
9030
|
+
aggregates: {
|
|
9031
|
+
type: "object",
|
|
9032
|
+
additionalProperties: {
|
|
9033
|
+
type: "object",
|
|
9034
|
+
properties: {
|
|
9035
|
+
count: { type: "string", example: "*" },
|
|
9036
|
+
countDistinct: { type: "string", description: "Field to count unique non-null values" },
|
|
9037
|
+
distinct: { type: "string", description: "Field to extract unique non-null values" },
|
|
9038
|
+
sum: { type: "string", description: "Field to sum" },
|
|
9039
|
+
avg: { type: "string", description: "Field to average" },
|
|
9040
|
+
min: { type: "string", description: "Field for minimum" },
|
|
9041
|
+
max: { type: "string", description: "Field for maximum" },
|
|
9042
|
+
cast: {
|
|
9043
|
+
type: "string",
|
|
9044
|
+
enum: [
|
|
9045
|
+
"number",
|
|
9046
|
+
"integer",
|
|
9047
|
+
"float",
|
|
9048
|
+
"boolean",
|
|
9049
|
+
"date",
|
|
9050
|
+
"string"
|
|
9051
|
+
]
|
|
9052
|
+
},
|
|
9053
|
+
where: {
|
|
9054
|
+
type: "object",
|
|
9055
|
+
description: "Per-aggregate filter condition",
|
|
9056
|
+
additionalProperties: true
|
|
9057
|
+
}
|
|
9058
|
+
}
|
|
9059
|
+
}
|
|
9060
|
+
}
|
|
9061
|
+
},
|
|
9062
|
+
required: ["aggregates"]
|
|
7074
9063
|
}
|
|
7075
|
-
|
|
9064
|
+
]
|
|
7076
9065
|
}
|
|
7077
9066
|
}
|
|
7078
9067
|
}
|
|
@@ -7083,11 +9072,36 @@ function generateOpenApi(config) {
|
|
|
7083
9072
|
content: {
|
|
7084
9073
|
"application/json": {
|
|
7085
9074
|
schema: {
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
9075
|
+
oneOf: [
|
|
9076
|
+
{
|
|
9077
|
+
type: "object",
|
|
9078
|
+
description: "Flat aggregate results map",
|
|
9079
|
+
additionalProperties: {
|
|
9080
|
+
oneOf: [
|
|
9081
|
+
{ type: "number", nullable: true },
|
|
9082
|
+
{ type: "array", items: { type: "string" } }
|
|
9083
|
+
]
|
|
9084
|
+
}
|
|
9085
|
+
},
|
|
9086
|
+
{
|
|
9087
|
+
type: "object",
|
|
9088
|
+
description: "Grouped aggregate results breakdown",
|
|
9089
|
+
properties: {
|
|
9090
|
+
groups: {
|
|
9091
|
+
type: "object",
|
|
9092
|
+
additionalProperties: {
|
|
9093
|
+
type: "object",
|
|
9094
|
+
additionalProperties: {
|
|
9095
|
+
oneOf: [
|
|
9096
|
+
{ type: "number", nullable: true },
|
|
9097
|
+
{ type: "array", items: { type: "string" } }
|
|
9098
|
+
]
|
|
9099
|
+
}
|
|
9100
|
+
}
|
|
9101
|
+
}
|
|
9102
|
+
}
|
|
9103
|
+
}
|
|
9104
|
+
]
|
|
7091
9105
|
}
|
|
7092
9106
|
}
|
|
7093
9107
|
}
|
|
@@ -7811,6 +9825,47 @@ function serializeDetailForApi(detail) {
|
|
|
7811
9825
|
if (!detail || !Array.isArray(detail)) return void 0;
|
|
7812
9826
|
return detail.map(serializeDetailItemForApi);
|
|
7813
9827
|
}
|
|
9828
|
+
async function serializeViewForApi(view, serializeAccess) {
|
|
9829
|
+
if (!view) return view;
|
|
9830
|
+
const serializeAccessConfig = async (access) => {
|
|
9831
|
+
if (!access) return void 0;
|
|
9832
|
+
const serialized = {};
|
|
9833
|
+
for (const key of ["read", "create", "update", "delete"]) {
|
|
9834
|
+
if (access[key] !== void 0) serialized[key] = await serializeAccess(access[key]);
|
|
9835
|
+
}
|
|
9836
|
+
return serialized;
|
|
9837
|
+
};
|
|
9838
|
+
return {
|
|
9839
|
+
slug: view.slug,
|
|
9840
|
+
label: view.label,
|
|
9841
|
+
icon: view.icon,
|
|
9842
|
+
layout: view.layout ?? "table",
|
|
9843
|
+
filter: view.filter,
|
|
9844
|
+
groupBy: view.groupBy,
|
|
9845
|
+
dateField: view.dateField,
|
|
9846
|
+
startDateField: view.startDateField,
|
|
9847
|
+
endDateField: view.endDateField,
|
|
9848
|
+
columns: view.columns,
|
|
9849
|
+
sort: view.sort,
|
|
9850
|
+
metrics: view.metrics,
|
|
9851
|
+
features: view.features,
|
|
9852
|
+
actionOrder: view.actionOrder,
|
|
9853
|
+
actions: await Promise.all(
|
|
9854
|
+
(view.actions || []).map(async (action) => ({
|
|
9855
|
+
name: action.name,
|
|
9856
|
+
label: action.label,
|
|
9857
|
+
icon: action.icon,
|
|
9858
|
+
type: action.type ?? "row",
|
|
9859
|
+
confirm: action.confirm,
|
|
9860
|
+
fields: action.fields?.map(serializeFieldForApi),
|
|
9861
|
+
mutation: action.mutation,
|
|
9862
|
+
// Self-hosted handlers are intentionally omitted: they never leave the server.
|
|
9863
|
+
access: action.access ? await serializeAccessConfig(action.access) : void 0
|
|
9864
|
+
}))
|
|
9865
|
+
),
|
|
9866
|
+
access: view.access ? await serializeAccessConfig(view.access) : void 0
|
|
9867
|
+
};
|
|
9868
|
+
}
|
|
7814
9869
|
function registerRoutes(app, config) {
|
|
7815
9870
|
const optionsCache = /* @__PURE__ */ new Map();
|
|
7816
9871
|
app.get("/api/schemas", optionalAuth(config), async (c) => {
|
|
@@ -7871,6 +9926,8 @@ function registerRoutes(app, config) {
|
|
|
7871
9926
|
auth: !!col.auth,
|
|
7872
9927
|
audit: !!col.audit,
|
|
7873
9928
|
drafts: !!col.drafts,
|
|
9929
|
+
defaultView: col.defaultView ?? col.admin?.defaultView,
|
|
9930
|
+
views: await Promise.all((col.views || []).map((view) => serializeViewForApi(view, serializeAccess))),
|
|
7874
9931
|
admin: col.admin,
|
|
7875
9932
|
detail: serializeDetailForApi(col.detail),
|
|
7876
9933
|
workflow: col.workflow ? {
|
|
@@ -7945,9 +10002,9 @@ function registerRoutes(app, config) {
|
|
|
7945
10002
|
const { collection: colSlug, field: fieldName } = c.req.param();
|
|
7946
10003
|
const siteId = c.req.header("X-Site-Id");
|
|
7947
10004
|
const requestConfig = siteId && config.onSchemaFetch ? mergeDynamicConfig(config, await config.onSchemaFetch(siteId)) : config;
|
|
7948
|
-
|
|
10005
|
+
const collections = [...requestConfig.collections];
|
|
7949
10006
|
const user = c.get("user");
|
|
7950
|
-
|
|
10007
|
+
const collection = collections.find((col) => col.slug === colSlug);
|
|
7951
10008
|
let field;
|
|
7952
10009
|
if (collection) {
|
|
7953
10010
|
const accessExpr = collection.access?.read;
|
|
@@ -8073,13 +10130,12 @@ function registerRoutes(app, config) {
|
|
|
8073
10130
|
app.get("/api/docs", (c) => {
|
|
8074
10131
|
return c.html(getSwaggerHtml());
|
|
8075
10132
|
});
|
|
8076
|
-
app.get("/api/preferences/:key",
|
|
10133
|
+
app.get("/api/preferences/:key", optionalAuth(config), async (c) => {
|
|
8077
10134
|
const db = config.db;
|
|
8078
10135
|
const user = c.get("user");
|
|
8079
10136
|
const key = c.req.param("key");
|
|
8080
10137
|
const scope = c.req.query("scope");
|
|
8081
10138
|
if (!db) return c.json({ message: "Database not configured" }, 500);
|
|
8082
|
-
if (!user?.collection || !user.sub) return c.json({ error: true, message: "Authentication required." }, 401);
|
|
8083
10139
|
if (!key) return c.json({ error: true, message: "Preference key is required." }, 400);
|
|
8084
10140
|
const getGlobalPreference = async () => {
|
|
8085
10141
|
const globalDoc = await db.findOne({
|
|
@@ -8088,12 +10144,15 @@ function registerRoutes(app, config) {
|
|
|
8088
10144
|
});
|
|
8089
10145
|
return globalDoc ? globalDoc.value : null;
|
|
8090
10146
|
};
|
|
8091
|
-
if (scope === "global") {
|
|
10147
|
+
if (scope === "global" || !user?.collection || !user.sub) {
|
|
8092
10148
|
const globalValue2 = await getGlobalPreference();
|
|
8093
10149
|
return c.json({ key, value: globalValue2 });
|
|
8094
10150
|
}
|
|
8095
10151
|
const doc = await db.findOne({ collection: user.collection, id: user.sub });
|
|
8096
|
-
if (!doc)
|
|
10152
|
+
if (!doc) {
|
|
10153
|
+
const globalValue2 = await getGlobalPreference();
|
|
10154
|
+
return c.json({ key, value: globalValue2 });
|
|
10155
|
+
}
|
|
8097
10156
|
const preferences = typeof doc.__preferences === "object" && doc.__preferences !== null ? doc.__preferences : {};
|
|
8098
10157
|
if (key in preferences) {
|
|
8099
10158
|
return c.json({ key, value: preferences[key] ?? null });
|
|
@@ -8232,6 +10291,10 @@ function registerRoutes(app, config) {
|
|
|
8232
10291
|
app.post(`${path}/media`, (c) => controller.create(c));
|
|
8233
10292
|
app.delete(`${path}/delete-many`, (c) => controller.deleteMany(c));
|
|
8234
10293
|
app.post(`${path}/aggregate`, (c) => controller.aggregate(c));
|
|
10294
|
+
if (collection.views?.length) {
|
|
10295
|
+
app.post(`${path}/views/:viewSlug/actions/:action`, optionalAuth(config), (c) => controller.runViewAction(c));
|
|
10296
|
+
app.post(`${path}/actions/:action`, optionalAuth(config), (c) => controller.runViewAction(c));
|
|
10297
|
+
}
|
|
8235
10298
|
if (collection.audit) {
|
|
8236
10299
|
app.get(`${path}/__audit`, (c) => auditController.findForCollection(c, collection));
|
|
8237
10300
|
}
|
|
@@ -9026,5 +11089,6 @@ init_observability();
|
|
|
9026
11089
|
renderPrometheusMetrics,
|
|
9027
11090
|
resolveObservabilityConfig,
|
|
9028
11091
|
serializeDetailForApi,
|
|
11092
|
+
serializeViewForApi,
|
|
9029
11093
|
shouldSampleRequest
|
|
9030
11094
|
});
|