@xyo-network/diviner-jsonpath-aggregate-model 2.83.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.
Files changed (129) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +13 -0
  3. package/dist/browser/Config.d.cts +27 -0
  4. package/dist/browser/Config.d.cts.map +1 -0
  5. package/dist/browser/Config.d.mts +27 -0
  6. package/dist/browser/Config.d.mts.map +1 -0
  7. package/dist/browser/Config.d.ts +27 -0
  8. package/dist/browser/Config.d.ts.map +1 -0
  9. package/dist/browser/Params.d.cts +8 -0
  10. package/dist/browser/Params.d.cts.map +1 -0
  11. package/dist/browser/Params.d.mts +8 -0
  12. package/dist/browser/Params.d.mts.map +1 -0
  13. package/dist/browser/Params.d.ts +8 -0
  14. package/dist/browser/Params.d.ts.map +1 -0
  15. package/dist/browser/Schema.d.cts +9 -0
  16. package/dist/browser/Schema.d.cts.map +1 -0
  17. package/dist/browser/Schema.d.mts +9 -0
  18. package/dist/browser/Schema.d.mts.map +1 -0
  19. package/dist/browser/Schema.d.ts +9 -0
  20. package/dist/browser/Schema.d.ts.map +1 -0
  21. package/dist/browser/index.cjs +33 -0
  22. package/dist/browser/index.cjs.map +1 -0
  23. package/dist/browser/index.d.cts +5 -0
  24. package/dist/browser/index.d.cts.map +1 -0
  25. package/dist/browser/index.d.mts +5 -0
  26. package/dist/browser/index.d.mts.map +1 -0
  27. package/dist/browser/index.d.ts +5 -0
  28. package/dist/browser/index.d.ts.map +1 -0
  29. package/dist/browser/index.js +10 -0
  30. package/dist/browser/index.js.map +1 -0
  31. package/dist/browser/jsonpath/JsonPathTransformExpression.d.cts +20 -0
  32. package/dist/browser/jsonpath/JsonPathTransformExpression.d.cts.map +1 -0
  33. package/dist/browser/jsonpath/JsonPathTransformExpression.d.mts +20 -0
  34. package/dist/browser/jsonpath/JsonPathTransformExpression.d.mts.map +1 -0
  35. package/dist/browser/jsonpath/JsonPathTransformExpression.d.ts +20 -0
  36. package/dist/browser/jsonpath/JsonPathTransformExpression.d.ts.map +1 -0
  37. package/dist/browser/jsonpath/PayloadTransformer.d.cts +3 -0
  38. package/dist/browser/jsonpath/PayloadTransformer.d.cts.map +1 -0
  39. package/dist/browser/jsonpath/PayloadTransformer.d.mts +3 -0
  40. package/dist/browser/jsonpath/PayloadTransformer.d.mts.map +1 -0
  41. package/dist/browser/jsonpath/PayloadTransformer.d.ts +3 -0
  42. package/dist/browser/jsonpath/PayloadTransformer.d.ts.map +1 -0
  43. package/dist/browser/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.cts +12 -0
  44. package/dist/browser/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.cts.map +1 -0
  45. package/dist/browser/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.mts +12 -0
  46. package/dist/browser/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.mts.map +1 -0
  47. package/dist/browser/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.ts +12 -0
  48. package/dist/browser/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.ts.map +1 -0
  49. package/dist/browser/jsonpath/SchemaToPayloadTransformersDictionary.d.cts +8 -0
  50. package/dist/browser/jsonpath/SchemaToPayloadTransformersDictionary.d.cts.map +1 -0
  51. package/dist/browser/jsonpath/SchemaToPayloadTransformersDictionary.d.mts +8 -0
  52. package/dist/browser/jsonpath/SchemaToPayloadTransformersDictionary.d.mts.map +1 -0
  53. package/dist/browser/jsonpath/SchemaToPayloadTransformersDictionary.d.ts +8 -0
  54. package/dist/browser/jsonpath/SchemaToPayloadTransformersDictionary.d.ts.map +1 -0
  55. package/dist/browser/jsonpath/index.d.cts +5 -0
  56. package/dist/browser/jsonpath/index.d.cts.map +1 -0
  57. package/dist/browser/jsonpath/index.d.mts +5 -0
  58. package/dist/browser/jsonpath/index.d.mts.map +1 -0
  59. package/dist/browser/jsonpath/index.d.ts +5 -0
  60. package/dist/browser/jsonpath/index.d.ts.map +1 -0
  61. package/dist/node/Config.d.cts +27 -0
  62. package/dist/node/Config.d.cts.map +1 -0
  63. package/dist/node/Config.d.mts +27 -0
  64. package/dist/node/Config.d.mts.map +1 -0
  65. package/dist/node/Config.d.ts +27 -0
  66. package/dist/node/Config.d.ts.map +1 -0
  67. package/dist/node/Params.d.cts +8 -0
  68. package/dist/node/Params.d.cts.map +1 -0
  69. package/dist/node/Params.d.mts +8 -0
  70. package/dist/node/Params.d.mts.map +1 -0
  71. package/dist/node/Params.d.ts +8 -0
  72. package/dist/node/Params.d.ts.map +1 -0
  73. package/dist/node/Schema.d.cts +9 -0
  74. package/dist/node/Schema.d.cts.map +1 -0
  75. package/dist/node/Schema.d.mts +9 -0
  76. package/dist/node/Schema.d.mts.map +1 -0
  77. package/dist/node/Schema.d.ts +9 -0
  78. package/dist/node/Schema.d.ts.map +1 -0
  79. package/dist/node/index.d.cts +5 -0
  80. package/dist/node/index.d.cts.map +1 -0
  81. package/dist/node/index.d.mts +5 -0
  82. package/dist/node/index.d.mts.map +1 -0
  83. package/dist/node/index.d.ts +5 -0
  84. package/dist/node/index.d.ts.map +1 -0
  85. package/dist/node/index.js +38 -0
  86. package/dist/node/index.js.map +1 -0
  87. package/dist/node/index.mjs +10 -0
  88. package/dist/node/index.mjs.map +1 -0
  89. package/dist/node/jsonpath/JsonPathTransformExpression.d.cts +20 -0
  90. package/dist/node/jsonpath/JsonPathTransformExpression.d.cts.map +1 -0
  91. package/dist/node/jsonpath/JsonPathTransformExpression.d.mts +20 -0
  92. package/dist/node/jsonpath/JsonPathTransformExpression.d.mts.map +1 -0
  93. package/dist/node/jsonpath/JsonPathTransformExpression.d.ts +20 -0
  94. package/dist/node/jsonpath/JsonPathTransformExpression.d.ts.map +1 -0
  95. package/dist/node/jsonpath/PayloadTransformer.d.cts +3 -0
  96. package/dist/node/jsonpath/PayloadTransformer.d.cts.map +1 -0
  97. package/dist/node/jsonpath/PayloadTransformer.d.mts +3 -0
  98. package/dist/node/jsonpath/PayloadTransformer.d.mts.map +1 -0
  99. package/dist/node/jsonpath/PayloadTransformer.d.ts +3 -0
  100. package/dist/node/jsonpath/PayloadTransformer.d.ts.map +1 -0
  101. package/dist/node/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.cts +12 -0
  102. package/dist/node/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.cts.map +1 -0
  103. package/dist/node/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.mts +12 -0
  104. package/dist/node/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.mts.map +1 -0
  105. package/dist/node/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.ts +12 -0
  106. package/dist/node/jsonpath/SchemaToJsonPathTransformExpressionDictionary.d.ts.map +1 -0
  107. package/dist/node/jsonpath/SchemaToPayloadTransformersDictionary.d.cts +8 -0
  108. package/dist/node/jsonpath/SchemaToPayloadTransformersDictionary.d.cts.map +1 -0
  109. package/dist/node/jsonpath/SchemaToPayloadTransformersDictionary.d.mts +8 -0
  110. package/dist/node/jsonpath/SchemaToPayloadTransformersDictionary.d.mts.map +1 -0
  111. package/dist/node/jsonpath/SchemaToPayloadTransformersDictionary.d.ts +8 -0
  112. package/dist/node/jsonpath/SchemaToPayloadTransformersDictionary.d.ts.map +1 -0
  113. package/dist/node/jsonpath/index.d.cts +5 -0
  114. package/dist/node/jsonpath/index.d.cts.map +1 -0
  115. package/dist/node/jsonpath/index.d.mts +5 -0
  116. package/dist/node/jsonpath/index.d.mts.map +1 -0
  117. package/dist/node/jsonpath/index.d.ts +5 -0
  118. package/dist/node/jsonpath/index.d.ts.map +1 -0
  119. package/package.json +64 -0
  120. package/src/Config.ts +29 -0
  121. package/src/Params.ts +9 -0
  122. package/src/Schema.ts +8 -0
  123. package/src/index.ts +4 -0
  124. package/src/jsonpath/JsonPathTransformExpression.ts +20 -0
  125. package/src/jsonpath/PayloadTransformer.ts +3 -0
  126. package/src/jsonpath/SchemaToJsonPathTransformExpressionDictionary.ts +8 -0
  127. package/src/jsonpath/SchemaToPayloadTransformersDictionary.ts +6 -0
  128. package/src/jsonpath/index.ts +4 -0
  129. package/typedoc.json +5 -0
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@xyo-network/diviner-jsonpath-aggregate-model",
3
+ "author": {
4
+ "email": "support@xyo.network",
5
+ "name": "XYO Development Team",
6
+ "url": "https://xyo.network"
7
+ },
8
+ "bugs": {
9
+ "email": "support@xyo.network",
10
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
11
+ },
12
+ "dependencies": {
13
+ "@xyo-network/core": "~2.83.0",
14
+ "@xyo-network/diviner-model": "~2.83.0",
15
+ "@xyo-network/module-model": "~2.83.0",
16
+ "@xyo-network/payload-model": "~2.83.0"
17
+ },
18
+ "devDependencies": {
19
+ "@xylabs/ts-scripts-yarn3": "^3.2.10",
20
+ "@xylabs/tsconfig": "^3.2.10",
21
+ "typescript": "^5.3.2"
22
+ },
23
+ "description": "Primary SDK for using XYO Protocol 2.0",
24
+ "docs": "dist/docs.json",
25
+ "types": "dist/node/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "browser": {
29
+ "require": {
30
+ "types": "./dist/browser/index.d.cts",
31
+ "default": "./dist/browser/index.cjs"
32
+ },
33
+ "import": {
34
+ "types": "./dist/browser/index.d.mts",
35
+ "default": "./dist/browser/index.js"
36
+ }
37
+ },
38
+ "node": {
39
+ "require": {
40
+ "types": "./dist/node/index.d.ts",
41
+ "default": "./dist/node/index.js"
42
+ },
43
+ "import": {
44
+ "types": "./dist/node/index.d.mts",
45
+ "default": "./dist/node/index.mjs"
46
+ }
47
+ }
48
+ },
49
+ "./package.json": "./package.json"
50
+ },
51
+ "main": "dist/node/index.js",
52
+ "module": "dist/node/index.mjs",
53
+ "homepage": "https://xyo.network",
54
+ "license": "LGPL-3.0-only",
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
61
+ },
62
+ "sideEffects": false,
63
+ "version": "2.83.0"
64
+ }
package/src/Config.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { DivinerConfig } from '@xyo-network/diviner-model'
2
+
3
+ import { SchemaToJsonPathTransformExpressionsDictionary } from './jsonpath'
4
+ import { JsonPathAggregateDivinerSchema } from './Schema'
5
+
6
+ /**
7
+ * The config schema type for the JSON Path diviner
8
+ */
9
+ export type JsonPathAggregateDivinerConfigSchema = `${JsonPathAggregateDivinerSchema}.config`
10
+ /**
11
+ * The config schema for the JSON Path diviner
12
+ */
13
+ export const JsonPathAggregateDivinerConfigSchema: JsonPathAggregateDivinerConfigSchema = `${JsonPathAggregateDivinerSchema}.config`
14
+
15
+ /**
16
+ * The configuration for the JSON Path diviner
17
+ */
18
+ export type JsonPathAggregateDivinerConfig = DivinerConfig<
19
+ {
20
+ /**
21
+ * The schema to use for the destination payloads
22
+ */
23
+ destinationSchema?: string
24
+ /**
25
+ * The JSON Path transform expressions to apply to the payloads
26
+ */
27
+ schemaTransforms?: SchemaToJsonPathTransformExpressionsDictionary
28
+ } & { schema: JsonPathAggregateDivinerConfigSchema }
29
+ >
package/src/Params.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { DivinerParams } from '@xyo-network/diviner-model'
2
+ import { AnyConfigSchema } from '@xyo-network/module-model'
3
+
4
+ import { JsonPathAggregateDivinerConfig } from './Config'
5
+
6
+ /**
7
+ * The params type the JSON Path diviner
8
+ **/
9
+ export type JsonPathAggregateDivinerParams = DivinerParams<AnyConfigSchema<JsonPathAggregateDivinerConfig>>
package/src/Schema.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The schema type used for the JSONPath Diviner.
3
+ */
4
+ export type JsonPathAggregateDivinerSchema = 'network.xyo.diviner.jsonpath'
5
+ /**
6
+ * The schema used for the JSONPath Diviner.
7
+ */
8
+ export const JsonPathAggregateDivinerSchema: JsonPathAggregateDivinerSchema = 'network.xyo.diviner.jsonpath'
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './Config'
2
+ export * from './jsonpath'
3
+ export * from './Params'
4
+ export * from './Schema'
@@ -0,0 +1,20 @@
1
+ import { JsonValue } from '@xyo-network/core'
2
+
3
+ /**
4
+ * Describes the JSON-path transformation to retrieve a field on a source object
5
+ * and the target field to store the value to on a destination object
6
+ */
7
+ export interface JsonPathTransformExpression {
8
+ /**
9
+ * The default value to use if the source field does not exist
10
+ */
11
+ defaultValue?: JsonValue
12
+ /**
13
+ * The target field to store the source field into on the destination object
14
+ */
15
+ destinationField: string
16
+ /**
17
+ * The JSON path expressions for the source field on the source object
18
+ */
19
+ sourcePathExpression: string
20
+ }
@@ -0,0 +1,3 @@
1
+ import { Payload } from '@xyo-network/payload-model'
2
+
3
+ export type PayloadTransformer = (x: Payload) => Partial<Payload>
@@ -0,0 +1,8 @@
1
+ import { JsonPathTransformExpression } from './JsonPathTransformExpression'
2
+
3
+ /**
4
+ * A dictionary of schema to JSON Path transform expressions.
5
+ */
6
+ export type SchemaToJsonPathTransformExpressionsDictionary<T extends { [schema: string]: unknown } = { [schema: string]: unknown }> = {
7
+ [key in keyof T]: JsonPathTransformExpression[]
8
+ }
@@ -0,0 +1,6 @@
1
+ import { PayloadTransformer } from './PayloadTransformer'
2
+
3
+ /**
4
+ * A dictionary of schema to payload transformers
5
+ */
6
+ export type SchemaToPayloadTransformersDictionary = { [schema: string]: PayloadTransformer[] }
@@ -0,0 +1,4 @@
1
+ export * from './JsonPathTransformExpression'
2
+ export * from './PayloadTransformer'
3
+ export * from './SchemaToJsonPathTransformExpressionDictionary'
4
+ export * from './SchemaToPayloadTransformersDictionary'
package/typedoc.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "entryPoints": ["src/index.ts"],
4
+ "tsconfig": "./tsconfig.typedoc.json"
5
+ }