@xyo-network/schema-cache 5.2.18 → 5.2.20

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Debounce.d.ts","sourceRoot":"","sources":["../../src/Debounce.ts"],"names":[],"mappings":"AAGA,qBAAa,QAAQ,CAAC,IAAI,GAAG,MAAM;IACjC,OAAO,CAAC,GAAG,CAA0B;IAE/B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,SAAS;CAepE"}
1
+ {"version":3,"file":"Debounce.d.ts","sourceRoot":"","sources":["../../src/Debounce.ts"],"names":[],"mappings":"AAEA,qBAAa,QAAQ,CAAC,IAAI,GAAG,MAAM;IACjC,OAAO,CAAC,GAAG,CAA0B;IAE/B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,SAAS;CAepE"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaCache.d.ts","sourceRoot":"","sources":["../../src/SchemaCache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAQvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAQ7E,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAA;AAE5D,qBAAa,WAAW,CAAC,CAAC,SAAS,wBAAwB,GAAG,wBAAwB;IACpF;;;OAGG;IACH,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAwD;IAExG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAa;IAEtC,cAAc,CAAC,EAAE,CAAC,IA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,0CAKlB;IAED;;;;OAIG;IACH,IAAI,UAAU,IAAI,CAAC,CAElB;IAEK,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,GAAG,IAAI,CAAC;IAcxE,OAAO,CAAC,kBAAkB;IAgB1B,OAAO,CAAC,YAAY;YAMN,WAAW;CAqB1B"}
@@ -1,6 +1,5 @@
1
1
  // src/Debounce.ts
2
- import { delay } from "@xylabs/delay";
3
- import { isDefined } from "@xylabs/typeof";
2
+ import { delay, isDefined } from "@xylabs/sdk-js";
4
3
  var Debounce = class {
5
4
  map = /* @__PURE__ */ new Map();
6
5
  async one(key, closure, timeout = 1e4) {
@@ -21,8 +20,11 @@ var Debounce = class {
21
20
  };
22
21
 
23
22
  // src/SchemaCache.ts
24
- import { handleError } from "@xylabs/error";
25
- import { isDefined as isDefined2, isString } from "@xylabs/typeof";
23
+ import {
24
+ handleError,
25
+ isDefined as isDefined2,
26
+ isString
27
+ } from "@xylabs/sdk-js";
26
28
  import { DomainPayloadWrapper } from "@xyo-network/domain-payload-plugin";
27
29
  import { SchemaSchema } from "@xyo-network/schema-payload-plugin";
28
30
  import { Ajv } from "ajv";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Debounce.ts","../../src/SchemaCache.ts"],"sourcesContent":["import { delay } from '@xylabs/delay'\nimport { isDefined } from '@xylabs/typeof'\n\nexport class Debounce<TKey = string> {\n private map = new Map<TKey, number>()\n\n async one<T>(key: TKey, closure: () => Promise<T>, timeout = 10_000) {\n const startTime = Date.now()\n while (isDefined(this.map.get(key))) {\n await delay(100)\n if (Date.now() - startTime > timeout) {\n throw new Error(`Debounce timed out [${key}]`)\n }\n }\n try {\n this.map.set(key, 1)\n return await closure()\n } finally {\n this.map.set(key, 0)\n }\n }\n}\n","import { handleError } from '@xylabs/error'\nimport { isDefined, isString } from '@xylabs/typeof'\nimport { DomainPayloadWrapper } from '@xyo-network/domain-payload-plugin'\nimport type { FetchedPayload } from '@xyo-network/huri'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { SchemaSchema } from '@xyo-network/schema-payload-plugin'\nimport type { SchemaObject } from 'ajv'\nimport { Ajv } from 'ajv'\nimport { isAxiosError } from 'axios'\nimport { LRUCache } from 'lru-cache'\n\nimport { Debounce } from './Debounce.ts'\nimport type { SchemaNameToValidatorMap } from './SchemaNameToValidatorMap.ts'\n\nconst getSchemaNameFromSchema = (schema: SchemaObject) => {\n if (isString(schema.$id)) {\n return schema.$id\n }\n}\n\nexport type SchemaCacheEntry = FetchedPayload<SchemaPayload>\n\nexport class SchemaCache<T extends SchemaNameToValidatorMap = SchemaNameToValidatorMap> {\n /**\n * Object representing `null` since LRU Cache types\n * only allow for types that derive from object\n */\n protected static readonly NULL: SchemaCacheEntry = { payload: { definition: {}, schema: SchemaSchema } }\n\n private static _instance?: SchemaCache\n\n onSchemaCached?: (name: string, entry: SchemaCacheEntry) => void\n proxy?: string\n\n private _cache = new LRUCache<string, SchemaCacheEntry>({ max: 500, ttl: 1000 * 60 * 5 })\n private _validators: T = {} as T\n\n // prevents double discovery\n private getDebounce = new Debounce()\n\n private constructor(proxy?: string) {\n this.proxy = proxy\n }\n\n static get instance() {\n if (!this._instance) {\n this._instance = new SchemaCache()\n }\n return this._instance\n }\n\n /**\n * A map of cached schema (by name) to payload validators for the schema. A schema\n * must be cached via `get('schema.name')` before it's validator can be used as\n * they are compiled dynamically at runtime upon retrieval.\n */\n get validators(): T {\n return this._validators\n }\n\n async get(schema?: string): Promise<SchemaCacheEntry | undefined | null> {\n if (isString(schema)) {\n await this.getDebounce.one(schema, async () => {\n // If we've never looked for it before, it will be undefined\n if (this._cache.get(schema) === undefined) {\n await this.fetchSchema(schema)\n }\n })\n const value = this._cache.get(schema)\n return value === SchemaCache.NULL ? null : value\n }\n return undefined\n }\n\n private cacheSchemaIfValid(entry: SchemaCacheEntry) {\n // only store them if they match the schema root\n if (isDefined(entry?.payload?.definition)) {\n const ajv = new Ajv({ strict: false })\n // check if it is a valid schema def\n const validator = ajv.compile(entry.payload.definition)\n const schemaName = getSchemaNameFromSchema(entry.payload.definition)\n if (isString(schemaName)) {\n this._cache.set(schemaName, entry)\n const key = schemaName as keyof T\n this._validators[key] = validator as unknown as T[keyof T]\n this.onSchemaCached?.(schemaName, entry)\n }\n }\n }\n\n private cacheSchemas(aliasEntries?: FetchedPayload[] | null) {\n for (const entry of aliasEntries?.filter(entry => entry.payload.schema === SchemaSchema) ?? []) {\n this.cacheSchemaIfValid(entry as SchemaCacheEntry)\n }\n }\n\n private async fetchSchema(schema: string) {\n try {\n const domain = await DomainPayloadWrapper.discover(schema, this.proxy)\n await domain?.fetch()\n this.cacheSchemas(domain?.aliases)\n\n // if it is still undefined, mark it as null (not found)\n if (this._cache.get(schema) === undefined) {\n this._cache.set(schema, SchemaCache.NULL)\n }\n } catch (error) {\n // if failed, set it to NULL, TODO: Make an entry for an error to try again in the future?\n this._cache.set(schema, SchemaCache.NULL)\n if (isAxiosError(error)) {\n console.log(`Axios Url: ${error.response?.config.url}`)\n }\n handleError(error, (error) => {\n console.error(`fetchSchema threw: ${error.message}`)\n })\n }\n }\n}\n"],"mappings":";AAAA,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAEnB,IAAM,WAAN,MAA8B;AAAA,EAC3B,MAAM,oBAAI,IAAkB;AAAA,EAEpC,MAAM,IAAO,KAAW,SAA2B,UAAU,KAAQ;AACnE,UAAM,YAAY,KAAK,IAAI;AAC3B,WAAO,UAAU,KAAK,IAAI,IAAI,GAAG,CAAC,GAAG;AACnC,YAAM,MAAM,GAAG;AACf,UAAI,KAAK,IAAI,IAAI,YAAY,SAAS;AACpC,cAAM,IAAI,MAAM,uBAAuB,GAAG,GAAG;AAAA,MAC/C;AAAA,IACF;AACA,QAAI;AACF,WAAK,IAAI,IAAI,KAAK,CAAC;AACnB,aAAO,MAAM,QAAQ;AAAA,IACvB,UAAE;AACA,WAAK,IAAI,IAAI,KAAK,CAAC;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B,OAAyB;AAElD,QAAIC,WAAU,OAAO,SAAS,UAAU,GAAG;AACzC,YAAM,MAAM,IAAI,IAAI,EAAE,QAAQ,MAAM,CAAC;AAErC,YAAM,YAAY,IAAI,QAAQ,MAAM,QAAQ,UAAU;AACtD,YAAM,aAAa,wBAAwB,MAAM,QAAQ,UAAU;AACnE,UAAI,SAAS,UAAU,GAAG;AACxB,aAAK,OAAO,IAAI,YAAY,KAAK;AACjC,cAAM,MAAM;AACZ,aAAK,YAAY,GAAG,IAAI;AACxB,aAAK,iBAAiB,YAAY,KAAK;AAAA,MACzC;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,aAAa,cAAwC;AAC3D,eAAW,SAAS,cAAc,OAAO,CAAAC,WAASA,OAAM,QAAQ,WAAW,YAAY,KAAK,CAAC,GAAG;AAC9F,WAAK,mBAAmB,KAAyB;AAAA,IACnD;AAAA,EACF;AAAA,EAEA,MAAc,YAAY,QAAgB;AACxC,QAAI;AACF,YAAM,SAAS,MAAM,qBAAqB,SAAS,QAAQ,KAAK,KAAK;AACrE,YAAM,QAAQ,MAAM;AACpB,WAAK,aAAa,QAAQ,OAAO;AAGjC,UAAI,KAAK,OAAO,IAAI,MAAM,MAAM,QAAW;AACzC,aAAK,OAAO,IAAI,QAAQ,aAAY,IAAI;AAAA,MAC1C;AAAA,IACF,SAAS,OAAO;AAEd,WAAK,OAAO,IAAI,QAAQ,aAAY,IAAI;AACxC,UAAI,aAAa,KAAK,GAAG;AACvB,gBAAQ,IAAI,cAAc,MAAM,UAAU,OAAO,GAAG,EAAE;AAAA,MACxD;AACA,kBAAY,OAAO,CAACC,WAAU;AAC5B,gBAAQ,MAAM,sBAAsBA,OAAM,OAAO,EAAE;AAAA,MACrD,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["isDefined","isDefined","entry","error"]}
1
+ {"version":3,"sources":["../../src/Debounce.ts","../../src/SchemaCache.ts"],"sourcesContent":["import { delay, isDefined } from '@xylabs/sdk-js'\n\nexport class Debounce<TKey = string> {\n private map = new Map<TKey, number>()\n\n async one<T>(key: TKey, closure: () => Promise<T>, timeout = 10_000) {\n const startTime = Date.now()\n while (isDefined(this.map.get(key))) {\n await delay(100)\n if (Date.now() - startTime > timeout) {\n throw new Error(`Debounce timed out [${key}]`)\n }\n }\n try {\n this.map.set(key, 1)\n return await closure()\n } finally {\n this.map.set(key, 0)\n }\n }\n}\n","import {\n handleError, isDefined, isString,\n} from '@xylabs/sdk-js'\nimport { DomainPayloadWrapper } from '@xyo-network/domain-payload-plugin'\nimport type { FetchedPayload } from '@xyo-network/huri'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { SchemaSchema } from '@xyo-network/schema-payload-plugin'\nimport type { SchemaObject } from 'ajv'\nimport { Ajv } from 'ajv'\nimport { isAxiosError } from 'axios'\nimport { LRUCache } from 'lru-cache'\n\nimport { Debounce } from './Debounce.ts'\nimport type { SchemaNameToValidatorMap } from './SchemaNameToValidatorMap.ts'\n\nconst getSchemaNameFromSchema = (schema: SchemaObject) => {\n if (isString(schema.$id)) {\n return schema.$id\n }\n}\n\nexport type SchemaCacheEntry = FetchedPayload<SchemaPayload>\n\nexport class SchemaCache<T extends SchemaNameToValidatorMap = SchemaNameToValidatorMap> {\n /**\n * Object representing `null` since LRU Cache types\n * only allow for types that derive from object\n */\n protected static readonly NULL: SchemaCacheEntry = { payload: { definition: {}, schema: SchemaSchema } }\n\n private static _instance?: SchemaCache\n\n onSchemaCached?: (name: string, entry: SchemaCacheEntry) => void\n proxy?: string\n\n private _cache = new LRUCache<string, SchemaCacheEntry>({ max: 500, ttl: 1000 * 60 * 5 })\n private _validators: T = {} as T\n\n // prevents double discovery\n private getDebounce = new Debounce()\n\n private constructor(proxy?: string) {\n this.proxy = proxy\n }\n\n static get instance() {\n if (!this._instance) {\n this._instance = new SchemaCache()\n }\n return this._instance\n }\n\n /**\n * A map of cached schema (by name) to payload validators for the schema. A schema\n * must be cached via `get('schema.name')` before it's validator can be used as\n * they are compiled dynamically at runtime upon retrieval.\n */\n get validators(): T {\n return this._validators\n }\n\n async get(schema?: string): Promise<SchemaCacheEntry | undefined | null> {\n if (isString(schema)) {\n await this.getDebounce.one(schema, async () => {\n // If we've never looked for it before, it will be undefined\n if (this._cache.get(schema) === undefined) {\n await this.fetchSchema(schema)\n }\n })\n const value = this._cache.get(schema)\n return value === SchemaCache.NULL ? null : value\n }\n return undefined\n }\n\n private cacheSchemaIfValid(entry: SchemaCacheEntry) {\n // only store them if they match the schema root\n if (isDefined(entry?.payload?.definition)) {\n const ajv = new Ajv({ strict: false })\n // check if it is a valid schema def\n const validator = ajv.compile(entry.payload.definition)\n const schemaName = getSchemaNameFromSchema(entry.payload.definition)\n if (isString(schemaName)) {\n this._cache.set(schemaName, entry)\n const key = schemaName as keyof T\n this._validators[key] = validator as unknown as T[keyof T]\n this.onSchemaCached?.(schemaName, entry)\n }\n }\n }\n\n private cacheSchemas(aliasEntries?: FetchedPayload[] | null) {\n for (const entry of aliasEntries?.filter(entry => entry.payload.schema === SchemaSchema) ?? []) {\n this.cacheSchemaIfValid(entry as SchemaCacheEntry)\n }\n }\n\n private async fetchSchema(schema: string) {\n try {\n const domain = await DomainPayloadWrapper.discover(schema, this.proxy)\n await domain?.fetch()\n this.cacheSchemas(domain?.aliases)\n\n // if it is still undefined, mark it as null (not found)\n if (this._cache.get(schema) === undefined) {\n this._cache.set(schema, SchemaCache.NULL)\n }\n } catch (error) {\n // if failed, set it to NULL, TODO: Make an entry for an error to try again in the future?\n this._cache.set(schema, SchemaCache.NULL)\n if (isAxiosError(error)) {\n console.log(`Axios Url: ${error.response?.config.url}`)\n }\n handleError(error, (error) => {\n console.error(`fetchSchema threw: ${error.message}`)\n })\n }\n }\n}\n"],"mappings":";AAAA,SAAS,OAAO,iBAAiB;AAE1B,IAAM,WAAN,MAA8B;AAAA,EAC3B,MAAM,oBAAI,IAAkB;AAAA,EAEpC,MAAM,IAAO,KAAW,SAA2B,UAAU,KAAQ;AACnE,UAAM,Y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AAK,GAAG;AACvB,gBAAQ,IAAI,cAAc,MAAM,UAAU,OAAO,GAAG,EAAE;AAAA,MACxD;AACA,kBAAY,OAAO,CAACC,WAAU;AAC5B,gBAAQ,MAAM,sBAAsBA,OAAM,OAAO,EAAE;AAAA,MACrD,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["isDefined","isDefined","entry","error"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/schema-cache",
3
- "version": "5.2.18",
3
+ "version": "5.2.20",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -36,28 +36,25 @@
36
36
  "!**/*.test.*"
37
37
  ],
38
38
  "dependencies": {
39
- "@xylabs/delay": "~5.0.50",
40
- "@xylabs/error": "~5.0.50",
41
- "@xylabs/typeof": "~5.0.50",
42
- "@xyo-network/domain-payload-plugin": "~5.2.18",
43
- "@xyo-network/huri": "~5.2.18",
44
- "@xyo-network/payload-model": "~5.2.18",
45
- "@xyo-network/schema-payload-plugin": "~5.2.18",
39
+ "@xylabs/sdk-js": "~5.0.61",
40
+ "@xyo-network/domain-payload-plugin": "workspace:~",
41
+ "@xyo-network/huri": "workspace:~",
42
+ "@xyo-network/payload-model": "workspace:~",
43
+ "@xyo-network/schema-payload-plugin": "workspace:~",
46
44
  "ajv": "~8.17.1",
47
45
  "axios": "^1.13.2",
48
46
  "lru-cache": "^11.2.4"
49
47
  },
50
48
  "devDependencies": {
51
- "@xylabs/assert": "~5.0.50",
52
- "@xylabs/ts-scripts-yarn3": "~7.2.8",
53
- "@xylabs/tsconfig-dom": "~7.2.8",
54
- "@xylabs/vitest-extended": "~5.0.50",
55
- "@xyo-network/network": "~5.2.18",
56
- "@xyo-network/payload-builder": "~5.2.18",
49
+ "@xylabs/ts-scripts-yarn3": "~7.2.32",
50
+ "@xylabs/tsconfig-dom": "~7.2.32",
51
+ "@xylabs/vitest-extended": "~5.0.61",
52
+ "@xyo-network/network": "workspace:~",
53
+ "@xyo-network/payload-builder": "workspace:~",
57
54
  "typescript": "~5.9.3",
58
- "vitest": "~4.0.15"
55
+ "vitest": "~4.0.16"
59
56
  },
60
57
  "publishConfig": {
61
58
  "access": "public"
62
59
  }
63
- }
60
+ }
package/src/Debounce.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { delay } from '@xylabs/delay'
2
- import { isDefined } from '@xylabs/typeof'
1
+ import { delay, isDefined } from '@xylabs/sdk-js'
3
2
 
4
3
  export class Debounce<TKey = string> {
5
4
  private map = new Map<TKey, number>()
@@ -1,5 +1,6 @@
1
- import { handleError } from '@xylabs/error'
2
- import { isDefined, isString } from '@xylabs/typeof'
1
+ import {
2
+ handleError, isDefined, isString,
3
+ } from '@xylabs/sdk-js'
3
4
  import { DomainPayloadWrapper } from '@xyo-network/domain-payload-plugin'
4
5
  import type { FetchedPayload } from '@xyo-network/huri'
5
6
  import type { SchemaPayload } from '@xyo-network/schema-payload-plugin'