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