@seedprotocol/sdk 0.1.119 → 0.1.120
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-PI7JgtNo.js → index-CXivX9-v.js} +4 -3
- package/dist/index-CXivX9-v.js.map +1 -0
- package/dist/{index-D9hBdVBw.js → index-lYH32Ucm.js} +50 -15
- package/dist/index-lYH32Ucm.js.map +1 -0
- package/dist/main.js +3 -2
- package/dist/main.js.map +1 -1
- package/dist/{seed.schema.config-DcbShLHu.js → seed.schema.config-y0omDTDZ.js} +3 -2
- package/dist/seed.schema.config-y0omDTDZ.js.map +1 -0
- package/dist/src/actors.ts +7 -289
- package/dist/src/files.ts +8 -8
- package/dist/src/index.ts +10 -62
- package/dist/src/migrate.ts +17 -14
- package/dist/types/src/browser/services/db/actors/migrate.d.ts.map +1 -1
- package/dist/types/src/shared/helpers/files.d.ts +2 -2
- package/dist/types/src/shared/helpers/files.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-D9hBdVBw.js.map +0 -1
- package/dist/index-PI7JgtNo.js.map +0 -1
- package/dist/seed.schema.config-DcbShLHu.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-
|
|
1
|
+
export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-lYH32Ucm.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import '@sinclair/typebox';
|
|
@@ -27,10 +27,11 @@ import 'rxjs';
|
|
|
27
27
|
import 'drizzle-orm/sqlite-proxy';
|
|
28
28
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
29
29
|
import 'drizzle-orm/migrator';
|
|
30
|
-
import '@zenfs/dom';
|
|
31
30
|
import 'node:fs';
|
|
31
|
+
import 'async-es/retry';
|
|
32
|
+
import '@zenfs/dom';
|
|
32
33
|
import 'arweave';
|
|
33
34
|
import './constants-B6s6tGup.js';
|
|
34
35
|
import '@ethereum-attestation-service/eas-sdk';
|
|
35
36
|
import 'thirdweb';
|
|
36
|
-
//# sourceMappingURL=index-
|
|
37
|
+
//# sourceMappingURL=index-CXivX9-v.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CXivX9-v.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -26,8 +26,9 @@ import { BehaviorSubject } from 'rxjs';
|
|
|
26
26
|
import { drizzle } from 'drizzle-orm/sqlite-proxy';
|
|
27
27
|
import { migrate as migrate$1 } from 'drizzle-orm/sqlite-proxy/migrator';
|
|
28
28
|
import { readMigrationFiles } from 'drizzle-orm/migrator';
|
|
29
|
-
import { WebAccess } from '@zenfs/dom';
|
|
30
29
|
import * as fsNode from 'node:fs';
|
|
30
|
+
import retry from 'async-es/retry';
|
|
31
|
+
import { WebAccess } from '@zenfs/dom';
|
|
31
32
|
import Arweave from 'arweave';
|
|
32
33
|
import { i as internalPropertyNames, I as INTERNAL_DATA_TYPES, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, d as defaultAttestationData } from './constants-B6s6tGup.js';
|
|
33
34
|
import { ZERO_BYTES32, SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
|
|
@@ -2114,7 +2115,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2114
2115
|
if (!models$1) {
|
|
2115
2116
|
return;
|
|
2116
2117
|
}
|
|
2117
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2118
|
+
const { models: SeedModels } = yield import('./seed.schema.config-y0omDTDZ.js');
|
|
2118
2119
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2119
2120
|
let hasModelsInDb = false;
|
|
2120
2121
|
const schemaDefsByModelName = new Map();
|
|
@@ -2314,6 +2315,36 @@ const validate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2314
2315
|
});
|
|
2315
2316
|
});
|
|
2316
2317
|
|
|
2318
|
+
/**
|
|
2319
|
+
* Waits for a file to exist at the specified path.
|
|
2320
|
+
* @param {string} filePath - The path of the file to check.
|
|
2321
|
+
* @param {number} interval - The interval in milliseconds between checks (default: 500ms).
|
|
2322
|
+
* @param {number} timeout - The timeout in milliseconds to wait for the file to exist (default: 10s).
|
|
2323
|
+
* @returns {Promise<boolean>} - Resolves to true if the file exists within the timeout period, otherwise false.
|
|
2324
|
+
*/
|
|
2325
|
+
const waitForFile = (filePath, interval = 500, timeout = 10000) => {
|
|
2326
|
+
return new Promise((resolve, reject) => {
|
|
2327
|
+
const startTime = Date.now();
|
|
2328
|
+
retry({
|
|
2329
|
+
times: Math.ceil(timeout / interval),
|
|
2330
|
+
interval: interval,
|
|
2331
|
+
}, (callback) => {
|
|
2332
|
+
if (fs.existsSync(filePath) && fsNode.existsSync(filePath)) {
|
|
2333
|
+
return callback(null, true); // File exists, finish with success
|
|
2334
|
+
}
|
|
2335
|
+
if (Date.now() - startTime >= timeout) {
|
|
2336
|
+
return callback(new Error('Timeout exceeded while waiting for file'));
|
|
2337
|
+
}
|
|
2338
|
+
callback(new Error('File does not exist yet')); // Retry with this error
|
|
2339
|
+
}, (err, result) => {
|
|
2340
|
+
if (err) {
|
|
2341
|
+
return resolve(false); // Resolve as false if timeout or error occurs
|
|
2342
|
+
}
|
|
2343
|
+
resolve(result); // Resolve as true if file exists
|
|
2344
|
+
});
|
|
2345
|
+
});
|
|
2346
|
+
};
|
|
2347
|
+
|
|
2317
2348
|
const logger$i = debug('app:services:db:actors:migrate');
|
|
2318
2349
|
const dbExec = (dbId_1, params_1, sql_1, dbName_1, ...args_1) => __awaiter(void 0, [dbId_1, params_1, sql_1, dbName_1, ...args_1], void 0, function* (dbId, params, sql, dbName, retries = 2) {
|
|
2319
2350
|
const rowsToReturnRaw = [];
|
|
@@ -2403,11 +2434,13 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2403
2434
|
console.log('journalExistsSync', journalExistsSync);
|
|
2404
2435
|
console.log('journalExistsSyncNode', journalExistsSyncNode);
|
|
2405
2436
|
if (!journalExists) {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2437
|
+
yield waitForFile(journalPath);
|
|
2438
|
+
// const handle = await navigator.storage.getDirectory()
|
|
2439
|
+
//
|
|
2440
|
+
// await configureSingle({
|
|
2441
|
+
// backend: WebAccess,
|
|
2442
|
+
// handle,
|
|
2443
|
+
// })
|
|
2411
2444
|
// window.location.reload()
|
|
2412
2445
|
// setTimeout(() => {
|
|
2413
2446
|
// _checkForFiles().then(() => {
|
|
@@ -2483,11 +2516,13 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2483
2516
|
catch (error) {
|
|
2484
2517
|
// console.error('Error migrating database: ', error)
|
|
2485
2518
|
// window.location.reload()
|
|
2486
|
-
const handle =
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2519
|
+
// const handle = await navigator.storage.getDirectory()
|
|
2520
|
+
//
|
|
2521
|
+
// await configureSingle({
|
|
2522
|
+
// backend: WebAccess,
|
|
2523
|
+
// handle,
|
|
2524
|
+
// })
|
|
2525
|
+
yield waitForFile(`${pathToDbDir}/meta/_journal.json`);
|
|
2491
2526
|
return _migrate();
|
|
2492
2527
|
}
|
|
2493
2528
|
setAppDb(drizzleDb);
|
|
@@ -6516,7 +6551,7 @@ const client = {
|
|
|
6516
6551
|
addresses,
|
|
6517
6552
|
arweaveDomain,
|
|
6518
6553
|
});
|
|
6519
|
-
import('./seed.schema.config-
|
|
6554
|
+
import('./seed.schema.config-y0omDTDZ.js').then(({ models }) => {
|
|
6520
6555
|
for (const [key, value] of Object.entries(models)) {
|
|
6521
6556
|
setModel(key, value);
|
|
6522
6557
|
}
|
|
@@ -7191,7 +7226,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
7191
7226
|
if (propertyRecordSchema &&
|
|
7192
7227
|
propertyRecordSchema.storageType &&
|
|
7193
7228
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
7194
|
-
const { Item } = yield import('./index-
|
|
7229
|
+
const { Item } = yield import('./index-CXivX9-v.js');
|
|
7195
7230
|
const item = yield Item.find({
|
|
7196
7231
|
seedLocalId,
|
|
7197
7232
|
modelName,
|
|
@@ -8133,4 +8168,4 @@ if (isNode()) {
|
|
|
8133
8168
|
}
|
|
8134
8169
|
|
|
8135
8170
|
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 };
|
|
8136
|
-
//# sourceMappingURL=index-
|
|
8171
|
+
//# sourceMappingURL=index-lYH32Ucm.js.map
|