@geins/cms 0.3.3 → 0.3.4-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.
@@ -2,5 +2,5 @@ yarn run v1.22.22
2
2
  $ rollup -c
3
3
  
4
4
  src/index.ts → dist/index.cjs, dist/index.esm.js...
5
- created dist/index.cjs, dist/index.esm.js in 8.9s
6
- Done in 9.74s.
5
+ created dist/index.cjs, dist/index.esm.js in 8.2s
6
+ Done in 9.02s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @geins/cms
2
2
 
3
+ ## 0.3.4-canary
4
+
5
+ ### Patch Changes
6
+
7
+ - d666708: added settingvars to GraphQLService
8
+ - 5f86eeb: ci fixes
9
+ - Updated dependencies [d666708]
10
+ - Updated dependencies [5f86eeb]
11
+ - @geins/core@0.3.4-canary
12
+
3
13
  ## 0.3.3
4
14
 
5
15
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -20669,6 +20669,26 @@ var GraphQLService = /** @class */ (function (_super) {
20669
20669
  function GraphQLService(client, geinsSettings) {
20670
20670
  return _super.call(this, client, geinsSettings) || this;
20671
20671
  }
20672
+ GraphQLService.prototype.verifyQueryOptions = function (options) {
20673
+ var _a, _b, _c, _d;
20674
+ if (!options.query) {
20675
+ throw new Error('Query is required');
20676
+ }
20677
+ 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)) {
20678
+ console.log('NO VARS');
20679
+ return options;
20680
+ }
20681
+ var queryOptions = __assign({}, options);
20682
+ queryOptions.variables = this.createVariables(queryOptions.variables);
20683
+ var queryVars = queryOptions.query.definitions[0].variableDefinitions.map(function (v) { return v.variable.name.value; });
20684
+ var providedVars = Object.keys(queryOptions.variables);
20685
+ providedVars.forEach(function (v) {
20686
+ if (!queryVars.includes(v)) {
20687
+ delete queryOptions.variables[v];
20688
+ }
20689
+ });
20690
+ return queryOptions;
20691
+ };
20672
20692
  /**
20673
20693
  * Generic method to run any GraphQL query
20674
20694
  * @param query - The GraphQL query DocumentNode or gql query object
@@ -20678,22 +20698,25 @@ var GraphQLService = /** @class */ (function (_super) {
20678
20698
  */
20679
20699
  GraphQLService.prototype.query = function (options) {
20680
20700
  return __awaiter(this, void 0, void 0, function () {
20681
- var result, _a, parsedResult, error_1;
20701
+ var queryOptions, result, _a, parsedResult, error_1;
20682
20702
  return __generator(this, function (_b) {
20683
20703
  switch (_b.label) {
20684
20704
  case 0:
20685
- _b.trys.push([0, 2, , 3]);
20686
- _a = this.cleanObject;
20687
- return [4 /*yield*/, this.runQuery(options)];
20705
+ _b.trys.push([0, 3, , 4]);
20706
+ return [4 /*yield*/, this.verifyQueryOptions(options)];
20688
20707
  case 1:
20708
+ queryOptions = _b.sent();
20709
+ _a = this.cleanObject;
20710
+ return [4 /*yield*/, this.runQuery(queryOptions)];
20711
+ case 2:
20689
20712
  result = _a.apply(this, [_b.sent()]);
20690
20713
  parsedResult = this.parseResult(result);
20691
20714
  return [2 /*return*/, parsedResult];
20692
- case 2:
20715
+ case 3:
20693
20716
  error_1 = _b.sent();
20694
20717
  console.error('Query error:', error_1);
20695
20718
  return [2 /*return*/, null];
20696
- case 3: return [2 /*return*/, null];
20719
+ case 4: return [2 /*return*/, null];
20697
20720
  }
20698
20721
  });
20699
20722
  });
package/dist/index.esm.js CHANGED
@@ -20667,6 +20667,26 @@ var GraphQLService = /** @class */ (function (_super) {
20667
20667
  function GraphQLService(client, geinsSettings) {
20668
20668
  return _super.call(this, client, geinsSettings) || this;
20669
20669
  }
20670
+ GraphQLService.prototype.verifyQueryOptions = function (options) {
20671
+ var _a, _b, _c, _d;
20672
+ if (!options.query) {
20673
+ throw new Error('Query is required');
20674
+ }
20675
+ 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)) {
20676
+ console.log('NO VARS');
20677
+ return options;
20678
+ }
20679
+ var queryOptions = __assign({}, options);
20680
+ queryOptions.variables = this.createVariables(queryOptions.variables);
20681
+ var queryVars = queryOptions.query.definitions[0].variableDefinitions.map(function (v) { return v.variable.name.value; });
20682
+ var providedVars = Object.keys(queryOptions.variables);
20683
+ providedVars.forEach(function (v) {
20684
+ if (!queryVars.includes(v)) {
20685
+ delete queryOptions.variables[v];
20686
+ }
20687
+ });
20688
+ return queryOptions;
20689
+ };
20670
20690
  /**
20671
20691
  * Generic method to run any GraphQL query
20672
20692
  * @param query - The GraphQL query DocumentNode or gql query object
@@ -20676,22 +20696,25 @@ var GraphQLService = /** @class */ (function (_super) {
20676
20696
  */
20677
20697
  GraphQLService.prototype.query = function (options) {
20678
20698
  return __awaiter(this, void 0, void 0, function () {
20679
- var result, _a, parsedResult, error_1;
20699
+ var queryOptions, result, _a, parsedResult, error_1;
20680
20700
  return __generator(this, function (_b) {
20681
20701
  switch (_b.label) {
20682
20702
  case 0:
20683
- _b.trys.push([0, 2, , 3]);
20684
- _a = this.cleanObject;
20685
- return [4 /*yield*/, this.runQuery(options)];
20703
+ _b.trys.push([0, 3, , 4]);
20704
+ return [4 /*yield*/, this.verifyQueryOptions(options)];
20686
20705
  case 1:
20706
+ queryOptions = _b.sent();
20707
+ _a = this.cleanObject;
20708
+ return [4 /*yield*/, this.runQuery(queryOptions)];
20709
+ case 2:
20687
20710
  result = _a.apply(this, [_b.sent()]);
20688
20711
  parsedResult = this.parseResult(result);
20689
20712
  return [2 /*return*/, parsedResult];
20690
- case 2:
20713
+ case 3:
20691
20714
  error_1 = _b.sent();
20692
20715
  console.error('Query error:', error_1);
20693
20716
  return [2 /*return*/, null];
20694
- case 3: return [2 /*return*/, null];
20717
+ case 4: return [2 /*return*/, null];
20695
20718
  }
20696
20719
  });
20697
20720
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geins/cms",
3
- "version": "0.3.3",
3
+ "version": "0.3.4-canary",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,13 +15,13 @@
15
15
  "dependencies": {
16
16
  "@apollo/client": "^3.11.8",
17
17
  "graphql": "^16.9.0",
18
- "@geins/core": "0.3.3"
18
+ "@geins/core": "0.3.4-canary"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@rollup/plugin-commonjs": "^28.0.0",
22
22
  "@rollup/plugin-node-resolve": "^15.3.0",
23
23
  "@rollup/plugin-typescript": "^12.1.0",
24
- "@geins/eslint-config": "*",
24
+ "@geins/eslint-config": "0.1.5-canary",
25
25
  "typescript": "^5.6.2",
26
26
  "eslint": "^9.11.1"
27
27
  }