@seedprotocol/sdk 0.1.82 → 0.1.83

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.
@@ -1018,18 +1018,21 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1018
1018
  return path.basename(file).includes(refResolvedValue);
1019
1019
  });
1020
1020
  let fileExists = false;
1021
- const filePath = `/files/${dir}/${matchingFiles[0]}`;
1021
+ let filename;
1022
+ let filePath;
1022
1023
  if (matchingFiles && matchingFiles.length > 0) {
1023
1024
  fileExists = true;
1025
+ filename = matchingFiles[0];
1026
+ filePath = `/files/${dir}/${filename}`;
1024
1027
  }
1025
- // const fileExists = await fs.promises.exists(filePath)
1026
- if (fileExists) {
1028
+ if (fileExists && filename && filePath) {
1027
1029
  const fileContents = yield fs.promises.readFile(filePath);
1028
- const fileHandler = new File([fileContents], refResolvedValue);
1030
+ const fileHandler = new File([fileContents], filename);
1029
1031
  refResolvedDisplayValue = URL.createObjectURL(fileHandler);
1030
1032
  yield updateMetadata({
1031
1033
  localId,
1032
1034
  refResolvedDisplayValue,
1035
+ refResolvedValue: filename,
1033
1036
  });
1034
1037
  }
1035
1038
  }
@@ -1059,7 +1062,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1059
1062
  if (propertyRecordSchema &&
1060
1063
  propertyRecordSchema.storageType &&
1061
1064
  propertyRecordSchema.storageType === 'ItemStorage') {
1062
- const { Item } = yield import('./index-fFLXHK1c.js');
1065
+ const { Item } = yield import('./index-dP9lYpUp.js');
1063
1066
  const item = yield Item.find({
1064
1067
  seedLocalId,
1065
1068
  modelName: itemModelName,
@@ -2621,7 +2624,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2621
2624
  if (!models$1) {
2622
2625
  return;
2623
2626
  }
2624
- const { models: SeedModels } = yield import('./seed.schema.config-DqizK2KH.js');
2627
+ const { models: SeedModels } = yield import('./seed.schema.config-D-amxDm7.js');
2625
2628
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2626
2629
  let hasModelsInDb = false;
2627
2630
  const schemaDefsByModelName = new Map();
@@ -3767,11 +3770,14 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
3767
3770
  }
3768
3771
  }
3769
3772
  }
3770
- const fetchResponse = yield queryClient.fetchQuery({
3773
+ const dataString = yield queryClient.fetchQuery({
3771
3774
  queryKey: ['fetchTransaction', transactionId],
3772
- queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return fetch(`https://${ARWEAVE_HOST}/raw/${transactionId}`); }),
3775
+ queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
3776
+ const response = yield fetch(`https://${ARWEAVE_HOST}/raw/${transactionId}`);
3777
+ return yield response.text();
3778
+ }),
3779
+ networkMode: "offlineFirst"
3773
3780
  });
3774
- const dataString = yield fetchResponse.text();
3775
3781
  // const dataString = await arweave.transactions.getData(transactionId, {
3776
3782
  // decode: true,
3777
3783
  // string: true,
@@ -6628,7 +6634,7 @@ const client = {
6628
6634
  console.error('fs listeners not ready during init');
6629
6635
  }
6630
6636
  globalService.send({ type: 'init', endpoints, models, addresses });
6631
- import('./seed.schema.config-DqizK2KH.js').then(({ models }) => {
6637
+ import('./seed.schema.config-D-amxDm7.js').then(({ models }) => {
6632
6638
  for (const [key, value] of Object.entries(models)) {
6633
6639
  setModel(key, value);
6634
6640
  }
@@ -7582,4 +7588,4 @@ if (isNode()) {
7582
7588
  }
7583
7589
 
7584
7590
  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 };
7585
- //# sourceMappingURL=index-FL8U-FO4.js.map
7591
+ //# sourceMappingURL=index-LeMH3hHu.js.map