@daffodil/core 0.88.1 → 0.90.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 (293) hide show
  1. package/external-script/index.d.ts +95 -1
  2. package/external-script/testing/index.d.ts +44 -1
  3. package/fesm2022/daffodil-core-external-script-testing.mjs +3 -3
  4. package/fesm2022/daffodil-core-external-script-testing.mjs.map +1 -1
  5. package/fesm2022/daffodil-core-external-script.mjs +4 -5
  6. package/fesm2022/daffodil-core-external-script.mjs.map +1 -1
  7. package/fesm2022/daffodil-core-graphql.mjs +3 -3
  8. package/fesm2022/daffodil-core-graphql.mjs.map +1 -1
  9. package/fesm2022/daffodil-core-routing.mjs +3 -3
  10. package/fesm2022/daffodil-core-routing.mjs.map +1 -1
  11. package/fesm2022/daffodil-core-state-testing.mjs +6 -6
  12. package/fesm2022/daffodil-core-state-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-core-state.mjs +2 -0
  14. package/fesm2022/daffodil-core-state.mjs.map +1 -1
  15. package/fesm2022/daffodil-core-testing.mjs +67 -67
  16. package/fesm2022/daffodil-core-testing.mjs.map +1 -1
  17. package/fesm2022/daffodil-core.mjs +77 -21
  18. package/fesm2022/daffodil-core.mjs.map +1 -1
  19. package/graphql/index.d.ts +64 -1
  20. package/index.d.ts +1322 -1
  21. package/package.json +1 -1
  22. package/routing/index.d.ts +86 -1
  23. package/state/index.d.ts +649 -1
  24. package/state/testing/index.d.ts +46 -1
  25. package/testing/index.d.ts +363 -1
  26. package/async/maybe.type.d.ts +0 -2
  27. package/base64/base64.interface.d.ts +0 -14
  28. package/base64/browser/browser.service.d.ts +0 -12
  29. package/base64/public_api.d.ts +0 -3
  30. package/base64/server/public_api.d.ts +0 -1
  31. package/base64/server/server.service.d.ts +0 -14
  32. package/canonically-locateable/canonically-locateable.interface.d.ts +0 -9
  33. package/collection/build-metadata.d.ts +0 -6
  34. package/collection/build-request.d.ts +0 -6
  35. package/collection/collection.interface.d.ts +0 -16
  36. package/collection/countable.interface.d.ts +0 -9
  37. package/collection/error-map.d.ts +0 -4
  38. package/collection/metadata.interface.d.ts +0 -12
  39. package/collection/page-out-of-bounds.error.d.ts +0 -9
  40. package/collection/paginable.d.ts +0 -10
  41. package/collection/public_api.d.ts +0 -10
  42. package/collection/request.interface.d.ts +0 -27
  43. package/collection/sortable.d.ts +0 -41
  44. package/constructable/constructable.d.ts +0 -24
  45. package/decorators/debounce.decorator.d.ts +0 -47
  46. package/decorators/public_api.d.ts +0 -1
  47. package/errors/error-map.d.ts +0 -8
  48. package/errors/error.interface.d.ts +0 -17
  49. package/errors/inheritable-error.d.ts +0 -22
  50. package/errors/is-error.d.ts +0 -4
  51. package/errors/public_api.d.ts +0 -4
  52. package/external-script/external-script.service.d.ts +0 -50
  53. package/external-script/interface.d.ts +0 -11
  54. package/external-script/public_api.d.ts +0 -3
  55. package/external-script/script.d.ts +0 -32
  56. package/external-script/testing/constants.d.ts +0 -4
  57. package/external-script/testing/external-script.service.d.ts +0 -37
  58. package/external-script/testing/public_api.d.ts +0 -2
  59. package/filterable/filter-base.d.ts +0 -24
  60. package/filterable/filter-option-base.d.ts +0 -9
  61. package/filterable/filter-option.d.ts +0 -6
  62. package/filterable/filter-request.d.ts +0 -7
  63. package/filterable/filter-toggle-request.d.ts +0 -6
  64. package/filterable/filter.d.ts +0 -9
  65. package/filterable/filterable.d.ts +0 -10
  66. package/filterable/filters.type.d.ts +0 -5
  67. package/filterable/public_api.d.ts +0 -12
  68. package/filterable/type/equal/filter.d.ts +0 -24
  69. package/filterable/type/equal/option.d.ts +0 -19
  70. package/filterable/type/equal/public_api.d.ts +0 -4
  71. package/filterable/type/equal/request.d.ts +0 -18
  72. package/filterable/type/equal/toggle-request.d.ts +0 -18
  73. package/filterable/type/filter-type.d.ts +0 -7
  74. package/filterable/type/range/filter-base.d.ts +0 -23
  75. package/filterable/type/range/option.d.ts +0 -14
  76. package/filterable/type/range/pair.d.ts +0 -20
  77. package/filterable/type/range/public_api.d.ts +0 -6
  78. package/filterable/type/range/request-base.d.ts +0 -20
  79. package/filterable/type/range/request-option.d.ts +0 -14
  80. package/filterable/type/range/separator.d.ts +0 -5
  81. package/filterable/type/range-numeric/filter.d.ts +0 -11
  82. package/filterable/type/range-numeric/public_api.d.ts +0 -3
  83. package/filterable/type/range-numeric/request.d.ts +0 -11
  84. package/filterable/type/range-numeric/toggle-request.d.ts +0 -12
  85. package/filters/array-to-dict/array-to-dict.d.ts +0 -5
  86. package/filters/behaviors/apply/apply-filter.d.ts +0 -8
  87. package/filters/behaviors/apply/apply-request-to-filters.d.ts +0 -8
  88. package/filters/behaviors/apply/apply-requests-to-filters.d.ts +0 -8
  89. package/filters/behaviors/apply/public_api.d.ts +0 -3
  90. package/filters/behaviors/clear/clear-filter.d.ts +0 -8
  91. package/filters/behaviors/clear/clear-filters.d.ts +0 -8
  92. package/filters/behaviors/clear/public_api.d.ts +0 -2
  93. package/filters/behaviors/remove/public_api.d.ts +0 -3
  94. package/filters/behaviors/remove/remove-filter.d.ts +0 -9
  95. package/filters/behaviors/remove/remove-request-from-filters.d.ts +0 -8
  96. package/filters/behaviors/remove/remove-requests-from-filters.d.ts +0 -9
  97. package/filters/behaviors/toggle/public_api.d.ts +0 -2
  98. package/filters/behaviors/toggle/toggle-request-on-filters.d.ts +0 -6
  99. package/filters/behaviors/toggle/toggle.d.ts +0 -6
  100. package/filters/compute-applied-filters/compute-applied-filters.d.ts +0 -6
  101. package/filters/errors/codes.enum.d.ts +0 -9
  102. package/filters/errors/filter-not-found.error.d.ts +0 -8
  103. package/filters/errors/public_api.d.ts +0 -4
  104. package/filters/errors/request-name-mismatch.error.d.ts +0 -9
  105. package/filters/errors/request-type-mismatch.error.d.ts +0 -9
  106. package/filters/errors/unknown-filter-type.error.d.ts +0 -9
  107. package/filters/find-applied/find-applied-options.d.ts +0 -5
  108. package/filters/find-applied/public_api.d.ts +0 -1
  109. package/filters/is-applied/is-filter-applied.d.ts +0 -5
  110. package/filters/is-applied/is-toggle-request-applied-to-filter.d.ts +0 -5
  111. package/filters/is-applied/public_api.d.ts +0 -2
  112. package/filters/public_api.d.ts +0 -13
  113. package/filters/to-request/filter-to-request.d.ts +0 -6
  114. package/filters/to-request/filters-to-requests.d.ts +0 -6
  115. package/filters/to-request/public_api.d.ts +0 -2
  116. package/filters/type/equal/array-to-dict/option.d.ts +0 -5
  117. package/filters/type/equal/behaviors/apply/apply.d.ts +0 -8
  118. package/filters/type/equal/behaviors/clear/clear.d.ts +0 -8
  119. package/filters/type/equal/behaviors/remove/remove.d.ts +0 -11
  120. package/filters/type/equal/behaviors/toggle/toggle.d.ts +0 -11
  121. package/filters/type/equal/is-applied/is-applied.d.ts +0 -5
  122. package/filters/type/equal/is-applied/is-toggle-request-applied-to-filter.d.ts +0 -5
  123. package/filters/type/equal/public_api.d.ts +0 -1
  124. package/filters/type/equal/to-request/filter-to-request.d.ts +0 -5
  125. package/filters/type/range/array-to-dict/pair.d.ts +0 -5
  126. package/filters/type/range/behaviors/apply/apply.d.ts +0 -8
  127. package/filters/type/range/behaviors/clear/clear.d.ts +0 -8
  128. package/filters/type/range/behaviors/remove/remove.d.ts +0 -11
  129. package/filters/type/range/behaviors/toggle/toggle.d.ts +0 -10
  130. package/filters/type/range/compute-pair-label.d.ts +0 -1
  131. package/filters/type/range/is-applied/is-applied.d.ts +0 -5
  132. package/filters/type/range/is-applied/is-toggle-request-applied-to-filter.d.ts +0 -5
  133. package/filters/type/range/public_api.d.ts +0 -2
  134. package/filters/type/range/to-request/filter-to-request.d.ts +0 -5
  135. package/filters/type/range-numeric/to-request/filter-to-request.d.ts +0 -5
  136. package/filters/validators/public_api.d.ts +0 -2
  137. package/filters/validators/request-name-match.d.ts +0 -7
  138. package/filters/validators/request-type-match.d.ts +0 -7
  139. package/graphql/apollo/cacheable-operations/cacheable-operations-link.interface.d.ts +0 -4
  140. package/graphql/apollo/public_api.d.ts +0 -3
  141. package/graphql/apollo/queued-apollo/queued-apollo.service.d.ts +0 -29
  142. package/graphql/apollo/validator/type.d.ts +0 -8
  143. package/graphql/fragments/build-fragment-definition.d.ts +0 -8
  144. package/graphql/fragments/build-fragment-name-spread.d.ts +0 -11
  145. package/graphql/fragments/public_api.d.ts +0 -2
  146. package/graphql/public_api.d.ts +0 -2
  147. package/identifiable/array-to-dict.d.ts +0 -5
  148. package/identifiable/identifiable.interface.d.ts +0 -10
  149. package/identifiable/public_api.d.ts +0 -2
  150. package/injection-tokens/config.factory.d.ts +0 -9
  151. package/injection-tokens/config.type.d.ts +0 -18
  152. package/injection-tokens/multi.factory.d.ts +0 -8
  153. package/injection-tokens/multi.type.d.ts +0 -15
  154. package/injection-tokens/public_api.d.ts +0 -10
  155. package/injection-tokens/services.factory.d.ts +0 -8
  156. package/injection-tokens/services.type.d.ts +0 -15
  157. package/injection-tokens/single.factory.d.ts +0 -8
  158. package/injection-tokens/single.type.d.ts +0 -14
  159. package/injection-tokens/singleton.factory.d.ts +0 -8
  160. package/injection-tokens/singleton.type.d.ts +0 -15
  161. package/injection-tokens/token-constuctor-params.type.d.ts +0 -3
  162. package/kindable/kindable.interface.d.ts +0 -9
  163. package/kindable/public_api.d.ts +0 -1
  164. package/locateable/locateable.interface.d.ts +0 -10
  165. package/merge/merge.d.ts +0 -64
  166. package/merge/mergers/array-concat.d.ts +0 -1
  167. package/merge/mergers/dict-assign.d.ts +0 -1
  168. package/merge/mergers/public_api.d.ts +0 -3
  169. package/merge/mergers/type.d.ts +0 -4
  170. package/merge/public_api.d.ts +0 -3
  171. package/merge/strategy.type.d.ts +0 -8
  172. package/operators/all-of.pipe.d.ts +0 -6
  173. package/operators/any-of.pipe.d.ts +0 -6
  174. package/operators/backoff.pipe.d.ts +0 -7
  175. package/operators/catch-and-arrayify-errors.pipe.d.ts +0 -6
  176. package/operators/public_api.d.ts +0 -4
  177. package/orderable/orderable.d.ts +0 -9
  178. package/public_api.d.ts +0 -20
  179. package/routing/public_api.d.ts +0 -2
  180. package/routing/query-param-filter/public_api.d.ts +0 -2
  181. package/routing/query-param-filter/request-builder/equal.d.ts +0 -6
  182. package/routing/query-param-filter/request-builder/public_api.d.ts +0 -2
  183. package/routing/query-param-filter/request-builder/type.d.ts +0 -6
  184. package/routing/query-param-filter/type.d.ts +0 -16
  185. package/routing/uri/normalizer.service.d.ts +0 -22
  186. package/routing/uri/public_api.d.ts +0 -2
  187. package/routing/uri/truncation/file-extension.d.ts +0 -9
  188. package/routing/uri/truncation/leading-path-segments.d.ts +0 -5
  189. package/routing/uri/truncation/leading-slash.d.ts +0 -11
  190. package/routing/uri/truncation/public_api.d.ts +0 -4
  191. package/routing/uri/truncation/query-fragment.d.ts +0 -5
  192. package/state/actions/failure.type.d.ts +0 -13
  193. package/state/actions/public_api.d.ts +0 -1
  194. package/state/collection/actions.d.ts +0 -73
  195. package/state/collection/adapter.class.d.ts +0 -35
  196. package/state/collection/facade.d.ts +0 -34
  197. package/state/collection/facade.interface.d.ts +0 -54
  198. package/state/collection/initial-state.d.ts +0 -2
  199. package/state/collection/public_api.d.ts +0 -6
  200. package/state/collection/selector-factory.d.ts +0 -62
  201. package/state/errors/errorable.type.d.ts +0 -7
  202. package/state/errors/public_api.d.ts +0 -3
  203. package/state/errors/state-error.interface.d.ts +0 -18
  204. package/state/errors/transform-error-to-state-error.d.ts +0 -7
  205. package/state/operation/adapter.d.ts +0 -24
  206. package/state/operation/entity/adapter.d.ts +0 -84
  207. package/state/operation/entity/helpers/create-fake-id.d.ts +0 -7
  208. package/state/operation/entity/public_api.d.ts +0 -5
  209. package/state/operation/entity/selectors.d.ts +0 -24
  210. package/state/operation/entity/state.type.d.ts +0 -8
  211. package/state/operation/entity/type.d.ts +0 -15
  212. package/state/operation/facade.type.d.ts +0 -34
  213. package/state/operation/public_api.d.ts +0 -5
  214. package/state/operation/selectors.d.ts +0 -38
  215. package/state/operation/state.d.ts +0 -9
  216. package/state/operators/public_api.d.ts +0 -1
  217. package/state/operators/substream.pipe.d.ts +0 -26
  218. package/state/public_api.d.ts +0 -8
  219. package/state/reducers/create-meta.d.ts +0 -5
  220. package/state/reducers/identity.d.ts +0 -6
  221. package/state/reducers/public_api.d.ts +0 -2
  222. package/state/states/helpers.d.ts +0 -9
  223. package/state/states/loading.d.ts +0 -5
  224. package/state/states/mutable-loading.d.ts +0 -6
  225. package/state/states/public_api.d.ts +0 -5
  226. package/state/states/state.enum.d.ts +0 -48
  227. package/state/states/stateable.interface.d.ts +0 -8
  228. package/state/store/facade.d.ts +0 -3
  229. package/state/testing/mock-collection-facade.d.ts +0 -26
  230. package/state/testing/mock-operation-facade.d.ts +0 -20
  231. package/state/testing/public_api.d.ts +0 -2
  232. package/storage/error/error.d.ts +0 -7
  233. package/storage/error/error.service.d.ts +0 -15
  234. package/storage/error/public_api.d.ts +0 -2
  235. package/storage/localstorage/localstorage.service.d.ts +0 -23
  236. package/storage/noopstorage/noopstorage.service.d.ts +0 -13
  237. package/storage/persistence-server-safe.token.d.ts +0 -2
  238. package/storage/persistence.interface.d.ts +0 -7
  239. package/storage/public_api.d.ts +0 -6
  240. package/storage/server-error/public_api.d.ts +0 -2
  241. package/storage/server-error/server-error.d.ts +0 -11
  242. package/storage/server-error/server-error.service.d.ts +0 -18
  243. package/testing/angular/mocks/pipes/currency.d.ts +0 -13
  244. package/testing/factories/collection/metadata.factory.d.ts +0 -29
  245. package/testing/factories/collection/mock-collection.class.d.ts +0 -18
  246. package/testing/factories/collection/numerically-paginable.factory.d.ts +0 -8
  247. package/testing/factories/collection/public_api.d.ts +0 -7
  248. package/testing/factories/collection/request.factory.d.ts +0 -25
  249. package/testing/factories/collection/sort-option.factory.d.ts +0 -8
  250. package/testing/factories/collection/sort-options.factory.d.ts +0 -9
  251. package/testing/factories/collection/sortable.factory.d.ts +0 -9
  252. package/testing/factories/factory.d.ts +0 -42
  253. package/testing/factories/factory.interface.d.ts +0 -4
  254. package/testing/factories/filters/filter.factory.d.ts +0 -18
  255. package/testing/factories/filters/public_api.d.ts +0 -4
  256. package/testing/factories/filters/request.factory.d.ts +0 -13
  257. package/testing/factories/filters/toggle-request.d.ts +0 -18
  258. package/testing/factories/filters/type/equal/option.d.ts +0 -17
  259. package/testing/factories/filters/type/equal/public_api.d.ts +0 -3
  260. package/testing/factories/filters/type/equal/request.d.ts +0 -16
  261. package/testing/factories/filters/type/equal/toggle-request.d.ts +0 -16
  262. package/testing/factories/filters/type/equal.d.ts +0 -17
  263. package/testing/factories/filters/type/public_api.d.ts +0 -4
  264. package/testing/factories/filters/type/range-numeric/option.d.ts +0 -15
  265. package/testing/factories/filters/type/range-numeric/pair.d.ts +0 -23
  266. package/testing/factories/filters/type/range-numeric/public_api.d.ts +0 -5
  267. package/testing/factories/filters/type/range-numeric/request-option.d.ts +0 -15
  268. package/testing/factories/filters/type/range-numeric/request.d.ts +0 -23
  269. package/testing/factories/filters/type/range-numeric/toggle-request.d.ts +0 -20
  270. package/testing/factories/filters/type/range-numeric.d.ts +0 -19
  271. package/testing/factories/identifiable.factory.d.ts +0 -11
  272. package/testing/factories/public_api.d.ts +0 -5
  273. package/testing/public_api.d.ts +0 -4
  274. package/testing/testing.module.d.ts +0 -7
  275. package/testing/unique/enforce.d.ts +0 -7
  276. package/types/html.type.d.ts +0 -5
  277. package/types/id.type.d.ts +0 -1
  278. package/types/public_api.d.ts +0 -2
  279. package/utils/array-to-dict.d.ts +0 -7
  280. package/utils/collect.d.ts +0 -6
  281. package/utils/identity.d.ts +0 -5
  282. package/utils/long-arithmetic.d.ts +0 -43
  283. package/utils/observe.d.ts +0 -9
  284. package/utils/public_api.d.ts +0 -16
  285. package/utils/random-slice.d.ts +0 -7
  286. package/utils/random-subset.d.ts +0 -7
  287. package/utils/range.d.ts +0 -12
  288. package/utils/sample.d.ts +0 -4
  289. package/utils/shallow-compare.d.ts +0 -6
  290. package/utils/shuffle.d.ts +0 -5
  291. package/utils/unique.d.ts +0 -8
  292. package/validator/field-presence.d.ts +0 -6
  293. package/validator/public_api.d.ts +0 -1
package/index.d.ts CHANGED
@@ -1 +1,1322 @@
1
- export * from './public_api';
1
+ import * as i0 from '@angular/core';
2
+ import { EnvironmentProviders, InjectionToken, ValueProvider, FactoryProvider, Type, ExistingProvider } from '@angular/core';
3
+ import * as rxjs from 'rxjs';
4
+ import { Observable } from 'rxjs';
5
+
6
+ /**
7
+ * An object that has a location referenced by a URL.
8
+ */
9
+ interface DaffLocatable {
10
+ /**
11
+ * The URL describing the location of the entity.
12
+ * It should be relative to the domain root with a leading slash, i.e. `/path/to/entity`.
13
+ */
14
+ url: string;
15
+ }
16
+
17
+ /**
18
+ * An object that has a canonical location referenced by a URL.
19
+ */
20
+ interface DaffCanonicallyLocatable {
21
+ /**
22
+ * The URL describing the canonical location of the entity.
23
+ */
24
+ canonicalUrl: string;
25
+ }
26
+
27
+ /**
28
+ * A type which describes a function which would return an instance of a class
29
+ * Typically, we call this the "new" method in a language.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * class MyClass {
34
+ * readonly myProp: string = 'prop';
35
+ * name: string;
36
+ * constructor(name: string){
37
+ * this.name = name;
38
+ * }
39
+ * }
40
+ *
41
+ * const map = {
42
+ * "key": Myclass
43
+ * }
44
+ *
45
+ * let instance = new map["key"];
46
+ * instance instanceof MyClass //true
47
+ *
48
+ * ```
49
+ */
50
+ type Constructable<T, Args extends Array<any> = Array<any>> = new (...args: Args) => T;
51
+
52
+ /**
53
+ * Configuration interface for Vercel image optimization settings.
54
+ */
55
+ interface VercelAssetsConfig {
56
+ /**
57
+ * Default width to use when no width is specified in the image config.
58
+ */
59
+ defaultWidth: number;
60
+ /**
61
+ * Image quality setting (0-100) for Vercel image optimization.
62
+ */
63
+ quality: number;
64
+ }
65
+ /**
66
+ * Provides a Vercel image loader as an Angular environment provider.
67
+ *
68
+ * @param domain The domain to match against image URLs for transformation
69
+ * @param configuration Configuration options for image optimization
70
+ * @returns Environment providers array containing the Vercel image loader
71
+ */
72
+ declare const provideVercelImageLoader: (domain: string, configuration: VercelAssetsConfig) => EnvironmentProviders;
73
+
74
+ /**
75
+ * A service for encoding and decoding base64 strings.
76
+ */
77
+ interface DaffBase64Service {
78
+ /**
79
+ * Encodes an ASCII string to base64.
80
+ */
81
+ encode(str: string): string;
82
+ /**
83
+ * Decodes a base64 string to ASCII.
84
+ */
85
+ decode(str: string): string;
86
+ }
87
+ declare const DaffBase64ServiceToken: i0.InjectionToken<DaffBase64Service>;
88
+
89
+ /**
90
+ * A base64 service meant to be loaded into SSR contexts.
91
+ *
92
+ * @inheritdoc
93
+ */
94
+ declare class DaffServerBase64Service implements DaffBase64Service {
95
+ constructor(platformId: string);
96
+ encode(str: string): string;
97
+ decode(str: string): string;
98
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffServerBase64Service, never>;
99
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffServerBase64Service>;
100
+ }
101
+
102
+ /**
103
+ * @inheritdoc
104
+ */
105
+ declare class DaffBrowserBase64Service implements DaffBase64Service {
106
+ constructor(platformId: string);
107
+ encode(str: string): string;
108
+ decode(str: string): string;
109
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffBrowserBase64Service, never>;
110
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffBrowserBase64Service>;
111
+ }
112
+
113
+ /**
114
+ * The interface that describes a collection of elements that can be navigated in
115
+ * a paged way. E.g. "Pages 1,2,3,4,5".
116
+ *
117
+ */
118
+ interface DaffNumericallyPaginable {
119
+ currentPage: number;
120
+ totalPages: number;
121
+ pageSize: number;
122
+ }
123
+
124
+ /**
125
+ * The metadata that describes the sorting behavior of a collection of elements.
126
+ */
127
+ interface DaffSortOptions {
128
+ default: DaffSortOption['value'];
129
+ options: DaffSortOption[];
130
+ }
131
+ /**
132
+ * One particular option used to sort a collection of elements;
133
+ */
134
+ interface DaffSortOption {
135
+ label: string;
136
+ value: any;
137
+ }
138
+ /**
139
+ * The direction in which to sort a list of elements, e.g. if the list was
140
+ * sorted alphabetically, "Ascending" would be from "A-Z",
141
+ * and "Descending" would be from "Z-A".
142
+ */
143
+ declare enum DaffSortDirectionEnum {
144
+ Ascending = "ASC",
145
+ Descending = "DSC"
146
+ }
147
+ /**
148
+ * Describes the properties of a collection that make the collection able to be
149
+ * sorted by Daffodil.
150
+ */
151
+ interface DaffSortable {
152
+ /**
153
+ * The available options by which to sort the collection.
154
+ */
155
+ sortOptions: DaffSortOptions;
156
+ /**
157
+ * The currently applied sorting option.
158
+ */
159
+ appliedSortOption: DaffSortOption['value'];
160
+ /**
161
+ * The currently applied sort direction.
162
+ */
163
+ appliedSortDirection: DaffSortDirectionEnum;
164
+ }
165
+
166
+ /**
167
+ * Represents an entity that contains a countable number of items.
168
+ */
169
+ interface DaffCountable {
170
+ /**
171
+ * The number of items contained or tracked by this entity.
172
+ */
173
+ count: number;
174
+ }
175
+
176
+ /**
177
+ * The base type of a filter option.
178
+ */
179
+ interface DaffFilterOptionBase {
180
+ /**
181
+ * Whether or not the filter option is applied.
182
+ */
183
+ applied: boolean;
184
+ }
185
+
186
+ /**
187
+ * The known types of filters.
188
+ */
189
+ declare enum DaffFilterType {
190
+ Equal = "equal",
191
+ RangeNumeric = "rangeNumeric"
192
+ }
193
+
194
+ /**
195
+ * The base type of a filter.
196
+ */
197
+ interface DaffFilterBase {
198
+ /**
199
+ * The end-user facing string that explains the filter e.g. "Color".
200
+ */
201
+ label: string;
202
+ /**
203
+ * The name of the filter e.g. "color".
204
+ */
205
+ name: string;
206
+ /**
207
+ * The type of the filter. This is used to determine the specific behavior of the filter.
208
+ */
209
+ type: DaffFilterType;
210
+ /**
211
+ * The available options by which to filter a collection entity, e.g. "red", "blue", or "green".
212
+ * The type of options changes per type of filter.
213
+ */
214
+ options: Record<string, DaffFilterOptionBase>;
215
+ }
216
+
217
+ /**
218
+ * The individual options applicable to a filter. Such an option may be something like
219
+ * "Red" or "Green", "Tall" or "Short", etc.
220
+ */
221
+ interface DaffFilterEqualOption extends DaffFilterOptionBase {
222
+ /**
223
+ * The id of the filter option.
224
+ */
225
+ value: string;
226
+ /**
227
+ * A label to represent the filter option in the UI.
228
+ */
229
+ label: string;
230
+ /**
231
+ * The number of entities that would be returned after application of this filter.
232
+ */
233
+ count: number;
234
+ }
235
+
236
+ /**
237
+ * A DaffFilterEqual is used to represent filters where
238
+ * there is a set of well-defined dictionary-like values that are exactly
239
+ * matchable. For example, one such filter may be a "Color" filter with options
240
+ * of "Red", "Green", or "Blue" where a user can which filters options from the set
241
+ * to apply.
242
+ *
243
+ * It is important to note that this kind of filter does not imply how combinations of
244
+ * options are applied to collections of items, items that are "Red" AND "Green" vs.
245
+ * items that are "Red" OR "Green".
246
+ */
247
+ interface DaffFilterEqual extends DaffFilterBase {
248
+ /**
249
+ * The filter type for this model is always of type "DaffFilterType.Equal".
250
+ */
251
+ type: DaffFilterType.Equal;
252
+ /**
253
+ * A dictionary of filter options.
254
+ */
255
+ options: Record<DaffFilterEqualOption['value'], DaffFilterEqualOption>;
256
+ }
257
+
258
+ /**
259
+ * A particular option of a range pair.
260
+ * Holds a value and a label.
261
+ */
262
+ interface DaffFilterRangeOption<T> {
263
+ /**
264
+ * The value for the range option; e.g. "10" for a price range option.
265
+ */
266
+ value: T;
267
+ /**
268
+ * A label to represent the range option in the UI.
269
+ */
270
+ label: string;
271
+ }
272
+
273
+ /**
274
+ * An pair of options of the range filter.
275
+ * Specifies a pair of min and max values.
276
+ */
277
+ interface DaffFilterRangePair<T> extends DaffFilterOptionBase {
278
+ /**
279
+ * The range pair is always set to applied, because a filter range pair exists if it is applied and does not exist if it is not applied.
280
+ */
281
+ applied: true;
282
+ /**
283
+ * The minimum range option of the filter range pair.
284
+ */
285
+ min: DaffFilterRangeOption<T>;
286
+ /**
287
+ * The maximum range option of the filter range pair.
288
+ */
289
+ max: DaffFilterRangeOption<T>;
290
+ }
291
+
292
+ /**
293
+ * A base type for a range-style filter where there is a continuous distribution
294
+ * that can be selected from. E.g. numbers from 0 through 100, letters from "a"
295
+ * through "z", or dates from "1970-01-01" through "1971-01-01".
296
+ *
297
+ * Note that this is the generic base allowing for stricter type implementations.
298
+ */
299
+ interface DaffFilterRangeBase<T> extends DaffFilterBase {
300
+ /**
301
+ * The minimum value for the filter range.
302
+ */
303
+ min: T;
304
+ /**
305
+ * The maximum value for the filter range.
306
+ */
307
+ max: T;
308
+ /**
309
+ * A dictionary of filter range options.
310
+ */
311
+ options: Record<string, DaffFilterRangePair<T>>;
312
+ }
313
+
314
+ /**
315
+ * The separator between a range type filter's values
316
+ * e.g. "price": "30-40".
317
+ */
318
+ declare const DaffFilterFromToFilterSeparator = "-";
319
+
320
+ /**
321
+ * The base interface for range requests. Range requests have a name and a
322
+ * single defining the min and max values between which to filter.
323
+ */
324
+ interface DaffFilterRangeRequestBase<T> {
325
+ /**
326
+ * The type of filter.
327
+ */
328
+ type: DaffFilterType;
329
+ /**
330
+ * The name/code of the filter; e.g. price.
331
+ */
332
+ name: string;
333
+ /**
334
+ * The value of the filter range.
335
+ */
336
+ value: DaffFilterRangeRequestOption<T>;
337
+ }
338
+
339
+ /**
340
+ * The request option represents the minimum and maximum values that
341
+ * are going to be filtered as defined by a {@link DaffFilterRangeRequestBase}.
342
+ */
343
+ interface DaffFilterRangeRequestOption<T> {
344
+ /**
345
+ * The minimum value of the filter range.
346
+ */
347
+ min: T;
348
+ /**
349
+ * The maximum value of the filter range.
350
+ */
351
+ max: T;
352
+ }
353
+
354
+ /**
355
+ * An interface that describes filters that are a range of numbers; i.e. prices.
356
+ */
357
+ interface DaffFilterRangeNumeric extends DaffFilterRangeBase<number> {
358
+ /**
359
+ * The type of filter.
360
+ */
361
+ type: DaffFilterType.RangeNumeric;
362
+ }
363
+
364
+ /**
365
+ * A single filter along with its options. For example, a filter may be
366
+ * something like "Color" with options of "Red", "Blue", and "Green".
367
+ *
368
+ * Importantly, filters have "types" which determine their behavior. See {@link DaffFilterType} for a complete list.
369
+ */
370
+ type DaffFilter = DaffFilterRangeNumeric | DaffFilterEqual;
371
+
372
+ /**
373
+ * A dictionary of {@link DaffFilter}s keyed by name.
374
+ */
375
+ type DaffFilters<T extends DaffFilter = DaffFilter> = Record<T['name'], T>;
376
+
377
+ /**
378
+ * A given option of a particular filter, e.g. "Blue" is a DaffFilterOption
379
+ * of the {@link DaffFilter} "Color".
380
+ */
381
+ type DaffFilterOption = DaffFilter['options'][string];
382
+
383
+ /**
384
+ * A request used to modify the applied status of a {@link DaffFilterEqual}.
385
+ */
386
+ interface DaffFilterEqualRequest {
387
+ /**
388
+ * The type of filter request.
389
+ */
390
+ type: DaffFilterType.Equal;
391
+ /**
392
+ * The name of the filter; e.g. color.
393
+ */
394
+ name: string;
395
+ /**
396
+ * An array of filter options; e.g. green and red.
397
+ */
398
+ value: string[];
399
+ }
400
+
401
+ /**
402
+ * Describes filter range requests for numbers; i.e. prices.
403
+ */
404
+ interface DaffFilterRangeNumericRequest extends DaffFilterRangeRequestBase<number> {
405
+ /**
406
+ * The filter type.
407
+ */
408
+ type: DaffFilterType.RangeNumeric;
409
+ }
410
+
411
+ /**
412
+ * A DaffFilterRequest is used to modify the applied or unapplied state of
413
+ * the options of a {@link DaffFilter}.
414
+ */
415
+ type DaffFilterRequest = DaffFilterEqualRequest | DaffFilterRangeNumericRequest;
416
+
417
+ /**
418
+ * A request used to toggle the applied status of a {@link DaffFilterEqual}.
419
+ */
420
+ interface DaffFilterEqualToggleRequest {
421
+ /**
422
+ * The type of filter request.
423
+ */
424
+ type: DaffFilterType.Equal;
425
+ /**
426
+ * The name of the filter; e.g. color.
427
+ */
428
+ name: string;
429
+ /**
430
+ * The value of the filter option; e.g. red.
431
+ */
432
+ value: string;
433
+ }
434
+
435
+ /**
436
+ * An interface to describe toggle requests for ranged numeric filters. For example, the request could be to
437
+ * toggle a price filter for the "10-20" range.
438
+ */
439
+ interface DaffFilterRangeNumericToggleRequest extends DaffFilterRangeRequestBase<number> {
440
+ /**
441
+ * The filter type.
442
+ */
443
+ type: DaffFilterType.RangeNumeric;
444
+ }
445
+
446
+ /**
447
+ * A DaffFilterToggleRequest is used to toggle a filter option between an applied and unapplied state.
448
+ */
449
+ type DaffFilterToggleRequest = DaffFilterEqualToggleRequest | DaffFilterRangeNumericToggleRequest;
450
+
451
+ /**
452
+ * Describes an object that allows a specific entity to be filterable.
453
+ */
454
+ interface DaffFilterable {
455
+ /**
456
+ * The available filters.
457
+ */
458
+ filters: DaffFilters;
459
+ }
460
+
461
+ type ID = string;
462
+
463
+ /**
464
+ * An object that has an identifier.
465
+ */
466
+ interface DaffIdentifiable {
467
+ /**
468
+ * The identifier.
469
+ */
470
+ id: ID;
471
+ }
472
+
473
+ /**
474
+ * Transforms an array of {@link DaffIdentifiable} objects to a dictionary of those objects keyed by ID.
475
+ */
476
+ declare const daffIdentifiableArrayToDict: <T extends DaffIdentifiable = DaffIdentifiable>(ary: T[]) => Record<T["id"], T>;
477
+
478
+ /**
479
+ * The collection metadata contains info about the collection as a whole
480
+ * such as pagination, sorting, and size.
481
+ */
482
+ interface DaffCollectionMetadata extends DaffNumericallyPaginable, DaffSortable, DaffCountable, DaffFilterable {
483
+ ids: DaffIdentifiable['id'][];
484
+ }
485
+
486
+ /**
487
+ * A collection of items that is paginable, sortable, and filterable.
488
+ */
489
+ interface DaffCollection<T extends DaffIdentifiable = DaffIdentifiable> {
490
+ /**
491
+ * The collection metadata that contains info about the collection.
492
+ * Includes page, sorting, filtering, and total number of items.
493
+ */
494
+ metadata: DaffCollectionMetadata;
495
+ /**
496
+ * The current page of items according to the sorting and filtering.
497
+ */
498
+ data: Record<T['id'], T>;
499
+ }
500
+
501
+ /**
502
+ * An error object containing info about the exception that generated it.
503
+ */
504
+ interface DaffError extends Error {
505
+ /**
506
+ * A string that uniquely identifies the error.
507
+ */
508
+ code: string;
509
+ /**
510
+ * Contains additional relevant information to the cause and/or solution of the error.
511
+ */
512
+ message: string;
513
+ /**
514
+ * Whether the error is non-critical and recoverable or catastrophic and unrecoverable.
515
+ */
516
+ recoverable: boolean;
517
+ }
518
+
519
+ /**
520
+ * A type for a dictionary of error codes to Daffodil errors.
521
+ */
522
+ interface DaffErrorCodeMap {
523
+ [x: string]: Constructable<DaffError>;
524
+ }
525
+
526
+ /**
527
+ * A class which allows you to appropriately check the inheritance of an error.
528
+ *
529
+ * In typescript, when you try to extend an error with a specialized error class,
530
+ * if you try to call something like:
531
+ *
532
+ * ```ts
533
+ * class MyError extends Error {}
534
+ *
535
+ * let myError = new MyError();
536
+ *
537
+ * myError instanceof MyError; // returns false
538
+ * ```
539
+ *
540
+ * You will see unexpected things. This class fixes that issue as described here
541
+ * https://github.com/microsoft/TypeScript/issues/13965
542
+ */
543
+ declare class DaffInheritableError extends Error {
544
+ __proto__: Error;
545
+ recoverable: boolean;
546
+ constructor(message?: string);
547
+ }
548
+
549
+ /**
550
+ * Checks if the passed object is a {@link DaffError}
551
+ */
552
+ declare const daffIsError: (error: any) => boolean;
553
+
554
+ declare const DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE = "DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS";
555
+ /**
556
+ * An error thrown when the requested page is greater than the number of available pages.
557
+ */
558
+ declare class DaffCollectionPageOutOfBoundsError extends DaffInheritableError implements DaffError {
559
+ readonly code: string;
560
+ constructor(message?: string);
561
+ }
562
+
563
+ declare const daffCollectionErrorMap: {
564
+ DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS: typeof DaffCollectionPageOutOfBoundsError;
565
+ };
566
+
567
+ /**
568
+ * A collection of items that is paginable, sortable, and filterable.
569
+ */
570
+ interface DaffCollectionRequest {
571
+ /**
572
+ * The option by which to sort the collection's items.
573
+ */
574
+ appliedSortOption?: string;
575
+ /**
576
+ * The direction by which to sort the collection's items.
577
+ */
578
+ appliedSortDirection?: DaffSortDirectionEnum;
579
+ /**
580
+ * What page of the collection's items to retrieve.
581
+ */
582
+ currentPage?: number;
583
+ /**
584
+ * The number of items per-page to request.
585
+ */
586
+ pageSize?: number;
587
+ /**
588
+ * The properties by which to filter the items of the collection being requested.
589
+ */
590
+ filterRequests?: DaffFilterRequest[];
591
+ }
592
+
593
+ /**
594
+ * Extracts the part of the {@link DaffCollectionRequest} that can be directly set in {@link DaffCollectionMetadata}.
595
+ */
596
+ declare const daffCollectionBuildMetadataFromRequest: (request: DaffCollectionRequest) => Partial<DaffCollectionMetadata>;
597
+
598
+ /**
599
+ * Builds a {@link DaffCollectionRequest} from {@link DaffCollectionMetadata}.
600
+ */
601
+ declare const daffCollectionBuildRequestFromMetadata: (metadata: DaffCollectionMetadata) => Partial<DaffCollectionRequest>;
602
+
603
+ /**
604
+ * A utility decorator that delays method execution until after a specified delay period has elapsed since the last invocation.
605
+ *
606
+ * @param delay - The delay in milliseconds before the method executes. Defaults to 100ms.
607
+ * @returns A method decorator that can be applied to class methods.
608
+ *
609
+ * @example Basic usage with custom delay
610
+ * ```ts
611
+ * import { debounce } from '@daffodil/core';
612
+ *
613
+ * class SearchComponent {
614
+ * @debounce(300)
615
+ * onSearchInput(value: string) {
616
+ * // Only executes after 300ms
617
+ * this.performSearch(value);
618
+ * }
619
+ * }
620
+ * ```
621
+ *
622
+ * @example Using default delay (100ms)
623
+ * ```ts
624
+ * class MyComponent {
625
+ * @debounce() // Uses 100ms default
626
+ * onInputChange(value: string) {
627
+ * console.log('Input changed:', value);
628
+ * }
629
+ * }
630
+ * ```
631
+ *
632
+ * @example Angular component integration
633
+ * ```ts
634
+ * import { Component } from '@angular/core';
635
+ * import { debounce } from '@daffodil/core';
636
+ *
637
+ * @Component({
638
+ * selector: 'app-search',
639
+ * template: '<input (input)="onSearchInput($event.target.value)" />',
640
+ * })
641
+ * export class SearchComponent {
642
+ * @debounce(500)
643
+ * onSearchInput(value: string) {
644
+ * this.searchService.search(value);
645
+ * }
646
+ * }
647
+ * ```
648
+ */
649
+ declare const debounce: (delay?: number) => MethodDecorator;
650
+
651
+ /**
652
+ * Applies a filter request to the matching filter.
653
+ *
654
+ * @idempotent {filter}
655
+ * @throws {@link DaffFilterUnknownType}
656
+ */
657
+ declare const daffApplyFilter: (request: DaffFilterRequest, filter: DaffFilter) => DaffFilter;
658
+
659
+ /**
660
+ * Applies a {@link DaffFilterRequest} to a dictionary of {@link DaffFilter}
661
+ * returning the updated dictionary.
662
+ *
663
+ * @idempotent {filters}
664
+ */
665
+ declare const daffApplyRequestToFilters: (request: DaffFilterRequest, filters: DaffFilters) => DaffFilters;
666
+
667
+ /**
668
+ * Applies filters from a {@link DaffFilterRequest} to a dictionary
669
+ * of {@link DaffFilter}.
670
+ *
671
+ * @idempotent {filters}
672
+ */
673
+ declare const daffApplyRequestsToFilters: (filtersRequests: DaffFilterRequest[], filters: DaffFilters) => DaffFilters;
674
+
675
+ /**
676
+ * Undoes the applied state of all applied filter options of a {@link DaffFilter}
677
+ * returning the filter.
678
+ *
679
+ * @idempotent {filter}
680
+ */
681
+ declare const daffClearFilter: (filter: DaffFilter) => DaffFilter;
682
+
683
+ /**
684
+ * Undoes the applied state of all applied filter options of a dictionary of {@link DaffFilter}
685
+ * returning updated dictionary.
686
+ *
687
+ * @idempotent {filters}
688
+ */
689
+ declare const daffClearFilters: (filters: DaffFilters) => DaffFilters;
690
+
691
+ /**
692
+ * Undoes any applied options of a {@link DaffFilter} that match the
693
+ * {@link DaffFilterRequest}, returning the {@link DaffFilter}.
694
+ *
695
+ * @idempotent {filter}
696
+ * @pure
697
+ */
698
+ declare const daffRemoveFilter: (request: DaffFilterRequest, filter: DaffFilter) => DaffFilter;
699
+
700
+ /**
701
+ * Undoes any applied options of a particular filter of a dictionary of {@link DaffFilter}
702
+ * that match the {@link DaffFilterRequest}, returning the dictionary of {@link DaffFilter}.
703
+ *
704
+ * @idempotent {filters}
705
+ */
706
+ declare const daffRemoveRequestFromFilters: (request: DaffFilterRequest, filters: DaffFilters) => DaffFilters;
707
+
708
+ /**
709
+ * Undoes all applied options of a dictionary of {@link DaffFilter}
710
+ * that match any of the {@link DaffFilterRequest},
711
+ * returning the updated dictionary of {@link DaffFilter}.
712
+ *
713
+ * @idempotent {filters}
714
+ */
715
+ declare const daffRemoveRequestsFromFilters: (requests: (DaffFilterRequest)[], filters: DaffFilters) => DaffFilters;
716
+
717
+ /**
718
+ * Toggles the state of the filters (and their options) in the {@link DaffFilter}
719
+ * that match the {@link DaffFilterToggleRequest} .
720
+ */
721
+ declare function daffToggleFilter(request: DaffFilterToggleRequest, filter: DaffFilter): DaffFilter;
722
+
723
+ /**
724
+ * Toggles the state of a filter option in the {@link DaffFilters}
725
+ * that matches the {@link DaffFilterToggleRequest}.
726
+ */
727
+ declare const daffToggleRequestOnFilters: (request: DaffFilterToggleRequest, filters: DaffFilters) => DaffFilters;
728
+
729
+ /**
730
+ * Determines whether or not a filter has any currently applied options.
731
+ */
732
+ declare const daffIsFilterApplied: (filter: DaffFilter) => boolean;
733
+
734
+ /**
735
+ * Determines whether or not a {@link DaffFilterToggleRequest} is already applied to a {@link DaffFilter}.
736
+ */
737
+ declare const daffIsToggleRequestAppliedToFilter: (request: DaffFilterToggleRequest, filter: DaffFilter) => boolean;
738
+
739
+ /**
740
+ * Finds the applied options in the filter.
741
+ */
742
+ declare const daffFilterFindAppliedOptions: <T extends DaffFilterBase>(filter: T) => T["options"][string][];
743
+
744
+ /**
745
+ * Builds a filter request from a filter.
746
+ * Returns null if the filter does not have at least one applied option.
747
+ */
748
+ declare function daffFilterToRequest(filter: DaffFilter): DaffFilterRequest | null;
749
+
750
+ /**
751
+ * Builds a list of filter requests from a list of filters.
752
+ * Requests are only built for the filters that have at least one applied option.
753
+ */
754
+ declare function daffFiltersToRequests(filters: DaffFilters): DaffFilterRequest[];
755
+
756
+ /**
757
+ * Transforms an {@link DaffFilterRangePair[]} to a dictionary.
758
+ */
759
+ declare const daffFilterRangePairArrayToDict: <T>(pairs: DaffFilterRangePair<T>[]) => Record<string, DaffFilterRangePair<T>>;
760
+
761
+ declare const daffFilterComputeRangePairLabel: (min: any, max: any) => string;
762
+
763
+ /**
764
+ * Converts a list of equal filter options to a dict of options keyed by option value.
765
+ */
766
+ declare const daffFilterEqualOptionArrayToDict: (options: DaffFilterEqualOption[]) => Record<DaffFilterEqualOption["value"], DaffFilterEqualOption>;
767
+
768
+ /**
769
+ * Ensures that the names of the filter and the filter request match.
770
+ *
771
+ * @throws {@link DaffFilterNotFound} if the names do not match.
772
+ */
773
+ declare const daffFilterValidateRequestNameMatch: (request: DaffFilterRequest | DaffFilterToggleRequest, filter: DaffFilter) => void;
774
+
775
+ /**
776
+ * Ensures that the types of the filter and the filter request match.
777
+ *
778
+ * @throws {@link DaffFilterRequestTypeMismatch} if the types do not match.
779
+ */
780
+ declare const daffFilterValidateRequestTypeMatch: (request: DaffFilterRequest | DaffFilterToggleRequest, filter: DaffFilter) => void;
781
+
782
+ /**
783
+ * An error thrown when a lookup for a filter.
784
+ */
785
+ declare class DaffFilterNotFound extends DaffInheritableError implements DaffError {
786
+ readonly code: string;
787
+ constructor(message?: string);
788
+ }
789
+
790
+ /**
791
+ * An error thrown when an operation targeting a filter matching one type
792
+ * matches a filter of another type.
793
+ */
794
+ declare class DaffFilterRequestTypeMismatch extends DaffInheritableError implements DaffError {
795
+ readonly code: string;
796
+ constructor(message?: string);
797
+ }
798
+
799
+ /**
800
+ * An error thrown when an operation targeting a filter matching one name
801
+ * matches a filter of another name.
802
+ */
803
+ declare class DaffFilterRequestNameMismatch extends DaffInheritableError implements DaffError {
804
+ readonly code: string;
805
+ constructor(message?: string);
806
+ }
807
+
808
+ /**
809
+ * An error thrown when an operation targeting a filter matches a type unknown
810
+ * to Daffodil.
811
+ */
812
+ declare class DaffFilterUnknownType extends DaffInheritableError implements DaffError {
813
+ readonly code: string;
814
+ constructor(message?: string);
815
+ }
816
+
817
+ /**
818
+ * Converts a list of filters into a dictionary of filters keyed by filter name.
819
+ */
820
+ declare const daffFilterArrayToDict: <T extends DaffFilter = DaffFilter>(filters: Array<T>) => DaffFilters<T>;
821
+
822
+ /**
823
+ * Returns a {@link DaffFilters} and only their applied options.
824
+ * {@link DaffFilter} that have no applied options will be omitted.
825
+ */
826
+ declare const daffComputeAppliedFilters: (filters: DaffFilters) => DaffFilters;
827
+
828
+ /**
829
+ * A injection token to hold and provide a single value.
830
+ */
831
+ interface DaffSingleInjectionToken<T = unknown> {
832
+ /**
833
+ * The injection token.
834
+ */
835
+ token: InjectionToken<T>;
836
+ /**
837
+ * A helper function to provide a value to the token.
838
+ */
839
+ provider: <R extends T = T>(value: R) => ValueProvider;
840
+ }
841
+
842
+ type TokenDesc<T> = ConstructorParameters<typeof InjectionToken<T>>[0];
843
+ type TokenOptions<T> = ConstructorParameters<typeof InjectionToken<T>>[1];
844
+
845
+ /**
846
+ * Creates an injection token/provider pair for a single valued DI token.
847
+ *
848
+ * See {@link DaffSingleInjectionToken}.
849
+ */
850
+ declare const createSingleInjectionToken: <T = unknown>(desc: TokenDesc<T>, options?: TokenOptions<T>) => DaffSingleInjectionToken<T>;
851
+
852
+ /**
853
+ * A injection token to hold and provide multiple values.
854
+ */
855
+ interface DaffMultiInjectionToken<T = unknown> {
856
+ /**
857
+ * The injection token.
858
+ * Its default value is an empty array.
859
+ */
860
+ token: InjectionToken<Array<T>>;
861
+ /**
862
+ * A helper function to provide values to the token.
863
+ */
864
+ provider: <R extends T = T>(...values: Array<R>) => Array<ValueProvider>;
865
+ }
866
+
867
+ /**
868
+ * Creates an injection token/provider pair for a multi valued DI token.
869
+ *
870
+ * See {@link DaffMultiInjectionToken}.
871
+ */
872
+ declare const createMultiInjectionToken: <T = unknown>(desc: TokenDesc<Array<T>>, options?: Partial<TokenOptions<Array<T>>>) => DaffMultiInjectionToken<T>;
873
+
874
+ /**
875
+ * A injection token to hold and provide a config value.
876
+ */
877
+ interface DaffConfigInjectionToken<T = unknown> {
878
+ /**
879
+ * The injection token.
880
+ * Its default value is the default config passed during token creation.
881
+ */
882
+ token: InjectionToken<T>;
883
+ /**
884
+ * A helper function to provide a value to the token.
885
+ * It will shallow merge the passed config with the default config
886
+ * with the passed config keys taking precedence.
887
+ * An injection token containing a config may also be passed.
888
+ */
889
+ provider: <R extends T = T>(config: Partial<R> | InjectionToken<Partial<R>>) => FactoryProvider;
890
+ }
891
+
892
+ /**
893
+ * Creates an injection token/provider pair for a DI token that holds a configuration.
894
+ *
895
+ * See {@link DaffConfigInjectionToken}.
896
+ */
897
+ declare const createConfigInjectionToken: <T = unknown>(defaultConfig: T | InjectionToken<T>, desc: TokenDesc<T>, options?: Partial<TokenOptions<T>>) => DaffConfigInjectionToken<T>;
898
+
899
+ /**
900
+ * A injection token to hold and provide multiple services.
901
+ */
902
+ interface DaffServicesInjectionToken<T = unknown> {
903
+ /**
904
+ * The injection token.
905
+ * Its default value is an empty array.
906
+ */
907
+ token: InjectionToken<Array<T>>;
908
+ /**
909
+ * A helper function to provide service classes to the token.
910
+ */
911
+ provider: <R extends T = T>(...classes: Array<Type<R>>) => Array<ExistingProvider>;
912
+ }
913
+
914
+ /**
915
+ * Creates an injection token/provider pair for a DI token that holds services.
916
+ *
917
+ * See {@link DaffServicesInjectionToken}.
918
+ */
919
+ declare const createServicesInjectionToken: <T = unknown>(desc: TokenDesc<Array<T>>, options?: Partial<TokenOptions<Array<T>>>) => DaffServicesInjectionToken<T>;
920
+
921
+ /**
922
+ * A injection token to hold and provide a singleton service.
923
+ */
924
+ interface DaffSingletonInjectionToken<T = unknown> {
925
+ /**
926
+ * The injection token.
927
+ * Its default value is an empty array.
928
+ */
929
+ token: InjectionToken<T>;
930
+ /**
931
+ * A helper function to provide the service class to the token.
932
+ */
933
+ provider: <R extends T = T>(klass: Type<R>) => ExistingProvider;
934
+ }
935
+
936
+ /**
937
+ * Creates an injection token/provider pair for a DI token that holds a singleton service.
938
+ *
939
+ * See {@link DaffSingletonInjectionToken}.
940
+ */
941
+ declare const createSingletonInjectionToken: <T = unknown>(desc: TokenDesc<T>, options?: TokenOptions<T>) => DaffSingletonInjectionToken<T>;
942
+
943
+ /**
944
+ * An object with a discrete kind.
945
+ */
946
+ interface DaffKindable<T extends string = string> {
947
+ /**
948
+ * The entity kind.
949
+ */
950
+ kind: T;
951
+ }
952
+
953
+ declare function daffArrayConcatMerger<T extends Array<unknown> = Array<unknown>>(a: T, b: T): T;
954
+
955
+ declare function daffDictAssignMerger<T extends Record<string, unknown> = Record<string, unknown>>(a: T, b: T): T;
956
+
957
+ /**
958
+ * A way to merge two fields into one.
959
+ */
960
+ type DaffMerger<T> = (a: T, b: T) => T;
961
+
962
+ /**
963
+ * A strategy for merging objects of the same structure.
964
+ * Each key can contain a merger function for handling collisions.
965
+ */
966
+ type DaffMergeStrategy<T extends Record<string, unknown> = Record<string, unknown>> = {
967
+ [k in keyof T]?: DaffMerger<T[k]>;
968
+ };
969
+
970
+ /**
971
+ * Merges dictionaries with a specific strategy for handling collisions.
972
+ * @see {@link DaffMergeStrategy}.
973
+ *
974
+ * @example Merging two dictionaries with predefined mergers
975
+ *
976
+ * ```ts
977
+ * const a = {
978
+ * ary: [1, 2],
979
+ * obj: {foo: 5, bar: 10}
980
+ * }
981
+ * const a = {
982
+ * ary: [3, 4],
983
+ * obj: {foo: 6},
984
+ * fish: 'tacos'
985
+ * }
986
+ * const result = daffMerge(
987
+ * [a, b],
988
+ * {
989
+ * ary: daffArrayConcatMerger,
990
+ * obj: daffDictAssignMerger
991
+ * }
992
+ * )
993
+ * ```
994
+ * the value of result would be:
995
+ * ```ts
996
+ * {
997
+ * ary: [1, 2, 3, 4],
998
+ * obj: {foo: 6, bar: 10},
999
+ * fish: 'tacos'
1000
+ * }
1001
+ * ```
1002
+ *
1003
+ * @example Merging two dictionaries with predefined mergers
1004
+ *
1005
+ * ```ts
1006
+ * const a = {
1007
+ * ary: [1, 2],
1008
+ * obj: {foo: 5, bar: 10}
1009
+ * }
1010
+ * const a = {
1011
+ * ary: [3, 4],
1012
+ * obj: {foo: 6},
1013
+ * fish: 'tacos'
1014
+ * }
1015
+ * const result = daffMerge(
1016
+ * [a, b],
1017
+ * {
1018
+ * ary: daffArrayConcatMerger,
1019
+ * obj: daffDictAssignMerger
1020
+ * }
1021
+ * )
1022
+ * ```
1023
+ * the value of result would be:
1024
+ * ```ts
1025
+ * {
1026
+ * ary: [1, 2, 3, 4],
1027
+ * obj: {foo: 6, bar: 10},
1028
+ * fish: 'tacos'
1029
+ * }
1030
+ * ```
1031
+ */
1032
+ declare const daffMerge: <T extends Record<string, unknown> = Record<string, unknown>>(dicts: Array<T>, strategy?: DaffMergeStrategy<T>) => T;
1033
+
1034
+ /**
1035
+ * Retries failed Observables
1036
+ *
1037
+ * @param maxTries The maximum number of tries the observable will be tried
1038
+ * @param ms The initial amount of time
1039
+ */
1040
+ declare function backoff(maxTries: number, ms: number): rxjs.UnaryFunction<rxjs.Observable<unknown>, rxjs.Observable<unknown>>;
1041
+
1042
+ /**
1043
+ * Accepts a list of input observables and emits true when any of the inputs emit a truthy value.
1044
+ * Does not emit until all of the input streams have emitted at least once.
1045
+ */
1046
+ declare const anyOf: (items: Observable<boolean>[]) => Observable<boolean>;
1047
+
1048
+ /**
1049
+ * Accepts a list of input observables and emits true when all of the inputs emit a truthy value.
1050
+ * Does not emit until all of the input streams have emitted at least once.
1051
+ */
1052
+ declare const allOf: (items: Observable<boolean>[]) => Observable<boolean>;
1053
+
1054
+ /**
1055
+ * Catches errors and invokes the callback with an array of errors.
1056
+ */
1057
+ declare const catchAndArrayifyErrors: <TReturn, TError extends DaffError = DaffError>(transformError: (errors: TError[]) => Observable<TReturn>) => rxjs.UnaryFunction<Observable<unknown>, Observable<TReturn>>;
1058
+
1059
+ declare const DAFF_STORAGE_SERVICE_ERROR_CODE = "DAFF_STORAGE_FAILURE";
1060
+ declare class DaffStorageServiceError extends DaffInheritableError implements DaffError {
1061
+ message: string;
1062
+ readonly code: string;
1063
+ constructor(message: string);
1064
+ }
1065
+
1066
+ interface DaffPersistenceService {
1067
+ setItem(key: string, value: any): void;
1068
+ getItem(key: string): any;
1069
+ clear(): void;
1070
+ removeItem(key: string): void;
1071
+ }
1072
+ declare const DaffPersistenceServiceToken: i0.InjectionToken<DaffPersistenceService>;
1073
+
1074
+ /**
1075
+ * @inheritdoc
1076
+ */
1077
+ declare class DaffErrorStorageService implements DaffPersistenceService {
1078
+ static readonly ERROR_MESSAGE = "The DaffErrorStorageService always throws an error.";
1079
+ setItem(key: string, value: any): void;
1080
+ getItem(key: string): any;
1081
+ removeItem(key: string): any;
1082
+ clear(): void;
1083
+ private throwError;
1084
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffErrorStorageService, never>;
1085
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffErrorStorageService>;
1086
+ }
1087
+
1088
+ declare const DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE = "DAFF_SERVER_STORAGE_FAILURE";
1089
+ /**
1090
+ * An error thrown when there is an attempt to access storage on the server and none is available.
1091
+ */
1092
+ declare class DaffServerSideStorageError extends DaffStorageServiceError implements DaffError {
1093
+ message: string;
1094
+ readonly code: string;
1095
+ constructor(message: string);
1096
+ }
1097
+
1098
+ /**
1099
+ * A storage service meant to be loaded into SSR contexts.
1100
+ * It will always throw the {@link DaffServerSideStorageError}.
1101
+ *
1102
+ * @inheritdoc
1103
+ */
1104
+ declare class DaffServerErrorStorageService implements DaffPersistenceService {
1105
+ static readonly ERROR_MESSAGE = "The DaffServerErrorStorageService always throws an error.";
1106
+ setItem(key: string, value: any): void;
1107
+ getItem(key: string): any;
1108
+ removeItem(key: string): any;
1109
+ clear(): void;
1110
+ private throwError;
1111
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffServerErrorStorageService, never>;
1112
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffServerErrorStorageService>;
1113
+ }
1114
+
1115
+ /**
1116
+ * @inheritdoc
1117
+ */
1118
+ declare class DaffLocalStorageService implements DaffPersistenceService {
1119
+ constructor(platformId: string);
1120
+ /**
1121
+ * Persist the given item into local storage.
1122
+ */
1123
+ setItem(key: string, value: any): void;
1124
+ /**
1125
+ * Retrieve the given item from localstorage.
1126
+ */
1127
+ getItem(key: string): any;
1128
+ /**
1129
+ * Remove a given item from localstorage
1130
+ */
1131
+ removeItem(key: string): any;
1132
+ clear(): void;
1133
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffLocalStorageService, never>;
1134
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffLocalStorageService>;
1135
+ }
1136
+
1137
+ /**
1138
+ * @inheritdoc
1139
+ */
1140
+ declare class DaffNoopStorageService implements DaffPersistenceService {
1141
+ setItem(key: string, value: any): void;
1142
+ getItem(key: string): any;
1143
+ clear(): void;
1144
+ removeItem(key: string): void;
1145
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffNoopStorageService, never>;
1146
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffNoopStorageService>;
1147
+ }
1148
+
1149
+ /**
1150
+ * @inheritdoc
1151
+ */
1152
+ declare class DaffMemoryStorageService implements DaffPersistenceService {
1153
+ memory: {
1154
+ [x: string]: any;
1155
+ };
1156
+ setItem(key: string, value: any): void;
1157
+ getItem(key: string): any;
1158
+ clear(): void;
1159
+ /**
1160
+ * We abuse destructuring to remove the key
1161
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
1162
+ */
1163
+ removeItem(key: string): void;
1164
+ }
1165
+
1166
+ declare const DaffServerSafePersistenceServiceToken: i0.InjectionToken<DaffPersistenceService>;
1167
+
1168
+ /**
1169
+ * A token type for HTML.
1170
+ * A string that holds renderable content that is suitable for rendering with `[innerHTML]`.
1171
+ */
1172
+ type HTML = string;
1173
+
1174
+ /**
1175
+ * Recurses through a tree, collecting each element in that tree and returning it in an array.
1176
+ * The value of getKey should be a field that contains a list of the same type of object.
1177
+ * Accepts an optional depth argument which will limit the traversal. This should be used for trees with circular references.
1178
+ */
1179
+ declare const collect: <T>(obj: T, getChildren: (val: T) => T[], depth?: number) => T[];
1180
+
1181
+ /**
1182
+ * A helper function to compute a power of 10 required to convert a decimal number to an integer
1183
+ * This function will fail if the given number has more than 16 significant figures or
1184
+ * the value of the number is greater than 10^11
1185
+ *
1186
+ * @param value
1187
+ */
1188
+ declare function daffPrecision(value: number): number;
1189
+ /**
1190
+ * A function to add long numbers accurately with conversions and integer math.
1191
+ * This function only guarantees correct answers when the numbers given and the result are less than
1192
+ * 16 significant figures and less than 10^11
1193
+ *
1194
+ * @param numbers
1195
+ */
1196
+ declare function daffAdd(...numbers: number[]): number;
1197
+ /**
1198
+ * A function to subtract long numbers accurately with conversions and integer math.
1199
+ * This function only guarantees correct answers when the numbers given and the result are each less than
1200
+ * 16 significant figures and less than 10^11
1201
+ *
1202
+ * @param numbers
1203
+ */
1204
+ declare function daffSubtract(...numbers: number[]): number;
1205
+ /**
1206
+ * A function to multiply long numbers accurately with conversions and integer math.
1207
+ * This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures
1208
+ * and less than 10^11
1209
+ *
1210
+ * @param numbers
1211
+ */
1212
+ declare function daffMultiply(...numbers: number[]): number;
1213
+ /**
1214
+ * A function to divide long numbers accurately with conversions and integer math.
1215
+ * This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures
1216
+ * and less than 10^11
1217
+ *
1218
+ * Returns NaN when attempting to use NaN as an input.
1219
+ * Returns NaN when attempting to divide by 0 or null.
1220
+ *
1221
+ * @param numbers
1222
+ */
1223
+ declare function daffDivide(...numbers: number[]): number;
1224
+
1225
+ type Dictionary = Record<string | number | symbol, any>;
1226
+ /**
1227
+ * Converts an array into a dictionary.
1228
+ * Dictionary values are keyed by the return of the specified `getKey`.
1229
+ */
1230
+ declare const daffArrayToDict: <T, R extends keyof Dictionary = keyof Dictionary>(array: Array<T>, getKey: (val: T) => R) => Record<R, T>;
1231
+
1232
+ /**
1233
+ * Returns a random slice of an array.
1234
+ * An optional length may be specified.
1235
+ *
1236
+ * @param array
1237
+ */
1238
+ declare const randomSlice: <T>(array: T[], length?: number) => T[];
1239
+
1240
+ /**
1241
+ * Returns a random subset of an array in a random order.
1242
+ *
1243
+ * @param array
1244
+ * @param length
1245
+ */
1246
+ declare const randomSubset: <T>(array: T[], length?: number) => T[];
1247
+
1248
+ /**
1249
+ * Range
1250
+ *
1251
+ * Range accepts two inputs, a `start` and an `end`
1252
+ * and returns an array filled with numbers from
1253
+ * `start` to `end`.
1254
+ *
1255
+ * @param start
1256
+ * @param end
1257
+ * @returns number
1258
+ */
1259
+ declare const range: (start: number, end: number) => Array<number>;
1260
+
1261
+ /**
1262
+ * Returns a random element of an array.
1263
+ */
1264
+ declare const sample: <T>(array: T[]) => T;
1265
+
1266
+ /**
1267
+ * Shallow compares two objects using a list of provided property keys to enumerate the values.
1268
+ * `null` and `undefined` are considered equal for the purposes of the comparison.
1269
+ * A strict equality comparison is used for truthy property values.
1270
+ */
1271
+ declare function shallowCompare<T>(obj1: T, obj2: T, props: (T extends T ? keyof T : never)[]): boolean;
1272
+
1273
+ /**
1274
+ * Immutable Fisher-Yates Shuffle
1275
+ * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
1276
+ */
1277
+ declare const shuffle: <T>(array: T[]) => T[];
1278
+
1279
+ /**
1280
+ * Filters an array of elements, removing duplicates.
1281
+ * Does not guarantee order of filtered elements.
1282
+ *
1283
+ * An optional comparator function may be passed for arbitrary comparison behavior.
1284
+ * The default is a strict equality comparison: `a === b`.
1285
+ */
1286
+ declare const unique: <T>(array: T[], comparator?: (a: T, b: T) => boolean) => T[];
1287
+
1288
+ /**
1289
+ * The unary identity function.
1290
+ * Returns whatever is passed to it.
1291
+ */
1292
+ declare function identity<T>(v: T): T;
1293
+
1294
+ type MaybeAsync<T> = Promise<T> | Observable<T> | T;
1295
+
1296
+ /**
1297
+ * Converts a value to an observable.
1298
+ * If the value is an observable, just returns that observable.
1299
+ * If the value is a promise, converts it to an observable (see rxjs `from`).
1300
+ * If the value is neither, just returns an observable that immediately emits the value.
1301
+ */
1302
+ declare function observe<T>(val: MaybeAsync<T>): Observable<T>;
1303
+
1304
+ /**
1305
+ * Validates whether all the specified fields are defined in the passed object.
1306
+ * Uses `Object.hasOwn` to do the check, so even if a field has been set to `null`
1307
+ * or `undefined`, they will be treated as present.
1308
+ */
1309
+ declare const validateFieldPresence: <T extends Record<string, unknown>>(model: T, ...fields: Array<keyof T>) => boolean;
1310
+
1311
+ /**
1312
+ * An interface for models where the order of elements is important
1313
+ * and definable.
1314
+ *
1315
+ * Disambiguation: This is does not relate to ecommerce "Orders", e.g. a purchase.
1316
+ */
1317
+ interface DaffOrderable {
1318
+ order: number;
1319
+ }
1320
+
1321
+ export { DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE, DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE, DAFF_STORAGE_SERVICE_ERROR_CODE, DaffBase64ServiceToken, DaffBrowserBase64Service, DaffCollectionPageOutOfBoundsError, DaffErrorStorageService, DaffFilterFromToFilterSeparator, DaffFilterNotFound, DaffFilterRequestNameMismatch, DaffFilterRequestTypeMismatch, DaffFilterType, DaffFilterUnknownType, DaffInheritableError, DaffLocalStorageService, DaffMemoryStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerBase64Service, DaffServerErrorStorageService, DaffServerSafePersistenceServiceToken, DaffServerSideStorageError, DaffSortDirectionEnum, DaffStorageServiceError, allOf, anyOf, backoff, catchAndArrayifyErrors, collect, createConfigInjectionToken, createMultiInjectionToken, createServicesInjectionToken, createSingleInjectionToken, createSingletonInjectionToken, daffAdd, daffApplyFilter, daffApplyRequestToFilters, daffApplyRequestsToFilters, daffArrayConcatMerger, daffArrayToDict, daffClearFilter, daffClearFilters, daffCollectionBuildMetadataFromRequest, daffCollectionBuildRequestFromMetadata, daffCollectionErrorMap, daffComputeAppliedFilters, daffDictAssignMerger, daffDivide, daffFilterArrayToDict, daffFilterComputeRangePairLabel, daffFilterEqualOptionArrayToDict, daffFilterFindAppliedOptions, daffFilterRangePairArrayToDict, daffFilterToRequest, daffFilterValidateRequestNameMatch, daffFilterValidateRequestTypeMatch, daffFiltersToRequests, daffIdentifiableArrayToDict, daffIsError, daffIsFilterApplied, daffIsToggleRequestAppliedToFilter, daffMerge, daffMultiply, daffPrecision, daffRemoveFilter, daffRemoveRequestFromFilters, daffRemoveRequestsFromFilters, daffSubtract, daffToggleFilter, daffToggleRequestOnFilters, debounce, identity, observe, provideVercelImageLoader, randomSlice, randomSubset, range, sample, shallowCompare, shuffle, unique, validateFieldPresence };
1322
+ export type { Constructable, DaffBase64Service, DaffCanonicallyLocatable, DaffCollection, DaffCollectionMetadata, DaffCollectionRequest, DaffConfigInjectionToken, DaffCountable, DaffError, DaffErrorCodeMap, DaffFilter, DaffFilterBase, DaffFilterEqual, DaffFilterEqualOption, DaffFilterEqualRequest, DaffFilterEqualToggleRequest, DaffFilterOption, DaffFilterOptionBase, DaffFilterRangeBase, DaffFilterRangeNumeric, DaffFilterRangeNumericRequest, DaffFilterRangeNumericToggleRequest, DaffFilterRangeOption, DaffFilterRangePair, DaffFilterRangeRequestBase, DaffFilterRangeRequestOption, DaffFilterRequest, DaffFilterToggleRequest, DaffFilterable, DaffFilters, DaffIdentifiable, DaffKindable, DaffLocatable, DaffMergeStrategy, DaffMerger, DaffMultiInjectionToken, DaffNumericallyPaginable, DaffOrderable, DaffPersistenceService, DaffServicesInjectionToken, DaffSingleInjectionToken, DaffSingletonInjectionToken, DaffSortOption, DaffSortOptions, DaffSortable, HTML, ID, MaybeAsync };