@noy-db/hub 0.2.0-pre.14 → 0.2.0-pre.15
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 +56 -56
- 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 +3 -3
- package/dist/attestation/index.d.cts +5 -5
- package/dist/attestation/index.d.ts +5 -5
- package/dist/blobs/index.d.cts +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/bundle/index.cjs +426 -68
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +7 -7
- package/dist/bundle/index.d.ts +7 -7
- package/dist/bundle/index.js +1 -1
- package/dist/{chunk-3EWA37FV.js → chunk-3EWXMOK3.js} +7 -266
- package/dist/chunk-3EWXMOK3.js.map +1 -0
- package/dist/{chunk-ACKFRSAH.js → chunk-7EFFHEN5.js} +26 -19
- package/dist/chunk-7EFFHEN5.js.map +1 -0
- package/dist/{chunk-UWNYBOOO.js → chunk-C5T5AFWN.js} +2 -2
- package/dist/chunk-CJORTUJ2.js +524 -0
- package/dist/chunk-CJORTUJ2.js.map +1 -0
- package/dist/{chunk-YNTBADIY.js → chunk-CZI2A4MQ.js} +2 -2
- package/dist/{chunk-KGCORI4L.js → chunk-EYVQHAGH.js} +266 -66
- package/dist/chunk-EYVQHAGH.js.map +1 -0
- package/dist/{chunk-NP6EZT44.js → chunk-IQLVUT37.js} +2 -2
- package/dist/{chunk-4PEFEETV.js → chunk-KIP6JLTF.js} +2 -2
- package/dist/{chunk-ZWTNWAO4.js → chunk-NU6Q3FOR.js} +3 -3
- package/dist/chunk-NU6Q3FOR.js.map +1 -0
- package/dist/{chunk-WIBHRONM.js → chunk-XWH4MXIU.js} +2 -2
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/derivations/index.d.cts +7 -7
- package/dist/derivations/index.d.ts +7 -7
- package/dist/{dev-unlock-DV7ujTCI.d.ts → dev-unlock-iAS8z9jc.d.ts} +1 -1
- package/dist/{dev-unlock-BF4OSxRv.d.cts → dev-unlock-nVkuRLLe.d.cts} +1 -1
- package/dist/{executor-723ZP6TH.js → executor-HSSRXDOB.js} +4 -4
- package/dist/guards/index.d.cts +7 -7
- package/dist/guards/index.d.ts +7 -7
- package/dist/{hash-BcF5WQXl.d.cts → hash-Cv6byZs7.d.cts} +1 -1
- package/dist/{hash-DswxkLtW.d.ts → hash-DHOnRarj.d.ts} +1 -1
- package/dist/history/index.d.cts +7 -7
- package/dist/history/index.d.ts +7 -7
- package/dist/i18n/index.d.cts +6 -6
- package/dist/i18n/index.d.ts +6 -6
- package/dist/{immutable-guard-C8IYdzfu.d.ts → immutable-guard-BehB1YGB.d.ts} +1 -1
- package/dist/{immutable-guard-7KqslW2K.d.cts → immutable-guard-yBEOYmif.d.cts} +1 -1
- package/dist/{index-CUVOMtgg.d.cts → index-D95VK1Qy.d.cts} +11 -3
- package/dist/{index-Cqzp4tt9.d.ts → index-XNB2r6bX.d.ts} +11 -3
- package/dist/index.cjs +567 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -15
- package/dist/index.d.ts +145 -15
- package/dist/index.js +132 -16
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +92 -31
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.d.cts +3 -3
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +3 -3
- package/dist/{lazy-builder-D5GU14TS.d.ts → lazy-builder-ChSqcF5t.d.ts} +1 -1
- package/dist/{lazy-builder-Ci5_YG73.d.cts → lazy-builder-eYZzLEL1.d.cts} +1 -1
- package/dist/materialized-views/index.cjs +2 -2
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +7 -7
- package/dist/materialized-views/index.d.ts +7 -7
- package/dist/materialized-views/index.js +5 -5
- package/dist/{noydb-VZ4JVW55.js → noydb-GZGFBA4E.js} +8 -8
- package/dist/overlay-views/index.d.cts +7 -7
- package/dist/overlay-views/index.d.ts +7 -7
- package/dist/periods/index.d.cts +6 -6
- package/dist/periods/index.d.ts +6 -6
- package/dist/{predicate-Bt5ft-9c.d.cts → predicate-BmhBSPCH.d.cts} +59 -2
- package/dist/{predicate-Bt5ft-9c.d.ts → predicate-BmhBSPCH.d.ts} +59 -2
- package/dist/query/index.cjs +580 -195
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +5 -5
- package/dist/session/index.d.cts +7 -7
- package/dist/session/index.d.ts +7 -7
- package/dist/shadow/index.d.cts +6 -6
- package/dist/shadow/index.d.ts +6 -6
- package/dist/snapshots/index.d.cts +6 -6
- package/dist/snapshots/index.d.ts +6 -6
- package/dist/{stale-7FRJVHN6.js → stale-JH67FU57.js} +2 -2
- package/dist/store/index.d.cts +6 -6
- package/dist/store/index.d.ts +6 -6
- package/dist/{strategy-CrS7PnbE.d.ts → strategy-CbneC7bS.d.cts} +1 -1
- package/dist/{strategy-CrS7PnbE.d.cts → strategy-CbneC7bS.d.ts} +1 -1
- package/dist/sync/index.d.cts +5 -5
- package/dist/sync/index.d.ts +5 -5
- package/dist/team/index.d.cts +6 -6
- package/dist/team/index.d.ts +6 -6
- package/dist/tx/index.d.cts +6 -6
- package/dist/tx/index.d.ts +6 -6
- package/dist/{types-BFHQUjdy.d.ts → types-4t1-tWS4.d.ts} +22 -7
- package/dist/{types-V5R2-pd4.d.cts → types-BpPV5uyy.d.cts} +22 -7
- package/dist/{ulid-CwNf9e6-.d.cts → ulid-CiPrpGqm.d.cts} +1 -1
- package/dist/{ulid-p2nKiiKg.d.ts → ulid-DAfenvFd.d.ts} +1 -1
- package/dist/{vault-group-W7QC4UYW.js → vault-group-KOM7QRJG.js} +3 -3
- package/dist/{with-derivation-C9K43BOB.d.cts → with-derivation-DBqJB3dQ.d.cts} +1 -1
- package/dist/{with-derivation-Ds9yZgCj.d.ts → with-derivation-OK9M2sJE.d.ts} +1 -1
- package/dist/{with-materialized-view-DwR4jkV5.d.ts → with-materialized-view-Dt-ufPWQ.d.ts} +1 -1
- package/dist/{with-materialized-view-DgQcAjYv.d.cts → with-materialized-view-NzuxYPDF.d.cts} +1 -1
- package/dist/{with-overlayed-view-7-rUB3vD.d.cts → with-overlayed-view-CC0_ocy-.d.cts} +1 -1
- package/dist/{with-overlayed-view-ByyhHdVr.d.ts → with-overlayed-view-eDvMs6LO.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-3EWA37FV.js.map +0 -1
- package/dist/chunk-ACKFRSAH.js.map +0 -1
- package/dist/chunk-KGCORI4L.js.map +0 -1
- package/dist/chunk-TV3YZ35S.js +0 -90
- package/dist/chunk-TV3YZ35S.js.map +0 -1
- package/dist/chunk-ZWTNWAO4.js.map +0 -1
- /package/dist/{chunk-UWNYBOOO.js.map → chunk-C5T5AFWN.js.map} +0 -0
- /package/dist/{chunk-YNTBADIY.js.map → chunk-CZI2A4MQ.js.map} +0 -0
- /package/dist/{chunk-NP6EZT44.js.map → chunk-IQLVUT37.js.map} +0 -0
- /package/dist/{chunk-4PEFEETV.js.map → chunk-KIP6JLTF.js.map} +0 -0
- /package/dist/{chunk-WIBHRONM.js.map → chunk-XWH4MXIU.js.map} +0 -0
- /package/dist/{executor-723ZP6TH.js.map → executor-HSSRXDOB.js.map} +0 -0
- /package/dist/{noydb-VZ4JVW55.js.map → noydb-GZGFBA4E.js.map} +0 -0
- /package/dist/{stale-7FRJVHN6.js.map → stale-JH67FU57.js.map} +0 -0
- /package/dist/{vault-group-W7QC4UYW.js.map → vault-group-KOM7QRJG.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { b3 as NoydbStore, bF as UserEnvelope, br as PublicEnvelope, bG as GateName, bH as GatePolicy, bI as VaultPolicy, bJ as ActiveTier, bK as FactorProof, bL as SchemaUpdateStrategy, bM as TransformFn, bN as PersistedSchemaEnvelope, bO as UpdateDecision, bP as DirectoryConfig, bQ as UserVisibility, b1 as UnlockedKeyring, bw as Vault, ba as DiffEntry } from './types-
|
|
2
|
-
export { bR as AccessibleVault, bS as AffectedDocument, b7 as AppendInput, bT as ArchivePolicy, bU as ArchiveResult, bV as ArchiveRunOptions, bW as ArchiveStrategy, aP as ArrayOutputSpec, z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, bX as BUNDLE_STORE_POLICY, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, bY as BuiltInGateName, bt as BundleRecipient, a9 as CONSENT_AUDIT_COLLECTION, bZ as CacheOptions, b_ as CacheStats, b$ as CapturedBlueprint, c0 as ChangeEvent, b8 as ChangeType, ai as ClosePeriodOptions, aY as Collection, c1 as CollectionChangeEvent, c2 as CollectionConflictResolver, c3 as CollectionDescriptor, az as CollectionFrame, b9 as CollectionInstant, c4 as CollectionStats, c5 as ComputedFieldError, c6 as ComputedFields, c7 as ComputedFn, c8 as Conflict, c9 as ConflictPolicy, ca as ConflictStrategy, aa as ConsentAuditEntry, ab as ConsentAuditFilter, ac as ConsentContext, ad as ConsentOp, cb as CrossTierAccessEvent, cc as CrossVaultAggregation, cd as CrossVaultGroupedAggregation, ce as CrossVaultGroupedRow, cf as CrossVaultLiveAggregation, cg as CrossVaultLiveQuery, Y as DEFAULT_CHUNK_SIZE, ch as DEFAULT_PUBLIC_ENVELOPE_SCHEMA, ci as DELEGATIONS_COLLECTION, D as DICT_COLLECTION_PREFIX, cj as DeepPartial, ck as DeepPartialOrNull, cl as DeferredNumberingConfig, cm as DelegationToken, cn as DeleteManyResult, co as DeploymentEvent, cp as DerivationDescriptor, aN as DerivationStrategy, aR as DerivationStrategyHandle, aS as DerivedFromMeta, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, cq as DirtyEntry, cr as DryRunResult, cs as DumpSchemaOptions, ct as ELEVATION_AUDIT_COLLECTION, cu as ElevatedHandle, b5 as EncryptedEnvelope, cv as EnrollAuthenticatorOptions, cw as EnrollAuthenticatorWrappingDEKsOptions, cx as EnrollAuthenticatorWrappingKEKOptions, cy as EnrollRecoveryResult, cz as ExportCapability, cA as ExportChunk, cB as ExportFormat, cC as ExportStreamOptions, cD as FactorKind, cE as FactorProofBundle, cF as FactorRequirement, cG as FanoutQueryOptions, cH as FanoutResult, cI as FenceDoc, cJ as FenceState, cK as FieldChange, cL as FieldDescriptor, cM as FieldSource, cN as GhostRecord, cO as GrantOptions, at as GuardChange, au as GuardContext, as as GuardStrategy, aw as GuardStrategyHandle, cP as GuardViolation, cQ as HistoryConfig, cR as HistoryEntry, b4 as HistoryOptions, e as I18nMap, f as I18nTextDescriptor, g as I18nTextOptions, cS as INDEXED_STORE_POLICY, cT as ImportCapability, cU as InferOutput, cV as InternalCollectionStats, cW as IssueDelegationOptions, cX as IssueMagicLinkGrantOptions, bb as JsonPatch, bc as JsonPatchOp, cY as KeyringAuthenticator, cZ as KeyringAuthenticatorWrappingDEKs, c_ as KeyringAuthenticatorWrappingKEK, c$ as KeyringFile, L as Layer, bd as LedgerEntry, be as LedgerStore, d0 as ListAccessibleVaultsOptions, d1 as ListPageResult, d2 as ListUsersOptions, d3 as LiveQueryOptions, d4 as LiveUserEnvelope, d5 as LocaleReadOptions, d6 as Lru, d7 as LruOptions, d8 as LruStats, d9 as MAGIC_LINK_CONTENT_INFO_PREFIX, da as MAGIC_LINK_GRANTS_COLLECTION, db as MAGIC_LINK_KEK_INFO_PREFIX, dc as MagicLinkGrantPayload, dd as MagicLinkGrantRecord, bC as MaterializedFromMeta, de as MaterializedViewDescriptor, bD as MaterializedViewOutput, aV as MaterializedViewStrategy, aW as MaterializedViewStrategyHandle, df as MemoryRecipientSealer, dg as MemorySealingKeyProvider, dh as NOYDB_BACKUP_VERSION, di as NOYDB_FORMAT_VERSION, dj as NOYDB_KEYRING_VERSION, dk as NOYDB_SYNC_VERSION, dl as NextOptions, dm as Noydb, aB as NoydbBundleStore, dn as NoydbEventMap, dp as NoydbOptions, dq as NumberingAssignment, O as OnMissing, h as OnMissingPolicy, aj as OpenPeriodOptions, aT as OutputSpec, dr as OverlayViewDescriptor, aX as OverlayedViewStrategy, a_ as OverlayedViewStrategyHandle, ak as PERIODS_COLLECTION, ds as PUBLIC_ENVELOPE_FIELDS, dt as PaperRecoveryDoc, du as PaperRecoveryEntry, dv as PassphrasePolicy, dw as PassphraseValidationResult, al as PeriodRecord, dx as Permission, dy as Permissions, dz as PersistedSchemaKind, dA as PlaintextTranslatorContext, dB as PlaintextTranslatorFn, P as PolicyEnforcer, dC as PresenceHandle, dD as PresencePeer, b6 as PruneOptions, dE as PublicEnvelopeField, dF as PublicEnvelopeSchema, dG as PublicEnvelopeText, dH as PullMode, dI as PullOptions, dJ as PullPolicy, dK as PullResult, dL as PushMode, dM as PushOptions, dN as PushPolicy, dO as PushResult, dP as PutManyItemOptions, dQ as PutManyOptions, dR as PutManyResult, dS as QueryAcrossOptions, dT as QueryAcrossResult, dU as QuickUnlockState, dV as QuickUnlockStore, dW as ReAuthOperation, bv as RecipientHint, bu as RecipientSealer, aU as RecordOutputSpec, dX as RecoverPassphraseInput, dY as RecoverPassphraseResult, dZ as RecoverUserOptions, d_ as RecoveryProof, R as ResolveI18nOptions, d$ as ResolvedPublicEnvelopeSchema, aC as RetentionPolicy, e0 as RevokeOptions, b0 as Role, e1 as RotatePassphraseInput, e2 as RotateRecoveryOptions, e3 as RotateRecoveryResult, e4 as SEALED_PASSPHRASE_RECORD_ID, e5 as SchemaDelta, e6 as SchemaIntrospection, e7 as SchemaManifestRow, S as ScriptWarning, e8 as SealedEnvelope, e9 as SealedPassphrase, bs as SealingKeyProvider, ea as SequenceHandle, eb as SequenceStore, ec as SessionPolicy, ed as SetPublicEnvelopeInput, ee as ShamirRecoveryDoc, ef as ShamirRecoveryEntry, by as ShamirRecoveryProvider, eg as ShardedCollection, eh as ShardedGroupedQuery, ei as ShardedQuery, ej as ShardingConfig, ek as SkippedVault, a3 as SlotInfo, a4 as SlotRecord, el as SlotRewrapCeremony, em as SlotRewrapContext, aF as SnapshotMeta, en as StandardSchemaV1, eo as StandardSchemaV1Issue, ep as StandardSchemaV1SyncResult, eq as StateManagementVault, er as StoreAuth, es as StoreAuthKind, et as StoreCapabilities, eu as StoreTime, ev as SyncEngine, ew as SyncMetadata, ex as SyncPolicy, ey as SyncScheduler, ez as SyncSchedulerStatus, eA as SyncStatus, eB as SyncTarget, eC as SyncTargetRole, eD as SyncTransaction, eE as SyncTransactionResult, eF as TabChannel, eG as TabCoordinationOptions, eH as TabLockManager, eI as TabPresence, eJ as TabRole, eK as TierMode, eL as TranslatorAuditEntry, aJ as TxCollection, aK as TxContext, eM as TxOp, aL as TxVault, eN as USER_ENVELOPE_COLLECTION, eO as USER_ENVELOPE_MAX_BYTES, bE as UnionSource, eP as Unsubscribe, eQ as UpdateAuthenticatorOptions, eR as UpdateContext, eS as UpdateUserOptions, eT as UserApi, eU as UserEnvelopeCheckGate, eV as UserEnvelopeOversizedError, eW as UserEnvelopePresented, eX as UserInfo, eY as VaultBackup, bf as VaultEngine, aA as VaultFrame, eZ as VaultGroup, e_ as VaultGroupOptions, bg as VaultInstant, e$ as VaultPolicyOnDisk, f0 as VaultRegistryRow, f1 as VaultSchemaSnapshot, f2 as VaultSnapshot, f3 as VaultTemplate, bh as VerifyResult, a5 as VersionRecord, f4 as WarningRules, f5 as WeakPassphraseError, f6 as WeakPassphraseReason, f7 as WithArchiveOptions, f8 as WrappedDeksBlob, f9 as WriteConflict, fa as WriteEvent, fb as WriteHook, fc as WriteQueue, i as applyI18nLocale, bi as applyPatch, fd as assertStrongPassphrase, fe as buildRecipientKeyringFile, ff as burnPaperRecoveryEntry, bj as canonicalJson, bk as computePatch, x as createEnforcer, fg as createNoydb, fh as createStore, fi as deriveMagicLinkContentKey, j as dictCollectionName, k as dictKey, bl as diff, l as enforceScript, fj as enrollAuthenticator, fk as estimateEntropy, fl as evalComputedFields, fm as evaluateExportCapability, fn as evaluateImportCapability, fo as findAuthenticator, bm as formatDiff, fp as hasExportCapability, fq as hasImportCapability, fr as hasRecoveryEnrolled, bn as hashEntry, n as i18nText, o as inferScripts, p as isDictCollectionName, q as isDictKeyDescriptor, r as isI18nTextDescriptor, fs as isMagicLinkGrantExpired, ft as isPublicEnvelope, fu as issueDelegation, fv as keyringRecoverPassphrase, fw as keyringRotatePassphrase, fx as listMagicLinkGrants, fy as listUsers, fz as listUsersWithEnvelopes, fA as loadActiveDelegations, fB as loadPaperRecoveryEntries, fC as loadSealedPassphrase, fD as loadShamirRecoveryEntries, fE as magicLinkGrantRecordId, fF as mintPaperRecoveryEntry, fG as mintShamirRecoveryEntry, fH as mintWrappedDeksBlob, bo as paddedIndex, bp as parseIndex, fI as parseSealedEnvelope, fJ as readMagicLinkGrantRecord, fK as recoverUser, fL as removeAuthenticator, s as resolveI18nText, t as resolvePolicy, fM as resolvePublicEnvelopeSchema, fN as revokeDelegation, fO as revokeMagicLinkGrant, aM as runTransaction, fP as savePaperRecoveryEntries, fQ as saveSealedPassphrase, fR as saveShamirRecoveryEntries, bq as sha256Hex, fS as unwrapDeksFromBlob, fT as unwrapDeksFromPaperEntry, fU as unwrapDeksFromShamirEntry, fV as unwrapMagicLinkGrant, v as validateI18nTextValue, fW as validatePassphrase, fX as validatePublicEnvelopeInput, fY as validateSchemaInput, fZ as validateSchemaOutput, y as validateSessionPolicy, f_ as withArchive, f$ as withDeferredNumbering, g0 as writeMagicLinkGrant } from './types-
|
|
1
|
+
import { b3 as NoydbStore, bF as UserEnvelope, br as PublicEnvelope, bG as GateName, bH as GatePolicy, bI as VaultPolicy, bJ as ActiveTier, bK as FactorProof, bL as SchemaUpdateStrategy, bM as TransformFn, bN as PersistedSchemaEnvelope, bO as UpdateDecision, bP as DirectoryConfig, bQ as UserVisibility, b1 as UnlockedKeyring, bw as Vault, ba as DiffEntry } from './types-BpPV5uyy.cjs';
|
|
2
|
+
export { bR as AccessibleVault, bS as AffectedDocument, b7 as AppendInput, bT as ArchivePolicy, bU as ArchiveResult, bV as ArchiveRunOptions, bW as ArchiveStrategy, aP as ArrayOutputSpec, z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, bX as BUNDLE_STORE_POLICY, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, bY as BuiltInGateName, bt as BundleRecipient, a9 as CONSENT_AUDIT_COLLECTION, bZ as CacheOptions, b_ as CacheStats, b$ as CapturedBlueprint, c0 as ChangeEvent, b8 as ChangeType, ai as ClosePeriodOptions, aY as Collection, c1 as CollectionChangeEvent, c2 as CollectionConflictResolver, c3 as CollectionDescriptor, az as CollectionFrame, b9 as CollectionInstant, c4 as CollectionStats, c5 as ComputedFieldError, c6 as ComputedFields, c7 as ComputedFn, c8 as Conflict, c9 as ConflictPolicy, ca as ConflictStrategy, aa as ConsentAuditEntry, ab as ConsentAuditFilter, ac as ConsentContext, ad as ConsentOp, cb as CrossTierAccessEvent, cc as CrossVaultAggregation, cd as CrossVaultGroupedAggregation, ce as CrossVaultGroupedRow, cf as CrossVaultLiveAggregation, cg as CrossVaultLiveQuery, Y as DEFAULT_CHUNK_SIZE, ch as DEFAULT_PUBLIC_ENVELOPE_SCHEMA, ci as DELEGATIONS_COLLECTION, D as DICT_COLLECTION_PREFIX, cj as DeepPartial, ck as DeepPartialOrNull, cl as DeferredNumberingConfig, cm as DelegationToken, cn as DeleteManyResult, co as DeploymentEvent, cp as DerivationDescriptor, aN as DerivationStrategy, aR as DerivationStrategyHandle, aS as DerivedFromMeta, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, cq as DirtyEntry, cr as DryRunResult, cs as DumpSchemaOptions, ct as ELEVATION_AUDIT_COLLECTION, cu as ElevatedHandle, b5 as EncryptedEnvelope, cv as EnrollAuthenticatorOptions, cw as EnrollAuthenticatorWrappingDEKsOptions, cx as EnrollAuthenticatorWrappingKEKOptions, cy as EnrollRecoveryResult, cz as ExportCapability, cA as ExportChunk, cB as ExportFormat, cC as ExportStreamOptions, cD as FactorKind, cE as FactorProofBundle, cF as FactorRequirement, cG as FanoutQueryOptions, cH as FanoutResult, cI as FenceDoc, cJ as FenceState, cK as FieldChange, cL as FieldDescriptor, cM as FieldSource, cN as GhostRecord, cO as GrantOptions, at as GuardChange, au as GuardContext, as as GuardStrategy, aw as GuardStrategyHandle, cP as GuardViolation, cQ as HistoryConfig, cR as HistoryEntry, b4 as HistoryOptions, e as I18nMap, f as I18nTextDescriptor, g as I18nTextOptions, cS as INDEXED_STORE_POLICY, cT as ImportCapability, cU as InferOutput, cV as InternalCollectionStats, cW as IssueDelegationOptions, cX as IssueMagicLinkGrantOptions, bb as JsonPatch, bc as JsonPatchOp, cY as KeyringAuthenticator, cZ as KeyringAuthenticatorWrappingDEKs, c_ as KeyringAuthenticatorWrappingKEK, c$ as KeyringFile, L as Layer, bd as LedgerEntry, be as LedgerStore, d0 as ListAccessibleVaultsOptions, d1 as ListPageResult, d2 as ListUsersOptions, d3 as LiveQueryOptions, d4 as LiveUserEnvelope, d5 as LocaleReadOptions, d6 as Lru, d7 as LruOptions, d8 as LruStats, d9 as MAGIC_LINK_CONTENT_INFO_PREFIX, da as MAGIC_LINK_GRANTS_COLLECTION, db as MAGIC_LINK_KEK_INFO_PREFIX, dc as MagicLinkGrantPayload, dd as MagicLinkGrantRecord, bC as MaterializedFromMeta, de as MaterializedViewDescriptor, bD as MaterializedViewOutput, aV as MaterializedViewStrategy, aW as MaterializedViewStrategyHandle, df as MemoryRecipientSealer, dg as MemorySealingKeyProvider, dh as NOYDB_BACKUP_VERSION, di as NOYDB_FORMAT_VERSION, dj as NOYDB_KEYRING_VERSION, dk as NOYDB_SYNC_VERSION, dl as NextOptions, dm as Noydb, aB as NoydbBundleStore, dn as NoydbEventMap, dp as NoydbOptions, dq as NumberingAssignment, O as OnMissing, h as OnMissingPolicy, aj as OpenPeriodOptions, aT as OutputSpec, dr as OverlayViewDescriptor, aX as OverlayedViewStrategy, a_ as OverlayedViewStrategyHandle, ak as PERIODS_COLLECTION, ds as PUBLIC_ENVELOPE_FIELDS, dt as PaperRecoveryDoc, du as PaperRecoveryEntry, dv as PassphrasePolicy, dw as PassphraseValidationResult, al as PeriodRecord, dx as Permission, dy as Permissions, dz as PersistedSchemaKind, dA as PlaintextTranslatorContext, dB as PlaintextTranslatorFn, P as PolicyEnforcer, dC as PresenceHandle, dD as PresencePeer, b6 as PruneOptions, dE as PublicEnvelopeField, dF as PublicEnvelopeSchema, dG as PublicEnvelopeText, dH as PullMode, dI as PullOptions, dJ as PullPolicy, dK as PullResult, dL as PushMode, dM as PushOptions, dN as PushPolicy, dO as PushResult, dP as PutManyItemOptions, dQ as PutManyOptions, dR as PutManyResult, dS as QueryAcrossOptions, dT as QueryAcrossResult, dU as QuickUnlockState, dV as QuickUnlockStore, dW as ReAuthOperation, bv as RecipientHint, bu as RecipientSealer, aU as RecordOutputSpec, dX as RecoverPassphraseInput, dY as RecoverPassphraseResult, dZ as RecoverUserOptions, d_ as RecoveryProof, R as ResolveI18nOptions, d$ as ResolvedPublicEnvelopeSchema, aC as RetentionPolicy, e0 as RevokeOptions, b0 as Role, e1 as RotatePassphraseInput, e2 as RotateRecoveryOptions, e3 as RotateRecoveryResult, e4 as SEALED_PASSPHRASE_RECORD_ID, e5 as SchemaDelta, e6 as SchemaIntrospection, e7 as SchemaManifestRow, S as ScriptWarning, e8 as SealedEnvelope, e9 as SealedPassphrase, bs as SealingKeyProvider, ea as SequenceHandle, eb as SequenceStore, ec as SessionPolicy, ed as SetPublicEnvelopeInput, ee as ShamirRecoveryDoc, ef as ShamirRecoveryEntry, by as ShamirRecoveryProvider, eg as ShardedCollection, eh as ShardedGroupedQuery, ei as ShardedQuery, ej as ShardingConfig, ek as SkippedVault, a3 as SlotInfo, a4 as SlotRecord, el as SlotRewrapCeremony, em as SlotRewrapContext, aF as SnapshotMeta, en as StandardSchemaV1, eo as StandardSchemaV1Issue, ep as StandardSchemaV1SyncResult, eq as StateManagementVault, er as StoreAuth, es as StoreAuthKind, et as StoreCapabilities, eu as StoreTime, ev as SyncEngine, ew as SyncMetadata, ex as SyncPolicy, ey as SyncScheduler, ez as SyncSchedulerStatus, eA as SyncStatus, eB as SyncTarget, eC as SyncTargetRole, eD as SyncTransaction, eE as SyncTransactionResult, eF as TabChannel, eG as TabCoordinationOptions, eH as TabLockManager, eI as TabPresence, eJ as TabRole, eK as TierMode, eL as TranslatorAuditEntry, aJ as TxCollection, aK as TxContext, eM as TxOp, aL as TxVault, eN as USER_ENVELOPE_COLLECTION, eO as USER_ENVELOPE_MAX_BYTES, bE as UnionSource, eP as Unsubscribe, eQ as UpdateAuthenticatorOptions, eR as UpdateContext, eS as UpdateUserOptions, eT as UserApi, eU as UserEnvelopeCheckGate, eV as UserEnvelopeOversizedError, eW as UserEnvelopePresented, eX as UserInfo, eY as VaultBackup, bf as VaultEngine, aA as VaultFrame, eZ as VaultGroup, e_ as VaultGroupOptions, bg as VaultInstant, e$ as VaultPolicyOnDisk, f0 as VaultRegistryRow, f1 as VaultSchemaSnapshot, f2 as VaultSnapshot, f3 as VaultTemplate, bh as VerifyResult, a5 as VersionRecord, f4 as WarningRules, f5 as WeakPassphraseError, f6 as WeakPassphraseReason, f7 as WithArchiveOptions, f8 as WrappedDeksBlob, f9 as WriteConflict, fa as WriteEvent, fb as WriteHook, fc as WriteQueue, i as applyI18nLocale, bi as applyPatch, fd as assertStrongPassphrase, fe as buildRecipientKeyringFile, ff as burnPaperRecoveryEntry, bj as canonicalJson, bk as computePatch, x as createEnforcer, fg as createNoydb, fh as createStore, fi as deriveMagicLinkContentKey, j as dictCollectionName, k as dictKey, bl as diff, l as enforceScript, fj as enrollAuthenticator, fk as estimateEntropy, fl as evalComputedFields, fm as evaluateExportCapability, fn as evaluateImportCapability, fo as findAuthenticator, bm as formatDiff, fp as hasExportCapability, fq as hasImportCapability, fr as hasRecoveryEnrolled, bn as hashEntry, n as i18nText, o as inferScripts, p as isDictCollectionName, q as isDictKeyDescriptor, r as isI18nTextDescriptor, fs as isMagicLinkGrantExpired, ft as isPublicEnvelope, fu as issueDelegation, fv as keyringRecoverPassphrase, fw as keyringRotatePassphrase, fx as listMagicLinkGrants, fy as listUsers, fz as listUsersWithEnvelopes, fA as loadActiveDelegations, fB as loadPaperRecoveryEntries, fC as loadSealedPassphrase, fD as loadShamirRecoveryEntries, fE as magicLinkGrantRecordId, fF as mintPaperRecoveryEntry, fG as mintShamirRecoveryEntry, fH as mintWrappedDeksBlob, bo as paddedIndex, bp as parseIndex, fI as parseSealedEnvelope, fJ as readMagicLinkGrantRecord, fK as recoverUser, fL as removeAuthenticator, s as resolveI18nText, t as resolvePolicy, fM as resolvePublicEnvelopeSchema, fN as revokeDelegation, fO as revokeMagicLinkGrant, aM as runTransaction, fP as savePaperRecoveryEntries, fQ as saveSealedPassphrase, fR as saveShamirRecoveryEntries, bq as sha256Hex, fS as unwrapDeksFromBlob, fT as unwrapDeksFromPaperEntry, fU as unwrapDeksFromShamirEntry, fV as unwrapMagicLinkGrant, v as validateI18nTextValue, fW as validatePassphrase, fX as validatePublicEnvelopeInput, fY as validateSchemaInput, fZ as validateSchemaOutput, y as validateSessionPolicy, f_ as withArchive, f$ as withDeferredNumbering, g0 as writeMagicLinkGrant } from './types-BpPV5uyy.cjs';
|
|
3
3
|
export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from './mime-magic-CBBSOkjm.cjs';
|
|
4
4
|
export { AgeRoute, BlobLifecyclePolicy, BlobStoreRoute, CircuitBreakerOptions, HealthCheckOptions, LogLevel, LoggingOptions, MetricsOptions, OverrideOptions, OverrideTarget, RetryOptions, RouteStatus, RouteStoreOptions, RoutedNoydbStore, StoreCacheOptions, StoreMiddleware, StoreOperation, SuspendOptions, WrapBundleStoreOptions, WrappedBundleNoydbStore, createBundleStore, routeStore, withCache, withCircuitBreaker, withHealthCheck, withLogging, withMetrics, withRetry, wrapBundleStore, wrapStore } from './store/index.cjs';
|
|
5
|
-
import { a7 as NoydbError } from './strategy-
|
|
6
|
-
export { e as AggregateResult, f as AggregateSpec, g as Aggregation, h as AggregationUpstream,
|
|
7
|
-
export { D as DEFAULT_CROSS_JOIN_MAX_ROWS, a as DEFAULT_JOIN_MAX_ROWS, J as JoinContext, b as JoinLeg, c as JoinStrategy, d as JoinableSource, L as LiveQuery, e as LiveUpstream, O as OrderBy, Q as Query, f as QueryPlan, g as QuerySource, R as RefDescriptor, h as RefIntegrityError, i as RefMode, j as RefRegistry, k as RefScopeError, l as RefViolation, S as ScanBuilder, m as ScanPageProvider, n as applyJoins, o as buildLiveQuery, p as executePlan, r as ref, q as resetJoinWarnings } from './index-
|
|
8
|
-
export { A as AutoCredential, n as AutoCredentialKind, c as CompressionAlgo, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, j as generateULID, o as hasNoydbBundleMagic, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, p as readNoydbBundlePublicEnvelope, m as resetBrotliSupportCache, w as writeNoydbBundle } from './ulid-
|
|
5
|
+
import { a7 as NoydbError, a8 as RoundingMode } from './strategy-CbneC7bS.cjs';
|
|
6
|
+
export { e as AggregateResult, f as AggregateSpec, g as Aggregation, h as AggregationUpstream, a9 as AlreadyElevatedError, B as AmendmentForbiddenError, W as AttestationError, Y as BackupCorruptedError, Z as BackupLedgerError, _ as BundleIntegrityError, $ as BundleSealMismatchError, a0 as BundleVersionConflictError, aa as ConflictError, ab as CrossJoinSourceUnknownError, ac as CrossJoinTooLargeError, ad as DanglingReferenceError, ae as DecryptionError, af as DelegationTargetMissingError, H as DerivationCapExceededError, J as DerivationCycleError, K as DerivationDepthError, N as DerivationOutputShapeError, O as DerivationOutputUnknownError, D as DictKeyInUseError, a as DictKeyMissingError, ag as DirectoryDisabledError, ah as ElevationExpiredError, ai as ExportCapabilityError, F as FieldFrozenError, aj as FilenameSanitizationError, G as GROUPBY_MAX_CARDINALITY, i as GROUPBY_WARN_CARDINALITY, ak as GroupCardinalityError, j as GroupedAggregation, k as GroupedQuery, l as GroupedQueryN, m as GroupedRow, n as GroupedRowN, al as ImportCapabilityError, am as IndexRequiredError, an as IndexWriteFailureError, ao as InvalidKeyError, I as InvariantError, ap as JoinTooLargeError, aq as KeyringCorruptError, ar as KeyringExpiredError, as as LedgerContentionError, o as LiveAggregation, L as LocaleNotSpecifiedError, a3 as MaterializedViewConfigError, a4 as MaterializedViewCycleError, a5 as MaterializedViewSourceUnknownError, a6 as MaterializedViewTooLargeError, at as MigrationRequiredError, M as MissingTranslationError, au as MoneyCurrencyError, av as MoneyDescriptor, aw as MoneyOptions, ax as MoneyOptionsFixed, ay as MoneyOptionsMulti, az as MoneyPrecisionError, aA as MoneyUnsupportedError, aB as NetworkError, aC as NoAccessError, aD as NonAdditiveSchemaChangeError, aE as NotFoundError, aF as NumberingUncertaintyError, P as OverlayBaseIsVirtualError, Q as OverlayCollectionUnavailableError, U as OverlayIdMismatchError, V as OverlayNameCollisionError, aG as PathEscapeError, aH as PeriodClosedError, aI as PermissionDeniedError, aJ as PrivilegeEscalationError, aK as QuiesceTimeoutError, aL as ReadOnlyAtInstantError, aM as ReadOnlyError, aN as ReadOnlyFrameError, C as RecordLockedError, p as Reducer, q as ReducerOptions, R as ReservedCollectionNameError, aO as ReservedVaultNameError, aP as SchemaFenceError, aQ as SchemaLockedError, aR as SchemaUpdateError, aS as SchemaValidationError, S as ScriptViolationError, aT as SequenceContentionError, aU as SequenceOfflineError, b as SessionExpiredError, c as SessionNotFoundError, d as SessionPolicyError, aV as ShardProvisioningError, E as SnapshotNotFoundError, aW as StoreCapabilityError, aX as TamperedError, aY as TierDemoteDeniedError, aZ as TierNotGrantedError, T as TranslatorNotConfiguredError, a_ as UniqueConstraintError, a$ as UnknownShardError, b0 as UnsupportedIndexOptionError, b1 as ValidationError, b2 as VaultTemplateNotFoundError, r as avg, t as count, u as groupAndReduce, b3 as isMoneyDescriptor, v as max, w as min, b4 as money, x as reduceRecords, z as sum } from './strategy-CbneC7bS.cjs';
|
|
7
|
+
export { D as DEFAULT_CROSS_JOIN_MAX_ROWS, a as DEFAULT_JOIN_MAX_ROWS, J as JoinContext, b as JoinLeg, c as JoinStrategy, d as JoinableSource, L as LiveQuery, e as LiveUpstream, O as OrderBy, Q as Query, f as QueryPlan, g as QuerySource, R as RefDescriptor, h as RefIntegrityError, i as RefMode, j as RefRegistry, k as RefScopeError, l as RefViolation, S as ScanBuilder, m as ScanPageProvider, n as applyJoins, o as buildLiveQuery, p as executePlan, r as ref, q as resetJoinWarnings } from './index-D95VK1Qy.cjs';
|
|
8
|
+
export { A as AutoCredential, n as AutoCredentialKind, c as CompressionAlgo, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, j as generateULID, o as hasNoydbBundleMagic, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, p as readNoydbBundlePublicEnvelope, m as resetBrotliSupportCache, w as writeNoydbBundle } from './ulid-CiPrpGqm.cjs';
|
|
9
9
|
export { a as CrdtMode, b as CrdtState, L as LwwMapState, R as RgaState, Y as YjsState, m as mergeCrdtStates, r as resolveCrdtSnapshot } from './strategy-BSxFXGzb.cjs';
|
|
10
|
-
export { I as ImmutableGuardConfig, i as immutableGuard, w as withGuard } from './immutable-guard-
|
|
11
|
-
export { w as withDerivation } from './with-derivation-
|
|
12
|
-
export { w as withMaterializedView } from './with-materialized-view-
|
|
13
|
-
export { a as Clause, C as CollectionIndexes, F as FieldClause, b as FilterClause, G as GroupClause, H as HashIndex, I as IndexDef, O as Operator, e as evaluateClause, c as evaluateFieldClause, r as readPath } from './predicate-
|
|
14
|
-
export { w as withOverlayedView } from './with-overlayed-view-
|
|
10
|
+
export { I as ImmutableGuardConfig, i as immutableGuard, w as withGuard } from './immutable-guard-yBEOYmif.cjs';
|
|
11
|
+
export { w as withDerivation } from './with-derivation-DBqJB3dQ.cjs';
|
|
12
|
+
export { w as withMaterializedView } from './with-materialized-view-NzuxYPDF.cjs';
|
|
13
|
+
export { a as Clause, C as CollectionIndexes, F as FieldClause, b as FilterClause, G as GroupClause, H as HashIndex, I as IndexDef, O as Operator, e as evaluateClause, c as evaluateFieldClause, r as readPath } from './predicate-BmhBSPCH.cjs';
|
|
14
|
+
export { w as withOverlayedView } from './with-overlayed-view-CC0_ocy-.cjs';
|
|
15
15
|
export { SYNC_CREDENTIALS_COLLECTION, SyncCredential, credentialStatus, deleteCredential, getCredential, listCredentials, putCredential } from './team/index.cjs';
|
|
16
|
-
export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from './dev-unlock-
|
|
16
|
+
export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from './dev-unlock-nVkuRLLe.cjs';
|
|
17
17
|
export { i as isDiscriminant } from './discriminant-BN9REW3o.cjs';
|
|
18
|
-
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from './hash-
|
|
19
|
-
import './lazy-builder-
|
|
18
|
+
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from './hash-Cv6byZs7.cjs';
|
|
19
|
+
import './lazy-builder-eYZzLEL1.cjs';
|
|
20
20
|
import '@noy-db/attestation';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -662,6 +662,136 @@ declare function scaleForCurrency(code: string): number | null;
|
|
|
662
662
|
|
|
663
663
|
type FxRates = Record<string, number | string>;
|
|
664
664
|
|
|
665
|
+
/**
|
|
666
|
+
* Exact money arithmetic helpers (#337) — `mulRate` and `allocate`.
|
|
667
|
+
*
|
|
668
|
+
* Both operate on the canonical decoded string form that `get()`
|
|
669
|
+
* returns (`'10000.00'`), entirely in scaled-`BigInt` space — no
|
|
670
|
+
* floating-point step anywhere, exact past 2^53. They are pure
|
|
671
|
+
* functions with no vault or descriptor dependency: the working scale
|
|
672
|
+
* is inferred from the amount's fractional digits (a canonical money
|
|
673
|
+
* string always carries exactly the field's scale) or pinned with
|
|
674
|
+
* `opts.scale`.
|
|
675
|
+
*
|
|
676
|
+
* Why these two: app-side invariants of the form
|
|
677
|
+
* `Σ parts === whole` (receipt totals, net-zero WHT pairs, proration)
|
|
678
|
+
* carry ±0.01 tolerances ONLY because the math is major-unit floats +
|
|
679
|
+
* round2. `mulRate` (VAT-style rate application with explicit
|
|
680
|
+
* rounding) and `allocate` (largest-remainder split — parts sum to the
|
|
681
|
+
* input EXACTLY, by construction) make those tolerances zero.
|
|
682
|
+
*/
|
|
683
|
+
|
|
684
|
+
interface MulRateOptions {
|
|
685
|
+
/**
|
|
686
|
+
* Output scale (fraction digits). Defaults to the amount's own
|
|
687
|
+
* fractional digits — for a canonical money string that IS the
|
|
688
|
+
* field's scale.
|
|
689
|
+
*/
|
|
690
|
+
readonly scale?: number;
|
|
691
|
+
/** Rounding for the final re-scale. Default `'half-up'`. */
|
|
692
|
+
readonly rounding?: RoundingMode;
|
|
693
|
+
}
|
|
694
|
+
interface AllocateOptions {
|
|
695
|
+
/** Working scale. Defaults to the amount's own fractional digits. */
|
|
696
|
+
readonly scale?: number;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Multiply a money amount by a decimal rate, exactly.
|
|
700
|
+
*
|
|
701
|
+
* The rate is parsed at its OWN full precision (`0.07` → `7` at scale
|
|
702
|
+
* 2), the product computed in `BigInt` at `amountScale + rateScale`,
|
|
703
|
+
* then re-scaled back to the output scale with the requested rounding —
|
|
704
|
+
* one rounding step, at the very end.
|
|
705
|
+
*
|
|
706
|
+
* ```ts
|
|
707
|
+
* mulRate('10000.00', 0.07) // '700.00' (VAT)
|
|
708
|
+
* mulRate('33.33', '0.07') // '2.33' (half-up)
|
|
709
|
+
* mulRate('33.33', 0.07, { rounding: 'floor' }) // '2.33'
|
|
710
|
+
* mulRate(100, 0.07, { scale: 2 }) // '7.00'
|
|
711
|
+
* ```
|
|
712
|
+
*/
|
|
713
|
+
declare function mulRate(amount: number | string, rate: number | string, opts?: MulRateOptions): string;
|
|
714
|
+
/**
|
|
715
|
+
* Split a money amount across weighted buckets with ZERO drift: the
|
|
716
|
+
* returned parts sum to the input exactly, by construction
|
|
717
|
+
* (largest-remainder method).
|
|
718
|
+
*
|
|
719
|
+
* Each bucket gets `floor(amount × weightᵢ / Σweights)`; the leftover
|
|
720
|
+
* minor units (always fewer than the bucket count) go one each to the
|
|
721
|
+
* buckets with the largest truncated remainders — ties broken by
|
|
722
|
+
* position, earlier bucket first. Weights are parsed as exact decimals
|
|
723
|
+
* (no float division anywhere); they must be non-negative with a
|
|
724
|
+
* positive sum.
|
|
725
|
+
*
|
|
726
|
+
* ```ts
|
|
727
|
+
* allocate('100.00', [1, 1, 1]) // ['33.34', '33.33', '33.33']
|
|
728
|
+
* allocate('0.05', [3, 7]) // ['0.02', '0.03']
|
|
729
|
+
* allocate('-100.00', [1, 1, 1]) // ['-33.34', '-33.33', '-33.33']
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
declare function allocate(amount: number | string, weights: ReadonlyArray<number | string>, opts?: AllocateOptions): string[];
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Branded money output type (#338).
|
|
736
|
+
*
|
|
737
|
+
* The decoded read shape of a money field is an exact decimal STRING
|
|
738
|
+
* (`'10000.00'`) — but a hand-written schema types it `string | number`,
|
|
739
|
+
* which is honest about the input side and unhelpful on the output
|
|
740
|
+
* side: every read site hand-coerces, and a missed coercion passes
|
|
741
|
+
* typecheck silently (then surfaces as a runtime template warning, or
|
|
742
|
+
* worse, as `'10000.00' * 100` arithmetic).
|
|
743
|
+
*
|
|
744
|
+
* {@link MoneyString} is the output-side brand: a `string` that has
|
|
745
|
+
* been through noy-db's decode (or {@link asMoney}'s guard). Branding
|
|
746
|
+
* is type-level only — zero runtime cost on the read path.
|
|
747
|
+
*
|
|
748
|
+
* ## Wiring the brand through a validator (the input/output asymmetry)
|
|
749
|
+
*
|
|
750
|
+
* Keep the permissive `string | number` on the INPUT side so write
|
|
751
|
+
* sites are untouched, and brand the OUTPUT side. With Zod:
|
|
752
|
+
*
|
|
753
|
+
* ```ts
|
|
754
|
+
* import type { MoneyString } from '@noy-db/hub'
|
|
755
|
+
*
|
|
756
|
+
* const moneyValue = z.union([z.number(), z.string()]) as unknown as
|
|
757
|
+
* z.ZodType<MoneyString, z.ZodTypeDef, string | number>
|
|
758
|
+
*
|
|
759
|
+
* const Invoice = z.object({ id: z.string(), total: moneyValue })
|
|
760
|
+
* type InvoiceOut = z.output<typeof Invoice> // total: MoneyString
|
|
761
|
+
* type InvoiceIn = z.input<typeof Invoice> // total: string | number
|
|
762
|
+
* ```
|
|
763
|
+
*
|
|
764
|
+
* The cast is sound for fields declared in `moneyFields`: reads pass
|
|
765
|
+
* through `decodeMoneyFields`, which always produces the canonical
|
|
766
|
+
* decimal string.
|
|
767
|
+
*/
|
|
768
|
+
declare const MONEY_BRAND: unique symbol;
|
|
769
|
+
/**
|
|
770
|
+
* An exact decimal string produced by noy-db's money decode
|
|
771
|
+
* (`'10000.00'`). The brand exists only at the type level — at runtime
|
|
772
|
+
* a `MoneyString` is a plain string.
|
|
773
|
+
*/
|
|
774
|
+
type MoneyString = string & {
|
|
775
|
+
readonly [MONEY_BRAND]: true;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Runtime-guarded cast to {@link MoneyString}. Accepts a decimal string
|
|
779
|
+
* or a number, returns the canonical decimal string branded — throws
|
|
780
|
+
* `MoneyUnsupportedError` on anything non-finite / non-decimal. Use at
|
|
781
|
+
* trust boundaries (deserialized JSON, route params); values read
|
|
782
|
+
* through `get()`/`list()` are already canonical.
|
|
783
|
+
*/
|
|
784
|
+
declare function asMoney(value: string | number): MoneyString;
|
|
785
|
+
/** Type guard: is `value` a decimal string acceptable as money? */
|
|
786
|
+
declare function isMoneyString(value: unknown): value is MoneyString;
|
|
787
|
+
/**
|
|
788
|
+
* The ONE sanctioned escape hatch to a JS `number` — explicit because
|
|
789
|
+
* the conversion is lossy past 2^53. For display math and chart axes;
|
|
790
|
+
* never feed the result back into stored amounts (use `mulRate` /
|
|
791
|
+
* `allocate` for exact arithmetic).
|
|
792
|
+
*/
|
|
793
|
+
declare function moneyNumber(value: MoneyString | string | number): number;
|
|
794
|
+
|
|
665
795
|
/**
|
|
666
796
|
* Hierarchical access — tier-aware keyring helpers.
|
|
667
797
|
*
|
|
@@ -816,4 +946,4 @@ type DiffCandidate<T = unknown> = Vault | Record<string, readonly T[]> | string;
|
|
|
816
946
|
*/
|
|
817
947
|
declare function diffVault<T = unknown>(vault: Vault, candidate: DiffCandidate<T>, options?: DiffOptions): Promise<VaultDiff<T>>;
|
|
818
948
|
|
|
819
|
-
export { ActiveTier, type CheckGateContext, DEFAULT_FRESHNESS_MS, DIRECTORY_RECORD_ID, type DiffCandidate, DiffEntry, type DiffOptions, DirectoryConfig, FactorProof, type FxRates, GateName, GatePolicy, META_COLLECTION, ManagedRecoveryNotEnrolledError, NoydbError, NoydbStore, PERSONAL_POLICY, POLICY_RECORD_ID, PUBLIC_ENVELOPE_RECORD_ID, type PersistSchemaResult, PersistedSchemaEnvelope, PolicyDeniedError, type PolicyDenyReason, PublicEnvelope, RecoveryNotEnrolledError, RecoveryProfileNotImplementedError, SCHEMAS_COLLECTION, STATE_VAULT_NAME, STRICT_POLICY, SchemaUpdateStrategy, UnlockedKeyring, UpdateDecision, UserEnvelope, UserVisibility, VISIBILITY_RECORD_PREFIX, Vault, type VaultDiff, type VaultDiffEntry, type VaultDiffModifiedEntry, VaultPolicy, additiveOnly, assertTierAccess, base64ToBuffer, blindUpdate, bufferToBase64, checkGate, coordinatedCutover, decryptBytes, decryptDeterministic, dekKey, deleteUserEnvelope, deleteUserVisibility, derivePersistedSchema, derivePresenceKey, describeAllUsersAuth, describeAuthConfig, describeGate, describeUserAuth, diagramAuthConfig, diffVault, effectiveClearance, encryptBytes, encryptDeterministic, estimateRecordBytes, isZodSchema, listUserEnvelopeIds, loadPersistedSchema, loadPublicEnvelope, loadUserEnvelope, loadVaultPolicy, lockSchema, mergePolicy, parseBytes, persistDirectoryConfig, persistSchemaIfNeeded, persistUserVisibility, readDirectoryConfig, readPublicEnvelope, readUserVisibility, savePersistedSchema, savePublicEnvelope, saveUserEnvelope, saveVaultPolicy, scaleForCurrency, visibilityRecordId };
|
|
949
|
+
export { ActiveTier, type AllocateOptions, type CheckGateContext, DEFAULT_FRESHNESS_MS, DIRECTORY_RECORD_ID, type DiffCandidate, DiffEntry, type DiffOptions, DirectoryConfig, FactorProof, type FxRates, GateName, GatePolicy, META_COLLECTION, ManagedRecoveryNotEnrolledError, type MoneyString, type MulRateOptions, NoydbError, NoydbStore, PERSONAL_POLICY, POLICY_RECORD_ID, PUBLIC_ENVELOPE_RECORD_ID, type PersistSchemaResult, PersistedSchemaEnvelope, PolicyDeniedError, type PolicyDenyReason, PublicEnvelope, RecoveryNotEnrolledError, RecoveryProfileNotImplementedError, RoundingMode, SCHEMAS_COLLECTION, STATE_VAULT_NAME, STRICT_POLICY, SchemaUpdateStrategy, UnlockedKeyring, UpdateDecision, UserEnvelope, UserVisibility, VISIBILITY_RECORD_PREFIX, Vault, type VaultDiff, type VaultDiffEntry, type VaultDiffModifiedEntry, VaultPolicy, additiveOnly, allocate, asMoney, assertTierAccess, base64ToBuffer, blindUpdate, bufferToBase64, checkGate, coordinatedCutover, decryptBytes, decryptDeterministic, dekKey, deleteUserEnvelope, deleteUserVisibility, derivePersistedSchema, derivePresenceKey, describeAllUsersAuth, describeAuthConfig, describeGate, describeUserAuth, diagramAuthConfig, diffVault, effectiveClearance, encryptBytes, encryptDeterministic, estimateRecordBytes, isMoneyString, isZodSchema, listUserEnvelopeIds, loadPersistedSchema, loadPublicEnvelope, loadUserEnvelope, loadVaultPolicy, lockSchema, mergePolicy, moneyNumber, mulRate, parseBytes, persistDirectoryConfig, persistSchemaIfNeeded, persistUserVisibility, readDirectoryConfig, readPublicEnvelope, readUserVisibility, savePersistedSchema, savePublicEnvelope, saveUserEnvelope, saveVaultPolicy, scaleForCurrency, visibilityRecordId };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { b3 as NoydbStore, bF as UserEnvelope, br as PublicEnvelope, bG as GateName, bH as GatePolicy, bI as VaultPolicy, bJ as ActiveTier, bK as FactorProof, bL as SchemaUpdateStrategy, bM as TransformFn, bN as PersistedSchemaEnvelope, bO as UpdateDecision, bP as DirectoryConfig, bQ as UserVisibility, b1 as UnlockedKeyring, bw as Vault, ba as DiffEntry } from './types-
|
|
2
|
-
export { bR as AccessibleVault, bS as AffectedDocument, b7 as AppendInput, bT as ArchivePolicy, bU as ArchiveResult, bV as ArchiveRunOptions, bW as ArchiveStrategy, aP as ArrayOutputSpec, z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, bX as BUNDLE_STORE_POLICY, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, bY as BuiltInGateName, bt as BundleRecipient, a9 as CONSENT_AUDIT_COLLECTION, bZ as CacheOptions, b_ as CacheStats, b$ as CapturedBlueprint, c0 as ChangeEvent, b8 as ChangeType, ai as ClosePeriodOptions, aY as Collection, c1 as CollectionChangeEvent, c2 as CollectionConflictResolver, c3 as CollectionDescriptor, az as CollectionFrame, b9 as CollectionInstant, c4 as CollectionStats, c5 as ComputedFieldError, c6 as ComputedFields, c7 as ComputedFn, c8 as Conflict, c9 as ConflictPolicy, ca as ConflictStrategy, aa as ConsentAuditEntry, ab as ConsentAuditFilter, ac as ConsentContext, ad as ConsentOp, cb as CrossTierAccessEvent, cc as CrossVaultAggregation, cd as CrossVaultGroupedAggregation, ce as CrossVaultGroupedRow, cf as CrossVaultLiveAggregation, cg as CrossVaultLiveQuery, Y as DEFAULT_CHUNK_SIZE, ch as DEFAULT_PUBLIC_ENVELOPE_SCHEMA, ci as DELEGATIONS_COLLECTION, D as DICT_COLLECTION_PREFIX, cj as DeepPartial, ck as DeepPartialOrNull, cl as DeferredNumberingConfig, cm as DelegationToken, cn as DeleteManyResult, co as DeploymentEvent, cp as DerivationDescriptor, aN as DerivationStrategy, aR as DerivationStrategyHandle, aS as DerivedFromMeta, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, cq as DirtyEntry, cr as DryRunResult, cs as DumpSchemaOptions, ct as ELEVATION_AUDIT_COLLECTION, cu as ElevatedHandle, b5 as EncryptedEnvelope, cv as EnrollAuthenticatorOptions, cw as EnrollAuthenticatorWrappingDEKsOptions, cx as EnrollAuthenticatorWrappingKEKOptions, cy as EnrollRecoveryResult, cz as ExportCapability, cA as ExportChunk, cB as ExportFormat, cC as ExportStreamOptions, cD as FactorKind, cE as FactorProofBundle, cF as FactorRequirement, cG as FanoutQueryOptions, cH as FanoutResult, cI as FenceDoc, cJ as FenceState, cK as FieldChange, cL as FieldDescriptor, cM as FieldSource, cN as GhostRecord, cO as GrantOptions, at as GuardChange, au as GuardContext, as as GuardStrategy, aw as GuardStrategyHandle, cP as GuardViolation, cQ as HistoryConfig, cR as HistoryEntry, b4 as HistoryOptions, e as I18nMap, f as I18nTextDescriptor, g as I18nTextOptions, cS as INDEXED_STORE_POLICY, cT as ImportCapability, cU as InferOutput, cV as InternalCollectionStats, cW as IssueDelegationOptions, cX as IssueMagicLinkGrantOptions, bb as JsonPatch, bc as JsonPatchOp, cY as KeyringAuthenticator, cZ as KeyringAuthenticatorWrappingDEKs, c_ as KeyringAuthenticatorWrappingKEK, c$ as KeyringFile, L as Layer, bd as LedgerEntry, be as LedgerStore, d0 as ListAccessibleVaultsOptions, d1 as ListPageResult, d2 as ListUsersOptions, d3 as LiveQueryOptions, d4 as LiveUserEnvelope, d5 as LocaleReadOptions, d6 as Lru, d7 as LruOptions, d8 as LruStats, d9 as MAGIC_LINK_CONTENT_INFO_PREFIX, da as MAGIC_LINK_GRANTS_COLLECTION, db as MAGIC_LINK_KEK_INFO_PREFIX, dc as MagicLinkGrantPayload, dd as MagicLinkGrantRecord, bC as MaterializedFromMeta, de as MaterializedViewDescriptor, bD as MaterializedViewOutput, aV as MaterializedViewStrategy, aW as MaterializedViewStrategyHandle, df as MemoryRecipientSealer, dg as MemorySealingKeyProvider, dh as NOYDB_BACKUP_VERSION, di as NOYDB_FORMAT_VERSION, dj as NOYDB_KEYRING_VERSION, dk as NOYDB_SYNC_VERSION, dl as NextOptions, dm as Noydb, aB as NoydbBundleStore, dn as NoydbEventMap, dp as NoydbOptions, dq as NumberingAssignment, O as OnMissing, h as OnMissingPolicy, aj as OpenPeriodOptions, aT as OutputSpec, dr as OverlayViewDescriptor, aX as OverlayedViewStrategy, a_ as OverlayedViewStrategyHandle, ak as PERIODS_COLLECTION, ds as PUBLIC_ENVELOPE_FIELDS, dt as PaperRecoveryDoc, du as PaperRecoveryEntry, dv as PassphrasePolicy, dw as PassphraseValidationResult, al as PeriodRecord, dx as Permission, dy as Permissions, dz as PersistedSchemaKind, dA as PlaintextTranslatorContext, dB as PlaintextTranslatorFn, P as PolicyEnforcer, dC as PresenceHandle, dD as PresencePeer, b6 as PruneOptions, dE as PublicEnvelopeField, dF as PublicEnvelopeSchema, dG as PublicEnvelopeText, dH as PullMode, dI as PullOptions, dJ as PullPolicy, dK as PullResult, dL as PushMode, dM as PushOptions, dN as PushPolicy, dO as PushResult, dP as PutManyItemOptions, dQ as PutManyOptions, dR as PutManyResult, dS as QueryAcrossOptions, dT as QueryAcrossResult, dU as QuickUnlockState, dV as QuickUnlockStore, dW as ReAuthOperation, bv as RecipientHint, bu as RecipientSealer, aU as RecordOutputSpec, dX as RecoverPassphraseInput, dY as RecoverPassphraseResult, dZ as RecoverUserOptions, d_ as RecoveryProof, R as ResolveI18nOptions, d$ as ResolvedPublicEnvelopeSchema, aC as RetentionPolicy, e0 as RevokeOptions, b0 as Role, e1 as RotatePassphraseInput, e2 as RotateRecoveryOptions, e3 as RotateRecoveryResult, e4 as SEALED_PASSPHRASE_RECORD_ID, e5 as SchemaDelta, e6 as SchemaIntrospection, e7 as SchemaManifestRow, S as ScriptWarning, e8 as SealedEnvelope, e9 as SealedPassphrase, bs as SealingKeyProvider, ea as SequenceHandle, eb as SequenceStore, ec as SessionPolicy, ed as SetPublicEnvelopeInput, ee as ShamirRecoveryDoc, ef as ShamirRecoveryEntry, by as ShamirRecoveryProvider, eg as ShardedCollection, eh as ShardedGroupedQuery, ei as ShardedQuery, ej as ShardingConfig, ek as SkippedVault, a3 as SlotInfo, a4 as SlotRecord, el as SlotRewrapCeremony, em as SlotRewrapContext, aF as SnapshotMeta, en as StandardSchemaV1, eo as StandardSchemaV1Issue, ep as StandardSchemaV1SyncResult, eq as StateManagementVault, er as StoreAuth, es as StoreAuthKind, et as StoreCapabilities, eu as StoreTime, ev as SyncEngine, ew as SyncMetadata, ex as SyncPolicy, ey as SyncScheduler, ez as SyncSchedulerStatus, eA as SyncStatus, eB as SyncTarget, eC as SyncTargetRole, eD as SyncTransaction, eE as SyncTransactionResult, eF as TabChannel, eG as TabCoordinationOptions, eH as TabLockManager, eI as TabPresence, eJ as TabRole, eK as TierMode, eL as TranslatorAuditEntry, aJ as TxCollection, aK as TxContext, eM as TxOp, aL as TxVault, eN as USER_ENVELOPE_COLLECTION, eO as USER_ENVELOPE_MAX_BYTES, bE as UnionSource, eP as Unsubscribe, eQ as UpdateAuthenticatorOptions, eR as UpdateContext, eS as UpdateUserOptions, eT as UserApi, eU as UserEnvelopeCheckGate, eV as UserEnvelopeOversizedError, eW as UserEnvelopePresented, eX as UserInfo, eY as VaultBackup, bf as VaultEngine, aA as VaultFrame, eZ as VaultGroup, e_ as VaultGroupOptions, bg as VaultInstant, e$ as VaultPolicyOnDisk, f0 as VaultRegistryRow, f1 as VaultSchemaSnapshot, f2 as VaultSnapshot, f3 as VaultTemplate, bh as VerifyResult, a5 as VersionRecord, f4 as WarningRules, f5 as WeakPassphraseError, f6 as WeakPassphraseReason, f7 as WithArchiveOptions, f8 as WrappedDeksBlob, f9 as WriteConflict, fa as WriteEvent, fb as WriteHook, fc as WriteQueue, i as applyI18nLocale, bi as applyPatch, fd as assertStrongPassphrase, fe as buildRecipientKeyringFile, ff as burnPaperRecoveryEntry, bj as canonicalJson, bk as computePatch, x as createEnforcer, fg as createNoydb, fh as createStore, fi as deriveMagicLinkContentKey, j as dictCollectionName, k as dictKey, bl as diff, l as enforceScript, fj as enrollAuthenticator, fk as estimateEntropy, fl as evalComputedFields, fm as evaluateExportCapability, fn as evaluateImportCapability, fo as findAuthenticator, bm as formatDiff, fp as hasExportCapability, fq as hasImportCapability, fr as hasRecoveryEnrolled, bn as hashEntry, n as i18nText, o as inferScripts, p as isDictCollectionName, q as isDictKeyDescriptor, r as isI18nTextDescriptor, fs as isMagicLinkGrantExpired, ft as isPublicEnvelope, fu as issueDelegation, fv as keyringRecoverPassphrase, fw as keyringRotatePassphrase, fx as listMagicLinkGrants, fy as listUsers, fz as listUsersWithEnvelopes, fA as loadActiveDelegations, fB as loadPaperRecoveryEntries, fC as loadSealedPassphrase, fD as loadShamirRecoveryEntries, fE as magicLinkGrantRecordId, fF as mintPaperRecoveryEntry, fG as mintShamirRecoveryEntry, fH as mintWrappedDeksBlob, bo as paddedIndex, bp as parseIndex, fI as parseSealedEnvelope, fJ as readMagicLinkGrantRecord, fK as recoverUser, fL as removeAuthenticator, s as resolveI18nText, t as resolvePolicy, fM as resolvePublicEnvelopeSchema, fN as revokeDelegation, fO as revokeMagicLinkGrant, aM as runTransaction, fP as savePaperRecoveryEntries, fQ as saveSealedPassphrase, fR as saveShamirRecoveryEntries, bq as sha256Hex, fS as unwrapDeksFromBlob, fT as unwrapDeksFromPaperEntry, fU as unwrapDeksFromShamirEntry, fV as unwrapMagicLinkGrant, v as validateI18nTextValue, fW as validatePassphrase, fX as validatePublicEnvelopeInput, fY as validateSchemaInput, fZ as validateSchemaOutput, y as validateSessionPolicy, f_ as withArchive, f$ as withDeferredNumbering, g0 as writeMagicLinkGrant } from './types-
|
|
1
|
+
import { b3 as NoydbStore, bF as UserEnvelope, br as PublicEnvelope, bG as GateName, bH as GatePolicy, bI as VaultPolicy, bJ as ActiveTier, bK as FactorProof, bL as SchemaUpdateStrategy, bM as TransformFn, bN as PersistedSchemaEnvelope, bO as UpdateDecision, bP as DirectoryConfig, bQ as UserVisibility, b1 as UnlockedKeyring, bw as Vault, ba as DiffEntry } from './types-4t1-tWS4.js';
|
|
2
|
+
export { bR as AccessibleVault, bS as AffectedDocument, b7 as AppendInput, bT as ArchivePolicy, bU as ArchiveResult, bV as ArchiveRunOptions, bW as ArchiveStrategy, aP as ArrayOutputSpec, z as BLOB_CHUNKS_COLLECTION, A as BLOB_COLLECTION, E as BLOB_INDEX_COLLECTION, F as BLOB_SLOTS_PREFIX, G as BLOB_VERSIONS_PREFIX, bX as BUNDLE_STORE_POLICY, M as BlobObject, N as BlobPutOptions, Q as BlobResponseOptions, T as BlobSet, bY as BuiltInGateName, bt as BundleRecipient, a9 as CONSENT_AUDIT_COLLECTION, bZ as CacheOptions, b_ as CacheStats, b$ as CapturedBlueprint, c0 as ChangeEvent, b8 as ChangeType, ai as ClosePeriodOptions, aY as Collection, c1 as CollectionChangeEvent, c2 as CollectionConflictResolver, c3 as CollectionDescriptor, az as CollectionFrame, b9 as CollectionInstant, c4 as CollectionStats, c5 as ComputedFieldError, c6 as ComputedFields, c7 as ComputedFn, c8 as Conflict, c9 as ConflictPolicy, ca as ConflictStrategy, aa as ConsentAuditEntry, ab as ConsentAuditFilter, ac as ConsentContext, ad as ConsentOp, cb as CrossTierAccessEvent, cc as CrossVaultAggregation, cd as CrossVaultGroupedAggregation, ce as CrossVaultGroupedRow, cf as CrossVaultLiveAggregation, cg as CrossVaultLiveQuery, Y as DEFAULT_CHUNK_SIZE, ch as DEFAULT_PUBLIC_ENVELOPE_SCHEMA, ci as DELEGATIONS_COLLECTION, D as DICT_COLLECTION_PREFIX, cj as DeepPartial, ck as DeepPartialOrNull, cl as DeferredNumberingConfig, cm as DelegationToken, cn as DeleteManyResult, co as DeploymentEvent, cp as DerivationDescriptor, aN as DerivationStrategy, aR as DerivationStrategyHandle, aS as DerivedFromMeta, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, cq as DirtyEntry, cr as DryRunResult, cs as DumpSchemaOptions, ct as ELEVATION_AUDIT_COLLECTION, cu as ElevatedHandle, b5 as EncryptedEnvelope, cv as EnrollAuthenticatorOptions, cw as EnrollAuthenticatorWrappingDEKsOptions, cx as EnrollAuthenticatorWrappingKEKOptions, cy as EnrollRecoveryResult, cz as ExportCapability, cA as ExportChunk, cB as ExportFormat, cC as ExportStreamOptions, cD as FactorKind, cE as FactorProofBundle, cF as FactorRequirement, cG as FanoutQueryOptions, cH as FanoutResult, cI as FenceDoc, cJ as FenceState, cK as FieldChange, cL as FieldDescriptor, cM as FieldSource, cN as GhostRecord, cO as GrantOptions, at as GuardChange, au as GuardContext, as as GuardStrategy, aw as GuardStrategyHandle, cP as GuardViolation, cQ as HistoryConfig, cR as HistoryEntry, b4 as HistoryOptions, e as I18nMap, f as I18nTextDescriptor, g as I18nTextOptions, cS as INDEXED_STORE_POLICY, cT as ImportCapability, cU as InferOutput, cV as InternalCollectionStats, cW as IssueDelegationOptions, cX as IssueMagicLinkGrantOptions, bb as JsonPatch, bc as JsonPatchOp, cY as KeyringAuthenticator, cZ as KeyringAuthenticatorWrappingDEKs, c_ as KeyringAuthenticatorWrappingKEK, c$ as KeyringFile, L as Layer, bd as LedgerEntry, be as LedgerStore, d0 as ListAccessibleVaultsOptions, d1 as ListPageResult, d2 as ListUsersOptions, d3 as LiveQueryOptions, d4 as LiveUserEnvelope, d5 as LocaleReadOptions, d6 as Lru, d7 as LruOptions, d8 as LruStats, d9 as MAGIC_LINK_CONTENT_INFO_PREFIX, da as MAGIC_LINK_GRANTS_COLLECTION, db as MAGIC_LINK_KEK_INFO_PREFIX, dc as MagicLinkGrantPayload, dd as MagicLinkGrantRecord, bC as MaterializedFromMeta, de as MaterializedViewDescriptor, bD as MaterializedViewOutput, aV as MaterializedViewStrategy, aW as MaterializedViewStrategyHandle, df as MemoryRecipientSealer, dg as MemorySealingKeyProvider, dh as NOYDB_BACKUP_VERSION, di as NOYDB_FORMAT_VERSION, dj as NOYDB_KEYRING_VERSION, dk as NOYDB_SYNC_VERSION, dl as NextOptions, dm as Noydb, aB as NoydbBundleStore, dn as NoydbEventMap, dp as NoydbOptions, dq as NumberingAssignment, O as OnMissing, h as OnMissingPolicy, aj as OpenPeriodOptions, aT as OutputSpec, dr as OverlayViewDescriptor, aX as OverlayedViewStrategy, a_ as OverlayedViewStrategyHandle, ak as PERIODS_COLLECTION, ds as PUBLIC_ENVELOPE_FIELDS, dt as PaperRecoveryDoc, du as PaperRecoveryEntry, dv as PassphrasePolicy, dw as PassphraseValidationResult, al as PeriodRecord, dx as Permission, dy as Permissions, dz as PersistedSchemaKind, dA as PlaintextTranslatorContext, dB as PlaintextTranslatorFn, P as PolicyEnforcer, dC as PresenceHandle, dD as PresencePeer, b6 as PruneOptions, dE as PublicEnvelopeField, dF as PublicEnvelopeSchema, dG as PublicEnvelopeText, dH as PullMode, dI as PullOptions, dJ as PullPolicy, dK as PullResult, dL as PushMode, dM as PushOptions, dN as PushPolicy, dO as PushResult, dP as PutManyItemOptions, dQ as PutManyOptions, dR as PutManyResult, dS as QueryAcrossOptions, dT as QueryAcrossResult, dU as QuickUnlockState, dV as QuickUnlockStore, dW as ReAuthOperation, bv as RecipientHint, bu as RecipientSealer, aU as RecordOutputSpec, dX as RecoverPassphraseInput, dY as RecoverPassphraseResult, dZ as RecoverUserOptions, d_ as RecoveryProof, R as ResolveI18nOptions, d$ as ResolvedPublicEnvelopeSchema, aC as RetentionPolicy, e0 as RevokeOptions, b0 as Role, e1 as RotatePassphraseInput, e2 as RotateRecoveryOptions, e3 as RotateRecoveryResult, e4 as SEALED_PASSPHRASE_RECORD_ID, e5 as SchemaDelta, e6 as SchemaIntrospection, e7 as SchemaManifestRow, S as ScriptWarning, e8 as SealedEnvelope, e9 as SealedPassphrase, bs as SealingKeyProvider, ea as SequenceHandle, eb as SequenceStore, ec as SessionPolicy, ed as SetPublicEnvelopeInput, ee as ShamirRecoveryDoc, ef as ShamirRecoveryEntry, by as ShamirRecoveryProvider, eg as ShardedCollection, eh as ShardedGroupedQuery, ei as ShardedQuery, ej as ShardingConfig, ek as SkippedVault, a3 as SlotInfo, a4 as SlotRecord, el as SlotRewrapCeremony, em as SlotRewrapContext, aF as SnapshotMeta, en as StandardSchemaV1, eo as StandardSchemaV1Issue, ep as StandardSchemaV1SyncResult, eq as StateManagementVault, er as StoreAuth, es as StoreAuthKind, et as StoreCapabilities, eu as StoreTime, ev as SyncEngine, ew as SyncMetadata, ex as SyncPolicy, ey as SyncScheduler, ez as SyncSchedulerStatus, eA as SyncStatus, eB as SyncTarget, eC as SyncTargetRole, eD as SyncTransaction, eE as SyncTransactionResult, eF as TabChannel, eG as TabCoordinationOptions, eH as TabLockManager, eI as TabPresence, eJ as TabRole, eK as TierMode, eL as TranslatorAuditEntry, aJ as TxCollection, aK as TxContext, eM as TxOp, aL as TxVault, eN as USER_ENVELOPE_COLLECTION, eO as USER_ENVELOPE_MAX_BYTES, bE as UnionSource, eP as Unsubscribe, eQ as UpdateAuthenticatorOptions, eR as UpdateContext, eS as UpdateUserOptions, eT as UserApi, eU as UserEnvelopeCheckGate, eV as UserEnvelopeOversizedError, eW as UserEnvelopePresented, eX as UserInfo, eY as VaultBackup, bf as VaultEngine, aA as VaultFrame, eZ as VaultGroup, e_ as VaultGroupOptions, bg as VaultInstant, e$ as VaultPolicyOnDisk, f0 as VaultRegistryRow, f1 as VaultSchemaSnapshot, f2 as VaultSnapshot, f3 as VaultTemplate, bh as VerifyResult, a5 as VersionRecord, f4 as WarningRules, f5 as WeakPassphraseError, f6 as WeakPassphraseReason, f7 as WithArchiveOptions, f8 as WrappedDeksBlob, f9 as WriteConflict, fa as WriteEvent, fb as WriteHook, fc as WriteQueue, i as applyI18nLocale, bi as applyPatch, fd as assertStrongPassphrase, fe as buildRecipientKeyringFile, ff as burnPaperRecoveryEntry, bj as canonicalJson, bk as computePatch, x as createEnforcer, fg as createNoydb, fh as createStore, fi as deriveMagicLinkContentKey, j as dictCollectionName, k as dictKey, bl as diff, l as enforceScript, fj as enrollAuthenticator, fk as estimateEntropy, fl as evalComputedFields, fm as evaluateExportCapability, fn as evaluateImportCapability, fo as findAuthenticator, bm as formatDiff, fp as hasExportCapability, fq as hasImportCapability, fr as hasRecoveryEnrolled, bn as hashEntry, n as i18nText, o as inferScripts, p as isDictCollectionName, q as isDictKeyDescriptor, r as isI18nTextDescriptor, fs as isMagicLinkGrantExpired, ft as isPublicEnvelope, fu as issueDelegation, fv as keyringRecoverPassphrase, fw as keyringRotatePassphrase, fx as listMagicLinkGrants, fy as listUsers, fz as listUsersWithEnvelopes, fA as loadActiveDelegations, fB as loadPaperRecoveryEntries, fC as loadSealedPassphrase, fD as loadShamirRecoveryEntries, fE as magicLinkGrantRecordId, fF as mintPaperRecoveryEntry, fG as mintShamirRecoveryEntry, fH as mintWrappedDeksBlob, bo as paddedIndex, bp as parseIndex, fI as parseSealedEnvelope, fJ as readMagicLinkGrantRecord, fK as recoverUser, fL as removeAuthenticator, s as resolveI18nText, t as resolvePolicy, fM as resolvePublicEnvelopeSchema, fN as revokeDelegation, fO as revokeMagicLinkGrant, aM as runTransaction, fP as savePaperRecoveryEntries, fQ as saveSealedPassphrase, fR as saveShamirRecoveryEntries, bq as sha256Hex, fS as unwrapDeksFromBlob, fT as unwrapDeksFromPaperEntry, fU as unwrapDeksFromShamirEntry, fV as unwrapMagicLinkGrant, v as validateI18nTextValue, fW as validatePassphrase, fX as validatePublicEnvelopeInput, fY as validateSchemaInput, fZ as validateSchemaOutput, y as validateSessionPolicy, f_ as withArchive, f$ as withDeferredNumbering, g0 as writeMagicLinkGrant } from './types-4t1-tWS4.js';
|
|
3
3
|
export { d as detectMagic, a as detectMimeType, i as isPreCompressed } from './mime-magic-CBBSOkjm.js';
|
|
4
4
|
export { AgeRoute, BlobLifecyclePolicy, BlobStoreRoute, CircuitBreakerOptions, HealthCheckOptions, LogLevel, LoggingOptions, MetricsOptions, OverrideOptions, OverrideTarget, RetryOptions, RouteStatus, RouteStoreOptions, RoutedNoydbStore, StoreCacheOptions, StoreMiddleware, StoreOperation, SuspendOptions, WrapBundleStoreOptions, WrappedBundleNoydbStore, createBundleStore, routeStore, withCache, withCircuitBreaker, withHealthCheck, withLogging, withMetrics, withRetry, wrapBundleStore, wrapStore } from './store/index.js';
|
|
5
|
-
import { a7 as NoydbError } from './strategy-
|
|
6
|
-
export { e as AggregateResult, f as AggregateSpec, g as Aggregation, h as AggregationUpstream,
|
|
7
|
-
export { D as DEFAULT_CROSS_JOIN_MAX_ROWS, a as DEFAULT_JOIN_MAX_ROWS, J as JoinContext, b as JoinLeg, c as JoinStrategy, d as JoinableSource, L as LiveQuery, e as LiveUpstream, O as OrderBy, Q as Query, f as QueryPlan, g as QuerySource, R as RefDescriptor, h as RefIntegrityError, i as RefMode, j as RefRegistry, k as RefScopeError, l as RefViolation, S as ScanBuilder, m as ScanPageProvider, n as applyJoins, o as buildLiveQuery, p as executePlan, r as ref, q as resetJoinWarnings } from './index-
|
|
8
|
-
export { A as AutoCredential, n as AutoCredentialKind, c as CompressionAlgo, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, j as generateULID, o as hasNoydbBundleMagic, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, p as readNoydbBundlePublicEnvelope, m as resetBrotliSupportCache, w as writeNoydbBundle } from './ulid-
|
|
5
|
+
import { a7 as NoydbError, a8 as RoundingMode } from './strategy-CbneC7bS.js';
|
|
6
|
+
export { e as AggregateResult, f as AggregateSpec, g as Aggregation, h as AggregationUpstream, a9 as AlreadyElevatedError, B as AmendmentForbiddenError, W as AttestationError, Y as BackupCorruptedError, Z as BackupLedgerError, _ as BundleIntegrityError, $ as BundleSealMismatchError, a0 as BundleVersionConflictError, aa as ConflictError, ab as CrossJoinSourceUnknownError, ac as CrossJoinTooLargeError, ad as DanglingReferenceError, ae as DecryptionError, af as DelegationTargetMissingError, H as DerivationCapExceededError, J as DerivationCycleError, K as DerivationDepthError, N as DerivationOutputShapeError, O as DerivationOutputUnknownError, D as DictKeyInUseError, a as DictKeyMissingError, ag as DirectoryDisabledError, ah as ElevationExpiredError, ai as ExportCapabilityError, F as FieldFrozenError, aj as FilenameSanitizationError, G as GROUPBY_MAX_CARDINALITY, i as GROUPBY_WARN_CARDINALITY, ak as GroupCardinalityError, j as GroupedAggregation, k as GroupedQuery, l as GroupedQueryN, m as GroupedRow, n as GroupedRowN, al as ImportCapabilityError, am as IndexRequiredError, an as IndexWriteFailureError, ao as InvalidKeyError, I as InvariantError, ap as JoinTooLargeError, aq as KeyringCorruptError, ar as KeyringExpiredError, as as LedgerContentionError, o as LiveAggregation, L as LocaleNotSpecifiedError, a3 as MaterializedViewConfigError, a4 as MaterializedViewCycleError, a5 as MaterializedViewSourceUnknownError, a6 as MaterializedViewTooLargeError, at as MigrationRequiredError, M as MissingTranslationError, au as MoneyCurrencyError, av as MoneyDescriptor, aw as MoneyOptions, ax as MoneyOptionsFixed, ay as MoneyOptionsMulti, az as MoneyPrecisionError, aA as MoneyUnsupportedError, aB as NetworkError, aC as NoAccessError, aD as NonAdditiveSchemaChangeError, aE as NotFoundError, aF as NumberingUncertaintyError, P as OverlayBaseIsVirtualError, Q as OverlayCollectionUnavailableError, U as OverlayIdMismatchError, V as OverlayNameCollisionError, aG as PathEscapeError, aH as PeriodClosedError, aI as PermissionDeniedError, aJ as PrivilegeEscalationError, aK as QuiesceTimeoutError, aL as ReadOnlyAtInstantError, aM as ReadOnlyError, aN as ReadOnlyFrameError, C as RecordLockedError, p as Reducer, q as ReducerOptions, R as ReservedCollectionNameError, aO as ReservedVaultNameError, aP as SchemaFenceError, aQ as SchemaLockedError, aR as SchemaUpdateError, aS as SchemaValidationError, S as ScriptViolationError, aT as SequenceContentionError, aU as SequenceOfflineError, b as SessionExpiredError, c as SessionNotFoundError, d as SessionPolicyError, aV as ShardProvisioningError, E as SnapshotNotFoundError, aW as StoreCapabilityError, aX as TamperedError, aY as TierDemoteDeniedError, aZ as TierNotGrantedError, T as TranslatorNotConfiguredError, a_ as UniqueConstraintError, a$ as UnknownShardError, b0 as UnsupportedIndexOptionError, b1 as ValidationError, b2 as VaultTemplateNotFoundError, r as avg, t as count, u as groupAndReduce, b3 as isMoneyDescriptor, v as max, w as min, b4 as money, x as reduceRecords, z as sum } from './strategy-CbneC7bS.js';
|
|
7
|
+
export { D as DEFAULT_CROSS_JOIN_MAX_ROWS, a as DEFAULT_JOIN_MAX_ROWS, J as JoinContext, b as JoinLeg, c as JoinStrategy, d as JoinableSource, L as LiveQuery, e as LiveUpstream, O as OrderBy, Q as Query, f as QueryPlan, g as QuerySource, R as RefDescriptor, h as RefIntegrityError, i as RefMode, j as RefRegistry, k as RefScopeError, l as RefViolation, S as ScanBuilder, m as ScanPageProvider, n as applyJoins, o as buildLiveQuery, p as executePlan, r as ref, q as resetJoinWarnings } from './index-XNB2r6bX.js';
|
|
8
|
+
export { A as AutoCredential, n as AutoCredentialKind, c as CompressionAlgo, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, j as generateULID, o as hasNoydbBundleMagic, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, p as readNoydbBundlePublicEnvelope, m as resetBrotliSupportCache, w as writeNoydbBundle } from './ulid-DAfenvFd.js';
|
|
9
9
|
export { a as CrdtMode, b as CrdtState, L as LwwMapState, R as RgaState, Y as YjsState, m as mergeCrdtStates, r as resolveCrdtSnapshot } from './strategy-BSxFXGzb.js';
|
|
10
|
-
export { I as ImmutableGuardConfig, i as immutableGuard, w as withGuard } from './immutable-guard-
|
|
11
|
-
export { w as withDerivation } from './with-derivation-
|
|
12
|
-
export { w as withMaterializedView } from './with-materialized-view-
|
|
13
|
-
export { a as Clause, C as CollectionIndexes, F as FieldClause, b as FilterClause, G as GroupClause, H as HashIndex, I as IndexDef, O as Operator, e as evaluateClause, c as evaluateFieldClause, r as readPath } from './predicate-
|
|
14
|
-
export { w as withOverlayedView } from './with-overlayed-view-
|
|
10
|
+
export { I as ImmutableGuardConfig, i as immutableGuard, w as withGuard } from './immutable-guard-BehB1YGB.js';
|
|
11
|
+
export { w as withDerivation } from './with-derivation-OK9M2sJE.js';
|
|
12
|
+
export { w as withMaterializedView } from './with-materialized-view-Dt-ufPWQ.js';
|
|
13
|
+
export { a as Clause, C as CollectionIndexes, F as FieldClause, b as FilterClause, G as GroupClause, H as HashIndex, I as IndexDef, O as Operator, e as evaluateClause, c as evaluateFieldClause, r as readPath } from './predicate-BmhBSPCH.js';
|
|
14
|
+
export { w as withOverlayedView } from './with-overlayed-view-eDvMs6LO.js';
|
|
15
15
|
export { SYNC_CREDENTIALS_COLLECTION, SyncCredential, credentialStatus, deleteCredential, getCredential, listCredentials, putCredential } from './team/index.js';
|
|
16
|
-
export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from './dev-unlock-
|
|
16
|
+
export { C as CreateSessionOptions, a as CreateSessionResult, D as DevUnlockOptions, S as SessionToken, b as activeSessionCount, c as clearDevUnlock, d as createSession, e as enableDevUnlock, i as isDevUnlockActive, f as isSessionAlive, l as loadDevUnlock, r as resolveSession, g as revokeAllSessions, h as revokeSession } from './dev-unlock-iAS8z9jc.js';
|
|
17
17
|
export { i as isDiscriminant } from './discriminant-BN9REW3o.js';
|
|
18
|
-
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from './hash-
|
|
19
|
-
import './lazy-builder-
|
|
18
|
+
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from './hash-DHOnRarj.js';
|
|
19
|
+
import './lazy-builder-ChSqcF5t.js';
|
|
20
20
|
import '@noy-db/attestation';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -662,6 +662,136 @@ declare function scaleForCurrency(code: string): number | null;
|
|
|
662
662
|
|
|
663
663
|
type FxRates = Record<string, number | string>;
|
|
664
664
|
|
|
665
|
+
/**
|
|
666
|
+
* Exact money arithmetic helpers (#337) — `mulRate` and `allocate`.
|
|
667
|
+
*
|
|
668
|
+
* Both operate on the canonical decoded string form that `get()`
|
|
669
|
+
* returns (`'10000.00'`), entirely in scaled-`BigInt` space — no
|
|
670
|
+
* floating-point step anywhere, exact past 2^53. They are pure
|
|
671
|
+
* functions with no vault or descriptor dependency: the working scale
|
|
672
|
+
* is inferred from the amount's fractional digits (a canonical money
|
|
673
|
+
* string always carries exactly the field's scale) or pinned with
|
|
674
|
+
* `opts.scale`.
|
|
675
|
+
*
|
|
676
|
+
* Why these two: app-side invariants of the form
|
|
677
|
+
* `Σ parts === whole` (receipt totals, net-zero WHT pairs, proration)
|
|
678
|
+
* carry ±0.01 tolerances ONLY because the math is major-unit floats +
|
|
679
|
+
* round2. `mulRate` (VAT-style rate application with explicit
|
|
680
|
+
* rounding) and `allocate` (largest-remainder split — parts sum to the
|
|
681
|
+
* input EXACTLY, by construction) make those tolerances zero.
|
|
682
|
+
*/
|
|
683
|
+
|
|
684
|
+
interface MulRateOptions {
|
|
685
|
+
/**
|
|
686
|
+
* Output scale (fraction digits). Defaults to the amount's own
|
|
687
|
+
* fractional digits — for a canonical money string that IS the
|
|
688
|
+
* field's scale.
|
|
689
|
+
*/
|
|
690
|
+
readonly scale?: number;
|
|
691
|
+
/** Rounding for the final re-scale. Default `'half-up'`. */
|
|
692
|
+
readonly rounding?: RoundingMode;
|
|
693
|
+
}
|
|
694
|
+
interface AllocateOptions {
|
|
695
|
+
/** Working scale. Defaults to the amount's own fractional digits. */
|
|
696
|
+
readonly scale?: number;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Multiply a money amount by a decimal rate, exactly.
|
|
700
|
+
*
|
|
701
|
+
* The rate is parsed at its OWN full precision (`0.07` → `7` at scale
|
|
702
|
+
* 2), the product computed in `BigInt` at `amountScale + rateScale`,
|
|
703
|
+
* then re-scaled back to the output scale with the requested rounding —
|
|
704
|
+
* one rounding step, at the very end.
|
|
705
|
+
*
|
|
706
|
+
* ```ts
|
|
707
|
+
* mulRate('10000.00', 0.07) // '700.00' (VAT)
|
|
708
|
+
* mulRate('33.33', '0.07') // '2.33' (half-up)
|
|
709
|
+
* mulRate('33.33', 0.07, { rounding: 'floor' }) // '2.33'
|
|
710
|
+
* mulRate(100, 0.07, { scale: 2 }) // '7.00'
|
|
711
|
+
* ```
|
|
712
|
+
*/
|
|
713
|
+
declare function mulRate(amount: number | string, rate: number | string, opts?: MulRateOptions): string;
|
|
714
|
+
/**
|
|
715
|
+
* Split a money amount across weighted buckets with ZERO drift: the
|
|
716
|
+
* returned parts sum to the input exactly, by construction
|
|
717
|
+
* (largest-remainder method).
|
|
718
|
+
*
|
|
719
|
+
* Each bucket gets `floor(amount × weightᵢ / Σweights)`; the leftover
|
|
720
|
+
* minor units (always fewer than the bucket count) go one each to the
|
|
721
|
+
* buckets with the largest truncated remainders — ties broken by
|
|
722
|
+
* position, earlier bucket first. Weights are parsed as exact decimals
|
|
723
|
+
* (no float division anywhere); they must be non-negative with a
|
|
724
|
+
* positive sum.
|
|
725
|
+
*
|
|
726
|
+
* ```ts
|
|
727
|
+
* allocate('100.00', [1, 1, 1]) // ['33.34', '33.33', '33.33']
|
|
728
|
+
* allocate('0.05', [3, 7]) // ['0.02', '0.03']
|
|
729
|
+
* allocate('-100.00', [1, 1, 1]) // ['-33.34', '-33.33', '-33.33']
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
declare function allocate(amount: number | string, weights: ReadonlyArray<number | string>, opts?: AllocateOptions): string[];
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Branded money output type (#338).
|
|
736
|
+
*
|
|
737
|
+
* The decoded read shape of a money field is an exact decimal STRING
|
|
738
|
+
* (`'10000.00'`) — but a hand-written schema types it `string | number`,
|
|
739
|
+
* which is honest about the input side and unhelpful on the output
|
|
740
|
+
* side: every read site hand-coerces, and a missed coercion passes
|
|
741
|
+
* typecheck silently (then surfaces as a runtime template warning, or
|
|
742
|
+
* worse, as `'10000.00' * 100` arithmetic).
|
|
743
|
+
*
|
|
744
|
+
* {@link MoneyString} is the output-side brand: a `string` that has
|
|
745
|
+
* been through noy-db's decode (or {@link asMoney}'s guard). Branding
|
|
746
|
+
* is type-level only — zero runtime cost on the read path.
|
|
747
|
+
*
|
|
748
|
+
* ## Wiring the brand through a validator (the input/output asymmetry)
|
|
749
|
+
*
|
|
750
|
+
* Keep the permissive `string | number` on the INPUT side so write
|
|
751
|
+
* sites are untouched, and brand the OUTPUT side. With Zod:
|
|
752
|
+
*
|
|
753
|
+
* ```ts
|
|
754
|
+
* import type { MoneyString } from '@noy-db/hub'
|
|
755
|
+
*
|
|
756
|
+
* const moneyValue = z.union([z.number(), z.string()]) as unknown as
|
|
757
|
+
* z.ZodType<MoneyString, z.ZodTypeDef, string | number>
|
|
758
|
+
*
|
|
759
|
+
* const Invoice = z.object({ id: z.string(), total: moneyValue })
|
|
760
|
+
* type InvoiceOut = z.output<typeof Invoice> // total: MoneyString
|
|
761
|
+
* type InvoiceIn = z.input<typeof Invoice> // total: string | number
|
|
762
|
+
* ```
|
|
763
|
+
*
|
|
764
|
+
* The cast is sound for fields declared in `moneyFields`: reads pass
|
|
765
|
+
* through `decodeMoneyFields`, which always produces the canonical
|
|
766
|
+
* decimal string.
|
|
767
|
+
*/
|
|
768
|
+
declare const MONEY_BRAND: unique symbol;
|
|
769
|
+
/**
|
|
770
|
+
* An exact decimal string produced by noy-db's money decode
|
|
771
|
+
* (`'10000.00'`). The brand exists only at the type level — at runtime
|
|
772
|
+
* a `MoneyString` is a plain string.
|
|
773
|
+
*/
|
|
774
|
+
type MoneyString = string & {
|
|
775
|
+
readonly [MONEY_BRAND]: true;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Runtime-guarded cast to {@link MoneyString}. Accepts a decimal string
|
|
779
|
+
* or a number, returns the canonical decimal string branded — throws
|
|
780
|
+
* `MoneyUnsupportedError` on anything non-finite / non-decimal. Use at
|
|
781
|
+
* trust boundaries (deserialized JSON, route params); values read
|
|
782
|
+
* through `get()`/`list()` are already canonical.
|
|
783
|
+
*/
|
|
784
|
+
declare function asMoney(value: string | number): MoneyString;
|
|
785
|
+
/** Type guard: is `value` a decimal string acceptable as money? */
|
|
786
|
+
declare function isMoneyString(value: unknown): value is MoneyString;
|
|
787
|
+
/**
|
|
788
|
+
* The ONE sanctioned escape hatch to a JS `number` — explicit because
|
|
789
|
+
* the conversion is lossy past 2^53. For display math and chart axes;
|
|
790
|
+
* never feed the result back into stored amounts (use `mulRate` /
|
|
791
|
+
* `allocate` for exact arithmetic).
|
|
792
|
+
*/
|
|
793
|
+
declare function moneyNumber(value: MoneyString | string | number): number;
|
|
794
|
+
|
|
665
795
|
/**
|
|
666
796
|
* Hierarchical access — tier-aware keyring helpers.
|
|
667
797
|
*
|
|
@@ -816,4 +946,4 @@ type DiffCandidate<T = unknown> = Vault | Record<string, readonly T[]> | string;
|
|
|
816
946
|
*/
|
|
817
947
|
declare function diffVault<T = unknown>(vault: Vault, candidate: DiffCandidate<T>, options?: DiffOptions): Promise<VaultDiff<T>>;
|
|
818
948
|
|
|
819
|
-
export { ActiveTier, type CheckGateContext, DEFAULT_FRESHNESS_MS, DIRECTORY_RECORD_ID, type DiffCandidate, DiffEntry, type DiffOptions, DirectoryConfig, FactorProof, type FxRates, GateName, GatePolicy, META_COLLECTION, ManagedRecoveryNotEnrolledError, NoydbError, NoydbStore, PERSONAL_POLICY, POLICY_RECORD_ID, PUBLIC_ENVELOPE_RECORD_ID, type PersistSchemaResult, PersistedSchemaEnvelope, PolicyDeniedError, type PolicyDenyReason, PublicEnvelope, RecoveryNotEnrolledError, RecoveryProfileNotImplementedError, SCHEMAS_COLLECTION, STATE_VAULT_NAME, STRICT_POLICY, SchemaUpdateStrategy, UnlockedKeyring, UpdateDecision, UserEnvelope, UserVisibility, VISIBILITY_RECORD_PREFIX, Vault, type VaultDiff, type VaultDiffEntry, type VaultDiffModifiedEntry, VaultPolicy, additiveOnly, assertTierAccess, base64ToBuffer, blindUpdate, bufferToBase64, checkGate, coordinatedCutover, decryptBytes, decryptDeterministic, dekKey, deleteUserEnvelope, deleteUserVisibility, derivePersistedSchema, derivePresenceKey, describeAllUsersAuth, describeAuthConfig, describeGate, describeUserAuth, diagramAuthConfig, diffVault, effectiveClearance, encryptBytes, encryptDeterministic, estimateRecordBytes, isZodSchema, listUserEnvelopeIds, loadPersistedSchema, loadPublicEnvelope, loadUserEnvelope, loadVaultPolicy, lockSchema, mergePolicy, parseBytes, persistDirectoryConfig, persistSchemaIfNeeded, persistUserVisibility, readDirectoryConfig, readPublicEnvelope, readUserVisibility, savePersistedSchema, savePublicEnvelope, saveUserEnvelope, saveVaultPolicy, scaleForCurrency, visibilityRecordId };
|
|
949
|
+
export { ActiveTier, type AllocateOptions, type CheckGateContext, DEFAULT_FRESHNESS_MS, DIRECTORY_RECORD_ID, type DiffCandidate, DiffEntry, type DiffOptions, DirectoryConfig, FactorProof, type FxRates, GateName, GatePolicy, META_COLLECTION, ManagedRecoveryNotEnrolledError, type MoneyString, type MulRateOptions, NoydbError, NoydbStore, PERSONAL_POLICY, POLICY_RECORD_ID, PUBLIC_ENVELOPE_RECORD_ID, type PersistSchemaResult, PersistedSchemaEnvelope, PolicyDeniedError, type PolicyDenyReason, PublicEnvelope, RecoveryNotEnrolledError, RecoveryProfileNotImplementedError, RoundingMode, SCHEMAS_COLLECTION, STATE_VAULT_NAME, STRICT_POLICY, SchemaUpdateStrategy, UnlockedKeyring, UpdateDecision, UserEnvelope, UserVisibility, VISIBILITY_RECORD_PREFIX, Vault, type VaultDiff, type VaultDiffEntry, type VaultDiffModifiedEntry, VaultPolicy, additiveOnly, allocate, asMoney, assertTierAccess, base64ToBuffer, blindUpdate, bufferToBase64, checkGate, coordinatedCutover, decryptBytes, decryptDeterministic, dekKey, deleteUserEnvelope, deleteUserVisibility, derivePersistedSchema, derivePresenceKey, describeAllUsersAuth, describeAuthConfig, describeGate, describeUserAuth, diagramAuthConfig, diffVault, effectiveClearance, encryptBytes, encryptDeterministic, estimateRecordBytes, isMoneyString, isZodSchema, listUserEnvelopeIds, loadPersistedSchema, loadPublicEnvelope, loadUserEnvelope, loadVaultPolicy, lockSchema, mergePolicy, moneyNumber, mulRate, parseBytes, persistDirectoryConfig, persistSchemaIfNeeded, persistUserVisibility, readDirectoryConfig, readPublicEnvelope, readUserVisibility, savePersistedSchema, savePublicEnvelope, saveUserEnvelope, saveVaultPolicy, scaleForCurrency, visibilityRecordId };
|