@genesislcap/foundation-comms 14.225.1-alpha-2aa9bd9.0 → 14.225.1-alpha-5631b85.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,g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AAO,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;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);
@@ -2028,8 +2028,7 @@ export declare class DefaultKVStorage implements KVStorage {
2028
2028
  * ...
2029
2029
  * ```
2030
2030
  */
2031
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
2032
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
2031
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
2033
2032
  /**
2034
2033
  * Lists all keys for the user.
2035
2034
  * @alpha
@@ -3130,8 +3129,7 @@ export declare enum KVMessageType {
3130
3129
  */
3131
3130
  export declare interface KVStorage {
3132
3131
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
3133
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
3134
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
3132
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
3135
3133
  list(): Promise<string[]>;
3136
3134
  put(kvs: KeyValue<KVValue>[]): Promise<true | KVEventFailureResponse>;
3137
3135
  }
@@ -1323,9 +1323,7 @@ export class DefaultHttpConnect implements Connect {
1323
1323
  export class DefaultKVStorage implements KVStorage {
1324
1324
  constructor(connect: Connect, user: User_2, kvStorageConfig?: KVStorageConfig);
1325
1325
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
1326
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
1327
- // (undocumented)
1328
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
1326
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
1329
1327
  list(): Promise<string[]>;
1330
1328
  put(kvs: KeyValue<KVValue>[]): Promise<true | KVEventFailureResponse>;
1331
1329
  // (undocumented)
@@ -1920,9 +1918,7 @@ export interface KVStorage {
1920
1918
  // (undocumented)
1921
1919
  delete(keys: string[]): Promise<true | KVEventFailureResponse>;
1922
1920
  // (undocumented)
1923
- get<T = KVValue>(): Promise<KeyValueTransfer<T>[]>;
1924
- // (undocumented)
1925
- get<T = KVValue>(key: string): Promise<KeyValueTransfer<T>>;
1921
+ get<T = KVValue>(key?: string): Promise<KeyValueTransfer<T>[]>;
1926
1922
  // (undocumented)
1927
1923
  list(): Promise<string[]>;
1928
1924
  // (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.225.1-alpha-2aa9bd9.0",
4
+ "version": "14.225.1-alpha-5631b85.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.225.1-alpha-2aa9bd9.0",
79
- "@genesislcap/genx": "14.225.1-alpha-2aa9bd9.0",
80
- "@genesislcap/rollup-builder": "14.225.1-alpha-2aa9bd9.0",
81
- "@genesislcap/ts-builder": "14.225.1-alpha-2aa9bd9.0",
82
- "@genesislcap/uvu-playwright-builder": "14.225.1-alpha-2aa9bd9.0",
83
- "@genesislcap/vite-builder": "14.225.1-alpha-2aa9bd9.0",
84
- "@genesislcap/webpack-builder": "14.225.1-alpha-2aa9bd9.0",
78
+ "@genesislcap/foundation-testing": "14.225.1-alpha-5631b85.0",
79
+ "@genesislcap/genx": "14.225.1-alpha-5631b85.0",
80
+ "@genesislcap/rollup-builder": "14.225.1-alpha-5631b85.0",
81
+ "@genesislcap/ts-builder": "14.225.1-alpha-5631b85.0",
82
+ "@genesislcap/uvu-playwright-builder": "14.225.1-alpha-5631b85.0",
83
+ "@genesislcap/vite-builder": "14.225.1-alpha-5631b85.0",
84
+ "@genesislcap/webpack-builder": "14.225.1-alpha-5631b85.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.225.1-alpha-2aa9bd9.0",
92
- "@genesislcap/foundation-logger": "14.225.1-alpha-2aa9bd9.0",
93
- "@genesislcap/foundation-user": "14.225.1-alpha-2aa9bd9.0",
94
- "@genesislcap/foundation-utils": "14.225.1-alpha-2aa9bd9.0",
91
+ "@genesislcap/foundation-broadcast-channel": "14.225.1-alpha-5631b85.0",
92
+ "@genesislcap/foundation-logger": "14.225.1-alpha-5631b85.0",
93
+ "@genesislcap/foundation-user": "14.225.1-alpha-5631b85.0",
94
+ "@genesislcap/foundation-utils": "14.225.1-alpha-5631b85.0",
95
95
  "@microsoft/fast-element": "1.14.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": "02426a5ad4f33229095ff8761661873cfdce2e7f"
114
+ "gitHead": "883bf46758cf4c4d9077d5fb8b3339f904143b3d"
115
115
  }