@seedprotocol/sdk 0.1.76 → 0.1.78

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.
@@ -1,4 +1,4 @@
1
- export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-nyYoS6hl.js';
1
+ export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-_JWt4nA-.js';
2
2
  import './constants-rmQ8zg8_.js';
3
3
  import '@ethereum-attestation-service/eas-sdk';
4
4
  import 'thirdweb';
@@ -29,4 +29,4 @@ import 'rxjs';
29
29
  import 'drizzle-orm/sqlite-proxy';
30
30
  import '@zenfs/dom';
31
31
  import 'arweave';
32
- //# sourceMappingURL=index-D5bGQvS6.js.map
32
+ //# sourceMappingURL=index-DmrlOoY_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-D5bGQvS6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-DmrlOoY_.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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 whereClauses = [];
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, refResolvedValue, localStorageDir, } = firstRow;
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,27 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
990
991
  propertyRecordSchema.refValueType === 'ImageSrc') {
991
992
  dir = 'images';
992
993
  }
994
+ dir = dir.replace(/^\//, '');
995
+ if (!refResolvedValue &&
996
+ propertyValueFromDb &&
997
+ propertyValueFromDb.length === 66) {
998
+ const storageTransactionQuery = yield appDb
999
+ .select({
1000
+ propertyValue: metadata.propertyValue,
1001
+ })
1002
+ .from(metadata)
1003
+ .where(and(eq(metadata.seedUid, propertyValueFromDb), eq(metadata.propertyName, 'storageTransactionId')));
1004
+ if (storageTransactionQuery && storageTransactionQuery.length > 0) {
1005
+ const row = storageTransactionQuery[0];
1006
+ refResolvedValue = row.propertyValue;
1007
+ console.log('storageTransactionId', refResolvedValue);
1008
+ yield updateMetadata({
1009
+ localId,
1010
+ refResolvedValue,
1011
+ localStorageDir: '/images',
1012
+ });
1013
+ }
1014
+ }
993
1015
  const filePath = `/files/${dir}/${refResolvedValue}`;
994
1016
  const fileExists = yield fs.promises.exists(filePath);
995
1017
  if (fileExists) {
@@ -1028,7 +1050,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1028
1050
  if (propertyRecordSchema &&
1029
1051
  propertyRecordSchema.storageType &&
1030
1052
  propertyRecordSchema.storageType === 'ItemStorage') {
1031
- const { Item } = yield import('./index-D5bGQvS6.js');
1053
+ const { Item } = yield import('./index-DmrlOoY_.js');
1032
1054
  const item = yield Item.find({
1033
1055
  seedLocalId,
1034
1056
  modelName: itemModelName,
@@ -2590,7 +2612,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2590
2612
  if (!models$1) {
2591
2613
  return;
2592
2614
  }
2593
- const { models: SeedModels } = yield import('./seed.schema.config-CaxQONHV.js');
2615
+ const { models: SeedModels } = yield import('./seed.schema.config-CD9Ee46X.js');
2594
2616
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2595
2617
  let hasModelsInDb = false;
2596
2618
  const schemaDefsByModelName = new Map();
@@ -6590,7 +6612,7 @@ const client = {
6590
6612
  console.error('fs listeners not ready during init');
6591
6613
  }
6592
6614
  globalService.send({ type: 'init', endpoints, models, addresses });
6593
- import('./seed.schema.config-CaxQONHV.js').then(({ models }) => {
6615
+ import('./seed.schema.config-CD9Ee46X.js').then(({ models }) => {
6594
6616
  for (const [key, value] of Object.entries(models)) {
6595
6617
  setModel(key, value);
6596
6618
  }
@@ -7544,4 +7566,4 @@ if (isNode()) {
7544
7566
  }
7545
7567
 
7546
7568
  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-nyYoS6hl.js.map
7569
+ //# sourceMappingURL=index-_JWt4nA-.js.map