@naturalcycles/js-lib 15.103.0 → 15.104.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/dist/http/fetcher.d.ts
CHANGED
|
@@ -50,17 +50,24 @@ export declare class Fetcher {
|
|
|
50
50
|
put: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>;
|
|
51
51
|
patch: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>;
|
|
52
52
|
delete: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>;
|
|
53
|
+
/**
|
|
54
|
+
* HTTP QUERY method: like GET (safe and idempotent, hence retried by default),
|
|
55
|
+
* but with a request body (e.g `json`).
|
|
56
|
+
*/
|
|
57
|
+
query: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>;
|
|
53
58
|
getText: (url: string, opt?: FetcherOptions) => Promise<string>;
|
|
54
59
|
postText: (url: string, opt?: FetcherOptions) => Promise<string>;
|
|
55
60
|
putText: (url: string, opt?: FetcherOptions) => Promise<string>;
|
|
56
61
|
patchText: (url: string, opt?: FetcherOptions) => Promise<string>;
|
|
57
62
|
deleteText: (url: string, opt?: FetcherOptions) => Promise<string>;
|
|
63
|
+
queryText: (url: string, opt?: FetcherOptions) => Promise<string>;
|
|
58
64
|
getVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
59
65
|
postVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
60
66
|
putVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
61
67
|
patchVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
62
68
|
deleteVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
63
69
|
headVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
70
|
+
queryVoid: (url: string, opt?: FetcherOptions) => Promise<void>;
|
|
64
71
|
/**
|
|
65
72
|
* Small convenience wrapper that allows to issue GraphQL queries.
|
|
66
73
|
* In practice, all it does is:
|
package/dist/http/fetcher.js
CHANGED
|
@@ -122,12 +122,18 @@ export class Fetcher {
|
|
|
122
122
|
put;
|
|
123
123
|
patch;
|
|
124
124
|
delete;
|
|
125
|
+
/**
|
|
126
|
+
* HTTP QUERY method: like GET (safe and idempotent, hence retried by default),
|
|
127
|
+
* but with a request body (e.g `json`).
|
|
128
|
+
*/
|
|
129
|
+
query;
|
|
125
130
|
// responseType=text
|
|
126
131
|
getText;
|
|
127
132
|
postText;
|
|
128
133
|
putText;
|
|
129
134
|
patchText;
|
|
130
135
|
deleteText;
|
|
136
|
+
queryText;
|
|
131
137
|
// responseType=void (no body fetching/parsing)
|
|
132
138
|
getVoid;
|
|
133
139
|
postVoid;
|
|
@@ -135,6 +141,7 @@ export class Fetcher {
|
|
|
135
141
|
patchVoid;
|
|
136
142
|
deleteVoid;
|
|
137
143
|
headVoid;
|
|
144
|
+
queryVoid;
|
|
138
145
|
/**
|
|
139
146
|
* Small convenience wrapper that allows to issue GraphQL queries.
|
|
140
147
|
* In practice, all it does is:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
|
|
1
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'QUERY';
|
|
2
2
|
export type HttpStatusFamily = 5 | 4 | 3 | 2 | 1;
|
|
3
3
|
/**
|
|
4
4
|
* Number, representing a valid Http status code (e.g 401, 500, etc)
|
package/dist/http/http.model.js
CHANGED
package/package.json
CHANGED
package/src/http/fetcher.ts
CHANGED
|
@@ -175,6 +175,11 @@ export class Fetcher {
|
|
|
175
175
|
put!: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>
|
|
176
176
|
patch!: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>
|
|
177
177
|
delete!: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>
|
|
178
|
+
/**
|
|
179
|
+
* HTTP QUERY method: like GET (safe and idempotent, hence retried by default),
|
|
180
|
+
* but with a request body (e.g `json`).
|
|
181
|
+
*/
|
|
182
|
+
query!: <T = unknown>(url: string, opt?: FetcherOptions) => Promise<T>
|
|
178
183
|
|
|
179
184
|
// responseType=text
|
|
180
185
|
getText!: (url: string, opt?: FetcherOptions) => Promise<string>
|
|
@@ -182,6 +187,7 @@ export class Fetcher {
|
|
|
182
187
|
putText!: (url: string, opt?: FetcherOptions) => Promise<string>
|
|
183
188
|
patchText!: (url: string, opt?: FetcherOptions) => Promise<string>
|
|
184
189
|
deleteText!: (url: string, opt?: FetcherOptions) => Promise<string>
|
|
190
|
+
queryText!: (url: string, opt?: FetcherOptions) => Promise<string>
|
|
185
191
|
|
|
186
192
|
// responseType=void (no body fetching/parsing)
|
|
187
193
|
getVoid!: (url: string, opt?: FetcherOptions) => Promise<void>
|
|
@@ -190,6 +196,7 @@ export class Fetcher {
|
|
|
190
196
|
patchVoid!: (url: string, opt?: FetcherOptions) => Promise<void>
|
|
191
197
|
deleteVoid!: (url: string, opt?: FetcherOptions) => Promise<void>
|
|
192
198
|
headVoid!: (url: string, opt?: FetcherOptions) => Promise<void>
|
|
199
|
+
queryVoid!: (url: string, opt?: FetcherOptions) => Promise<void>
|
|
193
200
|
|
|
194
201
|
/**
|
|
195
202
|
* Small convenience wrapper that allows to issue GraphQL queries.
|
package/src/http/http.model.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Should be uppercase, because e.g this browser issue: https://github.com/axios/axios/issues/26
|
|
2
|
-
|
|
2
|
+
// QUERY is like GET (safe and idempotent), but with a request body: https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/
|
|
3
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'QUERY'
|
|
3
4
|
|
|
4
5
|
export type HttpStatusFamily = 5 | 4 | 3 | 2 | 1
|
|
5
6
|
|
|
@@ -8,4 +9,12 @@ export type HttpStatusFamily = 5 | 4 | 3 | 2 | 1
|
|
|
8
9
|
*/
|
|
9
10
|
export type HttpStatusCode = number
|
|
10
11
|
|
|
11
|
-
export const HTTP_METHODS: readonly HttpMethod[] = [
|
|
12
|
+
export const HTTP_METHODS: readonly HttpMethod[] = [
|
|
13
|
+
'GET',
|
|
14
|
+
'POST',
|
|
15
|
+
'PUT',
|
|
16
|
+
'PATCH',
|
|
17
|
+
'DELETE',
|
|
18
|
+
'HEAD',
|
|
19
|
+
'QUERY',
|
|
20
|
+
]
|