@xyo-network/archivist-model 4.0.3 → 4.1.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.
- package/{dist/types → build/neutral}/typeChecks.d.ts +3 -2
- package/build/neutral/typeChecks.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +282 -0
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/typeChecks.ts +3 -2
- package/dist/types/typeChecks.d.ts.map +0 -1
- /package/{dist/types → build/neutral}/ArchivistDriver.d.ts +0 -0
- /package/{dist/types → build/neutral}/ArchivistDriver.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/ArchivistFunctions.d.ts +0 -0
- /package/{dist/types → build/neutral}/ArchivistFunctions.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/ArchivistSnapshot.d.ts +0 -0
- /package/{dist/types → build/neutral}/ArchivistSnapshot.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/ArchivistStats.d.ts +0 -0
- /package/{dist/types → build/neutral}/ArchivistStats.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Config.d.ts +0 -0
- /package/{dist/types → build/neutral}/Config.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventData.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventData.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventModels/Cleared.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventModels/Cleared.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventModels/Deleted.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventModels/Deleted.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventModels/Inserted.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventModels/Inserted.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/EventModels/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/EventModels/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/IndexDescription.d.ts +0 -0
- /package/{dist/types → build/neutral}/IndexDescription.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Instance.d.ts +0 -0
- /package/{dist/types → build/neutral}/Instance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Labels.d.ts +0 -0
- /package/{dist/types → build/neutral}/Labels.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Module.d.ts +0 -0
- /package/{dist/types → build/neutral}/Module.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/ModuleInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/ModuleInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/NextOptions.d.ts +0 -0
- /package/{dist/types → build/neutral}/NextOptions.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Params.d.ts +0 -0
- /package/{dist/types → build/neutral}/Params.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/PayloadArchivist.d.ts +0 -0
- /package/{dist/types → build/neutral}/PayloadArchivist.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/All.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/All.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Clear.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Clear.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Commit.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Commit.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Delete.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Delete.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Get.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Get.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Insert.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Insert.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Next.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Next.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/Snapshot.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/Snapshot.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/Queries/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/Queries/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/RawQueryFunctions.d.ts +0 -0
- /package/{dist/types → build/neutral}/RawQueryFunctions.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/AttachableInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/AttachableInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/asAttachableInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/asAttachableInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/attachable/isAttachableInstance.d.ts +0 -0
- /package/{dist/types → build/neutral}/attachable/isAttachableInstance.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/index.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/lib/HydratedBoundWitness.d.ts +0 -0
- /package/{dist/types → build/neutral}/lib/HydratedBoundWitness.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/lib/IdentityFunction.d.ts +0 -0
- /package/{dist/types → build/neutral}/lib/IdentityFunction.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/lib/getBoundWitness.d.ts +0 -0
- /package/{dist/types → build/neutral}/lib/getBoundWitness.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/lib/hydrateBoundWitness.d.ts +0 -0
- /package/{dist/types → build/neutral}/lib/hydrateBoundWitness.d.ts.map +0 -0
- /package/{dist/types → build/neutral}/lib/index.d.ts +0 -0
- /package/{dist/types → build/neutral}/lib/index.d.ts.map +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { TypeCheck } from '@xylabs/object';
|
|
1
2
|
import type { ArchivistInstance } from './Instance.ts';
|
|
2
3
|
import type { ArchivistModuleInstance } from './ModuleInstance.ts';
|
|
3
|
-
export declare const isArchivistInstance:
|
|
4
|
-
export declare const isArchivistModule:
|
|
4
|
+
export declare const isArchivistInstance: TypeCheck<ArchivistInstance>;
|
|
5
|
+
export declare const isArchivistModule: TypeCheck<ArchivistModuleInstance>;
|
|
5
6
|
export declare const asArchivistModule: import("@xylabs/object").AsTypeFunction<ArchivistModuleInstance<import("@xyo-network/module-model").ModuleParams<import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").ArchivistConfig>>, import("./EventData.ts").ArchivistModuleEventData>>;
|
|
6
7
|
export declare const asArchivistInstance: import("@xylabs/object").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
8
|
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;
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { Promisable, PromisableArray } from '@xylabs/promise';
|
|
2
|
+
import { Hex, Hash } from '@xylabs/hex';
|
|
3
|
+
import * as _xyo_network_payload_model from '@xyo-network/payload-model';
|
|
4
|
+
import { Payload, PayloadHashMap, WithStorageMeta, Query } from '@xyo-network/payload-model';
|
|
5
|
+
import * as _xylabs_object from '@xylabs/object';
|
|
6
|
+
import { EmptyObject, WithAdditional, TypeCheck, IsObjectFactory } from '@xylabs/object';
|
|
7
|
+
import * as _xyo_network_module_model from '@xyo-network/module-model';
|
|
8
|
+
import { Module, ModuleEventArgs, ModuleEventData, ModuleQueryFunctions, ModuleConfig, ModuleIdentifier, ModuleParams, AnyConfigSchema, ModuleQueryResult, ModuleInstance, AttachableModuleInstance, Labels, ModuleQueries } from '@xyo-network/module-model';
|
|
9
|
+
import { EventData, EventEmitter } from '@xylabs/events';
|
|
10
|
+
import { AccountInstance } from '@xyo-network/account-model';
|
|
11
|
+
import { ObjectTypeShape } from '@xylabs/typeof';
|
|
12
|
+
import { BoundWitness, SignedBoundWitness } from '@xyo-network/boundwitness-model';
|
|
13
|
+
|
|
14
|
+
interface NextOptions<TId = Hex> {
|
|
15
|
+
cursor?: TId;
|
|
16
|
+
limit?: number;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
order?: 'asc' | 'desc';
|
|
19
|
+
}
|
|
20
|
+
interface ArchivistNextOptions extends NextOptions<Hash> {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ArchivistDriver<TId, TIn, TOut extends TIn> {
|
|
24
|
+
all(): Promisable<TOut[]>;
|
|
25
|
+
clear(): Promisable<void>;
|
|
26
|
+
count(): number;
|
|
27
|
+
delete(hashes: TId[]): Promise<TOut[]>;
|
|
28
|
+
get(hashes: TId[]): Promisable<TOut[]>;
|
|
29
|
+
insert(payloads: TIn[]): TOut[];
|
|
30
|
+
next(options?: NextOptions): Promisable<TOut[]>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface AllArchivistFunctions<TReadResponse, TSnapshotResponse> {
|
|
34
|
+
/** @deprecated use next or snapshot instead */
|
|
35
|
+
all(): PromisableArray<TReadResponse>;
|
|
36
|
+
snapshot(): PromisableArray<TSnapshotResponse>;
|
|
37
|
+
}
|
|
38
|
+
interface ReadArchivistFunctions<TReadResponse, TId = string> {
|
|
39
|
+
get(ids: TId[]): PromisableArray<TReadResponse>;
|
|
40
|
+
next(options?: NextOptions<TId>): PromisableArray<TReadResponse>;
|
|
41
|
+
}
|
|
42
|
+
interface WriteArchivistFunctions<TReadResponse, TWriteResponse = TReadResponse, TWrite = TReadResponse, TId = string> {
|
|
43
|
+
clear(): Promisable<void>;
|
|
44
|
+
delete(ids: TId[]): PromisableArray<TReadResponse>;
|
|
45
|
+
insert(item: TWrite[]): PromisableArray<TWriteResponse>;
|
|
46
|
+
}
|
|
47
|
+
interface StashArchivistFunctions<TWriteResponse> {
|
|
48
|
+
commit(): PromisableArray<TWriteResponse>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare const ArchivistSnapshotPayloadSchema: "network.xyo.archivist.snapshot";
|
|
52
|
+
type ArchivistSnapshotPayloadSchema = typeof ArchivistSnapshotPayloadSchema;
|
|
53
|
+
type ArchivistSnapshotPayload<TPayload extends Payload = Payload, TId extends string | number | symbol = Hash> = Payload<PayloadHashMap<TPayload, TId>, ArchivistSnapshotPayloadSchema>;
|
|
54
|
+
|
|
55
|
+
declare const ArchivistStatsPayloadSchema: "network.xyo.archivist.stats";
|
|
56
|
+
type ArchivistStatsPayloadSchema = typeof ArchivistStatsPayloadSchema;
|
|
57
|
+
type ArchivistStatsPayload = Payload<{
|
|
58
|
+
payloadCount: number;
|
|
59
|
+
}, ArchivistStatsPayloadSchema>;
|
|
60
|
+
|
|
61
|
+
type ClearedEventArgs<T extends Module = Module> = ModuleEventArgs<T>;
|
|
62
|
+
interface ClearedEventData<T extends Module = Module> extends EventData {
|
|
63
|
+
cleared: ClearedEventArgs<T>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type DeletedEventArgs<T extends Module = Module> = ModuleEventArgs<T, {
|
|
67
|
+
hashes: Hash[];
|
|
68
|
+
payloads: Payload[];
|
|
69
|
+
}>;
|
|
70
|
+
interface DeletedEventData<T extends Module = Module> extends EventData {
|
|
71
|
+
deleted: DeletedEventArgs<T>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type InsertedEventArgs<T extends Module = Module> = ModuleEventArgs<T, {
|
|
75
|
+
inPayloads: Payload[];
|
|
76
|
+
outPayloads: WithStorageMeta<Payload>[];
|
|
77
|
+
payloads: WithStorageMeta<Payload>[];
|
|
78
|
+
}>;
|
|
79
|
+
interface InsertedEventData<T extends Module = Module> extends EventData {
|
|
80
|
+
inserted: InsertedEventArgs<T>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface ArchivistModuleEventData extends InsertedEventData, DeletedEventData, ClearedEventData, ModuleEventData {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface AllArchivist<TReadResponse extends Payload = Payload, TId extends string = Hash> extends AllArchivistFunctions<WithStorageMeta<TReadResponse>, PayloadHashMap<WithStorageMeta<TReadResponse>, TId>> {
|
|
87
|
+
}
|
|
88
|
+
interface ReadArchivist<TReadResponse extends Payload = Payload, TId extends string = Hash> extends ReadArchivistFunctions<WithStorageMeta<TReadResponse>, TId> {
|
|
89
|
+
}
|
|
90
|
+
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> {
|
|
91
|
+
}
|
|
92
|
+
interface ReadWriteArchivist<TReadResponse extends Payload = Payload, TWriteResponse extends Payload = TReadResponse, TWrite extends Payload = TReadResponse, TId extends string = Hash> extends WriteArchivist<TReadResponse, TWriteResponse, TWrite, TId>, ReadArchivist<TReadResponse, TId> {
|
|
93
|
+
}
|
|
94
|
+
interface StashArchivist<TWriteResponse extends Payload = Payload> extends StashArchivistFunctions<WithStorageMeta<TWriteResponse>> {
|
|
95
|
+
}
|
|
96
|
+
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> {
|
|
97
|
+
}
|
|
98
|
+
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> {
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
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 {
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The index direction (1 for ascending, -1 for descending)
|
|
106
|
+
*/
|
|
107
|
+
type IndexDirection = -1 | 1;
|
|
108
|
+
/**
|
|
109
|
+
* Description of index(es) to be created on a store
|
|
110
|
+
*/
|
|
111
|
+
type IndexDescription = {
|
|
112
|
+
/**
|
|
113
|
+
* The key(s) to index
|
|
114
|
+
*/
|
|
115
|
+
key: Record<string, IndexDirection>;
|
|
116
|
+
/**
|
|
117
|
+
* Is the indexed value an array
|
|
118
|
+
*/
|
|
119
|
+
multiEntry?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The name of the index
|
|
122
|
+
*/
|
|
123
|
+
name?: string;
|
|
124
|
+
/**
|
|
125
|
+
* If true, the index must enforce uniqueness on the key
|
|
126
|
+
*/
|
|
127
|
+
unique?: boolean;
|
|
128
|
+
};
|
|
129
|
+
declare const IndexSeparator = "-";
|
|
130
|
+
/**
|
|
131
|
+
* Given an index description, this will build the index
|
|
132
|
+
* name in standard form
|
|
133
|
+
* @param index The index description
|
|
134
|
+
* @returns The index name in standard form
|
|
135
|
+
*/
|
|
136
|
+
declare const buildStandardIndexName: (index: IndexDescription) => string;
|
|
137
|
+
|
|
138
|
+
interface ArchivistParents {
|
|
139
|
+
commit?: ModuleIdentifier[];
|
|
140
|
+
read?: ModuleIdentifier[];
|
|
141
|
+
write?: ModuleIdentifier[];
|
|
142
|
+
}
|
|
143
|
+
interface ArchivistStorage {
|
|
144
|
+
/** The indexes to create on the object store */
|
|
145
|
+
indexes?: IndexDescription[];
|
|
146
|
+
}
|
|
147
|
+
interface ArchivistGetCache {
|
|
148
|
+
enabled?: boolean;
|
|
149
|
+
maxEntries?: number;
|
|
150
|
+
}
|
|
151
|
+
declare const ArchivistConfigSchema: "network.xyo.archivist.config";
|
|
152
|
+
type ArchivistConfigSchema = typeof ArchivistConfigSchema;
|
|
153
|
+
type ArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends string | void = void> = ModuleConfig<WithAdditional<{
|
|
154
|
+
getCache?: ArchivistGetCache;
|
|
155
|
+
/** @field address of one or more parent archivists to read from */
|
|
156
|
+
parents?: ArchivistParents;
|
|
157
|
+
/** @field fail if some parents can not be resolved (true if unspecified) */
|
|
158
|
+
requireAllParents?: boolean;
|
|
159
|
+
schema: TConfig extends Payload ? TConfig['schema'] : ArchivistConfigSchema;
|
|
160
|
+
/** @field storage configuration */
|
|
161
|
+
storage?: ArchivistStorage;
|
|
162
|
+
/** @field should child store all reads from parents? */
|
|
163
|
+
storeParentReads?: boolean;
|
|
164
|
+
}, TConfig>, TSchema>;
|
|
165
|
+
|
|
166
|
+
interface ArchivistModuleInstance<TParams extends ModuleParams<AnyConfigSchema<ArchivistConfig>> = ModuleParams<AnyConfigSchema<ArchivistConfig>>, TEventData extends ArchivistModuleEventData = ArchivistModuleEventData> extends Module<TParams, TEventData> {
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface ArchivistParentInstances {
|
|
170
|
+
commit?: ArchivistInstance[];
|
|
171
|
+
read?: ArchivistInstance[];
|
|
172
|
+
write?: ArchivistInstance[];
|
|
173
|
+
}
|
|
174
|
+
interface ArchivistParamFields {
|
|
175
|
+
parents?: ArchivistParentInstances;
|
|
176
|
+
}
|
|
177
|
+
interface ArchivistParams<TConfig extends AnyConfigSchema<ArchivistConfig> = AnyConfigSchema<ArchivistConfig>> extends ModuleParams<TConfig>, ArchivistParamFields {
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface ArchivistRawQueryFunctions {
|
|
181
|
+
allQuery(account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
182
|
+
clearQuery(account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
183
|
+
commitQuery(account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
184
|
+
deleteQuery(hashes: Hash[], account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
185
|
+
getQuery(hashes: Hash[], account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
186
|
+
insertQuery(payloads: Payload[], account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
187
|
+
nextQuery(options?: ArchivistNextOptions, account?: AccountInstance): Promisable<ModuleQueryResult>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
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> {
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
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> {
|
|
194
|
+
}
|
|
195
|
+
type AttachableArchivistInstanceTypeCheck<T extends AttachableArchivistInstance = AttachableArchivistInstance> = TypeCheck<T>;
|
|
196
|
+
declare class IsAttachableArchivistInstanceFactory<T extends AttachableArchivistInstance = AttachableArchivistInstance> extends IsObjectFactory<T> {
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare const asAttachableArchivistInstance: _xylabs_object.AsTypeFunction<AttachableArchivistInstance<ArchivistParams<_xyo_network_module_model.AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, _xyo_network_payload_model.Payload>>;
|
|
200
|
+
|
|
201
|
+
declare const requiredAttachableArchivistInstanceFunctions: ObjectTypeShape;
|
|
202
|
+
declare const isAttachableArchivistInstance: TypeCheck<AttachableArchivistInstance>;
|
|
203
|
+
|
|
204
|
+
interface ArchivistLabels extends Labels {
|
|
205
|
+
'network.xyo.archivist.persistence.scope': 'memory' | 'thread' | 'process' | 'device' | 'network';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
type IdentityFunction<T> = (value: unknown) => value is T;
|
|
209
|
+
|
|
210
|
+
declare const tryGetTypedBoundWitness: <T extends BoundWitness>(archivist: ReadArchivist, hash: Hash, identity: IdentityFunction<WithStorageMeta<T>>) => Promise<WithStorageMeta<T> | undefined>;
|
|
211
|
+
declare const getTypedBoundWitness: <T extends BoundWitness>(archivist: ReadArchivist, hash: Hash, identity: IdentityFunction<WithStorageMeta<T>>) => Promise<WithStorageMeta<T>>;
|
|
212
|
+
declare const getBoundWitness: (archivist: ReadArchivist, hash: Hash) => Promise<WithStorageMeta<BoundWitness>>;
|
|
213
|
+
|
|
214
|
+
type HydratedBoundWitness<T extends BoundWitness = BoundWitness, P extends Payload = Payload> = [T, P[]];
|
|
215
|
+
type HydratedBoundWitnessWithStorageMeta<T extends BoundWitness = BoundWitness, P extends Payload = Payload> = [WithStorageMeta<T>, WithStorageMeta<P>[]];
|
|
216
|
+
type SignedHydratedBoundWitness<T extends SignedBoundWitness = SignedBoundWitness, P extends Payload = Payload> = [T, P[]];
|
|
217
|
+
type SignedHydratedBoundWitnessWithStorageMeta<T extends SignedBoundWitness = SignedBoundWitness, P extends Payload = Payload> = [WithStorageMeta<T>, WithStorageMeta<P>[]];
|
|
218
|
+
|
|
219
|
+
declare const tryHydrateTypedBoundWitness: <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>, identity: IdentityFunction<WithStorageMeta<T>>) => Promise<HydratedBoundWitness<T> | undefined>;
|
|
220
|
+
declare const hydrateTypedBoundWitness: <T extends BoundWitness>(archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<T>, identity: IdentityFunction<WithStorageMeta<T>>) => Promise<HydratedBoundWitness<T>>;
|
|
221
|
+
declare const hydrateBoundWitness: (archivist: ReadArchivist, hashOrBw: Hash | WithStorageMeta<BoundWitness>) => Promise<HydratedBoundWitness<BoundWitness>>;
|
|
222
|
+
|
|
223
|
+
declare const ArchivistAllQuerySchema: "network.xyo.query.archivist.all";
|
|
224
|
+
type ArchivistAllQuerySchema = typeof ArchivistAllQuerySchema;
|
|
225
|
+
type ArchivistAllQuery = Query<{
|
|
226
|
+
schema: ArchivistAllQuerySchema;
|
|
227
|
+
}>;
|
|
228
|
+
|
|
229
|
+
declare const ArchivistClearQuerySchema: "network.xyo.query.archivist.clear";
|
|
230
|
+
type ArchivistClearQuerySchema = typeof ArchivistClearQuerySchema;
|
|
231
|
+
type ArchivistClearQuery = Query<{
|
|
232
|
+
schema: ArchivistClearQuerySchema;
|
|
233
|
+
}>;
|
|
234
|
+
|
|
235
|
+
declare const ArchivistCommitQuerySchema: "network.xyo.query.archivist.commit";
|
|
236
|
+
type ArchivistCommitQuerySchema = typeof ArchivistCommitQuerySchema;
|
|
237
|
+
type ArchivistCommitQuery = Query<{
|
|
238
|
+
schema: ArchivistCommitQuerySchema;
|
|
239
|
+
}>;
|
|
240
|
+
|
|
241
|
+
declare const ArchivistDeleteQuerySchema: "network.xyo.query.archivist.delete";
|
|
242
|
+
type ArchivistDeleteQuerySchema = typeof ArchivistDeleteQuerySchema;
|
|
243
|
+
type ArchivistDeleteQuery = Query<{
|
|
244
|
+
hashes: Hash[];
|
|
245
|
+
schema: ArchivistDeleteQuerySchema;
|
|
246
|
+
}>;
|
|
247
|
+
|
|
248
|
+
declare const ArchivistGetQuerySchema: "network.xyo.query.archivist.get";
|
|
249
|
+
type ArchivistGetQuerySchema = typeof ArchivistGetQuerySchema;
|
|
250
|
+
type ArchivistGetQuery = Query<{
|
|
251
|
+
hashes: Hash[];
|
|
252
|
+
schema: ArchivistGetQuerySchema;
|
|
253
|
+
}>;
|
|
254
|
+
|
|
255
|
+
declare const ArchivistInsertQuerySchema: "network.xyo.query.archivist.insert";
|
|
256
|
+
type ArchivistInsertQuerySchema = typeof ArchivistInsertQuerySchema;
|
|
257
|
+
type ArchivistInsertQuery = Query<{
|
|
258
|
+
schema: ArchivistInsertQuerySchema;
|
|
259
|
+
}>;
|
|
260
|
+
|
|
261
|
+
declare const ArchivistNextQuerySchema: "network.xyo.query.archivist.next";
|
|
262
|
+
type ArchivistNextQuerySchema = typeof ArchivistNextQuerySchema;
|
|
263
|
+
type ArchivistNextQuery = Query<ArchivistNextOptions, ArchivistNextQuerySchema>;
|
|
264
|
+
|
|
265
|
+
declare const ArchivistSnapshotQuerySchema: "network.xyo.query.archivist.snapshot";
|
|
266
|
+
type ArchivistSnapshotQuerySchema = typeof ArchivistSnapshotQuerySchema;
|
|
267
|
+
type ArchivistSnapshotQuery = Query<{
|
|
268
|
+
schema: ArchivistSnapshotQuerySchema;
|
|
269
|
+
}>;
|
|
270
|
+
|
|
271
|
+
type ArchivistQueries = ArchivistAllQuery | ArchivistClearQuery | ArchivistCommitQuery | ArchivistDeleteQuery | ArchivistGetQuery | ArchivistInsertQuery | ArchivistNextQuery | ArchivistSnapshotQuery;
|
|
272
|
+
type ArchivistModuleQueries = ModuleQueries | ArchivistQueries;
|
|
273
|
+
|
|
274
|
+
declare const isArchivistInstance: TypeCheck<ArchivistInstance>;
|
|
275
|
+
declare const isArchivistModule: TypeCheck<ArchivistModuleInstance>;
|
|
276
|
+
declare const asArchivistModule: _xylabs_object.AsTypeFunction<ArchivistModuleInstance<_xyo_network_module_model.ModuleParams<_xyo_network_module_model.AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData>>;
|
|
277
|
+
declare const asArchivistInstance: _xylabs_object.AsTypeFunction<ArchivistInstance<ArchivistParams<_xyo_network_module_model.AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, _xyo_network_payload_model.Payload>>;
|
|
278
|
+
declare const withArchivistModule: <R>(mod: any, closure: (mod: ArchivistModuleInstance<_xyo_network_module_model.ModuleParams<_xyo_network_module_model.AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData>) => R) => R | undefined;
|
|
279
|
+
declare const withArchivistInstance: <R>(mod: any, closure: (mod: ArchivistInstance<ArchivistParams<_xyo_network_module_model.AnyConfigSchema<ArchivistConfig>>, ArchivistModuleEventData, _xyo_network_payload_model.Payload>) => R) => R | undefined;
|
|
280
|
+
|
|
281
|
+
export { ArchivistAllQuerySchema, ArchivistClearQuerySchema, ArchivistCommitQuerySchema, ArchivistConfigSchema, ArchivistDeleteQuerySchema, ArchivistGetQuerySchema, ArchivistInsertQuerySchema, ArchivistNextQuerySchema, ArchivistSnapshotPayloadSchema, ArchivistSnapshotQuerySchema, ArchivistStatsPayloadSchema, IndexSeparator, IsAttachableArchivistInstanceFactory, asArchivistInstance, asArchivistModule, asAttachableArchivistInstance, buildStandardIndexName, getBoundWitness, getTypedBoundWitness, hydrateBoundWitness, hydrateTypedBoundWitness, isArchivistInstance, isArchivistModule, isAttachableArchivistInstance, requiredAttachableArchivistInstanceFunctions, tryGetTypedBoundWitness, tryHydrateTypedBoundWitness, withArchivistInstance, withArchivistModule };
|
|
282
|
+
export type { AllArchivist, AllArchivistFunctions, Archivist, ArchivistAllQuery, ArchivistClearQuery, ArchivistCommitQuery, ArchivistConfig, ArchivistDeleteQuery, ArchivistDriver, ArchivistGetCache, ArchivistGetQuery, ArchivistInsertQuery, ArchivistInstance, ArchivistLabels, ArchivistModuleEventData, ArchivistModuleInstance, ArchivistModuleQueries, ArchivistNextOptions, ArchivistNextQuery, ArchivistParamFields, ArchivistParams, ArchivistParentInstances, ArchivistParents, ArchivistQueries, ArchivistRawQueryFunctions, ArchivistSnapshotPayload, ArchivistSnapshotQuery, ArchivistStatsPayload, ArchivistStorage, AttachableArchivistInstance, AttachableArchivistInstanceTypeCheck, FullArchivist, HydratedBoundWitness, HydratedBoundWitnessWithStorageMeta, IdentityFunction, IndexDescription, IndexDirection, NextOptions, ReadArchivist, ReadArchivistFunctions, ReadWriteArchivist, SignedHydratedBoundWitness, SignedHydratedBoundWitnessWithStorageMeta, StashArchivist, StashArchivistFunctions, WriteArchivist, WriteArchivistFunctions };
|
|
@@ -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 { 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 = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])\nexport const isArchivistModule = 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":"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","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)).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":"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","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.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -21,29 +21,29 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"types": "./dist/
|
|
24
|
+
"types": "./dist/neutral/index.d.ts",
|
|
25
25
|
"default": "./dist/neutral/index.mjs"
|
|
26
26
|
},
|
|
27
27
|
"./package.json": "./package.json"
|
|
28
28
|
},
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
|
-
"types": "dist/
|
|
30
|
+
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/assert": "^4.13.
|
|
33
|
-
"@xylabs/events": "^4.13.
|
|
34
|
-
"@xylabs/exists": "^4.13.
|
|
35
|
-
"@xylabs/hex": "^4.13.
|
|
36
|
-
"@xylabs/object": "^4.13.
|
|
37
|
-
"@xylabs/promise": "^4.13.
|
|
38
|
-
"@xylabs/typeof": "^4.13.
|
|
39
|
-
"@xyo-network/account-model": "^4.0
|
|
40
|
-
"@xyo-network/boundwitness-model": "^4.0
|
|
41
|
-
"@xyo-network/module-model": "^4.0
|
|
42
|
-
"@xyo-network/payload-model": "^4.0
|
|
32
|
+
"@xylabs/assert": "^4.13.15",
|
|
33
|
+
"@xylabs/events": "^4.13.15",
|
|
34
|
+
"@xylabs/exists": "^4.13.15",
|
|
35
|
+
"@xylabs/hex": "^4.13.15",
|
|
36
|
+
"@xylabs/object": "^4.13.15",
|
|
37
|
+
"@xylabs/promise": "^4.13.15",
|
|
38
|
+
"@xylabs/typeof": "^4.13.15",
|
|
39
|
+
"@xyo-network/account-model": "^4.1.0",
|
|
40
|
+
"@xyo-network/boundwitness-model": "^4.1.0",
|
|
41
|
+
"@xyo-network/module-model": "^4.1.0",
|
|
42
|
+
"@xyo-network/payload-model": "^4.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
46
|
-
"@xylabs/tsconfig": "^
|
|
45
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
|
|
46
|
+
"@xylabs/tsconfig": "^7.0.0-rc.20",
|
|
47
47
|
"typescript": "^5.8.3"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
package/src/typeChecks.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TypeCheck } from '@xylabs/object'
|
|
1
2
|
import { AsObjectFactory } from '@xylabs/object'
|
|
2
3
|
import {
|
|
3
4
|
IsInstanceFactory, IsModuleFactory, isModuleInstance, WithFactory,
|
|
@@ -7,8 +8,8 @@ import type { ArchivistInstance } from './Instance.ts'
|
|
|
7
8
|
import type { ArchivistModuleInstance } from './ModuleInstance.ts'
|
|
8
9
|
import { ArchivistGetQuerySchema } from './Queries/index.ts'
|
|
9
10
|
|
|
10
|
-
export const isArchivistInstance = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])
|
|
11
|
-
export const isArchivistModule = new IsModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])
|
|
11
|
+
export const isArchivistInstance: TypeCheck<ArchivistInstance> = new IsInstanceFactory<ArchivistInstance>().create({ get: 'function' }, [isModuleInstance])
|
|
12
|
+
export const isArchivistModule: TypeCheck<ArchivistModuleInstance> = new IsModuleFactory<ArchivistModuleInstance>().create([ArchivistGetQuerySchema])
|
|
12
13
|
|
|
13
14
|
export const asArchivistModule = AsObjectFactory.create(isArchivistModule)
|
|
14
15
|
export const asArchivistInstance = AsObjectFactory.create(isArchivistInstance)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typeChecks.d.ts","sourceRoot":"","sources":["../../src/typeChecks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGlE,eAAO,MAAM,mBAAmB,2RAA6F,CAAA;AAC7H,eAAO,MAAM,iBAAiB,+QAAmF,CAAA;AAEjH,eAAO,MAAM,iBAAiB,mQAA4C,CAAA;AAC1E,eAAO,MAAM,mBAAmB,gSAA8C,CAAA;AAC9E,eAAO,MAAM,mBAAmB,+QAAwC,CAAA;AACxE,eAAO,MAAM,qBAAqB,4SAA0C,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|