@seedprotocol/sdk 0.1.64 → 0.1.65
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-9o1LuAwu.js → index-D2LDMjA3.js} +2 -2
- package/dist/index-D2LDMjA3.js.map +1 -0
- package/dist/{index-bNy6MtOd.js → index-UWk43qGs.js} +50 -6
- package/dist/index-UWk43qGs.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-BcB0_Har.js → seed.schema.config-DA3JNobc.js} +2 -2
- package/dist/{seed.schema.config-BcB0_Har.js.map → seed.schema.config-DA3JNobc.js.map} +1 -1
- package/dist/src/hydrateFromDb.ts +46 -3
- package/dist/src/saveListRelation.ts +107 -0
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/types/src/browser/property/actors/saveValueToDb/index.d.ts.map +1 -1
- package/dist/types/src/browser/property/actors/saveValueToDb/saveListRelation.d.ts +5 -0
- package/dist/types/src/browser/property/actors/saveValueToDb/saveListRelation.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/index-9o1LuAwu.js.map +0 -1
- package/dist/index-bNy6MtOd.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, e as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SEEDS, b as GET_SEED_IDS, c as GET_STORAGE_TRANSACTION_ID, d as GET_VERSIONS, I as Item, g as itemMachineAll, i as itemMachineSingle } from './index-
|
|
1
|
+
export { f as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, e as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SEEDS, b as GET_SEED_IDS, c as GET_STORAGE_TRANSACTION_ID, d as GET_VERSIONS, I as Item, g as itemMachineAll, i as itemMachineSingle } from './index-UWk43qGs.js';
|
|
2
2
|
import './constants-BLctWkrn.js';
|
|
3
3
|
import 'path';
|
|
4
4
|
import 'reflect-metadata';
|
|
@@ -27,4 +27,4 @@ import '@zenfs/dom';
|
|
|
27
27
|
import 'arweave';
|
|
28
28
|
import 'use-immer';
|
|
29
29
|
import '@xstate/react';
|
|
30
|
-
//# sourceMappingURL=index-
|
|
30
|
+
//# sourceMappingURL=index-D2LDMjA3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D2LDMjA3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -950,7 +950,9 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
950
950
|
return;
|
|
951
951
|
}
|
|
952
952
|
const firstRow = rows[0];
|
|
953
|
-
const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, versionLocalId: versionLocalIdFromDb, versionUid: versionUidFromDb, refValueType, refResolvedValue,
|
|
953
|
+
const { localId, uid, propertyName: propertyNameFromDb, propertyValue: propertyValueFromDb, seedLocalId: seedLocalIdFromDb, seedUid: seedUidFromDb, schemaUid: schemaUidFromDb, versionLocalId: versionLocalIdFromDb, versionUid: versionUidFromDb, refValueType, refResolvedValue, localStorageDir, } = firstRow;
|
|
954
|
+
let { refResolvedDisplayValue } = firstRow;
|
|
955
|
+
let propertyValueProcessed = propertyValueFromDb;
|
|
954
956
|
if (propertyName && !propertyNameFromDb) {
|
|
955
957
|
logger$m(`Property name from code is ${propertyName} but has not value in db ${propertyNameFromDb} for Property.${localId}`);
|
|
956
958
|
}
|
|
@@ -970,11 +972,43 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
970
972
|
if (seedUidFromDb !== seedUid) {
|
|
971
973
|
logger$m(`Seed uid from db ${seedUidFromDb} does not match seed uid ${seedUid} for Property.${localId}`);
|
|
972
974
|
}
|
|
975
|
+
if (refResolvedValue &&
|
|
976
|
+
refResolvedDisplayValue &&
|
|
977
|
+
refResolvedDisplayValue.includes('http')) {
|
|
978
|
+
let urlNeedsToBeRefreshed = false;
|
|
979
|
+
try {
|
|
980
|
+
const response = yield fetch(refResolvedDisplayValue, {
|
|
981
|
+
method: 'HEAD',
|
|
982
|
+
});
|
|
983
|
+
// Check if the status is in the 200-299 range
|
|
984
|
+
if (!response.ok) {
|
|
985
|
+
urlNeedsToBeRefreshed = true;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
catch (error) {
|
|
989
|
+
urlNeedsToBeRefreshed = true;
|
|
990
|
+
}
|
|
991
|
+
if (urlNeedsToBeRefreshed) {
|
|
992
|
+
const filePath = `/files/${localStorageDir}/${refResolvedValue}`;
|
|
993
|
+
const fileExists = yield fs.promises.exists(filePath);
|
|
994
|
+
if (fileExists) {
|
|
995
|
+
const fileContents = yield fs.promises.readFile(filePath);
|
|
996
|
+
const fileHandler = new File([fileContents], refResolvedValue);
|
|
997
|
+
refResolvedDisplayValue = URL.createObjectURL(fileHandler);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
if (propertyRecordSchema &&
|
|
1002
|
+
propertyRecordSchema.dataType === 'List' &&
|
|
1003
|
+
propertyRecordSchema.ref &&
|
|
1004
|
+
typeof propertyValueFromDb === 'string') {
|
|
1005
|
+
propertyValueProcessed = propertyValueFromDb.split(',');
|
|
1006
|
+
}
|
|
973
1007
|
sendBack({
|
|
974
1008
|
type: 'updateContext',
|
|
975
1009
|
localId,
|
|
976
1010
|
uid,
|
|
977
|
-
propertyValue:
|
|
1011
|
+
propertyValue: propertyValueProcessed,
|
|
978
1012
|
seedLocalId: seedLocalIdFromDb,
|
|
979
1013
|
seedUid: seedUidFromDb,
|
|
980
1014
|
versionLocalId: versionLocalIdFromDb,
|
|
@@ -989,7 +1023,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
989
1023
|
if (propertyRecordSchema &&
|
|
990
1024
|
propertyRecordSchema.storageType &&
|
|
991
1025
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
992
|
-
const { Item } = yield import('./index-
|
|
1026
|
+
const { Item } = yield import('./index-D2LDMjA3.js');
|
|
993
1027
|
const item = yield Item.find({
|
|
994
1028
|
seedLocalId,
|
|
995
1029
|
modelName: itemModelName,
|
|
@@ -2877,7 +2911,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2877
2911
|
if (!models$1) {
|
|
2878
2912
|
return;
|
|
2879
2913
|
}
|
|
2880
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2914
|
+
const { models: SeedModels } = yield import('./seed.schema.config-DA3JNobc.js');
|
|
2881
2915
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2882
2916
|
let hasModelsInDb = false;
|
|
2883
2917
|
const schemaDefsByModelName = new Map();
|
|
@@ -6802,7 +6836,7 @@ const client = {
|
|
|
6802
6836
|
console.error('fs listeners not ready during init');
|
|
6803
6837
|
}
|
|
6804
6838
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6805
|
-
import('./seed.schema.config-
|
|
6839
|
+
import('./seed.schema.config-DA3JNobc.js').then(({ models }) => {
|
|
6806
6840
|
for (const [key, value] of Object.entries(models)) {
|
|
6807
6841
|
setModel(key, value);
|
|
6808
6842
|
}
|
|
@@ -6985,6 +7019,16 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
|
|
|
6985
7019
|
});
|
|
6986
7020
|
return false;
|
|
6987
7021
|
}
|
|
7022
|
+
// if (
|
|
7023
|
+
// propertyRecordSchema.dataType === 'List' &&
|
|
7024
|
+
// propertyRecordSchema.ref
|
|
7025
|
+
// ) {
|
|
7026
|
+
// sendBack({
|
|
7027
|
+
// type: 'saveListRelation',
|
|
7028
|
+
// newValue,
|
|
7029
|
+
// })
|
|
7030
|
+
// return false
|
|
7031
|
+
// }
|
|
6988
7032
|
if (propertyRecordSchema.refValueType === 'ImageSrc' ||
|
|
6989
7033
|
propertyRecordSchema.dataType === 'ImageSrc') {
|
|
6990
7034
|
sendBack({
|
|
@@ -7375,4 +7419,4 @@ if (isNode()) {
|
|
|
7375
7419
|
}
|
|
7376
7420
|
|
|
7377
7421
|
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 };
|
|
7378
|
-
//# sourceMappingURL=index-
|
|
7422
|
+
//# sourceMappingURL=index-UWk43qGs.js.map
|