@blackglory/estore-js 0.3.0 → 0.4.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 +26 -221
- package/lib/contract.d.ts +16 -0
- package/lib/contract.js +2 -0
- package/lib/contract.js.map +1 -0
- package/lib/estore-client.d.ts +27 -0
- package/lib/estore-client.js +62 -0
- package/lib/estore-client.js.map +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/rpc-client.browser.d.ts +8 -0
- package/lib/utils/rpc-client.browser.js +24 -0
- package/lib/utils/rpc-client.browser.js.map +1 -0
- package/lib/utils/rpc-client.d.ts +8 -0
- package/lib/utils/rpc-client.js +25 -0
- package/lib/utils/rpc-client.js.map +1 -0
- package/package.json +20 -11
- package/lib/client.d.ts +0 -41
- package/lib/client.js +0 -106
- package/lib/client.js.map +0 -1
- package/lib/manager/base.d.ts +0 -13
- package/lib/manager/base.js +0 -22
- package/lib/manager/base.js.map +0 -1
- package/lib/manager/blacklist-manager.d.ts +0 -6
- package/lib/manager/blacklist-manager.js +0 -22
- package/lib/manager/blacklist-manager.js.map +0 -1
- package/lib/manager/index.d.ts +0 -20
- package/lib/manager/index.js +0 -16
- package/lib/manager/index.js.map +0 -1
- package/lib/manager/json-schema-manager.d.ts +0 -8
- package/lib/manager/json-schema-manager.js +0 -28
- package/lib/manager/json-schema-manager.js.map +0 -1
- package/lib/manager/token-manager.d.ts +0 -18
- package/lib/manager/token-manager.js +0 -44
- package/lib/manager/token-manager.js.map +0 -1
- package/lib/manager/token-policy-manager.d.ts +0 -17
- package/lib/manager/token-policy-manager.js +0 -44
- package/lib/manager/token-policy-manager.js.map +0 -1
- package/lib/manager/whitelist-manager.d.ts +0 -6
- package/lib/manager/whitelist-manager.js +0 -22
- package/lib/manager/whitelist-manager.js.map +0 -1
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +0 -2
- package/lib/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,247 +9,52 @@ yarn add @blackglory/estore-js
|
|
|
9
9
|
## API
|
|
10
10
|
### EStoreClient
|
|
11
11
|
```ts
|
|
12
|
-
interface
|
|
12
|
+
interface IStats {
|
|
13
13
|
namespace: string
|
|
14
14
|
items: number
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
interface IEStoreClientOptions {
|
|
18
18
|
server: string
|
|
19
|
-
token?: string
|
|
20
|
-
basicAuth?: {
|
|
21
|
-
username: string
|
|
22
|
-
password: string
|
|
23
|
-
}
|
|
24
|
-
keepalive?: boolean
|
|
25
19
|
timeout?: number
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
interface IEStoreClientRequestOptions {
|
|
29
|
-
signal?: AbortSignal
|
|
30
|
-
token?: string
|
|
31
|
-
keepalive?: boolean
|
|
32
|
-
timeout?: number | false
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface IEStoreClientRequestOptionsWithoutToken {
|
|
36
|
-
signal?: AbortSignal
|
|
37
|
-
keepalive?: boolean
|
|
38
|
-
timeout?: number | false
|
|
20
|
+
retryIntervalForReconnection?: number
|
|
39
21
|
}
|
|
40
22
|
|
|
41
23
|
class EStoreClient {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
append<T>(
|
|
45
|
-
namespace: string
|
|
46
|
-
, itemId: string
|
|
47
|
-
, payload: T
|
|
48
|
-
, index?: number
|
|
49
|
-
, options: IEStoreClientRequestOptions = {}
|
|
50
|
-
): Promise<void>
|
|
24
|
+
static create(options: IEStoreClientOptions): Promise<EStoreClient>
|
|
51
25
|
|
|
52
|
-
|
|
53
|
-
namespace: string
|
|
54
|
-
, itemId: string
|
|
55
|
-
, index: number
|
|
56
|
-
, options: IEStoreClientRequestOptions = {}
|
|
57
|
-
): Promise<T | undefined>
|
|
26
|
+
close(): Promise<void>
|
|
58
27
|
|
|
59
|
-
|
|
28
|
+
stats(namespace: string, timeout?: number): Promise<IStats>
|
|
29
|
+
getAllNamespaces(timeout?: number): Promise<string[]>
|
|
30
|
+
getAllItemIds(namespace: string, timeout?: number): Promise<string[]>
|
|
31
|
+
getAllEvents(
|
|
60
32
|
namespace: string
|
|
61
33
|
, itemId: string
|
|
62
|
-
,
|
|
63
|
-
): Promise<T[] | undefined>
|
|
64
|
-
|
|
65
|
-
getSize(
|
|
66
|
-
namespace: string
|
|
67
|
-
, itemId: string
|
|
68
|
-
, options: IEStoreClientRequestOptions = {}
|
|
69
|
-
): Promise<number>
|
|
70
|
-
|
|
71
|
-
has(
|
|
72
|
-
namespace: string
|
|
73
|
-
, itemId: string
|
|
74
|
-
, options: IEStoreClientRequestOptions = {}
|
|
75
|
-
): Promise<boolean>
|
|
76
|
-
|
|
77
|
-
del(
|
|
78
|
-
namespace: string
|
|
79
|
-
, itemId: string
|
|
80
|
-
, options: IEStoreClientRequestOptions = {}
|
|
81
|
-
): Promise<void>
|
|
82
|
-
|
|
83
|
-
clear(
|
|
84
|
-
namespace: string
|
|
85
|
-
, options: IEStoreClientRequestOptions = {}
|
|
86
|
-
): Promise<void>
|
|
87
|
-
|
|
88
|
-
getAllItemIds(
|
|
89
|
-
namespace: string
|
|
90
|
-
, options: IEStoreClientRequestOptions = {}
|
|
34
|
+
, timeout?: number
|
|
91
35
|
): Promise<string[]>
|
|
92
36
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
): Promise<
|
|
37
|
+
clearItemsByNamespace(namespace: string, timeout?: number): Promise<void>
|
|
38
|
+
removeItem(namespace: string, itemId: string, timeout?: number): Promise<void>
|
|
39
|
+
getItemSize(namespace: string, itemId: string, timeout?: number): Promise<number>
|
|
96
40
|
|
|
97
|
-
|
|
41
|
+
/**
|
|
42
|
+
* @param nextEventIndex 如果指定, 则会在eventIndex不等于下一个index时抛出EventIndexConflict错误.
|
|
43
|
+
* @throws {IllegalIndex}
|
|
44
|
+
*/
|
|
45
|
+
appendEvent(
|
|
98
46
|
namespace: string
|
|
99
|
-
,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### EStoreManager
|
|
105
|
-
```ts
|
|
106
|
-
interface IEStoreManagerRequestOptions {
|
|
107
|
-
signal?: AbortSignal
|
|
108
|
-
keepalive?: boolean
|
|
109
|
-
timeout?: number | false
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
interface IEStoreManagerOptions {
|
|
113
|
-
server: string
|
|
114
|
-
adminPassword: string
|
|
115
|
-
keepalive?: boolean
|
|
116
|
-
timeout?: number
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
class EStoreManager {
|
|
120
|
-
constructor(options: IEStoreManagerOptions)
|
|
121
|
-
|
|
122
|
-
JsonSchema: JsonSchemaManager
|
|
123
|
-
Blacklist: BlacklistManager
|
|
124
|
-
Whitelist: WhitelistManager
|
|
125
|
-
TokenPolicy: TokenPolicyManager
|
|
126
|
-
Token: TokenManager
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
#### JsonSchemaManager
|
|
131
|
-
```ts
|
|
132
|
-
class JsonSchemaManager {
|
|
133
|
-
getNamespaces(options: IEStoreManagerRequestOptions = {}): Promise<string[]>
|
|
134
|
-
get(namespace: string, options: IEStoreManagerRequestOptions = {}): Promise<unknown>
|
|
135
|
-
set(
|
|
136
|
-
namespace: string
|
|
137
|
-
, schema: JSONValue
|
|
138
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
139
|
-
): Promise<void>
|
|
140
|
-
remove(
|
|
141
|
-
namespace: string
|
|
142
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
143
|
-
): Promise<void>
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
#### BlacklistManager
|
|
148
|
-
```ts
|
|
149
|
-
class BlacklistManager {
|
|
150
|
-
getNamespaces(options: IEStoreManagerRequestOptions = {}): Promise<string[]>
|
|
151
|
-
add(namespace: string, options: IEStoreManagerRequestOptions = {}): Promise<void>
|
|
152
|
-
remove(namespace: string, options: IEStoreManagerRequestOptions = {}): Promise<void>
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### WhitelistManager
|
|
157
|
-
```ts
|
|
158
|
-
class WhitelistManager {
|
|
159
|
-
getNamespaces(options: IEStoreManagerRequestOptions = {}): Promise<string[]>
|
|
160
|
-
add(namespace: string, options: IEStoreManagerRequestOptions = {}): Promise<void>
|
|
161
|
-
remove(namespace: string, options: IEStoreManagerRequestOptions = {}): Promise<void>
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
#### TokenPolicyManager
|
|
166
|
-
```ts
|
|
167
|
-
interface ITokenPolicy {
|
|
168
|
-
writeTokenRequired: boolean | null
|
|
169
|
-
readTokenRequired: boolean | null
|
|
170
|
-
deleteTokenRequired: boolean | null
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
class TokenPolicyManager {
|
|
174
|
-
getNamespaces(options: IEStoreManagerRequestOptions = {}): Promise<string[]>
|
|
175
|
-
get(
|
|
176
|
-
namespace: string
|
|
177
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
178
|
-
): Promise<ITokenPolicy>
|
|
179
|
-
setWriteTokenRequired(
|
|
180
|
-
namespace: string
|
|
181
|
-
, val: boolean
|
|
182
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
183
|
-
): Promise<void>
|
|
184
|
-
removeWriteTokenRequired(
|
|
185
|
-
namespace: string
|
|
186
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
187
|
-
): Promise<void>
|
|
188
|
-
setReadTokenRequired(
|
|
189
|
-
namespace: string
|
|
190
|
-
, val: boolean
|
|
191
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
192
|
-
): Promise<void>
|
|
193
|
-
removeReadTokenRequired(
|
|
194
|
-
namespace: string
|
|
195
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
196
|
-
): Promise<void>
|
|
197
|
-
setDeleteTokenRequired(
|
|
198
|
-
namespace: string
|
|
199
|
-
, val: boolean
|
|
200
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
201
|
-
): Promise<void>
|
|
202
|
-
removeDeleteTokenRequired(
|
|
203
|
-
namespace: string
|
|
204
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
47
|
+
, itemId: string
|
|
48
|
+
, event: string
|
|
49
|
+
, nextEventIndex?: number
|
|
50
|
+
, timeout?: number
|
|
205
51
|
): Promise<void>
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
52
|
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
interface ITokenInfo {
|
|
212
|
-
token: string
|
|
213
|
-
write: boolean
|
|
214
|
-
read: boolean
|
|
215
|
-
delete: boolean
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
class TokenManager {
|
|
219
|
-
getNamespaces(options: IEStoreManagerRequestOptions = {}): Promise<string[]>
|
|
220
|
-
getTokens(
|
|
221
|
-
namespace: string
|
|
222
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
223
|
-
): Promise<ITokenInfo[]>
|
|
224
|
-
addWriteToken(
|
|
225
|
-
namespace: string
|
|
226
|
-
, token: string
|
|
227
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
228
|
-
): Promise<void>
|
|
229
|
-
removeWriteToken(
|
|
53
|
+
getEvent(
|
|
230
54
|
namespace: string
|
|
231
|
-
,
|
|
232
|
-
,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
namespace: string
|
|
236
|
-
, token: string
|
|
237
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
238
|
-
): Promise<void>
|
|
239
|
-
removeReadToken(
|
|
240
|
-
namespace: string
|
|
241
|
-
, token: string
|
|
242
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
243
|
-
): Promise<void>
|
|
244
|
-
addDeleteToken(
|
|
245
|
-
namespace: string
|
|
246
|
-
, token: string
|
|
247
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
248
|
-
): Promise<void>
|
|
249
|
-
removeDeleteToken(
|
|
250
|
-
namespace: string
|
|
251
|
-
, token: string
|
|
252
|
-
, options: IEStoreManagerRequestOptions = {}
|
|
253
|
-
): Promise<void>
|
|
55
|
+
, itemId: string
|
|
56
|
+
, index: number
|
|
57
|
+
, timeout?: number
|
|
58
|
+
): Promise<string | null>
|
|
254
59
|
}
|
|
255
60
|
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const expectedVersion = "^0.3.0";
|
|
2
|
+
export interface IStats {
|
|
3
|
+
namespace: string;
|
|
4
|
+
items: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IAPI {
|
|
7
|
+
stats(namespace: string): IStats;
|
|
8
|
+
getAllNamespaces(): string[];
|
|
9
|
+
getAllItemIds(namespace: string): string[];
|
|
10
|
+
getAllEvents(namespace: string, itemId: string): string[];
|
|
11
|
+
clearItemsByNamespace(namespace: string): null;
|
|
12
|
+
removeItem(namespace: string, itemId: string): null;
|
|
13
|
+
getItemSize(namespace: string, itemId: string): number;
|
|
14
|
+
appendEvent(namespace: string, itemId: string, event: string, nextEventIndex?: number): null;
|
|
15
|
+
getEvent(namespace: string, itemId: string, eventIndex: number): string | null;
|
|
16
|
+
}
|
package/lib/contract.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IStats } from './contract.js';
|
|
2
|
+
export { IStats } from './contract.js';
|
|
3
|
+
export interface IEStoreClientOptions {
|
|
4
|
+
server: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
retryIntervalForReconnection?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class EStoreClient {
|
|
9
|
+
private client;
|
|
10
|
+
private batchClient;
|
|
11
|
+
private batchProxy;
|
|
12
|
+
private closeClients;
|
|
13
|
+
private timeout?;
|
|
14
|
+
static create(options: IEStoreClientOptions): Promise<EStoreClient>;
|
|
15
|
+
private constructor();
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
stats(namespace: string, timeout?: number): Promise<IStats>;
|
|
18
|
+
getAllNamespaces(timeout?: number): Promise<string[]>;
|
|
19
|
+
getAllItemIds(namespace: string, timeout?: number): Promise<string[]>;
|
|
20
|
+
getAllEvents(namespace: string, itemId: string, timeout?: number): Promise<string[]>;
|
|
21
|
+
clearItemsByNamespace(namespace: string, timeout?: number): Promise<void>;
|
|
22
|
+
removeItem(namespace: string, itemId: string, timeout?: number): Promise<void>;
|
|
23
|
+
getItemSize(namespace: string, itemId: string, timeout?: number): Promise<number>;
|
|
24
|
+
appendEvent(namespace: string, itemId: string, event: string, nextEventIndex?: number, timeout?: number): Promise<void>;
|
|
25
|
+
getEvent(namespace: string, itemId: string, index: number, timeout?: number): Promise<string | null>;
|
|
26
|
+
private withTimeout;
|
|
27
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createRPCClient } from "./utils/rpc-client.js";
|
|
2
|
+
import { timeoutSignal, withAbortSignal } from 'extra-abort';
|
|
3
|
+
import { isUndefined } from '@blackglory/prelude';
|
|
4
|
+
export class EStoreClient {
|
|
5
|
+
constructor(client, batchClient, batchProxy, closeClients, timeout) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
this.batchClient = batchClient;
|
|
8
|
+
this.batchProxy = batchProxy;
|
|
9
|
+
this.closeClients = closeClients;
|
|
10
|
+
this.timeout = timeout;
|
|
11
|
+
}
|
|
12
|
+
static async create(options) {
|
|
13
|
+
const { client, batchClient, proxy, close } = await createRPCClient(options.server);
|
|
14
|
+
return new EStoreClient(client, batchClient, proxy, close, options.timeout);
|
|
15
|
+
}
|
|
16
|
+
async close() {
|
|
17
|
+
await this.closeClients();
|
|
18
|
+
}
|
|
19
|
+
async stats(namespace, timeout) {
|
|
20
|
+
return await this.withTimeout(() => this.client.stats(namespace), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
21
|
+
}
|
|
22
|
+
async getAllNamespaces(timeout) {
|
|
23
|
+
return await this.withTimeout(() => this.client.getAllNamespaces(), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
24
|
+
}
|
|
25
|
+
async getAllItemIds(namespace, timeout) {
|
|
26
|
+
return await this.withTimeout(() => this.client.getAllItemIds(namespace), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
27
|
+
}
|
|
28
|
+
async getAllEvents(namespace, itemId, timeout) {
|
|
29
|
+
return await this.withTimeout(() => this.client.getAllEvents(namespace, itemId), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
30
|
+
}
|
|
31
|
+
async clearItemsByNamespace(namespace, timeout) {
|
|
32
|
+
await this.withTimeout(() => this.client.clearItemsByNamespace(namespace), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
33
|
+
}
|
|
34
|
+
async removeItem(namespace, itemId, timeout) {
|
|
35
|
+
await this.withTimeout(() => this.client.removeItem(namespace, itemId), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
36
|
+
}
|
|
37
|
+
async getItemSize(namespace, itemId, timeout) {
|
|
38
|
+
return await this.withTimeout(() => this.client.getItemSize(namespace, itemId), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
39
|
+
}
|
|
40
|
+
async appendEvent(namespace, itemId, event, nextEventIndex, timeout) {
|
|
41
|
+
await this.withTimeout(() => {
|
|
42
|
+
if (isUndefined(nextEventIndex)) {
|
|
43
|
+
return this.client.appendEvent(namespace, itemId, event);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return this.client.appendEvent(namespace, itemId, event, nextEventIndex);
|
|
47
|
+
}
|
|
48
|
+
}, timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
49
|
+
}
|
|
50
|
+
async getEvent(namespace, itemId, index, timeout) {
|
|
51
|
+
return await this.withTimeout(() => this.client.getEvent(namespace, itemId, index), timeout !== null && timeout !== void 0 ? timeout : this.timeout);
|
|
52
|
+
}
|
|
53
|
+
async withTimeout(fn, timeout = this.timeout) {
|
|
54
|
+
if (timeout) {
|
|
55
|
+
return await withAbortSignal(timeoutSignal(timeout), fn);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return await fn();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=estore-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estore-client.js","sourceRoot":"","sources":["../src/estore-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,8BAA4B;AAGtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AASjD,MAAM,OAAO,YAAY;IAMvB,YACU,MAAyB,EACzB,WAAwB,EACxB,UAA2C,EAC3C,YAAiC,EACjC,OAAgB;QAJhB,WAAM,GAAN,MAAM,CAAmB;QACzB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAiC;QAC3C,iBAAY,GAAZ,YAAY,CAAqB;QACjC,YAAO,GAAP,OAAO,CAAS;IACvB,CAAC;IAXJ,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAA6B;QAC/C,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACnF,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7E,CAAC;IAUD,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;IAC3B,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,OAAgB;QAC7C,OAAO,MAAM,IAAI,CA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,EAAwB,EACxB,UAA8B,IAAI,CAAC,OAAO;QAE1C,IAAI,OAAO,EAAE;YACX,OAAO,MAAM,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;SACzD;aAAM;YACL,OAAO,MAAM,EAAE,EAAE,CAAA;SAClB;IACH,CAAC;CACF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './client.js';
|
|
2
|
-
export * from './manager/index.js';
|
|
1
|
+
export * from './estore-client.js';
|
package/lib/index.js
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAPI } from "../contract.js";
|
|
2
|
+
import { ClientProxy, BatchClient, BatchClientProxy } from 'delight-rpc';
|
|
3
|
+
export declare function createRPCClient(url: string, retryIntervalForReconnection?: number): Promise<{
|
|
4
|
+
client: ClientProxy<IAPI>;
|
|
5
|
+
batchClient: BatchClient<IAPI>;
|
|
6
|
+
proxy: BatchClientProxy<IAPI, unknown>;
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { expectedVersion } from "../contract.js";
|
|
2
|
+
import { createBatchProxy } from 'delight-rpc';
|
|
3
|
+
import { createClient, createBatchClient } from '@delight-rpc/extra-native-websocket';
|
|
4
|
+
import { ExtraNativeWebSocket, autoReconnect } from 'extra-native-websocket';
|
|
5
|
+
export async function createRPCClient(url, retryIntervalForReconnection) {
|
|
6
|
+
const ws = new ExtraNativeWebSocket(() => new WebSocket(url));
|
|
7
|
+
const cancelAutoReconnect = autoReconnect(ws, retryIntervalForReconnection);
|
|
8
|
+
await ws.connect();
|
|
9
|
+
const [client, closeClient] = createClient(ws, { expectedVersion });
|
|
10
|
+
const [batchClient, closeBatchClient] = createBatchClient(ws, { expectedVersion });
|
|
11
|
+
const proxy = createBatchProxy();
|
|
12
|
+
return {
|
|
13
|
+
client,
|
|
14
|
+
batchClient,
|
|
15
|
+
proxy,
|
|
16
|
+
close: async () => {
|
|
17
|
+
closeClient();
|
|
18
|
+
closeBatchClient();
|
|
19
|
+
cancelAutoReconnect();
|
|
20
|
+
await ws.close();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=rpc-client.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-client.browser.js","sourceRoot":"","sources":["../../src/utils/rpc-client.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,uBAAwB;AACxD,OAAO,EAA8C,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACrF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE5E,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,4BAAqC;IAOrC,MAAM,EAAE,GAAG,IAAI,oBAAoB,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IAC7D,MAAM,mBAAmB,GAAG,aAAa,CAAC,EAAE,EAAE,4BAA4B,CAAC,CAAA;IAC3E,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;IAElB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,YAAY,CAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;IACzE,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;IAClF,MAAM,KAAK,GAAG,gBAAgB,EAAQ,CAAA;IAEtC,OAAO;QACL,MAAM;QACN,WAAW;QACX,KAAK;QACL,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,WAAW,EAAE,CAAA;YACb,gBAAgB,EAAE,CAAA;YAClB,mBAAmB,EAAE,CAAA;YACrB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAPI } from "../contract.js";
|
|
2
|
+
import { ClientProxy, BatchClient, BatchClientProxy } from 'delight-rpc';
|
|
3
|
+
export declare function createRPCClient(url: string, retryIntervalForReconnection?: number): Promise<{
|
|
4
|
+
client: ClientProxy<IAPI>;
|
|
5
|
+
batchClient: BatchClient<IAPI>;
|
|
6
|
+
proxy: BatchClientProxy<IAPI, unknown>;
|
|
7
|
+
close: () => Promise<void>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { expectedVersion } from "../contract.js";
|
|
2
|
+
import { createBatchProxy } from 'delight-rpc';
|
|
3
|
+
import { createClient, createBatchClient } from '@delight-rpc/extra-websocket';
|
|
4
|
+
import { WebSocket } from 'ws';
|
|
5
|
+
import { ExtraWebSocket, autoReconnect } from 'extra-websocket';
|
|
6
|
+
export async function createRPCClient(url, retryIntervalForReconnection) {
|
|
7
|
+
const ws = new ExtraWebSocket(() => new WebSocket(url));
|
|
8
|
+
const cancelAutoReconnect = autoReconnect(ws, retryIntervalForReconnection);
|
|
9
|
+
await ws.connect();
|
|
10
|
+
const [client, closeClient] = createClient(ws, { expectedVersion });
|
|
11
|
+
const [batchClient, closeBatchClient] = createBatchClient(ws, { expectedVersion });
|
|
12
|
+
const proxy = createBatchProxy();
|
|
13
|
+
return {
|
|
14
|
+
client,
|
|
15
|
+
batchClient,
|
|
16
|
+
proxy,
|
|
17
|
+
close: async () => {
|
|
18
|
+
closeClient();
|
|
19
|
+
closeBatchClient();
|
|
20
|
+
cancelAutoReconnect();
|
|
21
|
+
await ws.close();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=rpc-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-client.js","sourceRoot":"","sources":["../../src/utils/rpc-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,eAAe,EAAE,uBAAwB;AACxD,OAAO,EAA8C,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/D,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAW,EACX,4BAAqC;IAOrC,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;IACvD,MAAM,mBAAmB,GAAG,aAAa,CAAC,EAAE,EAAE,4BAA4B,CAAC,CAAA;IAC3E,MAAM,EAAE,CAAC,OAAO,EAAE,CAAA;IAElB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,YAAY,CAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;IACzE,MAAM,CAAC,WAAW,EAAE,gBAAgB,CAAC,GAAG,iBAAiB,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,CAAA;IAClF,MAAM,KAAK,GAAG,gBAAgB,EAAQ,CAAA;IAEtC,OAAO;QACL,MAAM;QACN,WAAW;QACX,KAAK;QACL,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,WAAW,EAAE,CAAA;YACb,gBAAgB,EAAE,CAAA;YAClB,mBAAmB,EAAE,CAAA;YACrB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackglory/estore-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"files": [
|
|
7
7
|
"lib"
|
|
8
8
|
],
|
|
9
9
|
"type": "module",
|
|
10
|
-
"sideEffects": false,
|
|
11
10
|
"main": "lib/index.js",
|
|
12
11
|
"types": "lib/index.d.ts",
|
|
12
|
+
"browser": {
|
|
13
|
+
"./lib/utils/rpc-client.js": "./lib/utils/rpc-client.browser.js"
|
|
14
|
+
},
|
|
13
15
|
"repository": "git@github.com:BlackGlory/estore-js.git",
|
|
14
16
|
"author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
|
|
15
17
|
"license": "MIT",
|
|
18
|
+
"sideEffects": false,
|
|
16
19
|
"engines": {
|
|
17
20
|
"node": ">=16"
|
|
18
21
|
},
|
|
@@ -24,12 +27,17 @@
|
|
|
24
27
|
"test:coverage": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage --config jest.config.cjs",
|
|
25
28
|
"prepublishOnly": "run-s prepare clean build",
|
|
26
29
|
"clean": "rimraf lib",
|
|
27
|
-
"build": "tsc --project tsconfig.build.json
|
|
30
|
+
"build": "tsc --project tsconfig.build.json",
|
|
31
|
+
"docker:test": "run-s docker:test:clean docker:test:build docker:test:run docker:test:clean",
|
|
32
|
+
"docker:coverage": "run-s docker:test:clean docker:test:build docker:test:coverage docker:test:clean",
|
|
33
|
+
"docker:test:build": "docker-compose --project-name estore-js --file docker-compose.test.yml build",
|
|
34
|
+
"docker:test:run": "docker-compose --project-name estore-js --file docker-compose.test.yml run --rm test",
|
|
35
|
+
"docker:test:clean": "docker-compose --project-name estore-js --file docker-compose.test.yml down",
|
|
28
36
|
"release": "standard-version"
|
|
29
37
|
},
|
|
30
38
|
"husky": {
|
|
31
39
|
"hooks": {
|
|
32
|
-
"pre-commit": "run-s prepare lint build test",
|
|
40
|
+
"pre-commit": "run-s prepare lint build docker:test",
|
|
33
41
|
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
34
42
|
}
|
|
35
43
|
},
|
|
@@ -38,6 +46,7 @@
|
|
|
38
46
|
"@commitlint/cli": "^17.4.2",
|
|
39
47
|
"@commitlint/config-conventional": "^17.4.2",
|
|
40
48
|
"@types/jest": "^29.4.0",
|
|
49
|
+
"@types/ws": "^8.5.4",
|
|
41
50
|
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
42
51
|
"@typescript-eslint/parser": "^5.49.0",
|
|
43
52
|
"cross-env": "^7.0.3",
|
|
@@ -45,9 +54,7 @@
|
|
|
45
54
|
"extra-utils": "^5.0.1",
|
|
46
55
|
"husky": "4",
|
|
47
56
|
"jest": "^29.4.1",
|
|
48
|
-
"jest-environment-jsdom": "^29.4.1",
|
|
49
57
|
"jest-resolve": "^29.4.1",
|
|
50
|
-
"msw": "^1.0.0",
|
|
51
58
|
"npm-run-all": "^4.1.5",
|
|
52
59
|
"rimraf": "^3.0.2",
|
|
53
60
|
"standard-version": "^9.3.2",
|
|
@@ -59,12 +66,14 @@
|
|
|
59
66
|
},
|
|
60
67
|
"dependencies": {
|
|
61
68
|
"@blackglory/errors": "^3.0.0",
|
|
62
|
-
"@blackglory/http-status": "^2.0.1",
|
|
63
69
|
"@blackglory/prelude": "^0.3.1",
|
|
70
|
+
"@delight-rpc/extra-native-websocket": "^0.4.0",
|
|
71
|
+
"@delight-rpc/extra-websocket": "^0.4.0",
|
|
72
|
+
"delight-rpc": "^5.0.3",
|
|
64
73
|
"extra-abort": "^0.3.1",
|
|
65
|
-
"extra-
|
|
66
|
-
"extra-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
74
|
+
"extra-native-websocket": "^0.3.1",
|
|
75
|
+
"extra-websocket": "^0.3.1",
|
|
76
|
+
"justypes": "^4.1.0",
|
|
77
|
+
"ws": "^8.12.0"
|
|
69
78
|
}
|
|
70
79
|
}
|
package/lib/client.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
interface IInfo {
|
|
2
|
-
namespace: string;
|
|
3
|
-
items: number;
|
|
4
|
-
}
|
|
5
|
-
export interface IEStoreClientOptions {
|
|
6
|
-
server: string;
|
|
7
|
-
token?: string;
|
|
8
|
-
basicAuth?: {
|
|
9
|
-
username: string;
|
|
10
|
-
password: string;
|
|
11
|
-
};
|
|
12
|
-
keepalive?: boolean;
|
|
13
|
-
timeout?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface IEStoreClientRequestOptions {
|
|
16
|
-
signal?: AbortSignal;
|
|
17
|
-
token?: string;
|
|
18
|
-
keepalive?: boolean;
|
|
19
|
-
timeout?: number | false;
|
|
20
|
-
}
|
|
21
|
-
export interface IEStoreClientRequestOptionsWithoutToken {
|
|
22
|
-
signal?: AbortSignal;
|
|
23
|
-
keepalive?: boolean;
|
|
24
|
-
timeout?: number | false;
|
|
25
|
-
}
|
|
26
|
-
export declare class EStoreClient {
|
|
27
|
-
private options;
|
|
28
|
-
constructor(options: IEStoreClientOptions);
|
|
29
|
-
private getCommonTransformers;
|
|
30
|
-
append<T>(namespace: string, itemId: string, payload: T, index?: number, options?: IEStoreClientRequestOptions): Promise<void>;
|
|
31
|
-
getEvent<T>(namespace: string, itemId: string, index: number, options?: IEStoreClientRequestOptions): Promise<T | undefined>;
|
|
32
|
-
getEvents<T>(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<T[] | undefined>;
|
|
33
|
-
getSize(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<number>;
|
|
34
|
-
has(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<boolean>;
|
|
35
|
-
del(namespace: string, itemId: string, options?: IEStoreClientRequestOptions): Promise<void>;
|
|
36
|
-
clear(namespace: string, options?: IEStoreClientRequestOptions): Promise<void>;
|
|
37
|
-
getAllItemIds(namespace: string, options?: IEStoreClientRequestOptions): Promise<string[]>;
|
|
38
|
-
getAllNamespaces(options?: IEStoreClientRequestOptionsWithoutToken): Promise<string[]>;
|
|
39
|
-
stats(namespace: string, options?: IEStoreClientRequestOptionsWithoutToken): Promise<IInfo>;
|
|
40
|
-
}
|
|
41
|
-
export {};
|
package/lib/client.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { fetch } from 'extra-fetch';
|
|
2
|
-
import { head, post, get, del } from 'extra-request';
|
|
3
|
-
import { url, appendPathname, json, searchParams, signal, basicAuth, keepalive, header } from 'extra-request/transformers';
|
|
4
|
-
import { NotFound } from '@blackglory/http-status';
|
|
5
|
-
import { ok, toJSON } from 'extra-response';
|
|
6
|
-
import { raceAbortSignals, timeoutSignal } from 'extra-abort';
|
|
7
|
-
import { isntUndefined } from '@blackglory/prelude';
|
|
8
|
-
import { expectedVersion } from "./utils.js";
|
|
9
|
-
export class EStoreClient {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.options = options;
|
|
12
|
-
}
|
|
13
|
-
getCommonTransformers(options) {
|
|
14
|
-
var _a, _b, _c;
|
|
15
|
-
const token = 'token' in options
|
|
16
|
-
? ((_a = options.token) !== null && _a !== void 0 ? _a : this.options.token)
|
|
17
|
-
: this.options.token;
|
|
18
|
-
const auth = this.options.basicAuth;
|
|
19
|
-
return [
|
|
20
|
-
url(this.options.server),
|
|
21
|
-
auth && basicAuth(auth.username, auth.password),
|
|
22
|
-
token && searchParams({ token }),
|
|
23
|
-
signal(raceAbortSignals([
|
|
24
|
-
options.signal,
|
|
25
|
-
options.timeout !== false && ((_b = (options.timeout && timeoutSignal(options.timeout))) !== null && _b !== void 0 ? _b : (this.options.timeout && timeoutSignal(this.options.timeout)))
|
|
26
|
-
])),
|
|
27
|
-
((_c = options.keepalive) !== null && _c !== void 0 ? _c : this.options.keepalive) && keepalive(),
|
|
28
|
-
header('Accept-Version', expectedVersion)
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
async append(namespace, itemId, payload, index, options = {}) {
|
|
32
|
-
const req = post(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items/${itemId}/events`), isntUndefined(index) && header('If-Match', `${index}`), json(payload));
|
|
33
|
-
await fetch(req).then(ok);
|
|
34
|
-
}
|
|
35
|
-
async getEvent(namespace, itemId, index, options = {}) {
|
|
36
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items/${itemId}/events/${index}`));
|
|
37
|
-
try {
|
|
38
|
-
return await fetch(req)
|
|
39
|
-
.then(ok)
|
|
40
|
-
.then(toJSON);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
if (e instanceof NotFound)
|
|
44
|
-
return undefined;
|
|
45
|
-
throw e;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async getEvents(namespace, itemId, options = {}) {
|
|
49
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items/${itemId}/events`));
|
|
50
|
-
try {
|
|
51
|
-
return await fetch(req)
|
|
52
|
-
.then(ok)
|
|
53
|
-
.then(toJSON);
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
if (e instanceof NotFound)
|
|
57
|
-
return undefined;
|
|
58
|
-
throw e;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async getSize(namespace, itemId, options = {}) {
|
|
62
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items/${itemId}/size`));
|
|
63
|
-
return await fetch(req)
|
|
64
|
-
.then(ok)
|
|
65
|
-
.then(toJSON);
|
|
66
|
-
}
|
|
67
|
-
async has(namespace, itemId, options = {}) {
|
|
68
|
-
const req = head(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items/${itemId}`));
|
|
69
|
-
try {
|
|
70
|
-
await fetch(req).then(ok);
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
if (e instanceof NotFound)
|
|
75
|
-
return false;
|
|
76
|
-
throw e;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async del(namespace, itemId, options = {}) {
|
|
80
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items/${itemId}`));
|
|
81
|
-
await fetch(req).then(ok);
|
|
82
|
-
}
|
|
83
|
-
async clear(namespace, options = {}) {
|
|
84
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}`));
|
|
85
|
-
await fetch(req).then(ok);
|
|
86
|
-
}
|
|
87
|
-
async getAllItemIds(namespace, options = {}) {
|
|
88
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/items`));
|
|
89
|
-
return await fetch(req)
|
|
90
|
-
.then(ok)
|
|
91
|
-
.then(toJSON);
|
|
92
|
-
}
|
|
93
|
-
async getAllNamespaces(options = {}) {
|
|
94
|
-
const req = get(...this.getCommonTransformers(options), appendPathname('/estore'));
|
|
95
|
-
return await fetch(req)
|
|
96
|
-
.then(ok)
|
|
97
|
-
.then(toJSON);
|
|
98
|
-
}
|
|
99
|
-
async stats(namespace, options = {}) {
|
|
100
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/estore/${namespace}/stats`));
|
|
101
|
-
return await fetch(req)
|
|
102
|
-
.then(ok)
|
|
103
|
-
.then(toJSON);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=client.js.map
|
package/lib/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAA8B,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,IAA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;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAU,CAAA;IAC1B,CAAC;CACF"}
|
package/lib/manager/base.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IRequestOptionsTransformer } from 'extra-request';
|
|
2
|
-
import type { IEStoreManagerOptions } from './index.js';
|
|
3
|
-
import { Falsy } from 'justypes';
|
|
4
|
-
export interface IEStoreManagerRequestOptions {
|
|
5
|
-
signal?: AbortSignal;
|
|
6
|
-
keepalive?: boolean;
|
|
7
|
-
timeout?: number | false;
|
|
8
|
-
}
|
|
9
|
-
export declare class EStoreManagerBase {
|
|
10
|
-
private options;
|
|
11
|
-
constructor(options: IEStoreManagerOptions);
|
|
12
|
-
protected getCommonTransformers(options: IEStoreManagerRequestOptions): Array<IRequestOptionsTransformer | Falsy>;
|
|
13
|
-
}
|
package/lib/manager/base.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { url, signal, keepalive, bearerAuth, header } from 'extra-request/transformers/index';
|
|
2
|
-
import { timeoutSignal, raceAbortSignals } from 'extra-abort';
|
|
3
|
-
import { expectedVersion } from "../utils.js";
|
|
4
|
-
export class EStoreManagerBase {
|
|
5
|
-
constructor(options) {
|
|
6
|
-
this.options = options;
|
|
7
|
-
}
|
|
8
|
-
getCommonTransformers(options) {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
return [
|
|
11
|
-
url(this.options.server),
|
|
12
|
-
bearerAuth(this.options.adminPassword),
|
|
13
|
-
signal(raceAbortSignals([
|
|
14
|
-
options.signal,
|
|
15
|
-
options.timeout !== false && ((_a = (options.timeout && timeoutSignal(options.timeout))) !== null && _a !== void 0 ? _a : (this.options.timeout && timeoutSignal(this.options.timeout)))
|
|
16
|
-
])),
|
|
17
|
-
((_b = options.keepalive) !== null && _b !== void 0 ? _b : this.options.keepalive) && keepalive(),
|
|
18
|
-
header('Accept-Version', expectedVersion)
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=base.js.map
|
package/lib/manager/base.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/manager/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC7F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAG7D,OAAO,EAAE,eAAe,EAAE,oBAAqB;AAQ/C,MAAM,OAAO,iBAAiB;IAC5B,YAAoB,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAE5C,qBAAqB,CAC7B,OAAqC;;QAErC,OAAO;YACL,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;YACxB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;YACtC,MAAM,CAAC,gBAAgB,CAAC;gBACtB,OAAO,CAAC,MAAM;gBACd,OAAO,CAAC,OAAO,KAAK,KAAK,IAAI,CAC3B,MAAA,CAAC,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,mCACnD,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAC9D;aACF,CAAC,CAAC;YACH,CAAC,MAAA,OAAO,CAAC,SAAS,mCAAI,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,EAAE;YAC5D,MAAM,CAAC,gBAAgB,EAAE,eAAe,CAAC;SAC1C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './base.js';
|
|
2
|
-
export declare class BlacklistManager 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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { fetch } from 'extra-fetch';
|
|
2
|
-
import { get, put, del } from 'extra-request';
|
|
3
|
-
import { appendPathname } from 'extra-request/transformers';
|
|
4
|
-
import { ok, toJSON } from 'extra-response';
|
|
5
|
-
import { EStoreManagerBase } from './base.js';
|
|
6
|
-
export class BlacklistManager extends EStoreManagerBase {
|
|
7
|
-
async getNamespaces(options = {}) {
|
|
8
|
-
const req = get(...this.getCommonTransformers(options), appendPathname('/admin/blacklist'));
|
|
9
|
-
return await fetch(req)
|
|
10
|
-
.then(ok)
|
|
11
|
-
.then(toJSON);
|
|
12
|
-
}
|
|
13
|
-
async add(namespace, options = {}) {
|
|
14
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/blacklist/${namespace}`));
|
|
15
|
-
await fetch(req).then(ok);
|
|
16
|
-
}
|
|
17
|
-
async remove(namespace, options = {}) {
|
|
18
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/blacklist/${namespace}`));
|
|
19
|
-
await fetch(req).then(ok);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=blacklist-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blacklist-manager.js","sourceRoot":"","sources":["../../src/manager/blacklist-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE3E,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAIrD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,kBAAkB,CAAC,CACnC,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACrE,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAChD,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACxE,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAChD,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF"}
|
package/lib/manager/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { JsonSchemaManager } from './json-schema-manager.js';
|
|
2
|
-
import { BlacklistManager } from './blacklist-manager.js';
|
|
3
|
-
import { WhitelistManager } from './whitelist-manager.js';
|
|
4
|
-
import { TokenPolicyManager } from './token-policy-manager.js';
|
|
5
|
-
import { TokenManager } from './token-manager.js';
|
|
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: JsonSchemaManager;
|
|
16
|
-
Blacklist: BlacklistManager;
|
|
17
|
-
Whitelist: WhitelistManager;
|
|
18
|
-
TokenPolicy: TokenPolicyManager;
|
|
19
|
-
Token: TokenManager;
|
|
20
|
-
}
|
package/lib/manager/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { JsonSchemaManager } from './json-schema-manager.js';
|
|
2
|
-
import { BlacklistManager } from './blacklist-manager.js';
|
|
3
|
-
import { WhitelistManager } from './whitelist-manager.js';
|
|
4
|
-
import { TokenPolicyManager } from './token-policy-manager.js';
|
|
5
|
-
import { TokenManager } from './token-manager.js';
|
|
6
|
-
export class EStoreManager {
|
|
7
|
-
constructor(options) {
|
|
8
|
-
this.options = options;
|
|
9
|
-
this.JsonSchema = new JsonSchemaManager(this.options);
|
|
10
|
-
this.Blacklist = new BlacklistManager(this.options);
|
|
11
|
-
this.Whitelist = new WhitelistManager(this.options);
|
|
12
|
-
this.TokenPolicy = new TokenPolicyManager(this.options);
|
|
13
|
-
this.Token = new TokenManager(this.options);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
package/lib/manager/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AASjD,MAAM,OAAO,aAAa;IACxB,YAAoB,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;QAElD,eAAU,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAChD,cAAS,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC9C,cAAS,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC9C,gBAAW,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAClD,UAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IANe,CAAC;CAOvD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { JSONValue } from 'justypes';
|
|
2
|
-
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './base.js';
|
|
3
|
-
export declare class JsonSchemaManager extends EStoreManagerBase {
|
|
4
|
-
getNamespaces(options?: IEStoreManagerRequestOptions): Promise<string[]>;
|
|
5
|
-
get(namespace: string, options?: IEStoreManagerRequestOptions): Promise<unknown>;
|
|
6
|
-
set(namespace: string, schema: JSONValue, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
7
|
-
remove(namespace: string, options?: IEStoreManagerRequestOptions): Promise<void>;
|
|
8
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { fetch } from 'extra-fetch';
|
|
2
|
-
import { get, put, del } from 'extra-request';
|
|
3
|
-
import { appendPathname, json } from 'extra-request/transformers';
|
|
4
|
-
import { ok, toJSON } from 'extra-response';
|
|
5
|
-
import { EStoreManagerBase } from './base.js';
|
|
6
|
-
export class JsonSchemaManager extends EStoreManagerBase {
|
|
7
|
-
async getNamespaces(options = {}) {
|
|
8
|
-
const req = get(...this.getCommonTransformers(options), appendPathname('/admin/estore-with-json-schema'));
|
|
9
|
-
return await fetch(req)
|
|
10
|
-
.then(ok)
|
|
11
|
-
.then(toJSON);
|
|
12
|
-
}
|
|
13
|
-
async get(namespace, options = {}) {
|
|
14
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/json-schema`));
|
|
15
|
-
return await fetch(req)
|
|
16
|
-
.then(ok)
|
|
17
|
-
.then(toJSON);
|
|
18
|
-
}
|
|
19
|
-
async set(namespace, schema, options = {}) {
|
|
20
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/json-schema`), json(schema));
|
|
21
|
-
await fetch(req).then(ok);
|
|
22
|
-
}
|
|
23
|
-
async remove(namespace, options = {}) {
|
|
24
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/json-schema`));
|
|
25
|
-
await fetch(req).then(ok);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=json-schema-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-manager.js","sourceRoot":"","sources":["../../src/manager/json-schema-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE3E,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAItD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,gCAAgC,CAAC,CACjD,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACrE,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,iBAAiB,SAAS,cAAc,CAAC,CACzD,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAC,CAAA;IACjB,CAAC;IAKD,KAAK,CAAC,GAAG,CACP,SAAiB,EACjB,MAAiB,EACjB,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,iBAAiB,SAAS,cAAc,CAAC,EACxD,IAAI,CAAC,MAAM,CAAC,CACb,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,iBAAiB,SAAS,cAAc,CAAC,CACzD,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './base.js';
|
|
2
|
-
interface ITokenInfo {
|
|
3
|
-
token: string;
|
|
4
|
-
write: boolean;
|
|
5
|
-
read: boolean;
|
|
6
|
-
delete: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class TokenManager 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 {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { fetch } from 'extra-fetch';
|
|
2
|
-
import { get, put, del } from 'extra-request';
|
|
3
|
-
import { appendPathname } from 'extra-request/transformers';
|
|
4
|
-
import { ok, toJSON } from 'extra-response';
|
|
5
|
-
import { EStoreManagerBase } from './base.js';
|
|
6
|
-
export class TokenManager extends EStoreManagerBase {
|
|
7
|
-
async getNamespaces(options = {}) {
|
|
8
|
-
const req = get(...this.getCommonTransformers(options), appendPathname('/admin/estore-with-tokens'));
|
|
9
|
-
return await fetch(req)
|
|
10
|
-
.then(ok)
|
|
11
|
-
.then(toJSON);
|
|
12
|
-
}
|
|
13
|
-
async getTokens(namespace, options = {}) {
|
|
14
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens`));
|
|
15
|
-
return await fetch(req)
|
|
16
|
-
.then(ok)
|
|
17
|
-
.then(toJSON);
|
|
18
|
-
}
|
|
19
|
-
async addWriteToken(namespace, token, options = {}) {
|
|
20
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens/${token}/write`));
|
|
21
|
-
await fetch(req).then(ok);
|
|
22
|
-
}
|
|
23
|
-
async removeWriteToken(namespace, token, options = {}) {
|
|
24
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens/${token}/write`));
|
|
25
|
-
await fetch(req).then(ok);
|
|
26
|
-
}
|
|
27
|
-
async addReadToken(namespace, token, options = {}) {
|
|
28
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens/${token}/read`));
|
|
29
|
-
await fetch(req).then(ok);
|
|
30
|
-
}
|
|
31
|
-
async removeReadToken(namespace, token, options = {}) {
|
|
32
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens/${token}/read`));
|
|
33
|
-
await fetch(req).then(ok);
|
|
34
|
-
}
|
|
35
|
-
async addDeleteToken(namespace, token, options = {}) {
|
|
36
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens/${token}/delete`));
|
|
37
|
-
await fetch(req).then(ok);
|
|
38
|
-
}
|
|
39
|
-
async removeDeleteToken(namespace, token, options = {}) {
|
|
40
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/tokens/${token}/delete`));
|
|
41
|
-
await fetch(req).then(ok);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=token-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-manager.js","sourceRoot":"","sources":["../../src/manager/token-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE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AAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './base.js';
|
|
2
|
-
interface ITokenPolicy {
|
|
3
|
-
writeTokenRequired: boolean | null;
|
|
4
|
-
readTokenRequired: boolean | null;
|
|
5
|
-
deleteTokenRequired: boolean | null;
|
|
6
|
-
}
|
|
7
|
-
export declare class TokenPolicyManager 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 {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { fetch } from 'extra-fetch';
|
|
2
|
-
import { get, put, del } from 'extra-request';
|
|
3
|
-
import { appendPathname, json } from 'extra-request/transformers';
|
|
4
|
-
import { ok, toJSON } from 'extra-response';
|
|
5
|
-
import { EStoreManagerBase } from './base.js';
|
|
6
|
-
export class TokenPolicyManager extends EStoreManagerBase {
|
|
7
|
-
async getNamespaces(options = {}) {
|
|
8
|
-
const req = get(...this.getCommonTransformers(options), appendPathname('/admin/estore-with-token-policies'));
|
|
9
|
-
return await fetch(req)
|
|
10
|
-
.then(ok)
|
|
11
|
-
.then(toJSON);
|
|
12
|
-
}
|
|
13
|
-
async get(namespace, options = {}) {
|
|
14
|
-
const req = get(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies`));
|
|
15
|
-
return await fetch(req)
|
|
16
|
-
.then(ok)
|
|
17
|
-
.then(toJSON);
|
|
18
|
-
}
|
|
19
|
-
async setWriteTokenRequired(namespace, val, options = {}) {
|
|
20
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies/write-token-required`), json(val));
|
|
21
|
-
await fetch(req).then(ok);
|
|
22
|
-
}
|
|
23
|
-
async removeWriteTokenRequired(namespace, options = {}) {
|
|
24
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies/write-token-required`));
|
|
25
|
-
await fetch(req).then(ok);
|
|
26
|
-
}
|
|
27
|
-
async setReadTokenRequired(namespace, val, options = {}) {
|
|
28
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies/read-token-required`), json(val));
|
|
29
|
-
await fetch(req).then(ok);
|
|
30
|
-
}
|
|
31
|
-
async removeReadTokenRequired(namespace, options = {}) {
|
|
32
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies/read-token-required`));
|
|
33
|
-
await fetch(req).then(ok);
|
|
34
|
-
}
|
|
35
|
-
async setDeleteTokenRequired(namespace, val, options = {}) {
|
|
36
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies/delete-token-required`), json(val));
|
|
37
|
-
await fetch(req).then(ok);
|
|
38
|
-
}
|
|
39
|
-
async removeDeleteTokenRequired(namespace, options = {}) {
|
|
40
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/estore/${namespace}/token-policies/delete-token-required`));
|
|
41
|
-
await fetch(req).then(ok);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=token-policy-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-policy-manager.js","sourceRoot":"","sources":["../../src/manager/token-policy-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAQ3E,MAAM,OAAO,kBAAmB,SAAQ,iBAAiB;IAIvD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,mCAAmC,CAAC,CACpD,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CACP,SAAiB,EACjB,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,iBAAiB,SAAS,iBAAiB,CAAC,CAC5D,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAiB,CAAA;IACjC,CAAC;IAKD,KAAK,CAAC,qBAAqB,CACzB,SAAiB,EACjB,GAAY,EACZ,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAA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B,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,iBAAiB,SAAS,uCAAuC,CAAC,EACjF,IAAI,CAAC,GAAG,CAAC,CACV,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,yBAAyB,CAC7B,SAAiB,EACjB,UAAwC,EAAE;QAE1C,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,iBAAiB,SAAS,uCAAuC,CAAC,CAClF,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IEStoreManagerRequestOptions, EStoreManagerBase } from './base.js';
|
|
2
|
-
export declare class WhitelistManager 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
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { fetch } from 'extra-fetch';
|
|
2
|
-
import { get, put, del } from 'extra-request';
|
|
3
|
-
import { appendPathname } from 'extra-request/transformers';
|
|
4
|
-
import { ok, toJSON } from 'extra-response';
|
|
5
|
-
import { EStoreManagerBase } from './base.js';
|
|
6
|
-
export class WhitelistManager extends EStoreManagerBase {
|
|
7
|
-
async getNamespaces(options = {}) {
|
|
8
|
-
const req = get(...this.getCommonTransformers(options), appendPathname('/admin/whitelist'));
|
|
9
|
-
return await fetch(req)
|
|
10
|
-
.then(ok)
|
|
11
|
-
.then(toJSON);
|
|
12
|
-
}
|
|
13
|
-
async add(namespace, options = {}) {
|
|
14
|
-
const req = put(...this.getCommonTransformers(options), appendPathname(`/admin/whitelist/${namespace}`));
|
|
15
|
-
await fetch(req).then(ok);
|
|
16
|
-
}
|
|
17
|
-
async remove(namespace, options = {}) {
|
|
18
|
-
const req = del(...this.getCommonTransformers(options), appendPathname(`/admin/whitelist/${namespace}`));
|
|
19
|
-
await fetch(req).then(ok);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=whitelist-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whitelist-manager.js","sourceRoot":"","sources":["../../src/manager/whitelist-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAgC,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE3E,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAIrD,KAAK,CAAC,aAAa,CAAC,UAAwC,EAAE;QAC5D,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,kBAAkB,CAAC,CACnC,CAAA;QAED,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,EAAE,CAAC;aACR,IAAI,CAAC,MAAM,CAAa,CAAA;IAC7B,CAAC;IAKD,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACrE,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAChD,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;IAKD,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,UAAwC,EAAE;QACxE,MAAM,GAAG,GAAG,GAAG,CACb,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EACtC,cAAc,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAChD,CAAA;QAED,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF"}
|
package/lib/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const expectedVersion = "^0.2.0";
|
package/lib/utils.js
DELETED
package/lib/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA"}
|