@seedprotocol/sdk 0.7.8-next.1071.g2a141c1 → 0.7.8
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/{ClientManager-Bv15o3Oz.js → ClientManager-B1r_8P5Z.js} +37 -40
- package/dist/ClientManager-B1r_8P5Z.js.map +1 -0
- package/dist/{Item-tX3kpbj4.js → Item-CjTEShfk.js} +384 -399
- package/dist/Item-CjTEShfk.js.map +1 -0
- package/dist/{ModelProperty-N-3gBfu5.js → ModelProperty-C3749Wjq.js} +36 -36
- package/dist/{ModelProperty-N-3gBfu5.js.map → ModelProperty-C3749Wjq.js.map} +1 -1
- package/dist/{Schema-CY3OxwKS.js → Schema-CX9CTtho.js} +35 -35
- package/dist/{Schema-CY3OxwKS.js.map → Schema-CX9CTtho.js.map} +1 -1
- package/dist/{SchemaValidationService-BR2ABK2r.js → SchemaValidationService-T5mqnY8q.js} +6 -6
- package/dist/{SchemaValidationService-BR2ABK2r.js.map → SchemaValidationService-T5mqnY8q.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-vc_1RoDT.js → backfillMetadataPropertyIds-DWWkh-Ex.js} +3 -3
- package/dist/{backfillMetadataPropertyIds-vc_1RoDT.js.map → backfillMetadataPropertyIds-DWWkh-Ex.js.map} +1 -1
- package/dist/{tabEvents-BuorBItJ.js → changeFeed-DcsZ7deG.js} +369 -10
- package/dist/changeFeed-DcsZ7deG.js.map +1 -0
- package/dist/{configurePlatform-D-Pj9gTx.js → configurePlatform-AWild9o4.js} +2 -2
- package/dist/{configurePlatform-D-Pj9gTx.js.map → configurePlatform-AWild9o4.js.map} +1 -1
- package/dist/db/drizzle/0022_add_read_indexes.sql +5 -0
- package/dist/db/drizzle/0023_add_entity_changes.sql +48 -0
- package/dist/db/drizzle/meta/0022_snapshot.json +1585 -0
- package/dist/db/drizzle/meta/0023_snapshot.json +1645 -0
- package/dist/db/drizzle/meta/_journal.json +14 -0
- package/dist/{detachRowsBeforeDelete-sK1ye2W6.js → detachRowsBeforeDelete-Bo_pky-R.js} +2 -2
- package/dist/{detachRowsBeforeDelete-sK1ye2W6.js.map → detachRowsBeforeDelete-Bo_pky-R.js.map} +1 -1
- package/dist/dist/{ClientManager-Bv15o3Oz.d.ts → ClientManager-B1r_8P5Z.d.ts} +1 -1
- package/dist/dist/ClientManager-B1r_8P5Z.d.ts.map +1 -0
- package/dist/dist/{Item-tX3kpbj4.d.ts → Item-CjTEShfk.d.ts} +3 -2
- package/dist/dist/Item-CjTEShfk.d.ts.map +1 -0
- package/dist/dist/{ModelProperty-N-3gBfu5.d.ts → ModelProperty-C3749Wjq.d.ts} +1 -1
- package/dist/dist/{ModelProperty-N-3gBfu5.d.ts.map → ModelProperty-C3749Wjq.d.ts.map} +1 -1
- package/dist/dist/{Schema-CY3OxwKS.d.ts → Schema-CX9CTtho.d.ts} +2 -2
- package/dist/dist/{Schema-CY3OxwKS.d.ts.map → Schema-CX9CTtho.d.ts.map} +1 -1
- package/dist/dist/{SchemaValidationService-BR2ABK2r.d.ts → SchemaValidationService-T5mqnY8q.d.ts} +1 -1
- package/dist/dist/{SchemaValidationService-BR2ABK2r.d.ts.map → SchemaValidationService-T5mqnY8q.d.ts.map} +1 -1
- package/dist/dist/{backfillMetadataPropertyIds-vc_1RoDT.d.ts → backfillMetadataPropertyIds-DWWkh-Ex.d.ts} +1 -1
- package/dist/dist/backfillMetadataPropertyIds-DWWkh-Ex.d.ts.map +1 -0
- package/dist/dist/{tabEvents-BuorBItJ.d.ts → changeFeed-DcsZ7deG.d.ts} +101 -36
- package/dist/dist/changeFeed-DcsZ7deG.d.ts.map +1 -0
- package/dist/dist/{configurePlatform-D-Pj9gTx.d.ts → configurePlatform-AWild9o4.d.ts} +1 -1
- package/dist/dist/configurePlatform-AWild9o4.d.ts.map +1 -0
- package/dist/dist/{detachRowsBeforeDelete-sK1ye2W6.d.ts → detachRowsBeforeDelete-Bo_pky-R.d.ts} +1 -1
- package/dist/dist/detachRowsBeforeDelete-Bo_pky-R.d.ts.map +1 -0
- package/dist/dist/{eas-BSQxj7gN.d.ts → eas--9vtNkma.d.ts} +1 -1
- package/dist/dist/eas--9vtNkma.d.ts.map +1 -0
- package/dist/dist/{errors-a4Tj6hly.d.ts → errors-rIWK7gwJ.d.ts} +1 -1
- package/dist/dist/{errors-a4Tj6hly.d.ts.map → errors-rIWK7gwJ.d.ts.map} +1 -1
- package/dist/dist/{getItem-Ctps9gSs.d.ts → getItem-5j22EWWE.d.ts} +1 -1
- package/dist/dist/getItem-5j22EWWE.d.ts.map +1 -0
- package/dist/dist/{getPublishPayload-C2g5pPD2.d.ts → getPublishPayload-BGl2SaGK.d.ts} +1 -1
- package/dist/dist/{getPublishPayload-C2g5pPD2.d.ts.map → getPublishPayload-BGl2SaGK.d.ts.map} +1 -1
- package/dist/dist/{getPublishUploads-CaJHy3SL.d.ts → getPublishUploads-DVsDx6Xf.d.ts} +1 -1
- package/dist/dist/{getPublishUploads-CaJHy3SL.d.ts.map → getPublishUploads-DVsDx6Xf.d.ts.map} +1 -1
- package/dist/dist/{index-s73wD_LC.d.ts → index-C0SetTd1.d.ts} +1190 -1065
- package/dist/dist/index-C0SetTd1.d.ts.map +1 -0
- package/dist/dist/{index-BgEwcREa.d.ts → index-CJK3F_MK.d.ts} +13 -13
- package/dist/dist/index-CJK3F_MK.d.ts.map +1 -0
- package/dist/dist/{index-B6hPWSM4.d.ts → index-CZQrNqvq.d.ts} +130 -13
- package/dist/dist/{index-B6hPWSM4.d.ts.map → index-CZQrNqvq.d.ts.map} +1 -1
- package/dist/dist/{index-bOwhhJJL.d.ts → index-Dp4uyZYx.d.ts} +5 -5
- package/dist/dist/index-Dp4uyZYx.d.ts.map +1 -0
- package/dist/dist/{index.browser-C7iZp7mx.d.ts → index.browser-Ll71Y_Dl.d.ts} +391 -39
- package/dist/dist/{index.browser-C7iZp7mx.d.ts.map → index.browser-Ll71Y_Dl.d.ts.map} +1 -1
- package/dist/dist/{index.node-MPVTJR2J.d.ts → index.node-CgltN0cC.d.ts} +517 -49
- package/dist/dist/{index.node-MPVTJR2J.d.ts.map → index.node-CgltN0cC.d.ts.map} +1 -1
- package/dist/dist/modelPropertyRecordSchemas-C_lYTzMr.d.ts +7 -0
- package/dist/dist/modelPropertyRecordSchemas-C_lYTzMr.d.ts.map +1 -0
- package/dist/dist/platform.browser.d.ts +2 -2
- package/dist/dist/platform.node.d.ts +2 -2
- package/dist/dist/{property-mP9mOZ2L.d.ts → property-pcDxNEpy.d.ts} +3 -3
- package/dist/dist/property-pcDxNEpy.d.ts.map +1 -0
- package/dist/dist/{propertyValidationRules-DwzrYA7c.d.ts → propertyValidationRules-BEjN0f3-.d.ts} +6 -1
- package/dist/dist/propertyValidationRules-BEjN0f3-.d.ts.map +1 -0
- package/dist/dist/{publishDraftGraph-BzYVblZZ.d.ts → publishDraftGraph-I5yKe1Xz.d.ts} +1 -1
- package/dist/dist/{publishDraftGraph-BzYVblZZ.d.ts.map → publishDraftGraph-I5yKe1Xz.d.ts.map} +1 -1
- package/dist/dist/{resetAmbiguousLegacyItemData-B_IUQA09.d.ts → resetAmbiguousLegacyItemData-0Tin9-JK.d.ts} +1 -1
- package/dist/dist/resetAmbiguousLegacyItemData-0Tin9-JK.d.ts.map +1 -0
- package/dist/dist/{resolveModelForSyncedSeed-H-4tmU6l.d.ts → resolveModelForSyncedSeed-C5KXn6ex.d.ts} +1 -1
- package/dist/dist/resolveModelForSyncedSeed-C5KXn6ex.d.ts.map +1 -0
- package/dist/dist/{syncDbWithEas-y5VF623G.d.ts → syncDbWithEas-b4fESZ7C.d.ts} +1 -1
- package/dist/dist/syncDbWithEas-b4fESZ7C.d.ts.map +1 -0
- package/dist/dist/{tolerantWebAccess-DoI7QYT-.d.ts → tolerantWebAccess-CIpS7RLk.d.ts} +1 -1
- package/dist/dist/{tolerantWebAccess-DoI7QYT-.d.ts.map → tolerantWebAccess-CIpS7RLk.d.ts.map} +1 -1
- package/dist/dist/{updateSeedRevokedAt-BIzkbsUd.d.ts → updateSeedRevokedAt-CR4zwn-6.d.ts} +1 -1
- package/dist/dist/updateSeedRevokedAt-CR4zwn-6.d.ts.map +1 -0
- package/dist/{eas-BSQxj7gN.js → eas--9vtNkma.js} +3 -3
- package/dist/{eas-BSQxj7gN.js.map → eas--9vtNkma.js.map} +1 -1
- package/dist/{errors-a4Tj6hly.js → errors-rIWK7gwJ.js} +35 -35
- package/dist/{errors-a4Tj6hly.js.map → errors-rIWK7gwJ.js.map} +1 -1
- package/dist/{getItem-Ctps9gSs.js → getItem-5j22EWWE.js} +5 -5
- package/dist/{getItem-Ctps9gSs.js.map → getItem-5j22EWWE.js.map} +1 -1
- package/dist/{getPublishPayload-C2g5pPD2.js → getPublishPayload-BGl2SaGK.js} +14 -14
- package/dist/{getPublishPayload-C2g5pPD2.js.map → getPublishPayload-BGl2SaGK.js.map} +1 -1
- package/dist/{getPublishUploads-CaJHy3SL.js → getPublishUploads-DVsDx6Xf.js} +7 -7
- package/dist/{getPublishUploads-CaJHy3SL.js.map → getPublishUploads-DVsDx6Xf.js.map} +1 -1
- package/dist/{index-s73wD_LC.js → index-C0SetTd1.js} +52 -13
- package/dist/index-C0SetTd1.js.map +1 -0
- package/dist/{index-BgEwcREa.js → index-CJK3F_MK.js} +8 -8
- package/dist/index-CJK3F_MK.js.map +1 -0
- package/dist/{index-B6hPWSM4.js → index-CZQrNqvq.js} +3 -2
- package/dist/index-CZQrNqvq.js.map +1 -0
- package/dist/{index-bOwhhJJL.js → index-Dp4uyZYx.js} +8 -8
- package/dist/index-Dp4uyZYx.js.map +1 -0
- package/dist/{index.browser-C7iZp7mx.js → index.browser-Ll71Y_Dl.js} +243 -18
- package/dist/index.browser-Ll71Y_Dl.js.map +1 -0
- package/dist/{index.node-MPVTJR2J.js → index.node-CgltN0cC.js} +50 -15
- package/dist/index.node-CgltN0cC.js.map +1 -0
- package/dist/main.js +23 -30
- package/dist/main.js.map +1 -1
- package/dist/modelPropertyRecordSchemas-C_lYTzMr.js +94 -0
- package/dist/modelPropertyRecordSchemas-C_lYTzMr.js.map +1 -0
- package/dist/node.js +11 -11
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +4 -4
- package/dist/{property-mP9mOZ2L.js → property-pcDxNEpy.js} +7 -7
- package/dist/{property-mP9mOZ2L.js.map → property-pcDxNEpy.js.map} +1 -1
- package/dist/propertyValidationRules-BEjN0f3-.js +73 -0
- package/dist/propertyValidationRules-BEjN0f3-.js.map +1 -0
- package/dist/{publishDraftGraph-BzYVblZZ.js → publishDraftGraph-I5yKe1Xz.js} +6 -6
- package/dist/{publishDraftGraph-BzYVblZZ.js.map → publishDraftGraph-I5yKe1Xz.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-B_IUQA09.js → resetAmbiguousLegacyItemData-0Tin9-JK.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-B_IUQA09.js.map → resetAmbiguousLegacyItemData-0Tin9-JK.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-H-4tmU6l.js → resolveModelForSyncedSeed-C5KXn6ex.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-H-4tmU6l.js.map → resolveModelForSyncedSeed-C5KXn6ex.js.map} +1 -1
- package/dist/seedSchema/EntityChangeSchema.ts +28 -0
- package/dist/seedSchema/MetadataSchema.ts +12 -4
- package/dist/seedSchema/SeedSchema.ts +9 -3
- package/dist/seedSchema/VersionSchema.ts +9 -4
- package/dist/seedSchema/index.ts +1 -0
- package/dist/src/Item/Item.d.ts +2 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/Item/service/actors/loadOrCreateItem.d.ts.map +1 -1
- package/dist/src/ItemProperty/ItemProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/loadOrCreateProperty.d.ts.map +1 -1
- package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts +21 -0
- package/dist/src/ItemProperty/service/actors/modelPropertyRecordSchemas.d.ts.map +1 -0
- package/dist/src/browser/db/Db.d.ts +2 -2
- package/dist/src/browser/db/Db.d.ts.map +1 -1
- package/dist/src/browser/db/changeFeed.d.ts +77 -0
- package/dist/src/browser/db/changeFeed.d.ts.map +1 -0
- package/dist/src/browser/db/drizzleFiles.d.ts +4 -2
- package/dist/src/browser/db/drizzleFiles.d.ts.map +1 -1
- package/dist/src/db/write/applyArweaveL1TransactionIdLocal.d.ts.map +1 -1
- package/dist/src/db/write/claimUnpublishedDrafts.d.ts.map +1 -1
- package/dist/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/src/db/write/createSeed.d.ts.map +1 -1
- package/dist/src/db/write/createVersion.d.ts.map +1 -1
- package/dist/src/db/write/restoreDataItemIdsOverwrittenByL1.d.ts.map +1 -1
- package/dist/src/db/write/saveMetadata.d.ts.map +1 -1
- package/dist/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/src/db/write/updateSeedRevokedAt.d.ts.map +1 -1
- package/dist/src/db/write/updateSeedUid.d.ts.map +1 -1
- package/dist/src/db/write/updateVersionUid.d.ts.map +1 -1
- package/dist/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/src/helpers/propertyValidationRules.d.ts +8 -0
- package/dist/src/helpers/propertyValidationRules.d.ts.map +1 -1
- package/dist/src/helpers/timing.d.ts +36 -0
- package/dist/src/helpers/timing.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/db/singleConnectionTransactions.d.ts +6 -0
- package/dist/src/node/db/singleConnectionTransactions.d.ts.map +1 -1
- package/dist/src/outbox/itemAppliers.d.ts.map +1 -1
- package/dist/src/outbox/outbox.d.ts +2 -0
- package/dist/src/outbox/outbox.d.ts.map +1 -1
- package/dist/src/outbox/pendingValues.d.ts.map +1 -1
- package/dist/src/seedSchema/EntityChangeSchema.d.ts +126 -0
- package/dist/src/seedSchema/EntityChangeSchema.d.ts.map +1 -0
- package/dist/src/seedSchema/MetadataSchema.d.ts +4 -4
- package/dist/src/seedSchema/MetadataSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/SeedSchema.d.ts +4 -4
- package/dist/src/seedSchema/SeedSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/VersionSchema.d.ts +4 -4
- package/dist/src/seedSchema/VersionSchema.d.ts.map +1 -1
- package/dist/src/seedSchema/index.d.ts +1 -0
- package/dist/src/seedSchema/index.d.ts.map +1 -1
- package/dist/{syncDbWithEas-y5VF623G.js → syncDbWithEas-b4fESZ7C.js} +17 -23
- package/dist/syncDbWithEas-b4fESZ7C.js.map +1 -0
- package/dist/{tolerantWebAccess-DoI7QYT-.js → tolerantWebAccess-CIpS7RLk.js} +6 -6
- package/dist/{tolerantWebAccess-DoI7QYT-.js.map → tolerantWebAccess-CIpS7RLk.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-BIzkbsUd.js → updateSeedRevokedAt-CR4zwn-6.js} +5 -6
- package/dist/updateSeedRevokedAt-CR4zwn-6.js.map +1 -0
- package/package.json +6 -6
- package/dist/ClientManager-Bv15o3Oz.js.map +0 -1
- package/dist/Item-tX3kpbj4.js.map +0 -1
- package/dist/dist/ClientManager-Bv15o3Oz.d.ts.map +0 -1
- package/dist/dist/Item-tX3kpbj4.d.ts.map +0 -1
- package/dist/dist/backfillMetadataPropertyIds-vc_1RoDT.d.ts.map +0 -1
- package/dist/dist/configurePlatform-D-Pj9gTx.d.ts.map +0 -1
- package/dist/dist/detachRowsBeforeDelete-sK1ye2W6.d.ts.map +0 -1
- package/dist/dist/eas-BSQxj7gN.d.ts.map +0 -1
- package/dist/dist/getItem-Ctps9gSs.d.ts.map +0 -1
- package/dist/dist/index-BgEwcREa.d.ts.map +0 -1
- package/dist/dist/index-bOwhhJJL.d.ts.map +0 -1
- package/dist/dist/index-s73wD_LC.d.ts.map +0 -1
- package/dist/dist/property-mP9mOZ2L.d.ts.map +0 -1
- package/dist/dist/propertyValidationRules-DwzrYA7c.d.ts.map +0 -1
- package/dist/dist/resetAmbiguousLegacyItemData-B_IUQA09.d.ts.map +0 -1
- package/dist/dist/resolveModelForSyncedSeed-H-4tmU6l.d.ts.map +0 -1
- package/dist/dist/syncDbWithEas-y5VF623G.d.ts.map +0 -1
- package/dist/dist/tabEvents-BuorBItJ.d.ts.map +0 -1
- package/dist/dist/updateSeedRevokedAt-BIzkbsUd.d.ts.map +0 -1
- package/dist/index-B6hPWSM4.js.map +0 -1
- package/dist/index-BgEwcREa.js.map +0 -1
- package/dist/index-bOwhhJJL.js.map +0 -1
- package/dist/index-s73wD_LC.js.map +0 -1
- package/dist/index.browser-C7iZp7mx.js.map +0 -1
- package/dist/index.node-MPVTJR2J.js.map +0 -1
- package/dist/propertyValidationRules-DwzrYA7c.js +0 -51
- package/dist/propertyValidationRules-DwzrYA7c.js.map +0 -1
- package/dist/syncDbWithEas-y5VF623G.js.map +0 -1
- package/dist/tabEvents-BuorBItJ.js.map +0 -1
- package/dist/updateSeedRevokedAt-BIzkbsUd.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import fs__default from 'fs';
|
|
4
|
-
import {
|
|
5
|
-
import { B as BasePathResolver } from './configurePlatform-
|
|
4
|
+
import { Q as BaseFileManager, aq as isSqliteBusyError, ar as SQLITE_BUSY_RETRY_DELAYS_MS, G as BaseDb, h as appState, as as SEED_CONFIG_FILE, at as SEED_CONFIG_FALLBACKS } from './index-C0SetTd1.js';
|
|
5
|
+
import { B as BasePathResolver } from './configurePlatform-AWild9o4.js';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
import * as fsAsync from 'fs/promises';
|
|
8
8
|
import { pathToFileURL } from 'url';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
-
import { s as schema } from './index-
|
|
10
|
+
import { s as schema } from './index-CZQrNqvq.js';
|
|
11
11
|
import { createClient } from '@libsql/client';
|
|
12
12
|
import { drizzle } from 'drizzle-orm/libsql';
|
|
13
13
|
import { migrate } from 'drizzle-orm/libsql/migrator';
|
|
@@ -192,6 +192,12 @@ BaseFileManager.configure(new NodeFileManager());
|
|
|
192
192
|
* SQLocal makes them wait in the browser. So `fn` must not use the app database: it would wait
|
|
193
193
|
* for its own transaction.
|
|
194
194
|
* - Statements outside a transaction keep the busy retry: another process may hold the file.
|
|
195
|
+
*
|
|
196
|
+
* libsql 0.5 doesn't reset a statement that failed with SQLITE_BUSY, and that leaves its
|
|
197
|
+
* connection in an implicit transaction that never commits: every later write on it is lost when it
|
|
198
|
+
* closes and never reaches the file (`inTransaction` still reads false). So after a busy error the
|
|
199
|
+
* connection is replaced (`reconnect()`) before anything else runs on it, and a transaction waits
|
|
200
|
+
* for statements that are between attempts.
|
|
195
201
|
*/
|
|
196
202
|
function createSingleConnectionTransactions(client, schema) {
|
|
197
203
|
const execute = client.execute.bind(client);
|
|
@@ -204,14 +210,32 @@ function createSingleConnectionTransactions(client, schema) {
|
|
|
204
210
|
while (open)
|
|
205
211
|
await open;
|
|
206
212
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
/** Statements outside transactions that are running or replacing a busy connection. */
|
|
214
|
+
let statementsRunning = 0;
|
|
215
|
+
const whenStatementsDone = [];
|
|
216
|
+
const statementsDone = () => statementsRunning === 0 ? Promise.resolve() : new Promise((resolve) => whenStatementsDone.push(resolve));
|
|
217
|
+
const statement = async (run) => {
|
|
218
|
+
for (let attempt = 0;; attempt++) {
|
|
219
|
+
await outsideTransactions();
|
|
220
|
+
statementsRunning++;
|
|
221
|
+
try {
|
|
222
|
+
return await run();
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
if (!isSqliteBusyError(error) || attempt >= SQLITE_BUSY_RETRY_DELAYS_MS.length)
|
|
226
|
+
throw error;
|
|
227
|
+
await client.reconnect();
|
|
228
|
+
}
|
|
229
|
+
finally {
|
|
230
|
+
if (--statementsRunning === 0)
|
|
231
|
+
for (const resolve of whenStatementsDone.splice(0))
|
|
232
|
+
resolve();
|
|
233
|
+
}
|
|
234
|
+
await new Promise((resolve) => setTimeout(resolve, SQLITE_BUSY_RETRY_DELAYS_MS[attempt]));
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
client.execute = ((...args) => statement(() => execute(...args)));
|
|
238
|
+
client.batch = ((...args) => statement(() => batch(...args)));
|
|
215
239
|
// What Drizzle uses of the client, straight to the connection: the transaction's own statements
|
|
216
240
|
const transactionClient = {
|
|
217
241
|
execute,
|
|
@@ -230,7 +254,16 @@ function createSingleConnectionTransactions(client, schema) {
|
|
|
230
254
|
let end;
|
|
231
255
|
open = new Promise((resolve) => (end = resolve));
|
|
232
256
|
try {
|
|
233
|
-
await
|
|
257
|
+
await statementsDone();
|
|
258
|
+
try {
|
|
259
|
+
await execute('BEGIN IMMEDIATE');
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
// Busy: BaseDb.transaction retries the whole transaction, on a fresh connection
|
|
263
|
+
if (isSqliteBusyError(error))
|
|
264
|
+
await client.reconnect();
|
|
265
|
+
throw error;
|
|
266
|
+
}
|
|
234
267
|
try {
|
|
235
268
|
const result = await fn(transactionDb);
|
|
236
269
|
await execute('COMMIT');
|
|
@@ -243,6 +276,8 @@ function createSingleConnectionTransactions(client, schema) {
|
|
|
243
276
|
catch {
|
|
244
277
|
// Already rolled back (SQLite does on some errors)
|
|
245
278
|
}
|
|
279
|
+
if (isSqliteBusyError(error))
|
|
280
|
+
await client.reconnect();
|
|
246
281
|
throw error;
|
|
247
282
|
}
|
|
248
283
|
}
|
|
@@ -376,10 +411,10 @@ class NodeDb {
|
|
|
376
411
|
logger$1('[Db.prepareDb] running migrations from %s', outDir);
|
|
377
412
|
await migrate(db, { migrationsFolder: outDir });
|
|
378
413
|
this.db = db;
|
|
379
|
-
const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-
|
|
414
|
+
const { backfillMetadataPropertyIds } = await import('./backfillMetadataPropertyIds-DWWkh-Ex.js');
|
|
380
415
|
await backfillMetadataPropertyIds();
|
|
381
416
|
// One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)
|
|
382
|
-
const { resetAmbiguousLegacyItemData } = await import('./resetAmbiguousLegacyItemData-
|
|
417
|
+
const { resetAmbiguousLegacyItemData } = await import('./resetAmbiguousLegacyItemData-0Tin9-JK.js');
|
|
383
418
|
await resetAmbiguousLegacyItemData();
|
|
384
419
|
return this.db;
|
|
385
420
|
}
|
|
@@ -664,4 +699,4 @@ function createPlatformServices() {
|
|
|
664
699
|
}
|
|
665
700
|
|
|
666
701
|
export { Db as D, FileManager as F, PathResolver as P, resolveFilesDir as a, createPlatformServices as c, resolveSdkDrizzleMigrationsDir as r };
|
|
667
|
-
//# sourceMappingURL=index.node-
|
|
702
|
+
//# sourceMappingURL=index.node-CgltN0cC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.node-CgltN0cC.js","sources":["../../src/helpers/dotSeedPath.ts","../../src/node/helpers/FileManager.ts","../../src/node/db/singleConnectionTransactions.ts","../../src/node/db/Db.ts","../../src/node/helpers/PathResolver.ts","../../src/node/helpers/resolveFilesDir.ts","../../src/platform/index.node.ts"],"sourcesContent":["/**\n * Whether a relative filesDir already names the .seed directory or a path inside\n * it ('.seed', '.seed/files', './.seed/files'). '.seed-alt/x' is not: it is\n * resolved under .seed like any other relative path.\n */\nexport function isUnderDotSeed(relativePath: string): boolean {\n const firstSegment = relativePath.split(/[\\\\/]+/).find((segment) => segment !== '' && segment !== '.')\n return firstSegment === '.seed'\n}\n","import * as fsAsync from 'fs/promises'\nimport * as fs from 'fs'\nimport { BaseFileManager } from '@/helpers/FileManager/BaseFileManager'\nimport type { IFileManager } from '@/helpers/FileManager/IFileManager'\nimport path from 'path'\nimport { pathToFileURL } from 'url'\n\nexport class NodeFileManager implements IFileManager {\n async getFs() {\n return fs\n }\n\n getFsSync() {\n return fs\n }\n\n /** Node has no blob URLs; a file:// URL keeps refResolvedDisplayValue meaningful for server callers. */\n async getContentUrlFromPath(filePath: string): Promise<string | undefined> {\n return pathToFileURL(path.resolve(filePath)).href\n }\n\n async initializeFileSystem(_workingDir?: string): Promise<void> {\n return // No need to initialize file system in node\n }\n\n async downloadAllFiles(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async resizeImage(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async resizeAllImages(): Promise<void> {\n throw new Error('Not implemented')\n }\n\n async pathExists(filePath: string): Promise<boolean> {\n return await fsAsync.access(filePath).then(() => true).catch(() => false)\n }\n\n /** Node reads the real file system; nothing is cached. */\n async invalidateCachedPaths(): Promise<void> {}\n\n async getFileSize(filePath: string): Promise<number | null> {\n try {\n const stat = await fsAsync.stat(filePath)\n return stat.size\n } catch {\n return null\n }\n }\n\n async listImageFiles(): Promise<string[]> {\n return this.listFiles('images')\n }\n\n async listFiles(dir: string): Promise<string[]> {\n const targetDir = BaseFileManager.getFilesPath(dir)\n const exists = await this.pathExists(targetDir)\n if (!exists) {\n return []\n }\n const entries = await fsAsync.readdir(targetDir, { withFileTypes: true })\n return entries.filter((entry) => entry.isFile()).map((entry) => entry.name)\n }\n\n async createDirIfNotExists(filePath: string): Promise<void> {\n await fsAsync.mkdir(filePath, { recursive: true })\n }\n\n async waitForFile(filePath: string, interval: number = 1000, timeout: number = 60000): Promise<boolean> {\n const pathExists = await this.pathExists(filePath)\n if (pathExists) {\n return true\n }\n\n return new Promise((resolve, reject) => {\n const startTime = Date.now()\n let isBusy = false\n\n const checkInterval = setInterval(async () => {\n if (isBusy) {\n return\n }\n isBusy = true\n\n try {\n const exists = await this.pathExists(filePath)\n if (exists) {\n clearInterval(checkInterval)\n resolve(true)\n return\n }\n\n if (Date.now() - startTime >= timeout) {\n clearInterval(checkInterval)\n reject(new Error('Timeout exceeded while waiting for file'))\n return\n }\n } catch (error) {\n clearInterval(checkInterval)\n reject(error)\n return\n } finally {\n isBusy = false\n }\n }, interval)\n })\n }\n\n async waitForFileWithContent(filePath: string, interval: number = 100, timeout: number = 5000): Promise<boolean> {\n return this.waitForFile(filePath, interval, timeout)\n }\n\n async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {\n const dir = path.dirname(filePath)\n await fsAsync.mkdir(dir, { recursive: true })\n\n if (typeof content === 'string') {\n await fsAsync.writeFile(filePath, content, 'utf-8')\n } else if (content instanceof Blob) {\n const arrayBuffer = await content.arrayBuffer()\n await fsAsync.writeFile(filePath, new Uint8Array(arrayBuffer))\n } else if (content instanceof ArrayBuffer) {\n await fsAsync.writeFile(filePath, new Uint8Array(content))\n } else {\n throw new Error('Unsupported content type')\n }\n }\n\n saveFileSync(filePath: string, content: string | Blob | ArrayBuffer): void {\n const dir = path.dirname(filePath)\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir, { recursive: true })\n }\n\n if (typeof content === 'string') {\n fs.writeFileSync(filePath, content, 'utf-8')\n } else if (content instanceof Blob) {\n throw new Error('Blob content not supported in saveFileSync. Use saveFile() instead or convert to ArrayBuffer first.')\n } else if (content instanceof ArrayBuffer) {\n fs.writeFileSync(filePath, new Uint8Array(content))\n } else {\n throw new Error('Unsupported content type')\n }\n }\n\n async readFileAsBuffer(filePath: string): Promise<Buffer> {\n return await fsAsync.readFile(filePath)\n }\n\n async readFileAsString(filePath: string): Promise<string> {\n return await fsAsync.readFile(filePath, 'utf-8')\n }\n\n async readFile(filePath: string): Promise<File> {\n return new File([await fsAsync.readFile(filePath)], filePath)\n }\n\n readFileSync(filePath: string): File {\n return new File([fs.readFileSync(filePath)], filePath)\n }\n\n getParentDirPath(filePath: string): string {\n return path.dirname(filePath)\n }\n\n getFilenameFromPath(filePath: string): string {\n return path.basename(filePath)\n }\n\n getPathModule(): any {\n return path\n }\n}\n\n/** @deprecated Prefer NodeFileManager */\nexport const FileManager = NodeFileManager\n\nBaseFileManager.configure(new NodeFileManager())\n\nconst _check: IFileManager = new NodeFileManager()\nvoid _check\n","import type { Client } from '@libsql/client'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { isSqliteBusyError, SQLITE_BUSY_RETRY_DELAYS_MS } from '@/browser/db/sqliteBusyRetry'\n\n/**\n * Transactions on libsql's one connection, with the browser's semantics (ADR 0019).\n *\n * libsql's own `transaction()` hands the transaction the client's connection and opens a new one\n * for everything after, so a process ends up with several connections that lock each other out\n * (SQLITE_BUSY) and, in tests, lost an outbox op's committed insert. Here every statement uses the\n * client's single connection instead:\n *\n * - `transaction(fn)` runs one transaction at a time: BEGIN IMMEDIATE, `fn` on a Drizzle database\n * whose statements go straight to the connection, then COMMIT, or ROLLBACK when `fn` throws.\n * - Statements on the app database (the patched client) wait while a transaction is open, as\n * SQLocal makes them wait in the browser. So `fn` must not use the app database: it would wait\n * for its own transaction.\n * - Statements outside a transaction keep the busy retry: another process may hold the file.\n *\n * libsql 0.5 doesn't reset a statement that failed with SQLITE_BUSY, and that leaves its\n * connection in an implicit transaction that never commits: every later write on it is lost when it\n * closes and never reaches the file (`inTransaction` still reads false). So after a busy error the\n * connection is replaced (`reconnect()`) before anything else runs on it, and a transaction waits\n * for statements that are between attempts.\n */\nexport function createSingleConnectionTransactions(client: Client, schema: Record<string, unknown>) {\n const execute = client.execute.bind(client)\n const batch = client.batch.bind(client)\n\n /** Resolves when the open transaction ends; undefined when none is open. */\n let open: Promise<void> | undefined\n /** The transactions waiting their turn, chained. */\n let queue: Promise<void> = Promise.resolve()\n\n const outsideTransactions = async () => {\n while (open) await open\n }\n\n /** Statements outside transactions that are running or replacing a busy connection. */\n let statementsRunning = 0\n const whenStatementsDone: (() => void)[] = []\n const statementsDone = () =>\n statementsRunning === 0 ? Promise.resolve() : new Promise<void>((resolve) => whenStatementsDone.push(resolve))\n\n const statement = async <T>(run: () => Promise<T>): Promise<T> => {\n for (let attempt = 0; ; attempt++) {\n await outsideTransactions()\n statementsRunning++\n try {\n return await run()\n } catch (error) {\n if (!isSqliteBusyError(error) || attempt >= SQLITE_BUSY_RETRY_DELAYS_MS.length) throw error\n await client.reconnect()\n } finally {\n if (--statementsRunning === 0) for (const resolve of whenStatementsDone.splice(0)) resolve()\n }\n await new Promise((resolve) => setTimeout(resolve, SQLITE_BUSY_RETRY_DELAYS_MS[attempt]))\n }\n }\n\n client.execute = ((...args: Parameters<Client['execute']>) => statement(() => execute(...args))) as Client['execute']\n client.batch = ((...args: Parameters<Client['batch']>) => statement(() => batch(...args))) as Client['batch']\n\n // What Drizzle uses of the client, straight to the connection: the transaction's own statements\n const transactionClient = {\n execute,\n batch,\n protocol: client.protocol,\n get closed() {\n return client.closed\n },\n } as unknown as Client\n const transactionDb = drizzle(transactionClient, { schema })\n\n async function transaction<T>(fn: (tx: typeof transactionDb) => Promise<T>): Promise<T> {\n const previous = queue\n let finished!: () => void\n queue = new Promise<void>((resolve) => (finished = resolve))\n await previous\n let end!: () => void\n open = new Promise<void>((resolve) => (end = resolve))\n try {\n await statementsDone()\n try {\n await execute('BEGIN IMMEDIATE')\n } catch (error) {\n // Busy: BaseDb.transaction retries the whole transaction, on a fresh connection\n if (isSqliteBusyError(error)) await client.reconnect()\n throw error\n }\n try {\n const result = await fn(transactionDb)\n await execute('COMMIT')\n return result\n } catch (error) {\n try {\n await execute('ROLLBACK')\n } catch {\n // Already rolled back (SQLite does on some errors)\n }\n if (isSqliteBusyError(error)) await client.reconnect()\n throw error\n }\n } finally {\n open = undefined\n end()\n finished()\n }\n }\n\n return { transaction }\n}\n","import { BaseDb } from '@/db/Db/BaseDb'\nimport type { IDb } from '@/interfaces/IDb'\nimport path from 'path'\nimport { fileURLToPath } from 'node:url'\nimport debug from 'debug'\nimport { appState } from '@/seedSchema'\nimport fs from 'fs'\nimport { createClient } from '@libsql/client'\nimport { createSingleConnectionTransactions } from './singleConnectionTransactions'\nimport { drizzle } from 'drizzle-orm/libsql'\nimport { migrate } from 'drizzle-orm/libsql/migrator'\nimport * as schema from '@/seedSchema'\nimport { Observable, interval, switchMap, distinctUntilChanged, startWith } from 'rxjs'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\n\nconst logger = debug('seedSdk:node:db:Db')\n\nexport interface DbConfig {\n dbUrl?: string\n /** @deprecated Unused — schema is the static SDK seedSchema + prebuilt SQL migrations */\n schemaDir?: string\n outDir?: string\n}\n\nfunction resolveDbPaths(filesDir: string, config?: DbConfig) {\n const outDir = config?.outDir || path.join(filesDir, 'db')\n const dbPath = config?.dbUrl\n ? (config.dbUrl.startsWith('file:') ? config.dbUrl.replace(/^file:/, '') : config.dbUrl)\n : path.join(outDir, 'seed.db')\n return { outDir, dbPath }\n}\n\n/**\n * Locate prebuilt drizzle migration SQL shipped with the SDK\n * (same files the browser embeds via drizzleFiles.ts).\n */\nexport function resolveSdkDrizzleMigrationsDir(sdkRootDir?: string): string {\n const root =\n sdkRootDir ||\n (() => {\n try {\n return BasePathResolver.getSdkRootDir()\n } catch {\n return process.cwd()\n }\n })()\n\n // Look next to this module first, so the SDK always runs its own migrations\n // whatever the working directory (monorepos, packaged Electron apps, scripts\n // run from elsewhere). Rollup bundles this file into a chunk directly under\n // dist/, next to the copied dist/db/drizzle.\n const moduleDir = path.dirname(fileURLToPath(import.meta.url))\n\n const candidates = [\n path.join(moduleDir, 'db', 'drizzle'), // bundled: dist/<chunk>.js -> dist/db/drizzle\n path.join(moduleDir, '..', '..', 'db', 'drizzle'), // source: src/node/db -> src/db/drizzle\n path.join(moduleDir, '..', 'db', 'drizzle'), // dist layout variants\n path.join(moduleDir, '..', '..', '..', 'src', 'db', 'drizzle'), // dist/node -> src\n path.join(root, 'db', 'drizzle'), // production: sdkRoot is dist/\n path.join(root, 'dist', 'db', 'drizzle'), // sdk package root with built dist\n path.join(root, 'src', 'db', 'drizzle'), // monorepo / sdk-dev\n path.join(root, 'packages', 'sdk', 'src', 'db', 'drizzle'), // monorepo root as cwd\n path.join(root, 'packages', 'sdk', 'dist', 'db', 'drizzle'),\n ]\n\n for (const candidate of candidates) {\n if (fs.existsSync(path.join(candidate, 'meta', '_journal.json'))) {\n return candidate\n }\n }\n\n throw new Error(\n `Could not find SDK drizzle migrations (meta/_journal.json). Searched under: ${candidates.join(', ')}`,\n )\n}\n\nfunction copyDirRecursive(sourceDir: string, targetDir: string) {\n if (!fs.existsSync(targetDir)) {\n fs.mkdirSync(targetDir, { recursive: true })\n }\n for (const entry of fs.readdirSync(sourceDir)) {\n const sourcePath = path.join(sourceDir, entry)\n const targetPath = path.join(targetDir, entry)\n const stats = fs.statSync(sourcePath)\n if (stats.isDirectory()) {\n copyDirRecursive(sourcePath, targetPath)\n } else {\n fs.copyFileSync(sourcePath, targetPath)\n }\n }\n}\n\n\n/** The file a local libsql `file:` URL opens; undefined for `:memory:` and remote URLs. */\nconst localDbFilePath = (dbUrl: string): string | undefined => {\n if (!dbUrl.startsWith('file:')) return undefined\n const filePath = dbUrl.slice('file:'.length).split('?')[0]\n if (!filePath || filePath === ':memory:') return undefined\n return filePath.startsWith('//') ? filePath.replace(/^\\/\\/(localhost)?/, '') : filePath\n}\n\nexport class NodeDb implements IDb {\n db: any\n\n\n getAppDb() {\n return this.db\n }\n\n isAppDbReady() {\n return !!this.db\n }\n\n transactions: ReturnType<typeof createSingleConnectionTransactions> | undefined\n\n async transaction<T>(fn: (tx: any) => Promise<T>): Promise<T> {\n if (!this.db || !this.transactions) throw new Error('Database not prepared')\n return this.transactions.transaction(fn)\n }\n\n /**\n * Copy prebuilt SQL migrations into the app db directory (overwrite to stay current).\n */\n copyDrizzleFiles(filesDir: string, migrationsSourceDir?: string, config?: DbConfig): string {\n const { outDir } = resolveDbPaths(filesDir, config)\n const source = migrationsSourceDir || resolveSdkDrizzleMigrationsDir()\n logger('[Db.copyDrizzleFiles] copying from %s to %s', source, outDir)\n copyDirRecursive(source, outDir)\n return outDir\n }\n\n async prepareDb(filesDir: string, config?: DbConfig) {\n const resolvedFilesDir = path.resolve(filesDir)\n\n if (!fs.existsSync(resolvedFilesDir)) {\n fs.mkdirSync(resolvedFilesDir, { recursive: true })\n }\n\n const { outDir, dbPath } = resolveDbPaths(resolvedFilesDir, config)\n\n if (!fs.existsSync(outDir)) {\n fs.mkdirSync(outDir, { recursive: true })\n }\n\n // Install SDK migration SQL next to the DB (same source of truth as browser)\n this.copyDrizzleFiles(resolvedFilesDir, undefined, config)\n\n const dbUrl = config?.dbUrl\n ? (config.dbUrl.startsWith('file:') ? config.dbUrl : `file:${path.resolve(config.dbUrl)}`)\n : `file:${path.resolve(dbPath)}`\n\n // libsql won't create the database's folder (\"Unable to open connection … 14\").\n const dbFilePath = localDbFilePath(dbUrl)\n if (dbFilePath) {\n fs.mkdirSync(path.dirname(dbFilePath), { recursive: true })\n }\n\n const client = createClient({ url: dbUrl })\n // One connection for everything, transactions included (see singleConnectionTransactions)\n this.transactions = createSingleConnectionTransactions(client, schema)\n // Readers in other processes (a CLI on the same file) don't block a commit in WAL\n if (localDbFilePath(dbUrl)) await client.execute('PRAGMA journal_mode = WAL')\n const db = drizzle(client, { schema })\n\n logger('[Db.prepareDb] running migrations from %s', outDir)\n await migrate(db, { migrationsFolder: outDir })\n\n this.db = db\n\n const { backfillMetadataPropertyIds } = await import('@/db/backfillMetadataPropertyIds')\n await backfillMetadataPropertyIds()\n\n // One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)\n const { resetAmbiguousLegacyItemData } = await import('@/db/resetAmbiguousLegacyItemData')\n await resetAmbiguousLegacyItemData()\n\n return this.db\n }\n\n async connectToDb(_pathToDir: string) {\n return {\n id: this.db ? this.db.constructor.name : '',\n }\n }\n\n async migrate(pathToDbDir: string, _dbName: string, _dbId: string) {\n try {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n\n await migrate(this.db, { migrationsFolder: pathToDbDir })\n const queryResult = await this.db.select().from(appState)\n logger('queryResult', queryResult)\n } catch (error: any) {\n const errorMessage = error.message || String(error) || ''\n const errorString = String(error)\n const isMigrationError =\n errorMessage.includes(\"Can't find meta/_journal.json\") ||\n errorMessage.includes('_journal.json') ||\n errorMessage.includes(\"Cannot read properties of undefined\") ||\n errorMessage.includes(\"reading 'dialect'\") ||\n errorMessage.includes('undefined is not an object') ||\n errorString.includes('dialect') ||\n errorString.includes('undefined is not an object')\n\n if (isMigrationError) {\n if (process.env.NODE_ENV === 'test' || process.env.IS_SEED_DEV) {\n logger(\n 'Warning: Migration failed, but continuing in test environment:',\n errorMessage || errorString,\n )\n return this.db\n }\n }\n throw error\n }\n\n return this.db\n }\n\n /**\n * Polling-based liveQuery stub for Node. Prefer browser reactive queries in UI apps.\n */\n liveQuery<T>(query: ((sql: any) => any) | any): Observable<T[]> {\n if (!this.db) {\n throw new Error('Database not initialized. Call prepareDb first.')\n }\n\n const pollInterval = 1000\n\n if (typeof query === 'function') {\n throw new Error(\n 'SQL tag functions are not supported in node liveQuery stub implementation. Use Drizzle query builders instead.',\n )\n }\n\n const queryBuilder = query\n\n return interval(pollInterval).pipe(\n startWith(0),\n switchMap(async () => {\n try {\n const result = await Promise.resolve(queryBuilder)\n return result as T[]\n } catch (error) {\n logger('[Db.liveQuery] Error executing query:', error)\n throw error\n }\n }),\n distinctUntilChanged((prev, curr) => {\n return JSON.stringify(prev) === JSON.stringify(curr)\n }),\n )\n }\n}\n\n/** @deprecated Prefer NodeDb */\nexport const Db = NodeDb\n\nBaseDb.configure(new NodeDb())\n\nconst _check: IDb = new NodeDb()\nvoid _check\n","import path from 'path'\nimport fs from 'fs'\nimport { SEED_CONFIG_FILE, SEED_CONFIG_FALLBACKS } from '@/helpers/constants'\nimport type { IPathResolver } from '@/helpers/PathResolver/IPathResolver'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:node:helpers:PathResolver')\n\nexport class NodePathResolver implements IPathResolver {\n /** @deprecated Prefer BasePathResolver static methods or configure(). */\n static getInstance(): IPathResolver {\n return BasePathResolver.getInstance()\n }\n\n /**\n * Detects the current environment based on filesystem structure and package.json\n */\n private detectEnvironment(): 'sdk-dev' | 'linked-sdk' | 'production' | 'test' {\n // Check if we're in the SDK repo itself\n if (process.env.NODE_ENV !== 'test' && this.isInSdkRepo()) {\n return 'sdk-dev'\n }\n\n // Check if we're running tests\n if (process.env.NODE_ENV === 'test') {\n return 'test'\n }\n\n // Check if we're using a linked version of the SDK\n if (this.isUsingLinkedSdk()) {\n return 'linked-sdk'\n }\n\n // Default to production environment\n return 'production'\n }\n\n private isInSdkRepo(): boolean {\n try {\n const currentDir = process.cwd()\n // Check when running from packages/sdk (SDK package root)\n if (fs.existsSync(path.join(currentDir, 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'package.json'), 'utf8')).name === '@seedprotocol/sdk') {\n return true\n }\n // Check when running from monorepo root\n if (fs.existsSync(path.join(currentDir, 'packages', 'sdk', 'src', 'node')) &&\n fs.existsSync(path.join(currentDir, 'packages', 'sdk', 'package.json')) &&\n JSON.parse(fs.readFileSync(path.join(currentDir, 'packages', 'sdk', 'package.json'), 'utf8')).name === '@seedprotocol/sdk') {\n return true\n }\n return false\n } catch {\n return false\n }\n }\n\n private isUsingLinkedSdk(): boolean {\n try {\n const pkgPath = path.join(process.cwd(), 'package.json')\n if (!fs.existsSync(pkgPath)) return false\n \n const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))\n const sdkDep = pkg.dependencies?.['@seedprotocol/sdk']\n \n return sdkDep && (sdkDep.startsWith('link:') || sdkDep.startsWith('portal:'))\n } catch {\n return false\n }\n }\n\n /**\n * Gets the root directory containing node_modules\n */\n getRootWithNodeModules(): string {\n const processCwd = process.cwd()\n\n const calledFromMocks = processCwd.includes('__mocks__')\n\n if (calledFromMocks) {\n return path.join(processCwd, '..', '..', '..', '..',)\n }\n\n return processCwd\n }\n\n /**\n * Gets the SDK root directory\n */\n getSdkRootDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n const processCwd = process.cwd()\n\n // For test environment, always return the SDK root directory\n if (env === 'test') {\n return rootWithNodeModules\n }\n\n if (env === 'linked-sdk') {\n // For linked packages, find the package directory\n const pkgJson = JSON.parse(fs.readFileSync(path.join(processCwd, 'package.json'), 'utf8'))\n const sdkPath = pkgJson.dependencies?.['@seedprotocol/sdk'] || pkgJson.devDependencies?.['@seedprotocol/sdk']\n if (sdkPath === 'link:@seedprotocol/sdk') {\n return path.join(processCwd, 'node_modules', '@seedprotocol', 'sdk',)\n }\n return path.resolve(processCwd, sdkPath.replace(/^(link:|portal:)/, ''))\n }\n\n // After early returns, env can only be 'sdk-dev' or 'production'\n if (env === 'sdk-dev') {\n // When running from monorepo root, SDK root is packages/sdk\n if (fs.existsSync(path.join(rootWithNodeModules, 'packages', 'sdk', 'package.json'))) {\n return path.join(rootWithNodeModules, 'packages', 'sdk')\n }\n // When running from packages/sdk directly\n return rootWithNodeModules\n }\n \n // Production: {sdk package}/dist. Resolve the installed package rather than\n // assuming it sits under the working directory: hoisted monorepos, packaged\n // Electron apps and scripts run from another directory all differ.\n try {\n const { createRequire } = process.getBuiltinModule('node:module')\n const pkgJson = createRequire(import.meta.url).resolve('@seedprotocol/sdk/package.json')\n return path.join(path.dirname(pkgJson), 'dist')\n } catch {\n return path.join(rootWithNodeModules, 'node_modules', '@seedprotocol', 'sdk', 'dist')\n }\n }\n\n getNodeModulesDir(): string {\n const env = this.detectEnvironment()\n const rootWithNodeModules = this.getRootWithNodeModules()\n\n let nodeModulesDir = path.join(rootWithNodeModules, 'node_modules')\n\n if (env !== 'linked-sdk' && env !== 'sdk-dev' && nodeModulesDir.includes('__tests__')) {\n nodeModulesDir = path.join(process.cwd(), '..', '..', '..', '..', 'node_modules',)\n }\n\n return nodeModulesDir\n }\n\n /**\n * Gets the .seed directory path\n */\n getDotSeedDir(schemaFileDir?: string): string {\n if (!schemaFileDir && process.env.SEED_SDK_TEST_PROJECT_TYPE && !process.cwd().includes('__mocks__')) {\n return path.join(process.cwd(), '__tests__', '__mocks__', process.env.SEED_SDK_TEST_PROJECT_TYPE, 'project', '.seed')\n }\n return path.join(schemaFileDir || process.cwd(), '.seed')\n }\n\n /**\n * Finds the Seed Protocol config file in the given directory\n * @param searchDir - Directory to search for the config file\n * @returns The path to the found config file, or null if not found\n */\n findConfigFile(searchDir: string = process.cwd()): string | null {\n // First try the primary config file name\n const primaryPath = path.join(searchDir, SEED_CONFIG_FILE)\n if (fs.existsSync(primaryPath)) {\n return primaryPath\n }\n\n // Then try fallback names in order\n for (const fallbackName of SEED_CONFIG_FALLBACKS) {\n const fallbackPath = path.join(searchDir, fallbackName)\n if (fs.existsSync(fallbackPath)) {\n return fallbackPath\n }\n }\n\n return null\n }\n\n /**\n * Gets paths for app-specific directories\n */\n getAppPaths(schemaFileDir?: string | undefined) {\n const env = this.detectEnvironment()\n const dotSeedDir = this.getDotSeedDir(schemaFileDir)\n const nodeModulesDir = this.getNodeModulesDir()\n\n logger('env', env)\n\n logger('getAppPaths', {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n })\n\n return {\n sdkRootDir: this.getSdkRootDir(),\n dotSeedDir,\n nodeModulesDir,\n appSchemaDir: path.join(dotSeedDir, 'schema'),\n appDbDir: path.join(dotSeedDir, 'db'),\n appMetaDir: path.join(dotSeedDir, 'db', 'meta'),\n }\n }\n}\n\n/** @deprecated Prefer NodePathResolver; kept for CLI / node entry exports. */\nexport const PathResolver = NodePathResolver\n\nBasePathResolver.configure(new NodePathResolver())\n\nconst _check: IPathResolver = new NodePathResolver()\nvoid _check\n","import fs from 'fs'\nimport path from 'path'\nimport { BasePathResolver } from '@/helpers/PathResolver/BasePathResolver'\nimport { isUnderDotSeed } from '@/helpers/dotSeedPath'\n\n/**\n * The filesDir to use on Node, resolved relative to the .seed directory at the project root.\n * A browser OPFS-style path such as '/app-files' that doesn't exist on disk becomes\n * '.seed/app-files'; a relative path not already under .seed is joined to .seed; other absolute\n * paths are used as-is.\n */\nexport function resolveFilesDir(filesDir: string): string {\n // Not created here: prepareDb creates filesDir (under .seed when it's relative), so an absolute\n // filesDir works from a read-only working directory (e.g. a packaged Electron app's cwd `/`).\n const dotSeedDir = BasePathResolver.getDotSeedDir()\n\n // Browser OPFS paths are single-level, like '/app-files' or '/files'.\n const pathWithoutLeadingSlash = filesDir.slice(1)\n const isBrowserOpfsPath =\n path.isAbsolute(filesDir) &&\n filesDir.startsWith('/') &&\n pathWithoutLeadingSlash.length > 0 &&\n !pathWithoutLeadingSlash.includes('/') &&\n !fs.existsSync(filesDir)\n\n if (isBrowserOpfsPath) {\n return path.join(dotSeedDir, filesDir.slice(1) || 'app-files')\n }\n if (!path.isAbsolute(filesDir)) {\n return isUnderDotSeed(filesDir) ? path.resolve(filesDir) : path.join(dotSeedDir, filesDir)\n }\n return filesDir\n}\n","import { NodePathResolver } from '@/node/helpers/PathResolver'\nimport { NodeFileManager } from '@/node/helpers/FileManager'\nimport { NodeDb } from '@/node/db/Db'\nimport { NodeArweaveClient } from '@/node/helpers/ArweaveClient'\nimport { NodeEasClient } from '@/node/helpers/EasClient'\nimport { NodeQueryClient } from '@/node/helpers/QueryClient'\nimport type { PlatformServices } from './types'\n\nexport function createPlatformServices(): PlatformServices {\n return {\n pathResolver: new NodePathResolver(),\n fileManager: new NodeFileManager(),\n db: new NodeDb(),\n arweaveClient: new NodeArweaveClient(),\n easClient: new NodeEasClient(),\n queryClient: new NodeQueryClient(),\n }\n}\n\nexport { configurePlatform } from './configurePlatform'\nexport { resolveFilesDir } from '@/node/helpers/resolveFilesDir'\nexport type { PlatformServices } from './types'\n"],"names":["logger","fs"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;AAIG;AACG,SAAU,cAAc,CAAC,YAAoB,EAAA;IACjD,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,QAAQ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AAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC9B,OAAO,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC5F;AACA,IAAA,OAAO,QAAQ;AACjB;;SCxBgB,sBAAsB,GAAA;IACpC,OAAO;QACL,YAAY,EAAE,IAAI,gBAAgB,EAAE;QACpC,WAAW,EAAE,IAAI,eAAe,EAAE;QAClC,EAAE,EAAE,IAAI,MAAM,EAAE;QAChB,aAAa,EAAE,IAAI,iBAAiB,EAAE;QACtC,SAAS,EAAE,IAAI,aAAa,EAAE;QAC9B,WAAW,EAAE,IAAI,eAAe,EAAE;KACnC;AACH;;"}
|
package/dist/main.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export { C as ConflictError, d as ItemCreateError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
export { getPropertySchema } from './property-
|
|
5
|
-
export { A as ADDRESSES_PERSISTED_EVENT, F as FILES_CHANGED_EVENT, L as LOCAL_COPIES_REMOVED_EVENT, T as TabLockTimeoutError, i as isLeaderTab, p as parseAddressesPersistedPayload, w as whenLeaderTab } from './
|
|
6
|
-
export { E as EAS_CHAIN_ID_APP_STATE_KEY, I as INIT_CONFIG_CONFLICT_MESSAGE, q as assertLocalDbChain, u as claimUnpublishedDrafts, C as client, v as createLocalQueryDataSource, x as createSchema, y as easSyncActor, z as getClient, A as getPublishedSeedRecord, B as getSchemaNameFromId, i as importJsonSchema, D as isSeedQueryLocalSourceRegistered, F as listSchemas, G as loadAllSchemasFromDb, H as mergeEasSyncRequestIntents, r as readJsonImportFile, J as readSchema, K as registerSeedQueryLocalSource, L as requestEasSyncFromAddressChange, M as requestEasSyncFromEventBus, N as requestEasSyncFromModelsInit, O as sendEasSyncClientRequest, P as setRetriesWhenOnlineEnabled, Q as startEasSyncActor, j as syncSchemaFromSource, k as transformImportToSchemaFile, S as unregisterSeedQueryLocalSource } from './ClientManager-
|
|
7
|
-
import { N as isVersionRevoked, D as compareMetadataRowsLatestFirst, G as parseListPropertyValueFromStorage, W as isPublishedMetadataRow, F as getLatestPublishedVersionRow } from './Item-
|
|
8
|
-
export { X as ClientManagerState, I as Item, x as ItemProperty, y as ItemPropertySaveValidationError, M as METADATA_LATEST_FIRST_ORDER_SQL, Y as MachineIds, z as OwnershipError, Z as PUBLISH_NOT_CONFIGURED_MESSAGE, A as assertItemOwned, _ as createNewItem, K as getGetAdditionalSyncAddresses, $ as getGetPublisherForNewSeeds, a0 as getMetadataLatest, a1 as getPublishExecutor, a2 as getRevokeExecutor, a3 as getUploadExecutor, a4 as getVersionData, B as isItemOwned, a5 as isLocalUnsealedDraft, a6 as isSeedRowOwned, a7 as localUnsealedDraftSql, a8 as ownedPublisherSql, a9 as ownedSeedsSql, aa as pickLatestMetadataRowPerProperty, ab as placeholderUidSql, ac as propertyMachine, ad as publisherInAddressListSql, ae as publisherIsInOwnedSet, af as setAdditionalSyncAddresses, ag as setGetPublisherForNewSeeds, ah as setPublishExecutor, ai as setRevokeExecutor, aj as setUploadExecutor, C as waitForEntityIdle } from './Item-
|
|
1
|
+
export { C as ConflictError, d as ItemCreateError, I as ItemCreateValidationError, M as Model, U as UnknownModelError } from './errors-rIWK7gwJ.js';
|
|
2
|
+
import { G as BaseDb, F as versions, ae as normalizePublisher, C as seeds, aj as generateId, m as metadata, t as models, w as properties, n as normalizeDataType, ac as listRelationEasPropertyName, j as arweaveL1FinalizeJobs, X as normalizeRelationPropertyValue, Y as resolveSeedIdsFromRefString, i as isDataType, M as ModelPropertyDataTypes, a8 as INTERNAL_PROPERTY_NAMES, p as htmlEmbeddedImageCoPublish, a5 as ZERO_BYTES32, Q as BaseFileManager, $ as getStorageDirForDataType } from './index-C0SetTd1.js';
|
|
3
|
+
export { I as AmbiguousModelError, av as CONTENT_SHA256_TAG, aw as CONTENT_TYPE_TAG, ai as EAS_SEED_DATA_SYNCED_TO_DB_EVENT, ab as INTERNAL_DATA_TYPES, ax as ImageSize, ay as SEED_PROTOCOL_SCHEMA_NAME, az as SeedModels, aA as VERSION_SCHEMA_DEF, a7 as VERSION_SCHEMA_UID, aB as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, h as appState, a1 as buildArweaveContentTags, aC as classifyMediaRef, aD as closestImageSize, aE as contentSha256TagMatches, ad as easPropertyNameForPublish, l as easSyncProcesses, aF as ensureImageLocal, J as eventEmitter, aG as getAddressesForItemsFilter, Z as getArweaveUrlForTransaction, a0 as getContentSha256, V as getCorrectId, aH as getFeedItemStringField, W as isPublishedSeedRef, r as modelSchemas, s as modelUids, aI as normalizeAddressConfig, aJ as normalizeAddressList, aK as normalizeArweaveTxIdForEnsure, aL as normalizeFeedItemFields, ak as normalizeHexAddress, z as propertyUids, A as publishProcesses, aM as resolveMediaRef, B as schemas, E as uploadProcesses } from './index-C0SetTd1.js';
|
|
4
|
+
export { getPropertySchema } from './property-pcDxNEpy.js';
|
|
5
|
+
export { A as ADDRESSES_PERSISTED_EVENT, F as FILES_CHANGED_EVENT, L as LOCAL_COPIES_REMOVED_EVENT, T as TabLockTimeoutError, i as isChangeFeedRunning, a as isLeaderTab, p as parseAddressesPersistedPayload, w as watchEntityChanges, b as watchEntityRows, c as whenLeaderTab } from './changeFeed-DcsZ7deG.js';
|
|
6
|
+
export { E as EAS_CHAIN_ID_APP_STATE_KEY, I as INIT_CONFIG_CONFLICT_MESSAGE, q as assertLocalDbChain, u as claimUnpublishedDrafts, C as client, v as createLocalQueryDataSource, x as createSchema, y as easSyncActor, z as getClient, A as getPublishedSeedRecord, B as getSchemaNameFromId, i as importJsonSchema, D as isSeedQueryLocalSourceRegistered, F as listSchemas, G as loadAllSchemasFromDb, H as mergeEasSyncRequestIntents, r as readJsonImportFile, J as readSchema, K as registerSeedQueryLocalSource, L as requestEasSyncFromAddressChange, M as requestEasSyncFromEventBus, N as requestEasSyncFromModelsInit, O as sendEasSyncClientRequest, P as setRetriesWhenOnlineEnabled, Q as startEasSyncActor, j as syncSchemaFromSource, k as transformImportToSchemaFile, S as unregisterSeedQueryLocalSource } from './ClientManager-B1r_8P5Z.js';
|
|
7
|
+
import { N as isVersionRevoked, D as compareMetadataRowsLatestFirst, G as parseListPropertyValueFromStorage, W as isPublishedMetadataRow, F as getLatestPublishedVersionRow } from './Item-CjTEShfk.js';
|
|
8
|
+
export { X as ClientManagerState, I as Item, x as ItemProperty, y as ItemPropertySaveValidationError, M as METADATA_LATEST_FIRST_ORDER_SQL, Y as MachineIds, z as OwnershipError, Z as PUBLISH_NOT_CONFIGURED_MESSAGE, A as assertItemOwned, _ as createNewItem, K as getGetAdditionalSyncAddresses, $ as getGetPublisherForNewSeeds, a0 as getMetadataLatest, a1 as getPublishExecutor, a2 as getRevokeExecutor, a3 as getUploadExecutor, a4 as getVersionData, B as isItemOwned, a5 as isLocalUnsealedDraft, a6 as isSeedRowOwned, a7 as localUnsealedDraftSql, a8 as ownedPublisherSql, a9 as ownedSeedsSql, aa as pickLatestMetadataRowPerProperty, ab as placeholderUidSql, ac as propertyMachine, ad as publisherInAddressListSql, ae as publisherIsInOwnedSet, af as setAdditionalSyncAddresses, ag as setGetPublisherForNewSeeds, ah as setPublishExecutor, ai as setRevokeExecutor, aj as setUploadExecutor, C as waitForEntityIdle } from './Item-CjTEShfk.js';
|
|
9
9
|
import { eq, desc, and, inArray, or, isNotNull, ne, isNull } from 'drizzle-orm';
|
|
10
10
|
import { easName, BaseQueryClient, BaseEasClient, GET_SCHEMAS, isPlaceholderUid, isValidEasAttestationUid, normalizeBytes32Hex } from '@seedprotocol/eas';
|
|
11
11
|
export { EAS_CHAIN_DEPLOYMENTS, BaseEasClient as EasClient, easName, getCanonicalItemPropertiesFromEas, getEasChainDeployment, getEasEndpoint, getEasReadChainId, getEasSchemaUidBySchemaName, getItemPropertiesFromEas, getItemVersionsFromEas, getSeedsBySchemaName, getSeedsFromSchemaUids, isPlaceholderUid, isValidEasAttestationUid, matchEasName, normalizeBytes32Hex, pickLatestPropertyAttestationsByRefAndSchema, setSchemaUidForModel, setSchemaUidForSchemaDefinition, withExcludeRevokedFilter } from '@seedprotocol/eas';
|
|
12
|
-
export { S as Schema, d as deleteModelFromSchema, a as deletePropertyFromModel, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-
|
|
12
|
+
export { S as Schema, d as deleteModelFromSchema, a as deletePropertyFromModel, r as renameModelProperty, s as schemaMachine, u as updateModelProperties } from './Schema-CX9CTtho.js';
|
|
13
13
|
export { D as DatabaseNotPersistentError, F as FileSystemLockedError } from './errors-Do7v6RKu.js';
|
|
14
|
-
export { M as MODEL_AMBIGUOUS_EVENT } from './resolveModelForSyncedSeed-
|
|
15
|
-
export { ModelProperty } from './ModelProperty-
|
|
16
|
-
export { getModelSchemasFromEas } from './eas
|
|
14
|
+
export { M as MODEL_AMBIGUOUS_EVENT } from './resolveModelForSyncedSeed-C5KXn6ex.js';
|
|
15
|
+
export { ModelProperty } from './ModelProperty-C3749Wjq.js';
|
|
16
|
+
export { getModelSchemasFromEas } from './eas--9vtNkma.js';
|
|
17
17
|
export { BaseArweaveClient, DEFAULT_ARWEAVE_GATEWAYS, DEFAULT_ARWEAVE_GRAPHQL_URL, DEFAULT_ARWEAVE_HOST, DEFAULT_GATEWAY_SIDECAR_HOST, DEFAULT_GATEWAY_SIDECAR_PORT, DEFAULT_SEED_FEED_HYPER_KEY, DEFAULT_SEED_GATEWAY_HYPER_KEY, SEED_RSS_IMAGE_RELATION_FIELD_KEYS, ensureReadGatewaySelected, fetchArweaveRawFromBaseUrl, fetchArweaveRawTextAcrossGateways, getArweaveReadBaseUrls, getArweaveUploadStatus, getDefaultArweaveReadGatewayHostsOrdered, getLastHealthyReadGatewayHost, getPreferredArweaveReadBaseUrls, getReadGatewayHostsForConfig, getResolvedArweaveReadBaseUrls, getResolvedSeedGatewayEndpoints, getUploadApiArweaveDataUrl, getUploadApiArweaveStatusUrl, getUploadPipelineTransactionStatus, hasArweaveContentReadTransform, invalidateReadGatewayCache, invalidateSidecarProbeCache, isArweaveL1AnchoringComplete, isEasAttestationExplorerUrl, isGatewayHostCircuitOpen, isKnownArweaveGatewayHostname, isReadGatewayKnownHealthy, mergePrimaryHostWithDefaults, normalizeGatewayHostKey, normalizeUploadApiBaseUrl, queryArweaveGatewayTransaction, queryArweaveGatewayTransactionWithFallback, readArweaveContentResponse, recordGatewayHostFailure, recordGatewayHostSuccess, resetArweaveReadGatewayForTests, resolveSeedGatewayEndpoints, resolveSeedRssImageRelationFromItem, resolveSeedRssImageRelationRef, seedGatewayConfigFromClientContext, seedGatewayConfigFromSeedConfig, setArweaveContentReadTransform, setPreferredArweaveReadBaseUrls, setResolvedSeedGatewayEndpoints, transformArweaveContent } from '@seedprotocol/arweave';
|
|
18
|
-
export { u as updateSeedRevokedAt } from './updateSeedRevokedAt-
|
|
19
|
-
import { a as getSegmentedItemProperties, g as getPublishDraftGraph, i as isSeedRevoked, f as findRelatedSeedRow, b as isUnpublishedSeed, h as htmlPropertyNameForHtmlSeed, r as relatedModelNameFromDef } from './publishDraftGraph-
|
|
20
|
-
export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-
|
|
18
|
+
export { u as updateSeedRevokedAt } from './updateSeedRevokedAt-CR4zwn-6.js';
|
|
19
|
+
import { a as getSegmentedItemProperties, g as getPublishDraftGraph, i as isSeedRevoked, f as findRelatedSeedRow, b as isUnpublishedSeed, h as htmlPropertyNameForHtmlSeed, r as relatedModelNameFromDef } from './publishDraftGraph-I5yKe1Xz.js';
|
|
20
|
+
export { P as PublishValidationFailedError, R as RELATED_ITEM_UNPUBLISHED_CODE, a as RelatedItemUnpublishedError, r as resolvePublishPayloadValues, v as validateItemForPublish } from './getPublishPayload-BGl2SaGK.js';
|
|
21
21
|
import 'pluralize';
|
|
22
|
-
import { g as getRelatedDraftsCoPublishedWith, f as findEmbeddedImageFilePath } from './getPublishUploads-
|
|
23
|
-
export { H as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, a as HTML_EMBEDDED_MAX_IMAGE_BYTES, b as HTML_EMBEDDED_MAX_TOTAL_BYTES, c as HtmlEmbeddedDataUriLimitError, d as HtmlSeedPropertyRefError, S as SEED_PROPERTY_REF_PREFIX, e as clearHtmlEmbeddedImageCoPublishRows, h as extractDataUriImagesFromHtml, i as findSeedPropertyRefsInHtml, j as getPublishUploadData, k as itemHasPublishUploadCandidates, p as prepareHtmlEmbeddedImagesForPublish, r as replaceDataUrisInParsedHtml, l as replaceSeedPropertyRefsInHtml, m as resolveEffectiveHtmlEmbeddedDataUriPolicy, n as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-
|
|
22
|
+
import { g as getRelatedDraftsCoPublishedWith, f as findEmbeddedImageFilePath } from './getPublishUploads-DVsDx6Xf.js';
|
|
23
|
+
export { H as HTML_EMBEDDED_MAX_IMAGES_PER_DOC, a as HTML_EMBEDDED_MAX_IMAGE_BYTES, b as HTML_EMBEDDED_MAX_TOTAL_BYTES, c as HtmlEmbeddedDataUriLimitError, d as HtmlSeedPropertyRefError, S as SEED_PROPERTY_REF_PREFIX, e as clearHtmlEmbeddedImageCoPublishRows, h as extractDataUriImagesFromHtml, i as findSeedPropertyRefsInHtml, j as getPublishUploadData, k as itemHasPublishUploadCandidates, p as prepareHtmlEmbeddedImagesForPublish, r as replaceDataUrisInParsedHtml, l as replaceSeedPropertyRefsInHtml, m as resolveEffectiveHtmlEmbeddedDataUriPolicy, n as rewriteHtmlEmbeddedImagesOnDisk } from './getPublishUploads-DVsDx6Xf.js';
|
|
24
24
|
import 'js-yaml';
|
|
25
25
|
import 'xstate';
|
|
26
26
|
import 'debug';
|
|
@@ -35,7 +35,7 @@ import '@noble/hashes/sha3';
|
|
|
35
35
|
import '@noble/hashes/utils';
|
|
36
36
|
import 'lodash-es';
|
|
37
37
|
import 'rxjs';
|
|
38
|
-
import './SchemaValidationService-
|
|
38
|
+
import './SchemaValidationService-T5mqnY8q.js';
|
|
39
39
|
import '@sinclair/typebox/value';
|
|
40
40
|
import 'parse5';
|
|
41
41
|
import './mimeTypes-C9r76DCH.js';
|
|
@@ -134,14 +134,11 @@ const updateVersionUid = async ({ seedLocalId, versionUid, publisher, attestatio
|
|
|
134
134
|
.limit(1);
|
|
135
135
|
if (!seed)
|
|
136
136
|
return;
|
|
137
|
-
const now = Date.now();
|
|
138
137
|
await appDb.insert(versions).values({
|
|
139
138
|
localId: generateId(),
|
|
140
139
|
seedLocalId,
|
|
141
140
|
seedType: seed.type,
|
|
142
141
|
uid: versionUid,
|
|
143
|
-
createdAt: now,
|
|
144
|
-
updatedAt: now,
|
|
145
142
|
...(normalizedPublisher && { publisher: normalizedPublisher }),
|
|
146
143
|
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
147
144
|
});
|
|
@@ -157,7 +154,6 @@ const updateVersionUid = async ({ seedLocalId, versionUid, publisher, attestatio
|
|
|
157
154
|
uid: versionUid,
|
|
158
155
|
...(shouldSetPublisher && { publisher: normalizedPublisher }),
|
|
159
156
|
...(attestationCreatedAt != null && { attestationCreatedAt }),
|
|
160
|
-
updatedAt: Date.now(),
|
|
161
157
|
})
|
|
162
158
|
.where(eq(versions.localId, toUpdate.localId));
|
|
163
159
|
};
|
|
@@ -274,6 +270,7 @@ async function applyPropertyAttestationUidsFromPublish(params) {
|
|
|
274
270
|
attestationRaw: null,
|
|
275
271
|
revokedAt: null,
|
|
276
272
|
derivedFromUid: null,
|
|
273
|
+
// Stamped here: the spread copies the source row's times.
|
|
277
274
|
createdAt: now,
|
|
278
275
|
updatedAt: now,
|
|
279
276
|
};
|
|
@@ -292,7 +289,6 @@ async function applyPropertyAttestationUidsFromPublish(params) {
|
|
|
292
289
|
...(attestationCreatedAtMs != null && { attestationCreatedAt: attestationCreatedAtMs }),
|
|
293
290
|
...(validVersion && { versionUid: validVersion }),
|
|
294
291
|
...(versionLocalId && { versionLocalId }),
|
|
295
|
-
updatedAt: Date.now(),
|
|
296
292
|
})
|
|
297
293
|
.where(eq(metadata.localId, target.localId));
|
|
298
294
|
const i = working.findIndex((r) => r.localId === target.localId);
|
|
@@ -677,7 +673,6 @@ async function applyArweaveL1TransactionIdLocal(params) {
|
|
|
677
673
|
const rows = await appDb.select().from(metadata).where(where);
|
|
678
674
|
if (!rows.length)
|
|
679
675
|
return;
|
|
680
|
-
const now = Date.now();
|
|
681
676
|
for (const row of rows) {
|
|
682
677
|
const localId = row.localId;
|
|
683
678
|
if (!localId)
|
|
@@ -694,7 +689,6 @@ async function applyArweaveL1TransactionIdLocal(params) {
|
|
|
694
689
|
refResolvedDisplayValue: row.refResolvedDisplayValue
|
|
695
690
|
? row.refResolvedDisplayValue.split(dataItemId).join(l1TransactionId)
|
|
696
691
|
: row.refResolvedDisplayValue,
|
|
697
|
-
updatedAt: now,
|
|
698
692
|
})
|
|
699
693
|
.where(eq(metadata.localId, localId));
|
|
700
694
|
}
|
|
@@ -744,7 +738,6 @@ async function restoreDataItemIdsOverwrittenByL1() {
|
|
|
744
738
|
propertyValue: job.dataItemId,
|
|
745
739
|
refResolvedValue: swap(row.refResolvedValue),
|
|
746
740
|
refResolvedDisplayValue: swap(row.refResolvedDisplayValue),
|
|
747
|
-
updatedAt: Date.now(),
|
|
748
741
|
})
|
|
749
742
|
.where(eq(metadata.localId, row.localId));
|
|
750
743
|
restored += 1;
|
|
@@ -766,7 +759,7 @@ async function getRelatedItemsForPublish(item, visited = new Set()) {
|
|
|
766
759
|
visited.add(seedLocalId);
|
|
767
760
|
const result = [];
|
|
768
761
|
const { itemRelationProperties, itemImageProperties, itemListProperties } = await getSegmentedItemProperties(item);
|
|
769
|
-
const getItemMod = await import('./getItem-
|
|
762
|
+
const getItemMod = await import('./getItem-5j22EWWE.js');
|
|
770
763
|
const { getItem } = getItemMod;
|
|
771
764
|
const processRelationOrImage = async (prop) => {
|
|
772
765
|
const snapshot = prop.getService().getSnapshot();
|
|
@@ -785,7 +778,7 @@ async function getRelatedItemsForPublish(item, visited = new Set()) {
|
|
|
785
778
|
if (!value && prop.propertyName && isStorageSeed) {
|
|
786
779
|
const ctx = context;
|
|
787
780
|
if (ctx.seedLocalId || ctx.seedUid) {
|
|
788
|
-
const _mod_0 = await import('./Item-
|
|
781
|
+
const _mod_0 = await import('./Item-CjTEShfk.js');
|
|
789
782
|
const _ns_0 = _mod_0.au;
|
|
790
783
|
const { getPropertyData } = _ns_0;
|
|
791
784
|
const meta = await getPropertyData({
|
|
@@ -978,7 +971,7 @@ async function loadRelatedItem(value) {
|
|
|
978
971
|
const { seedLocalId, seedUid } = resolveSeedIdsFromRefString(normalized);
|
|
979
972
|
if (!seedLocalId && !seedUid)
|
|
980
973
|
return undefined;
|
|
981
|
-
const { getItem } = await import('./getItem-
|
|
974
|
+
const { getItem } = await import('./getItem-5j22EWWE.js');
|
|
982
975
|
try {
|
|
983
976
|
return await getItem({ seedLocalId, seedUid });
|
|
984
977
|
}
|
|
@@ -1074,7 +1067,7 @@ async function appendCoPublishImages(item, acc, seen, visited, forceFullSnapshot
|
|
|
1074
1067
|
.from(htmlEmbeddedImageCoPublish)
|
|
1075
1068
|
.where(eq(htmlEmbeddedImageCoPublish.parentSeedLocalId, item.seedLocalId));
|
|
1076
1069
|
for (const row of rows) {
|
|
1077
|
-
const _mod_1 = await import('./Item-
|
|
1070
|
+
const _mod_1 = await import('./Item-CjTEShfk.js');
|
|
1078
1071
|
const _ns_1 = _mod_1.av;
|
|
1079
1072
|
const { Item } = _ns_1;
|
|
1080
1073
|
const imageItem = await Item.find({
|