@seedprotocol/sdk 0.2.54 → 0.3.1
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-D5iJisYr.js → ArweaveClient-C0g0es2v.js} +2 -2
- package/dist/{ArweaveClient-D5iJisYr.js.map → ArweaveClient-C0g0es2v.js.map} +1 -1
- package/dist/{ArweaveClient-HEIIuOfB.js → ArweaveClient-CzkBgiZY.js} +2 -2
- package/dist/{ArweaveClient-HEIIuOfB.js.map → ArweaveClient-CzkBgiZY.js.map} +1 -1
- package/dist/{Db-jMth8Y2g.js → Db-C4oog-0n.js} +4 -3
- package/dist/{Db-jMth8Y2g.js.map → Db-C4oog-0n.js.map} +1 -1
- package/dist/Db-VPouegkr.js +82 -0
- package/dist/Db-VPouegkr.js.map +1 -0
- package/dist/EasClient-B9a3NsTi.js +10 -0
- package/dist/EasClient-B9a3NsTi.js.map +1 -0
- package/dist/{EasClient-D3wKgt0o.js → EasClient-DQ93i2ci.js} +2 -2
- package/dist/{EasClient-D3wKgt0o.js.map → EasClient-DQ93i2ci.js.map} +1 -1
- package/dist/{FileManager-4mWYO3Mt.js → FileManager-_ErxVuwb.js} +9 -5
- package/dist/FileManager-_ErxVuwb.js.map +1 -0
- package/dist/{Item-CbgjLSUx.js → Item-D9HFPxsK.js} +4 -3
- package/dist/{Item-CbgjLSUx.js.map → Item-D9HFPxsK.js.map} +1 -1
- package/dist/{ItemProperty-DduurIcl.js → ItemProperty-BdtvKrEy.js} +4 -3
- package/dist/{ItemProperty-DduurIcl.js.map → ItemProperty-BdtvKrEy.js.map} +1 -1
- package/dist/QueryClient-Bmnv_moN.js +22 -0
- package/dist/QueryClient-Bmnv_moN.js.map +1 -0
- package/dist/{QueryClient-CBOP3OoU.js → QueryClient-hzOtFe99.js} +3 -2
- package/dist/{QueryClient-CBOP3OoU.js.map → QueryClient-hzOtFe99.js.map} +1 -1
- package/dist/bin.js +30 -34
- package/dist/bin.js.map +1 -1
- package/dist/{constants-CIDbABDz.js → constants-Bhl5dZpN.js} +9 -4
- package/dist/constants-Bhl5dZpN.js.map +1 -0
- package/dist/db/configs/node.app.db.config.ts +27 -0
- package/dist/{index-DQNTvzqi.js → index-BAtjd9W-.js} +4 -3
- package/dist/index-BAtjd9W-.js.map +1 -0
- package/dist/{index-CTZqN6WI.js → index-BSR5hv7Q.js} +305 -268
- package/dist/index-BSR5hv7Q.js.map +1 -0
- package/dist/main.js +3 -2
- package/dist/main.js.map +1 -1
- package/dist/node/db/node.app.db.config.ts +1 -1
- package/dist/{seed.schema.config-B-4U2RRq.js → seed.schema.config-BxJYabim.js} +10 -9
- package/dist/seed.schema.config-BxJYabim.js.map +1 -0
- package/dist/src/AppStateSchema.ts +10 -0
- package/dist/src/ArweaveClient.ts +13 -0
- package/dist/src/Attestation.ts +21 -0
- package/dist/src/BaseArweaveClient.ts +13 -0
- package/dist/src/BaseClientManager.ts +35 -0
- package/dist/src/BaseDb.ts +35 -0
- package/dist/src/BaseEasClient.ts +14 -0
- package/dist/src/BaseFileManager.ts +60 -0
- package/dist/src/BaseItem.ts +413 -0
- package/dist/src/BaseItemProperty.ts +416 -0
- package/dist/src/BaseQueryClient.ts +13 -0
- package/dist/src/ClientManager.ts +63 -0
- package/dist/src/ConfigSchema.ts +15 -0
- package/dist/src/Db.ts +82 -0
- package/dist/src/EasClient.ts +13 -0
- package/dist/src/FileDownloader.ts +63 -0
- package/dist/src/FileManager.ts +59 -0
- package/dist/src/IDb.ts +7 -0
- package/dist/src/IEasClient.ts +2 -0
- package/dist/src/IItem.ts +26 -0
- package/dist/src/IItemProperty.ts +28 -0
- package/dist/src/IQueryClient.ts +11 -0
- package/dist/src/ImageResizer.ts +81 -0
- package/dist/src/Item.ts +12 -0
- package/dist/src/ItemProperty.ts +9 -0
- package/dist/src/MetadataSchema.ts +28 -0
- package/dist/src/ModelSchema.ts +46 -0
- package/dist/src/ModelUidSchema.ts +16 -0
- package/dist/src/PropertyUidSchema.ts +16 -0
- package/dist/src/QueryClient.ts +26 -0
- package/dist/src/Schema.ts +17 -0
- package/dist/src/SeedProtocolSdk.d.ts +19 -0
- package/dist/src/SeedSchema.ts +29 -0
- package/dist/src/VersionSchema.ts +16 -0
- package/dist/src/actors.ts +295 -0
- package/dist/src/addModelsToDb.ts +152 -0
- package/dist/src/allItems.ts +31 -0
- package/dist/src/analyzeInput.ts +144 -0
- package/dist/src/browser.app.db.config.ts +27 -0
- package/dist/src/browser.ts +30 -0
- package/dist/src/checkStatus.ts +57 -0
- package/dist/src/clientManagerMachine.ts +59 -0
- package/dist/src/configureFs.ts +98 -0
- package/dist/src/connectToDb.ts +41 -0
- package/dist/src/connectionManager.ts +67 -0
- package/dist/src/constants.ts +125 -0
- package/dist/src/content-hash.ts +30 -0
- package/dist/src/create.ts +39 -0
- package/dist/src/createMetadata.ts +77 -0
- package/dist/src/createNewItem.ts +61 -0
- package/dist/src/createPublishAttempt.ts +16 -0
- package/dist/src/createSeed.ts +31 -0
- package/dist/src/createSeeds.ts +24 -0
- package/dist/src/createVersion.ts +33 -0
- package/dist/src/dbMachine.ts +182 -0
- package/dist/src/deleteItem.ts +19 -0
- package/dist/src/download.ts +208 -0
- package/dist/src/drizzle.ts +78 -0
- package/dist/src/eas.ts +40 -0
- package/dist/src/environment.ts +35 -0
- package/dist/src/eventBus.ts +5 -0
- package/dist/src/events.ts +14 -0
- package/dist/src/fetchDataFromEas.ts +94 -0
- package/dist/src/fetchDbData.ts +19 -0
- package/dist/src/fetchRelatedItems.ts +184 -0
- package/dist/src/fetchSeeds.ts +45 -0
- package/dist/src/fetchVersions.ts +49 -0
- package/dist/src/files.ts +81 -0
- package/dist/src/filesDownload.ts +326 -0
- package/dist/src/fragment-masking.ts +87 -0
- package/dist/src/getExistingItem.ts +60 -0
- package/dist/src/getItem.ts +32 -0
- package/dist/src/getItemData.ts +99 -0
- package/dist/src/getItemProperties.ts +56 -0
- package/dist/src/getItemProperty.ts +34 -0
- package/dist/src/getItems.ts +70 -0
- package/dist/src/getMetadata.ts +40 -0
- package/dist/src/getModelSchemas.ts +89 -0
- package/dist/src/getPropertyData.ts +50 -0
- package/dist/src/getPublishPayload.ts +355 -0
- package/dist/src/getPublishUploads.ts +207 -0
- package/dist/src/getRelationValueData.ts +27 -0
- package/dist/src/getSchemaForItemProperty.ts +68 -0
- package/dist/src/getSchemaForModel.ts +42 -0
- package/dist/src/getSchemaUidForModel.ts +32 -0
- package/dist/src/getSeedData.ts +34 -0
- package/dist/src/getSegmentedItemProperties.ts +65 -0
- package/dist/src/getStorageTransactionIdForSeedUid.ts +38 -0
- package/dist/src/getVersionData.ts +46 -0
- package/dist/src/getVersionsForVersionUids.ts +39 -0
- package/dist/src/globalMachine.ts +280 -0
- package/dist/src/gql.ts +118 -0
- package/dist/src/graphql.ts +3209 -0
- package/dist/src/helpers.ts +273 -0
- package/dist/src/hydrateExistingItem.ts +137 -0
- package/dist/src/hydrateFromDb.ts +270 -0
- package/dist/src/hydrateNewItem.ts +34 -0
- package/dist/src/imageResize.ts +507 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.ts +4 -0
- package/dist/src/initialize.ts +124 -0
- package/dist/src/internalMachine.ts +241 -0
- package/dist/src/itemMachineAll.ts +157 -0
- package/dist/src/itemMachineSingle.ts +158 -0
- package/dist/src/loadAppDb.ts +44 -0
- package/dist/src/machines.ts +66 -0
- package/dist/src/metadataLatest.ts +34 -0
- package/dist/src/migrate.ts +57 -0
- package/dist/src/model.ts +72 -0
- package/dist/src/modelClass.ts +19 -0
- package/dist/src/node.app.db.config.ts +41 -0
- package/dist/src/prepareDb.ts +29 -0
- package/dist/src/preparePublishRequestData.ts +81 -0
- package/dist/src/processItems.ts +74 -0
- package/dist/src/property.ts +156 -0
- package/dist/src/propertyMachine.ts +202 -0
- package/dist/src/publish.ts +28 -0
- package/dist/src/publishMachine.ts +77 -0
- package/dist/src/queries.ts +13 -0
- package/dist/src/recoverDeletedItem.ts +14 -0
- package/dist/src/reload.ts +33 -0
- package/dist/src/request.ts +45 -0
- package/dist/src/requestAll.ts +157 -0
- package/dist/src/resolveRelatedValue.ts +367 -0
- package/dist/src/resolveRemoteStorage.ts +88 -0
- package/dist/src/saveAppState.ts +50 -0
- package/dist/src/saveConfig.ts +106 -0
- package/dist/src/saveDataToDb.ts +145 -0
- package/dist/src/saveImageSrc.ts +242 -0
- package/dist/src/saveItemStorage.ts +156 -0
- package/dist/src/saveMetadata.ts +18 -0
- package/dist/src/savePublishService.ts +30 -0
- package/dist/src/saveRelation.ts +112 -0
- package/dist/src/seed.schema.config.ts +25 -0
- package/dist/src/seed.ts +10 -0
- package/dist/src/seedProtocol.ts +17 -0
- package/dist/src/services.ts +365 -0
- package/dist/src/setAddresses.ts +16 -0
- package/dist/src/sqlWasmClient.ts +88 -0
- package/dist/src/syncDbWithEas.ts +628 -0
- package/dist/src/trash.ts +29 -0
- package/dist/src/ts-to-proto.ts +101 -0
- package/dist/src/types.ts +12 -0
- package/dist/src/updateItemPropertyValue.ts +243 -0
- package/dist/src/updateMachineContext.ts +21 -0
- package/dist/src/updateMetadata.ts +59 -0
- package/dist/src/upload.ts +86 -0
- package/dist/src/validate.ts +45 -0
- package/dist/src/validateInput.ts +43 -0
- package/dist/src/validateItemData.ts +20 -0
- package/dist/src/versionData.ts +24 -0
- package/dist/src/waitForDb.ts +25 -0
- package/dist/src/waitForFiles.ts +41 -0
- package/dist/src/wasm.d.ts +8300 -0
- package/dist/types/scripts/bin.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/EasClient.d.ts +1 -3
- package/dist/types/src/browser/helpers/EasClient.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts +2 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/client/ClientManager.d.ts +44 -0
- package/dist/types/src/client/ClientManager.d.ts.map +1 -0
- package/dist/types/src/client/actions/setAddresses.d.ts.map +1 -1
- package/dist/types/src/client/actors/initialize.d.ts.map +1 -1
- package/dist/types/src/client/actors/saveAppState.d.ts.map +1 -1
- package/dist/types/src/client/clientManagerMachine.d.ts.map +1 -1
- package/dist/types/src/client/index.d.ts +2 -40
- package/dist/types/src/client/index.d.ts.map +1 -1
- package/dist/types/src/db/configs/node.app.db.config.d.ts +3 -0
- package/dist/types/src/db/configs/node.app.db.config.d.ts.map +1 -0
- package/dist/types/src/events/files/download.d.ts.map +1 -1
- package/dist/types/src/helpers/EasClient/BaseEasClient.d.ts.map +1 -1
- package/dist/types/src/helpers/FileManager/BaseFileManager.d.ts +1 -0
- package/dist/types/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/types/src/helpers/constants.d.ts +1 -0
- package/dist/types/src/helpers/constants.d.ts.map +1 -1
- package/dist/types/src/interfaces/IQueryClient.d.ts +7 -1
- package/dist/types/src/interfaces/IQueryClient.d.ts.map +1 -1
- package/dist/types/src/node/db/Db.d.ts +5 -10
- package/dist/types/src/node/db/Db.d.ts.map +1 -1
- package/dist/types/src/node/helpers/FileManager.d.ts +2 -1
- package/dist/types/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/node/helpers/QueryClient.d.ts +2 -4
- package/dist/types/src/node/helpers/QueryClient.d.ts.map +1 -1
- package/dist/types/src/services/allItems/actors/fetchSeeds.d.ts.map +1 -1
- package/dist/types/src/services/db/actors/checkStatus.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/waitForFiles.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/loadAppDb.d.ts.map +1 -1
- package/dist/types/src/services/internal/actors/saveConfig.d.ts.map +1 -1
- package/dist/types/src/services/internal/actors/waitForFiles.d.ts.map +1 -1
- package/dist/types/src/services/internal/internalMachine.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/Db-DK9wSNIH.js +0 -120
- package/dist/Db-DK9wSNIH.js.map +0 -1
- package/dist/EasClient-jqkT2ZBt.js +0 -13
- package/dist/EasClient-jqkT2ZBt.js.map +0 -1
- package/dist/FileManager-4mWYO3Mt.js.map +0 -1
- package/dist/QueryClient-bKb3SB0W.js +0 -23
- package/dist/QueryClient-bKb3SB0W.js.map +0 -1
- package/dist/constants-CIDbABDz.js.map +0 -1
- package/dist/index-CTZqN6WI.js.map +0 -1
- package/dist/index-DQNTvzqi.js.map +0 -1
- package/dist/package.json +0 -189
- package/dist/seed.schema.config-B-4U2RRq.js.map +0 -1
- package/dist/types/src/client.d.ts +0 -18
- package/dist/types/src/client.d.ts.map +0 -1
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'immer';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
export { D as Db,
|
|
4
|
-
export { B as BaseArweaveClient, a as BaseEasClient, b as BaseFileManager, c as BaseQueryClient } from './constants-
|
|
3
|
+
export { D as Db, d as ImageSrc, e as Item, f as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, C as client, t as eventEmitter, r as getCorrectId, s as getGlobalService, j as useCreateItem, l as useDeleteItem, m as useGlobalServiceStatus, g as useItem, h as useItemProperties, k as useItemProperty, u as useItems, o as usePersistedSnapshots, n as usePublishItem, q as useService, p as useServices, w as withSeed } from './index-BSR5hv7Q.js';
|
|
4
|
+
export { B as BaseArweaveClient, a as BaseEasClient, b as BaseFileManager, c as BaseQueryClient } from './constants-Bhl5dZpN.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'xstate';
|
|
7
7
|
import 'debug';
|
|
@@ -12,6 +12,7 @@ import 'eventemitter3';
|
|
|
12
12
|
import 'nanoid';
|
|
13
13
|
import 'nanoid-dictionary';
|
|
14
14
|
import '@zenfs/core';
|
|
15
|
+
import 'graphql-request';
|
|
15
16
|
import 'lodash-es';
|
|
16
17
|
import '@statelyai/inspect';
|
|
17
18
|
import 'path';
|
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":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
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-BSR5hv7Q.js';
|
|
4
4
|
import 'immer';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'xstate';
|
|
7
|
-
import './constants-
|
|
7
|
+
import './constants-Bhl5dZpN.js';
|
|
8
|
+
import 'graphql-request';
|
|
8
9
|
import '@ethereum-attestation-service/eas-sdk';
|
|
9
10
|
import 'debug';
|
|
10
11
|
import 'pluralize';
|
|
@@ -29,11 +30,11 @@ let Seed = class Seed {
|
|
|
29
30
|
__decorate([
|
|
30
31
|
Text(),
|
|
31
32
|
__metadata("design:type", String)
|
|
32
|
-
], Seed.prototype, "uid",
|
|
33
|
+
], Seed.prototype, "uid", void 0);
|
|
33
34
|
__decorate([
|
|
34
35
|
Text(),
|
|
35
36
|
__metadata("design:type", String)
|
|
36
|
-
], Seed.prototype, "type",
|
|
37
|
+
], Seed.prototype, "type", void 0);
|
|
37
38
|
Seed = __decorate([
|
|
38
39
|
Model
|
|
39
40
|
], Seed);
|
|
@@ -42,11 +43,11 @@ let Version = class Version {
|
|
|
42
43
|
__decorate([
|
|
43
44
|
Text(),
|
|
44
45
|
__metadata("design:type", String)
|
|
45
|
-
], Version.prototype, "seedUid",
|
|
46
|
+
], Version.prototype, "seedUid", void 0);
|
|
46
47
|
__decorate([
|
|
47
48
|
Text(),
|
|
48
49
|
__metadata("design:type", String)
|
|
49
|
-
], Version.prototype, "note",
|
|
50
|
+
], Version.prototype, "note", void 0);
|
|
50
51
|
Version = __decorate([
|
|
51
52
|
Model
|
|
52
53
|
], Version);
|
|
@@ -55,11 +56,11 @@ let Metadata = class Metadata {
|
|
|
55
56
|
__decorate([
|
|
56
57
|
Text(),
|
|
57
58
|
__metadata("design:type", String)
|
|
58
|
-
], Metadata.prototype, "key",
|
|
59
|
+
], Metadata.prototype, "key", void 0);
|
|
59
60
|
__decorate([
|
|
60
61
|
Text(),
|
|
61
62
|
__metadata("design:type", String)
|
|
62
|
-
], Metadata.prototype, "value",
|
|
63
|
+
], Metadata.prototype, "value", void 0);
|
|
63
64
|
Metadata = __decorate([
|
|
64
65
|
Model
|
|
65
66
|
], Metadata);
|
|
@@ -70,4 +71,4 @@ const models = {
|
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
export { models };
|
|
73
|
-
//# sourceMappingURL=seed.schema.config-
|
|
74
|
+
//# sourceMappingURL=seed.schema.config-BxJYabim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.schema.config-BxJYabim.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,MAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,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,MAAA,CAAA;AAChB,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,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,MAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAe,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAFlB,QAAQ,GAAA,UAAA,CAAA;IADb;AACK,CAAA,EAAA,QAAQ,CAGb;AAEY,MAAA,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,QAAQ;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
|
|
3
|
+
export const appState = sqliteTable('appState', {
|
|
4
|
+
key: text('key').unique(),
|
|
5
|
+
value: text('value'),
|
|
6
|
+
createdAt: int('created_at'),
|
|
7
|
+
updatedAt: int('updated_at'),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export type appStateType = appState.$inferSelect
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient';
|
|
2
|
+
import { ARWEAVE_ENDPOINT } from '@/services/internal/constants';
|
|
3
|
+
import { GraphQLClient } from 'graphql-request';
|
|
4
|
+
|
|
5
|
+
class ArweaveClient extends BaseArweaveClient {
|
|
6
|
+
static getArweaveClient(): GraphQLClient {
|
|
7
|
+
return new GraphQLClient(ARWEAVE_ENDPOINT);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
BaseArweaveClient.setPlatformClass(ArweaveClient);
|
|
12
|
+
|
|
13
|
+
export { ArweaveClient };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { graphql, } from '../gql'
|
|
2
|
+
|
|
3
|
+
export const ATTESTATION_FIELDS = graphql(/* GraphQL */ `
|
|
4
|
+
fragment attestationFields on Attestation {
|
|
5
|
+
id
|
|
6
|
+
decodedDataJson
|
|
7
|
+
attester
|
|
8
|
+
schema {
|
|
9
|
+
schemaNames {
|
|
10
|
+
name
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
refUID
|
|
14
|
+
revoked
|
|
15
|
+
schemaId
|
|
16
|
+
txid
|
|
17
|
+
timeCreated
|
|
18
|
+
time
|
|
19
|
+
isOffchain
|
|
20
|
+
}
|
|
21
|
+
`,)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request'
|
|
2
|
+
|
|
3
|
+
export abstract class BaseArweaveClient {
|
|
4
|
+
static PlatformClass: typeof BaseArweaveClient
|
|
5
|
+
|
|
6
|
+
static setPlatformClass(platformClass: typeof BaseArweaveClient) {
|
|
7
|
+
this.PlatformClass = platformClass
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static getArweaveClient(): GraphQLClient {
|
|
11
|
+
return this.PlatformClass.getArweaveClient()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { initEasClient } from "@/helpers/EasClient"
|
|
2
|
+
import { initArweaveClient } from "@/helpers/ArweaveClient"
|
|
3
|
+
import { initQueryClient } from "@/helpers/QueryClient"
|
|
4
|
+
import { initFileManager } from "@/helpers/FileManager"
|
|
5
|
+
import { initDb } from "@/db/Db"
|
|
6
|
+
import { initItem } from "@/Item"
|
|
7
|
+
import { initItemProperty } from "@/ItemProperty"
|
|
8
|
+
import { SeedConstructorOptions } from "@/types"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export abstract class BaseClientManager {
|
|
12
|
+
static isInitialized = false
|
|
13
|
+
constructor() {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static async init(options: SeedConstructorOptions): Promise<void> {
|
|
17
|
+
if (this.isInitialized) {
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { config, addresses } = options
|
|
22
|
+
|
|
23
|
+
await initItem()
|
|
24
|
+
await initItemProperty()
|
|
25
|
+
await initEasClient()
|
|
26
|
+
await initArweaveClient()
|
|
27
|
+
await initQueryClient()
|
|
28
|
+
await initFileManager()
|
|
29
|
+
await initDb()
|
|
30
|
+
|
|
31
|
+
this.isInitialized = true
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IDb } from '@/interfaces/IDb'
|
|
2
|
+
import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core'
|
|
3
|
+
|
|
4
|
+
export abstract class BaseDb implements IDb {
|
|
5
|
+
|
|
6
|
+
constructor() {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static PlatformClass: typeof BaseDb
|
|
10
|
+
|
|
11
|
+
static setPlatformClass(platformClass: typeof BaseDb) {
|
|
12
|
+
this.PlatformClass = platformClass
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static getAppDb(): BaseSQLiteDatabase {
|
|
16
|
+
return this.PlatformClass.getAppDb()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static isAppDbReady(): boolean {
|
|
20
|
+
return this.PlatformClass.isAppDbReady()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static prepareDb(filesDir: string): Promise<BaseSQLiteDatabase> {
|
|
24
|
+
return this.PlatformClass.prepareDb(filesDir)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static connectToDb(pathToDir: string, dbName: string): Promise<unknown> {
|
|
28
|
+
return this.PlatformClass.connectToDb(pathToDir, dbName)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static async migrate(pathToDbDir: string, dbName: string, dbId: string): Promise<void> {
|
|
32
|
+
return this.PlatformClass.migrate(pathToDbDir, dbName, dbId)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request'
|
|
2
|
+
import { EAS_ENDPOINT } from '@/services/internal/constants'
|
|
3
|
+
|
|
4
|
+
export abstract class BaseEasClient {
|
|
5
|
+
static PlatformClass: typeof BaseEasClient
|
|
6
|
+
|
|
7
|
+
static setPlatformClass(platformClass: typeof BaseEasClient) {
|
|
8
|
+
this.PlatformClass = platformClass
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static getEasClient(): GraphQLClient {
|
|
12
|
+
return new GraphQLClient(EAS_ENDPOINT)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export abstract class BaseFileManager {
|
|
2
|
+
private static fileSystemInitialized = false
|
|
3
|
+
private static initializing = false
|
|
4
|
+
|
|
5
|
+
static PlatformClass: typeof BaseFileManager
|
|
6
|
+
|
|
7
|
+
static setPlatformClass( platformClass: typeof BaseFileManager ) {
|
|
8
|
+
this.PlatformClass = platformClass
|
|
9
|
+
}
|
|
10
|
+
|
|
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> {
|
|
22
|
+
return this.PlatformClass.getContentUrlFromPath(path)
|
|
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
|
+
}
|
|
40
|
+
|
|
41
|
+
static pathExists(filePath: string): Promise<boolean> {
|
|
42
|
+
return this.PlatformClass.pathExists(filePath)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static createDirIfNotExists(filePath: string): Promise<void> {
|
|
46
|
+
return this.PlatformClass.createDirIfNotExists(filePath)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static async waitForFile(filePath: string): Promise<boolean> {
|
|
50
|
+
return this.PlatformClass.waitForFile(filePath)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {
|
|
54
|
+
return this.PlatformClass.saveFile(filePath, content)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static async readFile(filePath: string): Promise<File> {
|
|
58
|
+
return this.PlatformClass.readFile(filePath)
|
|
59
|
+
}
|
|
60
|
+
}
|