@seedprotocol/sdk 0.2.45 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Db-gw_uZA_e.js → Db-Dgbci7BP.js} +4 -3
- package/dist/{Db-gw_uZA_e.js.map → Db-Dgbci7BP.js.map} +1 -1
- package/dist/{Db-BlgPVb_Z.js → Db-Dv7s24Zi.js} +6 -3
- package/dist/Db-Dv7s24Zi.js.map +1 -0
- package/dist/{FileManager-BNqJl6Bz.js → FileManager-Np-xCJ1X.js} +20 -7
- package/dist/FileManager-Np-xCJ1X.js.map +1 -0
- package/dist/{Item-BO38NUjz.js → Item-DOEEhWwi.js} +4 -3
- package/dist/{Item-BO38NUjz.js.map → Item-DOEEhWwi.js.map} +1 -1
- package/dist/{ItemProperty-8H7B05zy.js → ItemProperty-CABHeoKm.js} +4 -3
- package/dist/{ItemProperty-8H7B05zy.js.map → ItemProperty-CABHeoKm.js.map} +1 -1
- package/dist/bin.js +16 -16
- package/dist/bin.js.map +1 -1
- package/dist/{index-Km3L1_LR.js → index-CAikKppg.js} +4 -3
- package/dist/index-CAikKppg.js.map +1 -0
- package/dist/{index-CsbUKGXp.js → index-OxV3e-OY.js} +189 -144
- package/dist/index-OxV3e-OY.js.map +1 -0
- package/dist/main.js +3 -2
- package/dist/main.js.map +1 -1
- package/dist/{seed.schema.config-Dn_1QbD7.js → seed.schema.config-Ba_E7t1M.js} +10 -9
- package/dist/seed.schema.config-Ba_E7t1M.js.map +1 -0
- package/dist/src/BaseItem.ts +1 -1
- package/dist/src/BaseItemProperty.ts +8 -7
- package/dist/src/ImageResizer.ts +1 -1
- package/dist/src/client.ts +12 -0
- package/dist/src/createMetadata.ts +11 -4
- package/dist/src/drizzle.ts +1 -1
- package/dist/src/files.ts +14 -3
- package/dist/src/getItemProperties.ts +9 -19
- package/dist/src/getPublishPayload.ts +15 -8
- package/dist/src/gql.ts +9 -4
- package/dist/src/graphql.ts +12 -4
- package/dist/src/helpers.ts +13 -2
- package/dist/src/metadataLatest.ts +34 -0
- package/dist/src/migrate.ts +2 -2
- package/dist/src/property.ts +10 -7
- package/dist/src/saveImageSrc.ts +1 -1
- package/dist/src/ts-to-proto.ts +1 -1
- package/dist/src/updateItemPropertyValue.ts +1 -1
- package/dist/src/waitForDb.ts +12 -9
- package/dist/src/waitForFiles.ts +1 -1
- package/dist/types/src/Item/queries.d.ts +2 -2
- package/dist/types/src/Item/queries.d.ts.map +1 -1
- package/dist/types/src/Item/service/actors/fetchDataFromEas.d.ts +1 -2
- package/dist/types/src/Item/service/actors/fetchDataFromEas.d.ts.map +1 -1
- package/dist/types/src/Item/service/actors/waitForDb.d.ts +3 -1
- package/dist/types/src/Item/service/actors/waitForDb.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/BaseItemProperty.d.ts +1 -1
- package/dist/types/src/ItemProperty/BaseItemProperty.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/service/actors/waitForDb.d.ts.map +1 -1
- package/dist/types/src/ItemProperty/service/propertyMachine.d.ts +6 -6
- package/dist/types/src/browser/db/Db.d.ts.map +1 -1
- package/dist/types/src/browser/helpers/FileManager.d.ts.map +1 -1
- package/dist/types/src/browser/react/property.d.ts +1 -1
- package/dist/types/src/browser/react/property.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/read/getItemProperties.d.ts.map +1 -1
- package/dist/types/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/types/src/db/read/subqueries/metadataLatest.d.ts +5 -0
- package/dist/types/src/db/read/subqueries/metadataLatest.d.ts.map +1 -0
- package/dist/types/src/db/write/createMetadata.d.ts.map +1 -1
- package/dist/types/src/graphql/gql/gql.d.ts +12 -5
- package/dist/types/src/graphql/gql/gql.d.ts.map +1 -1
- package/dist/types/src/graphql/gql/graphql.d.ts +31 -15
- package/dist/types/src/graphql/gql/graphql.d.ts.map +1 -1
- package/dist/types/src/helpers/files.d.ts.map +1 -1
- package/dist/types/src/schema/file/queries.d.ts.map +1 -1
- package/dist/types/src/schema/model/index.d.ts.map +1 -1
- package/dist/types/src/services/global/globalMachine.d.ts +90 -90
- package/dist/types/src/services/internal/helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/Db-BlgPVb_Z.js.map +0 -1
- package/dist/FileManager-BNqJl6Bz.js.map +0 -1
- package/dist/index-CsbUKGXp.js.map +0 -1
- package/dist/index-Km3L1_LR.js.map +0 -1
- package/dist/seed.schema.config-Dn_1QbD7.js.map +0 -1
- package/dist/types/src/Item/service/actors/saveDataToDb.d.ts +0 -3
- package/dist/types/src/Item/service/actors/saveDataToDb.d.ts.map +0 -1
package/dist/main.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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, 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-
|
|
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-OxV3e-OY.js';
|
|
4
4
|
export { B as BaseArweaveClient, a as BaseEasClient, c as BaseFileManager, b as BaseQueryClient } from './constants-Dgv-tSO3.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'xstate';
|
|
7
|
+
import 'debug';
|
|
7
8
|
import 'pluralize';
|
|
8
9
|
import 'drizzle-orm/sqlite-core';
|
|
9
10
|
import 'drizzle-orm';
|
|
@@ -11,13 +12,13 @@ import 'eventemitter3';
|
|
|
11
12
|
import 'nanoid';
|
|
12
13
|
import 'nanoid-dictionary';
|
|
13
14
|
import '@zenfs/core';
|
|
14
|
-
import 'debug';
|
|
15
15
|
import 'lodash-es';
|
|
16
16
|
import '@statelyai/inspect';
|
|
17
17
|
import 'node:fs';
|
|
18
18
|
import 'path';
|
|
19
19
|
import 'arweave';
|
|
20
20
|
import 'rxjs';
|
|
21
|
+
import 'drizzle-orm/casing';
|
|
21
22
|
import '@ethereum-attestation-service/eas-sdk';
|
|
22
23
|
import 'react';
|
|
23
24
|
import 'use-immer';
|
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,11 +1,12 @@
|
|
|
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-OxV3e-OY.js';
|
|
4
4
|
import 'immer';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'xstate';
|
|
7
7
|
import './constants-Dgv-tSO3.js';
|
|
8
8
|
import '@ethereum-attestation-service/eas-sdk';
|
|
9
|
+
import 'debug';
|
|
9
10
|
import 'pluralize';
|
|
10
11
|
import 'drizzle-orm/sqlite-core';
|
|
11
12
|
import 'drizzle-orm';
|
|
@@ -13,13 +14,13 @@ import 'eventemitter3';
|
|
|
13
14
|
import 'nanoid';
|
|
14
15
|
import 'nanoid-dictionary';
|
|
15
16
|
import '@zenfs/core';
|
|
16
|
-
import 'debug';
|
|
17
17
|
import 'lodash-es';
|
|
18
18
|
import '@statelyai/inspect';
|
|
19
19
|
import 'node:fs';
|
|
20
20
|
import 'path';
|
|
21
21
|
import 'arweave';
|
|
22
22
|
import 'rxjs';
|
|
23
|
+
import 'drizzle-orm/casing';
|
|
23
24
|
import 'react';
|
|
24
25
|
import 'use-immer';
|
|
25
26
|
import '@xstate/react';
|
|
@@ -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", undefined);
|
|
33
34
|
__decorate([
|
|
34
35
|
Text(),
|
|
35
36
|
__metadata("design:type", String)
|
|
36
|
-
], Seed.prototype, "type",
|
|
37
|
+
], Seed.prototype, "type", undefined);
|
|
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", undefined);
|
|
46
47
|
__decorate([
|
|
47
48
|
Text(),
|
|
48
49
|
__metadata("design:type", String)
|
|
49
|
-
], Version.prototype, "note",
|
|
50
|
+
], Version.prototype, "note", undefined);
|
|
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", undefined);
|
|
59
60
|
__decorate([
|
|
60
61
|
Text(),
|
|
61
62
|
__metadata("design:type", String)
|
|
62
|
-
], Metadata.prototype, "value",
|
|
63
|
+
], Metadata.prototype, "value", undefined);
|
|
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-Ba_E7t1M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.schema.config-Ba_E7t1M.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;;;;;"}
|
package/dist/src/BaseItem.ts
CHANGED
|
@@ -110,7 +110,7 @@ export abstract class BaseItem<T extends ModelValues<ModelSchema>> implements II
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
this._propertiesSubject.next(propertiesObj)
|
|
113
|
-
eventEmitter.emit(`item.${modelName}.${seedUid || seedLocalId}.update`)
|
|
113
|
+
// eventEmitter.emit(`item.${modelName}.${seedUid || seedLocalId}.update`)
|
|
114
114
|
})
|
|
115
115
|
|
|
116
116
|
this._service.start()
|
|
@@ -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 fs from '@zenfs/core'
|
|
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'
|
|
@@ -201,12 +201,13 @@ export abstract class BaseItemProperty<PropertyType> implements IItemProperty<Pr
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
this._subject.next(renderValue)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
204
|
+
// TODO: Maybe have this only update the property?
|
|
205
|
+
// if (context.seedLocalId) {
|
|
206
|
+
// eventEmitter.emit(`item.${modelName}.${context.seedLocalId}.update`)
|
|
207
|
+
// }
|
|
208
|
+
// if (context.seedUid) {
|
|
209
|
+
// eventEmitter.emit(`item.${modelName}.${context.seedUid}.update`)
|
|
210
|
+
// }
|
|
210
211
|
},
|
|
211
212
|
)
|
|
212
213
|
|
package/dist/src/ImageResizer.ts
CHANGED
package/dist/src/client.ts
CHANGED
|
@@ -18,9 +18,21 @@ import { initEasClient } from './helpers/EasClient'
|
|
|
18
18
|
import { initQueryClient } from './helpers/QueryClient'
|
|
19
19
|
import { initFileManager } from './helpers/FileManager'
|
|
20
20
|
import { initDb } from './db/Db'
|
|
21
|
+
import debug from 'debug'
|
|
22
|
+
|
|
23
|
+
const logger = debug('app:client')
|
|
21
24
|
|
|
22
25
|
const client = {
|
|
26
|
+
isInitialized: false,
|
|
23
27
|
init: async (options: SeedConstructorOptions) => {
|
|
28
|
+
logger('init client')
|
|
29
|
+
|
|
30
|
+
if (client.isInitialized) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
client.isInitialized = true
|
|
35
|
+
|
|
24
36
|
const { config, addresses } = options
|
|
25
37
|
|
|
26
38
|
await initItem()
|
|
@@ -2,8 +2,10 @@ import { metadata, MetadataType } from '@/seedSchema'
|
|
|
2
2
|
import { BaseEasClient, BaseQueryClient, generateId } from '@/helpers'
|
|
3
3
|
import { PropertyType } from '@/types'
|
|
4
4
|
import { BaseDb } from '../Db/BaseDb'
|
|
5
|
-
import { GET_SCHEMA_BY_NAME,
|
|
5
|
+
import { GET_SCHEMA_BY_NAME, } from '@/Item/queries'
|
|
6
6
|
import { INTERNAL_DATA_TYPES } from '@/helpers/constants'
|
|
7
|
+
import { toSnakeCase } from 'drizzle-orm/casing'
|
|
8
|
+
import { Schema } from '@/graphql/gql/graphql'
|
|
7
9
|
|
|
8
10
|
type CreateMetadata = (
|
|
9
11
|
metadataValues: Partial<MetadataType>,
|
|
@@ -38,20 +40,25 @@ export const createMetadata: CreateMetadata = async (
|
|
|
38
40
|
const easClient = BaseEasClient.getEasClient()
|
|
39
41
|
|
|
40
42
|
const easDataType = INTERNAL_DATA_TYPES[propertyRecordSchema.dataType].eas
|
|
43
|
+
|
|
44
|
+
const propertyNameSnakeCase = toSnakeCase(metadataValues.propertyName)
|
|
41
45
|
|
|
42
46
|
const queryResult = await queryClient.fetchQuery({
|
|
43
47
|
queryKey: [`getSchemaByName${metadataValues.propertyName}`],
|
|
44
|
-
queryFn: async () =>
|
|
48
|
+
queryFn: async (): Promise<{schemas: Schema[]}> =>
|
|
45
49
|
easClient.request(GET_SCHEMA_BY_NAME, {
|
|
46
50
|
where: {
|
|
47
51
|
schema: {
|
|
48
|
-
equals: `${easDataType} ${
|
|
52
|
+
equals: `${easDataType} ${propertyNameSnakeCase}`,
|
|
49
53
|
},
|
|
50
54
|
},
|
|
51
55
|
}),
|
|
52
56
|
})
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
if (queryResult && queryResult.schemas.length > 0) {
|
|
59
|
+
metadataValues.schemaUid = queryResult.schemas[0].id
|
|
60
|
+
}
|
|
61
|
+
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
return appDb
|
package/dist/src/drizzle.ts
CHANGED
package/dist/src/files.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { fs } from '@zenfs/core'
|
|
2
2
|
import * as fsNode from 'node:fs'
|
|
3
|
+
import debug from 'debug'
|
|
4
|
+
|
|
5
|
+
const logger = debug('app:helpers:files')
|
|
3
6
|
// import * as retry from 'async-es/retry'
|
|
4
7
|
|
|
5
8
|
export const listFilesInOPFSRoot = async () => {
|
|
@@ -28,13 +31,20 @@ export const listFilesInOPFSRoot = async () => {
|
|
|
28
31
|
*/
|
|
29
32
|
export const waitForFile = (
|
|
30
33
|
filePath: string,
|
|
31
|
-
interval: number =
|
|
32
|
-
timeout: number =
|
|
34
|
+
interval: number = 1000,
|
|
35
|
+
timeout: number = 60000,
|
|
33
36
|
): Promise<boolean> => {
|
|
34
37
|
return new Promise((resolve, reject) => {
|
|
35
38
|
const startTime = Date.now()
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
let isBusy = false
|
|
41
|
+
|
|
42
|
+
const _interval = setInterval(async () => {
|
|
43
|
+
logger('waitForFile', filePath)
|
|
44
|
+
if (isBusy) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
isBusy = true
|
|
38
48
|
if (fs.existsSync(filePath) && fsNode.existsSync(filePath)) {
|
|
39
49
|
clearInterval(_interval)
|
|
40
50
|
resolve(true)
|
|
@@ -43,6 +53,7 @@ export const waitForFile = (
|
|
|
43
53
|
clearInterval(_interval)
|
|
44
54
|
reject(new Error('Timeout exceeded while waiting for file'))
|
|
45
55
|
}
|
|
56
|
+
isBusy = false
|
|
46
57
|
}, interval)
|
|
47
58
|
|
|
48
59
|
// retry(
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GetItemProperties, PropertyData } from '@/types'
|
|
2
2
|
import { metadata, seeds, versions } from '@/seedSchema'
|
|
3
|
-
import { and, eq, getTableColumns, isNotNull, isNull, SQL } from 'drizzle-orm'
|
|
3
|
+
import { and, eq, getTableColumns, isNotNull, isNull, sql, SQL } from 'drizzle-orm'
|
|
4
4
|
import { BaseDb } from '@/db/Db/BaseDb'
|
|
5
|
+
import { getMetadataLatest } from './subqueries/metadataLatest'
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
export const getItemProperties: GetItemProperties = async ({
|
|
@@ -21,16 +22,7 @@ export const getItemProperties: GetItemProperties = async ({
|
|
|
21
22
|
whereClauses.push(eq(seeds.localId, seedLocalId))
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
// const uidWhereClause: SQL = seedUid
|
|
25
|
-
// ? eq(seeds.uid, seedUid)
|
|
26
|
-
// : isNull(seeds.uid)
|
|
27
|
-
// const localWhereClause: SQL = seedLocalId
|
|
28
|
-
// ? eq(seeds.localId, seedLocalId)
|
|
29
|
-
// : isNull(seeds.localId)
|
|
30
|
-
|
|
31
|
-
// whereClauses.push(or(localWhereClause, uidWhereClause) as SQL)
|
|
32
25
|
whereClauses.push(isNotNull(metadata.propertyName))
|
|
33
|
-
// whereClauses.push(isNotNull(metadata.easDataType))
|
|
34
26
|
|
|
35
27
|
if (typeof edited !== 'undefined') {
|
|
36
28
|
if (edited) {
|
|
@@ -41,17 +33,15 @@ export const getItemProperties: GetItemProperties = async ({
|
|
|
41
33
|
}
|
|
42
34
|
}
|
|
43
35
|
|
|
44
|
-
const metadataColumns = getTableColumns(metadata)
|
|
36
|
+
// const metadataColumns = getTableColumns(metadata)
|
|
37
|
+
|
|
38
|
+
const metadataLatest = getMetadataLatest({seedLocalId, seedUid})
|
|
45
39
|
|
|
46
40
|
const propertiesData = await appDb
|
|
47
|
-
.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
.leftJoin(metadata, eq(metadata.seedLocalId, seeds.localId))
|
|
52
|
-
.leftJoin(versions, eq(versions.localId, seeds.localId))
|
|
53
|
-
.where(and(...whereClauses))
|
|
54
|
-
.groupBy(metadata.propertyName)
|
|
41
|
+
.with(metadataLatest)
|
|
42
|
+
.select()
|
|
43
|
+
.from(metadataLatest)
|
|
44
|
+
.where(eq(metadataLatest.rowNum, 1))
|
|
55
45
|
|
|
56
46
|
return propertiesData.map(data => ({
|
|
57
47
|
...data,
|
|
@@ -111,6 +111,7 @@ const processRelationProperty = async (
|
|
|
111
111
|
relationProperty: IItemProperty<any>,
|
|
112
112
|
multiPublishPayload: MultiPublishPayload,
|
|
113
113
|
uploadedTransactions: UploadedTransaction[],
|
|
114
|
+
originalSeedLocalId: string,
|
|
114
115
|
): Promise<MultiPublishPayload> => {
|
|
115
116
|
const value = relationProperty.getService().getSnapshot()
|
|
116
117
|
.context.propertyValue
|
|
@@ -147,7 +148,7 @@ const processRelationProperty = async (
|
|
|
147
148
|
listOfAttestations: [],
|
|
148
149
|
propertiesToUpdate: [
|
|
149
150
|
{
|
|
150
|
-
publishLocalId:
|
|
151
|
+
publishLocalId: originalSeedLocalId,
|
|
151
152
|
propertySchemaUid: relationProperty.schemaUid,
|
|
152
153
|
},
|
|
153
154
|
],
|
|
@@ -182,6 +183,7 @@ const processRelationProperty = async (
|
|
|
182
183
|
const processListProperty = async (
|
|
183
184
|
listProperty: IItemProperty<any>,
|
|
184
185
|
multiPublishPayload: MultiPublishPayload,
|
|
186
|
+
originalSeedLocalId: string,
|
|
185
187
|
): Promise<MultiPublishPayload> => {
|
|
186
188
|
let value = listProperty.getService().getSnapshot().context.propertyValue
|
|
187
189
|
if (!value || listProperty.uid) {
|
|
@@ -236,7 +238,7 @@ const processListProperty = async (
|
|
|
236
238
|
listOfAttestations: [],
|
|
237
239
|
propertiesToUpdate: [
|
|
238
240
|
{
|
|
239
|
-
publishLocalId:
|
|
241
|
+
publishLocalId: originalSeedLocalId,
|
|
240
242
|
propertySchemaUid: listProperty.schemaUid,
|
|
241
243
|
},
|
|
242
244
|
],
|
|
@@ -325,9 +327,19 @@ export const getPublishPayload = async (
|
|
|
325
327
|
relationProperty,
|
|
326
328
|
multiPublishPayload,
|
|
327
329
|
uploadedTransactions,
|
|
330
|
+
item.seedLocalId,
|
|
328
331
|
)
|
|
329
332
|
itemBasicProperties.push(relationProperty)
|
|
330
333
|
}
|
|
334
|
+
|
|
335
|
+
for (const listProperty of itemListProperties) {
|
|
336
|
+
multiPublishPayload = await processListProperty(
|
|
337
|
+
listProperty,
|
|
338
|
+
multiPublishPayload,
|
|
339
|
+
item.seedLocalId,
|
|
340
|
+
)
|
|
341
|
+
itemBasicProperties.push(listProperty)
|
|
342
|
+
}
|
|
331
343
|
|
|
332
344
|
itemPublishData = await processBasicProperties(
|
|
333
345
|
itemBasicProperties,
|
|
@@ -337,12 +349,7 @@ export const getPublishPayload = async (
|
|
|
337
349
|
multiPublishPayload.push(itemPublishData)
|
|
338
350
|
|
|
339
351
|
|
|
340
|
-
|
|
341
|
-
multiPublishPayload = await processListProperty(
|
|
342
|
-
listProperty,
|
|
343
|
-
multiPublishPayload,
|
|
344
|
-
)
|
|
345
|
-
}
|
|
352
|
+
|
|
346
353
|
|
|
347
354
|
return multiPublishPayload
|
|
348
355
|
}
|
package/dist/src/gql.ts
CHANGED
|
@@ -14,10 +14,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
|
|
14
14
|
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
|
|
15
15
|
*/
|
|
16
16
|
const documents = {
|
|
17
|
-
"\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n": types.GetTransactionTagsDocument,
|
|
18
17
|
"\n fragment attestationFields on Attestation {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n": types.AttestationFieldsFragmentDoc,
|
|
19
18
|
"\n fragment schemaFields on Schema {\n id\n resolver\n revocable\n schema\n index\n schemaNames {\n name\n }\n time\n txid\n creator\n }\n": types.SchemaFieldsFragmentDoc,
|
|
19
|
+
"\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n": types.GetTransactionTagsDocument,
|
|
20
20
|
"\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n": types.GetSchemasDocument,
|
|
21
|
+
"\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n": types.GetSchemaByNameDocument,
|
|
21
22
|
"\n query GetSeeds($where: AttestationWhereInput!) {\n itemSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n timeCreated\n isOffchain\n }\n }\n": types.GetSeedsDocument,
|
|
22
23
|
"\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n": types.GetSeedIdsDocument,
|
|
23
24
|
"\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n": types.GetStorageTransactionIdDocument,
|
|
@@ -48,19 +49,23 @@ export function graphql(source: string): unknown;
|
|
|
48
49
|
/**
|
|
49
50
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
50
51
|
*/
|
|
51
|
-
export function graphql(source: "\n
|
|
52
|
+
export function graphql(source: "\n fragment attestationFields on Attestation {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n"): (typeof documents)["\n fragment attestationFields on Attestation {\n id\n decodedDataJson\n attester\n schema {\n schemaNames {\n name\n }\n }\n refUID\n revoked\n schemaId\n txid\n timeCreated\n time\n isOffchain\n }\n"];
|
|
52
53
|
/**
|
|
53
54
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
54
55
|
*/
|
|
55
|
-
export function graphql(source: "\n fragment
|
|
56
|
+
export function graphql(source: "\n fragment schemaFields on Schema {\n id\n resolver\n revocable\n schema\n index\n schemaNames {\n name\n }\n time\n txid\n creator\n }\n"): (typeof documents)["\n fragment schemaFields on Schema {\n id\n resolver\n revocable\n schema\n index\n schemaNames {\n name\n }\n time\n txid\n creator\n }\n"];
|
|
56
57
|
/**
|
|
57
58
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
58
59
|
*/
|
|
59
|
-
export function graphql(source: "\n
|
|
60
|
+
export function graphql(source: "\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n"): (typeof documents)["\n query GetTransactionTags($transactionId: ID!) {\n tags: transaction(id: $transactionId) {\n id\n tags {\n name\n value\n }\n }\n }\n"];
|
|
60
61
|
/**
|
|
61
62
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
62
63
|
*/
|
|
63
64
|
export function graphql(source: "\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"): (typeof documents)["\n query GetSchemas($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"];
|
|
65
|
+
/**
|
|
66
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
67
|
+
*/
|
|
68
|
+
export function graphql(source: "\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"): (typeof documents)["\n query GetSchemaByName($where: SchemaWhereInput!) {\n schemas: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"];
|
|
64
69
|
/**
|
|
65
70
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
66
71
|
*/
|
package/dist/src/graphql.ts
CHANGED
|
@@ -3072,6 +3072,10 @@ export type TransactionEdge = {
|
|
|
3072
3072
|
node: Transaction;
|
|
3073
3073
|
};
|
|
3074
3074
|
|
|
3075
|
+
export type AttestationFieldsFragment = { __typename?: 'Attestation', id: string, decodedDataJson: string, attester: string, refUID: string, revoked: boolean, schemaId: string, txid: string, timeCreated: number, time: number, isOffchain: boolean, schema: { __typename?: 'Schema', schemaNames: Array<{ __typename?: 'SchemaName', name: string }> } } & { ' $fragmentName'?: 'AttestationFieldsFragment' };
|
|
3076
|
+
|
|
3077
|
+
export type SchemaFieldsFragment = { __typename?: 'Schema', id: string, resolver: string, revocable: boolean, schema: string, index: string, time: number, txid: string, creator: string, schemaNames: Array<{ __typename?: 'SchemaName', name: string }> } & { ' $fragmentName'?: 'SchemaFieldsFragment' };
|
|
3078
|
+
|
|
3075
3079
|
export type GetTransactionTagsQueryVariables = Exact<{
|
|
3076
3080
|
transactionId: Scalars['ID']['input'];
|
|
3077
3081
|
}>;
|
|
@@ -3079,10 +3083,6 @@ export type GetTransactionTagsQueryVariables = Exact<{
|
|
|
3079
3083
|
|
|
3080
3084
|
export type GetTransactionTagsQuery = { __typename?: 'Query', tags?: { __typename?: 'Transaction', id: string, tags: Array<{ __typename?: 'Tag', name: string, value: string }> } | null };
|
|
3081
3085
|
|
|
3082
|
-
export type AttestationFieldsFragment = { __typename?: 'Attestation', id: string, decodedDataJson: string, attester: string, refUID: string, revoked: boolean, schemaId: string, txid: string, timeCreated: number, time: number, isOffchain: boolean, schema: { __typename?: 'Schema', schemaNames: Array<{ __typename?: 'SchemaName', name: string }> } } & { ' $fragmentName'?: 'AttestationFieldsFragment' };
|
|
3083
|
-
|
|
3084
|
-
export type SchemaFieldsFragment = { __typename?: 'Schema', id: string, resolver: string, revocable: boolean, schema: string, index: string, time: number, txid: string, creator: string, schemaNames: Array<{ __typename?: 'SchemaName', name: string }> } & { ' $fragmentName'?: 'SchemaFieldsFragment' };
|
|
3085
|
-
|
|
3086
3086
|
export type GetSchemasQueryVariables = Exact<{
|
|
3087
3087
|
where: SchemaWhereInput;
|
|
3088
3088
|
}>;
|
|
@@ -3090,6 +3090,13 @@ export type GetSchemasQueryVariables = Exact<{
|
|
|
3090
3090
|
|
|
3091
3091
|
export type GetSchemasQuery = { __typename?: 'Query', schemas: Array<{ __typename?: 'Schema', id: string, schema: string, schemaNames: Array<{ __typename?: 'SchemaName', name: string }> }> };
|
|
3092
3092
|
|
|
3093
|
+
export type GetSchemaByNameQueryVariables = Exact<{
|
|
3094
|
+
where: SchemaWhereInput;
|
|
3095
|
+
}>;
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
export type GetSchemaByNameQuery = { __typename?: 'Query', schemas: Array<{ __typename?: 'Schema', id: string, schema: string, schemaNames: Array<{ __typename?: 'SchemaName', name: string }> }> };
|
|
3099
|
+
|
|
3093
3100
|
export type GetSeedsQueryVariables = Exact<{
|
|
3094
3101
|
where: AttestationWhereInput;
|
|
3095
3102
|
}>;
|
|
@@ -3188,6 +3195,7 @@ export const AttestationFieldsFragmentDoc = {"kind":"Document","definitions":[{"
|
|
|
3188
3195
|
export const SchemaFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"schemaFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Schema"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"resolver"}},{"kind":"Field","name":{"kind":"Name","value":"revocable"}},{"kind":"Field","name":{"kind":"Name","value":"schema"}},{"kind":"Field","name":{"kind":"Name","value":"index"}},{"kind":"Field","name":{"kind":"Name","value":"schemaNames"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"txid"}},{"kind":"Field","name":{"kind":"Name","value":"creator"}}]}}]} as unknown as DocumentNode<SchemaFieldsFragment, unknown>;
|
|
3189
3196
|
export const GetTransactionTagsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransactionTags"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"transactionId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"tags"},"name":{"kind":"Name","value":"transaction"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"transactionId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"tags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode<GetTransactionTagsQuery, GetTransactionTagsQueryVariables>;
|
|
3190
3197
|
export const GetSchemasDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSchemas"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SchemaWhereInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"schemas"},"name":{"kind":"Name","value":"schemata"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"schema"}},{"kind":"Field","name":{"kind":"Name","value":"schemaNames"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetSchemasQuery, GetSchemasQueryVariables>;
|
|
3198
|
+
export const GetSchemaByNameDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSchemaByName"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SchemaWhereInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"schemas"},"name":{"kind":"Name","value":"schemata"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"schema"}},{"kind":"Field","name":{"kind":"Name","value":"schemaNames"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetSchemaByNameQuery, GetSchemaByNameQueryVariables>;
|
|
3191
3199
|
export const GetSeedsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSeeds"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AttestationWhereInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"itemSeeds"},"name":{"kind":"Name","value":"attestations"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"timeCreated"},"value":{"kind":"EnumValue","value":"desc"}}]}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"decodedDataJson"}},{"kind":"Field","name":{"kind":"Name","value":"attester"}},{"kind":"Field","name":{"kind":"Name","value":"schema"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"schemaNames"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"refUID"}},{"kind":"Field","name":{"kind":"Name","value":"revoked"}},{"kind":"Field","name":{"kind":"Name","value":"schemaId"}},{"kind":"Field","name":{"kind":"Name","value":"timeCreated"}},{"kind":"Field","name":{"kind":"Name","value":"isOffchain"}}]}}]}}]} as unknown as DocumentNode<GetSeedsQuery, GetSeedsQueryVariables>;
|
|
3192
3200
|
export const GetSeedIdsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSeedIds"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AttestationWhereInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"itemSeedIds"},"name":{"kind":"Name","value":"attestations"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"timeCreated"},"value":{"kind":"EnumValue","value":"desc"}}]}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<GetSeedIdsQuery, GetSeedIdsQueryVariables>;
|
|
3193
3201
|
export const GetStorageTransactionIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetStorageTransactionId"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AttestationWhereInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"storageTransactionId"},"name":{"kind":"Name","value":"attestations"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"timeCreated"},"value":{"kind":"EnumValue","value":"desc"}}]}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"decodedDataJson"}}]}}]}}]} as unknown as DocumentNode<GetStorageTransactionIdQuery, GetStorageTransactionIdQueryVariables>;
|
package/dist/src/helpers.ts
CHANGED
|
@@ -17,12 +17,23 @@ export const createDirectories = async (dirPath: string) => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const parentDir = path.dirname(dirPath)
|
|
20
|
-
|
|
20
|
+
let parentDirExists = await fs.promises.exists(parentDir)
|
|
21
21
|
if (!parentDirExists) {
|
|
22
22
|
await createDirectories(parentDir)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
await fs.promises.
|
|
25
|
+
parentDirExists = await fs.promises.exists(parentDir)
|
|
26
|
+
if (parentDirExists) {
|
|
27
|
+
try {
|
|
28
|
+
await fs.promises.mkdir(dirPath)
|
|
29
|
+
} catch (error) {
|
|
30
|
+
logger(`[Error] Failed to create directories for ${dirPath}:`, error)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!parentDirExists) {
|
|
35
|
+
console.log(fs)
|
|
36
|
+
}
|
|
26
37
|
}
|
|
27
38
|
|
|
28
39
|
let busy = false
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { and, eq, getTableColumns, or, SQL, sql } from 'drizzle-orm'
|
|
2
|
+
import { BaseDb } from '@/db/Db/BaseDb'
|
|
3
|
+
import { metadata } from '@/seedSchema'
|
|
4
|
+
|
|
5
|
+
export const getMetadataLatest = ({seedLocalId, seedUid}: {seedLocalId?: string, seedUid?: string}) => {
|
|
6
|
+
const appDb = BaseDb.getAppDb()
|
|
7
|
+
|
|
8
|
+
const whereClauses: SQL[] = []
|
|
9
|
+
|
|
10
|
+
if (seedLocalId) {
|
|
11
|
+
whereClauses.push(eq(metadata.seedLocalId, seedLocalId))
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (seedUid) {
|
|
15
|
+
whereClauses.push(eq(metadata.seedUid, seedUid))
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const metadataColumns = getTableColumns(metadata)
|
|
19
|
+
|
|
20
|
+
return appDb.$with('metadataLatest').as(
|
|
21
|
+
appDb
|
|
22
|
+
.select({
|
|
23
|
+
...metadataColumns,
|
|
24
|
+
rowNum: sql.raw(`
|
|
25
|
+
ROW_NUMBER() OVER (
|
|
26
|
+
PARTITION BY property_name
|
|
27
|
+
ORDER BY COALESCE(created_at, attestation_created_at) DESC
|
|
28
|
+
)
|
|
29
|
+
`).as('rowNum')
|
|
30
|
+
})
|
|
31
|
+
.from(metadata)
|
|
32
|
+
.where(and(...whereClauses))
|
|
33
|
+
)
|
|
34
|
+
}
|
package/dist/src/migrate.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import debug from 'debug'
|
|
8
8
|
import { waitForFile } from '@/helpers/files'
|
|
9
9
|
import { BaseDb } from '@/db/Db/BaseDb'
|
|
10
|
-
import fs from '@zenfs/core'
|
|
10
|
+
import { fs } from '@zenfs/core'
|
|
11
11
|
|
|
12
12
|
const logger = debug('app:services:db:actors:migrate')
|
|
13
13
|
|
|
@@ -31,7 +31,7 @@ export const migrate = fromCallback<
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
if (!journalExists) {
|
|
34
|
-
await waitForFile(journalPath)
|
|
34
|
+
await waitForFile(journalPath, 500, 60000)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
package/dist/src/property.ts
CHANGED
|
@@ -23,13 +23,16 @@ type UseItemPropertyReturn = {
|
|
|
23
23
|
status: string
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
type UseItemProperty = (props: UseItemPropertyProps) => UseItemPropertyReturn
|
|
26
|
+
type UseItemProperty = (props: UseItemPropertyProps | undefined) => UseItemPropertyReturn
|
|
27
27
|
|
|
28
|
-
export const useItemProperty: UseItemProperty = ({
|
|
29
|
-
propertyName,
|
|
30
|
-
seedLocalId,
|
|
31
|
-
seedUid,
|
|
28
|
+
export const useItemProperty: UseItemProperty = (props = {
|
|
29
|
+
propertyName: '',
|
|
30
|
+
seedLocalId: '',
|
|
31
|
+
seedUid: '',
|
|
32
32
|
}) => {
|
|
33
|
+
|
|
34
|
+
const { propertyName, seedLocalId, seedUid } = props
|
|
35
|
+
|
|
33
36
|
const [property, setProperty] = useState<IItemProperty<any> | undefined>()
|
|
34
37
|
const [isInitialized, setIsInitialized] = useState(false)
|
|
35
38
|
|
|
@@ -76,13 +79,13 @@ export const useItemProperty: UseItemProperty = ({
|
|
|
76
79
|
setProperty(foundProperty)
|
|
77
80
|
setIsInitialized(true)
|
|
78
81
|
isReadingDb.current = false
|
|
79
|
-
}, [internalStatus])
|
|
82
|
+
}, [internalStatus, props])
|
|
80
83
|
|
|
81
84
|
const listenerRef = useRef(readFromDb)
|
|
82
85
|
|
|
83
86
|
useEffect(() => {
|
|
84
87
|
listenerRef.current = readFromDb
|
|
85
|
-
}, [readFromDb])
|
|
88
|
+
}, [readFromDb, props])
|
|
86
89
|
|
|
87
90
|
useEffect(() => {
|
|
88
91
|
if (internalStatus === 'ready') {
|
package/dist/src/saveImageSrc.ts
CHANGED
|
@@ -232,7 +232,7 @@ export const saveImageSrc = fromCallback<
|
|
|
232
232
|
refSeedType: 'image',
|
|
233
233
|
refSchemaUid: imageSchemaUid,
|
|
234
234
|
renderValue: refResolvedDisplayValue,
|
|
235
|
-
refResolvedDisplayValue
|
|
235
|
+
refResolvedDisplayValue,
|
|
236
236
|
refResolvedValue: fileName,
|
|
237
237
|
localStorageDir: '/images',
|
|
238
238
|
easDataType: 'bytes32',
|