@seedprotocol/sdk 0.1.58 → 0.1.60
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-CpkFYsgU.js → index-4a6qGsTX.js} +33 -45
- package/dist/index-4a6qGsTX.js.map +1 -0
- package/dist/{index-Ij9VEGXg.js → index-BE0vEP7p.js} +2 -2
- package/dist/index-BE0vEP7p.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-BzZpzxHI.js → seed.schema.config-CFOCE176.js} +2 -2
- package/dist/{seed.schema.config-BzZpzxHI.js.map → seed.schema.config-CFOCE176.js.map} +1 -1
- package/dist/src/item.ts +33 -32
- package/dist/src/resolveRelatedValue.ts +0 -4
- package/dist/types/src/browser/item/Item.d.ts.map +1 -1
- package/dist/types/src/browser/property/actors/resolveRelatedValue.d.ts.map +1 -1
- package/dist/types/src/browser/react/item.d.ts +0 -1
- package/dist/types/src/browser/react/item.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-CpkFYsgU.js.map +0 -1
- package/dist/index-Ij9VEGXg.js.map +0 -1
|
@@ -516,9 +516,6 @@ const refResolvedValueToContentUrl = new Map();
|
|
|
516
516
|
const seedUidToContentUrl = new Map();
|
|
517
517
|
const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
|
|
518
518
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, seedLocalId, schemaUid, } = context;
|
|
519
|
-
if (seedLocalId === 'AhiILhtcVq') {
|
|
520
|
-
console.log('[resolveRelatedValue] seedLocalId', seedLocalId);
|
|
521
|
-
}
|
|
522
519
|
const _resolveRelatedValue = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
523
520
|
if (!propertyValue || !isRelation) {
|
|
524
521
|
return;
|
|
@@ -992,7 +989,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
992
989
|
if (propertyRecordSchema &&
|
|
993
990
|
propertyRecordSchema.storageType &&
|
|
994
991
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
995
|
-
const { Item } = yield import('./index-
|
|
992
|
+
const { Item } = yield import('./index-BE0vEP7p.js');
|
|
996
993
|
const item = yield Item.find({
|
|
997
994
|
seedLocalId,
|
|
998
995
|
modelName: itemModelName,
|
|
@@ -2880,7 +2877,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2880
2877
|
if (!models$1) {
|
|
2881
2878
|
return;
|
|
2882
2879
|
}
|
|
2883
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2880
|
+
const { models: SeedModels } = yield import('./seed.schema.config-CFOCE176.js');
|
|
2884
2881
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2885
2882
|
let hasModelsInDb = false;
|
|
2886
2883
|
const schemaDefsByModelName = new Map();
|
|
@@ -6235,13 +6232,11 @@ class Item {
|
|
|
6235
6232
|
if (!propertyInstance) {
|
|
6236
6233
|
return;
|
|
6237
6234
|
}
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
});
|
|
6244
|
-
}
|
|
6235
|
+
this._service.send({
|
|
6236
|
+
type: 'addPropertyInstance',
|
|
6237
|
+
propertyName: props.propertyName,
|
|
6238
|
+
propertyInstance,
|
|
6239
|
+
});
|
|
6245
6240
|
Object.defineProperty(this, props.propertyName, {
|
|
6246
6241
|
get: () => propertyInstance.value,
|
|
6247
6242
|
set: (value) => (propertyInstance.value = value),
|
|
@@ -6339,16 +6334,6 @@ const getServiceUniqueKey = (service) => {
|
|
|
6339
6334
|
}
|
|
6340
6335
|
return uniqueKey;
|
|
6341
6336
|
};
|
|
6342
|
-
const useIsDbReady = () => {
|
|
6343
|
-
const [isDbReady, setIsDbReady] = useState(false);
|
|
6344
|
-
const { internalStatus } = useGlobalServiceStatus();
|
|
6345
|
-
useEffect(() => {
|
|
6346
|
-
if (internalStatus === 'ready') {
|
|
6347
|
-
setIsDbReady(true);
|
|
6348
|
-
}
|
|
6349
|
-
}, [internalStatus]);
|
|
6350
|
-
return isDbReady;
|
|
6351
|
-
};
|
|
6352
6337
|
const useServices = () => {
|
|
6353
6338
|
const [actors, setActors] = useState([]);
|
|
6354
6339
|
const [percentComplete, setPercentComplete] = useState(5);
|
|
@@ -6515,35 +6500,39 @@ const useItem = ({ modelName, seedLocalId, seedUid }) => {
|
|
|
6515
6500
|
};
|
|
6516
6501
|
const useItems = ({ modelName, deleted }) => {
|
|
6517
6502
|
const [items, setItems] = useImmer([]);
|
|
6518
|
-
const
|
|
6519
|
-
const [isInitialized, setIsInitialized] = useState(false);
|
|
6520
|
-
const isDbReady = useIsDbReady();
|
|
6503
|
+
const { status, internalStatus } = useGlobalServiceStatus();
|
|
6521
6504
|
const modelNameRef = useRef(modelName);
|
|
6522
|
-
const
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
event.modelName !== modelNameRef.current ||
|
|
6526
|
-
isReadingDb) {
|
|
6505
|
+
const isReadingDb = useRef(false);
|
|
6506
|
+
const readFromDb = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
6507
|
+
if (isReadingDb.current || internalStatus !== 'ready') {
|
|
6527
6508
|
return;
|
|
6528
6509
|
}
|
|
6529
|
-
|
|
6510
|
+
isReadingDb.current = true;
|
|
6530
6511
|
const allItems = yield Item.all(modelNameRef.current, deleted);
|
|
6512
|
+
setItems(() => []);
|
|
6531
6513
|
setItems(() => allItems);
|
|
6532
|
-
|
|
6533
|
-
}), [
|
|
6514
|
+
isReadingDb.current = false;
|
|
6515
|
+
}), [internalStatus]);
|
|
6516
|
+
const listenerRef = useRef(readFromDb);
|
|
6534
6517
|
useEffect(() => {
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
_fetchItems();
|
|
6518
|
+
listenerRef.current = readFromDb;
|
|
6519
|
+
}, [readFromDb]);
|
|
6520
|
+
useEffect(() => {
|
|
6521
|
+
if (internalStatus === 'ready') {
|
|
6522
|
+
listenerRef.current();
|
|
6541
6523
|
}
|
|
6542
|
-
}, [
|
|
6524
|
+
}, [internalStatus, status]);
|
|
6543
6525
|
useEffect(() => {
|
|
6544
|
-
eventEmitter.addListener('item.requestAll',
|
|
6526
|
+
eventEmitter.addListener('item.requestAll', (event) => {
|
|
6527
|
+
if (!event ||
|
|
6528
|
+
!event.modelName ||
|
|
6529
|
+
event.modelName !== modelNameRef.current) {
|
|
6530
|
+
return;
|
|
6531
|
+
}
|
|
6532
|
+
listenerRef.current();
|
|
6533
|
+
});
|
|
6545
6534
|
return () => {
|
|
6546
|
-
eventEmitter.removeListener('item.requestAll');
|
|
6535
|
+
eventEmitter.removeListener('item.requestAll', readFromDb);
|
|
6547
6536
|
};
|
|
6548
6537
|
}, []);
|
|
6549
6538
|
return {
|
|
@@ -6553,7 +6542,6 @@ const useItems = ({ modelName, deleted }) => {
|
|
|
6553
6542
|
item.createdAt,
|
|
6554
6543
|
], ['desc']).slice(0, 10),
|
|
6555
6544
|
isReadingDb,
|
|
6556
|
-
isInitialized,
|
|
6557
6545
|
};
|
|
6558
6546
|
};
|
|
6559
6547
|
const useItemIsReady = () => {
|
|
@@ -6779,7 +6767,7 @@ const client = {
|
|
|
6779
6767
|
console.error('fs listeners not ready during init');
|
|
6780
6768
|
}
|
|
6781
6769
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6782
|
-
import('./seed.schema.config-
|
|
6770
|
+
import('./seed.schema.config-CFOCE176.js').then(({ models }) => {
|
|
6783
6771
|
for (const [key, value] of Object.entries(models)) {
|
|
6784
6772
|
setModel(key, value);
|
|
6785
6773
|
}
|
|
@@ -7352,4 +7340,4 @@ if (isNode()) {
|
|
|
7352
7340
|
}
|
|
7353
7341
|
|
|
7354
7342
|
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 };
|
|
7355
|
-
//# sourceMappingURL=index-
|
|
7343
|
+
//# sourceMappingURL=index-4a6qGsTX.js.map
|