@seedprotocol/sdk 0.1.4 → 0.1.6
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 +5 -15
- package/dist/bin.js.map +1 -1
- package/dist/{index-VvchoqaM.js → index-CNBlL-jO.js} +114 -85
- package/dist/index-CNBlL-jO.js.map +1 -0
- package/dist/{index-Dr_ozHON.js → index-o-DJt8pS.js} +2 -2
- package/dist/index-o-DJt8pS.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed-CHE3yKuF.js → seed-BpNdPgtK.js} +2 -2
- package/dist/{seed-CHE3yKuF.js.map → seed-BpNdPgtK.js.map} +1 -1
- package/dist/{seed-C3nzF2oc.js → seed-Drx1JpCZ.js} +3 -3
- package/dist/{seed-C3nzF2oc.js.map → seed-Drx1JpCZ.js.map} +1 -1
- package/dist/{seed-Nsca4-Wn.js → seed-DykcKEyf.js} +3 -3
- package/dist/{seed-Nsca4-Wn.js.map → seed-DykcKEyf.js.map} +1 -1
- package/dist/{seed.schema.config-CJPoGRe1.js → seed.schema.config-CFp_quWt.js} +2 -2
- package/dist/{seed.schema.config-CJPoGRe1.js.map → seed.schema.config-CFp_quWt.js.map} +1 -1
- package/dist/types/src/browser/db/write.d.ts.map +1 -1
- package/dist/types/src/browser/item/all/actors/fetchSeeds.d.ts.map +1 -1
- package/dist/types/src/browser/item/create/actors/createItem.d.ts.map +1 -1
- package/dist/types/src/browser/react/index.d.ts.map +1 -1
- package/dist/types/src/browser/schema/file/fetchAll/actors.d.ts.map +1 -1
- package/dist/types/src/browser/services/events.d.ts.map +1 -1
- package/dist/types/src/browser/services/global/machine.d.ts.map +1 -1
- package/dist/types/src/browser/services/internal/helpers.d.ts.map +1 -1
- package/dist/types/src/node/codegen/drizzle.d.ts.map +1 -1
- package/dist/types/src/node/codegen/ts-to-proto.d.ts.map +1 -1
- package/dist/types/src/node/constants.d.ts.map +1 -1
- package/dist/types/src/node/helpers/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-Dr_ozHON.js.map +0 -1
- package/dist/index-VvchoqaM.js.map +0 -1
|
@@ -11,7 +11,7 @@ import { customAlphabet } from 'nanoid';
|
|
|
11
11
|
import * as nanoIdDictionary from 'nanoid-dictionary';
|
|
12
12
|
import { startCase, debounce, camelCase, orderBy } from 'lodash-es';
|
|
13
13
|
import { sqliteTable, text, int, blob, check, unique } from 'drizzle-orm/sqlite-core';
|
|
14
|
-
import { useState,
|
|
14
|
+
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
15
15
|
import EventEmitter from 'eventemitter3';
|
|
16
16
|
import { BehaviorSubject } from 'rxjs';
|
|
17
17
|
import { immerable, enableMapSet } from 'immer';
|
|
@@ -265,14 +265,14 @@ const getSqlite = async () => {
|
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
|
|
268
|
-
const logger$
|
|
268
|
+
const logger$e = debug('app:db:actors');
|
|
269
269
|
let seedDb;
|
|
270
270
|
let appDb;
|
|
271
271
|
let sdkConfigDb;
|
|
272
272
|
let sqliteWasmClient$1;
|
|
273
273
|
const checkStatus = fromCallback(({ sendBack, input: { context } }) => {
|
|
274
274
|
const { dbName, dirName } = context;
|
|
275
|
-
logger$
|
|
275
|
+
logger$e('[db/actors] checkStatus context', context);
|
|
276
276
|
const pathToDir = `${BROWSER_FS_TOP_DIR}/${dirName}`;
|
|
277
277
|
const pathToDbDir = `${pathToDir}/db`;
|
|
278
278
|
const pathToDb = `${pathToDbDir}/${dbName}.sqlite3`;
|
|
@@ -303,7 +303,7 @@ const checkStatus = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
303
303
|
});
|
|
304
304
|
});
|
|
305
305
|
const connectToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
306
|
-
logger$
|
|
306
|
+
logger$e('[db/actors] connectToDb context', context);
|
|
307
307
|
const { dbName, pathToDir } = context;
|
|
308
308
|
let isConnecting = false;
|
|
309
309
|
let dbId;
|
|
@@ -318,16 +318,16 @@ const connectToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
318
318
|
}
|
|
319
319
|
//@ts-ignore
|
|
320
320
|
response = yield sqliteWasmClient$1('config-get', {});
|
|
321
|
-
logger$
|
|
322
|
-
logger$
|
|
321
|
+
logger$e(response);
|
|
322
|
+
logger$e('Running SQLite3 version', response.result.version.libVersion);
|
|
323
323
|
//@ts-ignore
|
|
324
324
|
response = yield sqliteWasmClient$1('open', {
|
|
325
325
|
filename: `file:${pathToDir}/db/${dbName}.sqlite3?vfs=opfs`,
|
|
326
326
|
});
|
|
327
|
-
logger$
|
|
327
|
+
logger$e(response);
|
|
328
328
|
dbId = response.dbId;
|
|
329
329
|
// logger(`dbId: ${dbId}`)
|
|
330
|
-
logger$
|
|
330
|
+
logger$e('OPFS is available, created persisted database at', response.result.filename.replace(/^file:(.*?)\?vfs=opfs$/, '$1'));
|
|
331
331
|
});
|
|
332
332
|
const interval = setInterval(() => {
|
|
333
333
|
// TODO: Add a timeout
|
|
@@ -447,7 +447,7 @@ const dbExec = (dbId_1, params_1, sql_1, dbName_1, ...args_1) => __awaiter(void
|
|
|
447
447
|
});
|
|
448
448
|
const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
449
449
|
const { pathToDbDir, dirName, dbId, dbName } = context;
|
|
450
|
-
logger$
|
|
450
|
+
logger$e('[db/actors] migrate context', context);
|
|
451
451
|
const schemaGlobString = `${BROWSER_FS_TOP_DIR}/${dirName}/schema/*`;
|
|
452
452
|
const isSeedDb = dbName === DB_NAME_SEED;
|
|
453
453
|
const isAppDb = dbName === DB_NAME_APP;
|
|
@@ -728,7 +728,7 @@ const initialize$3 = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
728
728
|
}
|
|
729
729
|
});
|
|
730
730
|
|
|
731
|
-
const logger$
|
|
731
|
+
const logger$d = debug('app:shared:helpers');
|
|
732
732
|
const { alphanumeric } = nanoIdDictionary;
|
|
733
733
|
const generateId = () => {
|
|
734
734
|
return customAlphabet(alphanumeric, 10)();
|
|
@@ -791,7 +791,7 @@ const convertTxIdToImageSrc = (txId) => __awaiter(void 0, void 0, void 0, functi
|
|
|
791
791
|
const imageFilePath = `/files/images/${txId}`;
|
|
792
792
|
const fileExists = yield fs.promises.exists(imageFilePath);
|
|
793
793
|
if (!fileExists) {
|
|
794
|
-
logger$
|
|
794
|
+
logger$d(`[ItemView] [updateImageSrc] ${imageFilePath} does not exist`);
|
|
795
795
|
return;
|
|
796
796
|
}
|
|
797
797
|
const uint = yield fs.promises.readFile(imageFilePath);
|
|
@@ -1528,7 +1528,7 @@ const getAddressesFromDb = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
1528
1528
|
return JSON.parse(addressArrayString);
|
|
1529
1529
|
});
|
|
1530
1530
|
|
|
1531
|
-
const logger$
|
|
1531
|
+
const logger$c = debug('app:property:actors:hydrateFromDb');
|
|
1532
1532
|
const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
1533
1533
|
const { seedUid, seedLocalId, propertyName: propertyNameRaw, propertyValue, propertyRecordSchema, itemModelName, } = context;
|
|
1534
1534
|
let propertyName = propertyNameRaw;
|
|
@@ -1625,16 +1625,16 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1625
1625
|
const refResolvedValue = firstRow[7];
|
|
1626
1626
|
const refResolvedDisplayValue = firstRow[8];
|
|
1627
1627
|
if (propertyNameFromDb !== propertyName) {
|
|
1628
|
-
logger$
|
|
1628
|
+
logger$c(`Property name from db ${propertyNameFromDb} does not match property name ${propertyName} for Property.${localId}`);
|
|
1629
1629
|
}
|
|
1630
1630
|
if (propertyValueFromDb !== propertyValue) {
|
|
1631
|
-
logger$
|
|
1631
|
+
logger$c(`Property value from db ${propertyValueFromDb} does not match property value ${propertyValue} for Property.${localId}`);
|
|
1632
1632
|
}
|
|
1633
1633
|
if (seedLocalIdFromDb !== seedLocalId) {
|
|
1634
|
-
logger$
|
|
1634
|
+
logger$c(`Seed local id from db ${seedLocalIdFromDb} does not match seed local id ${seedLocalId} for Property.${localId}`);
|
|
1635
1635
|
}
|
|
1636
1636
|
if (seedUidFromDb !== seedUid) {
|
|
1637
|
-
logger$
|
|
1637
|
+
logger$c(`Seed uid from db ${seedUidFromDb} does not match seed uid ${seedUid} for Property.${localId}`);
|
|
1638
1638
|
}
|
|
1639
1639
|
sendBack({
|
|
1640
1640
|
type: 'updateContext',
|
|
@@ -1650,7 +1650,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1650
1650
|
renderValue: refResolvedDisplayValue,
|
|
1651
1651
|
});
|
|
1652
1652
|
if (propertyNameFromDb === 'storageTransactionId') {
|
|
1653
|
-
const { Item } = yield import('./index-
|
|
1653
|
+
const { Item } = yield import('./index-o-DJt8pS.js');
|
|
1654
1654
|
const item = yield Item.find({
|
|
1655
1655
|
seedLocalId,
|
|
1656
1656
|
modelName: itemModelName,
|
|
@@ -1662,7 +1662,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1662
1662
|
const renderValue = yield fs.promises
|
|
1663
1663
|
.readFile(`/files/html/${propertyValueFromDb}.html`, 'utf8')
|
|
1664
1664
|
.catch((error) => {
|
|
1665
|
-
logger$
|
|
1665
|
+
logger$c('Error reading html file', error);
|
|
1666
1666
|
});
|
|
1667
1667
|
property
|
|
1668
1668
|
.getService()
|
|
@@ -1725,7 +1725,7 @@ const internalPropertyNames = [
|
|
|
1725
1725
|
];
|
|
1726
1726
|
|
|
1727
1727
|
var _a$2;
|
|
1728
|
-
const logger$
|
|
1728
|
+
const logger$b = debug('app:property:class');
|
|
1729
1729
|
const namesThatEndWithId = [];
|
|
1730
1730
|
class ItemProperty {
|
|
1731
1731
|
// private constructor(localIdOrUid) {
|
|
@@ -1773,7 +1773,7 @@ class ItemProperty {
|
|
|
1773
1773
|
serviceInput.propertyValue = JSON.parse(propertyValue);
|
|
1774
1774
|
}
|
|
1775
1775
|
catch (e) {
|
|
1776
|
-
logger$
|
|
1776
|
+
logger$b('List property value is not JSON', e);
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
1779
|
const propertyNameSingular = pluralize(propertyName, 1);
|
|
@@ -1832,7 +1832,7 @@ class ItemProperty {
|
|
|
1832
1832
|
this._service.start();
|
|
1833
1833
|
}
|
|
1834
1834
|
_updateResponseListener(event) {
|
|
1835
|
-
logger$
|
|
1835
|
+
logger$b(`[ItemProperty] [_updateResponseListener] [${this.itemModelName}.${this.seedLocalId}] ${this.propertyName} event`, event);
|
|
1836
1836
|
}
|
|
1837
1837
|
static create(props) {
|
|
1838
1838
|
const { propertyName, seedLocalId, uid } = props;
|
|
@@ -1848,7 +1848,7 @@ class ItemProperty {
|
|
|
1848
1848
|
instance.getService().send({ type: 'refresh' });
|
|
1849
1849
|
}
|
|
1850
1850
|
if (seedLocalId === 'R4RYj2pYIQ' && propertyName === 'html') {
|
|
1851
|
-
logger$
|
|
1851
|
+
logger$b('[property/class] [create] [R4RYj2pYIQ] returning cached instance', instance.getService().getSnapshot().context);
|
|
1852
1852
|
}
|
|
1853
1853
|
return instance;
|
|
1854
1854
|
}
|
|
@@ -1858,14 +1858,14 @@ class ItemProperty {
|
|
|
1858
1858
|
const { instance, refCount } = this.instanceCache.get(uid);
|
|
1859
1859
|
this.instanceCache.set(uid, { instance, refCount: refCount + 1 });
|
|
1860
1860
|
if (seedLocalId === 'R4RYj2pYIQ' && propertyName === 'html') {
|
|
1861
|
-
logger$
|
|
1861
|
+
logger$b('[property/class] [create] [uid] [R4RYj2pYIQ] returning cached instance', instance.getService().getSnapshot().context);
|
|
1862
1862
|
}
|
|
1863
1863
|
return instance;
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
1866
|
const newInstance = new ItemProperty(props);
|
|
1867
1867
|
if (props.seedLocalId === 'R4RYj2pYIQ' && propertyName === 'html') {
|
|
1868
|
-
logger$
|
|
1868
|
+
logger$b('[property/class] [create] [R4RYj2pYIQ] returning new instance', props, newInstance.getService().getSnapshot().context);
|
|
1869
1869
|
}
|
|
1870
1870
|
return newInstance;
|
|
1871
1871
|
}
|
|
@@ -1968,7 +1968,7 @@ class ItemProperty {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
unload() {
|
|
1970
1970
|
this._service.stop();
|
|
1971
|
-
logger$
|
|
1971
|
+
logger$b(`[XXXXXX] [ItemProperty] [${this.seedLocalId}] [unload] removing listener`, this._updateResponseEvent);
|
|
1972
1972
|
eventEmitter.removeListener(this._updateResponseEvent, this._updateResponseListener);
|
|
1973
1973
|
}
|
|
1974
1974
|
}
|
|
@@ -2062,7 +2062,7 @@ const getContentUrlFromPath = (path) => __awaiter(void 0, void 0, void 0, functi
|
|
|
2062
2062
|
return URL.createObjectURL(fileHandler);
|
|
2063
2063
|
});
|
|
2064
2064
|
|
|
2065
|
-
const logger$
|
|
2065
|
+
const logger$a = debug('app:global:actors');
|
|
2066
2066
|
const initialize$1 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
2067
2067
|
const { internalService, models, endpoints } = context;
|
|
2068
2068
|
const { addresses } = event;
|
|
@@ -2083,7 +2083,7 @@ const initialize$1 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
2083
2083
|
const _initInternal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2084
2084
|
return new Promise((resolve) => {
|
|
2085
2085
|
internalSubscription = internalService.subscribe((snapshot) => {
|
|
2086
|
-
logger$
|
|
2086
|
+
logger$a('[sdk] [internal] snapshot', snapshot);
|
|
2087
2087
|
if (snapshot.value === 'ready') {
|
|
2088
2088
|
resolve();
|
|
2089
2089
|
}
|
|
@@ -2092,10 +2092,10 @@ const initialize$1 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
2092
2092
|
});
|
|
2093
2093
|
});
|
|
2094
2094
|
_initFileSystem().then(() => {
|
|
2095
|
-
logger$
|
|
2095
|
+
logger$a('[global/actors] File system initialized');
|
|
2096
2096
|
});
|
|
2097
2097
|
_initInternal().then(() => {
|
|
2098
|
-
logger$
|
|
2098
|
+
logger$a('[global/actors] Internal initialized');
|
|
2099
2099
|
sendBack({ type: GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY });
|
|
2100
2100
|
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
2101
2101
|
});
|
|
@@ -2116,12 +2116,12 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2116
2116
|
if (!models$1) {
|
|
2117
2117
|
return;
|
|
2118
2118
|
}
|
|
2119
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2119
|
+
const { models: SeedModels } = yield import('./seed.schema.config-CFp_quWt.js');
|
|
2120
2120
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2121
2121
|
let hasModelsInDb = false;
|
|
2122
2122
|
const schemaDefsByModelName = new Map();
|
|
2123
2123
|
for (const [modelName, _] of Object.entries(allModels)) {
|
|
2124
|
-
logger$
|
|
2124
|
+
logger$a('[helpers/db] [addModelsToInternalDb] starting modelName:', modelName);
|
|
2125
2125
|
let foundModel;
|
|
2126
2126
|
const foundModelsQuery = yield sdkConfigDb
|
|
2127
2127
|
.select()
|
|
@@ -2131,7 +2131,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2131
2131
|
yield sdkConfigDb.insert(models).values({
|
|
2132
2132
|
name: modelName,
|
|
2133
2133
|
});
|
|
2134
|
-
logger$
|
|
2134
|
+
logger$a('[global/actors] [addModelsToDb] inserted model:', modelName);
|
|
2135
2135
|
const foundModels = yield sdkConfigDb
|
|
2136
2136
|
.select({
|
|
2137
2137
|
id: models.id,
|
|
@@ -2215,7 +2215,7 @@ const getSchemaForModel = fromCallback(({ sendBack, input: { context, event } })
|
|
|
2215
2215
|
if (!model) {
|
|
2216
2216
|
throw new Error(`Model ${modelName} not found`);
|
|
2217
2217
|
}
|
|
2218
|
-
logger$
|
|
2218
|
+
logger$a('[service/actor] [getSchemaForModel] model:', model);
|
|
2219
2219
|
sendBack({ type: 'schemaForModel', schema: model.schema });
|
|
2220
2220
|
return () => { };
|
|
2221
2221
|
});
|
|
@@ -2269,6 +2269,7 @@ class SqliteConnectionManager {
|
|
|
2269
2269
|
}
|
|
2270
2270
|
}
|
|
2271
2271
|
|
|
2272
|
+
const logger$9 = debug('app:services:internal:helpers');
|
|
2272
2273
|
/**
|
|
2273
2274
|
* Recursively create directories if they don't exist.
|
|
2274
2275
|
* @param {string} dirPath - The directory path to create.
|
|
@@ -2342,10 +2343,9 @@ const downloadFile = (url, localFilePath) => __awaiter(void 0, void 0, void 0, f
|
|
|
2342
2343
|
}
|
|
2343
2344
|
catch (error) {
|
|
2344
2345
|
if (JSON.stringify(error).includes('File exists')) {
|
|
2345
|
-
|
|
2346
|
-
console.log(`[downloadFile] File already exists with contents: ${fileData}`);
|
|
2346
|
+
yield fs.promises.readFile(localFilePath, 'utf-8');
|
|
2347
2347
|
}
|
|
2348
|
-
|
|
2348
|
+
logger$9(`[Error] Failed to download file from ${url}:`, error);
|
|
2349
2349
|
}
|
|
2350
2350
|
busy = false;
|
|
2351
2351
|
});
|
|
@@ -2358,8 +2358,8 @@ const fetchFilesRecursively = (url, localPath, fileList) => __awaiter(void 0, vo
|
|
|
2358
2358
|
for (const file of fileList) {
|
|
2359
2359
|
const fileUrl = `${url}/${file}`;
|
|
2360
2360
|
const fileLocalPath = path.join(localPath, file);
|
|
2361
|
-
//
|
|
2362
|
-
//
|
|
2361
|
+
// logger(`[fetchFilesRecursively] fileUrl: ${fileUrl}`)
|
|
2362
|
+
// logger(`[fetchFilesRecursively] fileLocalPath: ${fileLocalPath}`)
|
|
2363
2363
|
yield downloadFile(fileUrl, fileLocalPath);
|
|
2364
2364
|
}
|
|
2365
2365
|
}
|
|
@@ -2383,7 +2383,7 @@ const syncDbFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ filePat
|
|
|
2383
2383
|
const fileList = yield fetchDirectory(filePaths);
|
|
2384
2384
|
yield fetchFilesRecursively(files, BROWSER_FS_TOP_DIR, fileList);
|
|
2385
2385
|
yield confirmFilesExist(fileList);
|
|
2386
|
-
|
|
2386
|
+
logger$9('[syncDbFiles] Files synced!');
|
|
2387
2387
|
});
|
|
2388
2388
|
|
|
2389
2389
|
const uploadBinaryData = fromCallback(({ sendBack, receive, input }) => { });
|
|
@@ -2693,7 +2693,7 @@ const getArweave = () => {
|
|
|
2693
2693
|
});
|
|
2694
2694
|
};
|
|
2695
2695
|
|
|
2696
|
-
const logger$
|
|
2696
|
+
const logger$8 = debug('app:files:download');
|
|
2697
2697
|
const downloadAllFilesRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({ endpoints, eventId, }) {
|
|
2698
2698
|
yield syncDbFiles(endpoints);
|
|
2699
2699
|
eventEmitter.emit('fs.downloadAll.success', { eventId });
|
|
@@ -2763,7 +2763,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2763
2763
|
try {
|
|
2764
2764
|
const res = yield fetch(`https://${ARWEAVE_HOST}/tx/${transactionId}/status`);
|
|
2765
2765
|
if (res.status !== 200) {
|
|
2766
|
-
logger$
|
|
2766
|
+
logger$8(`[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`);
|
|
2767
2767
|
excludedTransactions.add(transactionId);
|
|
2768
2768
|
yield writeAppState(seedDb, 'excludedTransactions', JSON.stringify(Array.from(excludedTransactions)));
|
|
2769
2769
|
continue;
|
|
@@ -2777,7 +2777,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2777
2777
|
console.error(`[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`, error);
|
|
2778
2778
|
});
|
|
2779
2779
|
if (!dataString) {
|
|
2780
|
-
logger$
|
|
2780
|
+
logger$8(`[fetchAll/actors] [fetchAllBinaryData] transaction ${transactionId} data not found`);
|
|
2781
2781
|
}
|
|
2782
2782
|
let contentType = identifyString(dataString);
|
|
2783
2783
|
if (contentType !== 'json' &&
|
|
@@ -2785,7 +2785,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2785
2785
|
contentType !== 'html') {
|
|
2786
2786
|
const possibleImageType = getImageDataType(dataString);
|
|
2787
2787
|
if (!possibleImageType) {
|
|
2788
|
-
logger$
|
|
2788
|
+
logger$8(`[fetchAll/actors] [fetchAllBinaryData] transaction ${transactionId} data not in expected format: ${possibleImageType}`);
|
|
2789
2789
|
continue;
|
|
2790
2790
|
}
|
|
2791
2791
|
contentType = possibleImageType;
|
|
@@ -2848,7 +2848,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2848
2848
|
}
|
|
2849
2849
|
}
|
|
2850
2850
|
catch (error) {
|
|
2851
|
-
logger$
|
|
2851
|
+
logger$8(error);
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
2854
2854
|
});
|
|
@@ -2894,7 +2894,7 @@ const isFsInitialized = () => {
|
|
|
2894
2894
|
return isInitialized;
|
|
2895
2895
|
};
|
|
2896
2896
|
|
|
2897
|
-
const logger$
|
|
2897
|
+
const logger$7 = debug('app:internal:actors');
|
|
2898
2898
|
let sqliteWasmClient;
|
|
2899
2899
|
let manager;
|
|
2900
2900
|
const validateInput = fromCallback(({ sendBack, input: { event } }) => {
|
|
@@ -2947,12 +2947,12 @@ const prepareDb = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
2947
2947
|
});
|
|
2948
2948
|
const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
2949
2949
|
const { endpoints, seedDbService, appDbService, sdkDbService } = context;
|
|
2950
|
-
logger$
|
|
2950
|
+
logger$7('[internal/actors] [configureFs] Configuring FS');
|
|
2951
2951
|
const services = [seedDbService, appDbService, sdkDbService];
|
|
2952
2952
|
const _configureFs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2953
|
-
logger$
|
|
2954
|
-
logger$
|
|
2955
|
-
logger$
|
|
2953
|
+
logger$7('[internal/actors] [configureFs] calling _configureFs');
|
|
2954
|
+
logger$7('[internal/actors] [configureFs] areFsListenersReady:', areFsListenersReady());
|
|
2955
|
+
logger$7('[internal/actors] [configureFs] isFsInitialized:', isFsInitialized());
|
|
2956
2956
|
yield waitForEvent({
|
|
2957
2957
|
req: {
|
|
2958
2958
|
eventLabel: 'fs.downloadAll.request',
|
|
@@ -2984,7 +2984,7 @@ const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2984
2984
|
// }, 200)
|
|
2985
2985
|
// })
|
|
2986
2986
|
})));
|
|
2987
|
-
logger$
|
|
2987
|
+
logger$7('[internal/actors] [configureFs] fs configured!');
|
|
2988
2988
|
});
|
|
2989
2989
|
// Some of our dependencies use fs sync functions, which don't work with
|
|
2990
2990
|
// OPFS. ZenFS creates an async cache of all files so that the sync functions
|
|
@@ -3070,14 +3070,14 @@ const saveConfig = fromCallback(({ sendBack, receive, input: { context } }) => {
|
|
|
3070
3070
|
},
|
|
3071
3071
|
setWhere: sql `key = 'addresses'`,
|
|
3072
3072
|
});
|
|
3073
|
-
logger$
|
|
3073
|
+
logger$7('[sdk] [internal/actors] Should be done saving');
|
|
3074
3074
|
}
|
|
3075
3075
|
catch (error) {
|
|
3076
3076
|
console.error('Error saving config:', error);
|
|
3077
3077
|
}
|
|
3078
3078
|
});
|
|
3079
3079
|
_saveConfig().then(() => {
|
|
3080
|
-
logger$
|
|
3080
|
+
logger$7('[sdk] [internal/actors] Successfully saved config');
|
|
3081
3081
|
return sendBack({ type: INTERNAL_SAVING_CONFIG_SUCCESS });
|
|
3082
3082
|
});
|
|
3083
3083
|
return () => { };
|
|
@@ -3102,7 +3102,7 @@ const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3102
3102
|
});
|
|
3103
3103
|
_loadAppDb().then(() => {
|
|
3104
3104
|
sendBack({ type: INTERNAL_LOADING_APP_DB_SUCCESS });
|
|
3105
|
-
logger$
|
|
3105
|
+
logger$7('[sdk] [internal/actors] Successfully loaded app DB');
|
|
3106
3106
|
});
|
|
3107
3107
|
return () => {
|
|
3108
3108
|
if (subscription) {
|
|
@@ -3112,7 +3112,7 @@ const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3112
3112
|
});
|
|
3113
3113
|
const loadSdkDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
3114
3114
|
const { sdkDbService } = context;
|
|
3115
|
-
logger$
|
|
3115
|
+
logger$7('[sdk] [internal/actors] Loading SDK DB');
|
|
3116
3116
|
let subscription;
|
|
3117
3117
|
const _loadSdkDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
3118
3118
|
return new Promise((resolve) => {
|
|
@@ -3135,7 +3135,7 @@ const loadSdkDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3135
3135
|
});
|
|
3136
3136
|
_loadSdkDb().then(() => {
|
|
3137
3137
|
sendBack({ type: INTERNAL_LOADING_SDK_DB_SUCCESS });
|
|
3138
|
-
logger$
|
|
3138
|
+
logger$7('[sdk] [internal/actors] Successfully loaded SDK DB');
|
|
3139
3139
|
});
|
|
3140
3140
|
return () => {
|
|
3141
3141
|
if (subscription) {
|
|
@@ -3144,7 +3144,7 @@ const loadSdkDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3144
3144
|
};
|
|
3145
3145
|
});
|
|
3146
3146
|
|
|
3147
|
-
const logger$
|
|
3147
|
+
const logger$6 = debug('app:services:db:machine');
|
|
3148
3148
|
const { CHECKING_STATUS, VALIDATING, WAITING_FOR_FILES, CONNECTING_TO_DB, MIGRATING, } = DbState;
|
|
3149
3149
|
const dbMachine = setup({
|
|
3150
3150
|
types: {
|
|
@@ -3165,7 +3165,7 @@ const dbMachine = setup({
|
|
|
3165
3165
|
[DB_WAITING_FOR_FILES_RECEIVED]: {
|
|
3166
3166
|
actions: assign({
|
|
3167
3167
|
hasFiles: ({ event }) => {
|
|
3168
|
-
logger$
|
|
3168
|
+
logger$6('[db/machine] DB_WAITING_FOR_FILES_RECEIVED event:', event);
|
|
3169
3169
|
return true;
|
|
3170
3170
|
},
|
|
3171
3171
|
}),
|
|
@@ -3174,8 +3174,8 @@ const dbMachine = setup({
|
|
|
3174
3174
|
target: `.${CHECKING_STATUS}`,
|
|
3175
3175
|
actions: assign({
|
|
3176
3176
|
hasFiles: ({ context, event }) => {
|
|
3177
|
-
logger$
|
|
3178
|
-
logger$
|
|
3177
|
+
logger$6('[db/machine] updateHasFiles event:', event);
|
|
3178
|
+
logger$6('[db/machine] updateHasFiles context:', context);
|
|
3179
3179
|
return event.hasFiles;
|
|
3180
3180
|
},
|
|
3181
3181
|
}),
|
|
@@ -3296,7 +3296,7 @@ const dbMachine = setup({
|
|
|
3296
3296
|
},
|
|
3297
3297
|
});
|
|
3298
3298
|
|
|
3299
|
-
const logger$
|
|
3299
|
+
const logger$5 = debug('app:services:internal:machine');
|
|
3300
3300
|
createBrowserInspector({
|
|
3301
3301
|
autoStart: false,
|
|
3302
3302
|
});
|
|
@@ -3458,7 +3458,7 @@ const internalMachine = setup({
|
|
|
3458
3458
|
[INTERNAL_LOADING_APP_DB_SUCCESS]: {
|
|
3459
3459
|
target: 'appDbLoaded',
|
|
3460
3460
|
actions: () => {
|
|
3461
|
-
logger$
|
|
3461
|
+
logger$5('[sdk] [internal/index] App DB loaded!');
|
|
3462
3462
|
},
|
|
3463
3463
|
},
|
|
3464
3464
|
},
|
|
@@ -3470,7 +3470,7 @@ const internalMachine = setup({
|
|
|
3470
3470
|
appDbLoaded: {
|
|
3471
3471
|
type: 'final',
|
|
3472
3472
|
entry: () => {
|
|
3473
|
-
logger$
|
|
3473
|
+
logger$5('[sdk] [internal/index] Entered appDbLoaded!');
|
|
3474
3474
|
},
|
|
3475
3475
|
},
|
|
3476
3476
|
},
|
|
@@ -3483,7 +3483,7 @@ const internalMachine = setup({
|
|
|
3483
3483
|
[INTERNAL_LOADING_SDK_DB_SUCCESS]: {
|
|
3484
3484
|
target: 'sdkConfigDbLoaded',
|
|
3485
3485
|
actions: () => {
|
|
3486
|
-
logger$
|
|
3486
|
+
logger$5('[sdk] [internal/index] SDK Config DB loaded!');
|
|
3487
3487
|
},
|
|
3488
3488
|
},
|
|
3489
3489
|
},
|
|
@@ -3495,7 +3495,7 @@ const internalMachine = setup({
|
|
|
3495
3495
|
sdkConfigDbLoaded: {
|
|
3496
3496
|
type: 'final',
|
|
3497
3497
|
entry: () => {
|
|
3498
|
-
logger$
|
|
3498
|
+
logger$5('[sdk] [internal/index] Entered sdkConfigDbLoaded!');
|
|
3499
3499
|
},
|
|
3500
3500
|
},
|
|
3501
3501
|
},
|
|
@@ -3504,7 +3504,7 @@ const internalMachine = setup({
|
|
|
3504
3504
|
onDone: {
|
|
3505
3505
|
target: 'ready',
|
|
3506
3506
|
actions: () => {
|
|
3507
|
-
logger$
|
|
3507
|
+
logger$5('[sdk] [internal/index] All DBs loaded! Should be headed to ready');
|
|
3508
3508
|
eventEmitter.emit('allDbsLoaded');
|
|
3509
3509
|
},
|
|
3510
3510
|
},
|
|
@@ -3516,7 +3516,7 @@ const internalMachine = setup({
|
|
|
3516
3516
|
},
|
|
3517
3517
|
ready: {
|
|
3518
3518
|
entry: () => {
|
|
3519
|
-
logger$
|
|
3519
|
+
logger$5('[sdk] [internal/index] Ready!');
|
|
3520
3520
|
},
|
|
3521
3521
|
meta: {
|
|
3522
3522
|
displayText: "Crossing the t's ...",
|
|
@@ -3531,7 +3531,7 @@ const internalMachine = setup({
|
|
|
3531
3531
|
},
|
|
3532
3532
|
},
|
|
3533
3533
|
entry: () => {
|
|
3534
|
-
logger$
|
|
3534
|
+
logger$5('[sdk] [internal/index] Error!');
|
|
3535
3535
|
},
|
|
3536
3536
|
meta: {
|
|
3537
3537
|
displayText: 'Whoops! Something went wrong.',
|
|
@@ -3738,6 +3738,7 @@ const fetchDbData = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3738
3738
|
return () => { };
|
|
3739
3739
|
});
|
|
3740
3740
|
|
|
3741
|
+
const logger$4 = debug('app:allItemsActors:fetchSeeds');
|
|
3741
3742
|
const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
|
|
3742
3743
|
const { queryVariables, modelName } = context;
|
|
3743
3744
|
if (!queryVariables) {
|
|
@@ -3747,7 +3748,7 @@ const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3747
3748
|
const _fetchSeeds = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
3748
3749
|
const queryKey = [`getSeeds${modelName}`];
|
|
3749
3750
|
const cachedResults = queryClient.getQueryData(queryKey);
|
|
3750
|
-
|
|
3751
|
+
logger$4(`[allItemsActors] [fetchSeeds] cachedResults ${Date.now()}`, cachedResults);
|
|
3751
3752
|
const results = yield queryClient.fetchQuery({
|
|
3752
3753
|
queryKey,
|
|
3753
3754
|
queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient.request(GET_SEEDS, queryVariables); }),
|
|
@@ -4233,17 +4234,15 @@ const globalMachine = setup({
|
|
|
4233
4234
|
[GETTING_SEED_CLASS]: {
|
|
4234
4235
|
entry: [
|
|
4235
4236
|
(_a) => __awaiter(void 0, [_a], void 0, function* ({ context }) {
|
|
4236
|
-
console.log('Getting seed');
|
|
4237
4237
|
let SeedClass;
|
|
4238
4238
|
if (context.environment === 'node') {
|
|
4239
|
-
const { SeedNode } = yield import('./seed-
|
|
4239
|
+
const { SeedNode } = yield import('./seed-DykcKEyf.js');
|
|
4240
4240
|
SeedClass = SeedNode;
|
|
4241
4241
|
}
|
|
4242
4242
|
else {
|
|
4243
|
-
const { SeedBrowser } = yield import('./seed-
|
|
4243
|
+
const { SeedBrowser } = yield import('./seed-Drx1JpCZ.js');
|
|
4244
4244
|
SeedClass = SeedBrowser;
|
|
4245
4245
|
}
|
|
4246
|
-
console.log('SeedClass', SeedClass);
|
|
4247
4246
|
return SeedClass;
|
|
4248
4247
|
}),
|
|
4249
4248
|
],
|
|
@@ -5317,7 +5316,7 @@ const getSeedData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seedLoc
|
|
|
5317
5316
|
};
|
|
5318
5317
|
});
|
|
5319
5318
|
|
|
5320
|
-
const logger$
|
|
5319
|
+
const logger$3 = debug('app:db:queries:getItem');
|
|
5321
5320
|
const getItemDataFromDb = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelName, seedLocalId, seedUid, }) {
|
|
5322
5321
|
if (!seedLocalId && !seedUid) {
|
|
5323
5322
|
throw new Error('[db/queries] [getItem] no seedLocalId or seedUid');
|
|
@@ -5325,7 +5324,7 @@ const getItemDataFromDb = (_a) => __awaiter(void 0, [_a], void 0, function* ({ m
|
|
|
5325
5324
|
if (seedUid && !seedLocalId) {
|
|
5326
5325
|
const seedData = yield getSeedData({ seedUid });
|
|
5327
5326
|
if (!seedData) {
|
|
5328
|
-
logger$
|
|
5327
|
+
logger$3('[db/queries] [getItem] no seedData seedUid', seedUid);
|
|
5329
5328
|
return;
|
|
5330
5329
|
}
|
|
5331
5330
|
seedLocalId = seedData.localId;
|
|
@@ -5622,7 +5621,7 @@ const GET_ALL_PROPERTIES_FOR_ALL_VERSIONS = graphql(/* GraphQL */ `
|
|
|
5622
5621
|
}
|
|
5623
5622
|
`);
|
|
5624
5623
|
|
|
5625
|
-
const logger$
|
|
5624
|
+
const logger$2 = debug('app:react:index');
|
|
5626
5625
|
const useItemProperty = (propertyName, seedLocalId) => {
|
|
5627
5626
|
const [property, setProperty] = useImmer(undefined);
|
|
5628
5627
|
const [isReadingFromDb, setIsReadingFromDb] = useState(false);
|
|
@@ -5634,6 +5633,11 @@ const useItemProperty = (propertyName, seedLocalId) => {
|
|
|
5634
5633
|
return snapshot.context.renderValue || snapshot.context.propertyValue;
|
|
5635
5634
|
});
|
|
5636
5635
|
const status = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => snapshot === null || snapshot === void 0 ? void 0 : snapshot.value);
|
|
5636
|
+
useEffect(() => {
|
|
5637
|
+
if (property && property.value !== value) {
|
|
5638
|
+
readFromDb();
|
|
5639
|
+
}
|
|
5640
|
+
}, [property, value]);
|
|
5637
5641
|
const readFromDb = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
5638
5642
|
if (isReadingFromDb) {
|
|
5639
5643
|
return;
|
|
@@ -5642,7 +5646,7 @@ const useItemProperty = (propertyName, seedLocalId) => {
|
|
|
5642
5646
|
const foundProperty = yield ItemProperty.find({ propertyName, seedLocalId });
|
|
5643
5647
|
setIsReadingFromDb(false);
|
|
5644
5648
|
if (!foundProperty) {
|
|
5645
|
-
logger$
|
|
5649
|
+
logger$2(`[useItemPropertyTest] [readFromDb] no property found for Item.${seedLocalId}.${propertyName}`);
|
|
5646
5650
|
return;
|
|
5647
5651
|
}
|
|
5648
5652
|
setProperty(() => foundProperty);
|
|
@@ -5651,6 +5655,9 @@ const useItemProperty = (propertyName, seedLocalId) => {
|
|
|
5651
5655
|
useEffect(() => {
|
|
5652
5656
|
readFromDb();
|
|
5653
5657
|
}, []);
|
|
5658
|
+
// TODO: How can we force a re-render when the property is updated?
|
|
5659
|
+
// Right now, the value will trigger an update because it's using a selector
|
|
5660
|
+
// and a change is pushed to the hook listener.
|
|
5654
5661
|
return {
|
|
5655
5662
|
property,
|
|
5656
5663
|
isInitialized,
|
|
@@ -5677,7 +5684,7 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
|
5677
5684
|
seedUid,
|
|
5678
5685
|
});
|
|
5679
5686
|
if (!foundItem) {
|
|
5680
|
-
logger$
|
|
5687
|
+
logger$2('[useItem] [getItemFromDb] no item found', modelName, seedLocalId);
|
|
5681
5688
|
return;
|
|
5682
5689
|
}
|
|
5683
5690
|
setItem(() => foundItem);
|
|
@@ -5688,6 +5695,12 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
|
5688
5695
|
readFromDb();
|
|
5689
5696
|
}
|
|
5690
5697
|
}, [internalStatus, status]);
|
|
5698
|
+
useEffect(() => {
|
|
5699
|
+
eventEmitter.addListener(`item.${modelName}.${seedLocalId}.update`, readFromDb);
|
|
5700
|
+
return () => {
|
|
5701
|
+
eventEmitter.removeListener(`item.${modelName}.${seedLocalId}.update`, readFromDb);
|
|
5702
|
+
};
|
|
5703
|
+
}, []);
|
|
5691
5704
|
return {
|
|
5692
5705
|
item,
|
|
5693
5706
|
isInitialized,
|
|
@@ -5753,7 +5766,7 @@ const useDbsAreReady = () => {
|
|
|
5753
5766
|
const globalService = getGlobalService();
|
|
5754
5767
|
const internalService = globalService.getSnapshot().context.internalService;
|
|
5755
5768
|
if (!internalService) {
|
|
5756
|
-
logger$
|
|
5769
|
+
logger$2('[useDbsAreReady] [useEffect] no internalService');
|
|
5757
5770
|
globalSubscription = globalService.subscribe(({ context }) => {
|
|
5758
5771
|
if (!internalSubscription && context && context.internalService) {
|
|
5759
5772
|
globalSubscription === null || globalSubscription === void 0 ? void 0 : globalSubscription.unsubscribe();
|
|
@@ -5936,7 +5949,7 @@ const getVersionData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seed
|
|
|
5936
5949
|
};
|
|
5937
5950
|
});
|
|
5938
5951
|
|
|
5939
|
-
const logger = debug('app:write');
|
|
5952
|
+
const logger$1 = debug('app:write');
|
|
5940
5953
|
const createSeed = (_a) => __awaiter(void 0, [_a], void 0, function* ({ type }) {
|
|
5941
5954
|
const appDb = getAppDb();
|
|
5942
5955
|
const newSeedLocalId = generateId();
|
|
@@ -6008,7 +6021,7 @@ const deleteItem = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seedLoca
|
|
|
6008
6021
|
});
|
|
6009
6022
|
const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function* ({ propertyLocalId, propertyName, newValue, seedUid, seedLocalId, modelName, refSeedType, refResolvedValue, refResolvedDisplayValue, versionLocalId, versionUid, schemaUid, }) {
|
|
6010
6023
|
if (!propertyLocalId && !seedLocalId) {
|
|
6011
|
-
logger(`[db/write] [updateItemPropertyValue] no propertyLocalId or seedLocalId for property: ${propertyName}`);
|
|
6024
|
+
logger$1(`[db/write] [updateItemPropertyValue] no propertyLocalId or seedLocalId for property: ${propertyName}`);
|
|
6012
6025
|
return;
|
|
6013
6026
|
}
|
|
6014
6027
|
let safeNewValue = newValue;
|
|
@@ -6047,7 +6060,7 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
6047
6060
|
const schemaUid = mostRecentRecord[9];
|
|
6048
6061
|
const easDataType = mostRecentRecord[10];
|
|
6049
6062
|
if (propertyValueFromDb === newValue) {
|
|
6050
|
-
logger(`[db/write] [updateItemPropertyValue] value is the same as most recent record for property: ${propertyNameFromDb}`);
|
|
6063
|
+
logger$1(`[db/write] [updateItemPropertyValue] value is the same as most recent record for property: ${propertyNameFromDb}`);
|
|
6051
6064
|
return;
|
|
6052
6065
|
}
|
|
6053
6066
|
// This means we already have a local-only record so we should just update that one
|
|
@@ -6060,6 +6073,7 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
6060
6073
|
updated_at = ${Date.now()}
|
|
6061
6074
|
WHERE local_id = '${localId}';`;
|
|
6062
6075
|
yield runQueryForStatement(updatePropertyStatement);
|
|
6076
|
+
eventEmitter.emit(`item.${modelName}.${seedLocalId}.update`);
|
|
6063
6077
|
return;
|
|
6064
6078
|
}
|
|
6065
6079
|
const seedDataFromDb = yield getSeedData({ seedLocalId });
|
|
@@ -6076,6 +6090,9 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
6076
6090
|
version_uid,
|
|
6077
6091
|
schema_uid,
|
|
6078
6092
|
eas_data_type,
|
|
6093
|
+
ref_seed_type,
|
|
6094
|
+
ref_resolved_value,
|
|
6095
|
+
ref_resolved_display_value,
|
|
6079
6096
|
created_at)
|
|
6080
6097
|
VALUES ('${newLocalId}',
|
|
6081
6098
|
'${propertyNameFromDb}',
|
|
@@ -6086,9 +6103,13 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
6086
6103
|
'${versionLocalId}',
|
|
6087
6104
|
${(versionDataFromDb === null || versionDataFromDb === void 0 ? void 0 : versionDataFromDb.uid) ? `'${versionDataFromDb.uid}'` : 'NULL'},
|
|
6088
6105
|
'${schemaUid}',
|
|
6089
|
-
'${easDataType}',
|
|
6106
|
+
${easDataType ? `'${easDataType}'` : 'NULL'},
|
|
6107
|
+
${refSeedType ? `'${refSeedType}'` : 'NULL'},
|
|
6108
|
+
${refResolvedValue ? `'${refResolvedValue}'` : 'NULL'},
|
|
6109
|
+
${refResolvedDisplayValue ? `'${refResolvedDisplayValue}'` : 'NULL'},
|
|
6090
6110
|
${Date.now()});`;
|
|
6091
6111
|
yield runQueryForStatement(newPropertyStatement);
|
|
6112
|
+
eventEmitter.emit(`item.${modelName}.${seedLocalId}.update`);
|
|
6092
6113
|
return;
|
|
6093
6114
|
}
|
|
6094
6115
|
// Here there are no records for this property on this seed so we should create one
|
|
@@ -6114,6 +6135,9 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
6114
6135
|
version_local_id,
|
|
6115
6136
|
version_uid,
|
|
6116
6137
|
schema_uid,
|
|
6138
|
+
ref_seed_type,
|
|
6139
|
+
ref_resolved_value,
|
|
6140
|
+
ref_resolved_display_value,
|
|
6117
6141
|
created_at)
|
|
6118
6142
|
VALUES ('${newLocalId}',
|
|
6119
6143
|
'${propertyName}',
|
|
@@ -6124,8 +6148,12 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
6124
6148
|
'${versionLocalId}',
|
|
6125
6149
|
${versionUid ? `'${versionUid}'` : 'NULL'},
|
|
6126
6150
|
'${schemaUid}',
|
|
6151
|
+
${refSeedType ? `'${refSeedType}'` : 'NULL'},
|
|
6152
|
+
${refResolvedValue ? `'${refResolvedValue}'` : 'NULL'},
|
|
6153
|
+
${refResolvedDisplayValue ? `'${refResolvedDisplayValue}'` : 'NULL'},
|
|
6127
6154
|
${Date.now()});`;
|
|
6128
6155
|
yield runQueryForStatement(newPropertyStatement);
|
|
6156
|
+
eventEmitter.emit(`item.${modelName}.${seedLocalId}.update`);
|
|
6129
6157
|
});
|
|
6130
6158
|
// if (propertyLocalId) {
|
|
6131
6159
|
// const existingItemPropertyStatement = `SELECT local_id,
|
|
@@ -6605,9 +6633,10 @@ const initSeedSync = () => {
|
|
|
6605
6633
|
}
|
|
6606
6634
|
};
|
|
6607
6635
|
|
|
6636
|
+
const logger = debug('app:services:events');
|
|
6608
6637
|
const handleServiceSaveState = (event) => {
|
|
6609
6638
|
const { state, serviceId } = event;
|
|
6610
|
-
|
|
6639
|
+
logger(`[browser] [service.saveState.request] serviceId: ${serviceId}`);
|
|
6611
6640
|
localStorage.setItem(`seed_sdk_service_${serviceId}`, JSON.stringify(state));
|
|
6612
6641
|
};
|
|
6613
6642
|
const setupServicesEventHandlers = () => {
|
|
@@ -6887,7 +6916,7 @@ const client = {
|
|
|
6887
6916
|
console.error('fs listeners not ready during init');
|
|
6888
6917
|
}
|
|
6889
6918
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6890
|
-
import('./seed.schema.config-
|
|
6919
|
+
import('./seed.schema.config-CFp_quWt.js').then(({ models }) => {
|
|
6891
6920
|
for (const [key, value] of Object.entries(models)) {
|
|
6892
6921
|
modelStore.set(key, value);
|
|
6893
6922
|
}
|
|
@@ -6945,4 +6974,4 @@ const client = {
|
|
|
6945
6974
|
};
|
|
6946
6975
|
|
|
6947
6976
|
export { APP_DB_CONFIG as A, useCreateItem as B, CHILD_SNAPSHOT as C, DB_NAME_SDK_CONFIG as D, useItemProperty as E, useDeleteItem as F, GET_SCHEMAS as G, getGlobalService as H, Item as I, Json as J, getCorrectId as K, List as L, Model as M, Property as P, Relation as R, SCHEMA_NJK as S, Text as T, __decorate as _, GET_SEEDS as a, 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, __metadata as h, itemMachineSingle as i, internalMachine as j, isNode as k, isBrowser as l, isReactNative as m, __awaiter as n, models as o, SCHEMA_TS as p, SDK_DB_CONFIG as q, SEED_DB_CONFIG as r, addModelsToInternalDb as s, client as t, ImageSrc as u, ItemProperty as v, withSeed as w, useItems as x, useItem as y, useItemProperties as z };
|
|
6948
|
-
//# sourceMappingURL=index-
|
|
6977
|
+
//# sourceMappingURL=index-CNBlL-jO.js.map
|