@nascentdigital/funnel-core 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/dist/app/AppConfig.d.ts +41 -0
  2. package/dist/app/AppConfig.js +93 -0
  3. package/dist/app/BrandConfig.d.ts +13 -0
  4. package/dist/app/BrandConfig.js +2 -0
  5. package/dist/app/FeaturesConfig.d.ts +6 -0
  6. package/dist/app/FeaturesConfig.js +2 -0
  7. package/dist/app/RegionsConfig.d.ts +43 -0
  8. package/dist/app/RegionsConfig.js +113 -0
  9. package/dist/app/UIConfig.d.ts +4 -0
  10. package/dist/app/UIConfig.js +2 -0
  11. package/dist/app/index.d.ts +5 -0
  12. package/dist/app/index.js +21 -0
  13. package/dist/consent/ConsentCategory.d.ts +12 -0
  14. package/dist/consent/ConsentCategory.js +28 -0
  15. package/dist/consent/ConsentService.d.ts +15 -0
  16. package/dist/consent/ConsentService.js +37 -0
  17. package/dist/consent/index.d.ts +2 -0
  18. package/dist/consent/index.js +18 -0
  19. package/dist/errors/IsometricError.d.ts +19 -0
  20. package/dist/errors/IsometricError.js +30 -0
  21. package/dist/errors/IsometricErrorModule.d.ts +11 -0
  22. package/dist/errors/IsometricErrorModule.js +2 -0
  23. package/dist/errors/IsometricErrorUtils.d.ts +9 -0
  24. package/dist/errors/IsometricErrorUtils.js +85 -0
  25. package/dist/errors/SerializedIsometricError.d.ts +10 -0
  26. package/dist/errors/SerializedIsometricError.js +15 -0
  27. package/dist/errors/api/ApiError.d.ts +15 -0
  28. package/dist/errors/api/ApiError.js +23 -0
  29. package/dist/errors/api/ApiErrors.d.ts +7 -0
  30. package/dist/errors/api/ApiErrors.js +67 -0
  31. package/dist/errors/api/ArgumentError.d.ts +7 -0
  32. package/dist/errors/api/ArgumentError.js +18 -0
  33. package/dist/errors/api/ConcurrencyError.d.ts +4 -0
  34. package/dist/errors/api/ConcurrencyError.js +11 -0
  35. package/dist/errors/api/ConflictError.d.ts +4 -0
  36. package/dist/errors/api/ConflictError.js +11 -0
  37. package/dist/errors/api/DependencyError.d.ts +4 -0
  38. package/dist/errors/api/DependencyError.js +11 -0
  39. package/dist/errors/api/IllegalStateError.d.ts +4 -0
  40. package/dist/errors/api/IllegalStateError.js +11 -0
  41. package/dist/errors/api/InvalidOperationError.d.ts +4 -0
  42. package/dist/errors/api/InvalidOperationError.js +11 -0
  43. package/dist/errors/api/NotAuthenticatedError.d.ts +4 -0
  44. package/dist/errors/api/NotAuthenticatedError.js +11 -0
  45. package/dist/errors/api/NotAuthorizedError.d.ts +4 -0
  46. package/dist/errors/api/NotAuthorizedError.js +11 -0
  47. package/dist/errors/api/NotAvailableError.d.ts +4 -0
  48. package/dist/errors/api/NotAvailableError.js +11 -0
  49. package/dist/errors/api/NotFoundError.d.ts +4 -0
  50. package/dist/errors/api/NotFoundError.js +11 -0
  51. package/dist/errors/api/NotImplementedError.d.ts +4 -0
  52. package/dist/errors/api/NotImplementedError.js +11 -0
  53. package/dist/errors/api/OfflineError.d.ts +4 -0
  54. package/dist/errors/api/OfflineError.js +11 -0
  55. package/dist/errors/api/RangeError.d.ts +4 -0
  56. package/dist/errors/api/RangeError.js +11 -0
  57. package/dist/errors/api/ServerError.d.ts +4 -0
  58. package/dist/errors/api/ServerError.js +11 -0
  59. package/dist/errors/api/TimeoutError.d.ts +4 -0
  60. package/dist/errors/api/TimeoutError.js +11 -0
  61. package/dist/errors/api/index.d.ts +16 -0
  62. package/dist/errors/api/index.js +32 -0
  63. package/dist/errors/index.d.ts +5 -0
  64. package/dist/errors/index.js +26 -0
  65. package/dist/forms/FormModel.d.ts +47 -0
  66. package/dist/forms/FormModel.js +149 -0
  67. package/dist/forms/Forms.d.ts +15 -0
  68. package/dist/forms/Forms.js +35 -0
  69. package/dist/forms/IFormService.d.ts +6 -0
  70. package/dist/forms/IFormService.js +2 -0
  71. package/dist/forms/TranslateSchema.d.ts +8 -0
  72. package/dist/forms/TranslateSchema.js +2 -0
  73. package/dist/forms/index.d.ts +4 -0
  74. package/dist/forms/index.js +20 -0
  75. package/dist/index.d.ts +10 -0
  76. package/dist/index.js +49 -0
  77. package/dist/regionalization/Country.d.ts +266 -0
  78. package/dist/regionalization/Country.js +338 -0
  79. package/dist/regionalization/Language.d.ts +199 -0
  80. package/dist/regionalization/Language.js +237 -0
  81. package/dist/regionalization/Locale.d.ts +28 -0
  82. package/dist/regionalization/Locale.js +49 -0
  83. package/dist/regionalization/Localized.d.ts +10 -0
  84. package/dist/regionalization/Localized.js +36 -0
  85. package/dist/regionalization/LocalizedCopy.d.ts +9 -0
  86. package/dist/regionalization/LocalizedCopy.js +26 -0
  87. package/dist/regionalization/Regionalization.d.ts +50 -0
  88. package/dist/regionalization/Regionalization.js +260 -0
  89. package/dist/regionalization/Regions.d.ts +2 -0
  90. package/dist/regionalization/Regions.js +2 -0
  91. package/dist/regionalization/index.d.ts +7 -0
  92. package/dist/regionalization/index.js +23 -0
  93. package/dist/schema/Asset.d.ts +23 -0
  94. package/dist/schema/Asset.js +36 -0
  95. package/dist/schema/AssetScope.d.ts +75 -0
  96. package/dist/schema/AssetScope.js +146 -0
  97. package/dist/schema/Block.d.ts +105 -0
  98. package/dist/schema/Block.js +122 -0
  99. package/dist/schema/ChangeSet.d.ts +108 -0
  100. package/dist/schema/ChangeSet.js +187 -0
  101. package/dist/schema/Collection.d.ts +197 -0
  102. package/dist/schema/Collection.js +165 -0
  103. package/dist/schema/CollectionModel.d.ts +30 -0
  104. package/dist/schema/CollectionModel.js +383 -0
  105. package/dist/schema/CollectionSnapshot.d.ts +11 -0
  106. package/dist/schema/CollectionSnapshot.js +12 -0
  107. package/dist/schema/Fields.d.ts +31 -0
  108. package/dist/schema/Fields.js +21 -0
  109. package/dist/schema/Form.d.ts +31 -0
  110. package/dist/schema/Form.js +23 -0
  111. package/dist/schema/LinkedCollectionModel.d.ts +9 -0
  112. package/dist/schema/LinkedCollectionModel.js +19 -0
  113. package/dist/schema/LinkedData.d.ts +44 -0
  114. package/dist/schema/LinkedData.js +288 -0
  115. package/dist/schema/LinkedPageModel.d.ts +11 -0
  116. package/dist/schema/LinkedPageModel.js +26 -0
  117. package/dist/schema/Optional.d.ts +23 -0
  118. package/dist/schema/Optional.js +34 -0
  119. package/dist/schema/Page.d.ts +299 -0
  120. package/dist/schema/Page.js +244 -0
  121. package/dist/schema/PageModel.d.ts +58 -0
  122. package/dist/schema/PageModel.js +881 -0
  123. package/dist/schema/PageQuery.d.ts +60 -0
  124. package/dist/schema/PageQuery.js +116 -0
  125. package/dist/schema/PageRoute.d.ts +7 -0
  126. package/dist/schema/PageRoute.js +48 -0
  127. package/dist/schema/PageSnapshot.d.ts +11 -0
  128. package/dist/schema/PageSnapshot.js +12 -0
  129. package/dist/schema/Section.d.ts +71 -0
  130. package/dist/schema/Section.js +35 -0
  131. package/dist/schema/Seo.d.ts +13 -0
  132. package/dist/schema/Seo.js +25 -0
  133. package/dist/schema/Site.d.ts +40 -0
  134. package/dist/schema/Site.js +87 -0
  135. package/dist/schema/SiteModel.d.ts +5 -0
  136. package/dist/schema/SiteModel.js +10 -0
  137. package/dist/schema/Tag.d.ts +28 -0
  138. package/dist/schema/Tag.js +59 -0
  139. package/dist/schema/TagGroup.d.ts +26 -0
  140. package/dist/schema/TagGroup.js +64 -0
  141. package/dist/schema/field/Field.d.ts +179 -0
  142. package/dist/schema/field/Field.js +309 -0
  143. package/dist/schema/field/base/AssetField.d.ts +148 -0
  144. package/dist/schema/field/base/AssetField.js +206 -0
  145. package/dist/schema/field/base/BooleanField.d.ts +21 -0
  146. package/dist/schema/field/base/BooleanField.js +38 -0
  147. package/dist/schema/field/base/CollectionField.d.ts +34 -0
  148. package/dist/schema/field/base/CollectionField.js +85 -0
  149. package/dist/schema/field/base/DateField.d.ts +21 -0
  150. package/dist/schema/field/base/DateField.js +37 -0
  151. package/dist/schema/field/base/DynamicPagesField.d.ts +36 -0
  152. package/dist/schema/field/base/DynamicPagesField.js +50 -0
  153. package/dist/schema/field/base/EmbeddedVideoField.d.ts +45 -0
  154. package/dist/schema/field/base/EmbeddedVideoField.js +176 -0
  155. package/dist/schema/field/base/EnumField.d.ts +40 -0
  156. package/dist/schema/field/base/EnumField.js +131 -0
  157. package/dist/schema/field/base/FormField.d.ts +25 -0
  158. package/dist/schema/field/base/FormField.js +48 -0
  159. package/dist/schema/field/base/LinkField.d.ts +103 -0
  160. package/dist/schema/field/base/LinkField.js +201 -0
  161. package/dist/schema/field/base/PageField.d.ts +46 -0
  162. package/dist/schema/field/base/PageField.js +83 -0
  163. package/dist/schema/field/base/RichTextField.d.ts +71 -0
  164. package/dist/schema/field/base/RichTextField.js +196 -0
  165. package/dist/schema/field/base/TextField.d.ts +33 -0
  166. package/dist/schema/field/base/TextField.js +86 -0
  167. package/dist/schema/field/base/TimestampField.d.ts +25 -0
  168. package/dist/schema/field/base/TimestampField.js +41 -0
  169. package/dist/schema/field/base/index.d.ts +13 -0
  170. package/dist/schema/field/base/index.js +29 -0
  171. package/dist/schema/field/composite/ListField.d.ts +47 -0
  172. package/dist/schema/field/composite/ListField.js +107 -0
  173. package/dist/schema/field/composite/ObjectField.d.ts +56 -0
  174. package/dist/schema/field/composite/ObjectField.js +19 -0
  175. package/dist/schema/field/composite/index.d.ts +2 -0
  176. package/dist/schema/field/composite/index.js +18 -0
  177. package/dist/schema/field/index.d.ts +3 -0
  178. package/dist/schema/field/index.js +19 -0
  179. package/dist/schema/index.d.ts +25 -0
  180. package/dist/schema/index.js +41 -0
  181. package/dist/services/EventBus.d.ts +17 -0
  182. package/dist/services/EventBus.js +37 -0
  183. package/dist/services/humanVerification/IHumanVerification.d.ts +8 -0
  184. package/dist/services/humanVerification/IHumanVerification.js +2 -0
  185. package/dist/services/humanVerification/index.d.ts +1 -0
  186. package/dist/services/humanVerification/index.js +17 -0
  187. package/dist/services/index.d.ts +3 -0
  188. package/dist/services/index.js +19 -0
  189. package/dist/services/leadGen/Contact.d.ts +40 -0
  190. package/dist/services/leadGen/Contact.js +38 -0
  191. package/dist/services/leadGen/ILeadGen.d.ts +16 -0
  192. package/dist/services/leadGen/ILeadGen.js +2 -0
  193. package/dist/services/leadGen/index.d.ts +2 -0
  194. package/dist/services/leadGen/index.js +18 -0
  195. package/dist/types/BoxedValue.d.ts +3 -0
  196. package/dist/types/BoxedValue.js +2 -0
  197. package/dist/types/Callback.d.ts +9 -0
  198. package/dist/types/Callback.js +2 -0
  199. package/dist/types/DateString.d.ts +35 -0
  200. package/dist/types/DateString.js +172 -0
  201. package/dist/types/FilterConditionally.d.ts +3 -0
  202. package/dist/types/FilterConditionally.js +2 -0
  203. package/dist/types/MaybeConditionalValue.d.ts +8 -0
  204. package/dist/types/MaybeConditionalValue.js +12 -0
  205. package/dist/types/Ordinal.d.ts +17 -0
  206. package/dist/types/Ordinal.js +38 -0
  207. package/dist/types/OverridableStringUnion.d.ts +2 -0
  208. package/dist/types/OverridableStringUnion.js +2 -0
  209. package/dist/types/PartialBy.d.ts +1 -0
  210. package/dist/types/PartialBy.js +2 -0
  211. package/dist/types/PickData.d.ts +6 -0
  212. package/dist/types/PickData.js +2 -0
  213. package/dist/types/Provider.d.ts +4 -0
  214. package/dist/types/Provider.js +2 -0
  215. package/dist/types/RequiredBy.d.ts +1 -0
  216. package/dist/types/RequiredBy.js +2 -0
  217. package/dist/types/Result.d.ts +16 -0
  218. package/dist/types/Result.js +2 -0
  219. package/dist/types/Timestamp.d.ts +17 -0
  220. package/dist/types/Timestamp.js +57 -0
  221. package/dist/types/Transform.d.ts +4 -0
  222. package/dist/types/Transform.js +2 -0
  223. package/dist/types/index.d.ts +14 -0
  224. package/dist/types/index.js +30 -0
  225. package/dist/ui/Accessible.d.ts +5 -0
  226. package/dist/ui/Accessible.js +15 -0
  227. package/dist/ui/BlockThemes.d.ts +19 -0
  228. package/dist/ui/BlockThemes.js +29 -0
  229. package/dist/ui/ColorMode.d.ts +12 -0
  230. package/dist/ui/ColorMode.js +49 -0
  231. package/dist/ui/File.d.ts +43 -0
  232. package/dist/ui/File.js +55 -0
  233. package/dist/ui/FileType.d.ts +8 -0
  234. package/dist/ui/FileType.js +48 -0
  235. package/dist/ui/ImageSource.d.ts +12 -0
  236. package/dist/ui/ImageSource.js +48 -0
  237. package/dist/ui/MimeType.d.ts +28 -0
  238. package/dist/ui/MimeType.js +110 -0
  239. package/dist/ui/Placement.d.ts +21 -0
  240. package/dist/ui/Placement.js +135 -0
  241. package/dist/ui/Position.d.ts +6 -0
  242. package/dist/ui/Position.js +42 -0
  243. package/dist/ui/Selector.d.ts +6 -0
  244. package/dist/ui/Selector.js +23 -0
  245. package/dist/ui/SemanticColor.d.ts +8 -0
  246. package/dist/ui/SemanticColor.js +237 -0
  247. package/dist/ui/Visual.d.ts +24 -0
  248. package/dist/ui/Visual.js +66 -0
  249. package/dist/ui/block-layout/BlockLayout.d.ts +99 -0
  250. package/dist/ui/block-layout/BlockLayout.js +286 -0
  251. package/dist/ui/block-layout/index.d.ts +1 -0
  252. package/dist/ui/block-layout/index.js +17 -0
  253. package/dist/ui/browser/BlurHasher.d.ts +13 -0
  254. package/dist/ui/browser/BlurHasher.js +76 -0
  255. package/dist/ui/browser/Browser.d.ts +107 -0
  256. package/dist/ui/browser/Browser.js +313 -0
  257. package/dist/ui/browser/ImageProxy.d.ts +30 -0
  258. package/dist/ui/browser/ImageProxy.js +132 -0
  259. package/dist/ui/browser/InputEvent.d.ts +13 -0
  260. package/dist/ui/browser/InputEvent.js +2 -0
  261. package/dist/ui/browser/SVGProxy.d.ts +9 -0
  262. package/dist/ui/browser/SVGProxy.js +59 -0
  263. package/dist/ui/browser/VideoProxy.d.ts +42 -0
  264. package/dist/ui/browser/VideoProxy.js +235 -0
  265. package/dist/ui/browser/index.d.ts +6 -0
  266. package/dist/ui/browser/index.js +22 -0
  267. package/dist/ui/fields/Field.d.ts +80 -0
  268. package/dist/ui/fields/Field.js +298 -0
  269. package/dist/ui/fields/FieldList.d.ts +80 -0
  270. package/dist/ui/fields/FieldList.js +421 -0
  271. package/dist/ui/fields/FieldListValidator.d.ts +9 -0
  272. package/dist/ui/fields/FieldListValidator.js +37 -0
  273. package/dist/ui/fields/FieldModel.d.ts +15 -0
  274. package/dist/ui/fields/FieldModel.js +28 -0
  275. package/dist/ui/fields/FieldSerializer.d.ts +13 -0
  276. package/dist/ui/fields/FieldSerializer.js +71 -0
  277. package/dist/ui/fields/FieldValidator.d.ts +19 -0
  278. package/dist/ui/fields/FieldValidator.js +98 -0
  279. package/dist/ui/fields/ObjectField.d.ts +75 -0
  280. package/dist/ui/fields/ObjectField.js +288 -0
  281. package/dist/ui/fields/errors.json +44 -0
  282. package/dist/ui/fields/index.d.ts +7 -0
  283. package/dist/ui/fields/index.js +23 -0
  284. package/dist/ui/fields/validators/AssetValidator.d.ts +9 -0
  285. package/dist/ui/fields/validators/AssetValidator.js +25 -0
  286. package/dist/ui/fields/validators/DateValidator.d.ts +9 -0
  287. package/dist/ui/fields/validators/DateValidator.js +41 -0
  288. package/dist/ui/fields/validators/EnumValidator.d.ts +10 -0
  289. package/dist/ui/fields/validators/EnumValidator.js +77 -0
  290. package/dist/ui/fields/validators/GenericValidator.d.ts +6 -0
  291. package/dist/ui/fields/validators/GenericValidator.js +22 -0
  292. package/dist/ui/fields/validators/LinkValidator.d.ts +9 -0
  293. package/dist/ui/fields/validators/LinkValidator.js +146 -0
  294. package/dist/ui/fields/validators/RichTextValidator.d.ts +6 -0
  295. package/dist/ui/fields/validators/RichTextValidator.js +35 -0
  296. package/dist/ui/fields/validators/TextValidator.d.ts +10 -0
  297. package/dist/ui/fields/validators/TextValidator.js +138 -0
  298. package/dist/ui/fields/validators/TimestampValidator.d.ts +9 -0
  299. package/dist/ui/fields/validators/TimestampValidator.js +41 -0
  300. package/dist/ui/fields/validators/ValidatorHelper.d.ts +23 -0
  301. package/dist/ui/fields/validators/ValidatorHelper.js +55 -0
  302. package/dist/ui/fields/validators/index.d.ts +8 -0
  303. package/dist/ui/fields/validators/index.js +24 -0
  304. package/dist/ui/geometry/AspectRatio.d.ts +27 -0
  305. package/dist/ui/geometry/AspectRatio.js +77 -0
  306. package/dist/ui/geometry/Bounds.d.ts +4 -0
  307. package/dist/ui/geometry/Bounds.js +11 -0
  308. package/dist/ui/geometry/Frame.d.ts +3 -0
  309. package/dist/ui/geometry/Frame.js +2 -0
  310. package/dist/ui/geometry/Insets.d.ts +14 -0
  311. package/dist/ui/geometry/Insets.js +14 -0
  312. package/dist/ui/geometry/PixelSize.d.ts +1 -0
  313. package/dist/ui/geometry/PixelSize.js +2 -0
  314. package/dist/ui/geometry/Point.d.ts +7 -0
  315. package/dist/ui/geometry/Point.js +15 -0
  316. package/dist/ui/geometry/Rect.d.ts +19 -0
  317. package/dist/ui/geometry/Rect.js +68 -0
  318. package/dist/ui/geometry/ScreenSize.d.ts +1 -0
  319. package/dist/ui/geometry/ScreenSize.js +2 -0
  320. package/dist/ui/geometry/Size.d.ts +7 -0
  321. package/dist/ui/geometry/Size.js +9 -0
  322. package/dist/ui/geometry/index.d.ts +9 -0
  323. package/dist/ui/geometry/index.js +25 -0
  324. package/dist/ui/index.d.ts +18 -0
  325. package/dist/ui/index.js +34 -0
  326. package/dist/ui/responsive/Breakpoint.d.ts +8 -0
  327. package/dist/ui/responsive/Breakpoint.js +24 -0
  328. package/dist/ui/responsive/BreakpointObserver.d.ts +16 -0
  329. package/dist/ui/responsive/BreakpointObserver.js +104 -0
  330. package/dist/ui/responsive/Breakpoints.d.ts +5 -0
  331. package/dist/ui/responsive/Breakpoints.js +15 -0
  332. package/dist/ui/responsive/ResponsiveValue.d.ts +7 -0
  333. package/dist/ui/responsive/ResponsiveValue.js +26 -0
  334. package/dist/ui/responsive/index.d.ts +4 -0
  335. package/dist/ui/responsive/index.js +20 -0
  336. package/dist/ui/richtext/LexicalUtils.d.ts +31 -0
  337. package/dist/ui/richtext/LexicalUtils.js +314 -0
  338. package/dist/ui/richtext/StyledTextNode.d.ts +33 -0
  339. package/dist/ui/richtext/StyledTextNode.js +101 -0
  340. package/dist/ui/richtext/index.d.ts +2 -0
  341. package/dist/ui/richtext/index.js +18 -0
  342. package/dist/utils/ArrayUtils.d.ts +17 -0
  343. package/dist/utils/ArrayUtils.js +66 -0
  344. package/dist/utils/ByteSize.d.ts +19 -0
  345. package/dist/utils/ByteSize.js +33 -0
  346. package/dist/utils/DateUtils.d.ts +15 -0
  347. package/dist/utils/DateUtils.js +100 -0
  348. package/dist/utils/Deferral.d.ts +28 -0
  349. package/dist/utils/Deferral.js +107 -0
  350. package/dist/utils/Duration.d.ts +7 -0
  351. package/dist/utils/Duration.js +35 -0
  352. package/dist/utils/Fn.d.ts +14 -0
  353. package/dist/utils/Fn.js +52 -0
  354. package/dist/utils/ObjectUtils.d.ts +89 -0
  355. package/dist/utils/ObjectUtils.js +159 -0
  356. package/dist/utils/Random.d.ts +15 -0
  357. package/dist/utils/Random.js +72 -0
  358. package/dist/utils/StringUtils.d.ts +10 -0
  359. package/dist/utils/StringUtils.js +51 -0
  360. package/dist/utils/UrlUtils.d.ts +22 -0
  361. package/dist/utils/UrlUtils.js +119 -0
  362. package/dist/utils/Value.d.ts +23 -0
  363. package/dist/utils/Value.js +122 -0
  364. package/dist/utils/index.d.ts +12 -0
  365. package/dist/utils/index.js +28 -0
  366. package/dist/utils/isDefined.d.ts +1 -0
  367. package/dist/utils/isDefined.js +6 -0
  368. package/package.json +64 -0
@@ -0,0 +1,60 @@
1
+ import { Language } from '../regionalization';
2
+ import { RequiredBy } from '../types';
3
+ import { Page } from './Page';
4
+ import { Tag } from './Tag';
5
+ export declare class PageQuery {
6
+ private readonly _query;
7
+ private constructor();
8
+ /**
9
+ * Start query
10
+ * @param data
11
+ */
12
+ static create(data?: PageQuery.Data): PageQuery;
13
+ /**
14
+ * Deserialize
15
+ * @param data
16
+ */
17
+ static from(data: PageQuery.Data): PageQuery;
18
+ type(type: Page.Type | Page.Type[] | undefined): PageQuery;
19
+ preview(preview: boolean): PageQuery;
20
+ brand(brand: string | undefined): PageQuery;
21
+ currentBrand(): PageQuery;
22
+ locale(region: string, language: Language): PageQuery;
23
+ exclude(ids: Page.Id | Page.Id[] | undefined): PageQuery;
24
+ withTags(tags: Tag.Data[] | Tag.Data | undefined, match?: PageQuery.TagsMatch): PageQuery;
25
+ withAnyTags(tags: Tag.Data[] | Tag.Data): PageQuery;
26
+ withAllTags(tags: Tag.Data[] | Tag.Data): PageQuery;
27
+ limit(amount: number): PageQuery;
28
+ sortBy(sort: PageQuery.Sort): PageQuery;
29
+ sortByLatest(): PageQuery;
30
+ sortByType(args: PageQuery.Sort.ByType[]): PageQuery;
31
+ /**
32
+ * Serialize
33
+ */
34
+ build(): PageQuery.Args;
35
+ }
36
+ export declare namespace PageQuery {
37
+ export type TagsMatch = 'any' | 'all';
38
+ export type Sort = Sort.ByType[] | 'latest';
39
+ export namespace Sort {
40
+ type ByType = {
41
+ type: Page.Type;
42
+ tags?: Tag.Data[];
43
+ };
44
+ }
45
+ export type Data = {
46
+ version?: Exclude<Page.State, 'unpublished'>;
47
+ excludeIds?: Page.Id[];
48
+ brand?: string;
49
+ types?: Page.Type[];
50
+ region?: string;
51
+ language?: Language;
52
+ tags?: Tag.Data[];
53
+ tagsMatch?: TagsMatch;
54
+ sort?: Sort;
55
+ limit?: number;
56
+ };
57
+ type RequiredArgs = 'version' | 'brand' | 'region' | 'language';
58
+ export type Args = RequiredBy<Data, RequiredArgs>;
59
+ export {};
60
+ }
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.PageQuery = void 0;
15
+ const app_1 = require("../app");
16
+ const errors_1 = require("../errors");
17
+ const utils_1 = require("../utils");
18
+ // class
19
+ class PageQuery {
20
+ constructor(baseQuery) {
21
+ this._query = baseQuery;
22
+ }
23
+ /**
24
+ * Start query
25
+ * @param data
26
+ */
27
+ static create(data = {}) {
28
+ return new PageQuery(data);
29
+ }
30
+ /**
31
+ * Deserialize
32
+ * @param data
33
+ */
34
+ static from(data) {
35
+ return new PageQuery(data);
36
+ }
37
+ type(type) {
38
+ this._query.types = type === undefined
39
+ ? undefined
40
+ : utils_1.ArrayUtils.coerce(type);
41
+ return this;
42
+ }
43
+ preview(preview) {
44
+ this._query.version = preview ? 'draft' : 'published';
45
+ return this;
46
+ }
47
+ brand(brand) {
48
+ this._query.brand = brand;
49
+ return this;
50
+ }
51
+ currentBrand() {
52
+ return this.brand(app_1.AppConfig.brand());
53
+ }
54
+ locale(region, language) {
55
+ this._query.region = region;
56
+ this._query.language = language;
57
+ return this;
58
+ }
59
+ exclude(ids) {
60
+ var _a;
61
+ // skip if no ids
62
+ if (!ids) {
63
+ return this;
64
+ }
65
+ // append ids
66
+ this._query.excludeIds = [
67
+ ...(_a = this._query.excludeIds) !== null && _a !== void 0 ? _a : [],
68
+ ...utils_1.ArrayUtils.coerce(ids)
69
+ ];
70
+ // allow chaining
71
+ return this;
72
+ }
73
+ withTags(tags, match) {
74
+ // skip if no tags
75
+ if (!tags) {
76
+ return this;
77
+ }
78
+ // update query and chain
79
+ this._query.tags = utils_1.ArrayUtils.coerce(tags);
80
+ this._query.tagsMatch = match;
81
+ return this;
82
+ }
83
+ withAnyTags(tags) {
84
+ return this.withTags(tags, 'any');
85
+ }
86
+ withAllTags(tags) {
87
+ return this.withTags(tags, 'all');
88
+ }
89
+ limit(amount) {
90
+ this._query.limit = amount;
91
+ return this;
92
+ }
93
+ sortBy(sort) {
94
+ this._query.sort = sort;
95
+ return this;
96
+ }
97
+ sortByLatest() {
98
+ return this.sortBy('latest');
99
+ }
100
+ sortByType(args) {
101
+ return this.sortBy(args);
102
+ }
103
+ /**
104
+ * Serialize
105
+ */
106
+ build() {
107
+ const _a = this._query, { version = app_1.AppConfig.get().version, brand, region, language } = _a, rest = __rest(_a, ["version", "brand", "region", "language"]);
108
+ // throw if required data is missing
109
+ if (brand === undefined || region === undefined || language === undefined) {
110
+ throw new errors_1.IllegalStateError('cannot build page query if brand, region, or language is not defined');
111
+ }
112
+ // return
113
+ return Object.assign({ version, brand, region, language }, rest);
114
+ }
115
+ }
116
+ exports.PageQuery = PageQuery;
@@ -0,0 +1,7 @@
1
+ import { Tagged } from 'type-fest';
2
+ export type PageRoute = Tagged<string, 'funnel.PageRoute'>;
3
+ export declare namespace PageRoute {
4
+ function filter(value: string): value is PageRoute;
5
+ function getParams(path: PageRoute): Set<string>;
6
+ function toUrl<TParam extends string>(path: PageRoute, params: Record<TParam, string>): string;
7
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageRoute = void 0;
4
+ // extension
5
+ var PageRoute;
6
+ (function (PageRoute) {
7
+ // matcher
8
+ const matcher = /^(\/(([\w\-._~:?#[\]@!$&'()*+,;=%]+)|(\{slug\})|(\{(discover|preview|content)(\.[a-zA-Z]\w*)+\})))+$/;
9
+ // guard
10
+ function filter(value) {
11
+ return matcher.test(value);
12
+ }
13
+ PageRoute.filter = filter;
14
+ // helpers
15
+ function getParams(path) {
16
+ // create set
17
+ const params = new Set();
18
+ // extract params
19
+ path.split('/').forEach(component => {
20
+ if (component.startsWith('{')) {
21
+ params.add(component.substring(1, component.length - 1));
22
+ }
23
+ });
24
+ // return params
25
+ return params;
26
+ }
27
+ PageRoute.getParams = getParams;
28
+ function toUrl(path, params) {
29
+ // break path into components
30
+ let components = path.split('/');
31
+ // replace path components
32
+ components = components.map(component => {
33
+ var _a;
34
+ // replace path components
35
+ if (component.startsWith('{')) {
36
+ const param = component.substring(1, component.length - 1);
37
+ return (_a = params[param]) !== null && _a !== void 0 ? _a : 'undefined';
38
+ }
39
+ // or return standard component
40
+ else {
41
+ return component;
42
+ }
43
+ });
44
+ // re-join components into url
45
+ return components.join('/');
46
+ }
47
+ PageRoute.toUrl = toUrl;
48
+ })(PageRoute || (exports.PageRoute = PageRoute = {}));
@@ -0,0 +1,11 @@
1
+ import { Tagged } from 'type-fest';
2
+ import { RequiredBy } from '../types';
3
+ import type { Page } from './Page';
4
+ export type PageSnapshot = RequiredBy<Pick<Page.Data, Exclude<Page.Data.Props.Id, 'id'> | Page.Data.Props.Content | 'createdOn' | 'updatedOn' | 'changeSetId' | 'publication'>, 'changeSetId'> & {
5
+ id: PageSnapshot.Id;
6
+ };
7
+ export declare namespace PageSnapshot {
8
+ type Id = Tagged<string, 'PageSnapshot.Id'>;
9
+ type Prop = keyof PageSnapshot;
10
+ const props: ReadonlyArray<Prop>;
11
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageSnapshot = void 0;
4
+ // extension
5
+ var PageSnapshot;
6
+ (function (PageSnapshot) {
7
+ PageSnapshot.props = [
8
+ 'id', 'groupId', 'type', 'brand', 'region', 'language', 'slug', 'name', 'tags', 'url',
9
+ 'discover', 'preview', 'content',
10
+ 'changeSetId', 'publication', 'createdOn', 'updatedOn'
11
+ ];
12
+ })(PageSnapshot || (exports.PageSnapshot = PageSnapshot = {}));
@@ -0,0 +1,71 @@
1
+ import { StringKeyOf } from 'type-fest';
2
+ import { Block } from './Block';
3
+ export declare class Section<TBlocks extends Section.Blocks = Section.Blocks, TUnion extends boolean = false> {
4
+ readonly type = "section";
5
+ readonly name: string;
6
+ readonly version: number;
7
+ readonly blocks: TBlocks;
8
+ readonly preset: Section.Preset<TBlocks>;
9
+ readonly ordered: boolean;
10
+ readonly min: number;
11
+ readonly max: number;
12
+ private readonly _union;
13
+ private constructor();
14
+ unwrap(): this;
15
+ rename(name: string): Section<TBlocks, TUnion>;
16
+ modify(args: Section.ModifyArgs<TBlocks, TUnion>): Section<TBlocks, TUnion>;
17
+ static ordered<TBlocks extends Section.Blocks>(args: Section.BaseFactoryArgs<TBlocks>): Section<TBlocks>;
18
+ static oneOf<TBlocks extends Section.Blocks>(args: Section.SingleBlockFactoryArgs<TBlocks>): Section<TBlocks, true>;
19
+ static unordered<TBlocks extends Section.Blocks>(args: Section.BaseFactoryArgs<TBlocks>): Section<TBlocks>;
20
+ }
21
+ export declare namespace Section {
22
+ type Blocks<TBlock extends Block = Block> = Record<string, TBlock>;
23
+ type Preset<TBlocks extends Blocks = Blocks> = Array<StringKeyOf<TBlocks>>;
24
+ type Data<TSection extends Section = Section> = {
25
+ type: 'section';
26
+ version: number;
27
+ blocks: Data.ForBlock<TSection>[];
28
+ };
29
+ namespace Data {
30
+ type BlockInSection<TBlock extends Block = Block, TBlockKey extends string = string> = Block.Data<TBlock> & {
31
+ section: {
32
+ id: string;
33
+ block: TBlockKey;
34
+ };
35
+ };
36
+ export type ForBlock<TSection extends Section = Section> = {
37
+ [TBlockKey in StringKeyOf<TSection['blocks']>]: BlockInSection<TSection['blocks'][TBlockKey], TBlockKey>;
38
+ }[StringKeyOf<TSection['blocks']>];
39
+ export {};
40
+ }
41
+ type LinkedData<TSection extends Section = Section> = {
42
+ type: 'section';
43
+ version: number;
44
+ blocks: LinkedData.ForBlock<TSection>[];
45
+ };
46
+ namespace LinkedData {
47
+ type BlockInSection<TBlock extends Block = Block, TBlockKey extends string = string> = Block.LinkedData<TBlock> & {
48
+ section: {
49
+ id: string;
50
+ block: TBlockKey;
51
+ };
52
+ };
53
+ export type ForBlock<TSection extends Section = Section> = {
54
+ [TBlockKey in StringKeyOf<TSection['blocks']>]: BlockInSection<TSection['blocks'][TBlockKey], TBlockKey>;
55
+ }[StringKeyOf<TSection['blocks']>];
56
+ export {};
57
+ }
58
+ type ConstructorArgs<TBlocks extends Blocks = Blocks, TUnion extends boolean = false> = {
59
+ name: string;
60
+ version: number;
61
+ blocks: TBlocks;
62
+ preset: Preset<TBlocks>;
63
+ ordered: boolean;
64
+ min: number;
65
+ max: number;
66
+ union: TUnion;
67
+ };
68
+ type BaseFactoryArgs<TBlocks extends Blocks> = Omit<ConstructorArgs<TBlocks>, 'ordered' | 'union'>;
69
+ type SingleBlockFactoryArgs<TBlocks extends Blocks> = Omit<BaseFactoryArgs<TBlocks>, 'min' | 'max'>;
70
+ type ModifyArgs<TBlocks extends Blocks, TUnion extends boolean> = Partial<Omit<ConstructorArgs<TBlocks, TUnion>, 'blocks' | 'union'>>;
71
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Section = void 0;
4
+ class Section {
5
+ constructor(args) {
6
+ this.type = 'section';
7
+ this.name = args.name;
8
+ this.version = args.version;
9
+ this.blocks = args.blocks;
10
+ this.preset = args.preset;
11
+ this.ordered = args.ordered;
12
+ this.min = args.min;
13
+ this.max = args.max;
14
+ this._union = args.union;
15
+ }
16
+ unwrap() {
17
+ return this;
18
+ }
19
+ rename(name) {
20
+ return this.modify({ name });
21
+ }
22
+ modify(args) {
23
+ return new Section(Object.assign({ name: this.name, version: this.version, blocks: this.blocks, preset: this.preset, ordered: this.ordered, min: this.min, max: this.max, union: this._union }, args));
24
+ }
25
+ static ordered(args) {
26
+ return new Section(Object.assign(Object.assign({}, args), { ordered: true, union: false }));
27
+ }
28
+ static oneOf(args) {
29
+ return new Section(Object.assign(Object.assign({}, args), { min: 1, max: 1, ordered: true, union: true }));
30
+ }
31
+ static unordered(args) {
32
+ return new Section(Object.assign(Object.assign({}, args), { ordered: false, union: false }));
33
+ }
34
+ }
35
+ exports.Section = Section;
@@ -0,0 +1,13 @@
1
+ import { Block } from './Block';
2
+ export declare const Seo: Block<"_nd-seo", {
3
+ title: import("./field").TextField;
4
+ description: import("./field").TextField;
5
+ keywords: import("./Optional").Optional<import("./field").ListField<{
6
+ keyword: import("./field").TextField;
7
+ }>>;
8
+ image: import("./Optional").Optional<import("./field").AssetField<import("./field").AssetField.LinkedValue.Image>>;
9
+ }, Block.Config>;
10
+ export declare namespace Seo {
11
+ type Data = Block.Data<typeof Seo>;
12
+ type LinkedData = Block.LinkedData<typeof Seo>;
13
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Seo = void 0;
4
+ const Block_1 = require("./Block");
5
+ const field_1 = require("./field");
6
+ // block
7
+ exports.Seo = Block_1.Block.create({
8
+ id: '_nd-seo',
9
+ name: 'SEO',
10
+ version: 1,
11
+ fields: {
12
+ title: field_1.Field.text({ name: 'Title' }),
13
+ description: field_1.Field.text({ name: 'Description', semantics: 'long' }),
14
+ keywords: field_1.Field.list({
15
+ name: 'Keywords',
16
+ hint: 'Add keywords to improve your search engine scores.',
17
+ min: 1,
18
+ max: 20,
19
+ itemTypes: {
20
+ keyword: field_1.Field.text({ name: 'Keyword', hint: 'Enter a search term', minLength: 2, maxLength: 40, required: true })
21
+ }
22
+ }).optional(),
23
+ image: field_1.Field.image({ name: 'Image' }).optional()
24
+ }
25
+ });
@@ -0,0 +1,40 @@
1
+ import { Localized } from '../regionalization';
2
+ import { Collection } from './Collection';
3
+ import { Page } from './Page';
4
+ import { PageRoute } from './PageRoute';
5
+ import { SiteModel } from './SiteModel';
6
+ export declare class Site<TRegions extends Site.Regions = Site.Regions> {
7
+ private static _site?;
8
+ readonly regions: TRegions;
9
+ readonly collections: ReadonlyArray<Collection>;
10
+ private constructor();
11
+ toData(): Site.Data;
12
+ static create<TRegions extends Site.Regions>(regions: Site.CreateArgs<TRegions>, collections?: ReadonlyArray<Collection>): Site<TRegions>;
13
+ static current<TRegions extends Site.Regions>(): Site<TRegions>;
14
+ static getPage(type: Page.Type, region: string): Page;
15
+ static getCollection(type: Collection.Type): Collection;
16
+ }
17
+ export declare namespace Site {
18
+ type ConstructorArgs<TRegions extends Regions> = {
19
+ regions: TRegions;
20
+ collections: ReadonlyArray<Collection>;
21
+ };
22
+ type CreateArgs<TRegions extends Regions> = ConstructorArgs<TRegions>['regions'];
23
+ type Regions<TRegion extends string = string> = Record<TRegion, Pages>;
24
+ type Pages = Record<string, Page>;
25
+ type Data = Record<string, Data.Pages>;
26
+ namespace Data {
27
+ type Pages = Record<Page.Type, Page>;
28
+ type Page = {
29
+ variant: Page.Variant;
30
+ route: Localized.Maybe<PageRoute>;
31
+ name: string;
32
+ };
33
+ type Collections = Record<Collection.Type, Collection>;
34
+ type Collection = {
35
+ name: string;
36
+ };
37
+ function forSite(site: Site): Data;
38
+ function toSiteModel(data: Data): SiteModel;
39
+ }
40
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Site = void 0;
4
+ const errors_1 = require("../errors");
5
+ const SiteModel_1 = require("./SiteModel");
6
+ // class
7
+ class Site {
8
+ constructor(args) {
9
+ // initialize instance variables
10
+ this.regions = args.regions;
11
+ this.collections = args.collections;
12
+ // bind pages within each region
13
+ Object.values(this.regions).forEach(region => Object.entries(region).forEach(([pageType, page]) => page.bind(pageType)));
14
+ }
15
+ toData() {
16
+ return Site.Data.forSite(this);
17
+ }
18
+ static create(regions, collections = []) {
19
+ // create new Site
20
+ const site = new Site({ regions, collections });
21
+ // bind site
22
+ this._site = site;
23
+ // return site
24
+ return site;
25
+ }
26
+ static current() {
27
+ // throw if not initialized
28
+ const { _site } = this;
29
+ if (!_site) {
30
+ throw new errors_1.IllegalStateError('Attempt to access site schema before initial create()');
31
+ }
32
+ // return site
33
+ return _site;
34
+ }
35
+ static getPage(type, region) {
36
+ // throw if page isn't found
37
+ const site = Site.current();
38
+ const pages = site.regions[region];
39
+ const schema = pages[type];
40
+ if (!schema) {
41
+ throw new errors_1.IllegalStateError(`Unable to resolve Page schema for "${type}"`);
42
+ }
43
+ // or return it
44
+ return schema;
45
+ }
46
+ static getCollection(type) {
47
+ // throw if collection isn't found
48
+ const schemas = Site.current().collections;
49
+ const schema = schemas.find(schema => schema.type === type);
50
+ if (!schema) {
51
+ throw new errors_1.IllegalStateError(`Unable to resolve Collection schema for "${type}"`);
52
+ }
53
+ // or return it
54
+ return schema;
55
+ }
56
+ }
57
+ exports.Site = Site;
58
+ // extension
59
+ (function (Site) {
60
+ let Data;
61
+ (function (Data) {
62
+ // helpers
63
+ function forSite(site) {
64
+ // create region by walking site
65
+ return Object.entries(site.regions).reduce((siteData, [region, pages]) => {
66
+ // reduce pages in region
67
+ siteData[region] = Object.entries(pages).reduce((pagesData, [pageType, page]) => {
68
+ // map page
69
+ pagesData[pageType] = {
70
+ variant: page.variant,
71
+ route: page.route,
72
+ name: page.name
73
+ };
74
+ // keep reducing
75
+ return pagesData;
76
+ }, {});
77
+ // keep reducing
78
+ return siteData;
79
+ }, {});
80
+ }
81
+ Data.forSite = forSite;
82
+ function toSiteModel(data) {
83
+ return new SiteModel_1.SiteModel(data);
84
+ }
85
+ Data.toSiteModel = toSiteModel;
86
+ })(Data = Site.Data || (Site.Data = {}));
87
+ })(Site || (exports.Site = Site = {}));
@@ -0,0 +1,5 @@
1
+ import { Site } from './Site';
2
+ export declare class SiteModel {
3
+ readonly data: Site.Data;
4
+ constructor(data: Site.Data);
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SiteModel = void 0;
4
+ // class
5
+ class SiteModel {
6
+ constructor(data) {
7
+ this.data = data;
8
+ }
9
+ }
10
+ exports.SiteModel = SiteModel;
@@ -0,0 +1,28 @@
1
+ import { StringKeyOf } from 'type-fest';
2
+ import { TagGroup } from './TagGroup';
3
+ export declare class Tag<TGroupId extends string = string, TId extends string = string> {
4
+ readonly groupId: TGroupId;
5
+ readonly id: TId;
6
+ readonly name: string;
7
+ readonly data: Tag.Data<TGroupId, TId>;
8
+ constructor(args: Tag.ConstructorArgs<TGroupId, TId>);
9
+ }
10
+ export declare namespace Tag {
11
+ const separator: "/";
12
+ type Data<TGroupId extends string = string, TId extends string = string> = `${TGroupId}/${TId}`;
13
+ namespace Data {
14
+ type ForGroup<TGroup extends TagGroup> = Data<TGroup['id'], StringKeyOf<TGroup['tags']>>;
15
+ type Components = {
16
+ tagGroupId: string;
17
+ tagId: string;
18
+ };
19
+ function parse(data: Tag.Data): Components | undefined;
20
+ }
21
+ type ConstructorArgs<TGroupId extends string = string, TId extends string = string> = {
22
+ groupId: TGroupId;
23
+ id: TId;
24
+ name: string;
25
+ };
26
+ function toData<TGroupId extends string = string, TId extends string = string>(tag: Tag<TGroupId, TId>): Data<TGroupId, TId>;
27
+ function validateComponent(component: string, componentName: string): void;
28
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Tag = void 0;
4
+ const errors_1 = require("../errors");
5
+ // schema
6
+ class Tag {
7
+ constructor(args) {
8
+ // throw if id isn't valid
9
+ Tag.validateComponent(args.id, 'Tag.id');
10
+ // initialize instance variables
11
+ this.groupId = args.groupId;
12
+ this.id = args.id;
13
+ this.name = args.name;
14
+ this.data = Tag.toData(this);
15
+ }
16
+ }
17
+ exports.Tag = Tag;
18
+ // extension
19
+ (function (Tag) {
20
+ // constants
21
+ Tag.separator = '/';
22
+ let Data;
23
+ (function (Data) {
24
+ // helpers
25
+ function parse(data) {
26
+ // parse component (or fail if invalid)
27
+ const components = data.split('/');
28
+ if (components.length !== 2) {
29
+ return undefined;
30
+ }
31
+ // return components
32
+ const [tagGroupId, tagId] = components;
33
+ return tagGroupId && tagId
34
+ ? { tagGroupId, tagId }
35
+ : undefined;
36
+ }
37
+ Data.parse = parse;
38
+ })(Data = Tag.Data || (Tag.Data = {}));
39
+ // helpers
40
+ function toData(tag) {
41
+ return `${tag.groupId}/${tag.id}`;
42
+ }
43
+ Tag.toData = toData;
44
+ function validateComponent(component, componentName) {
45
+ // fail if it's empty
46
+ if (!component) {
47
+ throw new errors_1.ArgumentError(`Tag components can't be empty`, componentName);
48
+ }
49
+ // fail if it includes a separator
50
+ else if (component.includes(Tag.separator)) {
51
+ throw new errors_1.ArgumentError(`Tag components cannot include '${Tag.separator}' character`, componentName);
52
+ }
53
+ // fail if there's whitespace
54
+ else if (/\s/.test(component)) {
55
+ throw new errors_1.ArgumentError(`Tag components cannot contain whitespace`, componentName);
56
+ }
57
+ }
58
+ Tag.validateComponent = validateComponent;
59
+ })(Tag || (exports.Tag = Tag = {}));
@@ -0,0 +1,26 @@
1
+ import { StringKeyOf } from 'type-fest';
2
+ import { Transform } from '../types';
3
+ import { Tag } from './Tag';
4
+ export declare class TagGroup<TId extends string = string, TTagId extends string = string> {
5
+ readonly id: TId;
6
+ readonly name: string;
7
+ readonly tags: Readonly<Record<TTagId, Tag<TId, TTagId>>>;
8
+ private constructor();
9
+ get tagIds(): TTagId[];
10
+ get(tagId: TTagId): Tag<TId, TTagId> | undefined;
11
+ extract(...tagIds: TTagId[]): Tag<TId, TTagId>[];
12
+ map<T>(mapper: Transform<Tag<TId, TTagId>, T>): T[];
13
+ parse(data: TagGroup.Data): Tag<TId, TTagId>[];
14
+ static create<TId extends string, TTagId extends string>(args: TagGroup.ConstructorArgs<TId, TTagId>): TagGroup<TId, TTagId>;
15
+ }
16
+ export declare namespace TagGroup {
17
+ type Data<TGroup extends TagGroup = TagGroup> = Tag.Data.ForGroup<TGroup>[];
18
+ type ConstructorArgs<TId extends string = string, TTagId extends string = string> = {
19
+ id: TId;
20
+ name: string;
21
+ tags: Readonly<Record<TTagId, string>>;
22
+ };
23
+ type CreateArgs<TId extends string, TTagId extends string> = ConstructorArgs<TId, TTagId>;
24
+ type Keys<TGroup extends TagGroup> = StringKeyOf<TGroup['tags']>;
25
+ type Tags<TGroup extends TagGroup> = Tag<TGroup['id'], Keys<TGroup>>;
26
+ }