@quantcdn/quant-client 2.0.13 → 3.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 +49 -72
- package/dist/api/apis.d.ts +30 -0
- package/dist/api/apis.js +48 -0
- package/dist/api/applicationsApi.d.ts +104 -0
- package/dist/api/applicationsApi.js +431 -0
- package/dist/api/commandsApi.d.ts +80 -0
- package/dist/api/commandsApi.js +316 -0
- package/dist/api/composeApi.d.ts +66 -0
- package/dist/api/composeApi.js +236 -0
- package/dist/api/containersApi.d.ts +67 -0
- package/dist/api/containersApi.js +236 -0
- package/dist/api/cronApi.d.ts +151 -0
- package/dist/api/cronApi.js +681 -0
- package/dist/api/environmentsApi.d.ts +194 -0
- package/dist/api/environmentsApi.js +861 -0
- package/dist/api/sSHAccessApi.d.ts +50 -0
- package/dist/api/sSHAccessApi.js +162 -0
- package/dist/api/scalingPolicyApi.d.ts +82 -0
- package/dist/api/scalingPolicyApi.js +307 -0
- package/dist/api/variablesApi.d.ts +83 -0
- package/dist/api/variablesApi.js +313 -0
- package/dist/api/volumesApi.d.ts +97 -0
- package/dist/api/volumesApi.js +405 -0
- package/dist/api.d.ts +2 -0
- package/dist/api.js +19 -0
- package/dist/model/application.d.ts +38 -0
- package/dist/model/application.js +93 -0
- package/dist/model/command.d.ts +34 -0
- package/dist/model/command.js +73 -0
- package/dist/model/compose.d.ts +32 -0
- package/dist/model/compose.js +58 -0
- package/dist/model/configuration.d.ts +26 -0
- package/dist/model/configuration.js +30 -0
- package/dist/model/container.d.ts +38 -0
- package/dist/model/container.js +78 -0
- package/dist/model/containerEnvironmentInner.d.ts +26 -0
- package/dist/model/containerEnvironmentInner.js +33 -0
- package/dist/model/containerImageReference.d.ts +28 -0
- package/dist/model/containerImageReference.js +43 -0
- package/dist/model/containerMountPointsInner.d.ts +27 -0
- package/dist/model/containerMountPointsInner.js +38 -0
- package/dist/model/createApplicationRequest.d.ts +28 -0
- package/dist/model/createApplicationRequest.js +43 -0
- package/dist/model/createCommandRequest.d.ts +25 -0
- package/dist/model/createCommandRequest.js +28 -0
- package/dist/model/createCronJob422Response.d.ts +26 -0
- package/dist/model/createCronJob422Response.js +33 -0
- package/dist/model/createCronJobRequest.d.ts +30 -0
- package/dist/model/createCronJobRequest.js +56 -0
- package/dist/model/createEnvironmentRequest.d.ts +34 -0
- package/dist/model/createEnvironmentRequest.js +53 -0
- package/dist/model/cron.d.ts +27 -0
- package/dist/model/cron.js +38 -0
- package/dist/model/cronRun.d.ts +48 -0
- package/dist/model/cronRun.js +89 -0
- package/dist/model/environment.d.ts +45 -0
- package/dist/model/environment.js +103 -0
- package/dist/model/getEcrLoginCredentials200Response.d.ts +28 -0
- package/dist/model/getEcrLoginCredentials200Response.js +43 -0
- package/dist/model/getScalingPolicies200Response.d.ts +26 -0
- package/dist/model/getScalingPolicies200Response.js +28 -0
- package/dist/model/getSshAccessCredentials200Response.d.ts +34 -0
- package/dist/model/getSshAccessCredentials200Response.js +68 -0
- package/dist/model/getSshAccessCredentials200ResponseCredentials.d.ts +28 -0
- package/dist/model/getSshAccessCredentials200ResponseCredentials.js +43 -0
- package/dist/model/models.d.ts +78 -0
- package/dist/model/models.js +352 -0
- package/dist/model/scalingPolicy.d.ts +35 -0
- package/dist/model/scalingPolicy.js +51 -0
- package/dist/model/syncOperation.d.ts +31 -0
- package/dist/model/syncOperation.js +58 -0
- package/dist/model/syncToEnvironmentRequest.d.ts +25 -0
- package/dist/model/syncToEnvironmentRequest.js +28 -0
- package/dist/model/updateComposeRequest.d.ts +26 -0
- package/dist/model/updateComposeRequest.js +28 -0
- package/dist/model/updateCronJobRequest.d.ts +29 -0
- package/dist/model/updateCronJobRequest.js +48 -0
- package/dist/model/updateEnvironmentComposeRequest.d.ts +26 -0
- package/dist/model/updateEnvironmentComposeRequest.js +28 -0
- package/dist/model/updateEnvironmentRequest.d.ts +26 -0
- package/dist/model/updateEnvironmentRequest.js +28 -0
- package/dist/model/updateEnvironmentStateRequest.d.ts +26 -0
- package/dist/model/updateEnvironmentStateRequest.js +33 -0
- package/dist/model/updateEnvironmentVariableRequest.d.ts +25 -0
- package/dist/model/updateEnvironmentVariableRequest.js +28 -0
- package/dist/model/validateCompose200Response.d.ts +27 -0
- package/dist/model/validateCompose200Response.js +38 -0
- package/dist/model/validateComposeRequest.d.ts +25 -0
- package/dist/model/validateComposeRequest.js +28 -0
- package/dist/model/variable.d.ts +26 -0
- package/dist/model/variable.js +33 -0
- package/dist/model/volume.d.ts +32 -0
- package/dist/model/volume.js +63 -0
- package/package.json +21 -40
- package/dist/src/client.d.ts +0 -15
- package/dist/src/client.js +0 -380
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +0 -42
- package/dist/src/interfaces.d.ts +0 -34
- package/dist/src/interfaces.js +0 -2
- package/dist/src/response.d.ts +0 -15
- package/dist/src/response.js +0 -103
- package/dist/src/types.d.ts +0 -68
- package/dist/src/types.js +0 -8
- package/dist/tests/client.test.d.ts +0 -1
- package/dist/tests/client.test.js +0 -191
- package/dist/tests/response.test.d.ts +0 -1
- package/dist/tests/response.test.js +0 -133
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QuantCloud API
|
|
4
|
+
* QuantCloud API
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Variable = void 0;
|
|
15
|
+
class Variable {
|
|
16
|
+
static getAttributeTypeMap() {
|
|
17
|
+
return Variable.attributeTypeMap;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Variable = Variable;
|
|
21
|
+
Variable.discriminator = undefined;
|
|
22
|
+
Variable.attributeTypeMap = [
|
|
23
|
+
{
|
|
24
|
+
"name": "key",
|
|
25
|
+
"baseName": "key",
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "value",
|
|
30
|
+
"baseName": "value",
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuantCloud API
|
|
3
|
+
* QuantCloud API
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
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 declare class Volume {
|
|
13
|
+
'volumeId'?: string;
|
|
14
|
+
'volumeName'?: string;
|
|
15
|
+
'description'?: string;
|
|
16
|
+
'environmentEfsId'?: string;
|
|
17
|
+
'createdAt'?: string;
|
|
18
|
+
'rootDirectory'?: string;
|
|
19
|
+
'accessPointId'?: string;
|
|
20
|
+
'accessPointArn'?: string;
|
|
21
|
+
static discriminator: string | undefined;
|
|
22
|
+
static attributeTypeMap: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
baseName: string;
|
|
25
|
+
type: string;
|
|
26
|
+
}>;
|
|
27
|
+
static getAttributeTypeMap(): {
|
|
28
|
+
name: string;
|
|
29
|
+
baseName: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QuantCloud API
|
|
4
|
+
* QuantCloud API
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Volume = void 0;
|
|
15
|
+
class Volume {
|
|
16
|
+
static getAttributeTypeMap() {
|
|
17
|
+
return Volume.attributeTypeMap;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Volume = Volume;
|
|
21
|
+
Volume.discriminator = undefined;
|
|
22
|
+
Volume.attributeTypeMap = [
|
|
23
|
+
{
|
|
24
|
+
"name": "volumeId",
|
|
25
|
+
"baseName": "volumeId",
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "volumeName",
|
|
30
|
+
"baseName": "volumeName",
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "description",
|
|
35
|
+
"baseName": "description",
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "environmentEfsId",
|
|
40
|
+
"baseName": "environmentEfsId",
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "createdAt",
|
|
45
|
+
"baseName": "createdAt",
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "rootDirectory",
|
|
50
|
+
"baseName": "rootDirectory",
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "accessPointId",
|
|
55
|
+
"baseName": "accessPointId",
|
|
56
|
+
"type": "string"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "accessPointArn",
|
|
60
|
+
"baseName": "accessPointArn",
|
|
61
|
+
"type": "string"
|
|
62
|
+
}
|
|
63
|
+
];
|
package/package.json
CHANGED
|
@@ -1,50 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantcdn/quant-client",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "dist/
|
|
6
|
-
"types": "dist/
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "TypeScript client for Quant Cloud API",
|
|
5
|
+
"main": "dist/api.js",
|
|
6
|
+
"types": "dist/api.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"
|
|
8
|
+
"dist/**/*"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
-
"
|
|
13
|
-
"lint:src": "eslint --ext .ts ./src"
|
|
12
|
+
"prepare": "npm run build"
|
|
14
13
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
14
|
+
"keywords": [
|
|
15
|
+
"quant",
|
|
16
|
+
"api",
|
|
17
|
+
"client",
|
|
18
|
+
"sdk"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^4.9.5",
|
|
24
|
+
"@types/node": "^18.14.0",
|
|
25
|
+
"@types/request": "^2.48.8"
|
|
23
26
|
},
|
|
24
|
-
"homepage": "https://github.com/quantcdn/quant-client#readme",
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/jest": "^29.5.2",
|
|
31
|
-
"@types/node": "^18.16.3",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
33
|
-
"@typescript-eslint/parser": "^6.4.1",
|
|
34
|
-
"@typescript-eslint/typescript-estree": "^6.4.1",
|
|
35
|
-
"eslint": "^8.48.0",
|
|
36
|
-
"eslint-config-standard-with-typescript": "^38.0.0",
|
|
37
|
-
"eslint-plugin-import": "^2.28.1",
|
|
38
|
-
"eslint-plugin-n": "^16.0.2",
|
|
39
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
40
|
-
"jest": "^29.5.0",
|
|
41
|
-
"ts-jest": "^29.1.0",
|
|
42
|
-
"typescript": "^5.2.2",
|
|
43
|
-
"chai": "^4.3.7",
|
|
44
|
-
"mocha": "^10.2.0",
|
|
45
|
-
"nock": "^13.3.1",
|
|
46
|
-
"ts-node": "^10.9.1",
|
|
47
|
-
"@types/mocha": "^10.0.1",
|
|
48
|
-
"@types/chai": "^4.3.5"
|
|
28
|
+
"axios": "^1.3.4",
|
|
29
|
+
"request": "^2.88.2"
|
|
49
30
|
}
|
|
50
|
-
}
|
|
31
|
+
}
|
package/dist/src/client.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quant API client.
|
|
3
|
-
*/
|
|
4
|
-
import type * as types from './types';
|
|
5
|
-
import type * as interfaces from './interfaces';
|
|
6
|
-
export declare class QuantClient {
|
|
7
|
-
private readonly _project;
|
|
8
|
-
private readonly _organization;
|
|
9
|
-
private readonly _search;
|
|
10
|
-
constructor(config: types.Config, Client?: interfaces.ClientConstructor);
|
|
11
|
-
getClient(name: string): interfaces.Client;
|
|
12
|
-
project: interfaces.ProjectApi;
|
|
13
|
-
organization: interfaces.OrganizationApi;
|
|
14
|
-
search: interfaces.SearchApi;
|
|
15
|
-
}
|
package/dist/src/client.js
DELETED
|
@@ -1,380 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Quant API client.
|
|
4
|
-
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.QuantClient = void 0;
|
|
16
|
-
const request = require("@cypress/request");
|
|
17
|
-
const response_1 = require("./response");
|
|
18
|
-
class HttpClient {
|
|
19
|
-
constructor(baseUrl, headers) {
|
|
20
|
-
this.baseUrl = baseUrl;
|
|
21
|
-
this.headers = headers;
|
|
22
|
-
}
|
|
23
|
-
do(options) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
return yield new Promise((resolve, reject) => {
|
|
26
|
-
request(options, (error, response, body) => {
|
|
27
|
-
if (error !== null) {
|
|
28
|
-
reject(error);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
resolve(body);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
get(path, qs, headers) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const options = {
|
|
40
|
-
url: `${this.baseUrl}/${path}`,
|
|
41
|
-
method: 'GET',
|
|
42
|
-
headers: Object.assign(Object.assign({}, this.headers), headers),
|
|
43
|
-
json: true,
|
|
44
|
-
qs
|
|
45
|
-
};
|
|
46
|
-
const res = new response_1.PaginatedResponse(this, options);
|
|
47
|
-
return yield new Promise((resolve) => { resolve(res); });
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
post(path, body, headers, formData, qs) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const options = {
|
|
53
|
-
url: `${this.baseUrl}/${path}`,
|
|
54
|
-
method: 'POST',
|
|
55
|
-
headers: Object.assign(Object.assign({}, this.headers), headers),
|
|
56
|
-
json: true,
|
|
57
|
-
body,
|
|
58
|
-
formData,
|
|
59
|
-
qs
|
|
60
|
-
};
|
|
61
|
-
const res = new response_1.PaginatedResponse(this, options);
|
|
62
|
-
return yield new Promise((resolve) => { resolve(res); });
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
delete(path, body, headers) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const options = {
|
|
68
|
-
url: `${this.baseUrl}/${path}`,
|
|
69
|
-
method: 'DELETE',
|
|
70
|
-
headers: Object.assign(Object.assign({}, this.headers), headers),
|
|
71
|
-
json: true,
|
|
72
|
-
body
|
|
73
|
-
};
|
|
74
|
-
const res = new response_1.PaginatedResponse(this, options);
|
|
75
|
-
return yield new Promise((resolve) => { resolve(res); });
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
patch(path, body, headers) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
const options = {
|
|
81
|
-
url: `${this.baseUrl}/${path}`,
|
|
82
|
-
method: 'PATCH',
|
|
83
|
-
headers: Object.assign(Object.assign({}, this.headers), headers),
|
|
84
|
-
json: true,
|
|
85
|
-
body
|
|
86
|
-
};
|
|
87
|
-
const res = new response_1.PaginatedResponse(this, options);
|
|
88
|
-
return yield new Promise((resolve) => { resolve(res); });
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
class QuantClient {
|
|
93
|
-
constructor(config, Client) {
|
|
94
|
-
var _a, _b;
|
|
95
|
-
this.project = {
|
|
96
|
-
/**
|
|
97
|
-
* Ping and ensure the API credentials are valid.
|
|
98
|
-
*
|
|
99
|
-
* @returns Promise<any>
|
|
100
|
-
* The response object.
|
|
101
|
-
*/
|
|
102
|
-
ping: () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
return yield this._project.get('ping');
|
|
104
|
-
}),
|
|
105
|
-
/**
|
|
106
|
-
* Fetch metadata for all objects stored in Quant.
|
|
107
|
-
*
|
|
108
|
-
* @returns Promise<any>
|
|
109
|
-
* The repsonse object.
|
|
110
|
-
*/
|
|
111
|
-
meta: (filters) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const qs = {};
|
|
113
|
-
if ((filters === null || filters === void 0 ? void 0 : filters.sort_direction) != null) {
|
|
114
|
-
qs.sort_direction = filters.sort_direction;
|
|
115
|
-
}
|
|
116
|
-
if ((filters === null || filters === void 0 ? void 0 : filters.sort_field) != null) {
|
|
117
|
-
qs.sort_field = filters.sort_field;
|
|
118
|
-
}
|
|
119
|
-
if ((filters === null || filters === void 0 ? void 0 : filters.quant_type) != null) {
|
|
120
|
-
qs.quant_type = filters.quant_type;
|
|
121
|
-
}
|
|
122
|
-
if ((filters === null || filters === void 0 ? void 0 : filters.page_size) != null) {
|
|
123
|
-
// Ensure page_size is between 1 and 100
|
|
124
|
-
qs.page_size = Math.min(Math.max(1, filters.page_size), 100);
|
|
125
|
-
}
|
|
126
|
-
return yield this._project.get('global-meta', qs);
|
|
127
|
-
}),
|
|
128
|
-
/**
|
|
129
|
-
* Send markup directly to the Quant API.
|
|
130
|
-
*
|
|
131
|
-
* @param markup MarkupPayload
|
|
132
|
-
* The markup payload data.
|
|
133
|
-
*
|
|
134
|
-
* @returns Promise<any>
|
|
135
|
-
* The repsonse object.
|
|
136
|
-
*/
|
|
137
|
-
markup: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const headers = {};
|
|
139
|
-
const body = {
|
|
140
|
-
url: payload.url,
|
|
141
|
-
content: payload.data.toString('utf-8'),
|
|
142
|
-
published: payload.published,
|
|
143
|
-
find_attachments: false
|
|
144
|
-
};
|
|
145
|
-
if (typeof payload.skipPurge !== 'undefined') {
|
|
146
|
-
headers['Quant-Skip-Purge'] = 'true';
|
|
147
|
-
}
|
|
148
|
-
if (typeof payload.findAttachments !== 'undefined') {
|
|
149
|
-
body.find_attachments = payload.findAttachments;
|
|
150
|
-
}
|
|
151
|
-
return yield this._project.post('markup', body, headers);
|
|
152
|
-
}),
|
|
153
|
-
/**
|
|
154
|
-
* Upload a file asset to Quant.
|
|
155
|
-
*
|
|
156
|
-
* @param payload FilePayload
|
|
157
|
-
* The file payload data.
|
|
158
|
-
*
|
|
159
|
-
* @returns Promise<any>
|
|
160
|
-
* The repsonse object.
|
|
161
|
-
*/
|
|
162
|
-
file: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
const headers = {
|
|
164
|
-
'Quant-File-Url': payload.url
|
|
165
|
-
};
|
|
166
|
-
if (typeof payload.skipPurge !== 'undefined') {
|
|
167
|
-
headers['Quant-Skip-Purge'] = 'true';
|
|
168
|
-
}
|
|
169
|
-
if (typeof payload.headers !== 'undefined') {
|
|
170
|
-
headers['Quant-File-Headers'] = payload.headers;
|
|
171
|
-
}
|
|
172
|
-
const formData = {
|
|
173
|
-
file: {
|
|
174
|
-
value: payload.data,
|
|
175
|
-
options: {
|
|
176
|
-
filename: 'file',
|
|
177
|
-
contentType: 'application/octet-stream'
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
return yield this._project.post('file', undefined, headers, formData);
|
|
182
|
-
}),
|
|
183
|
-
/**
|
|
184
|
-
* Publish a revision.
|
|
185
|
-
*
|
|
186
|
-
* @param payload PublishPayload
|
|
187
|
-
* The payload object
|
|
188
|
-
*
|
|
189
|
-
* @returns Promise<any>
|
|
190
|
-
* The response object.
|
|
191
|
-
*/
|
|
192
|
-
publish: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
-
const response = yield this._project.patch(`publish/${payload.revision}`, {}, {
|
|
194
|
-
'Quant-Url': payload.location
|
|
195
|
-
});
|
|
196
|
-
return response.first();
|
|
197
|
-
}),
|
|
198
|
-
/**
|
|
199
|
-
* Unpublish the current published revision.
|
|
200
|
-
*
|
|
201
|
-
* @param payload PublishPayload
|
|
202
|
-
* The payload object.
|
|
203
|
-
*
|
|
204
|
-
* @returns Promise<any>
|
|
205
|
-
* The response object.
|
|
206
|
-
*/
|
|
207
|
-
unpublish: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
const response = yield this._project.patch('unpublish', {}, {
|
|
209
|
-
'Quant-Url': payload.location
|
|
210
|
-
});
|
|
211
|
-
return response.first();
|
|
212
|
-
}),
|
|
213
|
-
/**
|
|
214
|
-
* Redirect a URL.
|
|
215
|
-
*
|
|
216
|
-
* @param payload RedirectPayload
|
|
217
|
-
* The redirect payload.
|
|
218
|
-
*
|
|
219
|
-
* @returns Promise<any>
|
|
220
|
-
* The repsonse object.
|
|
221
|
-
*/
|
|
222
|
-
redirect: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
223
|
-
const headers = {};
|
|
224
|
-
const body = {
|
|
225
|
-
url: payload.url,
|
|
226
|
-
redirect_url: payload.redirect_url,
|
|
227
|
-
redirect_http_code: payload.redirect_http_code,
|
|
228
|
-
published: payload.published
|
|
229
|
-
};
|
|
230
|
-
if (typeof payload.skipPurge !== 'undefined') {
|
|
231
|
-
headers['Quant-Skip-Purge'] = 'true';
|
|
232
|
-
}
|
|
233
|
-
return yield this._project.post('redirect', body, headers);
|
|
234
|
-
}),
|
|
235
|
-
/**
|
|
236
|
-
* Proxy a URL to a different origin.
|
|
237
|
-
*
|
|
238
|
-
* @param payload ProxyPayload
|
|
239
|
-
* The proxy API payload.
|
|
240
|
-
*
|
|
241
|
-
* @returns Promise<any>
|
|
242
|
-
* The repsonse object.
|
|
243
|
-
*/
|
|
244
|
-
proxy: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
245
|
-
return yield this._project.post('proxy', payload);
|
|
246
|
-
}),
|
|
247
|
-
/**
|
|
248
|
-
* Delete a URL from Quant.
|
|
249
|
-
*
|
|
250
|
-
* @param payload URLPayload
|
|
251
|
-
* The API payload.
|
|
252
|
-
*
|
|
253
|
-
* @returns Promise<any>
|
|
254
|
-
* The repsonse object.
|
|
255
|
-
*/
|
|
256
|
-
delete: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
257
|
-
const response = yield this._project.delete('delete/all?force_delete=true', {}, {
|
|
258
|
-
'Quant-Url': payload.url
|
|
259
|
-
});
|
|
260
|
-
return response.first();
|
|
261
|
-
}),
|
|
262
|
-
/**
|
|
263
|
-
* Get a revision from the API.
|
|
264
|
-
*
|
|
265
|
-
* @param payload URLPayload
|
|
266
|
-
* The URL payload.
|
|
267
|
-
*
|
|
268
|
-
* @returns Promise<any>
|
|
269
|
-
* The repsonse object.
|
|
270
|
-
*/
|
|
271
|
-
revisions: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
272
|
-
return yield this._project.get('revisions/latest', {}, {
|
|
273
|
-
'Quant-Url': payload.url
|
|
274
|
-
});
|
|
275
|
-
}),
|
|
276
|
-
/**
|
|
277
|
-
* Purge Varnish for a given URL pattern.
|
|
278
|
-
*
|
|
279
|
-
* @param payload URLPayload
|
|
280
|
-
* The URL payload.
|
|
281
|
-
*
|
|
282
|
-
* @returns Promise<any>
|
|
283
|
-
* The repsonse object.
|
|
284
|
-
*/
|
|
285
|
-
purge: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
286
|
-
return yield this._project.post('purge', {}, {
|
|
287
|
-
'Quant-Url': payload.url
|
|
288
|
-
});
|
|
289
|
-
})
|
|
290
|
-
};
|
|
291
|
-
this.organization = {
|
|
292
|
-
/**
|
|
293
|
-
* Fetch WAF logs from.
|
|
294
|
-
*
|
|
295
|
-
* @param payload types.WafLogsPayload
|
|
296
|
-
* The API request payload.
|
|
297
|
-
*
|
|
298
|
-
* @returns Promise<any>
|
|
299
|
-
* The response object.
|
|
300
|
-
*/
|
|
301
|
-
wafLogs: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
302
|
-
const headers = { 'Quant-Project': payload.project };
|
|
303
|
-
return yield this._organization.get('waf/logs', {}, headers);
|
|
304
|
-
})
|
|
305
|
-
};
|
|
306
|
-
this.search = {
|
|
307
|
-
/**
|
|
308
|
-
* Index search data.
|
|
309
|
-
*
|
|
310
|
-
* @param payload types.SearchIndexPayload
|
|
311
|
-
* The search index paylod.
|
|
312
|
-
*
|
|
313
|
-
* @returns Promise<any>
|
|
314
|
-
* The response.
|
|
315
|
-
*/
|
|
316
|
-
index: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
317
|
-
return yield this._search.post('search', JSON.parse(payload.data.toString()));
|
|
318
|
-
}),
|
|
319
|
-
/**
|
|
320
|
-
* Remove an item from the search index.
|
|
321
|
-
*
|
|
322
|
-
* @param payload types.URLPayload
|
|
323
|
-
* The URL payload.
|
|
324
|
-
*
|
|
325
|
-
* @returns Promise<any>
|
|
326
|
-
* The response obejct.
|
|
327
|
-
*/
|
|
328
|
-
remove: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
329
|
-
return yield this._search.delete('search', {}, {
|
|
330
|
-
'Quant-Url': payload.url
|
|
331
|
-
});
|
|
332
|
-
}),
|
|
333
|
-
/**
|
|
334
|
-
* Clear the search index.
|
|
335
|
-
*
|
|
336
|
-
* @returns Promise<any>
|
|
337
|
-
* The response object.
|
|
338
|
-
*/
|
|
339
|
-
clear: () => __awaiter(this, void 0, void 0, function* () {
|
|
340
|
-
return yield this._search.delete('search/all');
|
|
341
|
-
}),
|
|
342
|
-
/**
|
|
343
|
-
* Get the search index status.
|
|
344
|
-
*
|
|
345
|
-
* @returns Promise<any>
|
|
346
|
-
* The response object.
|
|
347
|
-
*/
|
|
348
|
-
status: () => __awaiter(this, void 0, void 0, function* () {
|
|
349
|
-
return yield this._search.get('search');
|
|
350
|
-
})
|
|
351
|
-
};
|
|
352
|
-
if (typeof Client === 'undefined') {
|
|
353
|
-
Client = HttpClient;
|
|
354
|
-
}
|
|
355
|
-
this._project = new Client((_a = config.endpoint) !== null && _a !== void 0 ? _a : 'https://api.quantcdn.io/v1', {
|
|
356
|
-
'User-Agent': 'Quant (+http://api.quantcdn.io)',
|
|
357
|
-
'Quant-Token': config.token,
|
|
358
|
-
'Quant-Customer': config.organization,
|
|
359
|
-
'Quant-Project': config.project,
|
|
360
|
-
'Content-Type': 'application/json'
|
|
361
|
-
});
|
|
362
|
-
this._search = new Client((_b = config.endpoint) !== null && _b !== void 0 ? _b : 'https://api.quantcdn.io/v1', {
|
|
363
|
-
'User-Agent': 'Quant (+http://api.quantcdn.io)',
|
|
364
|
-
'Quant-Token': config.token,
|
|
365
|
-
'Quant-Customer': config.organization,
|
|
366
|
-
'Quant-Project': config.project,
|
|
367
|
-
'Content-Type': 'application/json'
|
|
368
|
-
});
|
|
369
|
-
this._organization = new Client('https://dashboard.quantcdn.io/api/v1', {
|
|
370
|
-
'User-Agent': 'Quant (+http://api.quantcdn.io)',
|
|
371
|
-
// @todo: Americanise.
|
|
372
|
-
'Quant-Organisation': config.organization,
|
|
373
|
-
Authorization: `Bearer ${config.bearer}`
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
getClient(name) {
|
|
377
|
-
return this[`_${name}`];
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
exports.QuantClient = QuantClient;
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
-
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.types = void 0;
|
|
40
|
-
// export { QuantClient } from './quant-client'
|
|
41
|
-
__exportStar(require("./client"), exports);
|
|
42
|
-
exports.types = __importStar(require("./types"));
|
package/dist/src/interfaces.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type * as types from './types';
|
|
2
|
-
import type * as request from '@cypress/request';
|
|
3
|
-
export type ClientConstructor = new (baseUrl: string, headers: object) => Client;
|
|
4
|
-
export interface Client {
|
|
5
|
-
baseUrl: string;
|
|
6
|
-
headers: object;
|
|
7
|
-
do: (options: request.Options) => Promise<any>;
|
|
8
|
-
get: (path: string, qs?: object, headers?: object) => Promise<any>;
|
|
9
|
-
post: (path: string, body?: any, headers?: object, formData?: object, qs?: object) => Promise<any>;
|
|
10
|
-
delete: (path: string, body?: any, headers?: object) => Promise<any>;
|
|
11
|
-
patch: (path: string, body?: any, headers?: object) => Promise<any>;
|
|
12
|
-
}
|
|
13
|
-
export interface ProjectApi {
|
|
14
|
-
ping: () => Promise<any>;
|
|
15
|
-
meta: (filter?: types.MetaFilters) => Promise<any>;
|
|
16
|
-
markup: (payload: types.MarkupPayload) => Promise<any>;
|
|
17
|
-
file: (payload: types.FilePayload) => Promise<any>;
|
|
18
|
-
publish: (payload: types.PublishPayload) => Promise<any>;
|
|
19
|
-
unpublish: (payload: types.PublishPayload) => Promise<any>;
|
|
20
|
-
redirect: (payload: types.RedirectPayload) => Promise<any>;
|
|
21
|
-
proxy: (payload: types.ProxyPayload) => Promise<any>;
|
|
22
|
-
delete: (payload: types.URLPayload) => Promise<any>;
|
|
23
|
-
revisions: (payload: types.URLPayload) => Promise<any>;
|
|
24
|
-
purge: (payload: types.URLPayload) => Promise<any>;
|
|
25
|
-
}
|
|
26
|
-
export interface OrganizationApi {
|
|
27
|
-
wafLogs: (payload: types.WafLogsPayload) => Promise<any>;
|
|
28
|
-
}
|
|
29
|
-
export interface SearchApi {
|
|
30
|
-
index: (payload: types.SearchIndexPayload) => Promise<any>;
|
|
31
|
-
remove: (payload: types.URLPayload) => Promise<any>;
|
|
32
|
-
clear: () => Promise<any>;
|
|
33
|
-
status: () => Promise<any>;
|
|
34
|
-
}
|
package/dist/src/interfaces.js
DELETED