@ecodev/natural 63.9.1 → 64.0.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 (160) hide show
  1. package/fesm2022/ecodev-natural-vanilla.mjs +3 -3
  2. package/fesm2022/ecodev-natural-vanilla.mjs.map +1 -1
  3. package/fesm2022/ecodev-natural.mjs +520 -650
  4. package/fesm2022/ecodev-natural.mjs.map +1 -1
  5. package/index.d.ts +4264 -3
  6. package/package.json +9 -9
  7. package/src/lib/modules/sidenav/_sidenav.theme.scss +1 -1
  8. package/vanilla/index.d.ts +418 -3
  9. package/lib/classes/abstract-detail.d.ts +0 -108
  10. package/lib/classes/abstract-editable-list.d.ts +0 -70
  11. package/lib/classes/abstract-list.d.ts +0 -191
  12. package/lib/classes/abstract-navigable-list.d.ts +0 -54
  13. package/lib/classes/apollo-utils.d.ts +0 -18
  14. package/lib/classes/crypto.d.ts +0 -8
  15. package/lib/classes/cumulative-changes.d.ts +0 -27
  16. package/lib/classes/data-source.d.ts +0 -32
  17. package/lib/classes/network-activity.service.d.ts +0 -54
  18. package/lib/classes/providers.d.ts +0 -5
  19. package/lib/classes/query-variable-manager-utils.d.ts +0 -2
  20. package/lib/classes/query-variable-manager.d.ts +0 -91
  21. package/lib/classes/rxjs.d.ts +0 -42
  22. package/lib/classes/signing.d.ts +0 -7
  23. package/lib/classes/tld.d.ts +0 -10
  24. package/lib/classes/utility.d.ts +0 -85
  25. package/lib/classes/validators.d.ts +0 -72
  26. package/lib/directives/http-prefix.directive.d.ts +0 -15
  27. package/lib/modules/alert/alert.service.d.ts +0 -21
  28. package/lib/modules/alert/confirm.component.d.ts +0 -12
  29. package/lib/modules/alert/public-api.d.ts +0 -2
  30. package/lib/modules/avatar/component/avatar.component.d.ts +0 -37
  31. package/lib/modules/avatar/public-api.d.ts +0 -2
  32. package/lib/modules/avatar/service/avatar.service.d.ts +0 -24
  33. package/lib/modules/avatar/sources/gravatar.d.ts +0 -8
  34. package/lib/modules/avatar/sources/image.d.ts +0 -8
  35. package/lib/modules/avatar/sources/initials.d.ts +0 -8
  36. package/lib/modules/avatar/sources/source.d.ts +0 -23
  37. package/lib/modules/columns-picker/columns-picker.component.d.ts +0 -45
  38. package/lib/modules/columns-picker/public-api.d.ts +0 -2
  39. package/lib/modules/columns-picker/types.d.ts +0 -84
  40. package/lib/modules/common/directives/background-density.directive.d.ts +0 -37
  41. package/lib/modules/common/directives/linkable-tab.directive.d.ts +0 -29
  42. package/lib/modules/common/directives/src-density.directive.d.ts +0 -33
  43. package/lib/modules/common/pipes/capitalize.pipe.d.ts +0 -10
  44. package/lib/modules/common/pipes/ellipsis.pipe.d.ts +0 -7
  45. package/lib/modules/common/pipes/enum.pipe.d.ts +0 -14
  46. package/lib/modules/common/pipes/time-ago.pipe.d.ts +0 -18
  47. package/lib/modules/common/public-api.d.ts +0 -11
  48. package/lib/modules/common/services/memory-storage.d.ts +0 -46
  49. package/lib/modules/common/services/seo.provider.d.ts +0 -6
  50. package/lib/modules/common/services/seo.service.d.ts +0 -148
  51. package/lib/modules/detail-header/detail-header.component.d.ts +0 -43
  52. package/lib/modules/detail-header/public-api.d.ts +0 -1
  53. package/lib/modules/dialog-trigger/dialog-trigger.component.d.ts +0 -37
  54. package/lib/modules/dialog-trigger/public-api.d.ts +0 -1
  55. package/lib/modules/dropdown-components/abstract-association-select-component.directive.d.ts +0 -34
  56. package/lib/modules/dropdown-components/public-api.d.ts +0 -10
  57. package/lib/modules/dropdown-components/type-boolean/type-boolean.component.d.ts +0 -12
  58. package/lib/modules/dropdown-components/type-date/type-date.component.d.ts +0 -36
  59. package/lib/modules/dropdown-components/type-date-range/type-date-range.component.d.ts +0 -43
  60. package/lib/modules/dropdown-components/type-hierarchic-selector/type-hierarchic-selector.component.d.ts +0 -31
  61. package/lib/modules/dropdown-components/type-natural-select/type-natural-select.component.d.ts +0 -18
  62. package/lib/modules/dropdown-components/type-number/type-number.component.d.ts +0 -36
  63. package/lib/modules/dropdown-components/type-options/type-options.component.d.ts +0 -29
  64. package/lib/modules/dropdown-components/type-select/type-select.component.d.ts +0 -59
  65. package/lib/modules/dropdown-components/type-text/type-text.component.d.ts +0 -26
  66. package/lib/modules/dropdown-components/types.d.ts +0 -13
  67. package/lib/modules/dropdown-components/utils.d.ts +0 -14
  68. package/lib/modules/file/abstract-file.d.ts +0 -95
  69. package/lib/modules/file/component/file.component.d.ts +0 -58
  70. package/lib/modules/file/file-drop.directive.d.ts +0 -32
  71. package/lib/modules/file/file-select.directive.d.ts +0 -15
  72. package/lib/modules/file/file.service.d.ts +0 -19
  73. package/lib/modules/file/public-api.d.ts +0 -6
  74. package/lib/modules/file/types.d.ts +0 -7
  75. package/lib/modules/file/utils.d.ts +0 -8
  76. package/lib/modules/fixed-button/fixed-button.component.d.ts +0 -11
  77. package/lib/modules/fixed-button/public-api.d.ts +0 -1
  78. package/lib/modules/fixed-button-detail/fixed-button-detail.component.d.ts +0 -24
  79. package/lib/modules/fixed-button-detail/public-api.d.ts +0 -1
  80. package/lib/modules/hierarchic-selector/classes/flat-node.d.ts +0 -11
  81. package/lib/modules/hierarchic-selector/classes/hierarchic-configuration.d.ts +0 -56
  82. package/lib/modules/hierarchic-selector/classes/hierarchic-filters-configuration.d.ts +0 -7
  83. package/lib/modules/hierarchic-selector/classes/model-node.d.ts +0 -13
  84. package/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.component.d.ts +0 -161
  85. package/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.service.d.ts +0 -76
  86. package/lib/modules/hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.component.d.ts +0 -59
  87. package/lib/modules/hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.service.d.ts +0 -9
  88. package/lib/modules/hierarchic-selector/public-api.d.ts +0 -6
  89. package/lib/modules/icon/icon.directive.d.ts +0 -39
  90. package/lib/modules/icon/icon.module.d.ts +0 -9
  91. package/lib/modules/icon/public-api.d.ts +0 -2
  92. package/lib/modules/logger/error-handler.d.ts +0 -52
  93. package/lib/modules/logger/error.module.d.ts +0 -3
  94. package/lib/modules/logger/public-api.d.ts +0 -3
  95. package/lib/modules/matomo/matomo.service.d.ts +0 -42
  96. package/lib/modules/matomo/public-api.d.ts +0 -1
  97. package/lib/modules/panels/abstract-panel.d.ts +0 -37
  98. package/lib/modules/panels/fallback-if-no-opened-panels.urlmatcher.d.ts +0 -6
  99. package/lib/modules/panels/panels.component.d.ts +0 -9
  100. package/lib/modules/panels/panels.module.d.ts +0 -3
  101. package/lib/modules/panels/panels.service.d.ts +0 -121
  102. package/lib/modules/panels/panels.urlmatcher.d.ts +0 -8
  103. package/lib/modules/panels/public-api.d.ts +0 -7
  104. package/lib/modules/panels/types.d.ts +0 -61
  105. package/lib/modules/relations/public-api.d.ts +0 -1
  106. package/lib/modules/relations/relations.component.d.ts +0 -123
  107. package/lib/modules/search/classes/graphql-doctrine.d.ts +0 -4
  108. package/lib/modules/search/classes/graphql-doctrine.types.d.ts +0 -83
  109. package/lib/modules/search/classes/transformers.d.ts +0 -78
  110. package/lib/modules/search/classes/url.d.ts +0 -18
  111. package/lib/modules/search/classes/utils.d.ts +0 -17
  112. package/lib/modules/search/dropdown-container/dropdown-container.component.d.ts +0 -31
  113. package/lib/modules/search/dropdown-container/dropdown-ref.d.ts +0 -13
  114. package/lib/modules/search/dropdown-container/dropdown.service.d.ts +0 -24
  115. package/lib/modules/search/facet-selector/facet-selector.component.d.ts +0 -32
  116. package/lib/modules/search/group/group.component.d.ts +0 -21
  117. package/lib/modules/search/input/input.component.d.ts +0 -110
  118. package/lib/modules/search/public-api.d.ts +0 -11
  119. package/lib/modules/search/search/search.component.d.ts +0 -44
  120. package/lib/modules/search/types/dropdown-component.d.ts +0 -20
  121. package/lib/modules/search/types/facet.d.ts +0 -75
  122. package/lib/modules/search/types/values.d.ts +0 -32
  123. package/lib/modules/select/abstract-select.component.d.ts +0 -127
  124. package/lib/modules/select/public-api.d.ts +0 -3
  125. package/lib/modules/select/select/select.component.d.ts +0 -135
  126. package/lib/modules/select/select-enum/select-enum.component.d.ts +0 -32
  127. package/lib/modules/select/select-hierarchic/select-hierarchic.component.d.ts +0 -65
  128. package/lib/modules/sidenav/public-api.d.ts +0 -5
  129. package/lib/modules/sidenav/sidenav/sidenav.component.d.ts +0 -5
  130. package/lib/modules/sidenav/sidenav-container/sidenav-container.component.d.ts +0 -45
  131. package/lib/modules/sidenav/sidenav-content/sidenav-content.component.d.ts +0 -5
  132. package/lib/modules/sidenav/sidenav-stack.service.d.ts +0 -28
  133. package/lib/modules/sidenav/sidenav.service.d.ts +0 -86
  134. package/lib/modules/stamp/public-api.d.ts +0 -1
  135. package/lib/modules/stamp/stamp.component.d.ts +0 -15
  136. package/lib/modules/table-button/public-api.d.ts +0 -1
  137. package/lib/modules/table-button/table-button.component.d.ts +0 -32
  138. package/lib/services/abstract-model.service.d.ts +0 -244
  139. package/lib/services/debounce.service.d.ts +0 -52
  140. package/lib/services/enum.service.d.ts +0 -19
  141. package/lib/services/link-mutation.service.d.ts +0 -51
  142. package/lib/services/persistence.service.d.ts +0 -50
  143. package/lib/services/swiss-parsing-date-adapter.service.d.ts +0 -16
  144. package/lib/types/types.d.ts +0 -100
  145. package/public-api.d.ts +0 -44
  146. package/vanilla/public-api.d.ts +0 -11
  147. package/vanilla/src/lib/classes/crypto.d.ts +0 -8
  148. package/vanilla/src/lib/classes/data-source.d.ts +0 -32
  149. package/vanilla/src/lib/classes/query-variable-manager-utils.d.ts +0 -2
  150. package/vanilla/src/lib/classes/query-variable-manager.d.ts +0 -91
  151. package/vanilla/src/lib/classes/signing.d.ts +0 -7
  152. package/vanilla/src/lib/classes/utility.d.ts +0 -85
  153. package/vanilla/src/lib/modules/search/classes/graphql-doctrine.types.d.ts +0 -83
  154. package/vanilla/src/lib/modules/search/classes/utils.d.ts +0 -17
  155. package/vanilla/src/lib/modules/search/types/dropdown-component.d.ts +0 -20
  156. package/vanilla/src/lib/modules/search/types/facet.d.ts +0 -75
  157. package/vanilla/src/lib/modules/search/types/values.d.ts +0 -32
  158. package/vanilla/src/lib/services/abstract-model.service.d.ts +0 -244
  159. package/vanilla/src/lib/services/debounce.service.d.ts +0 -52
  160. package/vanilla/src/lib/types/types.d.ts +0 -100
@@ -1,244 +0,0 @@
1
- import { Apollo, MutationResult } from 'apollo-angular';
2
- import { FetchResult, WatchQueryFetchPolicy } from '@apollo/client/core';
3
- import { AbstractControl, AsyncValidatorFn, UntypedFormGroup, ValidatorFn } from '@angular/forms';
4
- import { DocumentNode } from 'graphql';
5
- import { Observable, OperatorFunction } from 'rxjs';
6
- import { NaturalQueryVariablesManager, QueryVariables } from '../classes/query-variable-manager';
7
- import { Literal } from '../types/types';
8
- import { PaginatedData } from '../classes/data-source';
9
- import { NaturalDebounceService } from './debounce.service';
10
- export type FormValidators = Record<string, ValidatorFn[]>;
11
- export type FormAsyncValidators = Record<string, AsyncValidatorFn[]>;
12
- export type VariablesWithInput = {
13
- input: Literal;
14
- };
15
- export type FormControls = Record<string, AbstractControl>;
16
- export type WithId<T> = {
17
- id: string;
18
- } & T;
19
- export declare abstract class NaturalAbstractModelService<Tone, Vone extends {
20
- id: string;
21
- }, Tall extends PaginatedData<Literal>, Vall extends QueryVariables, Tcreate, Vcreate extends VariablesWithInput, Tupdate, Vupdate extends {
22
- id: string;
23
- input: Literal;
24
- }, Tdelete, Vdelete extends {
25
- ids: string[];
26
- }> {
27
- protected readonly name: string;
28
- protected readonly oneQuery: DocumentNode | null;
29
- protected readonly allQuery: DocumentNode | null;
30
- protected readonly createMutation: DocumentNode | null;
31
- protected readonly updateMutation: DocumentNode | null;
32
- protected readonly deleteMutation: DocumentNode | null;
33
- private readonly createName;
34
- private readonly updateName;
35
- private readonly deleteName;
36
- /**
37
- * Store the creation mutations that are pending
38
- */
39
- private readonly creatingCache;
40
- protected readonly apollo: Apollo;
41
- protected readonly naturalDebounceService: NaturalDebounceService;
42
- private readonly plural;
43
- /**
44
- *
45
- * @param name service and single object query name (eg. userForFront or user).
46
- * @param oneQuery GraphQL query to fetch a single object from ID (eg. userForCrudQuery).
47
- * @param allQuery GraphQL query to fetch a filtered list of objects (eg. usersForCrudQuery).
48
- * @param createMutation GraphQL mutation to create an object.
49
- * @param updateMutation GraphQL mutation to update an object.
50
- * @param deleteMutation GraphQL mutation to delete a list of objects.
51
- * @param plural list query name (eg. usersForFront or users).
52
- * @param createName create object mutation name (eg. createUser).
53
- * @param updateName update object mutation name (eg. updateUser).
54
- * @param deleteName delete object mutation name (eg. deleteUsers).
55
- */
56
- constructor(name: string, oneQuery: DocumentNode | null, allQuery: DocumentNode | null, createMutation: DocumentNode | null, updateMutation: DocumentNode | null, deleteMutation: DocumentNode | null, plural?: string | null, createName?: string | null, updateName?: string | null, deleteName?: string | null);
57
- /**
58
- * List of individual fields validators
59
- */
60
- getFormValidators(model?: Literal): FormValidators;
61
- /**
62
- * List of individual async fields validators
63
- */
64
- getFormAsyncValidators(model?: Literal): FormAsyncValidators;
65
- /**
66
- * List of grouped fields validators (like password + confirm password)
67
- */
68
- getFormGroupValidators(model?: Literal): ValidatorFn[];
69
- /**
70
- * List of async group fields validators (like unique constraint on multiple columns)
71
- */
72
- getFormGroupAsyncValidators(model?: Literal): AsyncValidatorFn[];
73
- getFormConfig(model: Literal): FormControls;
74
- /**
75
- * Create the final FormGroup for the object, including all validators
76
- *
77
- * This method should **not** be overridden, but instead `getFormConfig`,
78
- * `getFormGroupValidators`, `getFormGroupAsyncValidators` might be.
79
- */
80
- getFormGroup(model: Literal): UntypedFormGroup;
81
- /**
82
- * Get a single object
83
- *
84
- * If available it will emit object from cache immediately, then it
85
- * will **always** fetch from network and then the observable will be completed.
86
- *
87
- * You must subscribe to start getting results (and fetch from network).
88
- */
89
- getOne(id: string): Observable<Tone>;
90
- /**
91
- * Watch a single object
92
- *
93
- * If available it will emit object from cache immediately, then it
94
- * will **always** fetch from network, and then keep watching the cache forever.
95
- *
96
- * You must subscribe to start getting results (and fetch from network).
97
- *
98
- * You **MUST** unsubscribe.
99
- */
100
- watchOne(id: string, fetchPolicy?: WatchQueryFetchPolicy): Observable<Tone>;
101
- private prepareOneQuery;
102
- /**
103
- * Get a collection of objects
104
- *
105
- * It will **always** fetch from network and then the observable will be completed.
106
- * No cache is ever used, so it's slow but correct.
107
- */
108
- getAll(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<Tall>;
109
- /**
110
- * Get a collection of objects
111
- *
112
- * Every time the observable variables change, and they are not undefined,
113
- * it will return result from cache, then it will **always** fetch from network,
114
- * and then keep watching the cache forever.
115
- *
116
- * You must subscribe to start getting results (and fetch from network).
117
- *
118
- * You **MUST** unsubscribe.
119
- */
120
- watchAll(queryVariablesManager: NaturalQueryVariablesManager<Vall>, fetchPolicy?: WatchQueryFetchPolicy): Observable<Tall>;
121
- /**
122
- * This functions allow to quickly create or update objects.
123
- *
124
- * Manages a "creation is pending" status, and update when creation is ready.
125
- * Uses regular update/updateNow and create methods.
126
- * Used mainly when editing multiple objects in same controller (like in editable arrays)
127
- */
128
- createOrUpdate(object: Vcreate['input'] | WithId<Vupdate['input']>, now?: boolean): Observable<Tcreate | Tupdate>;
129
- /**
130
- * Create an object in DB and then refetch the list of objects
131
- */
132
- create(object: Vcreate['input']): Observable<Tcreate>;
133
- /**
134
- * Update an object, after a short debounce
135
- */
136
- update(object: WithId<Vupdate['input']>): Observable<Tupdate>;
137
- /**
138
- * Update an object immediately when subscribing
139
- */
140
- updateNow(object: WithId<Vupdate['input']>): Observable<Tupdate>;
141
- /**
142
- * Delete objects and then refetch the list of objects
143
- */
144
- delete(objects: {
145
- id: string;
146
- }[]): Observable<Tdelete>;
147
- /**
148
- * If the id is provided, resolves an observable model. The observable model will only be emitted after we are sure
149
- * that Apollo cache is fresh and warm. Then the component can subscribe to the observable model to get the model
150
- * immediately from Apollo cache and any subsequents future mutations that may happen to Apollo cache.
151
- *
152
- * Without id, returns default values, in order to show a creation form.
153
- */
154
- resolve(id: string | undefined): Observable<Observable<Tone | Vcreate['input']>>;
155
- /**
156
- * Return an object that match the GraphQL input type.
157
- * It creates an object with manually filled data and add uncompleted data (like required attributes that can be empty strings)
158
- */
159
- getInput(object: Literal, forCreation: boolean): Vcreate['input'] | Vupdate['input'];
160
- /**
161
- * Return the number of objects matching the query. It may never complete.
162
- *
163
- * This is used for the unique validator
164
- */
165
- count(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<number>;
166
- /**
167
- * Return empty object with some default values from server perspective
168
- *
169
- * This is typically useful when showing a form for creation
170
- */
171
- getDefaultForServer(): Vcreate['input'];
172
- /**
173
- * You probably **should not** use this.
174
- *
175
- * If you are trying to *call* this method, instead you probably want to call `getDefaultForServer()` to get default
176
- * values for a model, or `getFormConfig()` to get a configured form that includes extra form fields.
177
- *
178
- * If you are trying to *override* this method, instead you probably want to override `getDefaultForServer()`.
179
- *
180
- * The only and **very rare** reason to override this method is if the client needs extra form fields that cannot be
181
- * accepted by the server (not part of `XXXInput` type) and that are strictly for the client form needs. In that case,
182
- * then you can return default values for those extra form fields, and the form returned by `getFormConfig()` will
183
- * include those extra fields.
184
- */
185
- protected getFormExtraFieldDefaultValues(): Literal;
186
- /**
187
- * This is used to extract only the array of fetched objects out of the entire fetched data
188
- */
189
- protected mapAll(): OperatorFunction<FetchResult<unknown>, Tall>;
190
- /**
191
- * This is used to extract only the created object out of the entire fetched data
192
- */
193
- protected mapCreation(result: MutationResult<unknown>): Tcreate;
194
- /**
195
- * This is used to extract only the updated object out of the entire fetched data
196
- */
197
- protected mapUpdate(result: MutationResult<unknown>): Tupdate;
198
- /**
199
- * This is used to extract only flag when deleting an object
200
- */
201
- protected mapDelete(result: MutationResult<unknown>): Tdelete;
202
- /**
203
- * Returns additional variables to be used when getting a single object
204
- *
205
- * This is typically a site or state ID, and is needed to get appropriate access rights
206
- */
207
- protected getPartialVariablesForOne(): Observable<Partial<Vone>>;
208
- /**
209
- * Returns additional variables to be used when getting multiple objects
210
- *
211
- * This is typically a site or state ID, but it could be something else to further filter the query
212
- */
213
- getPartialVariablesForAll(): Observable<Partial<Vall>>;
214
- /**
215
- * Returns additional variables to be used when creating an object
216
- *
217
- * This is typically a site or state ID
218
- */
219
- protected getPartialVariablesForCreation(object: Literal): Partial<Vcreate>;
220
- /**
221
- * Returns additional variables to be used when updating an object
222
- *
223
- * This is typically a site or state ID
224
- */
225
- protected getPartialVariablesForUpdate(object: Literal): Partial<Vupdate>;
226
- /**
227
- * Return additional variables to be used when deleting an object
228
- *
229
- * This is typically a site or state ID
230
- */
231
- protected getPartialVariablesForDelete(objects: Literal[]): Partial<Vdelete>;
232
- /**
233
- * Throw exception to prevent executing queries with invalid variables
234
- */
235
- protected throwIfObservable(value: unknown): void;
236
- /**
237
- * Merge given ID with additional partial variables if there is any
238
- */
239
- private getVariablesForOne;
240
- /**
241
- * Throw exception to prevent executing null queries
242
- */
243
- private throwIfNotQuery;
244
- }
@@ -1,52 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { UntypedModelService } from '../types/types';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Debounce subscriptions to update mutations, with the possibility to cancel one, flush one, or flush all of them.
6
- *
7
- * `modelService` is also used to separate objects by their types. So User with ID 1 is not confused with Product with ID 1.
8
- *
9
- * `id` must be the ID of the object that will be updated.
10
- */
11
- export declare class NaturalDebounceService {
12
- /**
13
- * Stores the debounced update function
14
- */
15
- private readonly allDebouncedUpdateCache;
16
- /**
17
- * Debounce the `modelService.updateNow()` mutation for a short time. If called multiple times with the same
18
- * modelService and id, it will postpone the subscription to the mutation.
19
- *
20
- * All input variables for the same object (same service and ID) will be cumulated over time. So it is possible
21
- * to update `field1`, then `field2`, and they will be batched into a single XHR including `field1` and `field2`.
22
- *
23
- * But it will always keep the same debouncing timeline.
24
- */
25
- debounce<T extends UntypedModelService>(modelService: UntypedModelService, id: string, object: Parameters<T['updateNow']>[0]): ReturnType<T['updateNow']>;
26
- cancelOne(modelService: UntypedModelService, id: string): void;
27
- /**
28
- * Immediately execute the pending update, if any.
29
- *
30
- * It should typically be called before resolving the object, to mutate it before re-fetching it from server.
31
- *
32
- * The returned observable will complete when the update completes, even if it errors.
33
- */
34
- flushOne(modelService: UntypedModelService, id: string): Observable<void>;
35
- /**
36
- * Immediately execute all pending updates.
37
- *
38
- * It should typically be called before login out.
39
- *
40
- * The returned observable will complete when all updates complete, even if some of them error.
41
- */
42
- flush(): Observable<void>;
43
- private internalFlush;
44
- /**
45
- * Count of pending updates
46
- */
47
- get count(): number;
48
- private getMap;
49
- private delete;
50
- static ɵfac: i0.ɵɵFactoryDeclaration<NaturalDebounceService, never>;
51
- static ɵprov: i0.ɵɵInjectableDeclaration<NaturalDebounceService>;
52
- }
@@ -1,19 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import * as i0 from "@angular/core";
3
- export type IEnum = {
4
- value: string;
5
- name: string;
6
- };
7
- export declare class NaturalEnumService {
8
- private readonly apollo;
9
- /**
10
- * Return a list of observable enumerables considering the given name
11
- */
12
- get(name: string): Observable<IEnum[]>;
13
- /**
14
- * Returns the enum user-friendly name, instead of its value.
15
- */
16
- getValueName(value: string, enumName: string): Observable<string>;
17
- static ɵfac: i0.ɵɵFactoryDeclaration<NaturalEnumService, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<NaturalEnumService>;
19
- }
@@ -1,51 +0,0 @@
1
- import { FetchResult } from '@apollo/client/core';
2
- import { Observable } from 'rxjs';
3
- import { Literal } from '../types/types';
4
- import * as i0 from "@angular/core";
5
- export type LinkableObject = {
6
- id: string;
7
- __typename: string;
8
- };
9
- export declare class NaturalLinkMutationService {
10
- private readonly apollo;
11
- /**
12
- * Receives the list of available mutations
13
- */
14
- private allMutations?;
15
- /**
16
- * Link two objects together
17
- */
18
- link(obj1: LinkableObject, obj2: LinkableObject, otherName?: string | null, variables?: Literal): Observable<FetchResult<{
19
- id: string;
20
- }>>;
21
- /**
22
- * Link many objects
23
- */
24
- linkMany(obj1: LinkableObject, objects: LinkableObject[], otherName?: string | null, variables?: Literal): Observable<FetchResult<{
25
- id: string;
26
- }>[]>;
27
- /**
28
- * Unlink two objects
29
- */
30
- unlink(obj1: LinkableObject, obj2: LinkableObject, otherName?: string | null): Observable<FetchResult<{
31
- id: string;
32
- }>>;
33
- /**
34
- * Return the list of all available mutation names
35
- */
36
- private getAllMutationNames;
37
- /**
38
- * Generate mutation using patterns and replacing variables
39
- */
40
- private getMutation;
41
- /**
42
- * Execute mutation
43
- */
44
- private execute;
45
- /**
46
- * Build the actual mutation string
47
- */
48
- private buildTemplate;
49
- static ɵfac: i0.ɵɵFactoryDeclaration<NaturalLinkMutationService, never>;
50
- static ɵprov: i0.ɵɵInjectableDeclaration<NaturalLinkMutationService>;
51
- }
@@ -1,50 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { ActivatedRoute, NavigationExtras } from '@angular/router';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Validator for persisted values retrieved from NaturalPersistenceService. If returns false, the persisted value
6
- * will be ignored, and instead `null` will be returned.
7
- *
8
- * `storageKey` is only given if the value is coming from session storage (and not from URL).
9
- */
10
- export type PersistenceValidator = (key: string, storageKey: string | null, value: unknown) => boolean;
11
- export declare const NATURAL_PERSISTENCE_VALIDATOR: InjectionToken<PersistenceValidator>;
12
- export declare class NaturalPersistenceService {
13
- private readonly router;
14
- private readonly sessionStorage;
15
- private readonly isValid;
16
- /**
17
- * Persist in url and local storage the given value with the given key.
18
- * When stored in storage, we need more "key" to identify the controller.
19
- */
20
- persist(key: string, value: unknown, route: ActivatedRoute, storageKey: string, navigationExtras?: NavigationExtras): Promise<boolean>;
21
- /**
22
- * Return object with persisted data in url or in session storage
23
- * Url has priority over session storage because of url sharing. When url is provided, session storage is ignored.
24
- * Url and storage are synced when arriving in a component :
25
- * - When loading with url parameters, storage is updated to stay synced
26
- * - When loading without url, but with storage data, the url is updated
27
- */
28
- get(key: string, route: ActivatedRoute, storageKey: string): any | null;
29
- /**
30
- * Get given key from the url parameters
31
- */
32
- getFromUrl(key: string, route: ActivatedRoute): any | null;
33
- /**
34
- * Add/override given pair key-value in the url
35
- * Always JSON.stringify() the given value
36
- * If the value is falsey, the pair key-value is removed from the url.
37
- */
38
- persistInUrl(key: string, value: unknown, route: ActivatedRoute, navigationExtras?: NavigationExtras): Promise<boolean>;
39
- getFromStorage(key: string, storageKey: string): any | null;
40
- /**
41
- * Store value in session storage.
42
- * If value is falsy, the entry is removed
43
- */
44
- persistInStorage(key: string, value: unknown, storageKey: string): void;
45
- private getStorageKey;
46
- private isFalseyValue;
47
- private deserialize;
48
- static ɵfac: i0.ɵɵFactoryDeclaration<NaturalPersistenceService, never>;
49
- static ɵprov: i0.ɵɵInjectableDeclaration<NaturalPersistenceService>;
50
- }
@@ -1,16 +0,0 @@
1
- import { NativeDateAdapter } from '@angular/material/core';
2
- import * as i0 from "@angular/core";
3
- export declare class NaturalSwissParsingDateAdapter extends NativeDateAdapter {
4
- /**
5
- * Parse commonly accepted swiss format, such as:
6
- *
7
- * - 24.12.2018
8
- * - 1.4.18
9
- * - 2018-12-24
10
- */
11
- parse(value: unknown): Date | null;
12
- private createDateIfValid;
13
- getFirstDayOfWeek(): number;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSwissParsingDateAdapter, never>;
15
- static ɵprov: i0.ɵɵInjectableDeclaration<NaturalSwissParsingDateAdapter>;
16
- }
@@ -1,100 +0,0 @@
1
- import { PaginatedData } from '../classes/data-source';
2
- import { NaturalAbstractModelService, VariablesWithInput } from '../services/abstract-model.service';
3
- import { QueryVariables } from '../classes/query-variable-manager';
4
- import { ObservedValueOf } from 'rxjs';
5
- import { ResolveData } from '@angular/router';
6
- /**
7
- * An object literal with any keys and values
8
- */
9
- export type Literal = Record<string, any>;
10
- /**
11
- * An object with either a name or a fullName (or maybe both)
12
- */
13
- export type NameOrFullName = {
14
- id: string;
15
- name: string;
16
- fullName?: string;
17
- } | {
18
- id: string;
19
- name?: string;
20
- fullName: string;
21
- };
22
- /**
23
- * Extract the Tone type from a NaturalAbstractModelService
24
- */
25
- export type ExtractTone<P> = P extends NaturalAbstractModelService<infer Tone, any, any, any, any, any, any, any, any, any> ? Tone : never;
26
- /**
27
- * Extract the Vone type from a NaturalAbstractModelService
28
- */
29
- export type ExtractVone<P> = P extends NaturalAbstractModelService<any, infer Vone, any, any, any, any, any, any, any, any> ? Vone extends {
30
- id: string;
31
- } ? Vone : never : never;
32
- /**
33
- * Extract the Tall type from a NaturalAbstractModelService
34
- */
35
- export type ExtractTall<P> = P extends NaturalAbstractModelService<any, any, infer Tall, any, any, any, any, any, any, any> ? Tall extends PaginatedData<Literal> ? Tall : never : never;
36
- /**
37
- * Extract the TallOne type for a single item coming from a list of items from a NaturalAbstractModelService
38
- */
39
- export type ExtractTallOne<P> = P extends NaturalAbstractModelService<any, any, PaginatedData<infer TallOne extends Literal>, any, any, any, any, any, any, any> ? TallOne extends Literal ? TallOne : never : never;
40
- /**
41
- * Extract the Vall type from a NaturalAbstractModelService
42
- */
43
- export type ExtractVall<P> = P extends NaturalAbstractModelService<any, any, any, infer Vall, any, any, any, any, any, any> ? Vall extends QueryVariables ? Vall : never : never;
44
- /**
45
- * Extract the Tcreate type from a NaturalAbstractModelService
46
- */
47
- export type ExtractTcreate<P> = P extends NaturalAbstractModelService<any, any, any, any, infer Tcreate, any, any, any, any, any> ? Tcreate : never;
48
- /**
49
- * Extract the Vcreate type from a NaturalAbstractModelService
50
- */
51
- export type ExtractVcreate<P> = P extends NaturalAbstractModelService<any, any, any, any, any, infer Vcreate, any, any, any, any> ? Vcreate extends VariablesWithInput ? Vcreate : never : never;
52
- /**
53
- * Extract the Tupdate type from a NaturalAbstractModelService
54
- */
55
- export type ExtractTupdate<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, infer Tupdate, any, any, any> ? Tupdate : never;
56
- /**
57
- * Extract the Vupdate type from a NaturalAbstractModelService
58
- */
59
- export type ExtractVupdate<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, infer Vupdate, any, any> ? Vupdate extends {
60
- id: string;
61
- input: Literal;
62
- } ? Vupdate : never : never;
63
- /**
64
- * Extract the Tdelete type from a NaturalAbstractModelService
65
- */
66
- export type ExtractTdelete<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, infer Tdelete, any> ? Tdelete : never;
67
- /**
68
- * Extract the Vdelete type from a NaturalAbstractModelService
69
- */
70
- export type ExtractVdelete<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, infer Vdelete> ? Vdelete extends {
71
- ids: string[];
72
- } ? Vdelete : never : never;
73
- /**
74
- * Extract the resolve type from a NaturalAbstractModelService
75
- */
76
- export type ExtractResolve<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, any> ? ObservedValueOf<ObservedValueOf<ReturnType<P['resolve']>>> : never;
77
- /**
78
- * This should be avoided if possible, and instead use a more precise type with some constraints on it to ensure that the model
79
- * service is able to fulfill its requirements.
80
- */
81
- export type UntypedModelService = NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, any>;
82
- /**
83
- * Returns the resolved data type, as available in components, from the given resolvers
84
- *
85
- * Eg:
86
- *
87
- * ```ts
88
- * const actionResolvers = {
89
- * model: resolveAction,
90
- * statuses: () => inject(NaturalEnumService).get('Status'),
91
- * } as const;
92
- *
93
- * // In action.component.ts
94
- * const data: ResolvedData<typeof actionResolvers>;
95
- * data.statuses.forEach(...);
96
- * ```
97
- */
98
- export type ResolvedData<T extends ResolveData> = {
99
- readonly [KeyType in keyof Pick<T, keyof T>]: ObservedValueOf<ReturnType<Pick<T, keyof T>[KeyType]>>;
100
- };
package/public-api.d.ts DELETED
@@ -1,44 +0,0 @@
1
- export * from './lib/classes/abstract-detail';
2
- export * from './lib/classes/abstract-editable-list';
3
- export * from './lib/classes/abstract-list';
4
- export * from './lib/classes/abstract-navigable-list';
5
- export { createHttpLink, hasFilesAndProcessDate } from './lib/classes/apollo-utils';
6
- export * from './lib/classes/data-source';
7
- export * from './lib/classes/query-variable-manager';
8
- export { cancellableTimeout, debug } from './lib/classes/rxjs';
9
- export * from './lib/classes/utility';
10
- export * from './lib/classes/validators';
11
- export { NetworkActivityService, activityInterceptor } from './lib/classes/network-activity.service';
12
- export { validTlds } from './lib/classes/tld';
13
- export * from './lib/services/abstract-model.service';
14
- export { NaturalDebounceService } from './lib/services/debounce.service';
15
- export * from './lib/services/enum.service';
16
- export * from './lib/services/link-mutation.service';
17
- export { NaturalPersistenceService, NATURAL_PERSISTENCE_VALIDATOR } from './lib/services/persistence.service';
18
- export type { PersistenceValidator } from './lib/services/persistence.service';
19
- export * from './lib/services/swiss-parsing-date-adapter.service';
20
- export type { ExtractResolve, ExtractTall, ExtractTallOne, ExtractTcreate, ExtractTdelete, ExtractTone, ExtractTupdate, ExtractVall, ExtractVcreate, ExtractVdelete, ExtractVone, ExtractVupdate, Literal, NameOrFullName, ResolvedData, } from './lib/types/types';
21
- export * from './lib/modules/alert/public-api';
22
- export * from './lib/modules/columns-picker/public-api';
23
- export * from './lib/modules/common/public-api';
24
- export * from './lib/modules/detail-header/public-api';
25
- export * from './lib/modules/dropdown-components/public-api';
26
- export * from './lib/modules/file/public-api';
27
- export * from './lib/modules/fixed-button/public-api';
28
- export * from './lib/modules/fixed-button-detail/public-api';
29
- export * from './lib/modules/hierarchic-selector/public-api';
30
- export * from './lib/modules/icon/public-api';
31
- export * from './lib/modules/panels/public-api';
32
- export * from './lib/modules/relations/public-api';
33
- export * from './lib/modules/search/public-api';
34
- export * from './lib/modules/select/public-api';
35
- export * from './lib/modules/sidenav/public-api';
36
- export * from './lib/modules/stamp/public-api';
37
- export * from './lib/modules/table-button/public-api';
38
- export * from './lib/modules/dialog-trigger/public-api';
39
- export * from './lib/modules/avatar/public-api';
40
- export * from './lib/modules/matomo/public-api';
41
- export * from './lib/modules/logger/public-api';
42
- export * from './lib/directives/http-prefix.directive';
43
- export { naturalProviders } from './lib/classes/providers';
44
- export { graphqlQuerySigner } from './lib/classes/signing';
@@ -1,11 +0,0 @@
1
- /**
2
- * **DO NOT MODIFY UNLESS STRICTLY REQUIRED FOR VANILLA**
3
- *
4
- * This is a minimal service specialized for Vanilla and any modification,
5
- * including adding `import` in this file, might break https://navigations.ichtus.club.
6
- */
7
- export { NaturalQueryVariablesManager } from './src/lib/classes/query-variable-manager';
8
- export type { Literal } from './src/lib/types/types';
9
- export { graphqlQuerySigner } from './src/lib/classes/signing';
10
- export { formatIsoDateTime } from './src/lib/classes/utility';
11
- export { NaturalAbstractModelService, type FormValidators } from './src/lib/services/abstract-model.service';
@@ -1,8 +0,0 @@
1
- /**
2
- * Thin wrapper around browsers' native SubtleCrypto for convenience of use
3
- */
4
- export declare function sha256(message: string): Promise<string>;
5
- /**
6
- * Thin wrapper around browsers' native SubtleCrypto for convenience of use
7
- */
8
- export declare function hmacSha256(secret: string, payload: string): Promise<string>;
@@ -1,32 +0,0 @@
1
- import { DataSource } from '@angular/cdk/collections';
2
- import { Observable } from 'rxjs';
3
- import { Literal } from '../types/types';
4
- export type PaginatedData<T> = {
5
- readonly items: readonly T[];
6
- readonly offset?: number | null;
7
- readonly pageSize: number;
8
- readonly pageIndex: number;
9
- readonly length: number;
10
- };
11
- /**
12
- * A NaturalDataSource will connect immediately, in order to know as soon as possible if
13
- * we need to show a template at all (as seen in my-ichtus)
14
- *
15
- * It also allow some extra data manipulation
16
- */
17
- export declare class NaturalDataSource<T extends PaginatedData<Literal> = PaginatedData<Literal>> extends DataSource<T['items'][0]> {
18
- private readonly ngUnsubscribe;
19
- private readonly internalData;
20
- constructor(value: Observable<T> | T);
21
- get internalDataObservable(): Observable<T | null>;
22
- /**
23
- * Array of data that should be rendered by the table, where each object represents one row.
24
- */
25
- get data(): T | null;
26
- set data(data: T | null);
27
- connect(): Observable<T['items']>;
28
- disconnect(): void;
29
- push(item: T['items'][0]): void;
30
- pop(): T['items'][0] | undefined;
31
- remove(item: T['items'][0]): void;
32
- }
@@ -1,2 +0,0 @@
1
- import { Literal } from '../types/types';
2
- export declare function hasMixedGroupLogic(groups: Literal[]): boolean;