@xyo-network/payload 2.38.8 → 2.38.10
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/cjs/Builder/Builder.d.ts +1 -1
- package/dist/cjs/Builder/Builder.d.ts.map +1 -1
- package/dist/cjs/Builder/Builder.js +6 -6
- package/dist/cjs/Builder/Builder.js.map +1 -1
- package/dist/cjs/Huri/Huri.d.ts +10 -10
- package/dist/cjs/Huri/Huri.d.ts.map +1 -1
- package/dist/cjs/Huri/Huri.js +47 -47
- package/dist/cjs/Huri/Huri.js.map +1 -1
- package/dist/cjs/SchemaNameValidator.d.ts +30 -30
- package/dist/cjs/SchemaNameValidator.d.ts.map +1 -1
- package/dist/cjs/SchemaNameValidator.js +53 -53
- package/dist/cjs/SchemaNameValidator.js.map +1 -1
- package/dist/cjs/Validator/Validator.d.ts +1 -1
- package/dist/cjs/Validator/Validator.d.ts.map +1 -1
- package/dist/cjs/Validator/Validator.js.map +1 -1
- package/dist/cjs/Wrapper/Wrapper.d.ts +4 -4
- package/dist/cjs/Wrapper/Wrapper.d.ts.map +1 -1
- package/dist/cjs/Wrapper/Wrapper.js +12 -12
- package/dist/cjs/Wrapper/Wrapper.js.map +1 -1
- package/dist/cjs/models/XyoPayloadFindFilter.d.ts +2 -2
- package/dist/cjs/models/XyoPayloadFindFilter.d.ts.map +1 -1
- package/dist/docs.json +911 -759
- package/dist/esm/Builder/Builder.d.ts +1 -1
- package/dist/esm/Builder/Builder.d.ts.map +1 -1
- package/dist/esm/Builder/Builder.js +6 -6
- package/dist/esm/Builder/Builder.js.map +1 -1
- package/dist/esm/Huri/Huri.d.ts +10 -10
- package/dist/esm/Huri/Huri.d.ts.map +1 -1
- package/dist/esm/Huri/Huri.js +46 -46
- package/dist/esm/Huri/Huri.js.map +1 -1
- package/dist/esm/SchemaNameValidator.d.ts +30 -30
- package/dist/esm/SchemaNameValidator.d.ts.map +1 -1
- package/dist/esm/SchemaNameValidator.js +53 -53
- package/dist/esm/SchemaNameValidator.js.map +1 -1
- package/dist/esm/Validator/Validator.d.ts +1 -1
- package/dist/esm/Validator/Validator.d.ts.map +1 -1
- package/dist/esm/Validator/Validator.js +1 -1
- package/dist/esm/Validator/Validator.js.map +1 -1
- package/dist/esm/Wrapper/Wrapper.d.ts +4 -4
- package/dist/esm/Wrapper/Wrapper.d.ts.map +1 -1
- package/dist/esm/Wrapper/Wrapper.js +12 -12
- package/dist/esm/Wrapper/Wrapper.js.map +1 -1
- package/dist/esm/models/XyoPayloadFindFilter.d.ts +2 -2
- package/dist/esm/models/XyoPayloadFindFilter.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/Builder/Builder.ts +7 -7
- package/src/Huri/Huri.ts +59 -60
- package/src/SchemaNameValidator.ts +51 -53
- package/src/Validator/Validator.ts +2 -1
- package/src/Wrapper/Wrapper.ts +16 -16
- package/src/models/XyoPayloadFindFilter.ts +2 -2
|
@@ -6,8 +6,8 @@ export declare class XyoPayloadBuilder<T extends XyoPayload = XyoPayload<Record<
|
|
|
6
6
|
private _fields;
|
|
7
7
|
private _schema;
|
|
8
8
|
constructor({ schema }: XyoPayloadBuilderOptions);
|
|
9
|
+
build(): T;
|
|
9
10
|
fields(fields?: Partial<T>): this;
|
|
10
11
|
hashableFields(): T;
|
|
11
|
-
build(): T;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=Builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["../../../src/Builder/Builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,iBAAiB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvF,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAQ;gBAEX,EAAE,MAAM,EAAE,EAAE,wBAAwB;IAIzC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAO1B,cAAc;
|
|
1
|
+
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["../../../src/Builder/Builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,iBAAiB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvF,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,OAAO,CAAQ;gBAEX,EAAE,MAAM,EAAE,EAAE,wBAAwB;IAIzC,KAAK,IAAI,CAAC;IAOV,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAO1B,cAAc;CAMtB"}
|
|
@@ -7,6 +7,12 @@ class XyoPayloadBuilder {
|
|
|
7
7
|
this._fields = {};
|
|
8
8
|
this._schema = schema;
|
|
9
9
|
}
|
|
10
|
+
build() {
|
|
11
|
+
const hashableFields = this.hashableFields();
|
|
12
|
+
const _hash = new core_1.Hasher(hashableFields).hash;
|
|
13
|
+
const _timestamp = Date.now();
|
|
14
|
+
return Object.assign(Object.assign({}, hashableFields), { _client: 'js', _hash, _timestamp, schema: this._schema });
|
|
15
|
+
}
|
|
10
16
|
fields(fields) {
|
|
11
17
|
if (fields) {
|
|
12
18
|
this._fields = Object.assign(Object.assign({}, this._fields), (0, core_1.removeEmptyFields)(fields));
|
|
@@ -16,12 +22,6 @@ class XyoPayloadBuilder {
|
|
|
16
22
|
hashableFields() {
|
|
17
23
|
return Object.assign(Object.assign({}, (0, core_1.removeEmptyFields)((0, core_1.deepOmitUnderscoreFields)(this._fields))), { schema: this._schema });
|
|
18
24
|
}
|
|
19
|
-
build() {
|
|
20
|
-
const hashableFields = this.hashableFields();
|
|
21
|
-
const _hash = new core_1.Hasher(hashableFields).hash;
|
|
22
|
-
const _timestamp = Date.now();
|
|
23
|
-
return Object.assign(Object.assign({}, hashableFields), { _client: 'js', _hash, _timestamp, schema: this._schema });
|
|
24
|
-
}
|
|
25
25
|
}
|
|
26
26
|
exports.XyoPayloadBuilder = XyoPayloadBuilder;
|
|
27
27
|
//# sourceMappingURL=Builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Builder.js","sourceRoot":"","sources":["../../../src/Builder/Builder.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AAQvF,MAAa,iBAAiB;IAI5B,YAAY,EAAE,MAAM,EAA4B;QAHxC,YAAO,GAAe,EAAE,CAAA;QAI9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAEM,MAAM,
|
|
1
|
+
{"version":3,"file":"Builder.js","sourceRoot":"","sources":["../../../src/Builder/Builder.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AAQvF,MAAa,iBAAiB;IAI5B,YAAY,EAAE,MAAM,EAA4B;QAHxC,YAAO,GAAe,EAAE,CAAA;QAI9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACvB,CAAC;IAEM,KAAK;QACV,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;QAC5C,MAAM,KAAK,GAAG,IAAI,aAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAA;QAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAC7B,uCAAY,cAAc,KAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,IAAE;IACtF,CAAC;IAEM,MAAM,CAAC,MAAmB;QAC/B,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,mCAAQ,IAAI,CAAC,OAAO,GAAK,IAAA,wBAAiB,EAAC,MAAM,CAAC,CAAE,CAAA;SACjE;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,cAAc;QACnB,OAAO,gCACF,IAAA,wBAAiB,EAAC,IAAA,+BAAwB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAC5D,MAAM,EAAE,IAAI,CAAC,OAAO,GAChB,CAAA;IACR,CAAC;CACF;AA5BD,8CA4BC"}
|
package/dist/cjs/Huri/Huri.d.ts
CHANGED
|
@@ -6,27 +6,27 @@ export interface HuriOptions {
|
|
|
6
6
|
archivistUri?: string;
|
|
7
7
|
}
|
|
8
8
|
export interface XyoFetchedPayload<T extends XyoPayload = XyoPayload> {
|
|
9
|
-
payload: T;
|
|
10
9
|
huri?: Huri;
|
|
10
|
+
payload: T;
|
|
11
11
|
}
|
|
12
12
|
export declare class Huri<T extends XyoPayload = XyoPayload> {
|
|
13
|
-
originalHref: string;
|
|
14
|
-
protocol?: string;
|
|
15
|
-
archivist?: string;
|
|
16
13
|
archive?: string;
|
|
14
|
+
archivist?: string;
|
|
17
15
|
hash: string;
|
|
16
|
+
originalHref: string;
|
|
17
|
+
protocol?: string;
|
|
18
18
|
private isHuri;
|
|
19
19
|
constructor(huri: XyoDataLike | Huri, { archivistUri }?: HuriOptions);
|
|
20
|
-
private parsePath;
|
|
21
|
-
private validateParse;
|
|
22
20
|
get href(): string;
|
|
23
|
-
toString(): string;
|
|
24
|
-
fetch(): Promise<T | undefined>;
|
|
25
21
|
static fetch<T extends XyoPayload = XyoPayload>(huri: Huri): Promise<T | undefined>;
|
|
26
|
-
private static parseProtocol;
|
|
27
|
-
private static parsePath;
|
|
28
22
|
static isHuri(value: unknown): Huri<import("../models").SchemaFields & import("../models").PayloadFields & {
|
|
29
23
|
schema: string;
|
|
30
24
|
}> | undefined;
|
|
25
|
+
private static parsePath;
|
|
26
|
+
private static parseProtocol;
|
|
27
|
+
fetch(): Promise<T | undefined>;
|
|
28
|
+
toString(): string;
|
|
29
|
+
private parsePath;
|
|
30
|
+
private validateParse;
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=Huri.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Huri.d.ts","sourceRoot":"","sources":["../../../src/Huri/Huri.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,oBAAY,iBAAiB,GAAG,OAAO,GAAG,SAAS,CAAA;AAEnD,oBAAY,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;AAY/E,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAClE,
|
|
1
|
+
{"version":3,"file":"Huri.d.ts","sourceRoot":"","sources":["../../../src/Huri/Huri.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,oBAAY,iBAAiB,GAAG,OAAO,GAAG,SAAS,CAAA;AAEnD,oBAAY,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;AAY/E,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAClE,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,OAAO,EAAE,CAAC,CAAA;CACX;AAED,qBAAa,IAAI,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAExB,OAAO,CAAC,MAAM,CAAO;gBAET,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,EAAE,YAAY,EAAE,GAAE,WAAgB;IAuBxE,IAAW,IAAI,WAad;WAEY,KAAK,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;WAI3E,MAAM,CAAC,KAAK,EAAE,OAAO;;;IAOnC,OAAO,CAAC,MAAM,CAAC,SAAS;IAWxB,OAAO,CAAC,MAAM,CAAC,aAAa;IAYf,KAAK,IAAI,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIrC,QAAQ;IAIf,OAAO,CAAC,SAAS;IAwBjB,OAAO,CAAC,aAAa;CAUtB"}
|
package/dist/cjs/Huri/Huri.js
CHANGED
|
@@ -23,32 +23,6 @@ class Huri {
|
|
|
23
23
|
}
|
|
24
24
|
this.validateParse();
|
|
25
25
|
}
|
|
26
|
-
parsePath(path, hasProtocol) {
|
|
27
|
-
var _a;
|
|
28
|
-
const pathParts = path.split('/');
|
|
29
|
-
//if the protocol was found, then there is not allowed to be a leading /
|
|
30
|
-
(0, assert_1.assertEx)(!(hasProtocol && pathParts[0].length === 0), 'Invalid protocol separator');
|
|
31
|
-
//remove leading '/' if needed
|
|
32
|
-
pathParts[0].length === 0 ? pathParts.shift() : null;
|
|
33
|
-
//hash is assumed to be the last part
|
|
34
|
-
const hash = (0, assert_1.assertEx)(pathParts.pop(), 'No hash specified');
|
|
35
|
-
//archivist is assumed to be the first part
|
|
36
|
-
this.archivist = (_a = pathParts.shift()) !== null && _a !== void 0 ? _a : 'api.archivist.xyo.network';
|
|
37
|
-
//the archive is whatever is left
|
|
38
|
-
this.archive = pathParts.pop();
|
|
39
|
-
//after we pull off all the path parts, there should be nothing left
|
|
40
|
-
(0, assert_1.assertEx)(pathParts.length === 0, 'Too many path parts');
|
|
41
|
-
return hash;
|
|
42
|
-
}
|
|
43
|
-
validateParse() {
|
|
44
|
-
var _a, _b;
|
|
45
|
-
//the archivist should not be zero length
|
|
46
|
-
(0, assert_1.assertEx)(((_a = this.archivist) === null || _a === void 0 ? void 0 : _a.length) !== 0, 'Invalid archivist length');
|
|
47
|
-
//the archivist should not be zero length (can be undefined)
|
|
48
|
-
(0, assert_1.assertEx)(((_b = this.archive) === null || _b === void 0 ? void 0 : _b.length) !== 0, 'Invalid archive length');
|
|
49
|
-
//the archive should not be set if the archivist is not set
|
|
50
|
-
(0, assert_1.assertEx)(!(this.archive && !this.archivist), 'If specifying archive, archivist is also required');
|
|
51
|
-
}
|
|
52
26
|
/*
|
|
53
27
|
The full href or the hash
|
|
54
28
|
*/
|
|
@@ -66,29 +40,16 @@ class Huri {
|
|
|
66
40
|
parts.push(this.hash);
|
|
67
41
|
return parts.join('/');
|
|
68
42
|
}
|
|
69
|
-
toString() {
|
|
70
|
-
return this.href;
|
|
71
|
-
}
|
|
72
|
-
fetch() {
|
|
73
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
return yield Huri.fetch(this);
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
43
|
static fetch(huri) {
|
|
78
44
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
45
|
return (yield axios_1.default.get(huri.href)).data;
|
|
80
46
|
});
|
|
81
47
|
}
|
|
82
|
-
static
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : undefined;
|
|
86
|
-
if (rawProtocol) {
|
|
87
|
-
const protocolParts = rawProtocol === null || rawProtocol === void 0 ? void 0 : rawProtocol.split(':');
|
|
88
|
-
(0, assert_1.assertEx)(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`);
|
|
89
|
-
(0, assert_1.assertEx)(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`);
|
|
90
|
-
return protocolParts.shift();
|
|
48
|
+
static isHuri(value) {
|
|
49
|
+
if (typeof value === 'object') {
|
|
50
|
+
return value.isHuri ? value : undefined;
|
|
91
51
|
}
|
|
52
|
+
return undefined;
|
|
92
53
|
}
|
|
93
54
|
static parsePath(huri) {
|
|
94
55
|
const protocolSplit = huri.split('//');
|
|
@@ -100,11 +61,50 @@ class Huri {
|
|
|
100
61
|
return protocolSplit[1];
|
|
101
62
|
}
|
|
102
63
|
}
|
|
103
|
-
static
|
|
104
|
-
|
|
105
|
-
|
|
64
|
+
static parseProtocol(huri) {
|
|
65
|
+
const protocolSplit = huri.split('//');
|
|
66
|
+
(0, assert_1.assertEx)(protocolSplit.length <= 2, `Invalid second protocol [${protocolSplit[2]}]`);
|
|
67
|
+
const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : undefined;
|
|
68
|
+
if (rawProtocol) {
|
|
69
|
+
const protocolParts = rawProtocol === null || rawProtocol === void 0 ? void 0 : rawProtocol.split(':');
|
|
70
|
+
(0, assert_1.assertEx)(protocolParts.length === 2, `Invalid protocol format [${rawProtocol}]`);
|
|
71
|
+
(0, assert_1.assertEx)(protocolParts[1].length === 0, `Invalid protocol format (post :) [${rawProtocol}]`);
|
|
72
|
+
return protocolParts.shift();
|
|
106
73
|
}
|
|
107
|
-
|
|
74
|
+
}
|
|
75
|
+
fetch() {
|
|
76
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return yield Huri.fetch(this);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
toString() {
|
|
81
|
+
return this.href;
|
|
82
|
+
}
|
|
83
|
+
parsePath(path, hasProtocol) {
|
|
84
|
+
var _a;
|
|
85
|
+
const pathParts = path.split('/');
|
|
86
|
+
//if the protocol was found, then there is not allowed to be a leading /
|
|
87
|
+
(0, assert_1.assertEx)(!(hasProtocol && pathParts[0].length === 0), 'Invalid protocol separator');
|
|
88
|
+
//remove leading '/' if needed
|
|
89
|
+
pathParts[0].length === 0 ? pathParts.shift() : null;
|
|
90
|
+
//hash is assumed to be the last part
|
|
91
|
+
const hash = (0, assert_1.assertEx)(pathParts.pop(), 'No hash specified');
|
|
92
|
+
//archivist is assumed to be the first part
|
|
93
|
+
this.archivist = (_a = pathParts.shift()) !== null && _a !== void 0 ? _a : 'api.archivist.xyo.network';
|
|
94
|
+
//the archive is whatever is left
|
|
95
|
+
this.archive = pathParts.pop();
|
|
96
|
+
//after we pull off all the path parts, there should be nothing left
|
|
97
|
+
(0, assert_1.assertEx)(pathParts.length === 0, 'Too many path parts');
|
|
98
|
+
return hash;
|
|
99
|
+
}
|
|
100
|
+
validateParse() {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
//the archivist should not be zero length
|
|
103
|
+
(0, assert_1.assertEx)(((_a = this.archivist) === null || _a === void 0 ? void 0 : _a.length) !== 0, 'Invalid archivist length');
|
|
104
|
+
//the archivist should not be zero length (can be undefined)
|
|
105
|
+
(0, assert_1.assertEx)(((_b = this.archive) === null || _b === void 0 ? void 0 : _b.length) !== 0, 'Invalid archive length');
|
|
106
|
+
//the archive should not be set if the archivist is not set
|
|
107
|
+
(0, assert_1.assertEx)(!(this.archive && !this.archivist), 'If specifying archive, archivist is also required');
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
exports.Huri = Huri;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Huri.js","sourceRoot":"","sources":["../../../src/Huri/Huri.ts"],"names":[],"mappings":";;;;AAAA,2CAAyC;AACzC,kDAAsD;AAEtD,0DAAyB;AA2BzB,MAAa,IAAI;IASf,YAAY,IAAwB,EAAE,EAAE,YAAY,KAAkB,EAAE;;QAFhE,WAAM,GAAG,IAAI,CAAA;QAGnB,MAAM,UAAU,GAAG,CAAA,MAAA,MAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAAE,IAAI,mCAAI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nB,yCAAyC;QACzC,IAAA,iBAAQ,EAAC,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,MAAK,CAAC,EAAE,0BAA0B,CAAC,CAAA;QAElE,4DAA4D;QAC5D,IAAA,iBAAQ,EAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,MAAK,CAAC,EAAE,wBAAwB,CAAC,CAAA;QAE9D,2DAA2D;QAC3D,IAAA,iBAAQ,EAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,mDAAmD,CAAC,CAAA;IACnG,CAAC;CACF;AA3HD,oBA2HC"}
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare class XyoSchemaNameValidator {
|
|
5
5
|
schema?: string;
|
|
6
|
-
constructor(schema?: string);
|
|
7
6
|
private _parts?;
|
|
7
|
+
private _rootDomain?;
|
|
8
|
+
constructor(schema?: string);
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Checks whether the schema is all lowercase
|
|
10
11
|
*
|
|
11
|
-
* @returns
|
|
12
|
+
* @returns boolean
|
|
12
13
|
*/
|
|
13
|
-
get
|
|
14
|
+
get isLowercase(): boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Levels in the schema
|
|
16
17
|
*
|
|
@@ -18,20 +19,11 @@ export declare class XyoSchemaNameValidator {
|
|
|
18
19
|
*/
|
|
19
20
|
get levels(): number | undefined;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @returns boolean
|
|
24
|
-
*/
|
|
25
|
-
get isLowercase(): boolean;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* Get a domain for the schema at a certain level
|
|
22
|
+
* The schema converted into a string array split on '.'
|
|
29
23
|
*
|
|
30
|
-
* @
|
|
31
|
-
* @returns string
|
|
24
|
+
* @returns string[]
|
|
32
25
|
*/
|
|
33
|
-
|
|
34
|
-
private _rootDomain?;
|
|
26
|
+
get parts(): string[] | undefined;
|
|
35
27
|
/**
|
|
36
28
|
* The rootDomain is the first two levels of the schema, in reverse order
|
|
37
29
|
* This can be used to determine who 'owns' that schema, based on domain
|
|
@@ -41,34 +33,42 @@ export declare class XyoSchemaNameValidator {
|
|
|
41
33
|
*/
|
|
42
34
|
get rootDomain(): string | undefined;
|
|
43
35
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @returns boolean
|
|
36
|
+
* Run all static validations
|
|
37
|
+
* @returns Error[]
|
|
47
38
|
*/
|
|
48
|
-
|
|
39
|
+
all(): Error[];
|
|
40
|
+
/**
|
|
41
|
+
* Run all the validations
|
|
42
|
+
* @param checkExistance - boolean
|
|
43
|
+
* @returns Error[]
|
|
44
|
+
*/
|
|
45
|
+
allDynamic(): Promise<Error[]>;
|
|
49
46
|
/**
|
|
50
47
|
* Determines how many levels of the schema's reverse domain
|
|
51
48
|
* pass DNS resolution
|
|
52
49
|
*
|
|
53
50
|
* @returns number (0 if none exist)
|
|
54
51
|
*/
|
|
55
|
-
|
|
52
|
+
domainExistenceDepth(): Promise<number>;
|
|
56
53
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @returns
|
|
54
|
+
* Checks if the root domain validates via DNS resolution
|
|
55
|
+
*
|
|
56
|
+
* @returns boolean
|
|
60
57
|
*/
|
|
61
|
-
|
|
58
|
+
rootDomainExists(): Promise<boolean>;
|
|
62
59
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
60
|
+
*
|
|
61
|
+
* Get a domain for the schema at a certain level
|
|
62
|
+
*
|
|
63
|
+
* @param level - Zero based level to check
|
|
64
|
+
* @returns string
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
private domainLevel;
|
|
67
67
|
}
|
|
68
|
-
/** @
|
|
68
|
+
/** @deprecated use XyoSchemaNameValidator instead */
|
|
69
69
|
export declare class SchemaValidator extends XyoSchemaNameValidator {
|
|
70
70
|
}
|
|
71
|
-
/** @
|
|
71
|
+
/** @deprecated use XyoSchemaNameValidator instead */
|
|
72
72
|
export declare class XyoSchemaValidator extends XyoSchemaNameValidator {
|
|
73
73
|
}
|
|
74
74
|
//# sourceMappingURL=SchemaNameValidator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaNameValidator.d.ts","sourceRoot":"","sources":["../../src/SchemaNameValidator.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,sBAAsB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"SchemaNameValidator.d.ts","sourceRoot":"","sources":["../../src/SchemaNameValidator.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,sBAAsB;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,WAAW,CAAC,CAAQ;gBAChB,MAAM,CAAC,EAAE,MAAM;IAI3B;;;;OAIG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED;;;;OAIG;IACH,IAAI,KAAK,yBAGR;IAED;;;;;;OAMG;IACH,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAGnC;IAED;;;OAGG;IAEI,GAAG;IAQV;;;;OAIG;IAEU,UAAU;IAOvB;;;;;OAKG;IACU,oBAAoB;IAYjC;;;;OAIG;IACU,gBAAgB;IAI7B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;CAMpB;AAED,qDAAqD;AACrD,qBAAa,eAAgB,SAAQ,sBAAsB;CAAG;AAE9D,qDAAqD;AACrD,qBAAa,kBAAmB,SAAQ,sBAAsB;CAAG"}
|
|
@@ -11,14 +11,13 @@ class XyoSchemaNameValidator {
|
|
|
11
11
|
this.schema = schema;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Checks whether the schema is all lowercase
|
|
15
15
|
*
|
|
16
|
-
* @returns
|
|
16
|
+
* @returns boolean
|
|
17
17
|
*/
|
|
18
|
-
get
|
|
19
|
-
var _a
|
|
20
|
-
this.
|
|
21
|
-
return this._parts;
|
|
18
|
+
get isLowercase() {
|
|
19
|
+
var _a;
|
|
20
|
+
return this.schema === ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Levels in the schema
|
|
@@ -30,24 +29,14 @@ class XyoSchemaNameValidator {
|
|
|
30
29
|
return (_a = this.parts) === null || _a === void 0 ? void 0 : _a.length;
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @returns boolean
|
|
36
|
-
*/
|
|
37
|
-
get isLowercase() {
|
|
38
|
-
var _a;
|
|
39
|
-
return this.schema === ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* Get a domain for the schema at a certain level
|
|
32
|
+
* The schema converted into a string array split on '.'
|
|
44
33
|
*
|
|
45
|
-
* @
|
|
46
|
-
* @returns string
|
|
34
|
+
* @returns string[]
|
|
47
35
|
*/
|
|
48
|
-
|
|
49
|
-
var _a;
|
|
50
|
-
|
|
36
|
+
get parts() {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
this._parts = (_a = this._parts) !== null && _a !== void 0 ? _a : (_b = this.schema) === null || _b === void 0 ? void 0 : _b.split('.');
|
|
39
|
+
return this._parts;
|
|
51
40
|
}
|
|
52
41
|
/**
|
|
53
42
|
* The rootDomain is the first two levels of the schema, in reverse order
|
|
@@ -62,13 +51,34 @@ class XyoSchemaNameValidator {
|
|
|
62
51
|
return this._rootDomain;
|
|
63
52
|
}
|
|
64
53
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* @returns boolean
|
|
54
|
+
* Run all static validations
|
|
55
|
+
* @returns Error[]
|
|
68
56
|
*/
|
|
69
|
-
|
|
57
|
+
all() {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
const errors = [];
|
|
60
|
+
if (((_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0)
|
|
61
|
+
errors.push(Error('schema missing'));
|
|
62
|
+
else if (((_c = this.levels) !== null && _c !== void 0 ? _c : 0) < 3)
|
|
63
|
+
errors.push(Error(`schema levels < 3 [${this.levels}, ${this.schema}]`));
|
|
64
|
+
else if (!this.isLowercase)
|
|
65
|
+
errors.push(Error(`schema not lowercase [${this.schema}]`));
|
|
66
|
+
return errors;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Run all the validations
|
|
70
|
+
* @param checkExistance - boolean
|
|
71
|
+
* @returns Error[]
|
|
72
|
+
*/
|
|
73
|
+
allDynamic() {
|
|
74
|
+
var _a, _b;
|
|
70
75
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
|
|
76
|
+
const errors = [];
|
|
77
|
+
if (((_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0)
|
|
78
|
+
errors.push(Error('schema missing'));
|
|
79
|
+
else if (!(yield this.rootDomainExists()))
|
|
80
|
+
errors.push(Error(`schema root domain must exist [${this.rootDomain}]`));
|
|
81
|
+
return errors;
|
|
72
82
|
});
|
|
73
83
|
}
|
|
74
84
|
/**
|
|
@@ -77,7 +87,7 @@ class XyoSchemaNameValidator {
|
|
|
77
87
|
*
|
|
78
88
|
* @returns number (0 if none exist)
|
|
79
89
|
*/
|
|
80
|
-
|
|
90
|
+
domainExistenceDepth() {
|
|
81
91
|
var _a;
|
|
82
92
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
93
|
const levels = (_a = this.levels) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -92,43 +102,33 @@ class XyoSchemaNameValidator {
|
|
|
92
102
|
});
|
|
93
103
|
}
|
|
94
104
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* @returns
|
|
105
|
+
* Checks if the root domain validates via DNS resolution
|
|
106
|
+
*
|
|
107
|
+
* @returns boolean
|
|
98
108
|
*/
|
|
99
|
-
|
|
100
|
-
var _a, _b;
|
|
109
|
+
rootDomainExists() {
|
|
101
110
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
|
|
103
|
-
if (((_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0)
|
|
104
|
-
errors.push(Error('schema missing'));
|
|
105
|
-
else if (!(yield this.rootDomainExists()))
|
|
106
|
-
errors.push(Error(`schema root domain must exist [${this.rootDomain}]`));
|
|
107
|
-
return errors;
|
|
111
|
+
return yield (0, core_1.domainExists)(this.rootDomain);
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
115
|
+
*
|
|
116
|
+
* Get a domain for the schema at a certain level
|
|
117
|
+
*
|
|
118
|
+
* @param level - Zero based level to check
|
|
119
|
+
* @returns string
|
|
113
120
|
*/
|
|
114
|
-
|
|
115
|
-
var _a
|
|
116
|
-
|
|
117
|
-
if (((_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0)
|
|
118
|
-
errors.push(Error('schema missing'));
|
|
119
|
-
else if (((_c = this.levels) !== null && _c !== void 0 ? _c : 0) < 3)
|
|
120
|
-
errors.push(Error(`schema levels < 3 [${this.levels}, ${this.schema}]`));
|
|
121
|
-
else if (!this.isLowercase)
|
|
122
|
-
errors.push(Error(`schema not lowercase [${this.schema}]`));
|
|
123
|
-
return errors;
|
|
121
|
+
domainLevel(level) {
|
|
122
|
+
var _a;
|
|
123
|
+
return (_a = this.parts) === null || _a === void 0 ? void 0 : _a.slice(0, level + 1).reverse().join('.');
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
exports.XyoSchemaNameValidator = XyoSchemaNameValidator;
|
|
127
|
-
/** @
|
|
127
|
+
/** @deprecated use XyoSchemaNameValidator instead */
|
|
128
128
|
class SchemaValidator extends XyoSchemaNameValidator {
|
|
129
129
|
}
|
|
130
130
|
exports.SchemaValidator = SchemaValidator;
|
|
131
|
-
/** @
|
|
131
|
+
/** @deprecated use XyoSchemaNameValidator instead */
|
|
132
132
|
class XyoSchemaValidator extends XyoSchemaNameValidator {
|
|
133
133
|
}
|
|
134
134
|
exports.XyoSchemaValidator = XyoSchemaValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaNameValidator.js","sourceRoot":"","sources":["../../src/SchemaNameValidator.ts"],"names":[],"mappings":";;;;AAAA,4CAAgD;AAEhD;;GAEG;AACH,MAAa,sBAAsB;
|
|
1
|
+
{"version":3,"file":"SchemaNameValidator.js","sourceRoot":"","sources":["../../src/SchemaNameValidator.ts"],"names":[],"mappings":";;;;AAAA,4CAAgD;AAEhD;;GAEG;AACH,MAAa,sBAAsB;IAIjC,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,IAAI,WAAW;;QACb,OAAO,IAAI,CAAC,MAAM,MAAK,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAA,CAAA;IACnD,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;;QACR,OAAO,MAAA,IAAI,CAAC,KAAK,0CAAE,MAAM,CAAA;IAC3B,CAAC;IAED;;;;OAIG;IACH,IAAI,KAAK;;QACP,IAAI,CAAC,MAAM,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,MAAA,IAAI,CAAC,MAAM,0CAAE,KAAK,CAAC,GAAG,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IA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AG,MAAA,IAAI,CAAC,MAAM,mCAAI,CAAC,CAAA;YAC/B,IAAI,KAAK,GAAG,CAAC,CAAA;YACb,OAAO,KAAK,GAAG,MAAM,EAAE;gBACrB,IAAI,CAAC,CAAC,MAAM,IAAA,mBAAY,EAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;oBAClD,MAAK;iBACN;gBACD,KAAK,IAAI,CAAC,CAAA;aACX;YACD,OAAO,KAAK,CAAA;;KACb;IAED;;;;OAIG;IACU,gBAAgB;;YAC3B,OAAO,MAAM,IAAA,mBAAY,EAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC5C,CAAC;KAAA;IAED;;;;;;OAMG;IACK,WAAW,CAAC,KAAa;;QAC/B,OAAO,MAAA,IAAI,CAAC,KAAK,0CACb,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EACnB,OAAO,GACP,IAAI,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;CACF;AAlHD,wDAkHC;AAED,qDAAqD;AACrD,MAAa,eAAgB,SAAQ,sBAAsB;CAAG;AAA9D,0CAA8D;AAE9D,qDAAqD;AACrD,MAAa,kBAAmB,SAAQ,sBAAsB;CAAG;AAAjE,gDAAiE"}
|
|
@@ -2,8 +2,8 @@ import { XyoValidator, XyoValidatorBase } from '@xyo-network/core';
|
|
|
2
2
|
import { XyoPayload } from '../models';
|
|
3
3
|
import { XyoSchemaNameValidator } from '../SchemaNameValidator';
|
|
4
4
|
export declare class PayloadValidator<T extends XyoPayload = XyoPayload> extends XyoValidatorBase<T> implements XyoValidator<T> {
|
|
5
|
-
constructor(payload: T);
|
|
6
5
|
private _schemaValidator?;
|
|
6
|
+
constructor(payload: T);
|
|
7
7
|
get schemaValidator(): XyoSchemaNameValidator;
|
|
8
8
|
schemaName(): Error[];
|
|
9
9
|
validate(): Error[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../../src/Validator/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,qBAAa,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Validator.d.ts","sourceRoot":"","sources":["../../../src/Validator/Validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,qBAAa,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACrH,OAAO,CAAC,gBAAgB,CAAC,CAAwB;gBAErC,OAAO,EAAE,CAAC;IAItB,IAAI,eAAe,2BAGlB;IAEM,UAAU;IAUV,QAAQ;CAKhB;AAED,8CAA8C;AAC9C,qBAAa,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAC;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../../src/Validator/Validator.ts"],"names":[],"mappings":";;;AAAA,4CAAkE;AAGlE,gEAA+D;AAE/D,MAAa,gBAAoD,SAAQ,uBAAmB;
|
|
1
|
+
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../../../src/Validator/Validator.ts"],"names":[],"mappings":";;;AAAA,4CAAkE;AAGlE,gEAA+D;AAE/D,MAAa,gBAAoD,SAAQ,uBAAmB;IAG1F,YAAY,OAAU;QACpB,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,IAAI,eAAe;;QACjB,IAAI,CAAC,gBAAgB,GAAG,MAAA,IAAI,CAAC,gBAAgB,mCAAI,IAAI,4CAAsB,CAAC,MAAA,IAAI,CAAC,GAAG,CAAC,MAAM,mCAAI,EAAE,CAAC,CAAA;QAClG,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAC9B,CAAC;IAEM,UAAU;QACf,MAAM,MAAM,GAAY,EAAE,CAAA;QAC1B,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;YACjC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAA;SACrC;aAAM;YACL,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAA;SAC3C;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAEM,QAAQ;QACb,MAAM,MAAM,GAAY,EAAE,CAAA;QAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QACjC,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AA3BD,4CA2BC;AAED,8CAA8C;AAC9C,MAAa,mBAAuD,SAAQ,gBAAmB;CAAG;AAAlG,kDAAkG"}
|
|
@@ -3,11 +3,13 @@ import { Promisable } from '@xyo-network/promise';
|
|
|
3
3
|
import { Huri } from '../Huri';
|
|
4
4
|
import { XyoPayload } from '../models';
|
|
5
5
|
export declare abstract class PayloadWrapperBase<TPayload extends XyoPayload = XyoPayload> extends Hasher<TPayload> {
|
|
6
|
+
get body(): TPayload;
|
|
7
|
+
get errors(): Error[];
|
|
6
8
|
get payload(): TPayload;
|
|
9
|
+
get previousHash(): null;
|
|
10
|
+
get schema(): string;
|
|
7
11
|
get schemaName(): string;
|
|
8
|
-
get body(): TPayload;
|
|
9
12
|
get valid(): boolean;
|
|
10
|
-
get errors(): Error[];
|
|
11
13
|
static load(_address: XyoDataLike | Huri): Promisable<PayloadWrapperBase | null>;
|
|
12
14
|
static parse(_obj: unknown): PayloadWrapperBase;
|
|
13
15
|
}
|
|
@@ -16,8 +18,6 @@ export declare class PayloadWrapper<TPayload extends XyoPayload = XyoPayload> ex
|
|
|
16
18
|
static load(address: XyoDataLike | Huri): Promise<PayloadWrapper<import("../models").SchemaFields & import("../models").PayloadFields & {
|
|
17
19
|
schema: string;
|
|
18
20
|
}> | null>;
|
|
19
|
-
get previousHash(): null;
|
|
20
|
-
get schema(): string;
|
|
21
21
|
static parse<T extends XyoPayload = XyoPayload>(obj: unknown): PayloadWrapper<T>;
|
|
22
22
|
}
|
|
23
23
|
/** @deprecated use PayloadWrapper instead */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/Wrapper/Wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAGtC,8BAAsB,kBAAkB,CAAC,QAAQ,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,MAAM,CAAC,QAAQ,CAAC;IACzG,IAAW,OAAO,aAEjB;
|
|
1
|
+
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/Wrapper/Wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OA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