@seedprotocol/sdk 0.7.5 → 0.7.6
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 +2 -2
- package/dist/{ClientManager-DRf4uuei.js → ClientManager-D6YA20jP.js} +207 -149
- package/dist/ClientManager-D6YA20jP.js.map +1 -0
- package/dist/{Item-DTJPMjFk.js → Item-B1MH0tXx.js} +126 -86
- package/dist/Item-B1MH0tXx.js.map +1 -0
- package/dist/{ModelProperty-Dto5C0om.js → ModelProperty-Dw6dHdu_.js} +37 -37
- package/dist/{ModelProperty-Dto5C0om.js.map → ModelProperty-Dw6dHdu_.js.map} +1 -1
- package/dist/{Schema-8DxGcORY.js → Schema-DppObO6h.js} +62 -212
- package/dist/Schema-DppObO6h.js.map +1 -0
- package/dist/{SchemaValidationService-CE92y1TT.js → SchemaValidationService-DXQ-D531.js} +6 -6
- package/dist/{SchemaValidationService-CE92y1TT.js.map → SchemaValidationService-DXQ-D531.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-CRqp-BqX.js → backfillMetadataPropertyIds-Uhzlwg9X.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-CRqp-BqX.js.map → backfillMetadataPropertyIds-Uhzlwg9X.js.map} +1 -1
- package/dist/configurePlatform-CVoh3JeR.js +81 -0
- package/dist/configurePlatform-CVoh3JeR.js.map +1 -0
- package/dist/{detachRowsBeforeDelete-BVetHtn2.js → detachRowsBeforeDelete-CtmIFpgV.js} +2 -2
- package/dist/{detachRowsBeforeDelete-BVetHtn2.js.map → detachRowsBeforeDelete-CtmIFpgV.js.map} +1 -1
- package/dist/{discardNewDraft-CEOouygG.js → discardNewDraft-oGYdB5vS.js} +5 -5
- package/dist/{discardNewDraft-CEOouygG.js.map → discardNewDraft-oGYdB5vS.js.map} +1 -1
- package/dist/dist/ClientManager-D6YA20jP.d.ts +933 -0
- package/dist/dist/ClientManager-D6YA20jP.d.ts.map +1 -0
- package/dist/dist/Item-B1MH0tXx.d.ts +898 -0
- package/dist/dist/Item-B1MH0tXx.d.ts.map +1 -0
- package/dist/dist/ModelProperty-Dw6dHdu_.d.ts +315 -0
- package/dist/dist/ModelProperty-Dw6dHdu_.d.ts.map +1 -0
- package/dist/dist/Schema-DppObO6h.d.ts +601 -0
- package/dist/dist/Schema-DppObO6h.d.ts.map +1 -0
- package/dist/dist/SchemaValidationService-DXQ-D531.d.ts +118 -0
- package/dist/dist/SchemaValidationService-DXQ-D531.d.ts.map +1 -0
- package/dist/dist/backfillMetadataPropertyIds-Uhzlwg9X.d.ts +7 -0
- package/dist/dist/backfillMetadataPropertyIds-Uhzlwg9X.d.ts.map +1 -0
- package/dist/dist/configurePlatform-CVoh3JeR.d.ts +30 -0
- package/dist/dist/configurePlatform-CVoh3JeR.d.ts.map +1 -0
- package/dist/dist/detachRowsBeforeDelete-CtmIFpgV.d.ts +13 -0
- package/dist/dist/detachRowsBeforeDelete-CtmIFpgV.d.ts.map +1 -0
- package/dist/dist/discardNewDraft-oGYdB5vS.d.ts +8 -0
- package/dist/dist/discardNewDraft-oGYdB5vS.d.ts.map +1 -0
- package/dist/dist/eas-CSm5wmry.d.ts +12 -0
- package/dist/dist/eas-CSm5wmry.d.ts.map +1 -0
- package/dist/dist/errors-3tc6XkCB.d.ts +487 -0
- package/dist/dist/errors-3tc6XkCB.d.ts.map +1 -0
- package/dist/dist/errors-Do7v6RKu.d.ts +22 -0
- package/dist/dist/errors-Do7v6RKu.d.ts.map +1 -0
- package/dist/dist/getItem-DM3a-7XE.d.ts +6 -0
- package/dist/dist/getItem-DM3a-7XE.d.ts.map +1 -0
- package/dist/dist/getPublishPayload-CJF0k5d8.d.ts +47 -0
- package/dist/dist/getPublishPayload-CJF0k5d8.d.ts.map +1 -0
- package/dist/dist/getPublishUploads-C7-fYIgX.d.ts +89 -0
- package/dist/dist/getPublishUploads-C7-fYIgX.d.ts.map +1 -0
- package/dist/dist/index--mmQ3LQu.d.ts +6 -0
- package/dist/dist/index--mmQ3LQu.d.ts.map +1 -0
- package/dist/dist/index-B7yAoYli.d.ts +2752 -0
- package/dist/dist/index-B7yAoYli.d.ts.map +1 -0
- package/dist/dist/index-CrvIcVFJ.d.ts +4475 -0
- package/dist/dist/index-CrvIcVFJ.d.ts.map +1 -0
- package/dist/dist/index.browser-BmVS-c2C.d.ts +8445 -0
- package/dist/dist/index.browser-BmVS-c2C.d.ts.map +1 -0
- package/dist/dist/index.node-BKpbCAWt.d.ts +11123 -0
- package/dist/dist/index.node-BKpbCAWt.d.ts.map +1 -0
- package/dist/dist/mimeTypes-C9r76DCH.d.ts +30 -0
- package/dist/dist/mimeTypes-C9r76DCH.d.ts.map +1 -0
- package/dist/dist/model-oHA3YhOd.d.ts +6 -0
- package/dist/dist/model-oHA3YhOd.d.ts.map +1 -0
- package/dist/dist/platform.browser.d.ts +3 -0
- package/dist/dist/platform.browser.d.ts.map +1 -0
- package/dist/dist/platform.node.d.ts +3 -0
- package/dist/dist/platform.node.d.ts.map +1 -0
- package/dist/dist/property-DQ-Owzki.d.ts +37 -0
- package/dist/dist/property-DQ-Owzki.d.ts.map +1 -0
- package/dist/dist/propertyValidationRules-BDhFjlwP.d.ts +8 -0
- package/dist/dist/propertyValidationRules-BDhFjlwP.d.ts.map +1 -0
- package/dist/dist/publishDraftGraph-CzPd9oe9.d.ts +76 -0
- package/dist/dist/publishDraftGraph-CzPd9oe9.d.ts.map +1 -0
- package/dist/dist/resetAmbiguousLegacyItemData-cXZm4NuG.d.ts +17 -0
- package/dist/dist/resetAmbiguousLegacyItemData-cXZm4NuG.d.ts.map +1 -0
- package/dist/dist/resolveModelForSyncedSeed-BgxtVCHI.d.ts +21 -0
- package/dist/dist/resolveModelForSyncedSeed-BgxtVCHI.d.ts.map +1 -0
- package/dist/dist/syncDbWithEas-Y5GysSCm.d.ts +22 -0
- package/dist/dist/syncDbWithEas-Y5GysSCm.d.ts.map +1 -0
- package/dist/dist/tabEvents-D9x26vf2.d.ts +81 -0
- package/dist/dist/tabEvents-D9x26vf2.d.ts.map +1 -0
- package/dist/dist/tolerantWebAccess-BFU2t-SC.d.ts +113 -0
- package/dist/dist/tolerantWebAccess-BFU2t-SC.d.ts.map +1 -0
- package/dist/dist/updateSeedRevokedAt-CCF8WWYS.d.ts +11 -0
- package/dist/dist/updateSeedRevokedAt-CCF8WWYS.d.ts.map +1 -0
- package/dist/drizzle.js +2 -0
- package/dist/drizzle.js.map +1 -0
- package/dist/{eas-D7jvWMnI.js → eas-CSm5wmry.js} +3 -3
- package/dist/{eas-D7jvWMnI.js.map → eas-CSm5wmry.js.map} +1 -1
- package/dist/{errors-CIrbsN_i.js → errors-3tc6XkCB.js} +81 -36
- package/dist/errors-3tc6XkCB.js.map +1 -0
- package/dist/errors-Do7v6RKu.js +34 -0
- package/dist/errors-Do7v6RKu.js.map +1 -0
- package/dist/{getItem-CxU_kT5W.js → getItem-DM3a-7XE.js} +4 -4
- package/dist/{getItem-CxU_kT5W.js.map → getItem-DM3a-7XE.js.map} +1 -1
- package/dist/{getPublishPayload-DTjOKd3y.js → getPublishPayload-CJF0k5d8.js} +31 -25
- package/dist/getPublishPayload-CJF0k5d8.js.map +1 -0
- package/dist/{getPublishUploads-CVTBo_OV.js → getPublishUploads-C7-fYIgX.js} +6 -6
- package/dist/{getPublishUploads-CVTBo_OV.js.map → getPublishUploads-C7-fYIgX.js.map} +1 -1
- package/dist/{index-CMxEil8T.js → index--mmQ3LQu.js} +8 -8
- package/dist/index--mmQ3LQu.js.map +1 -0
- package/dist/{index-DWK-LOUY.js → index-B7yAoYli.js} +2 -2
- package/dist/index-B7yAoYli.js.map +1 -0
- package/dist/{BasePathResolver-CBTXCMFL.js → index-CrvIcVFJ.js} +304 -285
- package/dist/index-CrvIcVFJ.js.map +1 -0
- package/dist/{index.browser-shRXMeB3.js → index.browser-BmVS-c2C.js} +34 -44
- package/dist/index.browser-BmVS-c2C.js.map +1 -0
- package/dist/{index.node-DAKJNYp5.js → index.node-BKpbCAWt.js} +43 -7
- package/dist/index.node-BKpbCAWt.js.map +1 -0
- package/dist/main.js +23 -24
- package/dist/main.js.map +1 -1
- package/dist/node.js +13 -10
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +7 -7
- package/dist/platform.node.js +4 -4
- package/dist/{property-lz9yIpyA.js → property-DQ-Owzki.js} +7 -7
- package/dist/{property-lz9yIpyA.js.map → property-DQ-Owzki.js.map} +1 -1
- package/dist/{propertyValidationRules-LuIwoQoJ.js → propertyValidationRules-BDhFjlwP.js} +10 -10
- package/dist/{propertyValidationRules-LuIwoQoJ.js.map → propertyValidationRules-BDhFjlwP.js.map} +1 -1
- package/dist/{publishDraftGraph-CgSLPKvQ.js → publishDraftGraph-CzPd9oe9.js} +41 -8
- package/dist/publishDraftGraph-CzPd9oe9.js.map +1 -0
- package/dist/{resetAmbiguousLegacyItemData-CuamkAAh.js → resetAmbiguousLegacyItemData-cXZm4NuG.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-CuamkAAh.js.map → resetAmbiguousLegacyItemData-cXZm4NuG.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-BbSctSvz.js → resolveModelForSyncedSeed-BgxtVCHI.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-BbSctSvz.js.map → resolveModelForSyncedSeed-BgxtVCHI.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/initialize.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts +10 -0
- package/dist/src/ItemProperty/service/actors/saveValueToDb/rowContext.d.ts.map +1 -0
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveHtml.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveItemStorage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts +20 -20
- package/dist/src/Model/Model.d.ts +8 -0
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +3 -3
- package/dist/src/Schema/service/actors/checkExistingSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/loadOrCreateSchema.d.ts.map +1 -1
- package/dist/src/Schema/service/actors/writeModelsToDb.d.ts.map +1 -1
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/helpers/ArweaveClient.d.ts.map +1 -1
- package/dist/src/client/actors/addModelsToDb.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts +1 -7
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/saveAppState.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/seedConfigDefaults.d.ts +10 -0
- package/dist/src/client/seedConfigDefaults.d.ts.map +1 -0
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/write/updateItemPropertyValue.d.ts +6 -0
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/drizzle/index.d.ts +7 -0
- package/dist/src/drizzle/index.d.ts.map +1 -0
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/errors.d.ts +11 -0
- package/dist/src/helpers/FileManager/errors.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts +14 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/dotSeedPath.d.ts +7 -0
- package/dist/src/helpers/dotSeedPath.d.ts.map +1 -0
- package/dist/src/helpers/entity/entityLiveQuery.d.ts.map +1 -1
- package/dist/src/helpers/environment.d.ts +5 -0
- package/dist/src/helpers/environment.d.ts.map +1 -1
- package/dist/src/helpers/getSegmentedItemProperties.d.ts.map +1 -1
- package/dist/src/helpers/metadataPropertyNames.d.ts +10 -0
- package/dist/src/helpers/metadataPropertyNames.d.ts.map +1 -1
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts +9 -0
- package/dist/src/helpers/reconcilePropertyDraftRows.d.ts.map +1 -0
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/imports/index.d.ts +1 -1
- package/dist/src/imports/index.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +18 -5
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/helpers/resolveFilesDir.d.ts +8 -0
- package/dist/src/node/helpers/resolveFilesDir.d.ts.map +1 -0
- package/dist/src/node/webpack/index.d.ts +2 -0
- package/dist/src/node/webpack/index.d.ts.map +1 -1
- package/dist/src/platform/index.browser.d.ts +5 -0
- package/dist/src/platform/index.browser.d.ts.map +1 -1
- package/dist/src/platform/index.node.d.ts +1 -0
- package/dist/src/platform/index.node.d.ts.map +1 -1
- package/dist/src/stores/eas.d.ts +1 -1
- package/dist/src/stores/eas.d.ts.map +1 -1
- package/dist/src/types/import.d.ts +15 -0
- package/dist/src/types/import.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +8 -4
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-CrAY9Rl2.js → syncDbWithEas-Y5GysSCm.js} +17 -13
- package/dist/syncDbWithEas-Y5GysSCm.js.map +1 -0
- package/dist/{tabEvents-BGBYV65P.js → tabEvents-D9x26vf2.js} +4 -4
- package/dist/{tabEvents-BGBYV65P.js.map → tabEvents-D9x26vf2.js.map} +1 -1
- package/dist/{tolerantWebAccess-DVHCEulL.js → tolerantWebAccess-BFU2t-SC.js} +8 -8
- package/dist/{tolerantWebAccess-DVHCEulL.js.map → tolerantWebAccess-BFU2t-SC.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-Dy5J8CfQ.js → updateSeedRevokedAt-CCF8WWYS.js} +3 -3
- package/dist/{updateSeedRevokedAt-Dy5J8CfQ.js.map → updateSeedRevokedAt-CCF8WWYS.js.map} +1 -1
- package/package.json +31 -31
- package/dist/BasePathResolver-CBTXCMFL.js.map +0 -1
- package/dist/ClientManager-DRf4uuei.js.map +0 -1
- package/dist/Item-DTJPMjFk.js.map +0 -1
- package/dist/Schema-8DxGcORY.js.map +0 -1
- package/dist/configurePlatform-D4aGjKNk.js +0 -31
- package/dist/configurePlatform-D4aGjKNk.js.map +0 -1
- package/dist/errors-CIrbsN_i.js.map +0 -1
- package/dist/errors-CrBxGWah.js +0 -17
- package/dist/errors-CrBxGWah.js.map +0 -1
- package/dist/getPublishPayload-DTjOKd3y.js.map +0 -1
- package/dist/index-CMxEil8T.js.map +0 -1
- package/dist/index-DWK-LOUY.js.map +0 -1
- package/dist/index.browser-shRXMeB3.js.map +0 -1
- package/dist/index.node-DAKJNYp5.js.map +0 -1
- package/dist/publishDraftGraph-CgSLPKvQ.js.map +0 -1
- package/dist/src/client/nodeEndpointDefaults.d.ts +0 -8
- package/dist/src/client/nodeEndpointDefaults.d.ts.map +0 -1
- package/dist/syncDbWithEas-CrAY9Rl2.js.map +0 -1
|
@@ -467,6 +467,145 @@ const Property = {
|
|
|
467
467
|
/** `Html` opts are not representable in `TPropertyConstructor`; keep runtime shape via double assert. */
|
|
468
468
|
};
|
|
469
469
|
|
|
470
|
+
// Top-level re-export (not mid-file import + export): Rollup with
|
|
471
|
+
// external `@seedprotocol/arweave` otherwise emits a side-effect-only import
|
|
472
|
+
// and an unbound Object.freeze namespace when this module is dynamically imported.
|
|
473
|
+
// Define zero constants ourselves since they're not exported from eas-sdk in newer versions
|
|
474
|
+
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
475
|
+
const ZERO_BYTES = '0x';
|
|
476
|
+
const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
477
|
+
// Primary config file name for Seed Protocol SDK
|
|
478
|
+
const SEED_CONFIG_FILE = 'seed.config.ts';
|
|
479
|
+
// Fallback config file names (in order of preference)
|
|
480
|
+
const SEED_CONFIG_FALLBACKS = ['seed.schema.ts', 'schema.ts'];
|
|
481
|
+
// Legacy constant for backward compatibility
|
|
482
|
+
const SCHEMA_TS = SEED_CONFIG_FILE;
|
|
483
|
+
const INTERNAL_DATA_TYPES = {
|
|
484
|
+
Text: {
|
|
485
|
+
eas: 'string',
|
|
486
|
+
},
|
|
487
|
+
// ADR 0010: decimal strings, so negatives, fractions and values above 255 publish.
|
|
488
|
+
Number: {
|
|
489
|
+
eas: 'string',
|
|
490
|
+
},
|
|
491
|
+
Image: {
|
|
492
|
+
eas: 'bytes32',
|
|
493
|
+
},
|
|
494
|
+
Relation: {
|
|
495
|
+
eas: 'bytes32',
|
|
496
|
+
},
|
|
497
|
+
List: {
|
|
498
|
+
eas: 'bytes32[]',
|
|
499
|
+
},
|
|
500
|
+
File: {
|
|
501
|
+
eas: 'bytes32',
|
|
502
|
+
},
|
|
503
|
+
Json: {
|
|
504
|
+
eas: 'bytes32',
|
|
505
|
+
},
|
|
506
|
+
Blob: {
|
|
507
|
+
eas: 'bytes32',
|
|
508
|
+
},
|
|
509
|
+
Boolean: {
|
|
510
|
+
eas: 'bool',
|
|
511
|
+
},
|
|
512
|
+
Date: {
|
|
513
|
+
eas: 'uint256',
|
|
514
|
+
},
|
|
515
|
+
Html: {
|
|
516
|
+
eas: 'bytes32',
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
/** Full property names ending in `Id` that must not be stripped to a “base” name for `allProperties` keys. */
|
|
520
|
+
const PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP = new Set(['storageTransactionId']);
|
|
521
|
+
const INTERNAL_PROPERTY_NAMES = [
|
|
522
|
+
'localId',
|
|
523
|
+
'uid',
|
|
524
|
+
'seedLocalId',
|
|
525
|
+
'seedUid',
|
|
526
|
+
'schemaUid',
|
|
527
|
+
'attestationCreatedAt',
|
|
528
|
+
'attestationRaw',
|
|
529
|
+
'createdAt',
|
|
530
|
+
'updatedAt',
|
|
531
|
+
'lastVersionPublishedAt',
|
|
532
|
+
'latestVersionLocalId',
|
|
533
|
+
'latestVersionUid',
|
|
534
|
+
'lastLocalUpdateAt',
|
|
535
|
+
'modelName',
|
|
536
|
+
'refSeedType',
|
|
537
|
+
'refValueType',
|
|
538
|
+
'refResolvedValue',
|
|
539
|
+
'refResolvedDisplayValue',
|
|
540
|
+
'type',
|
|
541
|
+
// Image
|
|
542
|
+
'src',
|
|
543
|
+
'alt',
|
|
544
|
+
//
|
|
545
|
+
'versionLocalId',
|
|
546
|
+
'versionsCount',
|
|
547
|
+
'versionUid',
|
|
548
|
+
'_markedForDeletion',
|
|
549
|
+
// SDK-internal: wallet address of attester; never publish as property attestation
|
|
550
|
+
'publisher',
|
|
551
|
+
// SDK-internal: Unix timestamp when attestations were revoked; never a schema field
|
|
552
|
+
'revokedAt',
|
|
553
|
+
];
|
|
554
|
+
/** Schema definition of the Version attestation (zero resolver, revocable). */
|
|
555
|
+
const VERSION_SCHEMA_DEF = 'bytes32 version';
|
|
556
|
+
/**
|
|
557
|
+
* UID of {@link VERSION_SCHEMA_DEF}. Schema UIDs hash the definition, resolver and revocable flag,
|
|
558
|
+
* so this is the same on every chain; the schema must still be registered on each one.
|
|
559
|
+
*/
|
|
560
|
+
const VERSION_SCHEMA_UID = '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6';
|
|
561
|
+
/** @deprecated The UID is chain-independent. Use {@link VERSION_SCHEMA_UID}. */
|
|
562
|
+
const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA = VERSION_SCHEMA_UID;
|
|
563
|
+
const defaultAttestationData = {
|
|
564
|
+
recipient: ZERO_ADDRESS,
|
|
565
|
+
revocable: true,
|
|
566
|
+
value: BigInt(0),
|
|
567
|
+
refUID: ZERO_BYTES32,
|
|
568
|
+
expirationTime: BigInt(0),
|
|
569
|
+
data: ZERO_BYTES,
|
|
570
|
+
};
|
|
571
|
+
var ImageSize;
|
|
572
|
+
(function (ImageSize) {
|
|
573
|
+
ImageSize[ImageSize["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
|
|
574
|
+
ImageSize[ImageSize["SMALL"] = 760] = "SMALL";
|
|
575
|
+
ImageSize[ImageSize["MEDIUM"] = 1024] = "MEDIUM";
|
|
576
|
+
ImageSize[ImageSize["LARGE"] = 1440] = "LARGE";
|
|
577
|
+
ImageSize[ImageSize["EXTRA_LARGE"] = 1920] = "EXTRA_LARGE";
|
|
578
|
+
})(ImageSize || (ImageSize = {}));
|
|
579
|
+
const CLIENT_NOT_INITIALIZED = 'ClientManager is not initialized. Please call init() first.';
|
|
580
|
+
const INIT_SCRIPT_SUCCESS_MESSAGE = '[Seed Protocol] Finished running init script';
|
|
581
|
+
var SeedModels;
|
|
582
|
+
(function (SeedModels) {
|
|
583
|
+
SeedModels["Seed"] = "Seed";
|
|
584
|
+
SeedModels["Metadata"] = "Metadata";
|
|
585
|
+
SeedModels["Version"] = "Version";
|
|
586
|
+
})(SeedModels || (SeedModels = {}));
|
|
587
|
+
// Internal SDK schema that should not be created in app's files directory
|
|
588
|
+
const SEED_PROTOCOL_SCHEMA_NAME = 'Seed Protocol';
|
|
589
|
+
const INTERNAL_SCHEMA_IDS = ['SEEDPROTOCOL'];
|
|
590
|
+
/** Fired after `syncDbWithEas` persists EAS seeds/versions/metadata to SQLite (see `Item.rehydrateCachedItemsFromDbAfterEasSync`). */
|
|
591
|
+
const EAS_SEED_DATA_SYNCED_TO_DB_EVENT = 'easSeedDataSyncedToDb';
|
|
592
|
+
/**
|
|
593
|
+
* Check if a schema is an internal SDK schema that should not be created in app files
|
|
594
|
+
*/
|
|
595
|
+
function isInternalSchema(schemaName, schemaId) {
|
|
596
|
+
return schemaName === SEED_PROTOCOL_SCHEMA_NAME ||
|
|
597
|
+
(schemaId !== undefined && INTERNAL_SCHEMA_IDS.includes(schemaId));
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Model ids (schemaFileId) of the internal Seed Protocol storage models. Storage seeds are always
|
|
601
|
+
* these models, even if a user schema also defines a model named Image/File/Html.
|
|
602
|
+
*/
|
|
603
|
+
const INTERNAL_STORAGE_MODEL_FILE_IDS = {
|
|
604
|
+
image: 'SEEDPROTOCOL_IMAGE',
|
|
605
|
+
file: 'SEEDPROTOCOL_FILE',
|
|
606
|
+
html: 'SEEDPROTOCOL_HTML',
|
|
607
|
+
};
|
|
608
|
+
|
|
470
609
|
/** Ref model name when propDef is a List of Relation, else undefined. */
|
|
471
610
|
function listRelationRef(propDef) {
|
|
472
611
|
if (!propDef)
|
|
@@ -631,6 +770,21 @@ function easPropertyNameForPublish(propertyName, propertyDef) {
|
|
|
631
770
|
}
|
|
632
771
|
return easName(propertyName);
|
|
633
772
|
}
|
|
773
|
+
/**
|
|
774
|
+
* The EAS schema definition publish attests a property under (`string title`, `bytes32 author`),
|
|
775
|
+
* or undefined when its data type has no EAS type. Look schemas up by this, not by name: a name
|
|
776
|
+
* can have schemas of several types (Optimism Sepolia has `bytes32 storage_transaction_id` beside
|
|
777
|
+
* `string storage_transaction_id`).
|
|
778
|
+
*/
|
|
779
|
+
function easSchemaDefinitionForProperty(propertyName, propertyDef) {
|
|
780
|
+
if (!propertyDef?.dataType)
|
|
781
|
+
return undefined;
|
|
782
|
+
const dataType = normalizeDataType(String(propertyDef.dataType));
|
|
783
|
+
const easType = INTERNAL_DATA_TYPES[dataType]?.eas;
|
|
784
|
+
if (!easType)
|
|
785
|
+
return undefined;
|
|
786
|
+
return `${easType} ${easPropertyNameForPublish(propertyName, propertyDef)}`;
|
|
787
|
+
}
|
|
634
788
|
|
|
635
789
|
/** Same rules as getCorrectId in helpers/index (avoid barrel circular import). */
|
|
636
790
|
function parseLocalIdOrUid(localIdOrUid) {
|
|
@@ -2099,6 +2253,9 @@ const findOrCreateModelRecord = async (db, modelName, modelFileId, schemaId) =>
|
|
|
2099
2253
|
}
|
|
2100
2254
|
}
|
|
2101
2255
|
try {
|
|
2256
|
+
// A Model instance's own write can insert this file id between the lookups above and here
|
|
2257
|
+
// (schema import writes each model twice at once). DO NOTHING instead of a failed statement,
|
|
2258
|
+
// which sqlite-wasm logs as a warning even though the error is caught.
|
|
2102
2259
|
const inserted = await db
|
|
2103
2260
|
.insert(models)
|
|
2104
2261
|
.values({
|
|
@@ -2106,8 +2263,22 @@ const findOrCreateModelRecord = async (db, modelName, modelFileId, schemaId) =>
|
|
|
2106
2263
|
schemaFileId: modelFileId || null,
|
|
2107
2264
|
isEdited: false,
|
|
2108
2265
|
})
|
|
2266
|
+
.onConflictDoNothing()
|
|
2109
2267
|
.returning();
|
|
2110
|
-
|
|
2268
|
+
if (inserted.length > 0) {
|
|
2269
|
+
return inserted[0];
|
|
2270
|
+
}
|
|
2271
|
+
if (modelFileId) {
|
|
2272
|
+
const existing = await db
|
|
2273
|
+
.select()
|
|
2274
|
+
.from(models)
|
|
2275
|
+
.where(eq(models.schemaFileId, modelFileId))
|
|
2276
|
+
.limit(1);
|
|
2277
|
+
if (existing.length > 0) {
|
|
2278
|
+
return existing[0];
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
throw new Error(`Model "${modelName}" was not inserted and no row has schemaFileId "${modelFileId}"`);
|
|
2111
2282
|
}
|
|
2112
2283
|
catch (error) {
|
|
2113
2284
|
if (isSqliteUniqueConstraintError(error) && modelFileId) {
|
|
@@ -2947,17 +3118,15 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
2947
3118
|
}
|
|
2948
3119
|
}
|
|
2949
3120
|
logger$3(`Creating new property ${modelName}:${propertyName} with schemaFileId: ${propertyData.schemaFileId}`);
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
throw insertError;
|
|
2960
|
-
}
|
|
3121
|
+
// A conflict means the row already exists: the schema import's Model instances write their
|
|
3122
|
+
// properties at the same time as this. DO NOTHING keeps sqlite-wasm from logging a failed insert.
|
|
3123
|
+
const inserted = await db
|
|
3124
|
+
.insert(properties)
|
|
3125
|
+
.values(propertyDataWithIsEdited)
|
|
3126
|
+
.onConflictDoNothing()
|
|
3127
|
+
.returning({ id: properties.id });
|
|
3128
|
+
if (inserted.length === 0) {
|
|
3129
|
+
logger$3(`Property ${modelName}:${propertyName} already exists (UNIQUE constraint), treating as success`);
|
|
2961
3130
|
}
|
|
2962
3131
|
}
|
|
2963
3132
|
}
|
|
@@ -3091,6 +3260,54 @@ const loadModelsFromDbForSchema = async (schemaId) => {
|
|
|
3091
3260
|
return {};
|
|
3092
3261
|
}
|
|
3093
3262
|
};
|
|
3263
|
+
/**
|
|
3264
|
+
* Merges the models {@link loadModelsFromDbForSchema} read from the database into a schema's
|
|
3265
|
+
* models. The database decides which models and properties exist and their stored fields; the
|
|
3266
|
+
* schema keeps what only it holds (nameMatch, description, validation, ...), found by id first so
|
|
3267
|
+
* a property renamed in the database keeps them. A schema property whose id a database property
|
|
3268
|
+
* has is dropped under its old name.
|
|
3269
|
+
*/
|
|
3270
|
+
const mergeDbModelsIntoSchemaModels = (schemaModels, dbModels) => {
|
|
3271
|
+
const merged = { ...(schemaModels ?? {}) };
|
|
3272
|
+
for (const [modelName, dbModel] of Object.entries(dbModels)) {
|
|
3273
|
+
const schemaModel = schemaModels?.[modelName];
|
|
3274
|
+
if (!schemaModel) {
|
|
3275
|
+
merged[modelName] = dbModel;
|
|
3276
|
+
continue;
|
|
3277
|
+
}
|
|
3278
|
+
const schemaProps = schemaModel.properties ?? {};
|
|
3279
|
+
const dbProps = dbModel.properties ?? {};
|
|
3280
|
+
const schemaNameById = new Map();
|
|
3281
|
+
for (const [name, prop] of Object.entries(schemaProps)) {
|
|
3282
|
+
const id = prop?.id ?? prop?.schemaFileId;
|
|
3283
|
+
if (id)
|
|
3284
|
+
schemaNameById.set(id, name);
|
|
3285
|
+
}
|
|
3286
|
+
const properties = {};
|
|
3287
|
+
const matched = new Set();
|
|
3288
|
+
for (const [name, dbProp] of Object.entries(dbProps)) {
|
|
3289
|
+
const byId = dbProp?.schemaFileId ? schemaNameById.get(dbProp.schemaFileId) : undefined;
|
|
3290
|
+
const byName = schemaProps[name];
|
|
3291
|
+
const byNameId = byName?.id ?? byName?.schemaFileId;
|
|
3292
|
+
// By name only when the ids don't say it's another property.
|
|
3293
|
+
const schemaName = byId ?? (byName && !(byNameId && dbProp?.schemaFileId && byNameId !== dbProp.schemaFileId) ? name : undefined);
|
|
3294
|
+
const schemaProp = schemaName ? schemaProps[schemaName] : undefined;
|
|
3295
|
+
if (schemaName && schemaProp)
|
|
3296
|
+
matched.add(schemaName);
|
|
3297
|
+
// The database's dataType and ref replace the file's type and model.
|
|
3298
|
+
const { type, model, ...fromSchema } = schemaProp ?? {};
|
|
3299
|
+
properties[name] = {
|
|
3300
|
+
...fromSchema,
|
|
3301
|
+
...(dbProp?.dataType === undefined && type !== undefined ? { type } : {}),
|
|
3302
|
+
...(dbProp?.ref === undefined && model !== undefined ? { model } : {}),
|
|
3303
|
+
...dbProp,
|
|
3304
|
+
};
|
|
3305
|
+
}
|
|
3306
|
+
const unmatched = Object.fromEntries(Object.entries(schemaProps).filter(([name]) => !matched.has(name)));
|
|
3307
|
+
merged[modelName] = { ...schemaModel, ...dbModel, properties: { ...unmatched, ...properties } };
|
|
3308
|
+
}
|
|
3309
|
+
return merged;
|
|
3310
|
+
};
|
|
3094
3311
|
/**
|
|
3095
3312
|
* Returns model name by database model ID.
|
|
3096
3313
|
*/
|
|
@@ -3285,21 +3502,20 @@ const savePropertyToDb = async (property) => {
|
|
|
3285
3502
|
else {
|
|
3286
3503
|
// Property doesn't exist, create it
|
|
3287
3504
|
// Set isEdited = true for runtime-created properties
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3505
|
+
// A conflict means the row already exists (concurrent addModelsToDb or another write): treat as success
|
|
3506
|
+
const inserted = await db
|
|
3507
|
+
.insert(properties)
|
|
3508
|
+
.values({
|
|
3509
|
+
...propertyData,
|
|
3510
|
+
isEdited: true, // Runtime-created properties are edited
|
|
3511
|
+
})
|
|
3512
|
+
.onConflictDoNothing()
|
|
3513
|
+
.returning({ id: properties.id });
|
|
3514
|
+
if (inserted.length > 0) {
|
|
3293
3515
|
logger$3(`Created property ${property.modelName}:${property.name} in database`);
|
|
3294
3516
|
}
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
if (isSqliteUniqueConstraintError(insertError)) {
|
|
3298
|
-
logger$3(`Property ${property.modelName}:${property.name} already exists (UNIQUE constraint), treating as success`);
|
|
3299
|
-
}
|
|
3300
|
-
else {
|
|
3301
|
-
throw insertError;
|
|
3302
|
-
}
|
|
3517
|
+
else {
|
|
3518
|
+
logger$3(`Property ${property.modelName}:${property.name} already exists (UNIQUE constraint), treating as success`);
|
|
3303
3519
|
}
|
|
3304
3520
|
}
|
|
3305
3521
|
};
|
|
@@ -3415,34 +3631,31 @@ async function writeModelToDb(modelFileId, data) {
|
|
|
3415
3631
|
logger$3(`Model with schemaFileId "${modelFileId}" was created by another process, using existing record (id: ${modelId})`);
|
|
3416
3632
|
}
|
|
3417
3633
|
else {
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3634
|
+
// DO NOTHING on conflict: addModelsToDb writes the same row during schema import, and a failed
|
|
3635
|
+
// insert is logged by sqlite-wasm even when caught.
|
|
3636
|
+
const newModel = await db
|
|
3637
|
+
.insert(models)
|
|
3638
|
+
.values({
|
|
3639
|
+
name: data.modelName,
|
|
3640
|
+
schemaFileId: modelFileId,
|
|
3641
|
+
isEdited: true, // Runtime-created models are edited
|
|
3642
|
+
})
|
|
3643
|
+
.onConflictDoNothing()
|
|
3644
|
+
.returning();
|
|
3645
|
+
if (newModel.length > 0) {
|
|
3424
3646
|
modelId = newModel[0].id;
|
|
3425
3647
|
}
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
.limit(1);
|
|
3435
|
-
if (existing.length > 0) {
|
|
3436
|
-
modelId = existing[0].id;
|
|
3437
|
-
logger$3(`Found existing model with schemaFileId "${modelFileId}" (id: ${modelId}) after constraint violation`);
|
|
3438
|
-
}
|
|
3439
|
-
else {
|
|
3440
|
-
throw error;
|
|
3441
|
-
}
|
|
3442
|
-
}
|
|
3443
|
-
else {
|
|
3444
|
-
throw error;
|
|
3648
|
+
else {
|
|
3649
|
+
const existing = await db
|
|
3650
|
+
.select()
|
|
3651
|
+
.from(models)
|
|
3652
|
+
.where(eq(models.schemaFileId, modelFileId))
|
|
3653
|
+
.limit(1);
|
|
3654
|
+
if (existing.length === 0) {
|
|
3655
|
+
throw new Error(`Failed to create or find model "${data.modelName}" with schemaFileId "${modelFileId}"`);
|
|
3445
3656
|
}
|
|
3657
|
+
modelId = existing[0].id;
|
|
3658
|
+
logger$3(`Found existing model with schemaFileId "${modelFileId}" (id: ${modelId}) after insert conflict`);
|
|
3446
3659
|
}
|
|
3447
3660
|
}
|
|
3448
3661
|
}
|
|
@@ -3659,33 +3872,30 @@ async function writePropertyToDb(propertyFileId, data, isEdited = false) {
|
|
|
3659
3872
|
logger$3(`Property with schemaFileId "${propertyFileId}" was created by another process, updated existing record`);
|
|
3660
3873
|
}
|
|
3661
3874
|
else {
|
|
3662
|
-
|
|
3663
|
-
|
|
3875
|
+
// DO NOTHING on conflict: addModelsToDb writes the same row during schema import, and a failed
|
|
3876
|
+
// insert is logged by sqlite-wasm even when caught.
|
|
3877
|
+
const inserted = await db
|
|
3878
|
+
.insert(properties)
|
|
3879
|
+
.values({ required: false, ...propertyData })
|
|
3880
|
+
.onConflictDoNothing()
|
|
3881
|
+
.returning({ id: properties.id });
|
|
3882
|
+
if (inserted.length > 0) {
|
|
3664
3883
|
logger$3(`Created property ${data.name} (${propertyFileId}) in database`);
|
|
3665
3884
|
}
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
.limit(1);
|
|
3675
|
-
if (existing.length > 0) {
|
|
3676
|
-
await db
|
|
3677
|
-
.update(properties)
|
|
3678
|
-
.set(propertyData)
|
|
3679
|
-
.where(eq(properties.id, existing[0].id));
|
|
3680
|
-
logger$3(`Found existing property with schemaFileId "${propertyFileId}" (id: ${existing[0].id}) after constraint violation, updated it`);
|
|
3681
|
-
}
|
|
3682
|
-
else {
|
|
3683
|
-
throw new Error(`Failed to create or find property "${data.name}" with schemaFileId "${propertyFileId}": ${error.message}`);
|
|
3684
|
-
}
|
|
3685
|
-
}
|
|
3686
|
-
else {
|
|
3687
|
-
throw error;
|
|
3885
|
+
else {
|
|
3886
|
+
const existing = await db
|
|
3887
|
+
.select()
|
|
3888
|
+
.from(properties)
|
|
3889
|
+
.where(eq(properties.schemaFileId, propertyFileId))
|
|
3890
|
+
.limit(1);
|
|
3891
|
+
if (existing.length === 0) {
|
|
3892
|
+
throw new Error(`Failed to create or find property "${data.name}" with schemaFileId "${propertyFileId}"`);
|
|
3688
3893
|
}
|
|
3894
|
+
await db
|
|
3895
|
+
.update(properties)
|
|
3896
|
+
.set(propertyData)
|
|
3897
|
+
.where(eq(properties.id, existing[0].id));
|
|
3898
|
+
logger$3(`Found existing property with schemaFileId "${propertyFileId}" (id: ${existing[0].id}) after insert conflict, updated it`);
|
|
3689
3899
|
}
|
|
3690
3900
|
}
|
|
3691
3901
|
}
|
|
@@ -3864,6 +4074,7 @@ var db = /*#__PURE__*/Object.freeze({
|
|
|
3864
4074
|
getSqlResultObject: getSqlResultObject,
|
|
3865
4075
|
getWatchedAddressesFromDb: getWatchedAddressesFromDb,
|
|
3866
4076
|
loadModelsFromDbForSchema: loadModelsFromDbForSchema,
|
|
4077
|
+
mergeDbModelsIntoSchemaModels: mergeDbModelsIntoSchemaModels,
|
|
3867
4078
|
migrateMetadataForPropertyRename: migrateMetadataForPropertyRename,
|
|
3868
4079
|
moveMetadataToRenamedProperty: moveMetadataToRenamedProperty,
|
|
3869
4080
|
propertyStorageColumns: propertyStorageColumns,
|
|
@@ -3950,6 +4161,11 @@ const isElectronRenderer = () => {
|
|
|
3950
4161
|
const supportsOpfsFileDownloads = () => {
|
|
3951
4162
|
return isBrowser() || isElectronRenderer();
|
|
3952
4163
|
};
|
|
4164
|
+
/**
|
|
4165
|
+
* NODE_ENV is 'test' or IS_SEED_DEV is set. Bundlers compile `process.env.NODE_ENV` in, but
|
|
4166
|
+
* not IS_SEED_DEV, so that is only read where a `process` global exists: browsers have none.
|
|
4167
|
+
*/
|
|
4168
|
+
const isTestOrSeedDev = () => process.env.NODE_ENV === 'test' || (typeof process !== 'undefined' && !!process.env?.IS_SEED_DEV);
|
|
3953
4169
|
|
|
3954
4170
|
/**
|
|
3955
4171
|
* Tag every Seed upload carries with the hex digest of its data. Producers: the SDK's
|
|
@@ -4085,8 +4301,8 @@ const syncDbFiles = async (endpoints) => {
|
|
|
4085
4301
|
const getAppDbReady = async () => {
|
|
4086
4302
|
if (!BaseDb.isAppDbReady()) {
|
|
4087
4303
|
// Wait for ClientManager to be ready (DB_INIT state or later)
|
|
4088
|
-
const _mod_0 = await import('./ClientManager-
|
|
4089
|
-
const _ns_0 = _mod_0.
|
|
4304
|
+
const _mod_0 = await import('./ClientManager-D6YA20jP.js');
|
|
4305
|
+
const _ns_0 = _mod_0.O;
|
|
4090
4306
|
const clientManagerMod = _ns_0;
|
|
4091
4307
|
const { getClient } = clientManagerMod;
|
|
4092
4308
|
const clientManager = getClient();
|
|
@@ -4135,15 +4351,11 @@ const normalizeArweaveTxId = (raw) => {
|
|
|
4135
4351
|
const m = t.match(/^([a-z0-9_-]{43})(?:\.[^/]+)?$/i);
|
|
4136
4352
|
if (m)
|
|
4137
4353
|
return m[1];
|
|
4138
|
-
// Values may be full gateway URLs or paths; scan for
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
return candidate;
|
|
4144
|
-
}
|
|
4145
|
-
}
|
|
4146
|
-
return undefined;
|
|
4354
|
+
// Values may be full gateway URLs or paths; scan for an embedded tx id. It must be 43 characters
|
|
4355
|
+
// on its own, not the start of a longer run: the first 43 of a bytes32 value (`0x0000…0020`,
|
|
4356
|
+
// an EAS UID) are in the alphabet too.
|
|
4357
|
+
const embedded = t.match(/(?<![a-z0-9_-])[a-z0-9_-]{43}(?![a-z0-9_-])/gi);
|
|
4358
|
+
return embedded?.[0];
|
|
4147
4359
|
};
|
|
4148
4360
|
const mergeAddressLists = (a, b) => {
|
|
4149
4361
|
const seen = new Set();
|
|
@@ -4427,7 +4639,11 @@ const downloadTransactionIdWithDedupe = async (transactionId) => {
|
|
|
4427
4639
|
if (!supportsOpfsFileDownloads() || !transactionId || transactionId.trim().length === 0) {
|
|
4428
4640
|
return false;
|
|
4429
4641
|
}
|
|
4430
|
-
const normalizedTxId = normalizeArweaveTxId(transactionId)
|
|
4642
|
+
const normalizedTxId = normalizeArweaveTxId(transactionId);
|
|
4643
|
+
if (!normalizedTxId) {
|
|
4644
|
+
logger$2(`[download] not an Arweave transaction id: ${transactionId}`);
|
|
4645
|
+
return false;
|
|
4646
|
+
}
|
|
4431
4647
|
const existing = lazyDownloadInFlightByTransactionId.get(normalizedTxId);
|
|
4432
4648
|
if (existing) {
|
|
4433
4649
|
return existing;
|
|
@@ -4464,145 +4680,6 @@ var download = /*#__PURE__*/Object.freeze({
|
|
|
4464
4680
|
scheduleBulkFilesDownloadFromEasSync: scheduleBulkFilesDownloadFromEasSync
|
|
4465
4681
|
});
|
|
4466
4682
|
|
|
4467
|
-
// Top-level re-export (not mid-file import + export): Rollup with
|
|
4468
|
-
// external `@seedprotocol/arweave` otherwise emits a side-effect-only import
|
|
4469
|
-
// and an unbound Object.freeze namespace when this module is dynamically imported.
|
|
4470
|
-
// Define zero constants ourselves since they're not exported from eas-sdk in newer versions
|
|
4471
|
-
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
4472
|
-
const ZERO_BYTES = '0x';
|
|
4473
|
-
const ZERO_BYTES32 = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
4474
|
-
// Primary config file name for Seed Protocol SDK
|
|
4475
|
-
const SEED_CONFIG_FILE = 'seed.config.ts';
|
|
4476
|
-
// Fallback config file names (in order of preference)
|
|
4477
|
-
const SEED_CONFIG_FALLBACKS = ['seed.schema.ts', 'schema.ts'];
|
|
4478
|
-
// Legacy constant for backward compatibility
|
|
4479
|
-
const SCHEMA_TS = SEED_CONFIG_FILE;
|
|
4480
|
-
const INTERNAL_DATA_TYPES = {
|
|
4481
|
-
Text: {
|
|
4482
|
-
eas: 'string',
|
|
4483
|
-
},
|
|
4484
|
-
// ADR 0010: decimal strings, so negatives, fractions and values above 255 publish.
|
|
4485
|
-
Number: {
|
|
4486
|
-
eas: 'string',
|
|
4487
|
-
},
|
|
4488
|
-
Image: {
|
|
4489
|
-
eas: 'bytes32',
|
|
4490
|
-
},
|
|
4491
|
-
Relation: {
|
|
4492
|
-
eas: 'bytes32',
|
|
4493
|
-
},
|
|
4494
|
-
List: {
|
|
4495
|
-
eas: 'bytes32[]',
|
|
4496
|
-
},
|
|
4497
|
-
File: {
|
|
4498
|
-
eas: 'bytes32',
|
|
4499
|
-
},
|
|
4500
|
-
Json: {
|
|
4501
|
-
eas: 'bytes32',
|
|
4502
|
-
},
|
|
4503
|
-
Blob: {
|
|
4504
|
-
eas: 'bytes32',
|
|
4505
|
-
},
|
|
4506
|
-
Boolean: {
|
|
4507
|
-
eas: 'bool',
|
|
4508
|
-
},
|
|
4509
|
-
Date: {
|
|
4510
|
-
eas: 'uint256',
|
|
4511
|
-
},
|
|
4512
|
-
Html: {
|
|
4513
|
-
eas: 'bytes32',
|
|
4514
|
-
},
|
|
4515
|
-
};
|
|
4516
|
-
/** Full property names ending in `Id` that must not be stripped to a “base” name for `allProperties` keys. */
|
|
4517
|
-
const PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP = new Set(['storageTransactionId']);
|
|
4518
|
-
const INTERNAL_PROPERTY_NAMES = [
|
|
4519
|
-
'localId',
|
|
4520
|
-
'uid',
|
|
4521
|
-
'seedLocalId',
|
|
4522
|
-
'seedUid',
|
|
4523
|
-
'schemaUid',
|
|
4524
|
-
'attestationCreatedAt',
|
|
4525
|
-
'attestationRaw',
|
|
4526
|
-
'createdAt',
|
|
4527
|
-
'updatedAt',
|
|
4528
|
-
'lastVersionPublishedAt',
|
|
4529
|
-
'latestVersionLocalId',
|
|
4530
|
-
'latestVersionUid',
|
|
4531
|
-
'lastLocalUpdateAt',
|
|
4532
|
-
'modelName',
|
|
4533
|
-
'refSeedType',
|
|
4534
|
-
'refValueType',
|
|
4535
|
-
'refResolvedValue',
|
|
4536
|
-
'refResolvedDisplayValue',
|
|
4537
|
-
'type',
|
|
4538
|
-
// Image
|
|
4539
|
-
'src',
|
|
4540
|
-
'alt',
|
|
4541
|
-
//
|
|
4542
|
-
'versionLocalId',
|
|
4543
|
-
'versionsCount',
|
|
4544
|
-
'versionUid',
|
|
4545
|
-
'_markedForDeletion',
|
|
4546
|
-
// SDK-internal: wallet address of attester; never publish as property attestation
|
|
4547
|
-
'publisher',
|
|
4548
|
-
// SDK-internal: Unix timestamp when attestations were revoked; never a schema field
|
|
4549
|
-
'revokedAt',
|
|
4550
|
-
];
|
|
4551
|
-
/** Schema definition of the Version attestation (zero resolver, revocable). */
|
|
4552
|
-
const VERSION_SCHEMA_DEF = 'bytes32 version';
|
|
4553
|
-
/**
|
|
4554
|
-
* UID of {@link VERSION_SCHEMA_DEF}. Schema UIDs hash the definition, resolver and revocable flag,
|
|
4555
|
-
* so this is the same on every chain; the schema must still be registered on each one.
|
|
4556
|
-
*/
|
|
4557
|
-
const VERSION_SCHEMA_UID = '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6';
|
|
4558
|
-
/** @deprecated The UID is chain-independent. Use {@link VERSION_SCHEMA_UID}. */
|
|
4559
|
-
const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA = VERSION_SCHEMA_UID;
|
|
4560
|
-
const defaultAttestationData = {
|
|
4561
|
-
recipient: ZERO_ADDRESS,
|
|
4562
|
-
revocable: true,
|
|
4563
|
-
value: BigInt(0),
|
|
4564
|
-
refUID: ZERO_BYTES32,
|
|
4565
|
-
expirationTime: BigInt(0),
|
|
4566
|
-
data: ZERO_BYTES,
|
|
4567
|
-
};
|
|
4568
|
-
var ImageSize;
|
|
4569
|
-
(function (ImageSize) {
|
|
4570
|
-
ImageSize[ImageSize["EXTRA_SMALL"] = 480] = "EXTRA_SMALL";
|
|
4571
|
-
ImageSize[ImageSize["SMALL"] = 760] = "SMALL";
|
|
4572
|
-
ImageSize[ImageSize["MEDIUM"] = 1024] = "MEDIUM";
|
|
4573
|
-
ImageSize[ImageSize["LARGE"] = 1440] = "LARGE";
|
|
4574
|
-
ImageSize[ImageSize["EXTRA_LARGE"] = 1920] = "EXTRA_LARGE";
|
|
4575
|
-
})(ImageSize || (ImageSize = {}));
|
|
4576
|
-
const CLIENT_NOT_INITIALIZED = 'ClientManager is not initialized. Please call init() first.';
|
|
4577
|
-
const INIT_SCRIPT_SUCCESS_MESSAGE = '[Seed Protocol] Finished running init script';
|
|
4578
|
-
var SeedModels;
|
|
4579
|
-
(function (SeedModels) {
|
|
4580
|
-
SeedModels["Seed"] = "Seed";
|
|
4581
|
-
SeedModels["Metadata"] = "Metadata";
|
|
4582
|
-
SeedModels["Version"] = "Version";
|
|
4583
|
-
})(SeedModels || (SeedModels = {}));
|
|
4584
|
-
// Internal SDK schema that should not be created in app's files directory
|
|
4585
|
-
const SEED_PROTOCOL_SCHEMA_NAME = 'Seed Protocol';
|
|
4586
|
-
const INTERNAL_SCHEMA_IDS = ['SEEDPROTOCOL'];
|
|
4587
|
-
/** Fired after `syncDbWithEas` persists EAS seeds/versions/metadata to SQLite (see `Item.rehydrateCachedItemsFromDbAfterEasSync`). */
|
|
4588
|
-
const EAS_SEED_DATA_SYNCED_TO_DB_EVENT = 'easSeedDataSyncedToDb';
|
|
4589
|
-
/**
|
|
4590
|
-
* Check if a schema is an internal SDK schema that should not be created in app files
|
|
4591
|
-
*/
|
|
4592
|
-
function isInternalSchema(schemaName, schemaId) {
|
|
4593
|
-
return schemaName === SEED_PROTOCOL_SCHEMA_NAME ||
|
|
4594
|
-
(schemaId !== undefined && INTERNAL_SCHEMA_IDS.includes(schemaId));
|
|
4595
|
-
}
|
|
4596
|
-
/**
|
|
4597
|
-
* Model ids (schemaFileId) of the internal Seed Protocol storage models. Storage seeds are always
|
|
4598
|
-
* these models, even if a user schema also defines a model named Image/File/Html.
|
|
4599
|
-
*/
|
|
4600
|
-
const INTERNAL_STORAGE_MODEL_FILE_IDS = {
|
|
4601
|
-
image: 'SEEDPROTOCOL_IMAGE',
|
|
4602
|
-
file: 'SEEDPROTOCOL_FILE',
|
|
4603
|
-
html: 'SEEDPROTOCOL_HTML',
|
|
4604
|
-
};
|
|
4605
|
-
|
|
4606
4683
|
const logger$1 = debug('seedSdk:helpers:ensureImageLocal');
|
|
4607
4684
|
/** Arweave transaction ids are 43 chars in the URL-safe base64 alphabet. */
|
|
4608
4685
|
const ARWEAVE_TX_ID_RE = /^[a-z0-9_-]{43}$/i;
|
|
@@ -4921,63 +4998,5 @@ const getArweaveUrlForTransaction = (storageTransactionId) => {
|
|
|
4921
4998
|
return BaseArweaveClient.getRawUrl(storageTransactionId);
|
|
4922
4999
|
};
|
|
4923
5000
|
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
*/
|
|
4927
|
-
function createFacadeTestHandle(getImpl, setImpl, next) {
|
|
4928
|
-
const previous = getImpl();
|
|
4929
|
-
setImpl(next);
|
|
4930
|
-
return {
|
|
4931
|
-
restore() {
|
|
4932
|
-
setImpl(previous);
|
|
4933
|
-
},
|
|
4934
|
-
};
|
|
4935
|
-
}
|
|
4936
|
-
|
|
4937
|
-
class BasePathResolver {
|
|
4938
|
-
static configure(impl) {
|
|
4939
|
-
if (!impl) {
|
|
4940
|
-
throw new Error('Cannot configure PathResolver with undefined or null. Ensure the platform-specific PathResolver is properly created.');
|
|
4941
|
-
}
|
|
4942
|
-
BasePathResolver._impl = impl;
|
|
4943
|
-
}
|
|
4944
|
-
static createForTesting(impl) {
|
|
4945
|
-
return createFacadeTestHandle(() => BasePathResolver._impl, (next) => {
|
|
4946
|
-
BasePathResolver._impl = next;
|
|
4947
|
-
}, impl);
|
|
4948
|
-
}
|
|
4949
|
-
static requireImpl() {
|
|
4950
|
-
if (!BasePathResolver._impl) {
|
|
4951
|
-
throw new Error('PathResolver not configured. Please ensure the platform-specific PathResolver is registered. For Node.js, import from @seedprotocol/sdk/node. For browser, the SDK should auto-initialize.');
|
|
4952
|
-
}
|
|
4953
|
-
return BasePathResolver._impl;
|
|
4954
|
-
}
|
|
4955
|
-
/**
|
|
4956
|
-
* @deprecated Prefer static facade methods (e.g. BasePathResolver.getDotSeedDir()).
|
|
4957
|
-
*/
|
|
4958
|
-
static getInstance() {
|
|
4959
|
-
return BasePathResolver.requireImpl();
|
|
4960
|
-
}
|
|
4961
|
-
static getRootWithNodeModules() {
|
|
4962
|
-
return BasePathResolver.requireImpl().getRootWithNodeModules();
|
|
4963
|
-
}
|
|
4964
|
-
static getSdkRootDir() {
|
|
4965
|
-
return BasePathResolver.requireImpl().getSdkRootDir();
|
|
4966
|
-
}
|
|
4967
|
-
static getNodeModulesDir() {
|
|
4968
|
-
return BasePathResolver.requireImpl().getNodeModulesDir();
|
|
4969
|
-
}
|
|
4970
|
-
static getDotSeedDir(schemaFileDir) {
|
|
4971
|
-
return BasePathResolver.requireImpl().getDotSeedDir(schemaFileDir);
|
|
4972
|
-
}
|
|
4973
|
-
static findConfigFile(searchDir) {
|
|
4974
|
-
return BasePathResolver.requireImpl().findConfigFile(searchDir);
|
|
4975
|
-
}
|
|
4976
|
-
static getAppPaths(schemaFileDir) {
|
|
4977
|
-
return BasePathResolver.requireImpl().getAppPaths(schemaFileDir);
|
|
4978
|
-
}
|
|
4979
|
-
}
|
|
4980
|
-
BasePathResolver._impl = null;
|
|
4981
|
-
|
|
4982
|
-
export { getStorageDirForDataType as $, schemas as A, BaseDb as B, seeds as C, DEFAULT_TEXT_MAX_LENGTH as D, uploadProcesses as E, versions as F, resolveStorageNameToSchemaName as G, AmbiguousModelError as H, eventEmitter as I, nameMatchLevels as J, BasePathResolver as K, getPropertyIdForModelAndName as L, ModelPropertyDataTypes as M, resolveItemModelFileId as N, addModelsToDb as O, Property as P, INIT_SCRIPT_SUCCESS_MESSAGE as Q, getCorrectId as R, SCHEMA_TS as S, THtmlEmbeddedDataUriPolicy as T, isPublishedSeedRef as U, normalizeRelationPropertyValue as V, resolveSeedIdsFromRefString as W, SEED_CONFIG_FILE as X, SEED_CONFIG_FALLBACKS as Y, getArweaveUrlForTransaction as Z, INTERNAL_STORAGE_MODEL_FILE_IDS as _, TProperty as a, getStorageTransactionIdForSeedUid as a$, getContentSha256 as a0, buildArweaveContentTags as a1, getItemStorageSubdir as a2, getItemStorageLocalFileName as a3, isNode as a4, ZERO_BYTES32 as a5, resolveModelRecord as a6, getItemModelScope as a7, VERSION_SCHEMA_UID as a8, INTERNAL_PROPERTY_NAMES as a9, closestImageSize as aA, contentSha256TagMatches as aB, ensureImageLocal as aC, getAddressesForItemsFilter as aD, getFeedItemStringField as aE, normalizeAddressConfig as aF, normalizeAddressList as aG, normalizeArweaveTxIdForEnsure as aH, normalizeFeedItemFields as aI, resolveMediaRef as aJ, isInternalSchema as aK, writeModelToDb as aL, writePropertyToDb as aM, addSchemaToDb as aN, renameModelInDb as aO, currentNameMatchLevels as aP, loadModelsFromDbForSchema as aQ, clearNameMatchLevels as aR, downloadAllFilesRequestHandler as aS, downloadAllFilesBinaryRequestHandler as aT, warnOnInvalidNameMatch as aU, INTERNAL_SCHEMA_IDS as aV, linkModelToSchema as aW, getWatchedAddressesFromDb as aX, getOwnedAddressesFromDb as aY, CLIENT_NOT_INITIALIZED as aZ, toSchemaPropertyName as a_, isStorageSeedRef as aa, defaultAttestationData as ab, INTERNAL_DATA_TYPES as ac, listRelationEasPropertyName as ad, easPropertyNameForPublish as ae, isBrowser as af, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as ag, normalizePublisher as ah, getAllAddressesFromDb as ai, loadNameMatchLevels as aj, scheduleBulkFilesDownloadFromEasSync as ak, generateId as al, normalizeHexAddress as am, toMetadataPropertyName as an, getItemStoragePropertiesForModel as ao, getModelIdByFileId as ap, getModelId as aq, setCachedPropertyRefresher as ar, CONTENT_SHA256_TAG as as, CONTENT_TYPE_TAG as at, ImageSize as au, SEED_PROTOCOL_SCHEMA_NAME as av, SeedModels as aw, VERSION_SCHEMA_DEF as ax, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as ay, classifyMediaRef as az, TPropertyConstructor as b, convertTxIdToImage as b0, getMetadataPropertyNamesForQuery as b1, downloadTransactionIdWithDedupe as b2, resolveMetadataRecord as b3, getPropertyIdForSchemaFileId as b4, getDataTypeFromString as b5, getMimeType as b6, listRelationStoragePropertyName as b7, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP as b8, getAlternatePropertyNameForInstanceLookup as b9, BaseDb$1 as ba, ModelSchema as bb, BaseFileManager$1 as bc, SchemaSchema as bd, ModelSchemaSchema as be, resolveModelRecord$1 as bf, db as bg, download as bh, generateId$1 as bi, TPropertyDataType as c, TPropertyDefs as d, TStorageType as e, TValidationRules as f, normalizePropertyRecordSchema as g, BaseFileManager as h, isDataType as i, appState as j, arweaveL1FinalizeJobs as k, config as l, metadata as m, normalizeDataType as n, easSyncProcesses as o, htmlEmbeddedImageCoPublish as p, modelRelations as q, modelSchemas as r, modelUids as s, models as t, modelsRelations as u, properties as v, propertiesRelations as w, propertyUidRelations as x, propertyUids as y, publishProcesses as z };
|
|
4983
|
-
//# sourceMappingURL=BasePathResolver-CBTXCMFL.js.map
|
|
5001
|
+
export { getItemStorageSubdir as $, schemas as A, BaseDb as B, seeds as C, DEFAULT_TEXT_MAX_LENGTH as D, uploadProcesses as E, versions as F, resolveStorageNameToSchemaName as G, AmbiguousModelError as H, eventEmitter as I, nameMatchLevels as J, getPropertyIdForModelAndName as K, resolveItemModelFileId as L, ModelPropertyDataTypes as M, addModelsToDb as N, INIT_SCRIPT_SUCCESS_MESSAGE as O, Property as P, getCorrectId as Q, isPublishedSeedRef as R, SCHEMA_TS as S, THtmlEmbeddedDataUriPolicy as T, normalizeRelationPropertyValue as U, resolveSeedIdsFromRefString as V, getArweaveUrlForTransaction as W, INTERNAL_STORAGE_MODEL_FILE_IDS as X, getStorageDirForDataType as Y, getContentSha256 as Z, buildArweaveContentTags as _, TProperty as a, toSchemaPropertyName as a$, getItemStorageLocalFileName as a0, isNode as a1, ZERO_BYTES32 as a2, resolveModelRecord as a3, getItemModelScope as a4, VERSION_SCHEMA_UID as a5, INTERNAL_PROPERTY_NAMES as a6, isStorageSeedRef as a7, defaultAttestationData as a8, INTERNAL_DATA_TYPES as a9, contentSha256TagMatches as aA, ensureImageLocal as aB, getAddressesForItemsFilter as aC, getFeedItemStringField as aD, normalizeAddressConfig as aE, normalizeAddressList as aF, normalizeArweaveTxIdForEnsure as aG, normalizeFeedItemFields as aH, resolveMediaRef as aI, isInternalSchema as aJ, writeModelToDb as aK, writePropertyToDb as aL, addSchemaToDb as aM, renameModelInDb as aN, currentNameMatchLevels as aO, loadModelsFromDbForSchema as aP, mergeDbModelsIntoSchemaModels as aQ, clearNameMatchLevels as aR, isTestOrSeedDev as aS, downloadAllFilesRequestHandler as aT, downloadAllFilesBinaryRequestHandler as aU, warnOnInvalidNameMatch as aV, INTERNAL_SCHEMA_IDS as aW, linkModelToSchema as aX, getWatchedAddressesFromDb as aY, getOwnedAddressesFromDb as aZ, CLIENT_NOT_INITIALIZED as a_, listRelationEasPropertyName as aa, easPropertyNameForPublish as ab, isBrowser as ac, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as ad, normalizePublisher as ae, getAllAddressesFromDb as af, loadNameMatchLevels as ag, scheduleBulkFilesDownloadFromEasSync as ah, generateId as ai, normalizeHexAddress as aj, toMetadataPropertyName as ak, getItemStoragePropertiesForModel as al, SEED_CONFIG_FILE as am, SEED_CONFIG_FALLBACKS as an, getModelIdByFileId as ao, getModelId as ap, setCachedPropertyRefresher as aq, CONTENT_SHA256_TAG as ar, CONTENT_TYPE_TAG as as, ImageSize as at, SEED_PROTOCOL_SCHEMA_NAME as au, SeedModels as av, VERSION_SCHEMA_DEF as aw, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as ax, classifyMediaRef as ay, closestImageSize as az, TPropertyConstructor as b, easSchemaDefinitionForProperty as b0, getStorageTransactionIdForSeedUid as b1, convertTxIdToImage as b2, getMetadataPropertyNamesForQuery as b3, downloadTransactionIdWithDedupe as b4, resolveMetadataRecord as b5, getPropertyIdForSchemaFileId as b6, getDataTypeFromString as b7, getMimeType as b8, listRelationStoragePropertyName as b9, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP as ba, getAlternatePropertyNameForInstanceLookup as bb, BaseDb$1 as bc, ModelSchema as bd, BaseFileManager$1 as be, SchemaSchema as bf, ModelSchemaSchema as bg, resolveModelRecord$1 as bh, db as bi, download as bj, generateId$1 as bk, TPropertyDataType as c, TPropertyDefs as d, TStorageType as e, TValidationRules as f, normalizePropertyRecordSchema as g, BaseFileManager as h, isDataType as i, appState as j, arweaveL1FinalizeJobs as k, config as l, metadata as m, normalizeDataType as n, easSyncProcesses as o, htmlEmbeddedImageCoPublish as p, modelRelations as q, modelSchemas as r, modelUids as s, models as t, modelsRelations as u, properties as v, propertiesRelations as w, propertyUidRelations as x, propertyUids as y, publishProcesses as z };
|
|
5002
|
+
//# sourceMappingURL=index-CrvIcVFJ.js.map
|