@devrev/typescript-sdk 1.0.2 → 1.1.3
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/LICENSE +21 -0
- package/README.md +31 -48
- package/package.json +17 -10
- package/.eslintignore +0 -2
- package/.github/workflows/npm-publish.yml +0 -27
- package/.prettierignore +0 -4
- package/.prettierrc +0 -15
- package/.vscode/extensions.json +0 -8
- package/.vscode/launch.json +0 -17
- package/.vscode/settings.json +0 -31
- package/USER_README.md +0 -16
- package/nodemon.json +0 -5
- package/src/auto-generated/beta/beta-devrev-sdk.ts +0 -1826
- package/src/auto-generated/internal/private-internal-devrev-sdk.ts +0 -54739
- package/src/auto-generated/public-devrev-sdk.ts +0 -4009
- package/src/beta-data-contracts.json +0 -3271
- package/src/client_setup.ts +0 -64
- package/src/private-internal-data-contracts.json +0 -98025
- package/src/public-data-contracts.json +0 -6922
- package/src/workflow/workflow.test.ts +0 -26
- package/src/workflow/workflow.ts +0 -54
- package/templates/README.md +0 -17
- package/templates/base/README.md +0 -8
- package/templates/base/data-contract-jsdoc.ejs +0 -37
- package/templates/base/data-contracts.ejs +0 -28
- package/templates/base/enum-data-contract.ejs +0 -12
- package/templates/base/http-client.ejs +0 -3
- package/templates/base/http-clients/axios-http-client.ejs +0 -138
- package/templates/base/http-clients/fetch-http-client.ejs +0 -224
- package/templates/base/interface-data-contract.ejs +0 -10
- package/templates/base/object-field-jsdoc.ejs +0 -28
- package/templates/base/route-docs.ejs +0 -30
- package/templates/base/route-name.ejs +0 -43
- package/templates/base/route-type.ejs +0 -22
- package/templates/base/type-data-contract.ejs +0 -15
- package/templates/default/README.md +0 -7
- package/templates/default/api.ejs +0 -64
- package/templates/default/procedure-call.ejs +0 -100
- package/templates/default/route-types.ejs +0 -26
- package/templates/modular/README.md +0 -7
- package/templates/modular/api.ejs +0 -28
- package/templates/modular/procedure-call.ejs +0 -100
- package/templates/modular/route-types.ejs +0 -18
- package/tsconfig.eslint.json +0 -4
- package/tsconfig.json +0 -25
package/src/client_setup.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import * as Beta from './auto-generated/beta/beta-devrev-sdk';
|
|
3
|
-
import * as Sdk from './auto-generated/public-devrev-sdk';
|
|
4
|
-
|
|
5
|
-
export function setup(url = 'http://api.devrev.ai', token = process.env.SDK_TOKEN) {
|
|
6
|
-
|
|
7
|
-
const axiosConfig: AxiosRequestConfig = {
|
|
8
|
-
baseURL: url,
|
|
9
|
-
headers: {
|
|
10
|
-
Authorization: token,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
const devrevSDK = new Sdk.Api({
|
|
14
|
-
...axiosConfig,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
devrevSDK.instance.interceptors.request.use((config) => {
|
|
18
|
-
for (const key in config.params) {
|
|
19
|
-
// Check if the property is an array
|
|
20
|
-
if (Array.isArray(config.params[key])) {
|
|
21
|
-
// Join the array with a comma
|
|
22
|
-
config.params[key] = config.params[key]
|
|
23
|
-
.map((value: any) => {
|
|
24
|
-
return `"${value}"`;
|
|
25
|
-
})
|
|
26
|
-
.join(',');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return config;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
//add this in
|
|
33
|
-
return devrevSDK;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function setupBeta(url = 'http://api.devrev.ai', token = process.env.SDK_TOKEN) {
|
|
37
|
-
|
|
38
|
-
const axiosConfig: AxiosRequestConfig = {
|
|
39
|
-
baseURL: url,
|
|
40
|
-
headers: {
|
|
41
|
-
Authorization: token,
|
|
42
|
-
'X-Devrev-Scope': 'beta',
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const devrevSDK = new Beta.Api({
|
|
46
|
-
...axiosConfig,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
devrevSDK.instance.interceptors.request.use((config) => {
|
|
50
|
-
for (const key in config.params) {
|
|
51
|
-
// Check if the property is an array
|
|
52
|
-
if (Array.isArray(config.params[key])) {
|
|
53
|
-
// Join the array with a comma
|
|
54
|
-
config.params[key] = config.params[key]
|
|
55
|
-
.map((value: any) => {
|
|
56
|
-
return `"${value}"`;
|
|
57
|
-
})
|
|
58
|
-
.join(',');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return config;
|
|
62
|
-
});
|
|
63
|
-
return devrevSDK;
|
|
64
|
-
}
|