feat: 🎸 Add indexedDb parser (#2068)

* feat: 🎸 Add indexedDb parser

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12164

---------

Co-authored-by: Lisbet Alvarez <lisbet.alvarez@hashicorp.com>
This commit is contained in:
Zhihe LiandLisbet Alvarez committed 2024-04-12 14:55:33 -04:00
1 parent bd5e3da1f4
commit d72fa0d6e3
24 files changed
+890 -178

No files matched your search

+7 -8
View File
@@ -1,4 +1,4 @@
import Service, { inject as service } from '@ember/service';
import Service from '@ember/service';
import Dexie from 'dexie';
import { typeOf } from '@ember/utils';
@@ -7,9 +7,11 @@ import { typeOf } from '@ember/utils';
// this index. Increment the version number of the database whenever
// indexes change.
export const modelIndexes = {
tokens: '&id, token',
targets: '&id, attributes.type, attributes.name, attributes.scope.scope_id',
sessions: '&id, attributes.type, attributes.scope.scope_id',
token: '&id, token',
target:
'&id, attributes.created_time, attributes.type, attributes.name, attributes.description, attributes.address, attributes.scope.scope_id',
session:
'&id, attributes.created_time, attributes.type, attributes.status, attributes.endpoint, attributes.target_id, attributes.user_id, attributes.scope.scope_id',
};
export const formatDbName = (userId, clusterUrl) =>
@@ -46,7 +48,7 @@ const unconvertBooleansInObject = (result, object) => {
if (typeOf(value) === 'object') {
result[key] = unconvertBooleansInObject({}, value);
} else if (value === 'true' || value === 'false') {
result[key] = value === 'true' ? true : false;
result[key] = value === 'true';
} else {
result[key] = value;
}
@@ -60,9 +62,6 @@ const unconvertBooleansInObject = (result, object) => {
* `setup` from the application root and
*/
export default class IndexedDbService extends Service {
// =services
@service session;
// =attributes
#db;
get db() {