@graphcommerce/hygraph-cli 8.0.0-canary.92 → 8.0.0-canary.94

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @graphcommerce/hygraph-cli
2
2
 
3
+ ## 8.0.0-canary.94
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2169](https://github.com/graphcommerce-org/graphcommerce/pull/2169) [`eab3f0b`](https://github.com/graphcommerce-org/graphcommerce/commit/eab3f0b0b459f5b6cc4e50d787ac1e8ae545b708) - Solve issue where a Hygraph DynamicRow conditions were missing fields in the OrCondition
8
+ ([@Jessevdpoel](https://github.com/Jessevdpoel))
9
+
10
+ ## 8.0.0-canary.93
11
+
3
12
  ## 8.0.0-canary.92
4
13
 
5
14
  ## 8.0.0-canary.91
package/Config.graphqls CHANGED
@@ -45,4 +45,9 @@ extend input GraphCommerceConfig {
45
45
  Hygraph Project ID. **Only used for migrations.**
46
46
  """
47
47
  hygraphProjectId: String
48
+
49
+ """
50
+ Hygraph Management API. **Only used for migrations.**
51
+ """
52
+ hygraphManagementApi: String
48
53
  }
@@ -196,6 +196,13 @@ const graphcommerce6to7 = async (schema) => {
196
196
  enumerationApiId: 'RowColumnOneVariants',
197
197
  parentApiId: 'RowColumnOne',
198
198
  }, 'RowColumnOne', 'model');
199
+ (0, migrationAction_1.migrationAction)(schema, 'componentUnionField', 'create', {
200
+ displayName: 'Conditions',
201
+ apiId: 'conditions',
202
+ parentApiId: 'ConditionOr',
203
+ componentApiIds: ['ConditionText', 'ConditionNumber'],
204
+ isList: true,
205
+ }, 'ConditionOr', 'component');
199
206
  return migrationAction_1.client.run(true);
200
207
  };
201
208
  exports.graphcommerce6to7 = graphcommerce6to7;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.graphcommerce7to7_1 = void 0;
3
+ exports.graphcommerce7to8 = void 0;
4
4
  const management_sdk_1 = require("@hygraph/management-sdk");
5
5
  const migrationAction_1 = require("../migrationAction");
6
- const graphcommerce7to7_1 = async (schema) => {
6
+ const graphcommerce7to8 = async (schema) => {
7
7
  if (!migrationAction_1.client) {
8
8
  return 0;
9
9
  }
@@ -31,6 +31,13 @@ const graphcommerce7to7_1 = async (schema) => {
31
31
  },
32
32
  parentApiId: 'DynamicRow',
33
33
  }, 'DynamicRow', 'model');
34
+ (0, migrationAction_1.migrationAction)(schema, 'componentUnionField', 'create', {
35
+ displayName: 'Conditions',
36
+ apiId: 'conditions',
37
+ parentApiId: 'ConditionOr',
38
+ componentApiIds: ['ConditionText', 'ConditionNumber'],
39
+ isList: true,
40
+ }, 'ConditionOr', 'component');
34
41
  return migrationAction_1.client.run(true);
35
42
  };
36
- exports.graphcommerce7to7_1 = graphcommerce7to7_1;
43
+ exports.graphcommerce7to8 = graphcommerce7to8;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.graphcommerce7_unknown_to_8 = void 0;
3
+ exports.graphcommerce8to9 = void 0;
4
4
  const migrationAction_1 = require("../migrationAction");
5
- const graphcommerce7_unknown_to_8 = async (schema) => {
5
+ const graphcommerce8to9 = async (schema) => {
6
6
  if (!migrationAction_1.client) {
7
7
  return 0;
8
8
  }
@@ -19,4 +19,4 @@ const graphcommerce7_unknown_to_8 = async (schema) => {
19
19
  }
20
20
  return migrationAction_1.client.run(true);
21
21
  };
22
- exports.graphcommerce7_unknown_to_8 = graphcommerce7_unknown_to_8;
22
+ exports.graphcommerce8to9 = graphcommerce8to9;
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./graphcommerce5to6"), exports);
18
18
  __exportStar(require("./graphcommerce6to7"), exports);
19
19
  __exportStar(require("./graphcommerce7to8"), exports);
20
+ __exportStar(require("./graphcommerce8to9"), exports);
@@ -5,15 +5,18 @@ const client_1 = require("@apollo/client");
5
5
  const fetch_1 = require("@whatwg-node/fetch");
6
6
  const readSchema = async (config) => {
7
7
  if (!config.hygraphProjectId) {
8
- throw new Error('Please provide GC_HYGRAPH_PROJECT_ID in your env file');
8
+ throw new Error('Please provide GC_HYGRAPH_PROJECT_ID in your env file.');
9
9
  }
10
10
  if (!config.hygraphWriteAccessToken) {
11
- throw new Error('Please provide GC_HYGRAPH_WRITE_ACCESS_TOKEN in your env file');
11
+ throw new Error('Please provide GC_HYGRAPH_WRITE_ACCESS_TOKEN in your env file.');
12
12
  }
13
13
  const projectId = config.hygraphProjectId;
14
+ if (!config.hygraphManagementApi) {
15
+ throw new Error('Please provide GC_HYGRAPH_MANAGEMENT_API in your env file.');
16
+ }
14
17
  const hygraphClient = new client_1.ApolloClient({
15
18
  link: new client_1.HttpLink({
16
- uri: 'https://management.hygraph.com/graphql',
19
+ uri: config.hygraphManagementApi,
17
20
  fetch: fetch_1.fetch,
18
21
  headers: { Authorization: `Bearer ${config.hygraphWriteAccessToken}` },
19
22
  }),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/hygraph-cli",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.0.0-canary.92",
5
+ "version": "8.0.0-canary.94",
6
6
  "scripts": {
7
7
  "dev": "tsc --preserveWatchOutput --watch",
8
8
  "build": "tsc",
@@ -19,10 +19,10 @@
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@apollo/client": "^3",
22
- "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.92",
23
- "@graphcommerce/next-config": "^8.0.0-canary.92",
24
- "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.92",
25
- "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.92",
22
+ "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.94",
23
+ "@graphcommerce/next-config": "^8.0.0-canary.94",
24
+ "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.94",
25
+ "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.94",
26
26
  "dotenv": "^16.1.4",
27
27
  "graphql": "^16.7.1"
28
28
  },
@@ -303,5 +303,20 @@ export const graphcommerce6to7 = async (schema: Schema) => {
303
303
  'model',
304
304
  )
305
305
 
306
+ migrationAction(
307
+ schema,
308
+ 'componentUnionField',
309
+ 'create',
310
+ {
311
+ displayName: 'Conditions',
312
+ apiId: 'conditions',
313
+ parentApiId: 'ConditionOr',
314
+ componentApiIds: ['ConditionText', 'ConditionNumber'],
315
+ isList: true,
316
+ },
317
+ 'ConditionOr',
318
+ 'component',
319
+ )
320
+
306
321
  return client.run(true)
307
322
  }
@@ -2,7 +2,7 @@ import { VisibilityTypes } from '@hygraph/management-sdk'
2
2
  import { migrationAction, client } from '../migrationAction'
3
3
  import { Schema } from '../types'
4
4
 
5
- export const graphcommerce7to7_1 = async (schema: Schema) => {
5
+ export const graphcommerce7to8 = async (schema: Schema) => {
6
6
  if (!client) {
7
7
  return 0
8
8
  }
@@ -41,5 +41,20 @@ export const graphcommerce7to7_1 = async (schema: Schema) => {
41
41
  'model',
42
42
  )
43
43
 
44
+ migrationAction(
45
+ schema,
46
+ 'componentUnionField',
47
+ 'create',
48
+ {
49
+ displayName: 'Conditions',
50
+ apiId: 'conditions',
51
+ parentApiId: 'ConditionOr',
52
+ componentApiIds: ['ConditionText', 'ConditionNumber'],
53
+ isList: true,
54
+ },
55
+ 'ConditionOr',
56
+ 'component',
57
+ )
58
+
44
59
  return client.run(true)
45
60
  }
@@ -1,7 +1,7 @@
1
1
  import { migrationAction, client } from '../migrationAction'
2
2
  import { Schema } from '../types'
3
3
 
4
- export const graphcommerce7_unknown_to_8 = async (schema: Schema) => {
4
+ export const graphcommerce8to9 = async (schema: Schema) => {
5
5
  if (!client) {
6
6
  return 0
7
7
  }
@@ -1,3 +1,4 @@
1
1
  export * from './graphcommerce5to6'
2
2
  export * from './graphcommerce6to7'
3
3
  export * from './graphcommerce7to8'
4
+ export * from './graphcommerce8to9'
package/src/readSchema.ts CHANGED
@@ -4,18 +4,22 @@ import { fetch } from '@whatwg-node/fetch'
4
4
 
5
5
  export const readSchema = async (config: GraphCommerceConfig) => {
6
6
  if (!config.hygraphProjectId) {
7
- throw new Error('Please provide GC_HYGRAPH_PROJECT_ID in your env file')
7
+ throw new Error('Please provide GC_HYGRAPH_PROJECT_ID in your env file.')
8
8
  }
9
9
 
10
10
  if (!config.hygraphWriteAccessToken) {
11
- throw new Error('Please provide GC_HYGRAPH_WRITE_ACCESS_TOKEN in your env file')
11
+ throw new Error('Please provide GC_HYGRAPH_WRITE_ACCESS_TOKEN in your env file.')
12
12
  }
13
13
 
14
14
  const projectId = config.hygraphProjectId
15
15
 
16
+ if (!config.hygraphManagementApi) {
17
+ throw new Error('Please provide GC_HYGRAPH_MANAGEMENT_API in your env file.')
18
+ }
19
+
16
20
  const hygraphClient = new ApolloClient({
17
21
  link: new HttpLink({
18
- uri: 'https://management.hygraph.com/graphql',
22
+ uri: config.hygraphManagementApi,
19
23
  fetch,
20
24
  headers: { Authorization: `Bearer ${config.hygraphWriteAccessToken}` },
21
25
  }),