@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
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { j as ImageSrc, I as Item, k as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, v as getCorrectId, s as getGlobalService, n as useCreateItem, p as useDeleteItem, q as useGlobalServiceStatus, l as useItem, m as useItemProperties, o as useItemProperty, u as useItems, r as useServices, w as withSeed } from './index-
|
|
1
|
+
export { j as ImageSrc, I as Item, k as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, v as getCorrectId, s as getGlobalService, n as useCreateItem, p as useDeleteItem, q as useGlobalServiceStatus, l as useItem, m as useItemProperties, o as useItemProperty, u as useItems, r as useServices, w as withSeed } from './index-CSWCwkb_.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import 'tslib';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import 'drizzle-orm';
|
|
3
|
-
import { T as Text, M as Model } from './index-
|
|
3
|
+
import { T as Text, M as Model } from './index-CSWCwkb_.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'reflect-metadata';
|
|
6
6
|
import 'xstate';
|
|
@@ -80,4 +80,4 @@ const models = {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
export { models };
|
|
83
|
-
//# sourceMappingURL=seed.schema.config-
|
|
83
|
+
//# sourceMappingURL=seed.schema.config-CRQPn2Sv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.schema.config-
|
|
1
|
+
{"version":3,"file":"seed.schema.config-CRQPn2Sv.js","sources":["../../src/shared/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/browser'\n\n@Model\nclass Seed {\n @Text() uid!: string\n @Text() type!: string\n}\n\n@Model\nclass Version {\n @Text() seedUid!: string\n @Text() note!: string\n}\n\n@Model\nclass Metadata {\n @Text() key!: string\n @Text() value!: string\n}\n\nexport const models = {\n Seed,\n Version,\n Metadata,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,IAAI,GAAV,MAAM,IAAI,CAAA;CAGT;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,IAAI,GAAA,UAAA,CAAA;IADT;AACK,CAAA,EAAA,IAAI,CAGT;AAGD,IAAM,OAAO,GAAb,MAAM,OAAO,CAAA;CAGZ;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAiB,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA;AAChB,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,OAAO,GAAA,UAAA,CAAA;IADZ;AACK,CAAA,EAAA,OAAO,CAGZ;AAGD,IAAM,QAAQ,GAAd,MAAM,QAAQ,CAAA;CAGb;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAe,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAFlB,QAAQ,GAAA,UAAA,CAAA;IADb;AACK,CAAA,EAAA,QAAQ,CAGb;AAEY,MAAA,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,QAAQ;;;;;"}
|
|
@@ -139,45 +139,35 @@ const processRelationProperty = async (
|
|
|
139
139
|
relationProperty.propertyDef!.ref as string,
|
|
140
140
|
)
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
localId:
|
|
142
|
+
const publishPayload: PublishPayload = {
|
|
143
|
+
localId: relatedItem.seedLocalId,
|
|
144
144
|
seedIsRevocable: true,
|
|
145
145
|
versionSchemaUid: VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA,
|
|
146
146
|
seedUid: seedUid || ZERO_BYTES32,
|
|
147
147
|
seedSchemaUid,
|
|
148
148
|
versionUid,
|
|
149
149
|
listOfAttestations: [],
|
|
150
|
-
propertiesToUpdate: [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (itemUploadProperties.length === 1) {
|
|
157
|
-
const uploadProperty = itemUploadProperties[0]
|
|
158
|
-
const itemProperty = uploadProperty.itemProperty
|
|
159
|
-
const transactionData = uploadedTransactions.find(
|
|
160
|
-
(transaction) => transaction.seedLocalId === relatedItem.seedLocalId,
|
|
161
|
-
)
|
|
162
|
-
if (transactionData) {
|
|
163
|
-
itemProperty.value = transactionData.txId
|
|
164
|
-
await itemProperty.save()
|
|
165
|
-
itemBasicProperties.push(itemProperty)
|
|
166
|
-
}
|
|
150
|
+
propertiesToUpdate: [
|
|
151
|
+
{
|
|
152
|
+
publishLocalId: relationProperty.seedLocalId,
|
|
153
|
+
propertySchemaUid: relationProperty.schemaUid,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
167
156
|
}
|
|
168
157
|
|
|
169
|
-
|
|
170
|
-
|
|
158
|
+
multiPublishPayload = await processItem(
|
|
159
|
+
relatedItem,
|
|
171
160
|
publishPayload,
|
|
161
|
+
uploadedTransactions,
|
|
162
|
+
multiPublishPayload,
|
|
172
163
|
)
|
|
173
164
|
|
|
174
|
-
multiPublishPayload.push(publishPayload)
|
|
175
|
-
|
|
176
165
|
return multiPublishPayload
|
|
177
166
|
}
|
|
178
167
|
|
|
179
168
|
const processListProperty = async (
|
|
180
169
|
listProperty: ItemProperty<any>,
|
|
170
|
+
uploadTransactions: UploadedTransaction[],
|
|
181
171
|
multiPublishPayload: MultiPublishPayload,
|
|
182
172
|
): Promise<MultiPublishPayload> => {
|
|
183
173
|
let value = listProperty.getService().getSnapshot().context.propertyValue
|
|
@@ -232,20 +222,71 @@ const processListProperty = async (
|
|
|
232
222
|
listOfAttestations: [],
|
|
233
223
|
propertiesToUpdate: [
|
|
234
224
|
{
|
|
235
|
-
publishLocalId: listProperty.
|
|
225
|
+
publishLocalId: listProperty.seedLocalId,
|
|
236
226
|
propertySchemaUid: listProperty.schemaUid,
|
|
237
227
|
},
|
|
238
228
|
],
|
|
239
229
|
}
|
|
240
230
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
publishPayload = await processBasicProperties(
|
|
244
|
-
itemBasicProperties,
|
|
231
|
+
multiPublishPayload = await processItem(
|
|
232
|
+
relatedItem,
|
|
245
233
|
publishPayload,
|
|
234
|
+
uploadTransactions,
|
|
235
|
+
multiPublishPayload,
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return multiPublishPayload
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const processItem = async (
|
|
243
|
+
item: Item<any>,
|
|
244
|
+
itemPublishData: PublishPayload,
|
|
245
|
+
uploadedTransactions: UploadedTransaction[],
|
|
246
|
+
multiPublishPayload: MultiPublishPayload,
|
|
247
|
+
) => {
|
|
248
|
+
const {
|
|
249
|
+
itemBasicProperties,
|
|
250
|
+
itemRelationProperties,
|
|
251
|
+
itemListProperties,
|
|
252
|
+
itemUploadProperties,
|
|
253
|
+
} = getSegmentedItemProperties(item)
|
|
254
|
+
|
|
255
|
+
if (itemUploadProperties.length === 1) {
|
|
256
|
+
const uploadProperty = itemUploadProperties[0]
|
|
257
|
+
const itemProperty = uploadProperty.itemProperty
|
|
258
|
+
const transactionData = uploadedTransactions.find(
|
|
259
|
+
(transaction) => transaction.seedLocalId === item.seedLocalId,
|
|
260
|
+
)
|
|
261
|
+
if (transactionData) {
|
|
262
|
+
itemProperty.value = transactionData.txId
|
|
263
|
+
await itemProperty.save()
|
|
264
|
+
itemBasicProperties.push(itemProperty)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
for (const relationProperty of itemRelationProperties) {
|
|
269
|
+
multiPublishPayload = await processRelationProperty(
|
|
270
|
+
relationProperty,
|
|
271
|
+
multiPublishPayload,
|
|
272
|
+
uploadedTransactions,
|
|
246
273
|
)
|
|
274
|
+
itemBasicProperties.push(relationProperty)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
itemPublishData = await processBasicProperties(
|
|
278
|
+
itemBasicProperties,
|
|
279
|
+
itemPublishData,
|
|
280
|
+
)
|
|
247
281
|
|
|
248
|
-
|
|
282
|
+
multiPublishPayload.push(itemPublishData)
|
|
283
|
+
|
|
284
|
+
for (const listProperty of itemListProperties) {
|
|
285
|
+
multiPublishPayload = await processListProperty(
|
|
286
|
+
listProperty,
|
|
287
|
+
uploadedTransactions,
|
|
288
|
+
multiPublishPayload,
|
|
289
|
+
)
|
|
249
290
|
}
|
|
250
291
|
|
|
251
292
|
return multiPublishPayload
|
|
@@ -291,7 +332,7 @@ export const getPublishPayload = async (
|
|
|
291
332
|
|
|
292
333
|
// That means the Seed of the Item, plus any Seeds pointed to by Relations
|
|
293
334
|
|
|
294
|
-
|
|
335
|
+
const itemPublishData: PublishPayload = {
|
|
295
336
|
localId: item.seedLocalId,
|
|
296
337
|
seedUid: item.seedUid || ZERO_BYTES32,
|
|
297
338
|
seedIsRevocable: true,
|
|
@@ -302,47 +343,12 @@ export const getPublishPayload = async (
|
|
|
302
343
|
propertiesToUpdate: [],
|
|
303
344
|
}
|
|
304
345
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
itemRelationProperties,
|
|
308
|
-
itemListProperties,
|
|
309
|
-
itemUploadProperties,
|
|
310
|
-
} = getSegmentedItemProperties(item)
|
|
311
|
-
|
|
312
|
-
if (itemUploadProperties.length === 1) {
|
|
313
|
-
const uploadProperty = itemUploadProperties[0]
|
|
314
|
-
const itemProperty = uploadProperty.itemProperty
|
|
315
|
-
const transactionData = uploadedTransactions.find(
|
|
316
|
-
(transaction) => transaction.seedLocalId === item.seedLocalId,
|
|
317
|
-
)
|
|
318
|
-
if (transactionData) {
|
|
319
|
-
itemProperty.value = transactionData.txId
|
|
320
|
-
await itemProperty.save()
|
|
321
|
-
itemBasicProperties.push(itemProperty)
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
itemPublishData = await processBasicProperties(
|
|
326
|
-
itemBasicProperties,
|
|
346
|
+
multiPublishPayload = await processItem(
|
|
347
|
+
item,
|
|
327
348
|
itemPublishData,
|
|
349
|
+
uploadedTransactions,
|
|
350
|
+
multiPublishPayload,
|
|
328
351
|
)
|
|
329
352
|
|
|
330
|
-
multiPublishPayload.push(itemPublishData)
|
|
331
|
-
|
|
332
|
-
for (const relationProperty of itemRelationProperties) {
|
|
333
|
-
multiPublishPayload = await processRelationProperty(
|
|
334
|
-
relationProperty,
|
|
335
|
-
multiPublishPayload,
|
|
336
|
-
uploadedTransactions,
|
|
337
|
-
)
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
for (const listProperty of itemListProperties) {
|
|
341
|
-
multiPublishPayload = await processListProperty(
|
|
342
|
-
listProperty,
|
|
343
|
-
multiPublishPayload,
|
|
344
|
-
)
|
|
345
|
-
}
|
|
346
|
-
|
|
347
353
|
return multiPublishPayload
|
|
348
354
|
}
|
|
@@ -129,7 +129,11 @@ const processUploadProperty = async (
|
|
|
129
129
|
// })
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
try {
|
|
133
|
+
fileContents = await fs.promises.readFile(filePath)
|
|
134
|
+
} catch (e) {
|
|
135
|
+
fileContents = fs.readFileSync(filePath)
|
|
136
|
+
}
|
|
133
137
|
}
|
|
134
138
|
if (!fileContents) {
|
|
135
139
|
return uploads
|
|
@@ -142,9 +146,16 @@ const processUploadProperty = async (
|
|
|
142
146
|
let compositeFileContents = ''
|
|
143
147
|
|
|
144
148
|
for (const childUpload of childUploads) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
let childUploadContents
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
childUploadContents = await fs.promises.readFile(
|
|
153
|
+
childUpload.localStoragePath,
|
|
154
|
+
)
|
|
155
|
+
} catch (e) {
|
|
156
|
+
childUploadContents = fs.readFileSync(childUpload.localStoragePath)
|
|
157
|
+
}
|
|
158
|
+
|
|
148
159
|
compositeFileContents += `${separator}${childUpload.propertyName}${separator}${childUploadContents}`
|
|
149
160
|
}
|
|
150
161
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPublishPayload.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/db/read/getPublishPayload.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAGnB,MAAM,uCAAuC,CAAA;AAS9C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"getPublishPayload.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/db/read/getPublishPayload.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAGnB,MAAM,uCAAuC,CAAA;AAS9C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAmR1C,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;IACxC,kBAAkB,EAAE,GAAG,EAAE,CAAA;CAC1B,CAAA;AAED,KAAK,mBAAmB,GAAG,cAAc,EAAE,CAAA;AAE3C,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,SACtB,IAAI,CAAC,GAAG,CAAC,wBACO,mBAAmB,EAAE,KAC1C,OAAO,CAAC,mBAAmB,CAmC7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPublishUploads.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/db/read/getPublishUploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,WAAW,MAAM,6BAA6B,CAAA;AAUrD,eAAO,MAAM,cA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AAY,CAAC,GAAG,CAAC,6BA+CxC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-D1R2g9ZX.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|