@graphql-mesh/string-interpolation 0.1.1-alpha-112a2a51f.0 → 0.2.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/CHANGELOG.md +7 -2
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/package.json +2 -3
- package/package.json +2 -3
- package/src/index.ts +3 -2
- package/src/interpolator.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# @graphql-mesh/string-interpolation
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 974e703e2: No longer import entire lodash library but instead individual smaller packages
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
|
-
-
|
|
11
|
+
- 974e703e2: Cleanup dependencies
|
|
12
|
+
- 974e703e2: Use deeper lodash imports to have better treeshaking and avoid using eval
|
|
8
13
|
|
|
9
14
|
## 0.1.0
|
|
10
15
|
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const lodashGet = _interopDefault(require('lodash.get'));
|
|
8
8
|
const JsonPointer = _interopDefault(require('json-pointer'));
|
|
9
9
|
const dayjs = _interopDefault(require('dayjs'));
|
|
10
|
-
const objectHash = _interopDefault(require('object-hash'));
|
|
11
10
|
|
|
12
11
|
const defaultOptions = {
|
|
13
12
|
delimiter: ['{', '}'],
|
|
@@ -142,7 +141,7 @@ class Interpolator {
|
|
|
142
141
|
}
|
|
143
142
|
applyData(key, data) {
|
|
144
143
|
const [prop, ptr] = key.split('#');
|
|
145
|
-
const propData =
|
|
144
|
+
const propData = lodashGet(data, prop);
|
|
146
145
|
if (ptr) {
|
|
147
146
|
try {
|
|
148
147
|
return JsonPointer.get(propData, ptr);
|
|
@@ -225,8 +224,9 @@ function getInterpolatedHeadersFactory(nonInterpolatedHeaders = {}) {
|
|
|
225
224
|
};
|
|
226
225
|
}
|
|
227
226
|
|
|
227
|
+
const hashCode = (s) => s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0);
|
|
228
228
|
function hashObject(value) {
|
|
229
|
-
return
|
|
229
|
+
return hashCode(JSON.stringify(value)).toString();
|
|
230
230
|
}
|
|
231
231
|
const stringInterpolator = new Interpolator({
|
|
232
232
|
delimiter: ['{', '}'],
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import lodashGet from 'lodash.get';
|
|
2
2
|
import JsonPointer from 'json-pointer';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
|
-
import objectHash from 'object-hash';
|
|
5
4
|
|
|
6
5
|
const defaultOptions = {
|
|
7
6
|
delimiter: ['{', '}'],
|
|
@@ -136,7 +135,7 @@ class Interpolator {
|
|
|
136
135
|
}
|
|
137
136
|
applyData(key, data) {
|
|
138
137
|
const [prop, ptr] = key.split('#');
|
|
139
|
-
const propData =
|
|
138
|
+
const propData = lodashGet(data, prop);
|
|
140
139
|
if (ptr) {
|
|
141
140
|
try {
|
|
142
141
|
return JsonPointer.get(propData, ptr);
|
|
@@ -219,8 +218,9 @@ function getInterpolatedHeadersFactory(nonInterpolatedHeaders = {}) {
|
|
|
219
218
|
};
|
|
220
219
|
}
|
|
221
220
|
|
|
221
|
+
const hashCode = (s) => s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0);
|
|
222
222
|
function hashObject(value) {
|
|
223
|
-
return
|
|
223
|
+
return hashCode(JSON.stringify(value)).toString();
|
|
224
224
|
}
|
|
225
225
|
const stringInterpolator = new Interpolator({
|
|
226
226
|
delimiter: ['{', '}'],
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/string-interpolation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Dynamic string manipulation",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"dayjs": "1.11.2",
|
|
11
11
|
"json-pointer": "0.6.2",
|
|
12
|
-
"lodash": "
|
|
13
|
-
"object-hash": "3.0.0"
|
|
12
|
+
"lodash.get": "4.4.2"
|
|
14
13
|
},
|
|
15
14
|
"repository": {
|
|
16
15
|
"type": "git",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/string-interpolation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Dynamic string manipulation",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"json-pointer": "0.6.2",
|
|
27
27
|
"dayjs": "1.11.2",
|
|
28
|
-
"
|
|
29
|
-
"lodash": "^4.17.21"
|
|
28
|
+
"lodash.get": "4.4.2"
|
|
30
29
|
},
|
|
31
30
|
"author": "Arda TANRIKULU <ardatanrikulu@gmail.com>",
|
|
32
31
|
"repository": {
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Interpolator } from './interpolator';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
const hashCode = (s: string) => s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0);
|
|
4
5
|
|
|
5
6
|
export function hashObject(value: any): string {
|
|
6
|
-
return
|
|
7
|
+
return hashCode(JSON.stringify(value)).toString();
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export { Interpolator };
|
package/src/interpolator.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultOptions } from './statics/DefaultOptions';
|
|
2
|
-
import
|
|
2
|
+
import lodashGet from 'lodash.get';
|
|
3
3
|
import { defaultModifiers } from './modifiers';
|
|
4
4
|
import JsonPointer from 'json-pointer';
|
|
5
5
|
|
|
@@ -137,7 +137,7 @@ export class Interpolator {
|
|
|
137
137
|
|
|
138
138
|
applyData(key, data) {
|
|
139
139
|
const [prop, ptr] = key.split('#');
|
|
140
|
-
const propData =
|
|
140
|
+
const propData = lodashGet(data, prop);
|
|
141
141
|
if (ptr) {
|
|
142
142
|
try {
|
|
143
143
|
return JsonPointer.get(propData, ptr);
|