@blackglory/estore-js 0.1.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/LICENSE +21 -0
- package/README.md +368 -0
- package/dist/es2015/index.min.mjs +16 -0
- package/dist/es2015/index.min.mjs.map +1 -0
- package/dist/es2015/index.mjs +5521 -0
- package/dist/es2015/index.mjs.map +1 -0
- package/dist/es2015/index.umd.js +5532 -0
- package/dist/es2015/index.umd.js.map +1 -0
- package/dist/es2015/index.umd.min.js +23 -0
- package/dist/es2015/index.umd.min.js.map +1 -0
- package/dist/es2018/index.min.mjs +2 -0
- package/dist/es2018/index.min.mjs.map +1 -0
- package/dist/es2018/index.mjs +5424 -0
- package/dist/es2018/index.mjs.map +1 -0
- package/dist/es2018/index.umd.js +5435 -0
- package/dist/es2018/index.umd.js.map +1 -0
- package/dist/es2018/index.umd.min.js +9 -0
- package/dist/es2018/index.umd.min.js.map +1 -0
- package/lib/es2015/blacklist-client.d.ts +6 -0
- package/lib/es2015/blacklist-client.js +41 -0
- package/lib/es2015/blacklist-client.js.map +1 -0
- package/lib/es2015/estore-client.d.ts +41 -0
- package/lib/es2015/estore-client.js +139 -0
- package/lib/es2015/estore-client.js.map +1 -0
- package/lib/es2015/estore-manager.d.ts +20 -0
- package/lib/es2015/estore-manager.js +20 -0
- package/lib/es2015/estore-manager.js.map +1 -0
- package/lib/es2015/index.d.ts +4 -0
- package/lib/es2015/index.js +20 -0
- package/lib/es2015/index.js.map +1 -0
- package/lib/es2015/json-schema-client.d.ts +8 -0
- package/lib/es2015/json-schema-client.js +49 -0
- package/lib/es2015/json-schema-client.js.map +1 -0
- package/lib/es2015/token-client.d.ts +18 -0
- package/lib/es2015/token-client.js +73 -0
- package/lib/es2015/token-client.js.map +1 -0
- package/lib/es2015/token-policy-client.d.ts +17 -0
- package/lib/es2015/token-policy-client.js +73 -0
- package/lib/es2015/token-policy-client.js.map +1 -0
- package/lib/es2015/utils.d.ts +12 -0
- package/lib/es2015/utils.js +25 -0
- package/lib/es2015/utils.js.map +1 -0
- package/lib/es2015/whitelist-client.d.ts +6 -0
- package/lib/es2015/whitelist-client.js +41 -0
- package/lib/es2015/whitelist-client.js.map +1 -0
- package/lib/es2018/blacklist-client.d.ts +6 -0
- package/lib/es2018/blacklist-client.js +26 -0
- package/lib/es2018/blacklist-client.js.map +1 -0
- package/lib/es2018/estore-client.d.ts +41 -0
- package/lib/es2018/estore-client.js +110 -0
- package/lib/es2018/estore-client.js.map +1 -0
- package/lib/es2018/estore-manager.d.ts +20 -0
- package/lib/es2018/estore-manager.js +20 -0
- package/lib/es2018/estore-manager.js.map +1 -0
- package/lib/es2018/index.d.ts +4 -0
- package/lib/es2018/index.js +20 -0
- package/lib/es2018/index.js.map +1 -0
- package/lib/es2018/json-schema-client.d.ts +8 -0
- package/lib/es2018/json-schema-client.js +32 -0
- package/lib/es2018/json-schema-client.js.map +1 -0
- package/lib/es2018/token-client.d.ts +18 -0
- package/lib/es2018/token-client.js +48 -0
- package/lib/es2018/token-client.js.map +1 -0
- package/lib/es2018/token-policy-client.d.ts +17 -0
- package/lib/es2018/token-policy-client.js +48 -0
- package/lib/es2018/token-policy-client.js.map +1 -0
- package/lib/es2018/utils.d.ts +12 -0
- package/lib/es2018/utils.js +25 -0
- package/lib/es2018/utils.js.map +1 -0
- package/lib/es2018/whitelist-client.d.ts +6 -0
- package/lib/es2018/whitelist-client.js +26 -0
- package/lib/es2018/whitelist-client.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './utils';
|
|
2
|
+
export declare class WhitelistClient extends EStoreManagerBase {
|
|
3
|
+
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
4
|
+
add(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
5
|
+
remove(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WhitelistClient = void 0;
|
|
13
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
14
|
+
const extra_request_1 = require("extra-request");
|
|
15
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
16
|
+
const extra_response_1 = require("extra-response");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
class WhitelistClient extends utils_1.EStoreManagerBase {
|
|
19
|
+
getNamespaces(options = {}) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/admin/whitelist'));
|
|
22
|
+
return yield (0, extra_fetch_1.fetch)(req)
|
|
23
|
+
.then(extra_response_1.ok)
|
|
24
|
+
.then(extra_response_1.toJSON);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
add(namespace, options = {}) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/whitelist/${namespace}`));
|
|
30
|
+
yield (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
remove(namespace, options = {}) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/whitelist/${namespace}`));
|
|
36
|
+
yield (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.WhitelistClient = WhitelistClient;
|
|
41
|
+
//# sourceMappingURL=whitelist-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whitelist-client.js","sourceRoot":"","sources":["../../src/whitelist-client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAmC;AACnC,iDAA6C;AAC7C,kEAA8D;AAC9D,mDAA2C;AAC3C,mCAAyE;AAEzE,MAAa,eAAgB,SAAQ,yBAAiB;IAI9C,aAAa,CAAC,UAAwC,EAAE;;YAC5D,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,kBAAkB,CAAC,CAC7B,CAAA;YAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;iBACpB,IAAI,CAAC,mBAAE,CAAC;iBACR,IAAI,CAAC,uBAAM,CAAa,CAAA;QAC7B,CAAC;KAAA;IAKK,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;;YACrE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,oBAAoB,SAAS,EAAE,CAAC,CAC1C,CAAA;YAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;QAC3B,CAAC;KAAA;IAKK,MAAM,CAAC,SAAiB,EAAE,UAAwC,EAAE;;YACxE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,oBAAoB,SAAS,EAAE,CAAC,CAC1C,CAAA;YAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;QAC3B,CAAC;KAAA;CACF;AAtCD,0CAsCC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './utils';
|
|
2
|
+
export declare class BlacklistClient extends EStoreManagerBase {
|
|
3
|
+
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
4
|
+
add(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
5
|
+
remove(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlacklistClient = void 0;
|
|
4
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
5
|
+
const extra_request_1 = require("extra-request");
|
|
6
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
7
|
+
const extra_response_1 = require("extra-response");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
class BlacklistClient extends utils_1.EStoreManagerBase {
|
|
10
|
+
async getNamespaces(options = {}) {
|
|
11
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/admin/blacklist'));
|
|
12
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
13
|
+
.then(extra_response_1.ok)
|
|
14
|
+
.then(extra_response_1.toJSON);
|
|
15
|
+
}
|
|
16
|
+
async add(namespace, options = {}) {
|
|
17
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/blacklist/${namespace}`));
|
|
18
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
19
|
+
}
|
|
20
|
+
async remove(namespace, options = {}) {
|
|
21
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/blacklist/${namespace}`));
|
|
22
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.BlacklistClient = BlacklistClient;
|
|
26
|
+
//# sourceMappingURL=blacklist-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blacklist-client.js","sourceRoot":"","sources":["../../src/blacklist-client.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AACnC,iDAA6C;AAC7C,kEAA8D;AAC9D,mDAA2C;AAC3C,mCAAyE;AAEzE,MAAa,eAAgB,SAAQ,yBAAiB;IAIpD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,kBAAkB,CAAC,CAC7B,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACrE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,oBAAoB,SAAS,EAAE,CAAC,CAC1C,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACxE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,oBAAoB,SAAS,EAAE,CAAC,CAC1C,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AAtCD,0CAsCC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export { HTTPClientError } from '@blackglory/http-status';
|
|
2
|
+
interface IInfo {
|
|
3
|
+
namespace: string;
|
|
4
|
+
items: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IEStoreClientOptions {
|
|
7
|
+
server: string;
|
|
8
|
+
token?: string;
|
|
9
|
+
basicAuth?: {
|
|
10
|
+
username: string;
|
|
11
|
+
password: string;
|
|
12
|
+
};
|
|
13
|
+
keepalive?: boolean;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface IEStoreClientRequestOptions {
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
token?: string;
|
|
19
|
+
keepalive?: boolean;
|
|
20
|
+
timeout?: number | false;
|
|
21
|
+
}
|
|
22
|
+
export interface IEStoreClientRequestOptionsWithoutToken {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
keepalive?: boolean;
|
|
25
|
+
timeout?: number | false;
|
|
26
|
+
}
|
|
27
|
+
export declare class EStoreClient {
|
|
28
|
+
private options;
|
|
29
|
+
constructor(options: IEStoreClientOptions);
|
|
30
|
+
private getCommonTransformers;
|
|
31
|
+
append<T>(namespace: string, itemId: string, payload: T, index?: number, options?: IEStoreClientRequestOptions): Promise<void>;
|
|
32
|
+
getEvent<T>(namespace: string, itemId: string, index: number, options?: IEStoreClientRequestOptions): Promise<T | undefined>;
|
|
33
|
+
getEvents<T>(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<T[] | undefined>;
|
|
34
|
+
getSize(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<number>;
|
|
35
|
+
has(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<boolean>;
|
|
36
|
+
del(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<void>;
|
|
37
|
+
clear(namespace: string, options?: IEStoreClientRequestOptions): Promise<void>;
|
|
38
|
+
getAllItemIds(namespace: string, options?: IEStoreClientRequestOptions): Promise<string[]>;
|
|
39
|
+
getAllNamespaces(options?: IEStoreClientRequestOptionsWithoutToken): Promise<string[]>;
|
|
40
|
+
stats(namespace: string, options?: IEStoreClientRequestOptionsWithoutToken): Promise<IInfo>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EStoreClient = exports.HTTPClientError = void 0;
|
|
4
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
5
|
+
const extra_request_1 = require("extra-request");
|
|
6
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
7
|
+
const http_status_1 = require("@blackglory/http-status");
|
|
8
|
+
const extra_response_1 = require("extra-response");
|
|
9
|
+
const extra_abort_1 = require("extra-abort");
|
|
10
|
+
const types_1 = require("@blackglory/types");
|
|
11
|
+
var http_status_2 = require("@blackglory/http-status");
|
|
12
|
+
Object.defineProperty(exports, "HTTPClientError", { enumerable: true, get: function () { return http_status_2.HTTPClientError; } });
|
|
13
|
+
class EStoreClient {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.options = options;
|
|
16
|
+
}
|
|
17
|
+
getCommonTransformers(options) {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
const token = 'token' in options
|
|
20
|
+
? ((_a = options.token) !== null && _a !== void 0 ? _a : this.options.token)
|
|
21
|
+
: this.options.token;
|
|
22
|
+
const auth = this.options.basicAuth;
|
|
23
|
+
return [
|
|
24
|
+
(0, index_js_1.url)(this.options.server),
|
|
25
|
+
auth && (0, index_js_1.basicAuth)(auth.username, auth.password),
|
|
26
|
+
token && (0, index_js_1.searchParams)({ token }),
|
|
27
|
+
(0, index_js_1.signal)((0, extra_abort_1.raceAbortSignals)([
|
|
28
|
+
options.signal,
|
|
29
|
+
options.timeout !== false && ((_b = (options.timeout && (0, extra_abort_1.timeoutSignal)(options.timeout))) !== null && _b !== void 0 ? _b : (this.options.timeout && (0, extra_abort_1.timeoutSignal)(this.options.timeout)))
|
|
30
|
+
])),
|
|
31
|
+
(0, index_js_1.keepalive)((_c = options.keepalive) !== null && _c !== void 0 ? _c : this.options.keepalive)
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
async append(namespace, itemId, payload, index, options = {}) {
|
|
35
|
+
const req = (0, extra_request_1.post)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items/${itemId}/events`), (0, types_1.isntUndefined)(index) && (0, index_js_1.header)('If-Match', `${index}`), (0, index_js_1.json)(payload));
|
|
36
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
37
|
+
}
|
|
38
|
+
async getEvent(namespace, itemId, index, options = {}) {
|
|
39
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items/${itemId}/events/${index}`));
|
|
40
|
+
try {
|
|
41
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
42
|
+
.then(extra_response_1.ok)
|
|
43
|
+
.then(extra_response_1.toJSON);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
if (e instanceof http_status_1.NotFound)
|
|
47
|
+
return undefined;
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async getEvents(namespace, itemId, options = {}) {
|
|
52
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items/${itemId}/events`));
|
|
53
|
+
try {
|
|
54
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
55
|
+
.then(extra_response_1.ok)
|
|
56
|
+
.then(extra_response_1.toJSON);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
if (e instanceof http_status_1.NotFound)
|
|
60
|
+
return undefined;
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async getSize(namespace, itemId, options = {}) {
|
|
65
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items/${itemId}/size`));
|
|
66
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
67
|
+
.then(extra_response_1.ok)
|
|
68
|
+
.then(extra_response_1.toJSON);
|
|
69
|
+
}
|
|
70
|
+
async has(namespace, itemId, options = {}) {
|
|
71
|
+
const req = (0, extra_request_1.head)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items/${itemId}`));
|
|
72
|
+
try {
|
|
73
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
if (e instanceof http_status_1.NotFound)
|
|
78
|
+
return false;
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async del(namespace, itemId, options = {}) {
|
|
83
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items/${itemId}`));
|
|
84
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
85
|
+
}
|
|
86
|
+
async clear(namespace, options = {}) {
|
|
87
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}`));
|
|
88
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
89
|
+
}
|
|
90
|
+
async getAllItemIds(namespace, options = {}) {
|
|
91
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/items`));
|
|
92
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
93
|
+
.then(extra_response_1.ok)
|
|
94
|
+
.then(extra_response_1.toJSON);
|
|
95
|
+
}
|
|
96
|
+
async getAllNamespaces(options = {}) {
|
|
97
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/estore'));
|
|
98
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
99
|
+
.then(extra_response_1.ok)
|
|
100
|
+
.then(extra_response_1.toJSON);
|
|
101
|
+
}
|
|
102
|
+
async stats(namespace, options = {}) {
|
|
103
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/estore/${namespace}/stats`));
|
|
104
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
105
|
+
.then(extra_response_1.ok)
|
|
106
|
+
.then(extra_response_1.toJSON);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.EStoreClient = EStoreClient;
|
|
110
|
+
//# sourceMappingURL=estore-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estore-client.js","sourceRoot":"","sources":["../../src/estore-client.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AACnC,iDAA6E;AAC7E,kEAA6H;AAC7H,yDAAkD;AAClD,mDAA2C;AAE3C,6CAA6D;AAC7D,6CAAiD;AAEjD,uDAAyD;AAAhD,8GAAA,eAAe,OAAA;AA+BxB,MAAa,YAAY;IACvB,YAAoB,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE7C,qBAAqB,CAC3B,OAA8E;;QAE9E,MAAM,KAAK,GAAG,OAAO,IAAI,OAAO;YAClB,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAA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AAiB,EACjB,UAAuC,EAAE;QAEzC,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,WAAW,SAAS,QAAQ,CAAC,CACvC,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,gBAAgB,CACpB,UAAmD,EAAE;QAErD,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,SAAS,CAAC,CACpB,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,KAAK,CACT,SAAiB,EACjB,UAAmD,EAAE;QAErD,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,WAAW,SAAS,QAAQ,CAAC,CACvC,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAU,CAAA;IAC1B,CAAC;CACF;AArND,oCAqNC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { JsonSchemaClient } from './json-schema-client';
|
|
2
|
+
import { BlacklistClient } from './blacklist-client';
|
|
3
|
+
import { WhitelistClient } from './whitelist-client';
|
|
4
|
+
import { TokenPolicyClient } from './token-policy-client';
|
|
5
|
+
import { TokenClient } from './token-client';
|
|
6
|
+
export interface IEStoreManagerOptions {
|
|
7
|
+
server: string;
|
|
8
|
+
adminPassword: string;
|
|
9
|
+
keepalive?: boolean;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class EStoreManager {
|
|
13
|
+
private options;
|
|
14
|
+
constructor(options: IEStoreManagerOptions);
|
|
15
|
+
JsonSchema: JsonSchemaClient;
|
|
16
|
+
Blacklist: BlacklistClient;
|
|
17
|
+
Whitelist: WhitelistClient;
|
|
18
|
+
TokenPolicy: TokenPolicyClient;
|
|
19
|
+
Token: TokenClient;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EStoreManager = void 0;
|
|
4
|
+
const json_schema_client_1 = require("./json-schema-client");
|
|
5
|
+
const blacklist_client_1 = require("./blacklist-client");
|
|
6
|
+
const whitelist_client_1 = require("./whitelist-client");
|
|
7
|
+
const token_policy_client_1 = require("./token-policy-client");
|
|
8
|
+
const token_client_1 = require("./token-client");
|
|
9
|
+
class EStoreManager {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.JsonSchema = new json_schema_client_1.JsonSchemaClient(this.options);
|
|
13
|
+
this.Blacklist = new blacklist_client_1.BlacklistClient(this.options);
|
|
14
|
+
this.Whitelist = new whitelist_client_1.WhitelistClient(this.options);
|
|
15
|
+
this.TokenPolicy = new token_policy_client_1.TokenPolicyClient(this.options);
|
|
16
|
+
this.Token = new token_client_1.TokenClient(this.options);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.EStoreManager = EStoreManager;
|
|
20
|
+
//# sourceMappingURL=estore-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estore-manager.js","sourceRoot":"","sources":["../../src/estore-manager.ts"],"names":[],"mappings":";;;AAAA,6DAAuD;AACvD,yDAAoD;AACpD,yDAAoD;AACpD,+DAAyD;AACzD,iDAA4C;AAS5C,MAAa,aAAa;IACxB,YAAoB,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;QAElD,eAAU,GAAG,IAAI,qCAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/C,cAAS,GAAG,IAAI,kCAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC7C,cAAS,GAAG,IAAI,kCAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC7C,gBAAW,GAAG,IAAI,uCAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACjD,UAAK,GAAG,IAAI,0BAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IANgB,CAAC;CAOvD;AARD,sCAQC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AbortError = exports.HTTPError = void 0;
|
|
14
|
+
__exportStar(require("./estore-client"), exports);
|
|
15
|
+
__exportStar(require("./estore-manager"), exports);
|
|
16
|
+
var extra_response_1 = require("extra-response");
|
|
17
|
+
Object.defineProperty(exports, "HTTPError", { enumerable: true, get: function () { return extra_response_1.HTTPError; } });
|
|
18
|
+
var extra_fetch_1 = require("extra-fetch");
|
|
19
|
+
Object.defineProperty(exports, "AbortError", { enumerable: true, get: function () { return extra_fetch_1.AbortError; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,mDAAgC;AAChC,iDAA0C;AAAjC,2GAAA,SAAS,OAAA;AAClB,2CAAwC;AAA/B,yGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Json } from 'justypes';
|
|
2
|
+
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './utils';
|
|
3
|
+
export declare class JsonSchemaClient extends EStoreManagerBase {
|
|
4
|
+
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
5
|
+
get(namespace: string, options?: IEStoreManagerRequestOptions): Promise<unknown>;
|
|
6
|
+
set(namespace: string, schema: Json, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
7
|
+
remove(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonSchemaClient = void 0;
|
|
4
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
5
|
+
const extra_request_1 = require("extra-request");
|
|
6
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
7
|
+
const extra_response_1 = require("extra-response");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
class JsonSchemaClient extends utils_1.EStoreManagerBase {
|
|
10
|
+
async getNamespaces(options = {}) {
|
|
11
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/admin/estore-with-json-schema'));
|
|
12
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
13
|
+
.then(extra_response_1.ok)
|
|
14
|
+
.then(extra_response_1.toJSON);
|
|
15
|
+
}
|
|
16
|
+
async get(namespace, options = {}) {
|
|
17
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/json-schema`));
|
|
18
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
19
|
+
.then(extra_response_1.ok)
|
|
20
|
+
.then(extra_response_1.toJSON);
|
|
21
|
+
}
|
|
22
|
+
async set(namespace, schema, options = {}) {
|
|
23
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/json-schema`), (0, index_js_1.json)(schema));
|
|
24
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
25
|
+
}
|
|
26
|
+
async remove(namespace, options = {}) {
|
|
27
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/json-schema`));
|
|
28
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.JsonSchemaClient = JsonSchemaClient;
|
|
32
|
+
//# sourceMappingURL=json-schema-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-client.js","sourceRoot":"","sources":["../../src/json-schema-client.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AAEnC,iDAA6C;AAC7C,kEAAoE;AACpE,mDAA2C;AAC3C,mCAAyE;AAEzE,MAAa,gBAAiB,SAAQ,yBAAiB;IAIrD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,gCAAgC,CAAC,CAC3C,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACrE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,cAAc,CAAC,CACnD,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAC,CAAA;IACjB,CAAC;IAKD,KAAK,CAAC,GAAG,CACP,SAAiB,EACjB,MAAY,EACZ,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,cAAc,CAAC,EAClD,IAAA,eAAI,EAAC,MAAM,CAAC,CACb,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,cAAc,CAAC,CACnD,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AA5DD,4CA4DC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './utils';
|
|
2
|
+
interface ITokenInfo {
|
|
3
|
+
token: string;
|
|
4
|
+
write: boolean;
|
|
5
|
+
read: boolean;
|
|
6
|
+
delete: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class TokenClient extends EStoreManagerBase {
|
|
9
|
+
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
10
|
+
getTokens(namespace: string, options?: IEStoreManagerRequestOptions): Promise<ITokenInfo[]>;
|
|
11
|
+
addWriteToken(namespace: string, token: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
12
|
+
removeWriteToken(namespace: string, token: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
13
|
+
addReadToken(namespace: string, token: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
14
|
+
removeReadToken(namespace: string, token: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
15
|
+
addDeleteToken(namespace: string, token: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
16
|
+
removeDeleteToken(namespace: string, token: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenClient = void 0;
|
|
4
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
5
|
+
const extra_request_1 = require("extra-request");
|
|
6
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
7
|
+
const extra_response_1 = require("extra-response");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
class TokenClient extends utils_1.EStoreManagerBase {
|
|
10
|
+
async getNamespaces(options = {}) {
|
|
11
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/admin/estore-with-tokens'));
|
|
12
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
13
|
+
.then(extra_response_1.ok)
|
|
14
|
+
.then(extra_response_1.toJSON);
|
|
15
|
+
}
|
|
16
|
+
async getTokens(namespace, options = {}) {
|
|
17
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens`));
|
|
18
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
19
|
+
.then(extra_response_1.ok)
|
|
20
|
+
.then(extra_response_1.toJSON);
|
|
21
|
+
}
|
|
22
|
+
async addWriteToken(namespace, token, options = {}) {
|
|
23
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens/${token}/write`));
|
|
24
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
25
|
+
}
|
|
26
|
+
async removeWriteToken(namespace, token, options = {}) {
|
|
27
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens/${token}/write`));
|
|
28
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
29
|
+
}
|
|
30
|
+
async addReadToken(namespace, token, options = {}) {
|
|
31
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens/${token}/read`));
|
|
32
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
33
|
+
}
|
|
34
|
+
async removeReadToken(namespace, token, options = {}) {
|
|
35
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens/${token}/read`));
|
|
36
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
37
|
+
}
|
|
38
|
+
async addDeleteToken(namespace, token, options = {}) {
|
|
39
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens/${token}/delete`));
|
|
40
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
41
|
+
}
|
|
42
|
+
async removeDeleteToken(namespace, token, options = {}) {
|
|
43
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/tokens/${token}/delete`));
|
|
44
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.TokenClient = TokenClient;
|
|
48
|
+
//# sourceMappingURL=token-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-client.js","sourceRoot":"","sources":["../../src/token-client.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AACnC,iDAA6C;AAC7C,kEAA8D;AAC9D,mDAA2C;AAC3C,mCAAyE;AASzE,MAAa,WAAY,SAAQ,yBAAiB;IAIhD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,2BAA2B,CAAC,CACtC,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,SAAS,CACb,SAAiB,EACjB,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,SAAS,CAAC,CAC9C,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAiB,CAAA;IACjC,CAAC;IAKD,KAAK,CAAC,aAAa,CACjB,SAAiB,EACjB,KAAa,EACb,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,WAAW,KAAK,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AAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,WAAW,KAAK,SAAS,CAAC,CAC9D,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,iBAAiB,CACrB,SAAiB,EACjB,KAAa,EACb,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,WAAW,KAAK,SAAS,CAAC,CAC9D,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AA/HD,kCA+HC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './utils';
|
|
2
|
+
interface ITokenPolicy {
|
|
3
|
+
writeTokenRequired: boolean | null;
|
|
4
|
+
readTokenRequired: boolean | null;
|
|
5
|
+
deleteTokenRequired: boolean | null;
|
|
6
|
+
}
|
|
7
|
+
export declare class TokenPolicyClient extends EStoreManagerBase {
|
|
8
|
+
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
9
|
+
get(namespace: string, options?: IEStoreManagerRequestOptions): Promise<ITokenPolicy>;
|
|
10
|
+
setWriteTokenRequired(namespace: string, val: boolean, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
11
|
+
removeWriteTokenRequired(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
12
|
+
setReadTokenRequired(namespace: string, val: boolean, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
13
|
+
removeReadTokenRequired(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
14
|
+
setDeleteTokenRequired(namespace: string, val: boolean, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
15
|
+
removeDeleteTokenRequired(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenPolicyClient = void 0;
|
|
4
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
5
|
+
const extra_request_1 = require("extra-request");
|
|
6
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
7
|
+
const extra_response_1 = require("extra-response");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
class TokenPolicyClient extends utils_1.EStoreManagerBase {
|
|
10
|
+
async getNamespaces(options = {}) {
|
|
11
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/admin/estore-with-token-policies'));
|
|
12
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
13
|
+
.then(extra_response_1.ok)
|
|
14
|
+
.then(extra_response_1.toJSON);
|
|
15
|
+
}
|
|
16
|
+
async get(namespace, options = {}) {
|
|
17
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies`));
|
|
18
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
19
|
+
.then(extra_response_1.ok)
|
|
20
|
+
.then(extra_response_1.toJSON);
|
|
21
|
+
}
|
|
22
|
+
async setWriteTokenRequired(namespace, val, options = {}) {
|
|
23
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies/write-token-required`), (0, index_js_1.json)(val));
|
|
24
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
25
|
+
}
|
|
26
|
+
async removeWriteTokenRequired(namespace, options = {}) {
|
|
27
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies/write-token-required`));
|
|
28
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
29
|
+
}
|
|
30
|
+
async setReadTokenRequired(namespace, val, options = {}) {
|
|
31
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies/read-token-required`), (0, index_js_1.json)(val));
|
|
32
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
33
|
+
}
|
|
34
|
+
async removeReadTokenRequired(namespace, options = {}) {
|
|
35
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies/read-token-required`));
|
|
36
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
37
|
+
}
|
|
38
|
+
async setDeleteTokenRequired(namespace, val, options = {}) {
|
|
39
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies/delete-token-required`), (0, index_js_1.json)(val));
|
|
40
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
41
|
+
}
|
|
42
|
+
async removeDeleteTokenRequired(namespace, options = {}) {
|
|
43
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/estore/${namespace}/token-policies/delete-token-required`));
|
|
44
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.TokenPolicyClient = TokenPolicyClient;
|
|
48
|
+
//# sourceMappingURL=token-policy-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-policy-client.js","sourceRoot":"","sources":["../../src/token-policy-client.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AACnC,iDAA6C;AAC7C,kEAAoE;AACpE,mDAA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M,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,iBAAiB,SAAS,uCAAuC,CAAC,CAC5E,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AA5HD,8CA4HC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHTTPOptionsTransformer } from 'extra-request';
|
|
2
|
+
import type { IEStoreManagerOptions } from './estore-manager';
|
|
3
|
+
export interface IEStoreManagerRequestOptions {
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
keepalive?: boolean;
|
|
6
|
+
timeout?: number | false;
|
|
7
|
+
}
|
|
8
|
+
export declare class EStoreManagerBase {
|
|
9
|
+
private options;
|
|
10
|
+
constructor(options: IEStoreManagerOptions);
|
|
11
|
+
protected getCommonTransformers(options: IEStoreManagerRequestOptions): IHTTPOptionsTransformer[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EStoreManagerBase = void 0;
|
|
4
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
5
|
+
const extra_abort_1 = require("extra-abort");
|
|
6
|
+
class EStoreManagerBase {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
getCommonTransformers(options) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return [
|
|
13
|
+
(0, index_js_1.url)(this.options.server),
|
|
14
|
+
(0, index_js_1.bearerAuth)(this.options.adminPassword),
|
|
15
|
+
(0, index_js_1.signal)((0, extra_abort_1.raceAbortSignals)([
|
|
16
|
+
options.signal,
|
|
17
|
+
options.timeout !== false && ((_a = (options.timeout && (0, extra_abort_1.timeoutSignal)(options.timeout))) !== null && _a !== void 0 ? _a : (this.options.timeout && (0, extra_abort_1.timeoutSignal)(this.options.timeout)))
|
|
18
|
+
])),
|
|
19
|
+
(0, index_js_1.keepalive)((_b = options.keepalive) !== null && _b !== void 0 ? _b : this.options.keepalive),
|
|
20
|
+
(0, index_js_1.header)('Accept-Version', '0.1.0')
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.EStoreManagerBase = EStoreManagerBase;
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AACA,kEAAgG;AAChG,6CAA6D;AAS7D,MAAa,iBAAiB;IAC5B,YAAoB,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAE5C,qBAAqB,CAC7B,OAAqC;;QAErC,OAAO;YACL,IAAA,cAAG,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACxB,IAAA,qBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YACtC,IAAA,iBAAM,EAAC,IAAA,8BAAgB,EAAC;gBACtB,OAAO,CAAC,MAAM;gBACd,OAAO,CAAC,OAAO,KAAK,KAAK,IAAI,CAC3B,MAAA,CAAC,OAAO,CAAC,OAAO,IAAI,IAAA,2BAAa,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,mCACnD,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,IAAA,2BAAa,EAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAC9D;aACF,CAAC,CAAC;YACH,IAAA,oBAAS,EAAC,MAAA,OAAO,CAAC,SAAS,mCAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;YACtD,IAAA,iBAAM,EAAC,gBAAgB,EAAE,OAAO,CAAC;SAClC,CAAA;IACH,CAAC;CACF;AApBD,8CAoBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './utils';
|
|
2
|
+
export declare class WhitelistClient extends EStoreManagerBase {
|
|
3
|
+
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
4
|
+
add(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
5
|
+
remove(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WhitelistClient = void 0;
|
|
4
|
+
const extra_fetch_1 = require("extra-fetch");
|
|
5
|
+
const extra_request_1 = require("extra-request");
|
|
6
|
+
const index_js_1 = require("extra-request/transformers/index.js");
|
|
7
|
+
const extra_response_1 = require("extra-response");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
class WhitelistClient extends utils_1.EStoreManagerBase {
|
|
10
|
+
async getNamespaces(options = {}) {
|
|
11
|
+
const req = (0, extra_request_1.get)(...this.getCommonTransformers(options), (0, index_js_1.pathname)('/admin/whitelist'));
|
|
12
|
+
return await (0, extra_fetch_1.fetch)(req)
|
|
13
|
+
.then(extra_response_1.ok)
|
|
14
|
+
.then(extra_response_1.toJSON);
|
|
15
|
+
}
|
|
16
|
+
async add(namespace, options = {}) {
|
|
17
|
+
const req = (0, extra_request_1.put)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/whitelist/${namespace}`));
|
|
18
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
19
|
+
}
|
|
20
|
+
async remove(namespace, options = {}) {
|
|
21
|
+
const req = (0, extra_request_1.del)(...this.getCommonTransformers(options), (0, index_js_1.pathname)(`/admin/whitelist/${namespace}`));
|
|
22
|
+
await (0, extra_fetch_1.fetch)(req).then(extra_response_1.ok);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.WhitelistClient = WhitelistClient;
|
|
26
|
+
//# sourceMappingURL=whitelist-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whitelist-client.js","sourceRoot":"","sources":["../../src/whitelist-client.ts"],"names":[],"mappings":";;;AAAA,6CAAmC;AACnC,iDAA6C;AAC7C,kEAA8D;AAC9D,mDAA2C;AAC3C,mCAAyE;AAEzE,MAAa,eAAgB,SAAQ,yBAAiB;IAIpD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,kBAAkB,CAAC,CAC7B,CAAA;QAED,OAAO,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC;aACpB,IAAI,CAAC,mBAAE,CAAC;aACR,IAAI,CAAC,uBAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACrE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,oBAAoB,SAAS,EAAE,CAAC,CAC1C,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACxE,MAAM,GAAG,GAAG,IAAA,mBAAG,EACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,IAAA,mBAAQ,EAAC,oBAAoB,SAAS,EAAE,CAAC,CAC1C,CAAA;QAED,MAAM,IAAA,mBAAK,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,mBAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AAtCD,0CAsCC"}
|