@ethlete/query 0.1.0-next.0 → 0.1.0-next.2

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.
@@ -164,13 +164,15 @@ const buildTimestampFromSeconds = (seconds) => {
164
164
  }
165
165
  return new Date(Date.now() + seconds * 1000).getTime();
166
166
  };
167
- const buildRequestError = async (error) => {
167
+ const buildRequestError = async (error, route, requestInit) => {
168
168
  if (error instanceof DOMException && error.code === error.ABORT_ERR) {
169
169
  const err = {
170
170
  code: -1,
171
171
  message: 'Request aborted',
172
172
  detail: null,
173
173
  raw: error,
174
+ route,
175
+ requestInit,
174
176
  };
175
177
  return err;
176
178
  }
@@ -180,6 +182,8 @@ const buildRequestError = async (error) => {
180
182
  message: 'Syntax error',
181
183
  detail: null,
182
184
  raw: error,
185
+ route,
186
+ requestInit,
183
187
  };
184
188
  return err;
185
189
  }
@@ -189,6 +193,8 @@ const buildRequestError = async (error) => {
189
193
  message: `${error.name}: ${error.message}`,
190
194
  detail: null,
191
195
  raw: error,
196
+ route,
197
+ requestInit,
192
198
  };
193
199
  return err;
194
200
  }
@@ -206,6 +212,8 @@ const buildRequestError = async (error) => {
206
212
  message: error.statusText,
207
213
  detail,
208
214
  raw: error,
215
+ route,
216
+ requestInit,
209
217
  };
210
218
  return err;
211
219
  }
@@ -214,6 +222,8 @@ const buildRequestError = async (error) => {
214
222
  message: 'Unknown error',
215
223
  detail: null,
216
224
  raw: error,
225
+ route,
226
+ requestInit,
217
227
  };
218
228
  return err;
219
229
  };
@@ -268,7 +278,7 @@ const request = async (options) => {
268
278
  return { data, expiresInTimestamp };
269
279
  }
270
280
  catch (error) {
271
- throw await buildRequestError(error);
281
+ throw await buildRequestError(error, options.route, options.init);
272
282
  }
273
283
  };
274
284
 
@@ -345,11 +355,12 @@ class BearerAuthProvider {
345
355
  route,
346
356
  });
347
357
  const body = bodyAdapter ? bodyAdapter(this._refreshToken) : { refreshToken: this._refreshToken };
358
+ const requestInit = { body: buildBody(body), method };
348
359
  this.onRefreshInitiation$.next();
349
360
  try {
350
361
  const result = await request({
351
362
  route: fullRoute,
352
- init: { body: buildBody(body), method },
363
+ init: requestInit,
353
364
  });
354
365
  const tokens = responseAdapter ? responseAdapter(result.data) : result.data;
355
366
  if (!tokens.token) {
@@ -364,7 +375,7 @@ class BearerAuthProvider {
364
375
  }
365
376
  catch (error) {
366
377
  if (error instanceof Error) {
367
- this.onRefreshFailure$.next(await buildRequestError(error));
378
+ this.onRefreshFailure$.next(await buildRequestError(error, fullRoute, requestInit));
368
379
  }
369
380
  else {
370
381
  this.onRefreshFailure$.next(error);
@@ -520,7 +531,7 @@ class Query {
520
531
  }
521
532
  else {
522
533
  body = buildBody(this._args?.body);
523
- contentType = guessContentType(body);
534
+ contentType = guessContentType(this._args?.body);
524
535
  }
525
536
  let authHeader = null;
526
537
  if (this._queryConfig.secure) {
@@ -698,9 +709,9 @@ class QueryDirective {
698
709
  }
699
710
  }
700
711
  }
701
- QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
702
- QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: QueryDirective, isStandalone: true, selector: "[query]", inputs: { query: "query", cache: ["queryCache", "cache"] }, ngImport: i0 });
703
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: QueryDirective, decorators: [{
712
+ QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
713
+ QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.9", type: QueryDirective, isStandalone: true, selector: "[query]", inputs: { query: "query", cache: ["queryCache", "cache"] }, ngImport: i0 });
714
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: QueryDirective, decorators: [{
704
715
  type: Directive,
705
716
  args: [{
706
717
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -986,9 +997,9 @@ class InfinityQueryDirective {
986
997
  }
987
998
  }
988
999
  }
989
- InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
990
- InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: InfinityQueryDirective, isStandalone: true, selector: "[infinityQuery]", inputs: { infinityQuery: "infinityQuery" }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }], ngImport: i0 });
991
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: InfinityQueryDirective, decorators: [{
1000
+ InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1001
+ InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.9", type: InfinityQueryDirective, isStandalone: true, selector: "[infinityQuery]", inputs: { infinityQuery: "infinityQuery" }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }], ngImport: i0 });
1002
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: InfinityQueryDirective, decorators: [{
992
1003
  type: Directive,
993
1004
  args: [{
994
1005
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -1037,9 +1048,9 @@ class InfinityQueryTriggerDirective {
1037
1048
  this._observer.observe(this._elementRef.nativeElement);
1038
1049
  }
1039
1050
  }
1040
- InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1041
- InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[infinityQueryTrigger], infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
1042
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
1051
+ InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1052
+ InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.9", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[infinityQueryTrigger], infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
1053
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.9", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
1043
1054
  type: Directive,
1044
1055
  args: [{
1045
1056
  // eslint-disable-next-line @angular-eslint/directive-selector