@graphcommerce/hygraph-cli 9.0.4-canary.9 → 9.0.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 +7 -13
- package/dist/migrationActionFactory.js +11 -11
- package/package.json +5 -5
- package/src/migrationActionFactory.ts +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
# @graphcommerce/hygraph-cli
|
|
2
2
|
|
|
3
|
-
## 9.0.4
|
|
3
|
+
## 9.0.4
|
|
4
4
|
|
|
5
|
-
## 9.0.
|
|
5
|
+
## 9.0.3
|
|
6
6
|
|
|
7
|
-
## 9.0.
|
|
7
|
+
## 9.0.3-canary.0
|
|
8
8
|
|
|
9
|
-
## 9.0.
|
|
9
|
+
## 9.0.2
|
|
10
10
|
|
|
11
|
-
## 9.0.
|
|
11
|
+
## 9.0.2-canary.0
|
|
12
12
|
|
|
13
|
-
## 9.0.
|
|
13
|
+
## 9.0.1
|
|
14
14
|
|
|
15
|
-
## 9.0.
|
|
16
|
-
|
|
17
|
-
## 9.0.4-canary.2
|
|
18
|
-
|
|
19
|
-
## 9.0.4-canary.1
|
|
20
|
-
|
|
21
|
-
## 9.0.4-canary.0
|
|
15
|
+
## 9.0.1-canary.1
|
|
22
16
|
|
|
23
17
|
## 9.0.0
|
|
24
18
|
|
|
@@ -54,26 +54,26 @@ function migrationActionFactory(schema, client) {
|
|
|
54
54
|
* management sdk.
|
|
55
55
|
*
|
|
56
56
|
* MigrationAction() is better suited because it is a single function for all actions. More
|
|
57
|
-
* importantly, if the action fails, because a field with the apiID already exists for instance.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* importantly, if the action fails, because a field with the apiID already exists for instance. it
|
|
58
|
+
* will skip this action but still continue the whole migration, while the management sdk function
|
|
59
|
+
* will bail.
|
|
60
60
|
*
|
|
61
61
|
* It takes the schema as argument, which is always the same.
|
|
62
62
|
*
|
|
63
|
-
* Then it takes the type of schema entity you want to do an action upon, and the action you want
|
|
64
|
-
*
|
|
63
|
+
* Then it takes the type of schema entity you want to do an action upon, and the action you want to
|
|
64
|
+
* do.
|
|
65
65
|
*
|
|
66
|
-
* The fourth arguments are the props that belong to the action you want to do. For instance, if
|
|
67
|
-
*
|
|
66
|
+
* The fourth arguments are the props that belong to the action you want to do. For instance, if you
|
|
67
|
+
* want to create a model, you need to pass the props that belong to a model.
|
|
68
68
|
*
|
|
69
|
-
* The last two arguments are optional. If you want to create a field, you need to pass the apiId
|
|
70
|
-
*
|
|
69
|
+
* The last two arguments are optional. If you want to create a field, you need to pass the apiId of
|
|
70
|
+
* the model or component you want to create the field on. If you want to create a field on a
|
|
71
71
|
* component, you also need to pass the parentType, which is either 'model' or 'component'.
|
|
72
72
|
*/
|
|
73
73
|
const migrationAction = (_schema, type, action, props, parentApiId, parentType) => {
|
|
74
74
|
/**
|
|
75
|
-
* Check if the entity already exists.
|
|
76
|
-
* the entity already exists
|
|
75
|
+
* Check if the entity already exists.
|
|
76
|
+
* If an update or deletion is made, it does not matter if the entity already exists
|
|
77
77
|
*/
|
|
78
78
|
const alreadyExists = () => {
|
|
79
79
|
if (action !== 'create') {
|
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": "9.0.4
|
|
5
|
+
"version": "9.0.4",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "tsc --preserveWatchOutput --watch",
|
|
8
8
|
"build": "tsc",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@apollo/client": "*",
|
|
23
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.4
|
|
24
|
-
"@graphcommerce/next-config": "^9.0.4
|
|
25
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.4
|
|
26
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.4
|
|
23
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.4",
|
|
24
|
+
"@graphcommerce/next-config": "^9.0.4",
|
|
25
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.4",
|
|
26
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.4",
|
|
27
27
|
"dotenv": "^16.1.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -136,20 +136,20 @@ export function migrationActionFactory(schema: Schema, client: Client) {
|
|
|
136
136
|
* management sdk.
|
|
137
137
|
*
|
|
138
138
|
* MigrationAction() is better suited because it is a single function for all actions. More
|
|
139
|
-
* importantly, if the action fails, because a field with the apiID already exists for instance.
|
|
140
|
-
*
|
|
141
|
-
*
|
|
139
|
+
* importantly, if the action fails, because a field with the apiID already exists for instance. it
|
|
140
|
+
* will skip this action but still continue the whole migration, while the management sdk function
|
|
141
|
+
* will bail.
|
|
142
142
|
*
|
|
143
143
|
* It takes the schema as argument, which is always the same.
|
|
144
144
|
*
|
|
145
|
-
* Then it takes the type of schema entity you want to do an action upon, and the action you want
|
|
146
|
-
*
|
|
145
|
+
* Then it takes the type of schema entity you want to do an action upon, and the action you want to
|
|
146
|
+
* do.
|
|
147
147
|
*
|
|
148
|
-
* The fourth arguments are the props that belong to the action you want to do. For instance, if
|
|
149
|
-
*
|
|
148
|
+
* The fourth arguments are the props that belong to the action you want to do. For instance, if you
|
|
149
|
+
* want to create a model, you need to pass the props that belong to a model.
|
|
150
150
|
*
|
|
151
|
-
* The last two arguments are optional. If you want to create a field, you need to pass the apiId
|
|
152
|
-
*
|
|
151
|
+
* The last two arguments are optional. If you want to create a field, you need to pass the apiId of
|
|
152
|
+
* the model or component you want to create the field on. If you want to create a field on a
|
|
153
153
|
* component, you also need to pass the parentType, which is either 'model' or 'component'.
|
|
154
154
|
*/
|
|
155
155
|
const migrationAction = (
|
|
@@ -161,8 +161,8 @@ export function migrationActionFactory(schema: Schema, client: Client) {
|
|
|
161
161
|
parentType?: 'model' | 'component' | 'enumeration',
|
|
162
162
|
) => {
|
|
163
163
|
/**
|
|
164
|
-
* Check if the entity already exists.
|
|
165
|
-
* the entity already exists
|
|
164
|
+
* Check if the entity already exists.
|
|
165
|
+
* If an update or deletion is made, it does not matter if the entity already exists
|
|
166
166
|
*/
|
|
167
167
|
const alreadyExists = () => {
|
|
168
168
|
if (action !== 'create') {
|