@seedprotocol/sdk 0.1.16 → 0.1.17
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/bin.js +13 -13
- package/dist/{events-Coj2v7ep.js → events-CRCYmF7M.js} +350 -340
- package/dist/events-CRCYmF7M.js.map +1 -0
- package/dist/{index-DiVYILvi.js → index-DR_FgAUY.js} +16 -16
- package/dist/index-DR_FgAUY.js.map +1 -0
- package/dist/main.js +12 -12
- package/dist/{seed-CnyxDQnB.js → seed-BJPS_-pY.js} +17 -17
- package/dist/{seed-CnyxDQnB.js.map → seed-BJPS_-pY.js.map} +1 -1
- package/dist/{seed-D4FumM_8.js → seed-CjMH4SeR.js} +16 -16
- package/dist/{seed-D4FumM_8.js.map → seed-CjMH4SeR.js.map} +1 -1
- package/dist/{seed-Bqa5CPoS.js → seed-Dn2R3xbp.js} +2 -2
- package/dist/{seed-Bqa5CPoS.js.map → seed-Dn2R3xbp.js.map} +1 -1
- package/dist/{seed.schema.config-fpg0HLo5.js → seed.schema.config-GKCk8sOV.js} +6 -6
- package/dist/{seed.schema.config-fpg0HLo5.js.map → seed.schema.config-GKCk8sOV.js.map} +1 -1
- package/dist/types/src/browser/db/sqlWasmClient.d.ts +6 -0
- package/dist/types/src/browser/db/sqlWasmClient.d.ts.map +1 -0
- package/dist/types/src/browser/react/services.d.ts +1 -6
- package/dist/types/src/browser/react/services.d.ts.map +1 -1
- package/dist/types/src/browser/services/global/actors/initialize.d.ts +2 -0
- package/dist/types/src/browser/services/global/actors/initialize.d.ts.map +1 -0
- package/dist/types/src/browser/services/global/actors.d.ts +3 -3
- package/dist/types/src/browser/services/global/actors.d.ts.map +1 -1
- package/dist/types/src/browser/services/global/{machine.d.ts → globalMachine.d.ts} +1 -1
- package/dist/types/src/browser/services/global/globalMachine.d.ts.map +1 -0
- package/dist/types/src/browser/services/global/index.d.ts +1 -1
- package/dist/types/src/browser/services/global/index.d.ts.map +1 -1
- package/dist/types/src/browser/services/internal/actors/configureFs.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/configureFs.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/actors/loadAppDb.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/loadAppDb.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/actors/loadSdkDb.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/loadSdkDb.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/actors/loadSeedDb.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/loadSeedDb.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/actors/prepareDb.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/prepareDb.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/actors/saveConfig.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/saveConfig.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/actors/validateInput.d.ts +2 -0
- package/dist/types/src/browser/services/internal/actors/validateInput.d.ts.map +1 -0
- package/dist/types/src/browser/services/internal/{machine.d.ts → internalMachine.d.ts} +1 -1
- package/dist/types/src/browser/services/internal/internalMachine.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/machines.d.ts +3 -0
- package/dist/types/src/types/machines.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/events-Coj2v7ep.js.map +0 -1
- package/dist/index-DiVYILvi.js.map +0 -1
- package/dist/types/src/browser/services/global/machine.d.ts.map +0 -1
- package/dist/types/src/browser/services/internal/actors.d.ts +0 -10
- package/dist/types/src/browser/services/internal/actors.d.ts.map +0 -1
- package/dist/types/src/browser/services/internal/machine.d.ts.map +0 -1
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
import { useImmer } from 'use-immer';
|
|
2
|
-
import { sql, count, max, eq, and, or, isNull, relations } from 'drizzle-orm';
|
|
3
|
-
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
4
|
-
import debug from 'debug';
|
|
5
1
|
import { fromCallback, setup, assign, createActor, waitFor, emit } from 'xstate';
|
|
6
|
-
import { BehaviorSubject } from 'rxjs';
|
|
7
|
-
import { fs, configureSingle } from '@zenfs/core';
|
|
8
|
-
import { startCase, debounce, camelCase, orderBy } from 'lodash-es';
|
|
9
|
-
import { immerable, produce } from 'immer';
|
|
10
|
-
import pluralize from 'pluralize';
|
|
11
|
-
import { useSelector } from '@xstate/react';
|
|
12
2
|
import { createBrowserInspector } from '@statelyai/inspect';
|
|
13
|
-
import '
|
|
14
|
-
import {
|
|
15
|
-
import Arweave from 'arweave';
|
|
16
|
-
import { WebAccess } from '@zenfs/dom';
|
|
3
|
+
import { fs, configureSingle } from '@zenfs/core';
|
|
4
|
+
import { sql, count, max, eq, and, or, isNull, relations } from 'drizzle-orm';
|
|
17
5
|
import { drizzle } from 'drizzle-orm/sqlite-proxy';
|
|
6
|
+
import debug from 'debug';
|
|
18
7
|
import { QueryClient } from '@tanstack/react-query';
|
|
19
8
|
import { GraphQLClient } from 'graphql-request';
|
|
20
9
|
import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister';
|
|
@@ -24,6 +13,17 @@ import { sqliteTable, text, int, blob, check, unique } from 'drizzle-orm/sqlite-
|
|
|
24
13
|
import 'dayjs';
|
|
25
14
|
import { customAlphabet } from 'nanoid';
|
|
26
15
|
import * as nanoIdDictionary from 'nanoid-dictionary';
|
|
16
|
+
import { WebAccess } from '@zenfs/dom';
|
|
17
|
+
import Arweave from 'arweave';
|
|
18
|
+
import { startCase, debounce, camelCase, orderBy } from 'lodash-es';
|
|
19
|
+
import pluralize from 'pluralize';
|
|
20
|
+
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
21
|
+
import { BehaviorSubject } from 'rxjs';
|
|
22
|
+
import { immerable, produce } from 'immer';
|
|
23
|
+
import { useImmer } from 'use-immer';
|
|
24
|
+
import { useSelector } from '@xstate/react';
|
|
25
|
+
import 'reflect-metadata';
|
|
26
|
+
import { Type } from '@sinclair/typebox';
|
|
27
27
|
import EventEmitter from 'eventemitter3';
|
|
28
28
|
|
|
29
29
|
const isNode = () => {
|
|
@@ -172,12 +172,12 @@ const EAS_ENDPOINT = process.env.NEXT_PUBLIC_EAS_ENDPOINT ||
|
|
|
172
172
|
const ARWEAVE_HOST = process.env.NEXT_PUBLIC_ARWEAVE_HOST || 'permagate.io';
|
|
173
173
|
|
|
174
174
|
let sqlite3InitModule;
|
|
175
|
-
let sqliteWasmClient$
|
|
175
|
+
let sqliteWasmClient$1;
|
|
176
176
|
let isPreparing = false;
|
|
177
177
|
|
|
178
178
|
const getSqlite = async () => {
|
|
179
|
-
if (sqliteWasmClient$
|
|
180
|
-
return sqliteWasmClient$
|
|
179
|
+
if (sqliteWasmClient$1) {
|
|
180
|
+
return sqliteWasmClient$1
|
|
181
181
|
}
|
|
182
182
|
if (typeof window === 'undefined') {
|
|
183
183
|
throw new Error('validateInput called from non-browser context')
|
|
@@ -204,7 +204,7 @@ const getSqlite = async () => {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
try {
|
|
207
|
-
sqliteWasmClient$
|
|
207
|
+
sqliteWasmClient$1 = await window.sqlite3Worker1Promiser.v2().catch((err) => {
|
|
208
208
|
console.error('Error initializing sqliteWasmClient:', err);
|
|
209
209
|
isPreparing = false;
|
|
210
210
|
});
|
|
@@ -214,14 +214,14 @@ const getSqlite = async () => {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
const logger$
|
|
217
|
+
const logger$k = debug('app:db:actors');
|
|
218
218
|
let seedDb;
|
|
219
219
|
let appDb;
|
|
220
220
|
let sdkConfigDb;
|
|
221
|
-
let sqliteWasmClient
|
|
221
|
+
let sqliteWasmClient;
|
|
222
222
|
const checkStatus = fromCallback(({ sendBack, input: { context } }) => {
|
|
223
223
|
const { dbName, dirName } = context;
|
|
224
|
-
logger$
|
|
224
|
+
logger$k('[db/actors] checkStatus context', context);
|
|
225
225
|
const pathToDir = `${BROWSER_FS_TOP_DIR}/${dirName}`;
|
|
226
226
|
const pathToDbDir = `${pathToDir}/db`;
|
|
227
227
|
const pathToDb = `${pathToDbDir}/${dbName}.sqlite3`;
|
|
@@ -252,7 +252,7 @@ const checkStatus = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
const connectToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
255
|
-
logger$
|
|
255
|
+
logger$k('[db/actors] connectToDb context', context);
|
|
256
256
|
const { dbName, pathToDir } = context;
|
|
257
257
|
let isConnecting = false;
|
|
258
258
|
let dbId;
|
|
@@ -262,21 +262,21 @@ const connectToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
262
262
|
}
|
|
263
263
|
isConnecting = true;
|
|
264
264
|
let response;
|
|
265
|
-
if (!sqliteWasmClient
|
|
266
|
-
sqliteWasmClient
|
|
265
|
+
if (!sqliteWasmClient) {
|
|
266
|
+
sqliteWasmClient = yield getSqlite();
|
|
267
267
|
}
|
|
268
268
|
//@ts-ignore
|
|
269
|
-
response = yield sqliteWasmClient
|
|
270
|
-
logger$
|
|
271
|
-
logger$
|
|
269
|
+
response = yield sqliteWasmClient('config-get', {});
|
|
270
|
+
logger$k(response);
|
|
271
|
+
logger$k('Running SQLite3 version', response.result.version.libVersion);
|
|
272
272
|
//@ts-ignore
|
|
273
|
-
response = yield sqliteWasmClient
|
|
273
|
+
response = yield sqliteWasmClient('open', {
|
|
274
274
|
filename: `file:${pathToDir}/db/${dbName}.sqlite3?vfs=opfs`,
|
|
275
275
|
});
|
|
276
|
-
logger$
|
|
276
|
+
logger$k(response);
|
|
277
277
|
dbId = response.dbId;
|
|
278
278
|
// logger(`dbId: ${dbId}`)
|
|
279
|
-
logger$
|
|
279
|
+
logger$k('OPFS is available, created persisted database at', response.result.filename.replace(/^file:(.*?)\?vfs=opfs$/, '$1'));
|
|
280
280
|
});
|
|
281
281
|
const interval = setInterval(() => {
|
|
282
282
|
// TODO: Add a timeout
|
|
@@ -396,12 +396,12 @@ const dbExec = (dbId_1, params_1, sql_1, dbName_1, ...args_1) => __awaiter(void
|
|
|
396
396
|
});
|
|
397
397
|
const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
398
398
|
const { pathToDbDir, dirName, dbId, dbName } = context;
|
|
399
|
-
logger$
|
|
399
|
+
logger$k('[db/actors] migrate context', context);
|
|
400
400
|
const schemaGlobString = `${BROWSER_FS_TOP_DIR}/${dirName}/schema/*`;
|
|
401
401
|
const isSeedDb = dbName === DB_NAME_SEED;
|
|
402
402
|
const isAppDb = dbName === DB_NAME_APP;
|
|
403
403
|
const isSdkConfigDb = dbName === DB_NAME_SDK_CONFIG;
|
|
404
|
-
if (!sqliteWasmClient
|
|
404
|
+
if (!sqliteWasmClient) {
|
|
405
405
|
throw new Error('Sqlite wasm client not initialized');
|
|
406
406
|
}
|
|
407
407
|
let journalExists = false;
|
|
@@ -676,7 +676,7 @@ const initialize$3 = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
676
676
|
}
|
|
677
677
|
});
|
|
678
678
|
|
|
679
|
-
const logger$
|
|
679
|
+
const logger$j = debug('app:shared:helpers');
|
|
680
680
|
const { alphanumeric } = nanoIdDictionary;
|
|
681
681
|
const generateId = () => {
|
|
682
682
|
return customAlphabet(alphanumeric, 10)();
|
|
@@ -739,7 +739,7 @@ const convertTxIdToImageSrc = (txId) => __awaiter(void 0, void 0, void 0, functi
|
|
|
739
739
|
const imageFilePath = `/files/images/${txId}`;
|
|
740
740
|
const fileExists = yield fs.promises.exists(imageFilePath);
|
|
741
741
|
if (!fileExists) {
|
|
742
|
-
logger$
|
|
742
|
+
logger$j(`[ItemView] [updateImageSrc] ${imageFilePath} does not exist`);
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
745
|
const uint = yield fs.promises.readFile(imageFilePath);
|
|
@@ -1518,7 +1518,7 @@ const getAddressesFromDb = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
1518
1518
|
return JSON.parse(addressArrayString);
|
|
1519
1519
|
});
|
|
1520
1520
|
|
|
1521
|
-
const logger$
|
|
1521
|
+
const logger$i = debug('app:property:actors:hydrateFromDb');
|
|
1522
1522
|
const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
1523
1523
|
const { seedUid, seedLocalId, propertyName: propertyNameRaw, propertyValue, propertyRecordSchema, itemModelName, } = context;
|
|
1524
1524
|
let propertyName = propertyNameRaw;
|
|
@@ -1586,23 +1586,23 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1586
1586
|
const firstRow = rows[0];
|
|
1587
1587
|
const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, refResolvedValue, refResolvedDisplayValue, } = firstRow;
|
|
1588
1588
|
if (propertyName && !propertyNameFromDb) {
|
|
1589
|
-
logger$
|
|
1589
|
+
logger$i(`Property name from code is ${propertyName} but has not value in db ${propertyNameFromDb} for Property.${localId}`);
|
|
1590
1590
|
}
|
|
1591
1591
|
if (propertyName &&
|
|
1592
1592
|
propertyNameFromDb &&
|
|
1593
1593
|
!propertyNameFromDb.includes(propertyName) &&
|
|
1594
1594
|
!propertyName.includes(propertyNameFromDb) &&
|
|
1595
1595
|
propertyNameFromDb !== propertyName) {
|
|
1596
|
-
logger$
|
|
1596
|
+
logger$i(`Property name from db ${propertyNameFromDb} does not match property name ${propertyName} for Property.${localId}`);
|
|
1597
1597
|
}
|
|
1598
1598
|
if (propertyValue && propertyValueFromDb !== propertyValue) {
|
|
1599
|
-
logger$
|
|
1599
|
+
logger$i(`Property value from db ${propertyValueFromDb} does not match property value ${propertyValue} for Property.${localId}`);
|
|
1600
1600
|
}
|
|
1601
1601
|
if (seedLocalIdFromDb !== seedLocalId) {
|
|
1602
|
-
logger$
|
|
1602
|
+
logger$i(`Seed local id from db ${seedLocalIdFromDb} does not match seed local id ${seedLocalId} for Property.${localId}`);
|
|
1603
1603
|
}
|
|
1604
1604
|
if (seedUidFromDb !== seedUid) {
|
|
1605
|
-
logger$
|
|
1605
|
+
logger$i(`Seed uid from db ${seedUidFromDb} does not match seed uid ${seedUid} for Property.${localId}`);
|
|
1606
1606
|
}
|
|
1607
1607
|
sendBack({
|
|
1608
1608
|
type: 'updateContext',
|
|
@@ -1617,7 +1617,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1617
1617
|
renderValue: refResolvedDisplayValue,
|
|
1618
1618
|
});
|
|
1619
1619
|
if (propertyNameFromDb === 'storageTransactionId') {
|
|
1620
|
-
const { Item } = yield import('./index-
|
|
1620
|
+
const { Item } = yield import('./index-DR_FgAUY.js');
|
|
1621
1621
|
const item = yield Item.find({
|
|
1622
1622
|
seedLocalId,
|
|
1623
1623
|
modelName: itemModelName,
|
|
@@ -1635,7 +1635,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1635
1635
|
const renderValue = yield fs.promises
|
|
1636
1636
|
.readFile(htmlFilePath, 'utf8')
|
|
1637
1637
|
.catch((error) => {
|
|
1638
|
-
logger$
|
|
1638
|
+
logger$i('Error reading html file', error);
|
|
1639
1639
|
});
|
|
1640
1640
|
property
|
|
1641
1641
|
.getService()
|
|
@@ -1716,7 +1716,7 @@ const getVersionData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seed
|
|
|
1716
1716
|
|
|
1717
1717
|
const eventEmitter = new EventEmitter();
|
|
1718
1718
|
|
|
1719
|
-
const logger$
|
|
1719
|
+
const logger$h = debug('app:write');
|
|
1720
1720
|
const sendItemUpdateEvent = ({ modelName, seedLocalId, seedUid }) => {
|
|
1721
1721
|
if (!modelName || (!seedLocalId && !seedUid)) {
|
|
1722
1722
|
return;
|
|
@@ -1794,7 +1794,7 @@ const deleteItem = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seedLoca
|
|
|
1794
1794
|
});
|
|
1795
1795
|
const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({ propertyLocalId, propertyName, newValue, seedUid, seedLocalId, modelName, refSeedType, refResolvedValue, refResolvedDisplayValue, versionLocalId, versionUid, schemaUid, }) {
|
|
1796
1796
|
if (!propertyLocalId && !seedLocalId) {
|
|
1797
|
-
logger$
|
|
1797
|
+
logger$h(`[db/write] [updateItemPropertyValue] no propertyLocalId or seedLocalId for property: ${propertyName}`);
|
|
1798
1798
|
return;
|
|
1799
1799
|
}
|
|
1800
1800
|
let safeNewValue = newValue;
|
|
@@ -1833,7 +1833,7 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
1833
1833
|
const schemaUid = mostRecentRecord[9];
|
|
1834
1834
|
const easDataType = mostRecentRecord[10];
|
|
1835
1835
|
if (propertyValueFromDb === newValue) {
|
|
1836
|
-
logger$
|
|
1836
|
+
logger$h(`[db/write] [updateItemPropertyValue] value is the same as most recent record for property: ${propertyNameFromDb}`);
|
|
1837
1837
|
return;
|
|
1838
1838
|
}
|
|
1839
1839
|
// This means we already have a local-only record so we should just update that one
|
|
@@ -2248,7 +2248,7 @@ const setModel = (modelName, model) => {
|
|
|
2248
2248
|
};
|
|
2249
2249
|
|
|
2250
2250
|
var _a$1;
|
|
2251
|
-
const logger$
|
|
2251
|
+
const logger$g = debug('app:property:class');
|
|
2252
2252
|
const namesThatEndWithId = [];
|
|
2253
2253
|
class ItemProperty {
|
|
2254
2254
|
// private constructor(localIdOrUid) {
|
|
@@ -2296,7 +2296,7 @@ class ItemProperty {
|
|
|
2296
2296
|
serviceInput.propertyValue = JSON.parse(propertyValue);
|
|
2297
2297
|
}
|
|
2298
2298
|
catch (e) {
|
|
2299
|
-
logger$
|
|
2299
|
+
logger$g('List property value is not JSON', e);
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
2302
|
const propertyNameSingular = pluralize(propertyName, 1);
|
|
@@ -2358,7 +2358,7 @@ class ItemProperty {
|
|
|
2358
2358
|
this._service.start();
|
|
2359
2359
|
}
|
|
2360
2360
|
_updateResponseListener(event) {
|
|
2361
|
-
logger$
|
|
2361
|
+
logger$g(`[ItemProperty] [_updateResponseListener] [${this.itemModelName}.${this.seedLocalId}] ${this.propertyName} event`, event);
|
|
2362
2362
|
}
|
|
2363
2363
|
static create(props) {
|
|
2364
2364
|
const { propertyName, seedLocalId, uid } = props;
|
|
@@ -2494,7 +2494,7 @@ class ItemProperty {
|
|
|
2494
2494
|
}
|
|
2495
2495
|
unload() {
|
|
2496
2496
|
this._service.stop();
|
|
2497
|
-
logger$
|
|
2497
|
+
logger$g(`[XXXXXX] [ItemProperty] [${this.seedLocalId}] [unload] removing listener`, this._updateResponseEvent);
|
|
2498
2498
|
eventEmitter.removeListener(this._updateResponseEvent, this._updateResponseListener);
|
|
2499
2499
|
}
|
|
2500
2500
|
}
|
|
@@ -3783,7 +3783,7 @@ const getPropertiesForSeed = (seedLocalId, seedUid) => __awaiter(void 0, void 0,
|
|
|
3783
3783
|
return propertiesData;
|
|
3784
3784
|
});
|
|
3785
3785
|
|
|
3786
|
-
const logger$
|
|
3786
|
+
const logger$f = debug('app:db:queries:getItem');
|
|
3787
3787
|
const getItemDataFromDb = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelName, seedLocalId, seedUid, }) {
|
|
3788
3788
|
if (!seedLocalId && !seedUid) {
|
|
3789
3789
|
throw new Error('[db/queries] [getItem] no seedLocalId or seedUid');
|
|
@@ -3791,7 +3791,7 @@ const getItemDataFromDb = (_a) => __awaiter(void 0, [_a], void 0, function* ({ m
|
|
|
3791
3791
|
if (seedUid && !seedLocalId) {
|
|
3792
3792
|
const seedData = yield getSeedData({ seedUid });
|
|
3793
3793
|
if (!seedData) {
|
|
3794
|
-
logger$
|
|
3794
|
+
logger$f('[db/queries] [getItem] no seedData seedUid', seedUid);
|
|
3795
3795
|
return;
|
|
3796
3796
|
}
|
|
3797
3797
|
seedLocalId = seedData.localId;
|
|
@@ -4219,7 +4219,7 @@ const fetchDbData = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
4219
4219
|
return () => { };
|
|
4220
4220
|
});
|
|
4221
4221
|
|
|
4222
|
-
const logger$
|
|
4222
|
+
const logger$e = debug('app:allItemsActors:fetchSeeds');
|
|
4223
4223
|
const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
|
|
4224
4224
|
const { queryVariables, modelName } = context;
|
|
4225
4225
|
if (!queryVariables) {
|
|
@@ -4229,7 +4229,7 @@ const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
4229
4229
|
const _fetchSeeds = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4230
4230
|
const queryKey = [`getSeeds${modelName}`];
|
|
4231
4231
|
const cachedResults = queryClient.getQueryData(queryKey);
|
|
4232
|
-
logger$
|
|
4232
|
+
logger$e(`[allItemsActors] [fetchSeeds] cachedResults ${Date.now()}`, cachedResults);
|
|
4233
4233
|
const results = yield queryClient.fetchQuery({
|
|
4234
4234
|
queryKey,
|
|
4235
4235
|
queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient.request(GET_SEEDS, queryVariables); }),
|
|
@@ -4800,7 +4800,7 @@ const getArweave = () => {
|
|
|
4800
4800
|
});
|
|
4801
4801
|
};
|
|
4802
4802
|
|
|
4803
|
-
const logger$
|
|
4803
|
+
const logger$d = debug('app:react:db');
|
|
4804
4804
|
const useDbsAreReady = () => {
|
|
4805
4805
|
const [dbsAreReady, setDbsAreReady] = useState(false);
|
|
4806
4806
|
const update = useCallback(() => {
|
|
@@ -4816,7 +4816,7 @@ const useDbsAreReady = () => {
|
|
|
4816
4816
|
const globalService = getGlobalService();
|
|
4817
4817
|
const internalService = globalService.getSnapshot().context.internalService;
|
|
4818
4818
|
if (!internalService) {
|
|
4819
|
-
logger$
|
|
4819
|
+
logger$d('[useDbsAreReady] [useEffect] no internalService');
|
|
4820
4820
|
globalSubscription = globalService.subscribe(({ context }) => {
|
|
4821
4821
|
if (!internalSubscription && context && context.internalService) {
|
|
4822
4822
|
globalSubscription === null || globalSubscription === void 0 ? void 0 : globalSubscription.unsubscribe();
|
|
@@ -4990,7 +4990,7 @@ const useGlobalServiceStatus = () => {
|
|
|
4990
4990
|
};
|
|
4991
4991
|
};
|
|
4992
4992
|
|
|
4993
|
-
const logger$
|
|
4993
|
+
const logger$c = debug('app:react:item');
|
|
4994
4994
|
const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
4995
4995
|
const [item, setItem] = useImmer(undefined);
|
|
4996
4996
|
const [itemSubscription, setItemSubscription] = useState();
|
|
@@ -5013,7 +5013,7 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
|
5013
5013
|
seedUid,
|
|
5014
5014
|
});
|
|
5015
5015
|
if (!foundItem) {
|
|
5016
|
-
logger$
|
|
5016
|
+
logger$c('[useItem] [getItemFromDb] no item found', modelName, seedLocalId);
|
|
5017
5017
|
return;
|
|
5018
5018
|
}
|
|
5019
5019
|
updateItem(foundItem);
|
|
@@ -5029,7 +5029,7 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
|
5029
5029
|
const subscription = item.subscribe((_) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5030
5030
|
const newItem = yield Item.find({ modelName, seedLocalId, seedUid });
|
|
5031
5031
|
if (!newItem) {
|
|
5032
|
-
logger$
|
|
5032
|
+
logger$c('[useItem] [itemSubscription] no item found', modelName, seedLocalId);
|
|
5033
5033
|
return;
|
|
5034
5034
|
}
|
|
5035
5035
|
setItem(() => newItem);
|
|
@@ -5157,7 +5157,7 @@ const useDeleteItem = () => {
|
|
|
5157
5157
|
};
|
|
5158
5158
|
};
|
|
5159
5159
|
|
|
5160
|
-
const logger$
|
|
5160
|
+
const logger$b = debug('app:react:property');
|
|
5161
5161
|
const useItemProperty = (propertyName, seedLocalId) => {
|
|
5162
5162
|
const [property, setProperty] = useImmer(undefined);
|
|
5163
5163
|
const [isReadingFromDb, setIsReadingFromDb] = useState(false);
|
|
@@ -5183,7 +5183,7 @@ const useItemProperty = (propertyName, seedLocalId) => {
|
|
|
5183
5183
|
const foundProperty = yield ItemProperty.find({ propertyName, seedLocalId });
|
|
5184
5184
|
setIsReadingFromDb(false);
|
|
5185
5185
|
if (!foundProperty) {
|
|
5186
|
-
logger$
|
|
5186
|
+
logger$b(`[useItemPropertyTest] [readFromDb] no property found for Item.${seedLocalId}.${propertyName}`);
|
|
5187
5187
|
return;
|
|
5188
5188
|
}
|
|
5189
5189
|
setProperty(() => foundProperty);
|
|
@@ -5234,52 +5234,7 @@ const useItemProperties = (item) => {
|
|
|
5234
5234
|
};
|
|
5235
5235
|
};
|
|
5236
5236
|
|
|
5237
|
-
const logger$
|
|
5238
|
-
const initialize = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
5239
|
-
const { internalService, models, endpoints } = context;
|
|
5240
|
-
const { addresses } = event;
|
|
5241
|
-
let environment = 'browser';
|
|
5242
|
-
if (isNode()) {
|
|
5243
|
-
environment = 'node';
|
|
5244
|
-
}
|
|
5245
|
-
if (isReactNative()) {
|
|
5246
|
-
environment = 'react-native';
|
|
5247
|
-
}
|
|
5248
|
-
let internalSubscription;
|
|
5249
|
-
if (environment === 'browser' && models) {
|
|
5250
|
-
const _initFileSystem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5251
|
-
return;
|
|
5252
|
-
// return new Promise((resolve) => {
|
|
5253
|
-
// })
|
|
5254
|
-
});
|
|
5255
|
-
const _initInternal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5256
|
-
return new Promise((resolve) => {
|
|
5257
|
-
internalSubscription = internalService.subscribe((snapshot) => {
|
|
5258
|
-
logger$6('[sdk] [internal] snapshot', snapshot);
|
|
5259
|
-
if (snapshot.value === 'ready') {
|
|
5260
|
-
resolve();
|
|
5261
|
-
}
|
|
5262
|
-
});
|
|
5263
|
-
internalService.send({ type: 'init', endpoints, addresses });
|
|
5264
|
-
});
|
|
5265
|
-
});
|
|
5266
|
-
_initFileSystem().then(() => {
|
|
5267
|
-
logger$6('[global/actors] File system initialized');
|
|
5268
|
-
});
|
|
5269
|
-
_initInternal().then(() => {
|
|
5270
|
-
logger$6('[global/actors] Internal initialized');
|
|
5271
|
-
sendBack({ type: GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY });
|
|
5272
|
-
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
5273
|
-
});
|
|
5274
|
-
// _initEas().then(() => {
|
|
5275
|
-
// logger('EAS initialized')
|
|
5276
|
-
// })
|
|
5277
|
-
}
|
|
5278
|
-
sendBack({ type: GLOBAL_INITIALIZING_SEND_CONFIG, environment });
|
|
5279
|
-
return () => {
|
|
5280
|
-
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
5281
|
-
};
|
|
5282
|
-
});
|
|
5237
|
+
const logger$a = debug('app:global:actors');
|
|
5283
5238
|
const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
5284
5239
|
const { models: models$1 } = context;
|
|
5285
5240
|
const _addModelsToDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -5288,12 +5243,12 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5288
5243
|
if (!models$1) {
|
|
5289
5244
|
return;
|
|
5290
5245
|
}
|
|
5291
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
5246
|
+
const { models: SeedModels } = yield import('./seed.schema.config-GKCk8sOV.js');
|
|
5292
5247
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
5293
5248
|
let hasModelsInDb = false;
|
|
5294
5249
|
const schemaDefsByModelName = new Map();
|
|
5295
5250
|
for (const [modelName, _] of Object.entries(allModels)) {
|
|
5296
|
-
logger$
|
|
5251
|
+
logger$a('[helpers/db] [addModelsToInternalDb] starting modelName:', modelName);
|
|
5297
5252
|
let foundModel;
|
|
5298
5253
|
const foundModelsQuery = yield sdkConfigDb
|
|
5299
5254
|
.select()
|
|
@@ -5303,7 +5258,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5303
5258
|
yield sdkConfigDb.insert(models).values({
|
|
5304
5259
|
name: modelName,
|
|
5305
5260
|
});
|
|
5306
|
-
logger$
|
|
5261
|
+
logger$a('[global/actors] [addModelsToDb] inserted model:', modelName);
|
|
5307
5262
|
const foundModels = yield sdkConfigDb
|
|
5308
5263
|
.select({
|
|
5309
5264
|
id: models.id,
|
|
@@ -5387,11 +5342,186 @@ const getSchemaForModel = fromCallback(({ sendBack, input: { context, event } })
|
|
|
5387
5342
|
if (!model) {
|
|
5388
5343
|
throw new Error(`Model ${modelName} not found`);
|
|
5389
5344
|
}
|
|
5390
|
-
logger$
|
|
5345
|
+
logger$a('[service/actor] [getSchemaForModel] model:', model);
|
|
5391
5346
|
sendBack({ type: 'schemaForModel', schema: model.schema });
|
|
5392
5347
|
return () => { };
|
|
5393
5348
|
});
|
|
5394
5349
|
|
|
5350
|
+
const logger$9 = debug('app:services:db:machine');
|
|
5351
|
+
const { CHECKING_STATUS, VALIDATING, WAITING_FOR_FILES, CONNECTING_TO_DB, MIGRATING, } = DbState;
|
|
5352
|
+
const dbMachine = setup({
|
|
5353
|
+
types: {
|
|
5354
|
+
context: {},
|
|
5355
|
+
input: {},
|
|
5356
|
+
},
|
|
5357
|
+
actors: {
|
|
5358
|
+
checkStatus,
|
|
5359
|
+
validate,
|
|
5360
|
+
connectToDb,
|
|
5361
|
+
migrate,
|
|
5362
|
+
},
|
|
5363
|
+
}).createMachine({
|
|
5364
|
+
id: MachineIds.DB,
|
|
5365
|
+
initial: CHECKING_STATUS,
|
|
5366
|
+
context: ({ input }) => input,
|
|
5367
|
+
on: {
|
|
5368
|
+
[DB_WAITING_FOR_FILES_RECEIVED]: {
|
|
5369
|
+
actions: assign({
|
|
5370
|
+
hasFiles: ({ event }) => {
|
|
5371
|
+
logger$9('[db/machine] DB_WAITING_FOR_FILES_RECEIVED event:', event);
|
|
5372
|
+
return true;
|
|
5373
|
+
},
|
|
5374
|
+
}),
|
|
5375
|
+
},
|
|
5376
|
+
updateHasFiles: {
|
|
5377
|
+
target: `.${CHECKING_STATUS}`,
|
|
5378
|
+
actions: assign({
|
|
5379
|
+
hasFiles: ({ context, event }) => {
|
|
5380
|
+
logger$9('[db/machine] updateHasFiles event:', event);
|
|
5381
|
+
logger$9('[db/machine] updateHasFiles context:', context);
|
|
5382
|
+
return event.hasFiles;
|
|
5383
|
+
},
|
|
5384
|
+
}),
|
|
5385
|
+
},
|
|
5386
|
+
},
|
|
5387
|
+
// always: {
|
|
5388
|
+
// target: `.${CHECKING_STATUS}`,
|
|
5389
|
+
// guard: ({ context, event }) => context.hasFiles && event.type === 'updateHasFiles',
|
|
5390
|
+
// },
|
|
5391
|
+
states: {
|
|
5392
|
+
idle: {
|
|
5393
|
+
on: {
|
|
5394
|
+
start: CHECKING_STATUS,
|
|
5395
|
+
},
|
|
5396
|
+
meta: {
|
|
5397
|
+
displayText: 'DB starting ...',
|
|
5398
|
+
percentComplete: 0,
|
|
5399
|
+
},
|
|
5400
|
+
},
|
|
5401
|
+
[CHECKING_STATUS]: {
|
|
5402
|
+
on: {
|
|
5403
|
+
[DB_CHECK_STATUS_UPDATE_PATHS]: {
|
|
5404
|
+
actions: assign({
|
|
5405
|
+
pathToDb: ({ event }) => event.pathToDb,
|
|
5406
|
+
pathToDir: ({ event }) => event.pathToDir,
|
|
5407
|
+
pathToDbDir: ({ event }) => event.pathToDbDir,
|
|
5408
|
+
}),
|
|
5409
|
+
},
|
|
5410
|
+
[DB_CHECK_STATUS_EXISTS]: CONNECTING_TO_DB,
|
|
5411
|
+
},
|
|
5412
|
+
invoke: {
|
|
5413
|
+
src: 'checkStatus',
|
|
5414
|
+
input: ({ context, event }) => ({ context, event }),
|
|
5415
|
+
},
|
|
5416
|
+
meta: {
|
|
5417
|
+
displayText: 'Checking DB status',
|
|
5418
|
+
percentComplete: 60,
|
|
5419
|
+
},
|
|
5420
|
+
},
|
|
5421
|
+
[CONNECTING_TO_DB]: {
|
|
5422
|
+
on: {
|
|
5423
|
+
[DB_CREATING_SUCCESS]: {
|
|
5424
|
+
target: VALIDATING,
|
|
5425
|
+
actions: assign({
|
|
5426
|
+
dbId: ({ event }) => event.dbId,
|
|
5427
|
+
}),
|
|
5428
|
+
},
|
|
5429
|
+
},
|
|
5430
|
+
invoke: {
|
|
5431
|
+
src: 'connectToDb',
|
|
5432
|
+
input: ({ context }) => ({ context }),
|
|
5433
|
+
},
|
|
5434
|
+
meta: {
|
|
5435
|
+
displayText: 'Connecting to local DB',
|
|
5436
|
+
percentComplete: 70,
|
|
5437
|
+
},
|
|
5438
|
+
},
|
|
5439
|
+
[VALIDATING]: {
|
|
5440
|
+
on: {
|
|
5441
|
+
[DB_VALIDATING_SUCCESS]: {
|
|
5442
|
+
target: MIGRATING,
|
|
5443
|
+
// guard: ({ context }) => context.hasFiles,
|
|
5444
|
+
},
|
|
5445
|
+
[DB_VALIDATING_WAIT]: {
|
|
5446
|
+
target: WAITING_FOR_FILES,
|
|
5447
|
+
// guard: ({ context }) => !context.hasFiles,
|
|
5448
|
+
},
|
|
5449
|
+
},
|
|
5450
|
+
invoke: {
|
|
5451
|
+
src: 'validate',
|
|
5452
|
+
input: ({ context }) => ({ context }),
|
|
5453
|
+
},
|
|
5454
|
+
meta: {
|
|
5455
|
+
displayText: 'Validating DB',
|
|
5456
|
+
percentComplete: 80,
|
|
5457
|
+
},
|
|
5458
|
+
},
|
|
5459
|
+
// Here we're waiting for migration and schema files to be downloaded
|
|
5460
|
+
[WAITING_FOR_FILES]: {
|
|
5461
|
+
on: {
|
|
5462
|
+
[DB_WAITING_FOR_FILES_RECEIVED]: {
|
|
5463
|
+
target: MIGRATING,
|
|
5464
|
+
actions: assign({
|
|
5465
|
+
hasFiles: true,
|
|
5466
|
+
}),
|
|
5467
|
+
},
|
|
5468
|
+
[DB_MIGRATING_SUCCESS]: 'ready',
|
|
5469
|
+
},
|
|
5470
|
+
entry: ({ context }) => {
|
|
5471
|
+
if (context.hasFiles) {
|
|
5472
|
+
emit({ type: DB_WAITING_FOR_FILES_RECEIVED });
|
|
5473
|
+
}
|
|
5474
|
+
},
|
|
5475
|
+
},
|
|
5476
|
+
[MIGRATING]: {
|
|
5477
|
+
on: {
|
|
5478
|
+
[DB_MIGRATING_WAIT]: WAITING_FOR_FILES,
|
|
5479
|
+
[DB_MIGRATING_SUCCESS]: {
|
|
5480
|
+
target: 'ready',
|
|
5481
|
+
},
|
|
5482
|
+
},
|
|
5483
|
+
invoke: {
|
|
5484
|
+
src: 'migrate',
|
|
5485
|
+
input: ({ context }) => ({ context }),
|
|
5486
|
+
},
|
|
5487
|
+
meta: {
|
|
5488
|
+
displayText: 'Migrating DB',
|
|
5489
|
+
percentComplete: 90,
|
|
5490
|
+
},
|
|
5491
|
+
},
|
|
5492
|
+
ready: {
|
|
5493
|
+
target: 'idle',
|
|
5494
|
+
meta: {
|
|
5495
|
+
displayText: 'Wrapping up the db ...',
|
|
5496
|
+
percentComplete: 100,
|
|
5497
|
+
},
|
|
5498
|
+
},
|
|
5499
|
+
},
|
|
5500
|
+
});
|
|
5501
|
+
|
|
5502
|
+
const validateInput = fromCallback(({ sendBack, input: { event } }) => {
|
|
5503
|
+
const { endpoints, addresses } = event;
|
|
5504
|
+
if (typeof window === 'undefined') {
|
|
5505
|
+
throw new Error('validateInput called from non-browser context');
|
|
5506
|
+
}
|
|
5507
|
+
if (!endpoints || !endpoints.filePaths || !endpoints.files) {
|
|
5508
|
+
throw new Error('validateInput called with invalid endpoints');
|
|
5509
|
+
}
|
|
5510
|
+
if (!addresses || !addresses.length) {
|
|
5511
|
+
throw new Error('validateInput called with invalid addresses');
|
|
5512
|
+
}
|
|
5513
|
+
const _validateInput = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5514
|
+
sendBack({
|
|
5515
|
+
type: INTERNAL_VALIDATING_INPUT_SUCCESS,
|
|
5516
|
+
endpoints,
|
|
5517
|
+
addresses,
|
|
5518
|
+
});
|
|
5519
|
+
});
|
|
5520
|
+
_validateInput().then(() => {
|
|
5521
|
+
return;
|
|
5522
|
+
});
|
|
5523
|
+
});
|
|
5524
|
+
|
|
5395
5525
|
class SqliteConnectionManager {
|
|
5396
5526
|
constructor(sqliteModule, idleTimeout = 300000) {
|
|
5397
5527
|
// Default idle timeout: 5 minutes
|
|
@@ -5441,7 +5571,35 @@ class SqliteConnectionManager {
|
|
|
5441
5571
|
}
|
|
5442
5572
|
}
|
|
5443
5573
|
|
|
5444
|
-
const
|
|
5574
|
+
const prepareDb = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
5575
|
+
let sqliteWasmClient;
|
|
5576
|
+
const _prepareDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5577
|
+
if (typeof window === 'undefined') {
|
|
5578
|
+
return;
|
|
5579
|
+
}
|
|
5580
|
+
sqliteWasmClient = yield getSqlite();
|
|
5581
|
+
});
|
|
5582
|
+
const interval = setInterval(() => {
|
|
5583
|
+
// TODO: Add a timeout
|
|
5584
|
+
// TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome
|
|
5585
|
+
if (sqliteWasmClient) {
|
|
5586
|
+
clearInterval(interval);
|
|
5587
|
+
const manager = new SqliteConnectionManager(sqliteWasmClient);
|
|
5588
|
+
sendBack({ type: 'prepareDbSuccess', manager });
|
|
5589
|
+
return;
|
|
5590
|
+
}
|
|
5591
|
+
_prepareDb().then(() => {
|
|
5592
|
+
return;
|
|
5593
|
+
});
|
|
5594
|
+
}, 200);
|
|
5595
|
+
return () => {
|
|
5596
|
+
if (interval) {
|
|
5597
|
+
clearInterval(interval);
|
|
5598
|
+
}
|
|
5599
|
+
};
|
|
5600
|
+
});
|
|
5601
|
+
|
|
5602
|
+
const logger$8 = debug('app:services:internal:helpers');
|
|
5445
5603
|
/**
|
|
5446
5604
|
* Recursively create directories if they don't exist.
|
|
5447
5605
|
* @param {string} dirPath - The directory path to create.
|
|
@@ -5517,7 +5675,7 @@ const downloadFile = (url, localFilePath) => __awaiter(void 0, void 0, void 0, f
|
|
|
5517
5675
|
if (JSON.stringify(error).includes('File exists')) {
|
|
5518
5676
|
yield fs.promises.readFile(localFilePath, 'utf-8');
|
|
5519
5677
|
}
|
|
5520
|
-
logger$
|
|
5678
|
+
logger$8(`[Error] Failed to download file from ${url}:`, error);
|
|
5521
5679
|
}
|
|
5522
5680
|
busy = false;
|
|
5523
5681
|
});
|
|
@@ -5555,10 +5713,10 @@ const syncDbFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ filePat
|
|
|
5555
5713
|
const fileList = yield fetchDirectory(filePaths);
|
|
5556
5714
|
yield fetchFilesRecursively(files, BROWSER_FS_TOP_DIR, fileList);
|
|
5557
5715
|
yield confirmFilesExist(fileList);
|
|
5558
|
-
logger$
|
|
5716
|
+
logger$8('[syncDbFiles] Files synced!');
|
|
5559
5717
|
});
|
|
5560
5718
|
|
|
5561
|
-
const logger$
|
|
5719
|
+
const logger$7 = debug('app:files:download');
|
|
5562
5720
|
const downloadAllFilesRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({ endpoints, eventId, }) {
|
|
5563
5721
|
yield syncDbFiles(endpoints);
|
|
5564
5722
|
eventEmitter.emit('fs.downloadAll.success', { eventId });
|
|
@@ -5628,7 +5786,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
5628
5786
|
try {
|
|
5629
5787
|
const res = yield fetch(`https://${ARWEAVE_HOST}/tx/${transactionId}/status`);
|
|
5630
5788
|
if (res.status !== 200) {
|
|
5631
|
-
logger$
|
|
5789
|
+
logger$7(`[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`);
|
|
5632
5790
|
excludedTransactions.add(transactionId);
|
|
5633
5791
|
yield writeAppState(seedDb, 'excludedTransactions', JSON.stringify(Array.from(excludedTransactions)));
|
|
5634
5792
|
continue;
|
|
@@ -5642,7 +5800,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
5642
5800
|
console.error(`[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`, error);
|
|
5643
5801
|
});
|
|
5644
5802
|
if (!dataString) {
|
|
5645
|
-
logger$
|
|
5803
|
+
logger$7(`[fetchAll/actors] [fetchAllBinaryData] transaction ${transactionId} data not found`);
|
|
5646
5804
|
}
|
|
5647
5805
|
let contentType = identifyString(dataString);
|
|
5648
5806
|
if (contentType !== 'json' &&
|
|
@@ -5650,7 +5808,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
5650
5808
|
contentType !== 'html') {
|
|
5651
5809
|
const possibleImageType = getImageDataType(dataString);
|
|
5652
5810
|
if (!possibleImageType) {
|
|
5653
|
-
logger$
|
|
5811
|
+
logger$7(`[fetchAll/actors] [fetchAllBinaryData] transaction ${transactionId} data not in expected format: ${possibleImageType}`);
|
|
5654
5812
|
continue;
|
|
5655
5813
|
}
|
|
5656
5814
|
contentType = possibleImageType;
|
|
@@ -5713,7 +5871,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
5713
5871
|
}
|
|
5714
5872
|
}
|
|
5715
5873
|
catch (error) {
|
|
5716
|
-
logger$
|
|
5874
|
+
logger$7(error);
|
|
5717
5875
|
}
|
|
5718
5876
|
}
|
|
5719
5877
|
});
|
|
@@ -5759,65 +5917,15 @@ const isFsInitialized = () => {
|
|
|
5759
5917
|
return isInitialized;
|
|
5760
5918
|
};
|
|
5761
5919
|
|
|
5762
|
-
const logger$
|
|
5763
|
-
let sqliteWasmClient;
|
|
5764
|
-
let manager;
|
|
5765
|
-
const validateInput = fromCallback(({ sendBack, input: { event } }) => {
|
|
5766
|
-
const { endpoints, addresses } = event;
|
|
5767
|
-
if (typeof window === 'undefined') {
|
|
5768
|
-
throw new Error('validateInput called from non-browser context');
|
|
5769
|
-
}
|
|
5770
|
-
if (!endpoints || !endpoints.filePaths || !endpoints.files) {
|
|
5771
|
-
throw new Error('validateInput called with invalid endpoints');
|
|
5772
|
-
}
|
|
5773
|
-
if (!addresses || !addresses.length) {
|
|
5774
|
-
throw new Error('validateInput called with invalid addresses');
|
|
5775
|
-
}
|
|
5776
|
-
const _validateInput = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5777
|
-
sendBack({
|
|
5778
|
-
type: INTERNAL_VALIDATING_INPUT_SUCCESS,
|
|
5779
|
-
endpoints,
|
|
5780
|
-
addresses,
|
|
5781
|
-
});
|
|
5782
|
-
});
|
|
5783
|
-
_validateInput().then(() => {
|
|
5784
|
-
return;
|
|
5785
|
-
});
|
|
5786
|
-
});
|
|
5787
|
-
const prepareDb = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
5788
|
-
const _prepareDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5789
|
-
if (typeof window === 'undefined') {
|
|
5790
|
-
return;
|
|
5791
|
-
}
|
|
5792
|
-
sqliteWasmClient = yield getSqlite();
|
|
5793
|
-
});
|
|
5794
|
-
const interval = setInterval(() => {
|
|
5795
|
-
// TODO: Add a timeout
|
|
5796
|
-
// TODO: Add a cancel token to the promise so we can prevent more loops starting while we're checking the successful outcome
|
|
5797
|
-
if (sqliteWasmClient) {
|
|
5798
|
-
clearInterval(interval);
|
|
5799
|
-
manager = new SqliteConnectionManager(sqliteWasmClient);
|
|
5800
|
-
sendBack({ type: 'prepareDbSuccess', manager });
|
|
5801
|
-
return;
|
|
5802
|
-
}
|
|
5803
|
-
_prepareDb().then(() => {
|
|
5804
|
-
return;
|
|
5805
|
-
});
|
|
5806
|
-
}, 500);
|
|
5807
|
-
return () => {
|
|
5808
|
-
if (interval) {
|
|
5809
|
-
clearInterval(interval);
|
|
5810
|
-
}
|
|
5811
|
-
};
|
|
5812
|
-
});
|
|
5920
|
+
const logger$6 = debug('app:internal:actors:configureFs');
|
|
5813
5921
|
const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
5814
5922
|
const { endpoints, seedDbService, appDbService, sdkDbService } = context;
|
|
5815
|
-
logger$
|
|
5923
|
+
logger$6('[internal/actors] [configureFs] Configuring FS');
|
|
5816
5924
|
const services = [seedDbService, appDbService, sdkDbService];
|
|
5817
5925
|
const _configureFs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5818
|
-
logger$
|
|
5819
|
-
logger$
|
|
5820
|
-
logger$
|
|
5926
|
+
logger$6('[internal/actors] [configureFs] calling _configureFs');
|
|
5927
|
+
logger$6('[internal/actors] [configureFs] areFsListenersReady:', areFsListenersReady());
|
|
5928
|
+
logger$6('[internal/actors] [configureFs] isFsInitialized:', isFsInitialized());
|
|
5821
5929
|
yield waitForEvent({
|
|
5822
5930
|
req: {
|
|
5823
5931
|
eventLabel: 'fs.downloadAll.request',
|
|
@@ -5849,7 +5957,7 @@ const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5849
5957
|
// }, 200)
|
|
5850
5958
|
// })
|
|
5851
5959
|
})));
|
|
5852
|
-
logger$
|
|
5960
|
+
logger$6('[internal/actors] [configureFs] fs configured!');
|
|
5853
5961
|
});
|
|
5854
5962
|
// Some of our dependencies use fs sync functions, which don't work with
|
|
5855
5963
|
// OPFS. ZenFS creates an async cache of all files so that the sync functions
|
|
@@ -5861,6 +5969,7 @@ const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5861
5969
|
});
|
|
5862
5970
|
return () => { };
|
|
5863
5971
|
});
|
|
5972
|
+
|
|
5864
5973
|
const loadSeedDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
5865
5974
|
const { seedDbService } = context;
|
|
5866
5975
|
if (seedDbService.getSnapshot().value === 'ready') {
|
|
@@ -5885,6 +5994,8 @@ const loadSeedDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5885
5994
|
}
|
|
5886
5995
|
};
|
|
5887
5996
|
});
|
|
5997
|
+
|
|
5998
|
+
const logger$5 = debug('app:services:internal:actors:saveConfig');
|
|
5888
5999
|
const saveConfig = fromCallback(({ sendBack, receive, input: { context } }) => {
|
|
5889
6000
|
if (typeof window === 'undefined') {
|
|
5890
6001
|
console.error('seedInitBrowser called from non-browser context');
|
|
@@ -5935,18 +6046,20 @@ const saveConfig = fromCallback(({ sendBack, receive, input: { context } }) => {
|
|
|
5935
6046
|
},
|
|
5936
6047
|
setWhere: sql `key = 'addresses'`,
|
|
5937
6048
|
});
|
|
5938
|
-
logger$
|
|
6049
|
+
logger$5('[sdk] [internal/actors] Should be done saving');
|
|
5939
6050
|
}
|
|
5940
6051
|
catch (error) {
|
|
5941
6052
|
console.error('Error saving config:', error);
|
|
5942
6053
|
}
|
|
5943
6054
|
});
|
|
5944
6055
|
_saveConfig().then(() => {
|
|
5945
|
-
logger$
|
|
6056
|
+
logger$5('[sdk] [internal/actors] Successfully saved config');
|
|
5946
6057
|
return sendBack({ type: INTERNAL_SAVING_CONFIG_SUCCESS });
|
|
5947
6058
|
});
|
|
5948
6059
|
return () => { };
|
|
5949
6060
|
});
|
|
6061
|
+
|
|
6062
|
+
const logger$4 = debug('app:services:internal:actors:loadAppDb');
|
|
5950
6063
|
const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
5951
6064
|
const { appDbService } = context;
|
|
5952
6065
|
let subscription;
|
|
@@ -5967,7 +6080,7 @@ const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5967
6080
|
});
|
|
5968
6081
|
_loadAppDb().then(() => {
|
|
5969
6082
|
sendBack({ type: INTERNAL_LOADING_APP_DB_SUCCESS });
|
|
5970
|
-
logger$
|
|
6083
|
+
logger$4('[sdk] [internal/actors] Successfully loaded app DB');
|
|
5971
6084
|
});
|
|
5972
6085
|
return () => {
|
|
5973
6086
|
if (subscription) {
|
|
@@ -5975,6 +6088,8 @@ const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5975
6088
|
}
|
|
5976
6089
|
};
|
|
5977
6090
|
});
|
|
6091
|
+
|
|
6092
|
+
const logger$3 = debug('app:internal:actors:loadSdkDb');
|
|
5978
6093
|
const loadSdkDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
5979
6094
|
const { sdkDbService } = context;
|
|
5980
6095
|
logger$3('[sdk] [internal/actors] Loading SDK DB');
|
|
@@ -6009,159 +6124,7 @@ const loadSdkDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
6009
6124
|
};
|
|
6010
6125
|
});
|
|
6011
6126
|
|
|
6012
|
-
const logger$2 = debug('app:services:
|
|
6013
|
-
const { CHECKING_STATUS, VALIDATING, WAITING_FOR_FILES, CONNECTING_TO_DB, MIGRATING, } = DbState;
|
|
6014
|
-
const dbMachine = setup({
|
|
6015
|
-
types: {
|
|
6016
|
-
context: {},
|
|
6017
|
-
input: {},
|
|
6018
|
-
},
|
|
6019
|
-
actors: {
|
|
6020
|
-
checkStatus,
|
|
6021
|
-
validate,
|
|
6022
|
-
connectToDb,
|
|
6023
|
-
migrate,
|
|
6024
|
-
},
|
|
6025
|
-
}).createMachine({
|
|
6026
|
-
id: MachineIds.DB,
|
|
6027
|
-
initial: CHECKING_STATUS,
|
|
6028
|
-
context: ({ input }) => input,
|
|
6029
|
-
on: {
|
|
6030
|
-
[DB_WAITING_FOR_FILES_RECEIVED]: {
|
|
6031
|
-
actions: assign({
|
|
6032
|
-
hasFiles: ({ event }) => {
|
|
6033
|
-
logger$2('[db/machine] DB_WAITING_FOR_FILES_RECEIVED event:', event);
|
|
6034
|
-
return true;
|
|
6035
|
-
},
|
|
6036
|
-
}),
|
|
6037
|
-
},
|
|
6038
|
-
updateHasFiles: {
|
|
6039
|
-
target: `.${CHECKING_STATUS}`,
|
|
6040
|
-
actions: assign({
|
|
6041
|
-
hasFiles: ({ context, event }) => {
|
|
6042
|
-
logger$2('[db/machine] updateHasFiles event:', event);
|
|
6043
|
-
logger$2('[db/machine] updateHasFiles context:', context);
|
|
6044
|
-
return event.hasFiles;
|
|
6045
|
-
},
|
|
6046
|
-
}),
|
|
6047
|
-
},
|
|
6048
|
-
},
|
|
6049
|
-
// always: {
|
|
6050
|
-
// target: `.${CHECKING_STATUS}`,
|
|
6051
|
-
// guard: ({ context, event }) => context.hasFiles && event.type === 'updateHasFiles',
|
|
6052
|
-
// },
|
|
6053
|
-
states: {
|
|
6054
|
-
idle: {
|
|
6055
|
-
on: {
|
|
6056
|
-
start: CHECKING_STATUS,
|
|
6057
|
-
},
|
|
6058
|
-
meta: {
|
|
6059
|
-
displayText: 'DB starting ...',
|
|
6060
|
-
percentComplete: 0,
|
|
6061
|
-
},
|
|
6062
|
-
},
|
|
6063
|
-
[CHECKING_STATUS]: {
|
|
6064
|
-
on: {
|
|
6065
|
-
[DB_CHECK_STATUS_UPDATE_PATHS]: {
|
|
6066
|
-
actions: assign({
|
|
6067
|
-
pathToDb: ({ event }) => event.pathToDb,
|
|
6068
|
-
pathToDir: ({ event }) => event.pathToDir,
|
|
6069
|
-
pathToDbDir: ({ event }) => event.pathToDbDir,
|
|
6070
|
-
}),
|
|
6071
|
-
},
|
|
6072
|
-
[DB_CHECK_STATUS_EXISTS]: CONNECTING_TO_DB,
|
|
6073
|
-
},
|
|
6074
|
-
invoke: {
|
|
6075
|
-
src: 'checkStatus',
|
|
6076
|
-
input: ({ context, event }) => ({ context, event }),
|
|
6077
|
-
},
|
|
6078
|
-
meta: {
|
|
6079
|
-
displayText: 'Checking DB status',
|
|
6080
|
-
percentComplete: 60,
|
|
6081
|
-
},
|
|
6082
|
-
},
|
|
6083
|
-
[CONNECTING_TO_DB]: {
|
|
6084
|
-
on: {
|
|
6085
|
-
[DB_CREATING_SUCCESS]: {
|
|
6086
|
-
target: VALIDATING,
|
|
6087
|
-
actions: assign({
|
|
6088
|
-
dbId: ({ event }) => event.dbId,
|
|
6089
|
-
}),
|
|
6090
|
-
},
|
|
6091
|
-
},
|
|
6092
|
-
invoke: {
|
|
6093
|
-
src: 'connectToDb',
|
|
6094
|
-
input: ({ context }) => ({ context }),
|
|
6095
|
-
},
|
|
6096
|
-
meta: {
|
|
6097
|
-
displayText: 'Connecting to local DB',
|
|
6098
|
-
percentComplete: 70,
|
|
6099
|
-
},
|
|
6100
|
-
},
|
|
6101
|
-
[VALIDATING]: {
|
|
6102
|
-
on: {
|
|
6103
|
-
[DB_VALIDATING_SUCCESS]: {
|
|
6104
|
-
target: MIGRATING,
|
|
6105
|
-
// guard: ({ context }) => context.hasFiles,
|
|
6106
|
-
},
|
|
6107
|
-
[DB_VALIDATING_WAIT]: {
|
|
6108
|
-
target: WAITING_FOR_FILES,
|
|
6109
|
-
// guard: ({ context }) => !context.hasFiles,
|
|
6110
|
-
},
|
|
6111
|
-
},
|
|
6112
|
-
invoke: {
|
|
6113
|
-
src: 'validate',
|
|
6114
|
-
input: ({ context }) => ({ context }),
|
|
6115
|
-
},
|
|
6116
|
-
meta: {
|
|
6117
|
-
displayText: 'Validating DB',
|
|
6118
|
-
percentComplete: 80,
|
|
6119
|
-
},
|
|
6120
|
-
},
|
|
6121
|
-
// Here we're waiting for migration and schema files to be downloaded
|
|
6122
|
-
[WAITING_FOR_FILES]: {
|
|
6123
|
-
on: {
|
|
6124
|
-
[DB_WAITING_FOR_FILES_RECEIVED]: {
|
|
6125
|
-
target: MIGRATING,
|
|
6126
|
-
actions: assign({
|
|
6127
|
-
hasFiles: true,
|
|
6128
|
-
}),
|
|
6129
|
-
},
|
|
6130
|
-
[DB_MIGRATING_SUCCESS]: 'ready',
|
|
6131
|
-
},
|
|
6132
|
-
entry: ({ context }) => {
|
|
6133
|
-
if (context.hasFiles) {
|
|
6134
|
-
emit({ type: DB_WAITING_FOR_FILES_RECEIVED });
|
|
6135
|
-
}
|
|
6136
|
-
},
|
|
6137
|
-
},
|
|
6138
|
-
[MIGRATING]: {
|
|
6139
|
-
on: {
|
|
6140
|
-
[DB_MIGRATING_WAIT]: WAITING_FOR_FILES,
|
|
6141
|
-
[DB_MIGRATING_SUCCESS]: {
|
|
6142
|
-
target: 'ready',
|
|
6143
|
-
},
|
|
6144
|
-
},
|
|
6145
|
-
invoke: {
|
|
6146
|
-
src: 'migrate',
|
|
6147
|
-
input: ({ context }) => ({ context }),
|
|
6148
|
-
},
|
|
6149
|
-
meta: {
|
|
6150
|
-
displayText: 'Migrating DB',
|
|
6151
|
-
percentComplete: 90,
|
|
6152
|
-
},
|
|
6153
|
-
},
|
|
6154
|
-
ready: {
|
|
6155
|
-
target: 'idle',
|
|
6156
|
-
meta: {
|
|
6157
|
-
displayText: 'Wrapping up the db ...',
|
|
6158
|
-
percentComplete: 100,
|
|
6159
|
-
},
|
|
6160
|
-
},
|
|
6161
|
-
},
|
|
6162
|
-
});
|
|
6163
|
-
|
|
6164
|
-
const logger$1 = debug('app:services:internal:machine');
|
|
6127
|
+
const logger$2 = debug('app:services:internal:machine');
|
|
6165
6128
|
createBrowserInspector({
|
|
6166
6129
|
autoStart: false,
|
|
6167
6130
|
});
|
|
@@ -6323,7 +6286,7 @@ const internalMachine = setup({
|
|
|
6323
6286
|
[INTERNAL_LOADING_APP_DB_SUCCESS]: {
|
|
6324
6287
|
target: 'appDbLoaded',
|
|
6325
6288
|
actions: () => {
|
|
6326
|
-
logger$
|
|
6289
|
+
logger$2('[sdk] [internal/index] App DB loaded!');
|
|
6327
6290
|
},
|
|
6328
6291
|
},
|
|
6329
6292
|
},
|
|
@@ -6335,7 +6298,7 @@ const internalMachine = setup({
|
|
|
6335
6298
|
appDbLoaded: {
|
|
6336
6299
|
type: 'final',
|
|
6337
6300
|
entry: () => {
|
|
6338
|
-
logger$
|
|
6301
|
+
logger$2('[sdk] [internal/index] Entered appDbLoaded!');
|
|
6339
6302
|
},
|
|
6340
6303
|
},
|
|
6341
6304
|
},
|
|
@@ -6348,7 +6311,7 @@ const internalMachine = setup({
|
|
|
6348
6311
|
[INTERNAL_LOADING_SDK_DB_SUCCESS]: {
|
|
6349
6312
|
target: 'sdkConfigDbLoaded',
|
|
6350
6313
|
actions: () => {
|
|
6351
|
-
logger$
|
|
6314
|
+
logger$2('[sdk] [internal/index] SDK Config DB loaded!');
|
|
6352
6315
|
},
|
|
6353
6316
|
},
|
|
6354
6317
|
},
|
|
@@ -6360,7 +6323,7 @@ const internalMachine = setup({
|
|
|
6360
6323
|
sdkConfigDbLoaded: {
|
|
6361
6324
|
type: 'final',
|
|
6362
6325
|
entry: () => {
|
|
6363
|
-
logger$
|
|
6326
|
+
logger$2('[sdk] [internal/index] Entered sdkConfigDbLoaded!');
|
|
6364
6327
|
},
|
|
6365
6328
|
},
|
|
6366
6329
|
},
|
|
@@ -6369,7 +6332,7 @@ const internalMachine = setup({
|
|
|
6369
6332
|
onDone: {
|
|
6370
6333
|
target: 'ready',
|
|
6371
6334
|
actions: () => {
|
|
6372
|
-
logger$
|
|
6335
|
+
logger$2('[sdk] [internal/index] All DBs loaded! Should be headed to ready');
|
|
6373
6336
|
eventEmitter.emit('allDbsLoaded');
|
|
6374
6337
|
},
|
|
6375
6338
|
},
|
|
@@ -6381,7 +6344,7 @@ const internalMachine = setup({
|
|
|
6381
6344
|
},
|
|
6382
6345
|
ready: {
|
|
6383
6346
|
entry: () => {
|
|
6384
|
-
logger$
|
|
6347
|
+
logger$2('[sdk] [internal/index] Ready!');
|
|
6385
6348
|
},
|
|
6386
6349
|
meta: {
|
|
6387
6350
|
displayText: "Crossing the t's ...",
|
|
@@ -6396,7 +6359,7 @@ const internalMachine = setup({
|
|
|
6396
6359
|
},
|
|
6397
6360
|
},
|
|
6398
6361
|
entry: () => {
|
|
6399
|
-
logger$
|
|
6362
|
+
logger$2('[sdk] [internal/index] Error!');
|
|
6400
6363
|
},
|
|
6401
6364
|
meta: {
|
|
6402
6365
|
displayText: 'Whoops! Something went wrong.',
|
|
@@ -6407,6 +6370,53 @@ const internalMachine = setup({
|
|
|
6407
6370
|
},
|
|
6408
6371
|
});
|
|
6409
6372
|
|
|
6373
|
+
const logger$1 = debug('app:global:actors');
|
|
6374
|
+
const initialize = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
6375
|
+
const { internalService, models, endpoints } = context;
|
|
6376
|
+
const { addresses } = event;
|
|
6377
|
+
let environment = 'browser';
|
|
6378
|
+
if (isNode()) {
|
|
6379
|
+
environment = 'node';
|
|
6380
|
+
}
|
|
6381
|
+
if (isReactNative()) {
|
|
6382
|
+
environment = 'react-native';
|
|
6383
|
+
}
|
|
6384
|
+
let internalSubscription;
|
|
6385
|
+
if (environment === 'browser' && models) {
|
|
6386
|
+
const _initFileSystem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
6387
|
+
return;
|
|
6388
|
+
// return new Promise((resolve) => {
|
|
6389
|
+
// })
|
|
6390
|
+
});
|
|
6391
|
+
const _initInternal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
6392
|
+
return new Promise((resolve) => {
|
|
6393
|
+
internalSubscription = internalService.subscribe((snapshot) => {
|
|
6394
|
+
logger$1('[sdk] [internal] snapshot', snapshot);
|
|
6395
|
+
if (snapshot.value === 'ready') {
|
|
6396
|
+
resolve();
|
|
6397
|
+
}
|
|
6398
|
+
});
|
|
6399
|
+
internalService.send({ type: 'init', endpoints, addresses });
|
|
6400
|
+
});
|
|
6401
|
+
});
|
|
6402
|
+
_initFileSystem().then(() => {
|
|
6403
|
+
logger$1('[global/actors] File system initialized');
|
|
6404
|
+
});
|
|
6405
|
+
_initInternal().then(() => {
|
|
6406
|
+
logger$1('[global/actors] Internal initialized');
|
|
6407
|
+
sendBack({ type: GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY });
|
|
6408
|
+
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
6409
|
+
});
|
|
6410
|
+
// _initEas().then(() => {
|
|
6411
|
+
// logger('EAS initialized')
|
|
6412
|
+
// })
|
|
6413
|
+
}
|
|
6414
|
+
sendBack({ type: GLOBAL_INITIALIZING_SEND_CONFIG, environment });
|
|
6415
|
+
return () => {
|
|
6416
|
+
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
6417
|
+
};
|
|
6418
|
+
});
|
|
6419
|
+
|
|
6410
6420
|
const { UNINITIALIZED, INITIALIZING, INITIALIZED, GETTING_SEED_CLASS, GETTING_SCHEMA_FOR_MODEL, ADDING_MODELS_TO_DB, } = GlobalState;
|
|
6411
6421
|
createBrowserInspector({
|
|
6412
6422
|
autoStart: false,
|
|
@@ -6538,11 +6548,11 @@ const globalMachine = setup({
|
|
|
6538
6548
|
(_a) => __awaiter(void 0, [_a], void 0, function* ({ context }) {
|
|
6539
6549
|
let SeedClass;
|
|
6540
6550
|
if (context.environment === 'node') {
|
|
6541
|
-
const { SeedNode } = yield import('./seed-
|
|
6551
|
+
const { SeedNode } = yield import('./seed-BJPS_-pY.js');
|
|
6542
6552
|
SeedClass = SeedNode;
|
|
6543
6553
|
}
|
|
6544
6554
|
else {
|
|
6545
|
-
const { SeedBrowser } = yield import('./seed-
|
|
6555
|
+
const { SeedBrowser } = yield import('./seed-CjMH4SeR.js');
|
|
6546
6556
|
SeedClass = SeedBrowser;
|
|
6547
6557
|
}
|
|
6548
6558
|
return SeedClass;
|
|
@@ -6647,4 +6657,4 @@ const setupServicesEventHandlers = () => {
|
|
|
6647
6657
|
};
|
|
6648
6658
|
|
|
6649
6659
|
export { useDeleteItem as $, APP_DB_CONFIG as A, setupFsListeners as B, CHILD_SNAPSHOT as C, DB_NAME_SDK_CONFIG as D, setupAllItemsEventHandlers as E, setupServicesEventHandlers as F, GET_SCHEMAS as G, globalService as H, Item as I, Json as J, getModel as K, List as L, Model as M, getModels as N, getModelNames as O, Property as P, areFsListenersReady as Q, Relation as R, SCHEMA_NJK as S, Text as T, ItemProperty as U, useItems as V, useItem as W, useItemProperties as X, useCreateItem as Y, useItemProperty as Z, __awaiter as _, GET_SEEDS as a, useServices as a0, getGlobalService as a1, getCorrectId as a2, GET_SEED_IDS as b, GET_STORAGE_TRANSACTION_ID as c, GET_VERSIONS as d, GET_PROPERTIES as e, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as f, itemMachineAll as g, internalMachine as h, itemMachineSingle as i, isNode as j, isBrowser as k, isReactNative as l, __decorate as m, __metadata as n, models as o, SCHEMA_TS as p, SDK_DB_CONFIG as q, SEED_DB_CONFIG as r, addModelsToInternalDb as s, ImageSrc as t, createNewMetadataFromExistingRecord as u, generateId as v, eventEmitter as w, getDb as x, DB_NAME_APP as y, setModel as z };
|
|
6650
|
-
//# sourceMappingURL=events-
|
|
6660
|
+
//# sourceMappingURL=events-CRCYmF7M.js.map
|