@seedprotocol/sdk 0.7.9 → 0.7.10-next.1344.g3828e8a
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 +1 -1
- package/dist/{BaseFileManager-BAlySv8w.js → BaseFileManager-DLou1TZS.js} +5 -1
- package/dist/BaseFileManager-DLou1TZS.js.map +1 -0
- package/dist/{Item-Bf4kWKpH.js → Item-CXLcIHsi.js} +559 -346
- package/dist/Item-CXLcIHsi.js.map +1 -0
- package/dist/{ModelProperty-BlaEgb_U.js → ModelProperty-B3mfR6u4.js} +35 -35
- package/dist/{ModelProperty-BlaEgb_U.js.map → ModelProperty-B3mfR6u4.js.map} +1 -1
- package/dist/{Schema-J_1f6p0c.js → Schema-BeUyEmte.js} +18 -18
- package/dist/{Schema-J_1f6p0c.js.map → Schema-BeUyEmte.js.map} +1 -1
- package/dist/{SchemaValidationService-CnmKyzR-.js → SchemaValidationService-C1xqJFxI.js} +5 -5
- package/dist/{SchemaValidationService-CnmKyzR-.js.map → SchemaValidationService-C1xqJFxI.js.map} +1 -1
- package/dist/{errors-C1qUEZ7A.js → browserSupport-C64rX-2I.js} +38 -2
- package/dist/browserSupport-C64rX-2I.js.map +1 -0
- package/dist/{configurePlatform-CiOJ1R3q.js → configurePlatform-WkmvqeTO.js} +2 -2
- package/dist/{configurePlatform-CiOJ1R3q.js.map → configurePlatform-WkmvqeTO.js.map} +1 -1
- package/dist/{detachRowsBeforeDelete-sEaUwlOU.js → detachRowsBeforeDelete-BZr_0iZU.js} +2 -2
- package/dist/{detachRowsBeforeDelete-sEaUwlOU.js.map → detachRowsBeforeDelete-BZr_0iZU.js.map} +1 -1
- package/dist/dist/{BaseFileManager-BAlySv8w.d.ts → BaseFileManager-DLou1TZS.d.ts} +3 -1
- package/dist/dist/BaseFileManager-DLou1TZS.d.ts.map +1 -0
- package/dist/dist/{configurePlatform-CiOJ1R3q.d.ts → configurePlatform-WkmvqeTO.d.ts} +1 -1
- package/dist/dist/configurePlatform-WkmvqeTO.d.ts.map +1 -0
- package/dist/dist/{index-D0V-mjCV.d.ts → index-BjWk0x4-.d.ts} +1 -1
- package/dist/dist/{index-D0V-mjCV.d.ts.map → index-BjWk0x4-.d.ts.map} +1 -1
- package/dist/dist/{index.node-CYPemH-t.d.ts → index.node-BfiBriEq.d.ts} +7 -1
- package/dist/dist/{index.node-CYPemH-t.d.ts.map → index.node-BfiBriEq.d.ts.map} +1 -1
- package/dist/dist/platform.node.d.ts +2 -2
- package/dist/{eas-wB_fQ8Tc.js → eas-DpHg66jR.js} +5 -5
- package/dist/{eas-wB_fQ8Tc.js.map → eas-DpHg66jR.js.map} +1 -1
- package/dist/{errors-DLSoqSHG.js → errors-DpC9W4i3.js} +84 -45
- package/dist/{errors-DLSoqSHG.js.map → errors-DpC9W4i3.js.map} +1 -1
- package/dist/{getPublishPayload-BnIwpwz1.js → getPublishPayload-yidQCgY_.js} +8 -8
- package/dist/{getPublishPayload-BnIwpwz1.js.map → getPublishPayload-yidQCgY_.js.map} +1 -1
- package/dist/{getPublishPendingDiff-D6_-A5ns.js → getPublishPendingDiff-D__9bh6d.js} +7 -7
- package/dist/{getPublishPendingDiff-D6_-A5ns.js.map → getPublishPendingDiff-D__9bh6d.js.map} +1 -1
- package/dist/{getPublishUploads-sS6JfPgz.js → getPublishUploads-BdZmYCo2.js} +7 -7
- package/dist/{getPublishUploads-sS6JfPgz.js.map → getPublishUploads-BdZmYCo2.js.map} +1 -1
- package/dist/{index-CYGWPoOx.js → index-BMHqJ4kN.js} +7 -7
- package/dist/index-BMHqJ4kN.js.map +1 -0
- package/dist/{index-D0V-mjCV.js → index-BjWk0x4-.js} +2 -2
- package/dist/index-BjWk0x4-.js.map +1 -0
- package/dist/{index-DmTtj1nk.js → index-CVYB2g7a.js} +402 -20
- package/dist/index-CVYB2g7a.js.map +1 -0
- package/dist/{index-BVBmz_cc.js → index-uDLe9y9H.js} +7 -7
- package/dist/index-uDLe9y9H.js.map +1 -0
- package/dist/{index.browser-CUmBVYen.js → index.browser-OACFlpMH.js} +46 -10
- package/dist/index.browser-OACFlpMH.js.map +1 -0
- package/dist/{index.node-CYPemH-t.js → index.node-BfiBriEq.js} +31 -4
- package/dist/index.node-BfiBriEq.js.map +1 -0
- package/dist/main.js +17 -16
- package/dist/main.js.map +1 -1
- package/dist/{modelPropertyRecordSchemas-C7UgA5TH.js → modelPropertyRecordSchemas-BGvtTyaG.js} +5 -5
- package/dist/{modelPropertyRecordSchemas-C7UgA5TH.js.map → modelPropertyRecordSchemas-BGvtTyaG.js.map} +1 -1
- package/dist/node.js +8 -8
- package/dist/platform.browser.js +6 -6
- package/dist/platform.node.js +4 -4
- package/dist/{property-BxUYznH0.js → property-QjljUeb9.js} +8 -8
- package/dist/{property-BxUYznH0.js.map → property-QjljUeb9.js.map} +1 -1
- package/dist/{publishGraph-EcB40Uii.js → publishGraph-CP8IROkb.js} +5 -5
- package/dist/{publishGraph-EcB40Uii.js.map → publishGraph-CP8IROkb.js.map} +1 -1
- package/dist/{readHtmlBodyForStorageSeed-D6KPtWoR.js → readHtmlBodyForStorageSeed-D3OPk2iU.js} +10 -10
- package/dist/{readHtmlBodyForStorageSeed-D6KPtWoR.js.map → readHtmlBodyForStorageSeed-D3OPk2iU.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +26 -5
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +20 -5
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/loadProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/propertyWrite.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/src/archive/exportArchive.d.ts +57 -0
- package/dist/src/archive/exportArchive.d.ts.map +1 -0
- package/dist/src/browser/db/Db.d.ts +5 -0
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts +12 -1
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts +14 -4
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/db/Db/BaseDb.d.ts +2 -0
- package/dist/src/db/Db/BaseDb.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/browserSupport.d.ts +23 -0
- package/dist/src/helpers/browserSupport.d.ts.map +1 -0
- package/dist/src/helpers/cachedPropertyRefresh.d.ts +6 -6
- package/dist/src/helpers/cachedPropertyRefresh.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityCache.d.ts +34 -3
- package/dist/src/helpers/entity/entityCache.d.ts.map +1 -1
- package/dist/src/helpers/entity/entityLifecycle.d.ts +21 -3
- package/dist/src/helpers/entity/entityLifecycle.d.ts.map +1 -1
- package/dist/src/helpers/propertyDefinition.d.ts +2 -0
- package/dist/src/helpers/propertyDefinition.d.ts.map +1 -1
- package/dist/src/helpers/tabCoordinator.d.ts +9 -2
- package/dist/src/helpers/tabCoordinator.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/interfaces/IDb.d.ts +6 -0
- package/dist/src/interfaces/IDb.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts +6 -0
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/outbox/conflicts.d.ts.map +1 -1
- package/dist/src/outbox/outbox.d.ts +6 -0
- package/dist/src/outbox/outbox.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +16 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-CA7PvBgu.js → syncDbWithEas-CDjSNrVR.js} +14 -14
- package/dist/{syncDbWithEas-CA7PvBgu.js.map → syncDbWithEas-CDjSNrVR.js.map} +1 -1
- package/dist/{tabEvents-CaVmngqr.js → tabEvents-BHPY5I08.js} +38 -12
- package/dist/tabEvents-BHPY5I08.js.map +1 -0
- package/dist/{tolerantWebAccess-BJqViq08.js → tolerantWebAccess-hDq9ZGXH.js} +53 -13
- package/dist/tolerantWebAccess-hDq9ZGXH.js.map +1 -0
- package/dist/{updateSeedRevokedAt-BL9Bg-G7.js → updateSeedRevokedAt-BMwBnlnC.js} +3 -3
- package/dist/{updateSeedRevokedAt-BL9Bg-G7.js.map → updateSeedRevokedAt-BMwBnlnC.js.map} +1 -1
- package/package.json +10 -12
- package/dist/BaseFileManager-BAlySv8w.js.map +0 -1
- package/dist/Item-Bf4kWKpH.js.map +0 -1
- package/dist/dist/BaseFileManager-BAlySv8w.d.ts.map +0 -1
- package/dist/dist/configurePlatform-CiOJ1R3q.d.ts.map +0 -1
- package/dist/errors-C1qUEZ7A.js.map +0 -1
- package/dist/index-BVBmz_cc.js.map +0 -1
- package/dist/index-CYGWPoOx.js.map +0 -1
- package/dist/index-D0V-mjCV.js.map +0 -1
- package/dist/index-DmTtj1nk.js.map +0 -1
- package/dist/index.browser-CUmBVYen.js.map +0 -1
- package/dist/index.node-CYPemH-t.js.map +0 -1
- package/dist/tabEvents-CaVmngqr.js.map +0 -1
- package/dist/tolerantWebAccess-BJqViq08.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { fetchEasModelSchemas } from '@seedprotocol/eas';
|
|
2
2
|
export { getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsFromSchemaUids } from '@seedprotocol/eas';
|
|
3
|
-
import { k as localModelSchemaLookups } from './errors-
|
|
3
|
+
import { k as localModelSchemaLookups } from './errors-DpC9W4i3.js';
|
|
4
4
|
import 'xstate';
|
|
5
|
-
import './Item-
|
|
6
|
-
import './tabEvents-
|
|
5
|
+
import './Item-CXLcIHsi.js';
|
|
6
|
+
import './tabEvents-BHPY5I08.js';
|
|
7
7
|
import 'debug';
|
|
8
|
-
import './BaseFileManager-
|
|
8
|
+
import './BaseFileManager-DLou1TZS.js';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import 'drizzle-orm';
|
|
11
11
|
import 'pluralize';
|
|
@@ -29,4 +29,4 @@ import '@seedprotocol/query';
|
|
|
29
29
|
const getModelSchemasFromEas = async (lookups) => fetchEasModelSchemas(lookups ?? (await localModelSchemaLookups()));
|
|
30
30
|
|
|
31
31
|
export { getModelSchemasFromEas };
|
|
32
|
-
//# sourceMappingURL=eas-
|
|
32
|
+
//# sourceMappingURL=eas-DpHg66jR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eas-
|
|
1
|
+
{"version":3,"file":"eas-DpHg66jR.js","sources":["../../src/eas.ts"],"sourcesContent":["// Sync reads EAS through this module so tests can replace these with one `vi.mock('@/eas')`.\nexport {\n getItemVersionsFromEas,\n getItemPropertiesFromEas,\n getSeedsFromSchemaUids,\n} from '@seedprotocol/eas'\n\nimport { fetchEasModelSchemas } from '@seedprotocol/eas'\nimport type { EASSchema, ModelSchemaLookup } from '@seedprotocol/eas'\nimport { localModelSchemaLookups } from '@/db/read/localModelSchemaLookups'\n\n/**\n * The EAS model schemas the local models (or `lookups`) can match; see fetchEasModelSchemas.\n * Init and sync match the result with matchEasModelSchemas and record `model_uids` from it with\n * writeModelUids. Throws when the request fails.\n */\nexport const getModelSchemasFromEas = async (lookups?: readonly ModelSchemaLookup[]): Promise<EASSchema[]> =>\n fetchEasModelSchemas(lookups ?? (await localModelSchemaLookups())) as Promise<EASSchema[]>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAWA;;;;AAIG;MACU,sBAAsB,GAAG,OAAO,OAAsC,KACjF,oBAAoB,CAAC,OAAO,KAAK,MAAM,uBAAuB,EAAE,CAAC;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fromCallback, setup, assign, createActor, waitFor, fromPromise } from 'xstate';
|
|
2
|
-
import { aj as isActorStopped, T as applyContextUpdate, U as isInternalUpdate, ak as differsFromOriginals, X as isEntityTornDown, al as onEntityTeardown, V as evictionLog, Y as sameEntity, Z as DEFAULT_READY_TIMEOUT_MS, _ as waitForEntityReady, $ as createReactiveProxy, a0 as runEntityLoad, a2 as entityStatus, I as Item, a1 as evictEntities, a3 as releaseEntity, a4 as destroyEntity, a7 as modelPropertiesToObject, a5 as EntityCache, a9 as easPropertyNameForPublish, ae as matchMetadataProperty,
|
|
2
|
+
import { aj as isActorStopped, T as applyContextUpdate, U as isInternalUpdate, ak as differsFromOriginals, X as isEntityTornDown, al as onEntityTeardown, V as evictionLog, Y as sameEntity, Z as DEFAULT_READY_TIMEOUT_MS, _ as waitForEntityReady, $ as createReactiveProxy, a0 as runEntityLoad, a2 as entityStatus, I as Item, a1 as evictEntities, a3 as releaseEntity, a4 as destroyEntity, a7 as modelPropertiesToObject, a5 as EntityCache, a9 as easPropertyNameForPublish, ae as matchMetadataProperty, aT as getSeedPublisher, af as metadataRowsOfProperty, ag as METADATA_LATEST_FIRST_ORDER_SQL, aU as deleteStagedFile, aV as storageFileName, aW as STORAGE_SUBDIR, aX as resolveNewSeedFields, aY as lookupPropertySchemaUid, aZ as stageStorageContent, a_ as requireStagedFile, a$ as createSeed, b0 as createMetadata, H as compareMetadataRowsLatestFirst, b1 as storageValueRowOf, t as registerOutboxApplier, r as outboxOpValue, b2 as findSetConflict, b3 as recordPropertyEdit, h as OutboxOpDeferredError, u as startOutbox, i as OutboxOpFailedError, y as OwnershipError, B as isItemOwned, R as getLatestVersionRow, S as parseListPropertyValueFromStorage, at as resolvePublisherFromSeedRow, aE as isLocalUnsealedDraft, b4 as setEntityUnloadGraceMs, b5 as stopOutbox, b6 as evictAllEntities } from './Item-CXLcIHsi.js';
|
|
3
3
|
import debug from 'debug';
|
|
4
|
-
import { B as BaseDb, l as properties, d as models$1, j as modelSchemas, t as schemas, f as easSyncProcesses, a as appState, w as BaseFileManager, b as modelUids, s as seeds, v as versions, m as metadata$1, p as pendingWrites, h as htmlEmbeddedImageCoPublish, e as arweaveL1FinalizeJobs, r as publishProcesses } from './BaseFileManager-
|
|
5
|
-
import {
|
|
4
|
+
import { B as BaseDb, l as properties, d as models$1, j as modelSchemas, t as schemas, f as easSyncProcesses, a as appState, w as BaseFileManager, b as modelUids, s as seeds, v as versions, m as metadata$1, p as pendingWrites, h as htmlEmbeddedImageCoPublish, e as arweaveL1FinalizeJobs, r as publishProcesses } from './BaseFileManager-DLou1TZS.js';
|
|
5
|
+
import { aI as writeModelToDb, aJ as writePropertyToDb, m as generateId, p as isInternalSchema, A as AmbiguousModelError, aK as currentNameMatchLevels, aL as renameModelInDb, s as isClientReady, a as TProperty, ay as withDbTabLock, af as MachineIds, ap as isLeaderTab, aM as postTabMessage, aN as onTabMessage, ax as whenLeaderTab, aO as listenForOtherTabsEvents, F as isBrowser, $ as isNode, aP as startTabCoordination, aq as normalizeAddressConfig, aQ as isTestOrSeedDev, L as nameMatchLevels, C as loadNameMatchLevels, aD as withSeedDbLock, q as inDefinitionsTransaction, aR as insertModelStubs, G as emitAcrossTabs, a8 as ADDRESSES_PERSISTED_EVENT, ar as normalizeAddressList, aS as warnOnInvalidNameMatch, u as upsertSchemaRow, aT as refreshCachedProperties, g as normalizePropertyRecordSchema, M as ModelPropertyDataTypes, j as findSeedRow, aU as tryWithTabLock, Y as getItemStorageSubdir, _ as getItemStorageLocalFileName, aV as notifyFileSaved, ad as ImageSize, n as normalizeDataType, ab as ClientManagerState, aW as ClientManagerEvents, at as parseAddressesPersistedPayload, x as normalizePublisher, w as writeInBatches, K as selectInBatches, ae as LOCAL_COPIES_REMOVED_EVENT, aX as getWatchedAddressesFromDb, aY as getOwnedAddressesFromDb, aZ as CLIENT_NOT_INITIALIZED, a_ as stopTabCoordination, a$ as registerClientActor } from './tabEvents-BHPY5I08.js';
|
|
6
6
|
import { seedGatewayConfigFromSeedConfig, setPreferredArweaveReadBaseUrls, resolveSeedGatewayEndpoints, setResolvedSeedGatewayEndpoints, BaseArweaveClient, ensureReadGatewaySelected, DEFAULT_ARWEAVE_HOST } from '@seedprotocol/arweave';
|
|
7
7
|
import 'pluralize';
|
|
8
8
|
import { localNamesInBestMatchTier, configureEasReadChain, matchEasModelSchemas, whenEasReadChainSettled, getEasReadChainId, DEFAULT_EAS_CHAIN_ID, isEasReadChainConfigured, easName, isValidEasAttestationUid } from '@seedprotocol/eas';
|
|
@@ -36,10 +36,10 @@ const validateModel = fromCallback(({ sendBack, input: { context }, self }) => {
|
|
|
36
36
|
const _validateModel = async () => {
|
|
37
37
|
try {
|
|
38
38
|
// Use dynamic imports to break circular dependencies
|
|
39
|
-
const validationServiceMod = await import('./SchemaValidationService-
|
|
39
|
+
const validationServiceMod = await import('./SchemaValidationService-C1xqJFxI.js');
|
|
40
40
|
const { SchemaValidationService } = validationServiceMod;
|
|
41
41
|
const validationService = new SchemaValidationService();
|
|
42
|
-
const _mod_0 = await import('./Schema-
|
|
42
|
+
const _mod_0 = await import('./Schema-BeUyEmte.js');
|
|
43
43
|
const _ns_0 = _mod_0.a;
|
|
44
44
|
const schemaMod = _ns_0;
|
|
45
45
|
const { Schema } = schemaMod;
|
|
@@ -320,7 +320,7 @@ async function createModelProperties(model, propertyDefinitions) {
|
|
|
320
320
|
throw new Error('Model ID, file ID, and name are required to create properties');
|
|
321
321
|
}
|
|
322
322
|
logger$f(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
323
|
-
const { ModelProperty } = await import('./ModelProperty-
|
|
323
|
+
const { ModelProperty } = await import('./ModelProperty-B3mfR6u4.js');
|
|
324
324
|
const { and, eq } = await import('drizzle-orm');
|
|
325
325
|
const db = BaseDb.getAppDb();
|
|
326
326
|
for (const [propName, propData] of Object.entries(propertyDefinitions)) {
|
|
@@ -338,8 +338,8 @@ async function createModelProperties(model, propertyDefinitions) {
|
|
|
338
338
|
: undefined;
|
|
339
339
|
// Otherwise use provided ID or generate a random one
|
|
340
340
|
// IDs should be generated in the import process before creating properties
|
|
341
|
-
const _mod_1 = await import('./tabEvents-
|
|
342
|
-
const _ns_1 = _mod_1.
|
|
341
|
+
const _mod_1 = await import('./tabEvents-BHPY5I08.js');
|
|
342
|
+
const _ns_1 = _mod_1.bl;
|
|
343
343
|
const { generateId } = _ns_1;
|
|
344
344
|
const propertyFileId = propData.id || propertyRecord?.schemaFileId || generateId();
|
|
345
345
|
logger$f(`Creating property "${propName}" with fileId "${propertyFileId}"`);
|
|
@@ -356,8 +356,8 @@ async function createModelProperties(model, propertyDefinitions) {
|
|
|
356
356
|
}
|
|
357
357
|
else if (refModelName) {
|
|
358
358
|
// Fallback: resolve the ref by name within this model's schema
|
|
359
|
-
const _mod_2 = await import('./tabEvents-
|
|
360
|
-
const _ns_2 = _mod_2.
|
|
359
|
+
const _mod_2 = await import('./tabEvents-BHPY5I08.js');
|
|
360
|
+
const _ns_2 = _mod_2.bh;
|
|
361
361
|
const { resolveModelRecord } = _ns_2;
|
|
362
362
|
const refModelRecord = await resolveModelRecord(refModelName, { schemaName }, db);
|
|
363
363
|
if (refModelRecord?.id) {
|
|
@@ -452,7 +452,7 @@ const write = async (input) => {
|
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
454
|
// Imported here: the validation service imports the Schema barrel, which imports this module's callers
|
|
455
|
-
const { SchemaValidationService } = await import('./SchemaValidationService-
|
|
455
|
+
const { SchemaValidationService } = await import('./SchemaValidationService-C1xqJFxI.js');
|
|
456
456
|
const data = input.data();
|
|
457
457
|
const { errors } = new SchemaValidationService().validatePropertyStructure(data);
|
|
458
458
|
if (errors.length > 0) {
|
|
@@ -613,7 +613,7 @@ const createPropertyInstances = async (propertyFileIds, since) => {
|
|
|
613
613
|
return;
|
|
614
614
|
}
|
|
615
615
|
try {
|
|
616
|
-
const mod = await import('./ModelProperty-
|
|
616
|
+
const mod = await import('./ModelProperty-B3mfR6u4.js');
|
|
617
617
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
618
618
|
if (!ModelProperty) {
|
|
619
619
|
logger$d('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -684,10 +684,10 @@ async function loadModel(context, isStopped) {
|
|
|
684
684
|
if (!modelRecord) {
|
|
685
685
|
// Model names are only unique per schema: prefer this schema's row, and otherwise only
|
|
686
686
|
// consider same-name rows that no schema claims yet (never another schema's model).
|
|
687
|
-
const _mod_3 = await import('./BaseFileManager-
|
|
687
|
+
const _mod_3 = await import('./BaseFileManager-DLou1TZS.js');
|
|
688
688
|
const _ns_3 = _mod_3.M;
|
|
689
689
|
const { modelSchemas } = _ns_3;
|
|
690
|
-
const _mod_4 = await import('./BaseFileManager-
|
|
690
|
+
const _mod_4 = await import('./BaseFileManager-DLou1TZS.js');
|
|
691
691
|
const _ns_4 = _mod_4.z;
|
|
692
692
|
const { schemas: schemasTable } = _ns_4;
|
|
693
693
|
let dbModels = await db
|
|
@@ -827,7 +827,7 @@ async function loadModel(context, isStopped) {
|
|
|
827
827
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
828
828
|
// This handles the case where model exists in schema file but not yet in database
|
|
829
829
|
try {
|
|
830
|
-
const _mod_5 = await import('./Schema-
|
|
830
|
+
const _mod_5 = await import('./Schema-BeUyEmte.js');
|
|
831
831
|
const _ns_5 = _mod_5.a;
|
|
832
832
|
const { Schema } = _ns_5;
|
|
833
833
|
// Stopped meanwhile (unloaded, or evicted with its schema): don't load the schema again
|
|
@@ -912,11 +912,11 @@ async function loadModel(context, isStopped) {
|
|
|
912
912
|
}
|
|
913
913
|
// Also check database for models (in case they're persisted but not in Schema context)
|
|
914
914
|
if (db) {
|
|
915
|
-
const _mod_6 = await import('./BaseFileManager-
|
|
915
|
+
const _mod_6 = await import('./BaseFileManager-DLou1TZS.js');
|
|
916
916
|
const _ns_6 = _mod_6.M;
|
|
917
917
|
const modelSchemaSchemaMod = _ns_6;
|
|
918
918
|
const { modelSchemas } = modelSchemaSchemaMod;
|
|
919
|
-
const _mod_7 = await import('./BaseFileManager-
|
|
919
|
+
const _mod_7 = await import('./BaseFileManager-DLou1TZS.js');
|
|
920
920
|
const _ns_7 = _mod_7.z;
|
|
921
921
|
const schemaSchemaMod = _ns_7;
|
|
922
922
|
const { schemas: schemasTable } = schemaSchemaMod;
|
|
@@ -995,7 +995,7 @@ async function loadModel(context, isStopped) {
|
|
|
995
995
|
}
|
|
996
996
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
997
997
|
try {
|
|
998
|
-
const _mod_8 = await import('./Schema-
|
|
998
|
+
const _mod_8 = await import('./Schema-BeUyEmte.js');
|
|
999
999
|
const _ns_8 = _mod_8.a;
|
|
1000
1000
|
const { Schema } = _ns_8;
|
|
1001
1001
|
if (!isStopped()) {
|
|
@@ -1089,7 +1089,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
1089
1089
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
1090
1090
|
// Eagerly start loading to minimize delay on first access
|
|
1091
1091
|
let ModelPropertyClass = null;
|
|
1092
|
-
const modelPropertyImportPromise = import('./ModelProperty-
|
|
1092
|
+
const modelPropertyImportPromise = import('./ModelProperty-B3mfR6u4.js')
|
|
1093
1093
|
.then(module => {
|
|
1094
1094
|
ModelPropertyClass = module.ModelProperty;
|
|
1095
1095
|
return ModelPropertyClass;
|
|
@@ -1579,8 +1579,8 @@ class Model {
|
|
|
1579
1579
|
if (db) {
|
|
1580
1580
|
const since = evictionLog.now();
|
|
1581
1581
|
try {
|
|
1582
|
-
const _mod_9 = await import('./tabEvents-
|
|
1583
|
-
const _ns_9 = _mod_9.
|
|
1582
|
+
const _mod_9 = await import('./tabEvents-BHPY5I08.js');
|
|
1583
|
+
const _ns_9 = _mod_9.bh;
|
|
1584
1584
|
const { resolveModelRecord, getModelSchemaName } = _ns_9;
|
|
1585
1585
|
const resolved = scope.modelFileId
|
|
1586
1586
|
? await resolveModelRecord(undefined, { modelFileId: scope.modelFileId }, db)
|
|
@@ -1626,8 +1626,8 @@ class Model {
|
|
|
1626
1626
|
}
|
|
1627
1627
|
const since = options?.since ?? evictionLog.now();
|
|
1628
1628
|
try {
|
|
1629
|
-
const _mod_10 = await import('./tabEvents-
|
|
1630
|
-
const _ns_10 = _mod_10.
|
|
1629
|
+
const _mod_10 = await import('./tabEvents-BHPY5I08.js');
|
|
1630
|
+
const _ns_10 = _mod_10.bh;
|
|
1631
1631
|
const { resolveModelRecord, getModelSchemaName } = _ns_10;
|
|
1632
1632
|
const resolved = await resolveModelRecord(modelName, schemaName ? { schemaName, strict: true } : {}, db);
|
|
1633
1633
|
if (!resolved?.schemaFileId) {
|
|
@@ -2099,9 +2099,9 @@ class Model {
|
|
|
2099
2099
|
.limit(1);
|
|
2100
2100
|
if (modelRecord) {
|
|
2101
2101
|
const modelId = modelRecord.id;
|
|
2102
|
-
const { detachModelRows } = await import('./detachRowsBeforeDelete-
|
|
2103
|
-
const _mod_11 = await import('./tabEvents-
|
|
2104
|
-
const _ns_11 = _mod_11.
|
|
2102
|
+
const { detachModelRows } = await import('./detachRowsBeforeDelete-BZr_0iZU.js');
|
|
2103
|
+
const _mod_11 = await import('./tabEvents-BHPY5I08.js');
|
|
2104
|
+
const _ns_11 = _mod_11.bj;
|
|
2105
2105
|
const { inDefinitionsTransaction } = _ns_11;
|
|
2106
2106
|
// The model's rows go together or not at all
|
|
2107
2107
|
await inDefinitionsTransaction(async (tx) => {
|
|
@@ -2117,7 +2117,7 @@ class Model {
|
|
|
2117
2117
|
getModelProperty()?.evictForModel({ modelName, schemaName, modelId: dbId });
|
|
2118
2118
|
if (schemaName && modelName) {
|
|
2119
2119
|
// Imported here, not at module load: Model and Schema import each other.
|
|
2120
|
-
const _mod_12 = await import('./Schema-
|
|
2120
|
+
const _mod_12 = await import('./Schema-BeUyEmte.js');
|
|
2121
2121
|
const _ns_12 = _mod_12.a;
|
|
2122
2122
|
const { Schema } = _ns_12;
|
|
2123
2123
|
const schema = await Schema.find({ schemaName, waitForReady: false, hold: false });
|
|
@@ -2156,8 +2156,8 @@ class Model {
|
|
|
2156
2156
|
return undefined;
|
|
2157
2157
|
}
|
|
2158
2158
|
// Model names are only unique per schema: find this model's row by its id (schemaFileId).
|
|
2159
|
-
const _mod_13 = await import('./tabEvents-
|
|
2160
|
-
const _ns_13 = _mod_13.
|
|
2159
|
+
const _mod_13 = await import('./tabEvents-BHPY5I08.js');
|
|
2160
|
+
const _ns_13 = _mod_13.bh;
|
|
2161
2161
|
const { resolveModelRecord } = _ns_13;
|
|
2162
2162
|
const modelRecord = await resolveModelRecord(modelName, { modelFileId: context.id, schemaName: context.schemaName }, db);
|
|
2163
2163
|
if (!modelRecord?.id) {
|
|
@@ -2534,7 +2534,7 @@ function toRunSyncArg(options) {
|
|
|
2534
2534
|
return undefined;
|
|
2535
2535
|
}
|
|
2536
2536
|
const runEasSync = fromPromise(async ({ input, }) => {
|
|
2537
|
-
const { runSyncFromEas } = await import('./syncDbWithEas-
|
|
2537
|
+
const { runSyncFromEas } = await import('./syncDbWithEas-CDjSNrVR.js');
|
|
2538
2538
|
// Sync checks for rows and then inserts the rest (no unique index on uids), so syncs in
|
|
2539
2539
|
// different tabs take turns. A sync can run for minutes, so wait without a timeout.
|
|
2540
2540
|
await withDbTabLock('eas-sync', async () => {
|
|
@@ -2867,7 +2867,7 @@ async function platformClassesInit({ event }) {
|
|
|
2867
2867
|
if (!config) {
|
|
2868
2868
|
throw new Error('client.init requires a config');
|
|
2869
2869
|
}
|
|
2870
|
-
const { configurePlatform } = await import('./configurePlatform-
|
|
2870
|
+
const { configurePlatform } = await import('./configurePlatform-WkmvqeTO.js');
|
|
2871
2871
|
if (isBrowser()) {
|
|
2872
2872
|
const { createPlatformServices } = await import('./platform.browser.js');
|
|
2873
2873
|
configurePlatform(createPlatformServices());
|
|
@@ -3154,7 +3154,7 @@ async function addModelsToDb(context) {
|
|
|
3154
3154
|
timeout = setTimeout(() => reject(new Error('EAS query timeout after 10 seconds')), 10000);
|
|
3155
3155
|
});
|
|
3156
3156
|
// The lookup and the model_uids rule sync uses too (each name at its nameMatch level).
|
|
3157
|
-
const { getModelSchemasFromEas } = await import('./eas-
|
|
3157
|
+
const { getModelSchemasFromEas } = await import('./eas-DpHg66jR.js');
|
|
3158
3158
|
const lookups = await localModelSchemaLookups([...modelNamesWithRows]);
|
|
3159
3159
|
// Cleared, so a finished lookup doesn't keep a Node process alive for 10 s.
|
|
3160
3160
|
const schemas = await Promise.race([getModelSchemasFromEas(lookups), timeoutPromise]).finally(() => clearTimeout(timeout));
|
|
@@ -3737,7 +3737,7 @@ function schemaFilePropertyDefinition(modelName, propName, prop) {
|
|
|
3737
3737
|
dataType: def.dataType,
|
|
3738
3738
|
ref: hasRef ? def.ref : undefined,
|
|
3739
3739
|
refModelName: hasRef ? def.refModelName : undefined,
|
|
3740
|
-
refValueType:
|
|
3740
|
+
refValueType: hasRef ? def.refValueType : undefined,
|
|
3741
3741
|
storageType: def.storageType,
|
|
3742
3742
|
localStorageDir: def.localStorageDir,
|
|
3743
3743
|
filenameSuffix: def.filenameSuffix,
|
|
@@ -3871,8 +3871,8 @@ async function applySchemaFile(source, options = {}) {
|
|
|
3871
3871
|
if (!schemaRecord) {
|
|
3872
3872
|
warnOnEasNameCollisions(file);
|
|
3873
3873
|
warnOnInvalidNameMatch(file);
|
|
3874
|
-
const _mod_14 = await import('./tabEvents-
|
|
3875
|
-
const _ns_14 = _mod_14.
|
|
3874
|
+
const _mod_14 = await import('./tabEvents-BHPY5I08.js');
|
|
3875
|
+
const _ns_14 = _mod_14.bk;
|
|
3876
3876
|
const { addModelsToDb, broadcastSchemasInvalidate } = _ns_14;
|
|
3877
3877
|
const modelFileIds = new Map(Object.entries(file.models).map(([name, model]) => [name, model.id]));
|
|
3878
3878
|
const propertyDefinitions = schemaFilePropertyDefinitions(file);
|
|
@@ -4023,8 +4023,8 @@ async function resolveSchemaRow(row, db = BaseDb.getAppDb()) {
|
|
|
4023
4023
|
metadata: { ...schema.metadata, name: row.name },
|
|
4024
4024
|
};
|
|
4025
4025
|
if (row.id && db) {
|
|
4026
|
-
const _mod_15 = await import('./tabEvents-
|
|
4027
|
-
const _ns_15 = _mod_15.
|
|
4026
|
+
const _mod_15 = await import('./tabEvents-BHPY5I08.js');
|
|
4027
|
+
const _ns_15 = _mod_15.bk;
|
|
4028
4028
|
const { loadModelsFromDbForSchema, mergeDbModelsIntoSchemaModels } = _ns_15;
|
|
4029
4029
|
const dbModels = await loadModelsFromDbForSchema(row.id, db);
|
|
4030
4030
|
if (Object.keys(dbModels).length > 0) {
|
|
@@ -4603,6 +4603,10 @@ function startCanonicalizeModelTypes() {
|
|
|
4603
4603
|
void runInBackground();
|
|
4604
4604
|
});
|
|
4605
4605
|
}
|
|
4606
|
+
/** Resolves when a background run has finished (at once if none is running). */
|
|
4607
|
+
function whenCanonicalizeModelTypesSettled() {
|
|
4608
|
+
return running ?? Promise.resolve();
|
|
4609
|
+
}
|
|
4606
4610
|
|
|
4607
4611
|
const getVersionData = async ({ localId, seedLocalId, uid, }, db = BaseDb.getAppDb()) => {
|
|
4608
4612
|
const appDb = db;
|
|
@@ -4955,8 +4959,8 @@ async function applyStorageValue(seedLocalId, propertyName, value, db, prepared)
|
|
|
4955
4959
|
const row = prepared
|
|
4956
4960
|
? { ...stored, refResolvedValue: prepared.fileName, schemaUid: prepared.schemaUid, refModelUid: prepared.refModelUid }
|
|
4957
4961
|
: stored;
|
|
4958
|
-
const _mod_16 = await import('./Item-
|
|
4959
|
-
const _ns_16 = _mod_16.
|
|
4962
|
+
const _mod_16 = await import('./Item-CXLcIHsi.js');
|
|
4963
|
+
const _ns_16 = _mod_16.b7;
|
|
4960
4964
|
const { currentPropertyRow } = _ns_16;
|
|
4961
4965
|
const existing = await currentPropertyRow({ seedLocalId }, {
|
|
4962
4966
|
propertyName,
|
|
@@ -5269,8 +5273,8 @@ function startItemOutbox() {
|
|
|
5269
5273
|
return {};
|
|
5270
5274
|
// Cached, shared with item creation, so a save doesn't wait on the EAS indexer each time.
|
|
5271
5275
|
// Not required for the row; publish resolves the schema again.
|
|
5272
|
-
const _mod_17 = await import('./Item-
|
|
5273
|
-
const _ns_17 = _mod_17.
|
|
5276
|
+
const _mod_17 = await import('./Item-CXLcIHsi.js');
|
|
5277
|
+
const _ns_17 = _mod_17.ba;
|
|
5274
5278
|
const { lookupPropertySchemaUid } = _ns_17;
|
|
5275
5279
|
return {
|
|
5276
5280
|
schemaUid: await lookupPropertySchemaUid(op.propertyName, value.propertyRecordSchema),
|
|
@@ -6251,23 +6255,52 @@ const ensureInitialized = () => {
|
|
|
6251
6255
|
};
|
|
6252
6256
|
const CLIENT_ALREADY_STOPPED_WARNING = 'client.stop() or client.unload() was called after the client had already stopped; this call does nothing. ' +
|
|
6253
6257
|
'Remove the extra call, or call client.init() before stopping again.';
|
|
6254
|
-
/**
|
|
6255
|
-
|
|
6258
|
+
/** Set while a stop releases the client's resources; init waits for it. */
|
|
6259
|
+
let stopping;
|
|
6260
|
+
/**
|
|
6261
|
+
* Shared by stop() and unload(). Stops the client in any state, including after a failed or
|
|
6262
|
+
* unfinished init, then releases what it holds: the outbox drain, cached entities, this tab's
|
|
6263
|
+
* leadership and the database (closed, so its file is released). A repeat call after a stop warns
|
|
6264
|
+
* and does nothing.
|
|
6265
|
+
*/
|
|
6266
|
+
const stopClient = async ({ unsubscribe }) => {
|
|
6256
6267
|
if (clientManager.getSnapshot().status === 'stopped') {
|
|
6257
6268
|
console.warn(CLIENT_ALREADY_STOPPED_WARNING);
|
|
6258
6269
|
return;
|
|
6259
6270
|
}
|
|
6260
|
-
ensureInitialized();
|
|
6261
6271
|
activeInitConfig = undefined;
|
|
6262
6272
|
cancelAllRetriesWhenOnline();
|
|
6263
6273
|
unregisterSeedQueryLocalSource();
|
|
6264
6274
|
resetAddressesPersistedAnnouncement();
|
|
6275
|
+
// The next init sets its own period. Instances waiting out this one are evicted with the rest
|
|
6276
|
+
// (releaseClientResources), which cancels their timers.
|
|
6277
|
+
setEntityUnloadGraceMs(undefined);
|
|
6265
6278
|
clientManager.stop();
|
|
6266
6279
|
if (unsubscribe)
|
|
6267
6280
|
subscription.unsubscribe();
|
|
6268
6281
|
notifyServiceListeners();
|
|
6282
|
+
const releasing = releaseClientResources();
|
|
6283
|
+
stopping = releasing;
|
|
6284
|
+
try {
|
|
6285
|
+
await releasing;
|
|
6286
|
+
}
|
|
6287
|
+
finally {
|
|
6288
|
+
if (stopping === releasing)
|
|
6289
|
+
stopping = undefined;
|
|
6290
|
+
}
|
|
6291
|
+
};
|
|
6292
|
+
const releaseClientResources = async () => {
|
|
6293
|
+
await stopOutbox();
|
|
6294
|
+
await whenCanonicalizeModelTypesSettled();
|
|
6295
|
+
// Before the database closes, so their live queries end first.
|
|
6296
|
+
evictAllEntities();
|
|
6297
|
+
stopTabCoordination();
|
|
6298
|
+
await BaseDb.close();
|
|
6269
6299
|
};
|
|
6270
6300
|
const coalescedInit = createCoalescedAsync(async (options) => {
|
|
6301
|
+
// A stop still closing the database: open it again only once that's done.
|
|
6302
|
+
if (stopping)
|
|
6303
|
+
await stopping;
|
|
6271
6304
|
// If the actor is stopped (e.g., from a previous failed test), restart it
|
|
6272
6305
|
const snapshot = clientManager.getSnapshot();
|
|
6273
6306
|
const currentState = snapshot.value;
|
|
@@ -6302,6 +6335,7 @@ const coalescedInit = createCoalescedAsync(async (options) => {
|
|
|
6302
6335
|
}
|
|
6303
6336
|
});
|
|
6304
6337
|
}
|
|
6338
|
+
setEntityUnloadGraceMs(options?.config?.entityCache?.unloadGraceMs);
|
|
6305
6339
|
// The root-level init handler moves to PLATFORM_CLASSES_INIT (stopping any running step) as
|
|
6306
6340
|
// send() returns; the platformClassesInit step fills the context from options.
|
|
6307
6341
|
clientManager.send({ type: 'init', options });
|
|
@@ -6487,7 +6521,12 @@ const clientInstance = {
|
|
|
6487
6521
|
});
|
|
6488
6522
|
return () => subscription.unsubscribe();
|
|
6489
6523
|
},
|
|
6524
|
+
/**
|
|
6525
|
+
* Stops the client, from any state (a failed init too), and closes the database. Resolves once
|
|
6526
|
+
* everything is released; `init` may be called right away and waits for that.
|
|
6527
|
+
*/
|
|
6490
6528
|
stop: () => stopClient({ unsubscribe: false }),
|
|
6529
|
+
/** As `stop`, and also ends the client's internal state subscription. */
|
|
6491
6530
|
unload: () => stopClient({ unsubscribe: true }),
|
|
6492
6531
|
};
|
|
6493
6532
|
// Export the singleton instance
|
|
@@ -6547,4 +6586,4 @@ var errors = /*#__PURE__*/Object.freeze({
|
|
|
6547
6586
|
});
|
|
6548
6587
|
|
|
6549
6588
|
export { sendEasSyncClientRequest as $, waitForEasReadChain as A, assertLocalDbChain as B, ConflictError as C, writeModelUids as D, getContentHash as E, saveDefinition as F, EAS_CHAIN_ID_APP_STATE_KEY as G, INIT_CONFIG_CONFLICT_MESSAGE as H, ItemCreateValidationError as I, ItemCreateError as J, claimUnpublishedDrafts as K, createLocalQueryDataSource as L, Model as M, easSyncActor as N, getClient as O, getPublishedSeedRecord as P, getSchemaNameFromId as Q, RelationTargetError as R, SCHEMA_FILE_FORMAT as S, TModelSchema as T, UnknownModelError as U, isSeedQueryLocalSourceRegistered as V, listCompleteSchemaFiles as W, mergeEasSyncRequestIntents as X, registerSeedQueryLocalSource as Y, requestEasSyncFromAddressChange as Z, requestEasSyncFromModelsInit as _, applyCreateItem as a, setRetriesWhenOnlineEnabled as a0, startEasSyncActor as a1, unregisterSeedQueryLocalSource as a2, saveDefinition$1 as a3, Model$1 as a4, schema as a5, SEEDPROTOCOL_Seed_Protocol_v1 as a6, itemAppliers as a7, errors as a8, applyDelete as b, applyItemStorageValue as c, deleteFiles as d, applyStorageValue as e, TModelValues as f, ClientManager as g, syncSchemaFromSource as h, importJsonSchema as i, transformImportToSchemaFile as j, localModelSchemaLookups as k, loadSchemaFromFile as l, listLatestSchemaFiles as m, readSchemaFile as n, applySchemaFile as o, resolveSchemaRow as p, loadAllSchemasFromDb as q, readJsonImportFile as r, startItemOutbox as s, throwItemWriteError as t, getDraftSaveError as u, queueDraftSave as v, writeNextSchemaVersion as w, setupEntityLiveQuery as x, mergeSchemaFiles as y, trackDraftSave as z };
|
|
6550
|
-
//# sourceMappingURL=errors-
|
|
6589
|
+
//# sourceMappingURL=errors-DpC9W4i3.js.map
|