@takeshape/schema 8.57.0 → 8.61.0
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/es/index.js +2 -1
- package/es/migration/index.js +11 -1
- package/es/migration/to/v3.0.0.js +19 -1
- package/es/migration/to/v3.12.3.js +81 -0
- package/es/migration/to/v3.13.0.js +21 -0
- package/es/migration/utils.js +0 -17
- package/es/project-schema/index.js +2 -0
- package/es/project-schema/v3.12.3.js +1 -0
- package/es/project-schema/v3.13.0.js +1 -0
- package/es/relationships.js +17 -0
- package/es/schema-util.js +9 -4
- package/es/schemas/index.js +5 -3
- package/es/schemas/index.ts +6 -2
- package/es/schemas/project-schema/v3.12.3.json +2358 -0
- package/es/schemas/project-schema/v3.13.0.json +2371 -0
- package/es/types/utils.js +7 -1
- package/es/validate.js +11 -14
- package/examples/latest/betzino.json +2325 -516
- package/examples/latest/blog-schema.json +14 -5
- package/examples/latest/brewery-schema.json +4 -1
- package/examples/latest/complex-project-schema.json +100 -1
- package/examples/latest/fabric-ecommerce.json +1 -1
- package/examples/latest/frank-and-fred-schema.json +673 -1
- package/examples/latest/massive-schema.json +272 -17
- package/examples/latest/mill-components-schema.json +43 -4
- package/examples/latest/pet-oneof-array.json +1 -1
- package/examples/latest/post-schema.json +6 -3
- package/examples/latest/pruned-shopify-product-schema.json +1 -1
- package/examples/latest/real-world-schema.json +18 -3
- package/examples/latest/recursive-repeater-schema.json +4 -1
- package/examples/latest/recursive-schema.json +4 -1
- package/examples/latest/rick-and-morty-ast.json +43 -10
- package/examples/latest/rick-and-morty-graphql.json +24 -6
- package/examples/latest/rick-and-morty-rest.json +1 -1
- package/examples/latest/schema-with-repeater-draftjs.json +10 -1
- package/examples/latest/shape-books-v3_2_0.json +40 -7
- package/examples/latest/shape-books.json +40 -7
- package/examples/latest/shopify-lookbook.json +11 -5
- package/examples/latest/shopify-store-with-widget.json +1 -1
- package/examples/latest/stripe-starter-resolved.json +5 -2
- package/examples/latest/user-schema-no-required.json +1 -1
- package/examples/latest/user-schema-with-defaults.json +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -0
- package/lib/migration/index.d.ts.map +1 -1
- package/lib/migration/index.js +12 -0
- package/lib/migration/to/v3.0.0.d.ts.map +1 -1
- package/lib/migration/to/v3.0.0.js +19 -1
- package/lib/migration/to/v3.12.3.d.ts +4 -0
- package/lib/migration/to/v3.12.3.d.ts.map +1 -0
- package/lib/migration/to/v3.12.3.js +91 -0
- package/lib/migration/to/v3.13.0.d.ts +4 -0
- package/lib/migration/to/v3.13.0.d.ts.map +1 -0
- package/lib/migration/to/v3.13.0.js +32 -0
- package/lib/migration/utils.d.ts +0 -2
- package/lib/migration/utils.d.ts.map +1 -1
- package/lib/migration/utils.js +0 -19
- package/lib/project-schema/index.d.ts +5 -1
- package/lib/project-schema/index.d.ts.map +1 -1
- package/lib/project-schema/index.js +43 -17
- package/lib/project-schema/latest.d.ts +50 -16
- package/lib/project-schema/latest.d.ts.map +1 -1
- package/lib/project-schema/v3.12.3.d.ts +1307 -0
- package/lib/project-schema/v3.12.3.d.ts.map +1 -0
- package/lib/project-schema/v3.12.3.js +5 -0
- package/lib/project-schema/v3.13.0.d.ts +1318 -0
- package/lib/project-schema/v3.13.0.d.ts.map +1 -0
- package/lib/project-schema/v3.13.0.js +5 -0
- package/lib/project-schema/v4.0.0.d.ts +69 -0
- package/lib/project-schema/v4.0.0.d.ts.map +1 -1
- package/lib/relationships.d.ts +3 -0
- package/lib/relationships.d.ts.map +1 -0
- package/lib/relationships.js +24 -0
- package/lib/schema-util.d.ts +1 -0
- package/lib/schema-util.d.ts.map +1 -1
- package/lib/schema-util.js +9 -4
- package/lib/schemas/index.d.ts +2 -2
- package/lib/schemas/index.d.ts.map +1 -1
- package/lib/schemas/index.js +23 -19
- package/lib/schemas/index.ts +6 -2
- package/lib/schemas/project-schema/v3.12.3.json +2358 -0
- package/lib/schemas/project-schema/v3.13.0.json +2371 -0
- package/lib/types/types.d.ts +2 -2
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/utils.d.ts +4 -1
- package/lib/types/utils.d.ts.map +1 -1
- package/lib/types/utils.js +13 -2
- package/lib/validate.d.ts.map +1 -1
- package/lib/validate.js +11 -14
- package/package.json +4 -4
|
@@ -695,6 +695,9 @@
|
|
|
695
695
|
"ASSET"
|
|
696
696
|
],
|
|
697
697
|
"type": "single"
|
|
698
|
+
},
|
|
699
|
+
"@backReference": {
|
|
700
|
+
"enabled": true
|
|
698
701
|
}
|
|
699
702
|
},
|
|
700
703
|
"title": {
|
|
@@ -712,6 +715,9 @@
|
|
|
712
715
|
"SJDIicDUZ"
|
|
713
716
|
],
|
|
714
717
|
"type": "single"
|
|
718
|
+
},
|
|
719
|
+
"@backReference": {
|
|
720
|
+
"enabled": true
|
|
715
721
|
}
|
|
716
722
|
},
|
|
717
723
|
"deck": {
|
|
@@ -732,6 +738,9 @@
|
|
|
732
738
|
"rJBYXVyuQ"
|
|
733
739
|
],
|
|
734
740
|
"type": "multiple"
|
|
741
|
+
},
|
|
742
|
+
"@backReference": {
|
|
743
|
+
"enabled": true
|
|
735
744
|
}
|
|
736
745
|
}
|
|
737
746
|
},
|
|
@@ -766,6 +775,9 @@
|
|
|
766
775
|
"ASSET"
|
|
767
776
|
],
|
|
768
777
|
"type": "single"
|
|
778
|
+
},
|
|
779
|
+
"@backReference": {
|
|
780
|
+
"enabled": true
|
|
769
781
|
}
|
|
770
782
|
},
|
|
771
783
|
"biography": {
|
|
@@ -807,6 +819,9 @@
|
|
|
807
819
|
"r166qcP8Z"
|
|
808
820
|
],
|
|
809
821
|
"type": "single"
|
|
822
|
+
},
|
|
823
|
+
"@backReference": {
|
|
824
|
+
"enabled": true
|
|
810
825
|
}
|
|
811
826
|
},
|
|
812
827
|
"hero": {
|
|
@@ -833,6 +848,9 @@
|
|
|
833
848
|
"ASSET"
|
|
834
849
|
],
|
|
835
850
|
"type": "single"
|
|
851
|
+
},
|
|
852
|
+
"@backReference": {
|
|
853
|
+
"enabled": true
|
|
836
854
|
}
|
|
837
855
|
},
|
|
838
856
|
"featuredPost": {
|
|
@@ -843,8 +861,11 @@
|
|
|
843
861
|
"shapeIds": [
|
|
844
862
|
"rJoobhv8W"
|
|
845
863
|
],
|
|
846
|
-
"type": "single"
|
|
847
|
-
|
|
864
|
+
"type": "single"
|
|
865
|
+
},
|
|
866
|
+
"@backReference": {
|
|
867
|
+
"enabled": true,
|
|
868
|
+
"name": "heroFeaturedPost"
|
|
848
869
|
}
|
|
849
870
|
}
|
|
850
871
|
}
|
|
@@ -926,6 +947,9 @@
|
|
|
926
947
|
"SJDIicDUZ"
|
|
927
948
|
],
|
|
928
949
|
"type": "single"
|
|
950
|
+
},
|
|
951
|
+
"@backReference": {
|
|
952
|
+
"enabled": true
|
|
929
953
|
}
|
|
930
954
|
},
|
|
931
955
|
"credit": {
|
|
@@ -959,8 +983,11 @@
|
|
|
959
983
|
"shapeIds": [
|
|
960
984
|
"SJDIicDUZ"
|
|
961
985
|
],
|
|
962
|
-
"type": "single"
|
|
963
|
-
|
|
986
|
+
"type": "single"
|
|
987
|
+
},
|
|
988
|
+
"@backReference": {
|
|
989
|
+
"enabled": true,
|
|
990
|
+
"name": "authored"
|
|
964
991
|
}
|
|
965
992
|
},
|
|
966
993
|
"coverImage": {
|
|
@@ -972,6 +999,9 @@
|
|
|
972
999
|
"ASSET"
|
|
973
1000
|
],
|
|
974
1001
|
"type": "single"
|
|
1002
|
+
},
|
|
1003
|
+
"@backReference": {
|
|
1004
|
+
"enabled": true
|
|
975
1005
|
}
|
|
976
1006
|
},
|
|
977
1007
|
"genre": {
|
|
@@ -982,8 +1012,11 @@
|
|
|
982
1012
|
"shapeIds": [
|
|
983
1013
|
"rJ9bZzk-m"
|
|
984
1014
|
],
|
|
985
|
-
"type": "single"
|
|
986
|
-
|
|
1015
|
+
"type": "single"
|
|
1016
|
+
},
|
|
1017
|
+
"@backReference": {
|
|
1018
|
+
"enabled": true,
|
|
1019
|
+
"name": "books"
|
|
987
1020
|
}
|
|
988
1021
|
},
|
|
989
1022
|
"publishDate": {
|
|
@@ -1037,6 +1070,6 @@
|
|
|
1037
1070
|
}
|
|
1038
1071
|
}
|
|
1039
1072
|
},
|
|
1040
|
-
"schemaVersion": "3.
|
|
1073
|
+
"schemaVersion": "3.13.0",
|
|
1041
1074
|
"services": {}
|
|
1042
1075
|
}
|
|
@@ -1083,7 +1083,10 @@
|
|
|
1083
1083
|
]
|
|
1084
1084
|
},
|
|
1085
1085
|
"title": "Photo",
|
|
1086
|
-
"@mapping": "takeshape:local:Look.4WzSq3aHx"
|
|
1086
|
+
"@mapping": "takeshape:local:Look.4WzSq3aHx",
|
|
1087
|
+
"@backReference": {
|
|
1088
|
+
"enabled": true
|
|
1089
|
+
}
|
|
1087
1090
|
},
|
|
1088
1091
|
"text": {
|
|
1089
1092
|
"type": "object",
|
|
@@ -1102,11 +1105,14 @@
|
|
|
1102
1105
|
"shapeIds": [
|
|
1103
1106
|
"0DeHE3eJn"
|
|
1104
1107
|
],
|
|
1105
|
-
"type": "multiple"
|
|
1106
|
-
"relatedName": "looks"
|
|
1108
|
+
"type": "multiple"
|
|
1107
1109
|
},
|
|
1108
1110
|
"title": "Products",
|
|
1109
|
-
"@mapping": "takeshape:local:Look.dGVaGVDct"
|
|
1111
|
+
"@mapping": "takeshape:local:Look.dGVaGVDct",
|
|
1112
|
+
"@backReference": {
|
|
1113
|
+
"enabled": true,
|
|
1114
|
+
"name": "looks"
|
|
1115
|
+
}
|
|
1110
1116
|
}
|
|
1111
1117
|
},
|
|
1112
1118
|
"required": [
|
|
@@ -1176,5 +1182,5 @@
|
|
|
1176
1182
|
}
|
|
1177
1183
|
}
|
|
1178
1184
|
},
|
|
1179
|
-
"schemaVersion": "3.
|
|
1185
|
+
"schemaVersion": "3.13.0"
|
|
1180
1186
|
}
|
|
@@ -12534,5 +12534,5 @@
|
|
|
12534
12534
|
}
|
|
12535
12535
|
}
|
|
12536
12536
|
},
|
|
12537
|
-
"schemaVersion": "3.
|
|
12537
|
+
"schemaVersion": "3.13.0"
|
|
12538
12538
|
}
|
|
@@ -1879,7 +1879,10 @@
|
|
|
1879
1879
|
]
|
|
1880
1880
|
},
|
|
1881
1881
|
"title": "Avatar",
|
|
1882
|
-
"@mapping": "takeshape:local:Profile.k0Ha4O7oV"
|
|
1882
|
+
"@mapping": "takeshape:local:Profile.k0Ha4O7oV",
|
|
1883
|
+
"@backReference": {
|
|
1884
|
+
"enabled": true
|
|
1885
|
+
}
|
|
1883
1886
|
},
|
|
1884
1887
|
"stripeCustomerId": {
|
|
1885
1888
|
"type": "string",
|
|
@@ -29312,5 +29315,5 @@
|
|
|
29312
29315
|
}
|
|
29313
29316
|
}
|
|
29314
29317
|
},
|
|
29315
|
-
"schemaVersion": "3.
|
|
29318
|
+
"schemaVersion": "3.13.0"
|
|
29316
29319
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAE,6BAA6B,EAAC,MAAM,mBAAmB,CAAC;AAE1F,YAAY,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAE,6BAA6B,EAAC,MAAM,mBAAmB,CAAC;AAE1F,YAAY,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -347,4 +347,18 @@ Object.keys(_flattenTemplates).forEach(function (key) {
|
|
|
347
347
|
return _flattenTemplates[key];
|
|
348
348
|
}
|
|
349
349
|
});
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
var _relationships = require("./relationships");
|
|
353
|
+
|
|
354
|
+
Object.keys(_relationships).forEach(function (key) {
|
|
355
|
+
if (key === "default" || key === "__esModule") return;
|
|
356
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
357
|
+
if (key in exports && exports[key] === _relationships[key]) return;
|
|
358
|
+
Object.defineProperty(exports, key, {
|
|
359
|
+
enumerable: true,
|
|
360
|
+
get: function () {
|
|
361
|
+
return _relationships[key];
|
|
362
|
+
}
|
|
363
|
+
});
|
|
350
364
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,SAAS,CAAC;AAyC3D,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,6BAA6B,EACtC,aAAa,EAAE,gBAAgB,GAC9B,OAAO,CAAC,aAAa,CAAC,CA8ExB;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,6BAA6B,EACtC,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMpC"}
|
package/lib/migration/index.js
CHANGED
|
@@ -46,6 +46,10 @@ var _v15 = _interopRequireDefault(require("./to/v3.12.1"));
|
|
|
46
46
|
|
|
47
47
|
var _v16 = _interopRequireDefault(require("./to/v3.12.2"));
|
|
48
48
|
|
|
49
|
+
var _v17 = _interopRequireDefault(require("./to/v3.12.3"));
|
|
50
|
+
|
|
51
|
+
var _v18 = _interopRequireDefault(require("./to/v3.13.0"));
|
|
52
|
+
|
|
49
53
|
var _utils2 = require("./utils");
|
|
50
54
|
|
|
51
55
|
Object.keys(_utils2).forEach(function (key) {
|
|
@@ -134,6 +138,14 @@ async function migrateToLatestProjectSchema(context, projectSchema) {
|
|
|
134
138
|
projectSchema = (0, _v16.default)(projectSchema);
|
|
135
139
|
}
|
|
136
140
|
|
|
141
|
+
if ((0, _utils.isProjectSchemaV3_12_2)(projectSchema)) {
|
|
142
|
+
projectSchema = (0, _v17.default)(projectSchema);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if ((0, _utils.isProjectSchemaV3_12_3)(projectSchema)) {
|
|
146
|
+
projectSchema = (0, _v18.default)(projectSchema);
|
|
147
|
+
}
|
|
148
|
+
|
|
137
149
|
return projectSchema;
|
|
138
150
|
}
|
|
139
151
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3.0.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.0.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"v3.0.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.0.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACnB,mBAAmB,EASpB,MAAM,sBAAsB,CAAC;AAoO9B,iBAAS,eAAe,CAAC,aAAa,EAAE,mBAAmB,GAAG,mBAAmB,CAuBhF;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -41,6 +41,24 @@ function getModelType(contentType) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return 'multiple';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getRelationshipSchema(relationship) {
|
|
47
|
+
const itemSchema = {
|
|
48
|
+
$ref: '#/shapes/TSRelationship/schema'
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (relationship.type === 'multiple') {
|
|
52
|
+
return {
|
|
53
|
+
type: 'array',
|
|
54
|
+
items: itemSchema,
|
|
55
|
+
'@relationship': relationship
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { ...itemSchema,
|
|
60
|
+
'@relationship': relationship
|
|
61
|
+
};
|
|
44
62
|
} // eslint-disable-next-line complexity
|
|
45
63
|
|
|
46
64
|
|
|
@@ -87,7 +105,7 @@ function migrateToContentSchemaV3(params) {
|
|
|
87
105
|
return {
|
|
88
106
|
schema: { ...(0, _pick.default)(schema, relationshipType === 'multiple' ? _schemaUtil.multipleRelationshipSchemaKeys : _schemaUtil.schemaMetadataKeys),
|
|
89
107
|
'@mapping': mapping,
|
|
90
|
-
...
|
|
108
|
+
...getRelationshipSchema({
|
|
91
109
|
shapeIds: contentTypeIds,
|
|
92
110
|
type: relationshipType ?? 'single',
|
|
93
111
|
// Type is optional on assets
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProjectSchemaV3_12_2, ProjectSchemaV3_12_3 } from '../../project-schema';
|
|
2
|
+
declare function migrateToV3_12_3({ indexedShapes: oldIndexedShapes, ...projectSchema }: ProjectSchemaV3_12_2): ProjectSchemaV3_12_3;
|
|
3
|
+
export default migrateToV3_12_3;
|
|
4
|
+
//# sourceMappingURL=v3.12.3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3.12.3.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.12.3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAMV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAY9B,iBAAS,gBAAgB,CAAC,EACxB,aAAa,EAAE,gBAAgB,EAC/B,GAAG,aAAa,EACjB,EAAE,oBAAoB,GAAG,oBAAoB,CAwF7C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
function hasWebhook(projectSchema, config) {
|
|
13
|
+
var _config$queries, _config$queries$singl, _projectSchema$querie, _projectSchema$servic;
|
|
14
|
+
|
|
15
|
+
const queryName = (_config$queries = config.queries) === null || _config$queries === void 0 ? void 0 : (_config$queries$singl = _config$queries.single) === null || _config$queries$singl === void 0 ? void 0 : _config$queries$singl.name;
|
|
16
|
+
|
|
17
|
+
if (!queryName) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const resolver = projectSchema === null || projectSchema === void 0 ? void 0 : (_projectSchema$querie = projectSchema.queries[queryName]) === null || _projectSchema$querie === void 0 ? void 0 : _projectSchema$querie.resolver;
|
|
22
|
+
return resolver && 'service' in resolver && (projectSchema === null || projectSchema === void 0 ? void 0 : (_projectSchema$servic = projectSchema.services) === null || _projectSchema$servic === void 0 ? void 0 : _projectSchema$servic[resolver.service].provider) === 'shopify';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function migrateToV3_12_3({
|
|
26
|
+
indexedShapes: oldIndexedShapes,
|
|
27
|
+
...projectSchema
|
|
28
|
+
}) {
|
|
29
|
+
if (!oldIndexedShapes) {
|
|
30
|
+
return { ...projectSchema,
|
|
31
|
+
schemaVersion: '3.12.3'
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const indexedShapes = Object.fromEntries(Object.entries(oldIndexedShapes).map(([shapeName, config]) => {
|
|
36
|
+
var _config$queries$all;
|
|
37
|
+
|
|
38
|
+
const queries = {};
|
|
39
|
+
const triggers = [];
|
|
40
|
+
|
|
41
|
+
if (!config.queries) {
|
|
42
|
+
return [shapeName, { ...config,
|
|
43
|
+
queries,
|
|
44
|
+
triggers
|
|
45
|
+
}];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (hasWebhook(projectSchema, config)) {
|
|
49
|
+
queries.get = config.queries.single;
|
|
50
|
+
triggers.push({
|
|
51
|
+
type: 'webhook',
|
|
52
|
+
query: 'get',
|
|
53
|
+
service: 'shopify',
|
|
54
|
+
events: ['products/create', 'products/update', 'products/delete']
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const oldPagination = (_config$queries$all = config.queries.all) === null || _config$queries$all === void 0 ? void 0 : _config$queries$all.pagination;
|
|
59
|
+
const pagination = oldPagination === undefined ? undefined : oldPagination.type === 'cursor' ? { ...oldPagination,
|
|
60
|
+
itemsToIndexPath: oldPagination.itemsPath,
|
|
61
|
+
pageSize: oldPagination.size,
|
|
62
|
+
pageSizeArg: oldPagination.sizeArg
|
|
63
|
+
} : oldPagination.type === 'offset' ? { ...oldPagination,
|
|
64
|
+
itemsToIndexPath: oldPagination.itemsPath,
|
|
65
|
+
itemTotalPath: oldPagination.totalPath,
|
|
66
|
+
offsetArg: oldPagination.offsetParam
|
|
67
|
+
} : { ...oldPagination,
|
|
68
|
+
itemsToIndexPath: oldPagination.itemsPath,
|
|
69
|
+
pageTotalPath: oldPagination.totalPagesPath
|
|
70
|
+
};
|
|
71
|
+
queries.list = pagination ? { ...(0, _omit.default)(config.queries.all, 'interval'),
|
|
72
|
+
pagination
|
|
73
|
+
} : (0, _omit.default)(config.queries.all, 'interval', 'pagination');
|
|
74
|
+
triggers.push({
|
|
75
|
+
type: 'schedule',
|
|
76
|
+
query: 'list',
|
|
77
|
+
interval: config.queries.all.interval ?? 60 * 24
|
|
78
|
+
});
|
|
79
|
+
return [shapeName, { ...config,
|
|
80
|
+
queries,
|
|
81
|
+
triggers
|
|
82
|
+
}];
|
|
83
|
+
}));
|
|
84
|
+
return { ...projectSchema,
|
|
85
|
+
schemaVersion: '3.12.3',
|
|
86
|
+
indexedShapes
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var _default = migrateToV3_12_3;
|
|
91
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v3.13.0.d.ts","sourceRoot":"","sources":["../../../../src/migration/to/v3.13.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAE,oBAAoB,EAAsB,MAAM,sBAAsB,CAAC;AAI1G,iBAAS,gBAAgB,CAAC,aAAa,EAAE,oBAAoB,GAAG,oBAAoB,CAcnF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _util = require("@takeshape/util");
|
|
9
|
+
|
|
10
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function migrateToV3_13_0(projectSchema) {
|
|
15
|
+
(0, _util.visit)(projectSchema, ['@relationship'], (relationship, path) => {
|
|
16
|
+
const parent = (0, _get.default)(projectSchema, path.slice(0, -1));
|
|
17
|
+
parent['@backReference'] = {
|
|
18
|
+
enabled: true
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (relationship.relatedName) {
|
|
22
|
+
parent['@backReference'].name = relationship.relatedName;
|
|
23
|
+
delete relationship.relatedName;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return { ...projectSchema,
|
|
27
|
+
schemaVersion: '3.13.0'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var _default = migrateToV3_13_0;
|
|
32
|
+
exports.default = _default;
|
package/lib/migration/utils.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Relationship, PropertySchema } from '../project-schema';
|
|
2
1
|
export declare function formatDate(timestamp?: number): string;
|
|
3
|
-
export declare function getRelationshipSchema(relationship: Relationship): PropertySchema;
|
|
4
2
|
export declare function normalizeSchemaVersion(version?: string): string;
|
|
5
3
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/migration/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/migration/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
package/lib/migration/utils.js
CHANGED
|
@@ -4,31 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.formatDate = formatDate;
|
|
7
|
-
exports.getRelationshipSchema = getRelationshipSchema;
|
|
8
7
|
exports.normalizeSchemaVersion = normalizeSchemaVersion;
|
|
9
8
|
|
|
10
9
|
function formatDate(timestamp) {
|
|
11
10
|
return (timestamp ? new Date(timestamp) : new Date()).toISOString();
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function getRelationshipSchema(relationship) {
|
|
15
|
-
const itemSchema = {
|
|
16
|
-
$ref: '#/shapes/TSRelationship/schema'
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
if (relationship.type === 'multiple') {
|
|
20
|
-
return {
|
|
21
|
-
type: 'array',
|
|
22
|
-
items: itemSchema,
|
|
23
|
-
'@relationship': relationship
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return { ...itemSchema,
|
|
28
|
-
'@relationship': relationship
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
13
|
function normalizeSchemaVersion(version) {
|
|
33
14
|
return version === undefined ? '1' : version;
|
|
34
15
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './latest';
|
|
2
2
|
export * from './v4.0.0';
|
|
3
|
+
export * from './v3.13.0';
|
|
4
|
+
export * from './v3.12.3';
|
|
3
5
|
export * from './v3.12.2';
|
|
4
6
|
export * from './v3.12.1';
|
|
5
7
|
export * from './v3.12.0';
|
|
@@ -18,6 +20,8 @@ export * from './v3.1.0';
|
|
|
18
20
|
export * from './v3.0.0';
|
|
19
21
|
export * from './v1.0.0';
|
|
20
22
|
import { ProjectSchemaV4_0_0 } from './v4.0.0';
|
|
23
|
+
import { ProjectSchemaV3_13_0 } from './v3.13.0';
|
|
24
|
+
import { ProjectSchemaV3_12_3 } from './v3.12.3';
|
|
21
25
|
import { ProjectSchemaV3_12_2 } from './v3.12.2';
|
|
22
26
|
import { ProjectSchemaV3_12_1 } from './v3.12.1';
|
|
23
27
|
import { ProjectSchemaV3_12_0 } from './v3.12.0';
|
|
@@ -36,5 +40,5 @@ import { ProjectSchemaV3_1_0 } from './v3.1.0';
|
|
|
36
40
|
import { ProjectSchemaV3_0_0 } from './v3.0.0';
|
|
37
41
|
import { ProjectSchemaV1_0_0 } from './v1.0.0';
|
|
38
42
|
import { ProjectSchema } from './latest';
|
|
39
|
-
export declare type AnyProjectSchema = ProjectSchemaV4_0_0 | ProjectSchemaV3_12_2 | ProjectSchemaV3_12_1 | ProjectSchemaV3_12_0 | ProjectSchemaV3_11_0 | ProjectSchemaV3_10_0 | ProjectSchemaV3_9_0 | ProjectSchemaV3_8_0 | ProjectSchemaV3_7_0 | ProjectSchemaV3_6_0 | ProjectSchemaV3_5_1 | ProjectSchemaV3_5_0 | ProjectSchemaV3_4_0 | ProjectSchemaV3_3_0 | ProjectSchemaV3_2_0 | ProjectSchemaV3_1_0 | ProjectSchemaV3_0_0 | ProjectSchemaV1_0_0 | ProjectSchema;
|
|
43
|
+
export declare type AnyProjectSchema = ProjectSchemaV4_0_0 | ProjectSchemaV3_13_0 | ProjectSchemaV3_12_3 | ProjectSchemaV3_12_2 | ProjectSchemaV3_12_1 | ProjectSchemaV3_12_0 | ProjectSchemaV3_11_0 | ProjectSchemaV3_10_0 | ProjectSchemaV3_9_0 | ProjectSchemaV3_8_0 | ProjectSchemaV3_7_0 | ProjectSchemaV3_6_0 | ProjectSchemaV3_5_1 | ProjectSchemaV3_5_0 | ProjectSchemaV3_4_0 | ProjectSchemaV3_3_0 | ProjectSchemaV3_2_0 | ProjectSchemaV3_1_0 | ProjectSchemaV3_0_0 | ProjectSchemaV1_0_0 | ProjectSchema;
|
|
40
44
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/project-schema/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,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