@golemio/playgrounds 1.0.3-dev.442767601 → 1.0.3-dev.488256458

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 (110) hide show
  1. package/db/example/.config.json +3 -0
  2. package/db/example/00_truncate_tables.sql +6 -0
  3. package/db/example/01_playgrounds.sql +30 -0
  4. package/db/migrations/postgresql/.config.json +3 -0
  5. package/db/migrations/postgresql/20220223135414-playgrounds-to-postgres.js +53 -0
  6. package/db/migrations/postgresql/package.json +3 -0
  7. package/db/migrations/postgresql/sqls/20220223135414-playgrounds-to-postgres-down.sql +3 -0
  8. package/db/migrations/postgresql/sqls/20220223135414-playgrounds-to-postgres-up.sql +52 -0
  9. package/db/migrations/postgresql/sqls/package.json +3 -0
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +1 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/integration-engine/PlaygroundsDataSource.d.ts +5 -0
  14. package/dist/integration-engine/PlaygroundsDataSource.js +21 -0
  15. package/dist/integration-engine/PlaygroundsDataSource.js.map +1 -0
  16. package/dist/integration-engine/PlaygroundsTransformation.d.ts +6 -1
  17. package/dist/integration-engine/PlaygroundsTransformation.js +35 -27
  18. package/dist/integration-engine/PlaygroundsTransformation.js.map +1 -1
  19. package/dist/integration-engine/PlaygroundsWorker.d.ts +7 -1
  20. package/dist/integration-engine/PlaygroundsWorker.js +114 -81
  21. package/dist/integration-engine/PlaygroundsWorker.js.map +1 -1
  22. package/dist/integration-engine/helpers/AddressHelper.d.ts +11 -0
  23. package/dist/integration-engine/helpers/AddressHelper.js +68 -0
  24. package/dist/integration-engine/helpers/AddressHelper.js.map +1 -0
  25. package/dist/integration-engine/models/CityDistrictsModel.d.ts +4 -0
  26. package/dist/integration-engine/models/CityDistrictsModel.js +22 -0
  27. package/dist/integration-engine/models/CityDistrictsModel.js.map +1 -0
  28. package/dist/integration-engine/models/PlaygroundPropertyModel.d.ts +4 -0
  29. package/dist/integration-engine/models/PlaygroundPropertyModel.js +21 -0
  30. package/dist/integration-engine/models/PlaygroundPropertyModel.js.map +1 -0
  31. package/dist/integration-engine/models/PlaygroundsModel.d.ts +12 -0
  32. package/dist/integration-engine/models/PlaygroundsModel.js +47 -0
  33. package/dist/integration-engine/models/PlaygroundsModel.js.map +1 -0
  34. package/dist/integration-engine/models/PropertyModel.d.ts +4 -0
  35. package/dist/integration-engine/models/PropertyModel.js +21 -0
  36. package/dist/integration-engine/models/PropertyModel.js.map +1 -0
  37. package/dist/integration-engine/queueDefinitions.js +3 -3
  38. package/dist/integration-engine/queueDefinitions.js.map +1 -1
  39. package/dist/output-gateway/PlaygroundsRouter.d.ts +2 -1
  40. package/dist/output-gateway/PlaygroundsRouter.js +6 -4
  41. package/dist/output-gateway/PlaygroundsRouter.js.map +1 -1
  42. package/dist/output-gateway/index.d.ts +1 -1
  43. package/dist/output-gateway/index.js +1 -1
  44. package/dist/output-gateway/index.js.map +1 -1
  45. package/dist/output-gateway/models/FilterHelper.d.ts +8 -0
  46. package/dist/output-gateway/models/FilterHelper.js +49 -0
  47. package/dist/output-gateway/models/FilterHelper.js.map +1 -0
  48. package/dist/output-gateway/models/PlaygroundPropertyModel.d.ts +6 -0
  49. package/dist/output-gateway/models/PlaygroundPropertyModel.js +22 -0
  50. package/dist/output-gateway/models/PlaygroundPropertyModel.js.map +1 -0
  51. package/dist/output-gateway/models/PlaygroundsModel.d.ts +15 -0
  52. package/dist/output-gateway/models/PlaygroundsModel.js +87 -0
  53. package/dist/output-gateway/models/PlaygroundsModel.js.map +1 -0
  54. package/dist/output-gateway/models/PropertyModel.d.ts +6 -0
  55. package/dist/output-gateway/models/PropertyModel.js +22 -0
  56. package/dist/output-gateway/models/PropertyModel.js.map +1 -0
  57. package/dist/schema-definitions/PlaygroundSchemaTables.d.ts +5 -0
  58. package/dist/schema-definitions/PlaygroundSchemaTables.js +10 -0
  59. package/dist/schema-definitions/PlaygroundSchemaTables.js.map +1 -0
  60. package/dist/schema-definitions/PlaygroundsInfo.d.ts +12 -0
  61. package/dist/schema-definitions/PlaygroundsInfo.js +41 -0
  62. package/dist/schema-definitions/PlaygroundsInfo.js.map +1 -0
  63. package/dist/schema-definitions/json-schema/OutputSchemaProvider.d.ts +9 -0
  64. package/dist/schema-definitions/json-schema/OutputSchemaProvider.js +58 -0
  65. package/dist/schema-definitions/json-schema/OutputSchemaProvider.js.map +1 -0
  66. package/dist/schema-definitions/json-schema/SourceSchemaProvider.d.ts +5 -0
  67. package/dist/schema-definitions/json-schema/SourceSchemaProvider.js +48 -0
  68. package/dist/schema-definitions/json-schema/SourceSchemaProvider.js.map +1 -0
  69. package/dist/schema-definitions/json-schema/interfaces/ISourcePlayground.d.ts +14 -0
  70. package/dist/schema-definitions/json-schema/interfaces/ISourcePlayground.js +3 -0
  71. package/dist/schema-definitions/json-schema/interfaces/ISourcePlayground.js.map +1 -0
  72. package/dist/schema-definitions/json-schema/interfaces/ISourcePlaygroundCategory.d.ts +4 -0
  73. package/dist/schema-definitions/json-schema/interfaces/ISourcePlaygroundCategory.js +3 -0
  74. package/dist/schema-definitions/json-schema/interfaces/ISourcePlaygroundCategory.js.map +1 -0
  75. package/dist/schema-definitions/json-schema/interfaces/ISourceResponse.d.ts +8 -0
  76. package/dist/schema-definitions/json-schema/interfaces/ISourceResponse.js +3 -0
  77. package/dist/schema-definitions/json-schema/interfaces/ISourceResponse.js.map +1 -0
  78. package/dist/schema-definitions/output/IOutputPlaygroundProperties.d.ts +24 -0
  79. package/dist/schema-definitions/output/IOutputPlaygroundProperties.js +3 -0
  80. package/dist/schema-definitions/output/IOutputPlaygroundProperties.js.map +1 -0
  81. package/dist/schema-definitions/output/OutputPlayground.d.ts +9 -0
  82. package/dist/schema-definitions/output/OutputPlayground.js +38 -0
  83. package/dist/schema-definitions/output/OutputPlayground.js.map +1 -0
  84. package/dist/schema-definitions/sequelize-models/Playground.d.ts +24 -0
  85. package/dist/schema-definitions/sequelize-models/Playground.js +30 -0
  86. package/dist/schema-definitions/sequelize-models/Playground.js.map +1 -0
  87. package/dist/schema-definitions/sequelize-models/PlaygroundProperty.d.ts +7 -0
  88. package/dist/schema-definitions/sequelize-models/PlaygroundProperty.js +27 -0
  89. package/dist/schema-definitions/sequelize-models/PlaygroundProperty.js.map +1 -0
  90. package/dist/schema-definitions/sequelize-models/Property.d.ts +7 -0
  91. package/dist/schema-definitions/sequelize-models/Property.js +12 -0
  92. package/dist/schema-definitions/sequelize-models/Property.js.map +1 -0
  93. package/dist/schema-definitions/sequelize-models/interfaces/IPlayground.d.ts +20 -0
  94. package/dist/schema-definitions/sequelize-models/interfaces/IPlayground.js +3 -0
  95. package/dist/schema-definitions/sequelize-models/interfaces/IPlayground.js.map +1 -0
  96. package/dist/schema-definitions/sequelize-models/interfaces/IPlaygroundProperty.d.ts +4 -0
  97. package/dist/schema-definitions/sequelize-models/interfaces/IPlaygroundProperty.js +3 -0
  98. package/dist/schema-definitions/sequelize-models/interfaces/IPlaygroundProperty.js.map +1 -0
  99. package/dist/schema-definitions/sequelize-models/interfaces/IProperty.d.ts +4 -0
  100. package/dist/schema-definitions/sequelize-models/interfaces/IProperty.js +3 -0
  101. package/dist/schema-definitions/sequelize-models/interfaces/IProperty.js.map +1 -0
  102. package/package.json +6 -4
  103. package/db/example/mongo_data/dataplatform/playgrounds.bson +0 -0
  104. package/db/example/mongo_data/dataplatform/playgrounds.metadata.json +0 -1
  105. package/dist/output-gateway/PlaygroundsModel.d.ts +0 -7
  106. package/dist/output-gateway/PlaygroundsModel.js +0 -17
  107. package/dist/output-gateway/PlaygroundsModel.js.map +0 -1
  108. package/dist/schema-definitions/index.d.ts +0 -12
  109. package/dist/schema-definitions/index.js +0 -66
  110. package/dist/schema-definitions/index.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ {
2
+ "schema": "playgrounds"
3
+ }
@@ -0,0 +1,6 @@
1
+ TRUNCATE
2
+ "playground_properties",
3
+ "properties",
4
+ "playground";
5
+
6
+ ALTER SEQUENCE playground_internal_id_seq RESTART WITH 1;
@@ -0,0 +1,30 @@
1
+ INSERT INTO properties (id,description,updated_at,created_at) VALUES
2
+ (4,'Fitness prvky','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
3
+ (9,'Kultura (muzea, galerie, venkovní sochy, divadla, planetária)','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
4
+ (5,'Voda-hydrant nebo umyvadlo','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
5
+ (6,'WC na hřišti nebo v bezprostřední blízkosti','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
6
+ (8,'Částečný stín','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
7
+ (3,'Jiné sporty (lanová centra, minigolf, discgolf, boby)','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
8
+ (13,'Bazény, vodní atrakce, vodní soustavy','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
9
+ (1,'Plocha pro míčové hry','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
10
+ (2,'In line stezky, skate parky, BMX areály, dopravní hřiště','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
11
+ (7,'Správce na hřišti','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672');
12
+ INSERT INTO properties (id,description,updated_at,created_at) VALUES
13
+ (12,'Restaurace nebo kavárny v bezprostřední blízkosti','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
14
+ (10,'Naučné stezky','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672'),
15
+ (11,'ZOO koutky','2022-03-09 10:17:31.703','2022-03-09 10:16:05.672');
16
+
17
+ INSERT INTO playgrounds.playground ("internal_id","location","content",external_id,"name",perex,updated_at,created_at,url,image_url,district,address_region,address_country,address_formatted,address_locality,postal_code,street_address) VALUES
18
+ (1,'SRID=4326;POINT (14.613753319 50.11164856)'::geometry,'Dětské hřiště (62.A) se rozkládá v parčíku, u konečné autobusu č. 223. Tvoří ho hned 3 části. První je oplocena vyšším...',89,' Horní Počernice - hřiště 62.A','Lokalita vám nabídne velmi pěkné hřiště a několik zajímavých doprovodných aktivit.','2022-03-09 10:17:31.063','2022-03-09 10:16:03.574','http://www.hristepraha.cz/hriste/mapa/horni-pocernice-hriste-62-a','http://www.hristepraha.cz/images/img/840ce044e65195caa5465818342e3ac4o.jpg','Praha 20','Horní Počernice','Česko','Běluňská, 19300 Hlavní město Praha-Horní Počernice, Česko','Hlavní město Praha','19300','Běluňská'),
19
+ (2,'SRID=4326;POINT (14.428703308 50.130802155)'::geometry,'Větší hřiště se rozkládá, mezi ulicemi Toruňská a Gdaňská (29.A). Děti mohou vyzkoušet asi deset atrakcí. Atraktivní je...',42,'Bohnice a Čimice - Bohnice','Nedaleko od sebe leží 2 pěkná hřiště.','2022-03-09 10:17:31.063','2022-03-09 10:16:03.575','http://www.hristepraha.cz/hriste/mapa/bohnice-a-cimice-bohnice','http://www.hristepraha.cz/images/img/124f60c9d87bda76b3a42d3b6730bdf6o.jpg','Praha 8','Bohnice','Česko','Toruňská 326/3, 18100 Hlavní město Praha-Bohnice, Česko','Hlavní město Praha','18100','Toruňská 326/3'),
20
+ (3,'SRID=4326;POINT (14.338401794 50.048431396)'::geometry,'U stanice metra Lužiny se rozkládá rozlehlý park. Přestože je místy poněkud zanedbaný, stojí za návštěvu. Procházku...',66,'Centrální park Prahy 13','Chcete si prohlédnout Central park? Pak není nutné trmácet se do New Yorku. Stačí zajet na Lužiny!','2022-03-09 10:17:31.063','2022-03-09 10:16:03.575','http://www.hristepraha.cz/hriste/mapa/centralni-park-prahy-13','http://www.hristepraha.cz/images/img/9bf858de61f4e14add5c39a944b4b7fdo.jpg','Praha 13','Stodůlky','Česko','Pod Hranicí, 155 00 Hlavní město Praha-Stodůlky, Česko','Hlavní město Praha','155 00','Pod Hranicí'),
21
+ (4,'SRID=4326;POINT (14.572277069 50.105449677)'::geometry,'V zeleni u panelových domů, mezi ulicemi Breitcetlova a Šebelova (u mateřské školky), se rozkládá první areál (72.A)...',81,'Černý Most - hřiště 72.A','Na sídlišti Černý Most můžete nedaleko sebe navštívit dva menší areály s dětskými hřišti.','2022-03-09 10:17:31.063','2022-03-09 10:16:03.575','http://www.hristepraha.cz/hriste/mapa/cerny-most-hriste-72-a','http://www.hristepraha.cz/images/img/05884db0382d642111108750be85da6fo.jpg','Praha 14','Černý Most','Česko','Šebelova 875/4, 19800 Hlavní město Praha-Černý Most, Česko','Hlavní město Praha','19800','Šebelova 875/4');
22
+
23
+ INSERT INTO playgrounds.playground_properties (playground_id,properties_id,updated_at,created_at) VALUES
24
+ (1,4,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782'),
25
+ (1,9,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782'),
26
+ (2,9,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782'),
27
+ (3,5,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782'),
28
+ (3,6,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782'),
29
+ (3,8,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782'),
30
+ (4,5,'2022-03-09 10:17:31.782','2022-03-09 10:16:05.782');
@@ -0,0 +1,3 @@
1
+ {
2
+ "schema": "playgrounds, public"
3
+ }
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20220223135414-playgrounds-to-postgres-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20220223135414-playgrounds-to-postgres-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ DROP TABLE playground_properties;
2
+ DROP TABLE properties;
3
+ DROP TABLE playground;
@@ -0,0 +1,52 @@
1
+ -- playgrounds.properties definition
2
+
3
+ CREATE TABLE properties (
4
+ "id" int4 NOT NULL,
5
+ "description" text NULL,
6
+ "updated_at" timestamptz NOT NULL,
7
+ "created_at" timestamptz NOT NULL,
8
+ CONSTRAINT properties_pk PRIMARY KEY ("id")
9
+ );
10
+
11
+ -- playgrounds.playground definition
12
+
13
+ CREATE TABLE playground (
14
+ "internal_id" serial4 NOT NULL,
15
+ "location" geometry NULL,
16
+ "content" text NOT NULL,
17
+ "external_id" int4 NOT NULL,
18
+ "name" text NOT NULL,
19
+ "perex" text NULL,
20
+ "updated_at" timestamptz NOT NULL,
21
+ "created_at" timestamptz NOT NULL,
22
+ "url" text NOT NULL,
23
+ "image_url" text NOT NULL,
24
+ "district" text NULL,
25
+ "address_region" varchar NULL,
26
+ "address_country" varchar NULL,
27
+ "address_formatted" text NULL,
28
+ "address_locality" varchar NULL,
29
+ "postal_code" varchar NULL,
30
+ "street_address" varchar NULL,
31
+ CONSTRAINT playground_pkey PRIMARY KEY ("internal_id"),
32
+ CONSTRAINT playground_un UNIQUE ("external_id")
33
+ );
34
+ CREATE INDEX idx_playground_geom ON playground USING gist ("location");
35
+ CREATE INDEX playground_district_idx ON playground USING btree ("district");
36
+ CREATE UNIQUE INDEX playground_external_id_idx ON playground USING btree ("external_id");
37
+ CREATE INDEX playground_updated_at_idx ON playground USING btree ("updated_at");
38
+
39
+
40
+ -- playgrounds.playground_properties definition
41
+
42
+ CREATE TABLE playground_properties (
43
+ "playground_id" int4 NOT NULL,
44
+ "properties_id" int4 NOT NULL,
45
+ "updated_at" timestamptz NOT NULL,
46
+ "created_at" timestamptz NOT NULL,
47
+ CONSTRAINT playground_fk FOREIGN KEY ("playground_id") REFERENCES playground("internal_id") ON DELETE CASCADE,
48
+ CONSTRAINT playground_properties_fk FOREIGN KEY ("playground_id") REFERENCES playground("internal_id") ON DELETE CASCADE,
49
+ CONSTRAINT properties_fk FOREIGN KEY ("properties_id") REFERENCES properties("id") ON DELETE CASCADE,
50
+ CONSTRAINT playground_properties_pk PRIMARY KEY ("playground_id", "properties_id")
51
+ );
52
+
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * as IntegrationEngine from "./integration-engine/index";
2
2
  export * as OutputGateway from "./output-gateway/index";
3
- export * as SchemaDefinitions from "./schema-definitions/index";
package/dist/index.js CHANGED
@@ -19,9 +19,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.SchemaDefinitions = exports.OutputGateway = exports.IntegrationEngine = void 0;
22
+ exports.OutputGateway = exports.IntegrationEngine = void 0;
23
23
  // Library exports
24
24
  exports.IntegrationEngine = __importStar(require("./integration-engine/index"));
25
25
  exports.OutputGateway = __importStar(require("./output-gateway/index"));
26
- exports.SchemaDefinitions = __importStar(require("./schema-definitions/index"));
27
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,gFAA+C;AAC/C,wEAA2C;AAC3C,gFAAgD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,gFAA+C;AAC/C,wEAA2C"}
@@ -0,0 +1,5 @@
1
+ import { DataSource } from "@golemio/core/dist/integration-engine";
2
+ export declare class PlaygroundsDataSource {
3
+ private static dataSourceName;
4
+ static get: () => DataSource;
5
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PlaygroundsDataSource = void 0;
5
+ const SourceSchemaProvider_1 = require("../schema-definitions/json-schema/SourceSchemaProvider");
6
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
7
+ const config_1 = require("@golemio/core/dist/integration-engine/config");
8
+ const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
9
+ class PlaygroundsDataSource {
10
+ }
11
+ exports.PlaygroundsDataSource = PlaygroundsDataSource;
12
+ _a = PlaygroundsDataSource;
13
+ PlaygroundsDataSource.dataSourceName = "PlaygroundsDataSource";
14
+ PlaygroundsDataSource.get = () => {
15
+ return new integration_engine_1.DataSource(_a.dataSourceName, new integration_engine_1.HTTPProtocolStrategy({
16
+ headers: {},
17
+ method: "GET",
18
+ url: config_1.config.datasources.Playgrounds,
19
+ }), new integration_engine_1.JSONDataTypeStrategy({ resultsPath: "items" }), new golemio_validator_1.JSONSchemaValidator(_a.dataSourceName + "Validator", SourceSchemaProvider_1.SourceSchemaProvider.playground, true));
20
+ };
21
+ //# sourceMappingURL=PlaygroundsDataSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlaygroundsDataSource.js","sourceRoot":"","sources":["../../src/integration-engine/PlaygroundsDataSource.ts"],"names":[],"mappings":";;;;AAAA,iGAA6E;AAC7E,8EAA+G;AAC/G,yEAAsE;AACtE,mFAAkF;AAElF,MAAa,qBAAqB;;AAAlC,sDAeC;;AAdkB,oCAAc,GAAG,uBAAwB,CAAA;AAE1C,yBAAG,GAAG,GAAe,EAAE;IACjC,OAAO,IAAI,+BAAU,CACjB,EAAI,CAAC,cAAc,EACnB,IAAI,yCAAoB,CAAC;QACrB,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,eAAM,CAAC,WAAW,CAAC,WAAW;KACtC,CAAC,EACF,IAAI,yCAAoB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAClD,IAAI,uCAAmB,CAAC,EAAI,CAAC,cAAc,GAAG,WAAW,EAAE,2CAAoB,CAAC,UAAU,EAAE,IAAI,CAAC,CACpG,CAAC;AACN,CAAE,CAAA"}
@@ -1,6 +1,11 @@
1
+ import { ISourcePlayground } from "../schema-definitions/json-schema/interfaces/ISourcePlayground";
2
+ import { IPlayground } from "../schema-definitions/sequelize-models/interfaces/IPlayground";
3
+ import { IProperty } from "../schema-definitions/sequelize-models/interfaces/IProperty";
1
4
  import { BaseTransformation, ITransformation } from "@golemio/core/dist/integration-engine/transformations";
2
5
  export declare class PlaygroundsTransformation extends BaseTransformation implements ITransformation {
3
6
  name: string;
4
7
  constructor();
5
- protected transformElement: (element: any) => Promise<any>;
8
+ protected transformElement: (element: ISourcePlayground) => Promise<IPlayground>;
9
+ private removeIdentifier;
10
+ static getUniqueProperties: (playgroundsTransformedData: IPlayground[]) => IProperty[];
6
11
  }
@@ -10,41 +10,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PlaygroundsTransformation = void 0;
13
+ const PlaygroundsInfo_1 = require("../schema-definitions/PlaygroundsInfo");
13
14
  const transformations_1 = require("@golemio/core/dist/integration-engine/transformations");
14
- const index_1 = require("../schema-definitions/index");
15
15
  class PlaygroundsTransformation extends transformations_1.BaseTransformation {
16
16
  constructor() {
17
17
  super();
18
18
  this.transformElement = (element) => __awaiter(this, void 0, void 0, function* () {
19
- const res = {
20
- geometry: element.geometry,
21
- properties: {
22
- content: element.content,
23
- id: element.itemId,
24
- image: {
25
- url: element.image && element.image.originalUrl ? element.image.originalUrl : null,
26
- },
27
- name: element.title.replace(/\d{1,2}\.(\D){0,1} /g, ""),
28
- perex: element.perex ? element.perex : null,
29
- properties: [],
30
- updated_at: new Date().getTime(),
31
- url: element.url,
32
- },
33
- type: "Feature",
19
+ const playground = {
20
+ location: element.geometry,
21
+ image_url: element.image && element.image.originalUrl ? element.image.originalUrl : null,
22
+ content: element.content,
23
+ external_id: element.itemId,
24
+ name: this.removeIdentifier(element.title),
25
+ perex: element.perex ? element.perex : "",
26
+ url: element.url,
34
27
  };
35
- if (element.category) {
36
- const properties = element.category.map((cat) => __awaiter(this, void 0, void 0, function* () {
37
- return {
38
- description: cat.nazev,
39
- id: cat.id,
40
- };
41
- }));
42
- res.properties.properties = yield Promise.all(properties);
43
- }
44
- return res;
28
+ playground.properties = element.category.map((element) => {
29
+ return {
30
+ id: element.id,
31
+ description: element.nazev,
32
+ };
33
+ });
34
+ return playground;
45
35
  });
46
- this.name = index_1.Playgrounds.name;
36
+ this.name = PlaygroundsInfo_1.PlaygroundsInfo.moduleName;
37
+ }
38
+ removeIdentifier(title) {
39
+ return title.replace(/\d{1,2}\.(\D){0,1} /g, "");
47
40
  }
48
41
  }
49
42
  exports.PlaygroundsTransformation = PlaygroundsTransformation;
43
+ PlaygroundsTransformation.getUniqueProperties = (playgroundsTransformedData) => {
44
+ const result = [];
45
+ for (let index = 0; index < playgroundsTransformedData.length; index++) {
46
+ const element = playgroundsTransformedData[index];
47
+ if (element.properties) {
48
+ for (let index = 0; index < element.properties.length; index++) {
49
+ const property = element.properties[index];
50
+ if (result.every((element) => element.id != property.id)) {
51
+ result.push(property);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ return result;
57
+ };
50
58
  //# sourceMappingURL=PlaygroundsTransformation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlaygroundsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/PlaygroundsTransformation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2FAA4G;AAC5G,uDAAyC;AAEzC,MAAa,yBAA0B,SAAQ,oCAAkB;IAG7D;QACI,KAAK,EAAE,CAAC;QAIF,qBAAgB,GAAG,CAAO,OAAY,EAAgB,EAAE;YAC9D,MAAM,GAAG,GAAwB;gBAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,UAAU,EAAE;oBACR,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,EAAE,EAAE,OAAO,CAAC,MAAM;oBAClB,KAAK,EAAE;wBACH,GAAG,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;qBACrF;oBACD,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;oBACvD,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;oBAC3C,UAAU,EAAE,EAAE;oBACd,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;oBAChC,GAAG,EAAE,OAAO,CAAC,GAAG;iBACnB;gBACD,IAAI,EAAE,SAAS;aAClB,CAAC;YACF,IAAI,OAAO,CAAC,QAAQ,EAAE;gBAClB,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAO,GAAwB,EAAE,EAAE;oBACvE,OAAO;wBACH,WAAW,EAAE,GAAG,CAAC,KAAK;wBACtB,EAAE,EAAE,GAAG,CAAC,EAAE;qBACb,CAAC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AAC;YAEH,OAAO,UAAU,CAAC;QACtB,CAAC,CAAA,CAAC;QAtBE,IAAI,CAAC,IAAI,GAAG,iCAAe,CAAC,UAAU,CAAC;IAC3C,CAAC;IAuBO,gBAAgB,CAAC,KAAa;QAClC,OAAO,KAAK,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;;AA/BL,8DAiDC;AAhBiB,6CAAmB,GAAG,CAAC,0BAAyC,EAAe,EAAE;IAC3F,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,0BAA0B,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACpE,MAAM,OAAO,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,OAAO,CAAC,UAAU,EAAE;YACpB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBAC3C,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE;oBACtD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACzB;aACJ;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Playground } from "../schema-definitions/sequelize-models/Playground";
1
2
  import { BaseWorker } from "@golemio/core/dist/integration-engine/workers";
2
3
  export declare class PlaygroundsWorker extends BaseWorker {
3
4
  private dataSource;
@@ -7,5 +8,10 @@ export declare class PlaygroundsWorker extends BaseWorker {
7
8
  private cityDistrictsModel;
8
9
  constructor();
9
10
  refreshDataInDB: (msg: any) => Promise<void>;
10
- updateAddressAndDistrict: (msg: any) => Promise<void>;
11
+ updateAddressAndDistrict: (msg: any) => Promise<Playground>;
12
+ private savePlaygroundsData;
13
+ private validateAndSavePlaygrounds;
14
+ private validateAndSaveProperties;
15
+ private getTransformedDataWithId;
16
+ private getPlaygroundPropertyRelationData;
11
17
  }
@@ -10,103 +10,136 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PlaygroundsWorker = void 0;
13
- const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
14
- const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
13
+ const PlaygroundsInfo_1 = require("../schema-definitions/PlaygroundsInfo");
14
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
15
15
  const config_1 = require("@golemio/core/dist/integration-engine/config");
16
- const datasources_1 = require("@golemio/core/dist/integration-engine/datasources");
17
- const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
18
- const models_1 = require("@golemio/core/dist/integration-engine/models");
19
16
  const workers_1 = require("@golemio/core/dist/integration-engine/workers");
20
- const schema_definitions_1 = require("@golemio/city-districts/dist/schema-definitions");
21
- const index_1 = require("../schema-definitions/index");
17
+ const errors_1 = require("@golemio/errors");
22
18
  const _1 = require("./");
19
+ const AddressHelper_1 = require("./helpers/AddressHelper");
20
+ const CityDistrictsModel_1 = require("./models/CityDistrictsModel");
21
+ const PlaygroundsModel_1 = require("./models/PlaygroundsModel");
22
+ const PlaygroundsDataSource_1 = require("./PlaygroundsDataSource");
23
23
  class PlaygroundsWorker extends workers_1.BaseWorker {
24
24
  constructor() {
25
25
  super();
26
26
  this.refreshDataInDB = (msg) => __awaiter(this, void 0, void 0, function* () {
27
- const data = yield this.dataSource.getAll();
28
- const transformedData = yield this.transformation.transform(data);
29
- yield this.model.save(transformedData);
30
- // send messages for updating district and address and average occupancy
31
- const promises = transformedData.map((p) => {
32
- this.sendMessageToExchange("workers." + this.queuePrefix + ".updateAddressAndDistrict", JSON.stringify(p));
33
- });
34
- yield Promise.all(promises);
27
+ try {
28
+ const playgroundIdsForLocationSync = yield this.savePlaygroundsData();
29
+ // send messages for updating district and address and average occupancy
30
+ const promises = playgroundIdsForLocationSync.map((external_id) => {
31
+ this.sendMessageToExchange("workers." + this.queuePrefix + ".updateAddressAndDistrict", JSON.stringify({ external_id: external_id }));
32
+ });
33
+ yield Promise.all(promises);
34
+ }
35
+ catch (exception) {
36
+ throw exception instanceof errors_1.CustomError
37
+ ? exception
38
+ : new errors_1.CustomError("Error while refreshing playgrounds data", true, this.constructor.name, undefined, exception);
39
+ }
35
40
  });
36
41
  this.updateAddressAndDistrict = (msg) => __awaiter(this, void 0, void 0, function* () {
37
- const inputData = JSON.parse(msg.content.toString());
38
- const id = inputData.properties.id;
39
- const dbData = yield this.model.findOneById(id);
40
- if (!dbData.properties.district ||
41
- inputData.geometry.coordinates[0] !== dbData.geometry.coordinates[0] ||
42
- inputData.geometry.coordinates[1] !== dbData.geometry.coordinates[1]) {
43
- try {
44
- const result = yield this.cityDistrictsModel.findOne({
45
- // find district by coordinates
46
- geometry: {
47
- $geoIntersects: {
48
- $geometry: {
49
- coordinates: dbData.geometry.coordinates,
50
- type: "Point",
51
- },
52
- },
53
- },
54
- });
55
- dbData.properties.district = result ? result.properties.slug : null;
56
- yield dbData.save();
42
+ const playground = JSON.parse(msg.content.toString());
43
+ if (playground.external_id) {
44
+ const dbData = (yield this.model.findOne({
45
+ where: { external_id: playground.external_id },
46
+ }));
47
+ yield AddressHelper_1.AddressHelper.updateDistrict(dbData, this.cityDistrictsModel);
48
+ yield AddressHelper_1.AddressHelper.updateAddress(dbData);
49
+ return dbData;
50
+ }
51
+ else {
52
+ throw new errors_1.CustomError("Unknown type of message for playground address and district type", true, this.constructor.name);
53
+ }
54
+ });
55
+ this.getTransformedDataWithId = () => __awaiter(this, void 0, void 0, function* () {
56
+ const data = yield this.dataSource.getAll();
57
+ const transformedData = yield this.transformation.transform(data);
58
+ const dataIdsWithNewLocation = [];
59
+ for (let index = 0; index < transformedData.length; index++) {
60
+ const playground = transformedData[index];
61
+ const dbPlayground = yield this.model.getPlayground(playground.external_id);
62
+ // get internal ids for already existing data
63
+ if (dbPlayground) {
64
+ playground.internal_id = dbPlayground.internal_id;
65
+ if (AddressHelper_1.AddressHelper.needsUpdate(playground, dbPlayground)) {
66
+ dataIdsWithNewLocation.push(playground.external_id);
67
+ }
57
68
  }
58
- catch (err) {
59
- throw new golemio_errors_1.CustomError("Error while updating district.", true, this.constructor.name, 5001, err);
69
+ else {
70
+ // new playground
71
+ dataIdsWithNewLocation.push(playground.external_id);
60
72
  }
61
73
  }
62
- if (!dbData.properties.address ||
63
- !dbData.properties.address.address_formatted ||
64
- inputData.geometry.coordinates[0] !== dbData.geometry.coordinates[0] ||
65
- inputData.geometry.coordinates[1] !== dbData.geometry.coordinates[1]) {
66
- try {
67
- const address = yield helpers_1.GeocodeApi.getAddressByLatLng(dbData.geometry.coordinates[1], dbData.geometry.coordinates[0]);
68
- dbData.properties.address = address;
69
- yield dbData.save();
70
- }
71
- catch (err) {
72
- throw new golemio_errors_1.CustomError("Error while updating address.", true, this.constructor.name, 5001, err);
74
+ return { transformedData: transformedData, playgroundIdsForLocationSync: dataIdsWithNewLocation };
75
+ });
76
+ this.getPlaygroundPropertyRelationData = (playgroundsTransformedData, t) => __awaiter(this, void 0, void 0, function* () {
77
+ var _a;
78
+ const result = [];
79
+ for (let index = 0; index < playgroundsTransformedData.length; index++) {
80
+ const element = playgroundsTransformedData[index];
81
+ const internalId = (_a = element.internal_id) !== null && _a !== void 0 ? _a : (yield this.model.getPlaygroundId(element.external_id, t));
82
+ if (element.properties) {
83
+ for (let index = 0; index < element.properties.length; index++) {
84
+ const property = element.properties[index];
85
+ if (internalId) {
86
+ result.push({
87
+ playground_id: internalId,
88
+ properties_id: property.id,
89
+ });
90
+ }
91
+ }
73
92
  }
74
93
  }
75
- return dbData;
94
+ return result;
76
95
  });
77
- this.dataSource = new datasources_1.DataSource(index_1.Playgrounds.name + "DataSource", new datasources_1.HTTPProtocolStrategy({
78
- headers: {},
79
- method: "GET",
80
- url: config_1.config.datasources.Playgrounds,
81
- }), new datasources_1.JSONDataTypeStrategy({ resultsPath: "items" }), new golemio_validator_1.Validator(index_1.Playgrounds.name + "DataSource", index_1.Playgrounds.datasourceMongooseSchemaObject));
82
- this.model = new models_1.MongoModel(index_1.Playgrounds.name + "Model", {
83
- identifierPath: "properties.id",
84
- mongoCollectionName: index_1.Playgrounds.mongoCollectionName,
85
- outputMongooseSchemaObject: index_1.Playgrounds.outputMongooseSchemaObject,
86
- resultsPath: "properties",
87
- savingType: "insertOrUpdate",
88
- searchPath: (id, multiple) => (multiple ? { "properties.id": { $in: id } } : { "properties.id": id }),
89
- updateValues: (a, b) => {
90
- a.properties.name = b.properties.name;
91
- a.properties.url = b.properties.url;
92
- a.properties.perex = b.properties.perex;
93
- a.properties.content = b.properties.content;
94
- a.properties.image = b.properties.image;
95
- a.properties.properties = b.properties.properties;
96
- a.properties.updated_at = b.properties.updated_at;
97
- return a;
98
- },
99
- }, new golemio_validator_1.Validator(index_1.Playgrounds.name + "ModelValidator", index_1.Playgrounds.outputMongooseSchemaObject));
96
+ this.dataSource = PlaygroundsDataSource_1.PlaygroundsDataSource.get();
97
+ this.model = new PlaygroundsModel_1.PlaygroundsModel();
100
98
  this.transformation = new _1.PlaygroundsTransformation();
101
- this.queuePrefix = config_1.config.RABBIT_EXCHANGE_NAME + "." + index_1.Playgrounds.name.toLowerCase();
102
- this.cityDistrictsModel = new models_1.MongoModel(schema_definitions_1.CityDistricts.name + "Model", {
103
- identifierPath: "properties.id",
104
- mongoCollectionName: schema_definitions_1.CityDistricts.mongoCollectionName,
105
- outputMongooseSchemaObject: schema_definitions_1.CityDistricts.outputMongooseSchemaObject,
106
- resultsPath: "properties",
107
- savingType: "readOnly",
108
- searchPath: (id, multiple) => (multiple ? { "properties.id": { $in: id } } : { "properties.id": id }),
109
- }, new golemio_validator_1.Validator(schema_definitions_1.CityDistricts.name + "ModelValidator", schema_definitions_1.CityDistricts.outputMongooseSchemaObject));
99
+ this.queuePrefix = config_1.config.RABBIT_EXCHANGE_NAME + "." + PlaygroundsInfo_1.PlaygroundsInfo.moduleName.toLowerCase();
100
+ this.cityDistrictsModel = new CityDistrictsModel_1.CityDistrictsModel();
101
+ }
102
+ savePlaygroundsData() {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ const connection = integration_engine_1.PostgresConnector.getConnection();
105
+ const t = yield connection.transaction();
106
+ try {
107
+ const result = yield this.getTransformedDataWithId();
108
+ yield this.validateAndSavePlaygrounds(result.transformedData, t);
109
+ yield this.validateAndSaveProperties(result.transformedData, t);
110
+ yield t.commit();
111
+ return result.playgroundIdsForLocationSync;
112
+ }
113
+ catch (err) {
114
+ yield t.rollback();
115
+ throw err;
116
+ }
117
+ });
118
+ }
119
+ validateAndSavePlaygrounds(transformedData, t) {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ this.model.validate(transformedData);
122
+ const promises = transformedData.map((playground) => __awaiter(this, void 0, void 0, function* () {
123
+ yield this.model["sequelizeModel"].upsert(Object.assign({}, playground), { transaction: t });
124
+ }));
125
+ yield Promise.all(promises);
126
+ });
127
+ }
128
+ validateAndSaveProperties(transformedData, t) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ const propertiesData = _1.PlaygroundsTransformation.getUniqueProperties(transformedData);
131
+ const propertiesRelationData = yield this.getPlaygroundPropertyRelationData(transformedData, t);
132
+ this.model.propertiesModel.validate(propertiesData);
133
+ this.model.playgroundPropertyModel.validate(propertiesRelationData);
134
+ const promises = propertiesData.map((property) => __awaiter(this, void 0, void 0, function* () {
135
+ yield this.model.propertiesModel["sequelizeModel"].upsert(Object.assign({}, property), { transaction: t });
136
+ }));
137
+ yield Promise.all(promises);
138
+ const promises2 = propertiesRelationData.map((playgroundProperty) => __awaiter(this, void 0, void 0, function* () {
139
+ yield this.model.playgroundPropertyModel["sequelizeModel"].upsert(Object.assign({}, playgroundProperty), { transaction: t });
140
+ }));
141
+ yield Promise.all(promises2);
142
+ });
110
143
  }
111
144
  }
112
145
  exports.PlaygroundsWorker = PlaygroundsWorker;
@@ -1 +1 @@
1
- {"version":3,"file":"PlaygroundsWorker.js","sourceRoot":"","sources":["../../src/integration-engine/PlaygroundsWorker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAuE;AACvE,mFAAwE;AACxE,yEAAsE;AACtE,mFAA2H;AAC3H,2EAA2E;AAC3E,yEAA0E;AAC1E,2EAA2E;AAC3E,wFAAgF;AAChF,uDAAyC;AACzC,yBAA+C;AAE/C,MAAa,iBAAkB,SAAQ,oBAAU;IAO7C;QACI,KAAK,EAAE,CAAC;QAiDL,oBAAe,GAAG,CAAO,GAAQ,EAAiB,EAAE;YACvD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC5C,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAClE,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAEvC,wEAAwE;YACxE,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE;gBAC5C,IAAI,CAAC,qBAAqB,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,GAAG,2BAA2B,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/G,CAAC,CAAC,CAAC;YACH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC,CAAA,CAAC;QAEK,6BAAwB,GAAG,CAAO,GAAQ,EAAiB,EAAE;YAChE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YACrD,MAAM,EAAE,GAAG,SAAS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