@graphcommerce/hygraph-cli 8.0.0-canary.79 → 8.0.0-canary.81
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 +4 -0
- package/dist/migrations/graphcommerce7to8.js +36 -0
- package/dist/migrations/graphcommerce8to9.js +22 -0
- package/dist/migrations/index.js +1 -0
- package/package.json +5 -5
- package/src/migrations/graphcommerce7to8.ts +45 -0
- package/src/migrations/graphcommerce8to9.ts +24 -0
- package/src/migrations/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.graphcommerce7to7_1 = void 0;
|
|
4
|
+
const management_sdk_1 = require("@hygraph/management-sdk");
|
|
5
|
+
const migrationAction_1 = require("../migrationAction");
|
|
6
|
+
const graphcommerce7to7_1 = async (schema) => {
|
|
7
|
+
if (!migrationAction_1.client) {
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
const hasRow = schema.models
|
|
11
|
+
.find((m) => m.apiId === 'DynamicRow')
|
|
12
|
+
?.fields.some((f) => f.apiId === 'row');
|
|
13
|
+
if (hasRow) {
|
|
14
|
+
(0, migrationAction_1.migrationAction)(schema, 'unionField', 'update', {
|
|
15
|
+
apiId: 'row',
|
|
16
|
+
displayName: 'Row Deprecated',
|
|
17
|
+
parentApiId: 'DynamicRow',
|
|
18
|
+
description: 'This field is deprecated. Use Rows instead.',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
(0, migrationAction_1.migrationAction)(schema, 'unionField', 'create', {
|
|
22
|
+
displayName: 'Rows',
|
|
23
|
+
apiId: 'rows',
|
|
24
|
+
isList: true,
|
|
25
|
+
reverseField: {
|
|
26
|
+
modelApiIds: ['RowQuote', 'RowLinks', 'RowColumnOne'],
|
|
27
|
+
apiId: 'dynamicRows',
|
|
28
|
+
displayName: 'Dynamic Rows',
|
|
29
|
+
visibility: management_sdk_1.VisibilityTypes.Hidden,
|
|
30
|
+
isList: true,
|
|
31
|
+
},
|
|
32
|
+
parentApiId: 'DynamicRow',
|
|
33
|
+
}, 'DynamicRow', 'model');
|
|
34
|
+
return migrationAction_1.client.run(true);
|
|
35
|
+
};
|
|
36
|
+
exports.graphcommerce7to7_1 = graphcommerce7to7_1;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.graphcommerce7_unknown_to_8 = void 0;
|
|
4
|
+
const migrationAction_1 = require("../migrationAction");
|
|
5
|
+
const graphcommerce7_unknown_to_8 = async (schema) => {
|
|
6
|
+
if (!migrationAction_1.client) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
// This migration is for GC 8.0 and is not yet exported as a usable migration.
|
|
10
|
+
// Removes the deprecated 'Row' field which was deprecated in GC@7.1
|
|
11
|
+
const hasRow = schema.models
|
|
12
|
+
.find((m) => m.apiId === 'DynamicRow')
|
|
13
|
+
?.fields.some((f) => f.apiId === 'row');
|
|
14
|
+
if (hasRow) {
|
|
15
|
+
(0, migrationAction_1.migrationAction)(schema, 'simpleField', 'delete', {
|
|
16
|
+
apiId: 'row',
|
|
17
|
+
parentApiId: 'DynamicRow',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return migrationAction_1.client.run(true);
|
|
21
|
+
};
|
|
22
|
+
exports.graphcommerce7_unknown_to_8 = graphcommerce7_unknown_to_8;
|
package/dist/migrations/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./graphcommerce5to6"), exports);
|
|
18
18
|
__exportStar(require("./graphcommerce6to7"), exports);
|
|
19
|
+
__exportStar(require("./graphcommerce7to8"), exports);
|
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.
|
|
5
|
+
"version": "8.0.0-canary.81",
|
|
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.
|
|
23
|
-
"@graphcommerce/next-config": "^8.0.0-canary.
|
|
24
|
-
"@graphcommerce/prettier-config-pwa": "^8.0.0-canary.
|
|
25
|
-
"@graphcommerce/typescript-config-pwa": "^8.0.0-canary.
|
|
22
|
+
"@graphcommerce/eslint-config-pwa": "^8.0.0-canary.81",
|
|
23
|
+
"@graphcommerce/next-config": "^8.0.0-canary.81",
|
|
24
|
+
"@graphcommerce/prettier-config-pwa": "^8.0.0-canary.81",
|
|
25
|
+
"@graphcommerce/typescript-config-pwa": "^8.0.0-canary.81",
|
|
26
26
|
"dotenv": "^16.1.4",
|
|
27
27
|
"graphql": "^16.7.1"
|
|
28
28
|
},
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VisibilityTypes } from '@hygraph/management-sdk'
|
|
2
|
+
import { migrationAction, client } from '../migrationAction'
|
|
3
|
+
import { Schema } from '../types'
|
|
4
|
+
|
|
5
|
+
export const graphcommerce7to7_1 = async (schema: Schema) => {
|
|
6
|
+
if (!client) {
|
|
7
|
+
return 0
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const hasRow = schema.models
|
|
11
|
+
.find((m) => m.apiId === 'DynamicRow')
|
|
12
|
+
?.fields.some((f) => f.apiId === 'row')
|
|
13
|
+
|
|
14
|
+
if (hasRow) {
|
|
15
|
+
migrationAction(schema, 'unionField', 'update', {
|
|
16
|
+
apiId: 'row',
|
|
17
|
+
displayName: 'Row Deprecated',
|
|
18
|
+
parentApiId: 'DynamicRow',
|
|
19
|
+
description: 'This field is deprecated. Use Rows instead.',
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
migrationAction(
|
|
24
|
+
schema,
|
|
25
|
+
'unionField',
|
|
26
|
+
'create',
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Rows',
|
|
29
|
+
apiId: 'rows',
|
|
30
|
+
isList: true,
|
|
31
|
+
reverseField: {
|
|
32
|
+
modelApiIds: ['RowQuote', 'RowLinks', 'RowColumnOne'],
|
|
33
|
+
apiId: 'dynamicRows',
|
|
34
|
+
displayName: 'Dynamic Rows',
|
|
35
|
+
visibility: VisibilityTypes.Hidden,
|
|
36
|
+
isList: true,
|
|
37
|
+
},
|
|
38
|
+
parentApiId: 'DynamicRow',
|
|
39
|
+
},
|
|
40
|
+
'DynamicRow',
|
|
41
|
+
'model',
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return client.run(true)
|
|
45
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { migrationAction, client } from '../migrationAction'
|
|
2
|
+
import { Schema } from '../types'
|
|
3
|
+
|
|
4
|
+
export const graphcommerce7_unknown_to_8 = async (schema: Schema) => {
|
|
5
|
+
if (!client) {
|
|
6
|
+
return 0
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// This migration is for GC 8.0 and is not yet exported as a usable migration.
|
|
10
|
+
|
|
11
|
+
// Removes the deprecated 'Row' field which was deprecated in GC@7.1
|
|
12
|
+
const hasRow = schema.models
|
|
13
|
+
.find((m) => m.apiId === 'DynamicRow')
|
|
14
|
+
?.fields.some((f) => f.apiId === 'row')
|
|
15
|
+
|
|
16
|
+
if (hasRow) {
|
|
17
|
+
migrationAction(schema, 'simpleField', 'delete', {
|
|
18
|
+
apiId: 'row',
|
|
19
|
+
parentApiId: 'DynamicRow',
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return client.run(true)
|
|
24
|
+
}
|
package/src/migrations/index.ts
CHANGED