@seedprotocol/sdk 0.1.70 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-Cy1fke9s.js → index-Cv-NmpW4.js} +17 -22
- package/dist/index-Cv-NmpW4.js.map +1 -0
- package/dist/{index-B6WilINl.js → index-DXh19Ejc.js} +2 -2
- package/dist/index-DXh19Ejc.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-dylVDX7W.js → seed.schema.config-Bp82HrfV.js} +2 -2
- package/dist/{seed.schema.config-dylVDX7W.js.map → seed.schema.config-Bp82HrfV.js.map} +1 -1
- package/dist/src/hydrateFromDb.ts +5 -19
- package/dist/src/seed.ts +4 -31
- package/dist/src/updateMetadata.ts +19 -0
- package/dist/types/src/browser/db/write/updateMetadata.d.ts +5 -0
- package/dist/types/src/browser/db/write/updateMetadata.d.ts.map +1 -0
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-B6WilINl.js.map +0 -1
- package/dist/index-Cy1fke9s.js.map +0 -1
|
@@ -896,6 +896,15 @@ const getAddressesFromDb = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
896
896
|
return JSON.parse(addressArrayString);
|
|
897
897
|
});
|
|
898
898
|
|
|
899
|
+
const updateMetadata = (metadataValues) => __awaiter(void 0, void 0, void 0, function* () {
|
|
900
|
+
const appDb = getAppDb();
|
|
901
|
+
const { localId } = metadataValues, rest = __rest(metadataValues, ["localId"]);
|
|
902
|
+
if (!localId) {
|
|
903
|
+
throw new Error('No localId provided to updateMetadata');
|
|
904
|
+
}
|
|
905
|
+
yield appDb.update(metadata).set(rest).where(eq(metadata.localId, localId));
|
|
906
|
+
});
|
|
907
|
+
|
|
899
908
|
const logger$m = debug('app:property:actors:hydrateFromDb');
|
|
900
909
|
const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
901
910
|
const { seedUid, seedLocalId, propertyName: propertyNameRaw, propertyValue, propertyRecordSchema, itemModelName, } = context;
|
|
@@ -1001,6 +1010,10 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1001
1010
|
const fileContents = yield fs.promises.readFile(filePath);
|
|
1002
1011
|
const fileHandler = new File([fileContents], refResolvedValue);
|
|
1003
1012
|
refResolvedDisplayValue = URL.createObjectURL(fileHandler);
|
|
1013
|
+
yield updateMetadata({
|
|
1014
|
+
localId,
|
|
1015
|
+
refResolvedDisplayValue,
|
|
1016
|
+
});
|
|
1004
1017
|
}
|
|
1005
1018
|
}
|
|
1006
1019
|
}
|
|
@@ -1010,24 +1023,6 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1010
1023
|
typeof propertyValueFromDb === 'string') {
|
|
1011
1024
|
propertyValueProcessed = propertyValueFromDb.split(',');
|
|
1012
1025
|
}
|
|
1013
|
-
if (seedLocalIdFromDb === 'sAFXuO7Uez') {
|
|
1014
|
-
console.log(`[hydrateFromDb] sending updateContext with:`, {
|
|
1015
|
-
type: 'updateContext',
|
|
1016
|
-
localId,
|
|
1017
|
-
uid,
|
|
1018
|
-
propertyValue: propertyValueProcessed,
|
|
1019
|
-
seedLocalId: seedLocalIdFromDb,
|
|
1020
|
-
seedUid: seedUidFromDb,
|
|
1021
|
-
versionLocalId: versionLocalIdFromDb,
|
|
1022
|
-
versionUid: versionUidFromDb,
|
|
1023
|
-
schemaUid: schemaUidFromDb,
|
|
1024
|
-
refValueType,
|
|
1025
|
-
localStorageDir,
|
|
1026
|
-
resolvedValue: refResolvedValue,
|
|
1027
|
-
resolvedDisplayValue: refResolvedDisplayValue,
|
|
1028
|
-
renderValue: refResolvedDisplayValue,
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
1026
|
sendBack({
|
|
1032
1027
|
type: 'updateContext',
|
|
1033
1028
|
localId,
|
|
@@ -1047,7 +1042,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1047
1042
|
if (propertyRecordSchema &&
|
|
1048
1043
|
propertyRecordSchema.storageType &&
|
|
1049
1044
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
1050
|
-
const { Item } = yield import('./index-
|
|
1045
|
+
const { Item } = yield import('./index-DXh19Ejc.js');
|
|
1051
1046
|
const item = yield Item.find({
|
|
1052
1047
|
seedLocalId,
|
|
1053
1048
|
modelName: itemModelName,
|
|
@@ -2552,7 +2547,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2552
2547
|
if (!models$1) {
|
|
2553
2548
|
return;
|
|
2554
2549
|
}
|
|
2555
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2550
|
+
const { models: SeedModels } = yield import('./seed.schema.config-Bp82HrfV.js');
|
|
2556
2551
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2557
2552
|
let hasModelsInDb = false;
|
|
2558
2553
|
const schemaDefsByModelName = new Map();
|
|
@@ -6504,7 +6499,7 @@ const client = {
|
|
|
6504
6499
|
console.error('fs listeners not ready during init');
|
|
6505
6500
|
}
|
|
6506
6501
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6507
|
-
import('./seed.schema.config-
|
|
6502
|
+
import('./seed.schema.config-Bp82HrfV.js').then(({ models }) => {
|
|
6508
6503
|
for (const [key, value] of Object.entries(models)) {
|
|
6509
6504
|
setModel(key, value);
|
|
6510
6505
|
}
|
|
@@ -7465,4 +7460,4 @@ if (isNode()) {
|
|
|
7465
7460
|
}
|
|
7466
7461
|
|
|
7467
7462
|
export { GET_SCHEMAS as G, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, GET_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, ImageSrc as h, itemMachineSingle as i, ItemProperty as j, useItem as k, useItemProperties as l, useCreateItem as m, useItemProperty as n, useDeleteItem as o, useGlobalServiceStatus as p, useServices as q, getGlobalService as r, client as s, getCorrectId as t, useItems as u, withSeed as w };
|
|
7468
|
-
//# sourceMappingURL=index-
|
|
7463
|
+
//# sourceMappingURL=index-Cv-NmpW4.js.map
|