{
  "version": 3,
  "sources": ["../../src/modules/archivist-model/ArchivistSnapshot.ts", "../../src/modules/archivist-model/ArchivistStats.ts", "../../src/modules/archivist-model/attachable/asAttachableInstance.ts", "../../src/modules/archivist-model/attachable/isAttachableInstance.ts", "../../src/modules/archivist-model/typeChecks.ts", "../../src/modules/archivist-model/Queries/All.ts", "../../src/modules/archivist-model/Queries/Clear.ts", "../../src/modules/archivist-model/Queries/Commit.ts", "../../src/modules/archivist-model/Queries/Delete.ts", "../../src/modules/archivist-model/Queries/Get.ts", "../../src/modules/archivist-model/Queries/Insert.ts", "../../src/modules/archivist-model/Queries/Next.ts", "../../src/modules/archivist-model/Queries/Snapshot.ts", "../../src/modules/archivist-model/attachable/AttachableInstance.ts", "../../src/modules/archivist-model/Config.ts", "../../src/modules/archivist-model/IndexDescription.ts", "../../src/modules/archivist-model/lib/getBoundWitness.ts", "../../src/modules/archivist-model/lib/hydrateBoundWitness.ts"],
  "sourcesContent": ["import type { Hash } from '@ariestools/sdk'\nimport {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { Payload, PayloadHashMap } from '@xyo-network/sdk-protocol'\nimport { asSchema, PayloadZodOfSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistSnapshotPayloadSchema: 'network.xyo.archivist.snapshot' & {\n  readonly __schema: true\n} = asSchema('network.xyo.archivist.snapshot', true)\nexport type ArchivistSnapshotPayloadSchema = typeof ArchivistSnapshotPayloadSchema\n\nexport const ArchivistSnapshotPayloadZod: z.ZodMiniIntersection<\n  z.ZodMiniObject<{ schema: z.ZodMiniLiteral<ArchivistSnapshotPayloadSchema> }, z.core.$strip>,\n  z.ZodMiniCustom<PayloadHashMap, PayloadHashMap>\n> = z.intersection(PayloadZodOfSchema(ArchivistSnapshotPayloadSchema), z.custom<PayloadHashMap>())\n\nexport type ArchivistSnapshotPayload<TPayload extends Payload = Payload, TId extends string | number | symbol = Hash>\n  = Payload<PayloadHashMap<TPayload, TId>, ArchivistSnapshotPayloadSchema>\n\nconst isArchivistSnapshotPayloadInternal = zodIsFactory(ArchivistSnapshotPayloadZod)\n\nexport const isArchivistSnapshotPayload = <\n  TPayload extends Payload = Payload,\n  TId extends string | number | symbol = Hash,\n  TInput = unknown,\n>(payload?: TInput): payload is ArchivistSnapshotPayload<TPayload, TId> & TInput => isArchivistSnapshotPayloadInternal(payload)\n\nexport const asArchivistSnapshotPayload: ReturnType<typeof zodAsFactory<ArchivistSnapshotPayload>>\n  = zodAsFactory(ArchivistSnapshotPayloadZod, 'asArchivistSnapshotPayload')\nexport const toArchivistSnapshotPayload: ReturnType<typeof zodToFactory<ArchivistSnapshotPayload>>\n  = zodToFactory(ArchivistSnapshotPayloadZod, 'toArchivistSnapshotPayload')\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { asSchema, PayloadZodOfSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistStatsPayloadSchema: 'network.xyo.archivist.stats' & {\n  readonly __schema: true\n} = asSchema('network.xyo.archivist.stats', true)\nexport type ArchivistStatsPayloadSchema = typeof ArchivistStatsPayloadSchema\n\nexport const ArchivistStatsPayloadZod: z.ZodMiniObject<{\n  payloadCount: z.ZodMiniNumber<number>\n  schema: z.ZodMiniLiteral<ArchivistStatsPayloadSchema>\n}, z.core.$strip> = z.extend(PayloadZodOfSchema(ArchivistStatsPayloadSchema), { payloadCount: z.number() })\n\nexport type ArchivistStatsPayload = z.infer<typeof ArchivistStatsPayloadZod>\n\nexport const isArchivistStatsPayload: ReturnType<typeof zodIsFactory<ArchivistStatsPayload>> = zodIsFactory(ArchivistStatsPayloadZod)\nexport const asArchivistStatsPayload: ReturnType<typeof zodAsFactory<ArchivistStatsPayload>> = zodAsFactory(ArchivistStatsPayloadZod, 'asArchivistStatsPayload')\nexport const toArchivistStatsPayload: ReturnType<typeof zodToFactory<ArchivistStatsPayload>> = zodToFactory(ArchivistStatsPayloadZod, 'toArchivistStatsPayload')\n", "import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableArchivistInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableArchivistInstance = AsObjectFactory.create(isAttachableArchivistInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#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 '@ariestools/sdk'\nimport { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n  IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#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 @typescript-eslint/no-deprecated\nexport const withArchivistModule = WithFactory.create(isArchivistModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withArchivistInstance = WithFactory.create(isArchivistInstance)\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistAllQuerySchema: 'network.xyo.query.archivist.all' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.all', true)\nexport type ArchivistAllQuerySchema = typeof ArchivistAllQuerySchema\n\nexport const ArchivistAllQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistAllQuerySchema> }\n  & (typeof QueryFieldsZod)['shape'],\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistAllQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type ArchivistAllQuery = z.infer<typeof ArchivistAllQueryZod>\n\nexport const isArchivistAllQuery: ReturnType<typeof zodIsFactory<ArchivistAllQuery>> = zodIsFactory(ArchivistAllQueryZod)\nexport const asArchivistAllQuery: ReturnType<typeof zodAsFactory<ArchivistAllQuery>> = zodAsFactory(ArchivistAllQueryZod, 'asArchivistAllQuery')\nexport const toArchivistAllQuery: ReturnType<typeof zodToFactory<ArchivistAllQuery>> = zodToFactory(ArchivistAllQueryZod, 'toArchivistAllQuery')\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistClearQuerySchema: 'network.xyo.query.archivist.clear' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.clear', true)\nexport type ArchivistClearQuerySchema = typeof ArchivistClearQuerySchema\n\nexport const ArchivistClearQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistClearQuerySchema> }\n  & (typeof QueryFieldsZod)['shape'],\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistClearQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type ArchivistClearQuery = z.infer<typeof ArchivistClearQueryZod>\n\nexport const isArchivistClearQuery: ReturnType<typeof zodIsFactory<ArchivistClearQuery>> = zodIsFactory(ArchivistClearQueryZod)\nexport const asArchivistClearQuery: ReturnType<typeof zodAsFactory<ArchivistClearQuery>> = zodAsFactory(ArchivistClearQueryZod, 'asArchivistClearQuery')\nexport const toArchivistClearQuery: ReturnType<typeof zodToFactory<ArchivistClearQuery>> = zodToFactory(ArchivistClearQueryZod, 'toArchivistClearQuery')\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistCommitQuerySchema: 'network.xyo.query.archivist.commit' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.commit', true)\nexport type ArchivistCommitQuerySchema = typeof ArchivistCommitQuerySchema\n\nexport const ArchivistCommitQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistCommitQuerySchema> }\n  & (typeof QueryFieldsZod)['shape'],\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistCommitQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type ArchivistCommitQuery = z.infer<typeof ArchivistCommitQueryZod>\n\nexport const isArchivistCommitQuery: ReturnType<typeof zodIsFactory<ArchivistCommitQuery>> = zodIsFactory(ArchivistCommitQueryZod)\nexport const asArchivistCommitQuery: ReturnType<typeof zodAsFactory<ArchivistCommitQuery>> = zodAsFactory(ArchivistCommitQueryZod, 'asArchivistCommitQuery')\nexport const toArchivistCommitQuery: ReturnType<typeof zodToFactory<ArchivistCommitQuery>> = zodToFactory(ArchivistCommitQueryZod, 'toArchivistCommitQuery')\n", "import type { Hash } from '@ariestools/sdk'\nimport {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistDeleteQuerySchema: 'network.xyo.query.archivist.delete' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.delete', true)\nexport type ArchivistDeleteQuerySchema = typeof ArchivistDeleteQuerySchema\n\nexport const ArchivistDeleteQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistDeleteQuerySchema> }\n  & (typeof QueryFieldsZod)['shape']\n  & { hashes: z.ZodMiniArray<z.ZodMiniCustom<Hash, Hash>> },\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistDeleteQuerySchema), {\n  ...QueryFieldsZod.shape,\n  hashes: z.array(z.custom<Hash>()),\n})\n\nexport type ArchivistDeleteQuery = z.infer<typeof ArchivistDeleteQueryZod>\n\nexport const isArchivistDeleteQuery: ReturnType<typeof zodIsFactory<ArchivistDeleteQuery>> = zodIsFactory(ArchivistDeleteQueryZod)\nexport const asArchivistDeleteQuery: ReturnType<typeof zodAsFactory<ArchivistDeleteQuery>> = zodAsFactory(ArchivistDeleteQueryZod, 'asArchivistDeleteQuery')\nexport const toArchivistDeleteQuery: ReturnType<typeof zodToFactory<ArchivistDeleteQuery>> = zodToFactory(ArchivistDeleteQueryZod, 'toArchivistDeleteQuery')\n", "import type { Hash } from '@ariestools/sdk'\nimport {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistGetQuerySchema: 'network.xyo.query.archivist.get' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.get', true)\nexport type ArchivistGetQuerySchema = typeof ArchivistGetQuerySchema\n\nexport const ArchivistGetQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistGetQuerySchema> }\n  & (typeof QueryFieldsZod)['shape']\n  & { hashes: z.ZodMiniArray<z.ZodMiniCustom<Hash, Hash>> },\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistGetQuerySchema), {\n  ...QueryFieldsZod.shape,\n  hashes: z.array(z.custom<Hash>()),\n})\n\nexport type ArchivistGetQuery = z.infer<typeof ArchivistGetQueryZod>\n\nexport const isArchivistGetQuery: ReturnType<typeof zodIsFactory<ArchivistGetQuery>> = zodIsFactory(ArchivistGetQueryZod)\nexport const asArchivistGetQuery: ReturnType<typeof zodAsFactory<ArchivistGetQuery>> = zodAsFactory(ArchivistGetQueryZod, 'asArchivistGetQuery')\nexport const toArchivistGetQuery: ReturnType<typeof zodToFactory<ArchivistGetQuery>> = zodToFactory(ArchivistGetQueryZod, 'toArchivistGetQuery')\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistInsertQuerySchema: 'network.xyo.query.archivist.insert' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.insert', true)\nexport type ArchivistInsertQuerySchema = typeof ArchivistInsertQuerySchema\n\nexport const ArchivistInsertQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistInsertQuerySchema> }\n  & (typeof QueryFieldsZod)['shape'],\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistInsertQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type ArchivistInsertQuery = z.infer<typeof ArchivistInsertQueryZod>\n\nexport const isArchivistInsertQuery: ReturnType<typeof zodIsFactory<ArchivistInsertQuery>> = zodIsFactory(ArchivistInsertQueryZod)\nexport const asArchivistInsertQuery: ReturnType<typeof zodAsFactory<ArchivistInsertQuery>> = zodAsFactory(ArchivistInsertQueryZod, 'asArchivistInsertQuery')\nexport const toArchivistInsertQuery: ReturnType<typeof zodToFactory<ArchivistInsertQuery>> = zodToFactory(ArchivistInsertQueryZod, 'toArchivistInsertQuery')\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { Sequence } from '@xyo-network/sdk-protocol'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistNextQuerySchema: 'network.xyo.query.archivist.next' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.next', true)\nexport type ArchivistNextQuerySchema = typeof ArchivistNextQuerySchema\n\nexport const ArchivistNextQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistNextQuerySchema> }\n  & (typeof QueryFieldsZod)['shape']\n  & {\n    cursor: z.ZodMiniOptional<z.ZodMiniCustom<Sequence, Sequence>>\n    limit: z.ZodMiniOptional<z.ZodMiniNumber<number>>\n    open: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n    order: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<'asc'>, z.ZodMiniLiteral<'desc'>]>>\n  },\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistNextQuerySchema), {\n  ...QueryFieldsZod.shape,\n  cursor: z.optional(z.custom<Sequence>()),\n  limit: z.optional(z.number()),\n  open: z.optional(z.boolean()),\n  order: z.optional(z.union([z.literal('asc'), z.literal('desc')])),\n})\n\nexport type ArchivistNextQuery = z.infer<typeof ArchivistNextQueryZod>\n\nexport const isArchivistNextQuery: ReturnType<typeof zodIsFactory<ArchivistNextQuery>> = zodIsFactory(ArchivistNextQueryZod)\nexport const asArchivistNextQuery: ReturnType<typeof zodAsFactory<ArchivistNextQuery>> = zodAsFactory(ArchivistNextQueryZod, 'asArchivistNextQuery')\nexport const toArchivistNextQuery: ReturnType<typeof zodToFactory<ArchivistNextQuery>> = zodToFactory(ArchivistNextQueryZod, 'toArchivistNextQuery')\n", "import {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n  asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ArchivistSnapshotQuerySchema: 'network.xyo.query.archivist.snapshot' & {\n  readonly __schema: true\n} = asSchema('network.xyo.query.archivist.snapshot', true)\nexport type ArchivistSnapshotQuerySchema = typeof ArchivistSnapshotQuerySchema\n\nexport const ArchivistSnapshotQueryZod: z.ZodMiniObject<\n  & { schema: z.ZodMiniLiteral<ArchivistSnapshotQuerySchema> }\n  & (typeof QueryFieldsZod)['shape'],\n  z.core.$strip\n> = z.extend(PayloadZodOfSchema(ArchivistSnapshotQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type ArchivistSnapshotQuery = z.infer<typeof ArchivistSnapshotQueryZod>\n\nexport const isArchivistSnapshotQuery: ReturnType<typeof zodIsFactory<ArchivistSnapshotQuery>> = zodIsFactory(ArchivistSnapshotQueryZod)\nexport const asArchivistSnapshotQuery: ReturnType<typeof zodAsFactory<ArchivistSnapshotQuery>> = zodAsFactory(ArchivistSnapshotQueryZod, 'asArchivistSnapshotQuery')\nexport const toArchivistSnapshotQuery: ReturnType<typeof zodToFactory<ArchivistSnapshotQuery>> = zodToFactory(ArchivistSnapshotQueryZod, 'toArchivistSnapshotQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk-protocol'\n\nimport type { AttachableModuleInstance } from '#module-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 '@ariestools/sdk'\nimport {\n  zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type {\n  Payload,\n  Schema,\n} from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleConfig, ModuleIdentifier } from '#module-model'\nimport { ModuleConfigZod } from '#module-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' & {\n  readonly __schema: true\n} = asSchema('network.xyo.archivist.config', true)\nexport type ArchivistConfigSchema = typeof ArchivistConfigSchema\n\nexport const ArchivistConfigZod: z.ZodMiniObject<\n  & Omit<(typeof ModuleConfigZod)['shape'], 'schema'>\n  & {\n    getCache: z.ZodMiniOptional<z.ZodMiniCustom<ArchivistGetCache, ArchivistGetCache>>\n    parents: z.ZodMiniOptional<z.ZodMiniCustom<ArchivistParents, ArchivistParents>>\n    requireAllParents: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n    schema: z.ZodMiniLiteral<ArchivistConfigSchema>\n    storage: z.ZodMiniOptional<z.ZodMiniCustom<ArchivistStorage, ArchivistStorage>>\n    storeParentReads: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n  },\n  z.core.$strip\n> = z.extend(ModuleConfigZod, {\n  getCache: z.optional(z.custom<ArchivistGetCache>()),\n  parents: z.optional(z.custom<ArchivistParents>()),\n  requireAllParents: z.optional(z.boolean()),\n  schema: z.literal(ArchivistConfigSchema),\n  storage: z.optional(z.custom<ArchivistStorage>()),\n  storeParentReads: z.optional(z.boolean()),\n})\n\nexport type ArchivistConfigBase = z.infer<typeof ArchivistConfigZod>\n\nexport const isArchivistConfig: ReturnType<typeof zodIsFactory<ArchivistConfigBase>> = zodIsFactory(ArchivistConfigZod)\nexport const asArchivistConfig: ReturnType<typeof zodAsFactory<ArchivistConfigBase>> = zodAsFactory(ArchivistConfigZod, 'asArchivistConfig')\nexport const toArchivistConfig: ReturnType<typeof zodToFactory<ArchivistConfigBase>> = zodToFactory(ArchivistConfigZod, 'toArchivistConfig')\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 interface 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 '@ariestools/sdk'\nimport { assertEx } from '@ariestools/sdk'\nimport {\n  type BoundWitness, isBoundWitness, isStorageMeta, type WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\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 '@ariestools/sdk'\nimport { exists, isHash } from '@ariestools/sdk'\nimport type { BoundWitness, WithStorageMeta } from '@xyo-network/sdk-protocol'\nimport { isBoundWitness, isStorageMeta } from '@xyo-network/sdk-protocol'\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)).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)).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,EAAc;AAAA,EAAc;AAAA,OACvB;AAEP,SAAS,UAAU,0BAA0B;AAC7C,YAAY,OAAO;AAEZ,IAAM,iCAET,SAAS,kCAAkC,IAAI;AAG5C,IAAM,8BAGP,eAAa,mBAAmB,8BAA8B,GAAK,SAAuB,CAAC;AAKjG,IAAM,qCAAqC,aAAa,2BAA2B;AAE5E,IAAM,6BAA6B,CAIxC,YAAkF,mCAAmC,OAAO;AAEvH,IAAM,6BACT,aAAa,6BAA6B,4BAA4B;AACnE,IAAM,6BACT,aAAa,6BAA6B,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AAW,MAAM,0CAA0C,IAAI,EAAE;AACjH;AAEO,IAAM,iCAAiC,CAAC,WAA0B,SAAuD;AAC9H,SAAO,oCAAkD,WAAW,MAAM,OAAK,cAAc,CAAC,KAAK,eAAe,CAAC,CAAC;AACtH;;;ACrBA,SAAS,QAAQ,cAAc;AAE/B,SAAS,kBAAAG,iBAAgB,iBAAAC,sBAAqB;AAMvC,IAAM,8BAA8B,OAA+B,WAA0B,UAClG,aAAiG;AACjG,QAAM,KAAK,OAAO,QAAQ,IAAI,MAAM,uCAAuC,WAAW,UAAU,QAAQ,IAAI;AAC5G,SAAO,KAAK,CAAC,KAAK,MAAM,UAAU,IAAI,IAAI,cAAc,GAAG,OAAO,MAAM,CAAC,IAAI;AAC/E;AAEO,IAAM,2BAA2B,OAA+B,WAA0B,UAC/F,aAAqF;AACrF,QAAM,KAAK,OAAO,QAAQ,IAAI,MAAM,oCAAoC,WAAW,UAAU,QAAQ,IAAI;AACzG,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,QAAM,aAA8D,OAAKC,gBAAe,CAAC,KAAKC,eAAc,CAAC;AAC7G,SAAO,yBAAuC,WAAW,UAAU,UAAU;AAC/E;",
  "names": ["zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "z", "AsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "AsObjectFactory", "IsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "z", "isBoundWitness", "isStorageMeta", "isBoundWitness", "isStorageMeta"]
}
