@genesislcap/foundation-comms 14.218.3-alpha-42754ce.0 → 14.219.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,8 +17,7 @@ import { KeyValue, KeyValueTransfer, KVValue, KVEventFailureResponse } from './k
17
17
  */
18
18
  export interface KVStorage {
19
19
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
20
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
21
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
20
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
22
21
  list(): Promise<string[]>;
23
22
  put(kvs: KeyValue<KVValue>[]): Promise<true | KVEventFailureResponse>;
24
23
  }
@@ -68,8 +67,7 @@ export declare class DefaultKVStorage implements KVStorage {
68
67
  * ...
69
68
  * ```
70
69
  */
71
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
72
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
70
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
73
71
  /**
74
72
  * Lists all keys for the user.
75
73
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"kv.service.d.ts","sourceRoot":"","sources":["../../../../src/storage/kv/kv.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAMpD,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,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,sBAAsB,CAAC,CAAC;IAC/D,GAAG,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAA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B,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;AAE7F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAExC"}
@@ -1,6 +1,5 @@
1
1
  import { __awaiter, __decorate, __param } from "tslib";
2
2
  import { User } from '@genesislcap/foundation-user';
3
- import { decodeFromBase64WithPrefix, encodeToBase64WithPrefix, } from '@genesislcap/foundation-utils';
4
3
  import { DI, optional } from '@microsoft/fast-foundation';
5
4
  import { Connect } from '../../connect';
6
5
  import { logger } from '../../utils';
@@ -60,6 +59,24 @@ let DefaultKVStorage = class DefaultKVStorage {
60
59
  }
61
60
  });
62
61
  }
62
+ /**
63
+ * Gets the specified key-value pairs from the KV storage.
64
+ * @remarks If no key is specified, all key-value pairs for the current user are returned.
65
+ * @alpha
66
+ * @param kv - The single key-value pair to get.
67
+ * @returns A promise that resolves to an array of key-value pairs.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * ...
72
+ * const result = await this.kvStorage.get({ key: 'myKey' });
73
+ * logger.debug(result); // [{ key: 'myKey', value: 'myValue' }]
74
+ *
75
+ * const result2 = await this.kvStorage.get();
76
+ * logger.debug(result); // [{ key: 'myKey', value: 'myValue' }, { key: 'myOtherKey', value: 'myOtherValue' }]
77
+ * ...
78
+ * ```
79
+ */
63
80
  get(key) {
64
81
  var _a;
65
82
  return __awaiter(this, void 0, void 0, function* () {
@@ -71,13 +88,11 @@ let DefaultKVStorage = class DefaultKVStorage {
71
88
  };
72
89
  const result = yield this.connect.request(KVMessageType.REQ_KEY_VALUE_READ, params);
73
90
  if (result && result.REPLY && result.REPLY.length > 0) {
74
- const kvs = result.REPLY.map((kv) => ({
75
- kv: { key: kv.KEY, value: decodeFromBase64WithPrefix(kv.VALUE) },
76
- }));
77
- return key ? kvs[0] : kvs;
91
+ const kvs = result.REPLY.map((kv) => ({ kv: { key: kv.KEY, value: kv.VALUE } }));
92
+ return kvs;
78
93
  }
79
94
  else {
80
- return key ? undefined : [];
95
+ return [];
81
96
  }
82
97
  });
83
98
  }
@@ -128,12 +143,10 @@ let DefaultKVStorage = class DefaultKVStorage {
128
143
  return __awaiter(this, void 0, void 0, function* () {
129
144
  const params = {
130
145
  DETAILS: {
131
- RECORDS: kvs.map((kv) => {
132
- return {
133
- KEY: kv.key,
134
- VALUE: kv.base64 ? encodeToBase64WithPrefix(kv.value) : kv.value,
135
- };
136
- }),
146
+ RECORDS: kvs.map((kv) => ({
147
+ KEY: kv.key,
148
+ VALUE: kv.value,
149
+ })),
137
150
  },
138
151
  };
139
152
  const result = yield this.connect.commitEvent(KVEventMessageType.EVENT_KEY_VALUE_PUT, params);
@@ -2025,8 +2025,7 @@ export declare class DefaultKVStorage implements KVStorage {
2025
2025
  * ...
2026
2026
  * ```
2027
2027
  */
2028
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
2029
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
2028
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
2030
2029
  /**
2031
2030
  * Lists all keys for the user.
2032
2031
  * @alpha
@@ -3121,8 +3120,7 @@ export declare enum KVMessageType {
3121
3120
  */
3122
3121
  export declare interface KVStorage {
3123
3122
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
3124
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
3125
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
3123
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
3126
3124
  list(): Promise<string[]>;
3127
3125
  put(kvs: KeyValue<KVValue>[]): Promise<true | KVEventFailureResponse>;
3128
3126
  }
@@ -1318,9 +1318,7 @@ export class DefaultHttpConnect implements Connect {
1318
1318
  export class DefaultKVStorage implements KVStorage {
1319
1319
  constructor(connect: Connect, user: User_2, kvStorageConfig?: KVStorageConfig);
1320
1320
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
1321
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
1322
- // (undocumented)
1323
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
1321
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
1324
1322
  list(): Promise<string[]>;
1325
1323
  put(kvs: KeyValue<KVValue>[]): Promise<true | KVEventFailureResponse>;
1326
1324
  // (undocumented)
@@ -1910,9 +1908,7 @@ export interface KVStorage {
1910
1908
  // (undocumented)
1911
1909
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
1912
1910
  // (undocumented)
1913
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
1914
- // (undocumented)
1915
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
1911
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
1916
1912
  // (undocumented)
1917
1913
  list(): Promise<string[]>;
1918
1914
  // (undocumented)
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.218.3-alpha-42754ce.0",
4
+ "version": "14.219.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -75,23 +75,23 @@
75
75
  }
76
76
  },
77
77
  "devDependencies": {
78
- "@genesislcap/foundation-testing": "14.218.3-alpha-42754ce.0",
79
- "@genesislcap/genx": "14.218.3-alpha-42754ce.0",
80
- "@genesislcap/rollup-builder": "14.218.3-alpha-42754ce.0",
81
- "@genesislcap/ts-builder": "14.218.3-alpha-42754ce.0",
82
- "@genesislcap/uvu-playwright-builder": "14.218.3-alpha-42754ce.0",
83
- "@genesislcap/vite-builder": "14.218.3-alpha-42754ce.0",
84
- "@genesislcap/webpack-builder": "14.218.3-alpha-42754ce.0",
78
+ "@genesislcap/foundation-testing": "14.219.0",
79
+ "@genesislcap/genx": "14.219.0",
80
+ "@genesislcap/rollup-builder": "14.219.0",
81
+ "@genesislcap/ts-builder": "14.219.0",
82
+ "@genesislcap/uvu-playwright-builder": "14.219.0",
83
+ "@genesislcap/vite-builder": "14.219.0",
84
+ "@genesislcap/webpack-builder": "14.219.0",
85
85
  "@types/js-cookie": "^3.0.2",
86
86
  "@types/json-schema": "^7.0.11",
87
87
  "@types/webappsec-credential-management": "^0.6.2",
88
88
  "rimraf": "^5.0.0"
89
89
  },
90
90
  "dependencies": {
91
- "@genesislcap/foundation-broadcast-channel": "14.218.3-alpha-42754ce.0",
92
- "@genesislcap/foundation-logger": "14.218.3-alpha-42754ce.0",
93
- "@genesislcap/foundation-user": "14.218.3-alpha-42754ce.0",
94
- "@genesislcap/foundation-utils": "14.218.3-alpha-42754ce.0",
91
+ "@genesislcap/foundation-broadcast-channel": "14.219.0",
92
+ "@genesislcap/foundation-logger": "14.219.0",
93
+ "@genesislcap/foundation-user": "14.219.0",
94
+ "@genesislcap/foundation-utils": "14.219.0",
95
95
  "@microsoft/fast-element": "^1.12.0",
96
96
  "@microsoft/fast-foundation": "2.49.6",
97
97
  "analytics": "^0.8.0",
@@ -111,5 +111,5 @@
111
111
  "publishConfig": {
112
112
  "access": "public"
113
113
  },
114
- "gitHead": "39887d6184cce3f1713c5a91e7f119a9e0a8e0c8"
114
+ "gitHead": "22ff8ee1ca290cd29752b37d38153634899d51b5"
115
115
  }