@ecodev/natural 65.0.7 → 65.0.8

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.
@@ -196,18 +196,17 @@ function formatIsoDateTime(date) {
196
196
  const timezoneOffsetInMinutes = Math.round(date.getTimezoneOffset());
197
197
  const timezoneOffsetInHours = -Math.trunc(timezoneOffsetInMinutes / 60); // UTC minus local time
198
198
  const sign = timezoneOffsetInHours >= 0 ? '+' : '-';
199
- const remainderMinutes = -timezoneOffsetInMinutes % 60;
199
+ const remainderMinutes = -(timezoneOffsetInMinutes % 60);
200
200
  // It's a bit unfortunate that we need to construct a new Date instance,
201
201
  // but we don't want the original Date instance to be modified
202
202
  const correctedDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
203
203
  correctedDate.setHours(date.getHours() + timezoneOffsetInHours);
204
- correctedDate.setMinutes(date.getMinutes() + remainderMinutes);
205
204
  const iso = correctedDate
206
205
  .toISOString()
207
206
  .replace(/\.\d{3}Z/, '')
208
207
  .replace('Z', '');
209
208
  const hours = Math.abs(timezoneOffsetInHours).toString().padStart(2, '0');
210
- const minutes = Math.abs(remainderMinutes).toString().padStart(2, '0');
209
+ const minutes = remainderMinutes.toString().padStart(2, '0');
211
210
  return iso + sign + hours + ':' + minutes;
212
211
  }
213
212
  /**
@@ -6503,6 +6502,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
6503
6502
  class TypeSelectComponent {
6504
6503
  destroyRef = inject(DestroyRef);
6505
6504
  renderedValue = new BehaviorSubject('');
6505
+ list = viewChild(MatSelectionList, ...(ngDevMode ? [{ debugName: "list" }] : []));
6506
6506
  requireValueCtrl = false;
6507
6507
  operators = possibleDiscreteOperators;
6508
6508
  operatorCtrl = new FormControl('is', { nonNullable: true });
@@ -6529,6 +6529,12 @@ class TypeSelectComponent {
6529
6529
  });
6530
6530
  this.reloadCondition(data.condition);
6531
6531
  }
6532
+ ngAfterViewInit() {
6533
+ const list = this.list();
6534
+ if (!this.isMultiple() && list) {
6535
+ list.selectedOptions._multiple = false;
6536
+ }
6537
+ }
6532
6538
  getId(item) {
6533
6539
  if (typeof item === 'object' && item) {
6534
6540
  return item.id || item.value;
@@ -6642,7 +6648,7 @@ class TypeSelectComponent {
6642
6648
  }
6643
6649
  }
6644
6650
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
6645
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeSelectComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<form [formGroup]=\"form\">\n @if (configuration.operators) {\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n\n @if (requireValueCtrl) {\n <mat-selection-list [formControl]=\"valueCtrl\" [multiple]=\"configuration.multiple\">\n @for (item of items; track item) {\n <mat-list-option togglePosition=\"before\" [value]=\"getId(item)\">\n {{ getDisplay(item) }}\n </mat-list-option>\n }\n </mat-selection-list>\n }\n</form>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatSelectionList, selector: "mat-selection-list", inputs: ["color", "compareWith", "multiple", "hideSingleSelectionIndicator", "disabled"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: MatListOption, selector: "mat-list-option", inputs: ["togglePosition", "checkboxPosition", "color", "value", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }] });
6651
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeSelectComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "list", first: true, predicate: MatSelectionList, descendants: true, isSignal: true }], ngImport: i0, template: "<form [formGroup]=\"form\">\n @if (configuration.operators) {\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n\n @if (requireValueCtrl) {\n <mat-selection-list [formControl]=\"valueCtrl\">\n @for (item of items; track item) {\n <mat-list-option togglePosition=\"before\" [value]=\"getId(item)\">\n {{ getDisplay(item) }}\n </mat-list-option>\n }\n </mat-selection-list>\n }\n</form>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: MatSelectionList, selector: "mat-selection-list", inputs: ["color", "compareWith", "multiple", "hideSingleSelectionIndicator", "disabled"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: MatListOption, selector: "mat-list-option", inputs: ["togglePosition", "checkboxPosition", "color", "value", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }] });
6646
6652
  }
6647
6653
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeSelectComponent, decorators: [{
6648
6654
  type: Component,
@@ -6655,8 +6661,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
6655
6661
  MatOption,
6656
6662
  MatSelectionList,
6657
6663
  MatListOption,
6658
- ], template: "<form [formGroup]=\"form\">\n @if (configuration.operators) {\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n\n @if (requireValueCtrl) {\n <mat-selection-list [formControl]=\"valueCtrl\" [multiple]=\"configuration.multiple\">\n @for (item of items; track item) {\n <mat-list-option togglePosition=\"before\" [value]=\"getId(item)\">\n {{ getDisplay(item) }}\n </mat-list-option>\n }\n </mat-selection-list>\n }\n</form>\n" }]
6659
- }], ctorParameters: () => [] });
6664
+ ], template: "<form [formGroup]=\"form\">\n @if (configuration.operators) {\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n }\n\n @if (requireValueCtrl) {\n <mat-selection-list [formControl]=\"valueCtrl\">\n @for (item of items; track item) {\n <mat-list-option togglePosition=\"before\" [value]=\"getId(item)\">\n {{ getDisplay(item) }}\n </mat-list-option>\n }\n </mat-selection-list>\n }\n</form>\n" }]
6665
+ }], ctorParameters: () => [], propDecorators: { list: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatSelectionList), { isSignal: true }] }] } });
6660
6666
 
6661
6667
  class AbstractAssociationSelectComponent {
6662
6668
  configuration;
@@ -11350,11 +11356,15 @@ const naturalProviders = [
11350
11356
  localStorageProvider,
11351
11357
  ];
11352
11358
 
11359
+ // Keep those strings obfuscated, to make it harder to CTRL+F things in compiled code
11360
+ const cannotSignAGraphQLQueryThatIsUsingFormDataButThatIsMissingTheKeyOperations = atob('Q2Fubm90IHNpZ24gYSBHcmFwaFFMIHF1ZXJ5IHRoYXQgaXMgdXNpbmcgRm9ybURhdGEgYnV0IHRoYXQgaXMgbWlzc2luZyB0aGUga2V5IGBvcGVyYXRpb25zYA==');
11361
+ const graphqlQuerySignerRequiresANonEmptyKeyConfigureItInLocalPphpUnderSignedQueries = atob('Z3JhcGhxbFF1ZXJ5U2lnbmVyIHJlcXVpcmVzIGEgbm9uLWVtcHR5IGtleS4gQ29uZmlndXJlIGl0IGluIGxvY2FsLnBocCB1bmRlciBzaWduZWRRdWVyaWVzLg==');
11362
+ const xSignature = atob('WC1TaWduYXR1cmU=');
11353
11363
  function getOperations(req) {
11354
11364
  if (req.body instanceof FormData) {
11355
11365
  const operations = req.body.get('operations');
11356
11366
  if (typeof operations !== 'string') {
11357
- throw new Error('Cannot sign a GraphQL query that is using FormData but that is missing the key `operations`');
11367
+ throw new Error(cannotSignAGraphQLQueryThatIsUsingFormDataButThatIsMissingTheKeyOperations);
11358
11368
  }
11359
11369
  return operations;
11360
11370
  }
@@ -11371,20 +11381,32 @@ function graphqlQuerySigner(key) {
11371
11381
  // Validates the configuration exactly 1 time (not for
11372
11382
  // every query), and if not reject **all** HTTP requests
11373
11383
  if (!key) {
11374
- return () => throwError(() => new Error('graphqlQuerySigner requires a non-empty key. Configure it in local.php under signedQueries.'));
11384
+ return () => {
11385
+ return throwError(() => new Error(graphqlQuerySignerRequiresANonEmptyKeyConfigureItInLocalPphpUnderSignedQueries));
11386
+ };
11375
11387
  }
11376
11388
  return (req, next) => {
11377
11389
  const mustSign = req.method === 'POST' && /\/graphql(\?|$)/.exec(req.url);
11378
11390
  if (!mustSign) {
11379
11391
  return next(req);
11380
11392
  }
11381
- const operations = getOperations(req);
11382
- const timestamp = Math.round(Date.now() / 1000);
11383
- const payload = timestamp + operations;
11384
- return from(hmacSha256(key, payload)).pipe(switchMap(hash => {
11385
- const header = `v1.${timestamp}.${hash}`;
11393
+ return of(req).pipe(map$1(req => {
11394
+ const timestamp = Math.round(Date.now() / 1000);
11395
+ const operations = getOperations(req);
11396
+ return {
11397
+ operations: operations,
11398
+ timestamp: timestamp,
11399
+ payload: timestamp + operations,
11400
+ };
11401
+ }), switchMap(async (data) => {
11402
+ return {
11403
+ ...data,
11404
+ hash: await hmacSha256(key, data.payload),
11405
+ };
11406
+ }), switchMap(data => {
11407
+ const header = `v1.${data.timestamp}.${data.hash}`;
11386
11408
  const signedRequest = req.clone({
11387
- headers: req.headers.set('X-Signature', header),
11409
+ headers: req.headers.set(xSignature, header),
11388
11410
  });
11389
11411
  return next(signedRequest);
11390
11412
  }));