@seedprotocol/sdk 0.2.19 → 0.2.20
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/dist/{Db-CQyWrG2a.js → Db-DmVJMUEe.js} +2 -2
- package/dist/{Db-CQyWrG2a.js.map → Db-DmVJMUEe.js.map} +1 -1
- package/dist/{Db-Cv4GVzh1.js → Db-tOm1prXY.js} +2 -2
- package/dist/{Db-Cv4GVzh1.js.map → Db-tOm1prXY.js.map} +1 -1
- package/dist/{Item-UegZbC_j.js → Item-CUb5EPhJ.js} +2 -2
- package/dist/{Item-UegZbC_j.js.map → Item-CUb5EPhJ.js.map} +1 -1
- package/dist/{index-DNw_v54Y.js → index-BhuLVnLW.js} +70 -72
- package/dist/index-BhuLVnLW.js.map +1 -0
- package/dist/{index-DQrMMoLY.js → index-Bo17ctYt.js} +2 -2
- package/dist/index-Bo17ctYt.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-SuJxms_6.js → seed.schema.config-DQk8YJHP.js} +2 -2
- package/dist/{seed.schema.config-SuJxms_6.js.map → seed.schema.config-DQk8YJHP.js.map} +1 -1
- package/dist/src/initialize.ts +66 -68
- package/dist/types/src/services/global/actors/initialize.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-DNw_v54Y.js.map +0 -1
- package/dist/index-DQrMMoLY.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BaseDb, g as getAppDb, i as isAppDbReady, b as getSqliteWasmClient } from './index-
|
|
1
|
+
import { a as BaseDb, g as getAppDb, i as isAppDbReady, b as getSqliteWasmClient } from './index-BhuLVnLW.js';
|
|
2
2
|
import { __awaiter } from 'tslib';
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import 'immer';
|
|
@@ -135,4 +135,4 @@ class Db extends BaseDb {
|
|
|
135
135
|
BaseDb.setPlatformClass(Db);
|
|
136
136
|
|
|
137
137
|
export { Db };
|
|
138
|
-
//# sourceMappingURL=Db-
|
|
138
|
+
//# sourceMappingURL=Db-DmVJMUEe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Db-
|
|
1
|
+
{"version":3,"file":"Db-DmVJMUEe.js","sources":["../../src/services/db/connectionManager.ts","../../src/browser/db/Db.ts"],"sourcesContent":["type SqliteDatabase = {\n open: (filename: string) => Promise<void>\n exec: (sql: string, params?: any[]) => any\n close: () => void\n}\n\nclass SqliteConnectionManager {\n private sqliteModule: SqliteDatabase\n private idleTimeout: number\n private databases: { [key: string]: SqliteDatabase }\n private idleTimers: { [key: string]: NodeJS.Timeout }\n\n constructor(sqliteModule: SqliteDatabase, idleTimeout: number = 300000) {\n // Default idle timeout: 5 minutes\n this.sqliteModule = sqliteModule\n this.idleTimeout = idleTimeout\n this.databases = {}\n this.idleTimers = {}\n }\n\n private resetIdleTimer(dbName: string): void {\n if (this.idleTimers[dbName]) {\n clearTimeout(this.idleTimers[dbName])\n }\n\n this.idleTimers[dbName] = setTimeout(() => {\n this.closeConnection(dbName)\n }, this.idleTimeout)\n }\n\n private async getConnection(dbName: string): Promise<SqliteDatabase> {\n if (this.databases[dbName]) {\n this.resetIdleTimer(dbName)\n return this.databases[dbName]\n }\n\n const db = new this.sqliteModule()\n await db.open(dbName)\n this.databases[dbName] = db\n this.resetIdleTimer(dbName)\n return db\n }\n\n public async execute(\n dbName: string,\n sql: string,\n params: any[] = [],\n ): Promise<any> {\n const db = await this.getConnection(dbName)\n const result = db.exec(sql, params)\n this.resetIdleTimer(dbName)\n return result\n }\n\n public closeConnection(dbName: string): void {\n if (this.databases[dbName]) {\n this.databases[dbName].close()\n delete this.databases[dbName]\n if (this.idleTimers[dbName]) {\n clearTimeout(this.idleTimers[dbName])\n delete this.idleTimers[dbName]\n }\n }\n }\n}\n\nexport { SqliteConnectionManager }\n","import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces/IDb\";\nimport { getAppDb, getSqliteWasmClient, isAppDbReady } from \"./sqlWasmClient\";\nimport { SqliteConnectionManager } from \"@/services/db\";\nimport debug from \"debug\";\n\nconst logger = debug('app:browser:db:Db')\n\nclass Db extends BaseDb implements IDb {\n constructor() {\n super()\n }\n\n static getAppDb() {\n return getAppDb()\n }\n\n static isAppDbReady() {\n return isAppDbReady()\n }\n\n static prepareDb() {\n\n return new Promise((resolve, reject) => {\n let sqliteWasmClient\n const interval = setInterval(() => {\n // TODO: Add a timeout\n // TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome\n getSqliteWasmClient().then((sqliteWasmClient) => {\n\n if (sqliteWasmClient) {\n clearInterval(interval)\n const manager = new SqliteConnectionManager(sqliteWasmClient)\n resolve(manager)\n }\n })\n\n }, 200)\n })\n }\n\n static connectToDb(pathToDir: string, dbName: string) {\n\n return new Promise((resolve, reject) => {\n const interval = setInterval(() => {\n\n // TODO: Add a timeout\n // TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome\n getSqliteWasmClient().then((sqliteWasmClient) => {\n\n //@ts-ignore\n sqliteWasmClient('config-get', {}).then((response) => {\n logger(response)\n logger('Running SQLite3 version', response.result.version.libVersion)\n\n //@ts-ignore\n sqliteWasmClient('open', {\n filename: `file:${pathToDir}/db/${dbName}.sqlite3?vfs=opfs`,\n }).then((response: { dbId: string, result: { filename: string } }) => {\n\n logger(response)\n const dbId = response.dbId\n logger(\n 'OPFS is available, created persisted database at',\n response.result.filename.replace(/^file:(.*?)\\?vfs=opfs$/, '$1'),\n )\n\n if (dbId) {\n clearInterval(interval)\n resolve(dbId)\n }\n })\n })\n })\n }, 500)\n })\n }\n}\n\nBaseDb.setPlatformClass(Db)\n\nexport { Db }"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,CAAA;IAM3B,WAAY,CAAA,YAA4B,EAAE,WAAA,GAAsB,MAAM,EAAA;;AAEpE,QAAA,IAAI,CAAC,YAAY,GAAG,YAAY;AA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ElD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,YAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAK;;;AAIhC,gBAAA,mBAAmB,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,KAAI;;oBAG9C,gBAAgB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;wBACnD,MAAM,CAAC,QAAQ,CAAC;wBAChB,MAAM,CAAC,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;;wBAGrE,gBAAgB,CAAC,MAAM,EAAE;AACvB,4BAAA,QAAQ,EAAE,CAAA,KAAA,EAAQ,SAAS,CAAA,IAAA,EAAO,MAAM,CAAmB,iBAAA,CAAA;AAC5D,yBAAA,CAAC,CAAC,IAAI,CAAC,CAAC,QAAwD,KAAI;4BAEnE,MAAM,CAAC,QAAQ,CAAC;AAChB,4BAAA,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI;AAC1B,4BAAA,MAAM,CACJ,kDAAkD,EAClD,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CACjE;4BAED,IAAI,IAAI,EAAE;gCACR,aAAa,CAAC,QAAQ,CAAC;gCACvB,OAAO,CAAC,IAAI,CAAC;;AAEjB,yBAAC,CAAC;AACJ,qBAAC,CAAC;AACJ,iBAAC,CAAC;aACH,EAAE,GAAG,CAAC;AACT,SAAC,CAAC;;AAEL;AAED,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from 'tslib';
|
|
2
|
-
import { a as BaseDb } from './index-
|
|
2
|
+
import { a as BaseDb } from './index-BhuLVnLW.js';
|
|
3
3
|
import { defineConfig } from 'drizzle-kit';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
import process from 'node:process';
|
|
@@ -80,4 +80,4 @@ class Db extends BaseDb {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
export { Db };
|
|
83
|
-
//# sourceMappingURL=Db-
|
|
83
|
+
//# sourceMappingURL=Db-tOm1prXY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Db-
|
|
1
|
+
{"version":3,"file":"Db-tOm1prXY.js","sources":["../../src/node/db/node.app.db.config.ts","../../src/node/db/Db.ts"],"sourcesContent":["import { defineConfig } from 'drizzle-kit'\nimport dotenv from 'dotenv'\nimport process from 'node:process'\nimport path from 'path'\nimport { DrizzleConfig } from 'drizzle-orm'\n\ndotenv.config()\n\nlet sdkRoot = './node_modules/@seedprotocol/sdk'\n\nif (process.env.IS_SEED_DEV) {\n sdkRoot = './src'\n}\n\nlet dotSeedDir = path.join(process.cwd(), '.seed')\n\nif (process.env.IS_SEED_DEV) {\n dotSeedDir = path.join(\n process.cwd(),\n '__tests__',\n '__mocks__',\n 'project',\n '.seed',\n )\n}\n\nlet schemaDir = `${sdkRoot}/dist/seedSchema/*.ts`\n\nif (process.env.IS_SEED_DEV) {\n schemaDir = `${sdkRoot}/seedSchema/*.ts`\n}\n\nexport default defineConfig({\n schema: schemaDir,\n dialect: 'sqlite',\n out: `${dotSeedDir}/db`,\n dbCredentials: {\n url: `${dotSeedDir}/db/app_db.sqlite3`,\n },\n}) as DrizzleConfig\n","import { BaseDb } from \"@/db/Db/BaseDb\";\nimport { IDb } from \"@/interfaces\";\nimport nodeAppDbConfig from \"./node.app.db.config\";\nimport { drizzle } from \"drizzle-orm/better-sqlite3\";\n\nexport class Db extends BaseDb implements IDb {\n constructor() {\n super()\n }\n\n static getAppDb() {\n return drizzle(nodeAppDbConfig)\n }\n\n static isAppDbReady() {\n return true\n }\n\n static async prepareDb() {\n return drizzle(nodeAppDbConfig)\n }\n\n static async connectToDb(pathToDir: string, dbName: string) {\n return {\n id: drizzle(nodeAppDbConfig).$client.name\n }\n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SAAiB,EAAE,MAAc,EAAA;;YACxD,OAAO;gBACL,EAAE,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC;aACtC;SACF,CAAA;AAAA;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseItem } from './index-
|
|
1
|
+
import { B as BaseItem } from './index-BhuLVnLW.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import 'tslib';
|
|
@@ -37,4 +37,4 @@ class Item extends BaseItem {
|
|
|
37
37
|
BaseItem.setPlatformClass(Item);
|
|
38
38
|
|
|
39
39
|
export { Item };
|
|
40
|
-
//# sourceMappingURL=Item-
|
|
40
|
+
//# sourceMappingURL=Item-CUb5EPhJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item-
|
|
1
|
+
{"version":3,"file":"Item-CUb5EPhJ.js","sources":["../../src/node/Item/Item.ts"],"sourcesContent":["import { IItem } from '@/interfaces';\nimport { BaseItem } from '@/Item/BaseItem';\nimport { ModelSchema, ModelValues, NewItemProps } from '@/types';\n\nexport class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {\n constructor(initialValues: NewItemProps<T>) {\n super(initialValues);\n }\n\n}\n\nBaseItem.setPlatformClass(Item)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAO,IAAyC,SAAQ,QAAW,CAAA;AACvE,IAAA,WAAA,CAAY,aAA8B,EAAA;QACxC,KAAK,CAAC,aAAa,CAAC;;AAGvB;AAED,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;;;;"}
|
|
@@ -112,7 +112,7 @@ const initItem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
112
112
|
Item$2 = (yield Promise.resolve().then(function () { return Item$1; })).Item;
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
Item$2 = (yield import('./Item-
|
|
115
|
+
Item$2 = (yield import('./Item-CUb5EPhJ.js')).Item;
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
|
|
@@ -169,10 +169,10 @@ const initItemProperty = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
169
169
|
let Db;
|
|
170
170
|
const initDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
171
171
|
if (typeof window !== 'undefined') {
|
|
172
|
-
Db = (yield import('./Db-
|
|
172
|
+
Db = (yield import('./Db-DmVJMUEe.js')).Db;
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
-
Db = (yield import('./Db-
|
|
175
|
+
Db = (yield import('./Db-tOm1prXY.js')).Db;
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
|
|
@@ -1581,75 +1581,73 @@ const initialize$2 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
1581
1581
|
environment = 'react-native';
|
|
1582
1582
|
}
|
|
1583
1583
|
let internalSubscription;
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
arweaveDomain,
|
|
1603
|
-
});
|
|
1584
|
+
const _initFileSystem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1585
|
+
return;
|
|
1586
|
+
// return new Promise((resolve) => {
|
|
1587
|
+
// })
|
|
1588
|
+
});
|
|
1589
|
+
const _initInternal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1590
|
+
return new Promise((resolve) => {
|
|
1591
|
+
internalSubscription = internalService.subscribe((snapshot) => {
|
|
1592
|
+
logger$o('[sdk] [internal] snapshot', snapshot);
|
|
1593
|
+
if (snapshot.value === 'ready') {
|
|
1594
|
+
resolve();
|
|
1595
|
+
}
|
|
1596
|
+
});
|
|
1597
|
+
internalService.send({
|
|
1598
|
+
type: 'init',
|
|
1599
|
+
endpoints,
|
|
1600
|
+
addresses,
|
|
1601
|
+
arweaveDomain,
|
|
1604
1602
|
});
|
|
1605
1603
|
});
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1604
|
+
});
|
|
1605
|
+
const _initAllItemsServices = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1606
|
+
const appDb = BaseDb.getAppDb();
|
|
1607
|
+
const rows = yield appDb
|
|
1608
|
+
.select()
|
|
1609
|
+
.from(appState)
|
|
1610
|
+
.where(like(appState.key, 'snapshot__%'));
|
|
1611
|
+
const payloadObj = {
|
|
1612
|
+
create: {},
|
|
1613
|
+
restore: {},
|
|
1614
|
+
};
|
|
1615
|
+
const modelNamesRestored = [];
|
|
1616
|
+
if (rows && rows.length > 0) {
|
|
1617
|
+
for (const row of rows) {
|
|
1618
|
+
const modelName = row.key.replace('snapshot__', '');
|
|
1619
|
+
payloadObj.restore[modelName] = JSON.parse(row.value);
|
|
1620
|
+
modelNamesRestored.push(modelName);
|
|
1623
1621
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1622
|
+
}
|
|
1623
|
+
for (const [modelName, ModelClass] of Object.entries(models)) {
|
|
1624
|
+
if (!modelNamesRestored.includes(modelName)) {
|
|
1625
|
+
payloadObj.create[modelName] = ModelClass;
|
|
1628
1626
|
}
|
|
1629
|
-
|
|
1630
|
-
});
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
}
|
|
1627
|
+
}
|
|
1628
|
+
sendBack(Object.assign({ type: GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES }, payloadObj));
|
|
1629
|
+
});
|
|
1630
|
+
const _initEas = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1631
|
+
yield fetchSchemaUids();
|
|
1632
|
+
});
|
|
1633
|
+
_initFileSystem().then(() => {
|
|
1634
|
+
logger$o('[global/actors] File system initialized');
|
|
1635
|
+
});
|
|
1636
|
+
_initInternal()
|
|
1637
|
+
.then(() => {
|
|
1638
|
+
return _initAllItemsServices();
|
|
1639
|
+
})
|
|
1640
|
+
.then(() => {
|
|
1641
|
+
return _initEas();
|
|
1642
|
+
})
|
|
1643
|
+
.then(() => {
|
|
1644
|
+
logger$o('[global/actors] Internal initialized');
|
|
1645
|
+
sendBack({ type: GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY });
|
|
1646
|
+
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
1647
|
+
});
|
|
1648
|
+
// _initEas().then(() => {
|
|
1649
|
+
// logger('EAS initialized')
|
|
1650
|
+
// })
|
|
1653
1651
|
sendBack({ type: GLOBAL_INITIALIZING_SEND_CONFIG, environment });
|
|
1654
1652
|
return () => {
|
|
1655
1653
|
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
@@ -1686,7 +1684,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1686
1684
|
if (!models$1) {
|
|
1687
1685
|
return;
|
|
1688
1686
|
}
|
|
1689
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
1687
|
+
const { models: SeedModels } = yield import('./seed.schema.config-DQk8YJHP.js');
|
|
1690
1688
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
1691
1689
|
let hasModelsInDb = false;
|
|
1692
1690
|
const schemaDefsByModelName = new Map();
|
|
@@ -5492,7 +5490,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5492
5490
|
if (propertyRecordSchema &&
|
|
5493
5491
|
propertyRecordSchema.storageType &&
|
|
5494
5492
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
5495
|
-
const { Item } = yield import('./index-
|
|
5493
|
+
const { Item } = yield import('./index-Bo17ctYt.js');
|
|
5496
5494
|
const item = yield Item.find({
|
|
5497
5495
|
seedLocalId,
|
|
5498
5496
|
modelName,
|
|
@@ -8119,7 +8117,7 @@ const client = {
|
|
|
8119
8117
|
addresses,
|
|
8120
8118
|
arweaveDomain,
|
|
8121
8119
|
});
|
|
8122
|
-
const { models: internalModels } = yield import('./seed.schema.config-
|
|
8120
|
+
const { models: internalModels } = yield import('./seed.schema.config-DQk8YJHP.js');
|
|
8123
8121
|
for (const [key, value] of Object.entries(internalModels)) {
|
|
8124
8122
|
setModel(key, value);
|
|
8125
8123
|
}
|
|
@@ -8167,4 +8165,4 @@ const client = {
|
|
|
8167
8165
|
enableMapSet();
|
|
8168
8166
|
|
|
8169
8167
|
export { BaseItem as B, Db as D, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, BaseDb as a, getSqliteWasmClient as b, ImageSrc as c, Item$2 as d, ItemProperty$2 as e, useItem as f, getAppDb as g, useItemProperties as h, isAppDbReady as i, useCreateItem as j, useItemProperty as k, useDeleteItem as l, useGlobalServiceStatus as m, usePublishItem as n, usePersistedSnapshots as o, useServices as p, useService as q, getCorrectId as r, getGlobalService as s, eventEmitter as t, useItems as u, client as v, withSeed as w };
|
|
8170
|
-
//# sourceMappingURL=index-
|
|
8168
|
+
//# sourceMappingURL=index-BhuLVnLW.js.map
|