@seedprotocol/sdk 0.7.9 → 0.7.10-next.1353.g74aeeed
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-oPnmIehk.js} +571 -346
- package/dist/Item-oPnmIehk.js.map +1 -0
- package/dist/{ModelProperty-BlaEgb_U.js → ModelProperty-D2vJozmW.js} +95 -62
- package/dist/ModelProperty-D2vJozmW.js.map +1 -0
- package/dist/{Schema-J_1f6p0c.js → Schema-BMXRF4j9.js} +88 -52
- package/dist/Schema-BMXRF4j9.js.map +1 -0
- package/dist/{SchemaValidationService-CnmKyzR-.js → SchemaValidationService-CieGrj5c.js} +5 -5
- package/dist/{SchemaValidationService-CnmKyzR-.js.map → SchemaValidationService-CieGrj5c.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-FZPPqxqe.js} +5 -5
- package/dist/{eas-wB_fQ8Tc.js.map → eas-FZPPqxqe.js.map} +1 -1
- package/dist/{errors-DLSoqSHG.js → errors-CnT0fSMK.js} +185 -97
- package/dist/errors-CnT0fSMK.js.map +1 -0
- package/dist/{getPublishPayload-BnIwpwz1.js → getPublishPayload-DKuEaq96.js} +8 -8
- package/dist/{getPublishPayload-BnIwpwz1.js.map → getPublishPayload-DKuEaq96.js.map} +1 -1
- package/dist/{getPublishPendingDiff-D6_-A5ns.js → getPublishPendingDiff-CH5xLMjU.js} +7 -7
- package/dist/{getPublishPendingDiff-D6_-A5ns.js.map → getPublishPendingDiff-CH5xLMjU.js.map} +1 -1
- package/dist/{getPublishUploads-sS6JfPgz.js → getPublishUploads-DivYpgNw.js} +7 -7
- package/dist/{getPublishUploads-sS6JfPgz.js.map → getPublishUploads-DivYpgNw.js.map} +1 -1
- package/dist/{index-D0V-mjCV.js → index-BjWk0x4-.js} +2 -2
- package/dist/index-BjWk0x4-.js.map +1 -0
- package/dist/{index-CYGWPoOx.js → index-CZMWKXLM.js} +7 -7
- package/dist/index-CZMWKXLM.js.map +1 -0
- package/dist/{index-BVBmz_cc.js → index-DXRhFg1N.js} +7 -7
- package/dist/index-DXRhFg1N.js.map +1 -0
- package/dist/{index-DmTtj1nk.js → index-Gh42_47r.js} +402 -20
- package/dist/index-Gh42_47r.js.map +1 -0
- package/dist/{index.browser-CUmBVYen.js → index.browser-DQstVvRV.js} +46 -10
- package/dist/index.browser-DQstVvRV.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-DEe-lYhn.js} +5 -5
- package/dist/{modelPropertyRecordSchemas-C7UgA5TH.js.map → modelPropertyRecordSchemas-DEe-lYhn.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-iNW1N3vm.js} +8 -8
- package/dist/{property-BxUYznH0.js.map → property-iNW1N3vm.js.map} +1 -1
- package/dist/{publishGraph-EcB40Uii.js → publishGraph-CRn_N3NT.js} +5 -5
- package/dist/{publishGraph-EcB40Uii.js.map → publishGraph-CRn_N3NT.js.map} +1 -1
- package/dist/{readHtmlBodyForStorageSeed-D6KPtWoR.js → readHtmlBodyForStorageSeed-B7HgPmq6.js} +10 -10
- package/dist/{readHtmlBodyForStorageSeed-D6KPtWoR.js.map → readHtmlBodyForStorageSeed-B7HgPmq6.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/Model/Model.d.ts +45 -34
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/ModelProperty/ModelProperty.d.ts +31 -13
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +36 -27
- package/dist/src/Schema/Schema.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 +45 -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/schemaApply.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-FuyqoEKk.js} +14 -14
- package/dist/{syncDbWithEas-CA7PvBgu.js.map → syncDbWithEas-FuyqoEKk.js.map} +1 -1
- package/dist/{tabEvents-CaVmngqr.js → tabEvents-DT5ez6io.js} +38 -12
- package/dist/tabEvents-DT5ez6io.js.map +1 -0
- package/dist/{tolerantWebAccess-BJqViq08.js → tolerantWebAccess-zEseJ2zT.js} +53 -13
- package/dist/tolerantWebAccess-zEseJ2zT.js.map +1 -0
- package/dist/{updateSeedRevokedAt-BL9Bg-G7.js → updateSeedRevokedAt-B9JRwr5T.js} +3 -3
- package/dist/{updateSeedRevokedAt-BL9Bg-G7.js.map → updateSeedRevokedAt-B9JRwr5T.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/ModelProperty-BlaEgb_U.js.map +0 -1
- package/dist/Schema-J_1f6p0c.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/errors-DLSoqSHG.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,19 +1,19 @@
|
|
|
1
|
-
import { ay as withDbTabLock, az as MIME_TO_EXTENSION, aA as sniffMimeType, ak as contentSha256TagMatches, aB as notifyFilesWrittenOutsideCache, aC as createSessionObjectUrl, aD as withSeedDbLock, aE as countDbStatements, aF as startChangeFeed, aG as countLiveQueryRuns } from './tabEvents-
|
|
2
|
-
import { B as BaseDb, a as appState, w as BaseFileManager, y as withSqliteBusyRetry } from './BaseFileManager-
|
|
1
|
+
import { ay as withDbTabLock, az as MIME_TO_EXTENSION, aA as sniffMimeType, ak as contentSha256TagMatches, aB as notifyFilesWrittenOutsideCache, aC as createSessionObjectUrl, aD as withSeedDbLock, aE as countDbStatements, aF as startChangeFeed, aG as countLiveQueryRuns, aH as stopChangeFeed } from './tabEvents-DT5ez6io.js';
|
|
2
|
+
import { B as BaseDb, a as appState, w as BaseFileManager, y as withSqliteBusyRetry } from './BaseFileManager-DLou1TZS.js';
|
|
3
3
|
import { eq, sql } from 'drizzle-orm';
|
|
4
4
|
import debug from 'debug';
|
|
5
|
-
import { F as FileSystemLockedError, D as DatabaseNotPersistentError } from './
|
|
5
|
+
import { c as checkBrowserSupport, U as UnsupportedBrowserError, F as FileSystemLockedError, D as DatabaseNotPersistentError } from './browserSupport-C64rX-2I.js';
|
|
6
6
|
import { drizzle } from 'drizzle-orm/sqlite-proxy';
|
|
7
7
|
import { sha256 } from '@noble/hashes/sha256';
|
|
8
8
|
import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
|
|
9
9
|
import { DefaultArweaveClient } from '@seedprotocol/arweave';
|
|
10
10
|
import 'pluralize';
|
|
11
11
|
import { DefaultQueryClient, DefaultEasClient } from '@seedprotocol/eas';
|
|
12
|
-
import { s as schema } from './index-
|
|
12
|
+
import { s as schema } from './index-BjWk0x4-.js';
|
|
13
13
|
import { SQLocalDrizzle } from 'sqlocal/drizzle';
|
|
14
14
|
import { r as recreateIfOlderThanMinimumUpgradeVersion } from './minimumUpgradeVersion-BDhHvHtr.js';
|
|
15
15
|
import { throwError, Observable, distinctUntilChanged, finalize, share, ReplaySubject } from 'rxjs';
|
|
16
|
-
import './configurePlatform-
|
|
16
|
+
import './configurePlatform-WkmvqeTO.js';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* String classification for stored values. Each function is self-contained (no imports, no
|
|
@@ -1439,10 +1439,15 @@ class BrowserFileManager {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
1441
|
async initializeFileSystem(_workingDir) {
|
|
1442
|
+
// Before ZenFS loads: an old browser gets one error naming what it lacks. Isolation headers
|
|
1443
|
+
// are reported by DatabaseNotPersistentError, with hosting advice.
|
|
1444
|
+
const missing = checkBrowserSupport().missing.filter((feature) => feature !== 'cross-origin-isolation');
|
|
1445
|
+
if (missing.length)
|
|
1446
|
+
throw new UnsupportedBrowserError(missing);
|
|
1442
1447
|
const zenfs = await this.getFs();
|
|
1443
|
-
const { TolerantWebAccess, TolerantWebAccessFS } = await import('./tolerantWebAccess-
|
|
1444
|
-
const _mod_0 = await import('./tabEvents-
|
|
1445
|
-
const _ns_0 = _mod_0.
|
|
1448
|
+
const { TolerantWebAccess, TolerantWebAccessFS } = await import('./tolerantWebAccess-zEseJ2zT.js');
|
|
1449
|
+
const _mod_0 = await import('./tabEvents-DT5ez6io.js');
|
|
1450
|
+
const _ns_0 = _mod_0.bp;
|
|
1446
1451
|
const { queueFilesChangedNotice } = _ns_0;
|
|
1447
1452
|
const { configureSingle } = zenfs;
|
|
1448
1453
|
const configureRoot = async () => {
|
|
@@ -1510,7 +1515,7 @@ class BrowserFileManager {
|
|
|
1510
1515
|
}
|
|
1511
1516
|
async invalidateNow(filePaths) {
|
|
1512
1517
|
const { mounts } = await this.getFs();
|
|
1513
|
-
const { TolerantWebAccessFS } = await import('./tolerantWebAccess-
|
|
1518
|
+
const { TolerantWebAccessFS } = await import('./tolerantWebAccess-zEseJ2zT.js');
|
|
1514
1519
|
const mounted = mounts.get('/');
|
|
1515
1520
|
if (!(mounted instanceof TolerantWebAccessFS))
|
|
1516
1521
|
return;
|
|
@@ -4723,6 +4728,8 @@ class BrowserDb {
|
|
|
4723
4728
|
constructor() {
|
|
4724
4729
|
/** Live queries by SQL + params while they have subscribers; see liveQuery. */
|
|
4725
4730
|
this.sharedLiveQueries = new Map();
|
|
4731
|
+
/** Bumped by close(), so a prepareDb that was running closes what it opened instead of keeping it. */
|
|
4732
|
+
this.openGeneration = 0;
|
|
4726
4733
|
}
|
|
4727
4734
|
getAppDb() {
|
|
4728
4735
|
return this.appDb;
|
|
@@ -4767,7 +4774,11 @@ class BrowserDb {
|
|
|
4767
4774
|
}
|
|
4768
4775
|
}
|
|
4769
4776
|
async prepareDbLocked(filesDir) {
|
|
4777
|
+
const generation = this.openGeneration;
|
|
4770
4778
|
try {
|
|
4779
|
+
// A database left open by an init that failed after opening it: close it, or this would
|
|
4780
|
+
// start a second SQLocal worker on the same file.
|
|
4781
|
+
await this.closeOpenDb();
|
|
4771
4782
|
// Copy drizzle migration files from src/db/drizzle to filesDir/db
|
|
4772
4783
|
await this.copyDrizzleFiles(filesDir);
|
|
4773
4784
|
// Ensure meta directory exists
|
|
@@ -4791,6 +4802,16 @@ class BrowserDb {
|
|
|
4791
4802
|
: 'SharedArrayBuffer is unavailable');
|
|
4792
4803
|
}
|
|
4793
4804
|
const { sqlocalDrizzle, workerFailed } = await this.openPersistentSqlocal();
|
|
4805
|
+
const closedMeanwhile = async () => {
|
|
4806
|
+
if (generation === this.openGeneration)
|
|
4807
|
+
return;
|
|
4808
|
+
if (this.sqlocalInstance === sqlocalDrizzle)
|
|
4809
|
+
await this.closeOpenDb();
|
|
4810
|
+
else
|
|
4811
|
+
await sqlocalDrizzle.destroy().catch(() => { });
|
|
4812
|
+
throw new Error('The database was closed while it was being opened');
|
|
4813
|
+
};
|
|
4814
|
+
await closedMeanwhile();
|
|
4794
4815
|
const { batchDriver } = sqlocalDrizzle;
|
|
4795
4816
|
const driver = countDbStatements(withSqliteBusyRetry(sqlocalDrizzle.driver));
|
|
4796
4817
|
// Store SQLocalDrizzle instance for reactive queries
|
|
@@ -4807,6 +4828,7 @@ class BrowserDb {
|
|
|
4807
4828
|
await raceSqlocalStartup((async () => {
|
|
4808
4829
|
await recreateIfOlderThanMinimumUpgradeVersion(db);
|
|
4809
4830
|
await this.runMigrations(db);
|
|
4831
|
+
await closedMeanwhile();
|
|
4810
4832
|
this.appDb = db;
|
|
4811
4833
|
// Loaded Items and ItemProperties hear about row changes through it (ADR 0020). Started
|
|
4812
4834
|
// after the migrations above, so their log rows aren't dispatched.
|
|
@@ -4819,6 +4841,20 @@ class BrowserDb {
|
|
|
4819
4841
|
throw error;
|
|
4820
4842
|
}
|
|
4821
4843
|
}
|
|
4844
|
+
async close() {
|
|
4845
|
+
this.openGeneration++;
|
|
4846
|
+
await this.closeOpenDb();
|
|
4847
|
+
}
|
|
4848
|
+
/** Destroys the SQLocal instance (its worker releases seed.db) and forgets the database. */
|
|
4849
|
+
async closeOpenDb() {
|
|
4850
|
+
stopChangeFeed();
|
|
4851
|
+
const instance = this.sqlocalInstance;
|
|
4852
|
+
this.appDb = undefined;
|
|
4853
|
+
this.sqlocalInstance = undefined;
|
|
4854
|
+
this.sharedLiveQueries.clear();
|
|
4855
|
+
if (instance)
|
|
4856
|
+
await instance.destroy().catch((error) => logger('[Db.close] destroy failed', error));
|
|
4857
|
+
}
|
|
4822
4858
|
async connectToDb(_filesDir) {
|
|
4823
4859
|
return undefined;
|
|
4824
4860
|
}
|
|
@@ -5066,4 +5102,4 @@ function resolveFilesDir(filesDir) {
|
|
|
5066
5102
|
}
|
|
5067
5103
|
|
|
5068
5104
|
export { createPlatformServices as c, isSkippableOpfsEntryError as i, resolveFilesDir as r };
|
|
5069
|
-
//# sourceMappingURL=index.browser-
|
|
5105
|
+
//# sourceMappingURL=index.browser-DQstVvRV.js.map
|