@seedprotocol/sdk 0.1.76 → 0.1.77
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-nyYoS6hl.js → index-BH0P1ozi.js} +30 -9
- package/dist/index-BH0P1ozi.js.map +1 -0
- package/dist/{index-D5bGQvS6.js → index-BpkGOxI0.js} +2 -2
- package/dist/{index-D5bGQvS6.js.map → index-BpkGOxI0.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-CaxQONHV.js → seed.schema.config-CR4yAjam.js} +2 -2
- package/dist/{seed.schema.config-CaxQONHV.js.map → seed.schema.config-CR4yAjam.js.map} +1 -1
- package/dist/src/hydrateFromDb.ts +36 -6
- package/dist/src/initialize.ts +33 -119
- package/dist/src/queries.ts +27 -6
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/index-nyYoS6hl.js.map +0 -1
|
@@ -906,10 +906,11 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
906
906
|
}
|
|
907
907
|
const _hydrateFromDb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
908
908
|
const appDb = getAppDb();
|
|
909
|
-
const
|
|
910
|
-
if (propertyRecordSchema &&
|
|
909
|
+
const isRelation = propertyRecordSchema &&
|
|
911
910
|
propertyRecordSchema.ref &&
|
|
912
|
-
propertyRecordSchema.dataType === 'Relation'
|
|
911
|
+
propertyRecordSchema.dataType === 'Relation';
|
|
912
|
+
const whereClauses = [];
|
|
913
|
+
if (isRelation) {
|
|
913
914
|
let missingPropertyNameVariant;
|
|
914
915
|
if (propertyName.endsWith('Id')) {
|
|
915
916
|
missingPropertyNameVariant = propertyName.slice(0, -2);
|
|
@@ -942,8 +943,8 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
942
943
|
return;
|
|
943
944
|
}
|
|
944
945
|
const firstRow = rows[0];
|
|
945
|
-
const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, versionLocalId: versionLocalIdFromDb, versionUid: versionUidFromDb, refValueType,
|
|
946
|
-
let { refResolvedDisplayValue } = firstRow;
|
|
946
|
+
const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, versionLocalId: versionLocalIdFromDb, versionUid: versionUidFromDb, refValueType, localStorageDir, } = firstRow;
|
|
947
|
+
let { refResolvedDisplayValue, refResolvedValue } = firstRow;
|
|
947
948
|
let propertyValueProcessed = propertyValueFromDb;
|
|
948
949
|
if (propertyName && !propertyNameFromDb) {
|
|
949
950
|
logger$m(`Property name from code is ${propertyName} but has not value in db ${propertyNameFromDb} for Property.${localId}`);
|
|
@@ -990,6 +991,26 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
990
991
|
propertyRecordSchema.refValueType === 'ImageSrc') {
|
|
991
992
|
dir = 'images';
|
|
992
993
|
}
|
|
994
|
+
if (!refResolvedValue &&
|
|
995
|
+
propertyValueFromDb &&
|
|
996
|
+
propertyValueFromDb.length === 66) {
|
|
997
|
+
const storageTransactionQuery = yield appDb
|
|
998
|
+
.select({
|
|
999
|
+
propertyValue: metadata.propertyValue,
|
|
1000
|
+
})
|
|
1001
|
+
.from(metadata)
|
|
1002
|
+
.where(and(eq(metadata.seedUid, propertyValueFromDb), eq(metadata.propertyName, 'storageTransactionId')));
|
|
1003
|
+
if (storageTransactionQuery && storageTransactionQuery.length > 0) {
|
|
1004
|
+
const row = storageTransactionQuery[0];
|
|
1005
|
+
refResolvedValue = row.propertyValue;
|
|
1006
|
+
console.log('storageTransactionId', refResolvedValue);
|
|
1007
|
+
yield updateMetadata({
|
|
1008
|
+
localId,
|
|
1009
|
+
refResolvedValue,
|
|
1010
|
+
localStorageDir: '/images',
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
993
1014
|
const filePath = `/files/${dir}/${refResolvedValue}`;
|
|
994
1015
|
const fileExists = yield fs.promises.exists(filePath);
|
|
995
1016
|
if (fileExists) {
|
|
@@ -1028,7 +1049,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1028
1049
|
if (propertyRecordSchema &&
|
|
1029
1050
|
propertyRecordSchema.storageType &&
|
|
1030
1051
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
1031
|
-
const { Item } = yield import('./index-
|
|
1052
|
+
const { Item } = yield import('./index-BpkGOxI0.js');
|
|
1032
1053
|
const item = yield Item.find({
|
|
1033
1054
|
seedLocalId,
|
|
1034
1055
|
modelName: itemModelName,
|
|
@@ -2590,7 +2611,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2590
2611
|
if (!models$1) {
|
|
2591
2612
|
return;
|
|
2592
2613
|
}
|
|
2593
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2614
|
+
const { models: SeedModels } = yield import('./seed.schema.config-CR4yAjam.js');
|
|
2594
2615
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2595
2616
|
let hasModelsInDb = false;
|
|
2596
2617
|
const schemaDefsByModelName = new Map();
|
|
@@ -6590,7 +6611,7 @@ const client = {
|
|
|
6590
6611
|
console.error('fs listeners not ready during init');
|
|
6591
6612
|
}
|
|
6592
6613
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6593
|
-
import('./seed.schema.config-
|
|
6614
|
+
import('./seed.schema.config-CR4yAjam.js').then(({ models }) => {
|
|
6594
6615
|
for (const [key, value] of Object.entries(models)) {
|
|
6595
6616
|
setModel(key, value);
|
|
6596
6617
|
}
|
|
@@ -7544,4 +7565,4 @@ if (isNode()) {
|
|
|
7544
7565
|
}
|
|
7545
7566
|
|
|
7546
7567
|
export { GET_SCHEMAS as G, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, GET_SCHEMA_BY_NAME as a, GET_SEEDS as b, GET_SEED_IDS as c, GET_STORAGE_TRANSACTION_ID as d, GET_VERSIONS as e, GET_PROPERTIES as f, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as g, itemMachineAll as h, itemMachineSingle as i, ImageSrc as j, ItemProperty as k, useItem as l, useItemProperties as m, useCreateItem as n, useItemProperty as o, useDeleteItem as p, useGlobalServiceStatus as q, useServices as r, getGlobalService as s, client as t, useItems as u, getCorrectId as v, withSeed as w };
|
|
7547
|
-
//# sourceMappingURL=index-
|
|
7568
|
+
//# sourceMappingURL=index-BH0P1ozi.js.map
|