@xyo-network/archivist-model 4.1.7 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,9 @@ export interface AllArchivistFunctions<TReadResponse, TSnapshotResponse> {
5
5
  all(): PromisableArray<TReadResponse>;
6
6
  snapshot(): PromisableArray<TSnapshotResponse>;
7
7
  }
8
- export interface ReadArchivistFunctions<TReadResponse, TId = string> {
8
+ export interface ReadArchivistFunctions<TReadResponse, TId = string, TCursor = TId> {
9
9
  get(ids: TId[]): PromisableArray<TReadResponse>;
10
- next(options?: NextOptions<TId>): PromisableArray<TReadResponse>;
10
+ next(options?: NextOptions<TCursor>): PromisableArray<TReadResponse>;
11
11
  }
12
12
  export interface WriteArchivistFunctions<TReadResponse, TWriteResponse = TReadResponse, TWrite = TReadResponse, TId = string> {
13
13
  clear(): Promisable<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"ArchivistFunctions.d.ts","sourceRoot":"","sources":["../../src/ArchivistFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,WAAW,qBAAqB,CAAC,aAAa,EAAE,iBAAiB;IACrE,+CAA+C;IAC/C,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAA;IACrC,QAAQ,IAAI,eAAe,CAAC,iBAAiB,CAAC,CAAA;CAC/C;AAED,MAAM,WAAW,sBAAsB,CAAC,aAAa,EAAE,GAAG,GAAG,MAAM;IACjE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,eAAe,CAAC,aAAa,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,aAAa,CAAC,CAAA;CACjE;AAED,MAAM,WAAW,uBAAuB,C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,GAAG,EAAE,GAAG,eAAe,CAAC,aAAa,CAAC,CAAA;IAClD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,cAAc,CAAC,CAAA;CACxD;AAED,MAAM,WAAW,uBAAuB,CAAC,cAAc;IACrD,MAAM,IAAI,eAAe,CAAC,cAAc,CAAC,CAAA;CAC1C"}
@@ -1,7 +1,7 @@
1
1
  import type { Hash } from '@xylabs/hex';
2
2
  import type { ModuleQueryFunctions } from '@xyo-network/module-model';
3
- import type { Payload } from '@xyo-network/payload-model';
3
+ import type { Payload, Sequence } from '@xyo-network/payload-model';
4
4
  import type { Archivist } from './PayloadArchivist.ts';
5
- export interface ArchivistModule<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = Payload, TWrite extends Payload = TReadResponse & Payload, TId extends string = Hash> extends Archivist<TReadResponse, TWriteResponse, TWrite, TId>, ModuleQueryFunctions {
5
+ export interface ArchivistModule<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = Payload, TWrite extends Payload = TReadResponse & Payload, TId extends string = Hash, TCursor extends string = Sequence> extends Archivist<TReadResponse, TWriteResponse, TWrite, TId, TCursor>, ModuleQueryFunctions {
6
6
  }
7
7
  //# sourceMappingURL=Module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../../src/Module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,WAAW,eAAe,CAC9B,aAAa,SAAS,OAAO,GAAG,OAAO,EACvC,cAAc,SAAS,OAAO,GAAG,OAAO,EACxC,MAAM,SAAS,OAAO,GAAG,aAAa,GAAG,OAAO,EAChD,GAAG,SAAS,MAAM,GAAG,IAAI,CACzB,SAAQ,SAAS,CAAC,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,CAAC,EAC7D,oBAAoB;CAAG"}
1
+ {"version":3,"file":"Module.d.ts","sourceRoot":"","sources":["../../src/Module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,WAAW,eAAe,CAC9B,aAAa,SAAS,OAAO,GAAG,OAAO,EACvC,cAAc,SAAS,OAAO,GAAG,OAAO,EACxC,MAAM,SAAS,OAAO,GAAG,aAAa,GAAG,OAAO,EAChD,GAAG,SAAS,MAAM,GAAG,IAAI,EACzB,OAAO,SAAS,MAAM,GAAG,QAAQ,CACjC,SAAQ,SAAS,CAAC,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,EACtE,oBAAoB;CAAG"}
@@ -1,10 +1,11 @@
1
- import type { Hash, Hex } from '@xylabs/hex';
2
- export interface NextOptions<TId = Hex> {
3
- cursor?: TId;
1
+ import type { Hex } from '@xylabs/hex';
2
+ import type { Sequence } from '@xyo-network/payload-model';
3
+ export interface NextOptions<TSequence = Hex> {
4
+ cursor?: TSequence;
4
5
  limit?: number;
5
6
  open?: boolean;
6
7
  order?: 'asc' | 'desc';
7
8
  }
8
- export interface ArchivistNextOptions extends NextOptions<Hash> {
9
+ export interface ArchivistNextOptions extends NextOptions<Sequence> {
9
10
  }
10
11
  //# sourceMappingURL=NextOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NextOptions.d.ts","sourceRoot":"","sources":["../../src/NextOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,WAAW,WAAW,CAAC,GAAG,GAAG,GAAG;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW,CAAC,IAAI,CAAC;CAAG"}
1
+ {"version":3,"file":"NextOptions.d.ts","sourceRoot":"","sources":["../../src/NextOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,MAAM,WAAW,WAAW,CAAC,SAAS,GAAG,GAAG;IAC1C,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,oBAAqB,SAAQ,WAAW,CAAC,QAAQ,CAAC;CAAG"}
@@ -3,7 +3,7 @@ import type { Payload, PayloadHashMap, WithStorageMeta } from '@xyo-network/payl
3
3
  import type { AllArchivistFunctions, ReadArchivistFunctions, StashArchivistFunctions, WriteArchivistFunctions } from './ArchivistFunctions.ts';
4
4
  export interface AllArchivist<TReadResponse extends Payload = Payload, TId extends string = Hash> extends AllArchivistFunctions<WithStorageMeta<TReadResponse>, PayloadHashMap<WithStorageMeta<TReadResponse>, TId>> {
5
5
  }
6
- export interface ReadArchivist<TReadResponse extends Payload = Payload, TId extends string = Hash> extends ReadArchivistFunctions<WithStorageMeta<TReadResponse>, TId> {
6
+ export interface ReadArchivist<TReadResponse extends Payload = Payload, TId extends string = Hash, TCursor extends string = TId> extends ReadArchivistFunctions<WithStorageMeta<TReadResponse>, TId, TCursor> {
7
7
  }
8
8
  export interface WriteArchivist<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = TReadResponse, TWrite extends Payload = TReadResponse, TId extends string = Hash> extends WriteArchivistFunctions<WithStorageMeta<TReadResponse>, WithStorageMeta<TWriteResponse>, TWrite, TId> {
9
9
  }
@@ -13,6 +13,6 @@ export interface StashArchivist<TWriteResponse extends Payload = Payload> extend
13
13
  }
14
14
  export interface FullArchivist<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = TReadResponse, TWrite extends Payload = TReadResponse, TId extends string = Hash> extends ReadWriteArchivist<TReadResponse, TWriteResponse, TWrite, TId>, StashArchivist<TWriteResponse> {
15
15
  }
16
- export interface Archivist<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = Payload, TWrite extends Payload = TReadResponse & Payload, TId extends string = Hash> extends ReadArchivist<WithStorageMeta<TReadResponse>, TId>, AllArchivist<WithStorageMeta<TReadResponse>, TId>, WriteArchivist<WithStorageMeta<TReadResponse>, WithStorageMeta<TWriteResponse>, TWrite, TId>, StashArchivistFunctions<TWriteResponse> {
16
+ export interface Archivist<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = Payload, TWrite extends Payload = TReadResponse & Payload, TId extends string = Hash, TCursor extends string = TId> extends ReadArchivist<WithStorageMeta<TReadResponse>, TId, TCursor>, AllArchivist<WithStorageMeta<TReadResponse>, TId>, WriteArchivist<WithStorageMeta<TReadResponse>, WithStorageMeta<TWriteResponse>, TWrite, TId>, StashArchivistFunctions<TWriteResponse> {
17
17
  }
18
18
  //# sourceMappingURL=PayloadArchivist.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PayloadArchivist.d.ts","sourceRoot":"","sources":["../../src/PayloadArchivist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EACV,OAAO,EAAE,cAAc,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AG,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC;CAAG;AAE3G,MAAM,WAAW,SAAS,CACxB,aAAa,SAAS,OAAO,GAAG,OAAO,EACvC,cAAc,SAAS,OAAO,GAAG,OAAO,EACxC,MAAM,SAAS,OAAO,GAAG,aAAa,GAAG,OAAO,EAChD,GAAG,SAAS,MAAM,GAAG,IAAI,EACzB,OAAO,SAAS,MAAM,GAAG,GAAG,CAC5B,SAAQ,aAAa,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EACnE,YAAY,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,GAAG,CAAC,EACjD,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAC5F,uBAAuB,CAAC,cAAc,CAAC;CAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ArchivistSnapshot.ts","../../src/ArchivistStats.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/Queries/Snapshot.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts","../../src/lib/getBoundWitness.ts","../../src/lib/hydrateBoundWitness.ts"],"sourcesContent":["import type { Hash } from '@xylabs/hex'\nimport type { Payload, PayloadHashMap } from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotPayloadSchema = 'network.xyo.archivist.snapshot' as const\nexport type ArchivistSnapshotPayloadSchema = typeof ArchivistSnapshotPayloadSchema\n\nexport type ArchivistSnapshotPayload<TPayload extends Payload = Payload, TId extends string | number | symbol = Hash>\n = Payload<PayloadHashMap<TPayload, TId>, ArchivistSnapshotPayloadSchema>\n","import type { Payload } from '@xyo-network/payload-model'\n\nexport const ArchivistStatsPayloadSchema = 'network.xyo.archivist.stats' as const\nexport type ArchivistStatsPayloadSchema = typeof ArchivistStatsPayloadSchema\n\nexport type ArchivistStatsPayload\n = Payload<{ payloadCount: number }, ArchivistStatsPayloadSchema>\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { ObjectTypeShape } from '@xylabs/typeof'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks.ts'\nimport type { AttachableArchivistInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import type { TypeCheck } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport {\n IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,\n} from '@xyo-network/module-model'\n\nimport type { ArchivistInstance } from './Instance.ts'\nimport type { ArchivistModuleInstance } from './ModuleInstance.ts'\nimport { ArchivistGetQuerySchema } from './Queries/index.ts'\n\nexport const isArchivistInstance: TypeCheck<ArchivistInstance> = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule: TypeCheck<ArchivistModuleInstance> = new IsModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistAllQuerySchema = 'network.xyo.query.archivist.all' as const\nexport type ArchivistAllQuerySchema = typeof ArchivistAllQuerySchema\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear' as const\nexport type ArchivistClearQuerySchema = typeof ArchivistClearQuerySchema\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit' as const\nexport type ArchivistCommitQuerySchema = typeof ArchivistCommitQuerySchema\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import type { Hash } from '@xylabs/hex'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete' as const\nexport type ArchivistDeleteQuerySchema = typeof ArchivistDeleteQuerySchema\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import type { Hash } from '@xylabs/hex'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistGetQuerySchema = 'network.xyo.query.archivist.get' as const\nexport type ArchivistGetQuerySchema = typeof ArchivistGetQuerySchema\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert' as const\nexport type ArchivistInsertQuerySchema = typeof ArchivistInsertQuerySchema\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nimport type { ArchivistNextOptions } from '../NextOptions.ts'\n\nexport const ArchivistNextQuerySchema = 'network.xyo.query.archivist.next' as const\nexport type ArchivistNextQuerySchema = typeof ArchivistNextQuerySchema\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotQuerySchema = 'network.xyo.query.archivist.snapshot' as const\nexport type ArchivistSnapshotQuerySchema = typeof ArchivistSnapshotQuerySchema\n\nexport type ArchivistSnapshotQuery = Query<{\n schema: ArchivistSnapshotQuerySchema\n}>\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { AttachableModuleInstance } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type { ArchivistModuleEventData } from '../EventData.ts'\nimport type { ArchivistInstance } from '../Instance.ts'\nimport type { ArchivistModuleInstance } from '../ModuleInstance.ts'\nimport type { ArchivistParams } from '../Params.ts'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModuleInstance<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import type { EmptyObject, WithAdditional } from '@xylabs/object'\nimport type { ModuleConfig, ModuleIdentifier } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type { IndexDescription } from './IndexDescription.ts'\n\nexport interface ArchivistParents {\n commit?: ModuleIdentifier[]\n read?: ModuleIdentifier[]\n write?: ModuleIdentifier[]\n}\n\nexport interface ArchivistStorage {\n /** The indexes to create on the object store */\n indexes?: IndexDescription[]\n}\n\nexport interface ArchivistGetCache {\n enabled?: boolean\n maxEntries?: number\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n getCache?: ArchivistGetCache\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field storage configuration */\n storage?: ArchivistStorage\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key: Record<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithStorageMeta } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\nimport type { IdentityFunction } from './IdentityFunction.ts'\n\nexport const tryGetTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hash: Hash,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<WithStorageMeta<T> | undefined> => {\n const payload = (await archivist.get([hash])).at(0)\n return identity(payload) ? payload : undefined\n}\n\nexport const getTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hash: Hash,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<WithStorageMeta<T>> => {\n const payload = assertEx((await archivist.get([hash])).at(0), () => `failed to locate bound witness: ${hash}`)\n return assertEx(identity(payload) ? payload : undefined, () => `located payload failed identity check: ${hash}`)\n}\n\nexport const getBoundWitness = (archivist: ReadArchivist, hash: Hash): Promise<WithStorageMeta<BoundWitness>> => {\n return getTypedBoundWitness<BoundWitness>(archivist, hash, isBoundWitnessWithStorageMeta)\n}\n","import { exists } from '@xylabs/exists'\nimport type { Hash } from '@xylabs/hex'\nimport { isHash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithStorageMeta } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\nimport { getTypedBoundWitness, tryGetTypedBoundWitness } from './getBoundWitness.ts'\nimport type { HydratedBoundWitness } from './HydratedBoundWitness.ts'\nimport type { IdentityFunction } from './IdentityFunction.ts'\n\nexport const tryHydrateTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<HydratedBoundWitness<T> | undefined> => {\n const bw = isHash(hashOrBw) ? await tryGetTypedBoundWitness(archivist, hashOrBw, identity) : hashOrBw\n return bw ? [bw, (await archivist.get(bw?.payload_hashes)).filter(exists)] : undefined\n}\n\nexport const hydrateTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<HydratedBoundWitness<T>> => {\n const bw = isHash(hashOrBw) ? await getTypedBoundWitness(archivist, hashOrBw, identity) : hashOrBw\n const payloads = (await archivist.get(bw?.payload_hashes)).filter(exists)\n if (payloads.length !== bw.payload_hashes.length) {\n throw new Error(`missing payloads for ${bw._hash}`)\n }\n return [bw, payloads]\n}\n\nexport const hydrateBoundWitness = (\n archivist: ReadArchivist,\n hashOrBw: Hash | WithStorageMeta<BoundWitness>,\n): Promise<HydratedBoundWitness<BoundWitness>> => {\n return hydrateTypedBoundWitness<BoundWitness>(archivist, hashOrBw, isBoundWitnessWithStorageMeta)\n}\n"],"mappings":";AAGO,IAAM,iCAAiC;;;ACDvC,IAAM,8BAA8B;;;ACF3C,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAiB;AAAA,EAAkB;AAAA,OACjD;;;ACFA,IAAM,0BAA0B;;;ACAhC,IAAM,4BAA4B;;;ACAlC,IAAM,6BAA6B;;;ACCnC,IAAM,6BAA6B;;;ACAnC,IAAM,0BAA0B;;;ACDhC,IAAM,6BAA6B;;;ACEnC,IAAM,2BAA2B;;;ACFjC,IAAM,+BAA+B;;;ARQrC,IAAM,sBAAoD,IAAI,kBAAqC,EAAE,OAAO,EAAE,KAAK,WAAW,GAAG,CAAC,gBAAgB,CAAC;AACnJ,IAAM,oBAAwD,IAAI,gBAAyC,EAAE,OAAO,CAAC,uBAAuB,CAAC;AAE7I,IAAM,oBAAoB,gBAAgB,OAAO,iBAAiB;AAClE,IAAM,sBAAsB,gBAAgB,OAAO,mBAAmB;AACtE,IAAM,sBAAsB,YAAY,OAAO,iBAAiB;AAChE,IAAM,wBAAwB,YAAY,OAAO,mBAAmB;;;ADRpE,IAAM,+CAAgE,CAAC;AAG9E,IAAM,UAAU,IAAI,gBAA6C;AAE1D,IAAM,gCAAwE,QAAQ,OAAO,8CAA8C;AAAA,EAChJ;AAAA,EACA;AACF,CAAC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OAA+B,WAA0B,UAC/F,aAAqF;AACrF,QAAM,KAAK,OAAO,QAAQ,IAAI,MAAM,qBAAqB,WAAW,UAAU,QAAQ,IAAI;AAC1F,QAAM,YAAY,MAAM,UAAU,IAAI,IAAI,cAAc,GAAG,OAAO,MAAM;AACxE,MAAI,SAAS,WAAW,GAAG,eAAe,QAAQ;AAChD,UAAM,IAAI,MAAM,wBAAwB,GAAG,KAAK,EAAE;AAAA,EACpD;AACA,SAAO,CAAC,IAAI,QAAQ;AACtB;AAEO,IAAM,sBAAsB,CACjC,WACA,aACgD;AAChD,SAAO,yBAAuC,WAAW,UAAUC,8BAA6B;AAClG;","names":["AsObjectFactory","AsObjectFactory","IsObjectFactory","isBoundWitnessWithStorageMeta","isBoundWitnessWithStorageMeta"]}
1
+ {"version":3,"sources":["../../src/ArchivistSnapshot.ts","../../src/ArchivistStats.ts","../../src/attachable/asAttachableInstance.ts","../../src/attachable/isAttachableInstance.ts","../../src/typeChecks.ts","../../src/Queries/All.ts","../../src/Queries/Clear.ts","../../src/Queries/Commit.ts","../../src/Queries/Delete.ts","../../src/Queries/Get.ts","../../src/Queries/Insert.ts","../../src/Queries/Next.ts","../../src/Queries/Snapshot.ts","../../src/attachable/AttachableInstance.ts","../../src/Config.ts","../../src/IndexDescription.ts","../../src/lib/getBoundWitness.ts","../../src/lib/hydrateBoundWitness.ts"],"sourcesContent":["import type { Hash } from '@xylabs/hex'\nimport type { Payload, PayloadHashMap } from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotPayloadSchema = 'network.xyo.archivist.snapshot' as const\nexport type ArchivistSnapshotPayloadSchema = typeof ArchivistSnapshotPayloadSchema\n\nexport type ArchivistSnapshotPayload<TPayload extends Payload = Payload, TId extends string | number | symbol = Hash>\n = Payload<PayloadHashMap<TPayload, TId>, ArchivistSnapshotPayloadSchema>\n","import type { Payload } from '@xyo-network/payload-model'\n\nexport const ArchivistStatsPayloadSchema = 'network.xyo.archivist.stats' as const\nexport type ArchivistStatsPayloadSchema = typeof ArchivistStatsPayloadSchema\n\nexport type ArchivistStatsPayload\n = Payload<{ payloadCount: number }, ArchivistStatsPayloadSchema>\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { ObjectTypeShape } from '@xylabs/typeof'\nimport { isAttachableModuleInstance } from '@xyo-network/module-model'\n\nimport { isArchivistInstance } from '../typeChecks.ts'\nimport type { AttachableArchivistInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableArchivistInstance>()\n\nexport const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance> = factory.create(requiredAttachableArchivistInstanceFunctions, [\n isArchivistInstance,\n isAttachableModuleInstance,\n])\n","import type { TypeCheck } from '@xylabs/object'\nimport { AsObjectFactory } from '@xylabs/object'\nimport {\n IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,\n} from '@xyo-network/module-model'\n\nimport type { ArchivistInstance } from './Instance.ts'\nimport type { ArchivistModuleInstance } from './ModuleInstance.ts'\nimport { ArchivistGetQuerySchema } from './Queries/index.ts'\n\nexport const isArchivistInstance: TypeCheck<ArchivistInstance> = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule: TypeCheck<ArchivistModuleInstance> = new IsModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistAllQuerySchema = 'network.xyo.query.archivist.all' as const\nexport type ArchivistAllQuerySchema = typeof ArchivistAllQuerySchema\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistClearQuerySchema = 'network.xyo.query.archivist.clear' as const\nexport type ArchivistClearQuerySchema = typeof ArchivistClearQuerySchema\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistCommitQuerySchema = 'network.xyo.query.archivist.commit' as const\nexport type ArchivistCommitQuerySchema = typeof ArchivistCommitQuerySchema\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import type { Hash } from '@xylabs/hex'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistDeleteQuerySchema = 'network.xyo.query.archivist.delete' as const\nexport type ArchivistDeleteQuerySchema = typeof ArchivistDeleteQuerySchema\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import type { Hash } from '@xylabs/hex'\nimport type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistGetQuerySchema = 'network.xyo.query.archivist.get' as const\nexport type ArchivistGetQuerySchema = typeof ArchivistGetQuerySchema\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistInsertQuerySchema = 'network.xyo.query.archivist.insert' as const\nexport type ArchivistInsertQuerySchema = typeof ArchivistInsertQuerySchema\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import type { Query } from '@xyo-network/payload-model'\n\nimport type { ArchivistNextOptions } from '../NextOptions.ts'\n\nexport const ArchivistNextQuerySchema = 'network.xyo.query.archivist.next' as const\nexport type ArchivistNextQuerySchema = typeof ArchivistNextQuerySchema\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import type { Query } from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotQuerySchema = 'network.xyo.query.archivist.snapshot' as const\nexport type ArchivistSnapshotQuerySchema = typeof ArchivistSnapshotQuerySchema\n\nexport type ArchivistSnapshotQuery = Query<{\n schema: ArchivistSnapshotQuerySchema\n}>\n","import type { TypeCheck } from '@xylabs/object'\nimport { IsObjectFactory } from '@xylabs/object'\nimport type { AttachableModuleInstance } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type { ArchivistModuleEventData } from '../EventData.ts'\nimport type { ArchivistInstance } from '../Instance.ts'\nimport type { ArchivistModuleInstance } from '../ModuleInstance.ts'\nimport type { ArchivistParams } from '../Params.ts'\n\nexport interface AttachableArchivistInstance<\n TParams extends ArchivistParams = ArchivistParams,\n TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,\n TPayload extends Payload = Payload,\n> extends ArchivistModuleInstance<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n ArchivistInstance<TParams, TEventData, TPayload> {}\n\nexport type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>\n\nexport class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {}\n","import type { EmptyObject, WithAdditional } from '@xylabs/object'\nimport type { ModuleConfig, ModuleIdentifier } from '@xyo-network/module-model'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport type { IndexDescription } from './IndexDescription.ts'\n\nexport interface ArchivistParents {\n commit?: ModuleIdentifier[]\n read?: ModuleIdentifier[]\n write?: ModuleIdentifier[]\n}\n\nexport interface ArchivistStorage {\n /** The indexes to create on the object store */\n indexes?: IndexDescription[]\n}\n\nexport interface ArchivistGetCache {\n enabled?: boolean\n maxEntries?: number\n}\n\nexport const ArchivistConfigSchema = 'network.xyo.archivist.config' as const\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<\n WithAdditional<\n {\n getCache?: ArchivistGetCache\n /** @field address of one or more parent archivists to read from */\n parents?: ArchivistParents\n /** @field fail if some parents can not be resolved (true if unspecified) */\n requireAllParents?: boolean\n schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema\n /** @field storage configuration */\n storage?: ArchivistStorage\n /** @field should child store all reads from parents? */\n storeParentReads?: boolean\n },\n TConfig\n >,\n TSchema\n>\n","/**\n * The index direction (1 for ascending, -1 for descending)\n */\nexport type IndexDirection = -1 | 1\n\n/**\n * Description of index(es) to be created on a store\n */\nexport type IndexDescription = {\n /**\n * The key(s) to index\n */\n key: Record<string, IndexDirection>\n /**\n * Is the indexed value an array\n */\n multiEntry?: boolean\n /**\n * The name of the index\n */\n name?: string\n /**\n * If true, the index must enforce uniqueness on the key\n */\n unique?: boolean\n}\n\nexport const IndexSeparator = '-'\n\n/**\n * Given an index description, this will build the index\n * name in standard form\n * @param index The index description\n * @returns The index name in standard form\n */\nexport const buildStandardIndexName = (index: IndexDescription) => {\n const { key, unique } = index\n const prefix = unique ? 'UX' : 'IX'\n const indexKeys = Object.keys(key)\n return `${prefix}_${indexKeys.join(IndexSeparator)}`\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Hash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithStorageMeta } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\nimport type { IdentityFunction } from './IdentityFunction.ts'\n\nexport const tryGetTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hash: Hash,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<WithStorageMeta<T> | undefined> => {\n const payload = (await archivist.get([hash])).at(0)\n return identity(payload) ? payload : undefined\n}\n\nexport const getTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hash: Hash,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<WithStorageMeta<T>> => {\n const payload = assertEx((await archivist.get([hash])).at(0), () => `failed to locate bound witness: ${hash}`)\n return assertEx(identity(payload) ? payload : undefined, () => `located payload failed identity check: ${hash}`)\n}\n\nexport const getBoundWitness = (archivist: ReadArchivist, hash: Hash): Promise<WithStorageMeta<BoundWitness>> => {\n return getTypedBoundWitness<BoundWitness>(archivist, hash, isBoundWitnessWithStorageMeta)\n}\n","import { exists } from '@xylabs/exists'\nimport type { Hash } from '@xylabs/hex'\nimport { isHash } from '@xylabs/hex'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitnessWithStorageMeta } from '@xyo-network/boundwitness-model'\nimport type { WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\nimport { getTypedBoundWitness, tryGetTypedBoundWitness } from './getBoundWitness.ts'\nimport type { HydratedBoundWitness } from './HydratedBoundWitness.ts'\nimport type { IdentityFunction } from './IdentityFunction.ts'\n\nexport const tryHydrateTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<HydratedBoundWitness<T> | undefined> => {\n const bw = isHash(hashOrBw) ? await tryGetTypedBoundWitness(archivist, hashOrBw, identity) : hashOrBw\n return bw ? [bw, (await archivist.get(bw?.payload_hashes as Hash[])).filter(exists)] : undefined\n}\n\nexport const hydrateTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>,\n identity: IdentityFunction<WithStorageMeta<T>>): Promise<HydratedBoundWitness<T>> => {\n const bw = isHash(hashOrBw) ? await getTypedBoundWitness(archivist, hashOrBw, identity) : hashOrBw\n const payloads = (await archivist.get(bw?.payload_hashes as Hash[])).filter(exists)\n if (payloads.length !== bw.payload_hashes.length) {\n throw new Error(`missing payloads for ${bw._hash}`)\n }\n return [bw, payloads]\n}\n\nexport const hydrateBoundWitness = (\n archivist: ReadArchivist,\n hashOrBw: Hash | WithStorageMeta<BoundWitness>,\n): Promise<HydratedBoundWitness<BoundWitness>> => {\n return hydrateTypedBoundWitness<BoundWitness>(archivist, hashOrBw, isBoundWitnessWithStorageMeta)\n}\n"],"mappings":";AAGO,IAAM,iCAAiC;;;ACDvC,IAAM,8BAA8B;;;ACF3C,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAiB;AAAA,EAAkB;AAAA,OACjD;;;ACFA,IAAM,0BAA0B;;;ACAhC,IAAM,4BAA4B;;;ACAlC,IAAM,6BAA6B;;;ACCnC,IAAM,6BAA6B;;;ACAnC,IAAM,0BAA0B;;;ACDhC,IAAM,6BAA6B;;;ACEnC,IAAM,2BAA2B;;;ACFjC,IAAM,+BAA+B;;;ARQrC,IAAM,sBAAoD,IAAI,kBAAqC,EAAE,OAAO,EAAE,KAAK,WAAW,GAAG,CAAC,gBAAgB,CAAC;AACnJ,IAAM,oBAAwD,IAAI,gBAAyC,EAAE,OAAO,CAAC,uBAAuB,CAAC;AAE7I,IAAM,oBAAoB,gBAAgB,OAAO,iBAAiB;AAClE,IAAM,sBAAsB,gBAAgB,OAAO,mBAAmB;AACtE,IAAM,sBAAsB,YAAY,OAAO,iBAAiB;AAChE,IAAM,wBAAwB,YAAY,OAAO,mBAAmB;;;ADRpE,IAAM,+CAAgE,CAAC;AAG9E,IAAM,UAAU,IAAI,gBAA6C;AAE1D,IAAM,gCAAwE,QAAQ,OAAO,8CAA8C;AAAA,EAChJ;AAAA,EACA;AACF,CAAC;;;ADZM,IAAM,gCAAgCC,iBAAgB,OAAO,6BAA6B;;;AWHjG,SAAS,mBA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AAM,qBAAqB,WAAW,UAAU,QAAQ,IAAI;AAC1F,QAAM,YAAY,MAAM,UAAU,IAAI,IAAI,cAAwB,GAAG,OAAO,MAAM;AAClF,MAAI,SAAS,WAAW,GAAG,eAAe,QAAQ;AAChD,UAAM,IAAI,MAAM,wBAAwB,GAAG,KAAK,EAAE;AAAA,EACpD;AACA,SAAO,CAAC,IAAI,QAAQ;AACtB;AAEO,IAAM,sBAAsB,CACjC,WACA,aACgD;AAChD,SAAO,yBAAuC,WAAW,UAAUC,8BAA6B;AAClG;","names":["AsObjectFactory","AsObjectFactory","IsObjectFactory","isBoundWitnessWithStorageMeta","isBoundWitnessWithStorageMeta"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/archivist-model",
3
- "version": "4.1.7",
3
+ "version": "4.2.0",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,21 +29,21 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/assert": "^4.13.23",
33
- "@xylabs/events": "^4.13.23",
34
- "@xylabs/exists": "^4.13.23",
35
- "@xylabs/hex": "^4.13.23",
36
- "@xylabs/object": "^4.13.23",
37
- "@xylabs/promise": "^4.13.23",
38
- "@xylabs/typeof": "^4.13.23",
39
- "@xyo-network/account-model": "^4.1.7",
40
- "@xyo-network/boundwitness-model": "^4.1.7",
41
- "@xyo-network/module-model": "^4.1.7",
42
- "@xyo-network/payload-model": "^4.1.7"
32
+ "@xylabs/assert": "^4.14.1",
33
+ "@xylabs/events": "^4.14.1",
34
+ "@xylabs/exists": "^4.14.1",
35
+ "@xylabs/hex": "^4.14.1",
36
+ "@xylabs/object": "^4.14.1",
37
+ "@xylabs/promise": "^4.14.1",
38
+ "@xylabs/typeof": "^4.14.1",
39
+ "@xyo-network/account-model": "^4.2.0",
40
+ "@xyo-network/boundwitness-model": "^4.2.0",
41
+ "@xyo-network/module-model": "^4.2.0",
42
+ "@xyo-network/payload-model": "^4.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@xylabs/ts-scripts-yarn3": "^7.0.0",
46
- "@xylabs/tsconfig": "^7.0.0",
45
+ "@xylabs/ts-scripts-yarn3": "^7.0.1",
46
+ "@xylabs/tsconfig": "^7.0.1",
47
47
  "typescript": "^5.8.3"
48
48
  },
49
49
  "publishConfig": {
@@ -8,9 +8,9 @@ export interface AllArchivistFunctions<TReadResponse, TSnapshotResponse> {
8
8
  snapshot(): PromisableArray<TSnapshotResponse>
9
9
  }
10
10
 
11
- export interface ReadArchivistFunctions<TReadResponse, TId = string> {
11
+ export interface ReadArchivistFunctions<TReadResponse, TId = string, TCursor = TId> {
12
12
  get(ids: TId[]): PromisableArray<TReadResponse>
13
- next(options?: NextOptions<TId>): PromisableArray<TReadResponse>
13
+ next(options?: NextOptions<TCursor>): PromisableArray<TReadResponse>
14
14
  }
15
15
 
16
16
  export interface WriteArchivistFunctions<TReadResponse, TWriteResponse = TReadResponse, TWrite = TReadResponse, TId = string> {
package/src/Module.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Hash } from '@xylabs/hex'
2
2
  import type { ModuleQueryFunctions } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
3
+ import type { Payload, Sequence } from '@xyo-network/payload-model'
4
4
 
5
5
  import type { Archivist } from './PayloadArchivist.ts'
6
6
 
@@ -9,5 +9,6 @@ export interface ArchivistModule<
9
9
  TWriteResponse extends Payload = Payload,
10
10
  TWrite extends Payload = TReadResponse & Payload,
11
11
  TId extends string = Hash,
12
- > extends Archivist<TReadResponse, TWriteResponse, TWrite, TId>,
12
+ TCursor extends string = Sequence,
13
+ > extends Archivist<TReadResponse, TWriteResponse, TWrite, TId, TCursor>,
13
14
  ModuleQueryFunctions {}
@@ -1,10 +1,11 @@
1
- import type { Hash, Hex } from '@xylabs/hex'
1
+ import type { Hex } from '@xylabs/hex'
2
+ import type { Sequence } from '@xyo-network/payload-model'
2
3
 
3
- export interface NextOptions<TId = Hex> {
4
- cursor?: TId
4
+ export interface NextOptions<TSequence = Hex> {
5
+ cursor?: TSequence
5
6
  limit?: number
6
7
  open?: boolean
7
8
  order?: 'asc' | 'desc'
8
9
  }
9
10
 
10
- export interface ArchivistNextOptions extends NextOptions<Hash> {}
11
+ export interface ArchivistNextOptions extends NextOptions<Sequence> {}
@@ -15,7 +15,8 @@ export interface AllArchivist<
15
15
  export interface ReadArchivist<
16
16
  TReadResponse extends Payload = Payload,
17
17
  TId extends string = Hash,
18
- > extends ReadArchivistFunctions<WithStorageMeta<TReadResponse>, TId> {}
18
+ TCursor extends string = TId,
19
+ > extends ReadArchivistFunctions<WithStorageMeta<TReadResponse>, TId, TCursor> {}
19
20
 
20
21
  export interface WriteArchivist<
21
22
  TReadResponse extends Payload = Payload,
@@ -47,7 +48,8 @@ export interface Archivist<
47
48
  TWriteResponse extends Payload = Payload,
48
49
  TWrite extends Payload = TReadResponse & Payload,
49
50
  TId extends string = Hash,
50
- > extends ReadArchivist<WithStorageMeta<TReadResponse>, TId>,
51
+ TCursor extends string = TId,
52
+ > extends ReadArchivist<WithStorageMeta<TReadResponse>, TId, TCursor>,
51
53
  AllArchivist<WithStorageMeta<TReadResponse>, TId>,
52
54
  WriteArchivist<WithStorageMeta<TReadResponse>, WithStorageMeta<TWriteResponse>, TWrite, TId>,
53
55
  StashArchivistFunctions<TWriteResponse> {}
@@ -13,13 +13,13 @@ import type { IdentityFunction } from './IdentityFunction.ts'
13
13
  export const tryHydrateTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>,
14
14
  identity: IdentityFunction<WithStorageMeta<T>>): Promise<HydratedBoundWitness<T> | undefined> => {
15
15
  const bw = isHash(hashOrBw) ? await tryGetTypedBoundWitness(archivist, hashOrBw, identity) : hashOrBw
16
- return bw ? [bw, (await archivist.get(bw?.payload_hashes)).filter(exists)] : undefined
16
+ return bw ? [bw, (await archivist.get(bw?.payload_hashes as Hash[])).filter(exists)] : undefined
17
17
  }
18
18
 
19
19
  export const hydrateTypedBoundWitness = async <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>,
20
20
  identity: IdentityFunction<WithStorageMeta<T>>): Promise<HydratedBoundWitness<T>> => {
21
21
  const bw = isHash(hashOrBw) ? await getTypedBoundWitness(archivist, hashOrBw, identity) : hashOrBw
22
- const payloads = (await archivist.get(bw?.payload_hashes)).filter(exists)
22
+ const payloads = (await archivist.get(bw?.payload_hashes as Hash[])).filter(exists)
23
23
  if (payloads.length !== bw.payload_hashes.length) {
24
24
  throw new Error(`missing payloads for ${bw._hash}`)
25
25
  }