@seedprotocol/sdk 0.2.47 → 0.2.49
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-CoFomTCN.js → ArweaveClient-Dcqcpsq4.js} +2 -2
- package/dist/{ArweaveClient-DQrXvrNN.js.map → ArweaveClient-Dcqcpsq4.js.map} +1 -1
- package/dist/{ArweaveClient-DQrXvrNN.js → ArweaveClient-Dh7LRIqD.js} +2 -2
- package/dist/{ArweaveClient-CoFomTCN.js.map → ArweaveClient-Dh7LRIqD.js.map} +1 -1
- package/dist/{Db-Dgbci7BP.js → Db-BjoRtCFg.js} +3 -4
- package/dist/{Db-Dgbci7BP.js.map → Db-BjoRtCFg.js.map} +1 -1
- package/dist/{Db-Dv7s24Zi.js → Db-CMRjCZoY.js} +7 -7
- package/dist/Db-CMRjCZoY.js.map +1 -0
- package/dist/{EasClient-CBu9ENAi.js → EasClient-A1xC7Gm-.js} +2 -2
- package/dist/{EasClient-sCbTHcO8.js.map → EasClient-A1xC7Gm-.js.map} +1 -1
- package/dist/{EasClient-sCbTHcO8.js → EasClient-m2mXad59.js} +2 -2
- package/dist/{EasClient-CBu9ENAi.js.map → EasClient-m2mXad59.js.map} +1 -1
- package/dist/{FileManager-COOp89Mj.js → FileManager-Dv2zn1RW.js} +12 -2
- package/dist/FileManager-Dv2zn1RW.js.map +1 -0
- package/dist/{Item-DOEEhWwi.js → Item-7vg6XRhw.js} +3 -4
- package/dist/{Item-DOEEhWwi.js.map → Item-7vg6XRhw.js.map} +1 -1
- package/dist/{ItemProperty-CABHeoKm.js → ItemProperty-Bcht9WTV.js} +3 -4
- package/dist/{ItemProperty-CABHeoKm.js.map → ItemProperty-Bcht9WTV.js.map} +1 -1
- package/dist/{QueryClient-BBaE-LKI.js → QueryClient-C-hFMF2j.js} +2 -2
- package/dist/{QueryClient-BBaE-LKI.js.map → QueryClient-C-hFMF2j.js.map} +1 -1
- package/dist/{QueryClient-C-ZzUnWq.js → QueryClient-C02sPZ-K.js} +2 -2
- package/dist/{QueryClient-C-ZzUnWq.js.map → QueryClient-C02sPZ-K.js.map} +1 -1
- package/dist/bin.js +21 -21
- package/dist/bin.js.map +1 -1
- package/dist/{constants-Dgv-tSO3.js → constants-C03RQQht.js} +12 -5
- package/dist/constants-C03RQQht.js.map +1 -0
- package/dist/{index-OxV3e-OY.js → index-D3Scq_ka.js} +1095 -137
- package/dist/index-D3Scq_ka.js.map +1 -0
- package/dist/{index-CAikKppg.js → index-Dp3GcggF.js} +3 -4
- package/dist/index-Dp3GcggF.js.map +1 -0
- package/dist/main.js +2 -3
- package/dist/main.js.map +1 -1
- package/dist/{seed.schema.config-Ba_E7t1M.js → seed.schema.config-CS6BvsTl.js} +3 -4
- package/dist/seed.schema.config-CS6BvsTl.js.map +1 -0
- package/dist/src/BaseFileManager.ts +14 -2
- package/dist/src/BaseItem.ts +15 -3
- package/dist/src/BaseItemProperty.ts +1 -1
- package/dist/src/FileManager.ts +14 -1
- package/dist/src/IItem.ts +4 -1
- package/dist/src/ImageResizer.ts +3 -6
- package/dist/src/actors.ts +1 -1
- package/dist/src/client.ts +25 -0
- package/dist/src/configureFs.ts +1 -1
- package/dist/src/createNewItem.ts +5 -1
- package/dist/src/download.ts +6 -16
- package/dist/src/drizzle.ts +1 -1
- package/dist/src/files.ts +1 -1
- package/dist/src/getPublishUploads.ts +1 -1
- package/dist/src/helpers.ts +201 -84
- package/dist/src/hydrateFromDb.ts +1 -1
- package/dist/src/migrate.ts +3 -3
- package/dist/src/resolveRelatedValue.ts +1 -1
- package/dist/src/resolveRemoteStorage.ts +1 -1
- package/dist/src/saveImageSrc.ts +1 -1
- package/dist/src/saveItemStorage.ts +1 -1
- package/dist/src/ts-to-proto.ts +1 -1
- package/dist/src/validate.ts +1 -1
- package/dist/src/waitForDb.ts +9 -10
- package/dist/src/waitForFiles.ts +1 -1
- package/dist/types/src/Item/BaseItem.d.ts +4 -1
- package/dist/types/src/Item/BaseItem.d.ts.map +1 -1
- package/dist/types/src/Item/service/actors/saveDataToDb.d.ts +3 -0
- package/dist/types/src/Item/service/actors/saveDataToDb.d.ts.map +1 -0
- package/dist/types/src/browser/db/Db.d.ts +2 -2
- package/dist/types/src/browser/db/Db.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts +10 -0
- package/dist/types/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/index.d.ts +1 -2
- package/dist/types/src/browser/helpers/index.d.ts.map +1 -1
- package/dist/types/src/browser/react/item.d.ts.map +1 -1
- package/dist/types/src/browser/workers/ImageResizer.d.ts.map +1 -1
- package/dist/types/src/client.d.ts +1 -0
- package/dist/types/src/client.d.ts.map +1 -1
- package/dist/types/src/db/write/createNewItem.d.ts.map +1 -1
- package/dist/types/src/events/files/download.d.ts.map +1 -1
- package/dist/types/src/helpers/FileManager/BaseFileManager.d.ts +5 -2
- package/dist/types/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
- package/dist/types/src/interfaces/IItem.d.ts +3 -0
- package/dist/types/src/interfaces/IItem.d.ts.map +1 -1
- package/dist/types/src/node/helpers/FileManager.d.ts +2 -0
- package/dist/types/src/node/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/services/internal/helpers.d.ts +0 -2
- package/dist/types/src/services/internal/helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/Db-Dv7s24Zi.js.map +0 -1
- package/dist/FileManager-COOp89Mj.js.map +0 -1
- package/dist/FileManager-Np-xCJ1X.js +0 -794
- package/dist/FileManager-Np-xCJ1X.js.map +0 -1
- package/dist/constants-Dgv-tSO3.js.map +0 -1
- package/dist/index-CAikKppg.js.map +0 -1
- package/dist/index-OxV3e-OY.js.map +0 -1
- package/dist/seed.schema.config-Ba_E7t1M.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { I as Item } from './index-
|
|
1
|
+
export { I as Item } from './index-D3Scq_ka.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import 'xstate';
|
|
6
|
-
import './constants-
|
|
6
|
+
import './constants-C03RQQht.js';
|
|
7
7
|
import '@ethereum-attestation-service/eas-sdk';
|
|
8
8
|
import 'debug';
|
|
9
9
|
import 'pluralize';
|
|
@@ -15,7 +15,6 @@ import 'nanoid-dictionary';
|
|
|
15
15
|
import '@zenfs/core';
|
|
16
16
|
import 'lodash-es';
|
|
17
17
|
import '@statelyai/inspect';
|
|
18
|
-
import 'node:fs';
|
|
19
18
|
import 'path';
|
|
20
19
|
import 'arweave';
|
|
21
20
|
import 'rxjs';
|
|
@@ -23,4 +22,4 @@ import 'drizzle-orm/casing';
|
|
|
23
22
|
import 'react';
|
|
24
23
|
import 'use-immer';
|
|
25
24
|
import '@xstate/react';
|
|
26
|
-
//# sourceMappingURL=index-
|
|
25
|
+
//# sourceMappingURL=index-Dp3GcggF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Dp3GcggF.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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, s 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, w as withSeed } from './index-D3Scq_ka.js';
|
|
4
|
+
export { B as BaseArweaveClient, a as BaseEasClient, c as BaseFileManager, b as BaseQueryClient } from './constants-C03RQQht.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'xstate';
|
|
7
7
|
import 'debug';
|
|
@@ -14,7 +14,6 @@ import 'nanoid-dictionary';
|
|
|
14
14
|
import '@zenfs/core';
|
|
15
15
|
import 'lodash-es';
|
|
16
16
|
import '@statelyai/inspect';
|
|
17
|
-
import 'node:fs';
|
|
18
17
|
import 'path';
|
|
19
18
|
import 'arweave';
|
|
20
19
|
import 'rxjs';
|
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,10 @@
|
|
|
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-D3Scq_ka.js';
|
|
4
4
|
import 'immer';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'xstate';
|
|
7
|
-
import './constants-
|
|
7
|
+
import './constants-C03RQQht.js';
|
|
8
8
|
import '@ethereum-attestation-service/eas-sdk';
|
|
9
9
|
import 'debug';
|
|
10
10
|
import 'pluralize';
|
|
@@ -16,7 +16,6 @@ import 'nanoid-dictionary';
|
|
|
16
16
|
import '@zenfs/core';
|
|
17
17
|
import 'lodash-es';
|
|
18
18
|
import '@statelyai/inspect';
|
|
19
|
-
import 'node:fs';
|
|
20
19
|
import 'path';
|
|
21
20
|
import 'arweave';
|
|
22
21
|
import 'rxjs';
|
|
@@ -71,4 +70,4 @@ const models = {
|
|
|
71
70
|
};
|
|
72
71
|
|
|
73
72
|
export { models };
|
|
74
|
-
//# sourceMappingURL=seed.schema.config-
|
|
73
|
+
//# sourceMappingURL=seed.schema.config-CS6BvsTl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.schema.config-CS6BvsTl.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,SAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,SAAA,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,SAAA,CAAA;AAChB,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,SAAA,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,SAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAe,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,SAAA,CAAA;AAFlB,QAAQ,GAAA,UAAA,CAAA;IADb;AACK,CAAA,EAAA,QAAQ,CAGb;AAEY,MAAA,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,QAAQ;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export abstract class BaseFileManager {
|
|
2
|
-
private fileSystemInitialized = false
|
|
3
|
-
private initializing = false
|
|
2
|
+
private static fileSystemInitialized = false
|
|
3
|
+
private static initializing = false
|
|
4
4
|
|
|
5
5
|
static PlatformClass: typeof BaseFileManager
|
|
6
6
|
|
|
@@ -37,4 +37,16 @@ export abstract class BaseFileManager {
|
|
|
37
37
|
static resizeAllImages( { width, height }: ResizeAllImagesParams ): Promise<void> {
|
|
38
38
|
return this.PlatformClass.resizeAllImages({ width, height })
|
|
39
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
|
+
}
|
|
40
52
|
}
|
package/dist/src/BaseItem.ts
CHANGED
|
@@ -226,7 +226,7 @@ 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, versionLocalId,
|
|
229
|
+
const { seedLocalId, versionLocalId, } = await createNewItem({
|
|
230
230
|
modelName: props.modelName,
|
|
231
231
|
})
|
|
232
232
|
props.seedLocalId = seedLocalId
|
|
@@ -267,9 +267,9 @@ export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements II
|
|
|
267
267
|
static async all(
|
|
268
268
|
modelName?: string,
|
|
269
269
|
deleted?: boolean,
|
|
270
|
-
): Promise<
|
|
270
|
+
): Promise<BaseItem<any>[]> {
|
|
271
271
|
const itemsData = await getItemsData({ modelName, deleted })
|
|
272
|
-
const itemInstances:
|
|
272
|
+
const itemInstances: BaseItem<any>[] = []
|
|
273
273
|
for (const itemData of itemsData) {
|
|
274
274
|
itemInstances.push(
|
|
275
275
|
await BaseItem.create({
|
|
@@ -381,6 +381,10 @@ export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements II
|
|
|
381
381
|
return this.serviceContext.latestVersionUid as VersionsType
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
+
get latestVersionLocalId(): string {
|
|
385
|
+
return this.serviceContext.latestVersionLocalId as string
|
|
386
|
+
}
|
|
387
|
+
|
|
384
388
|
get modelName(): string {
|
|
385
389
|
return this.serviceContext.modelName as string
|
|
386
390
|
}
|
|
@@ -393,6 +397,14 @@ export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements II
|
|
|
393
397
|
return this.serviceContext.attestationCreatedAt as number
|
|
394
398
|
}
|
|
395
399
|
|
|
400
|
+
get versionsCount(): number {
|
|
401
|
+
return this.serviceContext.versionsCount as number
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
get lastVersionPublishedAt(): number {
|
|
405
|
+
return this.serviceContext.lastVersionPublishedAt as number
|
|
406
|
+
}
|
|
407
|
+
|
|
396
408
|
unload(): void {
|
|
397
409
|
this._subscription?.unsubscribe()
|
|
398
410
|
this._service.stop()
|
|
@@ -10,7 +10,7 @@ import { internalPropertyNames } from '@/helpers/constants'
|
|
|
10
10
|
import debug from 'debug'
|
|
11
11
|
import pluralize from 'pluralize'
|
|
12
12
|
import { eventEmitter } from '@/eventBus'
|
|
13
|
-
import
|
|
13
|
+
import fs from '@zenfs/core'
|
|
14
14
|
import { getPropertyData } from '@/db/read/getPropertyData'
|
|
15
15
|
import { getCorrectId } from '@/helpers'
|
|
16
16
|
import { TProperty } from '@/schema'
|
package/dist/src/FileManager.ts
CHANGED
|
@@ -37,8 +37,21 @@ class FileManager extends BaseFileManager {
|
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
static async pathExists(filePath: string): Promise<boolean> {
|
|
41
|
+
return new Promise(( resolve, reject ) => {
|
|
42
|
+
reject(new Error('Not implemented'))
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static async createDirIfNotExists(filePath: string): Promise<void> {
|
|
47
|
+
return new Promise(( resolve, reject ) => {
|
|
48
|
+
reject(new Error('Not implemented'))
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
BaseFileManager.setPlatformClass(FileManager)
|
|
43
55
|
|
|
44
|
-
export { FileManager }
|
|
56
|
+
export { FileManager }
|
|
57
|
+
|
package/dist/src/IItem.ts
CHANGED
|
@@ -17,7 +17,10 @@ export interface IItem<T extends ModelValues<ModelSchema>> {
|
|
|
17
17
|
readonly seedUid?: string
|
|
18
18
|
readonly schemaUid: string
|
|
19
19
|
readonly latestVersionUid: VersionsType
|
|
20
|
+
readonly latestVersionLocalId: string
|
|
20
21
|
readonly modelName: string
|
|
21
22
|
readonly properties: Record<string, IItemProperty<any>>
|
|
22
23
|
readonly attestationCreatedAt: number
|
|
23
|
-
|
|
24
|
+
readonly versionsCount: number
|
|
25
|
+
readonly lastVersionPublishedAt: number
|
|
26
|
+
}
|
package/dist/src/ImageResizer.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from '@zenfs/core';
|
|
2
2
|
import imageResize from './imageResize'
|
|
3
|
+
import { FileManager } from '@/browser/helpers/FileManager';
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
@@ -66,11 +67,7 @@ export class ImageResizer {
|
|
|
66
67
|
|
|
67
68
|
const widthDir = `${imageDir}/${width}`
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!widthDirExists) {
|
|
72
|
-
await fs.promises.mkdir(widthDir)
|
|
73
|
-
}
|
|
70
|
+
await FileManager.createDirIfNotExists(widthDir)
|
|
74
71
|
|
|
75
72
|
for (const imageFile of imageFiles) {
|
|
76
73
|
const resizedImageExists = await fs.promises.exists(`${widthDir}/${imageFile}`)
|
package/dist/src/actors.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { fetchAllFilesMachine } from '@/schema/file/fetchAll/index'
|
|
|
3
3
|
import { ARWEAVE_HOST } from '@/services/internal/constants'
|
|
4
4
|
import { GET_FILES_METADATA } from '@/schema/file/queries'
|
|
5
5
|
import { getArweave } from '@/helpers/ArweaveClient'
|
|
6
|
-
import
|
|
6
|
+
import fs from '@zenfs/core'
|
|
7
7
|
import {
|
|
8
8
|
getDataTypeFromString,
|
|
9
9
|
getMimeType,
|
package/dist/src/client.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { initQueryClient } from './helpers/QueryClient'
|
|
|
19
19
|
import { initFileManager } from './helpers/FileManager'
|
|
20
20
|
import { initDb } from './db/Db'
|
|
21
21
|
import debug from 'debug'
|
|
22
|
+
import { appState } from './seedSchema'
|
|
22
23
|
|
|
23
24
|
const logger = debug('app:client')
|
|
24
25
|
|
|
@@ -76,6 +77,30 @@ const client = {
|
|
|
76
77
|
setModel(key, value)
|
|
77
78
|
}
|
|
78
79
|
},
|
|
80
|
+
setAddresses: async(addresses: string[]) => {
|
|
81
|
+
const {BaseDb} = await import('./db/Db/BaseDb')
|
|
82
|
+
if (!BaseDb) {
|
|
83
|
+
throw new Error('BaseDb not found')
|
|
84
|
+
}
|
|
85
|
+
if (!BaseDb.PlatformClass) {
|
|
86
|
+
await initDb()
|
|
87
|
+
}
|
|
88
|
+
const appDb = BaseDb.getAppDb()
|
|
89
|
+
if (!appDb) {
|
|
90
|
+
throw new Error('App DB not found')
|
|
91
|
+
}
|
|
92
|
+
appDb.insert(appState)
|
|
93
|
+
.values({
|
|
94
|
+
key: 'addresses',
|
|
95
|
+
value: JSON.stringify(addresses),
|
|
96
|
+
})
|
|
97
|
+
.onConflictDoUpdate({
|
|
98
|
+
target: appState.key,
|
|
99
|
+
set: {
|
|
100
|
+
value: JSON.stringify(addresses),
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
},
|
|
79
104
|
subscribe: (callback: any) => {
|
|
80
105
|
const subscription = globalService.subscribe(callback)
|
|
81
106
|
|
package/dist/src/configureFs.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
DB_WAITING_FOR_FILES_RECEIVED,
|
|
7
7
|
INTERNAL_CONFIGURING_FS_SUCCESS,
|
|
8
8
|
} from '@/services/internal/constants'
|
|
9
|
-
import
|
|
9
|
+
import fs from '@zenfs/core'
|
|
10
10
|
import debug from 'debug'
|
|
11
11
|
import { FromCallbackInput, InternalMachineContext } from '@/types'
|
|
12
12
|
|
|
@@ -3,6 +3,8 @@ import { getModel } from '@/stores/modelClass'
|
|
|
3
3
|
import { createSeed } from './createSeed'
|
|
4
4
|
import { createVersion } from './createVersion'
|
|
5
5
|
import { createMetadata } from './createMetadata'
|
|
6
|
+
import { toSnakeCase } from 'drizzle-orm/casing'
|
|
7
|
+
import { eventEmitter } from '@/eventBus'
|
|
6
8
|
|
|
7
9
|
type CreateNewItemProps = Partial<ModelValues<any>> & {
|
|
8
10
|
modelName: string
|
|
@@ -26,7 +28,7 @@ export const createNewItem = async ({
|
|
|
26
28
|
|
|
27
29
|
const newSeedId = await createSeed({ type: seedType })
|
|
28
30
|
|
|
29
|
-
const newVersionId = await createVersion({ seedLocalId: newSeedId })
|
|
31
|
+
const newVersionId = await createVersion({ seedLocalId: newSeedId, seedType: toSnakeCase(modelName) })
|
|
30
32
|
|
|
31
33
|
const propertySchemas = getModel(modelName)?.schema
|
|
32
34
|
|
|
@@ -49,6 +51,8 @@ export const createNewItem = async ({
|
|
|
49
51
|
)
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
eventEmitter.emit('item.requestAll', { modelName })
|
|
55
|
+
|
|
52
56
|
return {
|
|
53
57
|
modelName,
|
|
54
58
|
seedLocalId: newSeedId,
|
package/dist/src/download.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syncDbFiles } from '@/services/internal/helpers'
|
|
2
2
|
import { eventEmitter } from '@/eventBus'
|
|
3
|
-
import
|
|
3
|
+
import fs from '@zenfs/core'
|
|
4
4
|
import { ARWEAVE_HOST } from '@/services/internal/constants'
|
|
5
5
|
import { appState } from '@/seedSchema'
|
|
6
6
|
import { eq } from 'drizzle-orm'
|
|
@@ -23,6 +23,7 @@ import { getArweave } from '@/helpers/ArweaveClient'
|
|
|
23
23
|
|
|
24
24
|
const logger = debug('app:files:download')
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
export const downloadAllFilesRequestHandler = async ({
|
|
27
28
|
endpoints,
|
|
28
29
|
eventId,
|
|
@@ -78,21 +79,10 @@ export const downloadAllFilesBinaryRequestHandler = async () => {
|
|
|
78
79
|
}),
|
|
79
80
|
})
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!(await fs.promises.exists('/files/html'))) {
|
|
86
|
-
await fs.promises.mkdir('/files/html', { recursive: true })
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (!(await fs.promises.exists('/files/json'))) {
|
|
90
|
-
await fs.promises.mkdir('/files/json', { recursive: true })
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (!(await fs.promises.exists('/files/images'))) {
|
|
94
|
-
await fs.promises.mkdir('/files/images', { recursive: true })
|
|
95
|
-
}
|
|
82
|
+
await BaseFileManager.createDirIfNotExists('/files')
|
|
83
|
+
await BaseFileManager.createDirIfNotExists('/files/html')
|
|
84
|
+
await BaseFileManager.createDirIfNotExists('/files/json')
|
|
85
|
+
await BaseFileManager.createDirIfNotExists('/files/images')
|
|
96
86
|
|
|
97
87
|
const appDb = BaseDb.getAppDb()
|
|
98
88
|
|
package/dist/src/drizzle.ts
CHANGED
package/dist/src/files.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Transaction from 'arweave'
|
|
2
2
|
import { CreateTransactionInterface } from 'arweave/web'
|
|
3
3
|
import { getArweave } from '@/helpers/ArweaveClient'
|
|
4
|
-
import
|
|
4
|
+
import fs from '@zenfs/core'
|
|
5
5
|
import { getCorrectId } from '@/helpers'
|
|
6
6
|
import { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'
|
|
7
7
|
import debug from 'debug'
|