@xyo-network/payload-model 3.9.2 → 3.9.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.
- package/dist/browser/index.d.ts +18 -46
- package/dist/neutral/index.d.ts +18 -46
- package/dist/node/index.d.ts +18 -46
- package/package.json +1 -1
- package/src/Payload.ts +16 -4
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Hash, Address, Hex } from '@xylabs/hex';
|
|
1
2
|
import * as _xylabs_object from '@xylabs/object';
|
|
2
3
|
import { EmptyObject, DeepRestrictToStringKeys, DeepOmitStartsWith, DeepPickStartsWith, JsonObject, JsonValue, Compare } from '@xylabs/object';
|
|
3
|
-
import { Hash, Address, Hex } from '@xylabs/hex';
|
|
4
4
|
import * as _store__xylabs_promise_npm_4_5_1_97d36b712b_package from '.store/@xylabs-promise-npm-4.5.1-97d36b712b/package';
|
|
5
5
|
|
|
6
6
|
type Schema = string;
|
|
@@ -21,18 +21,26 @@ interface SchemaField<T extends Schema = Schema> {
|
|
|
21
21
|
}
|
|
22
22
|
interface PayloadFields extends SchemaField {
|
|
23
23
|
}
|
|
24
|
+
type OpCode = 'elevate';
|
|
25
|
+
interface SourcesMetaField {
|
|
26
|
+
$sources: Hash[];
|
|
27
|
+
}
|
|
28
|
+
interface ChainMetaField {
|
|
29
|
+
$chain: {
|
|
30
|
+
ops?: OpCode[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
interface PayloadMetaFields extends SourcesMetaField, ChainMetaField {
|
|
34
|
+
}
|
|
24
35
|
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>;
|
|
25
|
-
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
36
|
+
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = (T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
26
37
|
schema: S;
|
|
27
38
|
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
|
|
28
39
|
schema: S;
|
|
29
40
|
}> : WithPayload<T & PayloadFields> : WithPayload<{
|
|
30
41
|
schema: S extends Schema ? S : Schema;
|
|
31
|
-
}>;
|
|
42
|
+
}>) & Partial<PayloadMetaFields>;
|
|
32
43
|
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
|
|
33
|
-
type SourcesMetaField = {
|
|
34
|
-
$sources: Hash[];
|
|
35
|
-
};
|
|
36
44
|
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
|
|
37
45
|
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
|
|
38
46
|
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
|
|
@@ -56,48 +64,12 @@ type ModuleError = Payload<{
|
|
|
56
64
|
query?: Hash;
|
|
57
65
|
schema: ModuleErrorSchema;
|
|
58
66
|
}>;
|
|
59
|
-
declare const isModuleError: (x?: unknown | null) => x is
|
|
60
|
-
schema: "network.xyo.error.module";
|
|
61
|
-
details?: string | number | boolean | {
|
|
62
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
63
|
-
} | (string | number | boolean | {
|
|
64
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
65
|
-
} | (string | number | boolean | {
|
|
66
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
67
|
-
} | (string | number | boolean | {
|
|
68
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
69
|
-
} | (string | number | boolean | {
|
|
70
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
71
|
-
} | (string | number | boolean | {
|
|
72
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
73
|
-
} | (string | number | boolean | {
|
|
74
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
75
|
-
} | (string | number | boolean | {
|
|
76
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null;
|
|
77
|
-
} | (string | number | boolean | {
|
|
78
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null;
|
|
79
|
-
} | (string | number | boolean | {
|
|
80
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null;
|
|
81
|
-
} | (string | number | boolean | {
|
|
82
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | any | null)[] | null;
|
|
83
|
-
} | (string | number | boolean | {
|
|
84
|
-
[x: string]: string | number | boolean | any | any | null;
|
|
85
|
-
} | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined;
|
|
86
|
-
message?: string | undefined;
|
|
87
|
-
name?: string | undefined;
|
|
88
|
-
query?: Hash | undefined;
|
|
89
|
-
}>;
|
|
67
|
+
declare const isModuleError: (x?: unknown | null) => x is ModuleError;
|
|
90
68
|
|
|
91
69
|
declare const isAnyPayload: (value: unknown) => value is Payload;
|
|
92
70
|
declare const asAnyPayload: {
|
|
93
|
-
<TType extends _xylabs_object.
|
|
94
|
-
|
|
95
|
-
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
96
|
-
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
|
|
97
|
-
schema: Schema;
|
|
98
|
-
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<_xylabs_object.DeepRestrictToStringKeys<{
|
|
99
|
-
schema: Schema;
|
|
100
|
-
}>>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
71
|
+
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
72
|
+
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<Payload>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
101
73
|
};
|
|
102
74
|
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
|
|
103
75
|
declare const asPayload: <T extends Payload>(schema: string[]) => {
|
|
@@ -294,4 +266,4 @@ interface Timestamp {
|
|
|
294
266
|
}
|
|
295
267
|
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
|
|
296
268
|
|
|
297
|
-
export { type AnyPayload, type AsyncPayloadValidationFunction, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };
|
|
269
|
+
export { type AnyPayload, type AsyncPayloadValidationFunction, type ChainMetaField, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OpCode, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadMetaFields, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Hash, Address, Hex } from '@xylabs/hex';
|
|
1
2
|
import * as _xylabs_object from '@xylabs/object';
|
|
2
3
|
import { EmptyObject, DeepRestrictToStringKeys, DeepOmitStartsWith, DeepPickStartsWith, JsonObject, JsonValue, Compare } from '@xylabs/object';
|
|
3
|
-
import { Hash, Address, Hex } from '@xylabs/hex';
|
|
4
4
|
import * as _store__xylabs_promise_npm_4_5_1_97d36b712b_package from '.store/@xylabs-promise-npm-4.5.1-97d36b712b/package';
|
|
5
5
|
|
|
6
6
|
type Schema = string;
|
|
@@ -21,18 +21,26 @@ interface SchemaField<T extends Schema = Schema> {
|
|
|
21
21
|
}
|
|
22
22
|
interface PayloadFields extends SchemaField {
|
|
23
23
|
}
|
|
24
|
+
type OpCode = 'elevate';
|
|
25
|
+
interface SourcesMetaField {
|
|
26
|
+
$sources: Hash[];
|
|
27
|
+
}
|
|
28
|
+
interface ChainMetaField {
|
|
29
|
+
$chain: {
|
|
30
|
+
ops?: OpCode[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
interface PayloadMetaFields extends SourcesMetaField, ChainMetaField {
|
|
34
|
+
}
|
|
24
35
|
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>;
|
|
25
|
-
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
36
|
+
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = (T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
26
37
|
schema: S;
|
|
27
38
|
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
|
|
28
39
|
schema: S;
|
|
29
40
|
}> : WithPayload<T & PayloadFields> : WithPayload<{
|
|
30
41
|
schema: S extends Schema ? S : Schema;
|
|
31
|
-
}>;
|
|
42
|
+
}>) & Partial<PayloadMetaFields>;
|
|
32
43
|
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
|
|
33
|
-
type SourcesMetaField = {
|
|
34
|
-
$sources: Hash[];
|
|
35
|
-
};
|
|
36
44
|
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
|
|
37
45
|
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
|
|
38
46
|
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
|
|
@@ -56,48 +64,12 @@ type ModuleError = Payload<{
|
|
|
56
64
|
query?: Hash;
|
|
57
65
|
schema: ModuleErrorSchema;
|
|
58
66
|
}>;
|
|
59
|
-
declare const isModuleError: (x?: unknown | null) => x is
|
|
60
|
-
schema: "network.xyo.error.module";
|
|
61
|
-
details?: string | number | boolean | {
|
|
62
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
63
|
-
} | (string | number | boolean | {
|
|
64
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
65
|
-
} | (string | number | boolean | {
|
|
66
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
67
|
-
} | (string | number | boolean | {
|
|
68
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
69
|
-
} | (string | number | boolean | {
|
|
70
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
71
|
-
} | (string | number | boolean | {
|
|
72
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
73
|
-
} | (string | number | boolean | {
|
|
74
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
75
|
-
} | (string | number | boolean | {
|
|
76
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null;
|
|
77
|
-
} | (string | number | boolean | {
|
|
78
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null;
|
|
79
|
-
} | (string | number | boolean | {
|
|
80
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null;
|
|
81
|
-
} | (string | number | boolean | {
|
|
82
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | any | null)[] | null;
|
|
83
|
-
} | (string | number | boolean | {
|
|
84
|
-
[x: string]: string | number | boolean | any | any | null;
|
|
85
|
-
} | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined;
|
|
86
|
-
message?: string | undefined;
|
|
87
|
-
name?: string | undefined;
|
|
88
|
-
query?: Hash | undefined;
|
|
89
|
-
}>;
|
|
67
|
+
declare const isModuleError: (x?: unknown | null) => x is ModuleError;
|
|
90
68
|
|
|
91
69
|
declare const isAnyPayload: (value: unknown) => value is Payload;
|
|
92
70
|
declare const asAnyPayload: {
|
|
93
|
-
<TType extends _xylabs_object.
|
|
94
|
-
|
|
95
|
-
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
96
|
-
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
|
|
97
|
-
schema: Schema;
|
|
98
|
-
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<_xylabs_object.DeepRestrictToStringKeys<{
|
|
99
|
-
schema: Schema;
|
|
100
|
-
}>>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
71
|
+
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
72
|
+
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<Payload>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
101
73
|
};
|
|
102
74
|
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
|
|
103
75
|
declare const asPayload: <T extends Payload>(schema: string[]) => {
|
|
@@ -294,4 +266,4 @@ interface Timestamp {
|
|
|
294
266
|
}
|
|
295
267
|
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
|
|
296
268
|
|
|
297
|
-
export { type AnyPayload, type AsyncPayloadValidationFunction, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };
|
|
269
|
+
export { type AnyPayload, type AsyncPayloadValidationFunction, type ChainMetaField, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OpCode, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadMetaFields, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { Hash, Address, Hex } from '@xylabs/hex';
|
|
1
2
|
import * as _xylabs_object from '@xylabs/object';
|
|
2
3
|
import { EmptyObject, DeepRestrictToStringKeys, DeepOmitStartsWith, DeepPickStartsWith, JsonObject, JsonValue, Compare } from '@xylabs/object';
|
|
3
|
-
import { Hash, Address, Hex } from '@xylabs/hex';
|
|
4
4
|
import * as _store__xylabs_promise_npm_4_5_1_97d36b712b_package from '.store/@xylabs-promise-npm-4.5.1-97d36b712b/package';
|
|
5
5
|
|
|
6
6
|
type Schema = string;
|
|
@@ -21,18 +21,26 @@ interface SchemaField<T extends Schema = Schema> {
|
|
|
21
21
|
}
|
|
22
22
|
interface PayloadFields extends SchemaField {
|
|
23
23
|
}
|
|
24
|
+
type OpCode = 'elevate';
|
|
25
|
+
interface SourcesMetaField {
|
|
26
|
+
$sources: Hash[];
|
|
27
|
+
}
|
|
28
|
+
interface ChainMetaField {
|
|
29
|
+
$chain: {
|
|
30
|
+
ops?: OpCode[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
interface PayloadMetaFields extends SourcesMetaField, ChainMetaField {
|
|
34
|
+
}
|
|
24
35
|
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>;
|
|
25
|
-
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
36
|
+
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = (T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
26
37
|
schema: S;
|
|
27
38
|
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
|
|
28
39
|
schema: S;
|
|
29
40
|
}> : WithPayload<T & PayloadFields> : WithPayload<{
|
|
30
41
|
schema: S extends Schema ? S : Schema;
|
|
31
|
-
}>;
|
|
42
|
+
}>) & Partial<PayloadMetaFields>;
|
|
32
43
|
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
|
|
33
|
-
type SourcesMetaField = {
|
|
34
|
-
$sources: Hash[];
|
|
35
|
-
};
|
|
36
44
|
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
|
|
37
45
|
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
|
|
38
46
|
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
|
|
@@ -56,48 +64,12 @@ type ModuleError = Payload<{
|
|
|
56
64
|
query?: Hash;
|
|
57
65
|
schema: ModuleErrorSchema;
|
|
58
66
|
}>;
|
|
59
|
-
declare const isModuleError: (x?: unknown | null) => x is
|
|
60
|
-
schema: "network.xyo.error.module";
|
|
61
|
-
details?: string | number | boolean | {
|
|
62
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
63
|
-
} | (string | number | boolean | {
|
|
64
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
65
|
-
} | (string | number | boolean | {
|
|
66
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
67
|
-
} | (string | number | boolean | {
|
|
68
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
69
|
-
} | (string | number | boolean | {
|
|
70
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
71
|
-
} | (string | number | boolean | {
|
|
72
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
73
|
-
} | (string | number | boolean | {
|
|
74
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null)[] | null;
|
|
75
|
-
} | (string | number | boolean | {
|
|
76
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null)[] | null;
|
|
77
|
-
} | (string | number | boolean | {
|
|
78
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null)[] | null;
|
|
79
|
-
} | (string | number | boolean | {
|
|
80
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | (string | number | boolean | any | any | null)[] | null)[] | null;
|
|
81
|
-
} | (string | number | boolean | {
|
|
82
|
-
[x: string]: string | number | boolean | any | (string | number | boolean | any | any | null)[] | null;
|
|
83
|
-
} | (string | number | boolean | {
|
|
84
|
-
[x: string]: string | number | boolean | any | any | null;
|
|
85
|
-
} | any | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null)[] | null | undefined;
|
|
86
|
-
message?: string | undefined;
|
|
87
|
-
name?: string | undefined;
|
|
88
|
-
query?: Hash | undefined;
|
|
89
|
-
}>;
|
|
67
|
+
declare const isModuleError: (x?: unknown | null) => x is ModuleError;
|
|
90
68
|
|
|
91
69
|
declare const isAnyPayload: (value: unknown) => value is Payload;
|
|
92
70
|
declare const asAnyPayload: {
|
|
93
|
-
<TType extends _xylabs_object.
|
|
94
|
-
|
|
95
|
-
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
96
|
-
<TType extends _xylabs_object.DeepRestrictToStringKeys<{
|
|
97
|
-
schema: Schema;
|
|
98
|
-
}>>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<_xylabs_object.DeepRestrictToStringKeys<{
|
|
99
|
-
schema: Schema;
|
|
100
|
-
}>>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
71
|
+
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
72
|
+
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<Payload>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
101
73
|
};
|
|
102
74
|
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
|
|
103
75
|
declare const asPayload: <T extends Payload>(schema: string[]) => {
|
|
@@ -294,4 +266,4 @@ interface Timestamp {
|
|
|
294
266
|
}
|
|
295
267
|
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
|
|
296
268
|
|
|
297
|
-
export { type AnyPayload, type AsyncPayloadValidationFunction, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };
|
|
269
|
+
export { type AnyPayload, type AsyncPayloadValidationFunction, type ChainMetaField, type DataHashStorageMeta, type Epoch, type HashStorageMeta, type LocalSequence, LocalSequenceConstants, type ModuleError, ModuleErrorSchema, type Nonce, type OpCode, type OverridablePayload, type Payload, type PayloadFields, type PayloadFindFilter, type PayloadMetaFields, type PayloadProperty, PayloadSchema, type PayloadSet, type PayloadSetPayload, PayloadSetSchema, type PayloadValidationFunction, type PayloadValue, type PayloadValueExpression, type PayloadWithOptionalSources, type PayloadWithSources, type QualifiedSequence, QualifiedSequenceConstants, type Query, type QueryFields, type Schema, type SchemaField, type SchemaFields, type Sequence, SequenceComparer, SequenceComponentLengths, SequenceComponentMinMax, SequenceConstants, SequenceNonceComponentLengths, SequenceParser, type SequenceStorageMeta, type SourcesMetaField, type StorageMeta, type SyncPayloadValidationFunction, type Timestamp, type WithAnySchema, type WithDataHashStorageMeta, type WithHashStorageMeta, type WithOnlyClientMeta, type WithOptionalSchema, type WithOptionalSources, type WithPartialDataHashStorageMeta, type WithPartialHashStorageMeta, type WithPartialSequenceStorageMeta, type WithPartialStorageMeta, type WithPayload, type WithSchema, type WithSequenceStorageMeta, type WithSources, type WithStorageMeta, type WithTimestamp, type WithoutClientMeta, type WithoutMeta, type WithoutPrivateStorageMeta, type WithoutSchema, type WithoutStorageMeta, asAnyPayload, asDataHashStorageMeta, asHashStorageMeta, asOptionalDataHashStorageMeta, asOptionalHashStorageMeta, asOptionalSequenceStorageMeta, asOptionalStorageMeta, asPayload, asSchema, asSequenceStorageMeta, asStorageStorageMeta, isAnyPayload, isDataHashStorageMeta, isEpoch, isHashStorageMeta, isLocalSequence, isModuleError, isNonce, isPayload, isPayloadOfSchemaType, isPayloadOfSchemaTypeWithSources, isQualifiedSequence, isSchema, isSequence, isSequenceStorageMeta, isStorageMeta, notPayloadOfSchemaType };
|
package/package.json
CHANGED
package/src/Payload.ts
CHANGED
|
@@ -13,12 +13,24 @@ export interface SchemaField<T extends Schema = Schema> {
|
|
|
13
13
|
/** Additional fields for a payload */
|
|
14
14
|
export interface PayloadFields extends SchemaField {}
|
|
15
15
|
|
|
16
|
+
// elevate - include the data hash in the parent boundwitness [data hash so that the opcodes get ignored]
|
|
17
|
+
export type OpCode = 'elevate'
|
|
18
|
+
|
|
19
|
+
export interface SourcesMetaField { $sources: Hash[] }
|
|
20
|
+
export interface ChainMetaField {
|
|
21
|
+
$chain: {
|
|
22
|
+
ops?: OpCode[]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface PayloadMetaFields extends SourcesMetaField, ChainMetaField {}
|
|
27
|
+
|
|
16
28
|
export type WithPayload<T extends EmptyObject | void = void> =
|
|
17
29
|
DeepRestrictToStringKeys<WithoutMeta<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>>
|
|
18
30
|
|
|
19
31
|
/** Base Type for Payloads */
|
|
20
32
|
export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> =
|
|
21
|
-
T extends WithSchema ?
|
|
33
|
+
(T extends WithSchema ?
|
|
22
34
|
S extends Schema ?
|
|
23
35
|
/* T (w/Schema) & S provided */
|
|
24
36
|
WithPayload<Omit<T, 'schema'> & { schema: S }>
|
|
@@ -31,13 +43,13 @@ export type Payload<T extends void | EmptyObject | WithSchema = void, S extends
|
|
|
31
43
|
: /* Either just S or neither S or T provided */
|
|
32
44
|
WithPayload<{
|
|
33
45
|
schema: S extends Schema ? S : Schema
|
|
34
|
-
}>
|
|
46
|
+
}>) & Partial<PayloadMetaFields>
|
|
35
47
|
|
|
36
48
|
export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
/** @deprecated $sources are now optional in all Payloads */
|
|
40
51
|
export type WithSources<T extends EmptyObject> = T & SourcesMetaField
|
|
52
|
+
/** @deprecated $sources are now optional in all Payloads */
|
|
41
53
|
export type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T
|
|
42
54
|
|
|
43
55
|
export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>
|