@seedprotocol/sdk 0.1.86 → 0.1.88

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.
@@ -159,7 +159,7 @@ const waitForDb$1 = fromCallback(({ sendBack }) => {
159
159
  });
160
160
 
161
161
  const initialize$3 = fromCallback(({ sendBack, input: { context } }) => {
162
- const { isRelation, propertyName, storageTransactionId, seedLocalId } = context;
162
+ const { isRelation, propertyName, storageTransactionId } = context;
163
163
  if (isRelation) {
164
164
  sendBack({ type: 'isRelatedProperty' });
165
165
  sendBack({ type: 'initializeSuccess' });
@@ -183,7 +183,7 @@ const initialize$3 = fromCallback(({ sendBack, input: { context } }) => {
183
183
  .catch((error) => {
184
184
  console.warn('Error reading html file', error);
185
185
  });
186
- sendBack({ type: 'updateRenderValue', renderValue });
186
+ sendBack({ type: 'updateContext', renderValue });
187
187
  return;
188
188
  }
189
189
  if (propertyName === 'json') {
@@ -197,7 +197,7 @@ const initialize$3 = fromCallback(({ sendBack, input: { context } }) => {
197
197
  .catch((error) => {
198
198
  console.warn('Error reading json file', error);
199
199
  });
200
- sendBack({ type: 'updateRenderValue', renderValue });
200
+ sendBack({ type: 'updateContext', renderValue });
201
201
  return;
202
202
  }
203
203
  });
@@ -517,9 +517,9 @@ const storageTransactionIdToContentUrl = new Map();
517
517
  const refResolvedValueToContentUrl = new Map();
518
518
  const seedUidToContentUrl = new Map();
519
519
  const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
520
- const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, seedLocalId, schemaUid, } = context;
520
+ const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
521
521
  const _resolveRelatedValue = () => __awaiter(void 0, void 0, void 0, function* () {
522
- if (!propertyValue || !isRelation) {
522
+ if (!propertyValue || !isRelation || populatedFromDb) {
523
523
  return;
524
524
  }
525
525
  let parsedValue;
@@ -532,7 +532,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
532
532
  if (!parsedValue && seedUidToContentUrl.has(propertyValue)) {
533
533
  const contentUrl = seedUidToContentUrl.get(propertyValue);
534
534
  sendBack({
535
- type: 'updateRenderValue',
535
+ type: 'updateContext',
536
536
  renderValue: contentUrl,
537
537
  });
538
538
  sendBack({
@@ -555,7 +555,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
555
555
  if (storageTransactionIdToContentUrl.has(storageTransactionId)) {
556
556
  const contentUrl = storageTransactionIdToContentUrl.get(storageTransactionId);
557
557
  sendBack({
558
- type: 'updateRenderValue',
558
+ type: 'updateContext',
559
559
  renderValue: contentUrl,
560
560
  });
561
561
  sendBack({
@@ -570,7 +570,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
570
570
  seedUidToContentUrl.set(propertyValue, contentUrl);
571
571
  }
572
572
  sendBack({
573
- type: 'updateRenderValue',
573
+ type: 'updateContext',
574
574
  renderValue: contentUrl,
575
575
  });
576
576
  sendBack({
@@ -592,7 +592,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
592
592
  if (refResolvedValueToContentUrl.has(refResolvedValue)) {
593
593
  const contentUrl = refResolvedValueToContentUrl.get(refResolvedValue);
594
594
  sendBack({
595
- type: 'updateRenderValue',
595
+ type: 'updateContext',
596
596
  renderValue: contentUrl,
597
597
  });
598
598
  sendBack({
@@ -608,7 +608,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
608
608
  const contentUrl = URL.createObjectURL(fileHandler);
609
609
  refResolvedValueToContentUrl.set(refResolvedValue, contentUrl);
610
610
  sendBack({
611
- type: 'updateRenderValue',
611
+ type: 'updateContext',
612
612
  renderValue: contentUrl,
613
613
  });
614
614
  sendBack({
@@ -638,7 +638,7 @@ const resolveRelatedValue = fromCallback(({ sendBack, input: { context } }) => {
638
638
  }
639
639
  if (contentUrl) {
640
640
  sendBack({
641
- type: 'updateRenderValue',
641
+ type: 'updateContext',
642
642
  renderValue: contentUrl,
643
643
  });
644
644
  sendBack({
@@ -1057,11 +1057,12 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1057
1057
  resolvedValue: refResolvedValue,
1058
1058
  resolvedDisplayValue: refResolvedDisplayValue,
1059
1059
  renderValue: refResolvedDisplayValue,
1060
+ populatedFromDb: true,
1060
1061
  });
1061
1062
  if (propertyRecordSchema &&
1062
1063
  propertyRecordSchema.storageType &&
1063
1064
  propertyRecordSchema.storageType === 'ItemStorage') {
1064
- const { Item } = yield import('./index-DAMQTiS7.js');
1065
+ const { Item } = yield import('./index-DtqQJ3vS.js');
1065
1066
  const item = yield Item.find({
1066
1067
  seedLocalId,
1067
1068
  modelName: itemModelName,
@@ -1074,7 +1075,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1074
1075
  }
1075
1076
  const renderValue = yield fs.promises.readFile(filePath, 'utf8');
1076
1077
  const property = item.properties[propertyName];
1077
- property.getService().send({ type: 'updateRenderValue', renderValue });
1078
+ property.getService().send({ type: 'updateContext', renderValue });
1078
1079
  return;
1079
1080
  }
1080
1081
  }
@@ -2628,7 +2629,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2628
2629
  if (!models$1) {
2629
2630
  return;
2630
2631
  }
2631
- const { models: SeedModels } = yield import('./seed.schema.config-BqcatDl0.js');
2632
+ const { models: SeedModels } = yield import('./seed.schema.config-BL0wlKbs.js');
2632
2633
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2633
2634
  let hasModelsInDb = false;
2634
2635
  const schemaDefsByModelName = new Map();
@@ -6630,7 +6631,7 @@ const client = {
6630
6631
  console.error('fs listeners not ready during init');
6631
6632
  }
6632
6633
  globalService.send({ type: 'init', endpoints, models, addresses });
6633
- import('./seed.schema.config-BqcatDl0.js').then(({ models }) => {
6634
+ import('./seed.schema.config-BL0wlKbs.js').then(({ models }) => {
6634
6635
  for (const [key, value] of Object.entries(models)) {
6635
6636
  setModel(key, value);
6636
6637
  }
@@ -7256,22 +7257,6 @@ const propertyMachine = setup({
7256
7257
  initial: 'waitingForDb',
7257
7258
  context: ({ input }) => input,
7258
7259
  on: {
7259
- updatePropertyValue: {
7260
- target: '.resolvingRelatedValue',
7261
- guard: ({ context }) => !context.isDbReady,
7262
- actions: assign(({ event }) => {
7263
- return {
7264
- propertyValue: event.propertyValue,
7265
- };
7266
- }),
7267
- },
7268
- updateRenderValue: {
7269
- actions: assign(({ event, context }) => {
7270
- return {
7271
- renderValue: event.renderValue,
7272
- };
7273
- }),
7274
- },
7275
7260
  // reload: '.hydratingFromDb',
7276
7261
  save: {
7277
7262
  actions: assign({
@@ -7584,4 +7569,4 @@ if (isNode()) {
7584
7569
  }
7585
7570
 
7586
7571
  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_SCHEMA_BY_NAME as a, GET_SEEDS as b, GET_SEED_IDS as c, GET_STORAGE_TRANSACTION_ID as d, GET_VERSIONS as e, GET_PROPERTIES as f, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as g, itemMachineAll as h, itemMachineSingle as i, ImageSrc as j, ItemProperty as k, useItem as l, useItemProperties as m, useCreateItem as n, useItemProperty as o, useDeleteItem as p, useGlobalServiceStatus as q, useServices as r, getGlobalService as s, client as t, useItems as u, getCorrectId as v, withSeed as w };
7587
- //# sourceMappingURL=index-64tJyd3u.js.map
7572
+ //# sourceMappingURL=index-CtxwCE0C.js.map