@api3/commons 0.1.0 → 0.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/README.md +17 -19
- package/dist/eslint/jest.d.ts +1 -0
- package/dist/eslint/jest.js +1 -0
- package/dist/eslint/jest.js.map +1 -1
- package/dist/eslint/react.d.ts +0 -1
- package/dist/eslint/react.js +0 -1
- package/dist/eslint/react.js.map +1 -1
- package/dist/eslint/universal.d.ts +1 -5
- package/dist/eslint/universal.js +2 -19
- package/dist/eslint/universal.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/logger/index.d.ts +9 -20
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +28 -12
- package/dist/logger/index.js.map +1 -1
- package/dist/processing/index.d.ts +4 -0
- package/dist/processing/index.d.ts.map +1 -0
- package/dist/processing/index.js +20 -0
- package/dist/processing/index.js.map +1 -0
- package/dist/processing/processing.d.ts +39 -0
- package/dist/processing/processing.d.ts.map +1 -0
- package/dist/processing/processing.js +122 -0
- package/dist/processing/processing.js.map +1 -0
- package/dist/processing/schema.d.ts +3 -0
- package/dist/processing/schema.d.ts.map +1 -0
- package/dist/processing/schema.js +12 -0
- package/dist/processing/schema.js.map +1 -0
- package/dist/processing/unsafe-evaluate.d.ts +50 -0
- package/dist/processing/unsafe-evaluate.d.ts.map +1 -0
- package/dist/processing/unsafe-evaluate.js +178 -0
- package/dist/processing/unsafe-evaluate.js.map +1 -0
- package/dist/processing/vm-timers.d.ts +21 -0
- package/dist/processing/vm-timers.d.ts.map +1 -0
- package/dist/processing/vm-timers.js +54 -0
- package/dist/processing/vm-timers.js.map +1 -0
- package/package.json +8 -11
- package/src/eslint/README.md +0 -5
- package/src/eslint/jest.js +1 -0
- package/src/eslint/react.js +0 -1
- package/src/eslint/universal.js +2 -20
- package/src/index.ts +3 -2
- package/src/logger/README.md +1 -2
- package/src/logger/index.ts +37 -15
- package/src/processing/README.md +45 -0
- package/src/processing/index.ts +3 -0
- package/src/processing/processing.test.ts +272 -0
- package/src/processing/processing.ts +160 -0
- package/src/processing/schema.ts +10 -0
- package/src/processing/unsafe-evaluate.test.ts +103 -0
- package/src/processing/unsafe-evaluate.ts +178 -0
- package/src/processing/vm-timers.ts +58 -0
package/README.md
CHANGED
|
@@ -30,25 +30,13 @@ Read the documentation of each module how to use it in the project.
|
|
|
30
30
|
|
|
31
31
|
### Import paths
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
There are two options how to import the commons modules, depending on the module resolution:
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
-
|
|
37
|
-
// and not like this
|
|
36
|
+
// 1) Import relative to the "node_modules" directory.
|
|
38
37
|
import { createLogger } from '@api3/commons/dist/logger';
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
This is done via `package.json` field called [exports](https://nodejs.org/api/packages.html#package-entry-points). This
|
|
42
|
-
field works for both CJS and ESM starting from Node version 12. In order for TS to support this, you need to make sure
|
|
43
|
-
you use `moduleResolution` and `module` set to `Node16`:
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"compilerOptions": {
|
|
48
|
-
"module": "Node16",
|
|
49
|
-
"moduleResolution": "Node16"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
38
|
+
// 2) Cleaner imports based on the "exports" field in "package.json".
|
|
39
|
+
import { createLogger } from '@api3/commons/logger';
|
|
52
40
|
```
|
|
53
41
|
|
|
54
42
|
## Release
|
|
@@ -68,11 +56,21 @@ To release a new version follow these steps:
|
|
|
68
56
|
|
|
69
57
|
1. Create a new directory in `src` with the name of the utility.
|
|
70
58
|
2. Create `index.ts` file in the directory. This file will be the entry point for the utility.
|
|
71
|
-
3.
|
|
72
|
-
[exports](https://nodejs.org/api/packages.html#package-entry-points) for more information.
|
|
59
|
+
3. Re-export the new utility from the root `index.ts` file.
|
|
73
60
|
4. Create a `README.md` with documentation.
|
|
74
61
|
|
|
75
|
-
|
|
62
|
+
#### Testing the package locally
|
|
63
|
+
|
|
64
|
+
It is preferred (simpler and faster) to test the package using the `file:` protocol.
|
|
65
|
+
|
|
66
|
+
1. Implement some changes and run `pnpm run build` to build the commons package.
|
|
67
|
+
2. In some other project, specify `file:<RELATIVE_PATH_TO_COMMONS>`. For example: `"@api3/commons": "file:../commons"`.
|
|
68
|
+
3. Re-install the dependencies in the project (doesn't matter what package manager you use). For example: `pnpm i`.
|
|
69
|
+
|
|
70
|
+
You can repeat the above steps as many times as you want. The package will be re-installed from the local directory with
|
|
71
|
+
the locally built content.
|
|
72
|
+
|
|
73
|
+
##### Using Verdaccio
|
|
76
74
|
|
|
77
75
|
The common pattern is to move some part of implementation to commons and then use it in some other repo. It is valuable
|
|
78
76
|
to see whether nothing broke in the process (before publishing the package). You can use
|
package/dist/eslint/jest.d.ts
CHANGED
package/dist/eslint/jest.js
CHANGED
package/dist/eslint/jest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../../src/eslint/jest.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,QAAQ,EAAE,8CAA8C;KACrE;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,8DAA8D;IAC9D,SAAS,EAAE;QACT;YACE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,CAAC;YACzE,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;aACX;YACD,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAClE,KAAK,EAAE;gBACL,+BAA+B,EAAE,KAAK;gBACtC,kBAAkB,EAAE,KAAK;gBACzB,iCAAiC,EAAE,KAAK;gBACxC,kBAAkB,EAAE,KAAK;gBACzB,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE;oBACf,OAAO;oBACP;wBACE,KAAK,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC;qBACjC;iBACF;
|
|
1
|
+
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../../src/eslint/jest.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,QAAQ,EAAE,8CAA8C;KACrE;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,8DAA8D;IAC9D,SAAS,EAAE;QACT;YACE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,CAAC;YACzE,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;aACX;YACD,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAClE,KAAK,EAAE;gBACL,+BAA+B,EAAE,KAAK;gBACtC,kBAAkB,EAAE,KAAK;gBACzB,iCAAiC,EAAE,KAAK;gBACxC,kBAAkB,EAAE,KAAK;gBACzB,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE;oBACf,OAAO;oBACP;wBACE,KAAK,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC;qBACjC;iBACF;gBACD,wBAAwB,EAAE,KAAK,EAAE,yGAAyG;aAC3I;SACF;KACF;CACF,CAAC"}
|
package/dist/eslint/react.d.ts
CHANGED
package/dist/eslint/react.js
CHANGED
|
@@ -41,7 +41,6 @@ module.exports = {
|
|
|
41
41
|
'react/destructuring-assignment': ['error', 'always', { destructureInSignature: 'ignore' }],
|
|
42
42
|
'react/forbid-component-props': ['error', { forbid: [] }],
|
|
43
43
|
'react/forbid-dom-props': ['error', { forbid: [] }],
|
|
44
|
-
'react/function-component-definition': 'off',
|
|
45
44
|
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never', propElementValues: 'always' }],
|
|
46
45
|
'react/jsx-curly-newline': 'off',
|
|
47
46
|
'react/jsx-filename-extension': 'off',
|
package/dist/eslint/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/eslint/react.js"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEpC,8DAA8D;AAC9D,MAAM,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/F,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE;YACZ,GAAG,EAAE,IAAI,EAAE,sBAAsB;SAClC;QACD,UAAU,EAAE,QAAQ,EAAE,mCAAmC;KAC1D;IACD,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ,EAAE,6CAA6C;SACjE;KACF;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,OAAO,EAAE,CAAC,kBAAkB,EAAE,gCAAgC,CAAC;IAC/D,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,CAAC;IAC5D,KAAK,EAAE;QACL,cAAc,EAAE;YACd,OAAO;YACP,KAAK,CAAC,EAAE,EAAE,0BAA0B,EAAE;gBACpC,4BAA4B;gBAC5B,UAAU,EAAE;oBACV;wBACE,OAAO,EAAE,OAAO;wBAChB,KAAK,EAAE,SAAS;wBAChB,QAAQ,EAAE,QAAQ;qBACnB;iBACF;aACF,CAAC;SAC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;wBACb,WAAW,EAAE,CAAC,SAAS,CAAC;wBACxB,OAAO,EACL,uHAAuH;qBAC1H;iBACF;aACF,CAAC;SACH;QAED,mCAAmC;QACnC,qBAAqB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3C;CACF,CAAC"}
|
|
@@ -54,11 +54,6 @@ export declare let rules: {
|
|
|
54
54
|
markers: string[];
|
|
55
55
|
};
|
|
56
56
|
})[];
|
|
57
|
-
'prefer-arrow/prefer-arrow-functions': (string | {
|
|
58
|
-
disallowPrototype: boolean;
|
|
59
|
-
singleReturnOnly: boolean;
|
|
60
|
-
classPropertiesAllowed: boolean;
|
|
61
|
-
})[];
|
|
62
57
|
'check-file/folder-naming-convention': (string | {
|
|
63
58
|
'**/': string;
|
|
64
59
|
})[];
|
|
@@ -72,6 +67,7 @@ export declare let rules: {
|
|
|
72
67
|
'unicorn/no-array-reduce': string;
|
|
73
68
|
'unicorn/no-nested-ternary': string;
|
|
74
69
|
'unicorn/no-null': string;
|
|
70
|
+
'unicorn/no-object-as-default-parameter': string;
|
|
75
71
|
'unicorn/no-useless-undefined': (string | {
|
|
76
72
|
checkArguments: boolean;
|
|
77
73
|
})[];
|
package/dist/eslint/universal.js
CHANGED
|
@@ -20,16 +20,7 @@ module.exports = {
|
|
|
20
20
|
'plugin:promise/recommended',
|
|
21
21
|
'plugin:lodash/recommended',
|
|
22
22
|
],
|
|
23
|
-
plugins: [
|
|
24
|
-
'@typescript-eslint',
|
|
25
|
-
'deprecation',
|
|
26
|
-
'functional',
|
|
27
|
-
'prefer-arrow',
|
|
28
|
-
'unicorn',
|
|
29
|
-
'check-file',
|
|
30
|
-
'import',
|
|
31
|
-
'lodash',
|
|
32
|
-
],
|
|
23
|
+
plugins: ['@typescript-eslint', 'deprecation', 'functional', 'unicorn', 'check-file', 'import', 'lodash'],
|
|
33
24
|
rules: {
|
|
34
25
|
/* Rule definitions and overrides for standard ESLint rules */
|
|
35
26
|
camelcase: 'error',
|
|
@@ -77,15 +68,6 @@ module.exports = {
|
|
|
77
68
|
},
|
|
78
69
|
},
|
|
79
70
|
],
|
|
80
|
-
/* Rules to setup enforcement of arrow functions over regular functions */
|
|
81
|
-
'prefer-arrow/prefer-arrow-functions': [
|
|
82
|
-
'error',
|
|
83
|
-
{
|
|
84
|
-
disallowPrototype: true,
|
|
85
|
-
singleReturnOnly: false,
|
|
86
|
-
classPropertiesAllowed: false,
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
71
|
/* Rules to enforce kebab-case folder structure */
|
|
90
72
|
'check-file/folder-naming-convention': [
|
|
91
73
|
'error',
|
|
@@ -107,6 +89,7 @@ module.exports = {
|
|
|
107
89
|
'unicorn/no-array-reduce': 'off',
|
|
108
90
|
'unicorn/no-nested-ternary': 'off',
|
|
109
91
|
'unicorn/no-null': 'off',
|
|
92
|
+
'unicorn/no-object-as-default-parameter': 'off',
|
|
110
93
|
'unicorn/no-useless-undefined': ['error', { checkArguments: false }],
|
|
111
94
|
'unicorn/prefer-module': 'off',
|
|
112
95
|
'unicorn/prevent-abbreviations': 'off',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal.js","sourceRoot":"","sources":["../../src/eslint/universal.js"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,MAAM,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/F,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;QACjB,UAAU,EAAE,QAAQ,EAAE,iCAAiC;KACxD;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,OAAO,EAAE;QACP,oBAAoB;QACpB,+BAA+B;QAC/B,2BAA2B;QAC3B,0BAA0B;QAC1B,4BAA4B;QAC5B,4BAA4B;QAC5B,2BAA2B;KAC5B;IACD,OAAO,EAAE
|
|
1
|
+
{"version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QACjH,yCAAyC,EAAE,KAAK;QAChD,yCAAyC,EAAE,KAAK;QAChD,8CAA8C,EAAE;YAC9C,OAAO;YACP;gBACE,sBAAsB,EAAE,IAAI,EAAE,+DAA+D;aAC9F;SACF;QACD,oDAAoD,EAAE,KAAK;QAC3D,2BAA2B,EAAE,KAAK;QAClC,yBAAyB,EAAE,KAAK;QAChC,gDAAgD,EAAE,KAAK;QACvD,+CAA+C,EAAE,KAAK;QACtD,mCAAmC,EAAE,KAAK;QAE1C,4CAA4C;QAC5C,uBAAuB,EAAE,OAAO;QAChC,8BAA8B,EAAE,OAAO;QACvC,8BAA8B,EAAE,OAAO;QACvC,yBAAyB,EAAE,KAAK;QAEhC,mCAAmC;QACnC,qBAAqB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC1C,mBAAmB,EAAE,KAAK;QAC1B,6BAA6B,EAAE,KAAK;QAEpC,gDAAgD;QAChD,sEAAsE;QACtE,+DAA+D;QAC/D,yBAAyB,EAAE,OAAO;KACnC;IACD,SAAS,EAAE;QACT,4BAA4B;QAC5B;YACE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;YACxC,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;aACX;YACD,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAClE,KAAK,EAAE;gBACL,+BAA+B,EAAE,KAAK;gBACtC,kBAAkB,EAAE,KAAK;gBACzB,iCAAiC,EAAE,KAAK;gBACxC,kBAAkB,EAAE,KAAK;gBACzB,kBAAkB,EAAE,KAAK,EAAE,uDAAuD;aACnF;SACF;KACF;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// NOTE: Not exporting ESLint rules because they need to be imported in a special way inside .eslintrc.js config.
|
|
18
|
+
__exportStar(require("./logger"), exports);
|
|
19
|
+
__exportStar(require("./processing"), exports);
|
|
4
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iHAAiH;AACjH,2CAAyB;AACzB,+CAA6B"}
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export declare const logConfigSchema: z.ZodObject<{
|
|
7
|
-
colorize: z.ZodBoolean;
|
|
8
|
-
enabled: z.ZodBoolean;
|
|
9
|
-
format: z.ZodUnion<[z.ZodLiteral<"json">, z.ZodLiteral<"pretty">]>;
|
|
10
|
-
minLevel: z.ZodUnion<[z.ZodLiteral<"debug">, z.ZodLiteral<"info">, z.ZodLiteral<"warn">, z.ZodLiteral<"error">]>;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
1
|
+
export declare const logFormatOptions: readonly ["json", "pretty"];
|
|
2
|
+
export type LogFormat = (typeof logFormatOptions)[number];
|
|
3
|
+
export declare const logLevelOptions: readonly ["debug", "info", "warn", "error"];
|
|
4
|
+
export type LogLevel = (typeof logLevelOptions)[number];
|
|
5
|
+
export interface LogConfig {
|
|
12
6
|
colorize: boolean;
|
|
13
7
|
enabled: boolean;
|
|
14
|
-
format:
|
|
15
|
-
minLevel:
|
|
16
|
-
}
|
|
17
|
-
colorize: boolean;
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
format: "json" | "pretty";
|
|
20
|
-
minLevel: "error" | "info" | "debug" | "warn";
|
|
21
|
-
}>;
|
|
22
|
-
export type LogConfig = z.infer<typeof logConfigSchema>;
|
|
8
|
+
format: LogFormat;
|
|
9
|
+
minLevel: LogLevel;
|
|
10
|
+
}
|
|
23
11
|
export type LogContext = Record<string, any>;
|
|
24
12
|
export interface Logger {
|
|
25
13
|
debug: (message: string, context?: LogContext) => void;
|
|
@@ -30,5 +18,6 @@ export interface Logger {
|
|
|
30
18
|
name: string;
|
|
31
19
|
}) => Logger;
|
|
32
20
|
}
|
|
21
|
+
export declare const validateLogConfig: (config: unknown) => LogConfig;
|
|
33
22
|
export declare const createLogger: (config: LogConfig) => Logger;
|
|
34
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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D,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,SAAS,WAG7C,CAAC"}
|
package/dist/logger/index.js
CHANGED
|
@@ -3,18 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createLogger = exports.
|
|
6
|
+
exports.createLogger = exports.validateLogConfig = exports.logLevelOptions = exports.logFormatOptions = void 0;
|
|
7
7
|
const winston_1 = __importDefault(require("winston"));
|
|
8
8
|
const winston_console_format_1 = require("winston-console-format");
|
|
9
|
-
|
|
10
|
-
exports.
|
|
11
|
-
exports.logLevelSchema = zod_1.z.union([zod_1.z.literal('debug'), zod_1.z.literal('info'), zod_1.z.literal('warn'), zod_1.z.literal('error')]);
|
|
12
|
-
exports.logConfigSchema = zod_1.z.object({
|
|
13
|
-
colorize: zod_1.z.boolean(),
|
|
14
|
-
enabled: zod_1.z.boolean(),
|
|
15
|
-
format: exports.logFormatSchema,
|
|
16
|
-
minLevel: exports.logLevelSchema,
|
|
17
|
-
});
|
|
9
|
+
exports.logFormatOptions = ['json', 'pretty'];
|
|
10
|
+
exports.logLevelOptions = ['debug', 'info', 'warn', 'error'];
|
|
18
11
|
const createConsoleTransport = (config) => {
|
|
19
12
|
const { colorize, enabled, format } = config;
|
|
20
13
|
if (!enabled) {
|
|
@@ -77,9 +70,32 @@ const wrapper = (logger) => {
|
|
|
77
70
|
child: (options) => wrapper(logger.child(options)),
|
|
78
71
|
};
|
|
79
72
|
};
|
|
73
|
+
const validateLogConfig = (config) => {
|
|
74
|
+
// eslint-disable-next-line lodash/prefer-lodash-typecheck
|
|
75
|
+
if (typeof config !== 'object' || config === null) {
|
|
76
|
+
throw new Error('Invalid logger configuration');
|
|
77
|
+
}
|
|
78
|
+
const { colorize, enabled, format, minLevel } = config;
|
|
79
|
+
// eslint-disable-next-line lodash/prefer-lodash-typecheck
|
|
80
|
+
if (typeof colorize !== 'boolean') {
|
|
81
|
+
throw new TypeError('Invalid logger configuration: colorize must be a boolean');
|
|
82
|
+
}
|
|
83
|
+
// eslint-disable-next-line lodash/prefer-lodash-typecheck
|
|
84
|
+
if (typeof enabled !== 'boolean') {
|
|
85
|
+
throw new TypeError('Invalid logger configuration: enabled must be a boolean');
|
|
86
|
+
}
|
|
87
|
+
if (!exports.logFormatOptions.includes(format)) {
|
|
88
|
+
throw new TypeError('Invalid logger configuration: format must be one of "json" or "pretty"');
|
|
89
|
+
}
|
|
90
|
+
if (!exports.logLevelOptions.includes(minLevel)) {
|
|
91
|
+
throw new TypeError('Invalid logger configuration: minLevel must be one of "debug", "info", "warn" or "error"');
|
|
92
|
+
}
|
|
93
|
+
return config;
|
|
94
|
+
};
|
|
95
|
+
exports.validateLogConfig = validateLogConfig;
|
|
80
96
|
const createLogger = (config) => {
|
|
81
|
-
// Ensure that the configuration is valid
|
|
82
|
-
return wrapper(createBaseLogger(exports.
|
|
97
|
+
// Ensure that the logger configuration is valid.
|
|
98
|
+
return wrapper(createBaseLogger((0, exports.validateLogConfig)(config)));
|
|
83
99
|
};
|
|
84
100
|
exports.createLogger = createLogger;
|
|
85
101
|
//# sourceMappingURL=index.js.map
|
package/dist/logger/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,mEAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,mEAAuD;AAE1C,QAAA,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AAI/C,QAAA,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAW3E,MAAM,sBAAsB,GAAG,CAAC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ACjH;IAED,OAAO,MAAmB,CAAC;AAC7B,CAAC,CAAC;AAvBW,QAAA,iBAAiB,qBAuB5B;AAEK,MAAM,YAAY,GAAG,CAAC,MAAiB,EAAE,EAAE;IAChD,iDAAiD;IACjD,OAAO,OAAO,CAAC,gBAAgB,CAAC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/processing/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./processing"), exports);
|
|
18
|
+
__exportStar(require("./schema"), exports);
|
|
19
|
+
__exportStar(require("./unsafe-evaluate"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/processing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Endpoint } from '@api3/ois';
|
|
2
|
+
import { type GoAsyncOptions } from '@api3/promise-utils';
|
|
3
|
+
import { type ApiCallParameters } from './schema';
|
|
4
|
+
export declare const DEFAULT_PROCESSING_TIMEOUT_MS = 10000;
|
|
5
|
+
/**
|
|
6
|
+
* Removes reserved parameters from the parameters object.
|
|
7
|
+
* @param parameters The API call parameters from which reserved parameters will be removed.
|
|
8
|
+
* @returns The parameters object without reserved parameters.
|
|
9
|
+
*/
|
|
10
|
+
export declare const removeReservedParameters: (parameters: ApiCallParameters) => ApiCallParameters;
|
|
11
|
+
/**
|
|
12
|
+
* Re-inserts reserved parameters from the initial parameters object into the modified parameters object.
|
|
13
|
+
* @param initialParameters The initial API call parameters that might contain reserved parameters.
|
|
14
|
+
* @param modifiedParameters The modified API call parameters to which reserved parameters will be added.
|
|
15
|
+
* @returns The modified parameters object with re-inserted reserved parameters.
|
|
16
|
+
*/
|
|
17
|
+
export declare const addReservedParameters: (initialParameters: ApiCallParameters, modifiedParameters: ApiCallParameters) => ApiCallParameters;
|
|
18
|
+
/**
|
|
19
|
+
* Pre-processes API call parameters based on the provided endpoint's processing specifications.
|
|
20
|
+
*
|
|
21
|
+
* @param endpoint The endpoint containing processing specifications.
|
|
22
|
+
* @param apiCallParameters The parameters to be pre-processed.
|
|
23
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
24
|
+
*
|
|
25
|
+
* @returns A promise that resolves to the pre-processed parameters.
|
|
26
|
+
*/
|
|
27
|
+
export declare const preProcessApiCallParameters: (endpoint: Endpoint, apiCallParameters: ApiCallParameters, processingOptions?: GoAsyncOptions) => Promise<ApiCallParameters>;
|
|
28
|
+
/**
|
|
29
|
+
* Post-processes the API call response based on the provided endpoint's processing specifications.
|
|
30
|
+
*
|
|
31
|
+
* @param apiCallResponse The raw response obtained from the API call.
|
|
32
|
+
* @param endpoint The endpoint containing processing specifications.
|
|
33
|
+
* @param apiCallParameters The parameters used in the API call.
|
|
34
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
35
|
+
*
|
|
36
|
+
* @returns A promise that resolves to the post-processed API call response.
|
|
37
|
+
*/
|
|
38
|
+
export declare const postProcessApiCallResponse: (apiCallResponse: unknown, endpoint: Endpoint, apiCallParameters: ApiCallParameters, processingOptions?: GoAsyncOptions) => Promise<unknown>;
|
|
39
|
+
//# sourceMappingURL=processing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing.d.ts","sourceRoot":"","sources":["../../src/processing/processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,KAAK,cAAc,EAAM,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,KAAK,iBAAiB,EAA6B,MAAM,UAAU,CAAC;AAG7E,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAIpD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,eAAgB,iBAAiB,KAAG,iBAUxE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,sBACb,iBAAiB,sBAChB,iBAAiB,KACpC,iBAQF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,aAC5B,QAAQ,qBACC,iBAAiB,sBACjB,cAAc,KAChC,QAAQ,iBAAiB,CA4C3B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,oBACpB,OAAO,YACd,QAAQ,qBACC,iBAAiB,sBACjB,cAAc,qBAwClC,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.postProcessApiCallResponse = exports.preProcessApiCallParameters = exports.addReservedParameters = exports.removeReservedParameters = exports.DEFAULT_PROCESSING_TIMEOUT_MS = void 0;
|
|
4
|
+
const ois_1 = require("@api3/ois");
|
|
5
|
+
const promise_utils_1 = require("@api3/promise-utils");
|
|
6
|
+
const schema_1 = require("./schema");
|
|
7
|
+
const unsafe_evaluate_1 = require("./unsafe-evaluate");
|
|
8
|
+
exports.DEFAULT_PROCESSING_TIMEOUT_MS = 10_000;
|
|
9
|
+
const reservedParameters = ois_1.RESERVED_PARAMETERS; // To avoid strict TS checks.
|
|
10
|
+
/**
|
|
11
|
+
* Removes reserved parameters from the parameters object.
|
|
12
|
+
* @param parameters The API call parameters from which reserved parameters will be removed.
|
|
13
|
+
* @returns The parameters object without reserved parameters.
|
|
14
|
+
*/
|
|
15
|
+
const removeReservedParameters = (parameters) => {
|
|
16
|
+
const result = {};
|
|
17
|
+
for (const key in parameters) {
|
|
18
|
+
if (!reservedParameters.includes(key)) {
|
|
19
|
+
result[key] = parameters[key];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
exports.removeReservedParameters = removeReservedParameters;
|
|
25
|
+
/**
|
|
26
|
+
* Re-inserts reserved parameters from the initial parameters object into the modified parameters object.
|
|
27
|
+
* @param initialParameters The initial API call parameters that might contain reserved parameters.
|
|
28
|
+
* @param modifiedParameters The modified API call parameters to which reserved parameters will be added.
|
|
29
|
+
* @returns The modified parameters object with re-inserted reserved parameters.
|
|
30
|
+
*/
|
|
31
|
+
const addReservedParameters = (initialParameters, modifiedParameters) => {
|
|
32
|
+
for (const key in initialParameters) {
|
|
33
|
+
if (reservedParameters.includes(key)) {
|
|
34
|
+
modifiedParameters[key] = initialParameters[key];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return modifiedParameters;
|
|
38
|
+
};
|
|
39
|
+
exports.addReservedParameters = addReservedParameters;
|
|
40
|
+
/**
|
|
41
|
+
* Pre-processes API call parameters based on the provided endpoint's processing specifications.
|
|
42
|
+
*
|
|
43
|
+
* @param endpoint The endpoint containing processing specifications.
|
|
44
|
+
* @param apiCallParameters The parameters to be pre-processed.
|
|
45
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
46
|
+
*
|
|
47
|
+
* @returns A promise that resolves to the pre-processed parameters.
|
|
48
|
+
*/
|
|
49
|
+
const preProcessApiCallParameters = async (endpoint, apiCallParameters, processingOptions = { retries: 0, totalTimeoutMs: exports.DEFAULT_PROCESSING_TIMEOUT_MS }) => {
|
|
50
|
+
const { preProcessingSpecifications } = endpoint;
|
|
51
|
+
if (!preProcessingSpecifications || preProcessingSpecifications.length === 0) {
|
|
52
|
+
return apiCallParameters;
|
|
53
|
+
}
|
|
54
|
+
// We only wrap the code through "go" utils because of the timeout and retry logic.
|
|
55
|
+
const goProcessedParameters = await (0, promise_utils_1.go)(async () => {
|
|
56
|
+
let currentValue = (0, exports.removeReservedParameters)(apiCallParameters);
|
|
57
|
+
for (const processing of preProcessingSpecifications) {
|
|
58
|
+
// Provide endpoint parameters without reserved parameters immutably between steps. Recompute them for each
|
|
59
|
+
// snippet independently because processing snippets can modify the parameters.
|
|
60
|
+
const endpointParameters = (0, exports.removeReservedParameters)(apiCallParameters);
|
|
61
|
+
switch (processing.environment) {
|
|
62
|
+
case 'Node': {
|
|
63
|
+
currentValue = await (0, unsafe_evaluate_1.unsafeEvaluate)(processing.value, { input: currentValue, endpointParameters }, processing.timeoutMs);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case 'Node async': {
|
|
67
|
+
currentValue = await (0, unsafe_evaluate_1.unsafeEvaluateAsync)(processing.value, { input: currentValue, endpointParameters }, processing.timeoutMs);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return currentValue;
|
|
73
|
+
}, processingOptions);
|
|
74
|
+
if (!goProcessedParameters.success)
|
|
75
|
+
throw goProcessedParameters.error;
|
|
76
|
+
// Let this throw if the processed parameters are invalid.
|
|
77
|
+
const parsedParameters = (0, schema_1.validateApiCallParameters)(goProcessedParameters.data);
|
|
78
|
+
// Having removed reserved parameters for pre-processing, we need to re-insert them for the API call.
|
|
79
|
+
return (0, exports.addReservedParameters)(apiCallParameters, parsedParameters);
|
|
80
|
+
};
|
|
81
|
+
exports.preProcessApiCallParameters = preProcessApiCallParameters;
|
|
82
|
+
/**
|
|
83
|
+
* Post-processes the API call response based on the provided endpoint's processing specifications.
|
|
84
|
+
*
|
|
85
|
+
* @param apiCallResponse The raw response obtained from the API call.
|
|
86
|
+
* @param endpoint The endpoint containing processing specifications.
|
|
87
|
+
* @param apiCallParameters The parameters used in the API call.
|
|
88
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
89
|
+
*
|
|
90
|
+
* @returns A promise that resolves to the post-processed API call response.
|
|
91
|
+
*/
|
|
92
|
+
const postProcessApiCallResponse = async (apiCallResponse, endpoint, apiCallParameters, processingOptions = { retries: 0, totalTimeoutMs: exports.DEFAULT_PROCESSING_TIMEOUT_MS }) => {
|
|
93
|
+
const { postProcessingSpecifications } = endpoint;
|
|
94
|
+
if (!postProcessingSpecifications || postProcessingSpecifications?.length === 0) {
|
|
95
|
+
return apiCallResponse;
|
|
96
|
+
}
|
|
97
|
+
// We only wrap the code through "go" utils because of the timeout and retry logic.
|
|
98
|
+
const goResult = await (0, promise_utils_1.go)(async () => {
|
|
99
|
+
let currentValue = apiCallResponse;
|
|
100
|
+
for (const processing of postProcessingSpecifications) {
|
|
101
|
+
// Provide endpoint parameters without reserved parameters immutably between steps. Recompute them for each
|
|
102
|
+
// snippet independently because processing snippets can modify the parameters.
|
|
103
|
+
const endpointParameters = (0, exports.removeReservedParameters)(apiCallParameters);
|
|
104
|
+
switch (processing.environment) {
|
|
105
|
+
case 'Node': {
|
|
106
|
+
currentValue = await (0, unsafe_evaluate_1.unsafeEvaluate)(processing.value, { input: currentValue, endpointParameters }, processing.timeoutMs);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case 'Node async': {
|
|
110
|
+
currentValue = await (0, unsafe_evaluate_1.unsafeEvaluateAsync)(processing.value, { input: currentValue, endpointParameters }, processing.timeoutMs);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return currentValue;
|
|
116
|
+
}, processingOptions);
|
|
117
|
+
if (!goResult.success)
|
|
118
|
+
throw goResult.error;
|
|
119
|
+
return goResult.data;
|
|
120
|
+
};
|
|
121
|
+
exports.postProcessApiCallResponse = postProcessApiCallResponse;
|
|
122
|
+
//# sourceMappingURL=processing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing.js","sourceRoot":"","sources":["../../src/processing/processing.ts"],"names":[],"mappings":";;;AAAA,mCAA+D;AAC/D,uDAA8D;AAE9D,qCAA6E;AAC7E,uDAAwE;AAE3D,QAAA,6BAA6B,GAAG,MAAM,CAAC;AAEpD,MAAM,kBAAkB,GAAG,yBAA+B,CAAC,CAAC,6BAA6B;AAEzF;;;;GAIG;AACI,MAAM,wBAAwB,GAAG,CAAC,UAA6B,EAAqB,EAAE;IAC3F,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;QAC5B,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACrC,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;SAC/B;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAVW,QAAA,wBAAwB,4BAUnC;AAEF;;;;;GAKG;AACI,MAAM,qBAAqB,GAAG,CACnC,iBAAoC,EACpC,kBAAqC,EAClB,EAAE;IACrB,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QACnC,IAAI,kBAAkB,CAAC,QAAQ,C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;oBACjB,YAAY,GAAG,MAAM,IAAA,qCAAmB,EACtC,UAAU,CAAC,KAAK,EAChB,EAAE,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAC3C,UAAU,CAAC,SAAS,CACrB,CAAC;oBACF,MAAM;iBACP;aACF;SACF;QAED,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,iBAAiB,CAAC,CAAC;IACtB,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,MAAM,QAAQ,CAAC,KAAK,CAAC;IAE5C,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AA5CW,QAAA,0BAA0B,8BA4CrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/processing/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,sBAAuB,OAAO,KAAG,iBAOtE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateApiCallParameters = void 0;
|
|
4
|
+
const validateApiCallParameters = (apiCallParameters) => {
|
|
5
|
+
// eslint-disable-next-line lodash/prefer-lodash-typecheck
|
|
6
|
+
if (typeof apiCallParameters !== 'object' || apiCallParameters === null) {
|
|
7
|
+
throw new TypeError('Invalid API call parameters');
|
|
8
|
+
}
|
|
9
|
+
return apiCallParameters;
|
|
10
|
+
};
|
|
11
|
+
exports.validateApiCallParameters = validateApiCallParameters;
|
|
12
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/processing/schema.ts"],"names":[],"mappings":";;;AAAO,MAAM,yBAAyB,GAAG,CAAC,iBAA0B,EAAqB,EAAE;IACzF,0DAA0D;IAC1D,IAAI,OAAO,iBAAiB,KAAK,QAAQ,IAAI,iBAAiB,KAAK,IAAI,EAAE;QACvE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;KACpD;IAED,OAAO,iBAAsC,CAAC;AAChD,CAAC,CAAC;AAPW,QAAA,yBAAyB,6BAOpC"}
|