@burdenoff/be-sdk 2026.1110.2 → 2026.1110.3
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/configs/eslint/index.js +1 -1
- package/configs/tsconfig/tsconfig.json +1 -1
- package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
- package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
- package/dist/ai-credits/index.d.ts +2 -3
- package/dist/ai-credits/index.js +3 -4
- package/dist/ai-credits/index.js.map +1 -1
- package/dist/ai-credits-Ca-NNcVx.js +546 -0
- package/dist/ai-credits-Ca-NNcVx.js.map +1 -0
- package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
- package/dist/auth/index.d.ts +2 -77
- package/dist/auth/index.js +3 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/auth-CEuBEBQN.js +228 -0
- package/dist/auth-CEuBEBQN.js.map +1 -0
- package/dist/cache/index.d.ts +2 -3
- package/dist/cache/index.js +3 -7
- package/dist/cache/index.js.map +1 -1
- package/dist/cache-CU0uLwcS.js +1837 -0
- package/dist/cache-CU0uLwcS.js.map +1 -0
- package/dist/captcha/index.d.ts +2 -1
- package/dist/captcha/index.js +3 -3
- package/dist/captcha/index.js.map +1 -1
- package/dist/captcha-BT7yh1YS.js +77 -0
- package/dist/captcha-BT7yh1YS.js.map +1 -0
- package/dist/client/internal-client.d.ts +4 -7
- package/dist/client/internal-client.js +172 -4
- package/dist/client/internal-client.js.map +1 -1
- package/dist/client-BgAEvDC2.d.ts +86 -0
- package/dist/client-DcZ3iGES.js +565 -0
- package/dist/client-DcZ3iGES.js.map +1 -0
- package/dist/collector-endpoint-iyQYeI50.js +50 -0
- package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
- package/dist/context-CZnXf2yb.js +247 -0
- package/dist/context-CZnXf2yb.js.map +1 -0
- package/dist/crypto/index.d.ts +2 -1
- package/dist/crypto/index.js +3 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/crypto-DO9fM0FO.js +145 -0
- package/dist/crypto-DO9fM0FO.js.map +1 -0
- package/dist/database/index.d.ts +104 -108
- package/dist/database/index.js +468 -6
- package/dist/database/index.js.map +1 -1
- package/dist/dataloader/index.d.ts +2 -1
- package/dist/dataloader/index.js +3 -3
- package/dist/dataloader/index.js.map +1 -1
- package/dist/dataloader-DwpT3YoS.js +294 -0
- package/dist/dataloader-DwpT3YoS.js.map +1 -0
- package/dist/deployed-environment-p_Tdl3sT.js +38 -0
- package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
- package/dist/dist-BGKdXVy3.js +1718 -0
- package/dist/dist-BGKdXVy3.js.map +1 -0
- package/dist/env-DdaoGjIt.js +74 -0
- package/dist/env-DdaoGjIt.js.map +1 -0
- package/dist/event-queue/index.d.ts +2 -7
- package/dist/event-queue/index.js +7 -9
- package/dist/event-queue/index.js.map +1 -1
- package/dist/event-queue-Cw-YJPY_.js +1384 -0
- package/dist/event-queue-Cw-YJPY_.js.map +1 -0
- package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
- package/dist/export/index.d.ts +2 -2
- package/dist/export/index.js +3 -14
- package/dist/export/index.js.map +1 -1
- package/dist/export-B6fphx8a.js +642 -0
- package/dist/export-B6fphx8a.js.map +1 -0
- package/dist/feature-flags/index.d.ts +2 -10
- package/dist/feature-flags/index.js +3 -6
- package/dist/feature-flags/index.js.map +1 -1
- package/dist/feature-flags-71oDkrUe.js +422 -0
- package/dist/feature-flags-71oDkrUe.js.map +1 -0
- package/dist/files/index.d.ts +2 -3
- package/dist/files/index.js +3 -4
- package/dist/files/index.js.map +1 -1
- package/dist/files-DjH0099H.js +830 -0
- package/dist/files-DjH0099H.js.map +1 -0
- package/dist/gateway/index.d.ts +4 -6
- package/dist/gateway/index.js +7 -13
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/security/index.d.ts +2 -2
- package/dist/gateway/security/index.js +3 -5
- package/dist/gateway/security/index.js.map +1 -1
- package/dist/gateway-DBFmxWks.js +50 -0
- package/dist/gateway-DBFmxWks.js.map +1 -0
- package/dist/graph/index.d.ts +3 -10
- package/dist/graph/index.js +4 -13
- package/dist/graph/index.js.map +1 -1
- package/dist/graph-DDYgIryR.js +2152 -0
- package/dist/graph-DDYgIryR.js.map +1 -0
- package/dist/graph-emitter-CdOXP7Tn.js +621 -0
- package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
- package/dist/graphql/index.d.ts +3 -2
- package/dist/graphql/index.js +4 -6
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/services/index.d.ts +2 -24
- package/dist/graphql/services/index.js +3 -4
- package/dist/graphql/services/index.js.map +1 -1
- package/dist/graphql-DHAHHcww.js +161 -0
- package/dist/graphql-DHAHHcww.js.map +1 -0
- package/dist/graphql-DNkMkGBZ.d.ts +21 -0
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.js +3 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n-BBMYFd0P.js +860 -0
- package/dist/i18n-BBMYFd0P.js.map +1 -0
- package/dist/import-optional-peer-B82VYxeX.js +18 -0
- package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
- package/dist/index-3KOZ1zN9.d.ts +233 -0
- package/dist/index-BBqooJ52.d.ts +45 -0
- package/dist/index-BGzMYJsm.d.ts +209 -0
- package/dist/index-BKwHQtHQ.d.ts +63 -0
- package/dist/index-BMIMnp6T.d.ts +8 -0
- package/dist/index-BQDsNAMR.d.ts +81 -0
- package/dist/index-BVOL7458.d.ts +10 -0
- package/dist/index-BcqQs-Uq.d.ts +69 -0
- package/dist/index-BeVtqGO-.d.ts +208 -0
- package/dist/index-BiTzGUZP.d.ts +114 -0
- package/dist/index-BqYfCQSP.d.ts +500 -0
- package/dist/index-C0qLquY0.d.ts +150 -0
- package/dist/index-C5uEKchX.d.ts +60 -0
- package/dist/index-CDOqxSIi.d.ts +37 -0
- package/dist/index-CG6wj66Y.d.ts +148 -0
- package/dist/index-CIgoeobA.d.ts +145 -0
- package/dist/index-CPQDMSFS.d.ts +103 -0
- package/dist/index-CSRcgkVi.d.ts +23 -0
- package/dist/index-CZTnQIRU.d.ts +341 -0
- package/dist/index-CaM9JUcc.d.ts +144 -0
- package/dist/index-CkT2aUr3.d.ts +704 -0
- package/dist/index-CliOgq6L.d.ts +203 -0
- package/dist/index-CnzbJZP7.d.ts +999 -0
- package/dist/index-D6UeLAye.d.ts +63 -0
- package/dist/index-DGgh9DWn.d.ts +59 -0
- package/dist/index-DY3dNhMN.d.ts +420 -0
- package/dist/index-DZC-2o9R.d.ts +207 -0
- package/dist/index-DqbGqfAy.d.ts +127 -0
- package/dist/index-Dt1HJPTX.d.ts +12 -0
- package/dist/index-DtI6aBtB.d.ts +22 -0
- package/dist/index-FKohsiex.d.ts +38 -0
- package/dist/index-FbXPfen7.d.ts +132 -0
- package/dist/index-MArCb8Aq.d.ts +306 -0
- package/dist/index-N-huORcj.d.ts +303 -0
- package/dist/index-YOShAwkq.d.ts +45 -0
- package/dist/index-bZKZUvBu.d.ts +646 -0
- package/dist/index-yBSjMY32.d.ts +24 -0
- package/dist/index.d.ts +501 -544
- package/dist/index.js +1820 -2171
- package/dist/index.js.map +1 -1
- package/dist/init/index.d.ts +2 -2
- package/dist/init/index.js +3 -16
- package/dist/init/index.js.map +1 -1
- package/dist/init-Dy3KhT6Y.js +325 -0
- package/dist/init-Dy3KhT6Y.js.map +1 -0
- package/dist/instrumentation/index.d.ts +3 -4
- package/dist/instrumentation/index.js +5 -5
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation-xkkmDgJ0.js +1678 -0
- package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
- package/dist/lake/index.d.ts +50 -54
- package/dist/lake/index.js +169 -193
- package/dist/lake/index.js.map +1 -1
- package/dist/layer/index.d.ts +3 -2
- package/dist/layer/index.js +4 -5
- package/dist/layer/index.js.map +1 -1
- package/dist/layer-BZBZZWeV.d.ts +69 -0
- package/dist/layer-Bcix-WCl.js +105 -0
- package/dist/layer-Bcix-WCl.js.map +1 -0
- package/dist/layer-CEKy6cm8.js +252 -0
- package/dist/layer-CEKy6cm8.js.map +1 -0
- package/dist/lifecycle/index.d.ts +2 -1
- package/dist/lifecycle/index.js +3 -4
- package/dist/lifecycle/index.js.map +1 -1
- package/dist/lifecycle-DeoLSX0U.js +76 -0
- package/dist/lifecycle-DeoLSX0U.js.map +1 -0
- package/dist/logger/index.d.ts +2 -3
- package/dist/logger/index.js +3 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger-B6rCpb7D.js +290 -0
- package/dist/logger-B6rCpb7D.js.map +1 -0
- package/dist/metrics/index.d.ts +13 -14
- package/dist/metrics/index.js +3 -4
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics-BrLwNUrb.js +52 -0
- package/dist/metrics-BrLwNUrb.js.map +1 -0
- package/dist/metrics-collector-C2eShrlW.js +922 -0
- package/dist/metrics-collector-C2eShrlW.js.map +1 -0
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +3 -4
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware-CUxJVUpD.js +1243 -0
- package/dist/middleware-CUxJVUpD.js.map +1 -0
- package/dist/middleware-Cq0zFMGp.js +253 -0
- package/dist/middleware-Cq0zFMGp.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -5
- package/dist/notifications/index.js +3 -6
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications-CdETrtFK.js +869 -0
- package/dist/notifications-CdETrtFK.js.map +1 -0
- package/dist/observability/index.d.ts +2 -3
- package/dist/observability/index.js +3 -4
- package/dist/observability/index.js.map +1 -1
- package/dist/observability-DBDXipTU.js +272 -0
- package/dist/observability-DBDXipTU.js.map +1 -0
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.js +3 -5
- package/dist/platform/index.js.map +1 -1
- package/dist/platform-DZwczW7v.js +1510 -0
- package/dist/platform-DZwczW7v.js.map +1 -0
- package/dist/prisma/generator/index.d.ts +1 -1
- package/dist/prisma/generator/index.js +97 -84
- package/dist/prisma/generator/index.js.map +1 -1
- package/dist/prisma/index.d.ts +4 -7
- package/dist/prisma/index.js +5 -12
- package/dist/prisma/index.js.map +1 -1
- package/dist/prisma-BzOOdt79.js +863 -0
- package/dist/prisma-BzOOdt79.js.map +1 -0
- package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
- package/dist/product-alias/index.d.ts +2 -1
- package/dist/product-alias/index.js +3 -3
- package/dist/product-alias/index.js.map +1 -1
- package/dist/product-alias-BPqtskMq.js +273 -0
- package/dist/product-alias-BPqtskMq.js.map +1 -0
- package/dist/rbac/index.d.ts +2 -122
- package/dist/rbac/index.js +3 -6
- package/dist/rbac/index.js.map +1 -1
- package/dist/rbac-BB9l9Xph.js +1486 -0
- package/dist/rbac-BB9l9Xph.js.map +1 -0
- package/dist/resource-caps/index.d.ts +66 -72
- package/dist/resource-caps/index.js +430 -5
- package/dist/resource-caps/index.js.map +1 -1
- package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
- package/dist/sdk-Dju9o-sq.js +124 -0
- package/dist/sdk-Dju9o-sq.js.map +1 -0
- package/dist/security-DIG-95Ic.js +1647 -0
- package/dist/security-DIG-95Ic.js.map +1 -0
- package/dist/server/index.d.ts +7 -164
- package/dist/server/index.js +2000 -1507
- package/dist/server/index.js.map +1 -1
- package/dist/service-jwt-Bu-WNA_-.js +80 -0
- package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
- package/dist/services-BWzfz7vG.js +102 -0
- package/dist/services-BWzfz7vG.js.map +1 -0
- package/dist/sharding/index.d.ts +41 -44
- package/dist/sharding/index.js +156 -137
- package/dist/sharding/index.js.map +1 -1
- package/dist/sharing/index.d.ts +2 -1
- package/dist/sharing/index.js +3 -4
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing-CflDsSJ-.js +911 -0
- package/dist/sharing-CflDsSJ-.js.map +1 -0
- package/dist/stub-BqwKn4eh.js +630 -0
- package/dist/stub-BqwKn4eh.js.map +1 -0
- package/dist/tags/index.d.ts +2 -3
- package/dist/tags/index.js +3 -4
- package/dist/tags/index.js.map +1 -1
- package/dist/tags-B5xpbgsk.js +868 -0
- package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.js.map} +1 -1
- package/dist/telemetry/index.d.ts +64 -76
- package/dist/telemetry/index.js +369 -201
- package/dist/telemetry/index.js.map +1 -1
- package/dist/temporal/index.d.ts +2 -148
- package/dist/temporal/index.js +3 -5
- package/dist/temporal/index.js.map +1 -1
- package/dist/temporal-B534uYK8.js +706 -0
- package/dist/temporal-B534uYK8.js.map +1 -0
- package/dist/tracker/index.d.ts +5 -11
- package/dist/tracker/index.js +5 -20
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker-BQVoEFUo.js +839 -0
- package/dist/tracker-BQVoEFUo.js.map +1 -0
- package/dist/types-BYMYND1L.js +44 -0
- package/dist/types-BYMYND1L.js.map +1 -0
- package/dist/types-C6EKaS3V.d.ts +106 -0
- package/dist/types-CWybW61E.d.ts +323 -0
- package/dist/types-C_yfu3XK.d.ts +34 -0
- package/dist/types-Cj2RWXbz.js +90 -0
- package/dist/types-Cj2RWXbz.js.map +1 -0
- package/dist/types-DgaQqvxo.d.ts +70 -0
- package/dist/usage/index.d.ts +2 -213
- package/dist/usage/index.js +3 -15
- package/dist/usage/index.js.map +1 -1
- package/dist/usage-BKFZiWQn.js +682 -0
- package/dist/usage-BKFZiWQn.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils-DL85Tnbn.js +500 -0
- package/dist/utils-DL85Tnbn.js.map +1 -0
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +3 -3
- package/dist/validation/index.js.map +1 -1
- package/dist/validation-CPUITdMk.js +762 -0
- package/dist/validation-CPUITdMk.js.map +1 -0
- package/dist/workspace-extension-COrC0dYi.js +979 -0
- package/dist/workspace-extension-COrC0dYi.js.map +1 -0
- package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
- package/package.json +7 -10
- package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
- package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
- package/dist/chunk-4XIBXZ6J.js +0 -276
- package/dist/chunk-4XIBXZ6J.js.map +0 -1
- package/dist/chunk-554Z4C2K.js +0 -1006
- package/dist/chunk-554Z4C2K.js.map +0 -1
- package/dist/chunk-5CAFHK2Z.js +0 -107
- package/dist/chunk-5CAFHK2Z.js.map +0 -1
- package/dist/chunk-63ZXJ42X.js +0 -451
- package/dist/chunk-63ZXJ42X.js.map +0 -1
- package/dist/chunk-6XEXJATV.js +0 -304
- package/dist/chunk-6XEXJATV.js.map +0 -1
- package/dist/chunk-726AR6Q7.js +0 -1532
- package/dist/chunk-726AR6Q7.js.map +0 -1
- package/dist/chunk-A5F6Z5UE.js +0 -21
- package/dist/chunk-A5F6Z5UE.js.map +0 -1
- package/dist/chunk-A6DE32ZS.js +0 -1507
- package/dist/chunk-A6DE32ZS.js.map +0 -1
- package/dist/chunk-AXJDGQPE.js +0 -690
- package/dist/chunk-AXJDGQPE.js.map +0 -1
- package/dist/chunk-BJQOGOVW.js +0 -602
- package/dist/chunk-BJQOGOVW.js.map +0 -1
- package/dist/chunk-CFXWH2IS.js +0 -52
- package/dist/chunk-CFXWH2IS.js.map +0 -1
- package/dist/chunk-DRWH5XCJ.js +0 -876
- package/dist/chunk-DRWH5XCJ.js.map +0 -1
- package/dist/chunk-E4QNLVY4.js +0 -909
- package/dist/chunk-E4QNLVY4.js.map +0 -1
- package/dist/chunk-EBDHIL7V.js +0 -774
- package/dist/chunk-EBDHIL7V.js.map +0 -1
- package/dist/chunk-ELU7VL3E.js +0 -245
- package/dist/chunk-ELU7VL3E.js.map +0 -1
- package/dist/chunk-FZRODKIN.js +0 -31
- package/dist/chunk-FZRODKIN.js.map +0 -1
- package/dist/chunk-GCIB76AJ.js +0 -882
- package/dist/chunk-GCIB76AJ.js.map +0 -1
- package/dist/chunk-HC6MPUIH.js +0 -1571
- package/dist/chunk-HC6MPUIH.js.map +0 -1
- package/dist/chunk-HNMHPSAM.js +0 -272
- package/dist/chunk-HNMHPSAM.js.map +0 -1
- package/dist/chunk-HTLEGD3Q.js +0 -1480
- package/dist/chunk-HTLEGD3Q.js.map +0 -1
- package/dist/chunk-I3KOWRT3.js +0 -89
- package/dist/chunk-I3KOWRT3.js.map +0 -1
- package/dist/chunk-ID3WR4JS.js +0 -509
- package/dist/chunk-ID3WR4JS.js.map +0 -1
- package/dist/chunk-JS52ZHTK.js +0 -1346
- package/dist/chunk-JS52ZHTK.js.map +0 -1
- package/dist/chunk-JVMAQOA3.js +0 -521
- package/dist/chunk-JVMAQOA3.js.map +0 -1
- package/dist/chunk-KH4TRQCO.js +0 -1063
- package/dist/chunk-KH4TRQCO.js.map +0 -1
- package/dist/chunk-KJOSPVB2.js +0 -57
- package/dist/chunk-KJOSPVB2.js.map +0 -1
- package/dist/chunk-KO2ZXZ7W.js +0 -61
- package/dist/chunk-KO2ZXZ7W.js.map +0 -1
- package/dist/chunk-KS2HQCJR.js +0 -56
- package/dist/chunk-KS2HQCJR.js.map +0 -1
- package/dist/chunk-LA5KPWZ2.js +0 -413
- package/dist/chunk-LA5KPWZ2.js.map +0 -1
- package/dist/chunk-MESLAC5W.js +0 -574
- package/dist/chunk-MESLAC5W.js.map +0 -1
- package/dist/chunk-MWPYA2HD.js +0 -94
- package/dist/chunk-MWPYA2HD.js.map +0 -1
- package/dist/chunk-NUB5GQTU.js +0 -270
- package/dist/chunk-NUB5GQTU.js.map +0 -1
- package/dist/chunk-OBBCR6WY.js +0 -277
- package/dist/chunk-OBBCR6WY.js.map +0 -1
- package/dist/chunk-OQDSAOG3.js +0 -1908
- package/dist/chunk-OQDSAOG3.js.map +0 -1
- package/dist/chunk-OXNCBE7P.js +0 -971
- package/dist/chunk-OXNCBE7P.js.map +0 -1
- package/dist/chunk-PBZFAAOM.js +0 -941
- package/dist/chunk-PN6GIF3R.js +0 -1185
- package/dist/chunk-PN6GIF3R.js.map +0 -1
- package/dist/chunk-PYD44IHJ.js +0 -728
- package/dist/chunk-PYD44IHJ.js.map +0 -1
- package/dist/chunk-QVPIACWD.js +0 -679
- package/dist/chunk-QVPIACWD.js.map +0 -1
- package/dist/chunk-QWNNFE4P.js +0 -41
- package/dist/chunk-QWNNFE4P.js.map +0 -1
- package/dist/chunk-RU266375.js +0 -327
- package/dist/chunk-RU266375.js.map +0 -1
- package/dist/chunk-RYTSVGGA.js +0 -1624
- package/dist/chunk-RYTSVGGA.js.map +0 -1
- package/dist/chunk-RZOFS2BQ.js +0 -225
- package/dist/chunk-RZOFS2BQ.js.map +0 -1
- package/dist/chunk-SBS4S2PJ.js +0 -100
- package/dist/chunk-SBS4S2PJ.js.map +0 -1
- package/dist/chunk-SPRG6G6G.js +0 -530
- package/dist/chunk-SPRG6G6G.js.map +0 -1
- package/dist/chunk-STWFX5E2.js +0 -233
- package/dist/chunk-STWFX5E2.js.map +0 -1
- package/dist/chunk-UNASM5VJ.js +0 -419
- package/dist/chunk-UNASM5VJ.js.map +0 -1
- package/dist/chunk-VAT66FJA.js +0 -245
- package/dist/chunk-VAT66FJA.js.map +0 -1
- package/dist/chunk-VFCMR5GX.js +0 -49
- package/dist/chunk-VFCMR5GX.js.map +0 -1
- package/dist/chunk-VGAHZKNJ.js +0 -66
- package/dist/chunk-VGAHZKNJ.js.map +0 -1
- package/dist/chunk-VTJTAAXC.js +0 -627
- package/dist/chunk-VTJTAAXC.js.map +0 -1
- package/dist/chunk-VXVLKRU6.js +0 -758
- package/dist/chunk-VXVLKRU6.js.map +0 -1
- package/dist/chunk-WWUU5ETI.js +0 -163
- package/dist/chunk-WWUU5ETI.js.map +0 -1
- package/dist/chunk-XE4OXN2W.js +0 -10
- package/dist/chunk-XE4OXN2W.js.map +0 -1
- package/dist/chunk-XOJORS75.js +0 -1853
- package/dist/chunk-XOJORS75.js.map +0 -1
- package/dist/chunk-YMZEUTD2.js +0 -110
- package/dist/chunk-YMZEUTD2.js.map +0 -1
- package/dist/chunk-Z77BTSOK.js +0 -617
- package/dist/chunk-Z77BTSOK.js.map +0 -1
- package/dist/chunk-ZZK3WEDI.js +0 -181
- package/dist/chunk-ZZK3WEDI.js.map +0 -1
- package/dist/client-CCXpAZ2r.d.ts +0 -89
- package/dist/client-DSI_760t.d.ts +0 -36
- package/dist/client-JU6T3UPB.js +0 -11
- package/dist/client-JU6T3UPB.js.map +0 -1
- package/dist/dist-2X4Q7PJA.js +0 -1491
- package/dist/dist-2X4Q7PJA.js.map +0 -1
- package/dist/env-4UWSUS64.js +0 -4
- package/dist/env-4UWSUS64.js.map +0 -1
- package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
- package/dist/graphql-CMHMQjvd.d.ts +0 -23
- package/dist/i18n-Qm2AkPC-.d.ts +0 -33
- package/dist/index--yvpa6ay.d.ts +0 -83
- package/dist/index-4gKQKZ2B.d.ts +0 -71
- package/dist/index-5x0XMKXN.d.ts +0 -149
- package/dist/index-B70b5mYS.d.ts +0 -33
- package/dist/index-B8KrxO4j.d.ts +0 -755
- package/dist/index-BOuDKnqD.d.ts +0 -201
- package/dist/index-BTMt4OjA.d.ts +0 -201
- package/dist/index-BejbszA7.d.ts +0 -39
- package/dist/index-BkeOYZye.d.ts +0 -198
- package/dist/index-BuAj5nXg.d.ts +0 -83
- package/dist/index-BvkVcW8I.d.ts +0 -349
- package/dist/index-CWmH_-RZ.d.ts +0 -247
- package/dist/index-CbgWNcus.d.ts +0 -258
- package/dist/index-CmfPeQza.d.ts +0 -166
- package/dist/index-CmpG-zak.d.ts +0 -607
- package/dist/index-CoMKgL-p.d.ts +0 -12
- package/dist/index-D8HGwglK.d.ts +0 -541
- package/dist/index-DCaVm66D.d.ts +0 -1101
- package/dist/index-DE2w7E0d.d.ts +0 -83
- package/dist/index-DSOpj8DI.d.ts +0 -17
- package/dist/index-DW9q22GH.d.ts +0 -75
- package/dist/index-DnjJ9CwI.d.ts +0 -347
- package/dist/index-DwMJZ8PP.d.ts +0 -317
- package/dist/index-PaojfSdd.d.ts +0 -71
- package/dist/index-aHtYvc3i.d.ts +0 -284
- package/dist/index-e_18DzAg.d.ts +0 -18
- package/dist/index-ffmipXSA.d.ts +0 -55
- package/dist/index-joONjwLt.d.ts +0 -33
- package/dist/index-kssw5ziY.d.ts +0 -250
- package/dist/index-lFffh5-G.d.ts +0 -125
- package/dist/index-pxYge_6k.d.ts +0 -79
- package/dist/layer-Cv9vSwBx.d.ts +0 -70
- package/dist/pino-logger-H4HPW5P6.js +0 -5
- package/dist/pino-logger-H4HPW5P6.js.map +0 -1
- package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
- package/dist/sdk-L75WWUP3.js +0 -156
- package/dist/sdk-L75WWUP3.js.map +0 -1
- package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
- package/dist/types-Bo2wkjSP.d.ts +0 -35
- package/dist/types-DVpvrAhd.d.ts +0 -71
- package/dist/types-DgJ4lDYA.d.ts +0 -108
- package/dist/types-USOv09qy.d.ts +0 -327
- package/dist/workspace-guard-NXVYYBVJ.js +0 -5
- package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
|
|
2
|
+
import { t as GatewayClient } from "./client-DcZ3iGES.js";
|
|
3
|
+
import "./gateway-DBFmxWks.js";
|
|
4
|
+
|
|
5
|
+
// src/export/base-exporter.ts
|
|
6
|
+
/**
|
|
7
|
+
* Abstract base class for module exporters
|
|
8
|
+
*
|
|
9
|
+
* Provides common functionality that all module exporters can inherit:
|
|
10
|
+
* - Field filtering
|
|
11
|
+
* - Pagination helpers
|
|
12
|
+
* - Module metadata
|
|
13
|
+
*
|
|
14
|
+
* @typeParam T - The type of entity this exporter handles
|
|
15
|
+
*/
|
|
16
|
+
var BaseModuleExporter = class {
|
|
17
|
+
/** Unique key identifying this module (e.g., 'users', 'tags', 'orders') */
|
|
18
|
+
moduleKey;
|
|
19
|
+
/** Human-readable display name for the module */
|
|
20
|
+
displayName;
|
|
21
|
+
/** Description of what this module exports */
|
|
22
|
+
description;
|
|
23
|
+
/** Default fields to exclude from export (e.g., sensitive data) */
|
|
24
|
+
defaultExcludeFields;
|
|
25
|
+
/** List of product IDs this exporter supports */
|
|
26
|
+
supportedProducts;
|
|
27
|
+
/** Model name for database operations */
|
|
28
|
+
modelName;
|
|
29
|
+
/**
|
|
30
|
+
* Filter fields from an entity based on exclude list
|
|
31
|
+
*
|
|
32
|
+
* Use this to remove sensitive or unnecessary fields from exported data.
|
|
33
|
+
*
|
|
34
|
+
* @param entity - Entity to filter
|
|
35
|
+
* @param excludeFields - Fields to exclude (uses defaultExcludeFields if not provided)
|
|
36
|
+
* @returns Filtered entity as a plain object
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const user = { id: '1', name: 'John', password: 'secret', ssn: '123' };
|
|
41
|
+
* const filtered = this.filterFields(user, ['password', 'ssn']);
|
|
42
|
+
* // Result: { id: '1', name: 'John' }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
filterFields(entity, excludeFields) {
|
|
46
|
+
const fieldsToExclude = excludeFields || this.defaultExcludeFields || [];
|
|
47
|
+
if (fieldsToExclude.length === 0) return entity;
|
|
48
|
+
const filtered = {};
|
|
49
|
+
const record = entity;
|
|
50
|
+
for (const [key, value] of Object.entries(record)) if (!fieldsToExclude.includes(key)) filtered[key] = value;
|
|
51
|
+
return filtered;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Filter multiple entities
|
|
55
|
+
*
|
|
56
|
+
* @param entities - Array of entities to filter
|
|
57
|
+
* @param excludeFields - Fields to exclude
|
|
58
|
+
* @returns Array of filtered entities
|
|
59
|
+
*/
|
|
60
|
+
filterFieldsMany(entities, excludeFields) {
|
|
61
|
+
return entities.map((entity) => this.filterFields(entity, excludeFields));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Paginate helper for database queries
|
|
65
|
+
*
|
|
66
|
+
* Use this to implement paginated data fetching in your export method.
|
|
67
|
+
*
|
|
68
|
+
* @param queryFn - Function that executes the paginated query
|
|
69
|
+
* @param page - Page number (1-indexed)
|
|
70
|
+
* @param pageSize - Number of items per page
|
|
71
|
+
* @returns Paginated result with data and metadata
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const result = await this.paginate(
|
|
76
|
+
* async ({ skip, take }) => {
|
|
77
|
+
* const items = await db.user.findMany({ skip, take });
|
|
78
|
+
* const total = await db.user.count();
|
|
79
|
+
* return { items, total };
|
|
80
|
+
* },
|
|
81
|
+
* 1,
|
|
82
|
+
* 100
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
async paginate(queryFn, page = 1, pageSize = 100) {
|
|
87
|
+
const skip = (page - 1) * pageSize;
|
|
88
|
+
const { items, total } = await queryFn({
|
|
89
|
+
skip,
|
|
90
|
+
take: pageSize
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
data: items,
|
|
94
|
+
total,
|
|
95
|
+
hasMore: skip + items.length < total,
|
|
96
|
+
nextCursor: items.length > 0 && skip + items.length < total ? String(page + 1) : void 0
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Fetch all data using cursor-based pagination
|
|
101
|
+
*
|
|
102
|
+
* Use this for exporting large datasets efficiently.
|
|
103
|
+
*
|
|
104
|
+
* @param fetchBatch - Function to fetch a batch of data
|
|
105
|
+
* @param batchSize - Number of items per batch
|
|
106
|
+
* @returns All fetched items
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const allUsers = await this.fetchAll(
|
|
111
|
+
* async (cursor) => db.user.findMany({
|
|
112
|
+
* where: cursor ? { id: { gt: cursor } } : undefined,
|
|
113
|
+
* orderBy: { id: 'asc' },
|
|
114
|
+
* take: 100,
|
|
115
|
+
* }),
|
|
116
|
+
* 100
|
|
117
|
+
* );
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
async fetchAll(fetchBatch, batchSize = 100) {
|
|
121
|
+
const allItems = [];
|
|
122
|
+
let cursor;
|
|
123
|
+
while (true) {
|
|
124
|
+
const batch = await fetchBatch(cursor);
|
|
125
|
+
if (batch.length === 0) break;
|
|
126
|
+
allItems.push(...batch);
|
|
127
|
+
const lastItem = batch[batch.length - 1];
|
|
128
|
+
if (lastItem) cursor = lastItem.id;
|
|
129
|
+
if (batch.length < batchSize) break;
|
|
130
|
+
}
|
|
131
|
+
return allItems;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Transform entity for export
|
|
135
|
+
*
|
|
136
|
+
* Override this method to customize how entities are transformed before export.
|
|
137
|
+
* Default implementation returns the entity as-is after field filtering.
|
|
138
|
+
*
|
|
139
|
+
* @param entity - Entity to transform
|
|
140
|
+
* @param excludeFields - Fields to exclude
|
|
141
|
+
* @returns Transformed entity
|
|
142
|
+
*/
|
|
143
|
+
transformForExport(entity, excludeFields) {
|
|
144
|
+
return this.filterFields(entity, excludeFields);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Validate export options
|
|
148
|
+
*
|
|
149
|
+
* Override this to add custom validation for export options.
|
|
150
|
+
*
|
|
151
|
+
* @param options - Export options to validate
|
|
152
|
+
* @throws Error if options are invalid
|
|
153
|
+
*/
|
|
154
|
+
validateOptions(options) {
|
|
155
|
+
const validFormats = [
|
|
156
|
+
"csv",
|
|
157
|
+
"json",
|
|
158
|
+
"xlsx"
|
|
159
|
+
];
|
|
160
|
+
if (!validFormats.includes(options.format)) throw new Error(`Invalid export format: ${options.format}. Valid formats: ${validFormats.join(", ")}`);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get supported export formats
|
|
164
|
+
*
|
|
165
|
+
* @returns Array of supported format strings
|
|
166
|
+
*/
|
|
167
|
+
getSupportedFormats() {
|
|
168
|
+
return [
|
|
169
|
+
"csv",
|
|
170
|
+
"json",
|
|
171
|
+
"xlsx"
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get module metadata
|
|
176
|
+
*
|
|
177
|
+
* @returns Module metadata object
|
|
178
|
+
*/
|
|
179
|
+
getMetadata() {
|
|
180
|
+
return {
|
|
181
|
+
moduleKey: this.moduleKey,
|
|
182
|
+
displayName: this.displayName,
|
|
183
|
+
description: this.description,
|
|
184
|
+
supportedProducts: this.supportedProducts,
|
|
185
|
+
supportedFormats: this.getSupportedFormats()
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// src/export/pagination.ts
|
|
191
|
+
/**
|
|
192
|
+
* Service providing pagination utilities for export and data fetching operations
|
|
193
|
+
*/
|
|
194
|
+
var PaginationService = class PaginationService {
|
|
195
|
+
/**
|
|
196
|
+
* Paginate an array of items using offset-based pagination
|
|
197
|
+
*
|
|
198
|
+
* @param items - Array of items to paginate
|
|
199
|
+
* @param params - Pagination parameters
|
|
200
|
+
* @returns Paginated result with items and metadata
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const allUsers = await db.user.findMany();
|
|
205
|
+
* const page = PaginationService.paginate(allUsers, { page: 1, pageSize: 10 });
|
|
206
|
+
* console.log(page.items); // First 10 users
|
|
207
|
+
* console.log(page.pageInfo.hasNextPage); // true if more pages exist
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
static paginate(items, params) {
|
|
211
|
+
const page = params.page ?? 1;
|
|
212
|
+
const pageSize = params.pageSize ?? 20;
|
|
213
|
+
const start = (page - 1) * pageSize;
|
|
214
|
+
const end = start + pageSize;
|
|
215
|
+
const paginatedItems = items.slice(start, end);
|
|
216
|
+
return {
|
|
217
|
+
items: paginatedItems,
|
|
218
|
+
totalCount: items.length,
|
|
219
|
+
pageInfo: {
|
|
220
|
+
hasNextPage: end < items.length,
|
|
221
|
+
hasPreviousPage: page > 1,
|
|
222
|
+
startCursor: paginatedItems.length > 0 ? String(start) : void 0,
|
|
223
|
+
endCursor: paginatedItems.length > 0 ? String(Math.min(end, items.length) - 1) : void 0
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Calculate pagination metadata without slicing data
|
|
229
|
+
*
|
|
230
|
+
* @param totalCount - Total number of items
|
|
231
|
+
* @param page - Current page number (1-indexed)
|
|
232
|
+
* @param pageSize - Items per page
|
|
233
|
+
* @returns Pagination metadata
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* const meta = PaginationService.calculatePagination(150, 3, 20);
|
|
238
|
+
* // meta.hasNextPage = true (page 4 exists)
|
|
239
|
+
* // meta.hasPreviousPage = true (page 2 exists)
|
|
240
|
+
* // meta.totalPages = 8
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
static calculatePagination(totalCount, page, pageSize) {
|
|
244
|
+
const totalPages = Math.ceil(totalCount / pageSize);
|
|
245
|
+
const startIndex = (page - 1) * pageSize;
|
|
246
|
+
const endIndex = Math.min(startIndex + pageSize - 1, totalCount - 1);
|
|
247
|
+
return {
|
|
248
|
+
hasNextPage: page < totalPages,
|
|
249
|
+
hasPreviousPage: page > 1,
|
|
250
|
+
totalPages,
|
|
251
|
+
currentPage: page,
|
|
252
|
+
pageSize,
|
|
253
|
+
startIndex,
|
|
254
|
+
endIndex
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Async generator for paginated database queries using cursor-based pagination
|
|
259
|
+
*
|
|
260
|
+
* This is ideal for processing large datasets without loading everything into memory.
|
|
261
|
+
* The generator yields items one at a time, fetching new batches as needed.
|
|
262
|
+
*
|
|
263
|
+
* @param fetchFn - Function to fetch data given a cursor
|
|
264
|
+
* @param options - Pagination options
|
|
265
|
+
* @returns Async generator of items
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```typescript
|
|
269
|
+
* // Define fetch function that queries the database
|
|
270
|
+
* const fetchUsers = async (cursor?: string) => {
|
|
271
|
+
* return db.user.findMany({
|
|
272
|
+
* where: cursor ? { id: { gt: cursor } } : undefined,
|
|
273
|
+
* orderBy: { id: 'asc' },
|
|
274
|
+
* take: 100,
|
|
275
|
+
* });
|
|
276
|
+
* };
|
|
277
|
+
*
|
|
278
|
+
* // Process all users without loading all into memory
|
|
279
|
+
* for await (const user of PaginationService.paginatedQuery(fetchUsers)) {
|
|
280
|
+
* await processUser(user);
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
static async *paginatedQuery(fetchFn, options = {}) {
|
|
285
|
+
const { limit, initialCursor } = options;
|
|
286
|
+
let cursor = initialCursor;
|
|
287
|
+
let hasMore = true;
|
|
288
|
+
let totalYielded = 0;
|
|
289
|
+
while (hasMore) {
|
|
290
|
+
const items = await fetchFn(cursor);
|
|
291
|
+
if (items.length === 0) break;
|
|
292
|
+
for (const item of items) {
|
|
293
|
+
yield item;
|
|
294
|
+
totalYielded++;
|
|
295
|
+
if (limit && totalYielded >= limit) return;
|
|
296
|
+
}
|
|
297
|
+
const lastItem = items[items.length - 1];
|
|
298
|
+
if (lastItem) cursor = lastItem.id;
|
|
299
|
+
hasMore = items.length > 0;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Collect all items from a paginated query into an array
|
|
304
|
+
*
|
|
305
|
+
* @param fetchFn - Function to fetch data given a cursor
|
|
306
|
+
* @param options - Pagination options
|
|
307
|
+
* @returns Array of all items
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* const allUsers = await PaginationService.collectPaginatedQuery(fetchUsers, { limit: 1000 });
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
static async collectPaginatedQuery(fetchFn, options = {}) {
|
|
315
|
+
const items = [];
|
|
316
|
+
for await (const item of PaginationService.paginatedQuery(fetchFn, options)) items.push(item);
|
|
317
|
+
return items;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Create a cursor-based paginated fetch function from a Prisma-style query
|
|
321
|
+
*
|
|
322
|
+
* @param queryFn - Prisma-style query function
|
|
323
|
+
* @param batchSize - Number of items to fetch per batch
|
|
324
|
+
* @returns Fetch function compatible with paginatedQuery
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* const fetchFn = PaginationService.createPrismaFetchFn(
|
|
329
|
+
* (cursor) => db.user.findMany({
|
|
330
|
+
* where: { isActive: true, ...(cursor ? { id: { gt: cursor } } : {}) },
|
|
331
|
+
* orderBy: { id: 'asc' },
|
|
332
|
+
* take: 100,
|
|
333
|
+
* }),
|
|
334
|
+
* 100
|
|
335
|
+
* );
|
|
336
|
+
*
|
|
337
|
+
* for await (const user of PaginationService.paginatedQuery(fetchFn)) {
|
|
338
|
+
* console.log(user);
|
|
339
|
+
* }
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
static createPrismaFetchFn(queryFn, _batchSize = 100) {
|
|
343
|
+
return queryFn;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Calculate offset for skip-based pagination
|
|
347
|
+
*
|
|
348
|
+
* @param page - Page number (1-indexed)
|
|
349
|
+
* @param pageSize - Items per page
|
|
350
|
+
* @returns Offset value for skip
|
|
351
|
+
*/
|
|
352
|
+
static calculateOffset(page, pageSize) {
|
|
353
|
+
return (Math.max(1, page) - 1) * pageSize;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Parse cursor string to extract pagination state
|
|
357
|
+
*
|
|
358
|
+
* @param cursor - Base64-encoded cursor string
|
|
359
|
+
* @returns Decoded cursor data or null if invalid
|
|
360
|
+
*/
|
|
361
|
+
static parseCursor(cursor) {
|
|
362
|
+
try {
|
|
363
|
+
const decoded = Buffer.from(cursor, "base64").toString("utf-8");
|
|
364
|
+
return JSON.parse(decoded);
|
|
365
|
+
} catch {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Create cursor string from pagination state
|
|
371
|
+
*
|
|
372
|
+
* @param data - Data to encode in cursor
|
|
373
|
+
* @returns Base64-encoded cursor string
|
|
374
|
+
*/
|
|
375
|
+
static createCursor(data) {
|
|
376
|
+
return Buffer.from(JSON.stringify(data)).toString("base64");
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
// src/export/csv.ts
|
|
381
|
+
const FORMULA_PREFIX_RE = /^[=+\-@]/;
|
|
382
|
+
function sanitizeCSVCell(value) {
|
|
383
|
+
return FORMULA_PREFIX_RE.test(value) ? `'${value}` : value;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Convert an array of objects to CSV format
|
|
387
|
+
*
|
|
388
|
+
* Handles nested objects by flattening them with dot notation.
|
|
389
|
+
* Arrays are JSON stringified.
|
|
390
|
+
* Dates are converted to ISO strings.
|
|
391
|
+
*
|
|
392
|
+
* @param data - Array of objects to convert
|
|
393
|
+
* @param options - CSV conversion options
|
|
394
|
+
* @returns CSV string
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* const users = [
|
|
399
|
+
* { id: 1, name: 'John', address: { city: 'NYC' } },
|
|
400
|
+
* { id: 2, name: 'Jane', address: { city: 'LA' } },
|
|
401
|
+
* ];
|
|
402
|
+
*
|
|
403
|
+
* const csv = convertToCSV(users);
|
|
404
|
+
* // Output:
|
|
405
|
+
* // id,name,address.city
|
|
406
|
+
* // 1,John,NYC
|
|
407
|
+
* // 2,Jane,LA
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
function convertToCSV(data, options = {}) {
|
|
411
|
+
const { delimiter = ",", includeHeaders = true, flattenFields = true, maxFlattenDepth = 3 } = options;
|
|
412
|
+
if (data.length === 0) return "";
|
|
413
|
+
const flattenObject = (obj, prefix = "", depth = 0) => {
|
|
414
|
+
const result = {};
|
|
415
|
+
if (obj === null || obj === void 0) return result;
|
|
416
|
+
if (typeof obj !== "object") return { [prefix || "value"]: String(obj) };
|
|
417
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
418
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
419
|
+
if (value === null || value === void 0) result[newKey] = "";
|
|
420
|
+
else if (value instanceof Date) result[newKey] = value.toISOString();
|
|
421
|
+
else if (Array.isArray(value)) result[newKey] = JSON.stringify(value);
|
|
422
|
+
else if (typeof value === "object" && flattenFields && depth < maxFlattenDepth) Object.assign(result, flattenObject(value, newKey, depth + 1));
|
|
423
|
+
else if (typeof value === "object") result[newKey] = JSON.stringify(value);
|
|
424
|
+
else result[newKey] = String(value);
|
|
425
|
+
}
|
|
426
|
+
return result;
|
|
427
|
+
};
|
|
428
|
+
const flattenedRecords = data.map((item) => flattenObject(item));
|
|
429
|
+
const allKeys = /* @__PURE__ */ new Set();
|
|
430
|
+
for (const record of flattenedRecords) for (const key of Object.keys(record)) allKeys.add(key);
|
|
431
|
+
const headers = Array.from(allKeys).sort((a, b) => a.localeCompare(b));
|
|
432
|
+
const escapeCSV = (value) => {
|
|
433
|
+
const sanitizedValue = sanitizeCSVCell(value);
|
|
434
|
+
if (sanitizedValue.includes(delimiter) || sanitizedValue.includes("\"") || sanitizedValue.includes("\n") || sanitizedValue.includes("\r")) return `"${sanitizedValue.replace(/"/g, "\"\"")}"`;
|
|
435
|
+
return sanitizedValue;
|
|
436
|
+
};
|
|
437
|
+
const lines = [];
|
|
438
|
+
if (includeHeaders) lines.push(headers.map(escapeCSV).join(delimiter));
|
|
439
|
+
for (const record of flattenedRecords) {
|
|
440
|
+
const row = headers.map((header) => escapeCSV(record[header] || ""));
|
|
441
|
+
lines.push(row.join(delimiter));
|
|
442
|
+
}
|
|
443
|
+
return lines.join("\n");
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Parse a CSV string into an array of objects
|
|
447
|
+
*
|
|
448
|
+
* @param csv - CSV string to parse
|
|
449
|
+
* @param options - Parse options
|
|
450
|
+
* @returns Array of parsed objects
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* const csv = 'id,name\n1,John\n2,Jane';
|
|
455
|
+
* const data = parseCSV(csv);
|
|
456
|
+
* // [{ id: '1', name: 'John' }, { id: '2', name: 'Jane' }]
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
function parseCSV(csv, options = {}) {
|
|
460
|
+
const { delimiter = ",", hasHeaders = true } = options;
|
|
461
|
+
const lines = csv.split(/\r?\n/).filter((line) => line.trim());
|
|
462
|
+
if (lines.length === 0) return [];
|
|
463
|
+
const parseLine = (line) => {
|
|
464
|
+
const values = [];
|
|
465
|
+
let current = "";
|
|
466
|
+
let inQuotes = false;
|
|
467
|
+
let i = 0;
|
|
468
|
+
while (i < line.length) {
|
|
469
|
+
const char = line[i];
|
|
470
|
+
const nextChar = line[i + 1];
|
|
471
|
+
if (char === "\"" && inQuotes && nextChar === "\"") {
|
|
472
|
+
current += "\"";
|
|
473
|
+
i += 2;
|
|
474
|
+
} else if (char === "\"") {
|
|
475
|
+
inQuotes = !inQuotes;
|
|
476
|
+
i++;
|
|
477
|
+
} else if (char === delimiter && !inQuotes) {
|
|
478
|
+
values.push(current);
|
|
479
|
+
current = "";
|
|
480
|
+
i++;
|
|
481
|
+
} else {
|
|
482
|
+
current += char;
|
|
483
|
+
i++;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
values.push(current);
|
|
487
|
+
return values;
|
|
488
|
+
};
|
|
489
|
+
let headers;
|
|
490
|
+
let dataLines;
|
|
491
|
+
const firstLine = lines[0];
|
|
492
|
+
if (hasHeaders) {
|
|
493
|
+
headers = parseLine(firstLine);
|
|
494
|
+
dataLines = lines.slice(1);
|
|
495
|
+
} else {
|
|
496
|
+
headers = parseLine(firstLine).map((_, i) => `col${i}`);
|
|
497
|
+
dataLines = lines;
|
|
498
|
+
}
|
|
499
|
+
return dataLines.map((line) => {
|
|
500
|
+
const values = parseLine(line);
|
|
501
|
+
const obj = {};
|
|
502
|
+
headers.forEach((header, i) => {
|
|
503
|
+
obj[header] = values[i] || "";
|
|
504
|
+
});
|
|
505
|
+
return obj;
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Convert CSV to JSON string
|
|
510
|
+
*
|
|
511
|
+
* @param csv - CSV string
|
|
512
|
+
* @param options - Parse options
|
|
513
|
+
* @returns JSON string
|
|
514
|
+
*/
|
|
515
|
+
function csvToJSON(csv, options = {}) {
|
|
516
|
+
const { pretty = false, ...parseOptions } = options;
|
|
517
|
+
const data = parseCSV(csv, parseOptions);
|
|
518
|
+
return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Get CSV headers from data
|
|
522
|
+
*
|
|
523
|
+
* @param data - Array of objects
|
|
524
|
+
* @param flattenFields - Whether to flatten nested objects
|
|
525
|
+
* @returns Array of header strings
|
|
526
|
+
*/
|
|
527
|
+
function getCSVHeaders(data, flattenFields = true) {
|
|
528
|
+
if (data.length === 0) return [];
|
|
529
|
+
const collectKeys = (obj, prefix = "", depth = 0) => {
|
|
530
|
+
const keys = [];
|
|
531
|
+
if (obj === null || obj === void 0 || typeof obj !== "object") return prefix ? [prefix] : [];
|
|
532
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
533
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
534
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && flattenFields && depth < 3) keys.push(...collectKeys(value, fullKey, depth + 1));
|
|
535
|
+
else keys.push(fullKey);
|
|
536
|
+
}
|
|
537
|
+
return keys;
|
|
538
|
+
};
|
|
539
|
+
const allKeys = /* @__PURE__ */ new Set();
|
|
540
|
+
for (const item of data) for (const key of collectKeys(item)) allKeys.add(key);
|
|
541
|
+
return Array.from(allKeys).sort((a, b) => a.localeCompare(b));
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Estimate CSV file size for a dataset
|
|
545
|
+
*
|
|
546
|
+
* @param data - Array of objects
|
|
547
|
+
* @param sampleSize - Number of records to sample for estimation
|
|
548
|
+
* @returns Estimated size in bytes
|
|
549
|
+
*/
|
|
550
|
+
function estimateCSVSize(data, sampleSize = 100) {
|
|
551
|
+
if (data.length === 0) return 0;
|
|
552
|
+
const sample = data.slice(0, Math.min(sampleSize, data.length));
|
|
553
|
+
const averageRowSize = convertToCSV(sample).length / sample.length;
|
|
554
|
+
const headerSize = getCSVHeaders(data).join(",").length + 1;
|
|
555
|
+
return Math.ceil(headerSize + averageRowSize * data.length);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// src/export/gateway-client.ts
|
|
559
|
+
/**
|
|
560
|
+
* Export Gateway Helper
|
|
561
|
+
*
|
|
562
|
+
* Centralised wrapper around the workspace internal gateway's
|
|
563
|
+
* `createExportJob` mutation, used by per-svc convenience resolvers
|
|
564
|
+
* (e.g. `createTagsExportJob`, `createGroupsExportJob`).
|
|
565
|
+
*
|
|
566
|
+
* Replaces the duplicated `src/clients/export-gateway.ts` files that
|
|
567
|
+
* existed in 19+ workspace svcs.
|
|
568
|
+
*
|
|
569
|
+
* @module export/gateway-client
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```typescript
|
|
573
|
+
* import { triggerExportJob } from '@burdenoff/be-sdk/export';
|
|
574
|
+
*
|
|
575
|
+
* const result = await triggerExportJob({
|
|
576
|
+
* serviceName: 'wspace-tags-svc',
|
|
577
|
+
* workspaceId: ctx.workspaceId,
|
|
578
|
+
* name: input.name,
|
|
579
|
+
* entityTypes: ['tags', 'vocabularies'],
|
|
580
|
+
* format: input.format,
|
|
581
|
+
* actorId: ctx.actorId,
|
|
582
|
+
* actorType: ctx.actorType,
|
|
583
|
+
* });
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
const CREATE_EXPORT_JOB_MUTATION = `mutation CreateExportJob($input: CreateExportJobInput!) {
|
|
587
|
+
createExportJob(input: $input) {
|
|
588
|
+
id
|
|
589
|
+
status
|
|
590
|
+
workspaceId
|
|
591
|
+
entityTypes
|
|
592
|
+
format
|
|
593
|
+
createdAt
|
|
594
|
+
}
|
|
595
|
+
}`;
|
|
596
|
+
/**
|
|
597
|
+
* Submit a `createExportJob` mutation to the workspace internal gateway.
|
|
598
|
+
*
|
|
599
|
+
* The caller is expected to map the returned `ExportJobResult` to its
|
|
600
|
+
* own GraphQL output type (the per-svc `ExportJobResponse`).
|
|
601
|
+
*/
|
|
602
|
+
async function triggerExportJob(params) {
|
|
603
|
+
const { serviceName, layer = "wspace", actorId, actorType, workspaceId, name, entityTypes, format, includeMetadata, dateRangeStart, dateRangeEnd } = params;
|
|
604
|
+
const client = new GatewayClient({
|
|
605
|
+
layer,
|
|
606
|
+
serviceName
|
|
607
|
+
});
|
|
608
|
+
const input = {
|
|
609
|
+
name,
|
|
610
|
+
entityTypes,
|
|
611
|
+
format,
|
|
612
|
+
...includeMetadata !== void 0 ? { includeMetadata } : {},
|
|
613
|
+
...dateRangeStart !== void 0 ? { dateRangeStart } : {},
|
|
614
|
+
...dateRangeEnd !== void 0 ? { dateRangeEnd } : {}
|
|
615
|
+
};
|
|
616
|
+
const job = (await client.internalQuery({
|
|
617
|
+
query: CREATE_EXPORT_JOB_MUTATION,
|
|
618
|
+
variables: { input },
|
|
619
|
+
headers: {
|
|
620
|
+
"x-actor-id": actorId,
|
|
621
|
+
"x-actor-type": actorType,
|
|
622
|
+
"x-workspace-id": workspaceId
|
|
623
|
+
}
|
|
624
|
+
})).data?.createExportJob;
|
|
625
|
+
if (!job) throw new Error("Export service did not return a job");
|
|
626
|
+
return job;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// src/export/index.ts
|
|
630
|
+
var export_exports = /* @__PURE__ */ __exportAll({
|
|
631
|
+
BaseModuleExporter: () => BaseModuleExporter,
|
|
632
|
+
PaginationService: () => PaginationService,
|
|
633
|
+
convertToCSV: () => convertToCSV,
|
|
634
|
+
csvToJSON: () => csvToJSON,
|
|
635
|
+
estimateCSVSize: () => estimateCSVSize,
|
|
636
|
+
getCSVHeaders: () => getCSVHeaders,
|
|
637
|
+
parseCSV: () => parseCSV,
|
|
638
|
+
triggerExportJob: () => triggerExportJob
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
export { estimateCSVSize as a, PaginationService as c, csvToJSON as i, BaseModuleExporter as l, triggerExportJob as n, getCSVHeaders as o, convertToCSV as r, parseCSV as s, export_exports as t };
|
|
642
|
+
//# sourceMappingURL=export-B6fphx8a.js.map
|