@messenger-box/property-ext-server 0.0.1-alpha.187 → 0.0.1-alpha.195
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/config.d.ts +5 -0
- package/lib/config/index.d.ts +1 -0
- package/lib/containers/container.d.ts +2 -0
- package/lib/containers/index.d.ts +1 -0
- package/lib/graphql/index.d.ts +1 -0
- package/lib/graphql/schema/index.d.ts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +562 -0
- package/lib/index.js.map +1 -1
- package/lib/migrations/bot-user-migration.d.ts +12 -0
- package/lib/migrations/index.d.ts +2 -0
- package/lib/migrations/property-ext-messages-migration.d.ts +18 -0
- package/lib/module.d.ts +3 -0
- package/package.json +6 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './container';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { schema } from './schema';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const schema: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './module';
|
package/lib/index.js
CHANGED
|
@@ -87,14 +87,576 @@ module.exports =
|
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
+
/***/ "./src/config/config.ts":
|
|
91
|
+
/*!******************************!*\
|
|
92
|
+
!*** ./src/config/config.ts ***!
|
|
93
|
+
\******************************/
|
|
94
|
+
/*! no static exports found */
|
|
95
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
96
|
+
|
|
97
|
+
"use strict";
|
|
98
|
+
|
|
99
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
100
|
+
exports.config = void 0;
|
|
101
|
+
const envalid_1 = __webpack_require__(/*! envalid */ "envalid");
|
|
102
|
+
const env = process.APP_ENV || process.env;
|
|
103
|
+
exports.config = envalid_1.cleanEnv(env, {
|
|
104
|
+
NODE_ENV: envalid_1.str({ choices: ['production', 'test', 'staging', 'development'], default: 'production' }),
|
|
105
|
+
POST_DATA_FILE_PATH: envalid_1.str({
|
|
106
|
+
default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/post.json',
|
|
107
|
+
}),
|
|
108
|
+
CHANNEL_DATA_FILE_PATH: envalid_1.str({
|
|
109
|
+
default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/channel.json',
|
|
110
|
+
}),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/***/ }),
|
|
115
|
+
|
|
116
|
+
/***/ "./src/config/index.ts":
|
|
117
|
+
/*!*****************************!*\
|
|
118
|
+
!*** ./src/config/index.ts ***!
|
|
119
|
+
\*****************************/
|
|
120
|
+
/*! no static exports found */
|
|
121
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
122
|
+
|
|
123
|
+
"use strict";
|
|
124
|
+
|
|
125
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
126
|
+
if (k2 === undefined) k2 = k;
|
|
127
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
128
|
+
}) : (function(o, m, k, k2) {
|
|
129
|
+
if (k2 === undefined) k2 = k;
|
|
130
|
+
o[k2] = m[k];
|
|
131
|
+
}));
|
|
132
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
133
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
134
|
+
};
|
|
135
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
136
|
+
__exportStar(__webpack_require__(/*! ./config */ "./src/config/config.ts"), exports);
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/***/ }),
|
|
140
|
+
|
|
141
|
+
/***/ "./src/containers/container.ts":
|
|
142
|
+
/*!*************************************!*\
|
|
143
|
+
!*** ./src/containers/container.ts ***!
|
|
144
|
+
\*************************************/
|
|
145
|
+
/*! no static exports found */
|
|
146
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
147
|
+
|
|
148
|
+
"use strict";
|
|
149
|
+
|
|
150
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
151
|
+
exports.propertyContainerModule = void 0;
|
|
152
|
+
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
153
|
+
const migrations_1 = __webpack_require__(/*! ../migrations */ "./src/migrations/index.ts");
|
|
154
|
+
const propertyContainerModule = () => new inversify_1.ContainerModule((bind) => {
|
|
155
|
+
bind('MongodbMigration').to(migrations_1.BotUserMigration).whenTargetNamed(migrations_1.BotUserMigration.name);
|
|
156
|
+
bind('MongodbMigration').to(migrations_1.PropertyExtMessagesMigration).whenTargetNamed(migrations_1.PropertyExtMessagesMigration.name);
|
|
157
|
+
});
|
|
158
|
+
exports.propertyContainerModule = propertyContainerModule;
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
/***/ }),
|
|
162
|
+
|
|
163
|
+
/***/ "./src/containers/index.ts":
|
|
164
|
+
/*!*********************************!*\
|
|
165
|
+
!*** ./src/containers/index.ts ***!
|
|
166
|
+
\*********************************/
|
|
167
|
+
/*! no static exports found */
|
|
168
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
169
|
+
|
|
170
|
+
"use strict";
|
|
171
|
+
|
|
172
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
173
|
+
if (k2 === undefined) k2 = k;
|
|
174
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
175
|
+
}) : (function(o, m, k, k2) {
|
|
176
|
+
if (k2 === undefined) k2 = k;
|
|
177
|
+
o[k2] = m[k];
|
|
178
|
+
}));
|
|
179
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
180
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
181
|
+
};
|
|
182
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
183
|
+
__exportStar(__webpack_require__(/*! ./container */ "./src/containers/container.ts"), exports);
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
/***/ }),
|
|
187
|
+
|
|
188
|
+
/***/ "./src/graphql/index.ts":
|
|
189
|
+
/*!******************************!*\
|
|
190
|
+
!*** ./src/graphql/index.ts ***!
|
|
191
|
+
\******************************/
|
|
192
|
+
/*! no static exports found */
|
|
193
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
194
|
+
|
|
195
|
+
"use strict";
|
|
196
|
+
|
|
197
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
198
|
+
exports.schema = void 0;
|
|
199
|
+
var schema_1 = __webpack_require__(/*! ./schema */ "./src/graphql/schema/index.ts");
|
|
200
|
+
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return schema_1.schema; } });
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
/***/ }),
|
|
204
|
+
|
|
205
|
+
/***/ "./src/graphql/schema/index.ts":
|
|
206
|
+
/*!*************************************!*\
|
|
207
|
+
!*** ./src/graphql/schema/index.ts ***!
|
|
208
|
+
\*************************************/
|
|
209
|
+
/*! no static exports found */
|
|
210
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
211
|
+
|
|
212
|
+
"use strict";
|
|
213
|
+
|
|
214
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
215
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
216
|
+
};
|
|
217
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
218
|
+
exports.schema = void 0;
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
220
|
+
// @ts-nocheck
|
|
221
|
+
const post_graphql_1 = __importDefault(__webpack_require__(/*! ./post.graphql */ "./src/graphql/schema/post.graphql"));
|
|
222
|
+
exports.schema = [post_graphql_1.default].join('/n');
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
/***/ }),
|
|
226
|
+
|
|
227
|
+
/***/ "./src/graphql/schema/post.graphql":
|
|
228
|
+
/*!*****************************************!*\
|
|
229
|
+
!*** ./src/graphql/schema/post.graphql ***!
|
|
230
|
+
\*****************************************/
|
|
231
|
+
/*! exports provided: default */
|
|
232
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
233
|
+
|
|
234
|
+
"use strict";
|
|
235
|
+
__webpack_require__.r(__webpack_exports__);
|
|
236
|
+
/* harmony default export */ __webpack_exports__["default"] = ("extend enum PostTypeEnum{\n ALERT\n CARD\n}\n");
|
|
237
|
+
|
|
238
|
+
/***/ }),
|
|
239
|
+
|
|
90
240
|
/***/ "./src/index.ts":
|
|
91
241
|
/*!**********************!*\
|
|
92
242
|
!*** ./src/index.ts ***!
|
|
93
243
|
\**********************/
|
|
94
244
|
/*! no static exports found */
|
|
245
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
246
|
+
|
|
247
|
+
"use strict";
|
|
248
|
+
|
|
249
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
250
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
251
|
+
};
|
|
252
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
253
|
+
exports.default = void 0;
|
|
254
|
+
var module_1 = __webpack_require__(/*! ./module */ "./src/module.ts");
|
|
255
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(module_1).default; } });
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
/***/ }),
|
|
259
|
+
|
|
260
|
+
/***/ "./src/migrations/bot-user-migration.ts":
|
|
261
|
+
/*!**********************************************!*\
|
|
262
|
+
!*** ./src/migrations/bot-user-migration.ts ***!
|
|
263
|
+
\**********************************************/
|
|
264
|
+
/*! no static exports found */
|
|
265
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
266
|
+
|
|
267
|
+
"use strict";
|
|
268
|
+
|
|
269
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
270
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
271
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
272
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
273
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
274
|
+
};
|
|
275
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
276
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
277
|
+
};
|
|
278
|
+
var BotUserMigration_1;
|
|
279
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
280
|
+
exports.BotUserMigration = void 0;
|
|
281
|
+
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
282
|
+
const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
|
|
283
|
+
const config_1 = __webpack_require__(/*! ../config */ "./src/config/index.ts");
|
|
284
|
+
let BotUserMigration = BotUserMigration_1 = class BotUserMigration {
|
|
285
|
+
constructor(broker, logger) {
|
|
286
|
+
this.broker = broker;
|
|
287
|
+
this.logger = logger;
|
|
288
|
+
this.name = 'BotUserMigration';
|
|
289
|
+
this.id = `${this.constructor.name}_20220502`;
|
|
290
|
+
this.logger = logger.child({ className: BotUserMigration_1.name });
|
|
291
|
+
}
|
|
292
|
+
async up() {
|
|
293
|
+
await this.down();
|
|
294
|
+
this.logger.debug(`(up) Starting up migration...`);
|
|
295
|
+
const user = await this.broker.call(`AccountUser.createAccount`, {
|
|
296
|
+
account: {
|
|
297
|
+
username: 'resortifi',
|
|
298
|
+
email: 'resortifi-bot@resortifi.com',
|
|
299
|
+
alias: 'resortifi',
|
|
300
|
+
emailVerified: true,
|
|
301
|
+
notificationEmail: '',
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
this.logger.debug(`(up) done`, user);
|
|
305
|
+
}
|
|
306
|
+
async down() {
|
|
307
|
+
if (config_1.config.isDev) {
|
|
308
|
+
await this.broker.waitForServices('AccountUser');
|
|
309
|
+
}
|
|
310
|
+
this.logger.debug(`(down) Starting down migration...`);
|
|
311
|
+
const user = await this.broker.call(`AccountUser.findAccountByEmail`, {
|
|
312
|
+
email: 'resortifi-bot@resortifi.com',
|
|
313
|
+
});
|
|
314
|
+
if (!user) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
this.logger.debug(`(down) User Found, dropping...`, user);
|
|
318
|
+
await this.broker.call(`AccountUser.deleteAccount`, {
|
|
319
|
+
account: {
|
|
320
|
+
id: user.id,
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
this.logger.debug(`(down) User drop done!`);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
BotUserMigration = BotUserMigration_1 = __decorate([
|
|
327
|
+
inversify_1.injectable(),
|
|
328
|
+
__param(0, inversify_1.inject(core_1.CommonType.MOLECULER_BROKER)),
|
|
329
|
+
__param(1, inversify_1.inject('Logger'))
|
|
330
|
+
], BotUserMigration);
|
|
331
|
+
exports.BotUserMigration = BotUserMigration;
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
/***/ }),
|
|
335
|
+
|
|
336
|
+
/***/ "./src/migrations/index.ts":
|
|
337
|
+
/*!*********************************!*\
|
|
338
|
+
!*** ./src/migrations/index.ts ***!
|
|
339
|
+
\*********************************/
|
|
340
|
+
/*! no static exports found */
|
|
341
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
342
|
+
|
|
343
|
+
"use strict";
|
|
344
|
+
|
|
345
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
346
|
+
exports.BotUserMigration = exports.PropertyExtMessagesMigration = void 0;
|
|
347
|
+
var property_ext_messages_migration_1 = __webpack_require__(/*! ./property-ext-messages-migration */ "./src/migrations/property-ext-messages-migration.ts");
|
|
348
|
+
Object.defineProperty(exports, "PropertyExtMessagesMigration", { enumerable: true, get: function () { return property_ext_messages_migration_1.PropertyExtMessagesMigration; } });
|
|
349
|
+
var bot_user_migration_1 = __webpack_require__(/*! ./bot-user-migration */ "./src/migrations/bot-user-migration.ts");
|
|
350
|
+
Object.defineProperty(exports, "BotUserMigration", { enumerable: true, get: function () { return bot_user_migration_1.BotUserMigration; } });
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
/***/ }),
|
|
354
|
+
|
|
355
|
+
/***/ "./src/migrations/property-ext-messages-migration.ts":
|
|
356
|
+
/*!***********************************************************!*\
|
|
357
|
+
!*** ./src/migrations/property-ext-messages-migration.ts ***!
|
|
358
|
+
\***********************************************************/
|
|
359
|
+
/*! no static exports found */
|
|
360
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
361
|
+
|
|
362
|
+
"use strict";
|
|
363
|
+
|
|
364
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
365
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
366
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
367
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
368
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
369
|
+
};
|
|
370
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
371
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
372
|
+
};
|
|
373
|
+
var PropertyExtMessagesMigration_1;
|
|
374
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
375
|
+
exports.PropertyExtMessagesMigration = void 0;
|
|
376
|
+
const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
|
|
377
|
+
const core_1 = __webpack_require__(/*! @common-stack/core */ "@common-stack/core");
|
|
378
|
+
const property_ext_core_1 = __webpack_require__(/*! @messenger-box/property-ext-core */ "@messenger-box/property-ext-core");
|
|
379
|
+
const core_2 = __webpack_require__(/*! @messenger-box/core */ "@messenger-box/core");
|
|
380
|
+
const config_1 = __webpack_require__(/*! ../config */ "./src/config/index.ts");
|
|
381
|
+
let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class PropertyExtMessagesMigration {
|
|
382
|
+
constructor(broker, logger) {
|
|
383
|
+
this.broker = broker;
|
|
384
|
+
this.logger = logger;
|
|
385
|
+
this.name = 'PropertyExtMessagesMigration';
|
|
386
|
+
this.logger = logger.child({ className: PropertyExtMessagesMigration_1.name });
|
|
387
|
+
}
|
|
388
|
+
async createUsers() {
|
|
389
|
+
const userOne = this.broker.call(`AccountUser.createAccount`, {
|
|
390
|
+
account: {
|
|
391
|
+
username: 'propertyAutomatedUser',
|
|
392
|
+
email: 'property-automated-user@resortifi.com',
|
|
393
|
+
alias: 'propertyAutomatedUser',
|
|
394
|
+
emailVerified: true,
|
|
395
|
+
notificationEmail: '',
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
const userTwo = this.broker.call(`AccountUser.createAccount`, {
|
|
399
|
+
account: {
|
|
400
|
+
username: 'propertyAutomatedUser2',
|
|
401
|
+
email: 'property-automated-user2@resortifi.com',
|
|
402
|
+
alias: 'propertyAutomatedUser2',
|
|
403
|
+
emailVerified: true,
|
|
404
|
+
notificationEmail: '',
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
return Promise.all([userOne, userTwo]);
|
|
408
|
+
}
|
|
409
|
+
createChannel(owner, guest) {
|
|
410
|
+
return this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.create}`, {
|
|
411
|
+
data: {
|
|
412
|
+
topic: 'Fixtures',
|
|
413
|
+
title: `${owner.alias}:${guest.alias}`,
|
|
414
|
+
creator: guest.id,
|
|
415
|
+
displayName: `${owner.alias}:${guest.alias}`,
|
|
416
|
+
type: core_2.IRoomType.DIRECT,
|
|
417
|
+
members: [
|
|
418
|
+
{
|
|
419
|
+
id: undefined,
|
|
420
|
+
schemeAdmin: false,
|
|
421
|
+
roles: 'OWNER',
|
|
422
|
+
user: owner.id,
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
id: undefined,
|
|
426
|
+
schemeAdmin: true,
|
|
427
|
+
roles: 'GUEST',
|
|
428
|
+
user: guest.id,
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
async createSimpleMessage(channelId, editedBy) {
|
|
435
|
+
return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
|
|
436
|
+
data: {
|
|
437
|
+
editedBy: editedBy,
|
|
438
|
+
channel: channelId,
|
|
439
|
+
message: 'Hello from the migrations',
|
|
440
|
+
type: property_ext_core_1.IPostTypeEnum.Simple,
|
|
441
|
+
files: [],
|
|
442
|
+
},
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
async createAlertMessage(channelId, editedBy) {
|
|
446
|
+
const message = 'This is a dummy alert!';
|
|
447
|
+
return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
|
|
448
|
+
data: {
|
|
449
|
+
editedBy: editedBy,
|
|
450
|
+
channel: channelId,
|
|
451
|
+
message,
|
|
452
|
+
type: property_ext_core_1.IPostTypeEnum.ALERT,
|
|
453
|
+
files: [],
|
|
454
|
+
props: {
|
|
455
|
+
ref: 'Dummy',
|
|
456
|
+
refId: 'some-ref',
|
|
457
|
+
attachment: {
|
|
458
|
+
title: message,
|
|
459
|
+
isTitleHtml: false,
|
|
460
|
+
icon: 'InfoIcon',
|
|
461
|
+
callToAction: {
|
|
462
|
+
title: 'View',
|
|
463
|
+
link: `/some-route/some-id`,
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
async createCardMessage(channelId, editedBy) {
|
|
471
|
+
const message = 'Inquiry for fixture property';
|
|
472
|
+
return this.broker.call(`${core_2.IMoleculerTopics.PostService}.${core_2.IBaseServiceCommands.create}`, {
|
|
473
|
+
data: {
|
|
474
|
+
editedBy: editedBy,
|
|
475
|
+
channel: channelId,
|
|
476
|
+
message,
|
|
477
|
+
type: property_ext_core_1.IPostTypeEnum.CARD,
|
|
478
|
+
files: [],
|
|
479
|
+
props: {
|
|
480
|
+
ref: 'Property',
|
|
481
|
+
refId: 'some-property-id',
|
|
482
|
+
attachment: {
|
|
483
|
+
image: 'https://placehold.co/300',
|
|
484
|
+
title: message,
|
|
485
|
+
isTitleHtml: false,
|
|
486
|
+
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis interdum leo augue, non posuere sapien ullamcorper ac. Aliquam vitae ornare libero, ac vulputate elit. Aenean interdum, mi a viverra maximus, leo nibh maximus augue, vel ultrices leo ante et ex. Maecenas vel mi auctor, egestas tellus nec, placerat odio. Curabitur eget tortor sed ligula pharetra varius. Aliquam sit amet lacus ligula. Etiam vitae magna eros.',
|
|
487
|
+
isDescriptionHtml: false,
|
|
488
|
+
callToAction: {
|
|
489
|
+
title: 'View',
|
|
490
|
+
// Should come from frontend
|
|
491
|
+
link: `/property/some-id`,
|
|
492
|
+
},
|
|
493
|
+
property: {
|
|
494
|
+
price: 10,
|
|
495
|
+
priceType: 'Hourly',
|
|
496
|
+
type: 'Hotel',
|
|
497
|
+
totalStar: 5,
|
|
498
|
+
maxPeople: 500,
|
|
499
|
+
totalReview: 450,
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
async waitForServices() {
|
|
507
|
+
if (config_1.config.isDev) {
|
|
508
|
+
await this.broker.waitForServices('AccountUser');
|
|
509
|
+
await this.broker.waitForServices(`${core_2.IMoleculerTopics.ChannelService}`);
|
|
510
|
+
await this.broker.waitForServices(`${core_2.IMoleculerTopics.PostService}`);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
async up() {
|
|
514
|
+
await this.waitForServices();
|
|
515
|
+
await this.down();
|
|
516
|
+
this.logger.debug(`(up) Starting up migration...`);
|
|
517
|
+
const users = await this.createUsers();
|
|
518
|
+
this.logger.debug('(up) users created...');
|
|
519
|
+
const channel = await this.createChannel(users[0], users[1]);
|
|
520
|
+
if (!channel) {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
this.logger.debug('(up) channel created...');
|
|
524
|
+
await Promise.all([
|
|
525
|
+
this.createSimpleMessage(channel.id, users[0].id),
|
|
526
|
+
this.createAlertMessage(channel.id, users[0].id),
|
|
527
|
+
this.createCardMessage(channel.id, users[0].id),
|
|
528
|
+
]);
|
|
529
|
+
this.logger.debug('(up) messages created...');
|
|
530
|
+
}
|
|
531
|
+
async down() {
|
|
532
|
+
this.logger.debug(`(down) Starting down migration...`);
|
|
533
|
+
const users = await this.broker.call('AccountUser.getAll', {
|
|
534
|
+
options: {
|
|
535
|
+
email: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'],
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
await Promise.all(users.map(({ id }) => this.broker.call(`AccountUser.deleteAccount`, {
|
|
539
|
+
account: {
|
|
540
|
+
id,
|
|
541
|
+
},
|
|
542
|
+
})));
|
|
543
|
+
const [channel] = await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.getAll}`, {
|
|
544
|
+
criteria: {
|
|
545
|
+
displayName: `propertyAutomatedUser:propertyAutomatedUser2`,
|
|
546
|
+
},
|
|
547
|
+
});
|
|
548
|
+
if (!(channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
549
|
+
this.logger.debug(`(down) No Channel found, skipping migration!`);
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
const posts = await this.broker.call(`${core_2.IMoleculerTopics.PostService}.getAll`, {
|
|
553
|
+
criteria: {
|
|
554
|
+
channel: channel.id,
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
await Promise.all(posts.map(({ id }) => this.broker.call(`${core_2.IMoleculerTopics.PostService}.delete`, {
|
|
558
|
+
id,
|
|
559
|
+
})));
|
|
560
|
+
await this.broker.call(`${core_2.IMoleculerTopics.ChannelService}.${core_2.IBaseServiceCommands.delete}`, {
|
|
561
|
+
id: channel.id,
|
|
562
|
+
});
|
|
563
|
+
this.logger.debug(`(down) Successful`);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = __decorate([
|
|
567
|
+
inversify_1.injectable(),
|
|
568
|
+
__param(0, inversify_1.inject(core_1.CommonType.MOLECULER_BROKER)),
|
|
569
|
+
__param(1, inversify_1.inject('Logger'))
|
|
570
|
+
], PropertyExtMessagesMigration);
|
|
571
|
+
exports.PropertyExtMessagesMigration = PropertyExtMessagesMigration;
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
/***/ }),
|
|
575
|
+
|
|
576
|
+
/***/ "./src/module.ts":
|
|
577
|
+
/*!***********************!*\
|
|
578
|
+
!*** ./src/module.ts ***!
|
|
579
|
+
\***********************/
|
|
580
|
+
/*! no static exports found */
|
|
581
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
582
|
+
|
|
583
|
+
"use strict";
|
|
584
|
+
|
|
585
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
586
|
+
const server_core_1 = __webpack_require__(/*! @common-stack/server-core */ "@common-stack/server-core");
|
|
587
|
+
const containers_1 = __webpack_require__(/*! ./containers */ "./src/containers/index.ts");
|
|
588
|
+
const graphql_1 = __webpack_require__(/*! ./graphql */ "./src/graphql/index.ts");
|
|
589
|
+
exports.default = new server_core_1.Feature({
|
|
590
|
+
schema: graphql_1.schema,
|
|
591
|
+
createContainerFunc: [containers_1.propertyContainerModule],
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
/***/ }),
|
|
596
|
+
|
|
597
|
+
/***/ "@common-stack/core":
|
|
598
|
+
/*!*************************************!*\
|
|
599
|
+
!*** external "@common-stack/core" ***!
|
|
600
|
+
\*************************************/
|
|
601
|
+
/*! no static exports found */
|
|
602
|
+
/***/ (function(module, exports) {
|
|
603
|
+
|
|
604
|
+
module.exports = require("@common-stack/core");
|
|
605
|
+
|
|
606
|
+
/***/ }),
|
|
607
|
+
|
|
608
|
+
/***/ "@common-stack/server-core":
|
|
609
|
+
/*!********************************************!*\
|
|
610
|
+
!*** external "@common-stack/server-core" ***!
|
|
611
|
+
\********************************************/
|
|
612
|
+
/*! no static exports found */
|
|
613
|
+
/***/ (function(module, exports) {
|
|
614
|
+
|
|
615
|
+
module.exports = require("@common-stack/server-core");
|
|
616
|
+
|
|
617
|
+
/***/ }),
|
|
618
|
+
|
|
619
|
+
/***/ "@messenger-box/core":
|
|
620
|
+
/*!**************************************!*\
|
|
621
|
+
!*** external "@messenger-box/core" ***!
|
|
622
|
+
\**************************************/
|
|
623
|
+
/*! no static exports found */
|
|
95
624
|
/***/ (function(module, exports) {
|
|
96
625
|
|
|
626
|
+
module.exports = require("@messenger-box/core");
|
|
627
|
+
|
|
628
|
+
/***/ }),
|
|
629
|
+
|
|
630
|
+
/***/ "@messenger-box/property-ext-core":
|
|
631
|
+
/*!***************************************************!*\
|
|
632
|
+
!*** external "@messenger-box/property-ext-core" ***!
|
|
633
|
+
\***************************************************/
|
|
634
|
+
/*! no static exports found */
|
|
635
|
+
/***/ (function(module, exports) {
|
|
636
|
+
|
|
637
|
+
module.exports = require("@messenger-box/property-ext-core");
|
|
638
|
+
|
|
639
|
+
/***/ }),
|
|
640
|
+
|
|
641
|
+
/***/ "envalid":
|
|
642
|
+
/*!**************************!*\
|
|
643
|
+
!*** external "envalid" ***!
|
|
644
|
+
\**************************/
|
|
645
|
+
/*! no static exports found */
|
|
646
|
+
/***/ (function(module, exports) {
|
|
647
|
+
|
|
648
|
+
module.exports = require("envalid");
|
|
649
|
+
|
|
650
|
+
/***/ }),
|
|
651
|
+
|
|
652
|
+
/***/ "inversify":
|
|
653
|
+
/*!****************************!*\
|
|
654
|
+
!*** external "inversify" ***!
|
|
655
|
+
\****************************/
|
|
656
|
+
/*! no static exports found */
|
|
657
|
+
/***/ (function(module, exports) {
|
|
97
658
|
|
|
659
|
+
module.exports = require("inversify");
|
|
98
660
|
|
|
99
661
|
/***/ })
|
|
100
662
|
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap"],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/config/config.ts","webpack:///./src/config/index.ts","webpack:///./src/containers/container.ts","webpack:///./src/containers/index.ts","webpack:///./src/graphql/index.ts","webpack:///./src/graphql/schema/index.ts","webpack:///./src/graphql/schema/post.graphql","webpack:///./src/index.ts","webpack:///./src/migrations/bot-user-migration.ts","webpack:///./src/migrations/index.ts","webpack:///./src/migrations/property-ext-messages-migration.ts","webpack:///./src/module.ts","webpack:///external \"@common-stack/core\"","webpack:///external \"@common-stack/server-core\"","webpack:///external \"@messenger-box/core\"","webpack:///external \"@messenger-box/property-ext-core\"","webpack:///external \"envalid\"","webpack:///external \"inversify\""],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;AClFA,gEAA8C;AAG9C,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;AAEvC,cAAM,GAAG,kBAAQ,CAAC,GAAG,EAAE;IA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C,CAAC,CAAC;YAClE,OAAO;SACV;QACD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAmB,GAAG,uBAAgB,CAAC,WAAW,SAAS,EAAE;YAC7F,QAAQ,EAAE;gBACN,OAAO,EAAE,OAAO,CAAC,EAAE;aACtB;SACJ,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CACb,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,uBAAgB,CAAC,WAAW,SAAS,EAAE;YACvD,EAAE;SACL,CAAC,CACL,CACJ,CAAC;QACF,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,uBAAgB,CAAC,cAAc,IAAI,2BAAoB,CAAC,MAAM,EAAE,EAAE;YACxF,EAAE,EAAE,OAAO,CAAC,EAAE;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC3C,CAAC;CACJ;AA/MY,4BAA4B;IADxC,sBAAU,EAAE;IAGJ,6BAAM,CAAC,iBAAU,CAAC,gBAAgB,CAAC;IAEnC,6BAAM,CAAC,QAAQ,CAAC;GAJZ,4BAA4B,CA+MxC;AA/MY,oEAA4B;;;;;;;;;;;;;;;ACVzC,wGAAoD;AACpD,0FAAuD;AACvD,iFAAmC;AAEnC,kBAAe,IAAI,qBAAO,CAAC;IACvB,MAAM,EAAN,gBAAM;IACN,mBAAmB,EAAE,CAAC,oCAAuB,CAAC;CACjD,CAAC,CAAC;;;;;;;;;;;;ACPH,+C;;;;;;;;;;;ACAA,sD;;;;;;;;;;;ACAA,gD;;;;;;;;;;;ACAA,6D;;;;;;;;;;;ACAA,oC;;;;;;;;;;;ACAA,sC","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.ts\");\n","import { str, cleanEnv, json } from 'envalid';\nimport { IntegrationConnections, Integrations } from '@adminide-stack/core';\n\nconst env = (process as any).APP_ENV || process.env;\n\nexport const config = cleanEnv(env, {\n NODE_ENV: str({ choices: ['production', 'test', 'staging', 'development'], default: 'production' }),\n POST_DATA_FILE_PATH: str({\n default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/post.json',\n }),\n CHANNEL_DATA_FILE_PATH: str({\n default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/channel.json',\n }),\n});\n","export * from './config';\n","import { ContainerModule, interfaces } from 'inversify';\nimport { BotUserMigration, PropertyExtMessagesMigration } from '../migrations';\n\nexport const propertyContainerModule: (settings) => interfaces.ContainerModule = () =>\n new ContainerModule((bind: interfaces.Bind) => {\n bind('MongodbMigration').to(BotUserMigration).whenTargetNamed(BotUserMigration.name);\n bind('MongodbMigration').to(PropertyExtMessagesMigration).whenTargetNamed(PropertyExtMessagesMigration.name);\n });\n","export * from './container';\n","export { schema } from './schema';\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport post from './post.graphql';\n\nexport const schema = [post].join('/n');\n","export default \"extend enum PostTypeEnum{\\n ALERT\\n CARD\\n}\\n\";","export { default } from './module';\n","import { inject, injectable } from 'inversify';\nimport { CommonType } from '@common-stack/core';\nimport { ServiceBroker } from 'moleculer';\nimport { IDatabaseMigration } from '@adminide-stack/core';\nimport * as Logger from 'bunyan';\nimport { config } from '../config';\n\n@injectable()\nexport class BotUserMigration implements IDatabaseMigration {\n constructor(\n @inject(CommonType.MOLECULER_BROKER)\n private readonly broker: ServiceBroker,\n @inject('Logger')\n private logger: Logger,\n ) {\n this.logger = logger.child({ className: BotUserMigration.name });\n }\n\n protected name = 'BotUserMigration';\n\n id = `${this.constructor.name}_20220502`;\n\n async up(): Promise<void> {\n await this.down();\n this.logger.debug(`(up) Starting up migration...`);\n const user = await this.broker.call(`AccountUser.createAccount`, {\n account: {\n username: 'resortifi',\n email: 'resortifi-bot@resortifi.com',\n alias: 'resortifi',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n this.logger.debug(`(up) done`, user);\n }\n\n async down(): Promise<void> {\n if (config.isDev) {\n await this.broker.waitForServices('AccountUser');\n }\n this.logger.debug(`(down) Starting down migration...`);\n const user = await this.broker.call<{ id: string }, { email: string }>(`AccountUser.findAccountByEmail`, {\n email: 'resortifi-bot@resortifi.com',\n });\n if (!user) {\n return;\n }\n this.logger.debug(`(down) User Found, dropping...`, user);\n await this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id: user.id,\n },\n });\n this.logger.debug(`(down) User drop done!`);\n }\n}\n","export { PropertyExtMessagesMigration } from './property-ext-messages-migration';\nexport { BotUserMigration } from './bot-user-migration';\n","import { inject, injectable } from 'inversify';\nimport { IDatabaseMigration, IUserAccount } from '@adminide-stack/core';\nimport { CommonType } from '@common-stack/core';\nimport { ServiceBroker } from 'moleculer';\nimport * as Logger from 'bunyan';\nimport { IChannel, IPost, IPostTypeEnum } from '@messenger-box/property-ext-core';\nimport { IBaseServiceCommands, IMoleculerTopics, IRoomType } from '@messenger-box/core';\nimport { config } from '../config';\n\n@injectable()\nexport class PropertyExtMessagesMigration implements IDatabaseMigration {\n constructor(\n @inject(CommonType.MOLECULER_BROKER)\n private readonly broker: ServiceBroker,\n @inject('Logger')\n private logger: Logger,\n ) {\n this.logger = logger.child({ className: PropertyExtMessagesMigration.name });\n }\n\n id: 'MessagesMigration_07202022';\n\n protected name = 'PropertyExtMessagesMigration';\n\n private async createUsers(): Promise<[IUserAccount, IUserAccount]> {\n const userOne = this.broker.call<IUserAccount, unknown>(`AccountUser.createAccount`, {\n account: {\n username: 'propertyAutomatedUser',\n email: 'property-automated-user@resortifi.com',\n alias: 'propertyAutomatedUser',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n const userTwo = this.broker.call<IUserAccount, unknown>(`AccountUser.createAccount`, {\n account: {\n username: 'propertyAutomatedUser2',\n email: 'property-automated-user2@resortifi.com',\n alias: 'propertyAutomatedUser2',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n return Promise.all([userOne, userTwo]);\n }\n\n private createChannel(owner: IUserAccount, guest: IUserAccount): Promise<IChannel> {\n return this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.create}`, {\n data: {\n topic: 'Fixtures',\n title: `${owner.alias}:${guest.alias}`,\n creator: guest.id as never,\n displayName: `${owner.alias}:${guest.alias}`,\n type: IRoomType.DIRECT,\n members: [\n {\n id: undefined,\n schemeAdmin: false,\n roles: 'OWNER',\n user: owner.id as never,\n },\n {\n id: undefined,\n schemeAdmin: true,\n roles: 'GUEST',\n user: guest.id as never,\n },\n ],\n },\n });\n }\n\n private async createSimpleMessage(channelId: string, editedBy: string) {\n return this.broker.call(`${IMoleculerTopics.PostService}.${IBaseServiceCommands.create}`, {\n data: {\n editedBy: editedBy as never,\n channel: channelId as never,\n message: 'Hello from the migrations',\n type: IPostTypeEnum.Simple as never,\n files: [],\n },\n });\n }\n\n private async createAlertMessage(channelId: string, editedBy: string) {\n const message = 'This is a dummy alert!';\n return this.broker.call(`${IMoleculerTopics.PostService}.${IBaseServiceCommands.create}`, {\n data: {\n editedBy: editedBy as never,\n channel: channelId as never,\n message,\n type: IPostTypeEnum.ALERT as never,\n files: [],\n props: {\n ref: 'Dummy',\n refId: 'some-ref',\n attachment: {\n title: message,\n isTitleHtml: false,\n icon: 'InfoIcon',\n callToAction: {\n title: 'View',\n link: `/some-route/some-id`,\n },\n },\n },\n },\n });\n }\n\n private async createCardMessage(channelId: string, editedBy: string) {\n const message = 'Inquiry for fixture property';\n return this.broker.call(`${IMoleculerTopics.PostService}.${IBaseServiceCommands.create}`, {\n data: {\n editedBy: editedBy as never,\n channel: channelId as never,\n message,\n type: IPostTypeEnum.CARD as never,\n files: [],\n props: {\n ref: 'Property',\n refId: 'some-property-id',\n attachment: {\n image: 'https://placehold.co/300',\n title: message,\n isTitleHtml: false,\n description:\n 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis interdum leo augue, non posuere sapien ullamcorper ac. Aliquam vitae ornare libero, ac vulputate elit. Aenean interdum, mi a viverra maximus, leo nibh maximus augue, vel ultrices leo ante et ex. Maecenas vel mi auctor, egestas tellus nec, placerat odio. Curabitur eget tortor sed ligula pharetra varius. Aliquam sit amet lacus ligula. Etiam vitae magna eros.',\n isDescriptionHtml: false,\n callToAction: {\n title: 'View',\n // Should come from frontend\n link: `/property/some-id`,\n },\n property: {\n price: 10,\n priceType: 'Hourly',\n type: 'Hotel',\n totalStar: 5,\n maxPeople: 500,\n totalReview: 450,\n },\n },\n },\n },\n });\n }\n\n private async waitForServices() {\n if (config.isDev) {\n await this.broker.waitForServices('AccountUser');\n await this.broker.waitForServices(`${IMoleculerTopics.ChannelService}`);\n await this.broker.waitForServices(`${IMoleculerTopics.PostService}`);\n }\n }\n\n async up(): Promise<void> {\n await this.waitForServices();\n await this.down();\n this.logger.debug(`(up) Starting up migration...`);\n const users = await this.createUsers();\n this.logger.debug('(up) users created...');\n const channel = await this.createChannel(users[0], users[1]);\n if (!channel) {\n return;\n }\n this.logger.debug('(up) channel created...');\n await Promise.all([\n this.createSimpleMessage(channel.id, users[0].id),\n this.createAlertMessage(channel.id, users[0].id),\n this.createCardMessage(channel.id, users[0].id),\n ]);\n this.logger.debug('(up) messages created...');\n }\n\n async down(): Promise<void> {\n this.logger.debug(`(down) Starting down migration...`);\n const users = await this.broker.call<IUserAccount[], unknown>('AccountUser.getAll', {\n options: {\n email: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'],\n },\n });\n await Promise.all(\n users.map(({ id }) =>\n this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id,\n },\n }),\n ),\n );\n const [channel] = await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.getAll}`, {\n criteria: {\n displayName: `propertyAutomatedUser:propertyAutomatedUser2`,\n },\n });\n if (!channel?.id) {\n this.logger.debug(`(down) No Channel found, skipping migration!`);\n return;\n }\n const posts = await this.broker.call<IPost[], unknown>(`${IMoleculerTopics.PostService}.getAll`, {\n criteria: {\n channel: channel.id,\n },\n });\n await Promise.all(\n posts.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostService}.delete`, {\n id,\n }),\n ),\n );\n await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.delete}`, {\n id: channel.id,\n });\n this.logger.debug(`(down) Successful`);\n }\n}\n","import { Feature } from '@common-stack/server-core';\nimport { propertyContainerModule } from './containers';\nimport { schema } from './graphql';\n\nexport default new Feature({\n schema,\n createContainerFunc: [propertyContainerModule],\n});\n","module.exports = require(\"@common-stack/core\");","module.exports = require(\"@common-stack/server-core\");","module.exports = require(\"@messenger-box/core\");","module.exports = require(\"@messenger-box/property-ext-core\");","module.exports = require(\"envalid\");","module.exports = require(\"inversify\");"],"sourceRoot":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ServiceBroker } from 'moleculer';
|
|
2
|
+
import { IDatabaseMigration } from '@adminide-stack/core';
|
|
3
|
+
import * as Logger from 'bunyan';
|
|
4
|
+
export declare class BotUserMigration implements IDatabaseMigration {
|
|
5
|
+
private readonly broker;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(broker: ServiceBroker, logger: Logger);
|
|
8
|
+
protected name: string;
|
|
9
|
+
id: string;
|
|
10
|
+
up(): Promise<void>;
|
|
11
|
+
down(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDatabaseMigration } from '@adminide-stack/core';
|
|
2
|
+
import { ServiceBroker } from 'moleculer';
|
|
3
|
+
import * as Logger from 'bunyan';
|
|
4
|
+
export declare class PropertyExtMessagesMigration implements IDatabaseMigration {
|
|
5
|
+
private readonly broker;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(broker: ServiceBroker, logger: Logger);
|
|
8
|
+
id: 'MessagesMigration_07202022';
|
|
9
|
+
protected name: string;
|
|
10
|
+
private createUsers;
|
|
11
|
+
private createChannel;
|
|
12
|
+
private createSimpleMessage;
|
|
13
|
+
private createAlertMessage;
|
|
14
|
+
private createCardMessage;
|
|
15
|
+
private waitForServices;
|
|
16
|
+
up(): Promise<void>;
|
|
17
|
+
down(): Promise<void>;
|
|
18
|
+
}
|
package/lib/module.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@messenger-box/property-ext-server",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.195",
|
|
4
4
|
"description": "Extension to Messenger to support property",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -37,8 +37,11 @@
|
|
|
37
37
|
"\\.(ts|tsx)$": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@messenger-box/property-ext-core": "0.0.1-alpha.192"
|
|
42
|
+
},
|
|
40
43
|
"peerDependencies": {
|
|
41
|
-
"@adminide-stack/account-api-server": "1.1.3-alpha.
|
|
44
|
+
"@adminide-stack/account-api-server": "1.1.3-alpha.37",
|
|
42
45
|
"@adminide-stack/core": "*",
|
|
43
46
|
"@adminide-stack/platform-server": "*",
|
|
44
47
|
"@cdm-logger/server": "*",
|
|
@@ -64,5 +67,5 @@
|
|
|
64
67
|
"typescript": {
|
|
65
68
|
"definition": "lib/index.d.ts"
|
|
66
69
|
},
|
|
67
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "24872b58431cc4f8861c952af50cb9560883b00a"
|
|
68
71
|
}
|