@takeshape/schema 7.194.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.
Files changed (312) hide show
  1. package/README.md +5 -0
  2. package/es/api-version.js +21 -0
  3. package/es/auth-schemas.js +0 -0
  4. package/es/builtin-schema.js +590 -0
  5. package/es/content-schema-transform.js +192 -0
  6. package/es/entitlements.js +0 -0
  7. package/es/enum.js +11 -0
  8. package/es/get-is-leaf.js +58 -0
  9. package/es/index.js +25 -0
  10. package/es/migration.js +413 -0
  11. package/es/mocks.js +47 -0
  12. package/es/patterns.js +0 -0
  13. package/es/project-schema/index.js +10 -0
  14. package/es/project-schema/v1.0.0.js +0 -0
  15. package/es/project-schema/v3.0.0.js +0 -0
  16. package/es/project-schema/v3.1.0.js +0 -0
  17. package/es/project-schema/v3.2.0.js +0 -0
  18. package/es/project-schema/v3.3.0.js +0 -0
  19. package/es/project-schema/v3.4.0.js +0 -0
  20. package/es/project-schema/v3.5.0.js +0 -0
  21. package/es/project-schema/v3.5.1.js +0 -0
  22. package/es/project-schema/v3.6.0.js +0 -0
  23. package/es/refs.js +301 -0
  24. package/es/resolvers.js +2 -0
  25. package/es/scalars.js +4 -0
  26. package/es/schema-util.js +1197 -0
  27. package/es/schemas/auth-schemas.json +313 -0
  28. package/es/schemas/project-schema/meta-schema-v1.0.0.json +209 -0
  29. package/es/schemas/project-schema/meta-schema-v3.0.0.json +609 -0
  30. package/es/schemas/project-schema/meta-schema-v3.1.0.json +609 -0
  31. package/es/schemas/project-schema/meta-schema-v3.2.0.json +613 -0
  32. package/es/schemas/project-schema/meta-schema-v3.3.0.json +613 -0
  33. package/es/schemas/project-schema/meta-schema-v3.4.0.json +613 -0
  34. package/es/schemas/project-schema/meta-schema-v3.5.0.json +627 -0
  35. package/es/schemas/project-schema/meta-schema-v3.5.1.json +630 -0
  36. package/es/schemas/project-schema/meta-schema-v3.6.0.json +633 -0
  37. package/es/schemas/project-schema/v1.0.0.json +321 -0
  38. package/es/schemas/project-schema/v3.0.0.json +411 -0
  39. package/es/schemas/project-schema/v3.1.0.json +569 -0
  40. package/es/schemas/project-schema/v3.2.0.json +577 -0
  41. package/es/schemas/project-schema/v3.3.0.json +578 -0
  42. package/es/schemas/project-schema/v3.4.0.json +568 -0
  43. package/es/schemas/project-schema/v3.5.0.json +568 -0
  44. package/es/schemas/project-schema/v3.5.1.json +568 -0
  45. package/es/schemas/project-schema/v3.6.0.json +584 -0
  46. package/es/schemas/project-schema.json +16 -0
  47. package/es/schemas/user-schema.json +58 -0
  48. package/es/services.js +379 -0
  49. package/es/taxonomies.js +55 -0
  50. package/es/template-shapes.js +79 -0
  51. package/es/types.js +202 -0
  52. package/es/unions.js +137 -0
  53. package/es/user-schema.js +0 -0
  54. package/es/util/detect-cycles.js +54 -0
  55. package/es/util/index.js +1 -0
  56. package/es/validate.js +764 -0
  57. package/es/versions.js +4 -0
  58. package/es/workflows.js +69 -0
  59. package/examples/.pnpm-debug.log +20 -0
  60. package/examples/v1_0_0/beer-schema.json +125 -0
  61. package/examples/v1_0_0/blog-schema.json +192 -0
  62. package/examples/v1_0_0/brewery-schema.json +232 -0
  63. package/examples/v1_0_0/complex-project-schema.json +3197 -0
  64. package/examples/v1_0_0/error-schema.json +275 -0
  65. package/examples/v1_0_0/frank-and-fred-schema.json +21387 -0
  66. package/examples/v1_0_0/massive-schema.json +6930 -0
  67. package/examples/v1_0_0/post-schema.json +83 -0
  68. package/examples/v1_0_0/real-world-schema.json +797 -0
  69. package/examples/v1_0_0/recursive-repeater-schema.json +69 -0
  70. package/examples/v1_0_0/recursive-schema.json +79 -0
  71. package/examples/v1_0_0/schema-with-repeater-draftjs.json +292 -0
  72. package/examples/v1_0_0/shape-books.json +797 -0
  73. package/examples/v1_0_0/user-schema-no-required.json +84 -0
  74. package/examples/v1_0_0/user-schema-with-defaults.json +105 -0
  75. package/examples/v1_0_0/user-schema-with-obj-prop.json +92 -0
  76. package/examples/v1_0_0/user-schema.json +87 -0
  77. package/examples/v3_0_0/rick-and-morty-rest.json +62 -0
  78. package/examples/v3_0_0/shopify-lookbook.json +1172 -0
  79. package/examples/v3_0_0/shopify-store-with-widget.json +11323 -0
  80. package/examples/v3_2_0/blog-schema.json +378 -0
  81. package/examples/v3_2_0/brewery-schema.json +385 -0
  82. package/examples/v3_2_0/complex-project-schema.json +3748 -0
  83. package/examples/v3_2_0/frank-and-fred-schema.json +19217 -0
  84. package/examples/v3_2_0/massive-schema.json +6676 -0
  85. package/examples/v3_2_0/pet-oneof-array.json +323 -0
  86. package/examples/v3_2_0/post-schema.json +265 -0
  87. package/examples/v3_2_0/real-world-schema.json +970 -0
  88. package/examples/v3_2_0/recursive-repeater-schema.json +144 -0
  89. package/examples/v3_2_0/recursive-schema.json +151 -0
  90. package/examples/v3_2_0/rick-and-morty-rest.json +65 -0
  91. package/examples/v3_2_0/schema-with-repeater-draftjs.json +381 -0
  92. package/examples/v3_2_0/shape-books.json +1044 -0
  93. package/examples/v3_2_0/shopify-store-with-widget.json +11016 -0
  94. package/examples/v3_2_0/user-schema-no-required.json +174 -0
  95. package/examples/v3_2_0/user-schema-with-defaults.json +187 -0
  96. package/examples/v3_3_0/blog-schema.json +405 -0
  97. package/examples/v3_3_0/brewery-schema.json +406 -0
  98. package/examples/v3_3_0/complex-project-schema.json +4076 -0
  99. package/examples/v3_3_0/frank-and-fred-schema.json +20913 -0
  100. package/examples/v3_3_0/massive-schema.json +7309 -0
  101. package/examples/v3_3_0/pet-oneof-array.json +380 -0
  102. package/examples/v3_3_0/post-schema.json +248 -0
  103. package/examples/v3_3_0/real-world-schema.json +1046 -0
  104. package/examples/v3_3_0/recursive-repeater-schema.json +154 -0
  105. package/examples/v3_3_0/recursive-schema.json +161 -0
  106. package/examples/v3_3_0/rick-and-morty-rest.json +101 -0
  107. package/examples/v3_3_0/schema-with-repeater-draftjs.json +393 -0
  108. package/examples/v3_3_0/shape-books.json +1121 -0
  109. package/examples/v3_3_0/shopify-lookbook.json +1196 -0
  110. package/examples/v3_3_0/shopify-store-with-widget.json +11320 -0
  111. package/examples/v3_3_0/user-schema-no-required.json +185 -0
  112. package/examples/v3_3_0/user-schema-with-defaults.json +210 -0
  113. package/examples/v3_4_0/blog-schema.json +405 -0
  114. package/examples/v3_4_0/brewery-schema.json +406 -0
  115. package/examples/v3_4_0/complex-project-schema.json +4076 -0
  116. package/examples/v3_4_0/frank-and-fred-schema.json +20913 -0
  117. package/examples/v3_4_0/massive-schema.json +7309 -0
  118. package/examples/v3_4_0/pet-oneof-array.json +420 -0
  119. package/examples/v3_4_0/post-schema.json +248 -0
  120. package/examples/v3_4_0/real-world-schema.json +1046 -0
  121. package/examples/v3_4_0/recursive-repeater-schema.json +154 -0
  122. package/examples/v3_4_0/recursive-schema.json +161 -0
  123. package/examples/v3_4_0/rick-and-morty-rest.json +101 -0
  124. package/examples/v3_4_0/schema-with-repeater-draftjs.json +393 -0
  125. package/examples/v3_4_0/shape-books.json +1121 -0
  126. package/examples/v3_4_0/shopify-lookbook.json +1196 -0
  127. package/examples/v3_4_0/shopify-store-with-widget.json +11323 -0
  128. package/examples/v3_4_0/user-schema-no-required.json +185 -0
  129. package/examples/v3_4_0/user-schema-with-defaults.json +210 -0
  130. package/examples/v3_5_0/blog-schema.json +405 -0
  131. package/examples/v3_5_0/brewery-schema.json +406 -0
  132. package/examples/v3_5_0/complex-project-schema.json +4076 -0
  133. package/examples/v3_5_0/frank-and-fred-schema.json +20913 -0
  134. package/examples/v3_5_0/massive-schema.json +7309 -0
  135. package/examples/v3_5_0/pet-oneof-array.json +420 -0
  136. package/examples/v3_5_0/post-schema.json +248 -0
  137. package/examples/v3_5_0/real-world-schema.json +1046 -0
  138. package/examples/v3_5_0/recursive-repeater-schema.json +154 -0
  139. package/examples/v3_5_0/recursive-schema.json +161 -0
  140. package/examples/v3_5_0/rick-and-morty-rest.json +101 -0
  141. package/examples/v3_5_0/schema-with-repeater-draftjs.json +393 -0
  142. package/examples/v3_5_0/shape-books.json +1121 -0
  143. package/examples/v3_5_0/shopify-lookbook.json +1196 -0
  144. package/examples/v3_5_0/shopify-store-with-widget.json +12271 -0
  145. package/examples/v3_5_0/user-schema-no-required.json +185 -0
  146. package/examples/v3_5_0/user-schema-with-defaults.json +210 -0
  147. package/examples/v3_5_1/blog-schema.json +405 -0
  148. package/examples/v3_5_1/brewery-schema.json +406 -0
  149. package/examples/v3_5_1/complex-project-schema.json +4076 -0
  150. package/examples/v3_5_1/frank-and-fred-schema.json +20913 -0
  151. package/examples/v3_5_1/massive-schema.json +7309 -0
  152. package/examples/v3_5_1/pet-oneof-array.json +420 -0
  153. package/examples/v3_5_1/post-schema.json +248 -0
  154. package/examples/v3_5_1/real-world-schema.json +1046 -0
  155. package/examples/v3_5_1/recursive-repeater-schema.json +154 -0
  156. package/examples/v3_5_1/recursive-schema.json +161 -0
  157. package/examples/v3_5_1/rick-and-morty-rest.json +101 -0
  158. package/examples/v3_5_1/schema-with-repeater-draftjs.json +393 -0
  159. package/examples/v3_5_1/shape-books.json +1121 -0
  160. package/examples/v3_5_1/shopify-lookbook.json +1196 -0
  161. package/examples/v3_5_1/shopify-store-with-widget.json +12271 -0
  162. package/examples/v3_5_1/stripe-starter-resolved.json +21419 -0
  163. package/examples/v3_5_1/user-schema-no-required.json +185 -0
  164. package/examples/v3_5_1/user-schema-with-defaults.json +210 -0
  165. package/examples/v3_6_0/blog-schema.json +405 -0
  166. package/examples/v3_6_0/brewery-schema.json +406 -0
  167. package/examples/v3_6_0/complex-project-schema.json +4076 -0
  168. package/examples/v3_6_0/frank-and-fred-schema.json +20913 -0
  169. package/examples/v3_6_0/massive-schema.json +7309 -0
  170. package/examples/v3_6_0/pet-oneof-array.json +420 -0
  171. package/examples/v3_6_0/post-schema.json +248 -0
  172. package/examples/v3_6_0/real-world-schema.json +1046 -0
  173. package/examples/v3_6_0/recursive-repeater-schema.json +154 -0
  174. package/examples/v3_6_0/recursive-schema.json +161 -0
  175. package/examples/v3_6_0/rick-and-morty-rest.json +101 -0
  176. package/examples/v3_6_0/schema-with-repeater-draftjs.json +393 -0
  177. package/examples/v3_6_0/shape-books.json +1121 -0
  178. package/examples/v3_6_0/shopify-lookbook.json +1196 -0
  179. package/examples/v3_6_0/shopify-store-with-widget.json +12271 -0
  180. package/examples/v3_6_0/stripe-starter-resolved.json +21419 -0
  181. package/examples/v3_6_0/user-schema-no-required.json +185 -0
  182. package/examples/v3_6_0/user-schema-with-defaults.json +210 -0
  183. package/lib/api-version.d.ts +6 -0
  184. package/lib/api-version.d.ts.map +1 -0
  185. package/lib/api-version.js +36 -0
  186. package/lib/auth-schemas.d.ts +105 -0
  187. package/lib/auth-schemas.d.ts.map +1 -0
  188. package/lib/auth-schemas.js +1 -0
  189. package/lib/builtin-schema.d.ts +8 -0
  190. package/lib/builtin-schema.d.ts.map +1 -0
  191. package/lib/builtin-schema.js +606 -0
  192. package/lib/content-schema-transform.d.ts +41 -0
  193. package/lib/content-schema-transform.d.ts.map +1 -0
  194. package/lib/content-schema-transform.js +217 -0
  195. package/lib/entitlements.d.ts +1 -0
  196. package/lib/entitlements.d.ts.map +1 -0
  197. package/lib/entitlements.js +1 -0
  198. package/lib/enum.d.ts +3 -0
  199. package/lib/enum.d.ts.map +1 -0
  200. package/lib/enum.js +18 -0
  201. package/lib/get-is-leaf.d.ts +4 -0
  202. package/lib/get-is-leaf.d.ts.map +1 -0
  203. package/lib/get-is-leaf.js +68 -0
  204. package/lib/index.d.ts +27 -0
  205. package/lib/index.d.ts.map +1 -0
  206. package/lib/index.js +359 -0
  207. package/lib/migration.d.ts +55 -0
  208. package/lib/migration.d.ts.map +1 -0
  209. package/lib/migration.js +463 -0
  210. package/lib/mocks.d.ts +13 -0
  211. package/lib/mocks.d.ts.map +1 -0
  212. package/lib/mocks.js +61 -0
  213. package/lib/patterns.d.ts +13 -0
  214. package/lib/patterns.d.ts.map +1 -0
  215. package/lib/patterns.js +1 -0
  216. package/lib/project-schema/index.d.ts +21 -0
  217. package/lib/project-schema/index.d.ts.map +1 -0
  218. package/lib/project-schema/index.js +122 -0
  219. package/lib/project-schema/v1.0.0.d.ts +293 -0
  220. package/lib/project-schema/v1.0.0.d.ts.map +1 -0
  221. package/lib/project-schema/v1.0.0.js +1 -0
  222. package/lib/project-schema/v3.0.0.d.ts +480 -0
  223. package/lib/project-schema/v3.0.0.d.ts.map +1 -0
  224. package/lib/project-schema/v3.0.0.js +1 -0
  225. package/lib/project-schema/v3.1.0.d.ts +623 -0
  226. package/lib/project-schema/v3.1.0.d.ts.map +1 -0
  227. package/lib/project-schema/v3.1.0.js +1 -0
  228. package/lib/project-schema/v3.2.0.d.ts +634 -0
  229. package/lib/project-schema/v3.2.0.d.ts.map +1 -0
  230. package/lib/project-schema/v3.2.0.js +1 -0
  231. package/lib/project-schema/v3.3.0.d.ts +634 -0
  232. package/lib/project-schema/v3.3.0.d.ts.map +1 -0
  233. package/lib/project-schema/v3.3.0.js +1 -0
  234. package/lib/project-schema/v3.4.0.d.ts +626 -0
  235. package/lib/project-schema/v3.4.0.d.ts.map +1 -0
  236. package/lib/project-schema/v3.4.0.js +1 -0
  237. package/lib/project-schema/v3.5.0.d.ts +651 -0
  238. package/lib/project-schema/v3.5.0.d.ts.map +1 -0
  239. package/lib/project-schema/v3.5.0.js +1 -0
  240. package/lib/project-schema/v3.5.1.d.ts +651 -0
  241. package/lib/project-schema/v3.5.1.d.ts.map +1 -0
  242. package/lib/project-schema/v3.5.1.js +1 -0
  243. package/lib/project-schema/v3.6.0.d.ts +660 -0
  244. package/lib/project-schema/v3.6.0.d.ts.map +1 -0
  245. package/lib/project-schema/v3.6.0.js +1 -0
  246. package/lib/refs.d.ts +122 -0
  247. package/lib/refs.d.ts.map +1 -0
  248. package/lib/refs.js +359 -0
  249. package/lib/resolvers.d.ts +4 -0
  250. package/lib/resolvers.d.ts.map +1 -0
  251. package/lib/resolvers.js +10 -0
  252. package/lib/scalars.d.ts +3 -0
  253. package/lib/scalars.d.ts.map +1 -0
  254. package/lib/scalars.js +13 -0
  255. package/lib/schema-util.d.ts +201 -0
  256. package/lib/schema-util.d.ts.map +1 -0
  257. package/lib/schema-util.js +1353 -0
  258. package/lib/schemas/auth-schemas.json +313 -0
  259. package/lib/schemas/project-schema/meta-schema-v1.0.0.json +209 -0
  260. package/lib/schemas/project-schema/meta-schema-v3.0.0.json +609 -0
  261. package/lib/schemas/project-schema/meta-schema-v3.1.0.json +609 -0
  262. package/lib/schemas/project-schema/meta-schema-v3.2.0.json +613 -0
  263. package/lib/schemas/project-schema/meta-schema-v3.3.0.json +613 -0
  264. package/lib/schemas/project-schema/meta-schema-v3.4.0.json +613 -0
  265. package/lib/schemas/project-schema/meta-schema-v3.5.0.json +627 -0
  266. package/lib/schemas/project-schema/meta-schema-v3.5.1.json +630 -0
  267. package/lib/schemas/project-schema/meta-schema-v3.6.0.json +633 -0
  268. package/lib/schemas/project-schema/v1.0.0.json +321 -0
  269. package/lib/schemas/project-schema/v3.0.0.json +411 -0
  270. package/lib/schemas/project-schema/v3.1.0.json +569 -0
  271. package/lib/schemas/project-schema/v3.2.0.json +577 -0
  272. package/lib/schemas/project-schema/v3.3.0.json +578 -0
  273. package/lib/schemas/project-schema/v3.4.0.json +568 -0
  274. package/lib/schemas/project-schema/v3.5.0.json +568 -0
  275. package/lib/schemas/project-schema/v3.5.1.json +568 -0
  276. package/lib/schemas/project-schema/v3.6.0.json +584 -0
  277. package/lib/schemas/project-schema.json +16 -0
  278. package/lib/schemas/user-schema.json +58 -0
  279. package/lib/services.d.ts +71 -0
  280. package/lib/services.d.ts.map +1 -0
  281. package/lib/services.js +413 -0
  282. package/lib/taxonomies.d.ts +16 -0
  283. package/lib/taxonomies.d.ts.map +1 -0
  284. package/lib/taxonomies.js +69 -0
  285. package/lib/template-shapes.d.ts +32 -0
  286. package/lib/template-shapes.d.ts.map +1 -0
  287. package/lib/template-shapes.js +100 -0
  288. package/lib/types.d.ts +187 -0
  289. package/lib/types.d.ts.map +1 -0
  290. package/lib/types.js +289 -0
  291. package/lib/unions.d.ts +29 -0
  292. package/lib/unions.d.ts.map +1 -0
  293. package/lib/unions.js +167 -0
  294. package/lib/user-schema.d.ts +39 -0
  295. package/lib/user-schema.d.ts.map +1 -0
  296. package/lib/user-schema.js +1 -0
  297. package/lib/util/detect-cycles.d.ts +6 -0
  298. package/lib/util/detect-cycles.d.ts.map +1 -0
  299. package/lib/util/detect-cycles.js +61 -0
  300. package/lib/util/index.d.ts +2 -0
  301. package/lib/util/index.d.ts.map +1 -0
  302. package/lib/util/index.js +18 -0
  303. package/lib/validate.d.ts +49 -0
  304. package/lib/validate.d.ts.map +1 -0
  305. package/lib/validate.js +823 -0
  306. package/lib/versions.d.ts +5 -0
  307. package/lib/versions.d.ts.map +1 -0
  308. package/lib/versions.js +14 -0
  309. package/lib/workflows.d.ts +15 -0
  310. package/lib/workflows.d.ts.map +1 -0
  311. package/lib/workflows.js +92 -0
  312. package/package.json +65 -0
@@ -0,0 +1,606 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isAsset = isAsset;
7
+ exports.getAssetS3Path = getAssetS3Path;
8
+ exports.setAssetS3Path = setAssetS3Path;
9
+ exports.builtInForms = exports.builtInShapes = void 0;
10
+
11
+ function isAsset(content) {
12
+ return content._contentTypeId === 'ASSET' || content._shapeId === 'ASSET';
13
+ }
14
+
15
+ const ASSET_PATH = 'Hk6FQuz5';
16
+
17
+ function getAssetS3Path(content) {
18
+ return content[ASSET_PATH];
19
+ }
20
+
21
+ function setAssetS3Path(content, path) {
22
+ content[ASSET_PATH] = path;
23
+ }
24
+
25
+ const builtInShapes = {
26
+ TSRelationship: {
27
+ id: 'TSRelationship',
28
+ name: 'TSRelationship',
29
+ title: 'Relationship',
30
+ schema: {
31
+ type: 'object',
32
+ properties: {
33
+ shapeId: {
34
+ type: 'string'
35
+ },
36
+ shapeName: {
37
+ type: 'string'
38
+ },
39
+ contentTypeId: {
40
+ type: 'string',
41
+ '@deprecationReason': 'Use shapeId instead'
42
+ },
43
+ id: {
44
+ type: 'string'
45
+ }
46
+ },
47
+ required: ['id']
48
+ }
49
+ },
50
+ TSColorHsl: {
51
+ id: 'TSColorHsl',
52
+ name: 'TSColorHsl',
53
+ title: 'Color Hsl',
54
+ schema: {
55
+ type: 'object',
56
+ properties: {
57
+ h: {
58
+ type: 'number'
59
+ },
60
+ a: {
61
+ type: 'number'
62
+ },
63
+ s: {
64
+ type: 'number'
65
+ },
66
+ l: {
67
+ type: 'number'
68
+ }
69
+ }
70
+ }
71
+ },
72
+ TSColorHsv: {
73
+ id: 'TSColorHsv',
74
+ name: 'TSColorHsv',
75
+ title: 'Color Hsv',
76
+ schema: {
77
+ type: 'object',
78
+ properties: {
79
+ h: {
80
+ type: 'number'
81
+ },
82
+ a: {
83
+ type: 'number'
84
+ },
85
+ s: {
86
+ type: 'number'
87
+ },
88
+ v: {
89
+ type: 'number'
90
+ }
91
+ }
92
+ }
93
+ },
94
+ TSColorRgb: {
95
+ id: 'TSColorRgb',
96
+ name: 'TSColorRgb',
97
+ title: 'Color Rgb',
98
+ schema: {
99
+ type: 'object',
100
+ properties: {
101
+ a: {
102
+ type: 'number'
103
+ },
104
+ b: {
105
+ type: 'number'
106
+ },
107
+ r: {
108
+ type: 'number'
109
+ },
110
+ g: {
111
+ type: 'number'
112
+ }
113
+ }
114
+ }
115
+ },
116
+ TSColor: {
117
+ id: 'TSColor',
118
+ name: 'TSColor',
119
+ title: 'Color',
120
+ schema: {
121
+ type: 'object',
122
+ properties: {
123
+ hex: {
124
+ type: 'string'
125
+ },
126
+ hsl: {
127
+ $ref: '#/shapes/TSColorHsl/schema'
128
+ },
129
+ hsv: {
130
+ $ref: '#/shapes/TSColorHsv/schema'
131
+ },
132
+ rgb: {
133
+ $ref: '#/shapes/TSColorRgb/schema'
134
+ }
135
+ }
136
+ }
137
+ },
138
+ Asset: {
139
+ id: 'ASSET',
140
+ name: 'Asset',
141
+ title: 'Asset',
142
+ model: {
143
+ type: 'multiple'
144
+ },
145
+ schema: {
146
+ type: 'object',
147
+ properties: {
148
+ title: {
149
+ type: 'string',
150
+ title: 'Title',
151
+ '@mapping': 'takeshape:local:Asset.By5tQOMc'
152
+ },
153
+ description: {
154
+ type: 'string',
155
+ title: 'Description',
156
+ '@mapping': 'takeshape:local:Asset.B1Zsra3fx'
157
+ },
158
+ filename: {
159
+ type: 'string',
160
+ title: 'Filename',
161
+ '@l10n': false,
162
+ minLength: 1,
163
+ '@mapping': 'takeshape:local:Asset.H1oYQOM9'
164
+ },
165
+ caption: {
166
+ type: 'object',
167
+ title: 'Caption',
168
+ '@mapping': 'takeshape:local:Asset.SyWVsd98x',
169
+ '@tag': 'draftjs'
170
+ },
171
+ credit: {
172
+ type: 'object',
173
+ title: 'Credit',
174
+ '@mapping': 'takeshape:local:Asset.Skn_i_5Ll',
175
+ '@tag': 'draftjs'
176
+ },
177
+ path: {
178
+ type: 'string',
179
+ title: 'Path',
180
+ '@l10n': false,
181
+ minLength: 1,
182
+ '@mapping': 'takeshape:local:Asset.Hk6FQuz5'
183
+ },
184
+ mimeType: {
185
+ type: 'string',
186
+ title: 'MIME type',
187
+ '@l10n': false,
188
+ '@mapping': 'takeshape:local:Asset.SyCYX_Gq'
189
+ },
190
+ sourceUrl: {
191
+ type: 'string',
192
+ title: 'Source URL',
193
+ '@l10n': false,
194
+ '@mapping': 'takeshape:local:Asset.SJXSidnXE'
195
+ },
196
+ uploadStatus: {
197
+ type: 'string',
198
+ title: 'Upload status',
199
+ '@l10n': false,
200
+ '@mapping': 'takeshape:local:Asset.ByeAYXdG9'
201
+ }
202
+ },
203
+ required: ['filename', 'path']
204
+ }
205
+ },
206
+ TsStaticSite: {
207
+ id: 'SITE',
208
+ name: 'TsStaticSite',
209
+ title: 'Static Site',
210
+ model: {
211
+ type: 'multiple'
212
+ },
213
+ schema: {
214
+ type: 'object',
215
+ properties: {
216
+ title: {
217
+ type: 'string',
218
+ title: 'Title',
219
+ '@l10n': false,
220
+ minLength: 1,
221
+ '@mapping': 'takeshape:local:TsStaticSite.Ski9jLuXg'
222
+ },
223
+ baseUrl: {
224
+ type: 'string',
225
+ title: 'Base URL',
226
+ '@l10n': false,
227
+ minLength: 1,
228
+ '@mapping': 'takeshape:local:TsStaticSite.Bk3tNmrfE'
229
+ },
230
+ provider: {
231
+ type: 'string',
232
+ default: 's3',
233
+ title: 'Provider',
234
+ '@l10n': false,
235
+ oneOf: [{
236
+ enum: ['s3'],
237
+ title: 'S3'
238
+ }, {
239
+ enum: ['gcs'],
240
+ title: 'Google Cloud Storage'
241
+ }, {
242
+ enum: ['ftp'],
243
+ title: 'FTP Client'
244
+ }, {
245
+ enum: ['azure'],
246
+ title: 'Azure Storage Account'
247
+ }, {
248
+ enum: ['netlify'],
249
+ title: 'Netlify'
250
+ }, {
251
+ enum: ['vercel'],
252
+ title: 'Vercel'
253
+ }],
254
+ '@mapping': 'takeshape:local:TsStaticSite.SkwbT2hqe'
255
+ },
256
+ idKey: {
257
+ type: 'string',
258
+ title: 'Id Key',
259
+ '@l10n': false,
260
+ minLength: 1,
261
+ '@mapping': 'takeshape:local:TsStaticSite.SyRhi8_me'
262
+ },
263
+ secretKey: {
264
+ type: 'string',
265
+ title: 'Secret Key',
266
+ '@l10n': false,
267
+ '@sensitive': true,
268
+ minLength: 1,
269
+ '@mapping': 'takeshape:local:TsStaticSite.BkIajLdXl'
270
+ },
271
+ destination: {
272
+ type: 'string',
273
+ title: 'Destination',
274
+ '@l10n': false,
275
+ minLength: 1,
276
+ '@mapping': 'takeshape:local:TsStaticSite.Hk6TsIdXl'
277
+ },
278
+ privateAcl: {
279
+ type: 'boolean',
280
+ title: 'Private ACL',
281
+ '@l10n': false,
282
+ '@mapping': 'takeshape:local:TsStaticSite.ByFe48wWU'
283
+ },
284
+ environmentVariables: {
285
+ type: 'array',
286
+ title: 'Environment Variables',
287
+ '@l10n': false,
288
+ items: {
289
+ $ref: '#/shapes/TsStaticSiteEnvironmentVariables/schema'
290
+ },
291
+ '@mapping': 'takeshape:local:TsStaticSite.9fj4UiNxY'
292
+ },
293
+ triggers: {
294
+ type: 'array',
295
+ title: 'Publish Triggers',
296
+ '@l10n': false,
297
+ items: {
298
+ $ref: '#/shapes/TsStaticSiteTriggers/schema'
299
+ }
300
+ },
301
+ templateHash: {
302
+ type: 'string',
303
+ title: 'Template Hash',
304
+ '@l10n': false,
305
+ '@mapping': 'takeshape:local:TsStaticSite.S1QA3GYI8'
306
+ }
307
+ },
308
+ required: ['title', 'provider', 'destination']
309
+ }
310
+ },
311
+ TsStaticSiteEnvironmentVariables: {
312
+ id: '9fj4UiNxY',
313
+ name: 'TsStaticSiteEnvironmentVariables',
314
+ title: 'Static Site EnvironmentVariables',
315
+ schema: {
316
+ type: 'object',
317
+ properties: {
318
+ name: {
319
+ type: 'string',
320
+ title: 'Name',
321
+ '@mapping': 'takeshape:local:TsStaticSite.J8sbHgfdI'
322
+ },
323
+ value: {
324
+ type: 'string',
325
+ title: 'Value',
326
+ '@mapping': 'takeshape:local:TsStaticSite.ndhh88DvG'
327
+ }
328
+ }
329
+ }
330
+ },
331
+ TsStaticSiteTriggers: {
332
+ id: 'TsStaticSiteTriggers',
333
+ name: 'TsStaticSiteTriggers',
334
+ title: 'Static Site Triggers',
335
+ schema: {
336
+ type: 'object',
337
+ properties: {
338
+ contentTypeId: {
339
+ type: 'string',
340
+ title: 'Content Type'
341
+ },
342
+ status: {
343
+ type: 'string',
344
+ title: 'Workflow Status'
345
+ }
346
+ }
347
+ }
348
+ }
349
+ };
350
+ exports.builtInShapes = builtInShapes;
351
+ const builtInForms = {
352
+ Asset: {
353
+ default: {
354
+ order: ['title', 'description', 'caption', 'credit', 'filename', 'path', 'mimeType', 'sourceUrl', 'uploadStatus'],
355
+ properties: {
356
+ title: {
357
+ widget: 'singleLineText',
358
+ disabled: true
359
+ },
360
+ description: {
361
+ widget: 'paragraphText',
362
+ disabled: true
363
+ },
364
+ caption: {
365
+ widget: 'wysiwygSingleLineText',
366
+ disabled: true
367
+ },
368
+ credit: {
369
+ widget: 'wysiwygSingleLineText',
370
+ disabled: true
371
+ },
372
+ filename: {
373
+ widget: 'singleLineText',
374
+ disabled: true
375
+ },
376
+ path: {
377
+ widget: 'singleLineText',
378
+ disabled: true
379
+ },
380
+ mimeType: {
381
+ widget: 'singleLineText',
382
+ disabled: true
383
+ },
384
+ sourceUrl: {
385
+ widget: 'singleLineText',
386
+ disabled: true
387
+ },
388
+ uploadStatus: {
389
+ widget: 'singleLineText',
390
+ disabled: true
391
+ }
392
+ }
393
+ }
394
+ },
395
+ TsStaticSite: {
396
+ default: {
397
+ order: ['title', 'provider', 'destination', 'idKey', 'secretKey', 'environmentVariables'],
398
+ properties: {
399
+ title: {
400
+ widget: 'singleLineText',
401
+ disabled: true
402
+ },
403
+ provider: {
404
+ widget: 'dropdown',
405
+ disabled: true
406
+ },
407
+ destination: {
408
+ widget: 'singleLineText',
409
+ instructions: 'Deployment Bucket or FTP Host',
410
+ disabled: true
411
+ },
412
+ idKey: {
413
+ widget: 'singleLineText',
414
+ instructions: 'AWS Access Key ID or Google Cloud Storage Client Email or FTP Username',
415
+ disabled: true
416
+ },
417
+ secretKey: {
418
+ widget: 'sensitiveField',
419
+ instructions: 'AWS Secret Access Key or Google Cloud Storage Private Key or FTP Password',
420
+ multiline: true,
421
+ disabled: true
422
+ },
423
+ environmentVariables: {
424
+ widget: 'repeater',
425
+ order: ['name', 'value'],
426
+ disabled: true,
427
+ properties: {
428
+ name: {
429
+ widget: 'singleLineText',
430
+ disabled: true
431
+ },
432
+ value: {
433
+ widget: 'singleLineText',
434
+ disabled: true
435
+ }
436
+ }
437
+ }
438
+ }
439
+ },
440
+ generalHeader: {
441
+ order: ['title', 'provider', 'baseUrl'],
442
+ properties: {
443
+ title: {
444
+ widget: 'singleLineText',
445
+ disabled: true
446
+ },
447
+ provider: {
448
+ widget: 'dropdown',
449
+ disabled: true
450
+ },
451
+ baseUrl: {
452
+ widget: 'singleLineText',
453
+ disabled: true
454
+ }
455
+ }
456
+ },
457
+ generalFooter: {
458
+ order: ['environmentVariables', 'triggers'],
459
+ properties: {
460
+ environmentVariables: {
461
+ widget: 'repeater',
462
+ order: ['name', 'value'],
463
+ disabled: true,
464
+ properties: {
465
+ name: {
466
+ widget: 'singleLineText',
467
+ disabled: true
468
+ },
469
+ value: {
470
+ widget: 'singleLineText',
471
+ disabled: true
472
+ }
473
+ }
474
+ },
475
+ triggers: {
476
+ widget: 'repeater',
477
+ order: ['contentTypeId', 'status'],
478
+ disabled: true,
479
+ preview: 'siteTriggerPreview',
480
+ properties: {
481
+ contentTypeId: {
482
+ widget: 'dropdown',
483
+ disabled: true
484
+ },
485
+ status: {
486
+ widget: 'dropdown',
487
+ disabled: true
488
+ }
489
+ }
490
+ }
491
+ }
492
+ },
493
+ s3: {
494
+ order: ['destination', 'idKey', 'secretKey', 'privateAcl'],
495
+ properties: {
496
+ destination: {
497
+ widget: 'singleLineText',
498
+ instructions: 'Deployment Bucket Name',
499
+ disabled: true
500
+ },
501
+ idKey: {
502
+ widget: 'singleLineText',
503
+ instructions: 'AWS Access Key ID',
504
+ disabled: true
505
+ },
506
+ secretKey: {
507
+ widget: 'sensitiveField',
508
+ instructions: 'AWS Secret Access Key',
509
+ multiline: true,
510
+ disabled: true
511
+ },
512
+ privateAcl: {
513
+ widget: 'checkbox',
514
+ instructions: 'Disable public access to deployed files. This is useful when fronting S3 with CloudFront or with "Block All Public Access"',
515
+ disabled: true
516
+ }
517
+ }
518
+ },
519
+ gcs: {
520
+ order: ['destination', 'idKey', 'secretKey', 'privateAcl'],
521
+ properties: {
522
+ destination: {
523
+ widget: 'singleLineText',
524
+ instructions: 'Deployment Bucket Name',
525
+ disabled: true
526
+ },
527
+ idKey: {
528
+ widget: 'singleLineText',
529
+ instructions: 'Google Cloud Storage Client Email',
530
+ disabled: true
531
+ },
532
+ secretKey: {
533
+ widget: 'sensitiveField',
534
+ instructions: 'Google Cloud Storage Private Key',
535
+ multiline: true,
536
+ disabled: true
537
+ },
538
+ privateAcl: {
539
+ widget: 'checkbox',
540
+ instructions: 'Disable public access to deployed files.',
541
+ disabled: true
542
+ }
543
+ }
544
+ },
545
+ ftp: {
546
+ order: ['destination', 'idKey', 'secretKey'],
547
+ properties: {
548
+ destination: {
549
+ widget: 'singleLineText',
550
+ instructions: 'FTP Host',
551
+ disabled: true
552
+ },
553
+ idKey: {
554
+ widget: 'singleLineText',
555
+ instructions: 'FTP Username',
556
+ disabled: true
557
+ },
558
+ secretKey: {
559
+ widget: 'sensitiveField',
560
+ instructions: 'FTP Password',
561
+ multiline: true,
562
+ disabled: true
563
+ }
564
+ }
565
+ },
566
+ azure: {
567
+ order: ['destination', 'secretKey'],
568
+ properties: {
569
+ destination: {
570
+ widget: 'singleLineText',
571
+ instructions: 'Storage Account Name',
572
+ disabled: true
573
+ },
574
+ secretKey: {
575
+ widget: 'sensitiveField',
576
+ instructions: 'Access key',
577
+ multiline: true,
578
+ disabled: true
579
+ }
580
+ }
581
+ },
582
+ netlify: {
583
+ order: ['destination'],
584
+ properties: {
585
+ destination: {
586
+ widget: 'publishTargets',
587
+ itemTemplate: 'siteDropdownItem',
588
+ instructions: 'Choose existing or create a new site.',
589
+ disabled: true
590
+ }
591
+ }
592
+ },
593
+ vercel: {
594
+ order: ['destination'],
595
+ properties: {
596
+ destination: {
597
+ widget: 'publishTargets',
598
+ itemTemplate: 'siteDropdownItem',
599
+ instructions: 'Choose existing or create a new project.',
600
+ disabled: true
601
+ }
602
+ }
603
+ }
604
+ }
605
+ };
606
+ exports.builtInForms = builtInForms;
@@ -0,0 +1,41 @@
1
+ import type { ProjectSchema, ContentSchema, Shape } from './project-schema';
2
+ export declare type SchemaType = '*' | 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean';
3
+ export declare function getType(schema: Pick<ContentSchema, 'type'>): SchemaType;
4
+ export declare function toName(name: string): string;
5
+ export declare type ContentTransform = (schema: ContentSchema, obj: unknown, name?: string) => unknown;
6
+ export declare type SourceKeyTransform = (name: string, schema: ContentSchema) => string | string[];
7
+ export declare type KeyTransform = (name: string, schema: ContentSchema, sourceKey?: string) => string;
8
+ export interface PropertyTransform {
9
+ keyTransform?: KeyTransform;
10
+ filter(schema: ContentSchema, name: string, shape?: Shape): boolean;
11
+ process(value: unknown, schema: ContentSchema, name: string, shape: Shape | undefined, next: (value: unknown, schema: ContentSchema, name: string) => unknown): unknown;
12
+ }
13
+ export interface Accumulator<T = unknown> {
14
+ accumulate(value: unknown, schema: ContentSchema, name: string): void;
15
+ getResults(): T;
16
+ }
17
+ export declare type PropertyTransformMap = {
18
+ [key in SchemaType]?: PropertyTransform[];
19
+ };
20
+ export interface ContentTransformParams {
21
+ transforms?: PropertyTransformMap;
22
+ accumulators?: Accumulator[];
23
+ projectSchema: ProjectSchema;
24
+ keyTransform?: KeyTransform;
25
+ sourceKeyTransform?: SourceKeyTransform;
26
+ passThrough?: boolean;
27
+ }
28
+ export declare function preferKey(name: string, schema: ContentSchema): string;
29
+ export declare function findTransforms(pluginMap: PropertyTransformMap | undefined, schema: ContentSchema, name: string, shape?: Shape): PropertyTransform | undefined;
30
+ export declare function getContentTransform({ transforms, accumulators, keyTransform, sourceKeyTransform, passThrough, projectSchema }: ContentTransformParams): ContentTransform;
31
+ export interface PropertyInfo {
32
+ schema: ContentSchema;
33
+ key: string;
34
+ }
35
+ export interface GetPropertyInfoContext {
36
+ projectSchema: ProjectSchema;
37
+ transforms?: PropertyTransformMap;
38
+ keyTransform?: KeyTransform;
39
+ }
40
+ export declare function getPropertyInfo(context: GetPropertyInfoContext, schema: ContentSchema, path: string): PropertyInfo[];
41
+ //# sourceMappingURL=content-schema-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-schema-transform.d.ts","sourceRoot":"","sources":["../../src/content-schema-transform.ts"],"names":[],"mappings":"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"}