@seedprotocol/sdk 0.1.116 → 0.1.118
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/{index-fACn9sTT.js → index-BPIesZ_6.js} +30 -11
- package/dist/{index-fACn9sTT.js.map → index-BPIesZ_6.js.map} +1 -1
- package/dist/{index-BtxxSQ3G.js → index-B_TEG7RD.js} +5 -2
- package/dist/index-B_TEG7RD.js.map +1 -0
- package/dist/main.js +4 -1
- package/dist/main.js.map +1 -1
- package/dist/{seed.schema.config-DLrHziQY.js → seed.schema.config-BB6-tbUU.js} +5 -2
- package/dist/seed.schema.config-BB6-tbUU.js.map +1 -0
- package/dist/src/files.ts +43 -0
- package/dist/src/index.ts +21 -4
- package/dist/src/migrate.ts +38 -12
- package/dist/types/src/browser/services/db/actors/migrate.d.ts.map +1 -1
- package/dist/types/src/browser/services/db/dbMachine.d.ts +6 -6
- package/dist/types/src/shared/helpers/files.d.ts +8 -0
- package/dist/types/src/shared/helpers/files.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-BtxxSQ3G.js.map +0 -1
- package/dist/seed.schema.config-DLrHziQY.js.map +0 -1
|
@@ -24,7 +24,10 @@ import pluralize from 'pluralize';
|
|
|
24
24
|
import { createBrowserInspector } from '@statelyai/inspect';
|
|
25
25
|
import { BehaviorSubject } from 'rxjs';
|
|
26
26
|
import { drizzle } from 'drizzle-orm/sqlite-proxy';
|
|
27
|
+
import { migrate as migrate$1 } from 'drizzle-orm/sqlite-proxy/migrator';
|
|
28
|
+
import { readMigrationFiles } from 'drizzle-orm/migrator';
|
|
27
29
|
import { WebAccess } from '@zenfs/dom';
|
|
30
|
+
import * as fsNode from 'node:fs';
|
|
28
31
|
import Arweave from 'arweave';
|
|
29
32
|
import { i as internalPropertyNames, I as INTERNAL_DATA_TYPES, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, d as defaultAttestationData } from './constants-B6s6tGup.js';
|
|
30
33
|
import { ZERO_BYTES32, SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
|
|
@@ -2095,7 +2098,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2095
2098
|
if (!models$1) {
|
|
2096
2099
|
return;
|
|
2097
2100
|
}
|
|
2098
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2101
|
+
const { models: SeedModels } = yield import('./seed.schema.config-BB6-tbUU.js');
|
|
2099
2102
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2100
2103
|
let hasModelsInDb = false;
|
|
2101
2104
|
const schemaDefsByModelName = new Map();
|
|
@@ -2375,9 +2378,21 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2375
2378
|
//
|
|
2376
2379
|
// _initFs()
|
|
2377
2380
|
const _checkForFiles = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2378
|
-
|
|
2381
|
+
const journalPath = `/${pathToDbDir}/meta/_journal.json`;
|
|
2382
|
+
journalExists = yield fs.promises.exists(journalPath);
|
|
2383
|
+
const journalExistsAsync = journalExists;
|
|
2384
|
+
const journalExistsSync = fs.existsSync(journalPath);
|
|
2385
|
+
const journalExistsSyncNode = fsNode.existsSync(journalPath);
|
|
2386
|
+
console.log('journalExistsAsync', journalExistsAsync);
|
|
2387
|
+
console.log('journalExistsSync', journalExistsSync);
|
|
2388
|
+
console.log('journalExistsSyncNode', journalExistsSyncNode);
|
|
2379
2389
|
if (!journalExists) {
|
|
2380
|
-
|
|
2390
|
+
const handle = yield navigator.storage.getDirectory();
|
|
2391
|
+
yield configureSingle({
|
|
2392
|
+
backend: WebAccess,
|
|
2393
|
+
handle,
|
|
2394
|
+
});
|
|
2395
|
+
// window.location.reload()
|
|
2381
2396
|
// setTimeout(() => {
|
|
2382
2397
|
// _checkForFiles().then(() => {
|
|
2383
2398
|
// return
|
|
@@ -2407,8 +2422,6 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2407
2422
|
schema: schemaGlobString,
|
|
2408
2423
|
// logger: true,
|
|
2409
2424
|
});
|
|
2410
|
-
const { migrate: drizzleMigrate } = yield import('drizzle-orm/sqlite-proxy/migrator');
|
|
2411
|
-
const { readMigrationFiles } = yield import('drizzle-orm/migrator');
|
|
2412
2425
|
try {
|
|
2413
2426
|
const migrations = readMigrationFiles({
|
|
2414
2427
|
migrationsFolder: pathToDbDir,
|
|
@@ -2441,7 +2454,7 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2441
2454
|
}
|
|
2442
2455
|
}
|
|
2443
2456
|
}
|
|
2444
|
-
yield
|
|
2457
|
+
yield migrate$1(drizzleDb, (queriesToRun) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2445
2458
|
// logger('queriesToRun', queriesToRun)
|
|
2446
2459
|
for (const query of queriesToRun) {
|
|
2447
2460
|
// logger('query', query)
|
|
@@ -2452,8 +2465,14 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2452
2465
|
});
|
|
2453
2466
|
}
|
|
2454
2467
|
catch (error) {
|
|
2455
|
-
console.error('Error migrating database: ', error)
|
|
2456
|
-
window.location.reload()
|
|
2468
|
+
// console.error('Error migrating database: ', error)
|
|
2469
|
+
// window.location.reload()
|
|
2470
|
+
const handle = yield navigator.storage.getDirectory();
|
|
2471
|
+
yield configureSingle({
|
|
2472
|
+
backend: WebAccess,
|
|
2473
|
+
handle,
|
|
2474
|
+
});
|
|
2475
|
+
return _migrate();
|
|
2457
2476
|
}
|
|
2458
2477
|
setAppDb(drizzleDb);
|
|
2459
2478
|
// const createTempTableQuery = await appDb.run(
|
|
@@ -6481,7 +6500,7 @@ const client = {
|
|
|
6481
6500
|
addresses,
|
|
6482
6501
|
arweaveDomain,
|
|
6483
6502
|
});
|
|
6484
|
-
import('./seed.schema.config-
|
|
6503
|
+
import('./seed.schema.config-BB6-tbUU.js').then(({ models }) => {
|
|
6485
6504
|
for (const [key, value] of Object.entries(models)) {
|
|
6486
6505
|
setModel(key, value);
|
|
6487
6506
|
}
|
|
@@ -7156,7 +7175,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
7156
7175
|
if (propertyRecordSchema &&
|
|
7157
7176
|
propertyRecordSchema.storageType &&
|
|
7158
7177
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
7159
|
-
const { Item } = yield import('./index-
|
|
7178
|
+
const { Item } = yield import('./index-B_TEG7RD.js');
|
|
7160
7179
|
const item = yield Item.find({
|
|
7161
7180
|
seedLocalId,
|
|
7162
7181
|
modelName,
|
|
@@ -8098,4 +8117,4 @@ if (isNode()) {
|
|
|
8098
8117
|
}
|
|
8099
8118
|
|
|
8100
8119
|
export { GET_SCHEMAS as G, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, GET_SCHEMA_BY_NAME as a, GET_SEEDS as b, GET_SEED_IDS as c, GET_STORAGE_TRANSACTION_ID as d, GET_VERSIONS as e, GET_PROPERTIES as f, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as g, itemMachineAll as h, itemMachineSingle as i, ImageSrc as j, ItemProperty as k, useItem as l, useItemProperties as m, useCreateItem as n, useItemProperty as o, useDeleteItem as p, useGlobalServiceStatus as q, useServices as r, getGlobalService as s, client as t, useItems as u, getCorrectId as v, withSeed as w };
|
|
8101
|
-
//# sourceMappingURL=index-
|
|
8120
|
+
//# sourceMappingURL=index-BPIesZ_6.js.map
|