@seedprotocol/sdk 0.7.3-next.613.g79a8dfd → 0.7.3
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/{db-CQt-gcAl.js → BasePathResolver-Cm4apKRb.js} +2041 -127
- package/dist/BasePathResolver-Cm4apKRb.js.map +1 -0
- package/dist/{ClientManager-DDA9956Y.js → ClientManager-i3nJASkg.js} +664 -277
- package/dist/ClientManager-i3nJASkg.js.map +1 -0
- package/dist/{Item-D4FigtYS.js → Item-DBFchXpC.js} +495 -219
- package/dist/Item-DBFchXpC.js.map +1 -0
- package/dist/{ModelProperty-BDt6AU2h.js → ModelProperty-BS49g01Y.js} +167 -47
- package/dist/ModelProperty-BS49g01Y.js.map +1 -0
- package/dist/{Schema-B8xqLWkL.js → Schema-CpMNEnUO.js} +53 -42
- package/dist/Schema-CpMNEnUO.js.map +1 -0
- package/dist/{SchemaValidationService-BPxkfDLU.js → SchemaValidationService-DieV4KL-.js} +13 -14
- package/dist/{SchemaValidationService-BPxkfDLU.js.map → SchemaValidationService-DieV4KL-.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-DuTPcv8t.js → backfillMetadataPropertyIds-DSoOoTnX.js} +14 -7
- package/dist/{backfillMetadataPropertyIds-DuTPcv8t.js.map → backfillMetadataPropertyIds-DSoOoTnX.js.map} +1 -1
- package/dist/{configurePlatform-YcOiDQBZ.js → configurePlatform-D0lQGAMQ.js} +8 -7
- package/dist/{configurePlatform-YcOiDQBZ.js.map → configurePlatform-D0lQGAMQ.js.map} +1 -1
- package/dist/detachRowsBeforeDelete-S0q-DJPT.js +50 -0
- package/dist/detachRowsBeforeDelete-S0q-DJPT.js.map +1 -0
- package/dist/{eas-CpOD74Ke.js → eas-6pjU-OuX.js} +9 -8
- package/dist/eas-6pjU-OuX.js.map +1 -0
- package/dist/{getItem-B_OoFkd7.js → getItem-CxBNZ-WL.js} +13 -11
- package/dist/{getItem-B_OoFkd7.js.map → getItem-CxBNZ-WL.js.map} +1 -1
- package/dist/{getPublishPayload-Xl3sRkR-.js → getPublishPayload-CTCvRUoU.js} +50 -18
- package/dist/getPublishPayload-CTCvRUoU.js.map +1 -0
- package/dist/getPublishUploads-SFHCbf_y.js +648 -0
- package/dist/getPublishUploads-SFHCbf_y.js.map +1 -0
- package/dist/{index-Xl1_4Lmb.js → index-8O3Uow-Y.js} +125 -57
- package/dist/index-8O3Uow-Y.js.map +1 -0
- package/dist/{index-CSOQFAOn.js → index-AVFTVp1m.js} +2 -2
- package/dist/index-AVFTVp1m.js.map +1 -0
- package/dist/index-Cvt5UBz4.js +30 -0
- package/dist/index-Cvt5UBz4.js.map +1 -0
- package/dist/{index.browser-CjTe0vt1.js → index.browser-DBhxRoe8.js} +554 -165
- package/dist/index.browser-DBhxRoe8.js.map +1 -0
- package/dist/{index.node-Cfa7npS6.js → index.node-CJhlcNHM.js} +25 -13
- package/dist/index.node-CJhlcNHM.js.map +1 -0
- package/dist/main.js +30 -47
- package/dist/main.js.map +1 -1
- package/dist/mimeTypes-DHAHC4eZ.js +204 -0
- package/dist/mimeTypes-DHAHC4eZ.js.map +1 -0
- package/dist/node.js +19 -21
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +13 -11
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.node.js +18 -5
- package/dist/platform.node.js.map +1 -1
- package/dist/{property-BrXkY1Rg.js → property-DwPD283A.js} +14 -12
- package/dist/property-DwPD283A.js.map +1 -0
- package/dist/{publishDraftGraph-X0Wr9txE.js → publishDraftGraph-BOn3_Occ.js} +6 -9
- package/dist/{publishDraftGraph-X0Wr9txE.js.map → publishDraftGraph-BOn3_Occ.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js → resetAmbiguousLegacyItemData-BkYmBeJc.js} +14 -3
- package/dist/{resetAmbiguousLegacyItemData-Ci6PM_vC.js.map → resetAmbiguousLegacyItemData-BkYmBeJc.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-DFVdnYq8.js → resolveModelForSyncedSeed-BL24nLa7.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-DFVdnYq8.js.map → resolveModelForSyncedSeed-BL24nLa7.js.map} +1 -1
- package/dist/src/Item/Item.d.ts +21 -3
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/runPublish.d.ts +11 -2
- package/dist/src/Item/service/actors/runPublish.d.ts.map +1 -1
- package/dist/src/Item/service/itemMachineSingle.d.ts +12 -2
- package/dist/src/Item/service/itemMachineSingle.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts +5 -3
- package/dist/src/ItemProperty/ItemProperty.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/saveItemStorage.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/propertyMachine.d.ts.map +1 -1
- package/dist/src/Model/Model.d.ts +10 -4
- package/dist/src/Model/Model.d.ts.map +1 -1
- package/dist/src/Model/index.d.ts +2 -2
- package/dist/src/ModelProperty/ModelProperty.d.ts +10 -2
- package/dist/src/ModelProperty/ModelProperty.d.ts.map +1 -1
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts +3 -0
- package/dist/src/ModelProperty/service/modelPropertyMachine.d.ts.map +1 -1
- package/dist/src/Schema/Schema.d.ts +2 -2
- package/dist/src/Schema/Schema.d.ts.map +1 -1
- package/dist/src/Schema/index.d.ts +0 -1
- package/dist/src/Schema/index.d.ts.map +1 -1
- package/dist/src/browser/helpers/FileManager.d.ts +4 -1
- package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts +79 -4
- package/dist/src/browser/helpers/tolerantWebAccess.d.ts.map +1 -1
- package/dist/src/browser/workers/FileDownloader.d.ts +19 -4
- package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
- package/dist/src/browser/workers/filesDownload.d.ts.map +1 -1
- package/dist/src/client/ClientManager.d.ts +30 -11
- package/dist/src/client/ClientManager.d.ts.map +1 -1
- package/dist/src/client/actors/platformClassesInit.d.ts +6 -0
- package/dist/src/client/actors/platformClassesInit.d.ts.map +1 -1
- package/dist/src/client/actors/processSchemaFiles.d.ts.map +1 -1
- package/dist/src/client/actors/saveConfig.d.ts +13 -6
- package/dist/src/client/actors/saveConfig.d.ts.map +1 -1
- package/dist/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts +57 -0
- package/dist/src/db/migrateLegacyItemStorageRows.d.ts.map +1 -0
- package/dist/src/db/read/getCompositeChildPaths.d.ts +13 -0
- package/dist/src/db/read/getCompositeChildPaths.d.ts.map +1 -0
- package/dist/src/db/read/getItems.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/db/read/getPublishUploads.d.ts +32 -3
- package/dist/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/src/db/read/summarizePublishWork.d.ts.map +1 -1
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts +2 -0
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -1
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts +44 -0
- package/dist/src/db/write/convertVerbatimItemStorageRow.d.ts.map +1 -0
- package/dist/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/src/eventBus.d.ts +5 -0
- package/dist/src/eventBus.d.ts.map +1 -1
- package/dist/src/events/files/download.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts +3 -3
- package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts +25 -1
- package/dist/src/helpers/FileManager/IFileManager.d.ts.map +1 -1
- package/dist/src/helpers/arweaveContentTags.d.ts +33 -0
- package/dist/src/helpers/arweaveContentTags.d.ts.map +1 -0
- package/dist/src/helpers/cachedPropertyRefresh.d.ts +12 -0
- package/dist/src/helpers/cachedPropertyRefresh.d.ts.map +1 -0
- package/dist/src/helpers/compositeUpload.d.ts +28 -0
- package/dist/src/helpers/compositeUpload.d.ts.map +1 -0
- package/dist/src/helpers/db.d.ts +3 -0
- package/dist/src/helpers/db.d.ts.map +1 -1
- package/dist/src/helpers/easSdk.d.ts +16 -0
- package/dist/src/helpers/easSdk.d.ts.map +1 -0
- package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts +16 -0
- package/dist/src/helpers/entity/detachRowsBeforeDelete.d.ts.map +1 -0
- package/dist/src/helpers/entity/entityDestroy.d.ts +2 -0
- package/dist/src/helpers/entity/entityDestroy.d.ts.map +1 -1
- package/dist/src/helpers/itemStorageFile.d.ts +57 -0
- package/dist/src/helpers/itemStorageFile.d.ts.map +1 -0
- package/dist/src/helpers/mapWithConcurrency.d.ts +7 -0
- package/dist/src/helpers/mapWithConcurrency.d.ts.map +1 -0
- package/dist/src/helpers/mimeTypes.d.ts +43 -0
- package/dist/src/helpers/mimeTypes.d.ts.map +1 -0
- package/dist/src/helpers/ownership.d.ts +28 -4
- package/dist/src/helpers/ownership.d.ts.map +1 -1
- package/dist/src/helpers/property/index.d.ts +37 -51
- package/dist/src/helpers/property/index.d.ts.map +1 -1
- package/dist/src/helpers/publishConfig.d.ts +27 -8
- package/dist/src/helpers/publishConfig.d.ts.map +1 -1
- package/dist/src/helpers/storageDir.d.ts +16 -0
- package/dist/src/helpers/storageDir.d.ts.map +1 -0
- package/dist/src/helpers/tabCoordinator.d.ts +5 -1
- package/dist/src/helpers/tabCoordinator.d.ts.map +1 -1
- package/dist/src/helpers/tabEvents.d.ts +23 -2
- package/dist/src/helpers/tabEvents.d.ts.map +1 -1
- package/dist/src/helpers/updateSchema.d.ts +5 -0
- package/dist/src/helpers/updateSchema.d.ts.map +1 -1
- package/dist/src/helpers/waitForEntityIdle.d.ts +5 -0
- package/dist/src/helpers/waitForEntityIdle.d.ts.map +1 -1
- package/dist/src/imports/json.d.ts +9 -0
- package/dist/src/imports/json.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/interfaces/IItem.d.ts +7 -1
- package/dist/src/interfaces/IItem.d.ts.map +1 -1
- package/dist/src/node/db/Db.d.ts.map +1 -1
- package/dist/src/node/helpers/PathResolver.d.ts.map +1 -1
- package/dist/src/node/index.d.ts +8 -1
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/platform/index.browser.d.ts +2 -0
- package/dist/src/platform/index.browser.d.ts.map +1 -1
- package/dist/src/platform/index.node.d.ts +2 -0
- package/dist/src/platform/index.node.d.ts.map +1 -1
- package/dist/src/types/fileManager.d.ts +3 -14
- package/dist/src/types/fileManager.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +12 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/machines.d.ts +2 -0
- package/dist/src/types/machines.d.ts.map +1 -1
- package/dist/src/types/property.d.ts +8 -0
- package/dist/src/types/property.d.ts.map +1 -1
- package/dist/src/types/publish.d.ts +14 -0
- package/dist/src/types/publish.d.ts.map +1 -1
- package/dist/{syncDbWithEas-BU-jZ5bJ.js → syncDbWithEas-Bv2Fe38J.js} +17 -17
- package/dist/{syncDbWithEas-BU-jZ5bJ.js.map → syncDbWithEas-Bv2Fe38J.js.map} +1 -1
- package/dist/tabEvents-9s2WCYw-.js +335 -0
- package/dist/tabEvents-9s2WCYw-.js.map +1 -0
- package/dist/tolerantWebAccess-iUu80pAP.js +551 -0
- package/dist/tolerantWebAccess-iUu80pAP.js.map +1 -0
- package/dist/{updateSeedRevokedAt-iLpzae1i.js → updateSeedRevokedAt-zBfi931j.js} +3 -3
- package/dist/{updateSeedRevokedAt-iLpzae1i.js.map → updateSeedRevokedAt-zBfi931j.js.map} +1 -1
- package/package.json +11 -12
- package/src/node/easLodashRegister.js +4 -0
- package/dist/BasePathResolver-BdxCSIzn.js +0 -679
- package/dist/BasePathResolver-BdxCSIzn.js.map +0 -1
- package/dist/ClientManager-DDA9956Y.js.map +0 -1
- package/dist/Item-D4FigtYS.js.map +0 -1
- package/dist/ModelProperty-BDt6AU2h.js.map +0 -1
- package/dist/Schema-B8xqLWkL.js.map +0 -1
- package/dist/cjs/ModelProperty-B-cZm1yU.js +0 -1977
- package/dist/cjs/ModelProperty-B-cZm1yU.js.map +0 -1
- package/dist/cjs/Schema-STP972Xw.js +0 -5256
- package/dist/cjs/Schema-STP972Xw.js.map +0 -1
- package/dist/cjs/SchemaValidationService-CKNW1bKg.js +0 -778
- package/dist/cjs/SchemaValidationService-CKNW1bKg.js.map +0 -1
- package/dist/cjs/backfillMetadataPropertyIds-CP3y1skt.js +0 -89
- package/dist/cjs/backfillMetadataPropertyIds-CP3y1skt.js.map +0 -1
- package/dist/cjs/eas-CAnUC4wd.js +0 -138
- package/dist/cjs/eas-CAnUC4wd.js.map +0 -1
- package/dist/cjs/getItem-CWgb3e9G.js +0 -58
- package/dist/cjs/getItem-CWgb3e9G.js.map +0 -1
- package/dist/cjs/getPublishPayload-BsZWiJ03.js +0 -1603
- package/dist/cjs/getPublishPayload-BsZWiJ03.js.map +0 -1
- package/dist/cjs/getPublishUploads-BQr8aMVP.js +0 -495
- package/dist/cjs/getPublishUploads-BQr8aMVP.js.map +0 -1
- package/dist/cjs/index-nA5PxBSs.js +0 -70
- package/dist/cjs/index-nA5PxBSs.js.map +0 -1
- package/dist/cjs/index-usKaANAq.js +0 -22171
- package/dist/cjs/index-usKaANAq.js.map +0 -1
- package/dist/cjs/index.browser-BSf8HpnU.js +0 -22
- package/dist/cjs/index.browser-BSf8HpnU.js.map +0 -1
- package/dist/cjs/property-xMwPhQ5N.js +0 -327
- package/dist/cjs/property-xMwPhQ5N.js.map +0 -1
- package/dist/cjs/publishDraftGraph-BRWlR1KO.js +0 -403
- package/dist/cjs/publishDraftGraph-BRWlR1KO.js.map +0 -1
- package/dist/cjs/resetAmbiguousLegacyItemData-8nfkj9rz.js +0 -116
- package/dist/cjs/resetAmbiguousLegacyItemData-8nfkj9rz.js.map +0 -1
- package/dist/cjs/resolveModelForSyncedSeed-kYRuDWYw.js +0 -49
- package/dist/cjs/resolveModelForSyncedSeed-kYRuDWYw.js.map +0 -1
- package/dist/cjs/syncDbWithEas-DqRhV8o2.js +0 -886
- package/dist/cjs/syncDbWithEas-DqRhV8o2.js.map +0 -1
- package/dist/db-CQt-gcAl.js.map +0 -1
- package/dist/eas-CpOD74Ke.js.map +0 -1
- package/dist/getPublishPayload-Xl3sRkR-.js.map +0 -1
- package/dist/getPublishUploads-DHP01KgU.js +0 -484
- package/dist/getPublishUploads-DHP01KgU.js.map +0 -1
- package/dist/index-BGt4_oPO.js +0 -31
- package/dist/index-BGt4_oPO.js.map +0 -1
- package/dist/index-CSOQFAOn.js.map +0 -1
- package/dist/index-Xl1_4Lmb.js.map +0 -1
- package/dist/index.browser-CjTe0vt1.js.map +0 -1
- package/dist/index.node-Cfa7npS6.js.map +0 -1
- package/dist/main.cjs +0 -84
- package/dist/main.cjs.map +0 -1
- package/dist/property-BrXkY1Rg.js.map +0 -1
- package/dist/tabEvents-BZJMY5uK.js +0 -1344
- package/dist/tabEvents-BZJMY5uK.js.map +0 -1
- package/dist/tolerantWebAccess-BZ2RA_mb.js +0 -160
- package/dist/tolerantWebAccess-BZ2RA_mb.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type MetadataType } from '../seedSchema';
|
|
2
|
+
export type ItemStorageFileTarget = {
|
|
3
|
+
/** The item's seedUid, else its seedLocalId: the file is `<seedId><extension>`. */
|
|
4
|
+
seedId: string;
|
|
5
|
+
/** The property's `storage.path` (e.g. `/html`); `files` when unset. */
|
|
6
|
+
localStorageDir?: string | null;
|
|
7
|
+
/** The property's `storage.extension` (e.g. `.html`). */
|
|
8
|
+
filenameSuffix?: string | null;
|
|
9
|
+
/** An existing file name to write to instead (the row's refResolvedValue). */
|
|
10
|
+
fileName?: string | null;
|
|
11
|
+
};
|
|
12
|
+
/** Absolute path of the file {@link writeItemStorageFile} writes for `target`. */
|
|
13
|
+
export declare const getItemStorageFilePath: (target: ItemStorageFileTarget) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Write an ItemStorage property's content to its local file, where saveItemStorage, reads, publish
|
|
16
|
+
* (resolveItemStorageChildFile) and download all look for it. Returns what the metadata row records:
|
|
17
|
+
* `refResolvedValue` (the file name) and `localStorageDir` (with a leading slash).
|
|
18
|
+
*
|
|
19
|
+
* Callers that also update the file's metadata row hold {@link withItemStorageFileLock} around
|
|
20
|
+
* both, so another writer of the same file can't land in between.
|
|
21
|
+
*/
|
|
22
|
+
export declare const writeItemStorageFile: (target: ItemStorageFileTarget, content: string | Blob | ArrayBuffer) => Promise<{
|
|
23
|
+
fileName: string;
|
|
24
|
+
filePath: string;
|
|
25
|
+
localStorageDir: string;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Lock name for one ItemStorage file: `seed:item-storage:<absolute file path>`. The path starts
|
|
29
|
+
* with the files root, which also names the database (`<filesDir>/db/seed.db`), so the name is
|
|
30
|
+
* per database as well as per file.
|
|
31
|
+
*/
|
|
32
|
+
export declare const itemStorageFileLockName: (filePath: string) => string;
|
|
33
|
+
/**
|
|
34
|
+
* Runs `fn` holding the lock of one ItemStorage file, across tabs (Web Locks) and within this JS
|
|
35
|
+
* realm (an in-process queue where Web Locks are missing, e.g. Node < 24.5; see `withTabLock`).
|
|
36
|
+
*
|
|
37
|
+
* Writers of a local draft's file (saveItemStorage, convertVerbatimItemStorageRow, createNewItem)
|
|
38
|
+
* hold it across "read the row → write the file → update the row", so the file and the row end
|
|
39
|
+
* with the same writer's content. See docs/MULTI_TAB.md.
|
|
40
|
+
*
|
|
41
|
+
* Lock ordering: this lock is always the innermost. It may be taken while holding a broader lock
|
|
42
|
+
* (`seed:item-storage-migration:<db>`, `seed:publish:<seedLocalId>`), never the other way round,
|
|
43
|
+
* and no other lock (nor a second file lock) is requested while it is held. Keep the section to
|
|
44
|
+
* local DB and file I/O: no network. Not re-entrant.
|
|
45
|
+
*/
|
|
46
|
+
export declare function withItemStorageFileLock<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Runs `fn` with a fresh read of metadata row `localId`, holding the lock of the file that row's
|
|
49
|
+
* content goes to. `fileOf` names that file (absolute path) for a row, or returns undefined when
|
|
50
|
+
* there is nothing to write (then `fn` isn't called and the result is undefined).
|
|
51
|
+
*
|
|
52
|
+
* The file depends on the row, so the row is read once to pick the lock and again once it is held;
|
|
53
|
+
* if the row now points at another file (another writer changed it meanwhile), the lock is
|
|
54
|
+
* released and taken again for that file.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withLockedItemStorageRow<T>(localId: string, fileOf: (row: MetadataType) => string | undefined, fn: (row: MetadataType, filePath: string) => Promise<T>): Promise<T | undefined>;
|
|
57
|
+
//# sourceMappingURL=itemStorageFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemStorageFile.d.ts","sourceRoot":"","sources":["../../../src/helpers/itemStorageFile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAK1D,MAAM,MAAM,qBAAqB,GAAG;IAClC,mFAAmF;IACnF,MAAM,EAAE,MAAM,CAAA;IACd,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,yDAAyD;IACzD,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,GAAI,QAAQ,qBAAqB,KAAG,MAIpE,CAAA;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,qBAAqB,EAC7B,SAAS,MAAM,GAAG,IAAI,GAAG,WAAW,KACnC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAOzE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,MAAyC,CAAA;AAEpG;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE7F;AAcD;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAAC,CAAC,EAC9C,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,GAAG,SAAS,EACjD,EAAE,EAAE,CAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACtD,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAgBxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Promise.all(items.map(fn))` with at most `limit` calls in flight. Results keep the input order.
|
|
3
|
+
* Rejects with the first error (by time); after that no new calls start, though calls already in
|
|
4
|
+
* flight run to completion.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mapWithConcurrency<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
7
|
+
//# sourceMappingURL=mapWithConcurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapWithConcurrency.d.ts","sourceRoot":"","sources":["../../../src/helpers/mapWithConcurrency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAC3C,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACzC,OAAO,CAAC,CAAC,EAAE,CAAC,CAoBd"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File extension <-> MIME type, shared by the upload side (`getPublishUploads.ts`, which sets the
|
|
3
|
+
* `Content-Type` tag) and the download worker (`browser/workers/filesDownload.ts`, which picks the
|
|
4
|
+
* extension of a file saved under `files/`). The worker runs from a string and cannot import this
|
|
5
|
+
* module, so {@link MIME_TO_EXTENSION} is injected into its source as JSON.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Lowercase extension (no dot) to MIME type. Includes the odd extensions the SDK itself produces:
|
|
9
|
+
* `saveImage` names a file `<id>.<subtype>` (e.g. `.svg+xml`, `.x-icon`), so subtypes appear here too.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EXTENSION_TO_MIME: Readonly<Record<string, string>>;
|
|
12
|
+
/**
|
|
13
|
+
* MIME type to the extension a downloaded file gets. One canonical extension per type (the
|
|
14
|
+
* first one listed here wins over {@link EXTENSION_TO_MIME}'s aliases), plus a few common
|
|
15
|
+
* non-canonical spellings a gateway may send.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MIME_TO_EXTENSION: Readonly<Record<string, string>>;
|
|
18
|
+
/**
|
|
19
|
+
* Content types that say nothing about the content. A Blob carrying one of these is treated as
|
|
20
|
+
* untyped.
|
|
21
|
+
*/
|
|
22
|
+
export declare const GENERIC_MIME_TYPES: readonly string[];
|
|
23
|
+
/** Lowercase `type/subtype` without parameters; `undefined` when empty or generic. */
|
|
24
|
+
export declare const normalizeMimeType: (mimeType: string | null | undefined) => string | undefined;
|
|
25
|
+
/** MIME type for a path or file name by its extension, if it has a known one. */
|
|
26
|
+
export declare const getMimeTypeFromPath: (filePathOrName: string) => string | undefined;
|
|
27
|
+
/** Extension (no dot) for a MIME type, if it has a well-known one. */
|
|
28
|
+
export declare const getExtensionForMimeType: (mimeType: string | null | undefined) => string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* MIME type from the leading bytes, for formats with an unambiguous signature. Used when a local
|
|
31
|
+
* file has no (known) extension, e.g. a file seed named after its id.
|
|
32
|
+
*/
|
|
33
|
+
export declare const sniffMimeType: (bytes: Uint8Array) => string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Best MIME type for upload bytes: the source's own type (a Blob/File `type`) when it is specific,
|
|
36
|
+
* then the file name's extension, then the bytes' signature.
|
|
37
|
+
*/
|
|
38
|
+
export declare const resolveUploadMimeType: (params: {
|
|
39
|
+
sourceType?: string | null;
|
|
40
|
+
fileName?: string | null;
|
|
41
|
+
bytes?: Uint8Array;
|
|
42
|
+
}) => string | undefined;
|
|
43
|
+
//# sourceMappingURL=mimeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mimeTypes.d.ts","sourceRoot":"","sources":["../../../src/helpers/mimeTypes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwE9D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiC3D,CAAA;AAEJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAI/C,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,SAIhF,CAAA;AAED,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,GAAI,gBAAgB,MAAM,KAAG,MAAM,GAAG,SAKrE,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,GAAG,SAGtF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,KAAG,MAAM,GAAG,SA4B1D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ;IAC5C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,KAAG,MAAM,GAAG,SAG6C,CAAA"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { IItem } from '../interfaces/IItem';
|
|
2
2
|
import { seeds } from '../seedSchema';
|
|
3
3
|
import { type SQL } from 'drizzle-orm';
|
|
4
|
+
/**
|
|
5
|
+
* Thrown by write operations (save, destroy, publish, unpublish) on an item none
|
|
6
|
+
* of the client's addresses own. See isItemOwned for what counts as owned.
|
|
7
|
+
*/
|
|
8
|
+
export declare class OwnershipError extends Error {
|
|
9
|
+
constructor(message?: string);
|
|
10
|
+
}
|
|
4
11
|
type ItemLike = {
|
|
5
12
|
seedLocalId?: string;
|
|
6
13
|
seedUid?: string;
|
|
@@ -25,12 +32,28 @@ export declare function publisherIsInOwnedSet(publisher: string | null | undefin
|
|
|
25
32
|
*/
|
|
26
33
|
export declare function isSeedRowOwned(row: SeedOwnershipRow, ownedAddresses: readonly string[]): boolean;
|
|
27
34
|
/**
|
|
28
|
-
* SQL for
|
|
29
|
-
* Compares `lower(publisher)` so checksummed rows match persisted lowercase
|
|
35
|
+
* SQL for an address list on `publisher`. Empty list → no rows (`1=0`).
|
|
36
|
+
* Compares `lower(publisher)` so checksummed rows match persisted lowercase addresses.
|
|
37
|
+
* Used for `addressFilter: 'watched'`; `'owned'` uses {@link ownedSeedsSql}.
|
|
30
38
|
*/
|
|
31
39
|
export declare function publisherInAddressListSql(column: typeof seeds.publisher, addresses: readonly string[]): SQL;
|
|
32
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Matches `seeds.publisher` only. Use {@link ownedSeedsSql}, which agrees
|
|
42
|
+
* with {@link isSeedRowOwned} (empty owned → local unsealed drafts; attester fallback).
|
|
43
|
+
*/
|
|
33
44
|
export declare function ownedPublisherSql(ownedAddresses: readonly string[]): SQL;
|
|
45
|
+
/** SQL form of {@link isPlaceholderUid}: null, `''`, `'NULL'`, or zero bytes32 (trimmed, any case). */
|
|
46
|
+
export declare function placeholderUidSql(column: typeof seeds.uid): SQL;
|
|
47
|
+
/** SQL form of {@link isLocalUnsealedDraft} on `seeds`. */
|
|
48
|
+
export declare function localUnsealedDraftSql(): SQL;
|
|
49
|
+
/**
|
|
50
|
+
* SQL for `addressFilter: 'owned'`: a row passes exactly when {@link isSeedRowOwned} is true.
|
|
51
|
+
* - Empty owned → local unsealed drafts (pre-connect authoring), not every row.
|
|
52
|
+
* - Owned set → `lower(trim(publisher))` in the set, or, when publisher is blank, the
|
|
53
|
+
* `attestationRaw.attester` ({@link resolvePublisherFromSeedRow}). `json_valid` guards
|
|
54
|
+
* `json_extract`, which throws on malformed JSON.
|
|
55
|
+
*/
|
|
56
|
+
export declare function ownedSeedsSql(ownedAddresses: readonly string[]): SQL;
|
|
34
57
|
/**
|
|
35
58
|
* Checks if the current user owns the item (publisher is in persisted owned addresses).
|
|
36
59
|
*
|
|
@@ -46,7 +69,8 @@ export declare function ownedPublisherSql(ownedAddresses: readonly string[]): SQ
|
|
|
46
69
|
*/
|
|
47
70
|
export declare function isItemOwned(item: ItemLike | IItem<any>): Promise<boolean>;
|
|
48
71
|
/**
|
|
49
|
-
* Throws if the item is not owned. Use before write operations
|
|
72
|
+
* Throws OwnershipError if the item is not owned. Use before write operations
|
|
73
|
+
* (publish, save, destroy).
|
|
50
74
|
*/
|
|
51
75
|
export declare function assertItemOwned(item: ItemLike | IItem<any>): Promise<void>;
|
|
52
76
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../../src/helpers/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../../../src/helpers/ownership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAqC,KAAK,GAAG,EAAE,MAAM,aAAa,CAAA;AAQzE;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,SAAkB;CAKtC;AAED,KAAK,QAAQ,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB,CAAA;AA6BD,2FAA2F;AAC3F,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAWhF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAMnE;AAED,8DAA8D;AAC9D,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,OAAO,CAIT;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,gBAAgB,EACrB,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,EAC9B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,GAAG,CAML;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAExE;AAED,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG,GAAG,CAO/D;AAKD,2DAA2D;AAC3D,wBAAgB,qBAAqB,IAAI,GAAG,CAM3C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAUpE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAK/E;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhF"}
|