@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
package/lib/refs.d.ts ADDED
@@ -0,0 +1,122 @@
1
+ /// <reference types="lodash" />
2
+ import { SchemaPath, SchemaWithRef, ProjectSchemaV3X } from './types';
3
+ import { Maybe } from '@takeshape/util';
4
+ import { ContentObjectSchema, ContentSchema, Shape } from './project-schema';
5
+ export declare type ServicesContext = Pick<ProjectSchemaV3X, 'services'>;
6
+ export declare type ServicesShapesContext = Pick<ProjectSchemaV3X, 'services' | 'shapes'>;
7
+ /**
8
+ * This interface describes a parsed `@ref` or `$ref`.
9
+ * The intended usage is to convert a schema with a ref to a RefItem which can then
10
+ * be passed to the various rich utilities in this file.
11
+ */
12
+ export interface RefItem {
13
+ typeName: string;
14
+ serviceKey: string;
15
+ serviceNamespace?: string;
16
+ template?: string;
17
+ isForeign: boolean;
18
+ }
19
+ /**
20
+ * Adds a schema path, needed when visiting a whole schema to report errors.
21
+ */
22
+ export interface RefItemWithPath extends RefItem {
23
+ path: SchemaPath;
24
+ }
25
+ export declare function $refToAtRef($ref: string, service: string, namespace?: string): string;
26
+ export declare function refSchemaToPath(context: ServicesContext, refSchema: SchemaWithRef): string[];
27
+ /**
28
+ * Safely turn a "template" shape reference (`@args`, `args`, `shape`) into a `RefItem`
29
+ *
30
+ * @param context A partial project schema
31
+ * @param refExpression
32
+ * A ref expression might include "template" name and refer to a local or remote
33
+ * shape, `Foo` or `CreateArgs<Foo>` or `CreateArgs<remote:Foo>`.*
34
+ */
35
+ export declare function refExpressionToRefItem(context: ServicesContext, refExpression: string): RefItem;
36
+ /**
37
+ * Sugar for converting a `refExpression` directly into a shape, without the
38
+ * intermediate `refItem`.
39
+ *
40
+ * @param context A partial project schema
41
+ * @param refExpression
42
+ * A ref expression might include "template" name and refer to a local or remote
43
+ * shape, `Foo` or `CreateArgs<Foo>` or `CreateArgs<remote:Foo>`.
44
+ */
45
+ export declare function refExpressionToShape(context: ServicesShapesContext, refExpression: string): Maybe<Shape>;
46
+ /**
47
+ * Provided a service name and a referenced type. Supports 2 or 3 part
48
+ * references, e.g., `shopify:my-store:ProductInput` or `my-store:ProductInput`.
49
+ *
50
+ * @returns
51
+ * A 2 member array, where 0 is the service name, 1 is the referenced type.
52
+ */
53
+ export declare function splitAtRef(atRef: string): string[];
54
+ /**
55
+ * Parses and returns a typeName, serviceKey, and potentially a namespace for
56
+ * the type.
57
+ */
58
+ export declare function atRefToRefItem(context: ServicesContext, atRef: string, template?: string): RefItem;
59
+ export declare function refToRefItem(context: ServicesContext, $ref: string, template?: string): RefItem;
60
+ /**
61
+ * Given a content schema and project schema, finds a `@ref` or `$ref` and
62
+ * returns a `RefItem` suitable for loading a referenced schema...
63
+ */
64
+ export declare function getRef(context: ServicesContext, refSchema: SchemaWithRef): Maybe<RefItem>;
65
+ export declare function getRefWithPath(context: ServicesContext, refSchema: SchemaWithRef, schemaPath?: SchemaPath): Maybe<RefItemWithPath>;
66
+ /**
67
+ * Tests for a `@ref` or `$ref` property directly on the passed schema.
68
+ *
69
+ * @param schema Any schema that might could have a ref property.
70
+ */
71
+ export declare function hasRefProperty(schema: SchemaWithRef): boolean;
72
+ /**
73
+ * From a schema with a ref, will return the top-level ref, and potentially
74
+ * a ref item from a nested `items` property.
75
+ */
76
+ export declare function getRefOrItemsRef(context: ServicesContext, refSchema: SchemaWithRef, schemaPath?: SchemaPath): Maybe<RefItemWithPath>;
77
+ /**
78
+ * Turns a `RefItem` into an `@ref`.
79
+ */
80
+ export declare function refItemToAtRef(refItem: RefItem): string;
81
+ /**
82
+ * Turns a `RefItem` into a standard shape name, namespacing if present.
83
+ */
84
+ export declare function refItemToShapeName(refItem: RefItem): string;
85
+ /**
86
+ * Turns a `RefItem` into a path suitable for `lodash.get`.
87
+ */
88
+ export declare function refItemToShapePath(refItem: RefItem): string[];
89
+ /**
90
+ * Get a Shape referenced by a `RefItem`.
91
+ */
92
+ export declare function refItemToShape(context: ServicesShapesContext, refItem: RefItem): Maybe<Shape>;
93
+ /**
94
+ * Get a Shape schema referenced by a `RefItem`.
95
+ */
96
+ export declare function refItemToShapeSchema(context: ServicesShapesContext, refItem: RefItem): Maybe<ContentObjectSchema>;
97
+ /**
98
+ * Sugar, for when you really just need a string...
99
+ */
100
+ export declare function getRefShapeName(context: ServicesContext, refSchema: SchemaWithRef): Maybe<string>;
101
+ /**
102
+ * Sugar, for when you really just need a path...
103
+ */
104
+ export declare function anyRefToShapeSchemaPath(context: ServicesContext, refSchema: SchemaWithRef): Maybe<string[]>;
105
+ /**
106
+ * Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
107
+ */
108
+ export declare const omitRefAndExtend: (targetSchema: ContentSchema, sourceSchema: ContentSchema) => import("lodash").Omit<ContentSchema, "@ref" | "$ref"> & ContentSchema;
109
+ /**
110
+ * If there is a $ref, this will insert a content schema from the top level
111
+ * in place of the reference.
112
+ */
113
+ export declare function followRef(context: ServicesShapesContext, contentSchema: ContentSchema): ContentSchema;
114
+ /**
115
+ * Returns whether a schema has refs.
116
+ */
117
+ export declare function hasRef(contentSchema: ContentSchema): boolean;
118
+ /**
119
+ * Returns whether a schema has refs which can be followed.
120
+ */
121
+ export declare function hasResolvableRef(context: ServicesShapesContext, contentSchema: ContentSchema): boolean;
122
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/refs.ts"],"names":[],"mappings":"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"}
package/lib/refs.js ADDED
@@ -0,0 +1,359 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.$refToAtRef = $refToAtRef;
7
+ exports.refSchemaToPath = refSchemaToPath;
8
+ exports.refExpressionToRefItem = refExpressionToRefItem;
9
+ exports.refExpressionToShape = refExpressionToShape;
10
+ exports.splitAtRef = splitAtRef;
11
+ exports.atRefToRefItem = atRefToRefItem;
12
+ exports.refToRefItem = refToRefItem;
13
+ exports.getRef = getRef;
14
+ exports.getRefWithPath = getRefWithPath;
15
+ exports.hasRefProperty = hasRefProperty;
16
+ exports.getRefOrItemsRef = getRefOrItemsRef;
17
+ exports.refItemToAtRef = refItemToAtRef;
18
+ exports.refItemToShapeName = refItemToShapeName;
19
+ exports.refItemToShapePath = refItemToShapePath;
20
+ exports.refItemToShape = refItemToShape;
21
+ exports.refItemToShapeSchema = refItemToShapeSchema;
22
+ exports.getRefShapeName = getRefShapeName;
23
+ exports.anyRefToShapeSchemaPath = anyRefToShapeSchemaPath;
24
+ exports.followRef = followRef;
25
+ exports.hasRef = hasRef;
26
+ exports.hasResolvableRef = hasResolvableRef;
27
+ exports.omitRefAndExtend = void 0;
28
+
29
+ var _types = require("./types");
30
+
31
+ var _templateShapes = require("./template-shapes");
32
+
33
+ var _get = _interopRequireDefault(require("lodash/get"));
34
+
35
+ var _assign = _interopRequireDefault(require("lodash/fp/assign"));
36
+
37
+ var _omit = _interopRequireDefault(require("lodash/fp/omit"));
38
+
39
+ var _services = require("./services");
40
+
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
+
43
+ function $refToPath(ref) {
44
+ return ref.substr(2).split('/');
45
+ }
46
+
47
+ function $refToShapeName(ref) {
48
+ return $refToPath(ref)[1];
49
+ }
50
+
51
+ function $refToAtRef($ref, service, namespace) {
52
+ const shapeName = $refToShapeName($ref);
53
+
54
+ if (service === 'local') {
55
+ return `local:${shapeName}`;
56
+ }
57
+
58
+ return `${service}:${namespace === undefined ? shapeName : shapeName.replace(`${namespace}_`, '')}`;
59
+ }
60
+
61
+ function refSchemaToPath(context, refSchema) {
62
+ const refItem = getRef(context, refSchema);
63
+
64
+ if (refItem === undefined) {
65
+ throw new Error('Invalid ref in refSchemaToPath');
66
+ }
67
+
68
+ return refItemToShapePath(refItem);
69
+ }
70
+ /**
71
+ * Safely turn a "template" shape reference (`@args`, `args`, `shape`) into a `RefItem`
72
+ *
73
+ * @param context A partial project schema
74
+ * @param refExpression
75
+ * A ref expression might include "template" name and refer to a local or remote
76
+ * shape, `Foo` or `CreateArgs<Foo>` or `CreateArgs<remote:Foo>`.*
77
+ */
78
+
79
+
80
+ function refExpressionToRefItem(context, refExpression) {
81
+ const {
82
+ shapeName,
83
+ template
84
+ } = (0, _templateShapes.parseTemplateShape)(refExpression);
85
+
86
+ if (shapeName.includes(':')) {
87
+ return atRefToRefItem(context, shapeName, template);
88
+ }
89
+
90
+ return refToRefItem(context, `#/shapes/${shapeName}/schema`, template);
91
+ }
92
+ /**
93
+ * Sugar for converting a `refExpression` directly into a shape, without the
94
+ * intermediate `refItem`.
95
+ *
96
+ * @param context A partial project schema
97
+ * @param refExpression
98
+ * A ref expression might include "template" name and refer to a local or remote
99
+ * shape, `Foo` or `CreateArgs<Foo>` or `CreateArgs<remote:Foo>`.
100
+ */
101
+
102
+
103
+ function refExpressionToShape(context, refExpression) {
104
+ return refItemToShape(context, refExpressionToRefItem(context, refExpression));
105
+ }
106
+ /**
107
+ * Provided a service name and a referenced type. Supports 2 or 3 part
108
+ * references, e.g., `shopify:my-store:ProductInput` or `my-store:ProductInput`.
109
+ *
110
+ * @returns
111
+ * A 2 member array, where 0 is the service name, 1 is the referenced type.
112
+ */
113
+
114
+
115
+ function splitAtRef(atRef) {
116
+ const refParts = atRef.split(':');
117
+ const serviceKey = refParts.length === 2 ? refParts[0] : `${refParts[0]}:${refParts[1]}`;
118
+ const referencedType = refParts.length === 2 ? refParts[1] : refParts[2];
119
+ return [serviceKey, referencedType];
120
+ }
121
+ /**
122
+ * Parses and returns a typeName, serviceKey, and potentially a namespace for
123
+ * the type.
124
+ */
125
+
126
+
127
+ function atRefToRefItem(context, atRef, template) {
128
+ var _context$services;
129
+
130
+ const [serviceKey, typeName] = splitAtRef(atRef); // It's possible the service doesn't have a namespace, or is local and has
131
+ // no service config.
132
+
133
+ const serviceConfig = (_context$services = context.services) === null || _context$services === void 0 ? void 0 : _context$services[serviceKey];
134
+ const serviceNamespace = serviceConfig && (0, _services.getServiceNamespace)(serviceConfig);
135
+ return {
136
+ typeName,
137
+ serviceKey,
138
+ serviceNamespace,
139
+ template,
140
+ isForeign: Boolean(serviceConfig)
141
+ };
142
+ }
143
+
144
+ function refToRefItem(context, $ref, template) {
145
+ var _typeName, _serviceKey;
146
+
147
+ const shapeName = $refToShapeName($ref);
148
+ const shapeNameParts = shapeName.split('_');
149
+ let typeName;
150
+ let serviceKey;
151
+ let serviceNamespace;
152
+
153
+ if (shapeNameParts.length > 1) {
154
+ const namespaces = (0, _services.getServiceNamespaces)(context);
155
+ const maybeNamespace = shapeNameParts[0];
156
+ serviceKey = namespaces.get(maybeNamespace);
157
+
158
+ if (serviceKey) {
159
+ typeName = shapeNameParts.slice(1).join('_');
160
+ serviceNamespace = maybeNamespace;
161
+ }
162
+ }
163
+
164
+ return {
165
+ typeName: (_typeName = typeName) !== null && _typeName !== void 0 ? _typeName : shapeName,
166
+ serviceKey: (_serviceKey = serviceKey) !== null && _serviceKey !== void 0 ? _serviceKey : 'local',
167
+ serviceNamespace,
168
+ template,
169
+ isForeign: Boolean(serviceKey)
170
+ };
171
+ }
172
+ /**
173
+ * Given a content schema and project schema, finds a `@ref` or `$ref` and
174
+ * returns a `RefItem` suitable for loading a referenced schema...
175
+ */
176
+
177
+
178
+ function getRef(context, refSchema) {
179
+ if (refSchema['@ref']) {
180
+ // @ref: my-service:ShapeName
181
+ return atRefToRefItem(context, refSchema['@ref']);
182
+ }
183
+
184
+ if (refSchema.$ref) {
185
+ // $ref: #/shapes/[ShapeName OR Namespace_TypeName]/schema
186
+ return refToRefItem(context, refSchema.$ref);
187
+ }
188
+ }
189
+
190
+ function getRefWithPath(context, refSchema, schemaPath = []) {
191
+ const refItem = getRef(context, refSchema);
192
+
193
+ if (refItem) {
194
+ const refType = (0, _types.getRefType)(refSchema);
195
+ return { ...refItem,
196
+ path: schemaPath.concat([refType])
197
+ };
198
+ }
199
+ }
200
+ /**
201
+ * Tests for a `@ref` or `$ref` property directly on the passed schema.
202
+ *
203
+ * @param schema Any schema that might could have a ref property.
204
+ */
205
+
206
+
207
+ function hasRefProperty(schema) {
208
+ var _schema$Ref;
209
+
210
+ return Boolean((_schema$Ref = schema['@ref']) !== null && _schema$Ref !== void 0 ? _schema$Ref : schema.$ref);
211
+ }
212
+ /**
213
+ * From a schema with a ref, will return the top-level ref, and potentially
214
+ * a ref item from a nested `items` property.
215
+ */
216
+
217
+
218
+ function getRefOrItemsRef(context, refSchema, schemaPath = []) {
219
+ const refItem = getRefWithPath(context, refSchema, schemaPath);
220
+
221
+ if (refItem) {
222
+ return refItem;
223
+ }
224
+
225
+ if (refSchema.items) {
226
+ return getRefOrItemsRef(context, refSchema.items, schemaPath.concat(['items']));
227
+ }
228
+ }
229
+ /**
230
+ * Turns a `RefItem` into an `@ref`.
231
+ */
232
+
233
+
234
+ function refItemToAtRef(refItem) {
235
+ return `${refItem.serviceKey}:${refItem.typeName}`;
236
+ }
237
+ /**
238
+ * Turns a `RefItem` into a standard shape name, namespacing if present.
239
+ */
240
+
241
+
242
+ function refItemToShapeName(refItem) {
243
+ const {
244
+ serviceNamespace,
245
+ typeName
246
+ } = refItem;
247
+ return serviceNamespace ? `${serviceNamespace}_${typeName}` : typeName;
248
+ }
249
+ /**
250
+ * Turns a `RefItem` into a path suitable for `lodash.get`.
251
+ */
252
+
253
+
254
+ function refItemToShapePath(refItem) {
255
+ return ['shapes', refItemToShapeName(refItem)];
256
+ }
257
+ /**
258
+ * Get a Shape referenced by a `RefItem`.
259
+ */
260
+
261
+
262
+ function refItemToShape(context, refItem) {
263
+ const shapePath = refItemToShapePath(refItem);
264
+ return (0, _get.default)(context, shapePath);
265
+ }
266
+ /**
267
+ * Get a Shape schema referenced by a `RefItem`.
268
+ */
269
+
270
+
271
+ function refItemToShapeSchema(context, refItem) {
272
+ const shapePath = refItemToShapePath(refItem);
273
+ return (0, _get.default)(context, [...shapePath, 'schema']);
274
+ }
275
+ /**
276
+ * Sugar, for when you really just need a string...
277
+ */
278
+
279
+
280
+ function getRefShapeName(context, refSchema) {
281
+ const refItem = getRef(context, refSchema);
282
+ return refItem ? refItemToShapeName(refItem) : undefined;
283
+ }
284
+ /**
285
+ * Sugar, for when you really just need a path...
286
+ */
287
+
288
+
289
+ function anyRefToShapeSchemaPath(context, refSchema) {
290
+ const refItem = getRef(context, refSchema);
291
+ return refItem ? [...refItemToShapePath(refItem), 'schema'] : undefined;
292
+ }
293
+ /**
294
+ * Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
295
+ */
296
+
297
+
298
+ const omitRefAndExtend = (targetSchema, sourceSchema) => (0, _assign.default)((0, _omit.default)(['@ref', '$ref'], targetSchema), sourceSchema);
299
+ /**
300
+ * If there is a $ref, this will insert a content schema from the top level
301
+ * in place of the reference.
302
+ */
303
+
304
+
305
+ exports.omitRefAndExtend = omitRefAndExtend;
306
+
307
+ function followRef(context, contentSchema) {
308
+ const refItem = getRef(context, contentSchema);
309
+
310
+ if (refItem) {
311
+ const referencedSchema = refItemToShapeSchema(context, refItem);
312
+
313
+ if (referencedSchema) {
314
+ return omitRefAndExtend(contentSchema, referencedSchema);
315
+ }
316
+ }
317
+
318
+ return contentSchema;
319
+ }
320
+ /**
321
+ * Returns whether a schema has refs.
322
+ */
323
+
324
+
325
+ function hasRef(contentSchema) {
326
+ if ((0, _types.isRefSchema)(contentSchema) || (0, _types.isRefSchemaLegacy)(contentSchema)) {
327
+ return true;
328
+ }
329
+
330
+ if ((0, _types.isAllOfSchema)(contentSchema)) {
331
+ return Boolean(contentSchema.allOf.find(hasRef));
332
+ }
333
+
334
+ if ((0, _types.isOneOfSchema)(contentSchema)) {
335
+ return Boolean(contentSchema.oneOf.find(hasRef));
336
+ }
337
+
338
+ return false;
339
+ }
340
+ /**
341
+ * Returns whether a schema has refs which can be followed.
342
+ */
343
+
344
+
345
+ function hasResolvableRef(context, contentSchema) {
346
+ if ((0, _types.isRefSchema)(contentSchema) || (0, _types.isRefSchemaLegacy)(contentSchema)) {
347
+ return Boolean(refItemToShapeSchema(context, getRef(context, contentSchema)));
348
+ }
349
+
350
+ if ((0, _types.isAllOfSchema)(contentSchema)) {
351
+ return Boolean(contentSchema.allOf.find(s => hasResolvableRef(context, s)));
352
+ }
353
+
354
+ if ((0, _types.isOneOfSchema)(contentSchema)) {
355
+ return Boolean(contentSchema.oneOf.find(s => hasResolvableRef(context, s)));
356
+ }
357
+
358
+ return false;
359
+ }
@@ -0,0 +1,4 @@
1
+ export declare const modelResolvers: string[];
2
+ export declare const resolverList: readonly [...string[], "graphql:query", "graphql:mutation", "rest:get", "rest:head", "rest:post", "rest:put", "rest:patch", "rest:delete", "debug:noop", "util:wrap", "awsLambda:invoke"];
3
+ export declare type ResolverName = typeof resolverList[number];
4
+ //# sourceMappingURL=resolvers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../src/resolvers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,UAQ1B,CAAC;AACF,eAAO,MAAM,YAAY,2LAaf,CAAC;AAEX,oBAAY,YAAY,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolverList = exports.modelResolvers = void 0;
7
+ const modelResolvers = ['takeshape:get', 'takeshape:list', 'takeshape:create', 'takeshape:update', 'takeshape:delete', 'takeshape:duplicate', 'takeshape:find'];
8
+ exports.modelResolvers = modelResolvers;
9
+ const resolverList = [...modelResolvers, 'graphql:query', 'graphql:mutation', 'rest:get', 'rest:head', 'rest:post', 'rest:put', 'rest:patch', 'rest:delete', 'debug:noop', 'util:wrap', 'awsLambda:invoke'];
10
+ exports.resolverList = resolverList;
@@ -0,0 +1,3 @@
1
+ export declare const scalars: readonly ["string", "boolean", "integer", "number"];
2
+ export declare function isScalar(str: string): boolean;
3
+ //# sourceMappingURL=scalars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../../src/scalars.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,qDAAsD,CAAC;AAE3E,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7C"}
package/lib/scalars.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isScalar = isScalar;
7
+ exports.scalars = void 0;
8
+ const scalars = ['string', 'boolean', 'integer', 'number'];
9
+ exports.scalars = scalars;
10
+
11
+ function isScalar(str) {
12
+ return Array.from(scalars).includes(str);
13
+ }