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

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,18 @@
1
+ import type { Hash, Hex } from '@xylabs/hex';
2
+ import type { Payload } from '@xyo-network/payload-model';
3
+ export interface StorageMeta {
4
+ _dataHash: Hash;
5
+ _hash: Hash;
6
+ _sequence: Hex;
7
+ }
8
+ export type WithPartialStorageMeta<T extends Payload = Payload> = Partial<WithStorageMeta<T>>;
9
+ export type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
10
+ export declare const StorageMetaConstants: {
11
+ epochBytes: number;
12
+ nonceBytes: number;
13
+ addressBytes: number;
14
+ maxEpoch: number;
15
+ localSequenceBytes: number;
16
+ qualifiedSequenceBytes: number;
17
+ };
18
+ //# sourceMappingURL=StorageMeta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageMeta.d.ts","sourceRoot":"","sources":["../../src/StorageMeta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,IAAI,CAAA;IACf,KAAK,EAAE,IAAI,CAAA;IAEX,SAAS,EAAE,GAAG,CAAA;CACf;AAED,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7F,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,WAAW,CAAA;AAc1E,eAAO,MAAM,oBAAoB;;;;;;;CAGhC,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.2",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -33,10 +33,10 @@
33
33
  "@xylabs/object": "^4.4.12",
34
34
  "@xylabs/promise": "^4.4.12",
35
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"
36
+ "@xyo-network/account-model": "^3.6.0-rc.2",
37
+ "@xyo-network/module-events": "^3.6.0-rc.2",
38
+ "@xyo-network/module-model": "^3.6.0-rc.2",
39
+ "@xyo-network/payload-model": "^3.6.0-rc.2"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@xylabs/ts-scripts-yarn3": "^4.2.4",
@@ -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 StorageMetaConstants = {
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"