@ecodev/natural 63.5.1 → 63.6.1

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.
@@ -1,9 +1,11 @@
1
- import { pickBy, cloneDeep, uniq, groupBy, mergeWith, defaultsDeep, omit, merge, pick, defaults } from 'lodash-es';
2
- import { BehaviorSubject, throwError, from, switchMap, ReplaySubject, Subject, debounceTime, raceWith, take, mergeMap, EMPTY, shareReplay, catchError, of, Observable, forkJoin, map, first, combineLatest } from 'rxjs';
1
+ import { mergeWith, defaultsDeep, defaults } from 'es-toolkit/compat';
2
+ import { pickBy, cloneDeepWith, cloneDeep, uniq, groupBy, omit, merge, pick } from 'es-toolkit';
3
+ import { switchMap, take, BehaviorSubject, throwError, from, ReplaySubject, Subject, debounceTime, raceWith, mergeMap, EMPTY, shareReplay, catchError, of, Observable, forkJoin, map, first, combineLatest } from 'rxjs';
4
+ import { NavigationStart, NavigationEnd } from '@angular/router';
5
+ import { filter, takeWhile, map as map$1, switchMap as switchMap$1, debounceTime as debounceTime$1, tap, shareReplay as shareReplay$1, startWith } from 'rxjs/operators';
3
6
  import { Apollo, gql } from 'apollo-angular';
4
7
  import { NetworkStatus } from '@apollo/client/core';
5
8
  import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
6
- import { takeWhile, map as map$1, switchMap as switchMap$1, filter, debounceTime as debounceTime$1, tap, shareReplay as shareReplay$1, startWith } from 'rxjs/operators';
7
9
  import * as i0 from '@angular/core';
8
10
  import { Injectable, inject } from '@angular/core';
9
11
 
@@ -152,11 +154,22 @@ function rgbToHex(rgb) {
152
154
  }
153
155
  return '#' + [m[1], m[2], m[3]].map(x => parseInt(x).toString(16).toUpperCase().padStart(2, '0')).join('');
154
156
  }
157
+ /**
158
+ * Deep clone given values except for `File` that will be referencing the original value
159
+ */
160
+ function cloneDeepButSkipFile(value) {
161
+ return cloneDeepWith(value, v => (isFile(v) ? v : undefined));
162
+ }
163
+ function isFile(value) {
164
+ return ((typeof File !== 'undefined' && value instanceof File) ||
165
+ (typeof Blob !== 'undefined' && value instanceof Blob) ||
166
+ (typeof FileList !== 'undefined' && value instanceof FileList));
167
+ }
155
168
  /**
156
169
  * During lodash.mergeWith, overrides arrays
157
170
  */
158
171
  function mergeOverrideArray(destValue, source) {
159
- if (Array.isArray(source)) {
172
+ if (Array.isArray(source) || isFile(source)) {
160
173
  return source;
161
174
  }
162
175
  }
@@ -239,6 +252,9 @@ function validateColumns(data) {
239
252
  }
240
253
  return data.split(',').filter(string => string);
241
254
  }
255
+ function onHistoryEvent(router) {
256
+ return router.events.pipe(filter(e => e instanceof NavigationStart && e.navigationTrigger === 'popstate'), switchMap(() => router.events.pipe(filter(e => e instanceof NavigationEnd), take(1))));
257
+ }
242
258
 
243
259
  // Basic; loosely typed structure for graphql-doctrine filters
244
260
  // Logical operator to be used in conditions
@@ -262,7 +278,7 @@ function hasMixedGroupLogic(groups) {
262
278
  }
263
279
  return group;
264
280
  });
265
- const groupLogics = uniq(Object.keys(groupBy(completedGroups.slice(1), 'groupLogic')));
281
+ const groupLogics = uniq(Object.keys(groupBy(completedGroups.slice(1), group => group.groupLogic)));
266
282
  return groupLogics.length > 1;
267
283
  }
268
284
 
@@ -275,8 +291,11 @@ var SortingOrder;
275
291
  * During lodash merge, concat arrays
276
292
  */
277
293
  function mergeConcatArray(destValue, source) {
294
+ if (isFile(source)) {
295
+ return source;
296
+ }
278
297
  if (Array.isArray(source)) {
279
- if (destValue) {
298
+ if (Array.isArray(destValue)) {
280
299
  return destValue.concat(source);
281
300
  }
282
301
  else {
@@ -331,7 +350,7 @@ class NaturalQueryVariablesManager {
331
350
  set(channelName, variables) {
332
351
  // cloneDeep to change reference and prevent some interactions when merge
333
352
  if (variables) {
334
- this.channels.set(channelName, cloneDeep(variables));
353
+ this.channels.set(channelName, cloneDeepButSkipFile(variables));
335
354
  }
336
355
  else {
337
356
  this.channels.delete(channelName);
@@ -345,7 +364,7 @@ class NaturalQueryVariablesManager {
345
364
  * used this changed attribute without having explicitly asked QueryVariablesManager to update it.
346
365
  */
347
366
  get(channelName) {
348
- return cloneDeep(this.channels.get(channelName));
367
+ return cloneDeepButSkipFile(this.channels.get(channelName));
349
368
  }
350
369
  /**
351
370
  * Merge variable into a channel, overriding arrays in same channel / key
@@ -402,7 +421,7 @@ class NaturalQueryVariablesManager {
402
421
  }
403
422
  }
404
423
  // Merge other attributes than filter
405
- mergeWith(merged, omit(channelVariables, 'filter'), mergeConcatArray);
424
+ mergeWith(merged, omit(channelVariables, ['filter']), mergeConcatArray);
406
425
  });
407
426
  this.variables.next(merged);
408
427
  }
@@ -935,7 +954,7 @@ class NaturalAbstractModelService {
935
954
  create(object) {
936
955
  this.throwIfObservable(object);
937
956
  this.throwIfNotQuery(this.createMutation);
938
- const variables = merge({}, { input: this.getInput(object, true) }, this.getPartialVariablesForCreation(object));
957
+ const variables = merge({ input: this.getInput(object, true) }, this.getPartialVariablesForCreation(object));
939
958
  return this.apollo
940
959
  .mutate({
941
960
  mutation: this.createMutation,
@@ -1172,7 +1191,7 @@ class NaturalAbstractModelService {
1172
1191
  * Merge given ID with additional partial variables if there is any
1173
1192
  */
1174
1193
  getVariablesForOne(id) {
1175
- return this.getPartialVariablesForOne().pipe(map$1(partialVariables => merge({}, { id: id }, partialVariables)));
1194
+ return this.getPartialVariablesForOne().pipe(map$1(partialVariables => merge({ id: id }, partialVariables)));
1176
1195
  }
1177
1196
  /**
1178
1197
  * Throw exception to prevent executing null queries
@@ -1 +1 @@
1
- {"version":3,"file":"ecodev-natural-vanilla.mjs","sources":["../../../projects/natural/src/lib/classes/utility.ts","../../../projects/natural/src/lib/modules/search/classes/graphql-doctrine.types.ts","../../../projects/natural/src/lib/classes/query-variable-manager-utils.ts","../../../projects/natural/src/lib/classes/query-variable-manager.ts","../../../projects/natural/src/lib/classes/crypto.ts","../../../projects/natural/src/lib/classes/signing.ts","../../../projects/natural/src/lib/services/debounce.service.ts","../../../projects/natural/src/lib/modules/search/classes/utils.ts","../../../projects/natural/src/lib/services/abstract-model.service.ts","../../../projects/natural/public-api.ts","../../../projects/natural/ecodev-natural-vanilla.ts"],"sourcesContent":["import {pickBy} from 'lodash-es';\nimport {Literal} from '../types/types';\nimport type {ReadonlyDeep} from 'type-fest';\nimport {PaginationInput, Sorting, SortingOrder} from './query-variable-manager';\n\n/**\n * Very basic formatting to get only date, without time and ignoring entirely the timezone\n *\n * So something like: \"2021-09-23\"\n */\nexport function formatIsoDate(date: null): null;\nexport function formatIsoDate(date: Date): string;\nexport function formatIsoDate(date: Date | null): string | null;\nexport function formatIsoDate(date: Date | null): string | null {\n if (!date) {\n return null;\n }\n\n const y = date.getFullYear();\n const m = date.getMonth() + 1;\n const d = date.getDate();\n\n return y + '-' + (m < 10 ? '0' : '') + m + '-' + (d < 10 ? '0' : '') + d;\n}\n\n/**\n * Format a date and time in a way that will preserve the local time zone.\n * This allows the server side to know the day (without time) that was selected on client side.\n *\n * So something like: \"2021-09-23T17:57:16+09:00\"\n */\nexport function formatIsoDateTime(date: Date): string {\n const timezoneOffsetInMinutes = date.getTimezoneOffset();\n const timezoneOffsetInHours = -Math.trunc(timezoneOffsetInMinutes / 60); // UTC minus local time\n const sign = timezoneOffsetInHours >= 0 ? '+' : '-';\n const hoursLeadingZero = Math.abs(timezoneOffsetInHours) < 10 ? '0' : '';\n const remainderMinutes = -(timezoneOffsetInMinutes % 60);\n const minutesLeadingZero = Math.abs(remainderMinutes) < 10 ? '0' : '';\n\n // It's a bit unfortunate that we need to construct a new Date instance,\n // but we don't want the original Date instance to be modified\n const correctedDate = new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n date.getMilliseconds(),\n );\n correctedDate.setHours(date.getHours() + timezoneOffsetInHours);\n\n const iso = correctedDate\n .toISOString()\n .replace(/\\.\\d{3}Z/, '')\n .replace('Z', '');\n\n return (\n iso +\n sign +\n hoursLeadingZero +\n Math.abs(timezoneOffsetInHours).toString() +\n ':' +\n minutesLeadingZero +\n remainderMinutes\n );\n}\n\n/**\n * Relations to full objects are converted to their IDs only.\n *\n * So {user: {id: 123}} becomes {user: 123}\n */\nexport function relationsToIds(object: Literal): Literal {\n const newObj: Literal = {};\n Object.keys(object).forEach(key => {\n let value: unknown = object[key];\n\n if (value === null || value === undefined) {\n // noop\n } else if (hasId(value)) {\n value = value.id;\n } else if (Array.isArray(value)) {\n value = value.map((i: unknown) => (hasId(i) ? i.id : i));\n } else if (typeof value === 'object' && !(value instanceof File) && !(value instanceof Date)) {\n value = pickBy(value, (v, k) => k !== '__typename'); // omit(value, ['__typename']) ?\n }\n\n newObj[key] = value;\n });\n\n return newObj;\n}\n\nfunction hasId(value: unknown): value is {id: unknown} {\n return !!value && typeof value === 'object' && 'id' in value && !!value.id;\n}\n\n/**\n * Returns the plural form of the given name\n *\n * This is **not** necessarily valid english grammar. Its only purpose is for internal usage, not for humans.\n *\n * This **MUST** be kept in sync with `\\Ecodev\\Felix\\Api\\Plural:make()`.\n *\n * This is a bit performance-sensitive, so we should keep it fast and only cover cases that we actually need.\n */\nexport function makePlural(name: string): string {\n // Words ending in a y preceded by a vowel form their plurals by adding -s:\n if (/[aeiou]y$/.exec(name)) {\n return name + 's';\n }\n\n const plural = name + 's';\n\n return plural.replace(/ys$/, 'ies').replace(/ss$/, 'ses').replace(/xs$/, 'xes');\n}\n\n/**\n * Returns the string with the first letter as capital\n */\nexport function upperCaseFirstLetter(term: string): string {\n return term.charAt(0).toUpperCase() + term.slice(1);\n}\n\n/**\n * Replace all attributes of first object with the ones provided by the second, but keeps the reference\n */\nexport function replaceObjectKeepingReference(obj: Literal | null, newObj: Literal | null): void {\n if (!obj || !newObj) {\n return;\n }\n\n Object.keys(obj).forEach(key => {\n delete obj[key];\n });\n\n Object.keys(newObj).forEach(key => {\n obj[key] = newObj[key];\n });\n}\n\n/**\n * Get contrasted color for text in the slider thumb\n * @param hexBgColor string in hexadecimals representing the background color\n */\nexport function getForegroundColor(hexBgColor: string): 'black' | 'white' {\n const rgb = hexToRgb(hexBgColor.slice(0, 7)); // splice remove alpha and consider only \"visible\" color at 100% alpha\n const o = Math.round((rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000);\n\n return o > 125 ? 'black' : 'white';\n}\n\nfunction hexToRgb(hex: string): {r: number; g: number; b: number} {\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, (m, r, g, b) => {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : {\n r: 0,\n g: 0,\n b: 0,\n };\n}\n\n/**\n * Convert RGB color to hexadecimal color\n *\n * ```ts\n * rgbToHex('rgb(255, 00, 255)'); // '#FF00FF'\n * ```\n */\nexport function rgbToHex(rgb: string): string {\n const m = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/.exec(rgb);\n if (!m) {\n return rgb;\n }\n\n return '#' + [m[1], m[2], m[3]].map(x => parseInt(x).toString(16).toUpperCase().padStart(2, '0')).join('');\n}\n\n/**\n * During lodash.mergeWith, overrides arrays\n */\nexport function mergeOverrideArray(destValue: unknown, source: unknown): unknown {\n if (Array.isArray(source)) {\n return source;\n }\n}\n\n/**\n * Copy text to clipboard.\n * Accepts line breaks `\\n` as textarea do.\n */\nexport function copyToClipboard(document: Document, text: string): void {\n const input = document.createElement('textarea');\n document.body.append(input);\n input.value = text;\n input.select();\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n document.execCommand('copy');\n document.body.removeChild(input);\n}\n\nexport function deepFreeze<T extends Literal>(o: T): ReadonlyDeep<T> {\n Object.values(o).forEach(v => Object.isFrozen(v) || deepFreeze(v));\n\n return Object.freeze(o) as ReadonlyDeep<T>;\n}\n\n/**\n * Return a valid PaginationInput from whatever is available from data. Invalid properties/types will be dropped.\n */\nexport function validatePagination(data: unknown): PaginationInput | null {\n if (!data || typeof data !== 'object' || Array.isArray(data)) {\n return null;\n }\n\n const pagination: PaginationInput = {};\n\n if ('offset' in data && (data.offset === null || typeof data.offset === 'number')) {\n pagination.offset = data.offset;\n }\n\n if ('pageIndex' in data && (data.pageIndex === null || typeof data.pageIndex === 'number')) {\n pagination.pageIndex = data.pageIndex;\n }\n\n if ('pageSize' in data && (data.pageSize === null || typeof data.pageSize === 'number')) {\n pagination.pageSize = data.pageSize;\n }\n\n return pagination;\n}\n\n/**\n * Return a valid Sortings from whatever is available from data. Invalid properties/types will be dropped.\n */\nexport function validateSorting(data: unknown): Sorting[] | null {\n if (!Array.isArray(data)) {\n return null;\n }\n const result: Sorting[] = [];\n data.forEach(s => {\n const r = validateOneSorting(s);\n if (r) {\n result.push(r);\n }\n });\n\n return result;\n}\n\nfunction validateOneSorting(data: unknown): Sorting | null {\n if (!data || typeof data !== 'object' || !('field' in data)) {\n return null;\n }\n\n const sorting: Sorting = {field: data.field};\n\n if (\n 'order' in data &&\n (data.order === SortingOrder.ASC || data.order === SortingOrder.DESC || data.order === null)\n ) {\n sorting.order = data.order;\n }\n\n if ('nullAsHighest' in data && (data.nullAsHighest === null || typeof data.nullAsHighest === 'boolean')) {\n sorting.nullAsHighest = data.nullAsHighest;\n }\n\n if (\n 'emptyStringAsHighest' in data &&\n (data.emptyStringAsHighest === null || typeof data.emptyStringAsHighest === 'boolean')\n ) {\n sorting.emptyStringAsHighest = data.emptyStringAsHighest;\n }\n\n return sorting;\n}\n\n/**\n * Return valid columns from whatever is available from data. Invalid properties/types will be dropped.\n */\nexport function validateColumns(data: unknown): string[] | null {\n if (typeof data !== 'string') {\n return null;\n }\n\n return data.split(',').filter(string => string);\n}\n","// Basic; loosely typed structure for graphql-doctrine filters\n\nimport {Literal} from '../../../types/types';\n\nexport type Filter = {\n groups?: FilterGroup[] | null;\n};\n\nexport type FilterGroup = {\n // The logic operator to be used to append this group\n groupLogic?: LogicalOperator | null;\n // The logic operator to be used within all conditions in this group\n conditionsLogic?: LogicalOperator | null;\n // Optional joins to either filter the query or fetch related objects from DB in a single query\n joins?: FilterGroupJoin | null;\n // Conditions to be applied on fields\n conditions?: FilterGroupCondition[] | null;\n};\n\nexport type FilterGroupJoin = Record<string, JoinOn>;\n\nexport type JoinOn = {\n type?: JoinType | null;\n // Optional joins to either filter the query or fetch related objects from DB in a single query\n joins?: FilterGroupJoin | null;\n // Conditions to be applied on fields\n conditions?: FilterGroupCondition[] | null;\n};\n\n// Logical operator to be used in conditions\nexport enum LogicalOperator {\n AND = 'AND',\n OR = 'OR',\n}\n\n// Join types to be used in DQL\nexport enum JoinType {\n innerJoin = 'innerJoin',\n leftJoin = 'leftJoin',\n}\n\nexport type FilterGroupCondition = Record<string, FilterGroupConditionField>;\n\nexport type FilterGroupConditionField = {\n between?: BetweenOperator | null;\n equal?: EqualOperator | null;\n greater?: GreaterOperator | null;\n greaterOrEqual?: GreaterOrEqualOperator | null;\n in?: InOperator | null;\n less?: LessOperator | null;\n lessOrEqual?: LessOrEqualOperator | null;\n like?: LikeOperator | null;\n null?: NullOperator | null;\n\n // For relations\n have?: HaveOperator | null;\n empty?: EmptyOperator | null;\n\n // Allow anything else for custom operators\n [key: string]: Literal | undefined | null;\n};\n\nexport type Scalar = number | string | boolean;\n\nexport type HaveOperator = {\n values: string[];\n not?: boolean | null;\n};\n\nexport type EmptyOperator = {\n not?: boolean | null;\n};\n\nexport type BetweenOperator = {\n from: Scalar;\n to: Scalar;\n not?: boolean | null;\n};\n\nexport type EqualOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type GreaterOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type GreaterOrEqualOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type InOperator = {\n values: Scalar[];\n not?: boolean | null;\n};\n\nexport type LessOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type LessOrEqualOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type LikeOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type NullOperator = {\n not?: boolean | null;\n};\n","import {cloneDeep, groupBy, uniq} from 'lodash-es';\nimport {LogicalOperator} from '../modules/search/classes/graphql-doctrine.types';\nimport {Literal} from '../types/types';\n\nexport function hasMixedGroupLogic(groups: Literal[]): boolean {\n // Complete lack of definition by fallback on AND operator\n const completedGroups = cloneDeep(groups).map(group => {\n if (!group.groupLogic) {\n group.groupLogic = LogicalOperator.AND;\n }\n\n return group;\n });\n\n const groupLogics = uniq(Object.keys(groupBy(completedGroups.slice(1), 'groupLogic')));\n\n return groupLogics.length > 1;\n}\n","import {cloneDeep, defaultsDeep, mergeWith, omit} from 'lodash-es';\nimport {BehaviorSubject} from 'rxjs';\nimport {Literal} from '../types/types';\nimport {mergeOverrideArray} from './utility';\nimport {hasMixedGroupLogic} from './query-variable-manager-utils';\n\nexport type QueryVariables = {\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n filter?: any | null;\n pagination?: PaginationInput | null;\n sorting?: Sorting[] | null;\n};\n\nexport type PaginationInput = {\n offset?: number | null;\n pageIndex?: number | null;\n pageSize?: number | null;\n};\n\nexport type Sorting = {\n field: any;\n order?: SortingOrder | null;\n nullAsHighest?: boolean | null;\n emptyStringAsHighest?: boolean | null;\n};\n\nexport enum SortingOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\n/**\n * During lodash merge, concat arrays\n */\nfunction mergeConcatArray(destValue: any, source: any): any {\n if (Array.isArray(source)) {\n if (destValue) {\n return destValue.concat(source);\n } else {\n return source;\n }\n }\n}\n\n/**\n * Filter manager stores a set of channels that contain a variable object and exposes an observable \"variables\" that updates with the result\n * of all channels merged together.\n *\n * A channel is supposed to be used by a given aspect of the GUI (pagination, sorting, search, others ?).\n *\n * ```ts\n * const fm = new QueryVariablesManager();\n * fm.merge('componentA-variables', {a : [1, 2, 3]});\n * ```\n *\n * Variables attributes is a BehaviorSubject. That mean it's not mandatory to subscribe, we can just call getValue or value attributes on\n * it :\n *\n * ```ts\n * console.log(fm.variables.value); // {a : [1, 2, 3]}\n * ```\n *\n * Set new variables for 'componentA-variables':\n *\n * ```ts\n * fm.merge('componentA-variables', {a : [1, 2]});\n * console.log(fm.variables.value); // {a : [1, 2, 3]}\n * ```\n *\n * Set new variables for new channel:\n *\n * ```ts\n * fm.merge('componentB-variables', {a : [3, 4]});\n * console.log(fm.variables.value); // {a : [1, 2, 3, 4]}\n * ```\n */\nexport class NaturalQueryVariablesManager<T extends QueryVariables = QueryVariables> {\n public readonly variables = new BehaviorSubject<T | undefined>(undefined);\n private readonly channels = new Map<string, Partial<T>>();\n\n public constructor(queryVariablesManager?: NaturalQueryVariablesManager<T>) {\n if (queryVariablesManager) {\n this.channels = queryVariablesManager.getChannelsCopy();\n this.updateVariables();\n }\n }\n\n /**\n * Set or override all the variables that may exist in the given channel\n */\n public set(channelName: string, variables: Partial<T> | null | undefined): void {\n // cloneDeep to change reference and prevent some interactions when merge\n if (variables) {\n this.channels.set(channelName, cloneDeep(variables));\n } else {\n this.channels.delete(channelName);\n }\n this.updateVariables();\n }\n\n /**\n * Return a deep clone of the variables for the given channel name.\n *\n * Avoid returning the same reference to prevent an attribute change, then another channel update that would\n * used this changed attribute without having explicitly asked QueryVariablesManager to update it.\n */\n public get(channelName: string): Partial<T> | undefined {\n return cloneDeep(this.channels.get(channelName));\n }\n\n /**\n * Merge variable into a channel, overriding arrays in same channel / key\n */\n public merge(channelName: string, newVariables: Partial<T>): void {\n const variables = this.channels.get(channelName);\n if (variables) {\n mergeWith(variables, cloneDeep(newVariables), mergeOverrideArray); // merge preserves references, cloneDeep prevent that\n this.updateVariables();\n } else {\n this.set(channelName, newVariables);\n }\n }\n\n /**\n * Apply default values to a channel\n * Note : lodash defaults only defines values on destinations keys that are undefined\n */\n public defaults(channelName: string, newVariables: Partial<T>): void {\n const variables = this.channels.get(channelName);\n if (variables) {\n defaultsDeep(variables, newVariables);\n this.updateVariables();\n } else {\n this.set(channelName, newVariables);\n }\n }\n\n private getChannelsCopy(): Map<string, Partial<T>> {\n return new Map<string, Partial<T>>(this.channels);\n }\n\n /**\n * Merge channels in a single object\n * Arrays are concatenated\n * Filter groups are combined smartly (see mergeGroupList)\n */\n private updateVariables(): void {\n const merged: T = {} as T;\n\n this.channels.forEach(channelVariables => {\n if (channelVariables.filter) {\n // Merge filter's groups first\n const groups = this.mergeGroupList(\n merged.filter?.groups ? merged.filter.groups : [],\n channelVariables.filter.groups || [],\n );\n\n // Merge filter key (that contain groups)\n if (groups?.length) {\n if (merged.filter) {\n merged.filter.groups = groups;\n } else {\n merged.filter = {groups: groups};\n }\n } else {\n mergeWith(merged, {filter: channelVariables.filter}, mergeConcatArray);\n }\n }\n\n // Merge other attributes than filter\n mergeWith(merged, omit(channelVariables, 'filter'), mergeConcatArray);\n });\n\n this.variables.next(merged);\n }\n\n /**\n * Cross merge two filters\n * Only accepts groups with same groupLogic (ignores the first one, because there is no groupLogic in this one)\n * @throws In case two non-empty lists of groups are given and at one of them mix groupLogic value, throws an error\n */\n private mergeGroupList(groupsA: Literal[], groupsB: Literal[]): Literal {\n if (groupsA.length === 0 && groupsB.length === 0) {\n return []; // empty listings, return empty lists\n }\n\n if (groupsA.length === 0 && groupsB.length > 0) {\n return groupsB; // One list is empty, return the one that is not\n }\n\n if (groupsB.length === 0 && groupsA.length > 0) {\n return groupsA; // One list is empty, return the one that is not\n }\n\n const groups: Literal[] = [];\n\n if (hasMixedGroupLogic(groupsA) || hasMixedGroupLogic(groupsB)) {\n throw Error('QueryVariables groups contain mixed group logics');\n }\n\n groupsA.forEach(groupA => {\n groupsB.forEach(groupB => {\n groups.push(mergeWith(cloneDeep(groupA), groupB, mergeConcatArray));\n });\n });\n\n return groups;\n }\n}\n","function bufferToHexa(hashBuffer: ArrayBuffer): string {\n const hashArray = new Uint8Array(hashBuffer); // convert buffer to byte array\n return hashArray.reduce((result, byte) => result + byte.toString(16).padStart(2, '0'), ''); // convert bytes to hex string\n}\n\n/**\n * Thin wrapper around browsers' native SubtleCrypto for convenience of use\n */\nexport async function sha256(message: string): Promise<string> {\n const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array\n const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); // hash the message\n\n return bufferToHexa(hashBuffer);\n}\n\n/**\n * Thin wrapper around browsers' native SubtleCrypto for convenience of use\n */\nexport async function hmacSha256(secret: string, payload: string): Promise<string> {\n const encoder = new TextEncoder();\n const algorithm: HmacKeyGenParams = {name: 'HMAC', hash: 'SHA-256'};\n\n const key = await crypto.subtle.importKey('raw', encoder.encode(secret), algorithm, false, ['sign']);\n const signature = await crypto.subtle.sign(algorithm.name, key, encoder.encode(payload));\n\n return bufferToHexa(signature);\n}\n","import {HttpInterceptorFn, HttpRequest} from '@angular/common/http';\nimport {hmacSha256} from './crypto';\nimport {from, switchMap, throwError} from 'rxjs';\n\nfunction getOperations(req: HttpRequest<unknown>): string {\n if (req.body instanceof FormData) {\n const operations = req.body.get('operations');\n if (typeof operations !== 'string') {\n throw new Error(\n 'Cannot sign a GraphQL query that is using FormData but that is missing the key `operations`',\n );\n }\n return operations;\n } else {\n return JSON.stringify(req.body);\n }\n}\n\n/**\n * Sign all HTTP POST requests that are GraphQL queries against `/graphql` endpoint with a custom signature.\n *\n * The server will validate the signature before executing the GraphQL query.\n */\nexport function graphqlQuerySigner(key: string): HttpInterceptorFn {\n // Validates the configuration exactly 1 time (not for\n // every query), and if not reject **all** HTTP requests\n if (!key) {\n return () =>\n throwError(\n () =>\n new Error(\n 'graphqlQuerySigner requires a non-empty key. Configure it in local.php under signedQueries.',\n ),\n );\n }\n\n return (req, next) => {\n const mustSign = req.method === 'POST' && /\\/graphql(\\?|$)/.exec(req.url);\n if (!mustSign) {\n return next(req);\n }\n\n const operations = getOperations(req);\n const timestamp = Math.round(Date.now() / 1000);\n const payload = timestamp + operations;\n\n return from(hmacSha256(key, payload)).pipe(\n switchMap(hash => {\n const header = `v1.${timestamp}.${hash}`;\n const signedRequest = req.clone({\n headers: req.headers.set('X-Signature', header),\n });\n\n return next(signedRequest);\n }),\n );\n };\n}\n","import {\n catchError,\n debounceTime,\n EMPTY,\n forkJoin,\n map,\n mergeMap,\n Observable,\n of,\n raceWith,\n ReplaySubject,\n shareReplay,\n Subject,\n take,\n} from 'rxjs';\nimport {Injectable} from '@angular/core';\nimport {UntypedModelService} from '../types/types';\n\ntype Debounced<T extends UntypedModelService> = {\n object: Parameters<T['updateNow']>[0];\n modelService: T;\n debouncer: Subject<void>;\n canceller: Subject<void>;\n flusher: Subject<void>;\n result: ReturnType<T['updateNow']>;\n};\n\n/**\n * Debounce subscriptions to update mutations, with the possibility to cancel one, flush one, or flush all of them.\n *\n * `modelService` is also used to separate objects by their types. So User with ID 1 is not confused with Product with ID 1.\n *\n * `id` must be the ID of the object that will be updated.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class NaturalDebounceService {\n /**\n * Stores the debounced update function\n */\n private readonly allDebouncedUpdateCache = new Map<\n UntypedModelService,\n Map<string, Debounced<UntypedModelService>>\n >();\n\n /**\n * Debounce the `modelService.updateNow()` mutation for a short time. If called multiple times with the same\n * modelService and id, it will postpone the subscription to the mutation.\n *\n * All input variables for the same object (same service and ID) will be cumulated over time. So it is possible\n * to update `field1`, then `field2`, and they will be batched into a single XHR including `field1` and `field2`.\n *\n * But it will always keep the same debouncing timeline.\n */\n public debounce<T extends UntypedModelService>(\n modelService: UntypedModelService,\n id: string,\n object: Parameters<T['updateNow']>[0],\n ): ReturnType<T['updateNow']> {\n const debouncedUpdateCache = this.getMap(modelService);\n let debounced = debouncedUpdateCache.get(id) as Debounced<T> | undefined;\n\n if (debounced) {\n debounced.object = {\n ...debounced.object,\n ...object,\n };\n } else {\n const debouncer = new ReplaySubject<void>(1);\n let wasCancelled = false;\n const canceller = new Subject<void>();\n canceller.subscribe(() => {\n wasCancelled = true;\n debouncer.complete();\n canceller.complete();\n this.delete(modelService, id);\n });\n\n const flusher = new Subject<void>();\n\n debounced = {\n object,\n debouncer,\n canceller,\n flusher,\n modelService: modelService as T,\n result: debouncer.pipe(\n debounceTime(2000), // Wait 2 seconds...\n raceWith(flusher), // ...unless flusher is triggered\n take(1),\n mergeMap(() => {\n this.delete(modelService, id);\n\n if (wasCancelled || !debounced) {\n return EMPTY;\n }\n\n return modelService.updateNow(debounced.object);\n }),\n shareReplay(), // All attempts to update will share the exact same single result from API\n ) as ReturnType<T['updateNow']>,\n };\n\n debouncedUpdateCache.set(id, debounced);\n }\n\n // Notify our debounced update each time we ask to update\n debounced.debouncer.next();\n\n // Return and observable that is updated when mutation is done\n return debounced.result;\n }\n\n public cancelOne(modelService: UntypedModelService, id: string): void {\n const debounced = this.allDebouncedUpdateCache.get(modelService)?.get(id);\n debounced?.canceller.next();\n }\n\n /**\n * Immediately execute the pending update, if any.\n *\n * It should typically be called before resolving the object, to mutate it before re-fetching it from server.\n *\n * The returned observable will complete when the update completes, even if it errors.\n */\n public flushOne(modelService: UntypedModelService, id: string): Observable<void> {\n const debounced = this.allDebouncedUpdateCache.get(modelService)?.get(id);\n\n return this.internalFlush(debounced ? [debounced] : []);\n }\n\n /**\n * Immediately execute all pending updates.\n *\n * It should typically be called before login out.\n *\n * The returned observable will complete when all updates complete, even if some of them error.\n */\n public flush(): Observable<void> {\n const all: Debounced<UntypedModelService>[] = [];\n this.allDebouncedUpdateCache.forEach(map => map.forEach(debounced => all.push(debounced)));\n\n return this.internalFlush(all);\n }\n\n private internalFlush(debounceds: Debounced<UntypedModelService>[]): Observable<void> {\n const all: Observable<unknown>[] = [];\n const allFlusher: Subject<void>[] = [];\n\n debounceds.forEach(debounced => {\n all.push(debounced.result.pipe(catchError(() => of(undefined))));\n allFlusher.push(debounced.flusher);\n });\n\n if (!all.length) {\n all.push(of(undefined));\n }\n\n return new Observable(subscriber => {\n const subscription = forkJoin(all)\n .pipe(map(() => undefined))\n .subscribe(subscriber);\n\n // Flush only after subscription process is finished\n allFlusher.forEach(flusher => flusher.next());\n\n return subscription;\n });\n }\n\n /**\n * Count of pending updates\n */\n public get count(): number {\n let count = 0;\n this.allDebouncedUpdateCache.forEach(map => (count += map.size));\n\n return count;\n }\n\n private getMap<T extends UntypedModelService>(modelService: T): Map<string, Debounced<T>> {\n let debouncedUpdateCache = this.allDebouncedUpdateCache.get(modelService);\n if (!debouncedUpdateCache) {\n debouncedUpdateCache = new Map<string, Debounced<UntypedModelService>>();\n this.allDebouncedUpdateCache.set(modelService, debouncedUpdateCache);\n }\n\n return debouncedUpdateCache as Map<string, Debounced<T>>;\n }\n\n private delete(modelService: UntypedModelService, id: string): void {\n const map = this.allDebouncedUpdateCache.get(modelService);\n if (!map) {\n return;\n }\n\n map.delete(id);\n\n if (!map.size) {\n this.allDebouncedUpdateCache.delete(modelService);\n }\n }\n}\n","import {Facet, NaturalSearchFacets} from '../types/facet';\nimport {NaturalSearchSelection} from '../types/values';\n\n/**\n * Lookup a facet by its `name` and then by its `field`, or return null if not found\n */\nexport function getFacetFromSelection(\n facets: NaturalSearchFacets | null,\n selection: NaturalSearchSelection,\n): Facet | null {\n if (!facets) {\n return null;\n }\n\n return (\n facets.find(facet => facet.name != null && facet.name === selection.name) ||\n facets.find(facet => facet.field === selection.field) ||\n null\n );\n}\n\n/**\n * Deep clone a literal via JSON serializing/unserializing\n *\n * It will **not** work with:\n *\n * - functions (will be removed)\n * - `undefined` (will be removed)\n * - cyclic references (will crash)\n * - objects (will be converted to `{}`)\n */\nexport function deepClone<T>(obj: T extends undefined ? never : T): T {\n return JSON.parse(JSON.stringify(obj));\n}\n","import {Apollo, gql, MutationResult} from 'apollo-angular';\nimport {FetchResult, NetworkStatus, WatchQueryFetchPolicy} from '@apollo/client/core';\nimport {AbstractControl, AsyncValidatorFn, UntypedFormControl, UntypedFormGroup, ValidatorFn} from '@angular/forms';\nimport {DocumentNode} from 'graphql';\nimport {defaults, merge, pick} from 'lodash-es';\nimport {catchError, combineLatest, EMPTY, first, from, Observable, of, OperatorFunction} from 'rxjs';\nimport {debounceTime, filter, map, shareReplay, startWith, switchMap, takeWhile, tap} from 'rxjs/operators';\nimport {NaturalQueryVariablesManager, QueryVariables} from '../classes/query-variable-manager';\nimport {Literal} from '../types/types';\nimport {makePlural, relationsToIds, upperCaseFirstLetter} from '../classes/utility';\nimport {PaginatedData} from '../classes/data-source';\nimport {NaturalDebounceService} from './debounce.service';\nimport {ApolloQueryResult} from '@apollo/client/core/types';\nimport {deepClone} from '../modules/search/classes/utils';\nimport {inject} from '@angular/core';\n\nexport type FormValidators = Record<string, ValidatorFn[]>;\n\nexport type FormAsyncValidators = Record<string, AsyncValidatorFn[]>;\n\nexport type VariablesWithInput = {\n input: Literal;\n};\n\nexport type FormControls = Record<string, AbstractControl>;\n\nexport type WithId<T> = {id: string} & T;\n\nexport abstract class NaturalAbstractModelService<\n Tone,\n Vone extends {id: string},\n Tall extends PaginatedData<Literal>,\n Vall extends QueryVariables,\n Tcreate,\n Vcreate extends VariablesWithInput,\n Tupdate,\n Vupdate extends {id: string; input: Literal},\n Tdelete,\n Vdelete extends {ids: string[]},\n> {\n /**\n * Store the creation mutations that are pending\n */\n private readonly creatingCache = new Map<Vcreate['input'] | WithId<Vupdate['input']>, Observable<Tcreate>>();\n protected readonly apollo = inject(Apollo);\n protected readonly naturalDebounceService = inject(NaturalDebounceService);\n private readonly plural: string;\n\n /**\n *\n * @param name service and single object query name (eg. userForFront or user).\n * @param oneQuery GraphQL query to fetch a single object from ID (eg. userForCrudQuery).\n * @param allQuery GraphQL query to fetch a filtered list of objects (eg. usersForCrudQuery).\n * @param createMutation GraphQL mutation to create an object.\n * @param updateMutation GraphQL mutation to update an object.\n * @param deleteMutation GraphQL mutation to delete a list of objects.\n * @param plural list query name (eg. usersForFront or users).\n * @param createName create object mutation name (eg. createUser).\n * @param updateName update object mutation name (eg. updateUser).\n * @param deleteName delete object mutation name (eg. deleteUsers).\n */\n public constructor(\n protected readonly name: string,\n protected readonly oneQuery: DocumentNode | null,\n protected readonly allQuery: DocumentNode | null,\n protected readonly createMutation: DocumentNode | null,\n protected readonly updateMutation: DocumentNode | null,\n protected readonly deleteMutation: DocumentNode | null,\n plural: string | null = null,\n private readonly createName: string | null = null,\n private readonly updateName: string | null = null,\n private readonly deleteName: string | null = null,\n ) {\n this.plural = plural ?? makePlural(this.name);\n }\n\n /**\n * List of individual fields validators\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormValidators(model?: Literal): FormValidators {\n return {};\n }\n\n /**\n * List of individual async fields validators\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormAsyncValidators(model?: Literal): FormAsyncValidators {\n return {};\n }\n\n /**\n * List of grouped fields validators (like password + confirm password)\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormGroupValidators(model?: Literal): ValidatorFn[] {\n return [];\n }\n\n /**\n * List of async group fields validators (like unique constraint on multiple columns)\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormGroupAsyncValidators(model?: Literal): AsyncValidatorFn[] {\n return [];\n }\n\n public getFormConfig(model: Literal): FormControls {\n const values = {...this.getDefaultForServer(), ...this.getFormExtraFieldDefaultValues()};\n const validators = this.getFormValidators(model);\n const asyncValidators = this.getFormAsyncValidators(model);\n const controls: FormControls = {};\n const disabled = model.permissions ? !model.permissions.update : false;\n\n if (model.id) {\n controls.id = new UntypedFormControl({value: model.id, disabled: true});\n }\n\n // Configure form for each field of model\n for (const key of Object.keys(values)) {\n const value = model[key] !== undefined ? model[key] : values[key];\n const formState = {\n value: value,\n disabled: disabled,\n };\n const validator = typeof validators[key] !== 'undefined' ? validators[key] : null;\n const asyncValidator = typeof asyncValidators[key] !== 'undefined' ? asyncValidators[key] : null;\n\n controls[key] = new UntypedFormControl(formState, validator, asyncValidator);\n }\n\n // Configure form for extra validators that are not on a specific field\n for (const key of Object.keys(validators)) {\n if (!controls[key]) {\n const formState = {\n value: model[key] ? model[key] : null,\n disabled: disabled,\n };\n\n controls[key] = new UntypedFormControl(formState, validators[key]);\n }\n }\n\n for (const key of Object.keys(asyncValidators)) {\n if (controls[key] && asyncValidators[key]) {\n controls[key].setAsyncValidators(asyncValidators[key]);\n } else {\n const formState = {\n value: model[key] ? model[key] : null,\n disabled: disabled,\n };\n\n controls[key] = new UntypedFormControl(formState, null, asyncValidators[key]);\n }\n }\n\n return controls;\n }\n\n /**\n * Create the final FormGroup for the object, including all validators\n *\n * This method should **not** be overridden, but instead `getFormConfig`,\n * `getFormGroupValidators`, `getFormGroupAsyncValidators` might be.\n */\n public getFormGroup(model: Literal): UntypedFormGroup {\n const formConfig = this.getFormConfig(deepClone(model));\n return new UntypedFormGroup(formConfig, {\n validators: this.getFormGroupValidators(model),\n asyncValidators: this.getFormGroupAsyncValidators(model),\n });\n }\n\n /**\n * Get a single object\n *\n * If available it will emit object from cache immediately, then it\n * will **always** fetch from network and then the observable will be completed.\n *\n * You must subscribe to start getting results (and fetch from network).\n */\n public getOne(id: string): Observable<Tone> {\n return this.prepareOneQuery(id, 'cache-and-network').pipe(\n takeWhile(result => result.networkStatus !== NetworkStatus.ready, true),\n map(result => (result.data as Literal)[this.name]),\n );\n }\n\n /**\n * Watch a single object\n *\n * If available it will emit object from cache immediately, then it\n * will **always** fetch from network, and then keep watching the cache forever.\n *\n * You must subscribe to start getting results (and fetch from network).\n *\n * You **MUST** unsubscribe.\n */\n public watchOne(id: string, fetchPolicy: WatchQueryFetchPolicy = 'cache-and-network'): Observable<Tone> {\n return this.prepareOneQuery(id, fetchPolicy).pipe(map(result => (result.data as Literal)[this.name]));\n }\n\n private prepareOneQuery(id: string, fetchPolicy: WatchQueryFetchPolicy): Observable<ApolloQueryResult<unknown>> {\n this.throwIfObservable(id);\n this.throwIfNotQuery(this.oneQuery);\n\n return this.getVariablesForOne(id).pipe(\n switchMap(variables => {\n this.throwIfNotQuery(this.oneQuery);\n\n return this.apollo.watchQuery<unknown, Vone>({\n query: this.oneQuery,\n variables: variables,\n fetchPolicy: fetchPolicy,\n nextFetchPolicy: 'cache-only',\n }).valueChanges;\n }),\n filter(result => !!result.data),\n );\n }\n\n /**\n * Get a collection of objects\n *\n * It will **always** fetch from network and then the observable will be completed.\n * No cache is ever used, so it's slow but correct.\n */\n public getAll(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<Tall> {\n this.throwIfNotQuery(this.allQuery);\n\n return this.getPartialVariablesForAll().pipe(\n first(),\n switchMap(partialVariables => {\n this.throwIfNotQuery(this.allQuery);\n\n // Copy manager to prevent to apply internal variables to external QueryVariablesManager\n const manager = new NaturalQueryVariablesManager<Vall>(queryVariablesManager);\n manager.merge('partial-variables', partialVariables);\n\n return this.apollo.query<unknown, Vall>({\n query: this.allQuery,\n variables: manager.variables.value,\n fetchPolicy: 'network-only',\n });\n }),\n this.mapAll(),\n );\n }\n\n /**\n * Get a collection of objects\n *\n * Every time the observable variables change, and they are not undefined,\n * it will return result from cache, then it will **always** fetch from network,\n * and then keep watching the cache forever.\n *\n * You must subscribe to start getting results (and fetch from network).\n *\n * You **MUST** unsubscribe.\n */\n public watchAll(\n queryVariablesManager: NaturalQueryVariablesManager<Vall>,\n fetchPolicy: WatchQueryFetchPolicy = 'cache-and-network',\n ): Observable<Tall> {\n this.throwIfNotQuery(this.allQuery);\n\n return combineLatest({\n variables: queryVariablesManager.variables.pipe(\n // Ignore very fast variable changes\n debounceTime(20),\n // Wait for variables to be defined to prevent duplicate query: with and without variables\n // Null is accepted value for \"no variables\"\n filter(variables => typeof variables !== 'undefined'),\n ),\n partialVariables: this.getPartialVariablesForAll(),\n }).pipe(\n switchMap(result => {\n // Apply partial variables from service\n // Copy manager to prevent to apply internal variables to external QueryVariablesManager\n const manager = new NaturalQueryVariablesManager<Vall>(queryVariablesManager);\n manager.merge('partial-variables', result.partialVariables);\n\n this.throwIfNotQuery(this.allQuery);\n\n return this.apollo\n .watchQuery<unknown, Vall>({\n query: this.allQuery,\n variables: manager.variables.value,\n fetchPolicy: fetchPolicy,\n })\n .valueChanges.pipe(\n catchError(() => EMPTY),\n filter(r => !!r.data),\n this.mapAll(),\n );\n }),\n );\n }\n\n /**\n * This functions allow to quickly create or update objects.\n *\n * Manages a \"creation is pending\" status, and update when creation is ready.\n * Uses regular update/updateNow and create methods.\n * Used mainly when editing multiple objects in same controller (like in editable arrays)\n */\n public createOrUpdate(\n object: Vcreate['input'] | WithId<Vupdate['input']>,\n now = false,\n ): Observable<Tcreate | Tupdate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.createMutation);\n this.throwIfNotQuery(this.updateMutation);\n\n // If creation is pending, listen to creation observable and when ready, fire update\n const pendingCreation = this.creatingCache.get(object);\n if (pendingCreation) {\n return pendingCreation.pipe(\n switchMap(created => {\n return this.update({\n id: (created as WithId<Tcreate>).id,\n ...(object as Vcreate['input']),\n });\n }),\n );\n }\n\n // If object has Id, just save it\n if ('id' in object && object.id) {\n if (now) {\n // used mainly for tests, because lodash debounced used in update() does not work fine with fakeAsync and tick()\n return this.updateNow(object as WithId<Vupdate['input']>);\n } else {\n return this.update(object as WithId<Vupdate['input']>);\n }\n }\n\n // If object was not saving, and has no ID, create it\n const creation = this.create(object).pipe(\n tap(() => {\n this.creatingCache.delete(object); // remove from cache\n }),\n );\n\n // stores creating observable in a cache replayable version of the observable,\n // so several update() can subscribe to the same creation\n this.creatingCache.set(object, creation.pipe(shareReplay()));\n\n return creation;\n }\n\n /**\n * Create an object in DB and then refetch the list of objects\n */\n public create(object: Vcreate['input']): Observable<Tcreate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.createMutation);\n\n const variables = merge(\n {},\n {input: this.getInput(object, true)},\n this.getPartialVariablesForCreation(object),\n ) as Vcreate;\n\n return this.apollo\n .mutate<Tcreate, Vcreate>({\n mutation: this.createMutation,\n variables: variables,\n })\n .pipe(\n map(result => {\n this.apollo.client.reFetchObservableQueries();\n return this.mapCreation(result);\n }),\n );\n }\n\n /**\n * Update an object, after a short debounce\n */\n public update(object: WithId<Vupdate['input']>): Observable<Tupdate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.updateMutation);\n\n // Keep a single instance of the debounced update function\n const id = object.id;\n\n return this.naturalDebounceService.debounce(this, id, object);\n }\n\n /**\n * Update an object immediately when subscribing\n */\n public updateNow(object: WithId<Vupdate['input']>): Observable<Tupdate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.updateMutation);\n\n const variables = merge(\n {\n id: object.id,\n input: this.getInput(object, false),\n },\n this.getPartialVariablesForUpdate(object),\n ) as Vupdate;\n\n return this.apollo\n .mutate<Tupdate, Vupdate>({\n mutation: this.updateMutation,\n variables: variables,\n })\n .pipe(\n map(result => {\n this.apollo.client.reFetchObservableQueries();\n return this.mapUpdate(result);\n }),\n );\n }\n\n /**\n * Delete objects and then refetch the list of objects\n */\n public delete(objects: {id: string}[]): Observable<Tdelete> {\n this.throwIfObservable(objects);\n this.throwIfNotQuery(this.deleteMutation);\n\n const ids = objects.map(o => {\n // Cancel pending update\n this.naturalDebounceService.cancelOne(this, o.id);\n\n return o.id;\n });\n const variables = merge(\n {\n ids: ids,\n },\n this.getPartialVariablesForDelete(objects),\n ) as Vdelete;\n\n return this.apollo\n .mutate<Tdelete, Vdelete>({\n mutation: this.deleteMutation,\n variables: variables,\n })\n .pipe(\n // Delay the observable until Apollo refetch is completed\n switchMap(result => {\n const mappedResult = this.mapDelete(result);\n\n return from(this.apollo.client.reFetchObservableQueries()).pipe(map(() => mappedResult));\n }),\n );\n }\n\n /**\n * If the id is provided, resolves an observable model. The observable model will only be emitted after we are sure\n * that Apollo cache is fresh and warm. Then the component can subscribe to the observable model to get the model\n * immediately from Apollo cache and any subsequents future mutations that may happen to Apollo cache.\n *\n * Without id, returns default values, in order to show a creation form.\n */\n public resolve(id: string | undefined): Observable<Observable<Tone | Vcreate['input']>> {\n if (id) {\n const onlyNetwork = this.watchOne(id, 'network-only').pipe(first());\n const onlyCache = this.watchOne(id, 'cache-first');\n\n // In theory, we can rely on Apollo Cache to return a result instantly. It is very fast indeed,\n // but it is still asynchronous, so there may be a very short time when we don't have the model\n // available. To fix that, we can rely on RxJS, which is able to emit synchronously the value we just\n // got from server. Once Apollo Client moves to RxJS (https://github.com/apollographql/apollo-feature-requests/issues/375),\n // we could try to remove `startWith()`.\n return onlyNetwork.pipe(map(firstValue => onlyCache.pipe(startWith(firstValue))));\n } else {\n return of(of(this.getDefaultForServer()));\n }\n }\n\n /**\n * Return an object that match the GraphQL input type.\n * It creates an object with manually filled data and add uncompleted data (like required attributes that can be empty strings)\n */\n public getInput(object: Literal, forCreation: boolean): Vcreate['input'] | Vupdate['input'] {\n // Convert relations to their IDs for mutation\n object = relationsToIds(object);\n\n // Pick only attributes that we can find in the empty object\n // In other words, prevent to select data that has unwanted attributes\n const emptyObject = this.getDefaultForServer();\n let input = pick(object, Object.keys(emptyObject));\n\n // Complete a potentially uncompleted object with default values\n if (forCreation) {\n input = defaults(input, emptyObject);\n }\n\n return input;\n }\n\n /**\n * Return the number of objects matching the query. It may never complete.\n *\n * This is used for the unique validator\n */\n public count(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<number> {\n const queryName = 'Count' + upperCaseFirstLetter(this.plural);\n const filterType = upperCaseFirstLetter(this.name) + 'Filter';\n\n const query = gql`\n query ${queryName} ($filter: ${filterType}) {\n count: ${this.plural} (filter: $filter, pagination: {pageSize: 0, pageIndex: 0}) {\n length\n }\n }`;\n\n return this.getPartialVariablesForAll().pipe(\n switchMap(partialVariables => {\n // Copy manager to prevent to apply internal variables to external QueryVariablesManager\n const manager = new NaturalQueryVariablesManager<Vall>(queryVariablesManager);\n manager.merge('partial-variables', partialVariables);\n\n return this.apollo.query<{count: {length: number}}, Vall>({\n query: query,\n variables: manager.variables.value,\n fetchPolicy: 'network-only',\n });\n }),\n map(result => result.data.count.length),\n );\n }\n\n /**\n * Return empty object with some default values from server perspective\n *\n * This is typically useful when showing a form for creation\n */\n public getDefaultForServer(): Vcreate['input'] {\n return {};\n }\n\n /**\n * You probably **should not** use this.\n *\n * If you are trying to *call* this method, instead you probably want to call `getDefaultForServer()` to get default\n * values for a model, or `getFormConfig()` to get a configured form that includes extra form fields.\n *\n * If you are trying to *override* this method, instead you probably want to override `getDefaultForServer()`.\n *\n * The only and **very rare** reason to override this method is if the client needs extra form fields that cannot be\n * accepted by the server (not part of `XXXInput` type) and that are strictly for the client form needs. In that case,\n * then you can return default values for those extra form fields, and the form returned by `getFormConfig()` will\n * include those extra fields.\n */\n protected getFormExtraFieldDefaultValues(): Literal {\n return {};\n }\n\n /**\n * This is used to extract only the array of fetched objects out of the entire fetched data\n */\n protected mapAll(): OperatorFunction<FetchResult<unknown>, Tall> {\n return map(result => (result.data as any)[this.plural]); // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * This is used to extract only the created object out of the entire fetched data\n */\n protected mapCreation(result: MutationResult<unknown>): Tcreate {\n const name = this.createName ?? 'create' + upperCaseFirstLetter(this.name);\n return (result.data as any)[name]; // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * This is used to extract only the updated object out of the entire fetched data\n */\n protected mapUpdate(result: MutationResult<unknown>): Tupdate {\n const name = this.updateName ?? 'update' + upperCaseFirstLetter(this.name);\n return (result.data as any)[name]; // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * This is used to extract only flag when deleting an object\n */\n protected mapDelete(result: MutationResult<unknown>): Tdelete {\n const name = this.deleteName ?? 'delete' + upperCaseFirstLetter(this.plural);\n return (result.data as any)[name]; // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * Returns additional variables to be used when getting a single object\n *\n * This is typically a site or state ID, and is needed to get appropriate access rights\n */\n protected getPartialVariablesForOne(): Observable<Partial<Vone>> {\n return of({});\n }\n\n /**\n * Returns additional variables to be used when getting multiple objects\n *\n * This is typically a site or state ID, but it could be something else to further filter the query\n */\n public getPartialVariablesForAll(): Observable<Partial<Vall>> {\n return of({});\n }\n\n /**\n * Returns additional variables to be used when creating an object\n *\n * This is typically a site or state ID\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getPartialVariablesForCreation(object: Literal): Partial<Vcreate> {\n return {};\n }\n\n /**\n * Returns additional variables to be used when updating an object\n *\n * This is typically a site or state ID\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getPartialVariablesForUpdate(object: Literal): Partial<Vupdate> {\n return {};\n }\n\n /**\n * Return additional variables to be used when deleting an object\n *\n * This is typically a site or state ID\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getPartialVariablesForDelete(objects: Literal[]): Partial<Vdelete> {\n return {};\n }\n\n /**\n * Throw exception to prevent executing queries with invalid variables\n */\n protected throwIfObservable(value: unknown): void {\n if (value instanceof Observable) {\n throw new Error(\n 'Cannot use Observable as variables. Instead you should use .subscribe() to call the method with a real value',\n );\n }\n }\n\n /**\n * Merge given ID with additional partial variables if there is any\n */\n private getVariablesForOne(id: string): Observable<Vone> {\n return this.getPartialVariablesForOne().pipe(\n map(partialVariables => merge({}, {id: id} as Vone, partialVariables)),\n );\n }\n\n /**\n * Throw exception to prevent executing null queries\n */\n private throwIfNotQuery(query: DocumentNode | null): asserts query {\n if (!query) {\n throw new Error('GraphQL query for this method was not configured in this service constructor');\n }\n }\n}\n","/**\n * **DO NOT MODIFY UNLESS STRICTLY REQUIRED FOR VANILLA**\n *\n * This is a minimal service specialized for Vanilla and any modification,\n * including adding `import` in this file, might break https://navigations.ichtus.club.\n */\n\nexport {NaturalQueryVariablesManager} from './src/lib/classes/query-variable-manager';\nexport type {Literal} from './src/lib/types/types';\nexport {graphqlQuerySigner} from './src/lib/classes/signing';\nexport {formatIsoDateTime} from './src/lib/classes/utility';\nexport {NaturalAbstractModelService, type FormValidators} from './src/lib/services/abstract-model.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["map","switchMap","debounceTime","shareReplay"],"mappings":";;;;;;;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AA;AAClD,QAAA,OAAO,EAAE;;AAGb;;;;AAIG;;AAEO,IAAA,4BAA4B,CAAC,OAAkB,EAAA;AACrD,QAAA,OAAO,EAAE;;AAGb;;AAEG;AACO,IAAA,iBAAiB,CAAC,KAAc,EAAA;AACtC,QAAA,IAAI,KAAK,YAAY,UAAU,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CACX,8GAA8G,CACjH;;;AAIT;;AAEG;AACK,IAAA,kBAAkB,CAAC,EAAU,EAAA;QACjC,OAAO,IAAI,CAAC,yBAAyB,EAAE,CAAC,IAAI,CACxCA,KAAG,CAAC,gBAAgB,IAAI,KAAK,CAAC,EAAE,EAAE,EAAC,EAAE,EAAE,EAAE,EAAS,EAAE,gBAAgB,CAAC,CAAC,CACzE;;AAGL;;AAEG;AACK,IAAA,eAAe,CAAC,KAA0B,EAAA;QAC9C,IAAI,CAAC,KAAK,EAAE;AACR,YAAA,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC;;;AAG1G;;ACvpBD;;;;;AAKG;;ACLH;;AAEG;;;;"}
1
+ {"version":3,"file":"ecodev-natural-vanilla.mjs","sources":["../../../projects/natural/src/lib/classes/utility.ts","../../../projects/natural/src/lib/modules/search/classes/graphql-doctrine.types.ts","../../../projects/natural/src/lib/classes/query-variable-manager-utils.ts","../../../projects/natural/src/lib/classes/query-variable-manager.ts","../../../projects/natural/src/lib/classes/crypto.ts","../../../projects/natural/src/lib/classes/signing.ts","../../../projects/natural/src/lib/services/debounce.service.ts","../../../projects/natural/src/lib/modules/search/classes/utils.ts","../../../projects/natural/src/lib/services/abstract-model.service.ts","../../../projects/natural/public-api.ts","../../../projects/natural/ecodev-natural-vanilla.ts"],"sourcesContent":["import {NavigationEnd, NavigationStart, Router} from '@angular/router';\nimport {pickBy} from 'es-toolkit';\nimport {Observable, switchMap, take} from 'rxjs';\nimport {filter} from 'rxjs/operators';\nimport type {ReadonlyDeep} from 'type-fest';\nimport {Literal} from '../types/types';\nimport {PaginationInput, Sorting, SortingOrder} from './query-variable-manager';\nimport {cloneDeepWith} from 'es-toolkit';\n\n/**\n * Very basic formatting to get only date, without time and ignoring entirely the timezone\n *\n * So something like: \"2021-09-23\"\n */\nexport function formatIsoDate(date: null): null;\nexport function formatIsoDate(date: Date): string;\nexport function formatIsoDate(date: Date | null): string | null;\nexport function formatIsoDate(date: Date | null): string | null {\n if (!date) {\n return null;\n }\n\n const y = date.getFullYear();\n const m = date.getMonth() + 1;\n const d = date.getDate();\n\n return y + '-' + (m < 10 ? '0' : '') + m + '-' + (d < 10 ? '0' : '') + d;\n}\n\n/**\n * Format a date and time in a way that will preserve the local time zone.\n * This allows the server side to know the day (without time) that was selected on client side.\n *\n * So something like: \"2021-09-23T17:57:16+09:00\"\n */\nexport function formatIsoDateTime(date: Date): string {\n const timezoneOffsetInMinutes = date.getTimezoneOffset();\n const timezoneOffsetInHours = -Math.trunc(timezoneOffsetInMinutes / 60); // UTC minus local time\n const sign = timezoneOffsetInHours >= 0 ? '+' : '-';\n const hoursLeadingZero = Math.abs(timezoneOffsetInHours) < 10 ? '0' : '';\n const remainderMinutes = -(timezoneOffsetInMinutes % 60);\n const minutesLeadingZero = Math.abs(remainderMinutes) < 10 ? '0' : '';\n\n // It's a bit unfortunate that we need to construct a new Date instance,\n // but we don't want the original Date instance to be modified\n const correctedDate = new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n date.getHours(),\n date.getMinutes(),\n date.getSeconds(),\n date.getMilliseconds(),\n );\n correctedDate.setHours(date.getHours() + timezoneOffsetInHours);\n\n const iso = correctedDate\n .toISOString()\n .replace(/\\.\\d{3}Z/, '')\n .replace('Z', '');\n\n return (\n iso +\n sign +\n hoursLeadingZero +\n Math.abs(timezoneOffsetInHours).toString() +\n ':' +\n minutesLeadingZero +\n remainderMinutes\n );\n}\n\n/**\n * Relations to full objects are converted to their IDs only.\n *\n * So {user: {id: 123}} becomes {user: 123}\n */\nexport function relationsToIds(object: Literal): Literal {\n const newObj: Literal = {};\n Object.keys(object).forEach(key => {\n let value: unknown = object[key];\n\n if (value === null || value === undefined) {\n // noop\n } else if (hasId(value)) {\n value = value.id;\n } else if (Array.isArray(value)) {\n value = value.map((i: unknown) => (hasId(i) ? i.id : i));\n } else if (typeof value === 'object' && !(value instanceof File) && !(value instanceof Date)) {\n value = pickBy(value, (v, k) => k !== '__typename'); // omit(value, ['__typename']) ?\n }\n\n newObj[key] = value;\n });\n\n return newObj;\n}\n\nfunction hasId(value: unknown): value is {id: unknown} {\n return !!value && typeof value === 'object' && 'id' in value && !!value.id;\n}\n\n/**\n * Returns the plural form of the given name\n *\n * This is **not** necessarily valid english grammar. Its only purpose is for internal usage, not for humans.\n *\n * This **MUST** be kept in sync with `\\Ecodev\\Felix\\Api\\Plural:make()`.\n *\n * This is a bit performance-sensitive, so we should keep it fast and only cover cases that we actually need.\n */\nexport function makePlural(name: string): string {\n // Words ending in a y preceded by a vowel form their plurals by adding -s:\n if (/[aeiou]y$/.exec(name)) {\n return name + 's';\n }\n\n const plural = name + 's';\n\n return plural.replace(/ys$/, 'ies').replace(/ss$/, 'ses').replace(/xs$/, 'xes');\n}\n\n/**\n * Returns the string with the first letter as capital\n */\nexport function upperCaseFirstLetter(term: string): string {\n return term.charAt(0).toUpperCase() + term.slice(1);\n}\n\n/**\n * Replace all attributes of first object with the ones provided by the second, but keeps the reference\n */\nexport function replaceObjectKeepingReference(obj: Literal | null, newObj: Literal | null): void {\n if (!obj || !newObj) {\n return;\n }\n\n Object.keys(obj).forEach(key => {\n delete obj[key];\n });\n\n Object.keys(newObj).forEach(key => {\n obj[key] = newObj[key];\n });\n}\n\n/**\n * Get contrasted color for text in the slider thumb\n * @param hexBgColor string in hexadecimals representing the background color\n */\nexport function getForegroundColor(hexBgColor: string): 'black' | 'white' {\n const rgb = hexToRgb(hexBgColor.slice(0, 7)); // splice remove alpha and consider only \"visible\" color at 100% alpha\n const o = Math.round((rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000);\n\n return o > 125 ? 'black' : 'white';\n}\n\nfunction hexToRgb(hex: string): {r: number; g: number; b: number} {\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n hex = hex.replace(shorthandRegex, (m, r, g, b) => {\n return r + r + g + g + b + b;\n });\n\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n return result\n ? {\n r: parseInt(result[1], 16),\n g: parseInt(result[2], 16),\n b: parseInt(result[3], 16),\n }\n : {\n r: 0,\n g: 0,\n b: 0,\n };\n}\n\n/**\n * Convert RGB color to hexadecimal color\n *\n * ```ts\n * rgbToHex('rgb(255, 00, 255)'); // '#FF00FF'\n * ```\n */\nexport function rgbToHex(rgb: string): string {\n const m = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/.exec(rgb);\n if (!m) {\n return rgb;\n }\n\n return '#' + [m[1], m[2], m[3]].map(x => parseInt(x).toString(16).toUpperCase().padStart(2, '0')).join('');\n}\n\n/**\n * Deep clone given values except for `File` that will be referencing the original value\n */\nexport function cloneDeepButSkipFile<T>(value: T): T {\n return cloneDeepWith(value, v => (isFile(v) ? v : undefined));\n}\n\nexport function isFile(value: unknown): boolean {\n return (\n (typeof File !== 'undefined' && value instanceof File) ||\n (typeof Blob !== 'undefined' && value instanceof Blob) ||\n (typeof FileList !== 'undefined' && value instanceof FileList)\n );\n}\n\n/**\n * During lodash.mergeWith, overrides arrays\n */\nexport function mergeOverrideArray(destValue: unknown, source: unknown): unknown {\n if (Array.isArray(source) || isFile(source)) {\n return source;\n }\n}\n\n/**\n * Copy text to clipboard.\n * Accepts line breaks `\\n` as textarea do.\n */\nexport function copyToClipboard(document: Document, text: string): void {\n const input = document.createElement('textarea');\n document.body.append(input);\n input.value = text;\n input.select();\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n document.execCommand('copy');\n document.body.removeChild(input);\n}\n\nexport function deepFreeze<T extends Literal>(o: T): ReadonlyDeep<T> {\n Object.values(o).forEach(v => Object.isFrozen(v) || deepFreeze(v));\n\n return Object.freeze(o) as ReadonlyDeep<T>;\n}\n\n/**\n * Return a valid PaginationInput from whatever is available from data. Invalid properties/types will be dropped.\n */\nexport function validatePagination(data: unknown): PaginationInput | null {\n if (!data || typeof data !== 'object' || Array.isArray(data)) {\n return null;\n }\n\n const pagination: PaginationInput = {};\n\n if ('offset' in data && (data.offset === null || typeof data.offset === 'number')) {\n pagination.offset = data.offset;\n }\n\n if ('pageIndex' in data && (data.pageIndex === null || typeof data.pageIndex === 'number')) {\n pagination.pageIndex = data.pageIndex;\n }\n\n if ('pageSize' in data && (data.pageSize === null || typeof data.pageSize === 'number')) {\n pagination.pageSize = data.pageSize;\n }\n\n return pagination;\n}\n\n/**\n * Return a valid Sortings from whatever is available from data. Invalid properties/types will be dropped.\n */\nexport function validateSorting(data: unknown): Sorting[] | null {\n if (!Array.isArray(data)) {\n return null;\n }\n const result: Sorting[] = [];\n data.forEach(s => {\n const r = validateOneSorting(s);\n if (r) {\n result.push(r);\n }\n });\n\n return result;\n}\n\nfunction validateOneSorting(data: unknown): Sorting | null {\n if (!data || typeof data !== 'object' || !('field' in data)) {\n return null;\n }\n\n const sorting: Sorting = {field: data.field};\n\n if (\n 'order' in data &&\n (data.order === SortingOrder.ASC || data.order === SortingOrder.DESC || data.order === null)\n ) {\n sorting.order = data.order;\n }\n\n if ('nullAsHighest' in data && (data.nullAsHighest === null || typeof data.nullAsHighest === 'boolean')) {\n sorting.nullAsHighest = data.nullAsHighest;\n }\n\n if (\n 'emptyStringAsHighest' in data &&\n (data.emptyStringAsHighest === null || typeof data.emptyStringAsHighest === 'boolean')\n ) {\n sorting.emptyStringAsHighest = data.emptyStringAsHighest;\n }\n\n return sorting;\n}\n\n/**\n * Return valid columns from whatever is available from data. Invalid properties/types will be dropped.\n */\nexport function validateColumns(data: unknown): string[] | null {\n if (typeof data !== 'string') {\n return null;\n }\n\n return data.split(',').filter(string => string);\n}\n\nexport function onHistoryEvent(router: Router): Observable<NavigationEnd> {\n return router.events.pipe(\n filter(e => e instanceof NavigationStart && e.navigationTrigger === 'popstate'),\n switchMap(() =>\n router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n take(1),\n ),\n ),\n );\n}\n","// Basic; loosely typed structure for graphql-doctrine filters\n\nimport {Literal} from '../../../types/types';\n\nexport type Filter = {\n groups?: FilterGroup[] | null;\n};\n\nexport type FilterGroup = {\n // The logic operator to be used to append this group\n groupLogic?: LogicalOperator | null;\n // The logic operator to be used within all conditions in this group\n conditionsLogic?: LogicalOperator | null;\n // Optional joins to either filter the query or fetch related objects from DB in a single query\n joins?: FilterGroupJoin | null;\n // Conditions to be applied on fields\n conditions?: FilterGroupCondition[] | null;\n};\n\nexport type FilterGroupJoin = Record<string, JoinOn>;\n\nexport type JoinOn = {\n type?: JoinType | null;\n // Optional joins to either filter the query or fetch related objects from DB in a single query\n joins?: FilterGroupJoin | null;\n // Conditions to be applied on fields\n conditions?: FilterGroupCondition[] | null;\n};\n\n// Logical operator to be used in conditions\nexport enum LogicalOperator {\n AND = 'AND',\n OR = 'OR',\n}\n\n// Join types to be used in DQL\nexport enum JoinType {\n innerJoin = 'innerJoin',\n leftJoin = 'leftJoin',\n}\n\nexport type FilterGroupCondition = Record<string, FilterGroupConditionField>;\n\nexport type FilterGroupConditionField = {\n between?: BetweenOperator | null;\n equal?: EqualOperator | null;\n greater?: GreaterOperator | null;\n greaterOrEqual?: GreaterOrEqualOperator | null;\n in?: InOperator | null;\n less?: LessOperator | null;\n lessOrEqual?: LessOrEqualOperator | null;\n like?: LikeOperator | null;\n null?: NullOperator | null;\n\n // For relations\n have?: HaveOperator | null;\n empty?: EmptyOperator | null;\n\n // Allow anything else for custom operators\n [key: string]: Literal | undefined | null;\n};\n\nexport type Scalar = number | string | boolean;\n\nexport type HaveOperator = {\n values: string[];\n not?: boolean | null;\n};\n\nexport type EmptyOperator = {\n not?: boolean | null;\n};\n\nexport type BetweenOperator = {\n from: Scalar;\n to: Scalar;\n not?: boolean | null;\n};\n\nexport type EqualOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type GreaterOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type GreaterOrEqualOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type InOperator = {\n values: Scalar[];\n not?: boolean | null;\n};\n\nexport type LessOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type LessOrEqualOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type LikeOperator = {\n value: Scalar;\n not?: boolean | null;\n};\n\nexport type NullOperator = {\n not?: boolean | null;\n};\n","import {cloneDeep, groupBy, uniq} from 'es-toolkit';\nimport {LogicalOperator} from '../modules/search/classes/graphql-doctrine.types';\nimport {Literal} from '../types/types';\n\nexport function hasMixedGroupLogic(groups: Literal[]): boolean {\n // Complete lack of definition by fallback on AND operator\n const completedGroups = cloneDeep(groups).map(group => {\n if (!group.groupLogic) {\n group.groupLogic = LogicalOperator.AND;\n }\n\n return group;\n });\n\n const groupLogics = uniq(Object.keys(groupBy(completedGroups.slice(1), group => group.groupLogic)));\n\n return groupLogics.length > 1;\n}\n","import {defaultsDeep, mergeWith} from 'es-toolkit/compat';\nimport {cloneDeep, omit} from 'es-toolkit';\nimport {BehaviorSubject} from 'rxjs';\nimport {Literal} from '../types/types';\nimport {cloneDeepButSkipFile, isFile, mergeOverrideArray} from './utility';\nimport {hasMixedGroupLogic} from './query-variable-manager-utils';\n\nexport type QueryVariables = {\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n filter?: any | null;\n pagination?: PaginationInput | null;\n sorting?: Sorting[] | null;\n};\n\nexport type PaginationInput = {\n offset?: number | null;\n pageIndex?: number | null;\n pageSize?: number | null;\n};\n\nexport type Sorting = {\n field: any;\n order?: SortingOrder | null;\n nullAsHighest?: boolean | null;\n emptyStringAsHighest?: boolean | null;\n};\n\nexport enum SortingOrder {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\n/**\n * During lodash merge, concat arrays\n */\nfunction mergeConcatArray(destValue: unknown, source: unknown): unknown {\n if (isFile(source)) {\n return source;\n }\n\n if (Array.isArray(source)) {\n if (Array.isArray(destValue)) {\n return destValue.concat(source);\n } else {\n return source;\n }\n }\n}\n\n/**\n * Filter manager stores a set of channels that contain a variable object and exposes an observable \"variables\" that updates with the result\n * of all channels merged together.\n *\n * A channel is supposed to be used by a given aspect of the GUI (pagination, sorting, search, others ?).\n *\n * ```ts\n * const fm = new QueryVariablesManager();\n * fm.merge('componentA-variables', {a : [1, 2, 3]});\n * ```\n *\n * Variables attributes is a BehaviorSubject. That mean it's not mandatory to subscribe, we can just call getValue or value attributes on\n * it :\n *\n * ```ts\n * console.log(fm.variables.value); // {a : [1, 2, 3]}\n * ```\n *\n * Set new variables for 'componentA-variables':\n *\n * ```ts\n * fm.merge('componentA-variables', {a : [1, 2]});\n * console.log(fm.variables.value); // {a : [1, 2, 3]}\n * ```\n *\n * Set new variables for new channel:\n *\n * ```ts\n * fm.merge('componentB-variables', {a : [3, 4]});\n * console.log(fm.variables.value); // {a : [1, 2, 3, 4]}\n * ```\n */\nexport class NaturalQueryVariablesManager<T extends QueryVariables = QueryVariables> {\n public readonly variables = new BehaviorSubject<T | undefined>(undefined);\n private readonly channels = new Map<string, Partial<T>>();\n\n public constructor(queryVariablesManager?: NaturalQueryVariablesManager<T>) {\n if (queryVariablesManager) {\n this.channels = queryVariablesManager.getChannelsCopy();\n this.updateVariables();\n }\n }\n\n /**\n * Set or override all the variables that may exist in the given channel\n */\n public set(channelName: string, variables: Partial<T> | null | undefined): void {\n // cloneDeep to change reference and prevent some interactions when merge\n if (variables) {\n this.channels.set(channelName, cloneDeepButSkipFile(variables));\n } else {\n this.channels.delete(channelName);\n }\n this.updateVariables();\n }\n\n /**\n * Return a deep clone of the variables for the given channel name.\n *\n * Avoid returning the same reference to prevent an attribute change, then another channel update that would\n * used this changed attribute without having explicitly asked QueryVariablesManager to update it.\n */\n public get(channelName: string): Partial<T> | undefined {\n return cloneDeepButSkipFile(this.channels.get(channelName));\n }\n\n /**\n * Merge variable into a channel, overriding arrays in same channel / key\n */\n public merge(channelName: string, newVariables: Partial<T>): void {\n const variables = this.channels.get(channelName);\n if (variables) {\n mergeWith(variables, cloneDeep(newVariables), mergeOverrideArray); // merge preserves references, cloneDeep prevent that\n this.updateVariables();\n } else {\n this.set(channelName, newVariables);\n }\n }\n\n /**\n * Apply default values to a channel\n * Note : lodash defaults only defines values on destinations keys that are undefined\n */\n public defaults(channelName: string, newVariables: Partial<T>): void {\n const variables = this.channels.get(channelName);\n if (variables) {\n defaultsDeep(variables, newVariables);\n this.updateVariables();\n } else {\n this.set(channelName, newVariables);\n }\n }\n\n private getChannelsCopy(): Map<string, Partial<T>> {\n return new Map<string, Partial<T>>(this.channels);\n }\n\n /**\n * Merge channels in a single object\n * Arrays are concatenated\n * Filter groups are combined smartly (see mergeGroupList)\n */\n private updateVariables(): void {\n const merged: T = {} as T;\n\n this.channels.forEach(channelVariables => {\n if (channelVariables.filter) {\n // Merge filter's groups first\n const groups = this.mergeGroupList(\n merged.filter?.groups ? merged.filter.groups : [],\n channelVariables.filter.groups || [],\n );\n\n // Merge filter key (that contain groups)\n if (groups?.length) {\n if (merged.filter) {\n merged.filter.groups = groups;\n } else {\n merged.filter = {groups: groups};\n }\n } else {\n mergeWith(merged, {filter: channelVariables.filter}, mergeConcatArray);\n }\n }\n\n // Merge other attributes than filter\n mergeWith(merged, omit(channelVariables, ['filter']), mergeConcatArray);\n });\n\n this.variables.next(merged);\n }\n\n /**\n * Cross merge two filters\n * Only accepts groups with same groupLogic (ignores the first one, because there is no groupLogic in this one)\n * @throws In case two non-empty lists of groups are given and at one of them mix groupLogic value, throws an error\n */\n private mergeGroupList(groupsA: Literal[], groupsB: Literal[]): Literal {\n if (groupsA.length === 0 && groupsB.length === 0) {\n return []; // empty listings, return empty lists\n }\n\n if (groupsA.length === 0 && groupsB.length > 0) {\n return groupsB; // One list is empty, return the one that is not\n }\n\n if (groupsB.length === 0 && groupsA.length > 0) {\n return groupsA; // One list is empty, return the one that is not\n }\n\n const groups: Literal[] = [];\n\n if (hasMixedGroupLogic(groupsA) || hasMixedGroupLogic(groupsB)) {\n throw Error('QueryVariables groups contain mixed group logics');\n }\n\n groupsA.forEach(groupA => {\n groupsB.forEach(groupB => {\n groups.push(mergeWith(cloneDeep(groupA), groupB, mergeConcatArray));\n });\n });\n\n return groups;\n }\n}\n","function bufferToHexa(hashBuffer: ArrayBuffer): string {\n const hashArray = new Uint8Array(hashBuffer); // convert buffer to byte array\n return hashArray.reduce((result, byte) => result + byte.toString(16).padStart(2, '0'), ''); // convert bytes to hex string\n}\n\n/**\n * Thin wrapper around browsers' native SubtleCrypto for convenience of use\n */\nexport async function sha256(message: string): Promise<string> {\n const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array\n const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); // hash the message\n\n return bufferToHexa(hashBuffer);\n}\n\n/**\n * Thin wrapper around browsers' native SubtleCrypto for convenience of use\n */\nexport async function hmacSha256(secret: string, payload: string): Promise<string> {\n const encoder = new TextEncoder();\n const algorithm: HmacKeyGenParams = {name: 'HMAC', hash: 'SHA-256'};\n\n const key = await crypto.subtle.importKey('raw', encoder.encode(secret), algorithm, false, ['sign']);\n const signature = await crypto.subtle.sign(algorithm.name, key, encoder.encode(payload));\n\n return bufferToHexa(signature);\n}\n","import {HttpInterceptorFn, HttpRequest} from '@angular/common/http';\nimport {hmacSha256} from './crypto';\nimport {from, switchMap, throwError} from 'rxjs';\n\nfunction getOperations(req: HttpRequest<unknown>): string {\n if (req.body instanceof FormData) {\n const operations = req.body.get('operations');\n if (typeof operations !== 'string') {\n throw new Error(\n 'Cannot sign a GraphQL query that is using FormData but that is missing the key `operations`',\n );\n }\n return operations;\n } else {\n return JSON.stringify(req.body);\n }\n}\n\n/**\n * Sign all HTTP POST requests that are GraphQL queries against `/graphql` endpoint with a custom signature.\n *\n * The server will validate the signature before executing the GraphQL query.\n */\nexport function graphqlQuerySigner(key: string): HttpInterceptorFn {\n // Validates the configuration exactly 1 time (not for\n // every query), and if not reject **all** HTTP requests\n if (!key) {\n return () =>\n throwError(\n () =>\n new Error(\n 'graphqlQuerySigner requires a non-empty key. Configure it in local.php under signedQueries.',\n ),\n );\n }\n\n return (req, next) => {\n const mustSign = req.method === 'POST' && /\\/graphql(\\?|$)/.exec(req.url);\n if (!mustSign) {\n return next(req);\n }\n\n const operations = getOperations(req);\n const timestamp = Math.round(Date.now() / 1000);\n const payload = timestamp + operations;\n\n return from(hmacSha256(key, payload)).pipe(\n switchMap(hash => {\n const header = `v1.${timestamp}.${hash}`;\n const signedRequest = req.clone({\n headers: req.headers.set('X-Signature', header),\n });\n\n return next(signedRequest);\n }),\n );\n };\n}\n","import {\n catchError,\n debounceTime,\n EMPTY,\n forkJoin,\n map,\n mergeMap,\n Observable,\n of,\n raceWith,\n ReplaySubject,\n shareReplay,\n Subject,\n take,\n} from 'rxjs';\nimport {Injectable} from '@angular/core';\nimport {UntypedModelService} from '../types/types';\n\ntype Debounced<T extends UntypedModelService> = {\n object: Parameters<T['updateNow']>[0];\n modelService: T;\n debouncer: Subject<void>;\n canceller: Subject<void>;\n flusher: Subject<void>;\n result: ReturnType<T['updateNow']>;\n};\n\n/**\n * Debounce subscriptions to update mutations, with the possibility to cancel one, flush one, or flush all of them.\n *\n * `modelService` is also used to separate objects by their types. So User with ID 1 is not confused with Product with ID 1.\n *\n * `id` must be the ID of the object that will be updated.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class NaturalDebounceService {\n /**\n * Stores the debounced update function\n */\n private readonly allDebouncedUpdateCache = new Map<\n UntypedModelService,\n Map<string, Debounced<UntypedModelService>>\n >();\n\n /**\n * Debounce the `modelService.updateNow()` mutation for a short time. If called multiple times with the same\n * modelService and id, it will postpone the subscription to the mutation.\n *\n * All input variables for the same object (same service and ID) will be cumulated over time. So it is possible\n * to update `field1`, then `field2`, and they will be batched into a single XHR including `field1` and `field2`.\n *\n * But it will always keep the same debouncing timeline.\n */\n public debounce<T extends UntypedModelService>(\n modelService: UntypedModelService,\n id: string,\n object: Parameters<T['updateNow']>[0],\n ): ReturnType<T['updateNow']> {\n const debouncedUpdateCache = this.getMap(modelService);\n let debounced = debouncedUpdateCache.get(id) as Debounced<T> | undefined;\n\n if (debounced) {\n debounced.object = {\n ...debounced.object,\n ...object,\n };\n } else {\n const debouncer = new ReplaySubject<void>(1);\n let wasCancelled = false;\n const canceller = new Subject<void>();\n canceller.subscribe(() => {\n wasCancelled = true;\n debouncer.complete();\n canceller.complete();\n this.delete(modelService, id);\n });\n\n const flusher = new Subject<void>();\n\n debounced = {\n object,\n debouncer,\n canceller,\n flusher,\n modelService: modelService as T,\n result: debouncer.pipe(\n debounceTime(2000), // Wait 2 seconds...\n raceWith(flusher), // ...unless flusher is triggered\n take(1),\n mergeMap(() => {\n this.delete(modelService, id);\n\n if (wasCancelled || !debounced) {\n return EMPTY;\n }\n\n return modelService.updateNow(debounced.object);\n }),\n shareReplay(), // All attempts to update will share the exact same single result from API\n ) as ReturnType<T['updateNow']>,\n };\n\n debouncedUpdateCache.set(id, debounced);\n }\n\n // Notify our debounced update each time we ask to update\n debounced.debouncer.next();\n\n // Return and observable that is updated when mutation is done\n return debounced.result;\n }\n\n public cancelOne(modelService: UntypedModelService, id: string): void {\n const debounced = this.allDebouncedUpdateCache.get(modelService)?.get(id);\n debounced?.canceller.next();\n }\n\n /**\n * Immediately execute the pending update, if any.\n *\n * It should typically be called before resolving the object, to mutate it before re-fetching it from server.\n *\n * The returned observable will complete when the update completes, even if it errors.\n */\n public flushOne(modelService: UntypedModelService, id: string): Observable<void> {\n const debounced = this.allDebouncedUpdateCache.get(modelService)?.get(id);\n\n return this.internalFlush(debounced ? [debounced] : []);\n }\n\n /**\n * Immediately execute all pending updates.\n *\n * It should typically be called before login out.\n *\n * The returned observable will complete when all updates complete, even if some of them error.\n */\n public flush(): Observable<void> {\n const all: Debounced<UntypedModelService>[] = [];\n this.allDebouncedUpdateCache.forEach(map => map.forEach(debounced => all.push(debounced)));\n\n return this.internalFlush(all);\n }\n\n private internalFlush(debounceds: Debounced<UntypedModelService>[]): Observable<void> {\n const all: Observable<unknown>[] = [];\n const allFlusher: Subject<void>[] = [];\n\n debounceds.forEach(debounced => {\n all.push(debounced.result.pipe(catchError(() => of(undefined))));\n allFlusher.push(debounced.flusher);\n });\n\n if (!all.length) {\n all.push(of(undefined));\n }\n\n return new Observable(subscriber => {\n const subscription = forkJoin(all)\n .pipe(map(() => undefined))\n .subscribe(subscriber);\n\n // Flush only after subscription process is finished\n allFlusher.forEach(flusher => flusher.next());\n\n return subscription;\n });\n }\n\n /**\n * Count of pending updates\n */\n public get count(): number {\n let count = 0;\n this.allDebouncedUpdateCache.forEach(map => (count += map.size));\n\n return count;\n }\n\n private getMap<T extends UntypedModelService>(modelService: T): Map<string, Debounced<T>> {\n let debouncedUpdateCache = this.allDebouncedUpdateCache.get(modelService);\n if (!debouncedUpdateCache) {\n debouncedUpdateCache = new Map<string, Debounced<UntypedModelService>>();\n this.allDebouncedUpdateCache.set(modelService, debouncedUpdateCache);\n }\n\n return debouncedUpdateCache as Map<string, Debounced<T>>;\n }\n\n private delete(modelService: UntypedModelService, id: string): void {\n const map = this.allDebouncedUpdateCache.get(modelService);\n if (!map) {\n return;\n }\n\n map.delete(id);\n\n if (!map.size) {\n this.allDebouncedUpdateCache.delete(modelService);\n }\n }\n}\n","import {Facet, NaturalSearchFacets} from '../types/facet';\nimport {NaturalSearchSelection} from '../types/values';\n\n/**\n * Lookup a facet by its `name` and then by its `field`, or return null if not found\n */\nexport function getFacetFromSelection(\n facets: NaturalSearchFacets | null,\n selection: NaturalSearchSelection,\n): Facet | null {\n if (!facets) {\n return null;\n }\n\n return (\n facets.find(facet => facet.name != null && facet.name === selection.name) ||\n facets.find(facet => facet.field === selection.field) ||\n null\n );\n}\n\n/**\n * Deep clone a literal via JSON serializing/unserializing\n *\n * It will **not** work with:\n *\n * - functions (will be removed)\n * - `undefined` (will be removed)\n * - cyclic references (will crash)\n * - objects (will be converted to `{}`)\n */\nexport function deepClone<T>(obj: T extends undefined ? never : T): T {\n return JSON.parse(JSON.stringify(obj));\n}\n","import {Apollo, gql, MutationResult} from 'apollo-angular';\nimport {FetchResult, NetworkStatus, WatchQueryFetchPolicy} from '@apollo/client/core';\nimport {AbstractControl, AsyncValidatorFn, UntypedFormControl, UntypedFormGroup, ValidatorFn} from '@angular/forms';\nimport {DocumentNode} from 'graphql';\nimport {merge, pick} from 'es-toolkit';\nimport {defaults} from 'es-toolkit/compat';\nimport {catchError, combineLatest, EMPTY, first, from, Observable, of, OperatorFunction} from 'rxjs';\nimport {debounceTime, filter, map, shareReplay, startWith, switchMap, takeWhile, tap} from 'rxjs/operators';\nimport {NaturalQueryVariablesManager, QueryVariables} from '../classes/query-variable-manager';\nimport {Literal} from '../types/types';\nimport {makePlural, relationsToIds, upperCaseFirstLetter} from '../classes/utility';\nimport {PaginatedData} from '../classes/data-source';\nimport {NaturalDebounceService} from './debounce.service';\nimport {ApolloQueryResult} from '@apollo/client/core/types';\nimport {deepClone} from '../modules/search/classes/utils';\nimport {inject} from '@angular/core';\n\nexport type FormValidators = Record<string, ValidatorFn[]>;\n\nexport type FormAsyncValidators = Record<string, AsyncValidatorFn[]>;\n\nexport type VariablesWithInput = {\n input: Literal;\n};\n\nexport type FormControls = Record<string, AbstractControl>;\n\nexport type WithId<T> = {id: string} & T;\n\nexport abstract class NaturalAbstractModelService<\n Tone,\n Vone extends {id: string},\n Tall extends PaginatedData<Literal>,\n Vall extends QueryVariables,\n Tcreate,\n Vcreate extends VariablesWithInput,\n Tupdate,\n Vupdate extends {id: string; input: Literal},\n Tdelete,\n Vdelete extends {ids: string[]},\n> {\n /**\n * Store the creation mutations that are pending\n */\n private readonly creatingCache = new Map<Vcreate['input'] | WithId<Vupdate['input']>, Observable<Tcreate>>();\n protected readonly apollo = inject(Apollo);\n protected readonly naturalDebounceService = inject(NaturalDebounceService);\n private readonly plural: string;\n\n /**\n *\n * @param name service and single object query name (eg. userForFront or user).\n * @param oneQuery GraphQL query to fetch a single object from ID (eg. userForCrudQuery).\n * @param allQuery GraphQL query to fetch a filtered list of objects (eg. usersForCrudQuery).\n * @param createMutation GraphQL mutation to create an object.\n * @param updateMutation GraphQL mutation to update an object.\n * @param deleteMutation GraphQL mutation to delete a list of objects.\n * @param plural list query name (eg. usersForFront or users).\n * @param createName create object mutation name (eg. createUser).\n * @param updateName update object mutation name (eg. updateUser).\n * @param deleteName delete object mutation name (eg. deleteUsers).\n */\n public constructor(\n protected readonly name: string,\n protected readonly oneQuery: DocumentNode | null,\n protected readonly allQuery: DocumentNode | null,\n protected readonly createMutation: DocumentNode | null,\n protected readonly updateMutation: DocumentNode | null,\n protected readonly deleteMutation: DocumentNode | null,\n plural: string | null = null,\n private readonly createName: string | null = null,\n private readonly updateName: string | null = null,\n private readonly deleteName: string | null = null,\n ) {\n this.plural = plural ?? makePlural(this.name);\n }\n\n /**\n * List of individual fields validators\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormValidators(model?: Literal): FormValidators {\n return {};\n }\n\n /**\n * List of individual async fields validators\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormAsyncValidators(model?: Literal): FormAsyncValidators {\n return {};\n }\n\n /**\n * List of grouped fields validators (like password + confirm password)\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormGroupValidators(model?: Literal): ValidatorFn[] {\n return [];\n }\n\n /**\n * List of async group fields validators (like unique constraint on multiple columns)\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n public getFormGroupAsyncValidators(model?: Literal): AsyncValidatorFn[] {\n return [];\n }\n\n public getFormConfig(model: Literal): FormControls {\n const values = {...this.getDefaultForServer(), ...this.getFormExtraFieldDefaultValues()};\n const validators = this.getFormValidators(model);\n const asyncValidators = this.getFormAsyncValidators(model);\n const controls: FormControls = {};\n const disabled = model.permissions ? !model.permissions.update : false;\n\n if (model.id) {\n controls.id = new UntypedFormControl({value: model.id, disabled: true});\n }\n\n // Configure form for each field of model\n for (const key of Object.keys(values)) {\n const value = model[key] !== undefined ? model[key] : values[key];\n const formState = {\n value: value,\n disabled: disabled,\n };\n const validator = typeof validators[key] !== 'undefined' ? validators[key] : null;\n const asyncValidator = typeof asyncValidators[key] !== 'undefined' ? asyncValidators[key] : null;\n\n controls[key] = new UntypedFormControl(formState, validator, asyncValidator);\n }\n\n // Configure form for extra validators that are not on a specific field\n for (const key of Object.keys(validators)) {\n if (!controls[key]) {\n const formState = {\n value: model[key] ? model[key] : null,\n disabled: disabled,\n };\n\n controls[key] = new UntypedFormControl(formState, validators[key]);\n }\n }\n\n for (const key of Object.keys(asyncValidators)) {\n if (controls[key] && asyncValidators[key]) {\n controls[key].setAsyncValidators(asyncValidators[key]);\n } else {\n const formState = {\n value: model[key] ? model[key] : null,\n disabled: disabled,\n };\n\n controls[key] = new UntypedFormControl(formState, null, asyncValidators[key]);\n }\n }\n\n return controls;\n }\n\n /**\n * Create the final FormGroup for the object, including all validators\n *\n * This method should **not** be overridden, but instead `getFormConfig`,\n * `getFormGroupValidators`, `getFormGroupAsyncValidators` might be.\n */\n public getFormGroup(model: Literal): UntypedFormGroup {\n const formConfig = this.getFormConfig(deepClone(model));\n return new UntypedFormGroup(formConfig, {\n validators: this.getFormGroupValidators(model),\n asyncValidators: this.getFormGroupAsyncValidators(model),\n });\n }\n\n /**\n * Get a single object\n *\n * If available it will emit object from cache immediately, then it\n * will **always** fetch from network and then the observable will be completed.\n *\n * You must subscribe to start getting results (and fetch from network).\n */\n public getOne(id: string): Observable<Tone> {\n return this.prepareOneQuery(id, 'cache-and-network').pipe(\n takeWhile(result => result.networkStatus !== NetworkStatus.ready, true),\n map(result => (result.data as Literal)[this.name]),\n );\n }\n\n /**\n * Watch a single object\n *\n * If available it will emit object from cache immediately, then it\n * will **always** fetch from network, and then keep watching the cache forever.\n *\n * You must subscribe to start getting results (and fetch from network).\n *\n * You **MUST** unsubscribe.\n */\n public watchOne(id: string, fetchPolicy: WatchQueryFetchPolicy = 'cache-and-network'): Observable<Tone> {\n return this.prepareOneQuery(id, fetchPolicy).pipe(map(result => (result.data as Literal)[this.name]));\n }\n\n private prepareOneQuery(id: string, fetchPolicy: WatchQueryFetchPolicy): Observable<ApolloQueryResult<unknown>> {\n this.throwIfObservable(id);\n this.throwIfNotQuery(this.oneQuery);\n\n return this.getVariablesForOne(id).pipe(\n switchMap(variables => {\n this.throwIfNotQuery(this.oneQuery);\n\n return this.apollo.watchQuery<unknown, Vone>({\n query: this.oneQuery,\n variables: variables,\n fetchPolicy: fetchPolicy,\n nextFetchPolicy: 'cache-only',\n }).valueChanges;\n }),\n filter(result => !!result.data),\n );\n }\n\n /**\n * Get a collection of objects\n *\n * It will **always** fetch from network and then the observable will be completed.\n * No cache is ever used, so it's slow but correct.\n */\n public getAll(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<Tall> {\n this.throwIfNotQuery(this.allQuery);\n\n return this.getPartialVariablesForAll().pipe(\n first(),\n switchMap(partialVariables => {\n this.throwIfNotQuery(this.allQuery);\n\n // Copy manager to prevent to apply internal variables to external QueryVariablesManager\n const manager = new NaturalQueryVariablesManager<Vall>(queryVariablesManager);\n manager.merge('partial-variables', partialVariables);\n\n return this.apollo.query<unknown, Vall>({\n query: this.allQuery,\n variables: manager.variables.value,\n fetchPolicy: 'network-only',\n });\n }),\n this.mapAll(),\n );\n }\n\n /**\n * Get a collection of objects\n *\n * Every time the observable variables change, and they are not undefined,\n * it will return result from cache, then it will **always** fetch from network,\n * and then keep watching the cache forever.\n *\n * You must subscribe to start getting results (and fetch from network).\n *\n * You **MUST** unsubscribe.\n */\n public watchAll(\n queryVariablesManager: NaturalQueryVariablesManager<Vall>,\n fetchPolicy: WatchQueryFetchPolicy = 'cache-and-network',\n ): Observable<Tall> {\n this.throwIfNotQuery(this.allQuery);\n\n return combineLatest({\n variables: queryVariablesManager.variables.pipe(\n // Ignore very fast variable changes\n debounceTime(20),\n // Wait for variables to be defined to prevent duplicate query: with and without variables\n // Null is accepted value for \"no variables\"\n filter(variables => typeof variables !== 'undefined'),\n ),\n partialVariables: this.getPartialVariablesForAll(),\n }).pipe(\n switchMap(result => {\n // Apply partial variables from service\n // Copy manager to prevent to apply internal variables to external QueryVariablesManager\n const manager = new NaturalQueryVariablesManager<Vall>(queryVariablesManager);\n manager.merge('partial-variables', result.partialVariables);\n\n this.throwIfNotQuery(this.allQuery);\n\n return this.apollo\n .watchQuery<unknown, Vall>({\n query: this.allQuery,\n variables: manager.variables.value,\n fetchPolicy: fetchPolicy,\n })\n .valueChanges.pipe(\n catchError(() => EMPTY),\n filter(r => !!r.data),\n this.mapAll(),\n );\n }),\n );\n }\n\n /**\n * This functions allow to quickly create or update objects.\n *\n * Manages a \"creation is pending\" status, and update when creation is ready.\n * Uses regular update/updateNow and create methods.\n * Used mainly when editing multiple objects in same controller (like in editable arrays)\n */\n public createOrUpdate(\n object: Vcreate['input'] | WithId<Vupdate['input']>,\n now = false,\n ): Observable<Tcreate | Tupdate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.createMutation);\n this.throwIfNotQuery(this.updateMutation);\n\n // If creation is pending, listen to creation observable and when ready, fire update\n const pendingCreation = this.creatingCache.get(object);\n if (pendingCreation) {\n return pendingCreation.pipe(\n switchMap(created => {\n return this.update({\n id: (created as WithId<Tcreate>).id,\n ...(object as Vcreate['input']),\n });\n }),\n );\n }\n\n // If object has Id, just save it\n if ('id' in object && object.id) {\n if (now) {\n // used mainly for tests, because lodash debounced used in update() does not work fine with fakeAsync and tick()\n return this.updateNow(object as WithId<Vupdate['input']>);\n } else {\n return this.update(object as WithId<Vupdate['input']>);\n }\n }\n\n // If object was not saving, and has no ID, create it\n const creation = this.create(object).pipe(\n tap(() => {\n this.creatingCache.delete(object); // remove from cache\n }),\n );\n\n // stores creating observable in a cache replayable version of the observable,\n // so several update() can subscribe to the same creation\n this.creatingCache.set(object, creation.pipe(shareReplay()));\n\n return creation;\n }\n\n /**\n * Create an object in DB and then refetch the list of objects\n */\n public create(object: Vcreate['input']): Observable<Tcreate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.createMutation);\n\n const variables = merge(\n {input: this.getInput(object, true)},\n this.getPartialVariablesForCreation(object),\n ) as Vcreate;\n\n return this.apollo\n .mutate<Tcreate, Vcreate>({\n mutation: this.createMutation,\n variables: variables,\n })\n .pipe(\n map(result => {\n this.apollo.client.reFetchObservableQueries();\n return this.mapCreation(result);\n }),\n );\n }\n\n /**\n * Update an object, after a short debounce\n */\n public update(object: WithId<Vupdate['input']>): Observable<Tupdate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.updateMutation);\n\n // Keep a single instance of the debounced update function\n const id = object.id;\n\n return this.naturalDebounceService.debounce(this, id, object);\n }\n\n /**\n * Update an object immediately when subscribing\n */\n public updateNow(object: WithId<Vupdate['input']>): Observable<Tupdate> {\n this.throwIfObservable(object);\n this.throwIfNotQuery(this.updateMutation);\n\n const variables = merge(\n {\n id: object.id,\n input: this.getInput(object, false),\n },\n this.getPartialVariablesForUpdate(object),\n ) as Vupdate;\n\n return this.apollo\n .mutate<Tupdate, Vupdate>({\n mutation: this.updateMutation,\n variables: variables,\n })\n .pipe(\n map(result => {\n this.apollo.client.reFetchObservableQueries();\n return this.mapUpdate(result);\n }),\n );\n }\n\n /**\n * Delete objects and then refetch the list of objects\n */\n public delete(objects: {id: string}[]): Observable<Tdelete> {\n this.throwIfObservable(objects);\n this.throwIfNotQuery(this.deleteMutation);\n\n const ids = objects.map(o => {\n // Cancel pending update\n this.naturalDebounceService.cancelOne(this, o.id);\n\n return o.id;\n });\n const variables = merge(\n {\n ids: ids,\n },\n this.getPartialVariablesForDelete(objects),\n ) as Vdelete;\n\n return this.apollo\n .mutate<Tdelete, Vdelete>({\n mutation: this.deleteMutation,\n variables: variables,\n })\n .pipe(\n // Delay the observable until Apollo refetch is completed\n switchMap(result => {\n const mappedResult = this.mapDelete(result);\n\n return from(this.apollo.client.reFetchObservableQueries()).pipe(map(() => mappedResult));\n }),\n );\n }\n\n /**\n * If the id is provided, resolves an observable model. The observable model will only be emitted after we are sure\n * that Apollo cache is fresh and warm. Then the component can subscribe to the observable model to get the model\n * immediately from Apollo cache and any subsequents future mutations that may happen to Apollo cache.\n *\n * Without id, returns default values, in order to show a creation form.\n */\n public resolve(id: string | undefined): Observable<Observable<Tone | Vcreate['input']>> {\n if (id) {\n const onlyNetwork = this.watchOne(id, 'network-only').pipe(first());\n const onlyCache = this.watchOne(id, 'cache-first');\n\n // In theory, we can rely on Apollo Cache to return a result instantly. It is very fast indeed,\n // but it is still asynchronous, so there may be a very short time when we don't have the model\n // available. To fix that, we can rely on RxJS, which is able to emit synchronously the value we just\n // got from server. Once Apollo Client moves to RxJS (https://github.com/apollographql/apollo-feature-requests/issues/375),\n // we could try to remove `startWith()`.\n return onlyNetwork.pipe(map(firstValue => onlyCache.pipe(startWith(firstValue))));\n } else {\n return of(of(this.getDefaultForServer()));\n }\n }\n\n /**\n * Return an object that match the GraphQL input type.\n * It creates an object with manually filled data and add uncompleted data (like required attributes that can be empty strings)\n */\n public getInput(object: Literal, forCreation: boolean): Vcreate['input'] | Vupdate['input'] {\n // Convert relations to their IDs for mutation\n object = relationsToIds(object);\n\n // Pick only attributes that we can find in the empty object\n // In other words, prevent to select data that has unwanted attributes\n const emptyObject = this.getDefaultForServer();\n let input = pick(object, Object.keys(emptyObject));\n\n // Complete a potentially uncompleted object with default values\n if (forCreation) {\n input = defaults(input, emptyObject);\n }\n\n return input;\n }\n\n /**\n * Return the number of objects matching the query. It may never complete.\n *\n * This is used for the unique validator\n */\n public count(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<number> {\n const queryName = 'Count' + upperCaseFirstLetter(this.plural);\n const filterType = upperCaseFirstLetter(this.name) + 'Filter';\n\n const query = gql`\n query ${queryName} ($filter: ${filterType}) {\n count: ${this.plural} (filter: $filter, pagination: {pageSize: 0, pageIndex: 0}) {\n length\n }\n }`;\n\n return this.getPartialVariablesForAll().pipe(\n switchMap(partialVariables => {\n // Copy manager to prevent to apply internal variables to external QueryVariablesManager\n const manager = new NaturalQueryVariablesManager<Vall>(queryVariablesManager);\n manager.merge('partial-variables', partialVariables);\n\n return this.apollo.query<{count: {length: number}}, Vall>({\n query: query,\n variables: manager.variables.value,\n fetchPolicy: 'network-only',\n });\n }),\n map(result => result.data.count.length),\n );\n }\n\n /**\n * Return empty object with some default values from server perspective\n *\n * This is typically useful when showing a form for creation\n */\n public getDefaultForServer(): Vcreate['input'] {\n return {};\n }\n\n /**\n * You probably **should not** use this.\n *\n * If you are trying to *call* this method, instead you probably want to call `getDefaultForServer()` to get default\n * values for a model, or `getFormConfig()` to get a configured form that includes extra form fields.\n *\n * If you are trying to *override* this method, instead you probably want to override `getDefaultForServer()`.\n *\n * The only and **very rare** reason to override this method is if the client needs extra form fields that cannot be\n * accepted by the server (not part of `XXXInput` type) and that are strictly for the client form needs. In that case,\n * then you can return default values for those extra form fields, and the form returned by `getFormConfig()` will\n * include those extra fields.\n */\n protected getFormExtraFieldDefaultValues(): Literal {\n return {};\n }\n\n /**\n * This is used to extract only the array of fetched objects out of the entire fetched data\n */\n protected mapAll(): OperatorFunction<FetchResult<unknown>, Tall> {\n return map(result => (result.data as any)[this.plural]); // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * This is used to extract only the created object out of the entire fetched data\n */\n protected mapCreation(result: MutationResult<unknown>): Tcreate {\n const name = this.createName ?? 'create' + upperCaseFirstLetter(this.name);\n return (result.data as any)[name]; // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * This is used to extract only the updated object out of the entire fetched data\n */\n protected mapUpdate(result: MutationResult<unknown>): Tupdate {\n const name = this.updateName ?? 'update' + upperCaseFirstLetter(this.name);\n return (result.data as any)[name]; // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * This is used to extract only flag when deleting an object\n */\n protected mapDelete(result: MutationResult<unknown>): Tdelete {\n const name = this.deleteName ?? 'delete' + upperCaseFirstLetter(this.plural);\n return (result.data as any)[name]; // See https://github.com/apollographql/apollo-client/issues/5662\n }\n\n /**\n * Returns additional variables to be used when getting a single object\n *\n * This is typically a site or state ID, and is needed to get appropriate access rights\n */\n protected getPartialVariablesForOne(): Observable<Partial<Vone>> {\n return of({});\n }\n\n /**\n * Returns additional variables to be used when getting multiple objects\n *\n * This is typically a site or state ID, but it could be something else to further filter the query\n */\n public getPartialVariablesForAll(): Observable<Partial<Vall>> {\n return of({});\n }\n\n /**\n * Returns additional variables to be used when creating an object\n *\n * This is typically a site or state ID\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getPartialVariablesForCreation(object: Literal): Partial<Vcreate> {\n return {};\n }\n\n /**\n * Returns additional variables to be used when updating an object\n *\n * This is typically a site or state ID\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getPartialVariablesForUpdate(object: Literal): Partial<Vupdate> {\n return {};\n }\n\n /**\n * Return additional variables to be used when deleting an object\n *\n * This is typically a site or state ID\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getPartialVariablesForDelete(objects: Literal[]): Partial<Vdelete> {\n return {};\n }\n\n /**\n * Throw exception to prevent executing queries with invalid variables\n */\n protected throwIfObservable(value: unknown): void {\n if (value instanceof Observable) {\n throw new Error(\n 'Cannot use Observable as variables. Instead you should use .subscribe() to call the method with a real value',\n );\n }\n }\n\n /**\n * Merge given ID with additional partial variables if there is any\n */\n private getVariablesForOne(id: string): Observable<Vone> {\n return this.getPartialVariablesForOne().pipe(\n map(partialVariables => merge({id: id} as Vone, partialVariables)),\n );\n }\n\n /**\n * Throw exception to prevent executing null queries\n */\n private throwIfNotQuery(query: DocumentNode | null): asserts query {\n if (!query) {\n throw new Error('GraphQL query for this method was not configured in this service constructor');\n }\n }\n}\n","/**\n * **DO NOT MODIFY UNLESS STRICTLY REQUIRED FOR VANILLA**\n *\n * This is a minimal service specialized for Vanilla and any modification,\n * including adding `import` in this file, might break https://navigations.ichtus.club.\n */\n\nexport {NaturalQueryVariablesManager} from './src/lib/classes/query-variable-manager';\nexport type {Literal} from './src/lib/types/types';\nexport {graphqlQuerySigner} from './src/lib/classes/signing';\nexport {formatIsoDateTime} from './src/lib/classes/utility';\nexport {NaturalAbstractModelService, type FormValidators} from './src/lib/services/abstract-model.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["map","switchMap","debounceTime","shareReplay"],"mappings":";;;;;;;;;;;AAiBM,SAAU,aAAa,CAAC,IAAiB,EAAA;IAC3C,IAAI,CAAC,IAAI,EAAE;AACP,QAAA,OAAO,IAAI;;AAGf,IAAA,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE;IAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;AAC7B,IAAA,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE;AAExB,IAAA,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC;AAC5E;AAEA;;;;;AAKG;AACG,SAAU,iBAAiB,CAAC,IAAU,EAAA;AACxC,IAAA,MAAM,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,EAAE;AACxD,IAAA,MAAM,qBAAqB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;AACxE,IAAA,MAAM,IAAI,GAAG,qBAAqB,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG;AACnD,IAAA,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG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