@xyo-network/archivist-memory 3.9.17 → 3.9.19
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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Hash } from '@xylabs/hex';
|
|
2
|
+
import { Promisable } from '@xylabs/promise';
|
|
3
|
+
import { AccountInstance } from '@xyo-network/account';
|
|
4
|
+
import { AbstractArchivist } from '@xyo-network/archivist-abstract';
|
|
5
|
+
import { ArchivistModuleEventData, ArchivistNextOptions, ArchivistParams, AttachableArchivistInstance } from '@xyo-network/archivist-model';
|
|
6
|
+
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
7
|
+
import { AnyConfigSchema, ModuleInstance } from '@xyo-network/module-model';
|
|
8
|
+
import { Payload, Schema, WithStorageMeta } from '@xyo-network/payload-model';
|
|
9
|
+
import { LRUCache } from 'lru-cache';
|
|
10
|
+
import { MemoryArchivistConfig } from './Config.ts';
|
|
11
|
+
export type MemoryArchivistParams<TConfig extends AnyConfigSchema<MemoryArchivistConfig> = AnyConfigSchema<MemoryArchivistConfig>> = ArchivistParams<TConfig>;
|
|
12
|
+
export declare class MemoryArchivist<TParams extends MemoryArchivistParams<AnyConfigSchema<MemoryArchivistConfig>> = MemoryArchivistParams, TEventData extends ArchivistModuleEventData = ArchivistModuleEventData> extends AbstractArchivist<TParams, TEventData> implements AttachableArchivistInstance, ModuleInstance {
|
|
13
|
+
static readonly configSchemas: Schema[];
|
|
14
|
+
static readonly defaultConfigSchema: Schema;
|
|
15
|
+
private _cache?;
|
|
16
|
+
private _dataHashIndex?;
|
|
17
|
+
private _sequenceIndex;
|
|
18
|
+
get queries(): string[];
|
|
19
|
+
protected get cache(): LRUCache<Lowercase<string>, WithStorageMeta<Payload>, unknown>;
|
|
20
|
+
protected get dataHashIndex(): LRUCache<Lowercase<string>, Lowercase<string>, unknown>;
|
|
21
|
+
protected get max(): number;
|
|
22
|
+
private static findIndexFromCursor;
|
|
23
|
+
from(payloads: Payload[], account?: AccountInstance): Promise<MemoryArchivist>;
|
|
24
|
+
protected allHandler(): Promisable<WithStorageMeta<Payload>[]>;
|
|
25
|
+
protected clearHandler(): void | Promise<void>;
|
|
26
|
+
protected commitHandler(): Promise<BoundWitness[]>;
|
|
27
|
+
protected deleteHandler(hashes: Hash[]): Promise<Hash[]>;
|
|
28
|
+
protected getHandler(hashes: Hash[]): Promisable<WithStorageMeta<Payload>[]>;
|
|
29
|
+
protected insertHandler(payloads: WithStorageMeta<Payload>[]): WithStorageMeta<Payload>[];
|
|
30
|
+
protected nextHandler(options?: ArchivistNextOptions): Promisable<WithStorageMeta<Payload>[]>;
|
|
31
|
+
private insertPayloadIntoCache;
|
|
32
|
+
private rebuildDataHashIndex;
|
|
33
|
+
private rebuildSequenceIndex;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Archivist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Archivist.d.ts","sourceRoot":"","sources":["../../src/Archivist.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAO,MAAM,aAAa,CAAA;AACvC,OAAO,EAAa,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAW,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAOL,wBAAwB,EACxB,oBAAoB,EAEpB,eAAe,EACf,2BAA2B,EAC5B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EACL,eAAe,EAAmB,cAAc,EACjD,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,OAAO,EAAE,MAAM,EAAE,eAAe,EACjC,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,qBAAqB,EAA+B,M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OAAO,CAAC,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,EAAE;cAQ/E,WAAW,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,UAAU,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;IActG,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,oBAAoB;YAQd,oBAAoB;CAGnC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EmptyObject, WithAdditional } from '@xylabs/object';
|
|
2
|
+
import type { ArchivistConfig } from '@xyo-network/archivist-model';
|
|
3
|
+
import type { Payload, Schema } from '@xyo-network/payload-model';
|
|
4
|
+
export declare const MemoryArchivistConfigSchema: "network.xyo.archivist.memory.config";
|
|
5
|
+
export type MemoryArchivistConfigSchema = typeof MemoryArchivistConfigSchema;
|
|
6
|
+
export type MemoryArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ArchivistConfig<WithAdditional<{
|
|
7
|
+
max?: number;
|
|
8
|
+
}, TConfig>, TSchema extends Schema ? TSchema : MemoryArchivistConfigSchema | ArchivistConfig['schema']>;
|
|
9
|
+
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEjE,eAAO,MAAM,2BAA2B,EAAG,qCAA8C,CAAA;AACzF,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAE5E,MAAM,MAAM,qBAAqB,CAAC,OAAO,SAAS,OAAO,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,EAAE,OAAO,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,eAAe,CAC5I,cAAc,CACZ;IACE,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,EACD,OAAO,CACR,EACD,OAAO,SAAS,MAAM,GAAG,OAAO,GAAG,2BAA2B,GAAG,eAAe,CAAC,QAAQ,CAAC,CAC3F,CAAA"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,43 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { AbstractArchivist } from '@xyo-network/archivist-abstract';
|
|
5
|
-
import { ArchivistConfig, ArchivistParams, ArchivistModuleEventData, AttachableArchivistInstance, ArchivistNextOptions } from '@xyo-network/archivist-model';
|
|
6
|
-
import { BoundWitness } from '@xyo-network/boundwitness-model';
|
|
7
|
-
import { AnyConfigSchema, ModuleInstance } from '@xyo-network/module-model';
|
|
8
|
-
import { Payload, Schema, WithStorageMeta } from '@xyo-network/payload-model';
|
|
9
|
-
import { LRUCache } from 'lru-cache';
|
|
10
|
-
import { EmptyObject, WithAdditional } from '@xylabs/object';
|
|
11
|
-
|
|
12
|
-
declare const MemoryArchivistConfigSchema: "network.xyo.archivist.memory.config";
|
|
13
|
-
type MemoryArchivistConfigSchema = typeof MemoryArchivistConfigSchema;
|
|
14
|
-
type MemoryArchivistConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ArchivistConfig<WithAdditional<{
|
|
15
|
-
max?: number;
|
|
16
|
-
}, TConfig>, TSchema extends Schema ? TSchema : MemoryArchivistConfigSchema | ArchivistConfig['schema']>;
|
|
17
|
-
|
|
18
|
-
type MemoryArchivistParams<TConfig extends AnyConfigSchema<MemoryArchivistConfig> = AnyConfigSchema<MemoryArchivistConfig>> = ArchivistParams<TConfig>;
|
|
19
|
-
declare class MemoryArchivist<TParams extends MemoryArchivistParams<AnyConfigSchema<MemoryArchivistConfig>> = MemoryArchivistParams, TEventData extends ArchivistModuleEventData = ArchivistModuleEventData> extends AbstractArchivist<TParams, TEventData> implements AttachableArchivistInstance, ModuleInstance {
|
|
20
|
-
static readonly configSchemas: Schema[];
|
|
21
|
-
static readonly defaultConfigSchema: Schema;
|
|
22
|
-
private _cache?;
|
|
23
|
-
private _dataHashIndex?;
|
|
24
|
-
private _sequenceIndex;
|
|
25
|
-
get queries(): string[];
|
|
26
|
-
protected get cache(): LRUCache<Lowercase<string>, WithStorageMeta<Payload>, unknown>;
|
|
27
|
-
protected get dataHashIndex(): LRUCache<Lowercase<string>, Lowercase<string>, unknown>;
|
|
28
|
-
protected get max(): number;
|
|
29
|
-
private static findIndexFromCursor;
|
|
30
|
-
from(payloads: Payload[], account?: AccountInstance): Promise<MemoryArchivist>;
|
|
31
|
-
protected allHandler(): Promisable<WithStorageMeta<Payload>[]>;
|
|
32
|
-
protected clearHandler(): void | Promise<void>;
|
|
33
|
-
protected commitHandler(): Promise<BoundWitness[]>;
|
|
34
|
-
protected deleteHandler(hashes: Hash[]): Promise<Hash[]>;
|
|
35
|
-
protected getHandler(hashes: Hash[]): Promisable<WithStorageMeta<Payload>[]>;
|
|
36
|
-
protected insertHandler(payloads: WithStorageMeta<Payload>[]): WithStorageMeta<Payload>[];
|
|
37
|
-
protected nextHandler(options?: ArchivistNextOptions): Promisable<WithStorageMeta<Payload>[]>;
|
|
38
|
-
private insertPayloadIntoCache;
|
|
39
|
-
private rebuildDataHashIndex;
|
|
40
|
-
private rebuildSequenceIndex;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { MemoryArchivist, type MemoryArchivistConfig, MemoryArchivistConfigSchema, type MemoryArchivistParams };
|
|
1
|
+
export * from './Archivist.ts';
|
|
2
|
+
export * from './Config.ts';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/archivist-memory",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.19",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"@xylabs/hex": "^4.5.1",
|
|
35
35
|
"@xylabs/object": "^4.5.1",
|
|
36
36
|
"@xylabs/promise": "^4.5.1",
|
|
37
|
-
"@xyo-network/account": "^3.9.
|
|
38
|
-
"@xyo-network/archivist-abstract": "^3.9.
|
|
39
|
-
"@xyo-network/archivist-model": "^3.9.
|
|
40
|
-
"@xyo-network/boundwitness-model": "^3.9.
|
|
41
|
-
"@xyo-network/module-model": "^3.9.
|
|
42
|
-
"@xyo-network/payload-builder": "^3.9.
|
|
43
|
-
"@xyo-network/payload-model": "^3.9.
|
|
37
|
+
"@xyo-network/account": "^3.9.19",
|
|
38
|
+
"@xyo-network/archivist-abstract": "^3.9.19",
|
|
39
|
+
"@xyo-network/archivist-model": "^3.9.19",
|
|
40
|
+
"@xyo-network/boundwitness-model": "^3.9.19",
|
|
41
|
+
"@xyo-network/module-model": "^3.9.19",
|
|
42
|
+
"@xyo-network/payload-builder": "^3.9.19",
|
|
43
|
+
"@xyo-network/payload-model": "^3.9.19",
|
|
44
44
|
"lru-cache": "^11.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@xylabs/delay": "^4.5.1",
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "^5.0.
|
|
49
|
-
"@xylabs/tsconfig": "^5.0.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "^5.0.39",
|
|
49
|
+
"@xylabs/tsconfig": "^5.0.39",
|
|
50
50
|
"@xylabs/vitest-extended": "^4.5.1",
|
|
51
|
-
"@xyo-network/account": "^3.9.
|
|
52
|
-
"@xyo-network/archivist-acceptance-tests": "^3.9.
|
|
53
|
-
"@xyo-network/id-payload-plugin": "^3.9.
|
|
54
|
-
"@xyo-network/payload-wrapper": "^3.9.
|
|
55
|
-
"typescript": "^5.
|
|
56
|
-
"vitest": "^3.0.
|
|
51
|
+
"@xyo-network/account": "^3.9.19",
|
|
52
|
+
"@xyo-network/archivist-acceptance-tests": "^3.9.19",
|
|
53
|
+
"@xyo-network/id-payload-plugin": "^3.9.19",
|
|
54
|
+
"@xyo-network/payload-wrapper": "^3.9.19",
|
|
55
|
+
"typescript": "^5.8.2",
|
|
56
|
+
"vitest": "^3.0.7"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|