@seedprotocol/sdk 0.2.14 → 0.2.15

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 (176) hide show
  1. package/dist/Db-BZnRMEOf.js +82 -0
  2. package/dist/Db-BZnRMEOf.js.map +1 -0
  3. package/dist/{Db-DuTuGf68.js → Db-Dq4z7IcQ.js} +11 -10
  4. package/dist/{Db-DuTuGf68.js.map → Db-Dq4z7IcQ.js.map} +1 -1
  5. package/dist/{EasClient-DdahV-My.js → EasClient-BGQRv2-M.js} +2 -2
  6. package/dist/{EasClient-virlpmud.js.map → EasClient-BGQRv2-M.js.map} +1 -1
  7. package/dist/{EasClient-virlpmud.js → EasClient-Bbxr5rcF.js} +2 -2
  8. package/dist/{EasClient-DdahV-My.js.map → EasClient-Bbxr5rcF.js.map} +1 -1
  9. package/dist/{FileManager-hdyZkwYe.js → FileManager-BGej9rn4.js} +2 -2
  10. package/dist/{FileManager-hdyZkwYe.js.map → FileManager-BGej9rn4.js.map} +1 -1
  11. package/dist/{FileManager-5GT-dMg0.js → FileManager-CYXquukS.js} +2 -2
  12. package/dist/{FileManager-5GT-dMg0.js.map → FileManager-CYXquukS.js.map} +1 -1
  13. package/dist/{Item-CLlF0KW4.js → Item-BWNyN_kg.js} +11 -10
  14. package/dist/Item-BWNyN_kg.js.map +1 -0
  15. package/dist/{QueryClient-DI1wuuAt.js → QueryClient-CY_4gVB3.js} +2 -2
  16. package/dist/{QueryClient-DI1wuuAt.js.map → QueryClient-CY_4gVB3.js.map} +1 -1
  17. package/dist/{QueryClient-J0ohccHX.js → QueryClient-Dk66c5aw.js} +2 -2
  18. package/dist/{QueryClient-J0ohccHX.js.map → QueryClient-Dk66c5aw.js.map} +1 -1
  19. package/dist/bin.js +6 -6
  20. package/dist/bin.js.map +1 -1
  21. package/dist/{constants-C0HNnrob.js → constants-CuI_qYXt.js} +2 -2
  22. package/dist/constants-CuI_qYXt.js.map +1 -0
  23. package/dist/{index-DI6gojqO.js → index-Ce_InXlh.js} +11 -10
  24. package/dist/index-Ce_InXlh.js.map +1 -0
  25. package/dist/{index-B8uGwSbV.js → index-u7VSYW4L.js} +3866 -3967
  26. package/dist/index-u7VSYW4L.js.map +1 -0
  27. package/dist/main.js +9 -8
  28. package/dist/main.js.map +1 -1
  29. package/dist/{seed.schema.config-jYCP0EPe.js → seed.schema.config-gamPau9w.js} +12 -11
  30. package/dist/seed.schema.config-gamPau9w.js.map +1 -0
  31. package/dist/shared/configs/seed.schema.config.ts +1 -1
  32. package/dist/src/{ArweaveClientNode.ts → ArweaveClient.ts} +4 -4
  33. package/dist/src/BaseDb.ts +1 -1
  34. package/dist/src/BaseItemProperty.ts +6 -6
  35. package/dist/src/Db.ts +20 -0
  36. package/dist/src/IItem.ts +5 -3
  37. package/dist/src/IItemProperty.ts +4 -2
  38. package/dist/src/Item.ts +2 -2
  39. package/dist/src/SeedProtocolSdk.d.ts +7 -7
  40. package/dist/src/actors.ts +2 -2
  41. package/dist/src/addModelsToDb.ts +1 -1
  42. package/dist/src/client.ts +1 -1
  43. package/dist/src/download.ts +2 -2
  44. package/dist/src/index.ts +4 -73
  45. package/dist/src/initialize.ts +1 -1
  46. package/dist/src/machines.ts +0 -2
  47. package/dist/src/model.ts +13 -13
  48. package/dist/src/queries.ts +6 -27
  49. package/dist/src/seed.schema.config.ts +1 -1
  50. package/dist/src/seed.ts +4 -31
  51. package/dist/src/waitForDb.ts +18 -17
  52. package/dist/types/scripts/bin.d.ts +1 -1
  53. package/dist/types/scripts/bin.d.ts.map +1 -1
  54. package/dist/types/src/Item/BaseItem.d.ts +10 -1
  55. package/dist/types/src/Item/BaseItem.d.ts.map +1 -1
  56. package/dist/types/src/Item/service/actors/saveDataToDb.d.ts +3 -0
  57. package/dist/types/src/Item/service/actors/saveDataToDb.d.ts.map +1 -0
  58. package/dist/types/src/ItemProperty/BaseItemProperty.d.ts +3 -3
  59. package/dist/types/src/ItemProperty/BaseItemProperty.d.ts.map +1 -1
  60. package/dist/types/src/ItemProperty/service/propertyMachine.d.ts +1 -1
  61. package/dist/types/src/browser/ItemProperty/index.d.ts +0 -136
  62. package/dist/types/src/browser/ItemProperty/index.d.ts.map +1 -1
  63. package/dist/types/src/browser/helpers/ArweaveClient.d.ts +7 -0
  64. package/dist/types/src/browser/helpers/ArweaveClient.d.ts.map +1 -0
  65. package/dist/types/src/browser/index.d.ts +0 -2
  66. package/dist/types/src/browser/index.d.ts.map +1 -1
  67. package/dist/types/src/db/Db/BaseDb.d.ts +1 -1
  68. package/dist/types/src/db/Db/BaseDb.d.ts.map +1 -1
  69. package/dist/types/src/db/configs/browser.app.db.config.d.ts.map +1 -0
  70. package/dist/types/src/db/configs/seed.schema.config.d.ts.map +1 -0
  71. package/dist/types/src/helpers/ArweaveClient/BaseArweaveClient.d.ts.map +1 -0
  72. package/dist/types/src/helpers/ArweaveClient/index.d.ts +8 -0
  73. package/dist/types/src/helpers/ArweaveClient/index.d.ts.map +1 -0
  74. package/dist/types/src/helpers/environment.d.ts.map +1 -0
  75. package/dist/types/src/helpers/getSegmentedItemProperties.d.ts +3 -3
  76. package/dist/types/src/helpers/index.d.ts +1 -1
  77. package/dist/types/src/helpers/index.d.ts.map +1 -1
  78. package/dist/types/src/index.d.ts +6 -3
  79. package/dist/types/src/index.d.ts.map +1 -1
  80. package/dist/types/src/interfaces/IItem.d.ts +4 -3
  81. package/dist/types/src/interfaces/IItem.d.ts.map +1 -1
  82. package/dist/types/src/interfaces/IItemProperty.d.ts +3 -1
  83. package/dist/types/src/interfaces/IItemProperty.d.ts.map +1 -1
  84. package/dist/types/src/node/Item/Item.d.ts +2 -2
  85. package/dist/types/src/node/Item/Item.d.ts.map +1 -1
  86. package/dist/types/src/node/db/Db.d.ts +10 -0
  87. package/dist/types/src/node/db/Db.d.ts.map +1 -1
  88. package/dist/types/src/node/db/index.d.ts +2 -2
  89. package/dist/types/src/node/db/index.d.ts.map +1 -1
  90. package/dist/types/src/node/helpers/ArweaveClient.d.ts +7 -0
  91. package/dist/types/src/node/helpers/ArweaveClient.d.ts.map +1 -0
  92. package/dist/types/src/schema/file/download/actors.d.ts.map +1 -0
  93. package/dist/types/src/schema/file/download/index.d.ts.map +1 -0
  94. package/dist/types/src/schema/file/fetchAll/actors.d.ts.map +1 -0
  95. package/dist/types/src/schema/file/fetchAll/index.d.ts.map +1 -0
  96. package/dist/types/src/schema/file/queries.d.ts +9 -0
  97. package/dist/types/src/schema/file/queries.d.ts.map +1 -0
  98. package/dist/types/src/schema/image/queries.d.ts +7 -0
  99. package/dist/types/src/schema/image/queries.d.ts.map +1 -0
  100. package/dist/types/src/schema/index.d.ts +4 -0
  101. package/dist/types/src/schema/index.d.ts.map +1 -0
  102. package/dist/types/src/{browser/schema → schema}/model/index.d.ts +2 -2
  103. package/dist/types/src/schema/model/index.d.ts.map +1 -0
  104. package/dist/types/src/schema/property/index.d.ts +137 -0
  105. package/dist/types/src/schema/property/index.d.ts.map +1 -0
  106. package/dist/types/src/services/global/globalMachine.d.ts +94 -94
  107. package/dist/types/src/services/publish/publishMachine.d.ts +19 -19
  108. package/dist/types/src/types/machines.d.ts +0 -2
  109. package/dist/types/src/types/machines.d.ts.map +1 -1
  110. package/dist/types/src/types/model.d.ts +1 -1
  111. package/dist/types/src/types/model.d.ts.map +1 -1
  112. package/dist/types/src/types/property.d.ts +1 -1
  113. package/dist/types/src/types/property.d.ts.map +1 -1
  114. package/package.json +9 -6
  115. package/dist/Db-DOaWOiNg.js +0 -39
  116. package/dist/Db-DOaWOiNg.js.map +0 -1
  117. package/dist/Item-CLlF0KW4.js.map +0 -1
  118. package/dist/constants-C0HNnrob.js.map +0 -1
  119. package/dist/index-B8uGwSbV.js.map +0 -1
  120. package/dist/index-DI6gojqO.js.map +0 -1
  121. package/dist/seed.schema.config-jYCP0EPe.js.map +0 -1
  122. package/dist/shared/configs/browser.seed.db.config.ts +0 -33
  123. package/dist/src/ArweaveClientWeb.ts +0 -13
  124. package/dist/src/arweave.ts +0 -50
  125. package/dist/src/browser.seed.db.config.ts +0 -33
  126. package/dist/src/fsProxy.ts +0 -36
  127. package/dist/src/machine.ts +0 -55
  128. package/dist/types/src/browser/helpers/ArweaveClientWeb.d.ts +0 -7
  129. package/dist/types/src/browser/helpers/ArweaveClientWeb.d.ts.map +0 -1
  130. package/dist/types/src/browser/helpers/arweave.d.ts +0 -4
  131. package/dist/types/src/browser/helpers/arweave.d.ts.map +0 -1
  132. package/dist/types/src/browser/schema/file/download/actors.d.ts.map +0 -1
  133. package/dist/types/src/browser/schema/file/download/index.d.ts.map +0 -1
  134. package/dist/types/src/browser/schema/file/fetchAll/actors.d.ts.map +0 -1
  135. package/dist/types/src/browser/schema/file/fetchAll/index.d.ts.map +0 -1
  136. package/dist/types/src/browser/schema/file/index.d.ts +0 -17
  137. package/dist/types/src/browser/schema/file/index.d.ts.map +0 -1
  138. package/dist/types/src/browser/schema/file/machine.d.ts +0 -51
  139. package/dist/types/src/browser/schema/file/machine.d.ts.map +0 -1
  140. package/dist/types/src/browser/schema/file/queries.d.ts +0 -9
  141. package/dist/types/src/browser/schema/file/queries.d.ts.map +0 -1
  142. package/dist/types/src/browser/schema/file/upload/actors.d.ts +0 -3
  143. package/dist/types/src/browser/schema/file/upload/actors.d.ts.map +0 -1
  144. package/dist/types/src/browser/schema/file/upload/index.d.ts +0 -2
  145. package/dist/types/src/browser/schema/file/upload/index.d.ts.map +0 -1
  146. package/dist/types/src/browser/schema/image/index.d.ts +0 -9
  147. package/dist/types/src/browser/schema/image/index.d.ts.map +0 -1
  148. package/dist/types/src/browser/schema/image/queries.d.ts +0 -7
  149. package/dist/types/src/browser/schema/image/queries.d.ts.map +0 -1
  150. package/dist/types/src/browser/schema/index.d.ts +0 -6
  151. package/dist/types/src/browser/schema/index.d.ts.map +0 -1
  152. package/dist/types/src/browser/schema/model/actors.d.ts +0 -1
  153. package/dist/types/src/browser/schema/model/actors.d.ts.map +0 -1
  154. package/dist/types/src/browser/schema/model/index.d.ts.map +0 -1
  155. package/dist/types/src/helpers/BaseArweaveClient.d.ts.map +0 -1
  156. package/dist/types/src/node/helpers/ArweaveClientNode.d.ts +0 -7
  157. package/dist/types/src/node/helpers/ArweaveClientNode.d.ts.map +0 -1
  158. package/dist/types/src/shared/configs/browser.app.db.config.d.ts.map +0 -1
  159. package/dist/types/src/shared/configs/browser.seed.db.config.d.ts +0 -3
  160. package/dist/types/src/shared/configs/browser.seed.db.config.d.ts.map +0 -1
  161. package/dist/types/src/shared/configs/seed.schema.config.d.ts.map +0 -1
  162. package/dist/types/src/shared/environment.d.ts.map +0 -1
  163. package/dist/types/src/shared/fsProxy.d.ts +0 -5
  164. package/dist/types/src/shared/fsProxy.d.ts.map +0 -1
  165. package/dist/types/src/shared/index.d.ts +0 -3
  166. package/dist/types/src/shared/index.d.ts.map +0 -1
  167. package/dist/types/src/shared/seed.d.ts +0 -16
  168. package/dist/types/src/shared/seed.d.ts.map +0 -1
  169. /package/dist/types/src/{shared → db}/configs/browser.app.db.config.d.ts +0 -0
  170. /package/dist/types/src/{shared → db}/configs/seed.schema.config.d.ts +0 -0
  171. /package/dist/types/src/helpers/{BaseArweaveClient.d.ts → ArweaveClient/BaseArweaveClient.d.ts} +0 -0
  172. /package/dist/types/src/{shared → helpers}/environment.d.ts +0 -0
  173. /package/dist/types/src/{browser/schema → schema}/file/download/actors.d.ts +0 -0
  174. /package/dist/types/src/{browser/schema → schema}/file/download/index.d.ts +0 -0
  175. /package/dist/types/src/{browser/schema → schema}/file/fetchAll/actors.d.ts +0 -0
  176. /package/dist/types/src/{browser/schema → schema}/file/fetchAll/index.d.ts +0 -0
package/dist/main.js CHANGED
@@ -1,21 +1,18 @@
1
1
  import 'immer';
2
2
  import 'reflect-metadata';
3
- export { c as ImageSrc, I as Item, d as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, s as eventEmitter, r as getCorrectId, q as getGlobalService, h as useCreateItem, k as useDeleteItem, l as useGlobalServiceStatus, e as useItem, f as useItemProperties, j as useItemProperty, u as useItems, n as usePersistedSnapshots, m as usePublishItem, p as useService, o as useServices, w as withSeed } from './index-B8uGwSbV.js';
3
+ export { c as ImageSrc, d as Item, e as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, v as client, t as eventEmitter, r as getCorrectId, s as getGlobalService, j as useCreateItem, l as useDeleteItem, m as useGlobalServiceStatus, f as useItem, h as useItemProperties, k as useItemProperty, u as useItems, o as usePersistedSnapshots, n as usePublishItem, q as useService, p as useServices, w as withSeed } from './index-u7VSYW4L.js';
4
4
  import 'tslib';
5
- import 'xstate';
6
- import 'arweave';
7
5
  import 'drizzle-orm';
8
- export { c as BaseArweaveClient, B as BaseEasClient, b as BaseFileManager, a as BaseQueryClient } from './constants-C0HNnrob.js';
6
+ export { c as BaseArweaveClient, B as BaseEasClient, b as BaseFileManager, a as BaseQueryClient } from './constants-CuI_qYXt.js';
9
7
  import '@sinclair/typebox';
10
- import 'rxjs';
11
- import '@zenfs/core';
8
+ import 'react';
12
9
  import 'dayjs';
13
10
  import 'nanoid';
14
11
  import 'nanoid-dictionary';
12
+ import '@zenfs/core';
15
13
  import 'debug';
16
14
  import 'drizzle-orm/sqlite-core';
17
- import 'path';
18
- import 'react';
15
+ import 'xstate';
19
16
  import 'pluralize';
20
17
  import 'eventemitter3';
21
18
  import 'lodash-es';
@@ -25,7 +22,11 @@ import 'drizzle-orm/sqlite-proxy/migrator';
25
22
  import 'drizzle-orm/migrator';
26
23
  import 'node:fs';
27
24
  import '@zenfs/dom';
25
+ import 'path';
26
+ import 'arweave';
28
27
  import 'use-immer';
29
28
  import '@xstate/react';
29
+ import 'rxjs';
30
+ import '@/browser/helpers/arweave';
30
31
  import '@ethereum-attestation-service/eas-sdk';
31
32
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,22 +1,19 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
- import 'drizzle-orm';
3
- import { T as Text, M as Model } from './index-B8uGwSbV.js';
4
- import 'react';
5
2
  import 'reflect-metadata';
6
- import 'xstate';
7
- import 'arweave';
3
+ import { T as Text, M as Model } from './index-u7VSYW4L.js';
8
4
  import 'immer';
9
5
  import '@sinclair/typebox';
10
- import 'rxjs';
11
- import '@zenfs/core';
6
+ import 'drizzle-orm';
7
+ import 'react';
12
8
  import 'dayjs';
13
9
  import 'nanoid';
14
10
  import 'nanoid-dictionary';
11
+ import '@zenfs/core';
15
12
  import 'debug';
16
- import './constants-C0HNnrob.js';
17
- import '@ethereum-attestation-service/eas-sdk';
18
13
  import 'drizzle-orm/sqlite-core';
19
- import 'path';
14
+ import './constants-CuI_qYXt.js';
15
+ import '@ethereum-attestation-service/eas-sdk';
16
+ import 'xstate';
20
17
  import 'pluralize';
21
18
  import 'eventemitter3';
22
19
  import 'lodash-es';
@@ -26,8 +23,12 @@ import 'drizzle-orm/sqlite-proxy/migrator';
26
23
  import 'drizzle-orm/migrator';
27
24
  import 'node:fs';
28
25
  import '@zenfs/dom';
26
+ import 'path';
27
+ import 'arweave';
29
28
  import 'use-immer';
30
29
  import '@xstate/react';
30
+ import 'rxjs';
31
+ import '@/browser/helpers/arweave';
31
32
 
32
33
  let Seed = class Seed {
33
34
  };
@@ -75,4 +76,4 @@ const models = {
75
76
  };
76
77
 
77
78
  export { models };
78
- //# sourceMappingURL=seed.schema.config-jYCP0EPe.js.map
79
+ //# sourceMappingURL=seed.schema.config-gamPau9w.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.schema.config-gamPau9w.js","sources":["../../src/db/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/schema'\n\n@Model\nclass Seed {\n @Text() uid!: string\n @Text() type!: string\n}\n\n@Model\nclass Version {\n @Text() seedUid!: string\n @Text() note!: string\n}\n\n@Model\nclass Metadata {\n @Text() key!: string\n @Text() value!: string\n}\n\nexport const models = {\n Seed,\n Version,\n Metadata,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,IAAI,GAAV,MAAM,IAAI,CAAA;CAGT;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,KAAA,EAAA,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;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Model, Text } from '@/browser'
1
+ import { Model, Text } from '@/schema'
2
2
 
3
3
  @Model
4
4
  class Seed {
@@ -1,13 +1,13 @@
1
- import { BaseArweaveClient } from '@/helpers/BaseArweaveClient';
1
+ import { BaseArweaveClient } from '@/helpers/ArweaveClient/BaseArweaveClient';
2
2
  import { ARWEAVE_ENDPOINT } from '@/services/internal/constants';
3
3
  import { GraphQLClient } from 'graphql-request';
4
4
 
5
- class ArweaveClientNode extends BaseArweaveClient {
5
+ class ArweaveClient extends BaseArweaveClient {
6
6
  static getArweaveClient(): GraphQLClient {
7
7
  return new GraphQLClient(ARWEAVE_ENDPOINT);
8
8
  }
9
9
  }
10
10
 
11
- BaseArweaveClient.setPlatformClass(ArweaveClientNode);
11
+ BaseArweaveClient.setPlatformClass(ArweaveClient);
12
12
 
13
- export { ArweaveClientNode };
13
+ export { ArweaveClient };
@@ -20,7 +20,7 @@ export abstract class BaseDb implements IDb {
20
20
  return this.PlatformClass.isAppDbReady()
21
21
  }
22
22
 
23
- static prepareDb(): Promise<unknown> {
23
+ static prepareDb(): Promise<BaseSQLiteDatabase> {
24
24
  return this.PlatformClass.prepareDb()
25
25
  }
26
26
 
@@ -1,7 +1,6 @@
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/ItemProperty'
5
4
  import { IItemProperty } from '@/interfaces/IItemProperty'
6
5
  import { immerable } from 'immer'
7
6
  import { CreatePropertyInstanceProps, PropertyMachineContext } from '@/types'
@@ -14,6 +13,7 @@ import { eventEmitter } from '@/eventBus'
14
13
  import fs from '@zenfs/core'
15
14
  import { getPropertyData } from '@/db/read/getPropertyData'
16
15
  import { getCorrectId } from '@/helpers'
16
+ import { TProperty } from '@/schema'
17
17
 
18
18
  const logger = debug('app:property:class')
19
19
 
@@ -133,7 +133,7 @@ export abstract class BaseItemProperty<PropertyType> implements IItemProperty<Pr
133
133
  const { propertyRecordSchema } = context
134
134
 
135
135
  if (context.seedLocalId) {
136
- const cacheKey = ItemProperty.cacheKey(
136
+ const cacheKey = BaseItemProperty.cacheKey(
137
137
  context.seedLocalId,
138
138
  context.propertyName,
139
139
  )
@@ -256,12 +256,12 @@ export abstract class BaseItemProperty<PropertyType> implements IItemProperty<Pr
256
256
  return instance
257
257
  }
258
258
  if (!this.instanceCache.has(cacheKey)) {
259
- const newInstance = new ItemProperty(props)
259
+ const newInstance = new this(props)
260
260
  this.instanceCache.set(cacheKey, { instance: newInstance, refCount: 1 })
261
261
  return newInstance
262
262
  }
263
263
  }
264
- return new ItemProperty(props)
264
+ return new this(props)
265
265
  }
266
266
 
267
267
  static async find({
@@ -273,7 +273,7 @@ export abstract class BaseItemProperty<PropertyType> implements IItemProperty<Pr
273
273
  return
274
274
  }
275
275
  const cacheKeyId = seedUid || seedLocalId
276
- const cacheKey = ItemProperty.cacheKey(cacheKeyId!, propertyName)
276
+ const cacheKey = BaseItemProperty.cacheKey(cacheKeyId!, propertyName)
277
277
  if (this.instanceCache.has(cacheKey)) {
278
278
  const { instance, refCount } = this.instanceCache.get(cacheKey)!
279
279
  this.instanceCache.set(cacheKey, {
@@ -290,7 +290,7 @@ export abstract class BaseItemProperty<PropertyType> implements IItemProperty<Pr
290
290
  if (!propertyData) {
291
291
  return
292
292
  }
293
- return ItemProperty.create(propertyData)
293
+ return BaseItemProperty.create(propertyData)
294
294
  }
295
295
 
296
296
  static cacheKey(seedLocalIdOrUid: string, propertyName: string): string {
package/dist/src/Db.ts CHANGED
@@ -1,8 +1,28 @@
1
1
  import { BaseDb } from "@/db/Db/BaseDb";
2
2
  import { IDb } from "@/interfaces";
3
+ import nodeAppDbConfig from "./node.app.db.config";
4
+ import { drizzle } from "drizzle-orm/better-sqlite3";
3
5
 
4
6
  export class Db extends BaseDb implements IDb {
5
7
  constructor() {
6
8
  super()
7
9
  }
10
+
11
+ static getAppDb() {
12
+ return drizzle(nodeAppDbConfig)
13
+ }
14
+
15
+ static isAppDbReady() {
16
+ return true
17
+ }
18
+
19
+ static async prepareDb() {
20
+ return drizzle(nodeAppDbConfig)
21
+ }
22
+
23
+ static connectToDb(pathToDir: string, dbName: string) {
24
+ return {
25
+ id: drizzle(nodeAppDbConfig).$client.name
26
+ }
27
+ }
8
28
  }
package/dist/src/IItem.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { ActorRefFrom, Subscription } from 'xstate'
2
- import { ItemProperty } from '@/browser/property/ItemProperty'
3
- import { CreatePropertyInstanceProps, ModelSchema, ModelValues, PropertyData } from '@/types'
2
+ import { ModelSchema, ModelValues, NewItemProps, PropertyData } from '@/types'
4
3
  import { VersionsType } from '@/seedSchema/VersionSchema'
4
+ import { IItemProperty } from './IItemProperty'
5
5
 
6
6
  export interface IItem<T extends ModelValues<ModelSchema>> {
7
+
8
+ constructor(initialValues: NewItemProps<T>): void
7
9
  subscribe(callback: (itemProps: any) => void): Subscription
8
10
  getService(): ActorRefFrom<any>
9
11
  getEditedProperties(): Promise<PropertyData[]>
@@ -17,5 +19,5 @@ export interface IItem<T extends ModelValues<ModelSchema>> {
17
19
  readonly schemaUid: string
18
20
  readonly latestVersionUid: VersionsType
19
21
  readonly modelName: string
20
- readonly properties: Record<string, ItemProperty<any>>
22
+ readonly properties: Record<string, IItemProperty<any>>
21
23
  }
@@ -1,10 +1,12 @@
1
1
  import { ActorRefFrom, Subscription } from 'xstate';
2
- import { PropertyMachineContext } from '@/types';
3
2
  import { BehaviorSubject } from 'rxjs';
4
3
  import { Static } from '@sinclair/typebox';
5
- import { TProperty } from '@/browser/ItemProperty';
4
+ import { TProperty } from '@/schema';
5
+ import { CreatePropertyInstanceProps } from '@/types';
6
6
 
7
7
  export interface IItemProperty<PropertyType> {
8
+
9
+ constructor(initialValues: Partial<CreatePropertyInstanceProps>): void
8
10
  readonly localId: string;
9
11
  readonly uid: string;
10
12
  readonly seedLocalId: string;
package/dist/src/Item.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { IItem } from '@/interfaces';
2
2
  import { BaseItem } from '@/Item/BaseItem';
3
- import { ModelSchema, ModelValues } from '@/types';
3
+ import { ModelSchema, ModelValues, NewItemProps } from '@/types';
4
4
 
5
5
  export class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {
6
- constructor(initialValues: any) {
6
+ constructor(initialValues: NewItemProps<T>) {
7
7
  super(initialValues);
8
8
  }
9
9
 
@@ -21,13 +21,13 @@ export interface SeedProtocolSdk {
21
21
  eventEmitter: typeof import('@/eventBus').eventEmitter;
22
22
 
23
23
  // Exported types
24
- Model: typeof import('@/browser/schema').Model;
25
- Property: typeof import('@/browser/schema').Property;
26
- ImageSrc: typeof import('@/browser/schema').ImageSrc;
27
- List: typeof import('@/browser/schema').List;
28
- Text: typeof import('@/browser/schema').Text;
29
- Json: typeof import('@/browser/schema').Json;
30
- Relation: typeof import('@/browser/schema').Relation;
24
+ Model: typeof import('@/schema').Model;
25
+ Property: typeof import('@/schema').Property;
26
+ ImageSrc: typeof import('@/schema').ImageSrc;
27
+ List: typeof import('@/schema').List;
28
+ Text: typeof import('@/schema').Text;
29
+ Json: typeof import('@/schema').Json;
30
+ Relation: typeof import('@/schema').Relation;
31
31
 
32
32
  // Node-specific exports
33
33
  withSeed?: typeof import('@/node').withSeed;
@@ -1,7 +1,7 @@
1
1
  import { EventObject, fromCallback } from 'xstate'
2
- import { fetchAllFilesMachine } from '@/browser/schema/file/fetchAll/index'
2
+ import { fetchAllFilesMachine } from '@/schema/file/fetchAll/index'
3
3
  import { ARWEAVE_HOST } from '@/services/internal/constants'
4
- import { GET_FILES_METADATA } from '@/browser/schema/file/queries'
4
+ import { GET_FILES_METADATA } from '@/schema/file/queries'
5
5
  import { getArweave } from '@/browser/helpers/arweave'
6
6
  import { fs } from '@zenfs/core'
7
7
  import {
@@ -25,7 +25,7 @@ export const addModelsToDb = fromCallback<
25
25
  }
26
26
 
27
27
  const { models: SeedModels } = await import(
28
- '@/shared/configs/seed.schema.config'
28
+ '@/db/configs/seed.schema.config'
29
29
  )
30
30
 
31
31
  const allModels = {
@@ -56,7 +56,7 @@ const client = {
56
56
  arweaveDomain,
57
57
  })
58
58
 
59
- const { models: internalModels } = await import('@/shared/configs/seed.schema.config')
59
+ const { models: internalModels } = await import('@/db/configs/seed.schema.config')
60
60
  for (const [key, value] of Object.entries(internalModels)) {
61
61
  setModel(key, value)
62
62
  }
@@ -4,14 +4,13 @@ import { fs } from '@zenfs/core'
4
4
  import { ARWEAVE_HOST } from '@/services/internal/constants'
5
5
  import { appState } from '@/seedSchema'
6
6
  import { eq } from 'drizzle-orm'
7
- import { getArweave } from '@/browser/schema/file'
8
7
  import { getAddressesFromDb } from '@/helpers/db'
9
8
  import {
10
9
  getDataTypeFromString,
11
10
  getMimeType,
12
11
  identifyString,
13
12
  } from '@/helpers'
14
- import { GET_FILES_METADATA } from '@/browser/schema/file/queries'
13
+ import { GET_FILES_METADATA } from '@/schema/file/queries'
15
14
  import debug from 'debug'
16
15
  import { getGlobalService } from '@/services'
17
16
  import { waitFor } from 'xstate'
@@ -21,6 +20,7 @@ import { GET_TRANSACTION_TAGS } from '@/browser/arweave/queries'
21
20
  import { saveAppState } from '@/db/write/saveAppState'
22
21
  import { BaseDb } from '@/db/Db/BaseDb'
23
22
  import { BaseEasClient, BaseQueryClient, BaseArweaveClient } from '@/helpers'
23
+ import { getArweave } from '@/helpers/ArweaveClient'
24
24
 
25
25
 
26
26
  const logger = debug('app:files:download')
package/dist/src/index.ts CHANGED
@@ -1,73 +1,4 @@
1
- import { assign, setup } from 'xstate'
2
- import {
3
- fetchAllBinaryData,
4
- fetchAllMetadataRecords,
5
- } from '@/browser/schema/file/fetchAll/actors'
6
- import { Attestation } from '@/graphql/gql/graphql'
7
-
8
- type FetchAllFilesMachineContext = {
9
- addresses: string[]
10
- dbsLoaded: boolean
11
- filesMetadata?: Attestation[]
12
- filesBlobData?: any[]
13
- }
14
-
15
- export const fetchAllFilesMachine = setup({
16
- types: {
17
- context: {} as FetchAllFilesMachineContext,
18
- },
19
- actors: {
20
- fetchAllMetadataRecords,
21
- fetchAllBinaryData,
22
- },
23
- }).createMachine({
24
- id: 'fetchAllFiles',
25
- initial: 'idle',
26
- context: ({ input }) =>
27
- ({
28
- ...input,
29
- dbsLoaded: false,
30
- }) as FetchAllFilesMachineContext,
31
- on: {
32
- allDbsLoaded: {
33
- target: '.fetchingAllMetadataRecords',
34
- actions: assign({
35
- dbsLoaded: true,
36
- }),
37
- },
38
- },
39
- states: {
40
- idle: {},
41
- fetchingAllMetadataRecords: {
42
- on: {
43
- fetchingAllMetadataRecordsSuccess: {
44
- target: 'fetchingAllBinaryData',
45
- actions: assign({
46
- filesMetadata: ({ event }) => event.filesMetadata,
47
- }),
48
- },
49
- },
50
- invoke: {
51
- src: 'fetchAllMetadataRecords',
52
- input: ({ context, event }) => ({ context, event }),
53
- },
54
- },
55
- fetchingAllBinaryData: {
56
- on: {
57
- fetchingAllBinaryDataSuccess: {
58
- target: 'success',
59
- actions: assign({
60
- filesBlobData: ({ event }) => event.filesBlobData,
61
- }),
62
- },
63
- },
64
- invoke: {
65
- src: 'fetchAllBinaryData',
66
- input: ({ context }) => ({ context }),
67
- },
68
- },
69
- success: {
70
- type: 'final',
71
- },
72
- },
73
- })
1
+ export * from './analyzeInput'
2
+ export * from './saveImageSrc'
3
+ export * from './saveRelation'
4
+ export * from './saveItemStorage'
@@ -1,5 +1,5 @@
1
1
  import { EventObject, fromCallback, Subscription } from 'xstate'
2
- import { isNode, isReactNative } from '@/shared'
2
+ import { isNode, isReactNative } from '@/helpers/environment'
3
3
  import {
4
4
  GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES,
5
5
  GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY,
@@ -1,6 +1,5 @@
1
1
  import { Endpoints, Environment, ModelClassType } from './index'
2
2
  import { ActorRefFrom } from 'xstate'
3
- import { fileSystemMachine } from '@/browser/schema/file/machine'
4
3
  import { PublishRequestData } from './seedProtocol'
5
4
 
6
5
  export type DbServiceContext = {
@@ -35,7 +34,6 @@ export type GlobalMachineContext = {
35
34
  addresses?: string[]
36
35
  models?: { [key: string]: ModelClassType }
37
36
  internalService?: ActorRefFrom<any>
38
- fileSystemService?: ActorRefFrom<typeof fileSystemMachine>
39
37
  publishItemService?: ActorRefFrom<any>
40
38
  arweaveDomain?: string
41
39
  }
package/dist/src/model.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PropertyStates, PropertyValue } from './property'
2
2
  import { Actor } from 'xstate'
3
3
  import { Static } from '@sinclair/typebox'
4
- import { IModelClass, Item, TModelSchema } from '@/browser/schema'
4
+ import { IModelClass, Item, TModelSchema } from '@/schema'
5
5
 
6
6
  export type ModelDefinitions = {
7
7
  [modelName: string]: ModelClassType
@@ -37,7 +37,7 @@ export type StatesMap<T> = Map<string, Actor<T>>
37
37
  export type ModelSchema = Partial<Static<typeof TModelSchema>>
38
38
 
39
39
  export type ModelConstructor = <
40
- T extends { new (...args: any[]): IModelClass },
40
+ T extends { new(...args: any[]): IModelClass },
41
41
  >(
42
42
  constructor: T,
43
43
  ) => T & IModelClass
@@ -48,17 +48,17 @@ export interface ModelProperty {
48
48
  propertyLocalId?: string
49
49
  name: string
50
50
  dataType:
51
- | 'string'
52
- | 'bytes32'
53
- | 'uint8'
54
- | 'uint256'
55
- | 'bool'
56
- | 'address'
57
- | 'bytes'
58
- | 'int8'
59
- | 'int256'
60
- | 'int'
61
- | 'bytes32[]'
51
+ | 'string'
52
+ | 'bytes32'
53
+ | 'uint8'
54
+ | 'uint256'
55
+ | 'bool'
56
+ | 'address'
57
+ | 'bytes'
58
+ | 'int8'
59
+ | 'int256'
60
+ | 'int'
61
+ | 'bytes32[]'
62
62
  modelSchemaUids: string[]
63
63
  modelLocalId?: string
64
64
  schemaName?: string
@@ -1,34 +1,13 @@
1
1
  import { graphql } from '@/graphql/gql'
2
2
 
3
- export const GET_IMAGE_SEEDS = graphql(/* GraphQL */ `
4
- query GetImageSeeds($where: AttestationWhereInput!) {
5
- imageSeeds: attestations(where: $where, orderBy: [{ timeCreated: desc }]) {
3
+ export const GET_SCHEMA_UIDS_FOR_MODELS = graphql(/* GraphQL */ `
4
+ query GetSchemaUids($where: SchemaWhereInput!) {
5
+ schemaUids: schemata(where: $where) {
6
6
  id
7
- decodedDataJson
8
- attester
9
- schema {
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,4 +1,4 @@
1
- import { Model, Text } from '@/browser'
1
+ import { Model, Text } from '@/schema'
2
2
 
3
3
  @Model
4
4
  class Seed {
package/dist/src/seed.ts CHANGED
@@ -1,37 +1,10 @@
1
- import { isBrowser, isNode, isReactNative } from '@/shared/environment'
2
- import { Endpoints, SeedConstructorOptions } from '@/types/types'
3
- import { Subject } from 'rxjs'
1
+ import { SeedConstructorOptions } from '@/types/types'
2
+ import { SeedBase } from '@/shared/seed'
4
3
 
5
- type Environment = 'node' | 'browser' | 'react-native'
6
-
7
- abstract class SeedBase {
8
- private readonly _env: Environment = 'browser'
9
- protected _subject: Subject<void> = new Subject<void>()
10
-
11
- constructor(props: { endpoints: Endpoints }) {
12
- console.log('Seed constructor called')
13
- if (isNode()) {
14
- this._env = 'node'
15
- }
16
- if (isBrowser()) {
17
- this._env = 'browser'
18
- }
19
- if (isReactNative()) {
20
- this._env = 'react-native'
21
- }
22
- }
23
-
24
- async initialize() {}
25
-
26
- subscribe(callback: (event: any) => void) {
27
- return this._subject.subscribe(callback)
28
- }
29
- }
30
-
31
- class SeedSync extends SeedBase {
4
+ class SeedNode extends SeedBase {
32
5
  constructor(props: SeedConstructorOptions) {
33
6
  super(props)
34
7
  }
35
8
  }
36
9
 
37
- export { SeedBase, SeedSync }
10
+ export { SeedNode }
@@ -1,22 +1,23 @@
1
1
  import { EventObject, fromCallback } from 'xstate'
2
- import { itemMachineSingle } from '@/Item/service/itemMachineSingle'
2
+ import { FromCallbackInput, PropertyMachineContext } from '@/types'
3
3
  import { BaseDb } from '@/db/Db/BaseDb'
4
4
 
5
- export const waitForDb = fromCallback<EventObject, typeof itemMachineSingle>(
6
- ({ sendBack }) => {
7
- const _waitForDb = new Promise<void>((resolve) => {
8
- const interval = setInterval(() => {
9
- const appDb = BaseDb.getAppDb()
5
+ export const waitForDb = fromCallback<
6
+ EventObject,
7
+ FromCallbackInput<PropertyMachineContext>
8
+ >(({ sendBack }) => {
9
+ const _waitForDb = new Promise<void>((resolve) => {
10
+ const interval = setInterval(() => {
11
+ const appDb = BaseDb.getAppDb()
10
12
 
11
- if (appDb) {
12
- clearInterval(interval)
13
- resolve()
14
- }
15
- }, 100)
16
- })
13
+ if (appDb) {
14
+ clearInterval(interval)
15
+ resolve()
16
+ }
17
+ }, 100)
18
+ })
17
19
 
18
- _waitForDb.then(() => {
19
- sendBack({ type: 'waitForDbSuccess' })
20
- })
21
- },
22
- )
20
+ _waitForDb.then(() => {
21
+ sendBack({ type: 'waitForDbSuccess' })
22
+ })
23
+ })
@@ -2,7 +2,7 @@
2
2
  import '../src/node/helpers/EasClient';
3
3
  import '../src/node/helpers/QueryClient';
4
4
  import '../src/node/helpers/FileManager';
5
- import '../src/node/helpers/ArweaveClientNode';
5
+ import '../src/node/helpers/ArweaveClient';
6
6
  declare const init: (args: string[]) => void;
7
7
  export { init };
8
8
  //# sourceMappingURL=bin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../scripts/bin.ts"],"names":[],"mappings":";AAOA,OAAO,+BAA+B,CAAA;AACtC,OAAO,iCAAiC,CAAA;AACxC,OAAO,iCAAiC,CAAA;AACxC,OAAO,uCAAuC,CAAA;AAoB9C,QAAA,MAAM,IAAI,SAAU,MAAM,EAAE,SA+I3B,CAAA;AAeD,OAAO,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../scripts/bin.ts"],"names":[],"mappings":";AAOA,OAAO,+BAA+B,CAAA;AACtC,OAAO,iCAAiC,CAAA;AACxC,OAAO,iCAAiC,CAAA;AACxC,OAAO,mCAAmC,CAAA;AAoB1C,QAAA,MAAM,IAAI,SAAU,MAAM,EAAE,SA+I3B,CAAA;AAeD,OAAO,EAAE,IAAI,EAAE,CAAA"}