@xyo-network/payload-model 3.9.17 → 3.9.19
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/Error.d.ts +14 -0
- package/dist/browser/Error.d.ts.map +1 -0
- package/dist/browser/Payload.d.ts +44 -0
- package/dist/browser/Payload.d.ts.map +1 -0
- package/dist/browser/PayloadFindFilter.d.ts +6 -0
- package/dist/browser/PayloadFindFilter.d.ts.map +1 -0
- package/dist/browser/PayloadSet/PayloadSetPayload.d.ts +8 -0
- package/dist/browser/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
- package/dist/browser/PayloadSet/PayloadSetSchema.d.ts +3 -0
- package/dist/browser/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
- package/dist/browser/PayloadSet/index.d.ts +3 -0
- package/dist/browser/PayloadSet/index.d.ts.map +1 -0
- package/dist/browser/PayloadValidationFunction.d.ts +14 -0
- package/dist/browser/PayloadValidationFunction.d.ts.map +1 -0
- package/dist/browser/PayloadValueExpression.d.ts +38 -0
- package/dist/browser/PayloadValueExpression.d.ts.map +1 -0
- package/dist/browser/Query.d.ts +16 -0
- package/dist/browser/Query.d.ts.map +1 -0
- package/dist/browser/Schema.d.ts +19 -0
- package/dist/browser/Schema.d.ts.map +1 -0
- package/dist/browser/StorageMeta/DataHash.d.ts +14 -0
- package/dist/browser/StorageMeta/DataHash.d.ts.map +1 -0
- package/dist/browser/StorageMeta/Hash.d.ts +15 -0
- package/dist/browser/StorageMeta/Hash.d.ts.map +1 -0
- package/dist/browser/StorageMeta/Sequence.d.ts +14 -0
- package/dist/browser/StorageMeta/Sequence.d.ts.map +1 -0
- package/dist/browser/StorageMeta/StorageMeta.d.ts +14 -0
- package/dist/browser/StorageMeta/StorageMeta.d.ts.map +1 -0
- package/dist/browser/StorageMeta/index.d.ts +6 -0
- package/dist/browser/StorageMeta/index.d.ts.map +1 -0
- package/dist/browser/StorageMeta/sequence/Comparer.d.ts +6 -0
- package/dist/browser/StorageMeta/sequence/Comparer.d.ts.map +1 -0
- package/dist/browser/StorageMeta/sequence/Parser.d.ts +29 -0
- package/dist/browser/StorageMeta/sequence/Parser.d.ts.map +1 -0
- package/dist/browser/StorageMeta/sequence/Sequence.d.ts +71 -0
- package/dist/browser/StorageMeta/sequence/Sequence.d.ts.map +1 -0
- package/dist/browser/StorageMeta/sequence/index.d.ts +4 -0
- package/dist/browser/StorageMeta/sequence/index.d.ts.map +1 -0
- package/dist/browser/Timestamp.d.ts +8 -0
- package/dist/browser/Timestamp.d.ts.map +1 -0
- package/dist/browser/index.d.ts +13 -268
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/isPayload.d.ts +12 -0
- package/dist/browser/isPayload.d.ts.map +1 -0
- package/dist/browser/isPayloadOfSchemaType.d.ts +5 -0
- package/dist/browser/isPayloadOfSchemaType.d.ts.map +1 -0
- package/dist/neutral/Error.d.ts +14 -0
- package/dist/neutral/Error.d.ts.map +1 -0
- package/dist/neutral/Payload.d.ts +44 -0
- package/dist/neutral/Payload.d.ts.map +1 -0
- package/dist/neutral/PayloadFindFilter.d.ts +6 -0
- package/dist/neutral/PayloadFindFilter.d.ts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts +8 -0
- package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts +3 -0
- package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
- package/dist/neutral/PayloadSet/index.d.ts +3 -0
- package/dist/neutral/PayloadSet/index.d.ts.map +1 -0
- package/dist/neutral/PayloadValidationFunction.d.ts +14 -0
- package/dist/neutral/PayloadValidationFunction.d.ts.map +1 -0
- package/dist/neutral/PayloadValueExpression.d.ts +38 -0
- package/dist/neutral/PayloadValueExpression.d.ts.map +1 -0
- package/dist/neutral/Query.d.ts +16 -0
- package/dist/neutral/Query.d.ts.map +1 -0
- package/dist/neutral/Schema.d.ts +19 -0
- package/dist/neutral/Schema.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/DataHash.d.ts +14 -0
- package/dist/neutral/StorageMeta/DataHash.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/Hash.d.ts +15 -0
- package/dist/neutral/StorageMeta/Hash.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/Sequence.d.ts +14 -0
- package/dist/neutral/StorageMeta/Sequence.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/StorageMeta.d.ts +14 -0
- package/dist/neutral/StorageMeta/StorageMeta.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/index.d.ts +6 -0
- package/dist/neutral/StorageMeta/index.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/sequence/Comparer.d.ts +6 -0
- package/dist/neutral/StorageMeta/sequence/Comparer.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/sequence/Parser.d.ts +29 -0
- package/dist/neutral/StorageMeta/sequence/Parser.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/sequence/Sequence.d.ts +71 -0
- package/dist/neutral/StorageMeta/sequence/Sequence.d.ts.map +1 -0
- package/dist/neutral/StorageMeta/sequence/index.d.ts +4 -0
- package/dist/neutral/StorageMeta/sequence/index.d.ts.map +1 -0
- package/dist/neutral/Timestamp.d.ts +8 -0
- package/dist/neutral/Timestamp.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +13 -268
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/isPayload.d.ts +12 -0
- package/dist/neutral/isPayload.d.ts.map +1 -0
- package/dist/neutral/isPayloadOfSchemaType.d.ts +5 -0
- package/dist/neutral/isPayloadOfSchemaType.d.ts.map +1 -0
- package/dist/node/Error.d.ts +14 -0
- package/dist/node/Error.d.ts.map +1 -0
- package/dist/node/Payload.d.ts +44 -0
- package/dist/node/Payload.d.ts.map +1 -0
- package/dist/node/PayloadFindFilter.d.ts +6 -0
- package/dist/node/PayloadFindFilter.d.ts.map +1 -0
- package/dist/node/PayloadSet/PayloadSetPayload.d.ts +8 -0
- package/dist/node/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
- package/dist/node/PayloadSet/PayloadSetSchema.d.ts +3 -0
- package/dist/node/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
- package/dist/node/PayloadSet/index.d.ts +3 -0
- package/dist/node/PayloadSet/index.d.ts.map +1 -0
- package/dist/node/PayloadValidationFunction.d.ts +14 -0
- package/dist/node/PayloadValidationFunction.d.ts.map +1 -0
- package/dist/node/PayloadValueExpression.d.ts +38 -0
- package/dist/node/PayloadValueExpression.d.ts.map +1 -0
- package/dist/node/Query.d.ts +16 -0
- package/dist/node/Query.d.ts.map +1 -0
- package/dist/node/Schema.d.ts +19 -0
- package/dist/node/Schema.d.ts.map +1 -0
- package/dist/node/StorageMeta/DataHash.d.ts +14 -0
- package/dist/node/StorageMeta/DataHash.d.ts.map +1 -0
- package/dist/node/StorageMeta/Hash.d.ts +15 -0
- package/dist/node/StorageMeta/Hash.d.ts.map +1 -0
- package/dist/node/StorageMeta/Sequence.d.ts +14 -0
- package/dist/node/StorageMeta/Sequence.d.ts.map +1 -0
- package/dist/node/StorageMeta/StorageMeta.d.ts +14 -0
- package/dist/node/StorageMeta/StorageMeta.d.ts.map +1 -0
- package/dist/node/StorageMeta/index.d.ts +6 -0
- package/dist/node/StorageMeta/index.d.ts.map +1 -0
- package/dist/node/StorageMeta/sequence/Comparer.d.ts +6 -0
- package/dist/node/StorageMeta/sequence/Comparer.d.ts.map +1 -0
- package/dist/node/StorageMeta/sequence/Parser.d.ts +29 -0
- package/dist/node/StorageMeta/sequence/Parser.d.ts.map +1 -0
- package/dist/node/StorageMeta/sequence/Sequence.d.ts +71 -0
- package/dist/node/StorageMeta/sequence/Sequence.d.ts.map +1 -0
- package/dist/node/StorageMeta/sequence/index.d.ts +4 -0
- package/dist/node/StorageMeta/sequence/index.d.ts.map +1 -0
- package/dist/node/Timestamp.d.ts +8 -0
- package/dist/node/Timestamp.d.ts.map +1 -0
- package/dist/node/index.d.ts +13 -268
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/isPayload.d.ts +12 -0
- package/dist/node/isPayload.d.ts.map +1 -0
- package/dist/node/isPayloadOfSchemaType.d.ts +5 -0
- package/dist/node/isPayloadOfSchemaType.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/StorageMeta/DataHash.ts +2 -1
- package/src/StorageMeta/Hash.ts +4 -2
- package/src/StorageMeta/StorageMeta.ts +4 -2
- package/src/StorageMeta/sequence/Parser.ts +6 -3
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,268 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
interface SchemaFields extends EmptyObject {
|
|
16
|
-
schema: Schema;
|
|
17
|
-
}
|
|
18
|
-
type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields;
|
|
19
|
-
|
|
20
|
-
interface SchemaField<T extends Schema = Schema> {
|
|
21
|
-
schema: T;
|
|
22
|
-
}
|
|
23
|
-
interface PayloadFields extends SchemaField {
|
|
24
|
-
}
|
|
25
|
-
type OpCode = 'elevate';
|
|
26
|
-
interface SourcesMetaField {
|
|
27
|
-
$sources: Hash[];
|
|
28
|
-
}
|
|
29
|
-
interface ChainMetaFields {
|
|
30
|
-
$opCodes?: OpCode[];
|
|
31
|
-
}
|
|
32
|
-
interface PayloadMetaFields extends SourcesMetaField, ChainMetaFields {
|
|
33
|
-
}
|
|
34
|
-
type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>;
|
|
35
|
-
type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = (T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
36
|
-
schema: S;
|
|
37
|
-
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
|
|
38
|
-
schema: S;
|
|
39
|
-
}> : WithPayload<T & PayloadFields> : WithPayload<{
|
|
40
|
-
schema: S extends Schema ? S : Schema;
|
|
41
|
-
}>) & Partial<PayloadMetaFields>;
|
|
42
|
-
type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
|
|
43
|
-
type WithSources<T extends EmptyObject> = T & SourcesMetaField;
|
|
44
|
-
type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
|
|
45
|
-
type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
|
|
46
|
-
type PayloadWithOptionalSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithOptionalSources<Payload<T, S>>;
|
|
47
|
-
type WithAnySchema<T extends Payload> = OverridablePayload<T>;
|
|
48
|
-
type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>;
|
|
49
|
-
type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>;
|
|
50
|
-
type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>;
|
|
51
|
-
type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>;
|
|
52
|
-
type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>;
|
|
53
|
-
type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>;
|
|
54
|
-
type WithOnlyClientMeta<T extends EmptyObject> = DeepPickStartsWith<T, '$'>;
|
|
55
|
-
type AnyPayload = Payload<JsonObject, Schema>;
|
|
56
|
-
|
|
57
|
-
declare const ModuleErrorSchema: "network.xyo.error.module";
|
|
58
|
-
type ModuleErrorSchema = typeof ModuleErrorSchema;
|
|
59
|
-
type ModuleError = Payload<{
|
|
60
|
-
details?: JsonValue;
|
|
61
|
-
message?: string;
|
|
62
|
-
name?: string;
|
|
63
|
-
query?: Hash;
|
|
64
|
-
schema: ModuleErrorSchema;
|
|
65
|
-
}>;
|
|
66
|
-
declare const isModuleError: (x?: unknown | null) => x is ModuleError;
|
|
67
|
-
|
|
68
|
-
declare const isAnyPayload: (value: unknown) => value is Payload;
|
|
69
|
-
declare const asAnyPayload: {
|
|
70
|
-
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
71
|
-
<TType extends Payload>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<Payload>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
72
|
-
};
|
|
73
|
-
declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
|
|
74
|
-
declare const asPayload: <T extends Payload>(schema: string[]) => {
|
|
75
|
-
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
76
|
-
<TType extends T>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<T>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
declare function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']): (x?: unknown | null) => x is T;
|
|
80
|
-
declare const isPayloadOfSchemaTypeWithSources: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is WithSources<T>;
|
|
81
|
-
declare const notPayloadOfSchemaType: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is T;
|
|
82
|
-
|
|
83
|
-
interface PayloadFindFilter {
|
|
84
|
-
limit?: number;
|
|
85
|
-
order?: 'desc' | 'asc';
|
|
86
|
-
schema?: string | string[];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
declare const PayloadSetSchema: "network.xyo.payload.set";
|
|
90
|
-
type PayloadSetSchema = typeof PayloadSetSchema;
|
|
91
|
-
|
|
92
|
-
interface PayloadSet {
|
|
93
|
-
optional?: Record<string, number>;
|
|
94
|
-
required?: Record<string, number>;
|
|
95
|
-
}
|
|
96
|
-
type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
|
|
97
|
-
|
|
98
|
-
type SyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => boolean;
|
|
99
|
-
type AsyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => Promise<boolean>;
|
|
100
|
-
type PayloadValidationFunction<T extends Payload = Payload> = SyncPayloadValidationFunction<T> | AsyncPayloadValidationFunction<T>;
|
|
101
|
-
|
|
102
|
-
type PayloadProperty<T extends Payload = Payload> = keyof T;
|
|
103
|
-
type PayloadValue<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>> = T[Key];
|
|
104
|
-
type PayloadValueExpression<T extends Payload = Payload, Key extends PayloadProperty<T> = PayloadProperty<T>, TValue = PayloadValue<T, Key>> = (payload: T) => TValue;
|
|
105
|
-
|
|
106
|
-
interface QueryFields {
|
|
107
|
-
address?: Address | Address[];
|
|
108
|
-
budget?: number;
|
|
109
|
-
maxFrequency?: 'once' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
110
|
-
minBid?: number;
|
|
111
|
-
}
|
|
112
|
-
type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? Schema : void : S>;
|
|
113
|
-
|
|
114
|
-
interface DataHashStorageMeta {
|
|
115
|
-
_dataHash: Hash;
|
|
116
|
-
}
|
|
117
|
-
type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta;
|
|
118
|
-
type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>;
|
|
119
|
-
declare const isDataHashStorageMeta: (value: unknown) => value is DataHashStorageMeta;
|
|
120
|
-
declare const asDataHashStorageMeta: {
|
|
121
|
-
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
122
|
-
<TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<DataHashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
123
|
-
};
|
|
124
|
-
declare const asOptionalDataHashStorageMeta: <TType extends DataHashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
|
|
125
|
-
|
|
126
|
-
interface HashStorageMeta extends DataHashStorageMeta {
|
|
127
|
-
_hash: Hash;
|
|
128
|
-
}
|
|
129
|
-
type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta;
|
|
130
|
-
type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>;
|
|
131
|
-
declare const isHashStorageMeta: (value: unknown) => value is HashStorageMeta;
|
|
132
|
-
declare const asHashStorageMeta: {
|
|
133
|
-
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
134
|
-
<TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<HashStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
135
|
-
};
|
|
136
|
-
declare const asOptionalHashStorageMeta: <TType extends HashStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
|
|
137
|
-
|
|
138
|
-
declare const SequenceComparer: {
|
|
139
|
-
local: Compare<Lowercase<string>>;
|
|
140
|
-
qualified: Compare<Lowercase<string>>;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>;
|
|
144
|
-
type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>;
|
|
145
|
-
type Sequence = LocalSequence | QualifiedSequence;
|
|
146
|
-
type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>;
|
|
147
|
-
declare const isEpoch: (value: unknown) => value is Epoch;
|
|
148
|
-
type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>;
|
|
149
|
-
declare const isNonce: (value: unknown) => value is Epoch;
|
|
150
|
-
declare const isLocalSequence: (value: unknown) => value is Sequence;
|
|
151
|
-
declare const isQualifiedSequence: (value: unknown) => value is Sequence;
|
|
152
|
-
declare const isSequence: (value: unknown) => value is Sequence;
|
|
153
|
-
declare const SequenceNonceComponentLengths: {
|
|
154
|
-
nonceIndexBytes: number;
|
|
155
|
-
nonceHashBytes: number;
|
|
156
|
-
};
|
|
157
|
-
declare const SequenceComponentLengths: {
|
|
158
|
-
epochBytes: number;
|
|
159
|
-
nonceBytes: number;
|
|
160
|
-
addressBytes: number;
|
|
161
|
-
nonceIndexBytes: number;
|
|
162
|
-
nonceHashBytes: number;
|
|
163
|
-
};
|
|
164
|
-
declare const SequenceComponentMinMax: {
|
|
165
|
-
minEpoch: Epoch;
|
|
166
|
-
maxEpoch: Epoch;
|
|
167
|
-
minNonce: Nonce;
|
|
168
|
-
maxNonce: Nonce;
|
|
169
|
-
minAddress: Address;
|
|
170
|
-
maxAddress: Address;
|
|
171
|
-
};
|
|
172
|
-
declare const LocalSequenceConstants: {
|
|
173
|
-
localSequenceBytes: number;
|
|
174
|
-
minLocalSequence: LocalSequence;
|
|
175
|
-
maxLocalSequence: LocalSequence;
|
|
176
|
-
minEpoch: Epoch;
|
|
177
|
-
maxEpoch: Epoch;
|
|
178
|
-
minNonce: Nonce;
|
|
179
|
-
maxNonce: Nonce;
|
|
180
|
-
minAddress: Address;
|
|
181
|
-
maxAddress: Address;
|
|
182
|
-
epochBytes: number;
|
|
183
|
-
nonceBytes: number;
|
|
184
|
-
addressBytes: number;
|
|
185
|
-
nonceIndexBytes: number;
|
|
186
|
-
nonceHashBytes: number;
|
|
187
|
-
};
|
|
188
|
-
declare const QualifiedSequenceConstants: {
|
|
189
|
-
qualifiedSequenceBytes: number;
|
|
190
|
-
minQualifiedSequence: QualifiedSequence;
|
|
191
|
-
maxQualifiedSequence: QualifiedSequence;
|
|
192
|
-
};
|
|
193
|
-
declare const SequenceConstants: {
|
|
194
|
-
qualifiedSequenceBytes: number;
|
|
195
|
-
minQualifiedSequence: QualifiedSequence;
|
|
196
|
-
maxQualifiedSequence: QualifiedSequence;
|
|
197
|
-
localSequenceBytes: number;
|
|
198
|
-
minLocalSequence: LocalSequence;
|
|
199
|
-
maxLocalSequence: LocalSequence;
|
|
200
|
-
minEpoch: Epoch;
|
|
201
|
-
maxEpoch: Epoch;
|
|
202
|
-
minNonce: Nonce;
|
|
203
|
-
maxNonce: Nonce;
|
|
204
|
-
minAddress: Address;
|
|
205
|
-
maxAddress: Address;
|
|
206
|
-
epochBytes: number;
|
|
207
|
-
nonceBytes: number;
|
|
208
|
-
addressBytes: number;
|
|
209
|
-
nonceIndexBytes: number;
|
|
210
|
-
nonceHashBytes: number;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
declare class SequenceParser {
|
|
214
|
-
protected static privateConstructorKey: string;
|
|
215
|
-
private readonly data;
|
|
216
|
-
protected constructor(privateConstructorKey: string, hex: Hex);
|
|
217
|
-
get address(): Address;
|
|
218
|
-
get epoch(): Epoch;
|
|
219
|
-
get localSequence(): LocalSequence;
|
|
220
|
-
get nonce(): Nonce;
|
|
221
|
-
get qualifiedSequence(): QualifiedSequence;
|
|
222
|
-
static from(sequence: Sequence, address?: Address): SequenceParser;
|
|
223
|
-
static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser;
|
|
224
|
-
static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser;
|
|
225
|
-
static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser;
|
|
226
|
-
static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser;
|
|
227
|
-
static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser;
|
|
228
|
-
static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser;
|
|
229
|
-
static from(timestamp: number, hash: Hash, address?: Address): SequenceParser;
|
|
230
|
-
static from(timestamp: number, hash: Hex, address?: Address): SequenceParser;
|
|
231
|
-
static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser;
|
|
232
|
-
static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser;
|
|
233
|
-
static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser;
|
|
234
|
-
static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser;
|
|
235
|
-
static parse(value: Hex | string | ArrayBufferLike): SequenceParser;
|
|
236
|
-
static toEpoch(value: number | Hex | Epoch): Epoch;
|
|
237
|
-
static toNonce(value: Hash | Hex, index?: number): Nonce;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
interface SequenceStorageMeta {
|
|
241
|
-
_sequence: Sequence;
|
|
242
|
-
}
|
|
243
|
-
type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta;
|
|
244
|
-
type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>;
|
|
245
|
-
declare const isSequenceStorageMeta: (value: unknown) => value is SequenceStorageMeta;
|
|
246
|
-
declare const asSequenceStorageMeta: {
|
|
247
|
-
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
248
|
-
<TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<SequenceStorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
249
|
-
};
|
|
250
|
-
declare const asOptionalSequenceStorageMeta: <TType extends SequenceStorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
|
|
251
|
-
|
|
252
|
-
interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {
|
|
253
|
-
}
|
|
254
|
-
type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
|
|
255
|
-
type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>;
|
|
256
|
-
declare const isStorageMeta: (value: unknown) => value is StorageMeta;
|
|
257
|
-
declare const asStorageStorageMeta: {
|
|
258
|
-
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, config?: _xylabs_object.TypeCheckConfig): TType | undefined;
|
|
259
|
-
<TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise, assert: _xylabs_object.StringOrAlertFunction<StorageMeta>, config?: _xylabs_object.TypeCheckConfig): TType;
|
|
260
|
-
};
|
|
261
|
-
declare const asOptionalStorageMeta: <TType extends StorageMeta>(value: _store__xylabs_promise_npm_4_5_1_97d36b712b_package.AnyNonPromise) => TType | undefined;
|
|
262
|
-
|
|
263
|
-
interface Timestamp {
|
|
264
|
-
timestamp: number;
|
|
265
|
-
}
|
|
266
|
-
type WithTimestamp<T extends EmptyObject = EmptyObject> = T & Timestamp;
|
|
267
|
-
|
|
268
|
-
export { type AnyPayload, type AsyncPayloadValidationFunction, type ChainMetaFields, 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, SchemaRegEx, 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 };
|
|
1
|
+
export * from './Error.ts';
|
|
2
|
+
export * from './isPayload.ts';
|
|
3
|
+
export * from './isPayloadOfSchemaType.ts';
|
|
4
|
+
export * from './Payload.ts';
|
|
5
|
+
export * from './PayloadFindFilter.ts';
|
|
6
|
+
export * from './PayloadSet/index.ts';
|
|
7
|
+
export * from './PayloadValidationFunction.ts';
|
|
8
|
+
export * from './PayloadValueExpression.ts';
|
|
9
|
+
export * from './Query.ts';
|
|
10
|
+
export * from './Schema.ts';
|
|
11
|
+
export * from './StorageMeta/index.ts';
|
|
12
|
+
export * from './Timestamp.ts';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,cAAc,CAAA;AAC5B,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts","../../src/StorageMeta/DataHash.ts","../../src/StorageMeta/Hash.ts","../../src/StorageMeta/Sequence.ts","../../src/StorageMeta/sequence/Parser.ts","../../src/StorageMeta/sequence/Sequence.ts","../../src/StorageMeta/sequence/Comparer.ts","../../src/StorageMeta/StorageMeta.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport type { Payload } from './Payload.ts'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload\n = <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload.ts'\nimport type { Payload, WithSources } from './Payload.ts'\n\nexport function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']) {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.$sources != undefined && Array.isArray(x.$sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n// test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType<Payload>(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n*/\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType.ts'\nimport type { Payload } from './Payload.ts'\n\nexport const ModuleErrorSchema = 'network.xyo.error.module' as const\nexport type ModuleErrorSchema = typeof ModuleErrorSchema\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","export const PayloadSetSchema = 'network.xyo.payload.set' as const\nexport type PayloadSetSchema = typeof PayloadSetSchema\n","import type { EmptyObject } from '@xylabs/object'\nimport { AsTypeFactory } from '@xylabs/object'\n\nexport const SchemaRegEx = String.raw`^((?!-)[a-z0-9-]{1, 63}(?<!-)\\.)+$`\n\n/** Schema type in Javascript is a string */\n// eslint-disable-next-line sonarjs/redundant-type-aliases\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload' as const\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n return typeof value === 'string'\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n","import { type Hash, isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\n\nexport interface DataHashStorageMeta {\n _dataHash: Hash\n}\n\nexport type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta\nexport type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>\n\nexport const isDataHashStorageMeta = (value: unknown): value is DataHashStorageMeta => {\n return isHash((value as WithDataHashStorageMeta)?._dataHash)\n}\n\nexport const asDataHashStorageMeta = AsObjectFactory.create<DataHashStorageMeta>(isDataHashStorageMeta)\nexport const asOptionalDataHashStorageMeta = AsObjectFactory.createOptional<DataHashStorageMeta>(isDataHashStorageMeta)\n","import { type Hash, isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport { type DataHashStorageMeta, isDataHashStorageMeta } from './DataHash.ts'\n\nexport interface HashStorageMeta extends DataHashStorageMeta {\n _hash: Hash\n}\n\nexport type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta\nexport type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>\n\nexport const isHashStorageMeta = (value: unknown): value is HashStorageMeta => {\n return isDataHashStorageMeta(value) && isHash((value as WithHashStorageMeta)?._hash)\n}\n\nexport const asHashStorageMeta = AsObjectFactory.create<HashStorageMeta>(isHashStorageMeta)\nexport const asOptionalHashStorageMeta = AsObjectFactory.createOptional<HashStorageMeta>(isHashStorageMeta)\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { Sequence } from './sequence/index.ts'\n\nexport interface SequenceStorageMeta {\n _sequence: Sequence\n}\n\nexport type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta\nexport type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>\n\nexport const isSequenceStorageMeta = (value: unknown): value is SequenceStorageMeta => {\n return (value as WithSequenceStorageMeta)?._sequence != undefined\n}\n\nexport const asSequenceStorageMeta = AsObjectFactory.create(isSequenceStorageMeta)\nexport const asOptionalSequenceStorageMeta = AsObjectFactory.createOptional(isSequenceStorageMeta)\n","import { toUint8Array } from '@xylabs/arraybuffer'\nimport { assertEx } from '@xylabs/assert'\nimport {\n type Address,\n type Hash, type Hex,\n isAddress,\n toHex,\n} from '@xylabs/hex'\n\nimport type {\n Epoch, LocalSequence, Nonce, QualifiedSequence,\n Sequence,\n} from './Sequence.ts'\nimport {\n isQualifiedSequence, isSequence, SequenceConstants,\n} from './Sequence.ts'\n\nexport class SequenceParser {\n protected static privateConstructorKey = Date.now().toString()\n\n private readonly data: Readonly<Uint8Array>\n\n protected constructor(privateConstructorKey: string, hex: Hex) {\n assertEx(SequenceParser.privateConstructorKey === privateConstructorKey, () => 'Use create function instead of constructor')\n const paddedHex = toHex(hex, {\n prefix: false,\n bitLength: (hex.length <= SequenceConstants.localSequenceBytes * 2)\n ? SequenceConstants.localSequenceBytes * 8\n : SequenceConstants.qualifiedSequenceBytes * 8,\n })\n this.data = toUint8Array(paddedHex)\n }\n\n get address(): Address {\n const start = SequenceConstants.localSequenceBytes\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get epoch(): Epoch {\n const start = 0\n const end = SequenceConstants.epochBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get localSequence(): LocalSequence {\n const start = 0\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get nonce(): Nonce {\n const start = SequenceConstants.epochBytes\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get qualifiedSequence(): QualifiedSequence {\n const start = 0\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n static from(sequence: Sequence, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(\n timestampOrSequence: Sequence | Hex | number,\n nonceOrAddress: Hash | Nonce,\n addressOrIndex?: Address | number,\n addressOnly?: Address,\n ): SequenceParser {\n const address = typeof addressOrIndex === 'number' ? addressOnly : addressOrIndex\n const index = typeof addressOrIndex === 'number' ? addressOrIndex : undefined\n if (isSequence(timestampOrSequence)) {\n if (nonceOrAddress) {\n assertEx(!isQualifiedSequence(timestampOrSequence), () => 'Providing both a qualified sequence and a address is not allowed')\n assertEx(isAddress(nonceOrAddress), () => 'Invalid address provided')\n return new this(SequenceParser.privateConstructorKey, (timestampOrSequence + address) as Hex)\n }\n return new this(SequenceParser.privateConstructorKey, timestampOrSequence)\n }\n const epoch = SequenceParser.toEpoch(timestampOrSequence)\n const nonce = SequenceParser.toNonce(nonceOrAddress, index)\n const addressHex: Hex = address ? toHex(address, { bitLength: SequenceConstants.addressBytes * 8 }) : SequenceConstants.minAddress\n const hexString = (epoch + nonce + addressHex) as Hex\n assertEx(isSequence(hexString), () => `Invalid sequence [${hexString}] [${epoch}, ${nonce}, ${addressHex}]`)\n return new this(SequenceParser.privateConstructorKey, hexString)\n }\n\n static parse(value: Hex | string | ArrayBufferLike): SequenceParser {\n const hex = toHex(value)\n if (isSequence(hex)) {\n return new this(SequenceParser.privateConstructorKey, hex)\n }\n throw new Error(`Invalid sequence [${value}]`)\n }\n\n // can convert a short number/hex to an epoch (treats it as the whole value) or extract an epoch from a sequence\n static toEpoch(value: number | Hex | Epoch): Epoch {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (hex.length <= SequenceConstants.epochBytes * 2) {\n return toHex(value, { prefix: false, bitLength: SequenceConstants.epochBytes * 8 }) as Epoch\n }\n if (isSequence(hex)) {\n return hex.slice(0, SequenceConstants.epochBytes * 2) as Epoch\n }\n throw new Error(`Value could not be converted to epoch [${hex}]`)\n }\n\n // can convert a short number/hex to a nonce (treats it as the whole value) or extract an nonce from a sequence\n static toNonce(value: Hash | Hex, index = 0): Nonce {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (isSequence(hex)) {\n return hex.slice(SequenceConstants.epochBytes * 2, SequenceConstants.localSequenceBytes * 2) as Nonce\n }\n const hashHex = toHex((hex as string), { prefix: false, bitLength: SequenceConstants.nonceHashBytes * 8 }).slice(-SequenceConstants.nonceHashBytes * 2)\n const indexHex = toHex(index, { prefix: false, bitLength: SequenceConstants.nonceIndexBytes * 8 }).slice(-SequenceConstants.nonceIndexBytes * 2)\n return (indexHex + hashHex).slice(-SequenceConstants.nonceBytes * 2) as Nonce\n }\n}\n","import type { Address, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\n\n// we use Exclude to intentionally make the type not equal to string\nexport type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>\nexport type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>\nexport type Sequence = LocalSequence | QualifiedSequence\n\nexport type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>\n\nexport const isEpoch = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.epochBytes * 2\n}\n\nexport type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>\n\nexport const isNonce = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.nonceBytes * 2\n}\n\nexport const isLocalSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.localSequenceBytes * 2\n}\n\nexport const isQualifiedSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.qualifiedSequenceBytes * 2\n}\n\nexport const isSequence = (value: unknown): value is Sequence => {\n return isLocalSequence(value) || isQualifiedSequence(value)\n}\n\nexport const SequenceNonceComponentLengths = {\n nonceIndexBytes: 4,\n nonceHashBytes: 4,\n}\n\nexport const SequenceComponentLengths = {\n ...SequenceNonceComponentLengths,\n epochBytes: 8,\n nonceBytes: SequenceNonceComponentLengths.nonceIndexBytes + SequenceNonceComponentLengths.nonceHashBytes,\n addressBytes: 20,\n}\n\nexport const SequenceComponentMinMax = {\n minEpoch: '0'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n maxEpoch: 'f'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n minNonce: '0'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n maxNonce: 'f'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n minAddress: '0'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n maxAddress: 'f'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n}\n\nexport const LocalSequenceConstants = {\n ...SequenceComponentLengths,\n ...SequenceComponentMinMax,\n localSequenceBytes: SequenceComponentLengths.epochBytes + SequenceComponentLengths.nonceBytes,\n minLocalSequence: SequenceComponentMinMax.minEpoch + SequenceComponentMinMax.minNonce as LocalSequence,\n maxLocalSequence: SequenceComponentMinMax.maxEpoch + SequenceComponentMinMax.maxNonce as LocalSequence,\n}\n\nexport const QualifiedSequenceConstants = {\n qualifiedSequenceBytes: LocalSequenceConstants.localSequenceBytes + SequenceComponentLengths.addressBytes,\n minQualifiedSequence: LocalSequenceConstants.minLocalSequence + SequenceComponentMinMax.minAddress as QualifiedSequence,\n maxQualifiedSequence: LocalSequenceConstants.maxLocalSequence + SequenceComponentMinMax.maxAddress as QualifiedSequence,\n}\n\nexport const SequenceConstants = {\n ...LocalSequenceConstants,\n ...QualifiedSequenceConstants,\n}\n\n// \"11111111111111112222222222222222\" is and example of a local sequence string\n\n// \"111111111111111122222222222222223333333333333333333333333333333333333333\" is and example of a local sequence string\n// epoch = \"1111111111111111\"\n// nonce = \"2222222222222222\"\n// address = \"3333333333333333333333333333333333333333\"\n","import type { Compare } from '@xylabs/object'\n\nimport { SequenceParser } from './Parser.ts'\nimport type { Sequence } from './Sequence.ts'\n\nconst local: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.localSequence > bb.localSequence ? 1 : aa.localSequence < bb.localSequence ? -1 : 0\n}\n\nconst qualified: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.qualifiedSequence > bb.qualifiedSequence ? 1 : aa.qualifiedSequence < bb.qualifiedSequence ? -1 : 0\n}\n\nexport const SequenceComparer = { local, qualified }\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport { type HashStorageMeta, isHashStorageMeta } from './Hash.ts'\nimport { isSequenceStorageMeta, type SequenceStorageMeta } from './Sequence.ts'\n\nexport interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {}\n\nexport type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta\nexport type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>\n\nexport const isStorageMeta = (value: unknown): value is StorageMeta => {\n return isSequenceStorageMeta(value) && isHashStorageMeta(value)\n}\n\nexport const asStorageStorageMeta = AsObjectFactory.create(isStorageMeta)\nexport const asOptionalStorageMeta = AsObjectFactory.createOptional(isStorageMeta)\n"],"mappings":";AAAA,SAAS,iBAAiB,gBAAgB;AAInC,IAAM,eAAe,CAAC,UAAqC;AAChE,MAAI,SAAS,KAAK,GAAG;AACnB,WAAO,OAAO,MAAM,WAAW;AAAA,EACjC;AACA,SAAO;AACT;AAEO,IAAM,eAAe,gBAAgB,OAAO,YAAY;AAExD,IAAM,YACT,CAAoB,WACpB,CAAC,UAA+B;AAC9B,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,OAAO,SAAS,MAAM,MAAM;AAAA,EACrC;AACA,SAAO;AACT;AAEG,IAAM,YAAY,CAAoB,WAAqB,gBAAgB,OAAO,CAAC,UAA+B,UAAU,MAAM,EAAE,KAAK,CAAC;;;ACnB1I,SAAS,sBAAyD,QAAqB;AAC5F,SAAO,CAAC,MAA+B,aAAa,CAAC,KAAK,GAAG,WAAW;AAC1E;AAEO,IAAM,mCAAmC,CAAoC,WAAwB;AAC1G,SAAO,CAAC,MACN,sBAAsC,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,UAAa,MAAM,QAAQ,EAAE,QAAQ;AAC3G;AAEO,IAAM,yBAAyB,CAAoC,WAAwB;AAChG,SAAO,CAAC,MAA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AAoB,GAAG,oBAAoB,IAAI,GAAG,oBAAoB,GAAG,oBAAoB,KAAK;AAC9G;AAEO,IAAM,mBAAmB,EAAE,OAAO,UAAU;;;ACjBnD,SAAS,mBAAAC,wBAAuB;AAWzB,IAAM,gBAAgB,CAAC,UAAyC;AACrE,SAAO,sBAAsB,KAAK,KAAK,kBAAkB,KAAK;AAChE;AAEO,IAAM,uBAAuBC,iBAAgB,OAAO,aAAa;AACjE,IAAM,wBAAwBA,iBAAgB,eAAe,aAAa;","names":["AsObjectFactory","isHash","AsObjectFactory","isHash","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory"]}
|
|
1
|
+
{"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts","../../src/StorageMeta/DataHash.ts","../../src/StorageMeta/Hash.ts","../../src/StorageMeta/Sequence.ts","../../src/StorageMeta/sequence/Parser.ts","../../src/StorageMeta/sequence/Sequence.ts","../../src/StorageMeta/sequence/Comparer.ts","../../src/StorageMeta/StorageMeta.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport type { Payload } from './Payload.ts'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload\n = <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload.ts'\nimport type { Payload, WithSources } from './Payload.ts'\n\nexport function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']) {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.$sources != undefined && Array.isArray(x.$sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n// test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType<Payload>(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n*/\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType.ts'\nimport type { Payload } from './Payload.ts'\n\nexport const ModuleErrorSchema = 'network.xyo.error.module' as const\nexport type ModuleErrorSchema = typeof ModuleErrorSchema\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","export const PayloadSetSchema = 'network.xyo.payload.set' as const\nexport type PayloadSetSchema = typeof PayloadSetSchema\n","import type { EmptyObject } from '@xylabs/object'\nimport { AsTypeFactory } from '@xylabs/object'\n\nexport const SchemaRegEx = String.raw`^((?!-)[a-z0-9-]{1, 63}(?<!-)\\.)+$`\n\n/** Schema type in Javascript is a string */\n// eslint-disable-next-line sonarjs/redundant-type-aliases\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload' as const\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n return typeof value === 'string'\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n","import type { Hash } from '@xylabs/hex'\nimport { isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\n\nexport interface DataHashStorageMeta {\n _dataHash: Hash\n}\n\nexport type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta\nexport type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>\n\nexport const isDataHashStorageMeta = (value: unknown): value is DataHashStorageMeta => {\n return isHash((value as WithDataHashStorageMeta)?._dataHash)\n}\n\nexport const asDataHashStorageMeta = AsObjectFactory.create<DataHashStorageMeta>(isDataHashStorageMeta)\nexport const asOptionalDataHashStorageMeta = AsObjectFactory.createOptional<DataHashStorageMeta>(isDataHashStorageMeta)\n","import type { Hash } from '@xylabs/hex'\nimport { isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { DataHashStorageMeta } from './DataHash.ts'\nimport { isDataHashStorageMeta } from './DataHash.ts'\n\nexport interface HashStorageMeta extends DataHashStorageMeta {\n _hash: Hash\n}\n\nexport type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta\nexport type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>\n\nexport const isHashStorageMeta = (value: unknown): value is HashStorageMeta => {\n return isDataHashStorageMeta(value) && isHash((value as WithHashStorageMeta)?._hash)\n}\n\nexport const asHashStorageMeta = AsObjectFactory.create<HashStorageMeta>(isHashStorageMeta)\nexport const asOptionalHashStorageMeta = AsObjectFactory.createOptional<HashStorageMeta>(isHashStorageMeta)\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { Sequence } from './sequence/index.ts'\n\nexport interface SequenceStorageMeta {\n _sequence: Sequence\n}\n\nexport type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta\nexport type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>\n\nexport const isSequenceStorageMeta = (value: unknown): value is SequenceStorageMeta => {\n return (value as WithSequenceStorageMeta)?._sequence != undefined\n}\n\nexport const asSequenceStorageMeta = AsObjectFactory.create(isSequenceStorageMeta)\nexport const asOptionalSequenceStorageMeta = AsObjectFactory.createOptional(isSequenceStorageMeta)\n","import { toUint8Array } from '@xylabs/arraybuffer'\nimport { assertEx } from '@xylabs/assert'\nimport type {\n Address,\n Hash, Hex,\n} from '@xylabs/hex'\nimport {\n isAddress,\n toHex,\n} from '@xylabs/hex'\n\nimport type {\n Epoch, LocalSequence, Nonce, QualifiedSequence,\n Sequence,\n} from './Sequence.ts'\nimport {\n isQualifiedSequence, isSequence,\n SequenceConstants,\n} from './Sequence.ts'\n\nexport class SequenceParser {\n protected static privateConstructorKey = Date.now().toString()\n\n private readonly data: Readonly<Uint8Array>\n\n protected constructor(privateConstructorKey: string, hex: Hex) {\n assertEx(SequenceParser.privateConstructorKey === privateConstructorKey, () => 'Use create function instead of constructor')\n const paddedHex = toHex(hex, {\n prefix: false,\n bitLength: (hex.length <= SequenceConstants.localSequenceBytes * 2)\n ? SequenceConstants.localSequenceBytes * 8\n : SequenceConstants.qualifiedSequenceBytes * 8,\n })\n this.data = toUint8Array(paddedHex)\n }\n\n get address(): Address {\n const start = SequenceConstants.localSequenceBytes\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get epoch(): Epoch {\n const start = 0\n const end = SequenceConstants.epochBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get localSequence(): LocalSequence {\n const start = 0\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get nonce(): Nonce {\n const start = SequenceConstants.epochBytes\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get qualifiedSequence(): QualifiedSequence {\n const start = 0\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n static from(sequence: Sequence, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(\n timestampOrSequence: Sequence | Hex | number,\n nonceOrAddress: Hash | Nonce,\n addressOrIndex?: Address | number,\n addressOnly?: Address,\n ): SequenceParser {\n const address = typeof addressOrIndex === 'number' ? addressOnly : addressOrIndex\n const index = typeof addressOrIndex === 'number' ? addressOrIndex : undefined\n if (isSequence(timestampOrSequence)) {\n if (nonceOrAddress) {\n assertEx(!isQualifiedSequence(timestampOrSequence), () => 'Providing both a qualified sequence and a address is not allowed')\n assertEx(isAddress(nonceOrAddress), () => 'Invalid address provided')\n return new this(SequenceParser.privateConstructorKey, (timestampOrSequence + address) as Hex)\n }\n return new this(SequenceParser.privateConstructorKey, timestampOrSequence)\n }\n const epoch = SequenceParser.toEpoch(timestampOrSequence)\n const nonce = SequenceParser.toNonce(nonceOrAddress, index)\n const addressHex: Hex = address ? toHex(address, { bitLength: SequenceConstants.addressBytes * 8 }) : SequenceConstants.minAddress\n const hexString = (epoch + nonce + addressHex) as Hex\n assertEx(isSequence(hexString), () => `Invalid sequence [${hexString}] [${epoch}, ${nonce}, ${addressHex}]`)\n return new this(SequenceParser.privateConstructorKey, hexString)\n }\n\n static parse(value: Hex | string | ArrayBufferLike): SequenceParser {\n const hex = toHex(value)\n if (isSequence(hex)) {\n return new this(SequenceParser.privateConstructorKey, hex)\n }\n throw new Error(`Invalid sequence [${value}]`)\n }\n\n // can convert a short number/hex to an epoch (treats it as the whole value) or extract an epoch from a sequence\n static toEpoch(value: number | Hex | Epoch): Epoch {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (hex.length <= SequenceConstants.epochBytes * 2) {\n return toHex(value, { prefix: false, bitLength: SequenceConstants.epochBytes * 8 }) as Epoch\n }\n if (isSequence(hex)) {\n return hex.slice(0, SequenceConstants.epochBytes * 2) as Epoch\n }\n throw new Error(`Value could not be converted to epoch [${hex}]`)\n }\n\n // can convert a short number/hex to a nonce (treats it as the whole value) or extract an nonce from a sequence\n static toNonce(value: Hash | Hex, index = 0): Nonce {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (isSequence(hex)) {\n return hex.slice(SequenceConstants.epochBytes * 2, SequenceConstants.localSequenceBytes * 2) as Nonce\n }\n const hashHex = toHex((hex as string), { prefix: false, bitLength: SequenceConstants.nonceHashBytes * 8 }).slice(-SequenceConstants.nonceHashBytes * 2)\n const indexHex = toHex(index, { prefix: false, bitLength: SequenceConstants.nonceIndexBytes * 8 }).slice(-SequenceConstants.nonceIndexBytes * 2)\n return (indexHex + hashHex).slice(-SequenceConstants.nonceBytes * 2) as Nonce\n }\n}\n","import type { Address, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\n\n// we use Exclude to intentionally make the type not equal to string\nexport type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>\nexport type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>\nexport type Sequence = LocalSequence | QualifiedSequence\n\nexport type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>\n\nexport const isEpoch = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.epochBytes * 2\n}\n\nexport type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>\n\nexport const isNonce = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.nonceBytes * 2\n}\n\nexport const isLocalSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.localSequenceBytes * 2\n}\n\nexport const isQualifiedSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.qualifiedSequenceBytes * 2\n}\n\nexport const isSequence = (value: unknown): value is Sequence => {\n return isLocalSequence(value) || isQualifiedSequence(value)\n}\n\nexport const SequenceNonceComponentLengths = {\n nonceIndexBytes: 4,\n nonceHashBytes: 4,\n}\n\nexport const SequenceComponentLengths = {\n ...SequenceNonceComponentLengths,\n epochBytes: 8,\n nonceBytes: SequenceNonceComponentLengths.nonceIndexBytes + SequenceNonceComponentLengths.nonceHashBytes,\n addressBytes: 20,\n}\n\nexport const SequenceComponentMinMax = {\n minEpoch: '0'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n maxEpoch: 'f'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n minNonce: '0'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n maxNonce: 'f'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n minAddress: '0'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n maxAddress: 'f'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n}\n\nexport const LocalSequenceConstants = {\n ...SequenceComponentLengths,\n ...SequenceComponentMinMax,\n localSequenceBytes: SequenceComponentLengths.epochBytes + SequenceComponentLengths.nonceBytes,\n minLocalSequence: SequenceComponentMinMax.minEpoch + SequenceComponentMinMax.minNonce as LocalSequence,\n maxLocalSequence: SequenceComponentMinMax.maxEpoch + SequenceComponentMinMax.maxNonce as LocalSequence,\n}\n\nexport const QualifiedSequenceConstants = {\n qualifiedSequenceBytes: LocalSequenceConstants.localSequenceBytes + SequenceComponentLengths.addressBytes,\n minQualifiedSequence: LocalSequenceConstants.minLocalSequence + SequenceComponentMinMax.minAddress as QualifiedSequence,\n maxQualifiedSequence: LocalSequenceConstants.maxLocalSequence + SequenceComponentMinMax.maxAddress as QualifiedSequence,\n}\n\nexport const SequenceConstants = {\n ...LocalSequenceConstants,\n ...QualifiedSequenceConstants,\n}\n\n// \"11111111111111112222222222222222\" is and example of a local sequence string\n\n// \"111111111111111122222222222222223333333333333333333333333333333333333333\" is and example of a local sequence string\n// epoch = \"1111111111111111\"\n// nonce = \"2222222222222222\"\n// address = \"3333333333333333333333333333333333333333\"\n","import type { Compare } from '@xylabs/object'\n\nimport { SequenceParser } from './Parser.ts'\nimport type { Sequence } from './Sequence.ts'\n\nconst local: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.localSequence > bb.localSequence ? 1 : aa.localSequence < bb.localSequence ? -1 : 0\n}\n\nconst qualified: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.qualifiedSequence > bb.qualifiedSequence ? 1 : aa.qualifiedSequence < bb.qualifiedSequence ? -1 : 0\n}\n\nexport const SequenceComparer = { local, qualified }\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { HashStorageMeta } from './Hash.ts'\nimport { isHashStorageMeta } from './Hash.ts'\nimport type { SequenceStorageMeta } from './Sequence.ts'\nimport { isSequenceStorageMeta } from './Sequence.ts'\n\nexport interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {}\n\nexport type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta\nexport type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>\n\nexport const isStorageMeta = (value: unknown): value is StorageMeta => {\n return isSequenceStorageMeta(value) && isHashStorageMeta(value)\n}\n\nexport const asStorageStorageMeta = AsObjectFactory.create(isStorageMeta)\nexport const asOptionalStorageMeta = AsObjectFactory.createOptional(isStorageMeta)\n"],"mappings":";AAAA,SAAS,iBAAiB,gBAAgB;AAInC,IAAM,eAAe,CAAC,UAAqC;AAChE,MAAI,SAAS,KAAK,GAAG;AACnB,WAAO,OAAO,MAAM,WAAW;AAAA,EACjC;AACA,SAAO;AACT;AAEO,IAAM,eAAe,gBAAgB,OAAO,YAAY;AAExD,IAAM,YACT,CAAoB,WACpB,CAAC,UAA+B;AAC9B,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,OAAO,SAAS,MAAM,MAAM;AAAA,EACrC;AACA,SAAO;AACT;AAEG,IAAM,YAAY,CAAoB,WAAqB,gBAAgB,OAAO,CAAC,UAA+B,UAAU,MAAM,EAAE,KAAK,CAAC;;;ACnB1I,SAAS,sBAAyD,QAAqB;AAC5F,SAAO,CAAC,MAA+B,aAAa,CAAC,KAAK,GAAG,WAAW;AAC1E;AAEO,IAAM,mCAAmC,CAAoC,WAAwB;AAC1G,SAAO,CAAC,MACN,sBAAsC,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,UAAa,MAAM,QAAQ,EAAE,QAAQ;AAC3G;AAEO,IAAM,yBAAyB,CAAoC,WAAwB;AAChG,SAAO,CAAC,MAA+B,CAAC,aAAa,CAAC,KAAK,GAAG,WAAW;AAC3E;;;ACRO,IAAM,oBAAoB;AAW1B,IAAM,gBAAgB,sBAAmC,iBAAiB;;;ACjB1E,IAAM,mBAAmB;;;ACChC,SAAS,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M,gBAAgB,CAAC,UAAyC;AACrE,SAAO,sBAAsB,KAAK,KAAK,kBAAkB,KAAK;AAChE;AAEO,IAAM,uBAAuBC,iBAAgB,OAAO,aAAa;AACjE,IAAM,wBAAwBA,iBAAgB,eAAe,aAAa;","names":["AsObjectFactory","isHash","AsObjectFactory","isHash","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Payload } from './Payload.ts';
|
|
2
|
+
export declare const isAnyPayload: (value: unknown) => value is Payload;
|
|
3
|
+
export declare const asAnyPayload: {
|
|
4
|
+
<TType extends Payload>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
|
|
5
|
+
<TType extends Payload>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<Payload>, config?: import("@xylabs/object").TypeCheckConfig): TType;
|
|
6
|
+
};
|
|
7
|
+
export declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
|
|
8
|
+
export declare const asPayload: <T extends Payload>(schema: string[]) => {
|
|
9
|
+
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
|
|
10
|
+
<TType extends T>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=isPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayload.d.ts","sourceRoot":"","sources":["../../src/isPayload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAKtD,CAAA;AAED,eAAO,MAAM,YAAY;0CAHrB,qDAGD,iCAAiC,gBAAoB;0CAIpD,qDAAc,kGAEyB,gBAEjC;CARsD,CAAA;AAEhE,eAAO,MAAM,SAAS,GACjB,CAAC,SAAS,OAAO,EAAE,QAAQ,MAAM,EAAE,MACnC,OAAO,OAAO,KAAG,KAAK,IAAI,CAK1B,CAAA;AAEL,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,OAAO,EAAE,QAAQ,MAAM,EAAE;oCAdzD,qDAGD,iCAAiC,gBAAoB;oCAIpD,qDAAc,4FAEyB,gBAEjC;CAGwI,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Payload, WithSources } from './Payload.ts';
|
|
2
|
+
export declare function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']): (x?: unknown | null) => x is T;
|
|
3
|
+
export declare const isPayloadOfSchemaTypeWithSources: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is WithSources<T>;
|
|
4
|
+
export declare const notPayloadOfSchemaType: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is T;
|
|
5
|
+
//# sourceMappingURL=isPayloadOfSchemaType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPayloadOfSchemaType.d.ts","sourceRoot":"","sources":["../../src/isPayloadOfSchemaType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAExD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,IAClF,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,CAAC,CACpC;AAED,eAAO,MAAM,gCAAgC,GAAI,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAC7F,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAEhD,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MACnF,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,CACnC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex';
|
|
2
|
+
import type { JsonValue } from '@xylabs/object';
|
|
3
|
+
import type { Payload } from './Payload.ts';
|
|
4
|
+
export declare const ModuleErrorSchema: "network.xyo.error.module";
|
|
5
|
+
export type ModuleErrorSchema = typeof ModuleErrorSchema;
|
|
6
|
+
export type ModuleError = Payload<{
|
|
7
|
+
details?: JsonValue;
|
|
8
|
+
message?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
query?: Hash;
|
|
11
|
+
schema: ModuleErrorSchema;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const isModuleError: (x?: unknown | null) => x is ModuleError;
|
|
14
|
+
//# sourceMappingURL=Error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAO,MAAM,iBAAiB,EAAG,0BAAmC,CAAA;AACpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,iBAAiB,CAAA;CAC1B,CAAC,CAAA;AAEF,eAAO,MAAM,aAAa,0CAAwD,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex';
|
|
2
|
+
import type { DeepOmitStartsWith, DeepPickStartsWith, DeepRestrictToStringKeys, EmptyObject, JsonObject } from '@xylabs/object';
|
|
3
|
+
import type { Schema, WithSchema } from './Schema.ts';
|
|
4
|
+
export interface SchemaField<T extends Schema = Schema> {
|
|
5
|
+
schema: T;
|
|
6
|
+
}
|
|
7
|
+
/** Additional fields for a payload */
|
|
8
|
+
export interface PayloadFields extends SchemaField {
|
|
9
|
+
}
|
|
10
|
+
export type OpCode = 'elevate';
|
|
11
|
+
export interface SourcesMetaField {
|
|
12
|
+
$sources: Hash[];
|
|
13
|
+
}
|
|
14
|
+
export interface ChainMetaFields {
|
|
15
|
+
$opCodes?: OpCode[];
|
|
16
|
+
}
|
|
17
|
+
export interface PayloadMetaFields extends SourcesMetaField, ChainMetaFields {
|
|
18
|
+
}
|
|
19
|
+
export type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>;
|
|
20
|
+
/** Base Type for Payloads */
|
|
21
|
+
export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = (T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
|
|
22
|
+
schema: S;
|
|
23
|
+
}> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
|
|
24
|
+
schema: S;
|
|
25
|
+
}> : WithPayload<T & PayloadFields> : WithPayload<{
|
|
26
|
+
schema: S extends Schema ? S : Schema;
|
|
27
|
+
}>) & Partial<PayloadMetaFields>;
|
|
28
|
+
export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
|
|
29
|
+
export type WithSources<T extends EmptyObject> = T & SourcesMetaField;
|
|
30
|
+
/** @deprecated optional $sources are now optional in all Payloads */
|
|
31
|
+
export type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
|
|
32
|
+
export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
|
|
33
|
+
/** @deprecated optional $sources are now optional in all Payloads */
|
|
34
|
+
export type PayloadWithOptionalSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithOptionalSources<Payload<T, S>>;
|
|
35
|
+
export type WithAnySchema<T extends Payload> = OverridablePayload<T>;
|
|
36
|
+
export type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>;
|
|
37
|
+
export type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>;
|
|
38
|
+
export type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>;
|
|
39
|
+
export type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>;
|
|
40
|
+
export type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>;
|
|
41
|
+
export type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>;
|
|
42
|
+
export type WithOnlyClientMeta<T extends EmptyObject> = DeepPickStartsWith<T, '$'>;
|
|
43
|
+
export type AnyPayload = Payload<JsonObject, Schema>;
|
|
44
|
+
//# sourceMappingURL=Payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EACV,kBAAkB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,WAAW,EAC7E,UA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MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzF,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,kBAAkB,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;AACpF,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,WAAW,CAAC,CAAA;AAEjH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAElF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadFindFilter.d.ts","sourceRoot":"","sources":["../../src/PayloadFindFilter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Payload } from '../Payload.ts';
|
|
2
|
+
import type { PayloadSetSchema } from './PayloadSetSchema.ts';
|
|
3
|
+
export interface PayloadSet {
|
|
4
|
+
optional?: Record<string, number>;
|
|
5
|
+
required?: Record<string, number>;
|
|
6
|
+
}
|
|
7
|
+
export type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
|
|
8
|
+
//# sourceMappingURL=PayloadSetPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadSetPayload.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/PayloadSetPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadSetSchema.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/PayloadSetSchema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,yBAAkC,CAAA;AAClE,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Payload } from './Payload.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A function that validates the supplied payload synchronously
|
|
4
|
+
*/
|
|
5
|
+
export type SyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* A function that validates the supplied payload asynchronously
|
|
8
|
+
*/
|
|
9
|
+
export type AsyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* A function that validates the supplied payload
|
|
12
|
+
*/
|
|
13
|
+
export type PayloadValidationFunction<T extends Payload = Payload> = SyncPayloadValidationFunction<T> | AsyncPayloadValidationFunction<T>;
|
|
14
|
+
//# sourceMappingURL=PayloadValidationFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadValidationFunction.d.ts","sourceRoot":"","sources":["../../src/PayloadValidationFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAA;AAEhG;;GAEG;AACH,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE1G;;GAEG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,6BAA6B,CAAC,CAAC,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Payload } from './Payload.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Type corresponding to the properties of a payload
|
|
4
|
+
*/
|
|
5
|
+
export type PayloadProperty<
|
|
6
|
+
/**
|
|
7
|
+
* The type of payload
|
|
8
|
+
*/
|
|
9
|
+
T extends Payload = Payload> = keyof T;
|
|
10
|
+
/**
|
|
11
|
+
* Type corresponding to the payload values
|
|
12
|
+
*/
|
|
13
|
+
export type PayloadValue<
|
|
14
|
+
/**
|
|
15
|
+
* The type of payload
|
|
16
|
+
*/
|
|
17
|
+
T extends Payload = Payload,
|
|
18
|
+
/**
|
|
19
|
+
* The property of the payload to select
|
|
20
|
+
*/
|
|
21
|
+
Key extends PayloadProperty<T> = PayloadProperty<T>> = T[Key];
|
|
22
|
+
/**
|
|
23
|
+
* An expressions that selects a property value from the payload
|
|
24
|
+
*/
|
|
25
|
+
export type PayloadValueExpression<
|
|
26
|
+
/**
|
|
27
|
+
* The type of payload
|
|
28
|
+
*/
|
|
29
|
+
T extends Payload = Payload,
|
|
30
|
+
/**
|
|
31
|
+
* The property of the payload to select
|
|
32
|
+
*/
|
|
33
|
+
Key extends PayloadProperty<T> = PayloadProperty<T>,
|
|
34
|
+
/**
|
|
35
|
+
* The type of the selected property's value
|
|
36
|
+
*/
|
|
37
|
+
TValue = PayloadValue<T, Key>> = (payload: T) => TValue;
|
|
38
|
+
//# sourceMappingURL=PayloadValueExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadValueExpression.d.ts","sourceRoot":"","sources":["../../src/PayloadValueExpression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,eAAe;AACzB;;GAEG;AACH,CAAC,SAAS,OAAO,GAAG,OAAO,IACzB,MAAM,CAAC,CAAA;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY;AACtB;;GAEG;AACH,CAAC,SAAS,OAAO,GAAG,OAAO;AAC3B;;GAEG;AACH,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,IACjD,CAAC,CAAC,GAAG,CAAC,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,sBAAsB;AAChC;;GAEG;AACH,CAAC,SAAS,OAAO,GAAG,OAAO;AAC3B;;GAEG;AACH,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;AACnD;;GAEG;AACH,MAAM,GAAG,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,IAC3B,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,CAAA"}
|