@seedprotocol/sdk 0.2.30 → 0.2.31
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/{Db-lX4nNJTb.js → Db-CPpw7pPl.js} +2 -2
- package/dist/{Db-lX4nNJTb.js.map → Db-CPpw7pPl.js.map} +1 -1
- package/dist/{Db-Bu5Y7_fn.js → Db-DW4cvius.js} +2 -2
- package/dist/{Db-Bu5Y7_fn.js.map → Db-DW4cvius.js.map} +1 -1
- package/dist/{Item-BRHX17yq.js → Item-DJFIzrGb.js} +2 -2
- package/dist/{Item-BRHX17yq.js.map → Item-DJFIzrGb.js.map} +1 -1
- package/dist/{ItemProperty-CZzIP1b8.js → ItemProperty-DabiYJLq.js} +2 -2
- package/dist/{ItemProperty-CZzIP1b8.js.map → ItemProperty-DabiYJLq.js.map} +1 -1
- package/dist/{index-BCmsQoYg.js → index-D3qJ54jj.js} +70 -87
- package/dist/index-D3qJ54jj.js.map +1 -0
- package/dist/{index-DzDVTUae.js → index-MhbsovAK.js} +2 -2
- package/dist/index-MhbsovAK.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-BswsDyRe.js → seed.schema.config-DCFBkB3M.js} +2 -2
- package/dist/{seed.schema.config-BswsDyRe.js.map → seed.schema.config-DCFBkB3M.js.map} +1 -1
- package/dist/src/createMetadata.ts +1 -1
- package/dist/src/hydrateFromDb.ts +2 -36
- package/dist/src/propertyMachine.ts +1 -1
- package/dist/src/saveItemStorage.ts +1 -1
- package/dist/src/waitForDb.ts +18 -17
- package/dist/types/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-BCmsQoYg.js.map +0 -1
- package/dist/index-DzDVTUae.js.map +0 -1
|
@@ -134,7 +134,7 @@ const initItem = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
134
134
|
Item$2 = (yield Promise.resolve().then(function () { return Item$1; })).Item;
|
|
135
135
|
}
|
|
136
136
|
if (!isBrowser()) {
|
|
137
|
-
Item$2 = (yield import('./Item-
|
|
137
|
+
Item$2 = (yield import('./Item-DJFIzrGb.js')).Item;
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -184,17 +184,17 @@ const initItemProperty = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
184
184
|
ItemProperty$2 = (yield Promise.resolve().then(function () { return ItemProperty$1; })).ItemProperty;
|
|
185
185
|
}
|
|
186
186
|
if (!isBrowser()) {
|
|
187
|
-
ItemProperty$2 = (yield import('./ItemProperty-
|
|
187
|
+
ItemProperty$2 = (yield import('./ItemProperty-DabiYJLq.js')).ItemProperty;
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
let Db;
|
|
192
192
|
const initDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
193
193
|
if (isBrowser()) {
|
|
194
|
-
Db = (yield import('./Db-
|
|
194
|
+
Db = (yield import('./Db-DW4cvius.js')).Db;
|
|
195
195
|
}
|
|
196
196
|
if (!isBrowser()) {
|
|
197
|
-
Db = (yield import('./Db-
|
|
197
|
+
Db = (yield import('./Db-CPpw7pPl.js')).Db;
|
|
198
198
|
}
|
|
199
199
|
// TODO: Add config for React Native
|
|
200
200
|
});
|
|
@@ -264,7 +264,7 @@ const setModel = (modelName, model) => {
|
|
|
264
264
|
modelStore.set(modelName, model);
|
|
265
265
|
};
|
|
266
266
|
|
|
267
|
-
const logger$
|
|
267
|
+
const logger$o = debug('app:shared:helpers');
|
|
268
268
|
const { alphanumeric } = nanoIdDictionary;
|
|
269
269
|
const generateId = () => {
|
|
270
270
|
return customAlphabet(alphanumeric, 10)();
|
|
@@ -345,7 +345,7 @@ const convertTxIdToImageSrc = (txId) => __awaiter(void 0, void 0, void 0, functi
|
|
|
345
345
|
const imageFilePath = `/files/images/${txId}`;
|
|
346
346
|
const fileExists = yield fs.promises.exists(imageFilePath);
|
|
347
347
|
if (!fileExists) {
|
|
348
|
-
logger$
|
|
348
|
+
logger$o(`[ItemView] [updateImageSrc] ${imageFilePath} does not exist`);
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
const uint = yield fs.promises.readFile(imageFilePath);
|
|
@@ -812,7 +812,7 @@ const createMetadata = (metadataValues, propertyRecordSchema) => __awaiter(void
|
|
|
812
812
|
if (propertyRecordSchema &&
|
|
813
813
|
propertyRecordSchema.localStorageDir &&
|
|
814
814
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
815
|
-
metadataValues.refResolvedValue = `${metadataValues.seedLocalId}${propertyRecordSchema.filenameSuffix}`;
|
|
815
|
+
metadataValues.refResolvedValue = `${metadataValues.seedUid || metadataValues.seedLocalId}${propertyRecordSchema.filenameSuffix}`;
|
|
816
816
|
metadataValues.refValueType = 'file';
|
|
817
817
|
}
|
|
818
818
|
return appDb
|
|
@@ -1582,7 +1582,7 @@ const syncDbWithEasHandler = throttle((_) => __awaiter(void 0, void 0, void 0, f
|
|
|
1582
1582
|
trailing: false,
|
|
1583
1583
|
});
|
|
1584
1584
|
|
|
1585
|
-
const logger$
|
|
1585
|
+
const logger$n = debug('app:services:global:actors:initialize');
|
|
1586
1586
|
const initialize$2 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
1587
1587
|
const { internalService, models, endpoints, arweaveDomain, addresses, } = context;
|
|
1588
1588
|
if (!internalService) {
|
|
@@ -1601,7 +1601,7 @@ const initialize$2 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
1601
1601
|
const _initInternal = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1602
1602
|
return new Promise((resolve) => {
|
|
1603
1603
|
internalSubscription = internalService.subscribe((snapshot) => {
|
|
1604
|
-
logger$
|
|
1604
|
+
logger$n('[sdk] [internal] snapshot', snapshot);
|
|
1605
1605
|
if (snapshot.value === 'ready') {
|
|
1606
1606
|
resolve();
|
|
1607
1607
|
}
|
|
@@ -1643,7 +1643,7 @@ const initialize$2 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
1643
1643
|
yield fetchSchemaUids();
|
|
1644
1644
|
});
|
|
1645
1645
|
_initFileSystem().then(() => {
|
|
1646
|
-
logger$
|
|
1646
|
+
logger$n('[global/actors] File system initialized');
|
|
1647
1647
|
});
|
|
1648
1648
|
_initInternal()
|
|
1649
1649
|
.then(() => {
|
|
@@ -1653,7 +1653,7 @@ const initialize$2 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
1653
1653
|
return _initEas();
|
|
1654
1654
|
})
|
|
1655
1655
|
.then(() => {
|
|
1656
|
-
logger$
|
|
1656
|
+
logger$n('[global/actors] Internal initialized');
|
|
1657
1657
|
sendBack({ type: GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY });
|
|
1658
1658
|
internalSubscription === null || internalSubscription === void 0 ? void 0 : internalSubscription.unsubscribe();
|
|
1659
1659
|
});
|
|
@@ -1666,7 +1666,7 @@ const initialize$2 = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
|
1666
1666
|
};
|
|
1667
1667
|
});
|
|
1668
1668
|
|
|
1669
|
-
const logger$
|
|
1669
|
+
const logger$m = debug('app:services:global:actors:getSchemaForModel');
|
|
1670
1670
|
const getSchemaForModel = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
1671
1671
|
const { modelName } = event;
|
|
1672
1672
|
if (!modelName) {
|
|
@@ -1682,12 +1682,12 @@ const getSchemaForModel = fromCallback(({ sendBack, input: { context, event } })
|
|
|
1682
1682
|
if (!model) {
|
|
1683
1683
|
throw new Error(`Model ${modelName} not found`);
|
|
1684
1684
|
}
|
|
1685
|
-
logger$
|
|
1685
|
+
logger$m('[service/actor] [getSchemaForModel] model:', model);
|
|
1686
1686
|
sendBack({ type: 'schemaForModel', schema: model.schema });
|
|
1687
1687
|
return () => { };
|
|
1688
1688
|
});
|
|
1689
1689
|
|
|
1690
|
-
const logger$
|
|
1690
|
+
const logger$l = debug('app:services:global:actors:addModelsToDb');
|
|
1691
1691
|
const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
1692
1692
|
const { models: models$1 } = context;
|
|
1693
1693
|
const _addModelsToDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1696,12 +1696,12 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1696
1696
|
if (!models$1) {
|
|
1697
1697
|
return;
|
|
1698
1698
|
}
|
|
1699
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
1699
|
+
const { models: SeedModels } = yield import('./seed.schema.config-DCFBkB3M.js');
|
|
1700
1700
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
1701
1701
|
let hasModelsInDb = false;
|
|
1702
1702
|
const schemaDefsByModelName = new Map();
|
|
1703
1703
|
for (const [modelName, _] of Object.entries(allModels)) {
|
|
1704
|
-
logger$
|
|
1704
|
+
logger$l('[helpers/db] [addModelsToInternalDb] starting modelName:', modelName);
|
|
1705
1705
|
let foundModel;
|
|
1706
1706
|
const foundModelsQuery = yield appDb
|
|
1707
1707
|
.select()
|
|
@@ -1711,7 +1711,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1711
1711
|
yield appDb.insert(models).values({
|
|
1712
1712
|
name: modelName,
|
|
1713
1713
|
});
|
|
1714
|
-
logger$
|
|
1714
|
+
logger$l('[global/actors] [addModelsToDb] inserted model:', modelName);
|
|
1715
1715
|
const foundModels = yield appDb
|
|
1716
1716
|
.select({
|
|
1717
1717
|
id: models.id,
|
|
@@ -1783,10 +1783,10 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1783
1783
|
return () => { };
|
|
1784
1784
|
});
|
|
1785
1785
|
|
|
1786
|
-
const logger$
|
|
1786
|
+
const logger$k = debug('app:services:db:actors:checkStatus');
|
|
1787
1787
|
const checkStatus = fromCallback(({ sendBack, input: { context } }) => {
|
|
1788
1788
|
const { dbName } = context;
|
|
1789
|
-
logger$
|
|
1789
|
+
logger$k('[db/actors] checkStatus context', context);
|
|
1790
1790
|
const pathToDir = `${BROWSER_FS_TOP_DIR}`;
|
|
1791
1791
|
const pathToDbDir = `${pathToDir}/db`;
|
|
1792
1792
|
const pathToDb = `${pathToDbDir}/${dbName}.sqlite3`;
|
|
@@ -1817,9 +1817,9 @@ const checkStatus = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1817
1817
|
});
|
|
1818
1818
|
});
|
|
1819
1819
|
|
|
1820
|
-
const logger$
|
|
1820
|
+
const logger$j = debug('app:services:db:actors:connectToDb');
|
|
1821
1821
|
const connectToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
1822
|
-
logger$
|
|
1822
|
+
logger$j('[db/actors] connectToDb context', context);
|
|
1823
1823
|
const { dbName, pathToDir } = context;
|
|
1824
1824
|
if (!pathToDir || !dbName) {
|
|
1825
1825
|
throw new Error('pathToDir and dbName are required');
|
|
@@ -1913,7 +1913,7 @@ const waitForFile = (filePath, interval = 500, timeout = 10000) => {
|
|
|
1913
1913
|
});
|
|
1914
1914
|
};
|
|
1915
1915
|
|
|
1916
|
-
const logger$
|
|
1916
|
+
const logger$i = debug('app:services:db:actors:migrate');
|
|
1917
1917
|
const dbExec = (dbId_1, params_1, sql_1, dbName_1, ...args_1) => __awaiter(void 0, [dbId_1, params_1, sql_1, dbName_1, ...args_1], void 0, function* (dbId, params, sql, dbName, retries = 2) {
|
|
1918
1918
|
const rowsToReturnRaw = [];
|
|
1919
1919
|
const sqliteWasmClient = yield getSqliteWasmClient();
|
|
@@ -1979,7 +1979,7 @@ const dbExec = (dbId_1, params_1, sql_1, dbName_1, ...args_1) => __awaiter(void
|
|
|
1979
1979
|
});
|
|
1980
1980
|
const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
1981
1981
|
const { pathToDbDir, dbId, dbName } = context;
|
|
1982
|
-
logger$
|
|
1982
|
+
logger$i('[db/actors] migrate context', context);
|
|
1983
1983
|
const schemaGlobString = `${BROWSER_FS_TOP_DIR}/schema/*`;
|
|
1984
1984
|
let journalExists = false;
|
|
1985
1985
|
// const _initFs = async (): Promise<void> => {
|
|
@@ -2162,7 +2162,7 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2162
2162
|
return () => { };
|
|
2163
2163
|
});
|
|
2164
2164
|
|
|
2165
|
-
const logger$
|
|
2165
|
+
const logger$h = debug('app:services:db:machine');
|
|
2166
2166
|
const { CHECKING_STATUS, VALIDATING, WAITING_FOR_FILES, CONNECTING_TO_DB, MIGRATING, } = DbState;
|
|
2167
2167
|
const dbMachine = setup({
|
|
2168
2168
|
types: {
|
|
@@ -2183,7 +2183,7 @@ const dbMachine = setup({
|
|
|
2183
2183
|
[DB_WAITING_FOR_FILES_RECEIVED]: {
|
|
2184
2184
|
actions: assign({
|
|
2185
2185
|
hasFiles: ({ event }) => {
|
|
2186
|
-
logger$
|
|
2186
|
+
logger$h('[db/machine] DB_WAITING_FOR_FILES_RECEIVED event:', event);
|
|
2187
2187
|
return true;
|
|
2188
2188
|
},
|
|
2189
2189
|
}),
|
|
@@ -2192,8 +2192,8 @@ const dbMachine = setup({
|
|
|
2192
2192
|
target: `.${CHECKING_STATUS}`,
|
|
2193
2193
|
actions: assign({
|
|
2194
2194
|
hasFiles: ({ context, event }) => {
|
|
2195
|
-
logger$
|
|
2196
|
-
logger$
|
|
2195
|
+
logger$h('[db/machine] updateHasFiles event:', event);
|
|
2196
|
+
logger$h('[db/machine] updateHasFiles context:', context);
|
|
2197
2197
|
return event.hasFiles;
|
|
2198
2198
|
},
|
|
2199
2199
|
}),
|
|
@@ -2356,7 +2356,7 @@ const prepareDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2356
2356
|
});
|
|
2357
2357
|
});
|
|
2358
2358
|
|
|
2359
|
-
const logger$
|
|
2359
|
+
const logger$g = debug('app:services:internal:helpers');
|
|
2360
2360
|
/**
|
|
2361
2361
|
* Recursively create directories if they don't exist.
|
|
2362
2362
|
* @param {string} dirPath - The directory path to create.
|
|
@@ -2432,7 +2432,7 @@ const downloadFile = (url, localFilePath) => __awaiter(void 0, void 0, void 0, f
|
|
|
2432
2432
|
if (JSON.stringify(error).includes('File exists')) {
|
|
2433
2433
|
yield fs.promises.readFile(localFilePath, 'utf-8');
|
|
2434
2434
|
}
|
|
2435
|
-
logger$
|
|
2435
|
+
logger$g(`[Error] Failed to download file from ${url}:`, error);
|
|
2436
2436
|
}
|
|
2437
2437
|
busy = false;
|
|
2438
2438
|
});
|
|
@@ -2472,7 +2472,7 @@ const syncDbFiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ filePat
|
|
|
2472
2472
|
fileList = fileList.filter((file) => !filesToExclude.includes(file));
|
|
2473
2473
|
yield fetchFilesRecursively(files, BROWSER_FS_TOP_DIR, fileList);
|
|
2474
2474
|
yield confirmFilesExist(fileList);
|
|
2475
|
-
logger$
|
|
2475
|
+
logger$g('[syncDbFiles] Files synced!');
|
|
2476
2476
|
});
|
|
2477
2477
|
|
|
2478
2478
|
const GET_FILES_METADATA = graphql(/* GraphQL */ `
|
|
@@ -2624,7 +2624,7 @@ const setArweaveDomain = (newDomain) => {
|
|
|
2624
2624
|
domain = newDomain;
|
|
2625
2625
|
};
|
|
2626
2626
|
|
|
2627
|
-
const logger$
|
|
2627
|
+
const logger$f = debug('app:files:download');
|
|
2628
2628
|
const downloadAllFilesRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({ endpoints, eventId, }) {
|
|
2629
2629
|
yield syncDbFiles(endpoints);
|
|
2630
2630
|
eventEmitter.emit('fs.downloadAll.success', { eventId });
|
|
@@ -2710,7 +2710,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2710
2710
|
try {
|
|
2711
2711
|
const res = yield fetch(`https://${ARWEAVE_HOST}/tx/${transactionId}/status`);
|
|
2712
2712
|
if (res.status !== 200) {
|
|
2713
|
-
logger$
|
|
2713
|
+
logger$f(`[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`);
|
|
2714
2714
|
excludedTransactions.add(transactionId);
|
|
2715
2715
|
yield saveAppState('excludedTransactions', JSON.stringify(Array.from(excludedTransactions)));
|
|
2716
2716
|
continue;
|
|
@@ -2765,7 +2765,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2765
2765
|
// string: true,
|
|
2766
2766
|
// })
|
|
2767
2767
|
if (!dataString && !arrayBuffer) {
|
|
2768
|
-
logger$
|
|
2768
|
+
logger$f(`[fetchAll/actors] [fetchAllBinaryData] transaction ${transactionId} data not found`);
|
|
2769
2769
|
}
|
|
2770
2770
|
if (dataString && dataString.startsWith('===FILE_SEPARATOR===')) {
|
|
2771
2771
|
const dataStringParts = dataString
|
|
@@ -2801,7 +2801,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2801
2801
|
contentType !== 'html') {
|
|
2802
2802
|
const possibleImageType = getDataTypeFromString(dataString);
|
|
2803
2803
|
if (!possibleImageType) {
|
|
2804
|
-
logger$
|
|
2804
|
+
logger$f(`[fetchAll/actors] [fetchAllBinaryData] transaction ${transactionId} data not in expected format: ${possibleImageType}`);
|
|
2805
2805
|
continue;
|
|
2806
2806
|
}
|
|
2807
2807
|
contentType = possibleImageType;
|
|
@@ -2868,7 +2868,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
2868
2868
|
}
|
|
2869
2869
|
}
|
|
2870
2870
|
catch (error) {
|
|
2871
|
-
logger$
|
|
2871
|
+
logger$f(error);
|
|
2872
2872
|
}
|
|
2873
2873
|
}
|
|
2874
2874
|
});
|
|
@@ -2914,14 +2914,14 @@ const isFsInitialized = () => {
|
|
|
2914
2914
|
return isInitialized;
|
|
2915
2915
|
};
|
|
2916
2916
|
|
|
2917
|
-
const logger$
|
|
2917
|
+
const logger$e = debug('app:internal:actors:configureFs');
|
|
2918
2918
|
const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
2919
2919
|
const { endpoints, appDbService, filesDir, } = context;
|
|
2920
|
-
logger$
|
|
2920
|
+
logger$e('[internal/actors] [configureFs] Configuring FS');
|
|
2921
2921
|
const _configureFs = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2922
|
-
logger$
|
|
2923
|
-
logger$
|
|
2924
|
-
logger$
|
|
2922
|
+
logger$e('[internal/actors] [configureFs] calling _configureFs');
|
|
2923
|
+
logger$e('[internal/actors] [configureFs] areFsListenersReady:', areFsListenersReady());
|
|
2924
|
+
logger$e('[internal/actors] [configureFs] isFsInitialized:', isFsInitialized());
|
|
2925
2925
|
yield waitForEvent({
|
|
2926
2926
|
req: {
|
|
2927
2927
|
eventLabel: 'fs.downloadAll.request',
|
|
@@ -2950,7 +2950,7 @@ const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2950
2950
|
// }
|
|
2951
2951
|
// }, 200)
|
|
2952
2952
|
// })
|
|
2953
|
-
logger$
|
|
2953
|
+
logger$e('[internal/actors] [configureFs] fs configured!');
|
|
2954
2954
|
});
|
|
2955
2955
|
// Some of our dependencies use fs sync functions, which don't work with
|
|
2956
2956
|
// OPFS. ZenFS creates an async cache of all files so that the sync functions
|
|
@@ -2963,7 +2963,7 @@ const configureFs = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2963
2963
|
return () => { };
|
|
2964
2964
|
});
|
|
2965
2965
|
|
|
2966
|
-
const logger$
|
|
2966
|
+
const logger$d = debug('app:services:internal:actors:saveConfig');
|
|
2967
2967
|
const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
|
|
2968
2968
|
if (typeof window === 'undefined') {
|
|
2969
2969
|
console.error('seedInitBrowser called from non-browser context');
|
|
@@ -3024,20 +3024,20 @@ const saveConfig = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3024
3024
|
value: arweaveDomain || 'arweave.net',
|
|
3025
3025
|
},
|
|
3026
3026
|
});
|
|
3027
|
-
logger$
|
|
3027
|
+
logger$d('[sdk] [internal/actors] Should be done saving');
|
|
3028
3028
|
}
|
|
3029
3029
|
catch (error) {
|
|
3030
3030
|
console.error('Error saving config:', error);
|
|
3031
3031
|
}
|
|
3032
3032
|
});
|
|
3033
3033
|
_saveConfig().then(() => {
|
|
3034
|
-
logger$
|
|
3034
|
+
logger$d('[sdk] [internal/actors] Successfully saved config');
|
|
3035
3035
|
return sendBack({ type: INTERNAL_SAVING_CONFIG_SUCCESS });
|
|
3036
3036
|
});
|
|
3037
3037
|
return () => { };
|
|
3038
3038
|
});
|
|
3039
3039
|
|
|
3040
|
-
const logger$
|
|
3040
|
+
const logger$c = debug('app:services:internal:actors:loadAppDb');
|
|
3041
3041
|
const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
3042
3042
|
const { appDbService } = context;
|
|
3043
3043
|
let subscription;
|
|
@@ -3058,7 +3058,7 @@ const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3058
3058
|
});
|
|
3059
3059
|
_loadAppDb().then(() => {
|
|
3060
3060
|
sendBack({ type: INTERNAL_LOADING_APP_DB_SUCCESS });
|
|
3061
|
-
logger$
|
|
3061
|
+
logger$c('[sdk] [internal/actors] Successfully loaded app DB');
|
|
3062
3062
|
});
|
|
3063
3063
|
return () => {
|
|
3064
3064
|
if (subscription) {
|
|
@@ -3067,7 +3067,7 @@ const loadAppDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3067
3067
|
};
|
|
3068
3068
|
});
|
|
3069
3069
|
|
|
3070
|
-
const logger$
|
|
3070
|
+
const logger$b = debug('app:services:internal:machine');
|
|
3071
3071
|
createBrowserInspector({
|
|
3072
3072
|
autoStart: false,
|
|
3073
3073
|
});
|
|
@@ -3168,7 +3168,7 @@ const internalMachine = setup({
|
|
|
3168
3168
|
[INTERNAL_LOADING_APP_DB_SUCCESS]: {
|
|
3169
3169
|
target: SAVING_CONFIG,
|
|
3170
3170
|
actions: () => {
|
|
3171
|
-
logger$
|
|
3171
|
+
logger$b('[sdk] [internal/index] App DB loaded!');
|
|
3172
3172
|
},
|
|
3173
3173
|
},
|
|
3174
3174
|
},
|
|
@@ -3194,7 +3194,7 @@ const internalMachine = setup({
|
|
|
3194
3194
|
},
|
|
3195
3195
|
ready: {
|
|
3196
3196
|
entry: () => {
|
|
3197
|
-
logger$
|
|
3197
|
+
logger$b('[sdk] [internal/index] Ready!');
|
|
3198
3198
|
},
|
|
3199
3199
|
meta: {
|
|
3200
3200
|
displayText: "Crossing the t's ...",
|
|
@@ -3209,7 +3209,7 @@ const internalMachine = setup({
|
|
|
3209
3209
|
},
|
|
3210
3210
|
},
|
|
3211
3211
|
entry: () => {
|
|
3212
|
-
logger$
|
|
3212
|
+
logger$b('[sdk] [internal/index] Error!');
|
|
3213
3213
|
},
|
|
3214
3214
|
meta: {
|
|
3215
3215
|
displayText: 'Whoops! Something went wrong.',
|
|
@@ -3447,7 +3447,7 @@ const fetchDbData = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3447
3447
|
return () => { };
|
|
3448
3448
|
});
|
|
3449
3449
|
|
|
3450
|
-
const logger$
|
|
3450
|
+
const logger$a = debug('app:allItemsActors:fetchSeeds');
|
|
3451
3451
|
const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
|
|
3452
3452
|
const { queryVariables, modelName } = context;
|
|
3453
3453
|
if (!queryVariables) {
|
|
@@ -3459,7 +3459,7 @@ const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
3459
3459
|
const queryClient = BaseQueryClient.getQueryClient();
|
|
3460
3460
|
const easClient = BaseEasClient.getEasClient();
|
|
3461
3461
|
const cachedResults = queryClient.getQueryData(queryKey);
|
|
3462
|
-
logger$
|
|
3462
|
+
logger$a(`[allItemsActors] [fetchSeeds] cachedResults ${Date.now()}`, cachedResults);
|
|
3463
3463
|
const results = yield queryClient.fetchQuery({
|
|
3464
3464
|
queryKey,
|
|
3465
3465
|
queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient.request(GET_SEEDS, queryVariables); }),
|
|
@@ -3908,13 +3908,13 @@ const preparePublishRequestData = fromCallback(({ sendBack, input: { context } }
|
|
|
3908
3908
|
});
|
|
3909
3909
|
});
|
|
3910
3910
|
|
|
3911
|
-
const logger$
|
|
3911
|
+
const logger$9 = debug('app:services:publish:actors:upload');
|
|
3912
3912
|
const upload = fromCallback(({ sendBack, input: { context } }) => {
|
|
3913
3913
|
const { localId } = context;
|
|
3914
3914
|
const _upload = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
3915
3915
|
const item = yield Item.find({ seedLocalId: localId });
|
|
3916
3916
|
if (!item) {
|
|
3917
|
-
logger$
|
|
3917
|
+
logger$9('no item with localId', localId);
|
|
3918
3918
|
return false;
|
|
3919
3919
|
}
|
|
3920
3920
|
const editedProperties = yield item.getEditedProperties();
|
|
@@ -4767,7 +4767,7 @@ const getSeedData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seedLoc
|
|
|
4767
4767
|
return rows[0];
|
|
4768
4768
|
});
|
|
4769
4769
|
|
|
4770
|
-
const logger$
|
|
4770
|
+
const logger$8 = debug('app:db:read:getItemData');
|
|
4771
4771
|
const getItemData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelName, seedLocalId, seedUid, }) {
|
|
4772
4772
|
if (!seedLocalId && !seedUid) {
|
|
4773
4773
|
throw new Error('[db/queries] [getItem] no seedLocalId or seedUid');
|
|
@@ -4775,7 +4775,7 @@ const getItemData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelNa
|
|
|
4775
4775
|
if (seedUid && !seedLocalId) {
|
|
4776
4776
|
const seedData = yield getSeedData({ seedUid });
|
|
4777
4777
|
if (!seedData) {
|
|
4778
|
-
logger$
|
|
4778
|
+
logger$8('[db/queries] [getItem] no seedData seedUid', seedUid);
|
|
4779
4779
|
return;
|
|
4780
4780
|
}
|
|
4781
4781
|
seedLocalId = seedData.localId;
|
|
@@ -4802,7 +4802,7 @@ const getItemData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelNa
|
|
|
4802
4802
|
.orderBy(sql.raw('COALESCE(attestation_created_at, created_at) DESC'))
|
|
4803
4803
|
.groupBy(seeds.localId);
|
|
4804
4804
|
if (!itemDataRows || itemDataRows.length === 0) {
|
|
4805
|
-
logger$
|
|
4805
|
+
logger$8('[db/queries] [getItemDataFromDb] no itemDataRows');
|
|
4806
4806
|
return;
|
|
4807
4807
|
}
|
|
4808
4808
|
let itemData = itemDataRows[0];
|
|
@@ -5030,7 +5030,7 @@ const getRelationValueData = (propertyValue) => __awaiter(void 0, void 0, void 0
|
|
|
5030
5030
|
return rows[0];
|
|
5031
5031
|
});
|
|
5032
5032
|
|
|
5033
|
-
const logger$
|
|
5033
|
+
const logger$7 = debug('app:property:actors:resolveRelatedValue');
|
|
5034
5034
|
const storageTransactionIdToContentUrl = new Map();
|
|
5035
5035
|
const refResolvedValueToContentUrl = new Map();
|
|
5036
5036
|
const seedUidToContentUrl = new Map();
|
|
@@ -5045,7 +5045,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5045
5045
|
parsedValue = JSON.parse(propertyValue);
|
|
5046
5046
|
}
|
|
5047
5047
|
catch (error) {
|
|
5048
|
-
logger$
|
|
5048
|
+
logger$7(`${propertyName} value is not a JSON string.`);
|
|
5049
5049
|
}
|
|
5050
5050
|
if (!parsedValue && seedUidToContentUrl.has(propertyValue)) {
|
|
5051
5051
|
const contentUrl = seedUidToContentUrl.get(propertyValue);
|
|
@@ -5061,11 +5061,11 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5061
5061
|
}
|
|
5062
5062
|
if (Array.isArray(propertyValue)) {
|
|
5063
5063
|
// TODO: Handle array of seedUids
|
|
5064
|
-
logger$
|
|
5064
|
+
logger$7(`${propertyName} value is an array of seedUids`);
|
|
5065
5065
|
return;
|
|
5066
5066
|
}
|
|
5067
5067
|
if (Array.isArray(parsedValue)) {
|
|
5068
|
-
logger$
|
|
5068
|
+
logger$7(`${propertyName} value is a stringified array of seedUids`);
|
|
5069
5069
|
return;
|
|
5070
5070
|
}
|
|
5071
5071
|
const storageTransactionId = yield getStorageTransactionIdForSeedUid(propertyValue);
|
|
@@ -5349,9 +5349,9 @@ const updateMetadata = (metadataValues) => __awaiter(void 0, void 0, void 0, fun
|
|
|
5349
5349
|
yield appDb.update(metadata).set(rest).where(eq(metadata.localId, localId));
|
|
5350
5350
|
});
|
|
5351
5351
|
|
|
5352
|
-
|
|
5352
|
+
debug('app:property:actors:hydrateFromDb');
|
|
5353
5353
|
const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
5354
|
-
const { seedUid, seedLocalId, propertyName: propertyNameRaw,
|
|
5354
|
+
const { seedUid, seedLocalId, propertyName: propertyNameRaw, propertyRecordSchema, modelName, } = context;
|
|
5355
5355
|
let propertyName = propertyNameRaw;
|
|
5356
5356
|
if (propertyRecordSchema &&
|
|
5357
5357
|
propertyRecordSchema.ref &&
|
|
@@ -5407,25 +5407,6 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5407
5407
|
const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, versionLocalId: versionLocalIdFromDb, versionUid: versionUidFromDb, refValueType, localStorageDir, } = firstRow;
|
|
5408
5408
|
let { refResolvedDisplayValue, refResolvedValue } = firstRow;
|
|
5409
5409
|
let propertyValueProcessed = propertyValueFromDb;
|
|
5410
|
-
if (propertyName && !propertyNameFromDb) {
|
|
5411
|
-
logger$7(`Property name from code is ${propertyName} but has not value in db ${propertyNameFromDb} for Property.${localId}`);
|
|
5412
|
-
}
|
|
5413
|
-
if (propertyName &&
|
|
5414
|
-
propertyNameFromDb &&
|
|
5415
|
-
!propertyNameFromDb.includes(propertyName) &&
|
|
5416
|
-
!propertyName.includes(propertyNameFromDb) &&
|
|
5417
|
-
propertyNameFromDb !== propertyName) {
|
|
5418
|
-
logger$7(`Property name from db ${propertyNameFromDb} does not match property name ${propertyName} for Property.${localId}`);
|
|
5419
|
-
}
|
|
5420
|
-
if (propertyValue && propertyValueFromDb !== propertyValue) {
|
|
5421
|
-
logger$7(`Property value from db ${propertyValueFromDb} does not match property value ${propertyValue} for Property.${localId}`);
|
|
5422
|
-
}
|
|
5423
|
-
if (seedLocalIdFromDb !== seedLocalId) {
|
|
5424
|
-
logger$7(`Seed local id from db ${seedLocalIdFromDb} does not match seed local id ${seedLocalId} for Property.${localId}`);
|
|
5425
|
-
}
|
|
5426
|
-
if (seedUidFromDb !== seedUid) {
|
|
5427
|
-
logger$7(`Seed uid from db ${seedUidFromDb} does not match seed uid ${seedUid} for Property.${localId}`);
|
|
5428
|
-
}
|
|
5429
5410
|
if (propertyRecordSchema &&
|
|
5430
5411
|
propertyRecordSchema.refValueType === 'ImageSrc') {
|
|
5431
5412
|
let shouldReadFromFile = true;
|
|
@@ -5456,6 +5437,8 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5456
5437
|
if (!refResolvedValue &&
|
|
5457
5438
|
propertyValueFromDb &&
|
|
5458
5439
|
propertyValueFromDb.length === 66) {
|
|
5440
|
+
// Here the storageTransactionId is stored on a different record and
|
|
5441
|
+
// we want to add it as the refResolvedValue
|
|
5459
5442
|
const storageTransactionQuery = yield appDb
|
|
5460
5443
|
.select({
|
|
5461
5444
|
propertyValue: metadata.propertyValue,
|
|
@@ -5522,7 +5505,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
5522
5505
|
if (propertyRecordSchema &&
|
|
5523
5506
|
propertyRecordSchema.storageType &&
|
|
5524
5507
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
5525
|
-
const { Item } = yield import('./index-
|
|
5508
|
+
const { Item } = yield import('./index-MhbsovAK.js');
|
|
5526
5509
|
const item = yield Item.find({
|
|
5527
5510
|
seedLocalId,
|
|
5528
5511
|
modelName,
|
|
@@ -6112,7 +6095,7 @@ const saveItemStorage = fromCallback(({ sendBack, input: { context, event } }) =
|
|
|
6112
6095
|
}
|
|
6113
6096
|
const localStorageDir = propertyRecordSchema.localStorageDir || propertyData.localStorageDir;
|
|
6114
6097
|
const fileName = propertyData.refResolvedValue ||
|
|
6115
|
-
`${propertyData.seedLocalId}${propertyRecordSchema.filenameSuffix}`;
|
|
6098
|
+
`${propertyData.seedUid || propertyData.seedLocalId}${propertyRecordSchema.filenameSuffix}`;
|
|
6116
6099
|
if (!localStorageDir || !fileName) {
|
|
6117
6100
|
throw new Error(`Missing localStorageDir: ${localStorageDir} or fileName: ${fileName}`);
|
|
6118
6101
|
}
|
|
@@ -6234,7 +6217,7 @@ const propertyMachine = setup({
|
|
|
6234
6217
|
target: 'idle',
|
|
6235
6218
|
actions: assign({
|
|
6236
6219
|
refResolvedDisplayValue: ({ event }) => event.refResolvedDisplayValue,
|
|
6237
|
-
|
|
6220
|
+
refResolvedValue: ({ event }) => event.refResolvedValue,
|
|
6238
6221
|
}),
|
|
6239
6222
|
},
|
|
6240
6223
|
resolvingRelatedValueDone: {
|
|
@@ -8153,7 +8136,7 @@ const client = {
|
|
|
8153
8136
|
arweaveDomain,
|
|
8154
8137
|
filesDir,
|
|
8155
8138
|
});
|
|
8156
|
-
const { models: internalModels } = yield import('./seed.schema.config-
|
|
8139
|
+
const { models: internalModels } = yield import('./seed.schema.config-DCFBkB3M.js');
|
|
8157
8140
|
for (const [key, value] of Object.entries(internalModels)) {
|
|
8158
8141
|
setModel(key, value);
|
|
8159
8142
|
}
|
|
@@ -8201,4 +8184,4 @@ const client = {
|
|
|
8201
8184
|
enableMapSet();
|
|
8202
8185
|
|
|
8203
8186
|
export { BaseItem as B, Db as D, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, BaseItemProperty as a, BaseDb as b, getSqliteWasmClient as c, ImageSrc as d, Item$2 as e, ItemProperty$2 as f, getAppDb as g, useItem as h, isAppDbReady as i, useItemProperties as j, useCreateItem as k, useItemProperty as l, useDeleteItem as m, useGlobalServiceStatus as n, usePublishItem as o, usePersistedSnapshots as p, useServices as q, useService as r, getCorrectId as s, getGlobalService as t, useItems as u, eventEmitter as v, withSeed as w, client as x };
|
|
8204
|
-
//# sourceMappingURL=index-
|
|
8187
|
+
//# sourceMappingURL=index-D3qJ54jj.js.map
|