@xyo-network/schema-cache 5.3.25 → 5.3.26
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/README.md +262 -10
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -1,23 +1,275 @@
|
|
|
1
|
+
[![logo][]](https://xyo.network)
|
|
2
|
+
|
|
1
3
|
# @xyo-network/schema-cache
|
|
2
4
|
|
|
3
|
-
[![
|
|
5
|
+
[![npm][npm-badge]][npm-link]
|
|
6
|
+
[![license][license-badge]][license-link]
|
|
7
|
+
|
|
8
|
+
> Primary SDK for using XYO Protocol 2.0
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Using npm:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install {{name}}
|
|
16
|
+
```
|
|
4
17
|
|
|
5
|
-
|
|
18
|
+
Using yarn:
|
|
6
19
|
|
|
7
|
-
|
|
20
|
+
```sh
|
|
21
|
+
yarn add {{name}}
|
|
22
|
+
```
|
|
8
23
|
|
|
9
|
-
|
|
24
|
+
Using pnpm:
|
|
10
25
|
|
|
11
|
-
|
|
26
|
+
```sh
|
|
27
|
+
pnpm add {{name}}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Using bun:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
bun add {{name}}
|
|
34
|
+
```
|
|
12
35
|
|
|
13
|
-
Part of [sdk-xyo-client-js](https://www.npmjs.com/package/@xyo-network/sdk-xyo-client-js)
|
|
14
36
|
|
|
15
37
|
## License
|
|
16
38
|
|
|
17
|
-
|
|
39
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
40
|
+
|
|
41
|
+
## Reference
|
|
42
|
+
|
|
43
|
+
### packages
|
|
44
|
+
|
|
45
|
+
### sdk-utils
|
|
46
|
+
|
|
47
|
+
### packages
|
|
48
|
+
|
|
49
|
+
### schema-cache
|
|
50
|
+
|
|
51
|
+
### .temp-typedoc
|
|
52
|
+
|
|
53
|
+
### classes
|
|
54
|
+
|
|
55
|
+
### <a id="Debounce"></a>Debounce
|
|
56
|
+
|
|
57
|
+
[**@xyo-network/schema-cache**](#../README)
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
## Type Parameters
|
|
62
|
+
|
|
63
|
+
### TKey
|
|
64
|
+
|
|
65
|
+
`TKey` = `string`
|
|
66
|
+
|
|
67
|
+
## Constructors
|
|
68
|
+
|
|
69
|
+
### Constructor
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
new Debounce<TKey>(): Debounce<TKey>;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Returns
|
|
76
|
+
|
|
77
|
+
`Debounce`\<`TKey`\>
|
|
78
|
+
|
|
79
|
+
## Methods
|
|
80
|
+
|
|
81
|
+
### one()
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
one<T>(
|
|
85
|
+
key,
|
|
86
|
+
closure,
|
|
87
|
+
timeout?): Promise<T>;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Type Parameters
|
|
91
|
+
|
|
92
|
+
#### T
|
|
93
|
+
|
|
94
|
+
`T`
|
|
95
|
+
|
|
96
|
+
### Parameters
|
|
97
|
+
|
|
98
|
+
#### key
|
|
99
|
+
|
|
100
|
+
`TKey`
|
|
101
|
+
|
|
102
|
+
#### closure
|
|
103
|
+
|
|
104
|
+
() => `Promise`\<`T`\>
|
|
105
|
+
|
|
106
|
+
#### timeout?
|
|
107
|
+
|
|
108
|
+
`number` = `10_000`
|
|
109
|
+
|
|
110
|
+
### Returns
|
|
111
|
+
|
|
112
|
+
`Promise`\<`T`\>
|
|
113
|
+
|
|
114
|
+
### <a id="SchemaCache"></a>SchemaCache
|
|
115
|
+
|
|
116
|
+
[**@xyo-network/schema-cache**](#../README)
|
|
117
|
+
|
|
118
|
+
***
|
|
119
|
+
|
|
120
|
+
## Type Parameters
|
|
121
|
+
|
|
122
|
+
### T
|
|
123
|
+
|
|
124
|
+
`T` *extends* [`SchemaNameToValidatorMap`](#../interfaces/SchemaNameToValidatorMap) = [`SchemaNameToValidatorMap`](#../interfaces/SchemaNameToValidatorMap)
|
|
125
|
+
|
|
126
|
+
## Properties
|
|
127
|
+
|
|
128
|
+
### NULL
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
protected readonly static NULL: SchemaCacheEntry;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Object representing `null` since LRU Cache types
|
|
135
|
+
only allow for types that derive from object
|
|
136
|
+
|
|
137
|
+
***
|
|
138
|
+
|
|
139
|
+
### onSchemaCached?
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
optional onSchemaCached?: (name, entry) => void;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Parameters
|
|
146
|
+
|
|
147
|
+
#### name
|
|
148
|
+
|
|
149
|
+
`string`
|
|
150
|
+
|
|
151
|
+
#### entry
|
|
152
|
+
|
|
153
|
+
[`SchemaCacheEntry`](#../type-aliases/SchemaCacheEntry)
|
|
154
|
+
|
|
155
|
+
### Returns
|
|
156
|
+
|
|
157
|
+
`void`
|
|
158
|
+
|
|
159
|
+
***
|
|
160
|
+
|
|
161
|
+
### proxy?
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
optional proxy?: string;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Accessors
|
|
168
|
+
|
|
169
|
+
### instance
|
|
170
|
+
|
|
171
|
+
### Get Signature
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
get static instance(): SchemaCache<SchemaNameToValidatorMap>;
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Returns
|
|
178
|
+
|
|
179
|
+
`SchemaCache`\<[`SchemaNameToValidatorMap`](#../interfaces/SchemaNameToValidatorMap)\>
|
|
180
|
+
|
|
181
|
+
***
|
|
182
|
+
|
|
183
|
+
### validators
|
|
184
|
+
|
|
185
|
+
### Get Signature
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
get validators(): T;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
A map of cached schema (by name) to payload validators for the schema. A schema
|
|
192
|
+
must be cached via `get('schema.name')` before it's validator can be used as
|
|
193
|
+
they are compiled dynamically at runtime upon retrieval.
|
|
194
|
+
|
|
195
|
+
#### Returns
|
|
196
|
+
|
|
197
|
+
`T`
|
|
198
|
+
|
|
199
|
+
## Methods
|
|
200
|
+
|
|
201
|
+
### get()
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
get(schema?): Promise<
|
|
205
|
+
| SchemaCacheEntry
|
|
206
|
+
| null
|
|
207
|
+
| undefined>;
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Parameters
|
|
211
|
+
|
|
212
|
+
#### schema?
|
|
213
|
+
|
|
214
|
+
`string`
|
|
215
|
+
|
|
216
|
+
### Returns
|
|
217
|
+
|
|
218
|
+
`Promise`\<
|
|
219
|
+
\| [`SchemaCacheEntry`](#../type-aliases/SchemaCacheEntry)
|
|
220
|
+
\| `null`
|
|
221
|
+
\| `undefined`\>
|
|
222
|
+
|
|
223
|
+
### interfaces
|
|
224
|
+
|
|
225
|
+
### <a id="SchemaNameToValidatorMap"></a>SchemaNameToValidatorMap
|
|
226
|
+
|
|
227
|
+
[**@xyo-network/schema-cache**](#../README)
|
|
228
|
+
|
|
229
|
+
***
|
|
230
|
+
|
|
231
|
+
Used to map known schemas (byt their string name) to the validators which assert their types
|
|
232
|
+
|
|
233
|
+
## Indexable
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
[key: string]: ((x) => x is Payload) | undefined
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### type-aliases
|
|
240
|
+
|
|
241
|
+
### <a id="NarrowPayload"></a>NarrowPayload
|
|
242
|
+
|
|
243
|
+
[**@xyo-network/schema-cache**](#../README)
|
|
244
|
+
|
|
245
|
+
***
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
type NarrowPayload<T> = ((x) => x is T) | undefined;
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Used in conjunction with schema validation to support compile time type assertion
|
|
252
|
+
for known schema types.
|
|
253
|
+
|
|
254
|
+
## Type Parameters
|
|
255
|
+
|
|
256
|
+
### T
|
|
257
|
+
|
|
258
|
+
`T` *extends* `Payload` = `Payload`
|
|
259
|
+
|
|
260
|
+
### <a id="SchemaCacheEntry"></a>SchemaCacheEntry
|
|
261
|
+
|
|
262
|
+
[**@xyo-network/schema-cache**](#../README)
|
|
263
|
+
|
|
264
|
+
***
|
|
18
265
|
|
|
19
|
-
|
|
266
|
+
```ts
|
|
267
|
+
type SchemaCacheEntry = FetchedPayload<SchemaPayload>;
|
|
268
|
+
```
|
|
20
269
|
|
|
21
|
-
[Made with 🔥 and ❄️ by XYO](https://xyo.network)
|
|
22
270
|
|
|
23
|
-
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
271
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
272
|
+
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/schema-cache.svg
|
|
273
|
+
[npm-link]: https://www.npmjs.com/package/@xyo-network/schema-cache
|
|
274
|
+
[license-badge]: https://img.shields.io/npm/l/@xyo-network/schema-cache.svg
|
|
275
|
+
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/schema-cache",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.26",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/neutral/index.d.ts",
|
|
25
|
+
"import": "./dist/neutral/index.mjs",
|
|
25
26
|
"default": "./dist/neutral/index.mjs"
|
|
26
27
|
},
|
|
27
28
|
"./package.json": "./package.json"
|
|
28
29
|
},
|
|
29
|
-
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xyo-network/payload-
|
|
40
|
-
"@xyo-network/
|
|
41
|
-
"@xyo-network/
|
|
42
|
-
"@xyo-network/
|
|
39
|
+
"@xyo-network/domain-payload-plugin": "~5.3.26",
|
|
40
|
+
"@xyo-network/huri": "~5.3.26",
|
|
41
|
+
"@xyo-network/payload-model": "~5.3.26",
|
|
42
|
+
"@xyo-network/schema-payload-plugin": "~5.3.26"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@opentelemetry/api": "^1.9.1",
|
|
46
|
-
"@types/node": "^25.5.
|
|
47
|
-
"@xylabs/sdk-js": "^5.0.
|
|
48
|
-
"@xylabs/ts-scripts-common": "~7.
|
|
49
|
-
"@xylabs/ts-scripts-pnpm": "~7.
|
|
50
|
-
"@xylabs/tsconfig": "^7.
|
|
51
|
-
"@xylabs/tsconfig-dom": "~7.
|
|
52
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
46
|
+
"@types/node": "^25.5.2",
|
|
47
|
+
"@xylabs/sdk-js": "^5.0.94",
|
|
48
|
+
"@xylabs/ts-scripts-common": "~7.7.5",
|
|
49
|
+
"@xylabs/ts-scripts-pnpm": "~7.7.5",
|
|
50
|
+
"@xylabs/tsconfig": "^7.7.5",
|
|
51
|
+
"@xylabs/tsconfig-dom": "~7.7.5",
|
|
52
|
+
"@xylabs/vitest-extended": "~5.0.94",
|
|
53
53
|
"acorn": "^8.16.0",
|
|
54
54
|
"ajv": "^8.18.0",
|
|
55
55
|
"axios": "^1.14.0",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"vite": "^8.0.3",
|
|
62
62
|
"vitest": "~4.1.2",
|
|
63
63
|
"zod": "^4.3.6",
|
|
64
|
-
"@xyo-network/
|
|
65
|
-
"@xyo-network/
|
|
66
|
-
"@xyo-network/
|
|
67
|
-
"@xyo-network/
|
|
68
|
-
"@xyo-network/payload-
|
|
69
|
-
"@xyo-network/payload-
|
|
64
|
+
"@xyo-network/huri": "~5.3.26",
|
|
65
|
+
"@xyo-network/network": "~5.3.26",
|
|
66
|
+
"@xyo-network/payload-builder": "~5.3.26",
|
|
67
|
+
"@xyo-network/payload-model": "~5.3.26",
|
|
68
|
+
"@xyo-network/schema-payload-plugin": "~5.3.26",
|
|
69
|
+
"@xyo-network/domain-payload-plugin": "~5.3.26"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@xylabs/sdk-js": "^5",
|