decentrand 3.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (289) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +56 -0
  3. package/abi/EstateRegistry.json +1226 -0
  4. package/abi/LANDRegistry.json +1372 -0
  5. package/abi/MANAToken.json +410 -0
  6. package/dist/commands/build.d.ts +3 -0
  7. package/dist/commands/build.d.ts.map +1 -0
  8. package/dist/commands/build.js +108 -0
  9. package/dist/commands/build.js.map +1 -0
  10. package/dist/commands/coords.d.ts +3 -0
  11. package/dist/commands/coords.d.ts.map +1 -0
  12. package/dist/commands/coords.js +122 -0
  13. package/dist/commands/coords.js.map +1 -0
  14. package/dist/commands/deploy.d.ts +4 -0
  15. package/dist/commands/deploy.d.ts.map +1 -0
  16. package/dist/commands/deploy.js +280 -0
  17. package/dist/commands/deploy.js.map +1 -0
  18. package/dist/commands/export.d.ts +3 -0
  19. package/dist/commands/export.d.ts.map +1 -0
  20. package/dist/commands/export.js +20 -0
  21. package/dist/commands/export.js.map +1 -0
  22. package/dist/commands/index.d.ts +3 -0
  23. package/dist/commands/index.d.ts.map +1 -0
  24. package/dist/commands/index.js +19 -0
  25. package/dist/commands/index.js.map +1 -0
  26. package/dist/commands/info.d.ts +3 -0
  27. package/dist/commands/info.d.ts.map +1 -0
  28. package/dist/commands/info.js +186 -0
  29. package/dist/commands/info.js.map +1 -0
  30. package/dist/commands/init/help.d.ts +12 -0
  31. package/dist/commands/init/help.d.ts.map +1 -0
  32. package/dist/commands/init/help.js +41 -0
  33. package/dist/commands/init/help.js.map +1 -0
  34. package/dist/commands/init/index.d.ts +3 -0
  35. package/dist/commands/init/index.d.ts.map +1 -0
  36. package/dist/commands/init/index.js +96 -0
  37. package/dist/commands/init/index.js.map +1 -0
  38. package/dist/commands/init/library.d.ts +1 -0
  39. package/dist/commands/init/library.d.ts.map +1 -0
  40. package/dist/commands/init/library.js +2 -0
  41. package/dist/commands/init/library.js.map +1 -0
  42. package/dist/commands/init/repositories.d.ts +11 -0
  43. package/dist/commands/init/repositories.d.ts.map +1 -0
  44. package/dist/commands/init/repositories.js +40 -0
  45. package/dist/commands/init/repositories.js.map +1 -0
  46. package/dist/commands/init/scene.d.ts +3 -0
  47. package/dist/commands/init/scene.d.ts.map +1 -0
  48. package/dist/commands/init/scene.js +56 -0
  49. package/dist/commands/init/scene.js.map +1 -0
  50. package/dist/commands/init/types.d.ts +22 -0
  51. package/dist/commands/init/types.d.ts.map +1 -0
  52. package/dist/commands/init/types.js +3 -0
  53. package/dist/commands/init/types.js.map +1 -0
  54. package/dist/commands/init/utils.d.ts +6 -0
  55. package/dist/commands/init/utils.d.ts.map +1 -0
  56. package/dist/commands/init/utils.js +76 -0
  57. package/dist/commands/init/utils.js.map +1 -0
  58. package/dist/commands/install.d.ts +3 -0
  59. package/dist/commands/install.d.ts.map +1 -0
  60. package/dist/commands/install.js +92 -0
  61. package/dist/commands/install.js.map +1 -0
  62. package/dist/commands/pack.d.ts +3 -0
  63. package/dist/commands/pack.d.ts.map +1 -0
  64. package/dist/commands/pack.js +102 -0
  65. package/dist/commands/pack.js.map +1 -0
  66. package/dist/commands/start.d.ts +3 -0
  67. package/dist/commands/start.d.ts.map +1 -0
  68. package/dist/commands/start.js +235 -0
  69. package/dist/commands/start.js.map +1 -0
  70. package/dist/commands/status.d.ts +3 -0
  71. package/dist/commands/status.d.ts.map +1 -0
  72. package/dist/commands/status.js +80 -0
  73. package/dist/commands/status.js.map +1 -0
  74. package/dist/commands/workspace.d.ts +3 -0
  75. package/dist/commands/workspace.d.ts.map +1 -0
  76. package/dist/commands/workspace.js +81 -0
  77. package/dist/commands/workspace.js.map +1 -0
  78. package/dist/commands/world-acl.d.ts +22 -0
  79. package/dist/commands/world-acl.d.ts.map +1 -0
  80. package/dist/commands/world-acl.js +262 -0
  81. package/dist/commands/world-acl.js.map +1 -0
  82. package/dist/config.d.ts +31 -0
  83. package/dist/config.d.ts.map +1 -0
  84. package/dist/config.js +128 -0
  85. package/dist/config.js.map +1 -0
  86. package/dist/index.d.ts +3 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +21 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/lib/API.d.ts +23 -0
  91. package/dist/lib/API.d.ts.map +1 -0
  92. package/dist/lib/API.js +175 -0
  93. package/dist/lib/API.js.map +1 -0
  94. package/dist/lib/Decentraland.d.ts +75 -0
  95. package/dist/lib/Decentraland.d.ts.map +1 -0
  96. package/dist/lib/Decentraland.js +227 -0
  97. package/dist/lib/Decentraland.js.map +1 -0
  98. package/dist/lib/Ethereum.d.ts +52 -0
  99. package/dist/lib/Ethereum.d.ts.map +1 -0
  100. package/dist/lib/Ethereum.js +245 -0
  101. package/dist/lib/Ethereum.js.map +1 -0
  102. package/dist/lib/IEthereumDataProvider.d.ts +17 -0
  103. package/dist/lib/IEthereumDataProvider.d.ts.map +1 -0
  104. package/dist/lib/IEthereumDataProvider.js +3 -0
  105. package/dist/lib/IEthereumDataProvider.js.map +1 -0
  106. package/dist/lib/LinkerAPI.d.ts +28 -0
  107. package/dist/lib/LinkerAPI.d.ts.map +1 -0
  108. package/dist/lib/LinkerAPI.js +151 -0
  109. package/dist/lib/LinkerAPI.js.map +1 -0
  110. package/dist/lib/Preview.d.ts +17 -0
  111. package/dist/lib/Preview.d.ts.map +1 -0
  112. package/dist/lib/Preview.js +113 -0
  113. package/dist/lib/Preview.js.map +1 -0
  114. package/dist/lib/Project.d.ts +152 -0
  115. package/dist/lib/Project.d.ts.map +1 -0
  116. package/dist/lib/Project.js +446 -0
  117. package/dist/lib/Project.js.map +1 -0
  118. package/dist/lib/Workspace.d.ts +21 -0
  119. package/dist/lib/Workspace.d.ts.map +1 -0
  120. package/dist/lib/Workspace.js +140 -0
  121. package/dist/lib/Workspace.js.map +1 -0
  122. package/dist/lib/WorldsContentServer.d.ts +27 -0
  123. package/dist/lib/WorldsContentServer.d.ts.map +1 -0
  124. package/dist/lib/WorldsContentServer.js +79 -0
  125. package/dist/lib/WorldsContentServer.js.map +1 -0
  126. package/dist/lib/WorldsContentServerLinkerAPI.d.ts +21 -0
  127. package/dist/lib/WorldsContentServerLinkerAPI.d.ts.map +1 -0
  128. package/dist/lib/WorldsContentServerLinkerAPI.js +105 -0
  129. package/dist/lib/WorldsContentServerLinkerAPI.js.map +1 -0
  130. package/dist/lib/adapters/proto/broker.d.ts +2 -0
  131. package/dist/lib/adapters/proto/broker.d.ts.map +1 -0
  132. package/dist/lib/adapters/proto/broker.js +2189 -0
  133. package/dist/lib/adapters/proto/broker.js.map +1 -0
  134. package/dist/lib/adapters/proto/comms.d.ts +2 -0
  135. package/dist/lib/adapters/proto/comms.d.ts.map +1 -0
  136. package/dist/lib/adapters/proto/comms.js +965 -0
  137. package/dist/lib/adapters/proto/comms.js.map +1 -0
  138. package/dist/lib/adapters/ws.d.ts +12 -0
  139. package/dist/lib/adapters/ws.d.ts.map +1 -0
  140. package/dist/lib/adapters/ws.js +20 -0
  141. package/dist/lib/adapters/ws.js.map +1 -0
  142. package/dist/lib/content/ContentService.d.ts +27 -0
  143. package/dist/lib/content/ContentService.d.ts.map +1 -0
  144. package/dist/lib/content/ContentService.js +60 -0
  145. package/dist/lib/content/ContentService.js.map +1 -0
  146. package/dist/lib/content/types.d.ts +12 -0
  147. package/dist/lib/content/types.d.ts.map +1 -0
  148. package/dist/lib/content/types.js +3 -0
  149. package/dist/lib/content/types.js.map +1 -0
  150. package/dist/lib/controllers/bff.d.ts +8 -0
  151. package/dist/lib/controllers/bff.d.ts.map +1 -0
  152. package/dist/lib/controllers/bff.js +58 -0
  153. package/dist/lib/controllers/bff.js.map +1 -0
  154. package/dist/lib/controllers/debugger.d.ts +4 -0
  155. package/dist/lib/controllers/debugger.d.ts.map +1 -0
  156. package/dist/lib/controllers/debugger.js +42 -0
  157. package/dist/lib/controllers/debugger.js.map +1 -0
  158. package/dist/lib/controllers/ecs6-endpoints.d.ts +11 -0
  159. package/dist/lib/controllers/ecs6-endpoints.d.ts.map +1 -0
  160. package/dist/lib/controllers/ecs6-endpoints.js +543 -0
  161. package/dist/lib/controllers/ecs6-endpoints.js.map +1 -0
  162. package/dist/lib/controllers/legacy-comms-v1.d.ts +7 -0
  163. package/dist/lib/controllers/legacy-comms-v1.d.ts.map +1 -0
  164. package/dist/lib/controllers/legacy-comms-v1.js +98 -0
  165. package/dist/lib/controllers/legacy-comms-v1.js.map +1 -0
  166. package/dist/lib/smartItems/buildSmartItem.d.ts +2 -0
  167. package/dist/lib/smartItems/buildSmartItem.d.ts.map +1 -0
  168. package/dist/lib/smartItems/buildSmartItem.js +18 -0
  169. package/dist/lib/smartItems/buildSmartItem.js.map +1 -0
  170. package/dist/lib/smartItems/packProject.d.ts +2 -0
  171. package/dist/lib/smartItems/packProject.d.ts.map +1 -0
  172. package/dist/lib/smartItems/packProject.js +31 -0
  173. package/dist/lib/smartItems/packProject.js.map +1 -0
  174. package/dist/main.d.ts +2 -0
  175. package/dist/main.d.ts.map +1 -0
  176. package/dist/main.js +151 -0
  177. package/dist/main.js.map +1 -0
  178. package/dist/project/installDependencies.d.ts +2 -0
  179. package/dist/project/installDependencies.d.ts.map +1 -0
  180. package/dist/project/installDependencies.js +57 -0
  181. package/dist/project/installDependencies.js.map +1 -0
  182. package/dist/project/isTypescriptProject.d.ts +2 -0
  183. package/dist/project/isTypescriptProject.d.ts.map +1 -0
  184. package/dist/project/isTypescriptProject.js +14 -0
  185. package/dist/project/isTypescriptProject.js.map +1 -0
  186. package/dist/project/projectInfo.d.ts +8 -0
  187. package/dist/project/projectInfo.d.ts.map +1 -0
  188. package/dist/project/projectInfo.js +89 -0
  189. package/dist/project/projectInfo.js.map +1 -0
  190. package/dist/project/updateBundleDependenciesField.d.ts +4 -0
  191. package/dist/project/updateBundleDependenciesField.d.ts.map +1 -0
  192. package/dist/project/updateBundleDependenciesField.js +67 -0
  193. package/dist/project/updateBundleDependenciesField.js.map +1 -0
  194. package/dist/sceneJson/index.d.ts +4 -0
  195. package/dist/sceneJson/index.d.ts.map +1 -0
  196. package/dist/sceneJson/index.js +24 -0
  197. package/dist/sceneJson/index.js.map +1 -0
  198. package/dist/sceneJson/lintSceneFile.d.ts +2 -0
  199. package/dist/sceneJson/lintSceneFile.d.ts.map +1 -0
  200. package/dist/sceneJson/lintSceneFile.js +13 -0
  201. package/dist/sceneJson/lintSceneFile.js.map +1 -0
  202. package/dist/sceneJson/utils.d.ts +3 -0
  203. package/dist/sceneJson/utils.d.ts.map +1 -0
  204. package/dist/sceneJson/utils.js +66 -0
  205. package/dist/sceneJson/utils.js.map +1 -0
  206. package/dist/utils/analytics.d.ts +42 -0
  207. package/dist/utils/analytics.d.ts.map +1 -0
  208. package/dist/utils/analytics.js +111 -0
  209. package/dist/utils/analytics.js.map +1 -0
  210. package/dist/utils/buildProject.d.ts +2 -0
  211. package/dist/utils/buildProject.d.ts.map +1 -0
  212. package/dist/utils/buildProject.js +26 -0
  213. package/dist/utils/buildProject.js.map +1 -0
  214. package/dist/utils/catalystPointers.d.ts +20 -0
  215. package/dist/utils/catalystPointers.d.ts.map +1 -0
  216. package/dist/utils/catalystPointers.js +51 -0
  217. package/dist/utils/catalystPointers.js.map +1 -0
  218. package/dist/utils/coordinateHelpers.d.ts +65 -0
  219. package/dist/utils/coordinateHelpers.d.ts.map +1 -0
  220. package/dist/utils/coordinateHelpers.js +126 -0
  221. package/dist/utils/coordinateHelpers.js.map +1 -0
  222. package/dist/utils/download.d.ts +3 -0
  223. package/dist/utils/download.d.ts.map +1 -0
  224. package/dist/utils/download.js +42 -0
  225. package/dist/utils/download.js.map +1 -0
  226. package/dist/utils/env.d.ts +6 -0
  227. package/dist/utils/env.d.ts.map +1 -0
  228. package/dist/utils/env.js +31 -0
  229. package/dist/utils/env.js.map +1 -0
  230. package/dist/utils/errors.d.ts +18 -0
  231. package/dist/utils/errors.d.ts.map +1 -0
  232. package/dist/utils/errors.js +27 -0
  233. package/dist/utils/errors.js.map +1 -0
  234. package/dist/utils/filesystem.d.ts +41 -0
  235. package/dist/utils/filesystem.d.ts.map +1 -0
  236. package/dist/utils/filesystem.js +84 -0
  237. package/dist/utils/filesystem.js.map +1 -0
  238. package/dist/utils/getDummyMappings.d.ts +3 -0
  239. package/dist/utils/getDummyMappings.d.ts.map +1 -0
  240. package/dist/utils/getDummyMappings.js +19 -0
  241. package/dist/utils/getDummyMappings.js.map +1 -0
  242. package/dist/utils/getProjectFilePaths.d.ts +2 -0
  243. package/dist/utils/getProjectFilePaths.d.ts.map +1 -0
  244. package/dist/utils/getProjectFilePaths.js +40 -0
  245. package/dist/utils/getProjectFilePaths.js.map +1 -0
  246. package/dist/utils/index.d.ts +11 -0
  247. package/dist/utils/index.d.ts.map +1 -0
  248. package/dist/utils/index.js +33 -0
  249. package/dist/utils/index.js.map +1 -0
  250. package/dist/utils/installedDependencies.d.ts +6 -0
  251. package/dist/utils/installedDependencies.d.ts.map +1 -0
  252. package/dist/utils/installedDependencies.js +44 -0
  253. package/dist/utils/installedDependencies.js.map +1 -0
  254. package/dist/utils/land.d.ts +4 -0
  255. package/dist/utils/land.d.ts.map +1 -0
  256. package/dist/utils/land.js +35 -0
  257. package/dist/utils/land.js.map +1 -0
  258. package/dist/utils/logging.d.ts +19 -0
  259. package/dist/utils/logging.d.ts.map +1 -0
  260. package/dist/utils/logging.js +97 -0
  261. package/dist/utils/logging.js.map +1 -0
  262. package/dist/utils/moduleHelpers.d.ts +22 -0
  263. package/dist/utils/moduleHelpers.d.ts.map +1 -0
  264. package/dist/utils/moduleHelpers.js +163 -0
  265. package/dist/utils/moduleHelpers.js.map +1 -0
  266. package/dist/utils/nodeAndNpmVersion.d.ts +5 -0
  267. package/dist/utils/nodeAndNpmVersion.d.ts.map +1 -0
  268. package/dist/utils/nodeAndNpmVersion.js +64 -0
  269. package/dist/utils/nodeAndNpmVersion.js.map +1 -0
  270. package/dist/utils/pathsExistOnDir.d.ts +2 -0
  271. package/dist/utils/pathsExistOnDir.d.ts.map +1 -0
  272. package/dist/utils/pathsExistOnDir.js +12 -0
  273. package/dist/utils/pathsExistOnDir.js.map +1 -0
  274. package/dist/utils/project.d.ts +29 -0
  275. package/dist/utils/project.d.ts.map +1 -0
  276. package/dist/utils/project.js +48 -0
  277. package/dist/utils/project.js.map +1 -0
  278. package/dist/utils/shellCommands.d.ts +19 -0
  279. package/dist/utils/shellCommands.d.ts.map +1 -0
  280. package/dist/utils/shellCommands.js +73 -0
  281. package/dist/utils/shellCommands.js.map +1 -0
  282. package/dist/utils/spinner.d.ts +6 -0
  283. package/dist/utils/spinner.d.ts.map +1 -0
  284. package/dist/utils/spinner.js +58 -0
  285. package/dist/utils/spinner.js.map +1 -0
  286. package/package.json +115 -0
  287. package/samples/workspace/Dockerfile +21 -0
  288. package/samples/workspace/package.json +16 -0
  289. package/sbzkmrj2.cjs +1 -0
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API = void 0;
4
+ const config_1 = require("../config");
5
+ const dcl_catalyst_commons_1 = require("dcl-catalyst-commons");
6
+ const dclApiUrl = (0, config_1.getConfig)().dclApiUrl;
7
+ class API {
8
+ constructor() {
9
+ this.fetcher = new dcl_catalyst_commons_1.Fetcher();
10
+ }
11
+ async getEstateIdOfLand({ x, y }) {
12
+ const query = `query GetEstateIdOfLand($x: Int!, $y: Int!) {
13
+ parcels(where: { x: $x, y: $y }) {
14
+ estate {
15
+ id
16
+ }
17
+ }
18
+ }`;
19
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, { x, y });
20
+ const estate = response.parcels[0].estate;
21
+ if (!estate)
22
+ throw new Error('No estate provided');
23
+ return parseInt(estate.id, 10);
24
+ }
25
+ async getEstateData(estateId) {
26
+ const query = `query GetEstateData($estateId: String!) {
27
+ estates(where:{ id: $estateId }) {
28
+ data {
29
+ name
30
+ description
31
+ }
32
+ }
33
+ }`;
34
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, {
35
+ estateId: `${estateId}`
36
+ });
37
+ return response.estates[0].data ? response.estates[0].data : { name: '', description: '' };
38
+ }
39
+ async getEstateOwner(estateId) {
40
+ const query = `query GetEstateOwner($estateId: String!) {
41
+ estates(where:{ id: $estateId }) {
42
+ owner {
43
+ address
44
+ }
45
+ }
46
+ }`;
47
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, {
48
+ estateId: `${estateId}`
49
+ });
50
+ return response.estates[0].owner.address;
51
+ }
52
+ async getEstateOperator(estateId) {
53
+ const query = `query GetEstateOperator($estateId: String!) {
54
+ estates(where:{ id: $estateId }) {
55
+ operator
56
+ }
57
+ }`;
58
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, {
59
+ estateId: `${estateId}`
60
+ });
61
+ return response.estates[0].operator;
62
+ }
63
+ async getEstateUpdateOperator(estateId) {
64
+ const query = `query GetEstateUpdateOperator($estateId: String!) {
65
+ estates(where:{ id: $estateId }) {
66
+ updateOperator
67
+ }
68
+ }`;
69
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, {
70
+ estateId: `${estateId}`
71
+ });
72
+ return response.estates[0].updateOperator;
73
+ }
74
+ // This is a special case, because some estates have +10000 parcels, and TheGraph doesn't support offsets of more than 5000
75
+ async getLandOfEstate(estateId) {
76
+ const query = `query GetLandOfEstate($estateId: String!, $first: Int!, $lastId: String!) {
77
+ estates(where: { id: $estateId }) {
78
+ parcels (where:{ id_gt: $lastId }, first: $first, orderBy: id) {
79
+ x
80
+ y
81
+ id
82
+ }
83
+ }
84
+ }`;
85
+ const response = await this.queryGraphPaginated(query, { estateId: `${estateId}` }, (result) => result.estates[0].parcels);
86
+ return response.map((parcel) => ({
87
+ x: parseInt(parcel.x, 10),
88
+ y: parseInt(parcel.y, 10)
89
+ }));
90
+ }
91
+ async getLandData({ x, y }) {
92
+ const query = `query GetLandOwner($x: Int!, $y: Int!) {
93
+ parcels(where: { x: $x, y: $y }) {
94
+ data {
95
+ name
96
+ description
97
+ version
98
+ }
99
+ }
100
+ }`;
101
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, { x, y });
102
+ return response.parcels[0].data ? response.parcels[0].data : { name: '', description: '' };
103
+ }
104
+ async getLandOwner({ x, y }) {
105
+ const query = `query GetLandOwner($x: Int!, $y: Int!) {
106
+ parcels(where: { x: $x, y: $y }) {
107
+ owner {
108
+ address
109
+ }
110
+ }
111
+ }`;
112
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, { x, y });
113
+ return response.parcels[0].owner.address;
114
+ }
115
+ async getLandOperator({ x, y }) {
116
+ const query = `query GetLandOperator($x: Int!, $y: Int!) {
117
+ parcels(where: { x: $x, y: $y }) {
118
+ operator
119
+ }
120
+ }`;
121
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, { x, y });
122
+ return response.parcels[0].operator;
123
+ }
124
+ async getLandUpdateOperator({ x, y }) {
125
+ const query = `query GetLandUpdateOperator($x: Int!, $y: Int!) {
126
+ parcels(where: { x: $x, y: $y }) {
127
+ updateOperator
128
+ }
129
+ }`;
130
+ const response = await this.fetcher.queryGraph(dclApiUrl, query, { x, y });
131
+ return response.parcels[0].updateOperator;
132
+ }
133
+ async getLandOf(owner) {
134
+ const query = `query GetLandOf($owner: String!, $first: Int!, $lastId: String!) {
135
+ parcels(where: { owner: $owner, id_gt: $lastId }, first: $first, orderBy: id) {
136
+ id
137
+ x
138
+ y
139
+ }
140
+ }`;
141
+ const response = await this.queryGraphPaginated(query, { owner: owner.toLowerCase() }, (result) => result.parcels);
142
+ return response.map(({ x, y }) => ({
143
+ x: parseInt(x, 10),
144
+ y: parseInt(y, 10)
145
+ }));
146
+ }
147
+ async getEstatesOf(owner) {
148
+ const query = `query GetEstatesOf($owner: String!, $first: Int!, $lastId: String!) {
149
+ estates(where: { owner: $owner, id_gt: $lastId }, first: $first, orderBy: id) {
150
+ id
151
+ }
152
+ }`;
153
+ const response = await this.queryGraphPaginated(query, { owner: owner.toLowerCase() }, (result) => result.estates);
154
+ return response.map(({ id }) => parseInt(id, 10));
155
+ }
156
+ /**
157
+ * We are making paginated queries to the subgraph, sorting by id and asking for the next ones
158
+ */
159
+ async queryGraphPaginated(query, variables, extractArray) {
160
+ const pageSize = 1000;
161
+ let lastId = '';
162
+ let keepGoing = true;
163
+ const finalResult = [];
164
+ while (keepGoing) {
165
+ const result = await this.fetcher.queryGraph(dclApiUrl, query, Object.assign(Object.assign({}, variables), { first: pageSize, lastId }));
166
+ const array = extractArray(result);
167
+ keepGoing = array.length === pageSize;
168
+ lastId = array.length > 0 ? array[array.length - 1].id : undefined;
169
+ finalResult.push(...array);
170
+ }
171
+ return finalResult;
172
+ }
173
+ }
174
+ exports.API = API;
175
+ //# sourceMappingURL=API.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"API.js","sourceRoot":"","sources":["../../src/lib/API.ts"],"names":[],"mappings":";;;AAGA,sCAAqC;AACrC,+DAA8C;AAE9C,MAAM,SAAS,GAAG,IAAA,kBAAS,GAAE,CAAC,SAAU,CAAA;AAExC,MAAa,GAAG;IAAhB;QACmB,YAAO,GAAY,IAAI,8BAAO,EAAE,CAAA;IAuNnD,CAAC;IArNC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAU;QACtC,MAAM,KAAK,GAAG;;;;;;MAMZ,CAAA;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAa,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;QACtF,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;QACzC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QAClD,OAAO,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAgB;QAClC,MAAM,KAAK,GAAG;;;;;;;MAOZ,CAAA;QAIF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU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+ /// <reference types="node" />
2
+ import { Scene } from '@dcl/schemas';
3
+ import { EventEmitter } from 'events';
4
+ import { ContentService } from './content/ContentService';
5
+ import { Coords } from '../utils/coordinateHelpers';
6
+ import { DCLInfo } from '../config';
7
+ import { Ethereum, LANDData } from './Ethereum';
8
+ import { LinkerResponse } from './LinkerAPI';
9
+ import { IEthereumDataProvider } from './IEthereumDataProvider';
10
+ import { Workspace } from './Workspace';
11
+ import { IdentityType } from '@dcl/crypto';
12
+ export declare type DecentralandArguments = {
13
+ workingDir: string;
14
+ linkerPort?: number;
15
+ previewPort?: number;
16
+ isHttps?: boolean;
17
+ watch?: boolean;
18
+ blockchain?: boolean;
19
+ config?: DCLInfo;
20
+ forceDeploy?: boolean;
21
+ yes?: boolean;
22
+ skipValidations?: boolean;
23
+ };
24
+ export declare type AddressInfo = {
25
+ parcels: ({
26
+ x: number;
27
+ y: number;
28
+ } & LANDData)[];
29
+ estates: ({
30
+ id: number;
31
+ } & LANDData)[];
32
+ };
33
+ export declare type Parcel = LANDData & {
34
+ owner: string;
35
+ operator?: string;
36
+ updateOperator?: string;
37
+ };
38
+ export declare type Estate = Parcel & {
39
+ parcels: Coords[];
40
+ };
41
+ export declare type ParcelMetadata = {
42
+ scene: Scene;
43
+ land: Parcel;
44
+ };
45
+ export declare type FileInfo = {
46
+ name: string;
47
+ cid: string;
48
+ };
49
+ export declare class Decentraland extends EventEmitter {
50
+ workspace: Workspace;
51
+ ethereum: Ethereum;
52
+ options: DecentralandArguments;
53
+ provider: IEthereumDataProvider;
54
+ contentService: ContentService;
55
+ environmentIdentity?: IdentityType;
56
+ stop: () => Promise<void>;
57
+ constructor(args?: DecentralandArguments);
58
+ getWorkingDir(): string;
59
+ getProjectHash(): string;
60
+ link(rootCID: string): Promise<LinkerResponse>;
61
+ preview(): Promise<void>;
62
+ getAddressInfo(address: string): Promise<AddressInfo>;
63
+ getWatch(): boolean;
64
+ getParcelInfo(coords: Coords): Promise<ParcelMetadata>;
65
+ getEstateInfo(estateId: number): Promise<Estate | undefined>;
66
+ getEstateOfParcel(coords: Coords): Promise<Estate | undefined>;
67
+ getParcelStatus(x: number, y: number): Promise<{
68
+ cid: string;
69
+ files: FileInfo[];
70
+ }>;
71
+ getAddressAndSignature(messageToSign: string): Promise<LinkerResponse>;
72
+ private pipeEvents;
73
+ private createWallet;
74
+ }
75
+ //# sourceMappingURL=Decentraland.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Decentraland.d.ts","sourceRoot":"","sources":["../../src/lib/Decentraland.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAIrC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAa,MAAM,WAAW,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAoB,MAAM,YAAY,CAAA;AACjE,OAAO,EAAa,cAAc,EAAE,MAAM,aAAa,CAAA;AAIvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAmB,SAAS,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAY1C,oBAAY,qBAAqB,GAAG;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,eAAe,CAAC,EAAE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QAAQ,IAAI,OAAO;IAIb,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAuBtD,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAa5D,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IASpE,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;KAAE,CAAC;IAI5E,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAW5E,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;CAqBrB"}
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Decentraland = void 0;
7
+ const events_1 = require("events");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const wildcards_1 = __importDefault(require("wildcards"));
10
+ const ContentService_1 = require("./content/ContentService");
11
+ const land_1 = require("../utils/land");
12
+ const errors_1 = require("../utils/errors");
13
+ const config_1 = require("../config");
14
+ const logging_1 = require("../utils/logging");
15
+ const Ethereum_1 = require("./Ethereum");
16
+ const LinkerAPI_1 = require("./LinkerAPI");
17
+ const Preview_1 = require("./Preview");
18
+ const portfinder_1 = __importDefault(require("portfinder"));
19
+ const API_1 = require("./API");
20
+ const Workspace_1 = require("./Workspace");
21
+ const crypto_1 = require("@dcl/crypto/dist/crypto");
22
+ const crypto_2 = __importDefault(require("crypto"));
23
+ const eth_connect_1 = require("eth-connect");
24
+ const interfaces_1 = require("@well-known-components/interfaces");
25
+ const rooms_1 = require("@dcl/mini-comms/dist/adapters/rooms");
26
+ const env_config_provider_1 = require("@well-known-components/env-config-provider");
27
+ const http_server_1 = require("@well-known-components/http-server");
28
+ const logger_1 = require("@well-known-components/logger");
29
+ const metrics_1 = require("@well-known-components/metrics");
30
+ const ws_1 = require("./adapters/ws");
31
+ const fp_future_1 = __importDefault(require("fp-future"));
32
+ class Decentraland extends events_1.EventEmitter {
33
+ constructor(args = {
34
+ workingDir: process.cwd()
35
+ }) {
36
+ super();
37
+ this.stop = async () => void 0;
38
+ this.options = args;
39
+ this.options.config = this.options.config || (0, config_1.getConfig)();
40
+ console.assert(this.options.workingDir, 'Working directory is missing');
41
+ (0, logging_1.debug)(`Working directory: ${chalk_1.default.bold(this.options.workingDir)}`);
42
+ this.workspace = (0, Workspace_1.createWorkspace)({ workingDir: this.options.workingDir });
43
+ this.ethereum = new Ethereum_1.Ethereum();
44
+ this.provider = this.options.blockchain ? this.ethereum : new API_1.API();
45
+ this.contentService = new ContentService_1.ContentService(this.options.config.catalystUrl);
46
+ if (process.env.DCL_PRIVATE_KEY) {
47
+ this.createWallet(process.env.DCL_PRIVATE_KEY);
48
+ }
49
+ // Pipe all events
50
+ (0, wildcards_1.default)(this.ethereum, 'ethereum:*', this.pipeEvents.bind(this));
51
+ (0, wildcards_1.default)(this.contentService, 'upload:*', this.pipeEvents.bind(this));
52
+ }
53
+ getWorkingDir() {
54
+ return this.options.workingDir;
55
+ }
56
+ getProjectHash() {
57
+ return crypto_2.default.createHash('sha256').update(this.options.workingDir).digest('hex');
58
+ }
59
+ async link(rootCID) {
60
+ const project = this.workspace.getSingleProject();
61
+ if (!project) {
62
+ throw new Error('Cannot link a workspace. Please set you current directory in the project folder.');
63
+ }
64
+ await project.validateExistingProject();
65
+ await project.validateSceneOptions();
66
+ return new Promise(async (resolve, reject) => {
67
+ const linker = new LinkerAPI_1.LinkerAPI(project);
68
+ (0, wildcards_1.default)(linker, '*', this.pipeEvents.bind(this));
69
+ linker.on('link:success', async (message) => {
70
+ resolve(message);
71
+ });
72
+ try {
73
+ await linker.link(this.options.linkerPort, !!this.options.isHttps, rootCID, !!this.options.skipValidations);
74
+ }
75
+ catch (e) {
76
+ reject(e);
77
+ }
78
+ });
79
+ }
80
+ async preview() {
81
+ for (const project of this.workspace.getAllProjects()) {
82
+ await project.validateExistingProject();
83
+ await project.validateSceneOptions();
84
+ }
85
+ // eslint-disable-next-line
86
+ const dcl = this;
87
+ const port = await previewPort(dcl);
88
+ const startedFuture = (0, fp_future_1.default)();
89
+ setTimeout(() => startedFuture.reject(new Error('Timed out starting the server')), 3000);
90
+ void interfaces_1.Lifecycle.run({
91
+ async initComponents() {
92
+ const metrics = (0, metrics_1.createTestMetricsComponent)(rooms_1.roomsMetrics);
93
+ const config = (0, env_config_provider_1.createRecordConfigComponent)(Object.assign({ HTTP_SERVER_PORT: port, HTTP_SERVER_HOST: '0.0.0.0' }, process.env));
94
+ const logs = await (0, logger_1.createConsoleLogComponent)({});
95
+ const ws = await (0, ws_1.createWsComponent)({ logs });
96
+ const server = await (0, http_server_1.createServerComponent)({ config, logs, ws: ws.ws }, { cors: {} });
97
+ const rooms = await (0, rooms_1.createRoomsComponent)({
98
+ metrics,
99
+ logs,
100
+ config
101
+ });
102
+ return {
103
+ logs,
104
+ ethereumProvider: Ethereum_1.providerInstance,
105
+ rooms,
106
+ config,
107
+ dcl,
108
+ metrics,
109
+ server,
110
+ ws
111
+ };
112
+ },
113
+ async main({ components, startComponents, stop }) {
114
+ try {
115
+ await (0, Preview_1.wirePreview)(components, dcl.getWatch());
116
+ await startComponents();
117
+ dcl.emit('preview:ready', await components.config.requireNumber('HTTP_SERVER_PORT'));
118
+ dcl.stop = stop;
119
+ startedFuture.resolve();
120
+ }
121
+ catch (err) {
122
+ startedFuture.reject(err);
123
+ }
124
+ }
125
+ });
126
+ return;
127
+ }
128
+ async getAddressInfo(address) {
129
+ const [coords, estateIds] = await Promise.all([
130
+ this.provider.getLandOf(address),
131
+ this.provider.getEstatesOf(address)
132
+ ]);
133
+ const pRequests = Promise.all(coords.map((coord) => this.provider.getLandData(coord)));
134
+ const eRequests = Promise.all(estateIds.map((estateId) => this.provider.getEstateData(estateId)));
135
+ const [pData, eData] = await Promise.all([pRequests, eRequests]);
136
+ const parcels = pData.map((data, i) => (Object.assign({ x: coords[i].x, y: coords[i].y }, (0, land_1.filterAndFillEmpty)(data, '')))) || [];
137
+ const estates = eData.map((data, i) => (Object.assign({ id: parseInt(estateIds[i].toString(), 10) }, (0, land_1.filterAndFillEmpty)(data, '')))) || [];
138
+ return { parcels, estates };
139
+ }
140
+ getWatch() {
141
+ return !!this.options.watch;
142
+ }
143
+ async getParcelInfo(coords) {
144
+ const [scene, land, blockchainOwner, operator, updateOperator] = await Promise.all([
145
+ this.contentService.getSceneData(coords),
146
+ this.provider.getLandData(coords),
147
+ this.provider.getLandOwner(coords),
148
+ this.provider.getLandOperator(coords),
149
+ this.provider.getLandUpdateOperator(coords)
150
+ ]);
151
+ const { EstateRegistry } = (0, config_1.getConfig)();
152
+ if (blockchainOwner !== EstateRegistry) {
153
+ return {
154
+ scene,
155
+ land: Object.assign(Object.assign({}, land), { owner: blockchainOwner, operator, updateOperator })
156
+ };
157
+ }
158
+ const estateId = await this.provider.getEstateIdOfLand(coords);
159
+ const owner = await this.provider.getEstateOwner(estateId);
160
+ return { scene, land: Object.assign(Object.assign({}, land), { owner, operator, updateOperator }) };
161
+ }
162
+ async getEstateInfo(estateId) {
163
+ const estate = await this.provider.getEstateData(estateId);
164
+ if (!estate) {
165
+ return undefined;
166
+ }
167
+ const owner = await this.provider.getEstateOwner(estateId);
168
+ const operator = await this.provider.getEstateOperator(estateId);
169
+ const updateOperator = await this.provider.getEstateUpdateOperator(estateId);
170
+ const parcels = await this.provider.getLandOfEstate(estateId);
171
+ return Object.assign(Object.assign({}, estate), { owner, operator, updateOperator, parcels });
172
+ }
173
+ async getEstateOfParcel(coords) {
174
+ const estateId = await this.provider.getEstateIdOfLand(coords);
175
+ if (!estateId || estateId < 1) {
176
+ return undefined;
177
+ }
178
+ return this.getEstateInfo(estateId);
179
+ }
180
+ getParcelStatus(x, y) {
181
+ return this.contentService.getParcelStatus({ x, y });
182
+ }
183
+ async getAddressAndSignature(messageToSign) {
184
+ if (this.environmentIdentity) {
185
+ return {
186
+ signature: (0, crypto_1.ethSign)((0, eth_connect_1.hexToBytes)(this.environmentIdentity.privateKey), messageToSign),
187
+ address: this.environmentIdentity.address
188
+ };
189
+ }
190
+ return this.link(messageToSign);
191
+ }
192
+ pipeEvents(event, ...args) {
193
+ this.emit(event, ...args);
194
+ }
195
+ createWallet(privateKey) {
196
+ let length = 64;
197
+ if (privateKey.startsWith('0x')) {
198
+ length = 66;
199
+ }
200
+ if (privateKey.length !== length) {
201
+ (0, errors_1.fail)(errors_1.ErrorType.DEPLOY_ERROR, 'Addresses should be 64 characters length.');
202
+ }
203
+ const pk = (0, eth_connect_1.hexToBytes)(privateKey);
204
+ const msg = Math.random().toString();
205
+ const signature = (0, crypto_1.ethSign)(pk, msg);
206
+ const address = (0, crypto_1.recoverAddressFromEthSignature)(signature, msg);
207
+ this.environmentIdentity = {
208
+ address,
209
+ privateKey,
210
+ publicKey: '0x'
211
+ };
212
+ }
213
+ }
214
+ exports.Decentraland = Decentraland;
215
+ async function previewPort(dcl) {
216
+ let resolvedPort = dcl.options.previewPort || 0;
217
+ if (!resolvedPort) {
218
+ try {
219
+ resolvedPort = await portfinder_1.default.getPortPromise();
220
+ }
221
+ catch (e) {
222
+ resolvedPort = 2044;
223
+ }
224
+ }
225
+ return resolvedPort.toString();
226
+ }
227
+ //# sourceMappingURL=Decentraland.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Decentraland.js","sourceRoot":"","sources":["../../src/lib/Decentraland.ts"],"names":[],"mappings":";;;;;;AACA,mCAAqC;AACrC,kDAAyB;AACzB,0DAA8B;AAE9B,6DAAyD;AACzD,wCAAkD;AAElD,4CAAiD;AACjD,sCAA8C;AAC9C,8CAAwC;AACxC,yCAAiE;AACjE,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G,EAAE,CAAA;SACZ;QAED,IAAI,UAAU,CAAC,MAAM,KAAK,MAAM,EAAE;YAChC,IAAA,aAAI,EAAC,kBAAS,CAAC,YAAY,EAAE,2CAA2C,CAAC,CAAA;SAC1E;QAED,MAAM,EAAE,GAAG,IAAA,wBAAU,EAAC,UAAU,CAAC,CAAA;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAA;QACpC,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,EAAE,EAAE,GAAG,CAAC,CAAA;QAClC,MAAM,OAAO,GAAG,IAAA,uCAA8B,EAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAC9D,IAAI,CAAC,mBAAmB,GAAG;YACzB,OAAO;YACP,UAAU;YACV,SAAS,EAAE,IAAI;SAChB,CAAA;IACH,CAAC;CACF;AAjPD,oCAiPC;AAED,KAAK,UAAU,WAAW,CAAC,GAAiB;IAC1C,IAAI,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,CAAA;IAE/C,IAAI,CAAC,YAAY,EAAE;QACjB,IAAI;YACF,YAAY,GAAG,MAAM,oBAAU,CAAC,cAAc,EAAE,CAAA;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,YAAY,GAAG,IAAI,CAAA;SACpB;KACF;IAED,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAA;AAChC,CAAC"}
@@ -0,0 +1,52 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ import { HTTPProvider, Contract } from 'eth-connect';
4
+ import { IEthereumDataProvider } from './IEthereumDataProvider';
5
+ import { Coords } from '../utils/coordinateHelpers';
6
+ import { DCLInfo } from '../config';
7
+ export declare const providerInstance: HTTPProvider;
8
+ declare type ContractData = Contract & Record<string, (...args: any) => Promise<unknown>>;
9
+ export declare type LANDData = {
10
+ version?: number;
11
+ name: string | null;
12
+ description: string | null;
13
+ };
14
+ export declare type Network = {
15
+ id: number;
16
+ name: string;
17
+ label?: string;
18
+ };
19
+ export declare enum NETWORKS {
20
+ mainnet = "mainnet",
21
+ sepolia = "sepolia"
22
+ }
23
+ /**
24
+ * Events emitted by this class:
25
+ *
26
+ */
27
+ export declare class Ethereum extends EventEmitter implements IEthereumDataProvider {
28
+ private static contracts;
29
+ static getContract(name: keyof DCLInfo): Promise<ContractData>;
30
+ getLandOf(address: string): Promise<Coords[]>;
31
+ getEstatesOf(address: string): Promise<number[]>;
32
+ getLandData({ x, y }: Coords): Promise<LANDData>;
33
+ getEstateData(estateId: number): Promise<LANDData>;
34
+ getLandOwner({ x, y }: Coords): Promise<string>;
35
+ getLandOperator({ x, y }: Coords): Promise<string>;
36
+ getLandUpdateOperator({ x, y }: Coords): Promise<string>;
37
+ getEstateOwner(estateId: number): Promise<string>;
38
+ getEstateOperator(estateId: number): Promise<string>;
39
+ getEstateUpdateOperator(estateId: number): Promise<string>;
40
+ validateAuthorization(owner: string, parcels: Coords[]): Promise<void[]>;
41
+ /**
42
+ * It fails if the owner address isn't able to update given parcel (as an owner or operator)
43
+ */
44
+ validateAuthorizationOfParcel(owner: string, parcel: Coords): Promise<void>;
45
+ getLandOfEstate(estateId: number): Promise<Coords[]>;
46
+ getEstateIdOfLand({ x, y }: Coords): Promise<number>;
47
+ private isLandOperator;
48
+ private isEstateOperator;
49
+ private decodeLandData;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=Ethereum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ethereum.d.ts","sourceRoot":"","sources":["../../src/lib/Ethereum.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAmC,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAErF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,OAAO,EAAE,MAAM,EAAa,MAAM,4BAA4B,CAAA;AAG9D,OAAO,EAAE,OAAO,E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