@xyo-network/archivist-model 5.3.5 → 5.3.6

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.
@@ -1,11 +1,30 @@
1
- import type { EventEmitter } from '@xylabs/sdk-js';
2
- import type { ModuleInstance } from '@xyo-network/module-model';
1
+ import type { EventEmitter, Hash, Promisable } from '@xylabs/sdk-js';
2
+ import type { AnyConfigSchema, ModuleInstance, QueryableModuleParams } from '@xyo-network/module-model';
3
3
  import type { Payload } from '@xyo-network/payload-model';
4
+ import type { ArchivistConfig } from './Config.ts';
4
5
  import type { ArchivistModuleEventData } from './EventData.ts';
5
6
  import type { ArchivistModule } from './Module.ts';
6
7
  import type { ArchivistModuleInstance } from './ModuleInstance.ts';
7
- import type { ArchivistParams } from './Params.ts';
8
8
  import type { ArchivistRawQueryFunctions } from './RawQueryFunctions.ts';
9
+ export interface ArchivistParentInstances {
10
+ commit?: ArchivistInstance[];
11
+ read?: ArchivistInstance[];
12
+ write?: ArchivistInstance[];
13
+ }
14
+ export interface ArchivistKeyParams<TKey extends string = Hash, TValue = Payload, TDataKey extends string = TKey> {
15
+ dataKey?: (value: TValue) => Promisable<TKey>;
16
+ key?: (value: TValue) => Promisable<TDataKey>;
17
+ }
18
+ export interface ArchivistValueParams<TValue = Payload, TDataValue = TValue> {
19
+ dataValue?: (value: TValue) => Promisable<TDataValue>;
20
+ }
21
+ export interface ArchivistParamFields {
22
+ keys?: ArchivistKeyParams;
23
+ parents?: ArchivistParentInstances;
24
+ values?: ArchivistValueParams;
25
+ }
26
+ export interface ArchivistParams<TConfig extends AnyConfigSchema<ArchivistConfig> = AnyConfigSchema<ArchivistConfig>> extends QueryableModuleParams<TConfig>, ArchivistParamFields {
27
+ }
9
28
  export interface ArchivistInstance<TParams extends ArchivistParams = ArchivistParams, TEventData extends ArchivistModuleEventData = ArchivistModuleEventData, TPayload extends Payload = Payload> extends ArchivistModuleInstance<TParams, TEventData>, ArchivistModule<TPayload, TPayload>, ModuleInstance<TParams, TEventData>, ArchivistRawQueryFunctions, EventEmitter<TEventData> {
10
29
  }
11
30
  //# sourceMappingURL=Instance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../../src/Instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAExE,MAAM,WAAW,iBAAiB,CAChC,OAAO,SAAS,eAAe,GAAG,eAAe,EACjD,UAAU,SAAS,wBAAwB,GAAG,wBAAwB,EACtE,QAAQ,SAAS,OAAO,GAAG,OAAO,CAClC,SAAQ,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,EACpD,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACnC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EACnC,0BAA0B,EAAE,YAAY,CAAC,UAAU,CAAC;CAAG"}
1
+ {"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../../src/Instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAAE,IAAI,EAAE,UAAU,EAC/B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EACV,eAAe,EAAE,cAAc,EAAE,qBAAqB,EACvD,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,E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OAAO,CAAC,EAAE,oBAAoB;CAAG;AAEjE,MAAM,WAAW,iBAAiB,CAChC,OAAO,SAAS,eAAe,GAAG,eAAe,EACjD,UAAU,SAAS,wBAAwB,GAAG,wBAAwB,EACtE,QAAQ,SAAS,OAAO,GAAG,OAAO,CAClC,SAAQ,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,EACpD,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACnC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EACnC,0BAA0B,EAAE,YAAY,CAAC,UAAU,CAAC;CAAG"}
@@ -3,9 +3,8 @@ import { IsObjectFactory } from '@xylabs/sdk-js';
3
3
  import type { AttachableModuleInstance } from '@xyo-network/module-model';
4
4
  import type { Payload } from '@xyo-network/payload-model';
5
5
  import type { ArchivistModuleEventData } from '../EventData.ts';
6
- import type { ArchivistInstance } from '../Instance.ts';
6
+ import type { ArchivistInstance, ArchivistParams } from '../Instance.ts';
7
7
  import type { ArchivistModuleInstance } from '../ModuleInstance.ts';
8
- import type { ArchivistParams } from '../Params.ts';
9
8
  export interface AttachableArchivistInstance<TParams extends ArchivistParams = ArchivistParams, TEventData extends ArchivistModuleEventData = ArchivistModuleEventData, TPayload extends Payload = Payload> extends ArchivistModuleInstance<TParams, TEventData>, AttachableModuleInstance<TParams, TEventData>, ArchivistInstance<TParams, TEventData, TPayload> {
10
9
  }
11
10
  export type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"AttachableInstance.d.ts","sourceRoot":"","sources":["../../../src/attachable/AttachableInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,KAAK,EAA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E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,MAAM,WAAW,2BAA2B,CAC1C,OAAO,SAAS,eAAe,GAAG,eAAe,EACjD,UAAU,SAAS,wBAAwB,GAAG,wBAAwB,EACtE,QAAQ,SAAS,OAAO,GAAG,OAAO,CAClC,SAAQ,uBAAuB,CAAC,OAAO,EAAE,UAAU,CAAC,EACpD,wBAAwB,CAAC,OAAO,EAAE,UAAU,CAAC,EAC7C,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC;CAAG;AAErD,MAAM,MAAM,oCAAoC,CAAC,CAAC,SAAS,2BAA2B,GAAG,2BAA2B,IAAI,SAAS,CAAC,CAAC,CAAC,CAAA;AAEpI,qBAAa,oCAAoC,CAAC,CAAC,SAAS,2BAA2B,GAAG,2BAA2B,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;CAAG"}
@@ -1,2 +1,2 @@
1
- export declare const asAttachableArchivistInstance: import("@xylabs/sdk-js").AsTypeFunction<import("./AttachableInstance.ts").AttachableArchivistInstance<import("../Params.ts").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("../Config.ts").ArchivistConfig>>, import("../EventData.ts").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>>;
1
+ export declare const asAttachableArchivistInstance: import("@xylabs/sdk-js").AsTypeFunction<import("./AttachableInstance.ts").AttachableArchivistInstance<import("../Instance.ts").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("../Config.ts").ArchivistConfig>>, import("../EventData.ts").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>>;
2
2
  //# sourceMappingURL=asAttachableInstance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"asAttachableInstance.d.ts","sourceRoot":"","sources":["../../../src/attachable/asAttachableInstance.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,+UAAwD,CAAA"}
1
+ {"version":3,"file":"asAttachableInstance.d.ts","sourceRoot":"","sources":["../../../src/attachable/asAttachableInstance.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,iVAAwD,CAAA"}
@@ -11,7 +11,6 @@ export * from './Labels.ts';
11
11
  export * from './lib/index.ts';
12
12
  export * from './ModuleInstance.ts';
13
13
  export * from './NextOptions.ts';
14
- export * from './Params.ts';
15
14
  export * from './PayloadArchivist.ts';
16
15
  export * from './Queries/index.ts';
17
16
  export * from './RawQueryFunctions.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA"}
@@ -19,8 +19,8 @@ import { isAttachableModuleInstance } from "@xyo-network/module-model";
19
19
  import { AsObjectFactory } from "@xylabs/sdk-js";
20
20
  import {
21
21
  IsInstanceFactory,
22
- IsModuleFactory,
23
22
  isModuleInstance,
23
+ IsQueryableModuleFactory,
24
24
  WithFactory
25
25
  } from "@xyo-network/module-model";
26
26
 
@@ -58,7 +58,7 @@ var ArchivistSnapshotQuerySchema = asSchema10("network.xyo.query.archivist.snaps
58
58
 
59
59
  // src/typeChecks.ts
60
60
  var isArchivistInstance = new IsInstanceFactory().create({ get: "function" }, [isModuleInstance]);
61
- var isArchivistModule = new IsModuleFactory().create([ArchivistGetQuerySchema]);
61
+ var isArchivistModule = new IsQueryableModuleFactory().create([ArchivistGetQuerySchema]);
62
62
  var asArchivistModule = AsObjectFactory.create(isArchivistModule);
63
63
  var asArchivistInstance = AsObjectFactory.create(isArchivistInstance);
64
64
  var withArchivistModule = WithFactory.create(isArchivistModule);
@@ -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/sdk-js'\nimport {\n asSchema, type Payload, type PayloadHashMap,\n} from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotPayloadSchema = asSchema('network.xyo.archivist.snapshot', true)\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 { asSchema, type Payload } from '@xyo-network/payload-model'\n\nexport const ArchivistStatsPayloadSchema = asSchema('network.xyo.archivist.stats', true)\nexport type ArchivistStatsPayloadSchema = typeof ArchivistStatsPayloadSchema\n\nexport type ArchivistStatsPayload\n = Payload<{ payloadCount: number }, ArchivistStatsPayloadSchema>\n","import { AsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\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/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\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 { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistAllQuerySchema = asSchema('network.xyo.query.archivist.all', true)\nexport type ArchivistAllQuerySchema = typeof ArchivistAllQuerySchema\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistClearQuerySchema = asSchema('network.xyo.query.archivist.clear', true)\nexport type ArchivistClearQuerySchema = typeof ArchivistClearQuerySchema\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistCommitQuerySchema = asSchema('network.xyo.query.archivist.commit', true)\nexport type ArchivistCommitQuerySchema = typeof ArchivistCommitQuerySchema\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import type { Hash } from '@xylabs/sdk-js'\nimport { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistDeleteQuerySchema = asSchema('network.xyo.query.archivist.delete', true)\nexport type ArchivistDeleteQuerySchema = typeof ArchivistDeleteQuerySchema\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import type { Hash } from '@xylabs/sdk-js'\nimport { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistGetQuerySchema = asSchema('network.xyo.query.archivist.get', true)\nexport type ArchivistGetQuerySchema = typeof ArchivistGetQuerySchema\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistInsertQuerySchema = asSchema('network.xyo.query.archivist.insert', true)\nexport type ArchivistInsertQuerySchema = typeof ArchivistInsertQuerySchema\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nimport type { ArchivistNextOptions } from '../NextOptions.ts'\n\nexport const ArchivistNextQuerySchema = asSchema('network.xyo.query.archivist.next', true)\nexport type ArchivistNextQuerySchema = typeof ArchivistNextQuerySchema\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotQuerySchema = asSchema('network.xyo.query.archivist.snapshot', true)\nexport type ArchivistSnapshotQuerySchema = typeof ArchivistSnapshotQuerySchema\n\nexport type ArchivistSnapshotQuery = Query<{\n schema: ArchivistSnapshotQuerySchema\n}>\n","import type { TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\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/sdk-js'\nimport type { ModuleConfig, ModuleIdentifier } from '@xyo-network/module-model'\nimport type {\n Payload,\n Schema,\n} from '@xyo-network/payload-model'\nimport { asSchema } 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 = asSchema('network.xyo.archivist.config', true)\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field caching configuration for get calls */\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 type { Hash, IdentityFunction } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { type BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { isStorageMeta, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\n\nexport const tryGetTypedBoundWitnessWithStorageMeta = 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 getTypedBoundWitnessWithStorageMeta = 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 getBoundWitnessWithStorageMeta = (archivist: ReadArchivist, hash: Hash): Promise<WithStorageMeta<BoundWitness>> => {\n return getTypedBoundWitnessWithStorageMeta<BoundWitness>(archivist, hash, x => isStorageMeta(x) && isBoundWitness(x))\n}\n","import type { Hash, IdentityFunction } from '@xylabs/sdk-js'\nimport { exists, isHash } from '@xylabs/sdk-js'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { isStorageMeta, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\nimport { getTypedBoundWitnessWithStorageMeta, tryGetTypedBoundWitnessWithStorageMeta } from './getBoundWitness.ts'\nimport type { HydratedBoundWitness } from './HydratedBoundWitness.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 tryGetTypedBoundWitnessWithStorageMeta(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 getTypedBoundWitnessWithStorageMeta(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 const idFunction: IdentityFunction<WithStorageMeta<BoundWitness>> = x => isBoundWitness(x) && isStorageMeta(x)\n return hydrateTypedBoundWitness<BoundWitness>(archivist, hashOrBw, idFunction)\n}\n"],"mappings":";AACA;AAAA,EACE;AAAA,OACK;AAEA,IAAM,iCAAiC,SAAS,kCAAkC,IAAI;;;ACL7F,SAAS,YAAAA,iBAA8B;AAEhC,IAAM,8BAA8BA,UAAS,+BAA+B,IAAI;;;ACFvF,SAAS,mBAAAC,wBAAuB;;;ACChC,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;;;ACD3C,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAiB;AAAA,EAAkB;AAAA,OACjD;;;ACJP,SAAS,YAAAC,iBAA4B;AAE9B,IAAM,0BAA0BA,UAAS,mCAAmC,IAAI;;;ACFvF,SAAS,YAAAC,iBAA4B;AAE9B,IA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wB,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,QAAM,aAA8D,OAAKC,gBAAe,CAAC,KAAKC,eAAc,CAAC;AAC7G,SAAO,yBAAuC,WAAW,UAAU,UAAU;AAC/E;","names":["asSchema","AsObjectFactory","asSchema","asSchema","asSchema","asSchema","asSchema","asSchema","asSchema","asSchema","AsObjectFactory","IsObjectFactory","asSchema","isBoundWitness","isStorageMeta","isBoundWitness","isStorageMeta"]}
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/sdk-js'\nimport {\n asSchema, type Payload, type PayloadHashMap,\n} from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotPayloadSchema = asSchema('network.xyo.archivist.snapshot', true)\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 { asSchema, type Payload } from '@xyo-network/payload-model'\n\nexport const ArchivistStatsPayloadSchema = asSchema('network.xyo.archivist.stats', true)\nexport type ArchivistStatsPayloadSchema = typeof ArchivistStatsPayloadSchema\n\nexport type ArchivistStatsPayload\n = Payload<{ payloadCount: number }, ArchivistStatsPayloadSchema>\n","import { AsObjectFactory } from '@xylabs/sdk-js'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n","import type { ObjectTypeShape, TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\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/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport {\n // eslint-disable-next-line sonarjs/deprecation\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, 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 IsQueryableModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])\n\nexport const asArchivistModule = AsObjectFactory.create(isArchivistModule)\nexport const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistAllQuerySchema = asSchema('network.xyo.query.archivist.all', true)\nexport type ArchivistAllQuerySchema = typeof ArchivistAllQuerySchema\n\nexport type ArchivistAllQuery = Query<{\n schema: ArchivistAllQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistClearQuerySchema = asSchema('network.xyo.query.archivist.clear', true)\nexport type ArchivistClearQuerySchema = typeof ArchivistClearQuerySchema\n\nexport type ArchivistClearQuery = Query<{\n schema: ArchivistClearQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistCommitQuerySchema = asSchema('network.xyo.query.archivist.commit', true)\nexport type ArchivistCommitQuerySchema = typeof ArchivistCommitQuerySchema\n\nexport type ArchivistCommitQuery = Query<{\n schema: ArchivistCommitQuerySchema\n}>\n","import type { Hash } from '@xylabs/sdk-js'\nimport { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistDeleteQuerySchema = asSchema('network.xyo.query.archivist.delete', true)\nexport type ArchivistDeleteQuerySchema = typeof ArchivistDeleteQuerySchema\n\nexport type ArchivistDeleteQuery = Query<{\n hashes: Hash[]\n schema: ArchivistDeleteQuerySchema\n}>\n","import type { Hash } from '@xylabs/sdk-js'\nimport { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistGetQuerySchema = asSchema('network.xyo.query.archivist.get', true)\nexport type ArchivistGetQuerySchema = typeof ArchivistGetQuerySchema\n\nexport type ArchivistGetQuery = Query<{\n hashes: Hash[]\n schema: ArchivistGetQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistInsertQuerySchema = asSchema('network.xyo.query.archivist.insert', true)\nexport type ArchivistInsertQuerySchema = typeof ArchivistInsertQuerySchema\n\nexport type ArchivistInsertQuery = Query<{\n schema: ArchivistInsertQuerySchema\n}>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nimport type { ArchivistNextOptions } from '../NextOptions.ts'\n\nexport const ArchivistNextQuerySchema = asSchema('network.xyo.query.archivist.next', true)\nexport type ArchivistNextQuerySchema = typeof ArchivistNextQuerySchema\n\nexport type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>\n","import { asSchema, type Query } from '@xyo-network/payload-model'\n\nexport const ArchivistSnapshotQuerySchema = asSchema('network.xyo.query.archivist.snapshot', true)\nexport type ArchivistSnapshotQuerySchema = typeof ArchivistSnapshotQuerySchema\n\nexport type ArchivistSnapshotQuery = Query<{\n schema: ArchivistSnapshotQuerySchema\n}>\n","import type { TypeCheck } from '@xylabs/sdk-js'\nimport { IsObjectFactory } from '@xylabs/sdk-js'\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, ArchivistParams } from '../Instance.ts'\nimport type { ArchivistModuleInstance } from '../ModuleInstance.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/sdk-js'\nimport type { ModuleConfig, ModuleIdentifier } from '@xyo-network/module-model'\nimport type {\n Payload,\n Schema,\n} from '@xyo-network/payload-model'\nimport { asSchema } 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 = asSchema('network.xyo.archivist.config', true)\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n /** @field caching configuration for get calls */\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 type { Hash, IdentityFunction } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport { type BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { isStorageMeta, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\n\nexport const tryGetTypedBoundWitnessWithStorageMeta = 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 getTypedBoundWitnessWithStorageMeta = 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 getBoundWitnessWithStorageMeta = (archivist: ReadArchivist, hash: Hash): Promise<WithStorageMeta<BoundWitness>> => {\n return getTypedBoundWitnessWithStorageMeta<BoundWitness>(archivist, hash, x => isStorageMeta(x) && isBoundWitness(x))\n}\n","import type { Hash, IdentityFunction } from '@xylabs/sdk-js'\nimport { exists, isHash } from '@xylabs/sdk-js'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { isStorageMeta, type WithStorageMeta } from '@xyo-network/payload-model'\n\nimport type { ReadArchivist } from '../PayloadArchivist.ts'\nimport { getTypedBoundWitnessWithStorageMeta, tryGetTypedBoundWitnessWithStorageMeta } from './getBoundWitness.ts'\nimport type { HydratedBoundWitness } from './HydratedBoundWitness.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 tryGetTypedBoundWitnessWithStorageMeta(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 getTypedBoundWitnessWithStorageMeta(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 const idFunction: IdentityFunction<WithStorageMeta<BoundWitness>> = x => isBoundWitness(x) && isStorageMeta(x)\n return hydrateTypedBoundWitness<BoundWitness>(archivist, hashOrBw, idFunction)\n}\n"],"mappings":";AACA;AAAA,EACE;AAAA,OACK;AAEA,IAAM,iCAAiC,SAAS,kCAAkC,IAAI;;;ACL7F,SAAS,YAAAA,iBAA8B;AAEhC,IAAM,8BAA8BA,UAAS,+BAA+B,IAAI;;;ACFvF,SAAS,mBAAAC,wBAAuB;;;ACChC,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;;;ACD3C,SAAS,uBAAuB;AAChC;AAAA,EAEE;AAAA,EAAmB;AAAA,EAAkB;AAAA,EAA0B;AAAA,OAC1D;;;ACLP,SAAS,YAAAC,iBAA4B;AAE9B,IAAM,0BAA0BA,UAAS,mCAAmC,IAAI;;;ACFvF,SAAS,YAAAC,iBAA4B;AAE9B,IAAM,4BAA4BA,UAAS,qCAAqC,IAAI;;;ACF3F,SAAS,YAAAC,iBAA4B;AAE9B,IAAM,6BAA6BA,UAAS,sCAAsC,IAAI;;;AC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AE;AAAA,EACpD;AACA,SAAO,CAAC,IAAI,QAAQ;AACtB;AAEO,IAAM,sBAAsB,CACjC,WACA,aACgD;AAChD,QAAM,aAA8D,OAAKC,gBAAe,CAAC,KAAKC,eAAc,CAAC;AAC7G,SAAO,yBAAuC,WAAW,UAAU,UAAU;AAC/E;","names":["asSchema","AsObjectFactory","asSchema","asSchema","asSchema","asSchema","asSchema","asSchema","asSchema","asSchema","AsObjectFactory","IsObjectFactory","asSchema","isBoundWitness","isStorageMeta","isBoundWitness","isStorageMeta"]}
@@ -4,7 +4,9 @@ import type { ArchivistModuleInstance } from './ModuleInstance.ts';
4
4
  export declare const isArchivistInstance: TypeCheck<ArchivistInstance>;
5
5
  export declare const isArchivistModule: TypeCheck<ArchivistModuleInstance>;
6
6
  export declare const asArchivistModule: import("@xylabs/sdk-js").AsTypeFunction<ArchivistModuleInstance<import("@xyo-network/module-model").ModuleParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData>>;
7
- export declare const asArchivistInstance: import("@xylabs/sdk-js").AsTypeFunction<ArchivistInstance<import("./Params.ts").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>>;
7
+ export declare const asArchivistInstance: import("@xylabs/sdk-js").AsTypeFunction<ArchivistInstance<import("./Instance.ts").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>>;
8
+ /** @deprecated use narrowing instead [ if(is) ] */
8
9
  export declare const withArchivistModule: <R>(mod: any, closure: (mod: ArchivistModuleInstance<import("@xyo-network/module-model").ModuleParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData>) => R) => R | undefined;
9
- export declare const withArchivistInstance: <R>(mod: any, closure: (mod: ArchivistInstance<import("./Params.ts").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>) => R) => R | undefined;
10
+ /** @deprecated use narrowing instead [ if(is) ] */
11
+ export declare const withArchivistInstance: <R>(mod: any, closure: (mod: ArchivistInstance<import("./Instance.ts").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>) => R) => R | undefined;
10
12
  //# sourceMappingURL=typeChecks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeChecks.d.ts","sourceRoot":"","sources":["../../src/typeChecks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAM/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGlE,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,iBAAiB,CAA8F,CAAA;AAC3J,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,uBAAuB,CAAoF,CAAA;AAErJ,eAAO,MAAM,iBAAiB,mQAA4C,CAAA;AAC1E,eAAO,MAAM,mBAAmB,gSAA8C,CAAA;AAC9E,eAAO,MAAM,mBAAmB,+QAAwC,CAAA;AACxE,eAAO,MAAM,qBAAqB,4SAA0C,CAAA"}
1
+ {"version":3,"file":"typeChecks.d.ts","sourceRoot":"","sources":["../../src/typeChecks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAO/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGlE,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,iBAAiB,CAA8F,CAAA;AAC3J,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,uBAAuB,CAA6F,CAAA;AAE9J,eAAO,MAAM,iBAAiB,mQAA4C,CAAA;AAC1E,eAAO,MAAM,mBAAmB,kSAA8C,CAAA;AAE9E,mDAAmD;AAEnD,eAAO,MAAM,mBAAmB,+QAAwC,CAAA;AACxE,mDAAmD;AAEnD,eAAO,MAAM,qBAAqB,8SAA0C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/archivist-model",
3
- "version": "5.3.5",
3
+ "version": "5.3.6",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -36,10 +36,10 @@
36
36
  "!**/*.test.*"
37
37
  ],
38
38
  "dependencies": {
39
- "@xyo-network/account-model": "~5.3.5",
40
- "@xyo-network/boundwitness-model": "~5.3.5",
41
- "@xyo-network/module-model": "~5.3.5",
42
- "@xyo-network/payload-model": "~5.3.5"
39
+ "@xyo-network/account-model": "~5.3.6",
40
+ "@xyo-network/boundwitness-model": "~5.3.6",
41
+ "@xyo-network/module-model": "~5.3.6",
42
+ "@xyo-network/payload-model": "~5.3.6"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@xylabs/sdk-js": "^5.0.79",
package/src/Instance.ts CHANGED
@@ -1,13 +1,42 @@
1
- import type { EventEmitter } from '@xylabs/sdk-js'
2
- import type { ModuleInstance } from '@xyo-network/module-model'
1
+ import type {
2
+ EventEmitter, Hash, Promisable,
3
+ } from '@xylabs/sdk-js'
4
+ import type {
5
+ AnyConfigSchema, ModuleInstance, QueryableModuleParams,
6
+ } from '@xyo-network/module-model'
3
7
  import type { Payload } from '@xyo-network/payload-model'
4
8
 
9
+ import type { ArchivistConfig } from './Config.ts'
5
10
  import type { ArchivistModuleEventData } from './EventData.ts'
6
11
  import type { ArchivistModule } from './Module.ts'
7
12
  import type { ArchivistModuleInstance } from './ModuleInstance.ts'
8
- import type { ArchivistParams } from './Params.ts'
9
13
  import type { ArchivistRawQueryFunctions } from './RawQueryFunctions.ts'
10
14
 
15
+ export interface ArchivistParentInstances {
16
+ commit?: ArchivistInstance[]
17
+ read?: ArchivistInstance[]
18
+ write?: ArchivistInstance[]
19
+ }
20
+
21
+ export interface ArchivistKeyParams<TKey extends string = Hash, TValue = Payload, TDataKey extends string = TKey> {
22
+ dataKey?: (value: TValue) => Promisable<TKey>
23
+ key?: (value: TValue) => Promisable<TDataKey>
24
+ }
25
+
26
+ export interface ArchivistValueParams<TValue = Payload, TDataValue = TValue> {
27
+ dataValue?: (value: TValue) => Promisable<TDataValue>
28
+ }
29
+
30
+ export interface ArchivistParamFields {
31
+ keys?: ArchivistKeyParams
32
+ parents?: ArchivistParentInstances
33
+ values?: ArchivistValueParams
34
+ }
35
+
36
+ export interface ArchivistParams<
37
+ TConfig extends AnyConfigSchema<ArchivistConfig> = AnyConfigSchema<ArchivistConfig>,
38
+ > extends QueryableModuleParams<TConfig>, ArchivistParamFields {}
39
+
11
40
  export interface ArchivistInstance<
12
41
  TParams extends ArchivistParams = ArchivistParams,
13
42
  TEventData extends ArchivistModuleEventData = ArchivistModuleEventData,
@@ -4,9 +4,8 @@ import type { AttachableModuleInstance } from '@xyo-network/module-model'
4
4
  import type { Payload } from '@xyo-network/payload-model'
5
5
 
6
6
  import type { ArchivistModuleEventData } from '../EventData.ts'
7
- import type { ArchivistInstance } from '../Instance.ts'
7
+ import type { ArchivistInstance, ArchivistParams } from '../Instance.ts'
8
8
  import type { ArchivistModuleInstance } from '../ModuleInstance.ts'
9
- import type { ArchivistParams } from '../Params.ts'
10
9
 
11
10
  export interface AttachableArchivistInstance<
12
11
  TParams extends ArchivistParams = ArchivistParams,
package/src/index.ts CHANGED
@@ -11,7 +11,6 @@ export * from './Labels.ts'
11
11
  export * from './lib/index.ts'
12
12
  export * from './ModuleInstance.ts'
13
13
  export * from './NextOptions.ts'
14
- export * from './Params.ts'
15
14
  export * from './PayloadArchivist.ts'
16
15
  export * from './Queries/index.ts'
17
16
  export * from './RawQueryFunctions.ts'
package/src/typeChecks.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { TypeCheck } from '@xylabs/sdk-js'
2
2
  import { AsObjectFactory } from '@xylabs/sdk-js'
3
3
  import {
4
- IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,
4
+ // eslint-disable-next-line sonarjs/deprecation
5
+ IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,
5
6
  } from '@xyo-network/module-model'
6
7
 
7
8
  import type { ArchivistInstance } from './Instance.ts'
@@ -9,9 +10,14 @@ import type { ArchivistModuleInstance } from './ModuleInstance.ts'
9
10
  import { ArchivistGetQuerySchema } from './Queries/index.ts'
10
11
 
11
12
  export const isArchivistInstance: TypeCheck<ArchivistInstance> = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])
12
- export const isArchivistModule: TypeCheck<ArchivistModuleInstance> = new IsModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])
13
+ export const isArchivistModule: TypeCheck<ArchivistModuleInstance> = new IsQueryableModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])
13
14
 
14
15
  export const asArchivistModule = AsObjectFactory.create(isArchivistModule)
15
16
  export const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)
17
+
18
+ /** @deprecated use narrowing instead [ if(is) ] */
19
+ // eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
16
20
  export const withArchivistModule = WithFactory.create(isArchivistModule)
21
+ /** @deprecated use narrowing instead [ if(is) ] */
22
+ // eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
17
23
  export const withArchivistInstance = WithFactory.create(isArchivistInstance)
@@ -1,25 +0,0 @@
1
- import type { Hash, Promisable } from '@xylabs/sdk-js';
2
- import type { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model';
3
- import type { Payload } from '@xyo-network/payload-model';
4
- import type { ArchivistConfig } from './Config.ts';
5
- import type { ArchivistInstance } from './Instance.ts';
6
- export interface ArchivistParentInstances {
7
- commit?: ArchivistInstance[];
8
- read?: ArchivistInstance[];
9
- write?: ArchivistInstance[];
10
- }
11
- export interface ArchivistKeyParams<TKey extends string = Hash, TValue = Payload, TDataKey extends string = TKey> {
12
- dataKey?: (value: TValue) => Promisable<TKey>;
13
- key?: (value: TValue) => Promisable<TDataKey>;
14
- }
15
- export interface ArchivistValueParams<TValue = Payload, TDataValue = TValue> {
16
- dataValue?: (value: TValue) => Promisable<TDataValue>;
17
- }
18
- export interface ArchivistParamFields {
19
- keys?: ArchivistKeyParams;
20
- parents?: ArchivistParentInstances;
21
- values?: ArchivistValueParams;
22
- }
23
- export interface ArchivistParams<TConfig extends AnyConfigSchema<ArchivistConfig> = AnyConfigSchema<ArchivistConfig>> extends ModuleParams<TConfig>, ArchivistParamFields {
24
- }
25
- //# sourceMappingURL=Params.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../src/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC5B,IAAI,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC1B,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB,CAAC,IAAI,SAAS,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,SAAS,MAAM,GAAG,IAAI;IAC9G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,IAAI,CAAC,CAAA;IAC7C,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAA;CAC9C;AAED,MAAM,WAAW,oBAAoB,CAAC,MAAM,GAAG,OAAO,EAAE,UAAU,GAAG,MAAM;IACzE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,UAAU,CAAC,CAAA;CACtD;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,kBAAkB,CAAA;IACzB,OAAO,CAAC,EAAE,wBAAwB,CAAA;IAClC,MAAM,CAAC,EAAE,oBAAoB,CAAA;CAC9B;AAED,MAAM,WAAW,eAAe,CAC9B,OAAO,SAAS,eAAe,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC,eAAe,CAAC,CACnF,SAAQ,YAAY,CAAC,OAAO,CAAC,EAAE,oBAAoB;CAAG"}
package/src/Params.ts DELETED
@@ -1,31 +0,0 @@
1
- import type { Hash, Promisable } from '@xylabs/sdk-js'
2
- import type { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'
3
- import type { Payload } from '@xyo-network/payload-model'
4
-
5
- import type { ArchivistConfig } from './Config.ts'
6
- import type { ArchivistInstance } from './Instance.ts'
7
-
8
- export interface ArchivistParentInstances {
9
- commit?: ArchivistInstance[]
10
- read?: ArchivistInstance[]
11
- write?: ArchivistInstance[]
12
- }
13
-
14
- export interface ArchivistKeyParams<TKey extends string = Hash, TValue = Payload, TDataKey extends string = TKey> {
15
- dataKey?: (value: TValue) => Promisable<TKey>
16
- key?: (value: TValue) => Promisable<TDataKey>
17
- }
18
-
19
- export interface ArchivistValueParams<TValue = Payload, TDataValue = TValue> {
20
- dataValue?: (value: TValue) => Promisable<TDataValue>
21
- }
22
-
23
- export interface ArchivistParamFields {
24
- keys?: ArchivistKeyParams
25
- parents?: ArchivistParentInstances
26
- values?: ArchivistValueParams
27
- }
28
-
29
- export interface ArchivistParams<
30
- TConfig extends AnyConfigSchema<ArchivistConfig> = AnyConfigSchema<ArchivistConfig>,
31
- > extends ModuleParams<TConfig>, ArchivistParamFields {}