@xyo-network/diviner-jsonpath-aggregate-memory 4.0.3 → 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,70 @@
1
+ import { AbstractDiviner } from '@xyo-network/diviner-abstract';
2
+ import { JsonPathAggregateDivinerParams, PayloadTransformer, SchemaToPayloadTransformersDictionary, SchemaToJsonPathTransformExpressionsDictionary } from '@xyo-network/diviner-jsonpath-aggregate-model';
3
+ import { DivinerModuleEventData, DivinerInstance } from '@xyo-network/diviner-model';
4
+ import { Payload, Schema } from '@xyo-network/payload-model';
5
+
6
+ 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> {
7
+ static readonly configSchemas: Schema[];
8
+ static readonly defaultConfigSchema: Schema;
9
+ protected _transforms: PayloadTransformer[] | undefined;
10
+ private _payloadTransformers;
11
+ private _transformableSchemas;
12
+ /**
13
+ * The schema to use for the destination payloads
14
+ */
15
+ protected get destinationSchema(): string;
16
+ /**
17
+ * Dictionary of schemas to payload transformers
18
+ */
19
+ protected get payloadTransformers(): SchemaToPayloadTransformersDictionary;
20
+ /**
21
+ * The dictionary of schemas to JSON Path transform expressions
22
+ */
23
+ protected get schemaTransforms(): SchemaToJsonPathTransformExpressionsDictionary;
24
+ /**
25
+ * List of transformable schemas for this diviner
26
+ */
27
+ protected get transformableSchemas(): string[];
28
+ protected divineHandler(payloads?: TIn[]): Promise<TOut[]>;
29
+ /**
30
+ * Identifies if a payload is one that is transformed by this diviner
31
+ * @param x The candidate payload
32
+ * @returns True if the payload is one transformed by this diviner, false otherwise
33
+ */
34
+ protected isTransformablePayload: (x: Payload) => boolean;
35
+ /**
36
+ * Identifies if a schema is one that is transformed by this diviner
37
+ * @param schema The candidate schema
38
+ * @returns True if this schema is one transformed by this diviner, false otherwise
39
+ */
40
+ protected isTransformableSchema: (schema?: string | null) => boolean;
41
+ }
42
+
43
+ /**
44
+ * Materializes the JSON-path expressions into memoized functions by converting a
45
+ * dictionary of schema to JSON Path transform expressions to a dictionary
46
+ * of schema to payload transformers
47
+ * @param schemaTransforms The schema transforms to convert
48
+ * @returns A dictionary of schema to payload transformers
49
+ */
50
+ declare const jsonPathToTransformersDictionary: (schemaTransforms: SchemaToJsonPathTransformExpressionsDictionary) => SchemaToPayloadTransformersDictionary;
51
+
52
+ /**
53
+ * Reduces the payloads to a single payload using the supplied transformers
54
+ * @param payloads The payloads to reduce
55
+ * @param payloadTransformers The transformers to use to convert the payloads to the destination payload
56
+ * @param destinationSchema The schema of the destination payload
57
+ * @param excludeSources Exclude the source hashes from the destination payload
58
+ * @returns The reduced payload
59
+ */
60
+ declare const reducePayloads: <T extends Payload = Payload>(payloads: Payload[], payloadTransformers: SchemaToPayloadTransformersDictionary, destinationSchema: string, excludeSources?: boolean) => Promise<T>;
61
+ /**
62
+ * Reduces the arrays of payload arrays to an array of payloads using the supplied transformers
63
+ * @param payloadsArray The arrays of payloads to reduce
64
+ * @param payloadTransformers The transformers to use to convert the payloads to the destination payloads
65
+ * @param excludeSources Exclude the source hashes from the destination payload
66
+ * @returns The reduced payloads
67
+ */
68
+ declare const reducePayloadsArray: <T extends Payload = Payload>(payloadsArray: Payload[][], payloadTransformers: SchemaToPayloadTransformersDictionary, destinationSchema: string, excludeSources?: boolean) => Promise<T[]>;
69
+
70
+ export { JsonPathAggregateDiviner, jsonPathToTransformersDictionary, reducePayloads, reducePayloadsArray };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/diviner-jsonpath-aggregate-memory",
3
- "version": "4.0.3",
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,33 +21,33 @@
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/assert": "^4.13.4",
33
- "@xylabs/exists": "^4.13.4",
34
- "@xyo-network/boundwitness-model": "^4.0.3",
35
- "@xyo-network/diviner-abstract": "^4.0.3",
36
- "@xyo-network/diviner-jsonpath-aggregate-model": "^4.0.3",
37
- "@xyo-network/diviner-jsonpath-memory": "^4.0.3",
38
- "@xyo-network/diviner-model": "^4.0.3",
39
- "@xyo-network/payload-builder": "^4.0.3",
40
- "@xyo-network/payload-model": "^4.0.3",
41
- "@xyo-network/payload-utils": "^4.0.3"
32
+ "@xylabs/assert": "^4.13.15",
33
+ "@xylabs/exists": "^4.13.15",
34
+ "@xyo-network/boundwitness-model": "^4.1.0",
35
+ "@xyo-network/diviner-abstract": "^4.1.0",
36
+ "@xyo-network/diviner-jsonpath-aggregate-model": "^4.1.0",
37
+ "@xyo-network/diviner-jsonpath-memory": "^4.1.0",
38
+ "@xyo-network/diviner-model": "^4.1.0",
39
+ "@xyo-network/payload-builder": "^4.1.0",
40
+ "@xyo-network/payload-model": "^4.1.0",
41
+ "@xyo-network/payload-utils": "^4.1.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@xylabs/ts-scripts-yarn3": "^6.5.18",
45
- "@xylabs/tsconfig": "^6.5.18",
46
- "@xylabs/vitest-extended": "^4.13.4",
47
- "@xyo-network/account": "^4.0.3",
48
- "@xyo-network/account-model": "^4.0.3",
49
- "@xyo-network/boundwitness-builder": "^4.0.3",
50
- "@xyo-network/diviner-jsonpath-model": "^4.0.3",
44
+ "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.20",
45
+ "@xylabs/tsconfig": "^7.0.0-rc.20",
46
+ "@xylabs/vitest-extended": "^4.13.15",
47
+ "@xyo-network/account": "^4.1.0",
48
+ "@xyo-network/account-model": "^4.1.0",
49
+ "@xyo-network/boundwitness-builder": "^4.1.0",
50
+ "@xyo-network/diviner-jsonpath-model": "^4.1.0",
51
51
  "typescript": "^5.8.3",
52
52
  "vitest": "^3.2.4"
53
53
  },
File without changes
File without changes
File without changes
File without changes