@seedprotocol/sdk 0.2.2 → 0.2.3
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/{Item-EuINlFXI.js → Item-D_fRE67b.js} +4 -5
- package/dist/{Item-EuINlFXI.js.map → Item-D_fRE67b.js.map} +1 -1
- package/dist/bin.js +35 -2
- package/dist/bin.js.map +1 -1
- package/dist/constants-CtWTDW5q.js +168 -0
- package/dist/constants-CtWTDW5q.js.map +1 -0
- package/dist/{index-DIlkGqpY.js → index-CaMCzFrd.js} +12 -116
- package/dist/index-CaMCzFrd.js.map +1 -0
- package/dist/{index-C9eVIXxd.js → index-DpAde4Hk.js} +4 -5
- package/dist/index-DpAde4Hk.js.map +1 -0
- package/dist/main.js +3 -4
- package/dist/main.js.map +1 -1
- package/dist/node/db/node.app.db.config.ts +2 -2
- package/dist/{seed.schema.config-Du8pUTQu.js → seed.schema.config-DrU0-rhL.js} +4 -5
- package/dist/seed.schema.config-DrU0-rhL.js.map +1 -0
- package/dist/seedSchema/AppStateSchema.ts +10 -0
- package/dist/seedSchema/ConfigSchema.ts +15 -0
- package/dist/seedSchema/MetadataSchema.ts +28 -0
- package/dist/seedSchema/ModelSchema.ts +46 -0
- package/dist/seedSchema/ModelUidSchema.ts +16 -0
- package/dist/seedSchema/PropertyUidSchema.ts +16 -0
- package/dist/seedSchema/SeedSchema.ts +29 -0
- package/dist/seedSchema/VersionSchema.ts +16 -0
- package/dist/seedSchema/index.ts +8 -0
- package/dist/src/ArweaveClientNode.ts +13 -0
- package/dist/src/BaseItem.ts +1 -1
- package/dist/src/EasClientNode.ts +13 -0
- package/dist/src/FileManagerNode.ts +31 -0
- package/dist/src/QueryClientNode.ts +24 -0
- package/dist/src/getPropertyData.ts +1 -1
- package/dist/src/index.ts +21 -4
- package/dist/src/node.app.db.config.ts +2 -2
- package/dist/types/scripts/bin.d.ts +4 -0
- package/dist/types/scripts/bin.d.ts.map +1 -1
- package/dist/types/src/node/helpers/ArweaveClientNode.d.ts +7 -0
- package/dist/types/src/node/helpers/ArweaveClientNode.d.ts.map +1 -0
- package/dist/types/src/node/helpers/EasClientNode.d.ts +7 -0
- package/dist/types/src/node/helpers/EasClientNode.d.ts.map +1 -0
- package/dist/types/src/node/helpers/FileManagerNode.d.ts +9 -0
- package/dist/types/src/node/helpers/FileManagerNode.d.ts.map +1 -0
- package/dist/types/src/node/helpers/QueryClientNode.d.ts +9 -0
- package/dist/types/src/node/helpers/QueryClientNode.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/constants-yM3e1D1k.js +0 -64
- package/dist/constants-yM3e1D1k.js.map +0 -1
- package/dist/index-C9eVIXxd.js.map +0 -1
- package/dist/index-DIlkGqpY.js.map +0 -1
- package/dist/seed.schema.config-Du8pUTQu.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { I as Item } from './index-
|
|
1
|
+
export { I as Item } from './index-CaMCzFrd.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import 'tslib';
|
|
@@ -10,6 +10,8 @@ import 'dayjs';
|
|
|
10
10
|
import 'nanoid';
|
|
11
11
|
import 'nanoid-dictionary';
|
|
12
12
|
import 'debug';
|
|
13
|
+
import './constants-CtWTDW5q.js';
|
|
14
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
13
15
|
import 'drizzle-orm/sqlite-core';
|
|
14
16
|
import 'drizzle-orm';
|
|
15
17
|
import 'path';
|
|
@@ -17,8 +19,6 @@ import 'react';
|
|
|
17
19
|
import 'pluralize';
|
|
18
20
|
import 'eventemitter3';
|
|
19
21
|
import 'lodash-es';
|
|
20
|
-
import './constants-yM3e1D1k.js';
|
|
21
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
22
22
|
import '@statelyai/inspect';
|
|
23
23
|
import 'drizzle-orm/sqlite-proxy';
|
|
24
24
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
@@ -28,5 +28,4 @@ import '@zenfs/dom';
|
|
|
28
28
|
import 'arweave';
|
|
29
29
|
import 'use-immer';
|
|
30
30
|
import '@xstate/react';
|
|
31
|
-
|
|
32
|
-
//# sourceMappingURL=index-C9eVIXxd.js.map
|
|
31
|
+
//# sourceMappingURL=index-DpAde4Hk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DpAde4Hk.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/main.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import 'immer';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
|
-
export { l as
|
|
3
|
+
export { l as BaseFileManager, a as ImageSrc, I as Item, b as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, n as client, m as eventEmitter, k as getCorrectId, j as getGlobalService, e as useCreateItem, g as useDeleteItem, h as useGlobalServiceStatus, c as useItem, d as useItemProperties, f as useItemProperty, u as useItems, i as useServices, w as withSeed } from './index-CaMCzFrd.js';
|
|
4
4
|
import 'tslib';
|
|
5
5
|
import 'xstate';
|
|
6
6
|
import 'arweave';
|
|
7
7
|
import 'drizzle-orm';
|
|
8
|
+
export { b as BaseArweaveClient, B as BaseEasClient, a as BaseQueryClient } from './constants-CtWTDW5q.js';
|
|
8
9
|
import '@sinclair/typebox';
|
|
9
10
|
import 'rxjs';
|
|
10
11
|
import '@zenfs/core';
|
|
@@ -18,8 +19,6 @@ import 'react';
|
|
|
18
19
|
import 'pluralize';
|
|
19
20
|
import 'eventemitter3';
|
|
20
21
|
import 'lodash-es';
|
|
21
|
-
import './constants-yM3e1D1k.js';
|
|
22
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
23
22
|
import '@statelyai/inspect';
|
|
24
23
|
import 'drizzle-orm/sqlite-proxy';
|
|
25
24
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
@@ -28,5 +27,5 @@ import 'node:fs';
|
|
|
28
27
|
import '@zenfs/dom';
|
|
29
28
|
import 'use-immer';
|
|
30
29
|
import '@xstate/react';
|
|
31
|
-
import '
|
|
30
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
32
31
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -24,10 +24,10 @@ if (process.env.IS_SEED_DEV) {
|
|
|
24
24
|
)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
let schemaDir = `${sdkRoot}/dist/
|
|
27
|
+
let schemaDir = `${sdkRoot}/dist/seedSchema/*.ts`
|
|
28
28
|
|
|
29
29
|
if (process.env.IS_SEED_DEV) {
|
|
30
|
-
schemaDir = `${sdkRoot}/
|
|
30
|
+
schemaDir = `${sdkRoot}/seedSchema/*.ts`
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export default defineConfig({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import 'drizzle-orm';
|
|
3
|
-
import { T as Text, M as Model } from './index-
|
|
3
|
+
import { T as Text, M as Model } from './index-CaMCzFrd.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'reflect-metadata';
|
|
6
6
|
import 'xstate';
|
|
@@ -13,13 +13,13 @@ import 'dayjs';
|
|
|
13
13
|
import 'nanoid';
|
|
14
14
|
import 'nanoid-dictionary';
|
|
15
15
|
import 'debug';
|
|
16
|
+
import './constants-CtWTDW5q.js';
|
|
17
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
16
18
|
import 'drizzle-orm/sqlite-core';
|
|
17
19
|
import 'path';
|
|
18
20
|
import 'pluralize';
|
|
19
21
|
import 'eventemitter3';
|
|
20
22
|
import 'lodash-es';
|
|
21
|
-
import './constants-yM3e1D1k.js';
|
|
22
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
23
23
|
import '@statelyai/inspect';
|
|
24
24
|
import 'drizzle-orm/sqlite-proxy';
|
|
25
25
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
@@ -28,7 +28,6 @@ import 'node:fs';
|
|
|
28
28
|
import '@zenfs/dom';
|
|
29
29
|
import 'use-immer';
|
|
30
30
|
import '@xstate/react';
|
|
31
|
-
import 'lodash';
|
|
32
31
|
|
|
33
32
|
let Seed = class Seed {
|
|
34
33
|
};
|
|
@@ -76,4 +75,4 @@ const models = {
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
export { models };
|
|
79
|
-
//# sourceMappingURL=seed.schema.config-
|
|
78
|
+
//# sourceMappingURL=seed.schema.config-DrU0-rhL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.schema.config-DrU0-rhL.js","sources":["../../src/shared/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/browser'\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;;;;;"}
|
|
@@ -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,15 @@
|
|
|
1
|
+
import { blob, int, sqliteTable, text, check, } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
import { sql } from 'drizzle-orm'
|
|
3
|
+
|
|
4
|
+
export const config = sqliteTable('config', {
|
|
5
|
+
id: int('id').primaryKey({ autoIncrement: true }),
|
|
6
|
+
key: text('key').notNull(),
|
|
7
|
+
text: text('text'),
|
|
8
|
+
json: text('json', {mode: 'json'}),
|
|
9
|
+
blob: blob('blob', {mode: 'buffer'}),
|
|
10
|
+
}, () => {
|
|
11
|
+
return {
|
|
12
|
+
// Add a custom check constraint
|
|
13
|
+
atLeastOneNotNull: check('hasValue', sql`key IS NOT NULL OR text IS NOT NULL OR json IS NOT NULL OR blob IS NOT NULL`),
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
|
|
3
|
+
export const metadata = sqliteTable('metadata', {
|
|
4
|
+
localId: text('local_id').unique(),
|
|
5
|
+
uid: text('uid'),
|
|
6
|
+
propertyName: text('property_name'),
|
|
7
|
+
propertyValue: text('property_value'),
|
|
8
|
+
schemaUid: text('schema_uid'),
|
|
9
|
+
modelType: text('model_type'),
|
|
10
|
+
seedLocalId: text('seed_local_id'),
|
|
11
|
+
seedUid: text('seed_uid'),
|
|
12
|
+
versionLocalId: text('version_local_id'),
|
|
13
|
+
versionUid: text('version_uid'),
|
|
14
|
+
easDataType: text('eas_data_type'),
|
|
15
|
+
refValueType: text('ref_value_type'),
|
|
16
|
+
refModelUid: text('ref_schema_uid'),
|
|
17
|
+
refSeedType: text('ref_seed_type'),
|
|
18
|
+
refResolvedValue: text('ref_resolved_value'),
|
|
19
|
+
refResolvedDisplayValue: text('ref_resolved_display_value'),
|
|
20
|
+
localStorageDir: text('local_storage_dir'),
|
|
21
|
+
attestationRaw: text('attestation_raw'),
|
|
22
|
+
attestationCreatedAt: int('attestation_created_at'),
|
|
23
|
+
contentHash: text('content_hash'),
|
|
24
|
+
createdAt: int('created_at'),
|
|
25
|
+
updatedAt: int('updated_at'),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export type MetadataType = metadata.$inferSelect
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { int, sqliteTable, text, unique } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
import { relations } from 'drizzle-orm'
|
|
3
|
+
|
|
4
|
+
export const models = sqliteTable('models', {
|
|
5
|
+
id: int('id').primaryKey({ autoIncrement: true }),
|
|
6
|
+
name: text('name').notNull(),
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export const modelsRelations = relations(models, ({ many }) => ({
|
|
10
|
+
properties: many(properties),
|
|
11
|
+
}))
|
|
12
|
+
|
|
13
|
+
export type NewModelRecord = typeof models.$inferInsert
|
|
14
|
+
export type ModelRecordType = typeof models.$inferSelect
|
|
15
|
+
|
|
16
|
+
export const properties = sqliteTable(
|
|
17
|
+
'properties',
|
|
18
|
+
{
|
|
19
|
+
id: int('id').primaryKey({ autoIncrement: true }),
|
|
20
|
+
name: text('name').notNull(),
|
|
21
|
+
dataType: text('data_type').notNull(),
|
|
22
|
+
readEndpoint: text('read_endpoint'),
|
|
23
|
+
updateEndpoint: text('update_endpoint'),
|
|
24
|
+
modelId: int('model_id')
|
|
25
|
+
.notNull()
|
|
26
|
+
.references(() => models.id),
|
|
27
|
+
refModelId: int('ref_model_id').references(() => models.id),
|
|
28
|
+
refValueType: text('ref_value_type'),
|
|
29
|
+
},
|
|
30
|
+
(table) => {
|
|
31
|
+
return {
|
|
32
|
+
uniqueNameModelId: unique('unique_name_model_id').on(
|
|
33
|
+
table.name,
|
|
34
|
+
table.modelId,
|
|
35
|
+
),
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
export const propertiesRelations = relations(properties, ({ one }) => ({
|
|
41
|
+
model: one(models),
|
|
42
|
+
refModel: one(models),
|
|
43
|
+
}))
|
|
44
|
+
|
|
45
|
+
export type NewPropertyRecord = typeof properties.$inferInsert
|
|
46
|
+
export type PropertyType = typeof properties.$inferSelect
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
import { relations } from 'drizzle-orm'
|
|
3
|
+
import { models } from './ModelSchema'
|
|
4
|
+
|
|
5
|
+
export const modelUids = sqliteTable('model_uids', {
|
|
6
|
+
id: int('id').primaryKey({ autoIncrement: true }),
|
|
7
|
+
uid: text('uid').notNull(),
|
|
8
|
+
modelId: int('model_id')
|
|
9
|
+
.notNull()
|
|
10
|
+
.unique()
|
|
11
|
+
.references(() => models.id),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const modelRelations = relations(modelUids, ({ many, one }) => ({
|
|
15
|
+
model: one(models),
|
|
16
|
+
}))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
import { relations } from 'drizzle-orm'
|
|
3
|
+
import { models, properties } from './ModelSchema'
|
|
4
|
+
|
|
5
|
+
export const propertyUids = sqliteTable('property_uids', {
|
|
6
|
+
id: int('id').primaryKey({ autoIncrement: true }),
|
|
7
|
+
uid: text('uid').notNull(),
|
|
8
|
+
propertyId: int('property_id')
|
|
9
|
+
.notNull()
|
|
10
|
+
.unique()
|
|
11
|
+
.references(() => models.id),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const propertyUidRelations = relations(propertyUids, ({ one }) => ({
|
|
15
|
+
property: one(properties),
|
|
16
|
+
}))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
|
|
3
|
+
export const seeds = sqliteTable(
|
|
4
|
+
'seeds',
|
|
5
|
+
{
|
|
6
|
+
localId: text('local_id').unique(),
|
|
7
|
+
uid: text('uid'),
|
|
8
|
+
schemaUid: text('schema_uid'),
|
|
9
|
+
type: text('type'),
|
|
10
|
+
attestationRaw: text('attestation_raw'),
|
|
11
|
+
attestationCreatedAt: int('attestation_created_at'),
|
|
12
|
+
createdAt: int('created_at'),
|
|
13
|
+
updatedAt: int('updated_at'),
|
|
14
|
+
_markedForDeletion: int('_marked_for_deletion'),
|
|
15
|
+
},
|
|
16
|
+
// {
|
|
17
|
+
// triggers: [
|
|
18
|
+
// sql<string>`CREATE TRIGGER IF NOT EXISTS seeds_created_at_trigger
|
|
19
|
+
// BEFORE INSERT
|
|
20
|
+
// ON seeds
|
|
21
|
+
// FOR EACH ROW
|
|
22
|
+
// BEGIN
|
|
23
|
+
// SELECT strftime('%s', 'now') * 1000 INTO NEW.created_at;
|
|
24
|
+
// END;`,
|
|
25
|
+
// ],
|
|
26
|
+
// },
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export type SeedType = seeds.$inferSelect
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { int, sqliteTable, text } from 'drizzle-orm/sqlite-core'
|
|
2
|
+
|
|
3
|
+
export const versions = sqliteTable('versions', {
|
|
4
|
+
localId: text('local_id').unique(),
|
|
5
|
+
uid: text('uid'),
|
|
6
|
+
seedLocalId: text('seed_local_id'),
|
|
7
|
+
seedUid: text('seed_uid'),
|
|
8
|
+
seedType: text('seed_type'),
|
|
9
|
+
note: text('note'),
|
|
10
|
+
createdAt: int('created_at'),
|
|
11
|
+
updatedAt: int('updated_at'),
|
|
12
|
+
attestationCreatedAt: int('attestation_created_at'),
|
|
13
|
+
attestationRaw: text('attestation_raw'),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export type VersionsType = versions.$inferSelect
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './SeedSchema'
|
|
2
|
+
export * from './VersionSchema'
|
|
3
|
+
export * from './MetadataSchema'
|
|
4
|
+
export * from './AppStateSchema'
|
|
5
|
+
export * from './ConfigSchema'
|
|
6
|
+
export * from './ModelSchema'
|
|
7
|
+
export * from './ModelUidSchema'
|
|
8
|
+
export * from './PropertyUidSchema'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseArweaveClient } from '@/helpers/BaseArweaveClient';
|
|
2
|
+
import { ARWEAVE_ENDPOINT } from '@/services/internal/constants';
|
|
3
|
+
import { GraphQLClient } from 'graphql-request';
|
|
4
|
+
|
|
5
|
+
class ArweaveClientNode extends BaseArweaveClient {
|
|
6
|
+
static getArweaveClient(): GraphQLClient {
|
|
7
|
+
return new GraphQLClient(ARWEAVE_ENDPOINT);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
BaseArweaveClient.setPlatformClass(ArweaveClientNode);
|
|
12
|
+
|
|
13
|
+
export { ArweaveClientNode };
|
package/dist/src/BaseItem.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { BehaviorSubject } from 'rxjs'
|
|
|
19
19
|
import { ActorRefFrom, Subscription, createActor } from 'xstate'
|
|
20
20
|
import { eventEmitter } from '@/eventBus'
|
|
21
21
|
import pluralize from 'pluralize'
|
|
22
|
-
import { orderBy, startCase
|
|
22
|
+
import { orderBy, startCase } from 'lodash-es'
|
|
23
23
|
import { waitForEvent } from '@/events'
|
|
24
24
|
import { getItemData } from '@/db/read/getItemData'
|
|
25
25
|
import { getItemsData } from '@/db/read/getItems'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEasClient } from "@/helpers/BaseEasClient"
|
|
2
|
+
import { EAS_ENDPOINT } from "@/services/internal/constants"
|
|
3
|
+
import { GraphQLClient } from "graphql-request"
|
|
4
|
+
|
|
5
|
+
class EasClientNode extends BaseEasClient {
|
|
6
|
+
static getEasClient() {
|
|
7
|
+
return new GraphQLClient(EAS_ENDPOINT)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
BaseEasClient.setPlatformClass(EasClientNode)
|
|
12
|
+
|
|
13
|
+
export { EasClientNode }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
class FileManagerNode {
|
|
5
|
+
static async readFileAsBuffer(filePath: string): Promise<Buffer> {
|
|
6
|
+
return await fs.readFile(filePath);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static async writeFile(filePath: string, data: Buffer | string): Promise<void> {
|
|
10
|
+
await fs.writeFile(filePath, data);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static async deleteFile(filePath: string): Promise<void> {
|
|
14
|
+
await fs.unlink(filePath);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static async fileExists(filePath: string): Promise<boolean> {
|
|
18
|
+
try {
|
|
19
|
+
await fs.access(filePath);
|
|
20
|
+
return true;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static async getFileName(filePath: string): Promise<string> {
|
|
27
|
+
return path.basename(filePath);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { FileManagerNode };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseQueryClient } from "@/helpers/BaseQueryClient"
|
|
2
|
+
import { EAS_ENDPOINT } from "@/services/internal/constants"
|
|
3
|
+
import { GraphQLClient } from "graphql-request"
|
|
4
|
+
|
|
5
|
+
class QueryClientNode extends BaseQueryClient {
|
|
6
|
+
static getQueryClient() {
|
|
7
|
+
return {
|
|
8
|
+
fetchQuery: () => {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
reject(new Error('Not implemented'))
|
|
11
|
+
})
|
|
12
|
+
},
|
|
13
|
+
getQueryData: () => {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
reject(new Error('Not implemented'))
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
BaseQueryClient.setPlatformClass(QueryClientNode)
|
|
23
|
+
|
|
24
|
+
export { QueryClientNode }
|
|
@@ -2,7 +2,7 @@ import { PropertyData } from "@/types"
|
|
|
2
2
|
import { BaseDb } from "@/db/BaseDb"
|
|
3
3
|
import { metadata, MetadataType } from "@/seedSchema"
|
|
4
4
|
import { or, eq, and, sql } from "drizzle-orm"
|
|
5
|
-
import { startCase } from "lodash"
|
|
5
|
+
import { startCase } from "lodash-es"
|
|
6
6
|
import { GetPropertyDataOptions } from "@/types/db"
|
|
7
7
|
|
|
8
8
|
|
package/dist/src/index.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { setup } from 'xstate'
|
|
2
|
+
import {
|
|
3
|
+
uploadBinaryData,
|
|
4
|
+
uploadMetadata,
|
|
5
|
+
} from '@/browser/schema/file/upload/actors'
|
|
6
|
+
|
|
7
|
+
export const uploadMachine = setup({
|
|
8
|
+
actors: {
|
|
9
|
+
uploadBinaryData,
|
|
10
|
+
uploadMetadata,
|
|
11
|
+
},
|
|
12
|
+
}).createMachine({
|
|
13
|
+
id: 'upload',
|
|
14
|
+
initial: 'idle',
|
|
15
|
+
context: {
|
|
16
|
+
file: '',
|
|
17
|
+
},
|
|
18
|
+
states: {
|
|
19
|
+
idle: {},
|
|
20
|
+
},
|
|
21
|
+
})
|
|
@@ -24,10 +24,10 @@ if (process.env.IS_SEED_DEV) {
|
|
|
24
24
|
)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
let schemaDir = `${sdkRoot}/dist/
|
|
27
|
+
let schemaDir = `${sdkRoot}/dist/seedSchema/*.ts`
|
|
28
28
|
|
|
29
29
|
if (process.env.IS_SEED_DEV) {
|
|
30
|
-
schemaDir = `${sdkRoot}/
|
|
30
|
+
schemaDir = `${sdkRoot}/seedSchema/*.ts`
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export default defineConfig({
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import '../src/node/helpers/EasClientNode';
|
|
3
|
+
import '../src/node/helpers/QueryClientNode';
|
|
4
|
+
import '../src/node/helpers/FileManagerNode';
|
|
5
|
+
import '../src/node/helpers/ArweaveClientNode';
|
|
2
6
|
declare const init: (args: string[]) => void;
|
|
3
7
|
export { init };
|
|
4
8
|
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../scripts/bin.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../scripts/bin.ts"],"names":[],"mappings":";AAOA,OAAO,mCAAmC,CAAA;AAC1C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,uCAAuC,CAAA;AAoB9C,QAAA,MAAM,IAAI,SAAU,MAAM,EAAE,SA+I3B,CAAA;AAeD,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseArweaveClient } from '@/helpers/BaseArweaveClient';
|
|
2
|
+
import { GraphQLClient } from 'graphql-request';
|
|
3
|
+
declare class ArweaveClientNode extends BaseArweaveClient {
|
|
4
|
+
static getArweaveClient(): GraphQLClient;
|
|
5
|
+
}
|
|
6
|
+
export { ArweaveClientNode };
|
|
7
|
+
//# sourceMappingURL=ArweaveClientNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArweaveClientNode.d.ts","sourceRoot":"","sources":["../../../../../src/node/helpers/ArweaveClientNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,cAAM,iBAAkB,SAAQ,iBAAiB;IAC/C,MAAM,CAAC,gBAAgB,IAAI,aAAa;CAGzC;AAID,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseEasClient } from "@/helpers/BaseEasClient";
|
|
2
|
+
import { GraphQLClient } from "graphql-request";
|
|
3
|
+
declare class EasClientNode extends BaseEasClient {
|
|
4
|
+
static getEasClient(): GraphQLClient;
|
|
5
|
+
}
|
|
6
|
+
export { EasClientNode };
|
|
7
|
+
//# sourceMappingURL=EasClientNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EasClientNode.d.ts","sourceRoot":"","sources":["../../../../../src/node/helpers/EasClientNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,cAAM,aAAc,SAAQ,aAAa;IACvC,MAAM,CAAC,YAAY;CAGpB;AAID,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare class FileManagerNode {
|
|
2
|
+
static readFileAsBuffer(filePath: string): Promise<Buffer>;
|
|
3
|
+
static writeFile(filePath: string, data: Buffer | string): Promise<void>;
|
|
4
|
+
static deleteFile(filePath: string): Promise<void>;
|
|
5
|
+
static fileExists(filePath: string): Promise<boolean>;
|
|
6
|
+
static getFileName(filePath: string): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
export { FileManagerNode };
|
|
9
|
+
//# sourceMappingURL=FileManagerNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileManagerNode.d.ts","sourceRoot":"","sources":["../../../../../src/node/helpers/FileManagerNode.ts"],"names":[],"mappings":"AAGA,cAAM,eAAe;WACN,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;WAInD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAIjE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAI3C,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;WAS9C,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG5D;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseQueryClient } from "@/helpers/BaseQueryClient";
|
|
2
|
+
declare class QueryClientNode extends BaseQueryClient {
|
|
3
|
+
static getQueryClient(): {
|
|
4
|
+
fetchQuery: () => Promise<unknown>;
|
|
5
|
+
getQueryData: () => Promise<unknown>;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export { QueryClientNode };
|
|
9
|
+
//# sourceMappingURL=QueryClientNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryClientNode.d.ts","sourceRoot":"","sources":["../../../../../src/node/helpers/QueryClientNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAI3D,cAAM,eAAgB,SAAQ,eAAe;IAC3C,MAAM,CAAC,cAAc;;;;CActB;AAID,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ZERO_ADDRESS, ZERO_BYTES32, ZERO_BYTES } from '@ethereum-attestation-service/eas-sdk';
|
|
2
|
-
|
|
3
|
-
const SCHEMA_NJK = 'schema.njk';
|
|
4
|
-
const SCHEMA_TS = 'schema.ts';
|
|
5
|
-
const INTERNAL_DATA_TYPES = {
|
|
6
|
-
Text: {
|
|
7
|
-
eas: 'string',
|
|
8
|
-
},
|
|
9
|
-
Number: {
|
|
10
|
-
eas: 'uint8',
|
|
11
|
-
},
|
|
12
|
-
ImageSrc: {
|
|
13
|
-
eas: 'string',
|
|
14
|
-
},
|
|
15
|
-
Relation: {
|
|
16
|
-
eas: 'bytes32',
|
|
17
|
-
},
|
|
18
|
-
List: {
|
|
19
|
-
eas: 'bytes32[]',
|
|
20
|
-
},
|
|
21
|
-
FileSrc: {
|
|
22
|
-
eas: 'string',
|
|
23
|
-
},
|
|
24
|
-
Json: {
|
|
25
|
-
eas: 'string',
|
|
26
|
-
},
|
|
27
|
-
Blob: {
|
|
28
|
-
eas: 'bytes32',
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
const internalPropertyNames = [
|
|
32
|
-
'localId',
|
|
33
|
-
'uid',
|
|
34
|
-
'seedLocalId',
|
|
35
|
-
'seedUid',
|
|
36
|
-
'schemaUid',
|
|
37
|
-
'attestationCreatedAt',
|
|
38
|
-
'createdAt',
|
|
39
|
-
'updatedAt',
|
|
40
|
-
'versionsCount',
|
|
41
|
-
'lastVersionPublishedAt',
|
|
42
|
-
'latestVersionLocalId',
|
|
43
|
-
'versionLocalId',
|
|
44
|
-
'lastLocalUpdateAt',
|
|
45
|
-
'storageTransactionId',
|
|
46
|
-
'versionUid',
|
|
47
|
-
'refSeedType',
|
|
48
|
-
'refValueType',
|
|
49
|
-
'refResolvedValue',
|
|
50
|
-
'refResolvedDisplayValue',
|
|
51
|
-
'type',
|
|
52
|
-
];
|
|
53
|
-
const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA = '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6';
|
|
54
|
-
const defaultAttestationData = {
|
|
55
|
-
recipient: ZERO_ADDRESS,
|
|
56
|
-
revocable: true,
|
|
57
|
-
value: BigInt(0),
|
|
58
|
-
refUID: ZERO_BYTES32,
|
|
59
|
-
expirationTime: BigInt(0),
|
|
60
|
-
data: ZERO_BYTES,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export { INTERNAL_DATA_TYPES as I, SCHEMA_NJK as S, VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA as V, SCHEMA_TS as a, defaultAttestationData as d, internalPropertyNames as i };
|
|
64
|
-
//# sourceMappingURL=constants-yM3e1D1k.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-yM3e1D1k.js","sources":["../../src/helpers/constants.ts"],"sourcesContent":["import {\n AttestationRequestData,\n ZERO_BYTES,\n ZERO_BYTES32,\n ZERO_ADDRESS,\n} from '@ethereum-attestation-service/eas-sdk'\n\n\nexport const SCHEMA_NJK = 'schema.njk'\nexport const SCHEMA_TS = 'schema.ts'\n\nexport const INTERNAL_DATA_TYPES = {\n Text: {\n eas: 'string',\n },\n Number: {\n eas: 'uint8',\n },\n ImageSrc: {\n eas: 'string',\n },\n Relation: {\n eas: 'bytes32',\n },\n List: {\n eas: 'bytes32[]',\n },\n FileSrc: {\n eas: 'string',\n },\n Json: {\n eas: 'string',\n },\n Blob: {\n eas: 'bytes32',\n },\n}\n\nexport const internalPropertyNames = [\n 'localId',\n 'uid',\n 'seedLocalId',\n 'seedUid',\n 'schemaUid',\n 'attestationCreatedAt',\n 'createdAt',\n 'updatedAt',\n 'versionsCount',\n 'lastVersionPublishedAt',\n 'latestVersionLocalId',\n 'versionLocalId',\n 'lastLocalUpdateAt',\n 'storageTransactionId',\n 'versionUid',\n 'refSeedType',\n 'refValueType',\n 'refResolvedValue',\n 'refResolvedDisplayValue',\n 'type',\n]\n\nexport const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA =\n '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6'\n\nexport const defaultAttestationData: AttestationRequestData = {\n recipient: ZERO_ADDRESS,\n revocable: true,\n value: BigInt(0),\n refUID: ZERO_BYTES32,\n expirationTime: BigInt(0),\n data: ZERO_BYTES,\n}\n"],"names":[],"mappings":";;AAQO,MAAM,UAAU,GAAG;AACnB,MAAM,SAAS,GAAG;AAEZ,MAAA,mBAAmB,GAAG;AACjC,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,GAAG,EAAE,OAAO;AACb,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,WAAW;AACjB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;;AAGU,MAAA,qBAAqB,GAAG;IACnC,SAAS;IACT,KAAK;IACL,aAAa;IACb,SAAS;IACT,WAAW;IACX,sBAAsB;IACtB,WAAW;IACX,WAAW;IACX,eAAe;IACf,wBAAwB;IACxB,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,YAAY;IACZ,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,yBAAyB;IACzB,MAAM;;AAGD,MAAM,mCAAmC,GAC9C;AAEW,MAAA,sBAAsB,GAA2B;AAC5D,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAChB,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-C9eVIXxd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|