@takaro/apiclient 0.0.0-dev.efc0877 → 0.0.0-dev.f0d9fdf
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 +27 -0
- package/dist/.source-hash +1 -0
- package/dist/generated/api.d.ts +28336 -14337
- package/dist/generated/api.d.ts.map +1 -1
- package/dist/generated/api.js +13051 -5890
- package/dist/generated/api.js.map +1 -1
- package/dist/generated/base.d.ts.map +1 -1
- package/dist/generated/base.js.map +1 -1
- package/dist/generated/common.d.ts +1 -1
- package/dist/generated/common.d.ts.map +1 -1
- package/dist/generated/common.js.map +1 -1
- package/dist/generated/configuration.d.ts.map +1 -1
- package/dist/generated/configuration.js.map +1 -1
- package/dist/generated-management/api.d.ts +25184 -0
- package/dist/generated-management/api.d.ts.map +1 -0
- package/dist/generated-management/api.js +7174 -0
- package/dist/generated-management/api.js.map +1 -0
- package/dist/generated-management/base.d.ts +67 -0
- package/dist/generated-management/base.d.ts.map +1 -0
- package/dist/generated-management/base.js +59 -0
- package/dist/generated-management/base.js.map +1 -0
- package/dist/generated-management/common.d.ts +66 -0
- package/dist/generated-management/common.d.ts.map +1 -0
- package/dist/generated-management/common.js +135 -0
- package/dist/generated-management/common.js.map +1 -0
- package/dist/generated-management/configuration.d.ts +92 -0
- package/dist/generated-management/configuration.d.ts.map +1 -0
- package/dist/generated-management/configuration.js +46 -0
- package/dist/generated-management/configuration.js.map +1 -0
- package/dist/generated-management/index.d.ts +14 -0
- package/dist/generated-management/index.d.ts.map +1 -0
- package/{src/generated/index.ts → dist/generated-management/index.js} +1 -1
- package/dist/generated-management/index.js.map +1 -0
- package/dist/lib/adminClient.d.ts +8 -2
- package/dist/lib/adminClient.d.ts.map +1 -1
- package/dist/lib/adminClient.js +23 -2
- package/dist/lib/adminClient.js.map +1 -1
- package/dist/lib/apiKey.d.ts +3 -0
- package/dist/lib/apiKey.d.ts.map +1 -0
- package/dist/lib/apiKey.js +54 -0
- package/dist/lib/apiKey.js.map +1 -0
- package/dist/lib/baseClient.d.ts +3 -16
- package/dist/lib/baseClient.d.ts.map +1 -1
- package/dist/lib/baseClient.js +9 -22
- package/dist/lib/baseClient.js.map +1 -1
- package/dist/lib/client.d.ts +21 -2
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +83 -12
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/distributorClient.d.ts +12 -0
- package/dist/lib/distributorClient.d.ts.map +1 -0
- package/dist/lib/distributorClient.js +15 -0
- package/dist/lib/distributorClient.js.map +1 -0
- package/dist/lib/staffClient.d.ts +14 -0
- package/dist/lib/staffClient.d.ts.map +1 -0
- package/dist/lib/staffClient.js +30 -0
- package/dist/lib/staffClient.js.map +1 -0
- package/dist/main.d.ts +9 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +6 -0
- package/dist/main.js.map +1 -1
- package/package.json +15 -6
- package/src/__tests__/main.integration.test.ts +0 -39
- package/src/generated/.openapi-generator-ignore +0 -23
- package/src/generated/api.ts +0 -43516
- package/src/generated/base.ts +0 -91
- package/src/generated/common.ts +0 -164
- package/src/generated/configuration.ts +0 -123
- package/src/generated/git_push.sh +0 -57
- package/src/lib/__tests__/baseClient.unit.test.ts +0 -17
- package/src/lib/adminClient.ts +0 -37
- package/src/lib/baseClient.ts +0 -175
- package/src/lib/client.ts +0 -319
- package/src/main.ts +0 -9
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -8
- package/typedoc.json +0 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takaro API
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.0.0
|
|
6
|
+
* Contact: support@takaro.io
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { Configuration } from './configuration.js';
|
|
13
|
+
import type { RequestArgs } from './base.js';
|
|
14
|
+
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @throws {RequiredError}
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
*/
|
|
30
|
+
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
*/
|
|
35
|
+
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @export
|
|
39
|
+
*/
|
|
40
|
+
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @export
|
|
44
|
+
*/
|
|
45
|
+
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
*/
|
|
50
|
+
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
*/
|
|
60
|
+
export declare const toPathString: (url: URL) => string;
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
*/
|
|
65
|
+
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
66
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/generated-management/common.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG1D;;;GAGG;AACH,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,iBAA2B,MAAM,aAAa,MAAM,cAAc,OAAO,SAOtG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WAA2B,GAAG,gBAAgB,MAAM,kBAAkB,aAAa,kBAQhH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,WAAqB,GAAG,kBAAkB,aAAa,SAIvF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,WAA2B,GAAG,kBAAkB,aAAa,kBAQ9F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WACnB,GAAG,QACL,MAAM,UACJ,MAAM,EAAE,kBACA,aAAa,kBAS9B,CAAC;AAqBF;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAkB,GAAG,cAAc,GAAG,EAAE,SAInE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,UAAoB,GAAG,kBAAkB,GAAG,kBAAkB,aAAa,QAO5G,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAkB,GAAG,WAE7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,cACrB,WAAW,eACT,aAAa,aACf,MAAM,kBACD,aAAa,MAErB,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,UAAS,aAAa,aAA0B,MAAM,eAOhG,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Takaro API
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.0.0
|
|
8
|
+
* Contact: support@takaro.io
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
import { RequiredError } from './base.js';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
*/
|
|
19
|
+
export const DUMMY_BASE_URL = 'https://example.com';
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @throws {RequiredError}
|
|
23
|
+
* @export
|
|
24
|
+
*/
|
|
25
|
+
export const assertParamExists = function (functionName, paramName, paramValue) {
|
|
26
|
+
if (paramValue === null || paramValue === undefined) {
|
|
27
|
+
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
*/
|
|
34
|
+
export const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
35
|
+
if (configuration && configuration.apiKey) {
|
|
36
|
+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
37
|
+
? await configuration.apiKey(keyParamName)
|
|
38
|
+
: await configuration.apiKey;
|
|
39
|
+
object[keyParamName] = localVarApiKeyValue;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
*/
|
|
46
|
+
export const setBasicAuthToObject = function (object, configuration) {
|
|
47
|
+
if (configuration && (configuration.username || configuration.password)) {
|
|
48
|
+
object['auth'] = { username: configuration.username, password: configuration.password };
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @export
|
|
54
|
+
*/
|
|
55
|
+
export const setBearerAuthToObject = async function (object, configuration) {
|
|
56
|
+
if (configuration && configuration.accessToken) {
|
|
57
|
+
const accessToken = typeof configuration.accessToken === 'function'
|
|
58
|
+
? await configuration.accessToken()
|
|
59
|
+
: await configuration.accessToken;
|
|
60
|
+
object['Authorization'] = 'Bearer ' + accessToken;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @export
|
|
66
|
+
*/
|
|
67
|
+
export const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
68
|
+
if (configuration && configuration.accessToken) {
|
|
69
|
+
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
70
|
+
? await configuration.accessToken(name, scopes)
|
|
71
|
+
: await configuration.accessToken;
|
|
72
|
+
object['Authorization'] = 'Bearer ' + localVarAccessTokenValue;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function setFlattenedQueryParams(urlSearchParams, parameter, key = '') {
|
|
76
|
+
if (parameter == null)
|
|
77
|
+
return;
|
|
78
|
+
if (typeof parameter === 'object') {
|
|
79
|
+
if (Array.isArray(parameter)) {
|
|
80
|
+
parameter.forEach((item) => setFlattenedQueryParams(urlSearchParams, item, key));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
Object.keys(parameter).forEach((currentKey) => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
if (urlSearchParams.has(key)) {
|
|
88
|
+
urlSearchParams.append(key, parameter);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
urlSearchParams.set(key, parameter);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @export
|
|
98
|
+
*/
|
|
99
|
+
export const setSearchParams = function (url, ...objects) {
|
|
100
|
+
const searchParams = new URLSearchParams(url.search);
|
|
101
|
+
setFlattenedQueryParams(searchParams, objects);
|
|
102
|
+
url.search = searchParams.toString();
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @export
|
|
107
|
+
*/
|
|
108
|
+
export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
109
|
+
const nonString = typeof value !== 'string';
|
|
110
|
+
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
111
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
112
|
+
: nonString;
|
|
113
|
+
return needsSerialization ? JSON.stringify(value !== undefined ? value : {}) : value || '';
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @export
|
|
118
|
+
*/
|
|
119
|
+
export const toPathString = function (url) {
|
|
120
|
+
return url.pathname + url.search + url.hash;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @export
|
|
125
|
+
*/
|
|
126
|
+
export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
127
|
+
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
128
|
+
const axiosRequestArgs = {
|
|
129
|
+
...axiosArgs.options,
|
|
130
|
+
url: (axios.defaults.baseURL ? '' : (configuration?.basePath ?? basePath)) + axiosArgs.url,
|
|
131
|
+
};
|
|
132
|
+
return axios.request(axiosRequestArgs);
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/generated-management/common.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,YAAoB,EAAE,SAAiB,EAAE,UAAmB;IACrG,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QACpD,MAAM,IAAI,aAAa,CACrB,SAAS,EACT,sBAAsB,SAAS,uCAAuC,YAAY,GAAG,CACtF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,WAAW,MAAW,EAAE,YAAoB,EAAE,aAA6B;IAC/G,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QAC1C,MAAM,mBAAmB,GACvB,OAAO,aAAa,CAAC,MAAM,KAAK,UAAU;YACxC,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC;YAC1C,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC;QACjC,MAAM,CAAC,YAAY,CAAC,GAAG,mBAAmB,CAAC;IAC7C,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,MAAW,EAAE,aAA6B;IACtF,IAAI,aAAa,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxE,MA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CAAC;QAClE,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;AAC7F,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,GAAQ;IAC5C,OAAO,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC;AAC9C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,UACnC,SAAsB,EACtB,WAA0B,EAC1B,SAAiB,EACjB,aAA6B;IAE7B,OAAO,CAAoC,KAAK,GAAkB,WAAW,EAAE,QAAQ,GAAW,SAAS,EAAE,EAAE;QAC7G,MAAM,gBAAgB,GAAG;YACvB,GAAG,SAAS,CAAC,OAAO;YACpB,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,QAAQ,IAAI,QAAQ,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG;SAC3F,CAAC;QACF,OAAO,KAAK,CAAC,OAAO,CAAO,gBAAgB,CAAC,CAAC;IAC/C,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takaro API
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.0.0
|
|
6
|
+
* Contact: support@takaro.io
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export interface ConfigurationParameters {
|
|
13
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
14
|
+
username?: string;
|
|
15
|
+
password?: string;
|
|
16
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
17
|
+
basePath?: string;
|
|
18
|
+
serverIndex?: number;
|
|
19
|
+
baseOptions?: any;
|
|
20
|
+
formDataCtor?: new () => any;
|
|
21
|
+
}
|
|
22
|
+
export declare class Configuration {
|
|
23
|
+
/**
|
|
24
|
+
* parameter for apiKey security
|
|
25
|
+
* @param name security name
|
|
26
|
+
* @memberof Configuration
|
|
27
|
+
*/
|
|
28
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
29
|
+
/**
|
|
30
|
+
* parameter for basic security
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof Configuration
|
|
34
|
+
*/
|
|
35
|
+
username?: string;
|
|
36
|
+
/**
|
|
37
|
+
* parameter for basic security
|
|
38
|
+
*
|
|
39
|
+
* @type {string}
|
|
40
|
+
* @memberof Configuration
|
|
41
|
+
*/
|
|
42
|
+
password?: string;
|
|
43
|
+
/**
|
|
44
|
+
* parameter for oauth2 security
|
|
45
|
+
* @param name security name
|
|
46
|
+
* @param scopes oauth2 scope
|
|
47
|
+
* @memberof Configuration
|
|
48
|
+
*/
|
|
49
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
50
|
+
/**
|
|
51
|
+
* override base path
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
* @memberof Configuration
|
|
55
|
+
*/
|
|
56
|
+
basePath?: string;
|
|
57
|
+
/**
|
|
58
|
+
* override server index
|
|
59
|
+
*
|
|
60
|
+
* @type {number}
|
|
61
|
+
* @memberof Configuration
|
|
62
|
+
*/
|
|
63
|
+
serverIndex?: number;
|
|
64
|
+
/**
|
|
65
|
+
* base options for axios calls
|
|
66
|
+
*
|
|
67
|
+
* @type {any}
|
|
68
|
+
* @memberof Configuration
|
|
69
|
+
*/
|
|
70
|
+
baseOptions?: any;
|
|
71
|
+
/**
|
|
72
|
+
* The FormData constructor that will be used to create multipart form data
|
|
73
|
+
* requests. You can inject this here so that execution environments that
|
|
74
|
+
* do not support the FormData class can still run the generated client.
|
|
75
|
+
*
|
|
76
|
+
* @type {new () => FormData}
|
|
77
|
+
*/
|
|
78
|
+
formDataCtor?: new () => any;
|
|
79
|
+
constructor(param?: ConfigurationParameters);
|
|
80
|
+
/**
|
|
81
|
+
* Check if the given MIME is a JSON MIME.
|
|
82
|
+
* JSON MIME examples:
|
|
83
|
+
* application/json
|
|
84
|
+
* application/json; charset=UTF8
|
|
85
|
+
* APPLICATION/JSON
|
|
86
|
+
* application/vnd.company+json
|
|
87
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
88
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
89
|
+
*/
|
|
90
|
+
isJsonMime(mime: string): boolean;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/generated-management/configuration.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACrG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EACR,MAAM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GAAG,CAAC;IAE7B,YAAY,KAAK,GAAE,uBAA4B,EAe9C;IAED;;;;;;;;;OASG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGvC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Takaro API
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.0.0
|
|
8
|
+
* Contact: support@takaro.io
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
export class Configuration {
|
|
15
|
+
constructor(param = {}) {
|
|
16
|
+
this.apiKey = param.apiKey;
|
|
17
|
+
this.username = param.username;
|
|
18
|
+
this.password = param.password;
|
|
19
|
+
this.accessToken = param.accessToken;
|
|
20
|
+
this.basePath = param.basePath;
|
|
21
|
+
this.serverIndex = param.serverIndex;
|
|
22
|
+
this.baseOptions = {
|
|
23
|
+
headers: {
|
|
24
|
+
...param.baseOptions?.headers,
|
|
25
|
+
'User-Agent': 'OpenAPI-Generator/typescript-axios',
|
|
26
|
+
},
|
|
27
|
+
...param.baseOptions,
|
|
28
|
+
};
|
|
29
|
+
this.formDataCtor = param.formDataCtor;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if the given MIME is a JSON MIME.
|
|
33
|
+
* JSON MIME examples:
|
|
34
|
+
* application/json
|
|
35
|
+
* application/json; charset=UTF8
|
|
36
|
+
* APPLICATION/JSON
|
|
37
|
+
* application/vnd.company+json
|
|
38
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
39
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
isJsonMime(mime) {
|
|
42
|
+
const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
43
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/generated-management/configuration.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAiBH,MAAM,OAAO,aAAa;IA8DxB,YAAY,KAAK,GAA4B,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG;YACjB,OAAO,EAAE;gBACP,GAAG,KAAK,CAAC,WAAW,EAAE,OAAO;gBAC7B,YAAY,EAAE,oCAAoC;aACnD;YACD,GAAG,KAAK,CAAC,WAAW;SACrB,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACzC,CAAC;IAED;;;;;;;;;OASG;IACI,UAAU,CAAC,IAAY;QAC5B,MAAM,QAAQ,GAAW,IAAI,MAAM,CAAC,+DAA+D,EAAE,GAAG,CAAC,CAAC;QAC1G,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,6BAA6B,CAAC,CAAC;IACxG,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Takaro API
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.0.0
|
|
6
|
+
* Contact: support@takaro.io
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export * from './api.js';
|
|
13
|
+
export * from './configuration.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated-management/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated-management/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DomainApi } from '../generated/index.js';
|
|
2
|
-
import { BaseApiClient, IBaseApiClientConfig } from './baseClient.js';
|
|
1
|
+
import { DistributorApi, DomainApi, FixtureHistoryApi, StaffDomainLimitsApi, StaffPlanApi, StaffTakaroAiApi } from '../generated-management/index.js';
|
|
2
|
+
import { BaseApiClient, type IBaseApiClientConfig } from './baseClient.js';
|
|
3
3
|
export interface IAdminApiClientConfig extends IBaseApiClientConfig {
|
|
4
4
|
auth: {
|
|
5
5
|
clientSecret: string;
|
|
@@ -8,6 +8,12 @@ export interface IAdminApiClientConfig extends IBaseApiClientConfig {
|
|
|
8
8
|
export declare class AdminClient extends BaseApiClient<IAdminApiClientConfig> {
|
|
9
9
|
constructor(config: IAdminApiClientConfig);
|
|
10
10
|
private addAuthInterceptor;
|
|
11
|
+
get takaroAi(): StaffTakaroAiApi;
|
|
12
|
+
get plans(): StaffPlanApi;
|
|
13
|
+
get domainLimits(): StaffDomainLimitsApi;
|
|
11
14
|
get domain(): DomainApi;
|
|
15
|
+
get distributor(): DistributorApi;
|
|
16
|
+
/** The Fixture History Writer (GH #3730) — off unless the API enables it. */
|
|
17
|
+
get fixtureHistory(): FixtureHistoryApi;
|
|
12
18
|
}
|
|
13
19
|
//# sourceMappingURL=adminClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminClient.d.ts","sourceRoot":"","sources":["../../src/lib/adminClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"adminClient.d.ts","sourceRoot":"","sources":["../../src/lib/adminClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,qBAAa,WAAY,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IACnE,YAAY,MAAM,EAAE,qBAAqB,EAGxC;IAED,OAAO,CAAC,kBAAkB;IAa1B,IAAI,QAAQ,qBAEX;IAED,IAAI,KAAK,iBAER;IAED,IAAI,YAAY,yBAEf;IAED,IAAI,MAAM,cAQT;IAED,IAAI,WAAW,mBAQd;IAED,6EAA6E;IAC7E,IAAI,cAAc,sBAQjB;CACF"}
|
package/dist/lib/adminClient.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DomainApi } from '../generated/index.js';
|
|
1
|
+
import { DistributorApi, DomainApi, FixtureHistoryApi, StaffDomainLimitsApi, StaffPlanApi, StaffTakaroAiApi, } from '../generated-management/index.js';
|
|
2
2
|
import { BaseApiClient } from './baseClient.js';
|
|
3
3
|
export class AdminClient extends BaseApiClient {
|
|
4
4
|
constructor(config) {
|
|
@@ -7,17 +7,38 @@ export class AdminClient extends BaseApiClient {
|
|
|
7
7
|
}
|
|
8
8
|
addAuthInterceptor(token, axios) {
|
|
9
9
|
axios.interceptors.request.use(async (request) => {
|
|
10
|
-
if (request.url?.includes('health'))
|
|
10
|
+
if (request.url?.includes('health')) {
|
|
11
11
|
return request;
|
|
12
|
+
}
|
|
12
13
|
request.headers['X-Takaro-Admin-Token'] = token;
|
|
13
14
|
return request;
|
|
14
15
|
});
|
|
15
16
|
return axios;
|
|
16
17
|
}
|
|
18
|
+
get takaroAi() {
|
|
19
|
+
return new StaffTakaroAiApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
20
|
+
}
|
|
21
|
+
get plans() {
|
|
22
|
+
return new StaffPlanApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
23
|
+
}
|
|
24
|
+
get domainLimits() {
|
|
25
|
+
return new StaffDomainLimitsApi({ isJsonMime: this.isJsonMime }, '', this.axios);
|
|
26
|
+
}
|
|
17
27
|
get domain() {
|
|
18
28
|
return new DomainApi({
|
|
19
29
|
isJsonMime: this.isJsonMime,
|
|
20
30
|
}, '', this.axios);
|
|
21
31
|
}
|
|
32
|
+
get distributor() {
|
|
33
|
+
return new DistributorApi({
|
|
34
|
+
isJsonMime: this.isJsonMime,
|
|
35
|
+
}, '', this.axios);
|
|
36
|
+
}
|
|
37
|
+
/** The Fixture History Writer (GH #3730) — off unless the API enables it. */
|
|
38
|
+
get fixtureHistory() {
|
|
39
|
+
return new FixtureHistoryApi({
|
|
40
|
+
isJsonMime: this.isJsonMime,
|
|
41
|
+
}, '', this.axios);
|
|
42
|
+
}
|
|
22
43
|
}
|
|
23
44
|
//# sourceMappingURL=adminClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminClient.js","sourceRoot":"","sources":["../../src/lib/adminClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"adminClient.js","sourceRoot":"","sources":["../../src/lib/adminClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,aAAa,EAA6B,MAAM,iBAAiB,CAAC;AAS3E,MAAM,OAAO,WAAY,SAAQ,aAAoC;IACnE,YAAY,MAA6B;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC;IAEO,kBAAkB,CAAC,KAAa,EAAE,KAAoB;QAC5D,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC/C,IAAI,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACpC,OAAO,OAAO,CAAC;YACjB,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,KAAK,CAAC;YAChD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,gBAAgB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,YAAY,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,oBAAoB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,SAAS,CAClB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,cAAc,CACvB;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,IAAI,cAAc;QAChB,OAAO,IAAI,iBAAiB,CAC1B;YACE,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,EACD,EAAE,EACF,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKey.d.ts","sourceRoot":"","sources":["../../src/lib/apiKey.ts"],"names":[],"mappings":"AAsCA,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAWxD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOnD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Second implementation of @takaro/util's base62 CRC32 (this package runs in the browser);
|
|
2
|
+
// must stay byte-identical to lib-util/src/copyOnceToken.ts.
|
|
3
|
+
const TAKARO_KEY_PREFIX = 'takaro_';
|
|
4
|
+
const BASE62_ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|
5
|
+
const CHECKSUM_LENGTH = 6;
|
|
6
|
+
const MIN_KEY_LENGTH = TAKARO_KEY_PREFIX.length + CHECKSUM_LENGTH + 1;
|
|
7
|
+
const CRC32_TABLE = (() => {
|
|
8
|
+
const table = new Int32Array(256);
|
|
9
|
+
for (let i = 0; i < 256; i++) {
|
|
10
|
+
let value = i;
|
|
11
|
+
for (let bit = 0; bit < 8; bit++) {
|
|
12
|
+
value = value & 1 ? (value >>> 1) ^ 0xedb88320 : value >>> 1;
|
|
13
|
+
}
|
|
14
|
+
table[i] = value;
|
|
15
|
+
}
|
|
16
|
+
return table;
|
|
17
|
+
})();
|
|
18
|
+
function crc32(input) {
|
|
19
|
+
let crc = -1;
|
|
20
|
+
for (let i = 0; i < input.length; i++) {
|
|
21
|
+
crc = (crc >>> 8) ^ CRC32_TABLE[(crc ^ input.charCodeAt(i)) & 0xff];
|
|
22
|
+
}
|
|
23
|
+
return (crc ^ -1) >>> 0;
|
|
24
|
+
}
|
|
25
|
+
function crc32Base62(input) {
|
|
26
|
+
let remaining = crc32(input);
|
|
27
|
+
let encoded = '';
|
|
28
|
+
do {
|
|
29
|
+
encoded = BASE62_ALPHABET[remaining % 62] + encoded;
|
|
30
|
+
remaining = Math.floor(remaining / 62);
|
|
31
|
+
} while (remaining > 0);
|
|
32
|
+
return encoded.padStart(CHECKSUM_LENGTH, '0');
|
|
33
|
+
}
|
|
34
|
+
export function isValidApiKeyFormat(key) {
|
|
35
|
+
if (typeof key !== 'string' || key.length < MIN_KEY_LENGTH || !key.startsWith(TAKARO_KEY_PREFIX)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
for (const character of key.slice(TAKARO_KEY_PREFIX.length)) {
|
|
39
|
+
if (!BASE62_ALPHABET.includes(character) && character !== '_') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const body = key.slice(0, -CHECKSUM_LENGTH);
|
|
44
|
+
return crc32Base62(body) === key.slice(-CHECKSUM_LENGTH);
|
|
45
|
+
}
|
|
46
|
+
export function assertValidApiKey(key) {
|
|
47
|
+
if (typeof key !== 'string' || !key.startsWith(TAKARO_KEY_PREFIX)) {
|
|
48
|
+
throw new Error(`Invalid Takaro API key: it does not start with '${TAKARO_KEY_PREFIX}'`);
|
|
49
|
+
}
|
|
50
|
+
if (!isValidApiKeyFormat(key)) {
|
|
51
|
+
throw new Error('Invalid Takaro API key: the checksum does not match, the key is likely mistyped or truncated');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=apiKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKey.js","sourceRoot":"","sources":["../../src/lib/apiKey.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,6DAA6D;AAC7D,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAEpC,MAAM,eAAe,GAAG,gEAAgE,CAAC;AACzF,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,iBAAiB,CAAC,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC;AAEtE,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;IACxB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;YACjC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;I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,CAAC,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,mDAAmD,iBAAiB,GAAG,CAAC,CAAC;IAC3F,CAAC;IACD,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAC;IAClH,CAAC;AACH,CAAC"}
|
package/dist/lib/baseClient.d.ts
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { MetaApi } from '../generated/api.js';
|
|
2
|
-
import { AxiosInstance } from 'axios';
|
|
3
|
-
/**
|
|
4
|
-
* Axios defaults to NO timeout, so a request whose TCP connection stalls blocks its
|
|
5
|
-
* await forever. During incident run-29688761260 a single POST hung for ~80 minutes
|
|
6
|
-
* (Tempo trace 15f5708701c38676355a0e42cb9f7ffe: a client span with no server span),
|
|
7
|
-
* freezing 3 of 4 CI shards until the 53-minute job timeout.
|
|
8
|
-
*
|
|
9
|
-
* 120s is deliberately generous — the goal is "not infinite", not "tight". The slowest
|
|
10
|
-
* legitimate single call is a domain create under full 4-shard CI load at roughly 30s.
|
|
11
|
-
* Individual long-running calls should pass a per-request `{ timeout }` override rather
|
|
12
|
-
* than raising this.
|
|
13
|
-
*/
|
|
2
|
+
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
14
3
|
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 120000;
|
|
15
4
|
export interface IBaseApiClientConfig {
|
|
16
5
|
url: string;
|
|
17
6
|
log?: Logger | false;
|
|
18
7
|
/** Per-request timeout in ms. Defaults to DEFAULT_REQUEST_TIMEOUT_MS. */
|
|
19
8
|
timeoutMs?: number;
|
|
9
|
+
axiosFactory?: (config: AxiosRequestConfig) => AxiosInstance;
|
|
20
10
|
}
|
|
21
11
|
interface Logger {
|
|
22
12
|
info: (msg: string, meta?: unknown) => void;
|
|
@@ -34,10 +24,7 @@ export declare class BaseApiClient<T extends IBaseApiClientConfig> {
|
|
|
34
24
|
get axiosInstance(): AxiosInstance;
|
|
35
25
|
isJsonMime(mime: string): mime is "application/json";
|
|
36
26
|
private addLoggers;
|
|
37
|
-
/**
|
|
38
|
-
* Wait until the API reports that it is healthy
|
|
39
|
-
* @param timeout in milliseconds
|
|
40
|
-
*/
|
|
27
|
+
/** Polls until the API reports healthy, or throws after `timeout` ms. */
|
|
41
28
|
waitUntilHealthy(timeout?: number): Promise<void>;
|
|
42
29
|
get meta(): MetaApi;
|
|
43
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseClient.d.ts","sourceRoot":"","sources":["../../src/lib/baseClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAc,
|
|
1
|
+
{"version":3,"file":"baseClient.d.ts","sourceRoot":"","sources":["../../src/lib/baseClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAc,EAAmB,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAG5F,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,aAAa,CAAC;CAC9D;AAED,UAAU,MAAM;IACd,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,qBAAa,aAAa,CAAC,CAAC,SAAS,oBAAoB;IAS3C,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IARxC,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC;IAC/B,SAAS,CAAC,GAAG,EAAE,MAAM,CAKnB;IAEF,YAA+B,MAAM,EAAE,CAAC,EAoBvC;IAED,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAEnC;IAED,SAAS,CAAC,QAAQ,EAAE,MAAM,QAEzB;IAED,IAAI,aAAa,kBAEhB;IAED,UAAU,CAAC,IAAI,EAAE,MAAM,8BAEtB;IAED,OAAO,CAAC,UAAU;IAgElB,yEAAyE;IACnE,gBAAgB,CAAC,OAAO,SAAS,iBAmBtC;IAED,IAAI,IAAI,YAQP;CACF"}
|
package/dist/lib/baseClient.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { MetaApi } from '../generated/api.js';
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
|
|
4
|
-
* Axios defaults to NO timeout, so a request whose TCP connection stalls blocks its
|
|
5
|
-
* await forever. During incident run-29688761260 a single POST hung for ~80 minutes
|
|
6
|
-
* (Tempo trace 15f5708701c38676355a0e42cb9f7ffe: a client span with no server span),
|
|
7
|
-
* freezing 3 of 4 CI shards until the 53-minute job timeout.
|
|
8
|
-
*
|
|
9
|
-
* 120s is deliberately generous — the goal is "not infinite", not "tight". The slowest
|
|
10
|
-
* legitimate single call is a domain create under full 4-shard CI load at roughly 30s.
|
|
11
|
-
* Individual long-running calls should pass a per-request `{ timeout }` override rather
|
|
12
|
-
* than raising this.
|
|
13
|
-
*/
|
|
3
|
+
// Axios defaults to NO timeout, so a stalled connection blocks forever (run-29688761260).
|
|
14
4
|
export const DEFAULT_REQUEST_TIMEOUT_MS = 120_000;
|
|
15
5
|
export class BaseApiClient {
|
|
16
6
|
constructor(config) {
|
|
@@ -21,11 +11,9 @@ export class BaseApiClient {
|
|
|
21
11
|
warn: () => { },
|
|
22
12
|
debug: () => { },
|
|
23
13
|
};
|
|
24
|
-
// Browsers refuse to let JS set
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const isBrowser = typeof globalThis['window'] !== 'undefined' &&
|
|
28
|
-
typeof globalThis['document'] !== 'undefined';
|
|
14
|
+
// Browsers refuse to let JS set User-Agent ("forbidden header"); include it only outside a browser.
|
|
15
|
+
const isBrowser = globalThis.window !== undefined &&
|
|
16
|
+
globalThis.document !== undefined;
|
|
29
17
|
const axiosConfig = {
|
|
30
18
|
baseURL: this.config.url,
|
|
31
19
|
headers: {
|
|
@@ -35,9 +23,11 @@ export class BaseApiClient {
|
|
|
35
23
|
withCredentials: true,
|
|
36
24
|
timeout: this.config.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS,
|
|
37
25
|
};
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
const createAxios = this.config.axiosFactory ?? ((config) => axios.create(config));
|
|
27
|
+
this.axios = this.addLoggers(createAxios(axiosConfig));
|
|
28
|
+
if (this.config.log) {
|
|
40
29
|
this.log = this.config.log;
|
|
30
|
+
}
|
|
41
31
|
}
|
|
42
32
|
setHeader(key, value) {
|
|
43
33
|
this.axios.defaults.headers.common[key] = value;
|
|
@@ -99,10 +89,7 @@ export class BaseApiClient {
|
|
|
99
89
|
});
|
|
100
90
|
return axios;
|
|
101
91
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Wait until the API reports that it is healthy
|
|
104
|
-
* @param timeout in milliseconds
|
|
105
|
-
*/
|
|
92
|
+
/** Polls until the API reports healthy, or throws after `timeout` ms. */
|
|
106
93
|
async waitUntilHealthy(timeout = 600000) {
|
|
107
94
|
const start = Date.now();
|
|
108
95
|
let isHealthy = false;
|