@seedprotocol/sdk 0.1.70 → 0.1.72
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/README.md +40 -19
- package/dist/bin.js +3 -1
- package/dist/bin.js.map +1 -1
- package/dist/{constants-BLctWkrn.js → constants-CtmwCBma.js} +23 -2
- package/dist/{constants-BLctWkrn.js.map → constants-CtmwCBma.js.map} +1 -1
- package/dist/{index-Cy1fke9s.js → index-Bcf8xGUK.js} +202 -71
- package/dist/index-Bcf8xGUK.js.map +1 -0
- package/dist/{index-B6WilINl.js → index-CG7KjAdn.js} +5 -3
- package/dist/index-CG7KjAdn.js.map +1 -0
- package/dist/main.js +4 -2
- package/dist/main.js.map +1 -1
- package/dist/{seed.schema.config-dylVDX7W.js → seed.schema.config-Z67FC09h.js} +5 -3
- package/dist/seed.schema.config-Z67FC09h.js.map +1 -0
- package/dist/src/ItemProperty.ts +4 -0
- package/dist/src/allItems.ts +3 -2
- package/dist/src/download.ts +2 -2
- package/dist/src/getPublishPayload.ts +111 -0
- package/dist/src/globalMachine.ts +46 -26
- package/dist/src/hydrateFromDb.ts +5 -19
- package/dist/src/index.ts +19 -104
- package/dist/src/item.ts +5 -5
- package/dist/src/publish.ts +0 -3
- package/dist/src/saveAppState.ts +19 -0
- package/dist/src/savePublishService.ts +30 -0
- package/dist/src/services.ts +13 -4
- package/dist/src/updateMetadata.ts +19 -0
- package/dist/src/write.ts +1 -18
- package/dist/types/src/browser/db/read/getPublishPayload.d.ts +15 -0
- package/dist/types/src/browser/db/read/getPublishPayload.d.ts.map +1 -0
- package/dist/types/src/browser/db/write/saveAppState.d.ts +2 -0
- package/dist/types/src/browser/db/write/saveAppState.d.ts.map +1 -0
- package/dist/types/src/browser/db/write/updateMetadata.d.ts +5 -0
- package/dist/types/src/browser/db/write/updateMetadata.d.ts.map +1 -0
- package/dist/types/src/browser/db/write.d.ts +0 -1
- package/dist/types/src/browser/db/write.d.ts.map +1 -1
- package/dist/types/src/browser/events/item/index.d.ts.map +1 -1
- package/dist/types/src/browser/events/item/publish.d.ts +0 -1
- package/dist/types/src/browser/events/item/publish.d.ts.map +1 -1
- package/dist/types/src/browser/events/services/allItems.d.ts.map +1 -1
- package/dist/types/src/browser/item/Item.d.ts +1 -0
- package/dist/types/src/browser/item/Item.d.ts.map +1 -1
- package/dist/types/src/browser/item/queries.d.ts +3 -0
- package/dist/types/src/browser/item/queries.d.ts.map +1 -1
- package/dist/types/src/browser/property/ItemProperty.d.ts +1 -0
- package/dist/types/src/browser/property/ItemProperty.d.ts.map +1 -1
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/types/src/browser/react/item.d.ts.map +1 -1
- package/dist/types/src/browser/react/services.d.ts.map +1 -1
- package/dist/types/src/browser/schema/file/fetchAll/actors.d.ts.map +1 -1
- package/dist/types/src/browser/services/global/actors/savePublishService.d.ts +4 -0
- package/dist/types/src/browser/services/global/actors/savePublishService.d.ts.map +1 -0
- package/dist/types/src/browser/services/global/globalMachine.d.ts +20 -0
- package/dist/types/src/browser/services/global/globalMachine.d.ts.map +1 -1
- package/dist/types/src/shared/helpers/constants.d.ts +12 -0
- package/dist/types/src/shared/helpers/constants.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-B6WilINl.js.map +0 -1
- package/dist/index-Cy1fke9s.js.map +0 -1
- package/dist/seed.schema.config-dylVDX7W.js.map +0 -1
- package/dist/src/seedData.ts +0 -0
- package/dist/types/src/browser/eas/actors.d.ts +0 -3
- package/dist/types/src/browser/eas/actors.d.ts.map +0 -1
- package/dist/types/src/browser/eas/helpers.d.ts +0 -5
- package/dist/types/src/browser/eas/helpers.d.ts.map +0 -1
- package/dist/types/src/browser/eas/index.d.ts +0 -113
- package/dist/types/src/browser/eas/index.d.ts.map +0 -1
- package/dist/types/src/browser/eas/seedData.d.ts +0 -1
- package/dist/types/src/browser/eas/seedData.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as __awaiter, d as __rest, i as internalPropertyNames, I as INTERNAL_DATA_TYPES } from './constants-
|
|
1
|
+
import { b as __awaiter, d as __rest, i as internalPropertyNames, I as INTERNAL_DATA_TYPES, e as defaultAttestationData, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA } from './constants-CtmwCBma.js';
|
|
2
2
|
import path, { basename } from 'path';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import { Type } from '@sinclair/typebox';
|
|
@@ -26,6 +26,8 @@ import { WebAccess } from '@zenfs/dom';
|
|
|
26
26
|
import Arweave from 'arweave';
|
|
27
27
|
import { useImmer } from 'use-immer';
|
|
28
28
|
import { useSelector } from '@xstate/react';
|
|
29
|
+
import { ZERO_ADDRESS } from 'thirdweb';
|
|
30
|
+
import { SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
|
|
29
31
|
|
|
30
32
|
const isNode = () => {
|
|
31
33
|
return (typeof process !== 'undefined' &&
|
|
@@ -896,6 +898,15 @@ const getAddressesFromDb = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
896
898
|
return JSON.parse(addressArrayString);
|
|
897
899
|
});
|
|
898
900
|
|
|
901
|
+
const updateMetadata = (metadataValues) => __awaiter(void 0, void 0, void 0, function* () {
|
|
902
|
+
const appDb = getAppDb();
|
|
903
|
+
const { localId } = metadataValues, rest = __rest(metadataValues, ["localId"]);
|
|
904
|
+
if (!localId) {
|
|
905
|
+
throw new Error('No localId provided to updateMetadata');
|
|
906
|
+
}
|
|
907
|
+
yield appDb.update(metadata).set(rest).where(eq(metadata.localId, localId));
|
|
908
|
+
});
|
|
909
|
+
|
|
899
910
|
const logger$m = debug('app:property:actors:hydrateFromDb');
|
|
900
911
|
const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
901
912
|
const { seedUid, seedLocalId, propertyName: propertyNameRaw, propertyValue, propertyRecordSchema, itemModelName, } = context;
|
|
@@ -1001,6 +1012,10 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1001
1012
|
const fileContents = yield fs.promises.readFile(filePath);
|
|
1002
1013
|
const fileHandler = new File([fileContents], refResolvedValue);
|
|
1003
1014
|
refResolvedDisplayValue = URL.createObjectURL(fileHandler);
|
|
1015
|
+
yield updateMetadata({
|
|
1016
|
+
localId,
|
|
1017
|
+
refResolvedDisplayValue,
|
|
1018
|
+
});
|
|
1004
1019
|
}
|
|
1005
1020
|
}
|
|
1006
1021
|
}
|
|
@@ -1010,24 +1025,6 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1010
1025
|
typeof propertyValueFromDb === 'string') {
|
|
1011
1026
|
propertyValueProcessed = propertyValueFromDb.split(',');
|
|
1012
1027
|
}
|
|
1013
|
-
if (seedLocalIdFromDb === 'sAFXuO7Uez') {
|
|
1014
|
-
console.log(`[hydrateFromDb] sending updateContext with:`, {
|
|
1015
|
-
type: 'updateContext',
|
|
1016
|
-
localId,
|
|
1017
|
-
uid,
|
|
1018
|
-
propertyValue: propertyValueProcessed,
|
|
1019
|
-
seedLocalId: seedLocalIdFromDb,
|
|
1020
|
-
seedUid: seedUidFromDb,
|
|
1021
|
-
versionLocalId: versionLocalIdFromDb,
|
|
1022
|
-
versionUid: versionUidFromDb,
|
|
1023
|
-
schemaUid: schemaUidFromDb,
|
|
1024
|
-
refValueType,
|
|
1025
|
-
localStorageDir,
|
|
1026
|
-
resolvedValue: refResolvedValue,
|
|
1027
|
-
resolvedDisplayValue: refResolvedDisplayValue,
|
|
1028
|
-
renderValue: refResolvedDisplayValue,
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
1028
|
sendBack({
|
|
1032
1029
|
type: 'updateContext',
|
|
1033
1030
|
localId,
|
|
@@ -1047,7 +1044,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
1047
1044
|
if (propertyRecordSchema &&
|
|
1048
1045
|
propertyRecordSchema.storageType &&
|
|
1049
1046
|
propertyRecordSchema.storageType === 'ItemStorage') {
|
|
1050
|
-
const { Item } = yield import('./index-
|
|
1047
|
+
const { Item } = yield import('./index-CG7KjAdn.js');
|
|
1051
1048
|
const item = yield Item.find({
|
|
1052
1049
|
seedLocalId,
|
|
1053
1050
|
modelName: itemModelName,
|
|
@@ -1219,21 +1216,6 @@ const createNewItem = (_a) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
1219
1216
|
versionLocalId: newVersionId,
|
|
1220
1217
|
};
|
|
1221
1218
|
});
|
|
1222
|
-
const writeAppState = (key, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1223
|
-
const appDb = getAppDb();
|
|
1224
|
-
yield appDb
|
|
1225
|
-
.insert(appState)
|
|
1226
|
-
.values({
|
|
1227
|
-
key,
|
|
1228
|
-
value,
|
|
1229
|
-
})
|
|
1230
|
-
.onConflictDoUpdate({
|
|
1231
|
-
target: appState.key,
|
|
1232
|
-
set: {
|
|
1233
|
-
value,
|
|
1234
|
-
},
|
|
1235
|
-
});
|
|
1236
|
-
});
|
|
1237
1219
|
|
|
1238
1220
|
const eventEmitter = new EventEmitter();
|
|
1239
1221
|
|
|
@@ -1590,6 +1572,9 @@ class ItemProperty {
|
|
|
1590
1572
|
get seedUid() {
|
|
1591
1573
|
return this._getSnapshot().context.seedUid;
|
|
1592
1574
|
}
|
|
1575
|
+
get schemaUid() {
|
|
1576
|
+
return this._getSnapshot().context.schemaUid;
|
|
1577
|
+
}
|
|
1593
1578
|
get propertyName() {
|
|
1594
1579
|
if (this._alias) {
|
|
1595
1580
|
return this._alias;
|
|
@@ -1850,6 +1835,17 @@ const GET_SCHEMAS = graphql(/* GraphQL */ `
|
|
|
1850
1835
|
}
|
|
1851
1836
|
}
|
|
1852
1837
|
`);
|
|
1838
|
+
const GET_SCHEMA_BY_NAME = graphql(/* GraphQL */ `
|
|
1839
|
+
query GetSchemaByName($where: SchemaWhereInput!) {
|
|
1840
|
+
schema: schemata(where: $where) {
|
|
1841
|
+
id
|
|
1842
|
+
schema
|
|
1843
|
+
schemaNames {
|
|
1844
|
+
name
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
`);
|
|
1853
1849
|
const GET_SEEDS = graphql(/* GraphQL */ `
|
|
1854
1850
|
query GetSeeds($where: AttestationWhereInput!) {
|
|
1855
1851
|
itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {
|
|
@@ -2552,7 +2548,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
|
|
|
2552
2548
|
if (!models$1) {
|
|
2553
2549
|
return;
|
|
2554
2550
|
}
|
|
2555
|
-
const { models: SeedModels } = yield import('./seed.schema.config-
|
|
2551
|
+
const { models: SeedModels } = yield import('./seed.schema.config-Z67FC09h.js');
|
|
2556
2552
|
const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
|
|
2557
2553
|
let hasModelsInDb = false;
|
|
2558
2554
|
const schemaDefsByModelName = new Map();
|
|
@@ -3571,6 +3567,22 @@ const GET_TRANSACTION_TAGS = graphql(/* GraphQL */ `
|
|
|
3571
3567
|
}
|
|
3572
3568
|
`);
|
|
3573
3569
|
|
|
3570
|
+
const saveAppState = (key, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3571
|
+
const appDb = getAppDb();
|
|
3572
|
+
yield appDb
|
|
3573
|
+
.insert(appState)
|
|
3574
|
+
.values({
|
|
3575
|
+
key,
|
|
3576
|
+
value,
|
|
3577
|
+
})
|
|
3578
|
+
.onConflictDoUpdate({
|
|
3579
|
+
target: appState.key,
|
|
3580
|
+
set: {
|
|
3581
|
+
value,
|
|
3582
|
+
},
|
|
3583
|
+
});
|
|
3584
|
+
});
|
|
3585
|
+
|
|
3574
3586
|
const logger$c = debug('app:files:download');
|
|
3575
3587
|
const downloadAllFilesRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({ endpoints, eventId, }) {
|
|
3576
3588
|
yield syncDbFiles(endpoints);
|
|
@@ -3657,7 +3669,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
|
|
|
3657
3669
|
if (res.status !== 200) {
|
|
3658
3670
|
logger$c(`[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`);
|
|
3659
3671
|
excludedTransactions.add(transactionId);
|
|
3660
|
-
yield
|
|
3672
|
+
yield saveAppState('excludedTransactions', JSON.stringify(Array.from(excludedTransactions)));
|
|
3661
3673
|
continue;
|
|
3662
3674
|
}
|
|
3663
3675
|
const { tags } = yield queryClient.fetchQuery({
|
|
@@ -4878,6 +4890,23 @@ const publishMachine = setup({
|
|
|
4878
4890
|
},
|
|
4879
4891
|
});
|
|
4880
4892
|
|
|
4893
|
+
const savePublishService = fromCallback(({ sendBack, input: { event, context } }) => {
|
|
4894
|
+
const { publishItemService } = context;
|
|
4895
|
+
if (!publishItemService) {
|
|
4896
|
+
sendBack({ type: 'savePublishServiceError' });
|
|
4897
|
+
return;
|
|
4898
|
+
}
|
|
4899
|
+
const _savePublishService = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4900
|
+
yield saveAppState(`snapshot__publishItemService`, JSON.stringify(publishItemService.getPersistedSnapshot()));
|
|
4901
|
+
return true;
|
|
4902
|
+
});
|
|
4903
|
+
_savePublishService().then((success) => {
|
|
4904
|
+
if (success) {
|
|
4905
|
+
sendBack({ type: 'savePublishServiceSuccess' });
|
|
4906
|
+
}
|
|
4907
|
+
});
|
|
4908
|
+
});
|
|
4909
|
+
|
|
4881
4910
|
const { UNINITIALIZED, INITIALIZING, INITIALIZED, PUBLISHING_ITEM, ADDING_MODELS_TO_DB, } = GlobalState;
|
|
4882
4911
|
createBrowserInspector({
|
|
4883
4912
|
autoStart: false,
|
|
@@ -4891,11 +4920,17 @@ const globalMachine = setup({
|
|
|
4891
4920
|
initialize: initialize$1,
|
|
4892
4921
|
addModelsToDb,
|
|
4893
4922
|
getSchemaForModel,
|
|
4923
|
+
savePublishService,
|
|
4894
4924
|
},
|
|
4895
4925
|
}).createMachine({
|
|
4896
4926
|
id: MachineIds.GLOBAL,
|
|
4897
4927
|
initial: UNINITIALIZED,
|
|
4898
4928
|
context: ({ input }) => input,
|
|
4929
|
+
on: {
|
|
4930
|
+
publishItemRequest: `.${PUBLISHING_ITEM}`,
|
|
4931
|
+
savePublishService: `.savingPublishService`,
|
|
4932
|
+
restorePublishService: `.${PUBLISHING_ITEM}`,
|
|
4933
|
+
},
|
|
4899
4934
|
states: {
|
|
4900
4935
|
[UNINITIALIZED]: {
|
|
4901
4936
|
on: {
|
|
@@ -4926,7 +4961,7 @@ const globalMachine = setup({
|
|
|
4926
4961
|
displayText: 'Booting up',
|
|
4927
4962
|
percentComplete: 5,
|
|
4928
4963
|
},
|
|
4929
|
-
tags: ['loading'],
|
|
4964
|
+
tags: ['loading', 'startup'],
|
|
4930
4965
|
},
|
|
4931
4966
|
[INITIALIZING]: {
|
|
4932
4967
|
on: {
|
|
@@ -4975,7 +5010,7 @@ const globalMachine = setup({
|
|
|
4975
5010
|
displayText: 'Initializing Seed SDK',
|
|
4976
5011
|
percentComplete: 10,
|
|
4977
5012
|
},
|
|
4978
|
-
tags: ['loading'],
|
|
5013
|
+
tags: ['loading', 'startup'],
|
|
4979
5014
|
},
|
|
4980
5015
|
},
|
|
4981
5016
|
[ADDING_MODELS_TO_DB]: {
|
|
@@ -4993,38 +5028,51 @@ const globalMachine = setup({
|
|
|
4993
5028
|
meta: {
|
|
4994
5029
|
displayText: 'Adding models to database',
|
|
4995
5030
|
},
|
|
4996
|
-
tags: ['loading'],
|
|
5031
|
+
tags: ['loading', 'startup'],
|
|
4997
5032
|
},
|
|
4998
5033
|
},
|
|
4999
5034
|
[INITIALIZED]: {
|
|
5000
|
-
type: 'parallel',
|
|
5001
|
-
on: {
|
|
5002
|
-
|
|
5003
|
-
},
|
|
5035
|
+
// type: 'parallel',
|
|
5036
|
+
// on: {
|
|
5037
|
+
// publishItemRequest: `.${PUBLISHING_ITEM}`,
|
|
5038
|
+
// },
|
|
5004
5039
|
meta: {
|
|
5005
5040
|
displayText: 'Global service ready',
|
|
5006
5041
|
percentComplete: 40,
|
|
5007
5042
|
},
|
|
5008
|
-
tags: ['loading'],
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5043
|
+
tags: ['loading', 'startup'],
|
|
5044
|
+
// initial: PUBLISHING_ITEM,
|
|
5045
|
+
},
|
|
5046
|
+
[PUBLISHING_ITEM]: {
|
|
5047
|
+
target: INITIALIZED,
|
|
5048
|
+
entry: [
|
|
5049
|
+
assign({
|
|
5050
|
+
publishItemService: ({ spawn, event }) => spawn(publishMachine, {
|
|
5051
|
+
id: 'publishService',
|
|
5052
|
+
input: {
|
|
5053
|
+
localId: event.seedLocalId,
|
|
5054
|
+
},
|
|
5055
|
+
}),
|
|
5056
|
+
}),
|
|
5057
|
+
],
|
|
5058
|
+
meta: {
|
|
5059
|
+
displayText: 'Publishing item',
|
|
5060
|
+
},
|
|
5061
|
+
tags: ['publishing'],
|
|
5062
|
+
},
|
|
5063
|
+
savingPublishService: {
|
|
5064
|
+
target: INITIALIZED,
|
|
5065
|
+
on: {
|
|
5066
|
+
savePublishServiceSuccess: INITIALIZED,
|
|
5067
|
+
},
|
|
5068
|
+
invoke: {
|
|
5069
|
+
src: 'savePublishService',
|
|
5070
|
+
input: ({ context }) => ({ context }),
|
|
5071
|
+
},
|
|
5072
|
+
meta: {
|
|
5073
|
+
displayText: 'Saving publish service',
|
|
5027
5074
|
},
|
|
5075
|
+
tags: ['publishing'],
|
|
5028
5076
|
},
|
|
5029
5077
|
},
|
|
5030
5078
|
// on: {
|
|
@@ -5097,7 +5145,7 @@ const globalService = createActor(globalMachine, {
|
|
|
5097
5145
|
globalService.start();
|
|
5098
5146
|
const getGlobalService = () => globalService;
|
|
5099
5147
|
|
|
5100
|
-
const publishItemRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
5148
|
+
const publishItemRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({ seedLocalId, }) {
|
|
5101
5149
|
const globalService = getGlobalService();
|
|
5102
5150
|
globalService.subscribe((snapshot) => {
|
|
5103
5151
|
if (!snapshot ||
|
|
@@ -5108,7 +5156,6 @@ const publishItemRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, functi
|
|
|
5108
5156
|
});
|
|
5109
5157
|
globalService.send({
|
|
5110
5158
|
type: 'publishItemRequest',
|
|
5111
|
-
modelName,
|
|
5112
5159
|
seedLocalId,
|
|
5113
5160
|
});
|
|
5114
5161
|
});
|
|
@@ -5126,6 +5173,7 @@ const setupAllItemsEventHandlers = () => {
|
|
|
5126
5173
|
// eventEmitter.addListener('item.update', itemUpdateHandler)
|
|
5127
5174
|
eventEmitter.addListener('syncDbWithEas', syncDbWithEasHandler);
|
|
5128
5175
|
eventEmitter.addListener('item.publish.request', publishItemRequestHandler);
|
|
5176
|
+
eventEmitter.addListener('item.publish.payload.request', publishItemRequestHandler);
|
|
5129
5177
|
//
|
|
5130
5178
|
// eventEmitter.emit('item.events.setupAllItemsEventHandlers')
|
|
5131
5179
|
areReady = true;
|
|
@@ -5733,6 +5781,86 @@ const getItemDataFromDb = (_a) => __awaiter(void 0, [_a], void 0, function* ({ m
|
|
|
5733
5781
|
}
|
|
5734
5782
|
return itemData;
|
|
5735
5783
|
});
|
|
5784
|
+
const getItem = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelName, seedLocalId, seedUid }) {
|
|
5785
|
+
const itemInitObj = yield getItemDataFromDb({
|
|
5786
|
+
modelName,
|
|
5787
|
+
seedLocalId,
|
|
5788
|
+
seedUid,
|
|
5789
|
+
});
|
|
5790
|
+
if (!itemInitObj) {
|
|
5791
|
+
console.error(`[db/queries] [getItem] no itemInitObj modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`);
|
|
5792
|
+
return;
|
|
5793
|
+
}
|
|
5794
|
+
if (!itemInitObj.seedLocalId) {
|
|
5795
|
+
console.error(`[db/queries] [getItem] no itemInitObj.seedLocalId modelName: ${modelName} seedLocalId: ${seedLocalId} seedUid: ${seedUid}`);
|
|
5796
|
+
return;
|
|
5797
|
+
}
|
|
5798
|
+
return Item.create(itemInitObj);
|
|
5799
|
+
});
|
|
5800
|
+
|
|
5801
|
+
const getPublishPayload = (seedLocalId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5802
|
+
const item = yield getItem({ seedLocalId });
|
|
5803
|
+
if (!item) {
|
|
5804
|
+
throw new Error('Item not found');
|
|
5805
|
+
}
|
|
5806
|
+
const localId = item.seedLocalId;
|
|
5807
|
+
const seedIsRevocable = true;
|
|
5808
|
+
const seedSchemaUid = item.schemaUid;
|
|
5809
|
+
const seedUid = item.seedUid;
|
|
5810
|
+
const versionSchemaUid = VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA;
|
|
5811
|
+
const listOfAttestations = [];
|
|
5812
|
+
const propertiesToUpdate = [];
|
|
5813
|
+
yield getModelSchemas();
|
|
5814
|
+
for (const [propertyName, itemProperty] of Object.entries(item.properties)) {
|
|
5815
|
+
const foundPropertySchema = yield queryClient.fetchQuery({
|
|
5816
|
+
queryKey: [`getPropertySchema${propertyName}`],
|
|
5817
|
+
queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
5818
|
+
return easClient.request(GET_SCHEMAS, {
|
|
5819
|
+
where: {
|
|
5820
|
+
id: {
|
|
5821
|
+
equals: itemProperty.schemaUid,
|
|
5822
|
+
},
|
|
5823
|
+
},
|
|
5824
|
+
});
|
|
5825
|
+
}),
|
|
5826
|
+
});
|
|
5827
|
+
if (!foundPropertySchema ||
|
|
5828
|
+
!foundPropertySchema.schemas ||
|
|
5829
|
+
foundPropertySchema.schemas.length === 0) {
|
|
5830
|
+
console.error(`Property schema not found for ${propertyName}`);
|
|
5831
|
+
continue;
|
|
5832
|
+
}
|
|
5833
|
+
if (!itemProperty.propertyDef) {
|
|
5834
|
+
console.error(`Property definition not found for ${propertyName}`);
|
|
5835
|
+
continue;
|
|
5836
|
+
}
|
|
5837
|
+
const easDataType = INTERNAL_DATA_TYPES[itemProperty.propertyDef.dataType].eas;
|
|
5838
|
+
const data = [
|
|
5839
|
+
{ name: propertyName, type: easDataType, value: itemProperty.value },
|
|
5840
|
+
];
|
|
5841
|
+
const easSchemaDefinition = foundPropertySchema.schemas[0].schema;
|
|
5842
|
+
const dataEncoder = new SchemaEncoder(easSchemaDefinition);
|
|
5843
|
+
const encodedData = dataEncoder.encodeData(data);
|
|
5844
|
+
listOfAttestations.push({
|
|
5845
|
+
schema: itemProperty.schemaUid,
|
|
5846
|
+
data: [
|
|
5847
|
+
Object.assign(Object.assign({}, defaultAttestationData), { data: encodedData }),
|
|
5848
|
+
],
|
|
5849
|
+
});
|
|
5850
|
+
}
|
|
5851
|
+
return [
|
|
5852
|
+
{
|
|
5853
|
+
localId,
|
|
5854
|
+
seedIsRevocable,
|
|
5855
|
+
seedSchemaUid,
|
|
5856
|
+
seedUid: seedUid || ZERO_ADDRESS,
|
|
5857
|
+
versionUid: item.latestVersionUid || ZERO_ADDRESS,
|
|
5858
|
+
versionSchemaUid,
|
|
5859
|
+
listOfAttestations,
|
|
5860
|
+
propertiesToUpdate,
|
|
5861
|
+
},
|
|
5862
|
+
];
|
|
5863
|
+
});
|
|
5736
5864
|
|
|
5737
5865
|
var _a$1;
|
|
5738
5866
|
class Item {
|
|
@@ -5766,6 +5894,9 @@ class Item {
|
|
|
5766
5894
|
},
|
|
5767
5895
|
});
|
|
5768
5896
|
});
|
|
5897
|
+
this.getPublishPayload = () => __awaiter(this, void 0, void 0, function* () {
|
|
5898
|
+
yield getPublishPayload(this.seedLocalId);
|
|
5899
|
+
});
|
|
5769
5900
|
const { modelName, seedUid, schemaUid, seedLocalId, latestVersionLocalId, latestVersionUid, } = initialValues;
|
|
5770
5901
|
const ModelClass = getModel(modelName);
|
|
5771
5902
|
if (ModelClass &&
|
|
@@ -5969,7 +6100,7 @@ _a$1 = immerable;
|
|
|
5969
6100
|
Item.instanceCache = new Map();
|
|
5970
6101
|
|
|
5971
6102
|
const logger$4 = debug('app:react:services');
|
|
5972
|
-
const finalStrings = ['idle', 'ready', 'done', 'success'];
|
|
6103
|
+
const finalStrings = ['idle', 'ready', 'done', 'success', 'initialized'];
|
|
5973
6104
|
const getServiceName = (service) => {
|
|
5974
6105
|
let name = 'actor';
|
|
5975
6106
|
if (service && service.uniqueKey) {
|
|
@@ -6082,7 +6213,7 @@ const useServices = () => {
|
|
|
6082
6213
|
if (!globalService || !internalService) {
|
|
6083
6214
|
return;
|
|
6084
6215
|
}
|
|
6085
|
-
if (getServiceValue(globalService) === '
|
|
6216
|
+
if (getServiceValue(globalService) === 'initialized' &&
|
|
6086
6217
|
getServiceValue(internalService) === 'ready') {
|
|
6087
6218
|
const denominator = actors.length;
|
|
6088
6219
|
const finishedActors = actors.filter((actor) => {
|
|
@@ -6480,7 +6611,7 @@ const saveServiceHandler = (event) => __awaiter(void 0, void 0, void 0, function
|
|
|
6480
6611
|
console.log(`[saveServiceHandler] service not found: ${nameOfService}`);
|
|
6481
6612
|
return;
|
|
6482
6613
|
}
|
|
6483
|
-
yield
|
|
6614
|
+
yield saveAppState(`snapshot__${modelName}`, JSON.stringify(service.getPersistedSnapshot()));
|
|
6484
6615
|
});
|
|
6485
6616
|
|
|
6486
6617
|
const setupServiceHandlers = () => {
|
|
@@ -6504,7 +6635,7 @@ const client = {
|
|
|
6504
6635
|
console.error('fs listeners not ready during init');
|
|
6505
6636
|
}
|
|
6506
6637
|
globalService.send({ type: 'init', endpoints, models, addresses });
|
|
6507
|
-
import('./seed.schema.config-
|
|
6638
|
+
import('./seed.schema.config-Z67FC09h.js').then(({ models }) => {
|
|
6508
6639
|
for (const [key, value] of Object.entries(models)) {
|
|
6509
6640
|
setModel(key, value);
|
|
6510
6641
|
}
|
|
@@ -7464,5 +7595,5 @@ if (isNode()) {
|
|
|
7464
7595
|
withSeed = (_a = initSeedSync()) === null || _a === void 0 ? void 0 : _a.withSeed;
|
|
7465
7596
|
}
|
|
7466
7597
|
|
|
7467
|
-
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,
|
|
7468
|
-
//# sourceMappingURL=index-
|
|
7598
|
+
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 };
|
|
7599
|
+
//# sourceMappingURL=index-Bcf8xGUK.js.map
|