@ocap/indexdb-sqlite 1.29.13 → 1.29.15

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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Database } from "../interfaces.mjs";
2
2
  import { Kysely } from "kysely";
3
3
  import { BaseIndexDB } from "@ocap/indexdb";
4
- import { IIndexDB, IIndexTable, IListAccountsResult, IListAssetsResult, IListDelegationsResult, IListFactoriesResult, IListRollupBlocksResult, IListRollupValidatorsResult, IListRollupsResult, IListStakesResult, IListTokenFactoriesResult, IListTokensResult, IListTransactionsResult, IndexTableTypeMap, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions } from "@ocap/types";
4
+ import { IIndexDB, IIndexTable, IListAccountsResult, IListAssetsResult, IListDelegationsResult, IListFactoriesResult, IListRollupBlocksResult, IListRollupValidatorsResult, IListRollupsResult, IListStakesResult, IListTokenFactoriesResult, IListTokensResult, IListTransactionsResult, IndexTableTypeMap, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions, TSearchResult } from "@ocap/types";
5
5
 
6
6
  //#region src/db/base.d.ts
7
7
 
@@ -73,6 +73,10 @@ declare class SqliteBaseIndexDB extends BaseIndexDB implements IIndexDB {
73
73
  * List delegations
74
74
  */
75
75
  listDelegations(params?: Partial<TRequestListDelegations>): Promise<IListDelegationsResult>;
76
+ /**
77
+ * Search entities by semantic fields (moniker, name, symbol, description)
78
+ */
79
+ search(keyword: string): Promise<TSearchResult[]>;
76
80
  }
77
81
  //#endregion
78
82
  export { SqliteBaseIndexDB as default };
package/esm/db/base.mjs CHANGED
@@ -8,6 +8,18 @@ import omit from "lodash/omit.js";
8
8
  //#region src/db/base.ts
9
9
  const debug = debugFactory("@ocap/indexdb-sqlite");
10
10
  const MAX_REQUEST_FACTORY_ADDRESS_SIZE = 100;
11
+ const SEARCH_LIMIT_PER_TABLE = 5;
12
+ /** Escape SQL LIKE special characters */
13
+ function escapeLikePattern(s) {
14
+ return s.replace(/[%_\\]/g, (c) => `\\${c}`);
15
+ }
16
+ /** Score a match: 3=exact, 2=prefix, 1=contains */
17
+ function scoreMatch(fieldValue, keyword) {
18
+ const lower = fieldValue.toLowerCase();
19
+ if (lower === keyword) return 3;
20
+ if (lower.startsWith(keyword)) return 2;
21
+ return 1;
22
+ }
11
23
  function buildPagingResult(total, pagination, itemCount) {
12
24
  return {
13
25
  cursor: String(pagination.cursor + itemCount),
@@ -740,6 +752,115 @@ var SqliteBaseIndexDB = class extends BaseIndexDB {
740
752
  paging: buildPagingResult(total, pagination, delegations.length)
741
753
  };
742
754
  }
755
+ /**
756
+ * Search entities by semantic fields (moniker, name, symbol, description)
757
+ */
758
+ async search(keyword) {
759
+ const trimmed = keyword?.trim();
760
+ if (!trimmed) return [];
761
+ const escaped = escapeLikePattern(trimmed);
762
+ const lowerKw = trimmed.toLowerCase();
763
+ const containsPattern = `%${escaped}%`;
764
+ const typePriority = {
765
+ token: 0,
766
+ account: 1,
767
+ factory: 2,
768
+ asset: 3,
769
+ tokenFactory: 4
770
+ };
771
+ const [tokenRows, accountRows, factoryRows, assetRows, tokenFactoryRows] = await Promise.all([
772
+ sql`
773
+ SELECT address, name, symbol FROM token
774
+ WHERE LOWER(name) LIKE LOWER(${containsPattern}) ESCAPE '\\' OR LOWER(symbol) LIKE LOWER(${containsPattern}) ESCAPE '\\'
775
+ LIMIT ${sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
776
+ `.execute(this.db),
777
+ sql`
778
+ SELECT address, moniker FROM account
779
+ WHERE LOWER(moniker) LIKE LOWER(${containsPattern}) ESCAPE '\\'
780
+ LIMIT ${sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
781
+ `.execute(this.db),
782
+ sql`
783
+ SELECT address, name, description FROM factory
784
+ WHERE LOWER(name) LIKE LOWER(${containsPattern}) ESCAPE '\\' OR LOWER(description) LIKE LOWER(${containsPattern}) ESCAPE '\\'
785
+ LIMIT ${sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
786
+ `.execute(this.db),
787
+ sql`
788
+ SELECT address, moniker FROM asset
789
+ WHERE LOWER(moniker) LIKE LOWER(${containsPattern}) ESCAPE '\\'
790
+ LIMIT ${sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
791
+ `.execute(this.db),
792
+ sql`
793
+ SELECT address, name, moniker FROM tokenFactory
794
+ WHERE LOWER(name) LIKE LOWER(${containsPattern}) ESCAPE '\\' OR LOWER(moniker) LIKE LOWER(${containsPattern}) ESCAPE '\\'
795
+ LIMIT ${sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
796
+ `.execute(this.db)
797
+ ]);
798
+ const results = [];
799
+ for (const row of tokenRows.rows) {
800
+ const nameScore = row.name ? scoreMatch(row.name, lowerKw) : 0;
801
+ const symbolScore = row.symbol ? scoreMatch(row.symbol, lowerKw) : 0;
802
+ const score = Math.max(nameScore, symbolScore);
803
+ const title = nameScore >= symbolScore ? row.name || row.symbol || "" : row.symbol || row.name || "";
804
+ results.push({
805
+ type: "token",
806
+ id: row.address,
807
+ title,
808
+ score,
809
+ priority: typePriority.token
810
+ });
811
+ }
812
+ for (const row of accountRows.rows) {
813
+ const score = scoreMatch(row.moniker, lowerKw);
814
+ results.push({
815
+ type: "account",
816
+ id: row.address,
817
+ title: row.moniker || "",
818
+ score,
819
+ priority: typePriority.account
820
+ });
821
+ }
822
+ for (const row of factoryRows.rows) {
823
+ const nameScore = row.name ? scoreMatch(row.name, lowerKw) : 0;
824
+ const descScore = row.description ? scoreMatch(row.description, lowerKw) : 0;
825
+ const score = Math.max(nameScore, descScore);
826
+ results.push({
827
+ type: "factory",
828
+ id: row.address,
829
+ title: row.name || "",
830
+ score,
831
+ priority: typePriority.factory
832
+ });
833
+ }
834
+ for (const row of assetRows.rows) {
835
+ const score = scoreMatch(row.moniker, lowerKw);
836
+ results.push({
837
+ type: "asset",
838
+ id: row.address,
839
+ title: row.moniker || "",
840
+ score,
841
+ priority: typePriority.asset
842
+ });
843
+ }
844
+ for (const row of tokenFactoryRows.rows) {
845
+ const nameScore = row.name ? scoreMatch(row.name, lowerKw) : 0;
846
+ const monikerScore = row.moniker ? scoreMatch(row.moniker, lowerKw) : 0;
847
+ const score = Math.max(nameScore, monikerScore);
848
+ const title = nameScore >= monikerScore ? row.name || row.moniker || "" : row.moniker || row.name || "";
849
+ results.push({
850
+ type: "tokenFactory",
851
+ id: row.address,
852
+ title,
853
+ score,
854
+ priority: typePriority.tokenFactory
855
+ });
856
+ }
857
+ results.sort((a, b) => b.score - a.score || a.priority - b.priority);
858
+ return results.map(({ type, id, title }) => ({
859
+ type,
860
+ id,
861
+ title
862
+ }));
863
+ }
743
864
  };
744
865
  var base_default = SqliteBaseIndexDB;
745
866
 
package/esm/db/index.mjs CHANGED
@@ -314,6 +314,7 @@ var SqliteIndexDB = class extends base_default$1 {
314
314
  schema: {
315
315
  jsonFields: [
316
316
  "ops",
317
+ "deny",
317
318
  "context",
318
319
  "data"
319
320
  ],
@@ -326,6 +327,8 @@ var SqliteIndexDB = class extends base_default$1 {
326
327
  "from",
327
328
  "to",
328
329
  "ops",
330
+ "deny",
331
+ "validUntil",
329
332
  "context",
330
333
  "data",
331
334
  "genesisTime",
@@ -198,6 +198,8 @@ interface DelegationTable {
198
198
  from_: string | null;
199
199
  to_: string | null;
200
200
  ops: string | null;
201
+ deny: string | null;
202
+ validUntil: number | null;
201
203
  context: string | null;
202
204
  data: string | null;
203
205
  genesisTime: string | null;
@@ -0,0 +1,7 @@
1
+ import { Kysely } from "kysely";
2
+
3
+ //#region src/migrations/003-delegation-extensions.d.ts
4
+ declare function up(db: Kysely<unknown>): Promise<void>;
5
+ declare function down(_db: Kysely<unknown>): Promise<void>;
6
+ //#endregion
7
+ export { down, up };
@@ -0,0 +1,16 @@
1
+ import { __exportAll } from "../_virtual/rolldown_runtime.mjs";
2
+ import { sql } from "kysely";
3
+
4
+ //#region src/migrations/003-delegation-extensions.ts
5
+ var _003_delegation_extensions_exports = /* @__PURE__ */ __exportAll({
6
+ down: () => down,
7
+ up: () => up
8
+ });
9
+ async function up(db) {
10
+ await sql`ALTER TABLE delegation ADD COLUMN deny TEXT`.execute(db);
11
+ await sql`ALTER TABLE delegation ADD COLUMN validUntil INTEGER DEFAULT 0`.execute(db);
12
+ }
13
+ async function down(_db) {}
14
+
15
+ //#endregion
16
+ export { _003_delegation_extensions_exports, down, up };
@@ -0,0 +1,7 @@
1
+ import { Kysely } from "kysely";
2
+
3
+ //#region src/migrations/004-search-indexes.d.ts
4
+ declare function up(db: Kysely<unknown>): Promise<void>;
5
+ declare function down(db: Kysely<unknown>): Promise<void>;
6
+ //#endregion
7
+ export { down, up };
@@ -0,0 +1,21 @@
1
+ import { __exportAll } from "../_virtual/rolldown_runtime.mjs";
2
+ import { sql } from "kysely";
3
+
4
+ //#region src/migrations/004-search-indexes.ts
5
+ var _004_search_indexes_exports = /* @__PURE__ */ __exportAll({
6
+ down: () => down,
7
+ up: () => up
8
+ });
9
+ async function up(db) {
10
+ await sql`CREATE INDEX IF NOT EXISTS idx_asset_moniker ON asset(moniker) WHERE moniker IS NOT NULL`.execute(db);
11
+ await sql`CREATE INDEX IF NOT EXISTS idx_token_name ON token(name) WHERE name IS NOT NULL`.execute(db);
12
+ await sql`CREATE INDEX IF NOT EXISTS idx_tokenfactory_name ON tokenFactory(name) WHERE name IS NOT NULL`.execute(db);
13
+ }
14
+ async function down(db) {
15
+ await sql`DROP INDEX IF EXISTS idx_asset_moniker`.execute(db);
16
+ await sql`DROP INDEX IF EXISTS idx_token_name`.execute(db);
17
+ await sql`DROP INDEX IF EXISTS idx_tokenfactory_name`.execute(db);
18
+ }
19
+
20
+ //#endregion
21
+ export { _004_search_indexes_exports, down, up };
@@ -1,5 +1,7 @@
1
1
  import { _001_genesis_exports } from "./001-genesis.mjs";
2
2
  import { _002_composite_indexes_exports } from "./002-composite-indexes.mjs";
3
+ import { _003_delegation_extensions_exports } from "./003-delegation-extensions.mjs";
4
+ import { _004_search_indexes_exports } from "./004-search-indexes.mjs";
3
5
  import { Migrator } from "kysely";
4
6
 
5
7
  //#region src/migrations/index.ts
@@ -11,7 +13,9 @@ var InMemoryMigrationProvider = class {
11
13
  async getMigrations() {
12
14
  return {
13
15
  "001-genesis": _001_genesis_exports,
14
- "002-composite-indexes": _002_composite_indexes_exports
16
+ "002-composite-indexes": _002_composite_indexes_exports,
17
+ "003-delegation-extensions": _003_delegation_extensions_exports,
18
+ "004-search-indexes": _004_search_indexes_exports
15
19
  };
16
20
  }
17
21
  };
package/lib/db/base.cjs CHANGED
@@ -12,6 +12,18 @@ lodash_omit = require_rolldown_runtime.__toESM(lodash_omit);
12
12
  //#region src/db/base.ts
13
13
  const debug$1 = (0, debug.default)("@ocap/indexdb-sqlite");
14
14
  const MAX_REQUEST_FACTORY_ADDRESS_SIZE = 100;
15
+ const SEARCH_LIMIT_PER_TABLE = 5;
16
+ /** Escape SQL LIKE special characters */
17
+ function escapeLikePattern(s) {
18
+ return s.replace(/[%_\\]/g, (c) => `\\${c}`);
19
+ }
20
+ /** Score a match: 3=exact, 2=prefix, 1=contains */
21
+ function scoreMatch(fieldValue, keyword) {
22
+ const lower = fieldValue.toLowerCase();
23
+ if (lower === keyword) return 3;
24
+ if (lower.startsWith(keyword)) return 2;
25
+ return 1;
26
+ }
15
27
  function buildPagingResult(total, pagination, itemCount) {
16
28
  return {
17
29
  cursor: String(pagination.cursor + itemCount),
@@ -744,6 +756,115 @@ var SqliteBaseIndexDB = class extends _ocap_indexdb.BaseIndexDB {
744
756
  paging: buildPagingResult(total, pagination, delegations.length)
745
757
  };
746
758
  }
759
+ /**
760
+ * Search entities by semantic fields (moniker, name, symbol, description)
761
+ */
762
+ async search(keyword) {
763
+ const trimmed = keyword?.trim();
764
+ if (!trimmed) return [];
765
+ const escaped = escapeLikePattern(trimmed);
766
+ const lowerKw = trimmed.toLowerCase();
767
+ const containsPattern = `%${escaped}%`;
768
+ const typePriority = {
769
+ token: 0,
770
+ account: 1,
771
+ factory: 2,
772
+ asset: 3,
773
+ tokenFactory: 4
774
+ };
775
+ const [tokenRows, accountRows, factoryRows, assetRows, tokenFactoryRows] = await Promise.all([
776
+ kysely.sql`
777
+ SELECT address, name, symbol FROM token
778
+ WHERE LOWER(name) LIKE LOWER(${containsPattern}) ESCAPE '\\' OR LOWER(symbol) LIKE LOWER(${containsPattern}) ESCAPE '\\'
779
+ LIMIT ${kysely.sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
780
+ `.execute(this.db),
781
+ kysely.sql`
782
+ SELECT address, moniker FROM account
783
+ WHERE LOWER(moniker) LIKE LOWER(${containsPattern}) ESCAPE '\\'
784
+ LIMIT ${kysely.sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
785
+ `.execute(this.db),
786
+ kysely.sql`
787
+ SELECT address, name, description FROM factory
788
+ WHERE LOWER(name) LIKE LOWER(${containsPattern}) ESCAPE '\\' OR LOWER(description) LIKE LOWER(${containsPattern}) ESCAPE '\\'
789
+ LIMIT ${kysely.sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
790
+ `.execute(this.db),
791
+ kysely.sql`
792
+ SELECT address, moniker FROM asset
793
+ WHERE LOWER(moniker) LIKE LOWER(${containsPattern}) ESCAPE '\\'
794
+ LIMIT ${kysely.sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
795
+ `.execute(this.db),
796
+ kysely.sql`
797
+ SELECT address, name, moniker FROM tokenFactory
798
+ WHERE LOWER(name) LIKE LOWER(${containsPattern}) ESCAPE '\\' OR LOWER(moniker) LIKE LOWER(${containsPattern}) ESCAPE '\\'
799
+ LIMIT ${kysely.sql.raw(String(SEARCH_LIMIT_PER_TABLE))}
800
+ `.execute(this.db)
801
+ ]);
802
+ const results = [];
803
+ for (const row of tokenRows.rows) {
804
+ const nameScore = row.name ? scoreMatch(row.name, lowerKw) : 0;
805
+ const symbolScore = row.symbol ? scoreMatch(row.symbol, lowerKw) : 0;
806
+ const score = Math.max(nameScore, symbolScore);
807
+ const title = nameScore >= symbolScore ? row.name || row.symbol || "" : row.symbol || row.name || "";
808
+ results.push({
809
+ type: "token",
810
+ id: row.address,
811
+ title,
812
+ score,
813
+ priority: typePriority.token
814
+ });
815
+ }
816
+ for (const row of accountRows.rows) {
817
+ const score = scoreMatch(row.moniker, lowerKw);
818
+ results.push({
819
+ type: "account",
820
+ id: row.address,
821
+ title: row.moniker || "",
822
+ score,
823
+ priority: typePriority.account
824
+ });
825
+ }
826
+ for (const row of factoryRows.rows) {
827
+ const nameScore = row.name ? scoreMatch(row.name, lowerKw) : 0;
828
+ const descScore = row.description ? scoreMatch(row.description, lowerKw) : 0;
829
+ const score = Math.max(nameScore, descScore);
830
+ results.push({
831
+ type: "factory",
832
+ id: row.address,
833
+ title: row.name || "",
834
+ score,
835
+ priority: typePriority.factory
836
+ });
837
+ }
838
+ for (const row of assetRows.rows) {
839
+ const score = scoreMatch(row.moniker, lowerKw);
840
+ results.push({
841
+ type: "asset",
842
+ id: row.address,
843
+ title: row.moniker || "",
844
+ score,
845
+ priority: typePriority.asset
846
+ });
847
+ }
848
+ for (const row of tokenFactoryRows.rows) {
849
+ const nameScore = row.name ? scoreMatch(row.name, lowerKw) : 0;
850
+ const monikerScore = row.moniker ? scoreMatch(row.moniker, lowerKw) : 0;
851
+ const score = Math.max(nameScore, monikerScore);
852
+ const title = nameScore >= monikerScore ? row.name || row.moniker || "" : row.moniker || row.name || "";
853
+ results.push({
854
+ type: "tokenFactory",
855
+ id: row.address,
856
+ title,
857
+ score,
858
+ priority: typePriority.tokenFactory
859
+ });
860
+ }
861
+ results.sort((a, b) => b.score - a.score || a.priority - b.priority);
862
+ return results.map(({ type, id, title }) => ({
863
+ type,
864
+ id,
865
+ title
866
+ }));
867
+ }
747
868
  };
748
869
  var base_default = SqliteBaseIndexDB;
749
870
 
package/lib/db/base.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Database } from "../interfaces.cjs";
2
2
  import { BaseIndexDB } from "@ocap/indexdb";
3
- import { IIndexDB, IIndexTable, IListAccountsResult, IListAssetsResult, IListDelegationsResult, IListFactoriesResult, IListRollupBlocksResult, IListRollupValidatorsResult, IListRollupsResult, IListStakesResult, IListTokenFactoriesResult, IListTokensResult, IListTransactionsResult, IndexTableTypeMap, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions } from "@ocap/types";
3
+ import { IIndexDB, IIndexTable, IListAccountsResult, IListAssetsResult, IListDelegationsResult, IListFactoriesResult, IListRollupBlocksResult, IListRollupValidatorsResult, IListRollupsResult, IListStakesResult, IListTokenFactoriesResult, IListTokensResult, IListTransactionsResult, IndexTableTypeMap, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions, TSearchResult } from "@ocap/types";
4
4
  import { Kysely } from "kysely";
5
5
 
6
6
  //#region src/db/base.d.ts
@@ -73,6 +73,10 @@ declare class SqliteBaseIndexDB extends BaseIndexDB implements IIndexDB {
73
73
  * List delegations
74
74
  */
75
75
  listDelegations(params?: Partial<TRequestListDelegations>): Promise<IListDelegationsResult>;
76
+ /**
77
+ * Search entities by semantic fields (moniker, name, symbol, description)
78
+ */
79
+ search(keyword: string): Promise<TSearchResult[]>;
76
80
  }
77
81
  //#endregion
78
82
  export { SqliteBaseIndexDB as default };
package/lib/db/index.cjs CHANGED
@@ -315,6 +315,7 @@ var SqliteIndexDB = class extends require_db_base.default {
315
315
  schema: {
316
316
  jsonFields: [
317
317
  "ops",
318
+ "deny",
318
319
  "context",
319
320
  "data"
320
321
  ],
@@ -327,6 +328,8 @@ var SqliteIndexDB = class extends require_db_base.default {
327
328
  "from",
328
329
  "to",
329
330
  "ops",
331
+ "deny",
332
+ "validUntil",
330
333
  "context",
331
334
  "data",
332
335
  "genesisTime",
@@ -198,6 +198,8 @@ interface DelegationTable {
198
198
  from_: string | null;
199
199
  to_: string | null;
200
200
  ops: string | null;
201
+ deny: string | null;
202
+ validUntil: number | null;
201
203
  context: string | null;
202
204
  data: string | null;
203
205
  genesisTime: string | null;
@@ -0,0 +1,23 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let kysely = require("kysely");
3
+
4
+ //#region src/migrations/003-delegation-extensions.ts
5
+ var _003_delegation_extensions_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
6
+ down: () => down,
7
+ up: () => up
8
+ });
9
+ async function up(db) {
10
+ await kysely.sql`ALTER TABLE delegation ADD COLUMN deny TEXT`.execute(db);
11
+ await kysely.sql`ALTER TABLE delegation ADD COLUMN validUntil INTEGER DEFAULT 0`.execute(db);
12
+ }
13
+ async function down(_db) {}
14
+
15
+ //#endregion
16
+ Object.defineProperty(exports, '_003_delegation_extensions_exports', {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _003_delegation_extensions_exports;
20
+ }
21
+ });
22
+ exports.down = down;
23
+ exports.up = up;
@@ -0,0 +1,7 @@
1
+ import { Kysely } from "kysely";
2
+
3
+ //#region src/migrations/003-delegation-extensions.d.ts
4
+ declare function up(db: Kysely<unknown>): Promise<void>;
5
+ declare function down(_db: Kysely<unknown>): Promise<void>;
6
+ //#endregion
7
+ export { down, up };
@@ -0,0 +1,28 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let kysely = require("kysely");
3
+
4
+ //#region src/migrations/004-search-indexes.ts
5
+ var _004_search_indexes_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
6
+ down: () => down,
7
+ up: () => up
8
+ });
9
+ async function up(db) {
10
+ await kysely.sql`CREATE INDEX IF NOT EXISTS idx_asset_moniker ON asset(moniker) WHERE moniker IS NOT NULL`.execute(db);
11
+ await kysely.sql`CREATE INDEX IF NOT EXISTS idx_token_name ON token(name) WHERE name IS NOT NULL`.execute(db);
12
+ await kysely.sql`CREATE INDEX IF NOT EXISTS idx_tokenfactory_name ON tokenFactory(name) WHERE name IS NOT NULL`.execute(db);
13
+ }
14
+ async function down(db) {
15
+ await kysely.sql`DROP INDEX IF EXISTS idx_asset_moniker`.execute(db);
16
+ await kysely.sql`DROP INDEX IF EXISTS idx_token_name`.execute(db);
17
+ await kysely.sql`DROP INDEX IF EXISTS idx_tokenfactory_name`.execute(db);
18
+ }
19
+
20
+ //#endregion
21
+ Object.defineProperty(exports, '_004_search_indexes_exports', {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _004_search_indexes_exports;
25
+ }
26
+ });
27
+ exports.down = down;
28
+ exports.up = up;
@@ -0,0 +1,7 @@
1
+ import { Kysely } from "kysely";
2
+
3
+ //#region src/migrations/004-search-indexes.d.ts
4
+ declare function up(db: Kysely<unknown>): Promise<void>;
5
+ declare function down(db: Kysely<unknown>): Promise<void>;
6
+ //#endregion
7
+ export { down, up };
@@ -1,6 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_migrations_001_genesis = require('./001-genesis.cjs');
3
3
  const require_migrations_002_composite_indexes = require('./002-composite-indexes.cjs');
4
+ const require_migrations_003_delegation_extensions = require('./003-delegation-extensions.cjs');
5
+ const require_migrations_004_search_indexes = require('./004-search-indexes.cjs');
4
6
  let kysely = require("kysely");
5
7
 
6
8
  //#region src/migrations/index.ts
@@ -12,7 +14,9 @@ var InMemoryMigrationProvider = class {
12
14
  async getMigrations() {
13
15
  return {
14
16
  "001-genesis": require_migrations_001_genesis._001_genesis_exports,
15
- "002-composite-indexes": require_migrations_002_composite_indexes._002_composite_indexes_exports
17
+ "002-composite-indexes": require_migrations_002_composite_indexes._002_composite_indexes_exports,
18
+ "003-delegation-extensions": require_migrations_003_delegation_extensions._003_delegation_extensions_exports,
19
+ "004-search-indexes": require_migrations_004_search_indexes._004_search_indexes_exports
16
20
  };
17
21
  }
18
22
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocap/indexdb-sqlite",
3
3
  "description": "OCAP indexdb adapter that uses SQLite as backend",
4
- "version": "1.29.13",
4
+ "version": "1.29.15",
5
5
  "author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ArcBlock/blockchain/issues",
@@ -14,7 +14,7 @@
14
14
  "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)"
15
15
  ],
16
16
  "devDependencies": {
17
- "@ocap/indexdb-test": "1.29.13"
17
+ "@ocap/indexdb-test": "1.29.15"
18
18
  },
19
19
  "homepage": "https://github.com/ArcBlock/blockchain/tree/master/indexdb/sqlite",
20
20
  "keywords": [
@@ -63,10 +63,10 @@
63
63
  "clean": "rm -rf lib esm"
64
64
  },
65
65
  "dependencies": {
66
- "@arcblock/did": "1.29.13",
67
- "@ocap/indexdb": "1.29.13",
68
- "@ocap/types": "1.29.13",
69
- "@ocap/util": "1.29.13",
66
+ "@arcblock/did": "1.29.15",
67
+ "@ocap/indexdb": "1.29.15",
68
+ "@ocap/types": "1.29.15",
69
+ "@ocap/util": "1.29.15",
70
70
  "debug": "^4.4.3",
71
71
  "better-sqlite3": "^11.8.1",
72
72
  "kysely": "^0.27.0",