@seedprotocol/sdk 0.2.43 → 0.2.45
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/{ArweaveClient-BXD_aTsx.js → ArweaveClient-CoFomTCN.js} +2 -2
- package/dist/{ArweaveClient-CkcZD_QE.js.map → ArweaveClient-CoFomTCN.js.map} +1 -1
- package/dist/{ArweaveClient-CkcZD_QE.js → ArweaveClient-DQrXvrNN.js} +2 -2
- package/dist/{ArweaveClient-BXD_aTsx.js.map → ArweaveClient-DQrXvrNN.js.map} +1 -1
- package/dist/{Db-Bug4efsE.js → Db-BlgPVb_Z.js} +156 -166
- package/dist/Db-BlgPVb_Z.js.map +1 -0
- package/dist/{Db-B4XyOmGy.js → Db-gw_uZA_e.js} +34 -43
- package/dist/{Db-B4XyOmGy.js.map → Db-gw_uZA_e.js.map} +1 -1
- package/dist/{EasClient-BNwSwDTO.js → EasClient-CBu9ENAi.js} +2 -2
- package/dist/{EasClient-epqE9aWI.js.map → EasClient-CBu9ENAi.js.map} +1 -1
- package/dist/{EasClient-epqE9aWI.js → EasClient-sCbTHcO8.js} +2 -2
- package/dist/{EasClient-BNwSwDTO.js.map → EasClient-sCbTHcO8.js.map} +1 -1
- package/dist/FileManager-BNqJl6Bz.js +781 -0
- package/dist/FileManager-BNqJl6Bz.js.map +1 -0
- package/dist/FileManager-COOp89Mj.js +38 -0
- package/dist/FileManager-COOp89Mj.js.map +1 -0
- package/dist/{Item-vjJTzf1d.js → Item-BO38NUjz.js} +9 -12
- package/dist/{Item-vjJTzf1d.js.map → Item-BO38NUjz.js.map} +1 -1
- package/dist/{ItemProperty-DJpbernm.js → ItemProperty-8H7B05zy.js} +9 -12
- package/dist/{ItemProperty-DJpbernm.js.map → ItemProperty-8H7B05zy.js.map} +1 -1
- package/dist/{QueryClient-Ckl99FYC.js → QueryClient-BBaE-LKI.js} +2 -2
- package/dist/{QueryClient-Ckl99FYC.js.map → QueryClient-BBaE-LKI.js.map} +1 -1
- package/dist/{QueryClient-Do0C7Jnt.js → QueryClient-C-ZzUnWq.js} +2 -2
- package/dist/{QueryClient-Do0C7Jnt.js.map → QueryClient-C-ZzUnWq.js.map} +1 -1
- package/dist/bin.js +28 -27
- package/dist/bin.js.map +1 -1
- package/dist/{constants-BakHTrB9.js → constants-Dgv-tSO3.js} +76 -41
- package/dist/constants-Dgv-tSO3.js.map +1 -0
- package/dist/{index-DcPIAiHD.js → index-CsbUKGXp.js} +1330 -1571
- package/dist/index-CsbUKGXp.js.map +1 -0
- package/dist/{index-BWIn7kWN.js → index-Km3L1_LR.js} +9 -12
- package/dist/index-Km3L1_LR.js.map +1 -0
- package/dist/main.js +7 -10
- package/dist/main.js.map +1 -1
- package/dist/node/codegen/templates/index.njk +0 -4
- package/dist/{seed.schema.config-DGcg6TCS.js → seed.schema.config-Dn_1QbD7.js} +9 -11
- package/dist/seed.schema.config-Dn_1QbD7.js.map +1 -0
- package/dist/seedSchema/index.ts +0 -2
- package/dist/src/BaseFileManager.ts +31 -2
- package/dist/src/BaseItem.ts +4 -3
- package/dist/src/BaseItemProperty.ts +2 -2
- package/dist/src/FileDownloader.ts +63 -0
- package/dist/src/FileManager.ts +37 -6
- package/dist/src/ImageResizer.ts +84 -0
- package/dist/src/analyzeInput.ts +22 -2
- package/dist/src/configureFs.ts +18 -5
- package/dist/src/constants.ts +67 -60
- package/dist/src/createMetadata.ts +27 -2
- package/dist/src/dbMachine.ts +6 -0
- package/dist/src/download.ts +48 -203
- package/dist/src/filesDownload.ts +326 -0
- package/dist/src/getItem.ts +5 -0
- package/dist/src/getPublishPayload.ts +15 -8
- package/dist/src/getPublishUploads.ts +0 -27
- package/dist/src/helpers.ts +7 -15
- package/dist/src/hydrateFromDb.ts +4 -1
- package/dist/src/imageResize.ts +507 -0
- package/dist/src/internalMachine.ts +16 -0
- package/dist/src/migrate.ts +0 -24
- package/dist/src/model.ts +6 -5
- package/dist/src/saveImageSrc.ts +15 -1
- package/dist/src/syncDbWithEas.ts +0 -90
- package/dist/src/updateItemPropertyValue.ts +16 -3
- package/dist/src/validate.ts +6 -3
- package/dist/src/waitForDb.ts +18 -17
- package/dist/src/waitForFiles.ts +9 -8
- package/dist/types/src/Item/BaseItem.d.ts +2 -2
- package/dist/types/src/Item/BaseItem.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/BaseItemProperty.d.ts +2 -2
- package/dist/types/src/ItemProperty/BaseItemProperty.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/service/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.d.ts.map +1 -1
- package/dist/types/src/browser/db/Db.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts +5 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/browser/workers/FileDownloader.d.ts +8 -0
- package/dist/types/src/browser/workers/FileDownloader.d.ts.map +1 -0
- package/dist/types/src/browser/workers/ImageResizer.d.ts +9 -0
- package/dist/types/src/browser/workers/ImageResizer.d.ts.map +1 -0
- package/dist/types/src/browser/workers/content-hash.d.ts.map +1 -0
- package/dist/types/src/browser/workers/filesDownload.d.ts +3 -0
- package/dist/types/src/browser/workers/filesDownload.d.ts.map +1 -0
- package/dist/types/src/browser/workers/imageResize.d.ts +3 -0
- package/dist/types/src/browser/workers/imageResize.d.ts.map +1 -0
- package/dist/types/src/db/read/getItem.d.ts.map +1 -1
- package/dist/types/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/types/src/db/read/getPublishUploads.d.ts.map +1 -1
- package/dist/types/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/types/src/db/write/updateItemPropertyValue.d.ts +5 -1
- package/dist/types/src/db/write/updateItemPropertyValue.d.ts.map +1 -1
- package/dist/types/src/events/files/download.d.ts.map +1 -1
- package/dist/types/src/events/files/index.d.ts.map +1 -1
- package/dist/types/src/events/item/syncDbWithEas.d.ts.map +1 -1
- package/dist/types/src/helpers/FileManager/BaseFileManager.d.ts +6 -0
- package/dist/types/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/types/src/helpers/constants.d.ts +7 -0
- package/dist/types/src/helpers/constants.d.ts.map +1 -1
- package/dist/types/src/helpers/files.d.ts +1 -1
- package/dist/types/src/helpers/files.d.ts.map +1 -1
- package/dist/types/src/node/helpers/FileManager.d.ts +5 -0
- package/dist/types/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/schema/model/index.d.ts +2 -2
- package/dist/types/src/schema/model/index.d.ts.map +1 -1
- package/dist/types/src/seedSchema/index.d.ts +0 -2
- package/dist/types/src/seedSchema/index.d.ts.map +1 -1
- package/dist/types/src/services/allItems/actors/initialize.d.ts.map +1 -1
- package/dist/types/src/services/db/actors/migrate.d.ts.map +1 -1
- package/dist/types/src/services/db/actors/validate.d.ts.map +1 -1
- package/dist/types/src/services/db/dbMachine.d.ts +10 -0
- package/dist/types/src/services/db/dbMachine.d.ts.map +1 -1
- package/dist/types/src/services/internal/actors/configureFs.d.ts.map +1 -1
- package/dist/types/src/services/internal/actors/waitForFiles.d.ts +4 -0
- package/dist/types/src/services/internal/actors/waitForFiles.d.ts.map +1 -0
- package/dist/types/src/services/internal/constants.d.ts +2 -2
- package/dist/types/src/services/internal/constants.d.ts.map +1 -1
- package/dist/types/src/services/internal/helpers.d.ts.map +1 -1
- package/dist/types/src/services/internal/internalMachine.d.ts +10 -0
- package/dist/types/src/services/internal/internalMachine.d.ts.map +1 -1
- package/dist/types/src/types/fileManager.d.ts +15 -0
- package/dist/types/src/types/fileManager.d.ts.map +1 -0
- package/dist/types/src/types/model.d.ts +6 -5
- package/dist/types/src/types/model.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/Db-Bug4efsE.js.map +0 -1
- package/dist/FileManager-CXk83EW5.js +0 -16
- package/dist/FileManager-CXk83EW5.js.map +0 -1
- package/dist/FileManager-DXi-X7r5.js +0 -28
- package/dist/FileManager-DXi-X7r5.js.map +0 -1
- package/dist/constants-BakHTrB9.js.map +0 -1
- package/dist/content-hash.js +0 -27
- package/dist/content-hash.js.map +0 -1
- package/dist/index-BWIn7kWN.js.map +0 -1
- package/dist/index-DcPIAiHD.js.map +0 -1
- package/dist/seed.schema.config-DGcg6TCS.js.map +0 -1
- package/dist/types/__tests__/__mocks__/browser/project/schema.d.ts +0 -52
- package/dist/types/__tests__/__mocks__/browser/project/schema.d.ts.map +0 -1
- package/dist/types/__tests__/__mocks__/node/schema.d.ts +0 -52
- package/dist/types/__tests__/__mocks__/node/schema.d.ts.map +0 -1
- package/dist/types/__tests__/browser/db/drizzle.test.d.ts +0 -2
- package/dist/types/__tests__/browser/db/drizzle.test.d.ts.map +0 -1
- package/dist/types/__tests__/browser/property/propertyMachine.test.d.ts +0 -2
- package/dist/types/__tests__/browser/property/propertyMachine.test.d.ts.map +0 -1
- package/dist/types/__tests__/browser/react/index.test.d.ts +0 -2
- package/dist/types/__tests__/browser/react/index.test.d.ts.map +0 -1
- package/dist/types/__tests__/dist/exports.test.d.ts +0 -2
- package/dist/types/__tests__/dist/exports.test.d.ts.map +0 -1
- package/dist/types/__tests__/fs/index.test.d.ts +0 -2
- package/dist/types/__tests__/fs/index.test.d.ts.map +0 -1
- package/dist/types/__tests__/index.test.d.ts +0 -2
- package/dist/types/__tests__/index.test.d.ts.map +0 -1
- package/dist/types/__tests__/node/Item/Item.test.d.ts +0 -2
- package/dist/types/__tests__/node/Item/Item.test.d.ts.map +0 -1
- package/dist/types/__tests__/node/setup.d.ts +0 -2
- package/dist/types/__tests__/node/setup.d.ts.map +0 -1
- package/dist/types/__tests__/scripts/bin.test.d.ts +0 -2
- package/dist/types/__tests__/scripts/bin.test.d.ts.map +0 -1
- package/dist/types/__tests__/setup.d.ts +0 -2
- package/dist/types/__tests__/setup.d.ts.map +0 -1
- package/dist/types/src/workers/content-hash.d.ts.map +0 -1
- /package/dist/types/src/{workers → browser/workers}/content-hash.d.ts +0 -0
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
export { I as Item } from './index-
|
|
1
|
+
export { I as Item } from './index-CsbUKGXp.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
|
-
import 'tslib';
|
|
5
4
|
import '@sinclair/typebox';
|
|
6
|
-
import '
|
|
5
|
+
import 'xstate';
|
|
6
|
+
import './constants-Dgv-tSO3.js';
|
|
7
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
8
|
+
import 'pluralize';
|
|
9
|
+
import 'drizzle-orm/sqlite-core';
|
|
7
10
|
import 'drizzle-orm';
|
|
8
|
-
import '
|
|
11
|
+
import 'eventemitter3';
|
|
9
12
|
import 'nanoid';
|
|
10
13
|
import 'nanoid-dictionary';
|
|
11
14
|
import '@zenfs/core';
|
|
12
15
|
import 'debug';
|
|
13
|
-
import 'drizzle-orm/sqlite-core';
|
|
14
|
-
import './constants-BakHTrB9.js';
|
|
15
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
16
|
-
import 'xstate';
|
|
17
|
-
import 'pluralize';
|
|
18
16
|
import 'lodash-es';
|
|
19
17
|
import '@statelyai/inspect';
|
|
20
18
|
import 'node:fs';
|
|
21
|
-
import '@zenfs/dom';
|
|
22
19
|
import 'path';
|
|
23
20
|
import 'arweave';
|
|
24
|
-
import 'threads';
|
|
25
21
|
import 'rxjs';
|
|
22
|
+
import 'react';
|
|
26
23
|
import 'use-immer';
|
|
27
24
|
import '@xstate/react';
|
|
28
|
-
//# sourceMappingURL=index-
|
|
25
|
+
//# sourceMappingURL=index-Km3L1_LR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Km3L1_LR.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/main.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import 'immer';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
export { D as Db, c as ImageSrc, d as Item, e as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text,
|
|
4
|
-
export { B as BaseArweaveClient, a as BaseEasClient, c as BaseFileManager, b as BaseQueryClient } from './constants-
|
|
5
|
-
import 'tslib';
|
|
3
|
+
export { D as Db, c as ImageSrc, d as Item, e as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, v as client, r as eventEmitter, p as getCorrectId, q as getGlobalService, h as useCreateItem, j as useDeleteItem, k as useGlobalServiceStatus, f as useItem, g as useItemProperties, i as useItemProperty, u as useItems, m as usePersistedSnapshots, l as usePublishItem, o as useService, n as useServices, t as withSeed } from './index-CsbUKGXp.js';
|
|
4
|
+
export { B as BaseArweaveClient, a as BaseEasClient, c as BaseFileManager, b as BaseQueryClient } from './constants-Dgv-tSO3.js';
|
|
6
5
|
import '@sinclair/typebox';
|
|
7
|
-
import '
|
|
6
|
+
import 'xstate';
|
|
7
|
+
import 'pluralize';
|
|
8
|
+
import 'drizzle-orm/sqlite-core';
|
|
8
9
|
import 'drizzle-orm';
|
|
9
|
-
import '
|
|
10
|
+
import 'eventemitter3';
|
|
10
11
|
import 'nanoid';
|
|
11
12
|
import 'nanoid-dictionary';
|
|
12
13
|
import '@zenfs/core';
|
|
13
14
|
import 'debug';
|
|
14
|
-
import 'drizzle-orm/sqlite-core';
|
|
15
|
-
import 'xstate';
|
|
16
|
-
import 'pluralize';
|
|
17
15
|
import 'lodash-es';
|
|
18
16
|
import '@statelyai/inspect';
|
|
19
17
|
import 'node:fs';
|
|
20
|
-
import '@zenfs/dom';
|
|
21
18
|
import 'path';
|
|
22
19
|
import 'arweave';
|
|
23
|
-
import 'threads';
|
|
24
20
|
import 'rxjs';
|
|
25
21
|
import '@ethereum-attestation-service/eas-sdk';
|
|
22
|
+
import 'react';
|
|
26
23
|
import 'use-immer';
|
|
27
24
|
import '@xstate/react';
|
|
28
25
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -8,8 +8,6 @@ import { versions } from '../../seed/schema/VersionSchema'
|
|
|
8
8
|
import { metadata } from '../../seed/schema/MetadataSchema'
|
|
9
9
|
import { models } from '../../seed/schema/ModelSchema'
|
|
10
10
|
import { modelUids } from '../../seed/schema/ModelUidSchema'
|
|
11
|
-
import { propertyUids } from '../../seed/schema/PropertyUidSchema'
|
|
12
|
-
import { config } from '../../seed/schema/Config'
|
|
13
11
|
{% for model in models %}
|
|
14
12
|
export * from './{{ model.name }}Schema'
|
|
15
13
|
{%- endfor %}
|
|
@@ -23,8 +21,6 @@ tablesByName.set('versions', versions)
|
|
|
23
21
|
tablesByName.set('metadata', metadata)
|
|
24
22
|
tablesByName.set('models', models)
|
|
25
23
|
tablesByName.set('modelUids', modelUids)
|
|
26
|
-
tablesByName.set('propertyUids', propertyUids)
|
|
27
|
-
tablesByName.set('config', config)
|
|
28
24
|
|
|
29
25
|
export const getTable = (table: string) => {
|
|
30
26
|
return tablesByName.get(table)
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
import { T as Text, M as Model } from './index-
|
|
3
|
+
import { T as Text, M as Model } from './index-CsbUKGXp.js';
|
|
4
4
|
import 'immer';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
|
-
import '
|
|
6
|
+
import 'xstate';
|
|
7
|
+
import './constants-Dgv-tSO3.js';
|
|
8
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
9
|
+
import 'pluralize';
|
|
10
|
+
import 'drizzle-orm/sqlite-core';
|
|
7
11
|
import 'drizzle-orm';
|
|
8
|
-
import '
|
|
12
|
+
import 'eventemitter3';
|
|
9
13
|
import 'nanoid';
|
|
10
14
|
import 'nanoid-dictionary';
|
|
11
15
|
import '@zenfs/core';
|
|
12
16
|
import 'debug';
|
|
13
|
-
import 'drizzle-orm/sqlite-core';
|
|
14
|
-
import './constants-BakHTrB9.js';
|
|
15
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
16
|
-
import 'xstate';
|
|
17
|
-
import 'pluralize';
|
|
18
17
|
import 'lodash-es';
|
|
19
18
|
import '@statelyai/inspect';
|
|
20
19
|
import 'node:fs';
|
|
21
|
-
import '@zenfs/dom';
|
|
22
20
|
import 'path';
|
|
23
21
|
import 'arweave';
|
|
24
|
-
import 'threads';
|
|
25
22
|
import 'rxjs';
|
|
23
|
+
import 'react';
|
|
26
24
|
import 'use-immer';
|
|
27
25
|
import '@xstate/react';
|
|
28
26
|
|
|
@@ -72,4 +70,4 @@ const models = {
|
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
export { models };
|
|
75
|
-
//# sourceMappingURL=seed.schema.config-
|
|
73
|
+
//# sourceMappingURL=seed.schema.config-Dn_1QbD7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.schema.config-Dn_1QbD7.js","sources":["../../src/db/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/schema'\n\n@Model\nclass Seed {\n @Text() uid!: string\n @Text() type!: string\n}\n\n@Model\nclass Version {\n @Text() seedUid!: string\n @Text() note!: string\n}\n\n@Model\nclass Metadata {\n @Text() key!: string\n @Text() value!: string\n}\n\nexport const models = {\n Seed,\n Version,\n Metadata,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,IAAI,GAAV,MAAM,IAAI,CAAA;CAGT;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,IAAI,GAAA,UAAA,CAAA;IADT;AACK,CAAA,EAAA,IAAI,CAGT;AAGD,IAAM,OAAO,GAAb,MAAM,OAAO,CAAA;CAGZ;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAiB,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA;AAChB,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,OAAO,GAAA,UAAA,CAAA;IADZ;AACK,CAAA,EAAA,OAAO,CAGZ;AAGD,IAAM,QAAQ,GAAd,MAAM,QAAQ,CAAA;CAGb;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAe,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAFlB,QAAQ,GAAA,UAAA,CAAA;IADb;AACK,CAAA,EAAA,QAAQ,CAGb;AAEY,MAAA,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,QAAQ;;;;;"}
|
package/dist/seedSchema/index.ts
CHANGED
|
@@ -2,7 +2,5 @@ export * from './SeedSchema'
|
|
|
2
2
|
export * from './VersionSchema'
|
|
3
3
|
export * from './MetadataSchema'
|
|
4
4
|
export * from './AppStateSchema'
|
|
5
|
-
export * from './ConfigSchema'
|
|
6
5
|
export * from './ModelSchema'
|
|
7
6
|
export * from './ModelUidSchema'
|
|
8
|
-
export * from './PropertyUidSchema'
|
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
export abstract class BaseFileManager {
|
|
2
|
+
private fileSystemInitialized = false
|
|
3
|
+
private initializing = false
|
|
4
|
+
|
|
2
5
|
static PlatformClass: typeof BaseFileManager
|
|
3
6
|
|
|
4
|
-
static setPlatformClass(platformClass: typeof BaseFileManager) {
|
|
7
|
+
static setPlatformClass( platformClass: typeof BaseFileManager ) {
|
|
5
8
|
this.PlatformClass = platformClass
|
|
6
9
|
}
|
|
7
10
|
|
|
8
|
-
static
|
|
11
|
+
static async initializeFileSystem(): Promise<void> {
|
|
12
|
+
if (this.initializing || this.fileSystemInitialized) {
|
|
13
|
+
return Promise.resolve()
|
|
14
|
+
}
|
|
15
|
+
this.initializing = true
|
|
16
|
+
await this.PlatformClass.initializeFileSystem()
|
|
17
|
+
this.fileSystemInitialized = true
|
|
18
|
+
this.initializing = false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getContentUrlFromPath( path: string ): Promise<string | undefined> {
|
|
9
22
|
return this.PlatformClass.getContentUrlFromPath(path)
|
|
10
23
|
}
|
|
24
|
+
|
|
25
|
+
static downloadAllFiles( {
|
|
26
|
+
transactionIds,
|
|
27
|
+
arweaveHost,
|
|
28
|
+
excludedTransactions,
|
|
29
|
+
}: DownloadAllFilesParams ): Promise<void> {
|
|
30
|
+
return this.PlatformClass.downloadAllFiles({ transactionIds, arweaveHost, excludedTransactions })
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static resizeImage( { filePath, width, height }: ResizeImageParams ): Promise<void> {
|
|
34
|
+
return this.PlatformClass.resizeImage({ filePath, width, height })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static resizeAllImages( { width, height }: ResizeAllImagesParams ): Promise<void> {
|
|
38
|
+
return this.PlatformClass.resizeAllImages({ width, height })
|
|
39
|
+
}
|
|
11
40
|
}
|
package/dist/src/BaseItem.ts
CHANGED
|
@@ -32,7 +32,7 @@ import { createNewItem } from '@/db/write/createNewItem'
|
|
|
32
32
|
|
|
33
33
|
export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements IItem<T> {
|
|
34
34
|
|
|
35
|
-
protected static instanceCache: Map<string, { instance:
|
|
35
|
+
protected static instanceCache: Map<string, { instance: BaseItem<any>; refCount: number }> = new Map();
|
|
36
36
|
protected _subscription: Subscription | undefined;
|
|
37
37
|
protected readonly _storageTransactionId: string | undefined;
|
|
38
38
|
[immerable] = true;
|
|
@@ -185,7 +185,7 @@ export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements II
|
|
|
185
185
|
|
|
186
186
|
static async create<T extends ModelValues<ModelSchema>>(
|
|
187
187
|
props: Partial<ItemData>,
|
|
188
|
-
): Promise<
|
|
188
|
+
): Promise<BaseItem<any>> {
|
|
189
189
|
if (!props.modelName && props.type) {
|
|
190
190
|
props.modelName = startCase(props.type)
|
|
191
191
|
}
|
|
@@ -226,10 +226,11 @@ export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements II
|
|
|
226
226
|
if (!props.modelName) {
|
|
227
227
|
throw new Error('Model name is required to create an item')
|
|
228
228
|
}
|
|
229
|
-
const { seedLocalId } = await createNewItem({
|
|
229
|
+
const { seedLocalId, versionLocalId, versionUid } = await createNewItem({
|
|
230
230
|
modelName: props.modelName,
|
|
231
231
|
})
|
|
232
232
|
props.seedLocalId = seedLocalId
|
|
233
|
+
props.latestVersionLocalId = versionLocalId
|
|
233
234
|
const newInstance = new this(props)
|
|
234
235
|
this.instanceCache.set(newInstance.seedUid || newInstance.seedLocalId, {
|
|
235
236
|
instance: newInstance,
|
|
@@ -30,7 +30,7 @@ type ItemPropertyFindProps = {
|
|
|
30
30
|
export abstract class BaseItemProperty<PropertyType> implements IItemProperty<PropertyType> {
|
|
31
31
|
protected static instanceCache: Map<
|
|
32
32
|
string,
|
|
33
|
-
{ instance:
|
|
33
|
+
{ instance: BaseItemProperty<any>; refCount: number }
|
|
34
34
|
> = new Map()
|
|
35
35
|
protected readonly _service: ItemPropertyService
|
|
36
36
|
protected _subject: BehaviorSubject<any>
|
|
@@ -221,7 +221,7 @@ export abstract class BaseItemProperty<PropertyType> implements IItemProperty<Pr
|
|
|
221
221
|
|
|
222
222
|
static create(
|
|
223
223
|
props: Partial<CreatePropertyInstanceProps>,
|
|
224
|
-
):
|
|
224
|
+
): BaseItemProperty<any> | undefined {
|
|
225
225
|
const { propertyName, seedLocalId, seedUid, versionLocalId, versionUid } =
|
|
226
226
|
props
|
|
227
227
|
if (!propertyName || (!seedLocalId && !seedUid)) {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { saveAppState } from '@/db/write/saveAppState.js';
|
|
2
|
+
import filesDownload from './filesDownload.js'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class FileDownloader {
|
|
7
|
+
private cores: number
|
|
8
|
+
private workersArchive: Worker[] = []
|
|
9
|
+
private workerBlobUrl: string
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
this.cores = Math.min(navigator.hardwareConcurrency || 4, 4);
|
|
13
|
+
|
|
14
|
+
this.workerBlobUrl = globalThis.URL.createObjectURL(
|
|
15
|
+
new Blob([filesDownload], { type: 'application/javascript' })
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public downloadAll = async ({transactionIds, arweaveHost, excludedTransactions}: DownloadAllFilesParams): Promise<void> => {
|
|
20
|
+
|
|
21
|
+
if (this.workersArchive.length > 0) {
|
|
22
|
+
for (let i = 0; i < this.workersArchive.length; i++) {
|
|
23
|
+
this.workersArchive[i].terminate()
|
|
24
|
+
delete this.workersArchive[i]
|
|
25
|
+
}
|
|
26
|
+
this.workersArchive = []
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const worker = new Worker(this.workerBlobUrl);
|
|
30
|
+
|
|
31
|
+
this.workersArchive.push(worker)
|
|
32
|
+
|
|
33
|
+
const localExcludedTransactions = new Set(excludedTransactions)
|
|
34
|
+
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
worker.onmessage = (e) => {
|
|
37
|
+
console.log('filesDownload main thread onmessage', e.data);
|
|
38
|
+
|
|
39
|
+
if (e.data.message === 'excludeTransaction') {
|
|
40
|
+
localExcludedTransactions.add(e.data.transactionId)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (e.data.done) {
|
|
44
|
+
saveAppState('excludedTransactions', JSON.stringify(Array.from(localExcludedTransactions)))
|
|
45
|
+
.then(() => {
|
|
46
|
+
resolve(e.data)
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
reject(error)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
if (e.data.error) {
|
|
53
|
+
reject(e.data.error)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
worker.postMessage({
|
|
58
|
+
transactionIds,
|
|
59
|
+
arweaveHost,
|
|
60
|
+
});
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
}
|
package/dist/src/FileManager.ts
CHANGED
|
@@ -1,13 +1,44 @@
|
|
|
1
|
-
import * as fsAsync
|
|
2
|
-
import { BaseFileManager } from '@/helpers/FileManager/BaseFileManager'
|
|
1
|
+
import * as fsAsync from 'fs/promises'
|
|
2
|
+
import { BaseFileManager } from '@/helpers/FileManager/BaseFileManager'
|
|
3
3
|
|
|
4
4
|
class FileManager extends BaseFileManager {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
static async readFileAsBuffer( filePath: string ): Promise<Buffer> {
|
|
7
|
+
return await fsAsync.readFile(filePath)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static async getContentUrlFromPath( path: string ): Promise<string | undefined> {
|
|
11
|
+
return new Promise(( resolve, reject ) => {
|
|
12
|
+
reject(new Error('Not implemented'))
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static async initializeFileSystem(): Promise<void> {
|
|
17
|
+
return new Promise(( resolve, reject ) => {
|
|
18
|
+
reject(new Error('Not implemented'))
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static async downloadAllFiles(): Promise<void> {
|
|
23
|
+
return new Promise(( resolve, reject ) => {
|
|
24
|
+
reject(new Error('Not implemented'))
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static async resizeImage(): Promise<void> {
|
|
29
|
+
return new Promise(( resolve, reject ) => {
|
|
30
|
+
reject(new Error('Not implemented'))
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static async resizeAllImages(): Promise<void> {
|
|
35
|
+
return new Promise(( resolve, reject ) => {
|
|
36
|
+
reject(new Error('Not implemented'))
|
|
37
|
+
})
|
|
7
38
|
}
|
|
8
39
|
|
|
9
40
|
}
|
|
10
41
|
|
|
11
|
-
BaseFileManager.setPlatformClass(FileManager)
|
|
42
|
+
BaseFileManager.setPlatformClass(FileManager)
|
|
12
43
|
|
|
13
|
-
export { FileManager }
|
|
44
|
+
export { FileManager }
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import fs from '@zenfs/core';
|
|
2
|
+
import imageResize from './imageResize'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class ImageResizer {
|
|
7
|
+
private cores: number
|
|
8
|
+
private workersArchive: Map<string, Worker> = new Map()
|
|
9
|
+
private workerBlobUrl: string
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
this.cores = Math.min(navigator.hardwareConcurrency || 4, 4);
|
|
13
|
+
|
|
14
|
+
this.workerBlobUrl = globalThis.URL.createObjectURL(
|
|
15
|
+
new Blob([imageResize], { type: 'application/javascript' })
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async resize({filePath, width, height}: ResizeImageParams) {
|
|
20
|
+
|
|
21
|
+
if (this.workersArchive.has(filePath)) {
|
|
22
|
+
const savedWorker = this.workersArchive.get(filePath)
|
|
23
|
+
savedWorker?.terminate()
|
|
24
|
+
console.log('[ImageResizer.resize] Terminated worker for filePath due to incoming request', filePath)
|
|
25
|
+
this.workersArchive.delete(filePath)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const worker = new Worker(this.workerBlobUrl);
|
|
29
|
+
|
|
30
|
+
this.workersArchive.set(filePath, worker)
|
|
31
|
+
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
worker.onmessage = (e) => {
|
|
34
|
+
console.log('[ImageResizer.resize] main thread onmessage', e.data);
|
|
35
|
+
if (e.data.done) {
|
|
36
|
+
const savedWorker = this.workersArchive.get(filePath)
|
|
37
|
+
savedWorker?.terminate()
|
|
38
|
+
console.log('[ImageResizer.resize] Terminated worker for filePath due to done', filePath)
|
|
39
|
+
this.workersArchive.delete(filePath)
|
|
40
|
+
resolve(e.data)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (e.data.error) {
|
|
44
|
+
reject(e.data.error)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
worker.postMessage({
|
|
49
|
+
filePath,
|
|
50
|
+
width,
|
|
51
|
+
height,
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public async resizeAll({width, height}: ResizeAllImagesParams) {
|
|
57
|
+
|
|
58
|
+
const imageDir = '/files/images'
|
|
59
|
+
let imageFilesStats = await fs.promises.readdir(imageDir, {
|
|
60
|
+
withFileTypes: true
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
imageFilesStats = imageFilesStats.filter(file => file.isFile())
|
|
64
|
+
|
|
65
|
+
const imageFiles = imageFilesStats.map(file => file.path)
|
|
66
|
+
|
|
67
|
+
const widthDir = `${imageDir}/${width}`
|
|
68
|
+
|
|
69
|
+
const widthDirExists = await fs.promises.exists(widthDir)
|
|
70
|
+
|
|
71
|
+
if (!widthDirExists) {
|
|
72
|
+
await fs.promises.mkdir(widthDir)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
for (const imageFile of imageFiles) {
|
|
76
|
+
const resizedImageExists = await fs.promises.exists(`${widthDir}/${imageFile}`)
|
|
77
|
+
if (!resizedImageExists) {
|
|
78
|
+
await this.resize({filePath: `${imageDir}/${imageFile}`, width, height})
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
}
|
|
84
|
+
}
|
package/dist/src/analyzeInput.ts
CHANGED
|
@@ -97,7 +97,7 @@ export const analyzeInput = fromCallback<
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
await updateItemPropertyValue({
|
|
100
|
+
const result = await updateItemPropertyValue({
|
|
101
101
|
localId,
|
|
102
102
|
propertyName,
|
|
103
103
|
newValue,
|
|
@@ -108,9 +108,29 @@ export const analyzeInput = fromCallback<
|
|
|
108
108
|
schemaUid,
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
+
let updatedContext: Partial<PropertyMachineContext> = {
|
|
112
|
+
propertyValue: newValue,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (localId) {
|
|
116
|
+
updatedContext.localId = localId
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (schemaUid) {
|
|
120
|
+
updatedContext.schemaUid = schemaUid
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!localId && result?.localId) {
|
|
124
|
+
updatedContext.localId = result.localId
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (!schemaUid && result?.schemaUid) {
|
|
128
|
+
updatedContext.schemaUid = result.schemaUid
|
|
129
|
+
}
|
|
130
|
+
|
|
111
131
|
sendBack({
|
|
112
132
|
type: 'updateContext',
|
|
113
|
-
|
|
133
|
+
...updatedContext,
|
|
114
134
|
})
|
|
115
135
|
|
|
116
136
|
return true
|
package/dist/src/configureFs.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const configureFs = fromCallback<
|
|
|
20
20
|
|
|
21
21
|
logger('[internal/actors] [configureFs] Configuring FS')
|
|
22
22
|
|
|
23
|
-
const _configureFs = async (): Promise<
|
|
23
|
+
const _configureFs = async (): Promise<boolean> => {
|
|
24
24
|
logger('[internal/actors] [configureFs] calling _configureFs')
|
|
25
25
|
|
|
26
26
|
logger(
|
|
@@ -44,12 +44,24 @@ export const configureFs = fromCallback<
|
|
|
44
44
|
|
|
45
45
|
const journalPath = `${filesDir || BROWSER_FS_TOP_DIR}/db/meta/_journal.json`
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
let journalExists = await fs.promises.exists(journalPath)
|
|
49
|
+
|
|
50
|
+
if (!journalExists) {
|
|
51
|
+
journalExists = fs.existsSync(journalPath)
|
|
52
|
+
}
|
|
48
53
|
|
|
49
54
|
if (journalExists) {
|
|
50
55
|
appDbService.send({ type: DB_WAITING_FOR_FILES_RECEIVED })
|
|
56
|
+
logger('[internal/actors] [configureFs] fs configured!')
|
|
57
|
+
return true
|
|
51
58
|
}
|
|
52
59
|
|
|
60
|
+
sendBack({ type: 'shouldWaitForFiles' })
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
return false
|
|
64
|
+
|
|
53
65
|
// return new Promise<void>((resolve) => {
|
|
54
66
|
// const interval = setInterval(() => {
|
|
55
67
|
// journalExistsSync = fs.existsSync(journalPath)
|
|
@@ -65,15 +77,16 @@ export const configureFs = fromCallback<
|
|
|
65
77
|
// }, 200)
|
|
66
78
|
// })
|
|
67
79
|
|
|
68
|
-
logger('[internal/actors] [configureFs] fs configured!')
|
|
69
80
|
}
|
|
70
81
|
|
|
71
82
|
// Some of our dependencies use fs sync functions, which don't work with
|
|
72
83
|
// OPFS. ZenFS creates an async cache of all files so that the sync functions
|
|
73
84
|
// work, but we have to wait for it to be built. Otherwise things like
|
|
74
85
|
// drizzleMigrate will fail since they can't see the migration files yet.
|
|
75
|
-
_configureFs().then(() => {
|
|
76
|
-
|
|
86
|
+
_configureFs().then((fsConfigured) => {
|
|
87
|
+
if (fsConfigured) {
|
|
88
|
+
sendBack({ type: INTERNAL_CONFIGURING_FS_SUCCESS })
|
|
89
|
+
}
|
|
77
90
|
return
|
|
78
91
|
})
|
|
79
92
|
|