@xyo-network/diviner-jsonpatch-memory 3.0.6 → 3.0.8
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/neutral/Diviner.d.ts +12 -0
- package/dist/neutral/Diviner.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +2 -14
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs +1 -1
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +33 -33
- package/src/Diviner.ts +4 -2
- package/xy.config.ts +1 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AbstractDiviner } from '@xyo-network/diviner-abstract';
|
|
2
|
+
import type { JsonPatchDivinerParams } from '@xyo-network/diviner-jsonpatch-model';
|
|
3
|
+
import type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model';
|
|
4
|
+
import type { Payload, Schema } from '@xyo-network/payload-model';
|
|
5
|
+
import type { Operation } from 'json-joy-16-19-0/lib/json-patch';
|
|
6
|
+
export declare class JsonPatchDiviner<TParams extends JsonPatchDivinerParams = JsonPatchDivinerParams, TIn extends Payload = Payload, TOut extends Payload = Payload, TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut>> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {
|
|
7
|
+
static readonly configSchemas: Schema[];
|
|
8
|
+
static readonly defaultConfigSchema: Schema;
|
|
9
|
+
protected get operations(): readonly Operation[];
|
|
10
|
+
protected divineHandler(payloads?: TIn[]): Promise<TOut[]>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Diviner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../src/Diviner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACzF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAIhE,qBAAa,gBAAgB,CAC3B,OAAO,SAAS,sBAAsB,GAAG,sBAAsB,EAC/D,GAAG,SAAS,OAAO,GAAG,OAAO,EAC7B,IAAI,SAAS,OAAO,GAAG,OAAO,EAC9B,UAAU,SAAS,sBAAsB,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,sBAAsB,CAChH,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EACnC,GAAG,EACH,IAAI,CACL,CACD,SAAQ,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC;IACvD,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAAyD;IACzG,gBAAyB,mBAAmB,EAAE,MAAM,CAA+B;IAEnF,SAAS,KAAK,UAAU,IAAI,SAAS,SAAS,EAAE,CAE/C;cAEwB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAa1E"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DivinerModuleEventData, DivinerInstance } from '@xyo-network/diviner-model';
|
|
4
|
-
import { Payload, Schema } from '@xyo-network/payload-model';
|
|
5
|
-
import { Operation } from 'json-joy/lib/json-patch/index.js';
|
|
6
|
-
|
|
7
|
-
declare class JsonPatchDiviner<TParams extends JsonPatchDivinerParams = JsonPatchDivinerParams, TIn extends Payload = Payload, TOut extends Payload = Payload, TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut>> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {
|
|
8
|
-
static readonly configSchemas: Schema[];
|
|
9
|
-
static readonly defaultConfigSchema: Schema;
|
|
10
|
-
protected get operations(): readonly Operation[];
|
|
11
|
-
protected divineHandler(payloads?: TIn[]): Promise<TOut[]>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { JsonPatchDiviner };
|
|
1
|
+
export * from './Diviner.ts';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { assertEx } from "@xylabs/assert";
|
|
|
6
6
|
import { exists } from "@xylabs/exists";
|
|
7
7
|
import { AbstractDiviner } from "@xyo-network/diviner-abstract";
|
|
8
8
|
import { JsonPatchDivinerConfigSchema } from "@xyo-network/diviner-jsonpatch-model";
|
|
9
|
-
import { applyPatch } from "json-joy/lib/json-patch
|
|
9
|
+
import { applyPatch } from "json-joy-16-19-0/lib/json-patch";
|
|
10
10
|
var JsonPatchDiviner = class extends AbstractDiviner {
|
|
11
11
|
static {
|
|
12
12
|
__name(this, "JsonPatchDiviner");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Diviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { JsonPatchDivinerParams } from '@xyo-network/diviner-jsonpatch-model'\nimport { JsonPatchDivinerConfigSchema } from '@xyo-network/diviner-jsonpatch-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\nimport type { Operation } from 'json-joy/lib/json-patch
|
|
1
|
+
{"version":3,"sources":["../../src/Diviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { exists } from '@xylabs/exists'\nimport { AbstractDiviner } from '@xyo-network/diviner-abstract'\nimport type { JsonPatchDivinerParams } from '@xyo-network/diviner-jsonpatch-model'\nimport { JsonPatchDivinerConfigSchema } from '@xyo-network/diviner-jsonpatch-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\n// eslint-disable-next-line import-x/no-internal-modules\nimport type { Operation } from 'json-joy-16-19-0/lib/json-patch'\n// eslint-disable-next-line import-x/no-internal-modules\nimport { applyPatch } from 'json-joy-16-19-0/lib/json-patch'\n\nexport class JsonPatchDiviner<\n TParams extends JsonPatchDivinerParams = JsonPatchDivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, JsonPatchDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = JsonPatchDivinerConfigSchema\n\n protected get operations(): readonly Operation[] {\n return assertEx(this.config?.operations, () => 'JsonPatchDiviner: invalid operations')\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const results = payloads\n ?.map((payload) => {\n try {\n const result = applyPatch(payload, this.operations, { mutate: false })\n return result.res?.[0]?.doc as TOut\n } catch {\n return\n }\n })\n .filter(exists)\n return await Promise.resolve(results ?? [])\n }\n}\n"],"mappings":";;;;AAAA,SAASA,gBAAgB;AACzB,SAASC,cAAc;AACvB,SAASC,uBAAuB;AAEhC,SAASC,oCAAoC;AAM7C,SAASC,kBAAkB;AAEpB,IAAMC,mBAAN,cASGC,gBAAAA;EArBV,OAqBUA;;;EACR,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAEvD,IAAcE,aAAmC;AAC/C,WAAOC,SAAS,KAAKC,QAAQF,YAAY,MAAM,sCAAA;EACjD;EAEA,MAAyBG,cAAcC,UAAmC;AACxE,UAAMC,UAAUD,UACZE,IAAI,CAACC,YAAAA;AACL,UAAI;AACF,cAAMC,SAASC,WAAWF,SAAS,KAAKP,YAAY;UAAEU,QAAQ;QAAM,CAAA;AACpE,eAAOF,OAAOG,MAAM,CAAA,GAAIC;MAC1B,QAAQ;AACN;MACF;IACF,CAAA,EACCC,OAAOC,MAAAA;AACV,WAAO,MAAMC,QAAQC,QAAQX,WAAW,CAAA,CAAE;EAC5C;AACF;","names":["assertEx","exists","AbstractDiviner","JsonPatchDivinerConfigSchema","applyPatch","JsonPatchDiviner","AbstractDiviner","configSchemas","JsonPatchDivinerConfigSchema","defaultConfigSchema","operations","assertEx","config","divineHandler","payloads","results","map","payload","result","applyPatch","mutate","res","doc","filter","exists","Promise","resolve"]}
|
package/package.json
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-jsonpatch-memory",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"url": "https://xyo.network"
|
|
7
|
-
},
|
|
3
|
+
"version": "3.0.8",
|
|
4
|
+
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
|
+
"homepage": "https://xyo.network",
|
|
8
6
|
"bugs": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
7
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues",
|
|
8
|
+
"email": "support@xyo.network"
|
|
11
9
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"@xyo-network/diviner-abstract": "^3.0.6",
|
|
16
|
-
"@xyo-network/diviner-jsonpatch-model": "^3.0.6",
|
|
17
|
-
"@xyo-network/diviner-model": "^3.0.6",
|
|
18
|
-
"@xyo-network/payload-model": "^3.0.6",
|
|
19
|
-
"json-joy": "~16.19.0",
|
|
20
|
-
"tslib": "^2.6.3"
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
21
13
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
14
|
+
"license": "LGPL-3.0-only",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "XYO Development Team",
|
|
17
|
+
"email": "support@xyo.network",
|
|
18
|
+
"url": "https://xyo.network"
|
|
27
19
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
30
22
|
"exports": {
|
|
31
23
|
".": {
|
|
32
24
|
"types": "./dist/neutral/index.d.ts",
|
|
@@ -35,16 +27,24 @@
|
|
|
35
27
|
"./package.json": "./package.json"
|
|
36
28
|
},
|
|
37
29
|
"module": "dist/neutral/index.mjs",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"
|
|
30
|
+
"types": "dist/neutral/index.d.ts",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@xylabs/assert": "^4.0.3",
|
|
33
|
+
"@xylabs/exists": "^4.0.3",
|
|
34
|
+
"@xyo-network/diviner-abstract": "^3.0.8",
|
|
35
|
+
"@xyo-network/diviner-jsonpatch-model": "^3.0.8",
|
|
36
|
+
"@xyo-network/diviner-model": "^3.0.8",
|
|
37
|
+
"@xyo-network/payload-model": "^3.0.8",
|
|
38
|
+
"json-joy-16-19-0": "npm:json-joy@16.19.0",
|
|
39
|
+
"tslib": "^2.7.0"
|
|
42
40
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.7",
|
|
43
|
+
"@xylabs/tsconfig": "^4.0.7",
|
|
44
|
+
"@xyo-network/account": "^3.0.8",
|
|
45
|
+
"typescript": "^5.5.4"
|
|
46
46
|
},
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
50
|
}
|
package/src/Diviner.ts
CHANGED
|
@@ -5,8 +5,10 @@ import type { JsonPatchDivinerParams } from '@xyo-network/diviner-jsonpatch-mode
|
|
|
5
5
|
import { JsonPatchDivinerConfigSchema } from '@xyo-network/diviner-jsonpatch-model'
|
|
6
6
|
import type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/diviner-model'
|
|
7
7
|
import type { Payload, Schema } from '@xyo-network/payload-model'
|
|
8
|
-
|
|
9
|
-
import {
|
|
8
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
9
|
+
import type { Operation } from 'json-joy-16-19-0/lib/json-patch'
|
|
10
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
11
|
+
import { applyPatch } from 'json-joy-16-19-0/lib/json-patch'
|
|
10
12
|
|
|
11
13
|
export class JsonPatchDiviner<
|
|
12
14
|
TParams extends JsonPatchDivinerParams = JsonPatchDivinerParams,
|