@seedprotocol/sdk 0.1.65 → 0.1.66

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.
@@ -1023,7 +1023,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1023
1023
  if (propertyRecordSchema &&
1024
1024
  propertyRecordSchema.storageType &&
1025
1025
  propertyRecordSchema.storageType === 'ItemStorage') {
1026
- const { Item } = yield import('./index-D2LDMjA3.js');
1026
+ const { Item } = yield import('./index-C-vHwxAS.js');
1027
1027
  const item = yield Item.find({
1028
1028
  seedLocalId,
1029
1029
  modelName: itemModelName,
@@ -1154,7 +1154,6 @@ const createNewItem = (_a) => __awaiter(void 0, void 0, void 0, function* () {
1154
1154
  if (!modelName) {
1155
1155
  throw new Error('A model name is required for createNewItem');
1156
1156
  }
1157
- getAppDb();
1158
1157
  const seedType = modelName.toLowerCase();
1159
1158
  const newSeedId = yield createSeed({ type: seedType });
1160
1159
  const newVersionId = yield createVersion({ seedLocalId: newSeedId });
@@ -1198,6 +1197,12 @@ const updateItemPropertyValue = (_a) => __awaiter(void 0, [_a], void 0, function
1198
1197
  !refResolvedValue) {
1199
1198
  safeNewValue = escapeSqliteString(newValue);
1200
1199
  }
1200
+ const appDb = getAppDb();
1201
+ yield appDb
1202
+ .select()
1203
+ .from(metadata)
1204
+ .where(and(eq(metadata.propertyName, propertyName), eq(metadata.seedLocalId, seedLocalId)))
1205
+ .orderBy(sql.raw('COALESCE(attestation_created_at, created_at) DESC'));
1201
1206
  const mostRecentRecordStatement = `SELECT local_id,
1202
1207
  uid,
1203
1208
  property_name,
@@ -1548,7 +1553,7 @@ const saveImageSrc = fromCallback(({ sendBack, input: { context, event } }) => {
1548
1553
  }
1549
1554
  }
1550
1555
  const filePath = `/files/images/${fileName}`;
1551
- const imageVersionLocalId = yield createVersion({
1556
+ yield createVersion({
1552
1557
  seedLocalId: newImageSeedLocalId,
1553
1558
  seedType: 'image',
1554
1559
  });
@@ -1565,7 +1570,7 @@ const saveImageSrc = fromCallback(({ sendBack, input: { context, event } }) => {
1565
1570
  propertyValue: newImageSeedLocalId,
1566
1571
  seedLocalId,
1567
1572
  seedUid,
1568
- versionLocalId: imageVersionLocalId || versionLocalId,
1573
+ versionLocalId,
1569
1574
  versionUid,
1570
1575
  modelName: itemModelName,
1571
1576
  schemaUid,
@@ -1580,7 +1585,7 @@ const saveImageSrc = fromCallback(({ sendBack, input: { context, event } }) => {
1580
1585
  propertyName: propertyNameRaw,
1581
1586
  newValue: newImageSeedLocalId,
1582
1587
  seedLocalId,
1583
- versionLocalId: imageVersionLocalId || versionLocalId,
1588
+ versionLocalId,
1584
1589
  modelName: itemModelName,
1585
1590
  schemaUid,
1586
1591
  refSeedType: 'image',
@@ -2911,7 +2916,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2911
2916
  if (!models$1) {
2912
2917
  return;
2913
2918
  }
2914
- const { models: SeedModels } = yield import('./seed.schema.config-DA3JNobc.js');
2919
+ const { models: SeedModels } = yield import('./seed.schema.config-PwtELm7X.js');
2915
2920
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2916
2921
  let hasModelsInDb = false;
2917
2922
  const schemaDefsByModelName = new Map();
@@ -3861,6 +3866,12 @@ const getArweave = () => {
3861
3866
  return;
3862
3867
  }
3863
3868
  if (process.env.NODE_ENV === 'production') {
3869
+ if (Object.keys(Arweave).includes('default')) {
3870
+ return Arweave.default.init({
3871
+ host: process.env.NEXT_PUBLIC_ARWEAVE_HOST,
3872
+ protocol: 'https',
3873
+ });
3874
+ }
3864
3875
  return Arweave.init({
3865
3876
  host: process.env.NEXT_PUBLIC_ARWEAVE_HOST,
3866
3877
  protocol: 'https',
@@ -6836,7 +6847,7 @@ const client = {
6836
6847
  console.error('fs listeners not ready during init');
6837
6848
  }
6838
6849
  globalService.send({ type: 'init', endpoints, models, addresses });
6839
- import('./seed.schema.config-DA3JNobc.js').then(({ models }) => {
6850
+ import('./seed.schema.config-PwtELm7X.js').then(({ models }) => {
6840
6851
  for (const [key, value] of Object.entries(models)) {
6841
6852
  setModel(key, value);
6842
6853
  }
@@ -6996,7 +7007,7 @@ const saveItemStorage = fromCallback(({ sendBack, input: { context, event } }) =
6996
7007
  });
6997
7008
 
6998
7009
  const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
6999
- const { localId, propertyName: propertyNameRaw, seedLocalId, versionLocalId, propertyValue: existingValue, propertyRecordSchema, itemModelName, schemaUid, } = context;
7010
+ const { localId, propertyName: propertyNameRaw, seedLocalId, versionLocalId, versionUid, propertyValue: existingValue, propertyRecordSchema, itemModelName, schemaUid, } = context;
7000
7011
  let newValue;
7001
7012
  if (event) {
7002
7013
  newValue = event.newValue;
@@ -7019,16 +7030,6 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
7019
7030
  });
7020
7031
  return false;
7021
7032
  }
7022
- // if (
7023
- // propertyRecordSchema.dataType === 'List' &&
7024
- // propertyRecordSchema.ref
7025
- // ) {
7026
- // sendBack({
7027
- // type: 'saveListRelation',
7028
- // newValue,
7029
- // })
7030
- // return false
7031
- // }
7032
7033
  if (propertyRecordSchema.refValueType === 'ImageSrc' ||
7033
7034
  propertyRecordSchema.dataType === 'ImageSrc') {
7034
7035
  sendBack({
@@ -7051,6 +7052,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
7051
7052
  newValue,
7052
7053
  seedLocalId,
7053
7054
  versionLocalId,
7055
+ versionUid,
7054
7056
  modelName: itemModelName,
7055
7057
  schemaUid,
7056
7058
  });
@@ -7419,4 +7421,4 @@ if (isNode()) {
7419
7421
  }
7420
7422
 
7421
7423
  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 };
7422
- //# sourceMappingURL=index-UWk43qGs.js.map
7424
+ //# sourceMappingURL=index-BYbqQltB.js.map