@seedprotocol/sdk 0.1.65 → 0.1.67

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 { 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';
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-nGDuz8NN.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-D2LDMjA3.js.map
30
+ //# sourceMappingURL=index-BJn9UAOX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BJn9UAOX.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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-BJn9UAOX.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-miFErQ6h.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',
@@ -6812,6 +6823,10 @@ const saveServiceHandler = (event) => __awaiter(void 0, void 0, void 0, function
6812
6823
  const { modelName } = event;
6813
6824
  const nameOfService = `${modelName}Service`;
6814
6825
  const service = globalService.getSnapshot().context[nameOfService];
6826
+ if (!service) {
6827
+ console.log(`[saveServiceHandler] service not found: ${nameOfService}`);
6828
+ return;
6829
+ }
6815
6830
  yield writeAppState(`snapshot__${modelName}`, JSON.stringify(service.getPersistedSnapshot()));
6816
6831
  });
6817
6832
 
@@ -6836,7 +6851,7 @@ const client = {
6836
6851
  console.error('fs listeners not ready during init');
6837
6852
  }
6838
6853
  globalService.send({ type: 'init', endpoints, models, addresses });
6839
- import('./seed.schema.config-DA3JNobc.js').then(({ models }) => {
6854
+ import('./seed.schema.config-miFErQ6h.js').then(({ models }) => {
6840
6855
  for (const [key, value] of Object.entries(models)) {
6841
6856
  setModel(key, value);
6842
6857
  }
@@ -6996,7 +7011,7 @@ const saveItemStorage = fromCallback(({ sendBack, input: { context, event } }) =
6996
7011
  });
6997
7012
 
6998
7013
  const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
6999
- const { localId, propertyName: propertyNameRaw, seedLocalId, versionLocalId, propertyValue: existingValue, propertyRecordSchema, itemModelName, schemaUid, } = context;
7014
+ const { localId, propertyName: propertyNameRaw, seedLocalId, versionLocalId, versionUid, propertyValue: existingValue, propertyRecordSchema, itemModelName, schemaUid, } = context;
7000
7015
  let newValue;
7001
7016
  if (event) {
7002
7017
  newValue = event.newValue;
@@ -7019,16 +7034,6 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
7019
7034
  });
7020
7035
  return false;
7021
7036
  }
7022
- // if (
7023
- // propertyRecordSchema.dataType === 'List' &&
7024
- // propertyRecordSchema.ref
7025
- // ) {
7026
- // sendBack({
7027
- // type: 'saveListRelation',
7028
- // newValue,
7029
- // })
7030
- // return false
7031
- // }
7032
7037
  if (propertyRecordSchema.refValueType === 'ImageSrc' ||
7033
7038
  propertyRecordSchema.dataType === 'ImageSrc') {
7034
7039
  sendBack({
@@ -7051,6 +7056,7 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
7051
7056
  newValue,
7052
7057
  seedLocalId,
7053
7058
  versionLocalId,
7059
+ versionUid,
7054
7060
  modelName: itemModelName,
7055
7061
  schemaUid,
7056
7062
  });
@@ -7419,4 +7425,4 @@ if (isNode()) {
7419
7425
  }
7420
7426
 
7421
7427
  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
7428
+ //# sourceMappingURL=index-nGDuz8NN.js.map