@seedprotocol/sdk 0.2.51 → 0.2.52

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.
Files changed (205) hide show
  1. package/dist/{ArweaveClient-D1TsTBoj.js → ArweaveClient-D5iJisYr.js} +2 -2
  2. package/dist/{ArweaveClient-DpdXUcVJ.js.map → ArweaveClient-D5iJisYr.js.map} +1 -1
  3. package/dist/{ArweaveClient-DpdXUcVJ.js → ArweaveClient-HEIIuOfB.js} +2 -2
  4. package/dist/{ArweaveClient-D1TsTBoj.js.map → ArweaveClient-HEIIuOfB.js.map} +1 -1
  5. package/dist/{Db-quJxmvHH.js → Db-D-BsZYlN.js} +3 -3
  6. package/dist/{Db-quJxmvHH.js.map → Db-D-BsZYlN.js.map} +1 -1
  7. package/dist/{Db-DMJ0v3gO.js → Db-Dpsbk_T7.js} +3 -3
  8. package/dist/{Db-DMJ0v3gO.js.map → Db-Dpsbk_T7.js.map} +1 -1
  9. package/dist/{EasClient-ClZDuT3o.js → EasClient-D3wKgt0o.js} +2 -2
  10. package/dist/{EasClient-DfnGY_2X.js.map → EasClient-D3wKgt0o.js.map} +1 -1
  11. package/dist/{EasClient-DfnGY_2X.js → EasClient-jqkT2ZBt.js} +2 -2
  12. package/dist/{EasClient-ClZDuT3o.js.map → EasClient-jqkT2ZBt.js.map} +1 -1
  13. package/dist/{FileManager-texI7UwL.js → FileManager-4mWYO3Mt.js} +3 -5
  14. package/dist/FileManager-4mWYO3Mt.js.map +1 -0
  15. package/dist/{Item-D4n439Ei.js → Item-CqWdJsyg.js} +3 -3
  16. package/dist/{Item-D4n439Ei.js.map → Item-CqWdJsyg.js.map} +1 -1
  17. package/dist/{ItemProperty-Be5ymRVT.js → ItemProperty-BpBW3IWx.js} +3 -3
  18. package/dist/{ItemProperty-Be5ymRVT.js.map → ItemProperty-BpBW3IWx.js.map} +1 -1
  19. package/dist/{QueryClient-B1HkAaJo.js → QueryClient-CBOP3OoU.js} +2 -2
  20. package/dist/{QueryClient-B1HkAaJo.js.map → QueryClient-CBOP3OoU.js.map} +1 -1
  21. package/dist/{QueryClient-BPoc9eBn.js → QueryClient-bKb3SB0W.js} +2 -2
  22. package/dist/{QueryClient-BPoc9eBn.js.map → QueryClient-bKb3SB0W.js.map} +1 -1
  23. package/dist/bin.js +5 -5
  24. package/dist/{constants-5PxfAeqj.js → constants-CIDbABDz.js} +2 -2
  25. package/dist/{constants-5PxfAeqj.js.map → constants-CIDbABDz.js.map} +1 -1
  26. package/dist/{index-BeKRizLf.js → index-BRxO1tLl.js} +257 -145
  27. package/dist/index-BRxO1tLl.js.map +1 -0
  28. package/dist/{index-BLla2o05.js → index-d8Qsot6w.js} +3 -3
  29. package/dist/index-d8Qsot6w.js.map +1 -0
  30. package/dist/main.js +2 -2
  31. package/dist/package.json +189 -0
  32. package/dist/{seed.schema.config-CMpV_hyS.js → seed.schema.config-CPRn6KVL.js} +3 -3
  33. package/dist/{seed.schema.config-CMpV_hyS.js.map → seed.schema.config-CPRn6KVL.js.map} +1 -1
  34. package/dist/types/src/client/BaseClientManager.d.ts +7 -0
  35. package/dist/types/src/client/BaseClientManager.d.ts.map +1 -0
  36. package/dist/types/src/client/actions/setAddresses.d.ts +2 -0
  37. package/dist/types/src/client/actions/setAddresses.d.ts.map +1 -0
  38. package/dist/types/src/client/actors/initialize.d.ts +4 -0
  39. package/dist/types/src/client/actors/initialize.d.ts.map +1 -0
  40. package/dist/types/src/client/actors/saveAppState.d.ts +5 -0
  41. package/dist/types/src/client/actors/saveAppState.d.ts.map +1 -0
  42. package/dist/types/src/client/clientManagerMachine.d.ts +19 -0
  43. package/dist/types/src/client/clientManagerMachine.d.ts.map +1 -0
  44. package/dist/types/src/client/index.d.ts +41 -0
  45. package/dist/types/src/client/index.d.ts.map +1 -0
  46. package/dist/types/src/client.d.ts.map +1 -1
  47. package/dist/types/src/node/helpers/FileManager.d.ts.map +1 -1
  48. package/dist/types/src/services/internal/actors/validateInput.d.ts.map +1 -1
  49. package/dist/types/src/types/machines.d.ts +5 -0
  50. package/dist/types/src/types/machines.d.ts.map +1 -1
  51. package/package.json +2 -2
  52. package/dist/FileManager-texI7UwL.js.map +0 -1
  53. package/dist/index-BLla2o05.js.map +0 -1
  54. package/dist/index-BeKRizLf.js.map +0 -1
  55. package/dist/src/AppStateSchema.ts +0 -10
  56. package/dist/src/ArweaveClient.ts +0 -13
  57. package/dist/src/Attestation.ts +0 -21
  58. package/dist/src/BaseArweaveClient.ts +0 -13
  59. package/dist/src/BaseDb.ts +0 -35
  60. package/dist/src/BaseEasClient.ts +0 -13
  61. package/dist/src/BaseFileManager.ts +0 -56
  62. package/dist/src/BaseItem.ts +0 -413
  63. package/dist/src/BaseItemProperty.ts +0 -416
  64. package/dist/src/BaseQueryClient.ts +0 -13
  65. package/dist/src/ConfigSchema.ts +0 -15
  66. package/dist/src/Db.ts +0 -78
  67. package/dist/src/EasClient.ts +0 -13
  68. package/dist/src/FileDownloader.ts +0 -63
  69. package/dist/src/FileManager.ts +0 -57
  70. package/dist/src/IDb.ts +0 -7
  71. package/dist/src/IEasClient.ts +0 -2
  72. package/dist/src/IItem.ts +0 -26
  73. package/dist/src/IItemProperty.ts +0 -28
  74. package/dist/src/IQueryClient.ts +0 -4
  75. package/dist/src/ImageResizer.ts +0 -81
  76. package/dist/src/Item.ts +0 -12
  77. package/dist/src/ItemProperty.ts +0 -9
  78. package/dist/src/MetadataSchema.ts +0 -28
  79. package/dist/src/ModelSchema.ts +0 -46
  80. package/dist/src/ModelUidSchema.ts +0 -16
  81. package/dist/src/PropertyUidSchema.ts +0 -16
  82. package/dist/src/QueryClient.ts +0 -22
  83. package/dist/src/Schema.ts +0 -17
  84. package/dist/src/SeedProtocolSdk.d.ts +0 -19
  85. package/dist/src/SeedSchema.ts +0 -29
  86. package/dist/src/VersionSchema.ts +0 -16
  87. package/dist/src/actors.ts +0 -295
  88. package/dist/src/addModelsToDb.ts +0 -152
  89. package/dist/src/allItems.ts +0 -31
  90. package/dist/src/analyzeInput.ts +0 -144
  91. package/dist/src/browser.app.db.config.ts +0 -27
  92. package/dist/src/browser.ts +0 -30
  93. package/dist/src/checkStatus.ts +0 -50
  94. package/dist/src/client.ts +0 -148
  95. package/dist/src/configureFs.ts +0 -94
  96. package/dist/src/connectToDb.ts +0 -41
  97. package/dist/src/connectionManager.ts +0 -67
  98. package/dist/src/constants.ts +0 -125
  99. package/dist/src/content-hash.ts +0 -30
  100. package/dist/src/create.ts +0 -39
  101. package/dist/src/createMetadata.ts +0 -77
  102. package/dist/src/createNewItem.ts +0 -61
  103. package/dist/src/createPublishAttempt.ts +0 -16
  104. package/dist/src/createSeed.ts +0 -31
  105. package/dist/src/createSeeds.ts +0 -24
  106. package/dist/src/createVersion.ts +0 -33
  107. package/dist/src/dbMachine.ts +0 -182
  108. package/dist/src/deleteItem.ts +0 -19
  109. package/dist/src/download.ts +0 -202
  110. package/dist/src/drizzle.ts +0 -78
  111. package/dist/src/eas.ts +0 -40
  112. package/dist/src/environment.ts +0 -35
  113. package/dist/src/eventBus.ts +0 -5
  114. package/dist/src/events.ts +0 -14
  115. package/dist/src/fetchDataFromEas.ts +0 -94
  116. package/dist/src/fetchDbData.ts +0 -19
  117. package/dist/src/fetchRelatedItems.ts +0 -184
  118. package/dist/src/fetchSeeds.ts +0 -52
  119. package/dist/src/fetchVersions.ts +0 -49
  120. package/dist/src/files.ts +0 -81
  121. package/dist/src/filesDownload.ts +0 -326
  122. package/dist/src/fragment-masking.ts +0 -87
  123. package/dist/src/getExistingItem.ts +0 -60
  124. package/dist/src/getItem.ts +0 -32
  125. package/dist/src/getItemData.ts +0 -99
  126. package/dist/src/getItemProperties.ts +0 -56
  127. package/dist/src/getItemProperty.ts +0 -34
  128. package/dist/src/getItems.ts +0 -70
  129. package/dist/src/getMetadata.ts +0 -40
  130. package/dist/src/getModelSchemas.ts +0 -89
  131. package/dist/src/getPropertyData.ts +0 -50
  132. package/dist/src/getPublishPayload.ts +0 -355
  133. package/dist/src/getPublishUploads.ts +0 -207
  134. package/dist/src/getRelationValueData.ts +0 -27
  135. package/dist/src/getSchemaForItemProperty.ts +0 -68
  136. package/dist/src/getSchemaForModel.ts +0 -42
  137. package/dist/src/getSchemaUidForModel.ts +0 -32
  138. package/dist/src/getSeedData.ts +0 -34
  139. package/dist/src/getSegmentedItemProperties.ts +0 -65
  140. package/dist/src/getStorageTransactionIdForSeedUid.ts +0 -38
  141. package/dist/src/getVersionData.ts +0 -46
  142. package/dist/src/getVersionsForVersionUids.ts +0 -39
  143. package/dist/src/globalMachine.ts +0 -280
  144. package/dist/src/gql.ts +0 -118
  145. package/dist/src/graphql.ts +0 -3209
  146. package/dist/src/helpers.ts +0 -273
  147. package/dist/src/hydrateExistingItem.ts +0 -137
  148. package/dist/src/hydrateFromDb.ts +0 -270
  149. package/dist/src/hydrateNewItem.ts +0 -34
  150. package/dist/src/imageResize.ts +0 -507
  151. package/dist/src/index.d.ts +0 -5
  152. package/dist/src/index.ts +0 -4
  153. package/dist/src/initialize.ts +0 -124
  154. package/dist/src/internalMachine.ts +0 -238
  155. package/dist/src/itemMachineAll.ts +0 -157
  156. package/dist/src/itemMachineSingle.ts +0 -158
  157. package/dist/src/loadAppDb.ts +0 -47
  158. package/dist/src/machines.ts +0 -60
  159. package/dist/src/metadataLatest.ts +0 -34
  160. package/dist/src/migrate.ts +0 -53
  161. package/dist/src/model.ts +0 -72
  162. package/dist/src/modelClass.ts +0 -19
  163. package/dist/src/node.app.db.config.ts +0 -41
  164. package/dist/src/prepareDb.ts +0 -29
  165. package/dist/src/preparePublishRequestData.ts +0 -81
  166. package/dist/src/processItems.ts +0 -74
  167. package/dist/src/property.ts +0 -156
  168. package/dist/src/propertyMachine.ts +0 -202
  169. package/dist/src/publish.ts +0 -28
  170. package/dist/src/publishMachine.ts +0 -77
  171. package/dist/src/queries.ts +0 -13
  172. package/dist/src/recoverDeletedItem.ts +0 -14
  173. package/dist/src/reload.ts +0 -33
  174. package/dist/src/request.ts +0 -45
  175. package/dist/src/requestAll.ts +0 -157
  176. package/dist/src/resolveRelatedValue.ts +0 -367
  177. package/dist/src/resolveRemoteStorage.ts +0 -88
  178. package/dist/src/saveAppState.ts +0 -19
  179. package/dist/src/saveConfig.ts +0 -88
  180. package/dist/src/saveDataToDb.ts +0 -145
  181. package/dist/src/saveImageSrc.ts +0 -242
  182. package/dist/src/saveItemStorage.ts +0 -156
  183. package/dist/src/saveMetadata.ts +0 -18
  184. package/dist/src/savePublishService.ts +0 -30
  185. package/dist/src/saveRelation.ts +0 -112
  186. package/dist/src/seed.schema.config.ts +0 -25
  187. package/dist/src/seed.ts +0 -10
  188. package/dist/src/seedProtocol.ts +0 -17
  189. package/dist/src/services.ts +0 -365
  190. package/dist/src/sqlWasmClient.ts +0 -88
  191. package/dist/src/syncDbWithEas.ts +0 -628
  192. package/dist/src/trash.ts +0 -29
  193. package/dist/src/ts-to-proto.ts +0 -101
  194. package/dist/src/types.ts +0 -12
  195. package/dist/src/updateItemPropertyValue.ts +0 -243
  196. package/dist/src/updateMachineContext.ts +0 -21
  197. package/dist/src/updateMetadata.ts +0 -59
  198. package/dist/src/upload.ts +0 -86
  199. package/dist/src/validate.ts +0 -45
  200. package/dist/src/validateInput.ts +0 -47
  201. package/dist/src/validateItemData.ts +0 -20
  202. package/dist/src/versionData.ts +0 -24
  203. package/dist/src/waitForDb.ts +0 -25
  204. package/dist/src/waitForFiles.ts +0 -34
  205. package/dist/src/wasm.d.ts +0 -8300
@@ -1,32 +0,0 @@
1
- import { GET_SCHEMAS } from '@/Item/queries'
2
- import { BaseEasClient } from '@/helpers/EasClient/BaseEasClient'
3
- import { BaseQueryClient } from '@/helpers/QueryClient/BaseQueryClient'
4
-
5
-
6
- export const getSchemaUidForModel = async (
7
- modelName: string,
8
- ): Promise<string> => {
9
- const queryClient = BaseQueryClient.getQueryClient()
10
- const easClient = BaseEasClient.getEasClient()
11
-
12
- const modeType = modelName.toLowerCase()
13
-
14
- const modelSchemaQuery = await queryClient.fetchQuery({
15
- queryKey: [`getPropertySchema${modelName}`],
16
- queryFn: async () =>
17
- easClient.request(GET_SCHEMAS, {
18
- where: {
19
- schemaNames: {
20
- some: {
21
- name: {
22
- equals: modeType,
23
- },
24
- },
25
- },
26
- },
27
- }),
28
- })
29
-
30
- const foundSchema = modelSchemaQuery.schemas[0]
31
- return foundSchema.id
32
- }
@@ -1,34 +0,0 @@
1
- import { BaseDb } from '@/db/Db/BaseDb'
2
- import { seeds, SeedType } from '@/seedSchema'
3
- import { eq } from 'drizzle-orm'
4
-
5
- type GetSeedDataProps = {
6
- seedLocalId?: string
7
- seedUid?: string
8
- }
9
-
10
- type GetSeedData = (props: GetSeedDataProps) => Promise<SeedType | undefined>
11
-
12
- export const getSeedData: GetSeedData = async ({ seedLocalId, seedUid }) => {
13
- const appDb = BaseDb.getAppDb()
14
-
15
- let query
16
-
17
- const queryBase = appDb.select().from(seeds)
18
-
19
- if (seedLocalId) {
20
- query = queryBase.where(eq(seeds.localId, seedLocalId))
21
- }
22
-
23
- if (seedUid) {
24
- query = queryBase.where(eq(seeds.uid, seedUid))
25
- }
26
-
27
- const rows = await query
28
-
29
- if (!rows || !rows.length) {
30
- return
31
- }
32
-
33
- return rows[0]
34
- }
@@ -1,65 +0,0 @@
1
- import { UploadProperty } from '@/db/read/getPublishUploads'
2
- import { IItem } from '@/interfaces'
3
-
4
- export const getSegmentedItemProperties = (item: IItem<any>) => {
5
- const itemBasicProperties = []
6
- const itemRelationProperties = []
7
- const itemListProperties = []
8
- const itemUploadProperties: UploadProperty[] = []
9
- const itemStorageProperties = []
10
- let itemStorageTransactionProperty: UploadProperty | undefined
11
-
12
- for (const itemProperty of Object.values(item.properties)) {
13
- if (!itemProperty.propertyDef) {
14
- continue
15
- }
16
-
17
- const isItemStorage =
18
- itemProperty.propertyDef.storageType &&
19
- itemProperty.propertyDef.storageType === 'ItemStorage'
20
-
21
- const isImageSrc =
22
- itemProperty.propertyDef.dataType === 'Relation' &&
23
- itemProperty.propertyDef.refValueType === 'ImageSrc'
24
-
25
- const isStorageTransaction =
26
- itemProperty.propertyName === 'storageTransactionId'
27
-
28
- if (itemProperty.propertyDef.dataType === 'Relation') {
29
- itemRelationProperties.push(itemProperty)
30
- continue
31
- }
32
-
33
- if (itemProperty.propertyDef.dataType === 'List') {
34
- itemListProperties.push(itemProperty)
35
- continue
36
- }
37
-
38
- if (isItemStorage) {
39
- itemStorageProperties.push(itemProperty)
40
- continue
41
- }
42
-
43
- if (isStorageTransaction) {
44
- itemStorageTransactionProperty = { itemProperty, childProperties: [] }
45
- continue
46
- }
47
-
48
- itemBasicProperties.push(itemProperty)
49
- }
50
-
51
- if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {
52
- itemStorageTransactionProperty.childProperties = itemStorageProperties
53
- }
54
-
55
- if (itemStorageTransactionProperty) {
56
- itemUploadProperties.push(itemStorageTransactionProperty)
57
- }
58
-
59
- return {
60
- itemBasicProperties,
61
- itemRelationProperties,
62
- itemListProperties,
63
- itemUploadProperties,
64
- }
65
- }
@@ -1,38 +0,0 @@
1
- import { metadata } from '@/seedSchema'
2
- import { and, eq } from 'drizzle-orm'
3
- import { BaseDb } from '@/db/Db/BaseDb'
4
-
5
- const seedUidToStorageTransactionId = new Map<string, string>()
6
-
7
- type GetStorageTransactionIdResults = {
8
- storageTransactionId: string
9
- }[]
10
-
11
- export const getStorageTransactionIdForSeedUid = async (
12
- seedUid: string,
13
- ): Promise<string | undefined> => {
14
- if (seedUidToStorageTransactionId.has(seedUid)) {
15
- return seedUidToStorageTransactionId.get(seedUid)
16
- }
17
-
18
- const appDb = BaseDb.getAppDb()
19
-
20
- const results = (await appDb
21
- .select({
22
- storageTransactionId: metadata.propertyValue,
23
- })
24
- .from(metadata)
25
- .where(
26
- and(
27
- eq(metadata.seedUid, seedUid),
28
- eq(metadata.propertyName, 'storageTransactionId'),
29
- ),
30
- )) as GetStorageTransactionIdResults
31
-
32
- if (!results || results.length === 0) {
33
- return
34
- }
35
-
36
- seedUidToStorageTransactionId.set(seedUid, results[0].storageTransactionId)
37
- return results[0].storageTransactionId
38
- }
@@ -1,46 +0,0 @@
1
- import { versions, VersionsType } from '@/seedSchema'
2
- import { and, eq } from 'drizzle-orm'
3
- import { BaseDb } from '../Db/BaseDb'
4
-
5
- type GetVersionDataProps = {
6
- localId?: string | null
7
- uid?: string
8
- seedLocalId?: string
9
- }
10
-
11
- type GetVersionData = (
12
- props: GetVersionDataProps,
13
- ) => Promise<VersionsType | undefined>
14
-
15
- export const getVersionData: GetVersionData = async ({
16
- localId,
17
- seedLocalId,
18
- uid,
19
- }) => {
20
- const appDb = BaseDb.getAppDb()
21
-
22
- const whereClauses = []
23
-
24
- if (seedLocalId) {
25
- whereClauses.push(eq(versions.localId, seedLocalId))
26
- }
27
-
28
- if (localId) {
29
- whereClauses.push(eq(versions.localId, localId))
30
- }
31
-
32
- if (uid) {
33
- whereClauses.push(eq(versions.uid, uid))
34
- }
35
-
36
- const queryRows = await appDb
37
- .select()
38
- .from(versions)
39
- .where(and(...whereClauses))
40
-
41
- if (!queryRows || !queryRows.length) {
42
- return
43
- }
44
-
45
- return queryRows[0]
46
- }
@@ -1,39 +0,0 @@
1
- import { runQueryForStatement } from '../sqlWasmClient'
2
-
3
- type VersionData = {
4
- localId: string
5
- uid: string
6
- seedUid: string
7
- seedLocalId: string
8
- }
9
- type GetVersionsForVersionUids = (
10
- versionUids: string[],
11
- ) => Promise<VersionData[]>
12
- export const getVersionsForVersionUids: GetVersionsForVersionUids = async (
13
- versionUids: string[],
14
- ) => {
15
- const queryStatement = `
16
- SELECT local_id, uid, seed_uid, seed_local_id
17
- FROM versions
18
- WHERE uid IN ('${versionUids.join("','")}');
19
- `
20
-
21
- const { rows } = await runQueryForStatement(queryStatement)
22
-
23
- if (!rows || rows.length === 0) {
24
- return []
25
- }
26
-
27
- const versionsData: VersionData[] = []
28
-
29
- for (const row of rows) {
30
- versionsData.push({
31
- localId: row[0],
32
- uid: row[1],
33
- seedUid: row[2],
34
- seedLocalId: row[3],
35
- })
36
- }
37
-
38
- return versionsData
39
- }
@@ -1,280 +0,0 @@
1
- import { ActorRefFrom, assign, createActor, raise, setup } from 'xstate'
2
- import { createBrowserInspector } from '@statelyai/inspect'
3
- import {
4
- GLOBAL_ADDING_MODELS_TO_DB_SUCCESS,
5
- GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES,
6
- GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY,
7
- GLOBAL_INITIALIZING_SEND_CONFIG,
8
- GlobalState,
9
- MachineIds,
10
- } from '@/services/internal/constants'
11
- import { GlobalMachineContext, ModelClassType } from '@/types'
12
- import { eventEmitter } from '@/eventBus'
13
- import { initialize } from '@/services/global/actors/initialize'
14
- import { getSchemaForModel } from '@/services/global/actors/getSchemaForModel'
15
- import { addModelsToDb } from '@/services/global/actors/addModelsToDb'
16
- import { internalMachine } from '@/services/internal/internalMachine'
17
- import { itemMachineAll } from '../allItems/itemMachineAll'
18
- import { publishMachine } from '@/services/publish/publishMachine'
19
- import { savePublishService } from '@/services/global/actors/savePublishService'
20
-
21
- const {
22
- UNINITIALIZED,
23
- INITIALIZING,
24
- INITIALIZED,
25
- PUBLISHING_ITEM,
26
- ADDING_MODELS_TO_DB,
27
- } = GlobalState
28
-
29
- const { inspect } = createBrowserInspector({
30
- autoStart: false,
31
- })
32
-
33
- const globalMachine = setup({
34
- types: {
35
- context: {} as GlobalMachineContext,
36
- input: {} as GlobalMachineContext | undefined,
37
- },
38
- actors: {
39
- initialize,
40
- addModelsToDb,
41
- getSchemaForModel,
42
- savePublishService,
43
- },
44
- }).createMachine({
45
- id: MachineIds.GLOBAL,
46
- initial: UNINITIALIZED,
47
- context: ({ input }) => input as GlobalMachineContext,
48
- on: {
49
- publishItemRequest: `.${PUBLISHING_ITEM}`,
50
- savePublishService: `.savingPublishService`,
51
- restorePublishService: `.${PUBLISHING_ITEM}`,
52
- },
53
- states: {
54
- [UNINITIALIZED]: {
55
- on: {
56
- init: {
57
- target: INITIALIZING,
58
- actions: [
59
- assign({
60
- isInitialized: false,
61
- addedModelRecordsToDb: false,
62
- models: ({ event }) => event.models,
63
- endpoints: ({ event }) => event.endpoints,
64
- filesDir: ({ event }) => event.filesDir,
65
- internalService: ({ spawn, event }) => {
66
- return spawn(internalMachine, {
67
- systemId: MachineIds.INTERNAL,
68
- input: {
69
- endpoints: event.endpoints,
70
- filesDir: event.filesDir,
71
- addresses: event.addresses,
72
- arweaveDomain: event.arweaveDomain,
73
- },
74
- })
75
- },
76
- }),
77
- ],
78
- },
79
- },
80
- meta: {
81
- displayText: 'Booting up',
82
- percentComplete: 5,
83
- },
84
- tags: ['loading', 'startup'],
85
- },
86
- [INITIALIZING]: {
87
- on: {
88
- [GLOBAL_INITIALIZING_SEND_CONFIG]: {
89
- actions: assign({
90
- endpoints: ({ event }) => event.endpoints,
91
- environment: ({ event }) => event.environment,
92
- addresses: ({ event }) => event.addresses,
93
- isInitialized: true,
94
- }),
95
- },
96
- [GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY]: ADDING_MODELS_TO_DB,
97
- [GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES]: {
98
- actions: [
99
- assign(({ event, spawn }) => {
100
- const allItemsServices: Record<
101
- string,
102
- ActorRefFrom<typeof itemMachineAll>
103
- > = {}
104
- for (const [modelName, ModelClass] of Object.entries(
105
- event.create,
106
- )) {
107
- const service = spawn(itemMachineAll, {
108
- systemId: modelName,
109
- input: {
110
- modelName,
111
- ModelClass,
112
- modelSchema: (ModelClass as ModelClassType)!.schema,
113
- items: [],
114
- },
115
- })
116
- allItemsServices[`${modelName}Service`] = service
117
- }
118
-
119
- for (const [modelName, snapshot] of Object.entries(
120
- event.restore,
121
- )) {
122
- const service = createActor(itemMachineAll, {
123
- snapshot,
124
- })
125
- service.start()
126
- allItemsServices[`${modelName}Service`] = service
127
- }
128
- return allItemsServices
129
- }),
130
- raise({ type: 'allItemsServicesCreated' }),
131
- ],
132
- },
133
- },
134
- invoke: {
135
- src: 'initialize',
136
- input: ({ event, context }) => ({ event, context }),
137
- meta: {
138
- displayText: 'Initializing Seed SDK',
139
- percentComplete: 10,
140
- },
141
- tags: ['loading', 'startup'],
142
- },
143
- },
144
- [ADDING_MODELS_TO_DB]: {
145
- on: {
146
- [GLOBAL_ADDING_MODELS_TO_DB_SUCCESS]: {
147
- target: INITIALIZED,
148
- actions: assign({
149
- addedModelRecordsToDb: true,
150
- }),
151
- },
152
- },
153
- invoke: {
154
- src: 'addModelsToDb',
155
- input: ({ context }) => ({ context }),
156
- meta: {
157
- displayText: 'Adding models to database',
158
- },
159
- tags: ['loading', 'startup'],
160
- },
161
- },
162
- [INITIALIZED]: {
163
- // type: 'parallel',
164
- // on: {
165
- // publishItemRequest: `.${PUBLISHING_ITEM}`,
166
- // },
167
- meta: {
168
- displayText: 'Global service ready',
169
- percentComplete: 40,
170
- },
171
- tags: ['loading', 'startup'],
172
- // initial: PUBLISHING_ITEM,
173
- },
174
- [PUBLISHING_ITEM]: {
175
- target: INITIALIZED,
176
- entry: [
177
- assign({
178
- publishItemService: ({ spawn, event }) =>
179
- spawn(publishMachine, {
180
- id: 'publishService',
181
- input: {
182
- localId: event.seedLocalId,
183
- },
184
- }),
185
- }),
186
- ],
187
- meta: {
188
- displayText: 'Publishing item',
189
- },
190
- tags: ['publishing'],
191
- },
192
- savingPublishService: {
193
- target: INITIALIZED,
194
- on: {
195
- savePublishServiceSuccess: INITIALIZED,
196
- },
197
- invoke: {
198
- src: 'savePublishService',
199
- input: ({ context }) => ({ context }),
200
- },
201
- meta: {
202
- displayText: 'Saving publish service',
203
- },
204
- tags: ['publishing'],
205
- },
206
- },
207
- // on: {
208
- // '*': {
209
- // actions: emit(({ event }) => {
210
- // return event
211
- // }),
212
- // },
213
- // },
214
- })
215
-
216
- const globalService = createActor(globalMachine, {
217
- input: {},
218
- // inspect,
219
- inspect: (inspEvent) => {
220
- eventEmitter.emit('inspect.globalService', inspEvent)
221
- // console.log('[sdk] [service/index] inspEvent', inspEvent)
222
- // eventEmitter.emit('globalService', inspEvent)
223
- // let eventType: string = inspEvent.type
224
- // if (inspEvent.event && inspEvent.event.type) {
225
- // eventType = inspEvent.event.type
226
- // }
227
- //
228
- // if (typeof eventType === 'object') {
229
- // eventType = JSON.stringify(eventType)
230
- // }
231
- //
232
- // let srcId = inspEvent.actorRef.id
233
- //
234
- // if (!srcId.includes('seedSdk')) {
235
- // srcId = inspEvent.actorRef.logic.config.id
236
- // }
237
- //
238
- // if (inspEvent.type === '@xstate.snapshot') {
239
- // if (
240
- // inspEvent.event.type === CHILD_SNAPSHOT &&
241
- // inspEvent.snapshot &&
242
- // inspEvent.snapshot.machine.id === MachineIds.GLOBAL
243
- // ) {
244
- // return
245
- // }
246
- // if (inspEvent.snapshot && inspEvent.snapshot.value) {
247
- // if (typeof window !== 'undefined') {
248
- // eventEmitter.emit('globalService', {
249
- // type: eventType,
250
- // src: srcId,
251
- // snapshot: inspEvent.snapshot,
252
- // })
253
- // }
254
- // }
255
- // } else {
256
- // if (typeof window !== 'undefined') {
257
- // let snapshot
258
- //
259
- // try {
260
- // snapshot = inspEvent.actorRef.getSnapshot()
261
- // } catch (e) {
262
- // // This fails if the actor hasn't initialized yet, but that's OK I think
263
- // // console.log('[sdk] [service/index] ERROR', e)
264
- // }
265
- //
266
- // eventEmitter.emit('globalService', {
267
- // type: eventType,
268
- // src: srcId,
269
- // snapshot,
270
- // })
271
- // }
272
- // }
273
- },
274
- })
275
-
276
- globalService.start()
277
-
278
- const getGlobalService = (): ActorRefFrom<typeof globalMachine> => globalService
279
-
280
- export { globalMachine, getGlobalService, globalService }
package/dist/src/gql.ts DELETED
@@ -1,118 +0,0 @@
1
- /* eslint-disable */
2
- import * as types from './graphql';
3
- import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
4
-
5
- /**
6
- * Map of all GraphQL operations in the project.
7
- *
8
- * This map has several performance disadvantages:
9
- * 1. It is not tree-shakeable, so it will include all operations in the project.
10
- * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
11
- * 3. It does not support dead code elimination, so it will add unused operations.
12
- *
13
- * Therefore it is highly recommended to use the babel or swc plugin for production.
14
- * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
15
- */
16
- const documents = {
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,
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
- "\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,
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,
23
- "\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n": types.GetSeedIdsDocument,
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,
25
- "\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": types.GetVersionsDocument,
26
- "\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": types.GetPropertiesDocument,
27
- "\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": types.GetAllPropertiesForAllVersionsDocument,
28
- "\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": types.GetFilesMetadataDocument,
29
- "\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n": types.GetArweaveTransactionsDocument,
30
- "\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: 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 txid\n timeCreated\n time\n isOffchain\n }\n }\n": types.GetImageSeedsDocument,
31
- "\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n": types.GetImageVersionsDocument,
32
- "\n query GetSchemaUids($where: SchemaWhereInput!) {\n schemaUids: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n": types.GetSchemaUidsDocument,
33
- };
34
-
35
- /**
36
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
37
- *
38
- *
39
- * @example
40
- * ```ts
41
- * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
42
- * ```
43
- *
44
- * The query argument is unknown!
45
- * Please regenerate the types.
46
- */
47
- export function graphql(source: string): unknown;
48
-
49
- /**
50
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
51
- */
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"];
53
- /**
54
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
55
- */
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"];
57
- /**
58
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
59
- */
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"];
61
- /**
62
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
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"];
69
- /**
70
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
71
- */
72
- export function graphql(source: "\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"): (typeof documents)["\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"];
73
- /**
74
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
75
- */
76
- export function graphql(source: "\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"): (typeof documents)["\n query GetSeedIds($where: AttestationWhereInput!) {\n itemSeedIds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {\n id\n }\n }\n"];
77
- /**
78
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
79
- */
80
- export function graphql(source: "\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"): (typeof documents)["\n query GetStorageTransactionId($where: AttestationWhereInput!) {\n storageTransactionId: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n id\n decodedDataJson\n }\n }\n"];
81
- /**
82
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
83
- */
84
- export function graphql(source: "\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"): (typeof documents)["\n query GetVersions($where: AttestationWhereInput!) {\n itemVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"];
85
- /**
86
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
87
- */
88
- export function graphql(source: "\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"): (typeof documents)["\n query GetProperties($where: AttestationWhereInput!) {\n itemProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"];
89
- /**
90
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
91
- */
92
- export function graphql(source: "\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"): (typeof documents)["\n query GetAllPropertiesForAllVersions($where: AttestationWhereInput!) {\n allProperties: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"];
93
- /**
94
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
95
- */
96
- export function graphql(source: "\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"): (typeof documents)["\n query GetFilesMetadata($where: AttestationWhereInput!) {\n filesMetadata: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"];
97
- /**
98
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
99
- */
100
- export function graphql(source: "\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n"): (typeof documents)["\n query GetArweaveTransactions(\n $owners: [String!]\n $first: Int\n $after: String\n ) {\n transactions(owners: $owners, first: $first, after: $after) {\n edges {\n cursor\n node {\n id\n anchor\n signature\n block {\n id\n height\n }\n data {\n size\n type\n }\n tags {\n name\n value\n }\n }\n }\n pageInfo {\n hasNextPage\n }\n }\n }\n"];
101
- /**
102
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
103
- */
104
- export function graphql(source: "\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: 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 txid\n timeCreated\n time\n isOffchain\n }\n }\n"): (typeof documents)["\n query GetImageSeeds($where: AttestationWhereInput!) {\n imageSeeds: 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 txid\n timeCreated\n time\n isOffchain\n }\n }\n"];
105
- /**
106
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
107
- */
108
- export function graphql(source: "\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"): (typeof documents)["\n query GetImageVersions($where: AttestationWhereInput!) {\n imageVersions: attestations(\n where: $where\n orderBy: [{ timeCreated: desc }]\n ) {\n ...attestationFields\n }\n }\n"];
109
- /**
110
- * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
111
- */
112
- export function graphql(source: "\n query GetSchemaUids($where: SchemaWhereInput!) {\n schemaUids: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"): (typeof documents)["\n query GetSchemaUids($where: SchemaWhereInput!) {\n schemaUids: schemata(where: $where) {\n id\n schema\n schemaNames {\n name\n }\n }\n }\n"];
113
-
114
- export function graphql(source: string) {
115
- return (documents as any)[source] ?? {};
116
- }
117
-
118
- export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;