@magda/utils 2.3.3 → 3.0.0-alpha.1
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/index-web.d.ts +17 -200
- package/dist/index-web.js +2382 -42370
- package/dist/index.d.ts +20 -19
- package/dist/index.js +12519 -50287
- package/package.json +22 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Arguments } from 'yargs';
|
|
3
|
-
import { CoreOptions } from 'request';
|
|
4
|
-
import { Request as Request_2 } from 'request';
|
|
5
|
-
import { RequestAPI } from 'request';
|
|
6
|
-
import { RequiredUriUrl } from 'request';
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
4
|
* Checks to see whether the passed argv has a jwtSecret object. If not,
|
|
@@ -19,6 +14,17 @@ export declare function addJwtSecretFromEnvVar<T>(argv: {
|
|
|
19
14
|
[key in keyof Arguments<T>]: Arguments<T>[key];
|
|
20
15
|
};
|
|
21
16
|
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
|
20
|
+
*
|
|
21
|
+
* OpenAPI spec version: 0.1
|
|
22
|
+
*
|
|
23
|
+
*
|
|
24
|
+
* NOTE: This class is auto generated by the swagger code generator program.
|
|
25
|
+
* https://github.com/swagger-api/swagger-codegen.git
|
|
26
|
+
* Do not edit the class manually.
|
|
27
|
+
*/
|
|
22
28
|
declare class ApiError {
|
|
23
29
|
'message': string;
|
|
24
30
|
}
|
|
@@ -45,7 +51,7 @@ export declare class BadRequestError extends ServiceError {
|
|
|
45
51
|
constructor(statusCode: number, errorResponse: ApiError, e: any);
|
|
46
52
|
}
|
|
47
53
|
|
|
48
|
-
export declare function buildJwt(jwtSecret: string, userId: string, session?: any):
|
|
54
|
+
export declare function buildJwt(jwtSecret: string, userId: string, session?: any): string;
|
|
49
55
|
|
|
50
56
|
export declare const coerceJson: (param: string) => (json?: string | object | any[]) => any;
|
|
51
57
|
|
|
@@ -66,7 +72,7 @@ export declare function createNoCacheFetchOptions(fetchOptions?: RequestInit): {
|
|
|
66
72
|
referrer?: string;
|
|
67
73
|
referrerPolicy?: ReferrerPolicy;
|
|
68
74
|
signal?: AbortSignal;
|
|
69
|
-
window?:
|
|
75
|
+
window?: null;
|
|
70
76
|
};
|
|
71
77
|
|
|
72
78
|
/**
|
|
@@ -113,7 +119,7 @@ export declare const isUuid: (id: any) => boolean;
|
|
|
113
119
|
|
|
114
120
|
declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
|
|
115
121
|
private type;
|
|
116
|
-
private value
|
|
122
|
+
private value?;
|
|
117
123
|
constructor(type: MaybeType, value?: T);
|
|
118
124
|
static sequence<T>(t: {
|
|
119
125
|
[k: string]: Maybe<T>;
|
|
@@ -125,9 +131,11 @@ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
|
|
|
125
131
|
}) => Maybe<{
|
|
126
132
|
[k: string]: any;
|
|
127
133
|
}>;
|
|
128
|
-
static maybe<T>(t
|
|
134
|
+
static maybe<T>(t?: T | null): Maybe<T>;
|
|
129
135
|
static just<T>(t: T): Maybe<T>;
|
|
130
136
|
static nothing<T>(): Maybe<T>;
|
|
137
|
+
static isJust<T>(t: Maybe<T>): boolean;
|
|
138
|
+
static isNothing<T>(t: Maybe<T>): boolean;
|
|
131
139
|
unit<U>(u: U): Maybe<U>;
|
|
132
140
|
bind<U>(f: (t: T) => Maybe<U>): Maybe<U>;
|
|
133
141
|
of: <U>(u: U) => Maybe<U>;
|
|
@@ -141,7 +149,7 @@ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
|
|
|
141
149
|
valueOr<U extends T>(defaultValue: U): T | U;
|
|
142
150
|
valueOrCompute<U extends T>(defaultValueFunction: () => U): T | U;
|
|
143
151
|
valueOrThrow(error?: Error): T;
|
|
144
|
-
do(patterns?:
|
|
152
|
+
do(patterns?: Partial<MaybePatterns<T, void>>): Maybe<T>;
|
|
145
153
|
}
|
|
146
154
|
|
|
147
155
|
declare interface MaybePatterns<T, U> {
|
|
@@ -151,7 +159,7 @@ declare interface MaybePatterns<T, U> {
|
|
|
151
159
|
|
|
152
160
|
declare enum MaybeType {
|
|
153
161
|
Nothing = 0,
|
|
154
|
-
Just = 1
|
|
162
|
+
Just = 1
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
declare interface Monad<T> {
|
|
@@ -161,13 +169,6 @@ declare interface Monad<T> {
|
|
|
161
169
|
chain<U>(f: (t: T) => Monad<U>): Monad<U>;
|
|
162
170
|
}
|
|
163
171
|
|
|
164
|
-
declare interface OptionalMaybePatterns<T, U> {
|
|
165
|
-
just?: (t: T) => U;
|
|
166
|
-
nothing?: () => U;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export declare const request: RequestAPI<Request_2, CoreOptions, RequiredUriUrl>;
|
|
170
|
-
|
|
171
172
|
declare type RequestContentType = RequestContentTypeJson | RequestContentTypePlainText | RequestContentTypeForm | RequestContentTypeBinary | RequestContentTypeMultipartForm;
|
|
172
173
|
|
|
173
174
|
declare type RequestContentTypeBinary = "application/octet-stream";
|
|
@@ -180,7 +181,7 @@ declare type RequestContentTypeMultipartForm = "multipart/form-data";
|
|
|
180
181
|
|
|
181
182
|
declare type RequestContentTypePlainText = "text/plain";
|
|
182
183
|
|
|
183
|
-
export declare function retry<T>(op: () => Promise<T>, delaySeconds: number, retries: number, onRetry: (e: any, retries: number) => any, shouldRetry?: (e: any) => boolean): Promise<T>;
|
|
184
|
+
export declare function retry<T = any>(op: () => Promise<T>, delaySeconds: number, retries: number, onRetry: (e: any, retries: number) => any, shouldRetry?: (e: any) => boolean): Promise<T>;
|
|
184
185
|
|
|
185
186
|
export declare function retryBackoff<T>(op: () => Promise<T>, delaySeconds: number, retries: number, onRetry: (e: any, retries: number) => any, easing?: (delaySeconds: number) => number): Promise<T>;
|
|
186
187
|
|