@seedprotocol/sdk 0.1.63 → 0.1.64
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.
- package/dist/{index-C351N4sQ.js → index-9o1LuAwu.js} +2 -2
- package/dist/index-9o1LuAwu.js.map +1 -0
- package/dist/{index-DCYwncVx.js → index-bNy6MtOd.js} +24 -39
- package/dist/index-bNy6MtOd.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-8V0ae_un.js → seed.schema.config-BcB0_Har.js} +2 -2
- package/dist/{seed.schema.config-8V0ae_un.js.map → seed.schema.config-BcB0_Har.js.map} +1 -1
- package/dist/src/getItems.ts +2 -2
- package/dist/src/item.ts +0 -2
- package/dist/src/property.ts +27 -36
- package/dist/types/src/browser/react/item.d.ts.map +1 -1
- package/dist/types/src/browser/react/property.d.ts +0 -1
- package/dist/types/src/browser/react/property.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-C351N4sQ.js.map +0 -1
- package/dist/index-DCYwncVx.js.map +0 -1
|
@@ -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-
|
|
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-bNy6MtOd.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-
|
|
30
|
+
//# sourceMappingURL=index-9o1LuAwu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-9o1LuAwu.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ import path, { basename } from 'path';
|
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import { Type } from '@sinclair/typebox';
|
|
5
5
|
import { fromCallback, assign, createActor, waitFor, setup, emit, raise } from 'xstate';
|
|
6
|
-
import { sql, relations, and, eq, max, or, count, isNotNull, isNull, inArray, like, getTableColumns
|
|
6
|
+
import { sql, relations, and, eq, max, or, count, isNotNull, isNull, gt, inArray, like, getTableColumns } from 'drizzle-orm';
|
|
7
7
|
import { fs, configureSingle } from '@zenfs/core';
|
|
8
8
|
import 'dayjs';
|
|
9
9
|
import { customAlphabet } from 'nanoid';
|
|
@@ -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-
|
|
992
|
+
const { Item } = yield import('./index-9o1LuAwu.js');
|
|
993
993
|
const item = yield Item.find({
|
|
994
994
|
seedLocalId,
|
|
995
995
|
modelName: itemModelName,
|
|
@@ -1688,7 +1688,7 @@ const getItemsData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelN
|
|
|
1688
1688
|
})
|
|
1689
1689
|
.from(seeds)
|
|
1690
1690
|
.leftJoin(versionData, eq(seeds.localId, versionData.seedLocalId))
|
|
1691
|
-
.where(and(...conditions))
|
|
1691
|
+
.where(and(gt(versionData.versionsCount, 0), ...conditions))
|
|
1692
1692
|
.orderBy(sql.raw('COALESCE(attestation_created_at, created_at) DESC'))
|
|
1693
1693
|
.groupBy(seeds.localId);
|
|
1694
1694
|
const itemsData = (yield query);
|
|
@@ -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-
|
|
2880
|
+
const { models: SeedModels } = yield import('./seed.schema.config-BcB0_Har.js');
|
|
2881
2881
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2882
2882
|
let hasModelsInDb = false;
|
|
2883
2883
|
const schemaDefsByModelName = new Map();
|
|
@@ -6541,7 +6541,6 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
|
6541
6541
|
eventEmitter.removeListener(`item.${modelName}.${seedId}.update`);
|
|
6542
6542
|
};
|
|
6543
6543
|
}, []);
|
|
6544
|
-
console.log(`returning item ${seedLocalId}`, item);
|
|
6545
6544
|
return {
|
|
6546
6545
|
item,
|
|
6547
6546
|
itemData,
|
|
@@ -6641,10 +6640,9 @@ const useCreateItem = (modelName) => {
|
|
|
6641
6640
|
const logger$1 = debug('app:react:property');
|
|
6642
6641
|
const useItemProperty = ({ propertyName, seedLocalId, seedUid, }) => {
|
|
6643
6642
|
const [property, setProperty] = useState();
|
|
6644
|
-
const [isReadingFromDb, setIsReadingFromDb] = useState(false);
|
|
6645
6643
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
6646
|
-
// const isDbReady = useMemo(() => useIsDbReady(), [])
|
|
6647
6644
|
const { internalStatus } = useGlobalServiceStatus();
|
|
6645
|
+
const isReadingDb = useRef(false);
|
|
6648
6646
|
const value = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => {
|
|
6649
6647
|
if (!snapshot || !snapshot.context) {
|
|
6650
6648
|
return;
|
|
@@ -6652,26 +6650,21 @@ const useItemProperty = ({ propertyName, seedLocalId, seedUid, }) => {
|
|
|
6652
6650
|
return snapshot.context.renderValue || snapshot.context.propertyValue;
|
|
6653
6651
|
});
|
|
6654
6652
|
const status = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => snapshot === null || snapshot === void 0 ? void 0 : snapshot.value);
|
|
6655
|
-
// useEffect(() => {
|
|
6656
|
-
// if (property && property.value !== value) {
|
|
6657
|
-
// readFromDb()
|
|
6658
|
-
// }
|
|
6659
|
-
// }, [property, value])
|
|
6660
6653
|
const readFromDb = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
6661
6654
|
if (internalStatus !== 'ready' ||
|
|
6662
|
-
|
|
6655
|
+
isReadingDb.current ||
|
|
6663
6656
|
(!seedLocalId && !seedUid)) {
|
|
6664
6657
|
return;
|
|
6665
6658
|
}
|
|
6666
|
-
|
|
6659
|
+
isReadingDb.current = true;
|
|
6667
6660
|
const foundProperty = yield ItemProperty.find({
|
|
6668
6661
|
propertyName,
|
|
6669
6662
|
seedLocalId,
|
|
6670
6663
|
seedUid,
|
|
6671
6664
|
});
|
|
6672
|
-
setIsReadingFromDb(false);
|
|
6673
6665
|
if (!foundProperty) {
|
|
6674
6666
|
logger$1(`[useItemPropertyTest] [readFromDb] no property found for Item.${seedLocalId}.${propertyName}`);
|
|
6667
|
+
isReadingDb.current = false;
|
|
6675
6668
|
return;
|
|
6676
6669
|
}
|
|
6677
6670
|
if (foundProperty.status === 'waitingForDb') {
|
|
@@ -6679,36 +6672,28 @@ const useItemProperty = ({ propertyName, seedLocalId, seedUid, }) => {
|
|
|
6679
6672
|
}
|
|
6680
6673
|
setProperty(foundProperty);
|
|
6681
6674
|
setIsInitialized(true);
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
// }, [property])
|
|
6675
|
+
isReadingDb.current = false;
|
|
6676
|
+
}), [internalStatus]);
|
|
6677
|
+
const listenerRef = useRef(readFromDb);
|
|
6678
|
+
useEffect(() => {
|
|
6679
|
+
listenerRef.current = readFromDb;
|
|
6680
|
+
}, [readFromDb]);
|
|
6689
6681
|
useEffect(() => {
|
|
6690
6682
|
if (internalStatus === 'ready') {
|
|
6691
6683
|
readFromDb();
|
|
6692
6684
|
}
|
|
6693
6685
|
}, [internalStatus]);
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
// return () => {
|
|
6703
|
-
// eventEmitter.removeListener(
|
|
6704
|
-
// `property.${seedUid || seedLocalId}.${propertyName}.update`,
|
|
6705
|
-
// )
|
|
6706
|
-
// }
|
|
6707
|
-
// }, [])
|
|
6686
|
+
useEffect(() => {
|
|
6687
|
+
eventEmitter.addListener(`property.${seedUid || seedLocalId}.${propertyName}.update`, () => {
|
|
6688
|
+
listenerRef.current();
|
|
6689
|
+
});
|
|
6690
|
+
return () => {
|
|
6691
|
+
eventEmitter.removeListener(`property.${seedUid || seedLocalId}.${propertyName}.update`);
|
|
6692
|
+
};
|
|
6693
|
+
}, []);
|
|
6708
6694
|
return {
|
|
6709
6695
|
property,
|
|
6710
6696
|
isInitialized,
|
|
6711
|
-
isReadingFromDb,
|
|
6712
6697
|
value,
|
|
6713
6698
|
status,
|
|
6714
6699
|
};
|
|
@@ -6817,7 +6802,7 @@ const client = {
|
|
|
6817
6802
|
console.error('fs listeners not ready during init');
|
|
6818
6803
|
}
|
|
6819
6804
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6820
|
-
import('./seed.schema.config-
|
|
6805
|
+
import('./seed.schema.config-BcB0_Har.js').then(({ models }) => {
|
|
6821
6806
|
for (const [key, value] of Object.entries(models)) {
|
|
6822
6807
|
setModel(key, value);
|
|
6823
6808
|
}
|
|
@@ -7390,4 +7375,4 @@ if (isNode()) {
|
|
|
7390
7375
|
}
|
|
7391
7376
|
|
|
7392
7377
|
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 };
|
|
7393
|
-
//# sourceMappingURL=index-
|
|
7378
|
+
//# sourceMappingURL=index-bNy6MtOd.js.map
|