@xyo-network/diviner-jsonpath-aggregate 7.2.2 → 7.3.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.
- package/dist/neutral/index.d.ts +2 -2
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +143 -3
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/memory/Diviner.d.ts +41 -0
- package/dist/neutral/memory/Diviner.d.ts.map +1 -0
- package/dist/neutral/memory/index.d.ts +3 -0
- package/dist/neutral/memory/index.d.ts.map +1 -0
- package/dist/neutral/memory/jsonpath/index.d.ts +3 -0
- package/dist/neutral/memory/jsonpath/index.d.ts.map +1 -0
- package/dist/neutral/memory/jsonpath/jsonPathToTransformersDictionary.d.ts +10 -0
- package/dist/neutral/memory/jsonpath/jsonPathToTransformersDictionary.d.ts.map +1 -0
- package/dist/neutral/memory/jsonpath/reducePayloads.d.ts +20 -0
- package/dist/neutral/memory/jsonpath/reducePayloads.d.ts.map +1 -0
- package/dist/neutral/memory.d.ts +2 -0
- package/dist/neutral/memory.d.ts.map +1 -0
- package/dist/neutral/memory.mjs +138 -0
- package/dist/neutral/memory.mjs.map +7 -0
- package/dist/neutral/model/Config.d.ts +48 -0
- package/dist/neutral/model/Config.d.ts.map +1 -0
- package/dist/neutral/model/Params.d.ts +8 -0
- package/dist/neutral/model/Params.d.ts.map +1 -0
- package/dist/neutral/model/Schema.d.ts +11 -0
- package/dist/neutral/model/Schema.d.ts.map +1 -0
- package/dist/neutral/model/index.d.ts +5 -0
- package/dist/neutral/model/index.d.ts.map +1 -0
- package/dist/neutral/model/jsonpath/JsonPathTransformExpression.d.ts +20 -0
- package/dist/neutral/model/jsonpath/JsonPathTransformExpression.d.ts.map +1 -0
- package/dist/neutral/model/jsonpath/PayloadTransformer.d.ts +3 -0
- package/dist/neutral/model/jsonpath/PayloadTransformer.d.ts.map +1 -0
- package/dist/neutral/model/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.ts +8 -0
- package/dist/neutral/model/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.ts.map +1 -0
- package/dist/neutral/model/jsonpath/SchemaToPayloadTransformersDictionary.d.ts +6 -0
- package/dist/neutral/model/jsonpath/SchemaToPayloadTransformersDictionary.d.ts.map +1 -0
- package/dist/neutral/model/jsonpath/index.d.ts +5 -0
- package/dist/neutral/model/jsonpath/index.d.ts.map +1 -0
- package/dist/neutral/model.d.ts +2 -0
- package/dist/neutral/model.d.ts.map +1 -0
- package/dist/neutral/model.mjs +34 -0
- package/dist/neutral/model.mjs.map +7 -0
- package/package.json +24 -8
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from '
|
|
2
|
-
export * from '
|
|
1
|
+
export * from './memory.ts';
|
|
2
|
+
export * from './model.ts';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,4 +1,144 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// src/memory/Diviner.ts
|
|
2
|
+
import { assertEx } from "@ariestools/sdk";
|
|
3
|
+
import { AbstractDiviner } from "@xyo-network/sdk/diviner-abstract";
|
|
4
|
+
import {
|
|
5
|
+
BoundWitnessSchema,
|
|
6
|
+
combinationsByBoundwitness,
|
|
7
|
+
PayloadBuilder as PayloadBuilder2,
|
|
8
|
+
PayloadSchema
|
|
9
|
+
} from "@xyo-network/sdk-protocol";
|
|
10
|
+
import { combinationsBySchema } from "@xyo-network/sdk-protocol/payload-utils";
|
|
11
|
+
|
|
12
|
+
// src/model/Config.ts
|
|
13
|
+
import {
|
|
14
|
+
zodAsFactory,
|
|
15
|
+
zodIsFactory,
|
|
16
|
+
zodToFactory
|
|
17
|
+
} from "@ariestools/sdk";
|
|
18
|
+
import { DivinerConfigZod } from "@xyo-network/sdk/diviner-model";
|
|
19
|
+
import { asSchema as asSchema2 } from "@xyo-network/sdk-protocol";
|
|
20
|
+
import * as z from "zod/mini";
|
|
21
|
+
|
|
22
|
+
// src/model/Schema.ts
|
|
23
|
+
import { asSchema } from "@xyo-network/sdk-protocol";
|
|
24
|
+
var JsonPathAggregateDivinerSchema = asSchema("network.xyo.diviner.jsonpath.aggregate", true);
|
|
25
|
+
|
|
26
|
+
// src/model/Config.ts
|
|
27
|
+
var JsonPathAggregateDivinerConfigSchema = asSchema2(`${JsonPathAggregateDivinerSchema}.config`, true);
|
|
28
|
+
var JsonPathAggregateDivinerConfigZod = z.extend(DivinerConfigZod, {
|
|
29
|
+
destinationSchema: z.optional(z.custom()),
|
|
30
|
+
excludeSources: z.optional(z.boolean()),
|
|
31
|
+
schema: z.literal(JsonPathAggregateDivinerConfigSchema),
|
|
32
|
+
schemaTransforms: z.optional(z.custom())
|
|
33
|
+
});
|
|
34
|
+
var isJsonPathAggregateDivinerConfig = zodIsFactory(JsonPathAggregateDivinerConfigZod);
|
|
35
|
+
var asJsonPathAggregateDivinerConfig = zodAsFactory(JsonPathAggregateDivinerConfigZod, "asJsonPathAggregateDivinerConfig");
|
|
36
|
+
var toJsonPathAggregateDivinerConfig = zodToFactory(JsonPathAggregateDivinerConfigZod, "toJsonPathAggregateDivinerConfig");
|
|
37
|
+
|
|
38
|
+
// src/memory/jsonpath/jsonPathToTransformersDictionary.ts
|
|
39
|
+
import { toPayloadTransformer } from "@xyo-network/diviner-jsonpath/memory";
|
|
40
|
+
var jsonPathToTransformersDictionary = (schemaTransforms) => {
|
|
41
|
+
return Object.fromEntries(
|
|
42
|
+
Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {
|
|
43
|
+
const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer);
|
|
44
|
+
return [schema, transformers];
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/memory/jsonpath/reducePayloads.ts
|
|
50
|
+
import { exists } from "@ariestools/sdk";
|
|
51
|
+
import { PayloadBuilder } from "@xyo-network/sdk-protocol";
|
|
52
|
+
var reducePayloads = async (payloads, payloadTransformers, destinationSchema, excludeSources = false) => {
|
|
53
|
+
const payloadFields = payloads.filter(exists).flatMap((payload) => {
|
|
54
|
+
const transformers = payloadTransformers[payload.schema];
|
|
55
|
+
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
56
|
+
});
|
|
57
|
+
const baseObject = excludeSources ? {} : { sources: await PayloadBuilder.dataHashes(payloads) };
|
|
58
|
+
return new PayloadBuilder({ schema: destinationSchema }).fields(Object.assign(baseObject, ...payloadFields)).build();
|
|
59
|
+
};
|
|
60
|
+
var reducePayloadsArray = async (payloadsArray, payloadTransformers, destinationSchema, excludeSources = false) => {
|
|
61
|
+
return await Promise.all(
|
|
62
|
+
payloadsArray.map(async (payloads) => {
|
|
63
|
+
return await reducePayloads(payloads, payloadTransformers, destinationSchema, excludeSources);
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/memory/Diviner.ts
|
|
69
|
+
var moduleName = "JsonPathAggregateDiviner";
|
|
70
|
+
var JsonPathAggregateDiviner = class extends AbstractDiviner {
|
|
71
|
+
static configSchemas = [...super.configSchemas, JsonPathAggregateDivinerConfigSchema];
|
|
72
|
+
static defaultConfigSchema = JsonPathAggregateDivinerConfigSchema;
|
|
73
|
+
_transforms;
|
|
74
|
+
_payloadTransformers;
|
|
75
|
+
_transformableSchemas;
|
|
76
|
+
/**
|
|
77
|
+
* The schema to use for the destination payloads
|
|
78
|
+
*/
|
|
79
|
+
get destinationSchema() {
|
|
80
|
+
return this.config.destinationSchema ?? PayloadSchema;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Dictionary of schemas to payload transformers
|
|
84
|
+
*/
|
|
85
|
+
get payloadTransformers() {
|
|
86
|
+
this._payloadTransformers ??= jsonPathToTransformersDictionary(this.schemaTransforms);
|
|
87
|
+
return this._payloadTransformers;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The dictionary of schemas to JSON Path transform expressions
|
|
91
|
+
*/
|
|
92
|
+
get schemaTransforms() {
|
|
93
|
+
return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* List of transformable schemas for this diviner
|
|
97
|
+
*/
|
|
98
|
+
get transformableSchemas() {
|
|
99
|
+
this._transformableSchemas ??= Object.keys(this.schemaTransforms);
|
|
100
|
+
return this._transformableSchemas;
|
|
101
|
+
}
|
|
102
|
+
async divineHandler(payloads) {
|
|
103
|
+
if (!payloads) return [];
|
|
104
|
+
const strippedPayloads = payloads.map((payload) => {
|
|
105
|
+
const p = { ...payload };
|
|
106
|
+
return PayloadBuilder2.omitStorageMeta(p);
|
|
107
|
+
});
|
|
108
|
+
const combinations = this.transformableSchemas.includes(BoundWitnessSchema) ? await combinationsByBoundwitness(strippedPayloads) : await combinationsBySchema(strippedPayloads, this.transformableSchemas);
|
|
109
|
+
return await Promise.all(
|
|
110
|
+
combinations.map((combination) => {
|
|
111
|
+
return reducePayloads(combination, this.payloadTransformers, this.destinationSchema, this.config.excludeSources ?? false);
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Identifies if a payload is one that is transformed by this diviner
|
|
117
|
+
* @param x The candidate payload
|
|
118
|
+
* @returns True if the payload is one transformed by this diviner, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
isTransformablePayload = (x) => {
|
|
121
|
+
return this.transformableSchemas.includes(x?.schema);
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Identifies if a schema is one that is transformed by this diviner
|
|
125
|
+
* @param schema The candidate schema
|
|
126
|
+
* @returns True if this schema is one transformed by this diviner, false otherwise
|
|
127
|
+
*/
|
|
128
|
+
isTransformableSchema = (schema) => {
|
|
129
|
+
return typeof schema === "string" ? this.transformableSchemas.includes(schema) : false;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
JsonPathAggregateDiviner,
|
|
134
|
+
JsonPathAggregateDivinerConfigSchema,
|
|
135
|
+
JsonPathAggregateDivinerConfigZod,
|
|
136
|
+
JsonPathAggregateDivinerSchema,
|
|
137
|
+
asJsonPathAggregateDivinerConfig,
|
|
138
|
+
isJsonPathAggregateDivinerConfig,
|
|
139
|
+
jsonPathToTransformersDictionary,
|
|
140
|
+
reducePayloads,
|
|
141
|
+
reducePayloadsArray,
|
|
142
|
+
toJsonPathAggregateDivinerConfig
|
|
143
|
+
};
|
|
4
144
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["export * from '@xyo-network/diviner-jsonpath-aggregate-memory'\nexport * from '@xyo-network/diviner-jsonpath-aggregate-model'\n"],
|
|
5
|
-
"mappings": ";AAAA,cAAc;
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/memory/Diviner.ts", "../../src/model/Config.ts", "../../src/model/Schema.ts", "../../src/memory/jsonpath/jsonPathToTransformersDictionary.ts", "../../src/memory/jsonpath/reducePayloads.ts"],
|
|
4
|
+
"sourcesContent": ["import { assertEx } from '@ariestools/sdk'\nimport { AbstractDiviner } from '@xyo-network/sdk/diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/sdk/diviner-model'\nimport type { Payload, Schema } from '@xyo-network/sdk-protocol'\nimport {\n BoundWitnessSchema, combinationsByBoundwitness, PayloadBuilder, PayloadSchema,\n} from '@xyo-network/sdk-protocol'\nimport { combinationsBySchema } from '@xyo-network/sdk-protocol/payload-utils'\n\nimport type {\n JsonPathAggregateDivinerParams,\n PayloadTransformer,\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\n} from '../model/index.ts'\nimport { JsonPathAggregateDivinerConfigSchema } from '../model/index.ts'\nimport { jsonPathToTransformersDictionary, reducePayloads } from './jsonpath/index.ts'\n\nconst moduleName = 'JsonPathAggregateDiviner'\n\nexport class JsonPathAggregateDiviner<\n TParams extends JsonPathAggregateDivinerParams = JsonPathAggregateDivinerParams,\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, JsonPathAggregateDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = JsonPathAggregateDivinerConfigSchema\n\n protected _transforms: PayloadTransformer[] | undefined\n\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n private _transformableSchemas: string[] | undefined\n\n /**\n * The schema to use for the destination payloads\n */\n protected get destinationSchema(): Schema {\n return this.config.destinationSchema ?? PayloadSchema\n }\n\n /**\n * Dictionary of schemas to payload transformers\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n this._payloadTransformers ??= jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n /**\n * List of transformable schemas for this diviner\n */\n protected get transformableSchemas(): string[] {\n this._transformableSchemas ??= Object.keys(this.schemaTransforms)\n return this._transformableSchemas\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n if (!payloads) return []\n const strippedPayloads = payloads.map((payload) => {\n const p = { ...payload }\n return PayloadBuilder.omitStorageMeta(p)\n })\n const combinations\n = this.transformableSchemas.includes(BoundWitnessSchema)\n ? await combinationsByBoundwitness(strippedPayloads)\n : await combinationsBySchema(strippedPayloads, this.transformableSchemas)\n return await Promise.all(\n combinations.map((combination) => {\n return reducePayloads<TOut>(combination, this.payloadTransformers, this.destinationSchema, this.config.excludeSources ?? false)\n }),\n )\n }\n\n /**\n * Identifies if a payload is one that is transformed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one transformed by this diviner, false otherwise\n */\n protected isTransformablePayload = (x: Payload): boolean => {\n return this.transformableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is transformed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one transformed by this diviner, false otherwise\n */\n protected isTransformableSchema = (schema?: string | null): boolean => {\n return typeof schema === 'string' ? this.transformableSchemas.includes(schema) : false\n }\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { DivinerConfig } from '@xyo-network/sdk/diviner-model'\nimport { DivinerConfigZod } from '@xyo-network/sdk/diviner-model'\nimport type { Schema } from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { SchemaToJsonPathTransformExpressionsDictionary } from './jsonpath/index.ts'\nimport { JsonPathAggregateDivinerSchema } from './Schema.ts'\n\n/**\n * The config schema for the JSON Path diviner\n */\nexport const JsonPathAggregateDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${JsonPathAggregateDivinerSchema}.config`, true)\n\n/**\n * The config schema type for the JSON Path diviner\n */\nexport type JsonPathAggregateDivinerConfigSchema = typeof JsonPathAggregateDivinerConfigSchema\n\n/**\n * The Zod schema for the JSON Path aggregate diviner config\n */\nexport const JsonPathAggregateDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof DivinerConfigZod)['shape'], 'schema'> & {\n destinationSchema: z.ZodMiniOptional<z.ZodMiniCustom<Schema, Schema>>\n excludeSources: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n schema: z.ZodMiniLiteral<JsonPathAggregateDivinerConfigSchema>\n schemaTransforms: z.ZodMiniOptional<\n z.ZodMiniCustom<SchemaToJsonPathTransformExpressionsDictionary, SchemaToJsonPathTransformExpressionsDictionary>\n >\n },\n z.core.$strip\n> = z.extend(DivinerConfigZod, {\n destinationSchema: z.optional(z.custom<Schema>()),\n excludeSources: z.optional(z.boolean()),\n schema: z.literal(JsonPathAggregateDivinerConfigSchema),\n schemaTransforms: z.optional(z.custom<SchemaToJsonPathTransformExpressionsDictionary>()),\n})\n\n/**\n * The configuration for the JSON Path diviner\n */\nexport type JsonPathAggregateDivinerConfig = DivinerConfig<\n {\n /**\n * The schema to use for the destination payloads\n */\n destinationSchema?: Schema\n /**\n * Exclude the source hashes from the destination payload.\n */\n excludeSources?: boolean\n /**\n * The JSON Path transform expressions to apply to the payloads\n */\n schemaTransforms?: SchemaToJsonPathTransformExpressionsDictionary\n } & { schema: JsonPathAggregateDivinerConfigSchema }\n>\n\nexport const isJsonPathAggregateDivinerConfig: ReturnType<typeof zodIsFactory<JsonPathAggregateDivinerConfig>> = zodIsFactory(JsonPathAggregateDivinerConfigZod)\nexport const asJsonPathAggregateDivinerConfig: ReturnType<typeof zodAsFactory<JsonPathAggregateDivinerConfig>> = zodAsFactory(JsonPathAggregateDivinerConfigZod, 'asJsonPathAggregateDivinerConfig')\nexport const toJsonPathAggregateDivinerConfig: ReturnType<typeof zodToFactory<JsonPathAggregateDivinerConfig>> = zodToFactory(JsonPathAggregateDivinerConfigZod, 'toJsonPathAggregateDivinerConfig')\n", "import { asSchema } from '@xyo-network/sdk-protocol'\n\n/**\n * The schema used for the JSONPath Diviner.\n */\nexport const JsonPathAggregateDivinerSchema: 'network.xyo.diviner.jsonpath.aggregate' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.jsonpath.aggregate', true)\n\n/**\n * The schema type used for the JSONPath Diviner.\n */\nexport type JsonPathAggregateDivinerSchema = typeof JsonPathAggregateDivinerSchema\n", "import { toPayloadTransformer } from '@xyo-network/diviner-jsonpath/memory'\n\nimport type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '../../model/index.ts'\n\n/**\n * Materializes the JSON-path expressions into memoized functions by converting a\n * dictionary of schema to JSON Path transform expressions to a dictionary\n * of schema to payload transformers\n * @param schemaTransforms The schema transforms to convert\n * @returns A dictionary of schema to payload transformers\n */\nexport const jsonPathToTransformersDictionary = (\n schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary,\n): SchemaToPayloadTransformersDictionary => {\n return Object.fromEntries(\n Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {\n const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer)\n return [schema, transformers]\n }),\n )\n}\n", "import { exists } from '@ariestools/sdk'\nimport type {\n Payload, Schema, WithoutSchema,\n} from '@xyo-network/sdk-protocol'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\n\nimport type { SchemaToPayloadTransformersDictionary } from '../../model/index.ts'\n\n/**\n * Reduces the payloads to a single payload using the supplied transformers\n * @param payloads The payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payload\n * @param destinationSchema The schema of the destination payload\n * @param excludeSources Exclude the source hashes from the destination payload\n * @returns The reduced payload\n */\nexport const reducePayloads = async <T extends Payload = Payload>(\n payloads: Payload[],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: Schema,\n excludeSources = false,\n): Promise<T> => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const payloadFields = payloads.filter(exists).flatMap<WithoutSchema<Payload>[]>((payload) => {\n // Find the transformers for this payload\n const transformers = payloadTransformers[payload.schema]\n // If transformers exist, apply them to the payload otherwise return an empty array\n return transformers ? transformers.map(transform => transform(payload)) : []\n })\n // Include all the sources for reference\n const baseObject = excludeSources ? {} : { sources: await PayloadBuilder.dataHashes(payloads) }\n // Build and return the payload\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return new PayloadBuilder<T>({ schema: destinationSchema }).fields(Object.assign(baseObject, ...payloadFields)).build()\n}\n\n/**\n * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers\n * @param payloadsArray The arrays of payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads\n * @param excludeSources Exclude the source hashes from the destination payload\n * @returns The reduced payloads\n */\nexport const reducePayloadsArray = async <T extends Payload = Payload>(\n payloadsArray: Payload[][],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: Schema,\n excludeSources = false,\n): Promise<T[]> => {\n return await Promise.all(\n payloadsArray.map(async (payloads) => {\n return await reducePayloads<T>(payloads, payloadTransformers, destinationSchema, excludeSources)\n }),\n )\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["PayloadBuilder", "asSchema", "asSchema", "PayloadBuilder"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AbstractDiviner } from '@xyo-network/sdk/diviner-abstract';
|
|
2
|
+
import type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/sdk/diviner-model';
|
|
3
|
+
import type { Payload, Schema } from '@xyo-network/sdk-protocol';
|
|
4
|
+
import type { JsonPathAggregateDivinerParams, PayloadTransformer, SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '../model/index.ts';
|
|
5
|
+
export declare class JsonPathAggregateDiviner<TParams extends JsonPathAggregateDivinerParams = JsonPathAggregateDivinerParams, 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> {
|
|
6
|
+
static readonly configSchemas: Schema[];
|
|
7
|
+
static readonly defaultConfigSchema: Schema;
|
|
8
|
+
protected _transforms: PayloadTransformer[] | undefined;
|
|
9
|
+
private _payloadTransformers;
|
|
10
|
+
private _transformableSchemas;
|
|
11
|
+
/**
|
|
12
|
+
* The schema to use for the destination payloads
|
|
13
|
+
*/
|
|
14
|
+
protected get destinationSchema(): Schema;
|
|
15
|
+
/**
|
|
16
|
+
* Dictionary of schemas to payload transformers
|
|
17
|
+
*/
|
|
18
|
+
protected get payloadTransformers(): SchemaToPayloadTransformersDictionary;
|
|
19
|
+
/**
|
|
20
|
+
* The dictionary of schemas to JSON Path transform expressions
|
|
21
|
+
*/
|
|
22
|
+
protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary;
|
|
23
|
+
/**
|
|
24
|
+
* List of transformable schemas for this diviner
|
|
25
|
+
*/
|
|
26
|
+
protected get transformableSchemas(): string[];
|
|
27
|
+
protected divineHandler(payloads?: TIn[]): Promise<TOut[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Identifies if a payload is one that is transformed by this diviner
|
|
30
|
+
* @param x The candidate payload
|
|
31
|
+
* @returns True if the payload is one transformed by this diviner, false otherwise
|
|
32
|
+
*/
|
|
33
|
+
protected isTransformablePayload: (x: Payload) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Identifies if a schema is one that is transformed by this diviner
|
|
36
|
+
* @param schema The candidate schema
|
|
37
|
+
* @returns True if this schema is one transformed by this diviner, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
protected isTransformableSchema: (schema?: string | null) => boolean;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=Diviner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Diviner.d.ts","sourceRoot":"","sources":["../../../src/memory/Diviner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAMhE,OAAO,KAAK,EACV,8BAA8B,EAC9B,kBAAkB,EAClB,8CAA8C,EAC9C,qCAAqC,EACtC,MAAM,mBAAmB,CAAA;AAM1B,qBAAa,wBAAwB,CACnC,OAAO,SAAS,8BAA8B,GAAG,8BAA8B,EAC/E,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,CAAiE;IACjH,gBAAyB,mBAAmB,EAAE,MAAM,CAAuC;IAE3F,SAAS,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,SAAS,CAAA;IAEvD,OAAO,CAAC,oBAAoB,CAAmD;IAC/E,OAAO,CAAC,qBAAqB,CAAsB;IAEnD;;OAEG;IACH,SAAS,KAAK,iBAAiB,IAAI,MAAM,CAExC;IAED;;OAEG;IACH,SAAS,KAAK,mBAAmB,IAAI,qCAAqC,CAGzE;IAED;;OAEG;IACH,SAAS,KAAK,gBAAgB,IAAI,8CAA8C,CAE/E;IAED;;OAEG;IACH,SAAS,KAAK,oBAAoB,IAAI,MAAM,EAAE,CAG7C;cAEwB,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAiBzE;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,GAAI,GAAG,OAAO,KAAG,OAAO,CAEvD;IAED;;;;OAIG;IACH,SAAS,CAAC,qBAAqB,GAAI,SAAS,MAAM,GAAG,IAAI,KAAG,OAAO,CAElE;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/memory/jsonpath/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AACrD,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '../../model/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Materializes the JSON-path expressions into memoized functions by converting a
|
|
4
|
+
* dictionary of schema to JSON Path transform expressions to a dictionary
|
|
5
|
+
* of schema to payload transformers
|
|
6
|
+
* @param schemaTransforms The schema transforms to convert
|
|
7
|
+
* @returns A dictionary of schema to payload transformers
|
|
8
|
+
*/
|
|
9
|
+
export declare const jsonPathToTransformersDictionary: (schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary) => SchemaToPayloadTransformersDictionary;
|
|
10
|
+
//# sourceMappingURL=jsonPathToTransformersDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonPathToTransformersDictionary.d.ts","sourceRoot":"","sources":["../../../../src/memory/jsonpath/jsonPathToTransformersDictionary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8CAA8C,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAA;AAEjI;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,GAC3C,kBAAkB,8CAA8C,KAC/D,qCAOF,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Payload, Schema } from '@xyo-network/sdk-protocol';
|
|
2
|
+
import type { SchemaToPayloadTransformersDictionary } from '../../model/index.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Reduces the payloads to a single payload using the supplied transformers
|
|
5
|
+
* @param payloads The payloads to reduce
|
|
6
|
+
* @param payloadTransformers The transformers to use to convert the payloads to the destination payload
|
|
7
|
+
* @param destinationSchema The schema of the destination payload
|
|
8
|
+
* @param excludeSources Exclude the source hashes from the destination payload
|
|
9
|
+
* @returns The reduced payload
|
|
10
|
+
*/
|
|
11
|
+
export declare const reducePayloads: <T extends Payload = Payload>(payloads: Payload[], payloadTransformers: SchemaToPayloadTransformersDictionary, destinationSchema: Schema, excludeSources?: boolean) => Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Reduces the arrays of payload arrays to an array of payloads using the supplied transformers
|
|
14
|
+
* @param payloadsArray The arrays of payloads to reduce
|
|
15
|
+
* @param payloadTransformers The transformers to use to convert the payloads to the destination payloads
|
|
16
|
+
* @param excludeSources Exclude the source hashes from the destination payload
|
|
17
|
+
* @returns The reduced payloads
|
|
18
|
+
*/
|
|
19
|
+
export declare const reducePayloadsArray: <T extends Payload = Payload>(payloadsArray: Payload[][], payloadTransformers: SchemaToPayloadTransformersDictionary, destinationSchema: Schema, excludeSources?: boolean) => Promise<T[]>;
|
|
20
|
+
//# sourceMappingURL=reducePayloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducePayloads.d.ts","sourceRoot":"","sources":["../../../../src/memory/jsonpath/reducePayloads.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,OAAO,EAAE,MAAM,EAChB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAA;AAEjF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,SAAS,OAAO,GAAG,OAAO,EAC9D,UAAU,OAAO,EAAE,EACnB,qBAAqB,qCAAqC,EAC1D,mBAAmB,MAAM,EACzB,wBAAsB,KACrB,OAAO,CAAC,CAAC,CAcX,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAU,CAAC,SAAS,OAAO,GAAG,OAAO,EACnE,eAAe,OAAO,EAAE,EAAE,EAC1B,qBAAqB,qCAAqC,EAC1D,mBAAmB,MAAM,EACzB,wBAAsB,KACrB,OAAO,CAAC,CAAC,EAAE,CAMb,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/memory.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// src/memory/Diviner.ts
|
|
2
|
+
import { assertEx } from "@ariestools/sdk";
|
|
3
|
+
import { AbstractDiviner } from "@xyo-network/sdk/diviner-abstract";
|
|
4
|
+
import {
|
|
5
|
+
BoundWitnessSchema,
|
|
6
|
+
combinationsByBoundwitness,
|
|
7
|
+
PayloadBuilder as PayloadBuilder2,
|
|
8
|
+
PayloadSchema
|
|
9
|
+
} from "@xyo-network/sdk-protocol";
|
|
10
|
+
import { combinationsBySchema } from "@xyo-network/sdk-protocol/payload-utils";
|
|
11
|
+
|
|
12
|
+
// src/model/Config.ts
|
|
13
|
+
import {
|
|
14
|
+
zodAsFactory,
|
|
15
|
+
zodIsFactory,
|
|
16
|
+
zodToFactory
|
|
17
|
+
} from "@ariestools/sdk";
|
|
18
|
+
import { DivinerConfigZod } from "@xyo-network/sdk/diviner-model";
|
|
19
|
+
import { asSchema as asSchema2 } from "@xyo-network/sdk-protocol";
|
|
20
|
+
import * as z from "zod/mini";
|
|
21
|
+
|
|
22
|
+
// src/model/Schema.ts
|
|
23
|
+
import { asSchema } from "@xyo-network/sdk-protocol";
|
|
24
|
+
var JsonPathAggregateDivinerSchema = asSchema("network.xyo.diviner.jsonpath.aggregate", true);
|
|
25
|
+
|
|
26
|
+
// src/model/Config.ts
|
|
27
|
+
var JsonPathAggregateDivinerConfigSchema = asSchema2(`${JsonPathAggregateDivinerSchema}.config`, true);
|
|
28
|
+
var JsonPathAggregateDivinerConfigZod = z.extend(DivinerConfigZod, {
|
|
29
|
+
destinationSchema: z.optional(z.custom()),
|
|
30
|
+
excludeSources: z.optional(z.boolean()),
|
|
31
|
+
schema: z.literal(JsonPathAggregateDivinerConfigSchema),
|
|
32
|
+
schemaTransforms: z.optional(z.custom())
|
|
33
|
+
});
|
|
34
|
+
var isJsonPathAggregateDivinerConfig = zodIsFactory(JsonPathAggregateDivinerConfigZod);
|
|
35
|
+
var asJsonPathAggregateDivinerConfig = zodAsFactory(JsonPathAggregateDivinerConfigZod, "asJsonPathAggregateDivinerConfig");
|
|
36
|
+
var toJsonPathAggregateDivinerConfig = zodToFactory(JsonPathAggregateDivinerConfigZod, "toJsonPathAggregateDivinerConfig");
|
|
37
|
+
|
|
38
|
+
// src/memory/jsonpath/jsonPathToTransformersDictionary.ts
|
|
39
|
+
import { toPayloadTransformer } from "@xyo-network/diviner-jsonpath/memory";
|
|
40
|
+
var jsonPathToTransformersDictionary = (schemaTransforms) => {
|
|
41
|
+
return Object.fromEntries(
|
|
42
|
+
Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {
|
|
43
|
+
const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer);
|
|
44
|
+
return [schema, transformers];
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/memory/jsonpath/reducePayloads.ts
|
|
50
|
+
import { exists } from "@ariestools/sdk";
|
|
51
|
+
import { PayloadBuilder } from "@xyo-network/sdk-protocol";
|
|
52
|
+
var reducePayloads = async (payloads, payloadTransformers, destinationSchema, excludeSources = false) => {
|
|
53
|
+
const payloadFields = payloads.filter(exists).flatMap((payload) => {
|
|
54
|
+
const transformers = payloadTransformers[payload.schema];
|
|
55
|
+
return transformers ? transformers.map((transform) => transform(payload)) : [];
|
|
56
|
+
});
|
|
57
|
+
const baseObject = excludeSources ? {} : { sources: await PayloadBuilder.dataHashes(payloads) };
|
|
58
|
+
return new PayloadBuilder({ schema: destinationSchema }).fields(Object.assign(baseObject, ...payloadFields)).build();
|
|
59
|
+
};
|
|
60
|
+
var reducePayloadsArray = async (payloadsArray, payloadTransformers, destinationSchema, excludeSources = false) => {
|
|
61
|
+
return await Promise.all(
|
|
62
|
+
payloadsArray.map(async (payloads) => {
|
|
63
|
+
return await reducePayloads(payloads, payloadTransformers, destinationSchema, excludeSources);
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/memory/Diviner.ts
|
|
69
|
+
var moduleName = "JsonPathAggregateDiviner";
|
|
70
|
+
var JsonPathAggregateDiviner = class extends AbstractDiviner {
|
|
71
|
+
static configSchemas = [...super.configSchemas, JsonPathAggregateDivinerConfigSchema];
|
|
72
|
+
static defaultConfigSchema = JsonPathAggregateDivinerConfigSchema;
|
|
73
|
+
_transforms;
|
|
74
|
+
_payloadTransformers;
|
|
75
|
+
_transformableSchemas;
|
|
76
|
+
/**
|
|
77
|
+
* The schema to use for the destination payloads
|
|
78
|
+
*/
|
|
79
|
+
get destinationSchema() {
|
|
80
|
+
return this.config.destinationSchema ?? PayloadSchema;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Dictionary of schemas to payload transformers
|
|
84
|
+
*/
|
|
85
|
+
get payloadTransformers() {
|
|
86
|
+
this._payloadTransformers ??= jsonPathToTransformersDictionary(this.schemaTransforms);
|
|
87
|
+
return this._payloadTransformers;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The dictionary of schemas to JSON Path transform expressions
|
|
91
|
+
*/
|
|
92
|
+
get schemaTransforms() {
|
|
93
|
+
return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* List of transformable schemas for this diviner
|
|
97
|
+
*/
|
|
98
|
+
get transformableSchemas() {
|
|
99
|
+
this._transformableSchemas ??= Object.keys(this.schemaTransforms);
|
|
100
|
+
return this._transformableSchemas;
|
|
101
|
+
}
|
|
102
|
+
async divineHandler(payloads) {
|
|
103
|
+
if (!payloads) return [];
|
|
104
|
+
const strippedPayloads = payloads.map((payload) => {
|
|
105
|
+
const p = { ...payload };
|
|
106
|
+
return PayloadBuilder2.omitStorageMeta(p);
|
|
107
|
+
});
|
|
108
|
+
const combinations = this.transformableSchemas.includes(BoundWitnessSchema) ? await combinationsByBoundwitness(strippedPayloads) : await combinationsBySchema(strippedPayloads, this.transformableSchemas);
|
|
109
|
+
return await Promise.all(
|
|
110
|
+
combinations.map((combination) => {
|
|
111
|
+
return reducePayloads(combination, this.payloadTransformers, this.destinationSchema, this.config.excludeSources ?? false);
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Identifies if a payload is one that is transformed by this diviner
|
|
117
|
+
* @param x The candidate payload
|
|
118
|
+
* @returns True if the payload is one transformed by this diviner, false otherwise
|
|
119
|
+
*/
|
|
120
|
+
isTransformablePayload = (x) => {
|
|
121
|
+
return this.transformableSchemas.includes(x?.schema);
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Identifies if a schema is one that is transformed by this diviner
|
|
125
|
+
* @param schema The candidate schema
|
|
126
|
+
* @returns True if this schema is one transformed by this diviner, false otherwise
|
|
127
|
+
*/
|
|
128
|
+
isTransformableSchema = (schema) => {
|
|
129
|
+
return typeof schema === "string" ? this.transformableSchemas.includes(schema) : false;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export {
|
|
133
|
+
JsonPathAggregateDiviner,
|
|
134
|
+
jsonPathToTransformersDictionary,
|
|
135
|
+
reducePayloads,
|
|
136
|
+
reducePayloadsArray
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=memory.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/memory/Diviner.ts", "../../src/model/Config.ts", "../../src/model/Schema.ts", "../../src/memory/jsonpath/jsonPathToTransformersDictionary.ts", "../../src/memory/jsonpath/reducePayloads.ts"],
|
|
4
|
+
"sourcesContent": ["import { assertEx } from '@ariestools/sdk'\nimport { AbstractDiviner } from '@xyo-network/sdk/diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '@xyo-network/sdk/diviner-model'\nimport type { Payload, Schema } from '@xyo-network/sdk-protocol'\nimport {\n BoundWitnessSchema, combinationsByBoundwitness, PayloadBuilder, PayloadSchema,\n} from '@xyo-network/sdk-protocol'\nimport { combinationsBySchema } from '@xyo-network/sdk-protocol/payload-utils'\n\nimport type {\n JsonPathAggregateDivinerParams,\n PayloadTransformer,\n SchemaToJsonPathTransformExpressionsDictionary,\n SchemaToPayloadTransformersDictionary,\n} from '../model/index.ts'\nimport { JsonPathAggregateDivinerConfigSchema } from '../model/index.ts'\nimport { jsonPathToTransformersDictionary, reducePayloads } from './jsonpath/index.ts'\n\nconst moduleName = 'JsonPathAggregateDiviner'\n\nexport class JsonPathAggregateDiviner<\n TParams extends JsonPathAggregateDivinerParams = JsonPathAggregateDivinerParams,\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, JsonPathAggregateDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = JsonPathAggregateDivinerConfigSchema\n\n protected _transforms: PayloadTransformer[] | undefined\n\n private _payloadTransformers: SchemaToPayloadTransformersDictionary | undefined\n private _transformableSchemas: string[] | undefined\n\n /**\n * The schema to use for the destination payloads\n */\n protected get destinationSchema(): Schema {\n return this.config.destinationSchema ?? PayloadSchema\n }\n\n /**\n * Dictionary of schemas to payload transformers\n */\n protected get payloadTransformers(): SchemaToPayloadTransformersDictionary {\n this._payloadTransformers ??= jsonPathToTransformersDictionary(this.schemaTransforms)\n return this._payloadTransformers\n }\n\n /**\n * The dictionary of schemas to JSON Path transform expressions\n */\n protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary {\n return assertEx(this.config?.schemaTransforms, () => `${moduleName}: Missing config.schemaTransforms section`)\n }\n\n /**\n * List of transformable schemas for this diviner\n */\n protected get transformableSchemas(): string[] {\n this._transformableSchemas ??= Object.keys(this.schemaTransforms)\n return this._transformableSchemas\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n if (!payloads) return []\n const strippedPayloads = payloads.map((payload) => {\n const p = { ...payload }\n return PayloadBuilder.omitStorageMeta(p)\n })\n const combinations\n = this.transformableSchemas.includes(BoundWitnessSchema)\n ? await combinationsByBoundwitness(strippedPayloads)\n : await combinationsBySchema(strippedPayloads, this.transformableSchemas)\n return await Promise.all(\n combinations.map((combination) => {\n return reducePayloads<TOut>(combination, this.payloadTransformers, this.destinationSchema, this.config.excludeSources ?? false)\n }),\n )\n }\n\n /**\n * Identifies if a payload is one that is transformed by this diviner\n * @param x The candidate payload\n * @returns True if the payload is one transformed by this diviner, false otherwise\n */\n protected isTransformablePayload = (x: Payload): boolean => {\n return this.transformableSchemas.includes(x?.schema)\n }\n\n /**\n * Identifies if a schema is one that is transformed by this diviner\n * @param schema The candidate schema\n * @returns True if this schema is one transformed by this diviner, false otherwise\n */\n protected isTransformableSchema = (schema?: string | null): boolean => {\n return typeof schema === 'string' ? this.transformableSchemas.includes(schema) : false\n }\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { DivinerConfig } from '@xyo-network/sdk/diviner-model'\nimport { DivinerConfigZod } from '@xyo-network/sdk/diviner-model'\nimport type { Schema } from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { SchemaToJsonPathTransformExpressionsDictionary } from './jsonpath/index.ts'\nimport { JsonPathAggregateDivinerSchema } from './Schema.ts'\n\n/**\n * The config schema for the JSON Path diviner\n */\nexport const JsonPathAggregateDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${JsonPathAggregateDivinerSchema}.config`, true)\n\n/**\n * The config schema type for the JSON Path diviner\n */\nexport type JsonPathAggregateDivinerConfigSchema = typeof JsonPathAggregateDivinerConfigSchema\n\n/**\n * The Zod schema for the JSON Path aggregate diviner config\n */\nexport const JsonPathAggregateDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof DivinerConfigZod)['shape'], 'schema'> & {\n destinationSchema: z.ZodMiniOptional<z.ZodMiniCustom<Schema, Schema>>\n excludeSources: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n schema: z.ZodMiniLiteral<JsonPathAggregateDivinerConfigSchema>\n schemaTransforms: z.ZodMiniOptional<\n z.ZodMiniCustom<SchemaToJsonPathTransformExpressionsDictionary, SchemaToJsonPathTransformExpressionsDictionary>\n >\n },\n z.core.$strip\n> = z.extend(DivinerConfigZod, {\n destinationSchema: z.optional(z.custom<Schema>()),\n excludeSources: z.optional(z.boolean()),\n schema: z.literal(JsonPathAggregateDivinerConfigSchema),\n schemaTransforms: z.optional(z.custom<SchemaToJsonPathTransformExpressionsDictionary>()),\n})\n\n/**\n * The configuration for the JSON Path diviner\n */\nexport type JsonPathAggregateDivinerConfig = DivinerConfig<\n {\n /**\n * The schema to use for the destination payloads\n */\n destinationSchema?: Schema\n /**\n * Exclude the source hashes from the destination payload.\n */\n excludeSources?: boolean\n /**\n * The JSON Path transform expressions to apply to the payloads\n */\n schemaTransforms?: SchemaToJsonPathTransformExpressionsDictionary\n } & { schema: JsonPathAggregateDivinerConfigSchema }\n>\n\nexport const isJsonPathAggregateDivinerConfig: ReturnType<typeof zodIsFactory<JsonPathAggregateDivinerConfig>> = zodIsFactory(JsonPathAggregateDivinerConfigZod)\nexport const asJsonPathAggregateDivinerConfig: ReturnType<typeof zodAsFactory<JsonPathAggregateDivinerConfig>> = zodAsFactory(JsonPathAggregateDivinerConfigZod, 'asJsonPathAggregateDivinerConfig')\nexport const toJsonPathAggregateDivinerConfig: ReturnType<typeof zodToFactory<JsonPathAggregateDivinerConfig>> = zodToFactory(JsonPathAggregateDivinerConfigZod, 'toJsonPathAggregateDivinerConfig')\n", "import { asSchema } from '@xyo-network/sdk-protocol'\n\n/**\n * The schema used for the JSONPath Diviner.\n */\nexport const JsonPathAggregateDivinerSchema: 'network.xyo.diviner.jsonpath.aggregate' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.jsonpath.aggregate', true)\n\n/**\n * The schema type used for the JSONPath Diviner.\n */\nexport type JsonPathAggregateDivinerSchema = typeof JsonPathAggregateDivinerSchema\n", "import { toPayloadTransformer } from '@xyo-network/diviner-jsonpath/memory'\n\nimport type { SchemaToJsonPathTransformExpressionsDictionary, SchemaToPayloadTransformersDictionary } from '../../model/index.ts'\n\n/**\n * Materializes the JSON-path expressions into memoized functions by converting a\n * dictionary of schema to JSON Path transform expressions to a dictionary\n * of schema to payload transformers\n * @param schemaTransforms The schema transforms to convert\n * @returns A dictionary of schema to payload transformers\n */\nexport const jsonPathToTransformersDictionary = (\n schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary,\n): SchemaToPayloadTransformersDictionary => {\n return Object.fromEntries(\n Object.entries(schemaTransforms).map(([schema, jsonPathTransformerExpressions]) => {\n const transformers = jsonPathTransformerExpressions.map(toPayloadTransformer)\n return [schema, transformers]\n }),\n )\n}\n", "import { exists } from '@ariestools/sdk'\nimport type {\n Payload, Schema, WithoutSchema,\n} from '@xyo-network/sdk-protocol'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\n\nimport type { SchemaToPayloadTransformersDictionary } from '../../model/index.ts'\n\n/**\n * Reduces the payloads to a single payload using the supplied transformers\n * @param payloads The payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payload\n * @param destinationSchema The schema of the destination payload\n * @param excludeSources Exclude the source hashes from the destination payload\n * @returns The reduced payload\n */\nexport const reducePayloads = async <T extends Payload = Payload>(\n payloads: Payload[],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: Schema,\n excludeSources = false,\n): Promise<T> => {\n // Use the payload transformers to convert the fields from the source payloads to the destination fields\n const payloadFields = payloads.filter(exists).flatMap<WithoutSchema<Payload>[]>((payload) => {\n // Find the transformers for this payload\n const transformers = payloadTransformers[payload.schema]\n // If transformers exist, apply them to the payload otherwise return an empty array\n return transformers ? transformers.map(transform => transform(payload)) : []\n })\n // Include all the sources for reference\n const baseObject = excludeSources ? {} : { sources: await PayloadBuilder.dataHashes(payloads) }\n // Build and return the payload\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return new PayloadBuilder<T>({ schema: destinationSchema }).fields(Object.assign(baseObject, ...payloadFields)).build()\n}\n\n/**\n * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers\n * @param payloadsArray The arrays of payloads to reduce\n * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads\n * @param excludeSources Exclude the source hashes from the destination payload\n * @returns The reduced payloads\n */\nexport const reducePayloadsArray = async <T extends Payload = Payload>(\n payloadsArray: Payload[][],\n payloadTransformers: SchemaToPayloadTransformersDictionary,\n destinationSchema: Schema,\n excludeSources = false,\n): Promise<T[]> => {\n return await Promise.all(\n payloadsArray.map(async (payloads) => {\n return await reducePayloads<T>(payloads, payloadTransformers, destinationSchema, excludeSources)\n }),\n )\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["PayloadBuilder", "asSchema", "asSchema", "PayloadBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { zodAsFactory, zodIsFactory, zodToFactory } from '@ariestools/sdk';
|
|
2
|
+
import type { DivinerConfig } from '@xyo-network/sdk/diviner-model';
|
|
3
|
+
import { DivinerConfigZod } from '@xyo-network/sdk/diviner-model';
|
|
4
|
+
import type { Schema } from '@xyo-network/sdk-protocol';
|
|
5
|
+
import * as z from 'zod/mini';
|
|
6
|
+
import type { SchemaToJsonPathTransformExpressionsDictionary } from './jsonpath/index.ts';
|
|
7
|
+
/**
|
|
8
|
+
* The config schema for the JSON Path diviner
|
|
9
|
+
*/
|
|
10
|
+
export declare const JsonPathAggregateDivinerConfigSchema: string & {
|
|
11
|
+
readonly __schema: true;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The config schema type for the JSON Path diviner
|
|
15
|
+
*/
|
|
16
|
+
export type JsonPathAggregateDivinerConfigSchema = typeof JsonPathAggregateDivinerConfigSchema;
|
|
17
|
+
/**
|
|
18
|
+
* The Zod schema for the JSON Path aggregate diviner config
|
|
19
|
+
*/
|
|
20
|
+
export declare const JsonPathAggregateDivinerConfigZod: z.ZodMiniObject<Omit<(typeof DivinerConfigZod)['shape'], 'schema'> & {
|
|
21
|
+
destinationSchema: z.ZodMiniOptional<z.ZodMiniCustom<Schema, Schema>>;
|
|
22
|
+
excludeSources: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
23
|
+
schema: z.ZodMiniLiteral<JsonPathAggregateDivinerConfigSchema>;
|
|
24
|
+
schemaTransforms: z.ZodMiniOptional<z.ZodMiniCustom<SchemaToJsonPathTransformExpressionsDictionary, SchemaToJsonPathTransformExpressionsDictionary>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/**
|
|
27
|
+
* The configuration for the JSON Path diviner
|
|
28
|
+
*/
|
|
29
|
+
export type JsonPathAggregateDivinerConfig = DivinerConfig<{
|
|
30
|
+
/**
|
|
31
|
+
* The schema to use for the destination payloads
|
|
32
|
+
*/
|
|
33
|
+
destinationSchema?: Schema;
|
|
34
|
+
/**
|
|
35
|
+
* Exclude the source hashes from the destination payload.
|
|
36
|
+
*/
|
|
37
|
+
excludeSources?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The JSON Path transform expressions to apply to the payloads
|
|
40
|
+
*/
|
|
41
|
+
schemaTransforms?: SchemaToJsonPathTransformExpressionsDictionary;
|
|
42
|
+
} & {
|
|
43
|
+
schema: JsonPathAggregateDivinerConfigSchema;
|
|
44
|
+
}>;
|
|
45
|
+
export declare const isJsonPathAggregateDivinerConfig: ReturnType<typeof zodIsFactory<JsonPathAggregateDivinerConfig>>;
|
|
46
|
+
export declare const asJsonPathAggregateDivinerConfig: ReturnType<typeof zodAsFactory<JsonPathAggregateDivinerConfig>>;
|
|
47
|
+
export declare const toJsonPathAggregateDivinerConfig: ReturnType<typeof zodToFactory<JsonPathAggregateDivinerConfig>>;
|
|
48
|
+
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/model/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAAE,YAAY,EAAE,YAAY,EACzC,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAEvD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAA;AAE7B,OAAO,KAAK,EAAE,8CAA8C,EAAE,MAAM,qBAAqB,CAAA;AAGzF;;GAEG;AACH,eAAO,MAAM,oCAAoC,EAAE,MAAM,GAAG;IAC1D,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CACqC,CAAA;AAE9D;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,OAAO,oCAAoC,CAAA;AAE9F;;GAEG;AACH,eAAO,MAAM,iCAAiC,EAAE,CAAC,CAAC,aAAa,CAC7D,IAAI,CAAC,CAAC,OAAO,gBAAgB,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,GAAG;IACnD,iBAAiB,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACrE,cAAc,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,MAAM,EAAE,CAAC,CAAC,cAAc,CAAC,oCAAoC,CAAC,CAAA;IAC9D,gBAAgB,EAAE,CAAC,CAAC,eAAe,CACjC,CAAC,CAAC,aAAa,CAAC,8CAA8C,EAAE,8CAA8C,CAAC,CAChH,CAAA;CACF,EACD,CAAC,CAAC,IAAI,CAAC,MAAM,CAMb,CAAA;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,aAAa,CACxD;IACE;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,8CAA8C,CAAA;CAClE,GAAG;IAAE,MAAM,EAAE,oCAAoC,CAAA;CAAE,CACrD,CAAA;AAED,eAAO,MAAM,gCAAgC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,8BAA8B,CAAC,CAAmD,CAAA;AAChK,eAAO,MAAM,gCAAgC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,8BAA8B,CAAC,CAAuF,CAAA;AACpM,eAAO,MAAM,gCAAgC,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,8BAA8B,CAAC,CAAuF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DivinerParams } from '@xyo-network/sdk/diviner-model';
|
|
2
|
+
import type { AnyConfigSchema } from '@xyo-network/sdk/module-model';
|
|
3
|
+
import type { JsonPathAggregateDivinerConfig } from './Config.ts';
|
|
4
|
+
/**
|
|
5
|
+
* The params type the JSON Path diviner
|
|
6
|
+
**/
|
|
7
|
+
export type JsonPathAggregateDivinerParams = DivinerParams<AnyConfigSchema<JsonPathAggregateDivinerConfig>>;
|
|
8
|
+
//# sourceMappingURL=Params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/model/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAA;AAEjE;;IAEI;AACJ,MAAM,MAAM,8BAA8B,GAAG,aAAa,CAAC,eAAe,CAAC,8BAA8B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The schema used for the JSONPath Diviner.
|
|
3
|
+
*/
|
|
4
|
+
export declare const JsonPathAggregateDivinerSchema: 'network.xyo.diviner.jsonpath.aggregate' & {
|
|
5
|
+
readonly __schema: true;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The schema type used for the JSONPath Diviner.
|
|
9
|
+
*/
|
|
10
|
+
export type JsonPathAggregateDivinerSchema = typeof JsonPathAggregateDivinerSchema;
|
|
11
|
+
//# sourceMappingURL=Schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/model/Schema.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,wCAAwC,GAAG;IACtF,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAA;CACmC,CAAA;AAE5D;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,OAAO,8BAA8B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { JsonValue } from '@ariestools/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Describes the JSON-path transformation to retrieve a field on a source object
|
|
4
|
+
* and the target field to store the value to on a destination object
|
|
5
|
+
*/
|
|
6
|
+
export interface JsonPathTransformExpression {
|
|
7
|
+
/**
|
|
8
|
+
* The default value to use if the source field does not exist
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: JsonValue;
|
|
11
|
+
/**
|
|
12
|
+
* The target field to store the source field into on the destination object
|
|
13
|
+
*/
|
|
14
|
+
destinationField: string;
|
|
15
|
+
/**
|
|
16
|
+
* The JSON path expressions for the source field on the source object
|
|
17
|
+
*/
|
|
18
|
+
sourcePathExpression: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=JsonPathTransformExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JsonPathTransformExpression.d.ts","sourceRoot":"","sources":["../../../../src/model/jsonpath/JsonPathTransformExpression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,oBAAoB,EAAE,MAAM,CAAA;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayloadTransformer.d.ts","sourceRoot":"","sources":["../../../../src/model/jsonpath/PayloadTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAExD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JsonPathTransformExpression } from './JsonPathTransformExpression.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A dictionary of schema to JSON Path transform expressions.
|
|
4
|
+
*/
|
|
5
|
+
export type SchemaToJsonPathTransformExpressionsDictionary<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
6
|
+
[key in keyof T]: JsonPathTransformExpression[];
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=SchemaToJsonPathTransformExpressionDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaToJsonPathTransformExpressionDictionary.d.ts","sourceRoot":"","sources":["../../../../src/model/jsonpath/SchemaToJsonPathTransformExpressionDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAEnF;;GAEG;AACH,MAAM,MAAM,8CAA8C,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACvH,GAAG,IAAI,MAAM,CAAC,GAAG,2BAA2B,EAAE;CAChD,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PayloadTransformer } from './PayloadTransformer.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A dictionary of schema to payload transformers
|
|
4
|
+
*/
|
|
5
|
+
export type SchemaToPayloadTransformersDictionary = Record<string, PayloadTransformer[]>;
|
|
6
|
+
//# sourceMappingURL=SchemaToPayloadTransformersDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaToPayloadTransformersDictionary.d.ts","sourceRoot":"","sources":["../../../../src/model/jsonpath/SchemaToPayloadTransformersDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model/jsonpath/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,yBAAyB,CAAA;AACvC,cAAc,oDAAoD,CAAA;AAClE,cAAc,4CAA4C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/model/Config.ts
|
|
2
|
+
import {
|
|
3
|
+
zodAsFactory,
|
|
4
|
+
zodIsFactory,
|
|
5
|
+
zodToFactory
|
|
6
|
+
} from "@ariestools/sdk";
|
|
7
|
+
import { DivinerConfigZod } from "@xyo-network/sdk/diviner-model";
|
|
8
|
+
import { asSchema as asSchema2 } from "@xyo-network/sdk-protocol";
|
|
9
|
+
import * as z from "zod/mini";
|
|
10
|
+
|
|
11
|
+
// src/model/Schema.ts
|
|
12
|
+
import { asSchema } from "@xyo-network/sdk-protocol";
|
|
13
|
+
var JsonPathAggregateDivinerSchema = asSchema("network.xyo.diviner.jsonpath.aggregate", true);
|
|
14
|
+
|
|
15
|
+
// src/model/Config.ts
|
|
16
|
+
var JsonPathAggregateDivinerConfigSchema = asSchema2(`${JsonPathAggregateDivinerSchema}.config`, true);
|
|
17
|
+
var JsonPathAggregateDivinerConfigZod = z.extend(DivinerConfigZod, {
|
|
18
|
+
destinationSchema: z.optional(z.custom()),
|
|
19
|
+
excludeSources: z.optional(z.boolean()),
|
|
20
|
+
schema: z.literal(JsonPathAggregateDivinerConfigSchema),
|
|
21
|
+
schemaTransforms: z.optional(z.custom())
|
|
22
|
+
});
|
|
23
|
+
var isJsonPathAggregateDivinerConfig = zodIsFactory(JsonPathAggregateDivinerConfigZod);
|
|
24
|
+
var asJsonPathAggregateDivinerConfig = zodAsFactory(JsonPathAggregateDivinerConfigZod, "asJsonPathAggregateDivinerConfig");
|
|
25
|
+
var toJsonPathAggregateDivinerConfig = zodToFactory(JsonPathAggregateDivinerConfigZod, "toJsonPathAggregateDivinerConfig");
|
|
26
|
+
export {
|
|
27
|
+
JsonPathAggregateDivinerConfigSchema,
|
|
28
|
+
JsonPathAggregateDivinerConfigZod,
|
|
29
|
+
JsonPathAggregateDivinerSchema,
|
|
30
|
+
asJsonPathAggregateDivinerConfig,
|
|
31
|
+
isJsonPathAggregateDivinerConfig,
|
|
32
|
+
toJsonPathAggregateDivinerConfig
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=model.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/model/Config.ts", "../../src/model/Schema.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type { DivinerConfig } from '@xyo-network/sdk/diviner-model'\nimport { DivinerConfigZod } from '@xyo-network/sdk/diviner-model'\nimport type { Schema } from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { SchemaToJsonPathTransformExpressionsDictionary } from './jsonpath/index.ts'\nimport { JsonPathAggregateDivinerSchema } from './Schema.ts'\n\n/**\n * The config schema for the JSON Path diviner\n */\nexport const JsonPathAggregateDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${JsonPathAggregateDivinerSchema}.config`, true)\n\n/**\n * The config schema type for the JSON Path diviner\n */\nexport type JsonPathAggregateDivinerConfigSchema = typeof JsonPathAggregateDivinerConfigSchema\n\n/**\n * The Zod schema for the JSON Path aggregate diviner config\n */\nexport const JsonPathAggregateDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof DivinerConfigZod)['shape'], 'schema'> & {\n destinationSchema: z.ZodMiniOptional<z.ZodMiniCustom<Schema, Schema>>\n excludeSources: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n schema: z.ZodMiniLiteral<JsonPathAggregateDivinerConfigSchema>\n schemaTransforms: z.ZodMiniOptional<\n z.ZodMiniCustom<SchemaToJsonPathTransformExpressionsDictionary, SchemaToJsonPathTransformExpressionsDictionary>\n >\n },\n z.core.$strip\n> = z.extend(DivinerConfigZod, {\n destinationSchema: z.optional(z.custom<Schema>()),\n excludeSources: z.optional(z.boolean()),\n schema: z.literal(JsonPathAggregateDivinerConfigSchema),\n schemaTransforms: z.optional(z.custom<SchemaToJsonPathTransformExpressionsDictionary>()),\n})\n\n/**\n * The configuration for the JSON Path diviner\n */\nexport type JsonPathAggregateDivinerConfig = DivinerConfig<\n {\n /**\n * The schema to use for the destination payloads\n */\n destinationSchema?: Schema\n /**\n * Exclude the source hashes from the destination payload.\n */\n excludeSources?: boolean\n /**\n * The JSON Path transform expressions to apply to the payloads\n */\n schemaTransforms?: SchemaToJsonPathTransformExpressionsDictionary\n } & { schema: JsonPathAggregateDivinerConfigSchema }\n>\n\nexport const isJsonPathAggregateDivinerConfig: ReturnType<typeof zodIsFactory<JsonPathAggregateDivinerConfig>> = zodIsFactory(JsonPathAggregateDivinerConfigZod)\nexport const asJsonPathAggregateDivinerConfig: ReturnType<typeof zodAsFactory<JsonPathAggregateDivinerConfig>> = zodAsFactory(JsonPathAggregateDivinerConfigZod, 'asJsonPathAggregateDivinerConfig')\nexport const toJsonPathAggregateDivinerConfig: ReturnType<typeof zodToFactory<JsonPathAggregateDivinerConfig>> = zodToFactory(JsonPathAggregateDivinerConfigZod, 'toJsonPathAggregateDivinerConfig')\n", "import { asSchema } from '@xyo-network/sdk-protocol'\n\n/**\n * The schema used for the JSONPath Diviner.\n */\nexport const JsonPathAggregateDivinerSchema: 'network.xyo.diviner.jsonpath.aggregate' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.jsonpath.aggregate', true)\n\n/**\n * The schema type used for the JSONPath Diviner.\n */\nexport type JsonPathAggregateDivinerSchema = typeof JsonPathAggregateDivinerSchema\n"],
|
|
5
|
+
"mappings": ";AAAA;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AAEP,SAAS,wBAAwB;AAEjC,SAAS,YAAAA,iBAAgB;AACzB,YAAY,OAAO;;;ACPnB,SAAS,gBAAgB;AAKlB,IAAM,iCAET,SAAS,0CAA0C,IAAI;;;ADQpD,IAAM,uCAETC,UAAS,GAAG,8BAA8B,WAAW,IAAI;AAUtD,IAAM,oCAUP,SAAO,kBAAkB;AAAA,EAC7B,mBAAqB,WAAW,SAAe,CAAC;AAAA,EAChD,gBAAkB,WAAW,UAAQ,CAAC;AAAA,EACtC,QAAU,UAAQ,oCAAoC;AAAA,EACtD,kBAAoB,WAAW,SAAuD,CAAC;AACzF,CAAC;AAsBM,IAAM,mCAAoG,aAAa,iCAAiC;AACxJ,IAAM,mCAAoG,aAAa,mCAAmC,kCAAkC;AAC5L,IAAM,mCAAoG,aAAa,mCAAmC,kCAAkC;",
|
|
6
|
+
"names": ["asSchema", "asSchema"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/diviner-jsonpath-aggregate",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
"types": "./dist/neutral/index.d.ts",
|
|
25
25
|
"default": "./dist/neutral/index.mjs"
|
|
26
26
|
},
|
|
27
|
+
"./model": {
|
|
28
|
+
"types": "./dist/neutral/model.d.ts",
|
|
29
|
+
"default": "./dist/neutral/model.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./memory": {
|
|
32
|
+
"types": "./dist/neutral/memory.d.ts",
|
|
33
|
+
"default": "./dist/neutral/memory.mjs"
|
|
34
|
+
},
|
|
27
35
|
"./package.json": "./package.json"
|
|
28
36
|
},
|
|
29
37
|
"files": [
|
|
@@ -34,20 +42,28 @@
|
|
|
34
42
|
"README.md"
|
|
35
43
|
],
|
|
36
44
|
"dependencies": {
|
|
37
|
-
"@xyo-network/diviner-jsonpath
|
|
38
|
-
"@xyo-network/
|
|
45
|
+
"@xyo-network/diviner-jsonpath": "~7.3.0",
|
|
46
|
+
"@xyo-network/sdk": "~7.3.0"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
|
-
"@ariestools/sdk": "~8.1.
|
|
42
|
-
"@ariestools/toolchain": "~
|
|
43
|
-
"@ariestools/tsconfig": "~
|
|
49
|
+
"@ariestools/sdk": "~8.1.9",
|
|
50
|
+
"@ariestools/toolchain": "~9.1.1",
|
|
51
|
+
"@ariestools/tsconfig": "~9.1.1",
|
|
52
|
+
"@ariestools/vitest-extended": "~8.0.3",
|
|
44
53
|
"@opentelemetry/api": "~1.9.1",
|
|
45
|
-
"@xyo-network/sdk-protocol": "~7.
|
|
46
|
-
"eslint": "~10.
|
|
54
|
+
"@xyo-network/sdk-protocol": "~7.3.1",
|
|
55
|
+
"eslint": "~10.9.0",
|
|
47
56
|
"eslint-import-resolver-typescript": "~4.4.5",
|
|
48
57
|
"typescript": "~6.0.3",
|
|
58
|
+
"vite": "~8.2.2",
|
|
59
|
+
"vitest": "~4.1.11",
|
|
49
60
|
"zod": "~4.4.3"
|
|
50
61
|
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@ariestools/sdk": "^8.1",
|
|
64
|
+
"@xyo-network/sdk-protocol": "^7.3",
|
|
65
|
+
"zod": "^4.4"
|
|
66
|
+
},
|
|
51
67
|
"engines": {
|
|
52
68
|
"node": "^24"
|
|
53
69
|
},
|