@seedprotocol/sdk 0.7.4-next.711.gce2b766 → 0.7.4-next.784.g879c6a3
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/{BasePathResolver-Cm4apKRb.js → BasePathResolver-DxdS0wJ0.js} +43 -8
- package/dist/BasePathResolver-DxdS0wJ0.js.map +1 -0
- package/dist/{ClientManager-i3nJASkg.js → ClientManager-De-vKHGe.js} +37 -38
- package/dist/ClientManager-De-vKHGe.js.map +1 -0
- package/dist/{Item-DBFchXpC.js → Item-cq9VcsAY.js} +365 -191
- package/dist/Item-cq9VcsAY.js.map +1 -0
- package/dist/{ModelProperty-BS49g01Y.js → ModelProperty-DuuoFXaC.js} +45 -37
- package/dist/ModelProperty-DuuoFXaC.js.map +1 -0
- package/dist/{Schema-CpMNEnUO.js → Schema-Dc5EA8Yb.js} +246 -68
- package/dist/Schema-Dc5EA8Yb.js.map +1 -0
- package/dist/{SchemaValidationService-DieV4KL-.js → SchemaValidationService-DViJ056F.js} +49 -36
- package/dist/SchemaValidationService-DViJ056F.js.map +1 -0
- package/dist/{backfillMetadataPropertyIds-DSoOoTnX.js → backfillMetadataPropertyIds-DacVthS5.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-DSoOoTnX.js.map → backfillMetadataPropertyIds-DacVthS5.js.map} +1 -1
- package/dist/{configurePlatform-D0lQGAMQ.js → configurePlatform-DlZ23w7e.js} +2 -2
- package/dist/{configurePlatform-D0lQGAMQ.js.map → configurePlatform-DlZ23w7e.js.map} +1 -1
- package/dist/{detachRowsBeforeDelete-S0q-DJPT.js → detachRowsBeforeDelete-YRSZY6dO.js} +2 -2
- package/dist/{detachRowsBeforeDelete-S0q-DJPT.js.map → detachRowsBeforeDelete-YRSZY6dO.js.map} +1 -1
- package/dist/{eas-6pjU-OuX.js → eas-D_6ptL_F.js} +4 -4
- package/dist/{eas-6pjU-OuX.js.map → eas-D_6ptL_F.js.map} +1 -1
- package/dist/{index-8O3Uow-Y.js → errors-Cl8rbtKR.js} +192 -48
- package/dist/errors-Cl8rbtKR.js.map +1 -0
- package/dist/{getItem-CxBNZ-WL.js → getItem-BcmJcUZB.js} +5 -5
- package/dist/{getItem-CxBNZ-WL.js.map → getItem-BcmJcUZB.js.map} +1 -1
- package/dist/{getPublishPayload-CTCvRUoU.js → getPublishPayload-C278kK9P.js} +15 -15
- package/dist/{getPublishPayload-CTCvRUoU.js.map → getPublishPayload-C278kK9P.js.map} +1 -1
- package/dist/{getPublishUploads-SFHCbf_y.js → getPublishUploads-DJ1UPh7i.js} +9 -9
- package/dist/{getPublishUploads-SFHCbf_y.js.map → getPublishUploads-DJ1UPh7i.js.map} +1 -1
- package/dist/{index-Cvt5UBz4.js → index-CqnU-5i0.js} +9 -9
- package/dist/index-CqnU-5i0.js.map +1 -0
- package/dist/{index-AVFTVp1m.js → index-DAl9U4rn.js} +2 -2
- package/dist/index-DAl9U4rn.js.map +1 -0
- package/dist/{index.browser-DBhxRoe8.js → index.browser-J6QZ9smP.js} +10 -10
- package/dist/{index.browser-DBhxRoe8.js.map → index.browser-J6QZ9smP.js.map} +1 -1
- package/dist/{index.node-CJhlcNHM.js → index.node-C9VB9NlX.js} +9 -9
- package/dist/index.node-C9VB9NlX.js.map +1 -0
- package/dist/main.js +24 -24
- package/dist/{model-DGMe-TTm.js → model-oHA3YhOd.js} +5 -1
- package/dist/model-oHA3YhOd.js.map +1 -0
- package/dist/node.js +11 -11
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +4 -4
- package/dist/{property-DwPD283A.js → property-Brgr5RdT.js} +11 -11
- package/dist/{property-DwPD283A.js.map → property-Brgr5RdT.js.map} +1 -1
- package/dist/propertyValidationRules-CDRitiiK.js +51 -0
- package/dist/propertyValidationRules-CDRitiiK.js.map +1 -0
- package/dist/{publishDraftGraph-BOn3_Occ.js → publishDraftGraph-C37ibxb5.js} +6 -6
- package/dist/{publishDraftGraph-BOn3_Occ.js.map → publishDraftGraph-C37ibxb5.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-BkYmBeJc.js → resetAmbiguousLegacyItemData-CcLFRREE.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-BkYmBeJc.js.map → resetAmbiguousLegacyItemData-CcLFRREE.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-BL24nLa7.js → resolveModelForSyncedSeed-BTAeCOJE.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-BL24nLa7.js.map → resolveModelForSyncedSeed-BTAeCOJE.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +6 -2
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/errors.d.ts +23 -0
- package/dist/src/Item/errors.d.ts.map +1 -0
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.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/saveFile.d.ts +19 -0
- package/dist/src/ItemProperty/service/actors/saveValueToDb/saveFile.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.map +1 -1
- package/dist/src/Model/Model.d.ts +2 -0
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/service/actors/createModelProperties.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +2 -0
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +11 -2
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- 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/schemaMachine.d.ts.map +1 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts +4 -1
- package/dist/src/Schema/service/validation/SchemaValidationService.d.ts.map +1 -1
- package/dist/src/db/Db/BaseDb.d.ts +5 -2
- package/dist/src/db/Db/BaseDb.d.ts.map +1 -1
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/entity/draftSaveErrors.d.ts +4 -0
- package/dist/src/helpers/entity/draftSaveErrors.d.ts.map +1 -0
- package/dist/src/helpers/entity/entityUnload.d.ts +2 -1
- package/dist/src/helpers/entity/entityUnload.d.ts.map +1 -1
- package/dist/src/helpers/entity/evictionEpoch.d.ts +27 -2
- package/dist/src/helpers/entity/evictionEpoch.d.ts.map +1 -1
- package/dist/src/helpers/isSqliteUniqueConstraintError.d.ts.map +1 -1
- package/dist/src/helpers/model.d.ts.map +1 -1
- package/dist/src/helpers/propertyValidationRules.d.ts +12 -0
- package/dist/src/helpers/propertyValidationRules.d.ts.map +1 -0
- package/dist/src/helpers/propertyWriteQueue.d.ts +15 -0
- package/dist/src/helpers/propertyWriteQueue.d.ts.map +1 -0
- package/dist/src/helpers/schema.d.ts.map +1 -1
- package/dist/src/helpers/storageFileName.d.ts +7 -0
- package/dist/src/helpers/storageFileName.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +1 -0
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +12 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-Bv2Fe38J.js → syncDbWithEas-B-Ho0IOB.js} +50 -27
- package/dist/syncDbWithEas-B-Ho0IOB.js.map +1 -0
- package/dist/{tabEvents-9s2WCYw-.js → tabEvents-BTzckWrN.js} +4 -4
- package/dist/{tabEvents-9s2WCYw-.js.map → tabEvents-BTzckWrN.js.map} +1 -1
- package/dist/{tolerantWebAccess-iUu80pAP.js → tolerantWebAccess-DOm2Xv-f.js} +6 -6
- package/dist/{tolerantWebAccess-iUu80pAP.js.map → tolerantWebAccess-DOm2Xv-f.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-zBfi931j.js → updateSeedRevokedAt-IHXnJI-i.js} +3 -3
- package/dist/{updateSeedRevokedAt-zBfi931j.js.map → updateSeedRevokedAt-IHXnJI-i.js.map} +1 -1
- package/package.json +5 -5
- package/dist/BasePathResolver-Cm4apKRb.js.map +0 -1
- package/dist/ClientManager-i3nJASkg.js.map +0 -1
- package/dist/Item-DBFchXpC.js.map +0 -1
- package/dist/ModelProperty-BS49g01Y.js.map +0 -1
- package/dist/Schema-CpMNEnUO.js.map +0 -1
- package/dist/SchemaValidationService-DieV4KL-.js.map +0 -1
- package/dist/index-8O3Uow-Y.js.map +0 -1
- package/dist/index-AVFTVp1m.js.map +0 -1
- package/dist/index-Cvt5UBz4.js.map +0 -1
- package/dist/index.node-CJhlcNHM.js.map +0 -1
- package/dist/model-DGMe-TTm.js.map +0 -1
- package/dist/syncDbWithEas-Bv2Fe38J.js.map +0 -1
|
@@ -50,8 +50,11 @@ class BaseDb {
|
|
|
50
50
|
* Execute a reactive query that emits new results whenever the underlying data changes.
|
|
51
51
|
*
|
|
52
52
|
* Supports two usage patterns:
|
|
53
|
-
* 1. SQL tag function: liveQuery((sql) => sql`SELECT * FROM models`)
|
|
54
|
-
* 2. Drizzle query builder
|
|
53
|
+
* 1. SQL tag function (browser only): liveQuery((sql) => sql`SELECT * FROM models`)
|
|
54
|
+
* 2. Drizzle query builder: liveQuery(db.select().from(models))
|
|
55
|
+
*
|
|
56
|
+
* On Node only the query builder works (a tag function throws), and it is re-run every second;
|
|
57
|
+
* the observable emits when the result changes.
|
|
55
58
|
*/
|
|
56
59
|
static liveQuery(query) {
|
|
57
60
|
return BaseDb.requireImpl().liveQuery(query);
|
|
@@ -59,6 +62,11 @@ class BaseDb {
|
|
|
59
62
|
}
|
|
60
63
|
BaseDb._impl = null;
|
|
61
64
|
|
|
65
|
+
var BaseDb$1 = /*#__PURE__*/Object.freeze({
|
|
66
|
+
__proto__: null,
|
|
67
|
+
BaseDb: BaseDb
|
|
68
|
+
});
|
|
69
|
+
|
|
62
70
|
const models = sqliteTable('models', {
|
|
63
71
|
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
64
72
|
name: text('name').notNull(),
|
|
@@ -1102,7 +1110,8 @@ function isSqliteUniqueConstraintError(error) {
|
|
|
1102
1110
|
return true;
|
|
1103
1111
|
}
|
|
1104
1112
|
for (const key of ['message', 'msg', 'stack']) {
|
|
1105
|
-
const
|
|
1113
|
+
const raw = err[key];
|
|
1114
|
+
const value = key === 'stack' && typeof raw === 'string' ? stackWithoutFrames(raw) : raw;
|
|
1106
1115
|
if (typeof value === 'string' && matchesUniqueConstraintText(value)) {
|
|
1107
1116
|
return true;
|
|
1108
1117
|
}
|
|
@@ -1123,6 +1132,16 @@ function matchesUniqueConstraintText(text) {
|
|
|
1123
1132
|
/\brc\s*=\s*2067\b/i.test(text) ||
|
|
1124
1133
|
(text.includes('2067') && lower.includes('constraint')));
|
|
1125
1134
|
}
|
|
1135
|
+
/**
|
|
1136
|
+
* A stack's message lines without its frames. Frames hold file names and line:column numbers, so
|
|
1137
|
+
* a frame in a file named like this one, with a 2067 in its position or URL timestamp, would match.
|
|
1138
|
+
*/
|
|
1139
|
+
function stackWithoutFrames(stack) {
|
|
1140
|
+
return stack
|
|
1141
|
+
.split('\n')
|
|
1142
|
+
.filter((line) => !/^\s*at\s/.test(line) && !/@\S*:\d+:\d+\s*$/.test(line))
|
|
1143
|
+
.join('\n');
|
|
1144
|
+
}
|
|
1126
1145
|
|
|
1127
1146
|
/**
|
|
1128
1147
|
* Thrown when a model name exists in more than one schema and nothing says which one is meant.
|
|
@@ -2003,6 +2022,20 @@ const addSchemaToDb = async (schema, schemaFileId, schemaData, isDraft, isEdited
|
|
|
2003
2022
|
}
|
|
2004
2023
|
}
|
|
2005
2024
|
if (existingSchemas.length > 0) {
|
|
2025
|
+
// The row is per schema name and holds its latest version. A complete schema file can bring
|
|
2026
|
+
// a version under its own id (SDK version bumps keep the id; imported files may not).
|
|
2027
|
+
const isOtherVersionFile = !!schemaFileId &&
|
|
2028
|
+
!!existingSchemas[0].schemaFileId &&
|
|
2029
|
+
existingSchemas[0].schemaFileId !== schemaFileId &&
|
|
2030
|
+
existingSchemas[0].isDraft !== true &&
|
|
2031
|
+
schema.version !== undefined &&
|
|
2032
|
+
schema.version !== existingSchemas[0].version;
|
|
2033
|
+
if (isOtherVersionFile && schema.version < existingSchemas[0].version) {
|
|
2034
|
+
// An older version's file: rolling the row back to it would leave the newer version's id
|
|
2035
|
+
// pointing at the older version's data.
|
|
2036
|
+
logger$3(`Keeping schema "${schema.name}" at v${existingSchemas[0].version}; not replacing it with older v${schema.version}`);
|
|
2037
|
+
return existingSchemas[0];
|
|
2038
|
+
}
|
|
2006
2039
|
// Update fields if provided
|
|
2007
2040
|
const updates = {};
|
|
2008
2041
|
// Update schemaFileId if provided and different from existing (or if existing doesn't have one or is null)
|
|
@@ -2014,9 +2047,11 @@ const addSchemaToDb = async (schema, schemaFileId, schemaData, isDraft, isEdited
|
|
|
2014
2047
|
// 1. Existing schema is a draft (can be updated)
|
|
2015
2048
|
// 2. Existing schema has no schemaFileId (should be set)
|
|
2016
2049
|
// 3. We're explicitly setting isDraft to false (updating from draft to non-draft)
|
|
2050
|
+
// 4. It's a newer version's file: the row takes that version's data, so it takes its id too
|
|
2017
2051
|
const shouldUpdate = existingSchemas[0].isDraft === true ||
|
|
2018
2052
|
!existingSchemas[0].schemaFileId ||
|
|
2019
|
-
(isDraft === false && existingSchemas[0].isDraft === true)
|
|
2053
|
+
(isDraft === false && existingSchemas[0].isDraft === true) ||
|
|
2054
|
+
isOtherVersionFile;
|
|
2020
2055
|
if (shouldUpdate) {
|
|
2021
2056
|
logger$3(`Updating schemaFileId from "${existingSchemas[0].schemaFileId}" to "${schemaFileId}" for schema "${schema.name}"`);
|
|
2022
2057
|
updates.schemaFileId = schemaFileId;
|
|
@@ -2398,7 +2433,7 @@ const addModelsToDb = async (models$1, schema, modelRenames, schemaFileData) =>
|
|
|
2398
2433
|
schema = pendingProperties;
|
|
2399
2434
|
}
|
|
2400
2435
|
else {
|
|
2401
|
-
const modelHelpersMod = await import('./model-
|
|
2436
|
+
const modelHelpersMod = await import('./model-oHA3YhOd.js');
|
|
2402
2437
|
const { modelPropertiesToObject } = modelHelpersMod;
|
|
2403
2438
|
const modelProperties = modelClass.properties || [];
|
|
2404
2439
|
schema = modelPropertiesToObject(modelProperties);
|
|
@@ -3708,7 +3743,7 @@ const syncDbFiles = async (endpoints) => {
|
|
|
3708
3743
|
const getAppDbReady = async () => {
|
|
3709
3744
|
if (!BaseDb.isAppDbReady()) {
|
|
3710
3745
|
// Wait for ClientManager to be ready (DB_INIT state or later)
|
|
3711
|
-
const _mod_0 = await import('./ClientManager-
|
|
3746
|
+
const _mod_0 = await import('./ClientManager-De-vKHGe.js');
|
|
3712
3747
|
const _ns_0 = _mod_0.L;
|
|
3713
3748
|
const clientManagerMod = _ns_0;
|
|
3714
3749
|
const { getClient } = clientManagerMod;
|
|
@@ -4604,5 +4639,5 @@ class BasePathResolver {
|
|
|
4604
4639
|
}
|
|
4605
4640
|
BasePathResolver._impl = null;
|
|
4606
4641
|
|
|
4607
|
-
export { generateId as $, seeds as A, uploadProcesses as B, versions as C, DEFAULT_TEXT_MAX_LENGTH as D, BaseDb as E, AmbiguousModelError as F, eventEmitter as G, toSnakeCase as H, BasePathResolver as I, BaseFileManager as J, getPropertyIdForModelAndName as K, resolveItemModelFileId as L, ModelPropertyDataTypes as M, resolveSeedIdsFromRefString as N, normalizeRelationPropertyValue as O, Property as P, isPublishedSeedRef as Q, getStorageDirForDataType as R, getContentSha256 as S, THtmlEmbeddedDataUriPolicy as T, buildArweaveContentTags as U, getItemStorageSubdir as V, getItemStorageLocalFileName as W, normalizePublisher as X, getAllAddressesFromDb as Y, scheduleBulkFilesDownloadFromEasSync as Z, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as _, TProperty as a,
|
|
4608
|
-
//# sourceMappingURL=BasePathResolver-
|
|
4642
|
+
export { generateId as $, seeds as A, uploadProcesses as B, versions as C, DEFAULT_TEXT_MAX_LENGTH as D, BaseDb as E, AmbiguousModelError as F, eventEmitter as G, toSnakeCase as H, BasePathResolver as I, BaseFileManager as J, getPropertyIdForModelAndName as K, resolveItemModelFileId as L, ModelPropertyDataTypes as M, resolveSeedIdsFromRefString as N, normalizeRelationPropertyValue as O, Property as P, isPublishedSeedRef as Q, getStorageDirForDataType as R, getContentSha256 as S, THtmlEmbeddedDataUriPolicy as T, buildArweaveContentTags as U, getItemStorageSubdir as V, getItemStorageLocalFileName as W, normalizePublisher as X, getAllAddressesFromDb as Y, scheduleBulkFilesDownloadFromEasSync as Z, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as _, TProperty as a, BaseFileManager$1 as a$, normalizeHexAddress as a0, getItemStoragePropertiesForModel as a1, addModelsToDb as a2, INIT_SCRIPT_SUCCESS_MESSAGE as a3, SCHEMA_TS as a4, getCorrectId as a5, SEED_CONFIG_FILE as a6, SEED_CONFIG_FALLBACKS as a7, isNode as a8, ZERO_BYTES32 as a9, normalizeAddressConfig as aA, normalizeAddressList as aB, normalizeArweaveTxIdForEnsure as aC, normalizeFeedItemFields as aD, resolveMediaRef as aE, isInternalSchema as aF, writeModelToDb as aG, writePropertyToDb as aH, addSchemaToDb as aI, renameModelInDb as aJ, loadModelsFromDbForSchema as aK, downloadAllFilesRequestHandler as aL, downloadAllFilesBinaryRequestHandler as aM, INTERNAL_SCHEMA_IDS as aN, linkModelToSchema as aO, getWatchedAddressesFromDb as aP, getOwnedAddressesFromDb as aQ, CLIENT_NOT_INITIALIZED as aR, getStorageTransactionIdForSeedUid as aS, convertTxIdToImage as aT, downloadTransactionIdWithDedupe as aU, getPropertyIdForSchemaFileId as aV, getDataTypeFromString as aW, getMimeType as aX, PROPERTY_NAMES_EXEMPT_FROM_ID_SUFFIX_STRIP as aY, BaseDb$1 as aZ, ModelSchema as a_, resolveModelRecord as aa, getItemModelScope as ab, VERSION_SCHEMA_UID as ac, INTERNAL_PROPERTY_NAMES as ad, isStorageSeedRef as ae, defaultAttestationData as af, INTERNAL_DATA_TYPES as ag, isBrowser as ah, getModelIdByFileId as ai, getModelId as aj, setCachedPropertyRefresher as ak, getArweaveUrlForTransaction as al, INTERNAL_STORAGE_MODEL_FILE_IDS as am, CONTENT_SHA256_TAG as an, CONTENT_TYPE_TAG as ao, ImageSize as ap, SEED_PROTOCOL_SCHEMA_NAME as aq, SeedModels as ar, VERSION_SCHEMA_DEF as as, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as at, classifyMediaRef as au, closestImageSize as av, contentSha256TagMatches as aw, ensureImageLocal as ax, getAddressesForItemsFilter as ay, getFeedItemStringField as az, TPropertyConstructor as b, SchemaSchema as b0, ModelSchemaSchema as b1, resolveModelRecord$1 as b2, db as b3, download as b4, generateId$1 as b5, TPropertyDataType as c, TPropertyDefs as d, TStorageType as e, TValidationRules as f, normalizePropertyRecordSchema as g, appState as h, isDataType as i, arweaveL1FinalizeJobs as j, config as k, easSyncProcesses as l, metadata as m, normalizeDataType as n, htmlEmbeddedImageCoPublish as o, modelRelations as p, modelSchemas as q, modelUids as r, models as s, modelsRelations as t, properties as u, propertiesRelations as v, propertyUidRelations as w, propertyUids as x, publishProcesses as y, schemas as z };
|
|
4643
|
+
//# sourceMappingURL=BasePathResolver-DxdS0wJ0.js.map
|