@opra/client 0.20.1 → 0.20.3

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.
package/browser.js CHANGED
@@ -281,7 +281,7 @@ var HttpResponse = class _HttpResponse {
281
281
  }
282
282
  constructor(init) {
283
283
  this.hasBody = false;
284
- this.headers = new HttpHeaders2(init?.headers);
284
+ this.headers = init?.headers instanceof HttpHeaders2 ? init?.headers : new HttpHeaders2(init?.headers);
285
285
  this.status = init?.status || 200;
286
286
  this.statusText = init?.statusText || "OK";
287
287
  this.url = init?.url || null;
@@ -8,7 +8,8 @@ class HttpResponse {
8
8
  * Returns true if response has body to be received
9
9
  */
10
10
  this.hasBody = false;
11
- this.headers = new common_1.HttpHeaders(init?.headers);
11
+ this.headers = init?.headers instanceof common_1.HttpHeaders ? init?.headers
12
+ : new common_1.HttpHeaders(init?.headers);
12
13
  this.status = init?.status || 200;
13
14
  this.statusText = init?.statusText || 'OK';
14
15
  this.url = init?.url || null;
@@ -5,7 +5,8 @@ export class HttpResponse {
5
5
  * Returns true if response has body to be received
6
6
  */
7
7
  this.hasBody = false;
8
- this.headers = new HttpHeaders(init?.headers);
8
+ this.headers = init?.headers instanceof HttpHeaders ? init?.headers
9
+ : new HttpHeaders(init?.headers);
9
10
  this.status = init?.status || 200;
10
11
  this.statusText = init?.statusText || 'OK';
11
12
  this.url = init?.url || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/client",
3
- "version": "0.20.1",
3
+ "version": "0.20.3",
4
4
  "description": "Opra Client package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "@browsery/i18next": "^0.6.0",
47
47
  "@browsery/stream": "^0.5.0",
48
48
  "@browsery/util": "^0.4.0",
49
- "@opra/common": "^0.20.1",
49
+ "@opra/common": "^0.20.3",
50
50
  "accepts": "^1.3.8",
51
51
  "buffer": "^6.0.3",
52
52
  "cookie": "^0.5.0",
@@ -47,7 +47,7 @@ export declare namespace HttpCollectionNode {
47
47
  affected: number;
48
48
  }
49
49
  }
50
- export declare class HttpCollectionNode<TType, TResponseExt = any> {
50
+ export declare class HttpCollectionNode<TType, TResponseExt = {}> {
51
51
  protected [kHttpClientContext]: HttpClientContext;
52
52
  constructor(context: HttpClientContext);
53
53
  create(data: PartialInput<TType>, options?: StrictOmit<HttpCollectionNode.CreateOptions, 'observe'> & {
@@ -86,6 +86,7 @@ export declare class HttpCollectionNode<TType, TResponseExt = any> {
86
86
  get(id: any, options?: StrictOmit<HttpCollectionNode.GetOptions, 'observe'> & {
87
87
  observe: 'events';
88
88
  }): HttpRequestObservable<HttpEvent, TType, TResponseExt>;
89
+ findMany(options?: StrictOmit<HttpCollectionNode.FindManyOptions, 'observe'>): HttpRequestObservable<TType[], TType, TResponseExt>;
89
90
  findMany(options?: StrictOmit<HttpCollectionNode.FindManyOptions, 'observe'> & {
90
91
  observe?: 'body';
91
92
  }): HttpRequestObservable<TType[], TType, TResponseExt>;
@@ -11,7 +11,7 @@ export declare namespace HttpRequestObservable {
11
11
  http?: HttpRequestDefaults;
12
12
  }
13
13
  }
14
- export declare class HttpRequestObservable<T, TBody, TResponseExt = never, TResponse = HttpResponse<TBody> & TResponseExt> extends Observable<T> {
14
+ export declare class HttpRequestObservable<T, TBody, TResponseExt = {}> extends Observable<T> {
15
15
  static kContext: symbol;
16
16
  static kRequest: symbol;
17
17
  readonly contentId: string;
@@ -22,7 +22,7 @@ export declare class HttpRequestObservable<T, TBody, TResponseExt = never, TResp
22
22
  param(name: string, value: any): this;
23
23
  fetch(): Promise<TBody>;
24
24
  fetch(observe: 'body'): Promise<TBody>;
25
- fetch(observe: 'response'): Promise<TResponse>;
25
+ fetch(observe: 'response'): Promise<HttpResponse<TBody> & TResponseExt>;
26
26
  with(cb: (_this: this) => void): this;
27
27
  }
28
28
  export {};
@@ -23,7 +23,7 @@ export declare namespace HttpSingletonNode {
23
23
  include?: string[];
24
24
  }
25
25
  }
26
- export declare class HttpSingletonNode<TType, TResponseExt = any> {
26
+ export declare class HttpSingletonNode<TType, TResponseExt = {}> {
27
27
  protected [kHttpClientContext]: HttpClientContext;
28
28
  constructor(context: HttpClientContext);
29
29
  create(data: PartialInput<TType>, options?: StrictOmit<HttpSingletonNode.CreateOptions, 'observe'> & {