@geins/crm 0.3.3 → 0.3.4
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 +10 -0
- package/dist/index.cjs +29 -6
- package/dist/index.esm.js +29 -6
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @geins/crm
|
|
2
2
|
|
|
3
|
+
## 0.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3cf633e: added settingvars to GraphQLService
|
|
8
|
+
- 3cf633e: ci fixes
|
|
9
|
+
- Updated dependencies [3cf633e]
|
|
10
|
+
- Updated dependencies [3cf633e]
|
|
11
|
+
- @geins/core@0.3.4
|
|
12
|
+
|
|
3
13
|
## 0.3.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -20745,6 +20745,26 @@ var GraphQLService = /** @class */ (function (_super) {
|
|
|
20745
20745
|
function GraphQLService(client, geinsSettings) {
|
|
20746
20746
|
return _super.call(this, client, geinsSettings) || this;
|
|
20747
20747
|
}
|
|
20748
|
+
GraphQLService.prototype.verifyQueryOptions = function (options) {
|
|
20749
|
+
var _a, _b, _c, _d;
|
|
20750
|
+
if (!options.query) {
|
|
20751
|
+
throw new Error('Query is required');
|
|
20752
|
+
}
|
|
20753
|
+
if (!(((_d = (_c = (_b = (_a = options.query) === null || _a === void 0 ? void 0 : _a.definitions) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.variableDefinitions) === null || _d === void 0 ? void 0 : _d.length) > 0)) {
|
|
20754
|
+
console.log('NO VARS');
|
|
20755
|
+
return options;
|
|
20756
|
+
}
|
|
20757
|
+
var queryOptions = __assign({}, options);
|
|
20758
|
+
queryOptions.variables = this.createVariables(queryOptions.variables);
|
|
20759
|
+
var queryVars = queryOptions.query.definitions[0].variableDefinitions.map(function (v) { return v.variable.name.value; });
|
|
20760
|
+
var providedVars = Object.keys(queryOptions.variables);
|
|
20761
|
+
providedVars.forEach(function (v) {
|
|
20762
|
+
if (!queryVars.includes(v)) {
|
|
20763
|
+
delete queryOptions.variables[v];
|
|
20764
|
+
}
|
|
20765
|
+
});
|
|
20766
|
+
return queryOptions;
|
|
20767
|
+
};
|
|
20748
20768
|
/**
|
|
20749
20769
|
* Generic method to run any GraphQL query
|
|
20750
20770
|
* @param query - The GraphQL query DocumentNode or gql query object
|
|
@@ -20754,22 +20774,25 @@ var GraphQLService = /** @class */ (function (_super) {
|
|
|
20754
20774
|
*/
|
|
20755
20775
|
GraphQLService.prototype.query = function (options) {
|
|
20756
20776
|
return __awaiter(this, void 0, void 0, function () {
|
|
20757
|
-
var result, _a, parsedResult, error_1;
|
|
20777
|
+
var queryOptions, result, _a, parsedResult, error_1;
|
|
20758
20778
|
return __generator(this, function (_b) {
|
|
20759
20779
|
switch (_b.label) {
|
|
20760
20780
|
case 0:
|
|
20761
|
-
_b.trys.push([0,
|
|
20762
|
-
|
|
20763
|
-
return [4 /*yield*/, this.runQuery(options)];
|
|
20781
|
+
_b.trys.push([0, 3, , 4]);
|
|
20782
|
+
return [4 /*yield*/, this.verifyQueryOptions(options)];
|
|
20764
20783
|
case 1:
|
|
20784
|
+
queryOptions = _b.sent();
|
|
20785
|
+
_a = this.cleanObject;
|
|
20786
|
+
return [4 /*yield*/, this.runQuery(queryOptions)];
|
|
20787
|
+
case 2:
|
|
20765
20788
|
result = _a.apply(this, [_b.sent()]);
|
|
20766
20789
|
parsedResult = this.parseResult(result);
|
|
20767
20790
|
return [2 /*return*/, parsedResult];
|
|
20768
|
-
case
|
|
20791
|
+
case 3:
|
|
20769
20792
|
error_1 = _b.sent();
|
|
20770
20793
|
console.error('Query error:', error_1);
|
|
20771
20794
|
return [2 /*return*/, null];
|
|
20772
|
-
case
|
|
20795
|
+
case 4: return [2 /*return*/, null];
|
|
20773
20796
|
}
|
|
20774
20797
|
});
|
|
20775
20798
|
});
|
package/dist/index.esm.js
CHANGED
|
@@ -20743,6 +20743,26 @@ var GraphQLService = /** @class */ (function (_super) {
|
|
|
20743
20743
|
function GraphQLService(client, geinsSettings) {
|
|
20744
20744
|
return _super.call(this, client, geinsSettings) || this;
|
|
20745
20745
|
}
|
|
20746
|
+
GraphQLService.prototype.verifyQueryOptions = function (options) {
|
|
20747
|
+
var _a, _b, _c, _d;
|
|
20748
|
+
if (!options.query) {
|
|
20749
|
+
throw new Error('Query is required');
|
|
20750
|
+
}
|
|
20751
|
+
if (!(((_d = (_c = (_b = (_a = options.query) === null || _a === void 0 ? void 0 : _a.definitions) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.variableDefinitions) === null || _d === void 0 ? void 0 : _d.length) > 0)) {
|
|
20752
|
+
console.log('NO VARS');
|
|
20753
|
+
return options;
|
|
20754
|
+
}
|
|
20755
|
+
var queryOptions = __assign({}, options);
|
|
20756
|
+
queryOptions.variables = this.createVariables(queryOptions.variables);
|
|
20757
|
+
var queryVars = queryOptions.query.definitions[0].variableDefinitions.map(function (v) { return v.variable.name.value; });
|
|
20758
|
+
var providedVars = Object.keys(queryOptions.variables);
|
|
20759
|
+
providedVars.forEach(function (v) {
|
|
20760
|
+
if (!queryVars.includes(v)) {
|
|
20761
|
+
delete queryOptions.variables[v];
|
|
20762
|
+
}
|
|
20763
|
+
});
|
|
20764
|
+
return queryOptions;
|
|
20765
|
+
};
|
|
20746
20766
|
/**
|
|
20747
20767
|
* Generic method to run any GraphQL query
|
|
20748
20768
|
* @param query - The GraphQL query DocumentNode or gql query object
|
|
@@ -20752,22 +20772,25 @@ var GraphQLService = /** @class */ (function (_super) {
|
|
|
20752
20772
|
*/
|
|
20753
20773
|
GraphQLService.prototype.query = function (options) {
|
|
20754
20774
|
return __awaiter(this, void 0, void 0, function () {
|
|
20755
|
-
var result, _a, parsedResult, error_1;
|
|
20775
|
+
var queryOptions, result, _a, parsedResult, error_1;
|
|
20756
20776
|
return __generator(this, function (_b) {
|
|
20757
20777
|
switch (_b.label) {
|
|
20758
20778
|
case 0:
|
|
20759
|
-
_b.trys.push([0,
|
|
20760
|
-
|
|
20761
|
-
return [4 /*yield*/, this.runQuery(options)];
|
|
20779
|
+
_b.trys.push([0, 3, , 4]);
|
|
20780
|
+
return [4 /*yield*/, this.verifyQueryOptions(options)];
|
|
20762
20781
|
case 1:
|
|
20782
|
+
queryOptions = _b.sent();
|
|
20783
|
+
_a = this.cleanObject;
|
|
20784
|
+
return [4 /*yield*/, this.runQuery(queryOptions)];
|
|
20785
|
+
case 2:
|
|
20763
20786
|
result = _a.apply(this, [_b.sent()]);
|
|
20764
20787
|
parsedResult = this.parseResult(result);
|
|
20765
20788
|
return [2 /*return*/, parsedResult];
|
|
20766
|
-
case
|
|
20789
|
+
case 3:
|
|
20767
20790
|
error_1 = _b.sent();
|
|
20768
20791
|
console.error('Query error:', error_1);
|
|
20769
20792
|
return [2 /*return*/, null];
|
|
20770
|
-
case
|
|
20793
|
+
case 4: return [2 /*return*/, null];
|
|
20771
20794
|
}
|
|
20772
20795
|
});
|
|
20773
20796
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geins/crm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@apollo/client": "^3.11.8",
|
|
17
|
-
"@geins/core": "0.3.
|
|
17
|
+
"@geins/core": "0.3.4",
|
|
18
18
|
"crypto-js": "^4.2.0",
|
|
19
19
|
"graphql": "^16.9.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@geins/eslint-config": "*",
|
|
23
|
-
"@geins/types": "0.3.
|
|
23
|
+
"@geins/types": "0.3.4",
|
|
24
24
|
"@rollup/plugin-commonjs": "^28.0.0",
|
|
25
25
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
26
26
|
"@rollup/plugin-typescript": "^12.1.0",
|