@ocap/indexdb-memory 1.30.8 → 1.30.10
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/esm/db/base.mjs +0 -17
- package/lib/db/base.cjs +0 -17
- package/lib/db/index.d.cts +2 -2
- package/lib/table/base.d.cts +4 -4
- package/package.json +5 -5
package/esm/db/base.mjs
CHANGED
|
@@ -125,15 +125,6 @@ var LocalBaseIndexDB = class extends BaseIndexDB {
|
|
|
125
125
|
}
|
|
126
126
|
async listAssets(params = {}) {
|
|
127
127
|
const { ownerAddress, factoryAddress, paging, timeFilter = {} } = params;
|
|
128
|
-
if (!ownerAddress && !factoryAddress) return {
|
|
129
|
-
assets: [],
|
|
130
|
-
account: null,
|
|
131
|
-
paging: {
|
|
132
|
-
cursor: "0",
|
|
133
|
-
next: false,
|
|
134
|
-
total: 0
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
128
|
const pagination = formatPagination({
|
|
138
129
|
paging,
|
|
139
130
|
defaultSortField: "renaissanceTime"
|
|
@@ -418,14 +409,6 @@ var LocalBaseIndexDB = class extends BaseIndexDB {
|
|
|
418
409
|
}
|
|
419
410
|
listDelegations(params = {}) {
|
|
420
411
|
const { from, to, paging = {}, timeFilter = {} } = params;
|
|
421
|
-
if (!from && !to) return {
|
|
422
|
-
delegations: [],
|
|
423
|
-
paging: {
|
|
424
|
-
cursor: "0",
|
|
425
|
-
next: false,
|
|
426
|
-
total: 0
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
412
|
const query = getCollection(this.delegation).chain();
|
|
430
413
|
const pagination = formatPagination({
|
|
431
414
|
paging,
|
package/lib/db/base.cjs
CHANGED
|
@@ -129,15 +129,6 @@ var LocalBaseIndexDB = class extends _ocap_indexdb.BaseIndexDB {
|
|
|
129
129
|
}
|
|
130
130
|
async listAssets(params = {}) {
|
|
131
131
|
const { ownerAddress, factoryAddress, paging, timeFilter = {} } = params;
|
|
132
|
-
if (!ownerAddress && !factoryAddress) return {
|
|
133
|
-
assets: [],
|
|
134
|
-
account: null,
|
|
135
|
-
paging: {
|
|
136
|
-
cursor: "0",
|
|
137
|
-
next: false,
|
|
138
|
-
total: 0
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
132
|
const pagination = (0, _ocap_indexdb.formatPagination)({
|
|
142
133
|
paging,
|
|
143
134
|
defaultSortField: "renaissanceTime"
|
|
@@ -422,14 +413,6 @@ var LocalBaseIndexDB = class extends _ocap_indexdb.BaseIndexDB {
|
|
|
422
413
|
}
|
|
423
414
|
listDelegations(params = {}) {
|
|
424
415
|
const { from, to, paging = {}, timeFilter = {} } = params;
|
|
425
|
-
if (!from && !to) return {
|
|
426
|
-
delegations: [],
|
|
427
|
-
paging: {
|
|
428
|
-
cursor: "0",
|
|
429
|
-
next: false,
|
|
430
|
-
total: 0
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
416
|
const query = getCollection(this.delegation).chain();
|
|
434
417
|
const pagination = (0, _ocap_indexdb.formatPagination)({
|
|
435
418
|
paging,
|
package/lib/db/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import LocalBaseIndexDB from "./base.cjs";
|
|
2
2
|
import { IIndexDB, IIndexTable, IndexTableTypeMap } from "@ocap/types";
|
|
3
3
|
import { md5 } from "@ocap/util/lib/md5";
|
|
4
|
-
import
|
|
4
|
+
import Loki from "lokijs";
|
|
5
5
|
|
|
6
6
|
//#region src/db/index.d.ts
|
|
7
7
|
declare class MemoryIndexDB extends LocalBaseIndexDB implements IIndexDB {
|
|
8
8
|
name: string;
|
|
9
9
|
version: string;
|
|
10
10
|
md5: typeof md5;
|
|
11
|
-
db:
|
|
11
|
+
db: Loki;
|
|
12
12
|
tx: IIndexTable<IndexTableTypeMap['tx']>;
|
|
13
13
|
account: IIndexTable<IndexTableTypeMap['account']>;
|
|
14
14
|
asset: IIndexTable<IndexTableTypeMap['asset']>;
|
package/lib/table/base.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { BaseIndex } from "@ocap/indexdb";
|
|
2
2
|
import { IIndexTable } from "@ocap/types";
|
|
3
|
-
import
|
|
3
|
+
import Loki from "lokijs";
|
|
4
4
|
|
|
5
5
|
//#region src/table/base.d.ts
|
|
6
6
|
type UniqueIndex = string | string[];
|
|
7
7
|
declare class MemoryIndex<T = unknown> extends BaseIndex<T> implements IIndexTable<T> {
|
|
8
|
-
collection:
|
|
8
|
+
collection: Loki.Collection<T & Record<string, unknown>>;
|
|
9
9
|
/**
|
|
10
10
|
* @param name table name
|
|
11
11
|
* @param uniqIndex primary key(s)
|
|
12
12
|
* @param db LokiJS database instance
|
|
13
13
|
*/
|
|
14
|
-
constructor(name: string, uniqIndex: UniqueIndex, db:
|
|
15
|
-
count(...args: Parameters<
|
|
14
|
+
constructor(name: string, uniqIndex: UniqueIndex, db: Loki);
|
|
15
|
+
count(...args: Parameters<Loki.Collection['count']>): number;
|
|
16
16
|
_insert(row: Record<string, unknown>): T & Record<string, unknown>;
|
|
17
17
|
_get(key: string | Record<string, unknown>): (T & Record<string, unknown>) | null;
|
|
18
18
|
_update(key: string | Record<string, unknown>, updates: Record<string, unknown>): T & Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/indexdb-memory",
|
|
3
3
|
"description": "OCAP indexdb adapter that uses memory as backend, just for test purpose",
|
|
4
|
-
"version": "1.30.
|
|
4
|
+
"version": "1.30.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
|
7
7
|
"bugs": {
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
},
|
|
79
79
|
"gitHead": "87990c8b5e215107fc587c1ced0d6b3e2cd2483e",
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@arcblock/did": "1.30.
|
|
82
|
-
"@ocap/indexdb": "1.30.
|
|
83
|
-
"@ocap/types": "1.30.
|
|
84
|
-
"@ocap/util": "1.30.
|
|
81
|
+
"@arcblock/did": "1.30.10",
|
|
82
|
+
"@ocap/indexdb": "1.30.10",
|
|
83
|
+
"@ocap/types": "1.30.10",
|
|
84
|
+
"@ocap/util": "1.30.10",
|
|
85
85
|
"debug": "^4.4.3",
|
|
86
86
|
"lodash": "^4.17.23",
|
|
87
87
|
"lokijs": "^1.5.12"
|