@seedprotocol/sdk 0.2.1 → 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-D_fRE67b.js +40 -0
- package/dist/Item-D_fRE67b.js.map +1 -0
- package/dist/ItemProperty-l0sNRNKZ.js +2 -0
- package/dist/ItemProperty-l0sNRNKZ.js.map +1 -0
- package/dist/bin.js +35 -3
- 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-DaK2dz5P.js → index-CaMCzFrd.js} +226 -332
- package/dist/index-CaMCzFrd.js.map +1 -0
- package/dist/{index-B5qzD-bs.js → index-DpAde4Hk.js} +6 -8
- package/dist/index-DpAde4Hk.js.map +1 -0
- package/dist/main.js +3 -5
- package/dist/main.js.map +1 -1
- package/dist/node/db/node.app.db.config.ts +2 -2
- package/dist/{seed.schema.config-DIMmvqJf.js → seed.schema.config-DrU0-rhL.js} +7 -9
- 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/BaseItemProperty.ts +1 -1
- package/dist/src/EasClientNode.ts +13 -0
- package/dist/src/FileManagerNode.ts +31 -0
- package/dist/src/IItemProperty.ts +1 -1
- package/dist/src/ItemProperty.ts +0 -16
- package/dist/src/QueryClientNode.ts +24 -0
- package/dist/src/SeedProtocolSdk.d.ts +1 -1
- package/dist/src/client.ts +12 -6
- package/dist/src/create.ts +1 -1
- package/dist/src/fetchDbData.ts +7 -4
- package/dist/src/fetchSeeds.ts +5 -2
- package/dist/src/fetchVersions.ts +5 -2
- package/dist/src/getItem.ts +1 -1
- package/dist/src/getPropertyData.ts +1 -1
- package/dist/src/getPublishPayload.ts +1 -1
- package/dist/src/globalMachine.ts +1 -1
- package/dist/src/hydrateFromDb.ts +1 -1
- package/dist/src/initialize.ts +88 -238
- package/dist/src/itemMachineAll.ts +6 -7
- package/dist/src/node.app.db.config.ts +2 -2
- package/dist/src/preparePublishRequestData.ts +1 -1
- package/dist/src/processItems.ts +5 -2
- package/dist/src/property.ts +2 -2
- package/dist/src/requestAll.ts +1 -1
- package/dist/src/trash.ts +1 -1
- package/dist/types/scripts/bin.d.ts +4 -0
- package/dist/types/scripts/bin.d.ts.map +1 -1
- package/dist/types/src/Item/index.d.ts +5 -0
- package/dist/types/src/Item/index.d.ts.map +1 -0
- 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/index.d.ts +5 -0
- package/dist/types/src/ItemProperty/index.d.ts.map +1 -0
- package/dist/types/src/browser/{item → Item}/Item.d.ts.map +1 -1
- package/dist/types/src/browser/Item/index.d.ts +2 -0
- package/dist/types/src/browser/Item/index.d.ts.map +1 -0
- package/dist/types/src/browser/{item → ItemProperty}/ItemProperty.d.ts +2 -1
- package/dist/types/src/browser/ItemProperty/ItemProperty.d.ts.map +1 -0
- package/dist/types/src/browser/{property → ItemProperty}/index.d.ts +1 -1
- package/dist/types/src/browser/ItemProperty/index.d.ts.map +1 -0
- package/dist/types/src/browser/index.d.ts +2 -3
- package/dist/types/src/browser/index.d.ts.map +1 -1
- package/dist/types/src/browser/react/item.d.ts +1 -1
- package/dist/types/src/browser/react/property.d.ts +1 -1
- package/dist/types/src/browser/react/trash.d.ts +1 -1
- package/dist/types/src/browser/schema/index.d.ts +2 -2
- package/dist/types/src/browser/schema/index.d.ts.map +1 -1
- package/dist/types/src/browser/schema/model/index.d.ts +1 -1
- package/dist/types/src/{browser/client.d.ts → client.d.ts} +1 -1
- package/dist/types/src/client.d.ts.map +1 -0
- package/dist/types/src/db/read/getPublishPayload.d.ts +1 -1
- package/dist/types/src/helpers/constants.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +4 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/interfaces/IItemProperty.d.ts +1 -1
- package/dist/types/src/interfaces/IItemProperty.d.ts.map +1 -1
- package/dist/types/src/node/{item → Item}/Item.d.ts.map +1 -1
- package/dist/types/src/node/ItemProperty/ItemProperty.d.ts +1 -0
- package/dist/types/src/node/ItemProperty/ItemProperty.d.ts.map +1 -0
- 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/dist/types/src/services/allItems/actors/fetchDbData.d.ts +4 -0
- package/dist/types/src/services/allItems/actors/fetchDbData.d.ts.map +1 -0
- package/dist/types/src/services/allItems/actors/fetchRelatedItems.d.ts.map +1 -0
- package/dist/types/src/services/allItems/actors/fetchSeeds.d.ts +4 -0
- package/dist/types/src/services/allItems/actors/fetchSeeds.d.ts.map +1 -0
- package/dist/types/src/services/allItems/actors/fetchVersions.d.ts +4 -0
- package/dist/types/src/services/allItems/actors/fetchVersions.d.ts.map +1 -0
- package/dist/types/src/services/allItems/actors/initialize.d.ts.map +1 -0
- package/dist/types/src/services/allItems/actors/processItems.d.ts +4 -0
- package/dist/types/src/services/allItems/actors/processItems.d.ts.map +1 -0
- package/dist/types/src/services/allItems/itemMachineAll.d.ts +67 -0
- package/dist/types/src/services/allItems/itemMachineAll.d.ts.map +1 -0
- package/dist/types/src/types/item.d.ts +5 -5
- package/dist/types/src/types/item.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/constants-B6s6tGup.js +0 -65
- package/dist/constants-B6s6tGup.js.map +0 -1
- package/dist/index-B5qzD-bs.js.map +0 -1
- package/dist/index-DaK2dz5P.js.map +0 -1
- package/dist/seed.schema.config-DIMmvqJf.js.map +0 -1
- package/dist/src/init.ts +0 -61
- package/dist/types/src/browser/client.d.ts.map +0 -1
- package/dist/types/src/browser/item/ItemProperty.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/actors/fetchDbData.d.ts +0 -2
- package/dist/types/src/browser/item/all/actors/fetchDbData.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/actors/fetchRelatedItems.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/actors/fetchSeeds.d.ts +0 -2
- package/dist/types/src/browser/item/all/actors/fetchSeeds.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/actors/fetchVersions.d.ts +0 -2
- package/dist/types/src/browser/item/all/actors/fetchVersions.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/actors/initialize.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/actors/processItems.d.ts +0 -2
- package/dist/types/src/browser/item/all/actors/processItems.d.ts.map +0 -1
- package/dist/types/src/browser/item/all/itemMachineAll.d.ts +0 -2
- package/dist/types/src/browser/item/all/itemMachineAll.d.ts.map +0 -1
- package/dist/types/src/browser/item/index.d.ts +0 -3
- package/dist/types/src/browser/item/index.d.ts.map +0 -1
- package/dist/types/src/browser/property/index.d.ts.map +0 -1
- package/dist/types/src/init.d.ts +0 -6
- package/dist/types/src/init.d.ts.map +0 -1
- package/dist/types/src/seed.d.ts +0 -1
- package/dist/types/src/seed.d.ts.map +0 -1
- /package/dist/types/src/browser/{item → Item}/Item.d.ts +0 -0
- /package/dist/types/src/node/{item → Item}/Item.d.ts +0 -0
- /package/dist/types/src/{browser/item/all → services/allItems}/actors/fetchRelatedItems.d.ts +0 -0
- /package/dist/types/src/{browser/item/all → services/allItems}/actors/initialize.d.ts +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
export { I as Item
|
|
2
|
-
import '
|
|
1
|
+
export { I as Item } from './index-CaMCzFrd.js';
|
|
2
|
+
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
|
+
import 'tslib';
|
|
4
5
|
import '@sinclair/typebox';
|
|
5
6
|
import 'xstate';
|
|
6
7
|
import 'rxjs';
|
|
7
|
-
import 'immer';
|
|
8
8
|
import '@zenfs/core';
|
|
9
9
|
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,9 +19,6 @@ import 'react';
|
|
|
17
19
|
import 'pluralize';
|
|
18
20
|
import 'eventemitter3';
|
|
19
21
|
import 'lodash-es';
|
|
20
|
-
import './constants-B6s6tGup.js';
|
|
21
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
22
|
-
import 'thirdweb';
|
|
23
22
|
import '@statelyai/inspect';
|
|
24
23
|
import 'drizzle-orm/sqlite-proxy';
|
|
25
24
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
@@ -29,5 +28,4 @@ import '@zenfs/dom';
|
|
|
29
28
|
import 'arweave';
|
|
30
29
|
import 'use-immer';
|
|
31
30
|
import '@xstate/react';
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=index-B5qzD-bs.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
|
-
export { 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, l as client, n as eventEmitter, m as getCorrectId, k as getGlobalService, e as useCreateItem, g as useDeleteItem, h as useGlobalServiceStatus, c as useItem, d as useItemProperties, f as useItemProperty, u as useItems, j as useServices, w as withSeed } from './index-DaK2dz5P.js';
|
|
2
1
|
import 'immer';
|
|
3
2
|
import 'reflect-metadata';
|
|
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,9 +19,6 @@ import 'react';
|
|
|
18
19
|
import 'pluralize';
|
|
19
20
|
import 'eventemitter3';
|
|
20
21
|
import 'lodash-es';
|
|
21
|
-
import './constants-B6s6tGup.js';
|
|
22
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
23
|
-
import 'thirdweb';
|
|
24
22
|
import '@statelyai/inspect';
|
|
25
23
|
import 'drizzle-orm/sqlite-proxy';
|
|
26
24
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
@@ -29,5 +27,5 @@ import 'node:fs';
|
|
|
29
27
|
import '@zenfs/dom';
|
|
30
28
|
import 'use-immer';
|
|
31
29
|
import '@xstate/react';
|
|
32
|
-
import '
|
|
30
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
33
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,35 +1,33 @@
|
|
|
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';
|
|
7
7
|
import 'arweave';
|
|
8
|
-
import '
|
|
9
|
-
import '@zenfs/dom';
|
|
8
|
+
import 'immer';
|
|
10
9
|
import '@sinclair/typebox';
|
|
11
10
|
import 'rxjs';
|
|
12
|
-
import '
|
|
11
|
+
import '@zenfs/core';
|
|
13
12
|
import 'dayjs';
|
|
14
13
|
import 'nanoid';
|
|
15
14
|
import 'nanoid-dictionary';
|
|
16
15
|
import 'debug';
|
|
16
|
+
import './constants-CtWTDW5q.js';
|
|
17
|
+
import '@ethereum-attestation-service/eas-sdk';
|
|
17
18
|
import 'drizzle-orm/sqlite-core';
|
|
18
19
|
import 'path';
|
|
19
20
|
import 'pluralize';
|
|
20
21
|
import 'eventemitter3';
|
|
21
22
|
import 'lodash-es';
|
|
22
|
-
import './constants-B6s6tGup.js';
|
|
23
|
-
import '@ethereum-attestation-service/eas-sdk';
|
|
24
|
-
import 'thirdweb';
|
|
25
23
|
import '@statelyai/inspect';
|
|
26
24
|
import 'drizzle-orm/sqlite-proxy';
|
|
27
25
|
import 'drizzle-orm/sqlite-proxy/migrator';
|
|
28
26
|
import 'drizzle-orm/migrator';
|
|
29
27
|
import 'node:fs';
|
|
28
|
+
import '@zenfs/dom';
|
|
30
29
|
import 'use-immer';
|
|
31
30
|
import '@xstate/react';
|
|
32
|
-
import 'lodash';
|
|
33
31
|
|
|
34
32
|
let Seed = class Seed {
|
|
35
33
|
};
|
|
@@ -77,4 +75,4 @@ const models = {
|
|
|
77
75
|
};
|
|
78
76
|
|
|
79
77
|
export { models };
|
|
80
|
-
//# 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'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActorRefFrom, createActor, SnapshotFrom, Subscription, waitFor } from 'xstate'
|
|
2
2
|
import { BehaviorSubject, Subscriber } from 'rxjs'
|
|
3
3
|
import { Static } from '@sinclair/typebox'
|
|
4
|
-
import { ItemProperty, TProperty } from '@/browser/
|
|
4
|
+
import { ItemProperty, TProperty } from '@/browser/ItemProperty'
|
|
5
5
|
import { IItemProperty } from '@/interfaces/IItemProperty'
|
|
6
6
|
import { immerable } from 'immer'
|
|
7
7
|
import { CreatePropertyInstanceProps, PropertyMachineContext } from '@/types'
|
|
@@ -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 };
|
|
@@ -2,7 +2,7 @@ import { ActorRefFrom, Subscription } from 'xstate';
|
|
|
2
2
|
import { PropertyMachineContext } from '@/types';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
4
|
import { Static } from '@sinclair/typebox';
|
|
5
|
-
import { TProperty } from '@/browser/
|
|
5
|
+
import { TProperty } from '@/browser/ItemProperty';
|
|
6
6
|
|
|
7
7
|
export interface IItemProperty<PropertyType> {
|
|
8
8
|
readonly localId: string;
|
package/dist/src/ItemProperty.ts
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CreatePropertyInstanceProps, PropertyType } from '@/types'
|
|
2
|
-
import { IItemProperty } from '@/interfaces/IItemProperty'
|
|
3
|
-
import { BaseItemProperty } from '@/ItemProperty/BaseItemProperty'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export class ItemProperty extends BaseItemProperty<PropertyType> implements IItemProperty<PropertyType> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(initialValues: Partial<CreatePropertyInstanceProps>) {
|
|
11
|
-
super(initialValues)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
BaseItemProperty.setPlatformClass(ItemProperty)
|
|
@@ -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 }
|
package/dist/src/client.ts
CHANGED
|
@@ -12,9 +12,15 @@ import {
|
|
|
12
12
|
} from '@/stores/modelClass'
|
|
13
13
|
import { setupServiceHandlers } from '@/events/services'
|
|
14
14
|
import { setArweaveDomain } from '@/browser/helpers/arweave'
|
|
15
|
+
import { initItem } from './Item'
|
|
16
|
+
import { initItemProperty } from './ItemProperty'
|
|
15
17
|
|
|
16
18
|
const client = {
|
|
17
|
-
init: ({ config, addresses }: SeedConstructorOptions) => {
|
|
19
|
+
init: async ({ config, addresses }: Promise<SeedConstructorOptions>) => {
|
|
20
|
+
|
|
21
|
+
await initItem()
|
|
22
|
+
await initItemProperty()
|
|
23
|
+
|
|
18
24
|
const { endpoints, models, arweaveDomain } = config
|
|
19
25
|
|
|
20
26
|
if (arweaveDomain) {
|
|
@@ -41,11 +47,11 @@ const client = {
|
|
|
41
47
|
addresses,
|
|
42
48
|
arweaveDomain,
|
|
43
49
|
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
50
|
+
|
|
51
|
+
const { models: internalModels } = await import('@/shared/configs/seed.schema.config')
|
|
52
|
+
for (const [key, value] of Object.entries(internalModels)) {
|
|
53
|
+
setModel(key, value)
|
|
54
|
+
}
|
|
49
55
|
},
|
|
50
56
|
subscribe: (callback: any) => {
|
|
51
57
|
callback({
|
package/dist/src/create.ts
CHANGED
package/dist/src/fetchDbData.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { EventObject, fromCallback } from 'xstate'
|
|
2
|
-
import {
|
|
2
|
+
import { AllItemsMachineContext, FromCallbackInput } from '@/types'
|
|
3
3
|
|
|
4
|
-
export const fetchDbData = fromCallback<
|
|
4
|
+
export const fetchDbData = fromCallback<
|
|
5
|
+
EventObject,
|
|
6
|
+
FromCallbackInput<EventObject, AllItemsMachineContext>
|
|
7
|
+
>(
|
|
5
8
|
({ sendBack, input: { context } }) => {
|
|
6
9
|
const { modelNamePlural, times } = context
|
|
7
10
|
|
|
8
|
-
const _fetchDbData = async (): Promise<void> => {}
|
|
11
|
+
const _fetchDbData = async (): Promise<void> => { }
|
|
9
12
|
|
|
10
13
|
_fetchDbData().then(() => {
|
|
11
14
|
sendBack({ type: 'fetchDbDataSuccess' })
|
|
12
15
|
})
|
|
13
16
|
|
|
14
|
-
return () => {}
|
|
17
|
+
return () => { }
|
|
15
18
|
},
|
|
16
19
|
)
|
package/dist/src/fetchSeeds.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventObject, fromCallback } from 'xstate'
|
|
2
2
|
import { GET_SEEDS } from '@/Item/queries'
|
|
3
|
-
import {
|
|
3
|
+
import { AllItemsMachineContext, FromCallbackInput } from '@/types'
|
|
4
4
|
import { Attestation } from '@/graphql/gql/graphql'
|
|
5
5
|
import { BaseEasClient } from '@/helpers/BaseEasClient'
|
|
6
6
|
import { BaseQueryClient } from '@/helpers/BaseQueryClient'
|
|
@@ -11,7 +11,10 @@ const queryClient = BaseQueryClient.getQueryClient()
|
|
|
11
11
|
|
|
12
12
|
const logger = debug('app:allItemsActors:fetchSeeds')
|
|
13
13
|
|
|
14
|
-
export const fetchSeeds = fromCallback<
|
|
14
|
+
export const fetchSeeds = fromCallback<
|
|
15
|
+
EventObject,
|
|
16
|
+
FromCallbackInput<EventObject, AllItemsMachineContext>
|
|
17
|
+
>(
|
|
15
18
|
({ sendBack, input: { context } }) => {
|
|
16
19
|
const { queryVariables, modelName } = context
|
|
17
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventObject, fromCallback } from 'xstate'
|
|
2
2
|
import { GET_VERSIONS } from '@/Item/queries'
|
|
3
|
-
import {
|
|
3
|
+
import { AllItemsMachineContext, FromCallbackInput } from '@/types'
|
|
4
4
|
import { Attestation } from '@/graphql/gql/graphql'
|
|
5
5
|
import { BaseEasClient } from '@/helpers/BaseEasClient'
|
|
6
6
|
import { BaseQueryClient } from '@/helpers/BaseQueryClient'
|
|
@@ -9,7 +9,10 @@ const easClient = BaseEasClient.getEasClient()
|
|
|
9
9
|
const queryClient = BaseQueryClient.getQueryClient()
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
export const fetchVersions = fromCallback<
|
|
12
|
+
export const fetchVersions = fromCallback<
|
|
13
|
+
EventObject,
|
|
14
|
+
FromCallbackInput<EventObject, AllItemsMachineContext>
|
|
15
|
+
>(
|
|
13
16
|
({ sendBack, input: { context } }) => {
|
|
14
17
|
const { itemSeeds, modelName } = context
|
|
15
18
|
|
package/dist/src/getItem.ts
CHANGED
|
@@ -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
|
|
|
@@ -16,7 +16,7 @@ import pluralize from 'pluralize'
|
|
|
16
16
|
import { getSchemaUidForModel } from '@/db/read/getSchemaUidForModel'
|
|
17
17
|
import { getSchemaUidForSchemaDefinition } from '@/stores/eas'
|
|
18
18
|
import { getCorrectId } from '@/helpers'
|
|
19
|
-
import { Item } from '@/browser/
|
|
19
|
+
import { Item } from '@/browser/Item/Item'
|
|
20
20
|
import { getSegmentedItemProperties } from '@/helpers/getSegmentedItemProperties'
|
|
21
21
|
import { IItemProperty } from '@/interfaces'
|
|
22
22
|
|
|
@@ -14,7 +14,7 @@ import { initialize } from '@/services/global/actors/initialize'
|
|
|
14
14
|
import { getSchemaForModel } from '@/services/global/actors/getSchemaForModel'
|
|
15
15
|
import { addModelsToDb } from '@/services/global/actors/addModelsToDb'
|
|
16
16
|
import { internalMachine } from '@/services/internal/internalMachine'
|
|
17
|
-
import { itemMachineAll } from '
|
|
17
|
+
import { itemMachineAll } from '../allItems/itemMachineAll'
|
|
18
18
|
import { publishMachine } from '@/services/publish/publishMachine'
|
|
19
19
|
import { savePublishService } from '@/services/global/actors/savePublishService'
|
|
20
20
|
|
|
@@ -274,7 +274,7 @@ export const hydrateFromDb = fromCallback<
|
|
|
274
274
|
propertyRecordSchema.storageType &&
|
|
275
275
|
propertyRecordSchema.storageType === 'ItemStorage'
|
|
276
276
|
) {
|
|
277
|
-
const { Item } = await import(`@/browser/
|
|
277
|
+
const { Item } = await import(`@/browser/Item`)
|
|
278
278
|
const item = await Item.find({
|
|
279
279
|
seedLocalId,
|
|
280
280
|
modelName,
|