@seedprotocol/sdk 0.1.119 → 0.1.121
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-Bj_ICJrP.js} +3 -3
- package/dist/index-Bj_ICJrP.js.map +1 -0
- package/dist/{index-D9hBdVBw.js → index-CQVtBXqn.js} +63 -15
- package/dist/index-CQVtBXqn.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/{seed.schema.config-DcbShLHu.js → seed.schema.config-CEyCY7bh.js} +2 -2
- package/dist/{seed.schema.config-DcbShLHu.js.map → seed.schema.config-CEyCY7bh.js.map} +1 -1
- package/dist/src/actors.ts +7 -289
- package/dist/src/files.ts +38 -27
- package/dist/src/index.ts +4 -73
- package/dist/src/migrate.ts +17 -14
- package/dist/src/seed.ts +4 -31
- 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 -4
- package/dist/index-D9hBdVBw.js.map +0 -1
- package/dist/index-PI7JgtNo.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-CQVtBXqn.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import '@sinclair/typebox';
|
|
@@ -27,10 +27,10 @@ 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 '@zenfs/dom';
|
|
32
32
|
import 'arweave';
|
|
33
33
|
import './constants-B6s6tGup.js';
|
|
34
34
|
import '@ethereum-attestation-service/eas-sdk';
|
|
35
35
|
import 'thirdweb';
|
|
36
|
-
//# sourceMappingURL=index-
|
|
36
|
+
//# sourceMappingURL=index-Bj_ICJrP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bj_ICJrP.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -26,8 +26,8 @@ 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 { WebAccess } from '@zenfs/dom';
|
|
31
31
|
import Arweave from 'arweave';
|
|
32
32
|
import { i as internalPropertyNames, I as INTERNAL_DATA_TYPES, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, d as defaultAttestationData } from './constants-B6s6tGup.js';
|
|
33
33
|
import { ZERO_BYTES32, SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
|
|
@@ -2114,7 +2114,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2114
2114
|
if (!models$1) {
|
|
2115
2115
|
return;
|
|
2116
2116
|
}
|
|
2117
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2117
|
+
const { models: SeedModels } = yield import('./seed.schema.config-CEyCY7bh.js');
|
|
2118
2118
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2119
2119
|
let hasModelsInDb = false;
|
|
2120
2120
|
const schemaDefsByModelName = new Map();
|
|
@@ -2314,6 +2314,50 @@ const validate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2314
2314
|
});
|
|
2315
2315
|
});
|
|
2316
2316
|
|
|
2317
|
+
/**
|
|
2318
|
+
* Waits for a file to exist at the specified path.
|
|
2319
|
+
* @param {string} filePath - The path of the file to check.
|
|
2320
|
+
* @param {number} interval - The interval in milliseconds between checks (default: 500ms).
|
|
2321
|
+
* @param {number} timeout - The timeout in milliseconds to wait for the file to exist (default: 10s).
|
|
2322
|
+
* @returns {Promise<boolean>} - Resolves to true if the file exists within the timeout period, otherwise false.
|
|
2323
|
+
*/
|
|
2324
|
+
const waitForFile = (filePath, interval = 500, timeout = 10000) => {
|
|
2325
|
+
return new Promise((resolve, reject) => {
|
|
2326
|
+
const startTime = Date.now();
|
|
2327
|
+
const _interval = setInterval(() => {
|
|
2328
|
+
if (fs.existsSync(filePath) && fsNode.existsSync(filePath)) {
|
|
2329
|
+
clearInterval(_interval);
|
|
2330
|
+
resolve(true);
|
|
2331
|
+
}
|
|
2332
|
+
if (Date.now() - startTime >= timeout) {
|
|
2333
|
+
clearInterval(_interval);
|
|
2334
|
+
reject(new Error('Timeout exceeded while waiting for file'));
|
|
2335
|
+
}
|
|
2336
|
+
}, interval);
|
|
2337
|
+
// retry(
|
|
2338
|
+
// {
|
|
2339
|
+
// times: Math.ceil(timeout / interval),
|
|
2340
|
+
// interval: interval,
|
|
2341
|
+
// },
|
|
2342
|
+
// (callback: Function) => {
|
|
2343
|
+
// if (fs.existsSync(filePath) && fsNode.existsSync(filePath)) {
|
|
2344
|
+
// return callback(null, true) // File exists, finish with success
|
|
2345
|
+
// }
|
|
2346
|
+
// if (Date.now() - startTime >= timeout) {
|
|
2347
|
+
// return callback(new Error('Timeout exceeded while waiting for file'))
|
|
2348
|
+
// }
|
|
2349
|
+
// callback(new Error('File does not exist yet')) // Retry with this error
|
|
2350
|
+
// },
|
|
2351
|
+
// (err: Error, result: boolean) => {
|
|
2352
|
+
// if (err) {
|
|
2353
|
+
// return resolve(false) // Resolve as false if timeout or error occurs
|
|
2354
|
+
// }
|
|
2355
|
+
// resolve(result) // Resolve as true if file exists
|
|
2356
|
+
// },
|
|
2357
|
+
// )
|
|
2358
|
+
});
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2317
2361
|
const logger$i = debug('app:services:db:actors:migrate');
|
|
2318
2362
|
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
2363
|
const rowsToReturnRaw = [];
|
|
@@ -2403,11 +2447,13 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2403
2447
|
console.log('journalExistsSync', journalExistsSync);
|
|
2404
2448
|
console.log('journalExistsSyncNode', journalExistsSyncNode);
|
|
2405
2449
|
if (!journalExists) {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2450
|
+
yield waitForFile(journalPath);
|
|
2451
|
+
// const handle = await navigator.storage.getDirectory()
|
|
2452
|
+
//
|
|
2453
|
+
// await configureSingle({
|
|
2454
|
+
// backend: WebAccess,
|
|
2455
|
+
// handle,
|
|
2456
|
+
// })
|
|
2411
2457
|
// window.location.reload()
|
|
2412
2458
|
// setTimeout(() => {
|
|
2413
2459
|
// _checkForFiles().then(() => {
|
|
@@ -2483,11 +2529,13 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2483
2529
|
catch (error) {
|
|
2484
2530
|
// console.error('Error migrating database: ', error)
|
|
2485
2531
|
// window.location.reload()
|
|
2486
|
-
const handle =
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2532
|
+
// const handle = await navigator.storage.getDirectory()
|
|
2533
|
+
//
|
|
2534
|
+
// await configureSingle({
|
|
2535
|
+
// backend: WebAccess,
|
|
2536
|
+
// handle,
|
|
2537
|
+
// })
|
|
2538
|
+
yield waitForFile(`${pathToDbDir}/meta/_journal.json`);
|
|
2491
2539
|
return _migrate();
|
|
2492
2540
|
}
|
|
2493
2541
|
setAppDb(drizzleDb);
|
|
@@ -6516,7 +6564,7 @@ const client = {
|
|
|
6516
6564
|
addresses,
|
|
6517
6565
|
arweaveDomain,
|
|
6518
6566
|
});
|
|
6519
|
-
import('./seed.schema.config-
|
|
6567
|
+
import('./seed.schema.config-CEyCY7bh.js').then(({ models }) => {
|
|
6520
6568
|
for (const [key, value] of Object.entries(models)) {
|
|
6521
6569
|
setModel(key, value);
|
|
6522
6570
|
}
|
|
@@ -7191,7 +7239,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
7191
7239
|
if (propertyRecordSchema &&
|
|
7192
7240
|
propertyRecordSchema.storageType &&
|
|
7193
7241
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
7194
|
-
const { Item } = yield import('./index-
|
|
7242
|
+
const { Item } = yield import('./index-Bj_ICJrP.js');
|
|
7195
7243
|
const item = yield Item.find({
|
|
7196
7244
|
seedLocalId,
|
|
7197
7245
|
modelName,
|
|
@@ -8133,4 +8181,4 @@ if (isNode()) {
|
|
|
8133
8181
|
}
|
|
8134
8182
|
|
|
8135
8183
|
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-
|
|
8184
|
+
//# sourceMappingURL=index-CQVtBXqn.js.map
|