@cubicweb/client 3.0.0-alpha.9 → 3.0.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/README.md +58 -34
- package/lib/Authenticator.d.ts +8 -0
- package/lib/Authenticator.d.ts.map +1 -0
- package/lib/Authenticator.js +2 -0
- package/lib/Authenticator.js.map +1 -0
- package/lib/api/Api.d.ts +56 -23
- package/lib/api/Api.d.ts.map +1 -1
- package/lib/api/Api.js +141 -143
- package/lib/api/Api.js.map +1 -1
- package/lib/api/Client.d.ts +26 -10
- package/lib/api/Client.d.ts.map +1 -1
- package/lib/api/Client.js +41 -58
- package/lib/api/Client.js.map +1 -1
- package/lib/api/ResultSet.d.ts +52 -0
- package/lib/api/ResultSet.d.ts.map +1 -0
- package/lib/api/ResultSet.js +64 -0
- package/lib/api/ResultSet.js.map +1 -0
- package/lib/api/authenticators/CookieAuthenticator.d.ts +10 -0
- package/lib/api/authenticators/CookieAuthenticator.d.ts.map +1 -0
- package/lib/api/authenticators/CookieAuthenticator.js +11 -0
- package/lib/api/authenticators/CookieAuthenticator.js.map +1 -0
- package/lib/api/authenticators/SignedRequestAuthenticator.d.ts +32 -0
- package/lib/api/authenticators/SignedRequestAuthenticator.d.ts.map +1 -0
- package/lib/api/authenticators/SignedRequestAuthenticator.js +89 -0
- package/lib/api/authenticators/SignedRequestAuthenticator.js.map +1 -0
- package/lib/api/binary/RQLBinary.d.ts +6 -0
- package/lib/api/binary/RQLBinary.d.ts.map +1 -0
- package/lib/api/binary/RQLBinary.js +10 -0
- package/lib/api/binary/RQLBinary.js.map +1 -0
- package/lib/api/query/RQLQuery.d.ts +40 -0
- package/lib/api/query/RQLQuery.d.ts.map +1 -0
- package/lib/api/query/RQLQuery.js +48 -0
- package/lib/api/query/RQLQuery.js.map +1 -0
- package/lib/api/query/references.d.ts +41 -0
- package/lib/api/query/references.d.ts.map +1 -0
- package/lib/api/query/references.js +50 -0
- package/lib/api/query/references.js.map +1 -0
- package/lib/api/transaction/Transaction.d.ts +25 -0
- package/lib/api/transaction/Transaction.d.ts.map +1 -0
- package/lib/api/transaction/Transaction.js +28 -0
- package/lib/api/transaction/Transaction.js.map +1 -0
- package/lib/api/transaction/TransactionResult.d.ts +41 -0
- package/lib/api/transaction/TransactionResult.d.ts.map +1 -0
- package/lib/api/transaction/TransactionResult.js +45 -0
- package/lib/api/transaction/TransactionResult.js.map +1 -0
- package/lib/encodeFormData.d.ts +5 -0
- package/lib/encodeFormData.d.ts.map +1 -0
- package/lib/encodeFormData.js +94 -0
- package/lib/encodeFormData.js.map +1 -0
- package/lib/{Errors.d.ts → errors.d.ts} +7 -4
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +19 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +19 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -34
- package/lib/index.js.map +1 -1
- package/lib/schema/classes/EntitySchema.d.ts +5 -5
- package/lib/schema/classes/EntitySchema.d.ts.map +1 -1
- package/lib/schema/classes/EntitySchema.js +3 -5
- package/lib/schema/classes/EntitySchema.js.map +1 -1
- package/lib/schema/classes/RelationDefinitionSchema.d.ts +6 -6
- package/lib/schema/classes/RelationDefinitionSchema.d.ts.map +1 -1
- package/lib/schema/classes/RelationDefinitionSchema.js +8 -10
- package/lib/schema/classes/RelationDefinitionSchema.js.map +1 -1
- package/lib/schema/classes/Schema.d.ts +7 -7
- package/lib/schema/classes/Schema.d.ts.map +1 -1
- package/lib/schema/classes/Schema.js +8 -11
- package/lib/schema/classes/Schema.js.map +1 -1
- package/lib/schema/classes/Utils.d.ts +10 -10
- package/lib/schema/classes/Utils.d.ts.map +1 -1
- package/lib/schema/classes/Utils.js +19 -35
- package/lib/schema/classes/Utils.js.map +1 -1
- package/lib/schema/raw/Constraints.d.ts +27 -0
- package/lib/schema/raw/Constraints.d.ts.map +1 -1
- package/lib/schema/raw/Constraints.js +1 -2
- package/lib/schema/raw/Entities.js +1 -2
- package/lib/schema/raw/RelationDefinitions.d.ts +3 -3
- package/lib/schema/raw/RelationDefinitions.d.ts.map +1 -1
- package/lib/schema/raw/RelationDefinitions.js +1 -2
- package/lib/schema/raw/Schema.d.ts +2 -2
- package/lib/schema/raw/Schema.d.ts.map +1 -1
- package/lib/schema/raw/Schema.js +1 -2
- package/lib/schema/raw/Utils.d.ts +1 -1
- package/lib/schema/raw/Utils.d.ts.map +1 -1
- package/lib/schema/raw/Utils.js +1 -2
- package/lib/utils.d.ts +39 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +58 -0
- package/lib/utils.js.map +1 -0
- package/package.json +15 -5
- package/src/Authenticator.ts +8 -0
- package/src/api/Api.ts +148 -125
- package/src/api/Client.ts +31 -18
- package/src/api/ResultSet.ts +95 -0
- package/src/api/authenticators/CookieAuthenticator.ts +17 -0
- package/src/api/authenticators/SignedRequestAuthenticator.ts +133 -0
- package/src/api/binary/RQLBinary.ts +9 -0
- package/src/api/query/RQLQuery.ts +51 -0
- package/src/api/query/references.ts +43 -0
- package/src/api/transaction/Transaction.ts +31 -0
- package/src/api/transaction/TransactionResult.ts +68 -0
- package/src/encodeFormData.ts +126 -0
- package/src/{Errors.ts → errors.ts} +6 -7
- package/src/index.ts +24 -17
- package/src/schema/classes/EntitySchema.ts +8 -5
- package/src/schema/classes/RelationDefinitionSchema.ts +7 -7
- package/src/schema/classes/Schema.ts +10 -7
- package/src/schema/classes/Utils.ts +4 -4
- package/src/schema/raw/Constraints.ts +28 -0
- package/src/schema/raw/RelationDefinitions.ts +3 -3
- package/src/schema/raw/Schema.ts +2 -2
- package/src/schema/raw/Utils.ts +1 -1
- package/src/utils.ts +91 -0
- package/lib/Errors.d.ts.map +0 -1
- package/lib/Errors.js +0 -25
- package/lib/Errors.js.map +0 -1
- package/lib/api/Transaction.d.ts +0 -46
- package/lib/api/Transaction.d.ts.map +0 -1
- package/lib/api/Transaction.js +0 -75
- package/lib/api/Transaction.js.map +0 -1
- package/src/api/Transaction.ts +0 -94
package/README.md
CHANGED
|
@@ -7,11 +7,12 @@ library.
|
|
|
7
7
|
|
|
8
8
|
The full documentation is available [here](https://cubicweb.pages.logilab.fr/cubicwebjs/client).
|
|
9
9
|
|
|
10
|
-
**Compatible with [API cube](https://forge.extranet.logilab.fr/cubicweb/cubes/api) version 0.
|
|
10
|
+
**Compatible with [API cube](https://forge.extranet.logilab.fr/cubicweb/cubes/api) version 0.15 only.**
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
@cubicweb/client is available from NPM:
|
|
15
|
+
|
|
15
16
|
```bash
|
|
16
17
|
# With NPM
|
|
17
18
|
npm i @cubicweb/client
|
|
@@ -29,7 +30,7 @@ This class requires the URL to your CubicWeb instance API endpoint
|
|
|
29
30
|
(eg: `https://example.com/api`).
|
|
30
31
|
|
|
31
32
|
```js
|
|
32
|
-
const client = new Client("https://example.com/api")
|
|
33
|
+
const client = new Client("https://example.com/api");
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
**⚠️ Real API routes include the API version in the URL (eg: `v1`),
|
|
@@ -77,24 +78,18 @@ client
|
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
// Execute a series of request in a transaction
|
|
80
|
-
const transaction = new Transaction()
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
queryIndex: 0,
|
|
89
|
-
row: 0,
|
|
90
|
-
column: 0,
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
})
|
|
81
|
+
const transaction = new Transaction();
|
|
82
|
+
const insertQuery = new RQLQuery(`INSERT Person X: X name "test"`);
|
|
83
|
+
transaction.push(insertQuery);
|
|
84
|
+
transaction.push(
|
|
85
|
+
new RQLQuery(`INSERT Person X: X name "test"`, {
|
|
86
|
+
created_eid: insertQuery.cellRef(0, 0),
|
|
87
|
+
})
|
|
88
|
+
);
|
|
94
89
|
client
|
|
95
90
|
.executeTransaction(transaction)
|
|
96
91
|
.then((callbackResult) => {
|
|
97
|
-
console.log("Transaction was
|
|
92
|
+
console.log("Transaction was successful and the callback returned:");
|
|
98
93
|
console.log(callbackResult);
|
|
99
94
|
})
|
|
100
95
|
.catch((e) => {
|
|
@@ -122,36 +117,64 @@ you must authorize the URL the client is running on as well as the `Content-Type
|
|
|
122
117
|
|
|
123
118
|
## Authentication
|
|
124
119
|
|
|
125
|
-
The API cube uses cookie authentication
|
|
126
|
-
A `CW_JWT` [HTTP Only](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#security) cookie
|
|
127
|
-
will be automatically created by the browser when executing the login request.
|
|
128
|
-
This cookie cannot be accessed by the JavaScript so you will have to implement your own
|
|
129
|
-
logic to save the login state.
|
|
120
|
+
The API cube uses a cookie authentication method by default. When you call the login route, the cookie will be automatically created by the browser.
|
|
130
121
|
|
|
131
122
|
If the client is running on a different server from your CubicWeb instance,
|
|
132
123
|
make sure you setup CORS as described above.
|
|
133
124
|
For the login to work, you may also need to modify the cookie sent by the API cube to set
|
|
134
125
|
[`SameSite`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#samesite_attribute)
|
|
135
|
-
to `None`.
|
|
126
|
+
to `None`.
|
|
127
|
+
|
|
128
|
+
You can use other authenticators if needed. Here is an example relying on the
|
|
129
|
+
[`cubicweb-signedrequest`](https://forge.extranet.logilab.fr/cubicweb/cubes/signedrequest)
|
|
130
|
+
cube (v3.x):
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { Client } from "@cubicweb/client";
|
|
134
|
+
import { SignedRequestAuthenticator } from "@cubicweb/client/authenticators/SignedRequestAuthenticator";
|
|
135
|
+
|
|
136
|
+
const authenticator = new SignedRequetAuthenticator({
|
|
137
|
+
id: "<token-id>",
|
|
138
|
+
token: "<token>",
|
|
139
|
+
});
|
|
140
|
+
const client = new Client(API_URL, { authenticator });
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
You can also provide your own authenticator by implementing the `Authenticator` interface:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { Authenticator, Client } from "@cubicweb/client";
|
|
147
|
+
|
|
148
|
+
const client = new Client(API_URL, {
|
|
149
|
+
authenticator: {
|
|
150
|
+
authenticate(info, init) {
|
|
151
|
+
const headers = new Headers(init.headers);
|
|
152
|
+
headers.append("Authorization", `Basic Zm9vOmJhcg==`);
|
|
153
|
+
return { info, init: { ...init, headers } };
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
```
|
|
136
158
|
|
|
137
159
|
## Using the Schema
|
|
138
160
|
|
|
139
161
|
This library provides CubicWeb [schema abstraction classes](packages/client/src/schema/Schema.ts). Three classes are available:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
162
|
+
|
|
163
|
+
- `Schema` - Global handling of the schema.
|
|
164
|
+
Can be used to query entities and relations.
|
|
165
|
+
- `EntitySchema` - Handling of a single entity type.
|
|
166
|
+
Can be used to query relations and metadata about the entity.
|
|
167
|
+
- `RelationDefinitionSchema` - Handling of a single relation.
|
|
168
|
+
Can be used to retrieve associated entities and metadata the relation.
|
|
146
169
|
|
|
147
170
|
The `Schema` class is created from the JSON schema returned by the API.
|
|
148
171
|
The `Client.schema()` method takes care of this for you.
|
|
149
172
|
If your schema does not change often, it is recommended to export it using the following command
|
|
150
|
-
(replace `<YOUR_INSTANCE_NAME>` by the name of your instance):
|
|
173
|
+
(replace `<YOUR_INSTANCE_NAME>` by the name of your instance):
|
|
151
174
|
|
|
152
175
|
```bash
|
|
153
176
|
cubicweb-ctl export-schema -f json <YOUR_INSTANCE_NAME>
|
|
154
|
-
```
|
|
177
|
+
```
|
|
155
178
|
|
|
156
179
|
You can then manually create the Schema object by passing your JSON schema to its constructor.
|
|
157
180
|
|
|
@@ -161,6 +184,7 @@ const schema = client.schema();
|
|
|
161
184
|
// Using a local json schema
|
|
162
185
|
const schema = new Schema(your_raw_json_schema);
|
|
163
186
|
```
|
|
187
|
+
|
|
164
188
|
`EntitySchema` and `RelationDefinitionSchema` objects should not be created manually.
|
|
165
189
|
These are returned when querying a `Schema` object.
|
|
166
190
|
|
|
@@ -187,7 +211,7 @@ to benefit from the strong type inference. You can generate this representation
|
|
|
187
211
|
|
|
188
212
|
```bash
|
|
189
213
|
cubicweb-ctl export-schema -f typescript <YOUR_INSTANCE_NAME>
|
|
190
|
-
```
|
|
214
|
+
```
|
|
191
215
|
|
|
192
216
|
This command will generate a file `schema.ts` containing the typings.
|
|
193
217
|
You can then include it in your project. When using this generated type,
|
|
@@ -195,7 +219,7 @@ the TS engine will be able to detect invalid entity types and relations.
|
|
|
195
219
|
|
|
196
220
|
**⚠️ You cannot type the schema when using the `client.schema()` method.
|
|
197
221
|
This is intended to prevent errors if the JSON schema changes and not the TS schema.**
|
|
198
|
-
You must export both the JSON schema and TypeScript schema to use the typings.
|
|
222
|
+
You must export both the JSON schema and TypeScript schema to use the typings.
|
|
199
223
|
|
|
200
224
|
```js
|
|
201
225
|
// Type the schema when creating from a local JSON schema
|
|
@@ -210,7 +234,7 @@ const entity = schema.getEntity("ValidEntityType");
|
|
|
210
234
|
## Contribute
|
|
211
235
|
|
|
212
236
|
All `@cubicweb` libraries are in the [cubicwebjs monorepo](https://forge.extranet.logilab.fr/cubicweb/cubicwebjs).
|
|
213
|
-
Please refer to the main README.
|
|
237
|
+
Please refer to the main README.
|
|
214
238
|
|
|
215
239
|
## Get Help
|
|
216
240
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authenticator.d.ts","sourceRoot":"","sources":["../src/Authenticator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authenticator.js","sourceRoot":"","sources":["../src/Authenticator.ts"],"names":[],"mappings":""}
|
package/lib/api/Api.d.ts
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Authenticator } from "../Authenticator.js";
|
|
2
|
+
import { RawSchema } from "../schema/raw/Schema.js";
|
|
3
|
+
import { RQLBinary } from "./binary/RQLBinary.js";
|
|
4
|
+
import { RQLQueryCellRef } from "./query/references.js";
|
|
5
|
+
import { Transaction } from "./transaction/Transaction.js";
|
|
6
|
+
import { TransactionResult } from "./transaction/TransactionResult.js";
|
|
7
|
+
interface ApiOptions {
|
|
8
|
+
authenticator?: Authenticator;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
|
-
* Type representing
|
|
11
|
+
* Type representing valid final values to use as parameters in a RQL query.
|
|
5
12
|
*
|
|
6
|
-
* @
|
|
7
|
-
*/
|
|
8
|
-
export type RQLQuery = [string, RQLParams];
|
|
9
|
-
export type RQLParamValue = string | number | boolean | null;
|
|
10
|
-
/**
|
|
11
|
-
* Type representing RQL parameters to send along a request.
|
|
13
|
+
* For references to requests/binaries, see {@link RQLQueryCellRef} and {@link RQLQueryBinaryRef}
|
|
12
14
|
*
|
|
13
15
|
* @category Api
|
|
14
16
|
*/
|
|
15
|
-
export type
|
|
17
|
+
export type RQLQueryParamValue = string | number | boolean | null;
|
|
16
18
|
/**
|
|
17
|
-
* Type representing
|
|
19
|
+
* Type representing RQL parameters to send along a request.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
export type RqlRow = Array<string | number | boolean | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Type representing a RQL request result.
|
|
21
|
+
* Each key must be referenced in the RQL query.
|
|
24
22
|
*
|
|
25
23
|
* @category Api
|
|
26
24
|
*/
|
|
27
|
-
export type
|
|
25
|
+
export type RQLQueryParams = Record<string, RQLQueryParamValue | RQLQueryCellRef | RQLBinary>;
|
|
28
26
|
/**
|
|
29
|
-
* Type representing the currently logged user's data
|
|
27
|
+
* Type representing the currently logged user's data as returned by the `/current-user` route
|
|
30
28
|
*
|
|
31
29
|
* @category Api
|
|
32
30
|
*/
|
|
@@ -48,6 +46,9 @@ type ApiError = {
|
|
|
48
46
|
/**
|
|
49
47
|
* Type representing the error data sent to clients when retrieving an API error.
|
|
50
48
|
*
|
|
49
|
+
* It simply adds the HTTP status code in a `status` key to the regular CubicWeb api error,
|
|
50
|
+
* so users can handle HTTP status codes in their code.
|
|
51
|
+
*
|
|
51
52
|
* @category Api
|
|
52
53
|
*/
|
|
53
54
|
export type ApiErrorResponse = {
|
|
@@ -57,7 +58,7 @@ export type ApiErrorResponse = {
|
|
|
57
58
|
* Class used to handle requests to the CubicWeb API.
|
|
58
59
|
*
|
|
59
60
|
* You should never have to create this object yourself.
|
|
60
|
-
* Instead, retrieve this object from the methods in the
|
|
61
|
+
* Instead, retrieve this object from the methods in the {@link Client} class.
|
|
61
62
|
*
|
|
62
63
|
* @internal
|
|
63
64
|
*/
|
|
@@ -70,17 +71,18 @@ export default class Api {
|
|
|
70
71
|
private _logoutApiUrl;
|
|
71
72
|
private _currentUserApiUrl;
|
|
72
73
|
private _binaryApiUrl;
|
|
74
|
+
private _authenticator?;
|
|
73
75
|
/**
|
|
74
76
|
* Class used to handle requests to the CubicWeb API.
|
|
75
77
|
*
|
|
76
78
|
* You should never have to create this object yourself.
|
|
77
|
-
* Instead, retrieve this object from the methods in the
|
|
79
|
+
* Instead, retrieve this object from the methods in the {@link Client} class.
|
|
78
80
|
*
|
|
79
81
|
* @param apiUrl The API url. It should not include the API version as it will be automatically added.
|
|
80
82
|
* Example: if you can retrieve the schema with https://example.com/api/v1/schema,
|
|
81
83
|
* use https://example.com/api as `apiUrl`.
|
|
82
84
|
*/
|
|
83
|
-
constructor(apiUrl: string);
|
|
85
|
+
constructor(apiUrl: string, options: ApiOptions);
|
|
84
86
|
get apiUrl(): string;
|
|
85
87
|
private getApiRoute;
|
|
86
88
|
/**
|
|
@@ -93,7 +95,7 @@ export default class Api {
|
|
|
93
95
|
* Tries to log in the user on the configured CubicWeb instance with the given credentials.
|
|
94
96
|
*
|
|
95
97
|
* @param login The user login
|
|
96
|
-
* @param password
|
|
98
|
+
* @param password The user password
|
|
97
99
|
* @returns A promise returning true if the login was successful, false otherwise
|
|
98
100
|
*/
|
|
99
101
|
login(login: string, password: string): Promise<boolean>;
|
|
@@ -112,14 +114,45 @@ export default class Api {
|
|
|
112
114
|
/**
|
|
113
115
|
* Get the binary for the given entity attribute
|
|
114
116
|
*
|
|
115
|
-
* @
|
|
117
|
+
* @param eid Entity eid to fetch the binary from
|
|
118
|
+
* @param attribute Attribute on the entity in which the binary is stored
|
|
119
|
+
* @returns A promise resolving to the binary as a Blob
|
|
116
120
|
*/
|
|
117
121
|
binary(eid: number, attribute: string): Promise<Blob>;
|
|
122
|
+
/**
|
|
123
|
+
* Executes the given transaction.
|
|
124
|
+
*
|
|
125
|
+
* If the {@link Transaction} object contains binaries, the request is automatically
|
|
126
|
+
* sent using `multipart/form-data` to allow uploading binaries.
|
|
127
|
+
*
|
|
128
|
+
* @param transaction Transaction to execute
|
|
129
|
+
* @returns A promise returning the transaction result on success
|
|
130
|
+
*/
|
|
118
131
|
rql(transaction: Transaction): Promise<TransactionResult>;
|
|
119
132
|
private getTransactionParams;
|
|
120
133
|
private multipartTransaction;
|
|
121
134
|
private jsonTransaction;
|
|
122
135
|
private handleUserErrors;
|
|
136
|
+
/**
|
|
137
|
+
* Behaves the same as `fetchAPI` but forbids null responses.
|
|
138
|
+
* If this function detects a null response from the API,
|
|
139
|
+
* the promise will be rejected with a 500 error code.
|
|
140
|
+
*
|
|
141
|
+
* @param input The API route to use
|
|
142
|
+
* @param init Additional request parameters
|
|
143
|
+
* @returns A promise with the non-null fetched result
|
|
144
|
+
*/
|
|
145
|
+
private nonNullFetchApi;
|
|
146
|
+
/**
|
|
147
|
+
* Sends a request to the given API route with the `Content-Type` header set and waits for a response.
|
|
148
|
+
* The returned promise will be rejected if the API returns HTTP error codes.
|
|
149
|
+
* The rejected promise will contain an `ApiErrorResponse` object.
|
|
150
|
+
*
|
|
151
|
+
* @param input The API route to use
|
|
152
|
+
* @param init Additional request parameters
|
|
153
|
+
* @returns A promise with the fetched result
|
|
154
|
+
*/
|
|
155
|
+
private fetchApi;
|
|
123
156
|
}
|
|
124
157
|
export {};
|
|
125
158
|
//# sourceMappingURL=Api.d.ts.map
|
package/lib/api/Api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../src/api/Api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../src/api/Api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAEL,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAE5C,UAAU,UAAU;IAClB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,EACN,kBAAkB,GAAG,eAAe,GAAG,SAAS,CACjD,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,QAAQ,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAC,CAAgB;IAEvC;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAW/C,IAAI,MAAM,WAET;IAED,OAAO,CAAC,WAAW;IAInB;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,SAAS,CAAC;IAMlC;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe9D;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAM7B;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAMzC;;;;;;OAMG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU3D;;;;;;;;OAQG;IACG,GAAG,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAa/D,OAAO,CAAC,oBAAoB;YAOd,oBAAoB;YAqBpB,eAAe;IAW7B,OAAO,CAAC,gBAAgB;IAiBxB;;;;;;;;OAQG;YACW,eAAe;IAa7B;;;;;;;;OAQG;YACW,QAAQ;CA4DvB"}
|