@quantcdn/quant-client 3.0.4 → 4.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 +148 -18
- package/api.ts +24933 -0
- package/base.ts +89 -0
- package/common.ts +150 -0
- package/configuration.ts +115 -0
- package/dist/api.d.ts +17980 -2
- package/dist/api.js +13594 -16
- package/dist/base.d.ts +66 -0
- package/dist/base.js +68 -0
- package/dist/common.d.ts +65 -0
- package/dist/common.js +161 -0
- package/dist/configuration.d.ts +91 -0
- package/dist/configuration.js +44 -0
- package/dist/esm/api.d.ts +17980 -0
- package/dist/esm/api.js +13455 -0
- package/dist/esm/base.d.ts +66 -0
- package/dist/esm/base.js +63 -0
- package/dist/esm/common.d.ts +65 -0
- package/dist/esm/common.js +149 -0
- package/dist/esm/configuration.d.ts +91 -0
- package/dist/esm/configuration.js +40 -0
- package/dist/esm/examples/basic-usage.d.ts +4 -0
- package/dist/esm/examples/basic-usage.js +93 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +15 -0
- package/dist/examples/basic-usage.d.ts +4 -0
- package/dist/examples/basic-usage.js +95 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +31 -0
- package/index.ts +18 -0
- package/package.json +44 -22
- package/tsconfig.json +18 -0
- package/dist/api/apis.d.ts +0 -32
- package/dist/api/apis.js +0 -50
- package/dist/api/applicationsApi.d.ts +0 -104
- package/dist/api/applicationsApi.js +0 -431
- package/dist/api/backupManagementApi.d.ts +0 -112
- package/dist/api/backupManagementApi.js +0 -464
- package/dist/api/commandsApi.d.ts +0 -80
- package/dist/api/commandsApi.js +0 -316
- package/dist/api/composeApi.d.ts +0 -67
- package/dist/api/composeApi.js +0 -240
- package/dist/api/containersApi.d.ts +0 -67
- package/dist/api/containersApi.js +0 -236
- package/dist/api/cronApi.d.ts +0 -151
- package/dist/api/cronApi.js +0 -681
- package/dist/api/environmentsApi.d.ts +0 -194
- package/dist/api/environmentsApi.js +0 -869
- package/dist/api/sSHAccessApi.d.ts +0 -50
- package/dist/api/sSHAccessApi.js +0 -162
- package/dist/api/scalingPolicyApi.d.ts +0 -82
- package/dist/api/scalingPolicyApi.js +0 -307
- package/dist/api/variablesApi.d.ts +0 -83
- package/dist/api/variablesApi.js +0 -313
- package/dist/api/volumesApi.d.ts +0 -97
- package/dist/api/volumesApi.js +0 -405
- package/dist/model/application.d.ts +0 -38
- package/dist/model/application.js +0 -93
- package/dist/model/command.d.ts +0 -34
- package/dist/model/command.js +0 -73
- package/dist/model/compose.d.ts +0 -32
- package/dist/model/compose.js +0 -58
- package/dist/model/configuration.d.ts +0 -26
- package/dist/model/configuration.js +0 -30
- package/dist/model/container.d.ts +0 -75
- package/dist/model/container.js +0 -121
- package/dist/model/containerDependsOnInner.d.ts +0 -40
- package/dist/model/containerDependsOnInner.js +0 -42
- package/dist/model/containerEnvironmentInner.d.ts +0 -32
- package/dist/model/containerEnvironmentInner.js +0 -33
- package/dist/model/containerHealthCheck.d.ts +0 -47
- package/dist/model/containerHealthCheck.js +0 -65
- package/dist/model/containerImageReference.d.ts +0 -38
- package/dist/model/containerImageReference.js +0 -40
- package/dist/model/containerMountPointsInner.d.ts +0 -33
- package/dist/model/containerMountPointsInner.js +0 -41
- package/dist/model/containerSecretsInner.d.ts +0 -32
- package/dist/model/containerSecretsInner.js +0 -33
- package/dist/model/createApplicationRequest.d.ts +0 -28
- package/dist/model/createApplicationRequest.js +0 -43
- package/dist/model/createBackup202Response.d.ts +0 -27
- package/dist/model/createBackup202Response.js +0 -38
- package/dist/model/createBackupRequest.d.ts +0 -32
- package/dist/model/createBackupRequest.js +0 -33
- package/dist/model/createCommandRequest.d.ts +0 -25
- package/dist/model/createCommandRequest.js +0 -28
- package/dist/model/createCronJob422Response.d.ts +0 -26
- package/dist/model/createCronJob422Response.js +0 -33
- package/dist/model/createCronJobRequest.d.ts +0 -30
- package/dist/model/createCronJobRequest.js +0 -56
- package/dist/model/createEnvironmentRequest.d.ts +0 -34
- package/dist/model/createEnvironmentRequest.js +0 -53
- package/dist/model/cron.d.ts +0 -27
- package/dist/model/cron.js +0 -38
- package/dist/model/cronRun.d.ts +0 -48
- package/dist/model/cronRun.js +0 -89
- package/dist/model/deleteBackup200Response.d.ts +0 -26
- package/dist/model/deleteBackup200Response.js +0 -33
- package/dist/model/downloadBackup200Response.d.ts +0 -36
- package/dist/model/downloadBackup200Response.js +0 -38
- package/dist/model/environment.d.ts +0 -45
- package/dist/model/environment.js +0 -103
- package/dist/model/getEcrLoginCredentials200Response.d.ts +0 -28
- package/dist/model/getEcrLoginCredentials200Response.js +0 -43
- package/dist/model/getScalingPolicies200Response.d.ts +0 -26
- package/dist/model/getScalingPolicies200Response.js +0 -28
- package/dist/model/getSshAccessCredentials200Response.d.ts +0 -34
- package/dist/model/getSshAccessCredentials200Response.js +0 -68
- package/dist/model/getSshAccessCredentials200ResponseCredentials.d.ts +0 -28
- package/dist/model/getSshAccessCredentials200ResponseCredentials.js +0 -43
- package/dist/model/listBackups200Response.d.ts +0 -32
- package/dist/model/listBackups200Response.js +0 -43
- package/dist/model/listBackups200ResponseBackupsInner.d.ts +0 -37
- package/dist/model/listBackups200ResponseBackupsInner.js +0 -88
- package/dist/model/listBackups422Response.d.ts +0 -25
- package/dist/model/listBackups422Response.js +0 -28
- package/dist/model/models.d.ts +0 -89
- package/dist/model/models.js +0 -387
- package/dist/model/scalingPolicy.d.ts +0 -35
- package/dist/model/scalingPolicy.js +0 -51
- package/dist/model/syncOperation.d.ts +0 -31
- package/dist/model/syncOperation.js +0 -58
- package/dist/model/syncToEnvironmentRequest.d.ts +0 -25
- package/dist/model/syncToEnvironmentRequest.js +0 -28
- package/dist/model/updateComposeRequest.d.ts +0 -26
- package/dist/model/updateComposeRequest.js +0 -28
- package/dist/model/updateCronJobRequest.d.ts +0 -29
- package/dist/model/updateCronJobRequest.js +0 -48
- package/dist/model/updateEnvironmentComposeRequest.d.ts +0 -26
- package/dist/model/updateEnvironmentComposeRequest.js +0 -28
- package/dist/model/updateEnvironmentRequest.d.ts +0 -34
- package/dist/model/updateEnvironmentRequest.js +0 -38
- package/dist/model/updateEnvironmentStateRequest.d.ts +0 -26
- package/dist/model/updateEnvironmentStateRequest.js +0 -33
- package/dist/model/updateEnvironmentVariableRequest.d.ts +0 -25
- package/dist/model/updateEnvironmentVariableRequest.js +0 -28
- package/dist/model/validateCompose200Response.d.ts +0 -33
- package/dist/model/validateCompose200Response.js +0 -38
- package/dist/model/validateCompose422Response.d.ts +0 -25
- package/dist/model/validateCompose422Response.js +0 -28
- package/dist/model/validateComposeRequest.d.ts +0 -36
- package/dist/model/validateComposeRequest.js +0 -38
- package/dist/model/variable.d.ts +0 -26
- package/dist/model/variable.js +0 -33
- package/dist/model/volume.d.ts +0 -32
- package/dist/model/volume.js +0 -63
package/README.md
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
# Quant TypeScript Client
|
|
2
2
|
|
|
3
|
-
A TypeScript client for the Quant API.
|
|
3
|
+
A comprehensive TypeScript client for the Quant API, providing access to all Quant Cloud services including applications, environments, containers, cron jobs, and more.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install quant-ts-client
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { EnvironmentsApi, Configuration } from '
|
|
14
|
+
import { EnvironmentsApi, Configuration } from 'quant-ts-client';
|
|
15
15
|
|
|
16
16
|
// Create a configuration with your API key
|
|
17
17
|
const config = new Configuration({
|
|
18
18
|
apiKey: 'YOUR_API_KEY',
|
|
19
|
-
basePath: '
|
|
19
|
+
basePath: 'https://api.quant.example.com' // Replace with your actual API base URL
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
// Initialize an API instance
|
|
23
|
-
const environmentsApi = new EnvironmentsApi(config);
|
|
23
|
+
const environmentsApi = new EnvironmentsApi(config.basePath);
|
|
24
|
+
environmentsApi.setDefaultAuthentication({
|
|
25
|
+
applyToRequest: (requestOptions) => {
|
|
26
|
+
if (requestOptions && requestOptions.headers) {
|
|
27
|
+
requestOptions.headers["Authorization"] = `Bearer ${config.apiKey}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
24
31
|
|
|
25
|
-
// Example:
|
|
26
|
-
environmentsApi.
|
|
32
|
+
// Example: List all environments for an application
|
|
33
|
+
environmentsApi.listEnvironments('your-org-id', 'your-app-id')
|
|
27
34
|
.then(response => {
|
|
28
|
-
console.log(response.
|
|
35
|
+
console.log(response.body);
|
|
29
36
|
})
|
|
30
37
|
.catch(error => {
|
|
31
38
|
console.error(error);
|
|
@@ -36,30 +43,153 @@ environmentsApi.getAllEnvironments()
|
|
|
36
43
|
|
|
37
44
|
The client provides access to the following API endpoints:
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
- `ContainersApi`
|
|
43
|
-
- `
|
|
44
|
-
- `
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- `
|
|
46
|
+
### Core Services
|
|
47
|
+
- `ApplicationsApi` - Manage applications
|
|
48
|
+
- `EnvironmentsApi` - Manage environments
|
|
49
|
+
- `ContainersApi` - Manage containers
|
|
50
|
+
- `CommandsApi` - Execute commands
|
|
51
|
+
- `ComposeApi` - Docker Compose management
|
|
52
|
+
|
|
53
|
+
### Scheduling & Automation
|
|
54
|
+
- `CronApi` - Manage cron jobs
|
|
55
|
+
- `CrawlersApi` - Web crawler management
|
|
56
|
+
- `CrawlerSchedulesApi` - Crawler scheduling
|
|
57
|
+
|
|
58
|
+
### Data & Storage
|
|
59
|
+
- `VariablesApi` - Environment variables
|
|
60
|
+
- `VolumesApi` - Volume management
|
|
61
|
+
- `KVApi` - Key-value storage
|
|
62
|
+
- `BackupManagementApi` - Backup operations
|
|
63
|
+
|
|
64
|
+
### Security & Access
|
|
65
|
+
- `SSHAccessApi` - SSH access management
|
|
66
|
+
- `OrganizationsApi` - Organization management
|
|
67
|
+
- `ProjectsApi` - Project management
|
|
68
|
+
|
|
69
|
+
### Rules & Traffic Management
|
|
70
|
+
- `RulesAuthApi` - Authentication rules
|
|
71
|
+
- `RulesBotChallengeApi` - Bot challenge rules
|
|
72
|
+
- `RulesContentFilterApi` - Content filtering rules
|
|
73
|
+
- `RulesCustomResponseApi` - Custom response rules
|
|
74
|
+
- `RulesFunctionApi` - Function-based rules
|
|
75
|
+
- `RulesHeadersApi` - Header manipulation rules
|
|
76
|
+
- `RulesProxyApi` - Proxy rules
|
|
77
|
+
- `RulesRedirectApi` - Redirect rules
|
|
78
|
+
- `RulesServeStaticApi` - Static file serving rules
|
|
79
|
+
|
|
80
|
+
### Infrastructure
|
|
81
|
+
- `DomainsApi` - Domain management
|
|
82
|
+
- `HeadersApi` - Custom headers
|
|
83
|
+
- `PurgeApi` - Cache purging
|
|
84
|
+
- `ScalingPolicyApi` - Auto-scaling policies
|
|
85
|
+
|
|
86
|
+
## Examples
|
|
87
|
+
|
|
88
|
+
### Working with Applications
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { ApplicationsApi } from 'quant-ts-client';
|
|
92
|
+
|
|
93
|
+
const appsApi = new ApplicationsApi(config.basePath);
|
|
94
|
+
appsApi.setDefaultAuthentication(auth);
|
|
95
|
+
|
|
96
|
+
// List all applications
|
|
97
|
+
const apps = await appsApi.listApplications('your-org-id');
|
|
98
|
+
|
|
99
|
+
// Create a new application
|
|
100
|
+
const newApp = await appsApi.createApplication('your-org-id', {
|
|
101
|
+
name: 'my-app',
|
|
102
|
+
description: 'My new application'
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Managing Environments
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { EnvironmentsApi } from 'quant-ts-client';
|
|
110
|
+
|
|
111
|
+
const envsApi = new EnvironmentsApi(config.basePath);
|
|
112
|
+
envsApi.setDefaultAuthentication(auth);
|
|
113
|
+
|
|
114
|
+
// Create an environment
|
|
115
|
+
const env = await envsApi.createEnvironment('org-id', 'app-id', {
|
|
116
|
+
name: 'production',
|
|
117
|
+
region: 'us-east-1'
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Get environment logs
|
|
121
|
+
const logs = await envsApi.getEnvironmentLogs('org-id', 'app-id', 'env-id');
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Working with Cron Jobs
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { CronApi } from 'quant-ts-client';
|
|
128
|
+
|
|
129
|
+
const cronApi = new CronApi(config.basePath);
|
|
130
|
+
cronApi.setDefaultAuthentication(auth);
|
|
131
|
+
|
|
132
|
+
// Create a cron job
|
|
133
|
+
const cronJob = await cronApi.createCronJob('org-id', 'app-id', 'env-id', {
|
|
134
|
+
name: 'daily-backup',
|
|
135
|
+
schedule: '0 2 * * *',
|
|
136
|
+
command: 'backup-database'
|
|
137
|
+
});
|
|
138
|
+
```
|
|
48
139
|
|
|
49
140
|
## Development
|
|
50
141
|
|
|
142
|
+
### Prerequisites
|
|
143
|
+
|
|
144
|
+
- Node.js 16+
|
|
145
|
+
- TypeScript 4.9+
|
|
146
|
+
|
|
51
147
|
### Building the package
|
|
52
148
|
|
|
53
149
|
```bash
|
|
150
|
+
npm install
|
|
54
151
|
npm run build
|
|
55
152
|
```
|
|
56
153
|
|
|
154
|
+
### Testing locally
|
|
155
|
+
|
|
156
|
+
To test the package locally in another project:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# In the SDK directory
|
|
160
|
+
npm run build
|
|
161
|
+
npm link
|
|
162
|
+
|
|
163
|
+
# In your project directory
|
|
164
|
+
npm link quant-ts-client
|
|
165
|
+
```
|
|
166
|
+
|
|
57
167
|
### Publishing the package
|
|
58
168
|
|
|
59
169
|
```bash
|
|
60
170
|
npm publish
|
|
61
171
|
```
|
|
62
172
|
|
|
173
|
+
## TypeScript Support
|
|
174
|
+
|
|
175
|
+
This package includes full TypeScript definitions and is built with TypeScript 4.9+. All API methods, request/response types, and configuration options are fully typed.
|
|
176
|
+
|
|
177
|
+
## Error Handling
|
|
178
|
+
|
|
179
|
+
The client includes comprehensive error handling with typed error responses:
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
try {
|
|
183
|
+
const response = await environmentsApi.getEnvironment('org', 'app', 'env');
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (error instanceof HttpError) {
|
|
186
|
+
console.error(`HTTP ${error.statusCode}: ${error.message}`);
|
|
187
|
+
} else {
|
|
188
|
+
console.error('Unexpected error:', error);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
63
193
|
## License
|
|
64
194
|
|
|
65
|
-
MIT
|
|
195
|
+
MIT
|