@quantcdn/quant-client 2.0.0 → 2.0.2
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/client.js +16 -9
- package/dist/interfaces.d.ts +2 -2
- package/dist/response.d.ts +1 -1
- package/dist/response.js +3 -2
- package/dist/types.d.ts +4 -1
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.QuantClient = void 0;
|
|
16
|
-
const request = require("request");
|
|
16
|
+
const request = require("@cypress/request");
|
|
17
17
|
const response_1 = require("./response");
|
|
18
18
|
class HttpClient {
|
|
19
19
|
constructor(baseUrl, headers) {
|
|
@@ -107,8 +107,15 @@ class QuantClient {
|
|
|
107
107
|
* @returns Promise<any>
|
|
108
108
|
* The repsonse object.
|
|
109
109
|
*/
|
|
110
|
-
meta: () => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
|
|
110
|
+
meta: (filters) => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const qs = {};
|
|
112
|
+
if ((filters === null || filters === void 0 ? void 0 : filters.sort_direction) != null) {
|
|
113
|
+
qs.sort_direction = filters.sort_direction;
|
|
114
|
+
}
|
|
115
|
+
if ((filters === null || filters === void 0 ? void 0 : filters.sort_field) != null) {
|
|
116
|
+
qs.sort_field = filters.sort_field;
|
|
117
|
+
}
|
|
118
|
+
return yield this._project.get('global-meta', qs);
|
|
112
119
|
}),
|
|
113
120
|
/**
|
|
114
121
|
* Send markup directly to the Quant API.
|
|
@@ -125,13 +132,13 @@ class QuantClient {
|
|
|
125
132
|
url: payload.url,
|
|
126
133
|
content: payload.data.toString('utf-8'),
|
|
127
134
|
published: payload.published,
|
|
128
|
-
find_attachments:
|
|
135
|
+
find_attachments: false
|
|
129
136
|
};
|
|
130
137
|
if (typeof payload.skipPurge !== 'undefined') {
|
|
131
|
-
headers['Quant-Skip-Purge'] =
|
|
138
|
+
headers['Quant-Skip-Purge'] = true;
|
|
132
139
|
}
|
|
133
140
|
if (typeof payload.findAttachments !== 'undefined') {
|
|
134
|
-
body.find_attachments =
|
|
141
|
+
body.find_attachments = true;
|
|
135
142
|
}
|
|
136
143
|
return yield this._project.post('markup', body, headers);
|
|
137
144
|
}),
|
|
@@ -141,7 +148,7 @@ class QuantClient {
|
|
|
141
148
|
* @param payload FilePayload
|
|
142
149
|
* The file payload data.
|
|
143
150
|
*
|
|
144
|
-
* @returns
|
|
151
|
+
* @returns Promise<any>
|
|
145
152
|
* The repsonse object.
|
|
146
153
|
*/
|
|
147
154
|
file: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -272,8 +279,8 @@ class QuantClient {
|
|
|
272
279
|
* @param payload types.SearchIndexPayload
|
|
273
280
|
* The search index paylod.
|
|
274
281
|
*
|
|
275
|
-
* @returns
|
|
276
|
-
* The
|
|
282
|
+
* @returns Promise<any>
|
|
283
|
+
* The response.
|
|
277
284
|
*/
|
|
278
285
|
index: (payload) => __awaiter(this, void 0, void 0, function* () {
|
|
279
286
|
return yield this._search.post('search', JSON.parse(payload.data.toString()));
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as types from './types';
|
|
2
|
-
import type * as request from 'request';
|
|
2
|
+
import type * as request from '@cypress/request';
|
|
3
3
|
export type ClientConstructor = new (baseUrl: string, headers: object) => Client;
|
|
4
4
|
export interface Client {
|
|
5
5
|
baseUrl: string;
|
|
@@ -12,7 +12,7 @@ export interface Client {
|
|
|
12
12
|
}
|
|
13
13
|
export interface ProjectApi {
|
|
14
14
|
ping: () => Promise<any>;
|
|
15
|
-
meta: () => Promise<any>;
|
|
15
|
+
meta: (filter?: types.MetaFilters) => Promise<any>;
|
|
16
16
|
markup: (payload: types.MarkupPayload) => Promise<any>;
|
|
17
17
|
file: (payload: types.FilePayload) => Promise<any>;
|
|
18
18
|
publish: (payload: types.PublishPayload) => Promise<any>;
|
package/dist/response.d.ts
CHANGED
package/dist/response.js
CHANGED
|
@@ -12,8 +12,9 @@ var __await = (this && this.__await) || function (v) { return this instanceof __
|
|
|
12
12
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
13
13
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14
14
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
15
|
-
return i =
|
|
16
|
-
function
|
|
15
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
16
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
17
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
17
18
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
18
19
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
19
20
|
function fulfill(value) { resume("next", value); }
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { type Buffer } from 'buffer';
|
|
3
2
|
export interface Config {
|
|
4
3
|
organization: string;
|
|
@@ -58,3 +57,7 @@ export interface WafLog {
|
|
|
58
57
|
method: string;
|
|
59
58
|
user_agent: string;
|
|
60
59
|
}
|
|
60
|
+
export interface MetaFilters {
|
|
61
|
+
sort_field: string;
|
|
62
|
+
sort_direction: string;
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantcdn/quant-client",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Client library for API connectivity",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/quantcdn/quant-client#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
26
|
+
"@cypress/request": "3.0.1",
|
|
27
|
+
"mime-types": "^2.1.27"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/jest": "^29.5.2",
|