@seedprotocol/sdk 0.7.4 → 0.7.5-next.850.g9ab585b
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 +99 -0
- package/dist/{BasePathResolver-DrzGVH9L.js → BasePathResolver-CsZHPrk9.js} +141 -7
- package/dist/BasePathResolver-CsZHPrk9.js.map +1 -0
- package/dist/{ClientManager-Dfu4jcgm.js → ClientManager-DETTj0_z.js} +43 -33
- package/dist/ClientManager-DETTj0_z.js.map +1 -0
- package/dist/{Item-BUUFuywT.js → Item-TMrVEPeX.js} +63 -63
- package/dist/{Item-BUUFuywT.js.map → Item-TMrVEPeX.js.map} +1 -1
- package/dist/{ModelProperty-B6cnRvIz.js → ModelProperty-Bw6N8OMK.js} +36 -36
- package/dist/{ModelProperty-B6cnRvIz.js.map → ModelProperty-Bw6N8OMK.js.map} +1 -1
- package/dist/{Schema-Bf-jOLq0.js → Schema-VLenyJDy.js} +56 -36
- package/dist/Schema-VLenyJDy.js.map +1 -0
- package/dist/{SchemaValidationService-BNYMacsx.js → SchemaValidationService-CLGadxgf.js} +6 -6
- package/dist/{SchemaValidationService-BNYMacsx.js.map → SchemaValidationService-CLGadxgf.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-C2-s_jUa.js → backfillMetadataPropertyIds-C8fSvzy2.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-C2-s_jUa.js.map → backfillMetadataPropertyIds-C8fSvzy2.js.map} +1 -1
- package/dist/{configurePlatform-BzfirKuM.js → configurePlatform-C3E0BS3u.js} +2 -2
- package/dist/{configurePlatform-BzfirKuM.js.map → configurePlatform-C3E0BS3u.js.map} +1 -1
- package/dist/{detachRowsBeforeDelete-B0Daoz9Z.js → detachRowsBeforeDelete-D1gTseFW.js} +2 -2
- package/dist/{detachRowsBeforeDelete-B0Daoz9Z.js.map → detachRowsBeforeDelete-D1gTseFW.js.map} +1 -1
- package/dist/{eas-Dq5Kx_Nd.js → eas-A82zVNQ9.js} +25 -12
- package/dist/eas-A82zVNQ9.js.map +1 -0
- package/dist/{errors-DdWbxb_n.js → errors-CWKup8tw.js} +40 -37
- package/dist/errors-CWKup8tw.js.map +1 -0
- package/dist/{getItem-9bYSErSj.js → getItem-ChieGxJV.js} +4 -4
- package/dist/{getItem-9bYSErSj.js.map → getItem-ChieGxJV.js.map} +1 -1
- package/dist/{getPublishPayload-DPy-uMrR.js → getPublishPayload-CWfjl8PM.js} +25 -15
- package/dist/getPublishPayload-CWfjl8PM.js.map +1 -0
- package/dist/{getPublishUploads-J-143iSV.js → getPublishUploads-cLbSEXLk.js} +8 -8
- package/dist/{getPublishUploads-J-143iSV.js.map → getPublishUploads-cLbSEXLk.js.map} +1 -1
- package/dist/{index-7y2f_iQz.js → index-CURf9L4d.js} +2 -2
- package/dist/index-CURf9L4d.js.map +1 -0
- package/dist/{index-C61Rxy0F.js → index-CXkcz4hT.js} +8 -8
- package/dist/index-CXkcz4hT.js.map +1 -0
- package/dist/{index.browser-C1pisOEa.js → index.browser-47W0fJPw.js} +10 -10
- package/dist/{index.browser-C1pisOEa.js.map → index.browser-47W0fJPw.js.map} +1 -1
- package/dist/{index.node-BAlST8pD.js → index.node-BiQhZQvH.js} +6 -6
- package/dist/{index.node-BAlST8pD.js.map → index.node-BiQhZQvH.js.map} +1 -1
- package/dist/main.js +25 -23
- package/dist/main.js.map +1 -1
- package/dist/node.js +10 -10
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +4 -4
- package/dist/{property-zFPMtR3T.js → property-tgPI5hMu.js} +7 -7
- package/dist/{property-zFPMtR3T.js.map → property-tgPI5hMu.js.map} +1 -1
- package/dist/{propertyValidationRules-CeFVhdQg.js → propertyValidationRules-BLVxTejW.js} +10 -10
- package/dist/{propertyValidationRules-CeFVhdQg.js.map → propertyValidationRules-BLVxTejW.js.map} +1 -1
- package/dist/{publishDraftGraph-CuVq6iAR.js → publishDraftGraph-FAfecR_4.js} +6 -6
- package/dist/{publishDraftGraph-CuVq6iAR.js.map → publishDraftGraph-FAfecR_4.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-DsFTnMBz.js → resetAmbiguousLegacyItemData-kz2PYdZi.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-DsFTnMBz.js.map → resetAmbiguousLegacyItemData-kz2PYdZi.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-RUsgAZXG.js → resolveModelForSyncedSeed-Dm1E4ebt.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-RUsgAZXG.js.map → resolveModelForSyncedSeed-Dm1E4ebt.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +2 -1
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/service/schemaMachine.d.ts +3 -0
- package/dist/src/Schema/service/schemaMachine.d.ts.map +1 -1
- package/dist/src/db/canonicalizeModelTypes.d.ts +2 -2
- package/dist/src/db/canonicalizeModelTypes.d.ts.map +1 -1
- package/dist/src/db/read/getModelSchemas.d.ts +3 -2
- package/dist/src/db/read/getModelSchemas.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/nameMatchLevels.d.ts +64 -0
- package/dist/src/db/read/nameMatchLevels.d.ts.map +1 -0
- package/dist/src/db/read/resolveModelRecord.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts +2 -0
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/eas.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/easValueTypes.d.ts +16 -0
- package/dist/src/helpers/easValueTypes.d.ts.map +1 -0
- 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.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types/import.d.ts +20 -0
- package/dist/src/types/import.d.ts.map +1 -1
- package/dist/{syncDbWithEas-CRpnkq00.js → syncDbWithEas-CMCAihFh.js} +92 -22
- package/dist/syncDbWithEas-CMCAihFh.js.map +1 -0
- package/dist/{tabEvents-nBUq_1u1.js → tabEvents-BEAmMncP.js} +4 -4
- package/dist/{tabEvents-nBUq_1u1.js.map → tabEvents-BEAmMncP.js.map} +1 -1
- package/dist/{tolerantWebAccess-DIt3R8_u.js → tolerantWebAccess-CqiDGEyR.js} +6 -6
- package/dist/{tolerantWebAccess-DIt3R8_u.js.map → tolerantWebAccess-CqiDGEyR.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-DtTPSzpM.js → updateSeedRevokedAt-Bw3uEStt.js} +3 -3
- package/dist/{updateSeedRevokedAt-DtTPSzpM.js.map → updateSeedRevokedAt-Bw3uEStt.js.map} +1 -1
- package/package.json +9 -5
- package/dist/BasePathResolver-DrzGVH9L.js.map +0 -1
- package/dist/ClientManager-Dfu4jcgm.js.map +0 -1
- package/dist/Schema-Bf-jOLq0.js.map +0 -1
- package/dist/eas-Dq5Kx_Nd.js.map +0 -1
- package/dist/errors-DdWbxb_n.js.map +0 -1
- package/dist/getPublishPayload-DPy-uMrR.js.map +0 -1
- package/dist/index-7y2f_iQz.js.map +0 -1
- package/dist/index-C61Rxy0F.js.map +0 -1
- package/dist/syncDbWithEas-CRpnkq00.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { startCase, isEqual } from 'lodash-es';
|
|
2
|
-
import { E as BaseDb, l as easSyncProcesses, H as eventEmitter,
|
|
2
|
+
import { E as BaseDb, l as easSyncProcesses, H as eventEmitter, a2 as isNode, ad as isBrowser, J as BasePathResolver, aF as normalizeAddressConfig, h as appState, aS as downloadAllFilesRequestHandler, aT as downloadAllFilesBinaryRequestHandler, K as BaseFileManager, s as models$1, r as modelUids, A as seeds, aG as normalizeAddressList, z as schemas, aQ as loadModelsFromDbForSchema, aN as addSchemaToDb, aK as isInternalSchema, aU as warnOnInvalidNameMatch, aV as INTERNAL_SCHEMA_IDS, aj as generateId, aW as linkModelToSchema, aR as clearNameMatchLevels, n as normalizeDataType, ac as easPropertyNameForPublish, av as SEED_PROTOCOL_SCHEMA_NAME, q as modelSchemas, m as metadata$1, u as properties, N as resolveItemModelFileId, C as versions, ah as loadNameMatchLevels, o as htmlEmbeddedImageCoPublish, j as arweaveL1FinalizeJobs, y as publishProcesses, af as normalizePublisher, aX as getWatchedAddressesFromDb, aY as getOwnedAddressesFromDb, aZ as CLIENT_NOT_INITIALIZED } from './BasePathResolver-CsZHPrk9.js';
|
|
3
3
|
import debug from 'debug';
|
|
4
4
|
import { createActor, setup, assign, fromPromise, fromCallback, waitFor } from 'xstate';
|
|
5
|
-
import { u as MachineIds, a0 as ClientManagerEvents, a1 as withLockedItemStorageRow, a2 as getItemStorageFilePath, a3 as writeItemStorageFile, c as compareMetadataRowsLatestFirst, w as writeInBatches, C as ClientManagerState, a4 as resolvePublisherFromSeedRow, G as isLocalUnsealedDraft, I as Item } from './Item-
|
|
5
|
+
import { u as MachineIds, a0 as ClientManagerEvents, a1 as withLockedItemStorageRow, a2 as getItemStorageFilePath, a3 as writeItemStorageFile, c as compareMetadataRowsLatestFirst, w as writeInBatches, C as ClientManagerState, a4 as resolvePublisherFromSeedRow, G as isLocalUnsealedDraft, I as Item } from './Item-TMrVEPeX.js';
|
|
6
6
|
import { eq, inArray, and, isNotNull, ne, desc, countDistinct, isNull, or, sql, like } from 'drizzle-orm';
|
|
7
|
-
import { a as withDbTabLock, i as isLeaderTab, c as postTabMessage, o as onTabMessage, w as whenLeaderTab, l as listenForOtherTabsEvents, s as startTabCoordination, b as withSeedDbLock, e as emitAcrossTabs, A as ADDRESSES_PERSISTED_EVENT, p as parseAddressesPersistedPayload, L as LOCAL_COPIES_REMOVED_EVENT } from './tabEvents-
|
|
7
|
+
import { a as withDbTabLock, i as isLeaderTab, c as postTabMessage, o as onTabMessage, w as whenLeaderTab, l as listenForOtherTabsEvents, s as startTabCoordination, b as withSeedDbLock, e as emitAcrossTabs, A as ADDRESSES_PERSISTED_EVENT, p as parseAddressesPersistedPayload, L as LOCAL_COPIES_REMOVED_EVENT } from './tabEvents-BEAmMncP.js';
|
|
8
8
|
import { seedGatewayConfigFromSeedConfig, setPreferredArweaveReadBaseUrls, resolveSeedGatewayEndpoints, setResolvedSeedGatewayEndpoints, BaseArweaveClient, ensureReadGatewaySelected, DEFAULT_ARWEAVE_HOST } from '@seedprotocol/arweave';
|
|
9
9
|
import { configureEasReadChain, easName, BaseQueryClient, BaseEasClient, GET_SCHEMAS, whenEasReadChainSettled, getEasReadChainId, DEFAULT_EAS_CHAIN_ID, isEasReadChainConfigured, localNamesInBestMatchTier, isValidEasAttestationUid } from '@seedprotocol/eas';
|
|
10
10
|
import 'pluralize';
|
|
@@ -212,7 +212,7 @@ function toRunSyncArg(options) {
|
|
|
212
212
|
return undefined;
|
|
213
213
|
}
|
|
214
214
|
const runEasSync = fromPromise(async ({ input, }) => {
|
|
215
|
-
const { runSyncFromEas } = await import('./syncDbWithEas-
|
|
215
|
+
const { runSyncFromEas } = await import('./syncDbWithEas-CMCAihFh.js');
|
|
216
216
|
// Sync checks for rows and then inserts the rest (no unique index on uids), so syncs in
|
|
217
217
|
// different tabs take turns. A sync can run for minutes, so wait without a timeout.
|
|
218
218
|
await withDbTabLock('eas-sync', async () => {
|
|
@@ -609,7 +609,7 @@ const platformClassesInit = fromCallback(({ sendBack, input: { context, event }
|
|
|
609
609
|
}
|
|
610
610
|
// Prefer the condition-resolved factory when available; fall back to explicit
|
|
611
611
|
// platform imports so source/vitest resolution stays reliable.
|
|
612
|
-
const { configurePlatform } = await import('./configurePlatform-
|
|
612
|
+
const { configurePlatform } = await import('./configurePlatform-C3E0BS3u.js');
|
|
613
613
|
if (isBrowser()) {
|
|
614
614
|
const { createPlatformServices } = await import('./platform.browser.js');
|
|
615
615
|
configurePlatform(createPlatformServices());
|
|
@@ -2025,8 +2025,8 @@ function getRefValueType(prop) {
|
|
|
2025
2025
|
* @returns Promise that resolves when properties are found, or rejects if not found after max retries
|
|
2026
2026
|
*/
|
|
2027
2027
|
const verifyPropertiesPersisted = async (db, modelId, modelName, maxRetries = 10, retryDelay = 100) => {
|
|
2028
|
-
const _mod_0 = await import('./BasePathResolver-
|
|
2029
|
-
const _ns_0 = _mod_0.
|
|
2028
|
+
const _mod_0 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2029
|
+
const _ns_0 = _mod_0.bb;
|
|
2030
2030
|
const modelSchemaMod = _ns_0;
|
|
2031
2031
|
const { properties: propertiesTable } = modelSchemaMod;
|
|
2032
2032
|
const drizzleMod = await import('drizzle-orm');
|
|
@@ -2137,6 +2137,7 @@ function getSchemaContentForComparison(schema) {
|
|
|
2137
2137
|
version: schema.version,
|
|
2138
2138
|
models: {},
|
|
2139
2139
|
enums: schema.enums || {},
|
|
2140
|
+
nameMatch: schema.nameMatch,
|
|
2140
2141
|
};
|
|
2141
2142
|
for (const modelName of Object.keys(schema.models || {}).sort()) {
|
|
2142
2143
|
const model = schema.models[modelName];
|
|
@@ -2150,10 +2151,12 @@ function getSchemaContentForComparison(schema) {
|
|
|
2150
2151
|
refValueType: prop.refValueType ?? items?.type,
|
|
2151
2152
|
model: prop.model ?? items?.model,
|
|
2152
2153
|
storage: prop.storage,
|
|
2154
|
+
nameMatch: prop.nameMatch,
|
|
2153
2155
|
};
|
|
2154
2156
|
}
|
|
2155
2157
|
normalized.models[modelName] = {
|
|
2156
2158
|
description: model.description,
|
|
2159
|
+
nameMatch: model.nameMatch,
|
|
2157
2160
|
properties: props,
|
|
2158
2161
|
};
|
|
2159
2162
|
}
|
|
@@ -2215,6 +2218,7 @@ const transformImportToSchemaFile = (importData, version = 1) => {
|
|
|
2215
2218
|
$schema: 'https://seedprotocol.org/schemas/data-model/v1',
|
|
2216
2219
|
version,
|
|
2217
2220
|
id: schemaId,
|
|
2221
|
+
...(importData.nameMatch !== undefined && { nameMatch: importData.nameMatch }),
|
|
2218
2222
|
metadata: {
|
|
2219
2223
|
name: importData.name,
|
|
2220
2224
|
createdAt: now,
|
|
@@ -2262,6 +2266,7 @@ const parseJsonImportContent = (content) => {
|
|
|
2262
2266
|
const models = normalizeSchemaModels(data.models);
|
|
2263
2267
|
return {
|
|
2264
2268
|
name: schemaName,
|
|
2269
|
+
...(data.nameMatch !== undefined && { nameMatch: data.nameMatch }),
|
|
2265
2270
|
models,
|
|
2266
2271
|
};
|
|
2267
2272
|
}
|
|
@@ -2413,8 +2418,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
2413
2418
|
// Check DB for existing schema by name+version (same as minimal path)
|
|
2414
2419
|
const db = BaseDb.getAppDb();
|
|
2415
2420
|
if (db) {
|
|
2416
|
-
const _mod_1 = await import('./BasePathResolver-
|
|
2417
|
-
const _ns_1 = _mod_1.
|
|
2421
|
+
const _mod_1 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2422
|
+
const _ns_1 = _mod_1.bd;
|
|
2418
2423
|
const schemaSchemaMod = _ns_1;
|
|
2419
2424
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
2420
2425
|
const drizzleMod = await import('drizzle-orm');
|
|
@@ -2498,8 +2503,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
2498
2503
|
// For minimal imports: check DB for existing schema before creating new file
|
|
2499
2504
|
const db = BaseDb.getAppDb();
|
|
2500
2505
|
if (db) {
|
|
2501
|
-
const _mod_2 = await import('./BasePathResolver-
|
|
2502
|
-
const _ns_2 = _mod_2.
|
|
2506
|
+
const _mod_2 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2507
|
+
const _ns_2 = _mod_2.bd;
|
|
2503
2508
|
const schemaSchemaMod = _ns_2;
|
|
2504
2509
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
2505
2510
|
const drizzleMod = await import('drizzle-orm');
|
|
@@ -2576,6 +2581,7 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
2576
2581
|
}
|
|
2577
2582
|
}
|
|
2578
2583
|
warnOnEasNameCollisions(schemaFile);
|
|
2584
|
+
warnOnInvalidNameMatch(schemaFile);
|
|
2579
2585
|
// Check if this is an internal SDK schema (should not create files in app directory)
|
|
2580
2586
|
const isInternal = isInternalSchema(schemaFile.metadata.name, schemaFile.id);
|
|
2581
2587
|
if (isInternal) {
|
|
@@ -2678,8 +2684,8 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
2678
2684
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
2679
2685
|
};
|
|
2680
2686
|
// Use dynamic import to break circular dependency
|
|
2681
|
-
const _mod_3 = await import('./BasePathResolver-
|
|
2682
|
-
const _ns_3 = _mod_3.
|
|
2687
|
+
const _mod_3 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2688
|
+
const _ns_3 = _mod_3.bg;
|
|
2683
2689
|
const dbMod = _ns_3;
|
|
2684
2690
|
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
2685
2691
|
// Try to add schema and models to database if database is available
|
|
@@ -2700,12 +2706,12 @@ async function importJsonSchema(importFilePathOrContents, version = 1) {
|
|
|
2700
2706
|
});
|
|
2701
2707
|
// Verify expected models are linked (single attempt - addModelsToDb already confirmed)
|
|
2702
2708
|
const expectedModelNames = Object.keys(schemaFile.models || {});
|
|
2703
|
-
const _mod_4 = await import('./BasePathResolver-
|
|
2704
|
-
const _ns_4 = _mod_4.
|
|
2709
|
+
const _mod_4 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2710
|
+
const _ns_4 = _mod_4.be;
|
|
2705
2711
|
const modelSchemaSchemaMod = _ns_4;
|
|
2706
2712
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
2707
|
-
const _mod_5 = await import('./BasePathResolver-
|
|
2708
|
-
const _ns_5 = _mod_5.
|
|
2713
|
+
const _mod_5 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2714
|
+
const _ns_5 = _mod_5.bb;
|
|
2709
2715
|
const modelSchemaMod = _ns_5;
|
|
2710
2716
|
const { models: modelsTable } = modelSchemaMod;
|
|
2711
2717
|
const drizzleMod = await import('drizzle-orm');
|
|
@@ -2903,14 +2909,15 @@ async function applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, prope
|
|
|
2903
2909
|
createdAt: new Date(schemaFile.metadata.createdAt).getTime(),
|
|
2904
2910
|
updatedAt: new Date(schemaFile.metadata.updatedAt).getTime(),
|
|
2905
2911
|
};
|
|
2906
|
-
const _mod_6 = await import('./BasePathResolver-
|
|
2907
|
-
const _ns_6 = _mod_6.
|
|
2912
|
+
const _mod_6 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
2913
|
+
const _ns_6 = _mod_6.bg;
|
|
2908
2914
|
const dbMod = _ns_6;
|
|
2909
2915
|
const { addSchemaToDb, addModelsToDb } = dbMod;
|
|
2910
2916
|
const db = BaseDb.getAppDb();
|
|
2911
2917
|
if (!db) {
|
|
2912
2918
|
throw new Error('Database not found');
|
|
2913
2919
|
}
|
|
2920
|
+
warnOnInvalidNameMatch(schemaFile);
|
|
2914
2921
|
const schemaData = JSON.stringify(schemaFile, null, 2);
|
|
2915
2922
|
const schemaRecord = await addSchemaToDb(schemaInput, schemaFile.id, schemaData, false);
|
|
2916
2923
|
if (Object.keys(modelDefinitions).length > 0) {
|
|
@@ -3071,12 +3078,12 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
3071
3078
|
]));
|
|
3072
3079
|
const { schemaRecord } = await applySchemaToDb(schemaFile, modelDefinitions, modelFileIds, propertyFileIds, propertyDefinitions);
|
|
3073
3080
|
// Query the database to get model IDs that were just created
|
|
3074
|
-
const _mod_7 = await import('./BasePathResolver-
|
|
3075
|
-
const _ns_7 = _mod_7.
|
|
3081
|
+
const _mod_7 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
3082
|
+
const _ns_7 = _mod_7.be;
|
|
3076
3083
|
const modelSchemaSchemaMod = _ns_7;
|
|
3077
3084
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
3078
|
-
const _mod_8 = await import('./BasePathResolver-
|
|
3079
|
-
const _ns_8 = _mod_8.
|
|
3085
|
+
const _mod_8 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
3086
|
+
const _ns_8 = _mod_8.bb;
|
|
3080
3087
|
const modelSchemaMod = _ns_8;
|
|
3081
3088
|
const { models: modelsTable } = modelSchemaMod;
|
|
3082
3089
|
const drizzleMod = await import('drizzle-orm');
|
|
@@ -3141,8 +3148,8 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
3141
3148
|
// After properties are created (file path), ensure schemaFile has the correct IDs from database
|
|
3142
3149
|
// Query the database to get the actual schemaFileId values that were used
|
|
3143
3150
|
// This ensures schemaData matches what's actually in the database
|
|
3144
|
-
const _mod_9 = await import('./BasePathResolver-
|
|
3145
|
-
const _ns_9 = _mod_9.
|
|
3151
|
+
const _mod_9 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
3152
|
+
const _ns_9 = _mod_9.bb;
|
|
3146
3153
|
const modelSchemaMod2 = _ns_9;
|
|
3147
3154
|
const { properties: propertiesTable } = modelSchemaMod2;
|
|
3148
3155
|
let schemaFileUpdated = false;
|
|
@@ -3177,14 +3184,15 @@ const loadSchemaFromFile = async (schemaFilePath) => {
|
|
|
3177
3184
|
// This is important even if nothing changed, to ensure consistency
|
|
3178
3185
|
const updatedSchemaData = JSON.stringify(schemaFile, null, 2);
|
|
3179
3186
|
// Update the schema record in the database with current schemaData
|
|
3180
|
-
const _mod_10 = await import('./BasePathResolver-
|
|
3181
|
-
const _ns_10 = _mod_10.
|
|
3187
|
+
const _mod_10 = await import('./BasePathResolver-CsZHPrk9.js');
|
|
3188
|
+
const _ns_10 = _mod_10.bd;
|
|
3182
3189
|
const schemaSchemaMod = _ns_10;
|
|
3183
3190
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
3184
3191
|
await db
|
|
3185
3192
|
.update(schemasTable)
|
|
3186
3193
|
.set({ schemaData: updatedSchemaData })
|
|
3187
3194
|
.where(eq(schemasTable.id, schemaRecord.id));
|
|
3195
|
+
clearNameMatchLevels();
|
|
3188
3196
|
if (schemaFileUpdated) {
|
|
3189
3197
|
logger$5(`Updated schemaData in database with actual property IDs for schema "${schemaName}"`);
|
|
3190
3198
|
}
|
|
@@ -3287,7 +3295,7 @@ const jsonPropertiesToSchemaProperties = (modelName, modelDef, propertyFileIds)
|
|
|
3287
3295
|
*/
|
|
3288
3296
|
const createModelFromJson = async (modelName, modelDef, schemaName, modelFileId, // Optional modelFileId from JSON file
|
|
3289
3297
|
propertyFileIds) => {
|
|
3290
|
-
const _mod_11 = await import('./errors-
|
|
3298
|
+
const _mod_11 = await import('./errors-CWKup8tw.js');
|
|
3291
3299
|
const _ns_11 = _mod_11.h;
|
|
3292
3300
|
const modelMod = _ns_11;
|
|
3293
3301
|
const { Model } = modelMod;
|
|
@@ -4271,8 +4279,8 @@ const logger$1 = debug('seedSdk:db:canonicalizeModelTypes');
|
|
|
4271
4279
|
* EAS name of the model (ADR 0008): `html_page` for HTMLPage. Rows written before that hold other
|
|
4272
4280
|
* forms: drizzle's snake_case for local seeds (`image_v_2`), or the name an older SDK published,
|
|
4273
4281
|
* for synced ones (`htmlpage`). This rewrites each stored type that matches exactly one local model
|
|
4274
|
-
* name (in the tightest tier, as sync matches) to that model's type.
|
|
4275
|
-
* several, are left alone. Returns the number of types rewritten.
|
|
4282
|
+
* name (in the tightest tier its nameMatch level allows, as sync matches) to that model's type.
|
|
4283
|
+
* Types matching no model, or several, are left alone. Returns the number of types rewritten.
|
|
4276
4284
|
*/
|
|
4277
4285
|
async function canonicalizeModelTypes() {
|
|
4278
4286
|
const appDb = BaseDb.getAppDb();
|
|
@@ -4281,6 +4289,8 @@ async function canonicalizeModelTypes() {
|
|
|
4281
4289
|
.filter(Boolean);
|
|
4282
4290
|
if (modelNames.length === 0)
|
|
4283
4291
|
return 0;
|
|
4292
|
+
// Each model name at its nameMatch level (ADR 0009). Read fresh: this runs after a schema load.
|
|
4293
|
+
const levels = await loadNameMatchLevels(appDb);
|
|
4284
4294
|
const storedTypes = new Set();
|
|
4285
4295
|
const collect = (rows) => {
|
|
4286
4296
|
for (const row of rows)
|
|
@@ -4292,7 +4302,7 @@ async function canonicalizeModelTypes() {
|
|
|
4292
4302
|
collect(await appDb.selectDistinct({ type: metadata$1.modelType }).from(metadata$1).where(isNotNull(metadata$1.modelType)));
|
|
4293
4303
|
let rewritten = 0;
|
|
4294
4304
|
for (const type of storedTypes) {
|
|
4295
|
-
const canonical = new Set([...localNamesInBestMatchTier(type, modelNames)].map((name) => easName(name)));
|
|
4305
|
+
const canonical = new Set([...localNamesInBestMatchTier(type, modelNames, { level: (name) => levels.model(name) })].map((name) => easName(name)));
|
|
4296
4306
|
if (canonical.size !== 1)
|
|
4297
4307
|
continue;
|
|
4298
4308
|
const [next] = canonical;
|
|
@@ -5514,5 +5524,5 @@ var ClientManager$1 = /*#__PURE__*/Object.freeze({
|
|
|
5514
5524
|
getClient: getClient
|
|
5515
5525
|
});
|
|
5516
5526
|
|
|
5517
|
-
export { requestEasSyncFromModelsInit as A, sendEasSyncClientRequest as B, ClientManager as C, setRetriesWhenOnlineEnabled as D, EAS_CHAIN_ID_APP_STATE_KEY as E, startEasSyncActor as F, unregisterSeedQueryLocalSource as G, createModelsFromJson as H, INIT_CONFIG_CONFLICT_MESSAGE as I, getLatestSchemaVersion as J, jsonPropertiesToSchemaProperties as K, schema as L, ClientManager$1 as M, SEEDPROTOCOL_Seed_Protocol_v1 as S,
|
|
5518
|
-
//# sourceMappingURL=ClientManager-
|
|
5527
|
+
export { requestEasSyncFromModelsInit as A, sendEasSyncClientRequest as B, ClientManager as C, setRetriesWhenOnlineEnabled as D, EAS_CHAIN_ID_APP_STATE_KEY as E, startEasSyncActor as F, unregisterSeedQueryLocalSource as G, createModelsFromJson as H, INIT_CONFIG_CONFLICT_MESSAGE as I, getLatestSchemaVersion as J, jsonPropertiesToSchemaProperties as K, schema as L, ClientManager$1 as M, SEEDPROTOCOL_Seed_Protocol_v1 as S, importJsonSchema as a, assertLocalDbChain as b, convertVerbatimItemStorageRow as c, getContentHash as d, claimUnpublishedDrafts as e, createLocalQueryDataSource as f, getRefValueType as g, createSchema as h, isVerbatimItemStorageDraftRow as i, easSyncActor as j, getClient as k, loadSchemaFromFile as l, getPublishedSeedRecord as m, getSchemaNameFromId as n, isSeedQueryLocalSourceRegistered as o, listCompleteSchemaFiles as p, loadAllSchemasFromDb as q, readJsonImportFile as r, syncSchemaFromSource as s, transformImportToSchemaFile as t, mergeEasSyncRequestIntents as u, readSchema as v, waitForEasReadChain as w, registerSeedQueryLocalSource as x, requestEasSyncFromAddressChange as y, requestEasSyncFromEventBus as z };
|
|
5528
|
+
//# sourceMappingURL=ClientManager-DETTj0_z.js.map
|