@genesislcap/foundation-comms 14.151.2-alpha-6dc6e2c.0 → 14.152.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/dts/storage/kv/kv.service.d.ts +8 -1
- package/dist/dts/storage/kv/kv.service.d.ts.map +1 -1
- package/dist/esm/storage/kv/kv-config.service.js +1 -1
- package/dist/esm/storage/kv/kv.service.js +50 -42
- package/dist/foundation-comms.d.ts +7 -1
- package/docs/api-report.md +1 -1
- package/package.json +11 -11
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Auth } from '../../auth';
|
1
2
|
import { Connect } from '../../connect';
|
2
3
|
import { KVStorageConfig } from './kv-config.service';
|
3
4
|
import { KeyValue, KeyValueTransfer, KVValue, KVEventFailureResponse } from './kv.types';
|
@@ -26,8 +27,14 @@ export interface KVStorage {
|
|
26
27
|
*/
|
27
28
|
export declare class DefaultKVStorage implements KVStorage {
|
28
29
|
private connect;
|
30
|
+
private auth;
|
29
31
|
private kvStorageConfig;
|
30
|
-
constructor(connect: Connect, kvStorageConfig?: KVStorageConfig);
|
32
|
+
constructor(connect: Connect, auth: Auth, kvStorageConfig?: KVStorageConfig);
|
33
|
+
/**
|
34
|
+
* Determine whether KV Storage is available for use.
|
35
|
+
* @internal
|
36
|
+
*/
|
37
|
+
private checkAvailability;
|
31
38
|
/**
|
32
39
|
* Deletes the specified key-value pairs from the KV storage.
|
33
40
|
* @alpha
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"kv.service.d.ts","sourceRoot":"","sources":["../../../../src/storage/kv/kv.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,OAAO,EAA0B,MAAM,eAAe,CAAC;AAE9E,OAAO,EAA0B,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,OAAO,EACP,sBAAsB,EAGvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,IAAI,EAAE,M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Aa,gBAAiB,YAAW,SAAS;IAErC,OAAO,CAAC,OAAO;IAClB,OAAO,CAAC,IAAI;IACS,OAAO,CAAC,eAAe;gBAFjC,OAAO,EAAE,OAAO,EACnB,IAAI,EAAE,IAAI,EACW,eAAe,kBAAyB;IAK7E;;;OAGG;YACW,iBAAiB;IAa/B;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,sBAAsB,CAAC;IAmBpE;;;;;;;;;;;;;;;;;OAiBG;IACG,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAoBpE;;;;;;;;;;;OAWG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAiB/B;;;;;;;;;;;;OAYG;IACG,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,sBAAsB,CAAC;CAkB5E;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,iEAAsE,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __awaiter, __decorate, __param } from "tslib";
|
2
2
|
import { DI, optional } from '@microsoft/fast-foundation';
|
3
|
+
import { Auth } from '../../auth';
|
3
4
|
import { Connect } from '../../connect';
|
4
5
|
import { logger } from '../../utils';
|
5
6
|
import { defaultKVStorageConfig, KVStorageConfig } from './kv-config.service';
|
@@ -9,9 +10,25 @@ import { KVEventMessageType, KVMessageType, } from './kv.types';
|
|
9
10
|
* @alpha
|
10
11
|
*/
|
11
12
|
let DefaultKVStorage = class DefaultKVStorage {
|
12
|
-
constructor(connect, kvStorageConfig = defaultKVStorageConfig) {
|
13
|
+
constructor(connect, auth, kvStorageConfig = defaultKVStorageConfig) {
|
13
14
|
this.connect = connect;
|
15
|
+
this.auth = auth;
|
14
16
|
this.kvStorageConfig = kvStorageConfig;
|
17
|
+
this.checkAvailability();
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* Determine whether KV Storage is available for use.
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
checkAvailability() {
|
24
|
+
var _a;
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
26
|
+
const allSystemTables = yield this.connect.request('SYSTEM_TABLES');
|
27
|
+
const isKVStoreAvailable = !!((_a = allSystemTables === null || allSystemTables === void 0 ? void 0 : allSystemTables.REPLY) === null || _a === void 0 ? void 0 : _a.find((table) => table.TABLE_NAME === 'KEY_VALUE'));
|
28
|
+
if (!isKVStoreAvailable) {
|
29
|
+
logger.error('KV Storage is not available on the server resources. Update your server to use it.');
|
30
|
+
}
|
31
|
+
});
|
15
32
|
}
|
16
33
|
/**
|
17
34
|
* Deletes the specified key-value pairs from the KV storage.
|
@@ -34,15 +51,12 @@ let DefaultKVStorage = class DefaultKVStorage {
|
|
34
51
|
},
|
35
52
|
};
|
36
53
|
const result = yield this.connect.commitEvent(KVEventMessageType.EVENT_KEY_VALUE_DELETE, params);
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
resolve({ ERROR: result.ERROR, WARNING: result.WARNING });
|
44
|
-
}
|
45
|
-
});
|
54
|
+
if (result && result.MESSAGE_TYPE === 'EVENT_ACK') {
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
return { ERROR: result.ERROR, WARNING: result.WARNING };
|
59
|
+
}
|
46
60
|
});
|
47
61
|
}
|
48
62
|
/**
|
@@ -64,24 +78,22 @@ let DefaultKVStorage = class DefaultKVStorage {
|
|
64
78
|
* ```
|
65
79
|
*/
|
66
80
|
get(key) {
|
81
|
+
var _a, _b, _c;
|
67
82
|
return __awaiter(this, void 0, void 0, function* () {
|
68
83
|
const params = {
|
69
84
|
REQUEST: {
|
70
|
-
USER_NAME: this.kvStorageConfig.authEmail,
|
85
|
+
USER_NAME: (_a = this.kvStorageConfig.authEmail) !== null && _a !== void 0 ? _a : (_c = (_b = this.auth) === null || _b === void 0 ? void 0 : _b.currentUser) === null || _c === void 0 ? void 0 : _c.username,
|
71
86
|
KEY: key,
|
72
87
|
},
|
73
88
|
};
|
74
89
|
const result = yield this.connect.request(KVMessageType.REQ_KEY_VALUE_READ, params);
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
resolve([]);
|
83
|
-
}
|
84
|
-
});
|
90
|
+
if (result && result.REPLY && result.REPLY.length > 0) {
|
91
|
+
const kvs = result.REPLY.map((kv) => ({ kv: { key: kv.KEY, value: kv.VALUE } }));
|
92
|
+
return kvs;
|
93
|
+
}
|
94
|
+
else {
|
95
|
+
return [];
|
96
|
+
}
|
85
97
|
});
|
86
98
|
}
|
87
99
|
/**
|
@@ -97,23 +109,21 @@ let DefaultKVStorage = class DefaultKVStorage {
|
|
97
109
|
* ```
|
98
110
|
*/
|
99
111
|
list() {
|
112
|
+
var _a, _b, _c;
|
100
113
|
return __awaiter(this, void 0, void 0, function* () {
|
101
114
|
const params = {
|
102
115
|
REQUEST: {
|
103
|
-
USER_NAME: this.kvStorageConfig.authEmail,
|
116
|
+
USER_NAME: (_a = this.kvStorageConfig.authEmail) !== null && _a !== void 0 ? _a : (_c = (_b = this.auth) === null || _b === void 0 ? void 0 : _b.currentUser) === null || _c === void 0 ? void 0 : _c.username,
|
104
117
|
},
|
105
118
|
};
|
106
119
|
const result = yield this.connect.request(KVMessageType.REQ_KEY_VALUE_LIST, params);
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
resolve([]);
|
115
|
-
}
|
116
|
-
});
|
120
|
+
if (result && result.REPLY && result.REPLY.length > 0) {
|
121
|
+
const keys = result.REPLY.map((kv) => kv.KEY);
|
122
|
+
return keys;
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
return [];
|
126
|
+
}
|
117
127
|
});
|
118
128
|
}
|
119
129
|
/**
|
@@ -140,21 +150,19 @@ let DefaultKVStorage = class DefaultKVStorage {
|
|
140
150
|
},
|
141
151
|
};
|
142
152
|
const result = yield this.connect.commitEvent(KVEventMessageType.EVENT_KEY_VALUE_PUT, params);
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
}
|
148
|
-
|
149
|
-
resolve({ ERROR: result.ERROR, WARNING: result.WARNING });
|
150
|
-
}
|
151
|
-
});
|
153
|
+
if (result && result.MESSAGE_TYPE === 'EVENT_ACK') {
|
154
|
+
return true;
|
155
|
+
}
|
156
|
+
else {
|
157
|
+
return { ERROR: result.ERROR, WARNING: result.WARNING };
|
158
|
+
}
|
152
159
|
});
|
153
160
|
}
|
154
161
|
};
|
155
162
|
DefaultKVStorage = __decorate([
|
156
163
|
__param(0, Connect),
|
157
|
-
__param(1,
|
164
|
+
__param(1, Auth),
|
165
|
+
__param(2, optional(KVStorageConfig))
|
158
166
|
], DefaultKVStorage);
|
159
167
|
export { DefaultKVStorage };
|
160
168
|
/**
|
@@ -1245,8 +1245,14 @@ export declare const defaultHttpConnectConfig: HttpConnectConfig;
|
|
1245
1245
|
*/
|
1246
1246
|
export declare class DefaultKVStorage implements KVStorage {
|
1247
1247
|
private connect;
|
1248
|
+
private auth;
|
1248
1249
|
private kvStorageConfig;
|
1249
|
-
constructor(connect: Connect, kvStorageConfig?: KVStorageConfig);
|
1250
|
+
constructor(connect: Connect, auth: Auth, kvStorageConfig?: KVStorageConfig);
|
1251
|
+
/**
|
1252
|
+
* Determine whether KV Storage is available for use.
|
1253
|
+
* @internal
|
1254
|
+
*/
|
1255
|
+
private checkAvailability;
|
1250
1256
|
/**
|
1251
1257
|
* Deletes the specified key-value pairs from the KV storage.
|
1252
1258
|
* @alpha
|
package/docs/api-report.md
CHANGED
@@ -751,7 +751,7 @@ export const defaultHttpConnectConfig: HttpConnectConfig;
|
|
751
751
|
|
752
752
|
// @alpha
|
753
753
|
export class DefaultKVStorage implements KVStorage {
|
754
|
-
constructor(connect: Connect, kvStorageConfig?: KVStorageConfig);
|
754
|
+
constructor(connect: Connect, auth: Auth, kvStorageConfig?: KVStorageConfig);
|
755
755
|
delete(keys: string[]): Promise<true | KVEventFailureResponse>;
|
756
756
|
get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
|
757
757
|
list(): Promise<string[]>;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@genesislcap/foundation-comms",
|
3
3
|
"description": "Genesis Foundation UI Comms",
|
4
|
-
"version": "14.
|
4
|
+
"version": "14.152.0",
|
5
5
|
"sideEffects": false,
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
7
7
|
"main": "dist/esm/index.js",
|
@@ -59,13 +59,13 @@
|
|
59
59
|
"test:debug": "genx test --debug"
|
60
60
|
},
|
61
61
|
"devDependencies": {
|
62
|
-
"@genesislcap/foundation-testing": "14.
|
63
|
-
"@genesislcap/genx": "14.
|
64
|
-
"@genesislcap/rollup-builder": "14.
|
65
|
-
"@genesislcap/ts-builder": "14.
|
66
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
67
|
-
"@genesislcap/vite-builder": "14.
|
68
|
-
"@genesislcap/webpack-builder": "14.
|
62
|
+
"@genesislcap/foundation-testing": "14.152.0",
|
63
|
+
"@genesislcap/genx": "14.152.0",
|
64
|
+
"@genesislcap/rollup-builder": "14.152.0",
|
65
|
+
"@genesislcap/ts-builder": "14.152.0",
|
66
|
+
"@genesislcap/uvu-playwright-builder": "14.152.0",
|
67
|
+
"@genesislcap/vite-builder": "14.152.0",
|
68
|
+
"@genesislcap/webpack-builder": "14.152.0",
|
69
69
|
"@types/js-cookie": "^3.0.2",
|
70
70
|
"@types/json-schema": "^7.0.11",
|
71
71
|
"@types/webappsec-credential-management": "^0.6.2",
|
@@ -73,8 +73,8 @@
|
|
73
73
|
},
|
74
74
|
"dependencies": {
|
75
75
|
"@finos/fdc3": "^1.2.0",
|
76
|
-
"@genesislcap/foundation-logger": "14.
|
77
|
-
"@genesislcap/foundation-utils": "14.
|
76
|
+
"@genesislcap/foundation-logger": "14.152.0",
|
77
|
+
"@genesislcap/foundation-utils": "14.152.0",
|
78
78
|
"@microsoft/fast-element": "^1.12.0",
|
79
79
|
"@microsoft/fast-foundation": "^2.49.4",
|
80
80
|
"analytics": "^0.8.0",
|
@@ -91,5 +91,5 @@
|
|
91
91
|
"publishConfig": {
|
92
92
|
"access": "public"
|
93
93
|
},
|
94
|
-
"gitHead": "
|
94
|
+
"gitHead": "f3d0250895a2e94b877e74ed2e2767831ee7b1de"
|
95
95
|
}
|