@opra/client 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.min.mjs +23 -1
- package/esm/index.min.mjs +23 -1
- package/package.json +1 -1
- package/typings/common/schema/implementation/data-type/data-type.d.ts +1 -0
- package/typings/common/schema/implementation/resource/collection-resource-info.d.ts +1 -0
- package/typings/common/schema/implementation/resource/singleton-resource-info.d.ts +1 -0
- package/typings/http/http-collection-service.d.ts +3 -3
package/cjs/index.min.mjs
CHANGED
|
@@ -5508,6 +5508,9 @@ class DataType {
|
|
|
5508
5508
|
get ctor() {
|
|
5509
5509
|
return this._metadata.ctor;
|
|
5510
5510
|
}
|
|
5511
|
+
get isBuiltin() {
|
|
5512
|
+
return builtInTypes.has(this._name);
|
|
5513
|
+
}
|
|
5511
5514
|
parse(value) {
|
|
5512
5515
|
return this._metadata.parse ? this._metadata.parse(value) : value;
|
|
5513
5516
|
}
|
|
@@ -5785,6 +5788,14 @@ class CollectionResourceInfo extends ResourceInfo {
|
|
|
5785
5788
|
get search() {
|
|
5786
5789
|
return this.metadata.search;
|
|
5787
5790
|
}
|
|
5791
|
+
getHandlerNames() {
|
|
5792
|
+
const out = [];
|
|
5793
|
+
collectionMethods.forEach(m => {
|
|
5794
|
+
if (this.metadata[m])
|
|
5795
|
+
out.push(m);
|
|
5796
|
+
});
|
|
5797
|
+
return out;
|
|
5798
|
+
}
|
|
5788
5799
|
getHandler(method) {
|
|
5789
5800
|
const r = this.metadata[method];
|
|
5790
5801
|
return r && r.handler;
|
|
@@ -5821,6 +5832,14 @@ class SingletonResourceInfo extends ResourceInfo {
|
|
|
5821
5832
|
get update() {
|
|
5822
5833
|
return this.metadata.update;
|
|
5823
5834
|
}
|
|
5835
|
+
getHandlerNames() {
|
|
5836
|
+
const out = [];
|
|
5837
|
+
singletonMethods.forEach(m => {
|
|
5838
|
+
if (this.metadata[m])
|
|
5839
|
+
out.push(m);
|
|
5840
|
+
});
|
|
5841
|
+
return out;
|
|
5842
|
+
}
|
|
5824
5843
|
getSchema(jsonOnly) {
|
|
5825
5844
|
const out = super.getSchema(jsonOnly);
|
|
5826
5845
|
for (const k of singletonMethods) {
|
|
@@ -8122,7 +8141,10 @@ class OpraHttpClientBase {
|
|
|
8122
8141
|
promise = this._resolveMetadata();
|
|
8123
8142
|
documentResolverCaches.set(cacheName, promise);
|
|
8124
8143
|
return promise
|
|
8125
|
-
.catch(() =>
|
|
8144
|
+
.catch((e) => {
|
|
8145
|
+
// @ts-ignore
|
|
8146
|
+
throw new Error('Unable to fetch metadata from ' + this.serviceUrl, e);
|
|
8147
|
+
})
|
|
8126
8148
|
.finally(() => documentResolverCaches.delete(cacheName));
|
|
8127
8149
|
}
|
|
8128
8150
|
// batch(requests: HttpRequestHost<any>[]): BatchRequest {
|
package/esm/index.min.mjs
CHANGED
|
@@ -5507,6 +5507,9 @@ class DataType {
|
|
|
5507
5507
|
get ctor() {
|
|
5508
5508
|
return this._metadata.ctor;
|
|
5509
5509
|
}
|
|
5510
|
+
get isBuiltin() {
|
|
5511
|
+
return builtInTypes.has(this._name);
|
|
5512
|
+
}
|
|
5510
5513
|
parse(value) {
|
|
5511
5514
|
return this._metadata.parse ? this._metadata.parse(value) : value;
|
|
5512
5515
|
}
|
|
@@ -5784,6 +5787,14 @@ class CollectionResourceInfo extends ResourceInfo {
|
|
|
5784
5787
|
get search() {
|
|
5785
5788
|
return this.metadata.search;
|
|
5786
5789
|
}
|
|
5790
|
+
getHandlerNames() {
|
|
5791
|
+
const out = [];
|
|
5792
|
+
collectionMethods.forEach(m => {
|
|
5793
|
+
if (this.metadata[m])
|
|
5794
|
+
out.push(m);
|
|
5795
|
+
});
|
|
5796
|
+
return out;
|
|
5797
|
+
}
|
|
5787
5798
|
getHandler(method) {
|
|
5788
5799
|
const r = this.metadata[method];
|
|
5789
5800
|
return r && r.handler;
|
|
@@ -5820,6 +5831,14 @@ class SingletonResourceInfo extends ResourceInfo {
|
|
|
5820
5831
|
get update() {
|
|
5821
5832
|
return this.metadata.update;
|
|
5822
5833
|
}
|
|
5834
|
+
getHandlerNames() {
|
|
5835
|
+
const out = [];
|
|
5836
|
+
singletonMethods.forEach(m => {
|
|
5837
|
+
if (this.metadata[m])
|
|
5838
|
+
out.push(m);
|
|
5839
|
+
});
|
|
5840
|
+
return out;
|
|
5841
|
+
}
|
|
5823
5842
|
getSchema(jsonOnly) {
|
|
5824
5843
|
const out = super.getSchema(jsonOnly);
|
|
5825
5844
|
for (const k of singletonMethods) {
|
|
@@ -8121,7 +8140,10 @@ class OpraHttpClientBase {
|
|
|
8121
8140
|
promise = this._resolveMetadata();
|
|
8122
8141
|
documentResolverCaches.set(cacheName, promise);
|
|
8123
8142
|
return promise
|
|
8124
|
-
.catch(() =>
|
|
8143
|
+
.catch((e) => {
|
|
8144
|
+
// @ts-ignore
|
|
8145
|
+
throw new Error('Unable to fetch metadata from ' + this.serviceUrl, e);
|
|
8146
|
+
})
|
|
8125
8147
|
.finally(() => documentResolverCaches.delete(cacheName));
|
|
8126
8148
|
}
|
|
8127
8149
|
// batch(requests: HttpRequestHost<any>[]): BatchRequest {
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ export declare class CollectionResourceInfo extends ResourceInfo {
|
|
|
16
16
|
get update(): OpraSchema.UpdateMethodResolver | undefined;
|
|
17
17
|
get updateMany(): OpraSchema.UpdateManyMethodResolver | undefined;
|
|
18
18
|
get search(): OpraSchema.SearchMethodResolver | undefined;
|
|
19
|
+
getHandlerNames(): string[];
|
|
19
20
|
getHandler(method: string): Function;
|
|
20
21
|
getSchema(jsonOnly?: boolean): OpraSchema.CollectionResource;
|
|
21
22
|
}
|
|
@@ -10,5 +10,6 @@ export declare class SingletonResourceInfo extends ResourceInfo {
|
|
|
10
10
|
get delete(): OpraSchema.MethodResolver | undefined;
|
|
11
11
|
get get(): OpraSchema.GetMethodResolver | undefined;
|
|
12
12
|
get update(): OpraSchema.UpdateMethodResolver | undefined;
|
|
13
|
+
getHandlerNames(): string[];
|
|
13
14
|
getSchema(jsonOnly?: boolean): OpraSchema.SingletonResource;
|
|
14
15
|
}
|
|
@@ -6,7 +6,7 @@ import { CollectionDeleteManyRequest } from './requests/collection-delete-many-r
|
|
|
6
6
|
import { CollectionDeleteRequest } from './requests/collection-delete-request.js';
|
|
7
7
|
import { CollectionGetRequest } from './requests/collection-get-request.js';
|
|
8
8
|
import { CollectionSearchRequest } from './requests/collection-search-request.js';
|
|
9
|
-
export declare class HttpCollectionService<TType, TResponseExt> {
|
|
9
|
+
export declare class HttpCollectionService<TType, TResponseExt = never> {
|
|
10
10
|
readonly resource: CollectionResourceInfo;
|
|
11
11
|
protected _handler: HttpRequestHandler;
|
|
12
12
|
constructor(resource: CollectionResourceInfo, _handler: HttpRequestHandler);
|
|
@@ -48,10 +48,10 @@ export declare class HttpCollectionService<TType, TResponseExt> {
|
|
|
48
48
|
}): CollectionGetRequest<HttpEvent, TType, HttpResponse<TType> & TResponseExt>;
|
|
49
49
|
search(options?: CollectionSearchQueryOptions & StrictOmit<CommonHttpRequestOptions, 'observe'> & {
|
|
50
50
|
observe?: 'body';
|
|
51
|
-
}): CollectionSearchRequest<TType, TType, HttpResponse<TType> & TResponseExt>;
|
|
51
|
+
}): CollectionSearchRequest<TType[], TType, HttpResponse<TType> & TResponseExt>;
|
|
52
52
|
search(options?: CollectionSearchQueryOptions & StrictOmit<CommonHttpRequestOptions, 'observe'> & {
|
|
53
53
|
observe: 'response';
|
|
54
|
-
}): CollectionSearchRequest<HttpResponse<TType> & TResponseExt, TType, HttpResponse<TType> & TResponseExt>;
|
|
54
|
+
}): CollectionSearchRequest<HttpResponse<TType[]> & TResponseExt, TType, HttpResponse<TType> & TResponseExt>;
|
|
55
55
|
search(options?: CollectionSearchQueryOptions & StrictOmit<CommonHttpRequestOptions, 'observe'> & {
|
|
56
56
|
observe: 'events';
|
|
57
57
|
}): CollectionSearchRequest<HttpEvent, TType, HttpResponse<TType> & TResponseExt>;
|