@graphql-mesh/string-interpolation 0.4.2-alpha-20230110101449-24dddd33a → 0.4.2-alpha-20230110101550-e7c182bdb
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.
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getInterpolatedHeadersFactory = exports.getInterpolatedStringFactory = exports.parseInterpolationStrings = exports.getInterpolationKeys = void 0;
|
|
4
4
|
const index_js_1 = require("./index.js");
|
|
5
5
|
function getInterpolationKeys(...interpolationStrings) {
|
|
6
|
-
return interpolationStrings.reduce((keys, str) => [
|
|
6
|
+
return interpolationStrings.reduce((keys, str) => [
|
|
7
|
+
...keys,
|
|
8
|
+
...(str ? index_js_1.stringInterpolator.parseRules(str).map((match) => match.key) : []),
|
|
9
|
+
], []);
|
|
7
10
|
}
|
|
8
11
|
exports.getInterpolationKeys = getInterpolationKeys;
|
|
9
12
|
function parseInterpolationStrings(interpolationStrings, argTypeMap) {
|
|
@@ -14,7 +17,11 @@ function parseInterpolationStrings(interpolationStrings, argTypeMap) {
|
|
|
14
17
|
const interpolationKeyParts = interpolationKey.split('.');
|
|
15
18
|
const varName = interpolationKeyParts[interpolationKeyParts.length - 1];
|
|
16
19
|
const initialObject = interpolationKeyParts[0];
|
|
17
|
-
const argType = argTypeMap && varName in argTypeMap
|
|
20
|
+
const argType = argTypeMap && varName in argTypeMap
|
|
21
|
+
? argTypeMap[varName]
|
|
22
|
+
: interpolationKeyParts.length > 2
|
|
23
|
+
? 'JSON'
|
|
24
|
+
: 'ID';
|
|
18
25
|
switch (initialObject) {
|
|
19
26
|
case 'args':
|
|
20
27
|
args[varName] = {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { stringInterpolator } from './index.js';
|
|
2
2
|
export function getInterpolationKeys(...interpolationStrings) {
|
|
3
|
-
return interpolationStrings.reduce((keys, str) => [
|
|
3
|
+
return interpolationStrings.reduce((keys, str) => [
|
|
4
|
+
...keys,
|
|
5
|
+
...(str ? stringInterpolator.parseRules(str).map((match) => match.key) : []),
|
|
6
|
+
], []);
|
|
4
7
|
}
|
|
5
8
|
export function parseInterpolationStrings(interpolationStrings, argTypeMap) {
|
|
6
9
|
const interpolationKeys = getInterpolationKeys(...interpolationStrings);
|
|
@@ -10,7 +13,11 @@ export function parseInterpolationStrings(interpolationStrings, argTypeMap) {
|
|
|
10
13
|
const interpolationKeyParts = interpolationKey.split('.');
|
|
11
14
|
const varName = interpolationKeyParts[interpolationKeyParts.length - 1];
|
|
12
15
|
const initialObject = interpolationKeyParts[0];
|
|
13
|
-
const argType = argTypeMap && varName in argTypeMap
|
|
16
|
+
const argType = argTypeMap && varName in argTypeMap
|
|
17
|
+
? argTypeMap[varName]
|
|
18
|
+
: interpolationKeyParts.length > 2
|
|
19
|
+
? 'JSON'
|
|
20
|
+
: 'ID';
|
|
14
21
|
switch (initialObject) {
|
|
15
22
|
case 'args':
|
|
16
23
|
args[varName] = {
|
package/package.json
CHANGED