@geins/crm 0.3.4 → 0.3.5-canary
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 +12 -0
- package/dist/index.cjs +40 -33
- package/dist/index.esm.js +40 -33
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @geins/crm
|
|
2
2
|
|
|
3
|
+
## 0.3.5-canary
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d666708: added settingvars to GraphQLService
|
|
8
|
+
- 2158dcd: Possiblity to use string as query for the merchantAPI
|
|
9
|
+
- 5f86eeb: ci fixes
|
|
10
|
+
- Updated dependencies [d666708]
|
|
11
|
+
- Updated dependencies [2158dcd]
|
|
12
|
+
- Updated dependencies [5f86eeb]
|
|
13
|
+
- @geins/core@0.3.5-canary
|
|
14
|
+
|
|
3
15
|
## 0.3.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -16312,15 +16312,18 @@ var MerchantApiClient = /** @class */ (function () {
|
|
|
16312
16312
|
}
|
|
16313
16313
|
return FetchPolicyOptions.NETWORK_ONLY;
|
|
16314
16314
|
};
|
|
16315
|
-
MerchantApiClient.prototype.getOperationObject = function (operationType,
|
|
16315
|
+
MerchantApiClient.prototype.getOperationObject = function (operationType, operationOptions) {
|
|
16316
16316
|
var _a;
|
|
16317
16317
|
var _b;
|
|
16318
|
-
|
|
16319
|
-
|
|
16318
|
+
var query = operationOptions.query, queryAsString = operationOptions.queryAsString, variables = operationOptions.variables, requestOptions = operationOptions.requestOptions;
|
|
16319
|
+
var queryDocument = query || gql(queryAsString || '');
|
|
16320
|
+
var options = requestOptions || {};
|
|
16320
16321
|
var token = this._userToken || ((_b = this._cookieService) === null || _b === void 0 ? void 0 : _b.get(AUTH_COOKIES.USER_AUTH));
|
|
16321
|
-
|
|
16322
|
+
if (!queryDocument) {
|
|
16323
|
+
throw new Error('Query is required');
|
|
16324
|
+
}
|
|
16322
16325
|
var operationObj = (_a = {},
|
|
16323
|
-
_a[operationType] =
|
|
16326
|
+
_a[operationType] = queryDocument,
|
|
16324
16327
|
_a.variables = variables,
|
|
16325
16328
|
_a.fetchPolicy = this.getFetchPolicy(operationType, options.fetchPolicy),
|
|
16326
16329
|
_a.pollInterval = options.pollInterval || this.pollInterval,
|
|
@@ -16336,20 +16339,18 @@ var MerchantApiClient = /** @class */ (function () {
|
|
|
16336
16339
|
};
|
|
16337
16340
|
MerchantApiClient.prototype.runQuery = function (options) {
|
|
16338
16341
|
return __awaiter(this, void 0, void 0, function () {
|
|
16339
|
-
var
|
|
16342
|
+
var q;
|
|
16340
16343
|
return __generator(this, function (_a) {
|
|
16341
|
-
|
|
16342
|
-
q = this.getOperationObject(OperationType.QUERY, query, variables, requestOptions);
|
|
16344
|
+
q = this.getOperationObject(OperationType.QUERY, options);
|
|
16343
16345
|
return [2 /*return*/, this._apolloClient.query(q)];
|
|
16344
16346
|
});
|
|
16345
16347
|
});
|
|
16346
16348
|
};
|
|
16347
16349
|
MerchantApiClient.prototype.runMutation = function (options) {
|
|
16348
16350
|
return __awaiter(this, void 0, void 0, function () {
|
|
16349
|
-
var
|
|
16351
|
+
var q;
|
|
16350
16352
|
return __generator(this, function (_a) {
|
|
16351
|
-
|
|
16352
|
-
q = this.getOperationObject(OperationType.MUTATION, query, variables, requestOptions);
|
|
16353
|
+
q = this.getOperationObject(OperationType.MUTATION, options);
|
|
16353
16354
|
return [2 /*return*/, this._apolloClient.mutate(q)];
|
|
16354
16355
|
});
|
|
16355
16356
|
});
|
|
@@ -20740,37 +20741,45 @@ var ChannelService = /** @class */ (function (_super) {
|
|
|
20740
20741
|
return ChannelService;
|
|
20741
20742
|
}(BaseApiService));
|
|
20742
20743
|
|
|
20744
|
+
/**
|
|
20745
|
+
* GraphQLService class provides methods to interact with a GraphQL API.
|
|
20746
|
+
* It extends the BaseApiService and includes methods for querying and mutating data.
|
|
20747
|
+
*/
|
|
20743
20748
|
var GraphQLService = /** @class */ (function (_super) {
|
|
20744
20749
|
__extends(GraphQLService, _super);
|
|
20745
20750
|
function GraphQLService(client, geinsSettings) {
|
|
20746
20751
|
return _super.call(this, client, geinsSettings) || this;
|
|
20747
20752
|
}
|
|
20748
20753
|
GraphQLService.prototype.verifyQueryOptions = function (options) {
|
|
20749
|
-
var _a, _b, _c, _d;
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20754
|
+
var _a, _b, _c, _d, _e;
|
|
20755
|
+
var returnOptions = __assign({}, options);
|
|
20756
|
+
if (!options.query && !options.queryAsString) {
|
|
20757
|
+
throw new Error('Query or queryAsString is required');
|
|
20758
|
+
}
|
|
20759
|
+
// check if query is a string and convert it to a gql object
|
|
20760
|
+
typeof returnOptions.query === 'string' && (returnOptions.query = gql(options.queryAsString || ''));
|
|
20761
|
+
var definition = (_b = (_a = returnOptions.query) === null || _a === void 0 ? void 0 : _a.definitions) === null || _b === void 0 ? void 0 : _b[0];
|
|
20762
|
+
if (!definition ||
|
|
20763
|
+
definition.kind !== 'OperationDefinition' ||
|
|
20764
|
+
!(((_d = (_c = definition.variableDefinitions) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0)) {
|
|
20765
|
+
return returnOptions;
|
|
20766
|
+
}
|
|
20767
|
+
var queryOptions = __assign({}, returnOptions);
|
|
20768
|
+
var queryDocument = queryOptions.query;
|
|
20758
20769
|
queryOptions.variables = this.createVariables(queryOptions.variables);
|
|
20759
|
-
var queryVars =
|
|
20770
|
+
var queryVars = ((_e = queryDocument.definitions[0].variableDefinitions) === null || _e === void 0 ? void 0 : _e.map(function (v) { return v.variable.name.value; })) || [];
|
|
20760
20771
|
var providedVars = Object.keys(queryOptions.variables);
|
|
20761
20772
|
providedVars.forEach(function (v) {
|
|
20762
|
-
if (!queryVars.includes(v)) {
|
|
20773
|
+
if (queryVars && !queryVars.includes(v)) {
|
|
20763
20774
|
delete queryOptions.variables[v];
|
|
20764
20775
|
}
|
|
20765
20776
|
});
|
|
20766
20777
|
return queryOptions;
|
|
20767
20778
|
};
|
|
20768
20779
|
/**
|
|
20769
|
-
*
|
|
20770
|
-
* @param
|
|
20771
|
-
* @
|
|
20772
|
-
* @param options - Optional options like fetchPolicy, pollInterval, etc.
|
|
20773
|
-
* @returns The result data of the query or null
|
|
20780
|
+
* Executes a GraphQL query with the provided options.
|
|
20781
|
+
* @param options - The options for the GraphQL query.
|
|
20782
|
+
* @returns A promise that resolves to the query result or null if an error occurs.
|
|
20774
20783
|
*/
|
|
20775
20784
|
GraphQLService.prototype.query = function (options) {
|
|
20776
20785
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -20792,17 +20801,15 @@ var GraphQLService = /** @class */ (function (_super) {
|
|
|
20792
20801
|
error_1 = _b.sent();
|
|
20793
20802
|
console.error('Query error:', error_1);
|
|
20794
20803
|
return [2 /*return*/, null];
|
|
20795
|
-
case 4: return [2 /*return
|
|
20804
|
+
case 4: return [2 /*return*/];
|
|
20796
20805
|
}
|
|
20797
20806
|
});
|
|
20798
20807
|
});
|
|
20799
20808
|
};
|
|
20800
20809
|
/**
|
|
20801
|
-
*
|
|
20802
|
-
* @param
|
|
20803
|
-
* @
|
|
20804
|
-
* @param options - Optional options like fetchPolicy, etc.
|
|
20805
|
-
* @returns The result data of the mutation or null
|
|
20810
|
+
* Executes a GraphQL mutation with the provided options.
|
|
20811
|
+
* @param options - The options for the GraphQL mutation.
|
|
20812
|
+
* @returns A promise that resolves to the mutation result or null if an error occurs.
|
|
20806
20813
|
*/
|
|
20807
20814
|
GraphQLService.prototype.mutation = function (options) {
|
|
20808
20815
|
return __awaiter(this, void 0, void 0, function () {
|
package/dist/index.esm.js
CHANGED
|
@@ -16310,15 +16310,18 @@ var MerchantApiClient = /** @class */ (function () {
|
|
|
16310
16310
|
}
|
|
16311
16311
|
return FetchPolicyOptions.NETWORK_ONLY;
|
|
16312
16312
|
};
|
|
16313
|
-
MerchantApiClient.prototype.getOperationObject = function (operationType,
|
|
16313
|
+
MerchantApiClient.prototype.getOperationObject = function (operationType, operationOptions) {
|
|
16314
16314
|
var _a;
|
|
16315
16315
|
var _b;
|
|
16316
|
-
|
|
16317
|
-
|
|
16316
|
+
var query = operationOptions.query, queryAsString = operationOptions.queryAsString, variables = operationOptions.variables, requestOptions = operationOptions.requestOptions;
|
|
16317
|
+
var queryDocument = query || gql(queryAsString || '');
|
|
16318
|
+
var options = requestOptions || {};
|
|
16318
16319
|
var token = this._userToken || ((_b = this._cookieService) === null || _b === void 0 ? void 0 : _b.get(AUTH_COOKIES.USER_AUTH));
|
|
16319
|
-
|
|
16320
|
+
if (!queryDocument) {
|
|
16321
|
+
throw new Error('Query is required');
|
|
16322
|
+
}
|
|
16320
16323
|
var operationObj = (_a = {},
|
|
16321
|
-
_a[operationType] =
|
|
16324
|
+
_a[operationType] = queryDocument,
|
|
16322
16325
|
_a.variables = variables,
|
|
16323
16326
|
_a.fetchPolicy = this.getFetchPolicy(operationType, options.fetchPolicy),
|
|
16324
16327
|
_a.pollInterval = options.pollInterval || this.pollInterval,
|
|
@@ -16334,20 +16337,18 @@ var MerchantApiClient = /** @class */ (function () {
|
|
|
16334
16337
|
};
|
|
16335
16338
|
MerchantApiClient.prototype.runQuery = function (options) {
|
|
16336
16339
|
return __awaiter(this, void 0, void 0, function () {
|
|
16337
|
-
var
|
|
16340
|
+
var q;
|
|
16338
16341
|
return __generator(this, function (_a) {
|
|
16339
|
-
|
|
16340
|
-
q = this.getOperationObject(OperationType.QUERY, query, variables, requestOptions);
|
|
16342
|
+
q = this.getOperationObject(OperationType.QUERY, options);
|
|
16341
16343
|
return [2 /*return*/, this._apolloClient.query(q)];
|
|
16342
16344
|
});
|
|
16343
16345
|
});
|
|
16344
16346
|
};
|
|
16345
16347
|
MerchantApiClient.prototype.runMutation = function (options) {
|
|
16346
16348
|
return __awaiter(this, void 0, void 0, function () {
|
|
16347
|
-
var
|
|
16349
|
+
var q;
|
|
16348
16350
|
return __generator(this, function (_a) {
|
|
16349
|
-
|
|
16350
|
-
q = this.getOperationObject(OperationType.MUTATION, query, variables, requestOptions);
|
|
16351
|
+
q = this.getOperationObject(OperationType.MUTATION, options);
|
|
16351
16352
|
return [2 /*return*/, this._apolloClient.mutate(q)];
|
|
16352
16353
|
});
|
|
16353
16354
|
});
|
|
@@ -20738,37 +20739,45 @@ var ChannelService = /** @class */ (function (_super) {
|
|
|
20738
20739
|
return ChannelService;
|
|
20739
20740
|
}(BaseApiService));
|
|
20740
20741
|
|
|
20742
|
+
/**
|
|
20743
|
+
* GraphQLService class provides methods to interact with a GraphQL API.
|
|
20744
|
+
* It extends the BaseApiService and includes methods for querying and mutating data.
|
|
20745
|
+
*/
|
|
20741
20746
|
var GraphQLService = /** @class */ (function (_super) {
|
|
20742
20747
|
__extends(GraphQLService, _super);
|
|
20743
20748
|
function GraphQLService(client, geinsSettings) {
|
|
20744
20749
|
return _super.call(this, client, geinsSettings) || this;
|
|
20745
20750
|
}
|
|
20746
20751
|
GraphQLService.prototype.verifyQueryOptions = function (options) {
|
|
20747
|
-
var _a, _b, _c, _d;
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20752
|
+
var _a, _b, _c, _d, _e;
|
|
20753
|
+
var returnOptions = __assign({}, options);
|
|
20754
|
+
if (!options.query && !options.queryAsString) {
|
|
20755
|
+
throw new Error('Query or queryAsString is required');
|
|
20756
|
+
}
|
|
20757
|
+
// check if query is a string and convert it to a gql object
|
|
20758
|
+
typeof returnOptions.query === 'string' && (returnOptions.query = gql(options.queryAsString || ''));
|
|
20759
|
+
var definition = (_b = (_a = returnOptions.query) === null || _a === void 0 ? void 0 : _a.definitions) === null || _b === void 0 ? void 0 : _b[0];
|
|
20760
|
+
if (!definition ||
|
|
20761
|
+
definition.kind !== 'OperationDefinition' ||
|
|
20762
|
+
!(((_d = (_c = definition.variableDefinitions) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0)) {
|
|
20763
|
+
return returnOptions;
|
|
20764
|
+
}
|
|
20765
|
+
var queryOptions = __assign({}, returnOptions);
|
|
20766
|
+
var queryDocument = queryOptions.query;
|
|
20756
20767
|
queryOptions.variables = this.createVariables(queryOptions.variables);
|
|
20757
|
-
var queryVars =
|
|
20768
|
+
var queryVars = ((_e = queryDocument.definitions[0].variableDefinitions) === null || _e === void 0 ? void 0 : _e.map(function (v) { return v.variable.name.value; })) || [];
|
|
20758
20769
|
var providedVars = Object.keys(queryOptions.variables);
|
|
20759
20770
|
providedVars.forEach(function (v) {
|
|
20760
|
-
if (!queryVars.includes(v)) {
|
|
20771
|
+
if (queryVars && !queryVars.includes(v)) {
|
|
20761
20772
|
delete queryOptions.variables[v];
|
|
20762
20773
|
}
|
|
20763
20774
|
});
|
|
20764
20775
|
return queryOptions;
|
|
20765
20776
|
};
|
|
20766
20777
|
/**
|
|
20767
|
-
*
|
|
20768
|
-
* @param
|
|
20769
|
-
* @
|
|
20770
|
-
* @param options - Optional options like fetchPolicy, pollInterval, etc.
|
|
20771
|
-
* @returns The result data of the query or null
|
|
20778
|
+
* Executes a GraphQL query with the provided options.
|
|
20779
|
+
* @param options - The options for the GraphQL query.
|
|
20780
|
+
* @returns A promise that resolves to the query result or null if an error occurs.
|
|
20772
20781
|
*/
|
|
20773
20782
|
GraphQLService.prototype.query = function (options) {
|
|
20774
20783
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -20790,17 +20799,15 @@ var GraphQLService = /** @class */ (function (_super) {
|
|
|
20790
20799
|
error_1 = _b.sent();
|
|
20791
20800
|
console.error('Query error:', error_1);
|
|
20792
20801
|
return [2 /*return*/, null];
|
|
20793
|
-
case 4: return [2 /*return
|
|
20802
|
+
case 4: return [2 /*return*/];
|
|
20794
20803
|
}
|
|
20795
20804
|
});
|
|
20796
20805
|
});
|
|
20797
20806
|
};
|
|
20798
20807
|
/**
|
|
20799
|
-
*
|
|
20800
|
-
* @param
|
|
20801
|
-
* @
|
|
20802
|
-
* @param options - Optional options like fetchPolicy, etc.
|
|
20803
|
-
* @returns The result data of the mutation or null
|
|
20808
|
+
* Executes a GraphQL mutation with the provided options.
|
|
20809
|
+
* @param options - The options for the GraphQL mutation.
|
|
20810
|
+
* @returns A promise that resolves to the mutation result or null if an error occurs.
|
|
20804
20811
|
*/
|
|
20805
20812
|
GraphQLService.prototype.mutation = function (options) {
|
|
20806
20813
|
return __awaiter(this, void 0, void 0, function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geins/crm",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5-canary",
|
|
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.5-canary",
|
|
18
18
|
"crypto-js": "^4.2.0",
|
|
19
19
|
"graphql": "^16.9.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@geins/eslint-config": "
|
|
23
|
-
"@geins/types": "0.3.
|
|
22
|
+
"@geins/eslint-config": "0.1.6-canary",
|
|
23
|
+
"@geins/types": "0.3.5-canary",
|
|
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",
|