@seedprotocol/sdk 0.1.125 → 0.1.127
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-D1R2g9ZX.js → index-Bonkz33x.js} +2 -2
- package/dist/index-Bonkz33x.js.map +1 -0
- package/dist/{index-B4chWeSi.js → index-CSWCwkb_.js} +54 -47
- package/dist/{index-B4chWeSi.js.map → index-CSWCwkb_.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-Cj3PtmOG.js → seed.schema.config-CRQPn2Sv.js} +2 -2
- package/dist/{seed.schema.config-Cj3PtmOG.js.map → seed.schema.config-CRQPn2Sv.js.map} +1 -1
- package/dist/src/getPublishPayload.ts +75 -69
- package/dist/src/getPublishUploads.ts +15 -4
- package/dist/types/src/browser/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/types/src/browser/db/read/getPublishUploads.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-D1R2g9ZX.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-
|
|
1
|
+
export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-CSWCwkb_.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import '@sinclair/typebox';
|
|
@@ -33,4 +33,4 @@ import 'arweave';
|
|
|
33
33
|
import './constants-B6s6tGup.js';
|
|
34
34
|
import '@ethereum-attestation-service/eas-sdk';
|
|
35
35
|
import 'thirdweb';
|
|
36
|
-
//# sourceMappingURL=index-
|
|
36
|
+
//# sourceMappingURL=index-Bonkz33x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bonkz33x.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2114,7 +2114,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2114
2114
|
if (!models$1) {
|
|
2115
2115
|
return;
|
|
2116
2116
|
}
|
|
2117
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2117
|
+
const { models: SeedModels } = yield import('./seed.schema.config-CRQPn2Sv.js');
|
|
2118
2118
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2119
2119
|
let hasModelsInDb = false;
|
|
2120
2120
|
const schemaDefsByModelName = new Map();
|
|
@@ -5526,32 +5526,25 @@ const processRelationProperty = (relationProperty, multiPublishPayload, uploaded
|
|
|
5526
5526
|
}
|
|
5527
5527
|
const versionUid = getVersionUid(relatedItem);
|
|
5528
5528
|
const seedSchemaUid = yield getSchemaUidForModel(relationProperty.propertyDef.ref);
|
|
5529
|
-
|
|
5530
|
-
localId:
|
|
5529
|
+
const publishPayload = {
|
|
5530
|
+
localId: relatedItem.seedLocalId,
|
|
5531
5531
|
seedIsRevocable: true,
|
|
5532
5532
|
versionSchemaUid: VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,
|
|
5533
5533
|
seedUid: seedUid || ZERO_BYTES32,
|
|
5534
5534
|
seedSchemaUid,
|
|
5535
5535
|
versionUid,
|
|
5536
5536
|
listOfAttestations: [],
|
|
5537
|
-
propertiesToUpdate: [
|
|
5537
|
+
propertiesToUpdate: [
|
|
5538
|
+
{
|
|
5539
|
+
publishLocalId: relationProperty.seedLocalId,
|
|
5540
|
+
propertySchemaUid: relationProperty.schemaUid,
|
|
5541
|
+
},
|
|
5542
|
+
],
|
|
5538
5543
|
};
|
|
5539
|
-
|
|
5540
|
-
if (itemUploadProperties.length === 1) {
|
|
5541
|
-
const uploadProperty = itemUploadProperties[0];
|
|
5542
|
-
const itemProperty = uploadProperty.itemProperty;
|
|
5543
|
-
const transactionData = uploadedTransactions.find((transaction) => transaction.seedLocalId === relatedItem.seedLocalId);
|
|
5544
|
-
if (transactionData) {
|
|
5545
|
-
itemProperty.value = transactionData.txId;
|
|
5546
|
-
yield itemProperty.save();
|
|
5547
|
-
itemBasicProperties.push(itemProperty);
|
|
5548
|
-
}
|
|
5549
|
-
}
|
|
5550
|
-
publishPayload = yield processBasicProperties(itemBasicProperties, publishPayload);
|
|
5551
|
-
multiPublishPayload.push(publishPayload);
|
|
5544
|
+
multiPublishPayload = yield processItem(relatedItem, publishPayload, uploadedTransactions, multiPublishPayload);
|
|
5552
5545
|
return multiPublishPayload;
|
|
5553
5546
|
});
|
|
5554
|
-
const processListProperty = (listProperty, multiPublishPayload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5547
|
+
const processListProperty = (listProperty, uploadTransactions, multiPublishPayload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5555
5548
|
let value = listProperty.getService().getSnapshot().context.propertyValue;
|
|
5556
5549
|
if (!value || listProperty.uid) {
|
|
5557
5550
|
return multiPublishPayload;
|
|
@@ -5593,14 +5586,35 @@ const processListProperty = (listProperty, multiPublishPayload) => __awaiter(voi
|
|
|
5593
5586
|
listOfAttestations: [],
|
|
5594
5587
|
propertiesToUpdate: [
|
|
5595
5588
|
{
|
|
5596
|
-
publishLocalId: listProperty.
|
|
5589
|
+
publishLocalId: listProperty.seedLocalId,
|
|
5597
5590
|
propertySchemaUid: listProperty.schemaUid,
|
|
5598
5591
|
},
|
|
5599
5592
|
],
|
|
5600
5593
|
};
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5594
|
+
multiPublishPayload = yield processItem(relatedItem, publishPayload, uploadTransactions, multiPublishPayload);
|
|
5595
|
+
}
|
|
5596
|
+
return multiPublishPayload;
|
|
5597
|
+
});
|
|
5598
|
+
const processItem = (item, itemPublishData, uploadedTransactions, multiPublishPayload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5599
|
+
const { itemBasicProperties, itemRelationProperties, itemListProperties, itemUploadProperties, } = getSegmentedItemProperties(item);
|
|
5600
|
+
if (itemUploadProperties.length === 1) {
|
|
5601
|
+
const uploadProperty = itemUploadProperties[0];
|
|
5602
|
+
const itemProperty = uploadProperty.itemProperty;
|
|
5603
|
+
const transactionData = uploadedTransactions.find((transaction) => transaction.seedLocalId === item.seedLocalId);
|
|
5604
|
+
if (transactionData) {
|
|
5605
|
+
itemProperty.value = transactionData.txId;
|
|
5606
|
+
yield itemProperty.save();
|
|
5607
|
+
itemBasicProperties.push(itemProperty);
|
|
5608
|
+
}
|
|
5609
|
+
}
|
|
5610
|
+
for (const relationProperty of itemRelationProperties) {
|
|
5611
|
+
multiPublishPayload = yield processRelationProperty(relationProperty, multiPublishPayload, uploadedTransactions);
|
|
5612
|
+
itemBasicProperties.push(relationProperty);
|
|
5613
|
+
}
|
|
5614
|
+
itemPublishData = yield processBasicProperties(itemBasicProperties, itemPublishData);
|
|
5615
|
+
multiPublishPayload.push(itemPublishData);
|
|
5616
|
+
for (const listProperty of itemListProperties) {
|
|
5617
|
+
multiPublishPayload = yield processListProperty(listProperty, uploadedTransactions, multiPublishPayload);
|
|
5604
5618
|
}
|
|
5605
5619
|
return multiPublishPayload;
|
|
5606
5620
|
});
|
|
@@ -5615,7 +5629,7 @@ const getPublishPayload = (item, uploadedTransactions) => __awaiter(void 0, void
|
|
|
5615
5629
|
// Each PublishPayload is generated from a Seed that needs publishing
|
|
5616
5630
|
// First we need to determine all Seeds to publish
|
|
5617
5631
|
// That means the Seed of the Item, plus any Seeds pointed to by Relations
|
|
5618
|
-
|
|
5632
|
+
const itemPublishData = {
|
|
5619
5633
|
localId: item.seedLocalId,
|
|
5620
5634
|
seedUid: item.seedUid || ZERO_BYTES32,
|
|
5621
5635
|
seedIsRevocable: true,
|
|
@@ -5625,25 +5639,7 @@ const getPublishPayload = (item, uploadedTransactions) => __awaiter(void 0, void
|
|
|
5625
5639
|
listOfAttestations: [],
|
|
5626
5640
|
propertiesToUpdate: [],
|
|
5627
5641
|
};
|
|
5628
|
-
|
|
5629
|
-
if (itemUploadProperties.length === 1) {
|
|
5630
|
-
const uploadProperty = itemUploadProperties[0];
|
|
5631
|
-
const itemProperty = uploadProperty.itemProperty;
|
|
5632
|
-
const transactionData = uploadedTransactions.find((transaction) => transaction.seedLocalId === item.seedLocalId);
|
|
5633
|
-
if (transactionData) {
|
|
5634
|
-
itemProperty.value = transactionData.txId;
|
|
5635
|
-
yield itemProperty.save();
|
|
5636
|
-
itemBasicProperties.push(itemProperty);
|
|
5637
|
-
}
|
|
5638
|
-
}
|
|
5639
|
-
itemPublishData = yield processBasicProperties(itemBasicProperties, itemPublishData);
|
|
5640
|
-
multiPublishPayload.push(itemPublishData);
|
|
5641
|
-
for (const relationProperty of itemRelationProperties) {
|
|
5642
|
-
multiPublishPayload = yield processRelationProperty(relationProperty, multiPublishPayload, uploadedTransactions);
|
|
5643
|
-
}
|
|
5644
|
-
for (const listProperty of itemListProperties) {
|
|
5645
|
-
multiPublishPayload = yield processListProperty(listProperty, multiPublishPayload);
|
|
5646
|
-
}
|
|
5642
|
+
multiPublishPayload = yield processItem(item, itemPublishData, uploadedTransactions, multiPublishPayload);
|
|
5647
5643
|
return multiPublishPayload;
|
|
5648
5644
|
});
|
|
5649
5645
|
|
|
@@ -5728,7 +5724,12 @@ const processUploadProperty = (uploadProperty, uploads, relatedItemProperty) =>
|
|
|
5728
5724
|
// handle,
|
|
5729
5725
|
// })
|
|
5730
5726
|
}
|
|
5731
|
-
|
|
5727
|
+
try {
|
|
5728
|
+
fileContents = yield fs.promises.readFile(filePath);
|
|
5729
|
+
}
|
|
5730
|
+
catch (e) {
|
|
5731
|
+
fileContents = fs.readFileSync(filePath);
|
|
5732
|
+
}
|
|
5732
5733
|
}
|
|
5733
5734
|
if (!fileContents) {
|
|
5734
5735
|
return uploads;
|
|
@@ -5739,7 +5740,13 @@ const processUploadProperty = (uploadProperty, uploads, relatedItemProperty) =>
|
|
|
5739
5740
|
// let compositeFileContents = `${itemProperty.propertyName}${separator}${mainFileContents}`
|
|
5740
5741
|
let compositeFileContents = '';
|
|
5741
5742
|
for (const childUpload of childUploads) {
|
|
5742
|
-
|
|
5743
|
+
let childUploadContents;
|
|
5744
|
+
try {
|
|
5745
|
+
childUploadContents = yield fs.promises.readFile(childUpload.localStoragePath);
|
|
5746
|
+
}
|
|
5747
|
+
catch (e) {
|
|
5748
|
+
childUploadContents = fs.readFileSync(childUpload.localStoragePath);
|
|
5749
|
+
}
|
|
5743
5750
|
compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`;
|
|
5744
5751
|
}
|
|
5745
5752
|
fileContents = Buffer.from(compositeFileContents);
|
|
@@ -6609,7 +6616,7 @@ const client = {
|
|
|
6609
6616
|
addresses,
|
|
6610
6617
|
arweaveDomain,
|
|
6611
6618
|
});
|
|
6612
|
-
import('./seed.schema.config-
|
|
6619
|
+
import('./seed.schema.config-CRQPn2Sv.js').then(({ models }) => {
|
|
6613
6620
|
for (const [key, value] of Object.entries(models)) {
|
|
6614
6621
|
setModel(key, value);
|
|
6615
6622
|
}
|
|
@@ -7289,7 +7296,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
7289
7296
|
if (propertyRecordSchema &&
|
|
7290
7297
|
propertyRecordSchema.storageType &&
|
|
7291
7298
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
7292
|
-
const { Item } = yield import('./index-
|
|
7299
|
+
const { Item } = yield import('./index-Bonkz33x.js');
|
|
7293
7300
|
const item = yield Item.find({
|
|
7294
7301
|
seedLocalId,
|
|
7295
7302
|
modelName,
|
|
@@ -8246,4 +8253,4 @@ if (isNode()) {
|
|
|
8246
8253
|
}
|
|
8247
8254
|
|
|
8248
8255
|
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 };
|
|
8249
|
-
//# sourceMappingURL=index-
|
|
8256
|
+
//# sourceMappingURL=index-CSWCwkb_.js.map
|