@xyo-network/archivist-model 3.6.0-rc.1 → 3.6.0-rc.11

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 +1 @@
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,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;wDAA6F,CAAA;AAC7H,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;sDAA2E,CAAA;AAEzG,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;yEANG,iBAAiB,iCACjB,gBAAmB;;;;;;;;;;;;;;;;;;;yEAEiB,iBAAiB;;;;;;;;;;;;;;;;;;4EAC9B,gBAAoB;CAEF,CAAA;AAC1E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;2EAPC,iBAAiB,iCACjB,gBAAmB;;;;;;;;;;;;;;;;;;;;;2EAEiB,iBAAiB;;;;;;;;;;;;;;;;;;;;8EAC9B,gBAAoB;CAGE,CAAA;AAC9E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;6EAAwC,CAAA;AACxE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;+EAA0C,CAAA"}
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,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA6F,CAAA;AAC7H,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAA2E,CAAA;AAEzG,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEANE,iBAAiB,iCAClB,gBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEAEiB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAC9B,gBAAoB;CAED,CAAA;AAC1E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAPA,iBAAiB,iCAClB,gBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAEiB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAC9B,gBAAoB;CAGG,CAAA;AAC9E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAAwC,CAAA;AACxE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA0C,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/archivist-model",
3
- "version": "3.6.0-rc.1",
3
+ "version": "3.6.0-rc.11",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,18 +29,18 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/hex": "^4.4.12",
33
- "@xylabs/object": "^4.4.12",
34
- "@xylabs/promise": "^4.4.12",
35
- "@xylabs/typeof": "^4.4.12",
36
- "@xyo-network/account-model": "^3.6.0-rc.1",
37
- "@xyo-network/module-events": "^3.6.0-rc.1",
38
- "@xyo-network/module-model": "^3.6.0-rc.1",
39
- "@xyo-network/payload-model": "^3.6.0-rc.1"
32
+ "@xylabs/hex": "^4.4.24",
33
+ "@xylabs/object": "^4.4.24",
34
+ "@xylabs/promise": "^4.4.24",
35
+ "@xylabs/typeof": "^4.4.24",
36
+ "@xyo-network/account-model": "^3.6.0-rc.11",
37
+ "@xyo-network/module-events": "^3.6.0-rc.11",
38
+ "@xyo-network/module-model": "^3.6.0-rc.11",
39
+ "@xyo-network/payload-model": "^3.6.0-rc.11"
40
40
  },
41
41
  "devDependencies": {
42
- "@xylabs/ts-scripts-yarn3": "^4.2.4",
43
- "@xylabs/tsconfig": "^4.2.4",
42
+ "@xylabs/ts-scripts-yarn3": "^4.2.6",
43
+ "@xylabs/tsconfig": "^4.2.6",
44
44
  "typescript": "^5.7.2"
45
45
  },
46
46
  "publishConfig": {
@@ -10,11 +10,7 @@ export type IndexDescription = {
10
10
  /**
11
11
  * The key(s) to index
12
12
  */
13
- key:
14
- | {
15
- [key: string]: IndexDirection
16
- }
17
- | Map<string, IndexDirection>
13
+ key: Record<string, IndexDirection>
18
14
  /**
19
15
  * Is the indexed value an array
20
16
  */
@@ -1,8 +1,8 @@
1
- import type { Hash } from '@xylabs/hex'
1
+ import type { Hash, Hex } from '@xylabs/hex'
2
2
 
3
- export interface NextOptions<TId = string> {
3
+ export interface NextOptions<TId = Hex> {
4
+ cursor?: TId
4
5
  limit?: number
5
- offset?: TId
6
6
  order?: 'asc' | 'desc'
7
7
  }
8
8
 
@@ -1,7 +1,7 @@
1
1
  import type { Hash } from '@xylabs/hex'
2
2
  import type { Promisable, PromisableArray } from '@xylabs/promise'
3
3
  import type { ModuleQueryFunctions } from '@xyo-network/module-model'
4
- import type { Payload } from '@xyo-network/payload-model'
4
+ import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
5
5
 
6
6
  import type { NextOptions } from './NextOptions.ts'
7
7
 
@@ -26,8 +26,8 @@ export interface Archivist<
26
26
  TWriteResponse extends Payload = Payload,
27
27
  TWrite extends Payload = TReadResponse & Payload,
28
28
  TId = Hash,
29
- > extends ReadArchivist<TReadResponse, TId>,
30
- WriteArchivist<TReadResponse, TWriteResponse, TWrite, TId>,
29
+ > extends ReadArchivist<WithStorageMeta<TReadResponse>, TId>,
30
+ WriteArchivist<WithStorageMeta<TReadResponse>, WithStorageMeta<TWriteResponse>, TWrite, TId>,
31
31
  StashArchivist<TWriteResponse> {}
32
32
 
33
33
  export interface ArchivistQueryFunctions<
@@ -0,0 +1,37 @@
1
+ import type { Hash, Hex } from '@xylabs/hex'
2
+ import type { Payload } from '@xyo-network/payload-model'
3
+
4
+ export interface StorageMeta {
5
+ _dataHash: Hash
6
+ _hash: Hash
7
+ // this sequence number must be a 0 padded string representation of a 18 byte sequence number
8
+ _sequence: Hex // zero padded epoch/index (when returned, has address as suffix) - to be used as a universal cursor
9
+ }
10
+
11
+ export type WithPartialStorageMeta<T extends Payload = Payload> = Partial<WithStorageMeta<T>>
12
+
13
+ export type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta
14
+
15
+ const StorageMetaComponentConstants = {
16
+ epochBytes: 8,
17
+ nonceBytes: 8,
18
+ addressBytes: 20,
19
+ }
20
+
21
+ const StorageMetaLocalConstants = {
22
+ maxEpoch: Math.pow(256, StorageMetaComponentConstants.epochBytes) - 1,
23
+ localSequenceBytes: StorageMetaComponentConstants.epochBytes + StorageMetaComponentConstants.nonceBytes,
24
+ ...StorageMetaComponentConstants,
25
+ }
26
+
27
+ export const SequenceConstants = {
28
+ qualifiedSequenceBytes: StorageMetaLocalConstants.localSequenceBytes + StorageMetaComponentConstants.addressBytes,
29
+ ...StorageMetaLocalConstants,
30
+ }
31
+
32
+ // "00005a7f354762f3ac1bc5ddc6cfd08d14" is and example of a local sequence string
33
+
34
+ // "00005a7f354762f3ac1bc5ddc6cfd08d14a123456789abcdef0123" is and example of a local sequence string
35
+ // epoch = "00005a7f354762f3ac"
36
+ // nonce = "1bc5ddc6cfd08d14"
37
+ // address = "a123456789abcdef0123"