@xyo-network/archivist-indexeddb 4.1.2 → 4.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,105 +1,5 @@
1
- import { Hash, Hex } from '@xylabs/hex';
2
- import { ObjectStore } from '@xylabs/indexed-db';
3
- import { AbstractArchivist } from '@xyo-network/archivist-abstract';
4
- import { ArchivistConfig, ArchivistParams, ArchivistModuleEventData, ArchivistNextOptions } from '@xyo-network/archivist-model';
5
- import { WithStorageMeta, Schema, Payload } from '@xyo-network/payload-model';
6
- import { IDBPDatabase } from 'idb';
7
- import { AnyConfigSchema } from '@xyo-network/module-model';
8
-
9
- declare const IndexedDbArchivistSchema: "network.xyo.archivist.indexeddb";
10
- type IndexedDbArchivistSchema = typeof IndexedDbArchivistSchema;
11
-
12
- type IndexedDbArchivistConfigSchema = `${IndexedDbArchivistSchema}.config`;
13
- declare const IndexedDbArchivistConfigSchema: IndexedDbArchivistConfigSchema;
14
- type IndexedDbArchivistConfig<TStoreName extends string = string> = ArchivistConfig<{
15
- /**
16
- * The database name
17
- */
18
- dbName?: string;
19
- /**
20
- * The version of the DB, defaults to 1
21
- */
22
- dbVersion?: number;
23
- schema: IndexedDbArchivistConfigSchema;
24
- /**
25
- * The name of the object store
26
- */
27
- storeName?: TStoreName;
28
- }>;
29
-
30
- type IndexedDbArchivistParams = ArchivistParams<AnyConfigSchema<IndexedDbArchivistConfig>>;
31
-
32
- interface PayloadStore {
33
- [s: string]: WithStorageMeta;
34
- }
35
- declare class IndexedDbArchivist<TParams extends IndexedDbArchivistParams = IndexedDbArchivistParams, TEventData extends ArchivistModuleEventData = ArchivistModuleEventData> extends AbstractArchivist<TParams, TEventData> {
36
- static readonly configSchemas: Schema[];
37
- static readonly defaultConfigSchema: Schema;
38
- static readonly defaultDbName = "archivist";
39
- static readonly defaultDbVersion = 1;
40
- static readonly defaultStoreName = "payloads";
41
- static readonly labels: {
42
- "network.xyo.storage.class": string;
43
- };
44
- private static readonly dataHashIndex;
45
- private static readonly hashIndex;
46
- private static readonly schemaIndex;
47
- private static readonly sequenceIndex;
48
- static readonly hashIndexName: string;
49
- static readonly dataHashIndexName: string;
50
- static readonly schemaIndexName: string;
51
- static readonly sequenceIndexName: string;
52
- private _dbName?;
53
- private _dbVersion?;
54
- private _payloadCount;
55
- private _storeName?;
56
- /**
57
- * The database name. If not supplied via config, it defaults
58
- * to the module name (not guaranteed to be unique) and if module
59
- * name is not supplied, it defaults to `archivist`. This behavior
60
- * biases towards a single, isolated DB per archivist which seems to
61
- * make the most sense for 99% of use cases.
62
- */
63
- get dbName(): string;
64
- /**
65
- * The database version. If not supplied via config, it defaults to 1.
66
- */
67
- get dbVersion(): number;
68
- get queries(): string[];
69
- /**
70
- * The name of the object store. If not supplied via config, it defaults
71
- * to `payloads`.
72
- */
73
- get storeName(): string;
74
- /**
75
- * The indexes to create on the store
76
- */
77
- private get indexes();
78
- protected allHandler(): Promise<WithStorageMeta<Payload>[]>;
79
- protected clearHandler(): Promise<void>;
80
- protected deleteHandler(hashes: Hash[]): Promise<WithStorageMeta<Payload>[]>;
81
- protected getFromCursor(db: IDBPDatabase<ObjectStore>, storeName: string, order?: 'asc' | 'desc', limit?: number, cursor?: Hex, open?: boolean): Promise<WithStorageMeta[]>;
82
- /**
83
- * Uses an index to get a payload by the index value, but returns the value with the primary key (from the root store)
84
- * @param db The db instance to use
85
- * @param storeName The name of the store to use
86
- * @param indexName The index to use
87
- * @param key The key to get from the index
88
- * @returns The primary key and the payload, or undefined if not found
89
- */
90
- protected getFromIndexWithPrimaryKey(db: IDBPDatabase<ObjectStore>, storeName: string, indexName: string, key: IDBValidKey): Promise<[number, WithStorageMeta] | undefined>;
91
- protected getHandler(hashes: string[]): Promise<WithStorageMeta[]>;
92
- protected insertHandler(payloads: WithStorageMeta<Payload>[]): Promise<WithStorageMeta<Payload>[]>;
93
- protected nextHandler(options?: ArchivistNextOptions): Promise<WithStorageMeta<Payload>[]>;
94
- protected payloadCountHandler(): number;
95
- protected startHandler(): Promise<void>;
96
- /**
97
- * Executes a callback with the initialized DB and then closes the db
98
- * @param callback The method to execute with the initialized DB
99
- * @returns
100
- */
101
- private useDb;
102
- }
103
-
104
- export { IndexedDbArchivist, IndexedDbArchivistConfigSchema, IndexedDbArchivistSchema };
105
- export type { IndexedDbArchivistConfig, IndexedDbArchivistParams, PayloadStore };
1
+ export * from './Archivist.ts';
2
+ export * from './Config.ts';
3
+ export * from './Params.ts';
4
+ export * from './Schema.ts';
5
+ //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/archivist-indexeddb",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,29 +29,29 @@
29
29
  "module": "dist/browser/index.mjs",
30
30
  "types": "dist/browser/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/array": "^4.13.15",
33
- "@xylabs/assert": "^4.13.15",
34
- "@xylabs/exists": "^4.13.15",
35
- "@xylabs/hex": "^4.13.15",
36
- "@xylabs/indexed-db": "^4.13.15",
37
- "@xylabs/typeof": "^4.13.15",
38
- "@xyo-network/archivist-abstract": "^4.1.2",
39
- "@xyo-network/archivist-model": "^4.1.2",
40
- "@xyo-network/module-model": "^4.1.2",
41
- "@xyo-network/payload-builder": "^4.1.2",
42
- "@xyo-network/payload-model": "^4.1.2",
32
+ "@xylabs/array": "^4.13.16",
33
+ "@xylabs/assert": "^4.13.16",
34
+ "@xylabs/exists": "^4.13.16",
35
+ "@xylabs/hex": "^4.13.16",
36
+ "@xylabs/indexed-db": "^4.13.16",
37
+ "@xylabs/typeof": "^4.13.16",
38
+ "@xyo-network/archivist-abstract": "^4.1.4",
39
+ "@xyo-network/archivist-model": "^4.1.4",
40
+ "@xyo-network/module-model": "^4.1.4",
41
+ "@xyo-network/payload-builder": "^4.1.4",
42
+ "@xyo-network/payload-model": "^4.1.4",
43
43
  "idb": "^8.0.3"
44
44
  },
45
45
  "devDependencies": {
46
- "@xylabs/delay": "^4.13.15",
47
- "@xylabs/object": "^4.13.15",
48
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.23",
49
- "@xylabs/tsconfig": "^7.0.0-rc.23",
50
- "@xyo-network/account": "^4.1.2",
51
- "@xyo-network/account-model": "^4.1.2",
52
- "@xyo-network/archivist-acceptance-tests": "^4.1.2",
53
- "@xyo-network/id-payload-plugin": "^4.1.2",
54
- "@xyo-network/payload-wrapper": "^4.1.2",
46
+ "@xylabs/delay": "^4.13.16",
47
+ "@xylabs/object": "^4.13.16",
48
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
49
+ "@xylabs/tsconfig": "^7.0.0-rc.27",
50
+ "@xyo-network/account": "^4.1.4",
51
+ "@xyo-network/account-model": "^4.1.4",
52
+ "@xyo-network/archivist-acceptance-tests": "^4.1.4",
53
+ "@xyo-network/id-payload-plugin": "^4.1.4",
54
+ "@xyo-network/payload-wrapper": "^4.1.4",
55
55
  "fake-indexeddb": "^6.0.1",
56
56
  "typescript": "^5.8.3",
57
57
  "uuid": "^11.1.0",