@seedprotocol/sdk 0.1.62 → 0.1.63

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-BRj0FIK5.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-DCYwncVx.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-DZr1ley6.js.map
30
+ //# sourceMappingURL=index-C351N4sQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C351N4sQ.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -989,7 +989,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
989
989
  if (propertyRecordSchema &&
990
990
  propertyRecordSchema.storageType &&
991
991
  propertyRecordSchema.storageType === 'ItemStorage') {
992
- const { Item } = yield import('./index-DZr1ley6.js');
992
+ const { Item } = yield import('./index-C351N4sQ.js');
993
993
  const item = yield Item.find({
994
994
  seedLocalId,
995
995
  modelName: itemModelName,
@@ -2877,7 +2877,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2877
2877
  if (!models$1) {
2878
2878
  return;
2879
2879
  }
2880
- const { models: SeedModels } = yield import('./seed.schema.config-CumSjbki.js');
2880
+ const { models: SeedModels } = yield import('./seed.schema.config-8V0ae_un.js');
2881
2881
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2882
2882
  let hasModelsInDb = false;
2883
2883
  const schemaDefsByModelName = new Map();
@@ -6423,6 +6423,54 @@ const useGlobalServiceStatus = () => {
6423
6423
 
6424
6424
  const logger$2 = debug('app:react:item');
6425
6425
  const useItem = ({ modelName, seedLocalId, seedUid }) => {
6426
+ // const [itemSubscription, setItemSubscription] = useState<
6427
+ // Subscription | undefined
6428
+ // >()
6429
+ //
6430
+ // const queryClient = useQueryClient()
6431
+ //
6432
+ // const { data: item } = useQuery({
6433
+ // queryKey: ['item', modelName, seedLocalId, seedUid],
6434
+ // queryFn: async () =>
6435
+ // Item.find({
6436
+ // modelName,
6437
+ // seedLocalId,
6438
+ // seedUid,
6439
+ // }),
6440
+ // networkMode: 'offlineFirst',
6441
+ // })
6442
+ //
6443
+ // const updateItem = async (newItem: Item<any>) => {
6444
+ // queryClient.setQueryData(['item', modelName, seedLocalId, seedUid], newItem)
6445
+ // }
6446
+ //
6447
+ // useEffect(() => {
6448
+ // if (item && item.subscribe && !itemSubscription) {
6449
+ // const subscription = item.subscribe(async (_) => {
6450
+ // const newItem = await Item.find({ modelName, seedLocalId, seedUid })
6451
+ // if (!newItem) {
6452
+ // logger(
6453
+ // '[useItem] [itemSubscription] no item found',
6454
+ // modelName,
6455
+ // seedLocalId,
6456
+ // )
6457
+ // return
6458
+ // }
6459
+ // updateItem(newItem)
6460
+ // })
6461
+ // setItemSubscription(subscription)
6462
+ // }
6463
+ //
6464
+ // return () => {
6465
+ // itemSubscription?.unsubscribe()
6466
+ // }
6467
+ // }, [item, itemSubscription])
6468
+ //
6469
+ // return {
6470
+ // item,
6471
+ // itemData: {},
6472
+ // itemStatus: undefined,
6473
+ // }
6426
6474
  const [itemData, setItemData] = useImmer({});
6427
6475
  const [item, setItem] = useState();
6428
6476
  const [itemSubscription, setItemSubscription] = useState();
@@ -6490,9 +6538,10 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
6490
6538
  listenerRef.current();
6491
6539
  });
6492
6540
  return () => {
6493
- eventEmitter.removeListener(`item.${modelName}.${seedId}.update`, readFromDb);
6541
+ eventEmitter.removeListener(`item.${modelName}.${seedId}.update`);
6494
6542
  };
6495
6543
  }, []);
6544
+ console.log(`returning item ${seedLocalId}`, item);
6496
6545
  return {
6497
6546
  item,
6498
6547
  itemData,
@@ -6768,7 +6817,7 @@ const client = {
6768
6817
  console.error('fs listeners not ready during init');
6769
6818
  }
6770
6819
  globalService.send({ type: 'init', endpoints, models, addresses });
6771
- import('./seed.schema.config-CumSjbki.js').then(({ models }) => {
6820
+ import('./seed.schema.config-8V0ae_un.js').then(({ models }) => {
6772
6821
  for (const [key, value] of Object.entries(models)) {
6773
6822
  setModel(key, value);
6774
6823
  }
@@ -7341,4 +7390,4 @@ if (isNode()) {
7341
7390
  }
7342
7391
 
7343
7392
  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 };
7344
- //# sourceMappingURL=index-BRj0FIK5.js.map
7393
+ //# sourceMappingURL=index-DCYwncVx.js.map