@xyo-network/diviner-jsonpath-model 4.0.2 → 4.1.0

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.
@@ -0,0 +1,84 @@
1
+ import { DivinerConfig, DivinerParams } from '@xyo-network/diviner-model';
2
+ import { JsonValue } from '@xylabs/object';
3
+ import { Payload } from '@xyo-network/payload-model';
4
+ import { AnyConfigSchema } from '@xyo-network/module-model';
5
+
6
+ /**
7
+ * Describes the JSON-path transformation to retrieve a field on a source object
8
+ * and the target field to store the value to on a destination object
9
+ */
10
+ interface JsonPathTransformExpression {
11
+ /**
12
+ * The default value to use if the source field does not exist
13
+ */
14
+ defaultValue?: JsonValue;
15
+ /**
16
+ * The target field to store the source field into on the destination object
17
+ */
18
+ destinationField: string;
19
+ /**
20
+ * The JSON path expressions for the source field on the source object
21
+ */
22
+ sourcePathExpression: string;
23
+ }
24
+
25
+ type PayloadTransformer = (x: Payload) => Partial<Payload>;
26
+
27
+ /**
28
+ * A dictionary of schema to JSON Path transform expressions.
29
+ */
30
+ type SchemaToJsonPathTransformExpressionsDictionary<T extends {
31
+ [schema: string]: unknown;
32
+ } = {
33
+ [schema: string]: unknown;
34
+ }> = {
35
+ [key in keyof T]: JsonPathTransformExpression[];
36
+ };
37
+
38
+ /**
39
+ * A dictionary of schema to payload transformers
40
+ */
41
+ type SchemaToPayloadTransformersDictionary = {
42
+ [schema: string]: PayloadTransformer[];
43
+ };
44
+
45
+ /**
46
+ * The schema type used for the JSONPath Diviner.
47
+ */
48
+ type JsonPathDivinerSchema = 'network.xyo.diviner.jsonpath';
49
+ /**
50
+ * The schema used for the JSONPath Diviner.
51
+ */
52
+ declare const JsonPathDivinerSchema: JsonPathDivinerSchema;
53
+
54
+ /**
55
+ * The config schema type for the JSON Path diviner
56
+ */
57
+ type JsonPathDivinerConfigSchema = `${JsonPathDivinerSchema}.config`;
58
+ /**
59
+ * The config schema for the JSON Path diviner
60
+ */
61
+ declare const JsonPathDivinerConfigSchema: JsonPathDivinerConfigSchema;
62
+ /**
63
+ * The configuration for the JSON Path diviner
64
+ */
65
+ type JsonPathDivinerConfig = DivinerConfig<{
66
+ /**
67
+ * The schema to use for the destination payloads
68
+ */
69
+ destinationSchema?: string;
70
+ /**
71
+ * The JSON Path transform expressions to apply to the payloads
72
+ */
73
+ transforms?: JsonPathTransformExpression[];
74
+ } & {
75
+ schema: JsonPathDivinerConfigSchema;
76
+ }>;
77
+
78
+ /**
79
+ * The params type the JSON Path diviner
80
+ **/
81
+ type JsonPathDivinerParams = DivinerParams<AnyConfigSchema<JsonPathDivinerConfig>>;
82
+
83
+ export { JsonPathDivinerConfigSchema, JsonPathDivinerSchema };
84
+ export type { JsonPathDivinerConfig, JsonPathDivinerParams, JsonPathTransformExpression, PayloadTransformer, SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/diviner-jsonpath-model",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -21,22 +21,22 @@
21
21
  "type": "module",
22
22
  "exports": {
23
23
  ".": {
24
- "types": "./dist/types/index.d.ts",
24
+ "types": "./dist/neutral/index.d.ts",
25
25
  "default": "./dist/neutral/index.mjs"
26
26
  },
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "module": "dist/neutral/index.mjs",
30
- "types": "dist/types/index.d.ts",
30
+ "types": "dist/neutral/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/object": "^4.12.33",
33
- "@xyo-network/diviner-model": "^4.0.2",
34
- "@xyo-network/module-model": "^4.0.2",
35
- "@xyo-network/payload-model": "^4.0.2"
32
+ "@xylabs/object": "^4.13.15",
33
+ "@xyo-network/diviner-model": "^4.1.0",
34
+ "@xyo-network/module-model": "^4.1.0",
35
+ "@xyo-network/payload-model": "^4.1.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@xylabs/ts-scripts-yarn3": "^6.5.12",
39
- "@xylabs/tsconfig": "^6.5.12",
38
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
39
+ "@xylabs/tsconfig": "^7.0.0-rc.20",
40
40
  "typescript": "^5.8.3"
41
41
  },
42
42
  "publishConfig": {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes