@seedprotocol/sdk 0.1.77 → 0.1.79
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/{index-BpkGOxI0.js → index-DmrlOoY_.js} +2 -2
- package/dist/{index-BpkGOxI0.js.map → index-DmrlOoY_.js.map} +1 -1
- package/dist/{index-BH0P1ozi.js → index-_JWt4nA-.js} +5 -4
- package/dist/index-_JWt4nA-.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-CR4yAjam.js → seed.schema.config-CD9Ee46X.js} +2 -2
- package/dist/{seed.schema.config-CR4yAjam.js.map → seed.schema.config-CD9Ee46X.js.map} +1 -1
- package/dist/src/hydrateFromDb.ts +2 -0
- package/dist/src/initialize.ts +119 -33
- package/dist/src/queries.ts +6 -27
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/types/src/browser/schema/file/fetchAll/actors.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-BH0P1ozi.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { j as ImageSrc, I as Item, k as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, v as getCorrectId, s as getGlobalService, n as useCreateItem, p as useDeleteItem, q as useGlobalServiceStatus, l as useItem, m as useItemProperties, o as useItemProperty, u as useItems, r as useServices, w as withSeed } from './index-
|
|
1
|
+
export { j as ImageSrc, I as Item, k as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, v as getCorrectId, s as getGlobalService, n as useCreateItem, p as useDeleteItem, q as useGlobalServiceStatus, l as useItem, m as useItemProperties, o as useItemProperty, u as useItems, r as useServices, w as withSeed } from './index-_JWt4nA-.js';
|
|
2
2
|
import 'immer';
|
|
3
3
|
import 'reflect-metadata';
|
|
4
4
|
import './constants-rmQ8zg8_.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as __decorate, a as __metadata } from './constants-rmQ8zg8_.js';
|
|
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-_JWt4nA-.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'reflect-metadata';
|
|
6
6
|
import 'xstate';
|
|
@@ -76,4 +76,4 @@ const models = {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export { models };
|
|
79
|
-
//# sourceMappingURL=seed.schema.config-
|
|
79
|
+
//# sourceMappingURL=seed.schema.config-CD9Ee46X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.schema.config-
|
|
1
|
+
{"version":3,"file":"seed.schema.config-CD9Ee46X.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;;;;;"}
|
package/dist/src/initialize.ts
CHANGED
|
@@ -1,41 +1,127 @@
|
|
|
1
|
-
import { EventObject, fromCallback } from 'xstate'
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { EventObject, fromCallback, Subscription } from 'xstate'
|
|
2
|
+
import { isNode, isReactNative } from '@/shared'
|
|
3
|
+
import {
|
|
4
|
+
GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES,
|
|
5
|
+
GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY,
|
|
6
|
+
GLOBAL_INITIALIZING_SEND_CONFIG,
|
|
7
|
+
} from '@/browser/services/internal/constants'
|
|
8
|
+
import debug from 'debug'
|
|
9
|
+
import { FromCallbackInput, GlobalMachineContext } from '@/types'
|
|
10
|
+
import { getAppDb } from '@/browser/db/sqlWasmClient'
|
|
11
|
+
import { appState } from '@/shared/seedSchema'
|
|
12
|
+
import { like } from 'drizzle-orm'
|
|
13
|
+
|
|
14
|
+
const logger = debug('app:services:global:actors:initialize')
|
|
15
|
+
|
|
16
|
+
export const initialize = fromCallback<
|
|
17
|
+
EventObject,
|
|
18
|
+
FromCallbackInput<GlobalMachineContext>
|
|
19
|
+
>(({ sendBack, input: { event, context } }) => {
|
|
20
|
+
const { internalService, models, endpoints } = context
|
|
21
|
+
|
|
22
|
+
const { addresses } = event
|
|
23
|
+
|
|
24
|
+
let environment = 'browser'
|
|
25
|
+
|
|
26
|
+
if (isNode()) {
|
|
27
|
+
environment = 'node'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (isReactNative()) {
|
|
31
|
+
environment = 'react-native'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let internalSubscription: Subscription | undefined
|
|
35
|
+
let easSubscription: Subscription | undefined
|
|
36
|
+
|
|
37
|
+
if (environment === 'browser' && models) {
|
|
38
|
+
const _initFileSystem = async (): Promise<void> => {
|
|
39
|
+
return
|
|
40
|
+
// return new Promise((resolve) => {
|
|
41
|
+
// })
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const _initInternal = async (): Promise<void> => {
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
internalSubscription = internalService.subscribe((snapshot) => {
|
|
47
|
+
logger('[sdk] [internal] snapshot', snapshot)
|
|
48
|
+
if (snapshot.value === 'ready') {
|
|
49
|
+
resolve()
|
|
50
|
+
}
|
|
24
51
|
})
|
|
25
|
-
|
|
52
|
+
internalService.send({ type: 'init', endpoints, addresses })
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const _initAllItemsServices = async (): Promise<void> => {
|
|
57
|
+
const appDb = getAppDb()
|
|
58
|
+
|
|
59
|
+
const rows = await appDb
|
|
60
|
+
.select()
|
|
61
|
+
.from(appState)
|
|
62
|
+
.where(like(appState.key, 'snapshot__%'))
|
|
63
|
+
|
|
64
|
+
const payloadObj = {
|
|
65
|
+
create: {},
|
|
66
|
+
restore: {},
|
|
26
67
|
}
|
|
27
68
|
|
|
69
|
+
const modelNamesRestored: string[] = []
|
|
70
|
+
|
|
71
|
+
if (rows && rows.length > 0) {
|
|
72
|
+
for (const row of rows) {
|
|
73
|
+
const modelName = row.key.replace('snapshot__', '')
|
|
74
|
+
payloadObj.restore[modelName] = JSON.parse(row.value)
|
|
75
|
+
modelNamesRestored.push(modelName)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const [modelName, ModelClass] of Object.entries(models)) {
|
|
79
|
+
if (!modelNamesRestored.includes(modelName)) {
|
|
80
|
+
payloadObj.create[modelName] = ModelClass
|
|
81
|
+
}
|
|
82
|
+
}
|
|
28
83
|
sendBack({
|
|
29
|
-
type:
|
|
30
|
-
|
|
31
|
-
modelTableName,
|
|
32
|
-
modelNamePlural,
|
|
84
|
+
type: GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES,
|
|
85
|
+
...payloadObj,
|
|
33
86
|
})
|
|
34
87
|
}
|
|
35
88
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
89
|
+
const _initEas = async (): Promise<void> => {
|
|
90
|
+
// const { easService } = await import('@/browser/eas')
|
|
91
|
+
// easService.send({ type: 'init', endpoints, models })
|
|
92
|
+
// return new Promise((resolve) => {
|
|
93
|
+
// easSubscription = easService.subscribe((snapshot) => {
|
|
94
|
+
// if (snapshot.value === 'ready') {
|
|
95
|
+
// resolve()
|
|
96
|
+
// }
|
|
97
|
+
// })
|
|
98
|
+
// easService.send({ type: 'init', endpoints, models })
|
|
99
|
+
// })
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
_initFileSystem().then(() => {
|
|
103
|
+
logger('[global/actors] File system initialized')
|
|
39
104
|
})
|
|
40
|
-
|
|
41
|
-
)
|
|
105
|
+
|
|
106
|
+
_initInternal()
|
|
107
|
+
.then(() => {
|
|
108
|
+
return _initAllItemsServices()
|
|
109
|
+
})
|
|
110
|
+
.then(() => {
|
|
111
|
+
logger('[global/actors] Internal initialized')
|
|
112
|
+
sendBack({ type: GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY })
|
|
113
|
+
internalSubscription?.unsubscribe()
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// _initEas().then(() => {
|
|
117
|
+
// logger('EAS initialized')
|
|
118
|
+
// })
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
sendBack({ type: GLOBAL_INITIALIZING_SEND_CONFIG, environment })
|
|
122
|
+
|
|
123
|
+
return () => {
|
|
124
|
+
internalSubscription?.unsubscribe()
|
|
125
|
+
easSubscription?.unsubscribe()
|
|
126
|
+
}
|
|
127
|
+
})
|
package/dist/src/queries.ts
CHANGED
|
@@ -1,34 +1,13 @@
|
|
|
1
1
|
import { graphql } from '@/browser/gql'
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
query
|
|
5
|
-
|
|
3
|
+
export const GET_SCHEMA_UIDS_FOR_MODELS = graphql(/* GraphQL */ `
|
|
4
|
+
query GetSchemaUids($where: SchemaWhereInput!) {
|
|
5
|
+
schemaUids: schemata(where: $where) {
|
|
6
6
|
id
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
schemaNames {
|
|
11
|
-
name
|
|
12
|
-
}
|
|
7
|
+
schema
|
|
8
|
+
schemaNames {
|
|
9
|
+
name
|
|
13
10
|
}
|
|
14
|
-
refUID
|
|
15
|
-
revoked
|
|
16
|
-
schemaId
|
|
17
|
-
txid
|
|
18
|
-
timeCreated
|
|
19
|
-
time
|
|
20
|
-
isOffchain
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`)
|
|
24
|
-
|
|
25
|
-
export const GET_IMAGE_VERSIONS = graphql(/* GraphQL */ `
|
|
26
|
-
query GetImageVersions($where: AttestationWhereInput!) {
|
|
27
|
-
imageVersions: attestations(
|
|
28
|
-
where: $where
|
|
29
|
-
orderBy: [{ timeCreated: desc }]
|
|
30
|
-
) {
|
|
31
|
-
...attestationFields
|
|
32
11
|
}
|
|
33
12
|
}
|
|
34
13
|
`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/property/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAOlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAIzD,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/property/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAOlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAIzD,eAAO,MAAM,aAAa,uHAoRxB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/schema/file/fetchAll/actors.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,uBAAuB,KAmClC,CAAA;AAEF,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/schema/file/fetchAll/actors.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,uBAAuB,KAmClC,CAAA;AAEF,eAAO,MAAM,kBAAkB,KA2N7B,CAAA"}
|