@noy-db/hub 0.2.0-pre.15 → 0.2.0-pre.16
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/aggregate/index.cjs +106 -10
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +2 -2
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/aggregate/index.js +1 -1
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +3 -3
- package/dist/attestation/index.d.ts +3 -3
- package/dist/attestation/index.js +4 -4
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +4 -4
- package/dist/blobs/index.d.ts +4 -4
- package/dist/blobs/index.js +3 -3
- package/dist/bundle/index.cjs +181 -46
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +5 -5
- package/dist/bundle/index.d.ts +5 -5
- package/dist/bundle/index.js +7 -7
- package/dist/{chunk-BIYRQQV6.js → chunk-3YWP3WBP.js} +3 -3
- package/dist/{chunk-VU7SWWT5.js → chunk-42FEUPZQ.js} +10 -6
- package/dist/chunk-42FEUPZQ.js.map +1 -0
- package/dist/{chunk-7EFFHEN5.js → chunk-667MB6AH.js} +118 -47
- package/dist/chunk-667MB6AH.js.map +1 -0
- package/dist/{chunk-A5ZOOZFB.js → chunk-6H2ZUNR7.js} +2 -2
- package/dist/{chunk-7HT2MEZ5.js → chunk-7BQ4QWYX.js} +3 -3
- package/dist/{chunk-DQU36Q7I.js → chunk-7Z7KSVA5.js} +13 -4
- package/dist/chunk-7Z7KSVA5.js.map +1 -0
- package/dist/{chunk-WBAYSNUQ.js → chunk-BI6ETQPF.js} +2 -2
- package/dist/{chunk-56DJ7JVK.js → chunk-BR3AMFGS.js} +2 -2
- package/dist/{chunk-COFPAMX6.js → chunk-DLZ2ONOD.js} +3 -3
- package/dist/{chunk-EYVQHAGH.js → chunk-DUREQF5W.js} +2 -2
- package/dist/{chunk-PE4AQGFH.js → chunk-E2CDVKMH.js} +3 -3
- package/dist/{chunk-GC4V7RU7.js → chunk-F3BPIPLS.js} +1 -1
- package/dist/{chunk-GC4V7RU7.js.map → chunk-F3BPIPLS.js.map} +1 -1
- package/dist/{chunk-L2FE64BU.js → chunk-FFXM3ZIF.js} +2 -2
- package/dist/{chunk-5LQG6ZO2.js → chunk-G4SCICH5.js} +8 -3
- package/dist/chunk-G4SCICH5.js.map +1 -0
- package/dist/{chunk-WGHU7BLI.js → chunk-GNI5STXQ.js} +2 -2
- package/dist/{chunk-C5T5AFWN.js → chunk-HBXJ37ZY.js} +11 -5
- package/dist/chunk-HBXJ37ZY.js.map +1 -0
- package/dist/{chunk-7PS7EOCF.js → chunk-IXBIFDEW.js} +2 -2
- package/dist/{chunk-LX3CB26H.js → chunk-KABJXG2F.js} +2 -2
- package/dist/{chunk-3EWXMOK3.js → chunk-L2BNJ6HM.js} +26 -11
- package/dist/chunk-L2BNJ6HM.js.map +1 -0
- package/dist/{chunk-DKO2QFSA.js → chunk-OB2ZJQ2D.js} +2 -2
- package/dist/{chunk-KIP6JLTF.js → chunk-OMAMZKKD.js} +2 -2
- package/dist/{chunk-EGD5DXFT.js → chunk-OQSRJG6A.js} +13 -1
- package/dist/chunk-OQSRJG6A.js.map +1 -0
- package/dist/{chunk-KI6HAJWL.js → chunk-QSUK7YWK.js} +2 -2
- package/dist/{chunk-YHPM5D7Y.js → chunk-QVIEAYTP.js} +61 -2
- package/dist/chunk-QVIEAYTP.js.map +1 -0
- package/dist/{chunk-NSCVNK5K.js → chunk-SCJPI4Z5.js} +3 -3
- package/dist/{chunk-NU6Q3FOR.js → chunk-TKIY625R.js} +11 -1
- package/dist/{chunk-NU6Q3FOR.js.map → chunk-TKIY625R.js.map} +1 -1
- package/dist/{chunk-OHVFWCJP.js → chunk-VLMPU56Q.js} +48 -18
- package/dist/chunk-VLMPU56Q.js.map +1 -0
- package/dist/{chunk-6AJBSQU4.js → chunk-XL35NSEN.js} +2 -2
- package/dist/consent/index.d.cts +4 -4
- package/dist/consent/index.d.ts +4 -4
- package/dist/derivations/index.cjs +24 -3
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +5 -5
- package/dist/derivations/index.d.ts +5 -5
- package/dist/derivations/index.js +2 -2
- package/dist/{dev-unlock-nVkuRLLe.d.cts → dev-unlock-8XzcD2Z4.d.cts} +1 -1
- package/dist/{dev-unlock-iAS8z9jc.d.ts → dev-unlock-DR3upLd1.d.ts} +1 -1
- package/dist/{executor-HSSRXDOB.js → executor-AZLS3KBK.js} +4 -4
- package/dist/{fanout-sidecar-N6OJX6QR.js → fanout-sidecar-67CMI3UT.js} +2 -2
- package/dist/guards/index.cjs +9 -5
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +5 -5
- package/dist/guards/index.d.ts +5 -5
- package/dist/guards/index.js +1 -1
- package/dist/{hash-DHOnRarj.d.ts → hash-CDjye9KV.d.ts} +1 -1
- package/dist/{hash-Cv6byZs7.d.cts → hash-DuQ88_5W.d.cts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +5 -5
- package/dist/history/index.d.ts +5 -5
- package/dist/history/index.js +2 -2
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +4 -4
- package/dist/i18n/index.d.ts +4 -4
- package/dist/i18n/index.js +3 -3
- package/dist/{immutable-guard-yBEOYmif.d.cts → immutable-guard-CRPvu24K.d.cts} +16 -1
- package/dist/{immutable-guard-BehB1YGB.d.ts → immutable-guard-Dov3WvwF.d.ts} +16 -1
- package/dist/{index-D95VK1Qy.d.cts → index-C8Bk3-VF.d.cts} +1 -1
- package/dist/{index-XNB2r6bX.d.ts → index-nP99bXLg.d.ts} +1 -1
- package/dist/index.cjs +273 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -12
- package/dist/index.d.ts +13 -12
- package/dist/index.js +27 -25
- package/dist/index.js.map +1 -1
- package/dist/{issue-ADVS4OVP.js → issue-RZP3VI6O.js} +4 -4
- package/dist/{ledger-CWSE3BLF.js → ledger-A3LL253R.js} +3 -3
- package/dist/materialized-views/index.cjs +407 -5
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +5 -5
- package/dist/materialized-views/index.d.ts +5 -5
- package/dist/materialized-views/index.js +5 -5
- package/dist/noydb-WCMY2ZOW.js +35 -0
- package/dist/overlay-views/index.cjs +47 -17
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +26 -8
- package/dist/overlay-views/index.d.ts +26 -8
- package/dist/overlay-views/index.js +1 -1
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +4 -4
- package/dist/periods/index.d.ts +4 -4
- package/dist/periods/index.js +3 -3
- package/dist/{public-envelope-SYHEYQ3X.js → public-envelope-YP2UWMLG.js} +3 -3
- package/dist/query/index.cjs +24 -10
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +2 -2
- package/dist/{registry-XGLNADIE.js → registry-EB6SISTA.js} +2 -2
- package/dist/{registry-DK5YWAAA.js → registry-UTA4CLQS.js} +2 -2
- package/dist/{revoke-ZDFKMR5E.js → revoke-HNMQZSCL.js} +4 -4
- package/dist/session/index.d.cts +5 -5
- package/dist/session/index.d.ts +5 -5
- package/dist/shadow/index.d.cts +4 -4
- package/dist/shadow/index.d.ts +4 -4
- package/dist/{signer-P5D7Y72U.js → signer-DCMNKXSF.js} +3 -3
- package/dist/snapshots/index.d.cts +4 -4
- package/dist/snapshots/index.d.ts +4 -4
- package/dist/snapshots/index.js +3 -3
- package/dist/{stale-JH67FU57.js → stale-W5PQTRYH.js} +2 -2
- package/dist/store/index.d.cts +4 -4
- package/dist/store/index.d.ts +4 -4
- package/dist/{strategy-CbneC7bS.d.ts → strategy-BtW8fAjz.d.cts} +1 -1
- package/dist/{strategy-CbneC7bS.d.cts → strategy-BtW8fAjz.d.ts} +1 -1
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +3 -3
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.js +2 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +4 -4
- package/dist/team/index.d.ts +4 -4
- package/dist/team/index.js +5 -5
- package/dist/tx/index.cjs +66 -3
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +22 -6
- package/dist/tx/index.d.ts +22 -6
- package/dist/tx/index.js +7 -3
- package/dist/tx/index.js.map +1 -1
- package/dist/{types-BpPV5uyy.d.cts → types-Bze6vkwm.d.cts} +371 -139
- package/dist/{types-4t1-tWS4.d.ts → types-DrmBTscX.d.ts} +371 -139
- package/dist/{ulid-DAfenvFd.d.ts → ulid-DbBVrNSt.d.ts} +1 -1
- package/dist/{ulid-CiPrpGqm.d.cts → ulid-DfZlAh0u.d.cts} +1 -1
- package/dist/{vault-group-KOM7QRJG.js → vault-group-DX2HFQMX.js} +2 -2
- package/dist/{with-derivation-DBqJB3dQ.d.cts → with-derivation-CCqAchD5.d.cts} +1 -1
- package/dist/{with-derivation-OK9M2sJE.d.ts → with-derivation-_lySGdlm.d.ts} +1 -1
- package/dist/{with-materialized-view-NzuxYPDF.d.cts → with-materialized-view--4PsvMDu.d.cts} +1 -1
- package/dist/{with-materialized-view-Dt-ufPWQ.d.ts → with-materialized-view-QT1Tp7NO.d.ts} +1 -1
- package/dist/{with-overlayed-view-eDvMs6LO.d.ts → with-overlayed-view-BEXfpzSb.d.ts} +1 -1
- package/dist/{with-overlayed-view-CC0_ocy-.d.cts → with-overlayed-view-DlH5qmeB.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-3EWXMOK3.js.map +0 -1
- package/dist/chunk-5LQG6ZO2.js.map +0 -1
- package/dist/chunk-7EFFHEN5.js.map +0 -1
- package/dist/chunk-C5T5AFWN.js.map +0 -1
- package/dist/chunk-DQU36Q7I.js.map +0 -1
- package/dist/chunk-EGD5DXFT.js.map +0 -1
- package/dist/chunk-OHVFWCJP.js.map +0 -1
- package/dist/chunk-VU7SWWT5.js.map +0 -1
- package/dist/chunk-YHPM5D7Y.js.map +0 -1
- package/dist/noydb-GZGFBA4E.js +0 -35
- /package/dist/{chunk-BIYRQQV6.js.map → chunk-3YWP3WBP.js.map} +0 -0
- /package/dist/{chunk-A5ZOOZFB.js.map → chunk-6H2ZUNR7.js.map} +0 -0
- /package/dist/{chunk-7HT2MEZ5.js.map → chunk-7BQ4QWYX.js.map} +0 -0
- /package/dist/{chunk-WBAYSNUQ.js.map → chunk-BI6ETQPF.js.map} +0 -0
- /package/dist/{chunk-56DJ7JVK.js.map → chunk-BR3AMFGS.js.map} +0 -0
- /package/dist/{chunk-COFPAMX6.js.map → chunk-DLZ2ONOD.js.map} +0 -0
- /package/dist/{chunk-EYVQHAGH.js.map → chunk-DUREQF5W.js.map} +0 -0
- /package/dist/{chunk-PE4AQGFH.js.map → chunk-E2CDVKMH.js.map} +0 -0
- /package/dist/{chunk-L2FE64BU.js.map → chunk-FFXM3ZIF.js.map} +0 -0
- /package/dist/{chunk-WGHU7BLI.js.map → chunk-GNI5STXQ.js.map} +0 -0
- /package/dist/{chunk-7PS7EOCF.js.map → chunk-IXBIFDEW.js.map} +0 -0
- /package/dist/{chunk-LX3CB26H.js.map → chunk-KABJXG2F.js.map} +0 -0
- /package/dist/{chunk-DKO2QFSA.js.map → chunk-OB2ZJQ2D.js.map} +0 -0
- /package/dist/{chunk-KIP6JLTF.js.map → chunk-OMAMZKKD.js.map} +0 -0
- /package/dist/{chunk-KI6HAJWL.js.map → chunk-QSUK7YWK.js.map} +0 -0
- /package/dist/{chunk-NSCVNK5K.js.map → chunk-SCJPI4Z5.js.map} +0 -0
- /package/dist/{chunk-6AJBSQU4.js.map → chunk-XL35NSEN.js.map} +0 -0
- /package/dist/{executor-HSSRXDOB.js.map → executor-AZLS3KBK.js.map} +0 -0
- /package/dist/{fanout-sidecar-N6OJX6QR.js.map → fanout-sidecar-67CMI3UT.js.map} +0 -0
- /package/dist/{issue-ADVS4OVP.js.map → issue-RZP3VI6O.js.map} +0 -0
- /package/dist/{ledger-CWSE3BLF.js.map → ledger-A3LL253R.js.map} +0 -0
- /package/dist/{noydb-GZGFBA4E.js.map → noydb-WCMY2ZOW.js.map} +0 -0
- /package/dist/{public-envelope-SYHEYQ3X.js.map → public-envelope-YP2UWMLG.js.map} +0 -0
- /package/dist/{registry-DK5YWAAA.js.map → registry-EB6SISTA.js.map} +0 -0
- /package/dist/{registry-XGLNADIE.js.map → registry-UTA4CLQS.js.map} +0 -0
- /package/dist/{revoke-ZDFKMR5E.js.map → revoke-HNMQZSCL.js.map} +0 -0
- /package/dist/{signer-P5D7Y72U.js.map → signer-DCMNKXSF.js.map} +0 -0
- /package/dist/{stale-JH67FU57.js.map → stale-W5PQTRYH.js.map} +0 -0
- /package/dist/{vault-group-KOM7QRJG.js.map → vault-group-DX2HFQMX.js.map} +0 -0
package/dist/blobs/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { B as BlobStrategy } from '../types-
|
|
2
|
-
export { z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, C as BLOB_EVICTION_AUDIT_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, H as BlobEvictionEntry, J as BlobFieldPolicy, K as BlobFieldsConfig, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, U as BlobStrategyOpenArgs, V as CompactRunOptions, W as CompactionContext, X as CompactionResult, Y as DEFAULT_CHUNK_SIZE, Z as EXPORT_AUDIT_COLLECTION, _ as ExportBlobsAbortedError, $ as ExportBlobsAuditEntry, a0 as ExportBlobsHandle, a1 as ExportBlobsOptions, a2 as ExportedBlob, a3 as SlotInfo, a4 as SlotRecord, a5 as VersionRecord, a6 as createExportBlobsHandle, a7 as runCompaction } from '../types-
|
|
1
|
+
import { B as BlobStrategy } from '../types-Bze6vkwm.cjs';
|
|
2
|
+
export { z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, C as BLOB_EVICTION_AUDIT_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, H as BlobEvictionEntry, J as BlobFieldPolicy, K as BlobFieldsConfig, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, U as BlobStrategyOpenArgs, V as CompactRunOptions, W as CompactionContext, X as CompactionResult, Y as DEFAULT_CHUNK_SIZE, Z as EXPORT_AUDIT_COLLECTION, _ as ExportBlobsAbortedError, $ as ExportBlobsAuditEntry, a0 as ExportBlobsHandle, a1 as ExportBlobsOptions, a2 as ExportedBlob, a3 as SlotInfo, a4 as SlotRecord, a5 as VersionRecord, a6 as createExportBlobsHandle, a7 as runCompaction } from '../types-Bze6vkwm.cjs';
|
|
3
3
|
export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from '../mime-magic-CBBSOkjm.cjs';
|
|
4
4
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
5
5
|
import '../predicate-BmhBSPCH.cjs';
|
|
6
|
-
import '../strategy-
|
|
6
|
+
import '../strategy-BtW8fAjz.cjs';
|
|
7
7
|
import '../strategy-BSxFXGzb.cjs';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-C8Bk3-VF.cjs';
|
|
9
9
|
import '@noy-db/attestation';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/blobs/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { B as BlobStrategy } from '../types-
|
|
2
|
-
export { z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, C as BLOB_EVICTION_AUDIT_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, H as BlobEvictionEntry, J as BlobFieldPolicy, K as BlobFieldsConfig, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, U as BlobStrategyOpenArgs, V as CompactRunOptions, W as CompactionContext, X as CompactionResult, Y as DEFAULT_CHUNK_SIZE, Z as EXPORT_AUDIT_COLLECTION, _ as ExportBlobsAbortedError, $ as ExportBlobsAuditEntry, a0 as ExportBlobsHandle, a1 as ExportBlobsOptions, a2 as ExportedBlob, a3 as SlotInfo, a4 as SlotRecord, a5 as VersionRecord, a6 as createExportBlobsHandle, a7 as runCompaction } from '../types-
|
|
1
|
+
import { B as BlobStrategy } from '../types-DrmBTscX.js';
|
|
2
|
+
export { z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, C as BLOB_EVICTION_AUDIT_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, H as BlobEvictionEntry, J as BlobFieldPolicy, K as BlobFieldsConfig, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, U as BlobStrategyOpenArgs, V as CompactRunOptions, W as CompactionContext, X as CompactionResult, Y as DEFAULT_CHUNK_SIZE, Z as EXPORT_AUDIT_COLLECTION, _ as ExportBlobsAbortedError, $ as ExportBlobsAuditEntry, a0 as ExportBlobsHandle, a1 as ExportBlobsOptions, a2 as ExportedBlob, a3 as SlotInfo, a4 as SlotRecord, a5 as VersionRecord, a6 as createExportBlobsHandle, a7 as runCompaction } from '../types-DrmBTscX.js';
|
|
3
3
|
export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from '../mime-magic-CBBSOkjm.js';
|
|
4
4
|
import '../lazy-builder-ChSqcF5t.js';
|
|
5
5
|
import '../predicate-BmhBSPCH.js';
|
|
6
|
-
import '../strategy-
|
|
6
|
+
import '../strategy-BtW8fAjz.js';
|
|
7
7
|
import '../strategy-BSxFXGzb.js';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-nP99bXLg.js';
|
|
9
9
|
import '@noy-db/attestation';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/blobs/index.js
CHANGED
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
detectMagic,
|
|
10
10
|
detectMimeType,
|
|
11
11
|
isPreCompressed
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-KABJXG2F.js";
|
|
13
13
|
import {
|
|
14
14
|
BLOB_EVICTION_AUDIT_COLLECTION,
|
|
15
15
|
EXPORT_AUDIT_COLLECTION,
|
|
16
16
|
ExportBlobsAbortedError,
|
|
17
17
|
createExportBlobsHandle,
|
|
18
18
|
runCompaction
|
|
19
|
-
} from "../chunk-
|
|
20
|
-
import "../chunk-
|
|
19
|
+
} from "../chunk-XL35NSEN.js";
|
|
20
|
+
import "../chunk-F3BPIPLS.js";
|
|
21
21
|
import "../chunk-YULZKK4F.js";
|
|
22
22
|
import "../chunk-535SSHBS.js";
|
|
23
23
|
|
package/dist/bundle/index.cjs
CHANGED
|
@@ -4834,13 +4834,22 @@ var init_strategy4 = __esm({
|
|
|
4834
4834
|
});
|
|
4835
4835
|
|
|
4836
4836
|
// src/money/money-reducer.ts
|
|
4837
|
-
function
|
|
4838
|
-
if (typeof v === "
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4837
|
+
function toScaledIntFromAny(v, scale) {
|
|
4838
|
+
if (typeof v === "bigint") return v;
|
|
4839
|
+
if (typeof v === "number") {
|
|
4840
|
+
const r = parseToScaledInt(v, scale);
|
|
4841
|
+
return r.ok ? r.value : null;
|
|
4842
|
+
}
|
|
4843
|
+
if (typeof v === "string") {
|
|
4844
|
+
if (!v.includes(".")) {
|
|
4845
|
+
try {
|
|
4846
|
+
return BigInt(v);
|
|
4847
|
+
} catch {
|
|
4848
|
+
return null;
|
|
4849
|
+
}
|
|
4843
4850
|
}
|
|
4851
|
+
const r = parseToScaledInt(v, scale);
|
|
4852
|
+
return r.ok ? r.value : null;
|
|
4844
4853
|
}
|
|
4845
4854
|
return null;
|
|
4846
4855
|
}
|
|
@@ -4848,13 +4857,15 @@ function readMoney(record, field, desc) {
|
|
|
4848
4857
|
const raw = readPath(record, field);
|
|
4849
4858
|
if (raw === null || raw === void 0) return null;
|
|
4850
4859
|
if (desc.mode === "fixed") {
|
|
4851
|
-
const
|
|
4852
|
-
|
|
4860
|
+
const cur = desc.fixedCurrency;
|
|
4861
|
+
const value2 = toScaledIntFromAny(raw, desc.scaleFor(cur));
|
|
4862
|
+
return value2 === null ? null : { currency: cur, value: value2 };
|
|
4853
4863
|
}
|
|
4854
4864
|
if (typeof raw !== "object") return null;
|
|
4855
4865
|
const o = raw;
|
|
4856
4866
|
if (typeof o.currency !== "string") return null;
|
|
4857
|
-
const
|
|
4867
|
+
const scale = desc.allows(o.currency) ? desc.scaleFor(o.currency) : 0;
|
|
4868
|
+
const value = toScaledIntFromAny(o.amount, scale);
|
|
4858
4869
|
return value === null ? null : { currency: o.currency, value };
|
|
4859
4870
|
}
|
|
4860
4871
|
function targetScaleFor(desc, currency) {
|
|
@@ -6005,11 +6016,14 @@ function warnCardinalityApproaching(fields, observed) {
|
|
|
6005
6016
|
`[noy-db] .groupBy(${label}) produced ${observed} distinct groups, ${Math.round(observed / GROUPBY_MAX_CARDINALITY * 100)}% of the ${GROUPBY_MAX_CARDINALITY}-group ceiling. Narrow the query with .where() before grouping, or switch to a lower-cardinality field.`
|
|
6006
6017
|
);
|
|
6007
6018
|
}
|
|
6008
|
-
function groupAndReduce(records, fieldOrFields, spec) {
|
|
6019
|
+
function groupAndReduce(records, fieldOrFields, spec, moneyFields) {
|
|
6009
6020
|
const fields = typeof fieldOrFields === "string" ? [fieldOrFields] : fieldOrFields;
|
|
6010
6021
|
if (fields.length === 0) {
|
|
6011
6022
|
throw new Error(".groupBy() requires at least one field");
|
|
6012
6023
|
}
|
|
6024
|
+
if (moneyFields) {
|
|
6025
|
+
spec = wrapMoneyReducers(spec, moneyFields);
|
|
6026
|
+
}
|
|
6013
6027
|
const buckets = /* @__PURE__ */ new Map();
|
|
6014
6028
|
const fieldLabel = fields.length === 1 ? fields[0] : `[${fields.join(", ")}]`;
|
|
6015
6029
|
for (const record of records) {
|
|
@@ -6065,6 +6079,7 @@ var init_groupby = __esm({
|
|
|
6065
6079
|
init_predicate();
|
|
6066
6080
|
init_canonical_key();
|
|
6067
6081
|
init_errors();
|
|
6082
|
+
init_money_reducer();
|
|
6068
6083
|
GROUPBY_WARN_CARDINALITY = 1e4;
|
|
6069
6084
|
GROUPBY_MAX_CARDINALITY = 1e5;
|
|
6070
6085
|
warnedCardinalityFields = /* @__PURE__ */ new Set();
|
|
@@ -7466,10 +7481,14 @@ function summarizeQueryPlan(query) {
|
|
|
7466
7481
|
});
|
|
7467
7482
|
}
|
|
7468
7483
|
function summarizeUnionPlan(spec) {
|
|
7469
|
-
const arms = (spec.unionSources ?? []).map((s) =>
|
|
7484
|
+
const arms = (spec.unionSources ?? []).map((s) => {
|
|
7485
|
+
const joins = s.join?.length ? `[${s.join.map((j) => `${j.field}\u2192${j.as}`).join(";")}]` : "";
|
|
7486
|
+
return `${s.collection}${joins}`;
|
|
7487
|
+
}).join(",");
|
|
7470
7488
|
const groupBy = Array.isArray(spec.groupBy) ? [...spec.groupBy].sort().join(",") : typeof spec.groupBy === "string" ? spec.groupBy : "";
|
|
7471
7489
|
const aggKeys = spec.aggregate ? Object.keys(spec.aggregate).sort().join(",") : "";
|
|
7472
|
-
|
|
7490
|
+
const moneyKeys = spec.moneyFields ? Object.keys(spec.moneyFields).sort().join(",") : "";
|
|
7491
|
+
return `union(${arms})|groupBy(${groupBy})|aggregate(${aggKeys})|money(${moneyKeys})`;
|
|
7473
7492
|
}
|
|
7474
7493
|
var init_dependency_analyzer = __esm({
|
|
7475
7494
|
"src/materialized-views/dependency-analyzer.ts"() {
|
|
@@ -7596,6 +7615,7 @@ var init_registry = __esm({
|
|
|
7596
7615
|
let isQuery = false;
|
|
7597
7616
|
if (spec.unionSources) {
|
|
7598
7617
|
dependencies = new Set(spec.unionSources.map((s) => s.collection));
|
|
7618
|
+
if (spec.sources) for (const s of spec.sources) dependencies.add(s);
|
|
7599
7619
|
queryPlanSummary = summarizeUnionPlan(spec);
|
|
7600
7620
|
} else {
|
|
7601
7621
|
const q = spec.query(dbForQuery);
|
|
@@ -7750,7 +7770,13 @@ async function materializeUnionResult(spec, db) {
|
|
|
7750
7770
|
const unified = [];
|
|
7751
7771
|
for (const arm of spec.unionSources) {
|
|
7752
7772
|
const coll = db.collection(arm.collection);
|
|
7753
|
-
|
|
7773
|
+
let q = coll.query();
|
|
7774
|
+
if (arm.join?.length) {
|
|
7775
|
+
for (const leg of arm.join) {
|
|
7776
|
+
q = q.join(leg.field, { as: leg.as, maxRows: leg.maxRows, strategy: leg.strategy });
|
|
7777
|
+
}
|
|
7778
|
+
}
|
|
7779
|
+
const sourceRows = q.toArray();
|
|
7754
7780
|
for (const r of sourceRows) {
|
|
7755
7781
|
const mapped = arm.map(r);
|
|
7756
7782
|
if (mapped == null) continue;
|
|
@@ -7767,7 +7793,7 @@ async function materializeUnionResult(spec, db) {
|
|
|
7767
7793
|
}
|
|
7768
7794
|
return [...seen.values()];
|
|
7769
7795
|
}
|
|
7770
|
-
return groupAndReduce(unified, groupFields, spec.aggregate);
|
|
7796
|
+
return groupAndReduce(unified, groupFields, spec.aggregate, spec.moneyFields);
|
|
7771
7797
|
}
|
|
7772
7798
|
async function listOutputIds(outputColl) {
|
|
7773
7799
|
const cAny = outputColl;
|
|
@@ -8963,9 +8989,18 @@ var init_collection = __esm({
|
|
|
8963
8989
|
if (DerivationExecutor2 === null) {
|
|
8964
8990
|
({ DerivationExecutor: DerivationExecutor2 } = await Promise.resolve().then(() => (init_executor(), executor_exports)));
|
|
8965
8991
|
}
|
|
8966
|
-
|
|
8992
|
+
let sourceWithId;
|
|
8993
|
+
let sourceVersion = version;
|
|
8994
|
+
if (spec.source === this.name) {
|
|
8995
|
+
sourceWithId = { ...incoming, id };
|
|
8996
|
+
} else {
|
|
8997
|
+
const primary = await this.derivationSource.getCollection(spec.source).get(id);
|
|
8998
|
+
if (primary === null || primary === void 0) continue;
|
|
8999
|
+
sourceWithId = { ...primary, id };
|
|
9000
|
+
sourceVersion = 0;
|
|
9001
|
+
}
|
|
8967
9002
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
8968
|
-
const result = await DerivationExecutor2.run(spec, sourceWithId,
|
|
9003
|
+
const result = await DerivationExecutor2.run(spec, sourceWithId, sourceVersion, strategyHash, ctx);
|
|
8969
9004
|
for (const key of Object.keys(spec.outputs)) {
|
|
8970
9005
|
const out = result.outputs[key];
|
|
8971
9006
|
if (!out) continue;
|
|
@@ -10917,37 +10952,34 @@ var init_virtual_collection = __esm({
|
|
|
10917
10952
|
/** Get the merged row by id. */
|
|
10918
10953
|
async get(id) {
|
|
10919
10954
|
const overlayRow = await this.overlayCollection.get(id);
|
|
10920
|
-
if (overlayRow !== null && this.shadowPredicateApplies(overlayRow)) {
|
|
10921
|
-
return overlayRow;
|
|
10922
|
-
}
|
|
10923
10955
|
const baseRow = await this.baseCollection.get(id);
|
|
10924
|
-
|
|
10925
|
-
return null;
|
|
10956
|
+
return this.mergeRows(overlayRow, baseRow);
|
|
10926
10957
|
}
|
|
10927
10958
|
/** List union of base + overlay ids, applying the merge per row. */
|
|
10928
10959
|
async list() {
|
|
10929
10960
|
const baseRows = await this.baseCollection.list();
|
|
10930
10961
|
const overlayRows = await this.overlayCollection.list();
|
|
10931
|
-
const merged = /* @__PURE__ */ new Map();
|
|
10932
10962
|
const idOf = (row) => {
|
|
10933
10963
|
if (this.baseRowKey) return this.baseRowKey(row);
|
|
10934
10964
|
const idField = row.id;
|
|
10935
10965
|
return typeof idField === "string" ? idField : "";
|
|
10936
10966
|
};
|
|
10967
|
+
const baseById = /* @__PURE__ */ new Map();
|
|
10968
|
+
const overlayById = /* @__PURE__ */ new Map();
|
|
10937
10969
|
for (const row of baseRows) {
|
|
10938
10970
|
const id = idOf(row);
|
|
10939
|
-
if (id)
|
|
10971
|
+
if (id) baseById.set(id, row);
|
|
10940
10972
|
}
|
|
10941
10973
|
for (const row of overlayRows) {
|
|
10942
10974
|
const id = idOf(row);
|
|
10943
|
-
if (
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10975
|
+
if (id) overlayById.set(id, row);
|
|
10976
|
+
}
|
|
10977
|
+
const out = [];
|
|
10978
|
+
for (const id of /* @__PURE__ */ new Set([...baseById.keys(), ...overlayById.keys()])) {
|
|
10979
|
+
const merged = this.mergeRows(overlayById.get(id) ?? null, baseById.get(id) ?? null);
|
|
10980
|
+
if (merged !== null) out.push(merged);
|
|
10949
10981
|
}
|
|
10950
|
-
return
|
|
10982
|
+
return out;
|
|
10951
10983
|
}
|
|
10952
10984
|
/**
|
|
10953
10985
|
* Write to the overlay. Two forms:
|
|
@@ -10987,9 +11019,42 @@ var init_virtual_collection = __esm({
|
|
|
10987
11019
|
async delete(id) {
|
|
10988
11020
|
await this.overlayCollection.delete(id);
|
|
10989
11021
|
}
|
|
10990
|
-
/**
|
|
10991
|
-
|
|
10992
|
-
|
|
11022
|
+
/**
|
|
11023
|
+
* Merge a single id's overlay + base rows into the visible row.
|
|
11024
|
+
*
|
|
11025
|
+
* Priority (first match wins):
|
|
11026
|
+
* 1. Binary shadow win — overlay present AND
|
|
11027
|
+
* `overlay[shadowField] === shadowValue` → return the overlay row
|
|
11028
|
+
* entirely. This stays FIRST so the original binary behaviour is
|
|
11029
|
+
* unchanged whether or not `mergeMode` is configured.
|
|
11030
|
+
* 2. Field-level merge — overlay present, `mergeMode` configured,
|
|
11031
|
+
* and a rule whose `whenStatus` equals `overlay[shadowField]`.
|
|
11032
|
+
* The matched rule pulls its `overlayFields` (those present on
|
|
11033
|
+
* the overlay row) on top of the base row. With no base row, the
|
|
11034
|
+
* overlay row is returned as-is.
|
|
11035
|
+
* 3. Fallback — return the base row (possibly `null`). An
|
|
11036
|
+
* overlay-only row that qualifies under neither (1) nor (2) and
|
|
11037
|
+
* has no base is therefore NOT surfaced.
|
|
11038
|
+
*/
|
|
11039
|
+
mergeRows(overlayRow, baseRow) {
|
|
11040
|
+
const shadowField = this.spec.shadowField;
|
|
11041
|
+
if (overlayRow !== null && overlayRow[shadowField] === this.spec.shadowValue) {
|
|
11042
|
+
return overlayRow;
|
|
11043
|
+
}
|
|
11044
|
+
if (overlayRow !== null && this.spec.mergeMode) {
|
|
11045
|
+
const status = overlayRow[shadowField];
|
|
11046
|
+
const rule = this.spec.mergeMode.rules.find((r) => r.whenStatus === status);
|
|
11047
|
+
if (rule) {
|
|
11048
|
+
if (baseRow === null) return overlayRow;
|
|
11049
|
+
const overlaySrc = overlayRow;
|
|
11050
|
+
const picked = {};
|
|
11051
|
+
for (const field of rule.overlayFields) {
|
|
11052
|
+
if (field in overlaySrc) picked[field] = overlaySrc[field];
|
|
11053
|
+
}
|
|
11054
|
+
return { ...baseRow, ...picked };
|
|
11055
|
+
}
|
|
11056
|
+
}
|
|
11057
|
+
return baseRow;
|
|
10993
11058
|
}
|
|
10994
11059
|
// ─── Throw-stubs for the unimplemented Collection<T> surface ───────
|
|
10995
11060
|
//
|
|
@@ -11139,6 +11204,21 @@ var init_archive = __esm({
|
|
|
11139
11204
|
});
|
|
11140
11205
|
|
|
11141
11206
|
// src/sequence/index.ts
|
|
11207
|
+
function resolveSequenceKey(series, opts) {
|
|
11208
|
+
const partition = opts?.partition;
|
|
11209
|
+
if (!partition || partition.length === 0) return series;
|
|
11210
|
+
const parts = partition.map((p) => {
|
|
11211
|
+
if (typeof p === "number" && !Number.isFinite(p)) {
|
|
11212
|
+
throw new ValidationError(`sequence partition component must be a finite number, got ${p}`);
|
|
11213
|
+
}
|
|
11214
|
+
const s = String(p);
|
|
11215
|
+
if (s === "") {
|
|
11216
|
+
throw new ValidationError("sequence partition component must not be empty");
|
|
11217
|
+
}
|
|
11218
|
+
return encodeURIComponent(s);
|
|
11219
|
+
});
|
|
11220
|
+
return `${series}\0${parts.join("/")}`;
|
|
11221
|
+
}
|
|
11142
11222
|
async function sleepBackoff2(attempt) {
|
|
11143
11223
|
const ceil = Math.min(2 ** attempt, 32);
|
|
11144
11224
|
const ms = Math.floor(Math.random() * ceil);
|
|
@@ -11178,7 +11258,8 @@ var init_sequence = __esm({
|
|
|
11178
11258
|
handle(name) {
|
|
11179
11259
|
return {
|
|
11180
11260
|
next: () => this.next(name),
|
|
11181
|
-
peek: () => this.peek(name)
|
|
11261
|
+
peek: () => this.peek(name),
|
|
11262
|
+
seedTo: (n) => this.seedTo(name, n)
|
|
11182
11263
|
};
|
|
11183
11264
|
}
|
|
11184
11265
|
assertOnline() {
|
|
@@ -11231,6 +11312,30 @@ var init_sequence = __esm({
|
|
|
11231
11312
|
void lastConflict;
|
|
11232
11313
|
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
11233
11314
|
}
|
|
11315
|
+
async seedTo(name, n) {
|
|
11316
|
+
this.assertOnline();
|
|
11317
|
+
if (n <= 0) return;
|
|
11318
|
+
let lastConflict;
|
|
11319
|
+
for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {
|
|
11320
|
+
const { env, value } = await this.read(name);
|
|
11321
|
+
if (value >= n) return;
|
|
11322
|
+
const expectedVersion = env?._v ?? 0;
|
|
11323
|
+
const envelope = await this.encryptState({ value: n }, expectedVersion + 1);
|
|
11324
|
+
try {
|
|
11325
|
+
await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion);
|
|
11326
|
+
return;
|
|
11327
|
+
} catch (err) {
|
|
11328
|
+
if (err instanceof ConflictError) {
|
|
11329
|
+
lastConflict = err;
|
|
11330
|
+
if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff2(attempt);
|
|
11331
|
+
continue;
|
|
11332
|
+
}
|
|
11333
|
+
throw err;
|
|
11334
|
+
}
|
|
11335
|
+
}
|
|
11336
|
+
void lastConflict;
|
|
11337
|
+
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
11338
|
+
}
|
|
11234
11339
|
};
|
|
11235
11340
|
}
|
|
11236
11341
|
});
|
|
@@ -13245,11 +13350,15 @@ var init_read_only_facade = __esm({
|
|
|
13245
13350
|
});
|
|
13246
13351
|
|
|
13247
13352
|
// src/derivations/strategy-hash.ts
|
|
13248
|
-
async function computeStrategyHash(source, outputKeys, derive) {
|
|
13353
|
+
async function computeStrategyHash(source, outputKeys, derive, sources) {
|
|
13249
13354
|
const canonical2 = JSON.stringify({
|
|
13250
13355
|
source,
|
|
13251
13356
|
outputs: [...outputKeys].sort(),
|
|
13252
|
-
derive: derive.toString()
|
|
13357
|
+
derive: derive.toString(),
|
|
13358
|
+
// Declared sibling sources (#344) — adding/removing a trigger
|
|
13359
|
+
// collection invalidates cached derived records. Omitted when empty
|
|
13360
|
+
// so strategies without siblings keep their existing hash.
|
|
13361
|
+
...sources?.length ? { sources: [...sources].sort() } : {}
|
|
13253
13362
|
});
|
|
13254
13363
|
const bytes = new TextEncoder().encode(canonical2);
|
|
13255
13364
|
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
@@ -13278,11 +13387,16 @@ var init_registry3 = __esm({
|
|
|
13278
13387
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13279
13388
|
async register(spec) {
|
|
13280
13389
|
const outputKeys = Object.keys(spec.outputs);
|
|
13281
|
-
const strategyHash = await computeStrategyHash(spec.source, outputKeys, spec.derive);
|
|
13390
|
+
const strategyHash = await computeStrategyHash(spec.source, outputKeys, spec.derive, spec.sources);
|
|
13282
13391
|
const reg = { spec, strategyHash };
|
|
13283
13392
|
const fromSource = this._bySource.get(spec.source);
|
|
13284
13393
|
if (fromSource) fromSource.push(reg);
|
|
13285
13394
|
else this._bySource.set(spec.source, [reg]);
|
|
13395
|
+
for (const extra of spec.sources ?? []) {
|
|
13396
|
+
const fromExtra = this._bySource.get(extra);
|
|
13397
|
+
if (fromExtra) fromExtra.push(reg);
|
|
13398
|
+
else this._bySource.set(extra, [reg]);
|
|
13399
|
+
}
|
|
13286
13400
|
for (const key of outputKeys) {
|
|
13287
13401
|
const output = spec.outputs[key];
|
|
13288
13402
|
if (!output) continue;
|
|
@@ -14458,17 +14572,23 @@ var init_vault = __esm({
|
|
|
14458
14572
|
* const cur = await vault.sequence('invoice-2026').peek() // current value, no allocation
|
|
14459
14573
|
* ```
|
|
14460
14574
|
*/
|
|
14461
|
-
sequence(
|
|
14462
|
-
if (
|
|
14575
|
+
sequence(series, opts) {
|
|
14576
|
+
if (series.includes("\0")) {
|
|
14577
|
+
throw new ValidationError(`sequence("${series}"): series name must not contain a null byte (\\x00).`);
|
|
14578
|
+
}
|
|
14579
|
+
if (this.numberingConfigs.has(series)) {
|
|
14463
14580
|
const eng = this.deferred();
|
|
14464
14581
|
return {
|
|
14465
|
-
next: async (
|
|
14466
|
-
if (!
|
|
14467
|
-
throw new ValidationError(`sequence("${
|
|
14582
|
+
next: async (nextOpts) => {
|
|
14583
|
+
if (!nextOpts?.for) {
|
|
14584
|
+
throw new ValidationError(`sequence("${series}") is a deferred-numbering series; call next({ for: recordId }).`);
|
|
14468
14585
|
}
|
|
14469
|
-
return (await eng.enqueue(
|
|
14586
|
+
return (await eng.enqueue(series, nextOpts.for)).assigned;
|
|
14470
14587
|
},
|
|
14471
|
-
peek: () => eng.peek(
|
|
14588
|
+
peek: () => eng.peek(series),
|
|
14589
|
+
seedTo: () => {
|
|
14590
|
+
throw new ValidationError(`sequence("${series}") is a deferred-numbering series; seedTo is CAS-only.`);
|
|
14591
|
+
}
|
|
14472
14592
|
};
|
|
14473
14593
|
}
|
|
14474
14594
|
if (!this.sequenceStore) {
|
|
@@ -14480,7 +14600,7 @@ var init_vault = __esm({
|
|
|
14480
14600
|
actor: this.keyring.userId
|
|
14481
14601
|
});
|
|
14482
14602
|
}
|
|
14483
|
-
return this.sequenceStore.handle(
|
|
14603
|
+
return this.sequenceStore.handle(resolveSequenceKey(series, opts));
|
|
14484
14604
|
}
|
|
14485
14605
|
/** @internal — lazily build the deferred-numbering engine with a cache-coherent stamp. */
|
|
14486
14606
|
deferred() {
|
|
@@ -14772,9 +14892,24 @@ var init_vault = __esm({
|
|
|
14772
14892
|
});
|
|
14773
14893
|
}
|
|
14774
14894
|
if (rule.mode === "cascade") {
|
|
14895
|
+
const txCtx = this.noydb._activeTxContextOrNull;
|
|
14775
14896
|
for (const match of matches) {
|
|
14776
14897
|
const matchId = match["id"] ?? null;
|
|
14777
14898
|
if (matchId === null) continue;
|
|
14899
|
+
if (txCtx !== null) {
|
|
14900
|
+
const prior = await this.adapter.get(this.name, rule.collection, matchId);
|
|
14901
|
+
if (prior !== null) {
|
|
14902
|
+
txCtx._executed.push({
|
|
14903
|
+
op: {
|
|
14904
|
+
type: "delete",
|
|
14905
|
+
vaultName: this.name,
|
|
14906
|
+
collectionName: rule.collection,
|
|
14907
|
+
id: matchId
|
|
14908
|
+
},
|
|
14909
|
+
priorEnvelope: prior
|
|
14910
|
+
});
|
|
14911
|
+
}
|
|
14912
|
+
}
|
|
14778
14913
|
await fromCollection.delete(matchId);
|
|
14779
14914
|
}
|
|
14780
14915
|
}
|
|
@@ -17163,7 +17298,7 @@ var init_strategy11 = __esm({
|
|
|
17163
17298
|
'Multi-record transactions require the tx strategy. Import `{ withTransactions }` from "@noy-db/hub/tx" and pass it to `createNoydb({ txStrategy: withTransactions() })`.'
|
|
17164
17299
|
);
|
|
17165
17300
|
NO_TX = {
|
|
17166
|
-
async runTransaction() {
|
|
17301
|
+
async runTransaction(_db, _fn, _options, _txInvariants) {
|
|
17167
17302
|
throw NOT_ENABLED6;
|
|
17168
17303
|
},
|
|
17169
17304
|
async runDryRun() {
|