@messenger-box/property-ext-server 0.0.1-alpha.392 → 0.0.1-alpha.398
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/env-config.d.ts +1 -0
- package/lib/index.js +100 -81
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -35,6 +35,7 @@ exports.config = (0, envalid_1.cleanEnv)(env, {
|
|
|
35
35
|
CHANNEL_DATA_FILE_PATH: (0, envalid_1.str)({
|
|
36
36
|
default: 'node_modules/@messenger-box/property-ext-server/lib/mock/fixtures/channel.json',
|
|
37
37
|
}),
|
|
38
|
+
APP_NAME: (0, envalid_1.str)({ devDefault: 'Support' }),
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
|
|
@@ -286,7 +287,7 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
286
287
|
this.broker = broker;
|
|
287
288
|
this.logger = logger;
|
|
288
289
|
this.name = this.constructor.name;
|
|
289
|
-
this.id = `${this.name}
|
|
290
|
+
this.id = `${this.name}_20231006`;
|
|
290
291
|
this.logger = logger.child({ className: PropertyExtMessagesMigration_1.name });
|
|
291
292
|
}
|
|
292
293
|
async createUsers() {
|
|
@@ -304,20 +305,12 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
304
305
|
});
|
|
305
306
|
const userTwo = this.broker.call(`AccountUser.createAccount`, {
|
|
306
307
|
account: {
|
|
307
|
-
|
|
308
|
-
// email: 'property-automated-user2@resortifi.com',
|
|
309
|
-
// alias: 'auth0|62df22109b1f5f6077c1f57e', // This need to match with auth0 id. Otherwise manually updatein the DB
|
|
310
|
-
// familyName: 'property-fixure',
|
|
311
|
-
// givenName: 'user2',
|
|
312
|
-
// picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',
|
|
313
|
-
// emailVerified: true,
|
|
314
|
-
// notificationEmail: '',
|
|
315
|
-
username: 'followupchatsubadmin',
|
|
308
|
+
username: 'propertyAutomatedUser2',
|
|
316
309
|
email: 'property-automated-user2@resortifi.com',
|
|
317
310
|
alias: 'auth0|62df22109b1f5f6077c1f57e',
|
|
318
|
-
familyName: '
|
|
319
|
-
givenName: '
|
|
320
|
-
picture: 'https://
|
|
311
|
+
familyName: 'property-fixure',
|
|
312
|
+
givenName: 'user2',
|
|
313
|
+
picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',
|
|
321
314
|
emailVerified: true,
|
|
322
315
|
notificationEmail: '',
|
|
323
316
|
},
|
|
@@ -327,9 +320,9 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
327
320
|
createServiceChannel(owner) {
|
|
328
321
|
return this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"create" /* IBaseServiceCommands.Create */}`, {
|
|
329
322
|
data: {
|
|
330
|
-
topic: '
|
|
331
|
-
title:
|
|
332
|
-
description:
|
|
323
|
+
topic: 'CustomerSupportServiceChat',
|
|
324
|
+
title: `${config_1.config.APP_NAME} SUPPORT`,
|
|
325
|
+
description: `${config_1.config.APP_NAME} SUPPORT SERVICE`,
|
|
333
326
|
creator: owner.id,
|
|
334
327
|
displayName: `followup-support-${owner.id}`,
|
|
335
328
|
type: "SERVICE" /* IRoomType.Service */,
|
|
@@ -447,104 +440,130 @@ let PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = class Proper
|
|
|
447
440
|
this.broker.waitForServices(`${"ChannelService" /* IMoleculerTopics.ChannelService */}`),
|
|
448
441
|
this.broker.waitForServices('AccountUser'),
|
|
449
442
|
this.broker.waitForServices(`${"PostService" /* IMoleculerTopics.PostService */}`),
|
|
443
|
+
this.broker.waitForServices(`${"PostThreadService" /* IMoleculerTopics.PostThreadService */}`),
|
|
450
444
|
]);
|
|
451
445
|
}
|
|
452
446
|
}
|
|
453
447
|
async up() {
|
|
454
|
-
await this.waitForServices();
|
|
455
448
|
await this.down();
|
|
449
|
+
await this.waitForServices();
|
|
450
|
+
// await this.down();
|
|
456
451
|
this.logger.debug(`(up) Starting up migration...`);
|
|
457
452
|
const users = await this.createUsers();
|
|
453
|
+
if (!users) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
458
456
|
this.logger.debug('(up) users created...');
|
|
459
457
|
const channel = await this.createChannel(users[0], users[1]);
|
|
460
458
|
if (!channel) {
|
|
461
459
|
return;
|
|
462
460
|
}
|
|
463
461
|
this.logger.debug('(up) channel created...');
|
|
464
|
-
const serviceChannel = await this.createServiceChannel(users[1]);
|
|
465
|
-
if (!serviceChannel) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
this.logger.debug('(up) service channel created...', serviceChannel);
|
|
469
462
|
await Promise.all([
|
|
470
463
|
this.createSimpleMessage(channel.id, users[0].id),
|
|
471
464
|
this.createAlertMessage(channel.id, users[0].id),
|
|
472
465
|
this.createCardMessage(channel.id, users[0].id),
|
|
473
466
|
]);
|
|
474
467
|
this.logger.debug('(up) messages created...');
|
|
468
|
+
const serviceChannel = await this.createServiceChannel(users[1]);
|
|
469
|
+
if (!serviceChannel) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
this.logger.debug('(up) service channel created...');
|
|
475
473
|
}
|
|
476
474
|
async down() {
|
|
477
475
|
this.logger.debug(`(down) Starting down migration...`);
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
const [userOne, userTwo] = users;
|
|
490
|
-
/////////////////////////....Service Channel....//////////////////////////////////
|
|
491
|
-
const [servicehannel] = await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"getAll" /* IBaseServiceCommands.GetAll */}`, {
|
|
492
|
-
criteria: {
|
|
493
|
-
displayName: `followup-support-${userTwo}`,
|
|
494
|
-
},
|
|
495
|
-
});
|
|
496
|
-
if (!(servicehannel === null || servicehannel === void 0 ? void 0 : servicehannel.id)) {
|
|
497
|
-
this.logger.debug(`(down) No Channel found, skipping channel delete!`);
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
const posts = await this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.getAll`, {
|
|
501
|
-
criteria: {
|
|
502
|
-
channel: servicehannel.id,
|
|
476
|
+
await this.waitForServices();
|
|
477
|
+
try {
|
|
478
|
+
const users = await this.broker.call('AccountUser.getAll', {
|
|
479
|
+
options: {
|
|
480
|
+
criteria: {
|
|
481
|
+
email: {
|
|
482
|
+
$in: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'],
|
|
483
|
+
},
|
|
484
|
+
},
|
|
503
485
|
},
|
|
504
486
|
});
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
487
|
+
if (!users.length) {
|
|
488
|
+
this.logger.debug(`(down) No Users found, skipping migrations!`);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
const [userOne, userTwo] = users;
|
|
492
|
+
const [channel] = await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"getAll" /* IBaseServiceCommands.GetAll */}`, {
|
|
509
493
|
criteria: {
|
|
510
|
-
|
|
494
|
+
displayName: `${userTwo.id}:${userOne.id}`,
|
|
511
495
|
},
|
|
512
496
|
});
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
497
|
+
if (!(channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
498
|
+
this.logger.debug(`(down) No Channel found, skipping channel delete!`);
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
const posts = await this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.getAll`, {
|
|
502
|
+
criteria: {
|
|
503
|
+
channel: channel.id,
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
await Promise.all(posts.map(({ id }) => this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.delete`, {
|
|
507
|
+
id,
|
|
508
|
+
})));
|
|
509
|
+
await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"delete" /* IBaseServiceCommands.Delete */}`, {
|
|
510
|
+
id: channel.id,
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
/////////////////////////....Service Channel....//////////////////////////////////
|
|
514
|
+
const serviceUsers = await this.broker.call('AccountUser.getAll', {
|
|
515
|
+
options: {
|
|
516
|
+
criteria: {
|
|
517
|
+
email: 'property-automated-user2@resortifi.com',
|
|
518
|
+
},
|
|
519
|
+
},
|
|
518
520
|
});
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
if (!(channel === null || channel === void 0 ? void 0 : channel.id)) {
|
|
527
|
-
this.logger.debug(`(down) No Channel found, skipping channel delete!`);
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
const posts = await this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.getAll`, {
|
|
521
|
+
if (!serviceUsers.length) {
|
|
522
|
+
this.logger.debug(`(down) No service Users found, skipping migrations!`);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const [serviceUser] = serviceUsers;
|
|
526
|
+
const [servicehannel] = await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"getAll" /* IBaseServiceCommands.GetAll */}`, {
|
|
531
527
|
criteria: {
|
|
532
|
-
|
|
528
|
+
displayName: `followup-support-${serviceUser === null || serviceUser === void 0 ? void 0 : serviceUser.id}`,
|
|
533
529
|
},
|
|
534
530
|
});
|
|
535
|
-
|
|
536
|
-
|
|
531
|
+
this.logger.debug(`servicehannel = ${JSON.stringify(servicehannel)}`);
|
|
532
|
+
if (!(servicehannel === null || servicehannel === void 0 ? void 0 : servicehannel.id)) {
|
|
533
|
+
this.logger.debug(`(down) No Service Channel found, skipping service channel delete!`);
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
const posts = await this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.getAll`, {
|
|
537
|
+
criteria: {
|
|
538
|
+
channel: servicehannel.id,
|
|
539
|
+
},
|
|
540
|
+
});
|
|
541
|
+
await Promise.all(posts.map(({ id }) => this.broker.call(`${"PostService" /* IMoleculerTopics.PostService */}.delete`, {
|
|
542
|
+
id,
|
|
543
|
+
})));
|
|
544
|
+
const postsThreads = await this.broker.call(`${"PostThreadService" /* IMoleculerTopics.PostThreadService */}.getAll`, {
|
|
545
|
+
criteria: {
|
|
546
|
+
channel: servicehannel.id,
|
|
547
|
+
},
|
|
548
|
+
});
|
|
549
|
+
await Promise.all(postsThreads.map(({ id }) => this.broker.call(`${"PostThreadService" /* IMoleculerTopics.PostThreadService */}.delete`, {
|
|
550
|
+
id,
|
|
551
|
+
})));
|
|
552
|
+
await this.broker.call(`${"ChannelService" /* IMoleculerTopics.ChannelService */}.${"delete" /* IBaseServiceCommands.Delete */}`, {
|
|
553
|
+
id: servicehannel.id,
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
/////////////////////////....Service Channel.... end//////////////////////////////////
|
|
557
|
+
await Promise.all(users.map(({ id }) => this.broker.call(`AccountUser.deleteAccount`, {
|
|
558
|
+
account: {
|
|
559
|
+
id,
|
|
560
|
+
},
|
|
537
561
|
})));
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
562
|
+
this.logger.debug(`(down) Successful`);
|
|
563
|
+
}
|
|
564
|
+
catch (e) {
|
|
565
|
+
this.logger.error(e.message, e.stack);
|
|
541
566
|
}
|
|
542
|
-
await Promise.all(users.map(({ id }) => this.broker.call(`AccountUser.deleteAccount`, {
|
|
543
|
-
account: {
|
|
544
|
-
id,
|
|
545
|
-
},
|
|
546
|
-
})));
|
|
547
|
-
this.logger.debug(`(down) Successful`);
|
|
548
567
|
}
|
|
549
568
|
};
|
|
550
569
|
PropertyExtMessagesMigration = PropertyExtMessagesMigration_1 = __decorate([
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;AAAA,iEAAe,0BAA0B,wBAAwB,GAAG;;;;;;;;;;;;;ACApE,gEAA8C;AAG9C,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;AAEvC,cAAM,GAAG,sBAAQ,EAAC,GAAG,EAAE;IAChC,QAAQ,EAAE,iBAAG,EAAC,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IACnG,mBAAmB,EAAE,iBAAG,EAAC;QACrB,OAAO,EAAE,6EAA6E;KACzF,CAAC;IACF,sBAAsB,EAAE,iBAAG,EAAC;QACxB,OAAO,EAAE,gFAAgF;KAC5F,CAAC;CACL,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACbH,6FAA6B;;;;;;;;;;;;;;ACA7B,sEAAwD;AACxD,2FAA+E;AAExE,MAAM,uBAAuB,GAA6C,GAAG,EAAE,CAClF,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IAC1C,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,6BAAgB,CAAC,CAAC,eAAe,CAAC,6BAAgB,CAAC,IAAI,CAAC,CAAC;IACrF,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,yCAA4B,CAAC,CAAC,eAAe,CAAC,yCAA4B,CAAC,IAAI,CAAC,CAAC;AACjH,CAAC,CAAC,CAAC;AAJM,+BAAuB,2BAI7B;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPP,+FAA4B;;;;;;;;;;;;;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qBAAe,IAAI,qBAAO,CAAC;IACvB,MAAM,EAAN,gBAAM;IACN,mBAAmB,EAAE,CAAC,oCAAuB,CAAC;CACjD,CAAC,CAAC;;;;;;;;;;;ACPH;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["webpack://@messenger-box/property-ext-server/./src/graphql/schema/post.graphql","webpack://@messenger-box/property-ext-server/./src/config/env-config.ts","webpack://@messenger-box/property-ext-server/./src/config/index.ts","webpack://@messenger-box/property-ext-server/./src/containers/container.ts","webpack://@messenger-box/property-ext-server/./src/containers/index.ts","webpack://@messenger-box/property-ext-server/./src/graphql/index.ts","webpack://@messenger-box/property-ext-server/./src/graphql/schema/index.ts","webpack://@messenger-box/property-ext-server/./src/index.ts","webpack://@messenger-box/property-ext-server/./src/migrations/bot-user-migration.ts","webpack://@messenger-box/property-ext-server/./src/migrations/index.ts","webpack://@messenger-box/property-ext-server/./src/migrations/property-ext-messages-migration.ts","webpack://@messenger-box/property-ext-server/./src/module.ts","webpack://@messenger-box/property-ext-server/external commonjs \"@common-stack/core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@common-stack/server-core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@messenger-box/property-ext-core\"","webpack://@messenger-box/property-ext-server/external commonjs \"envalid\"","webpack://@messenger-box/property-ext-server/external commonjs \"inversify\"","webpack://@messenger-box/property-ext-server/webpack/bootstrap","webpack://@messenger-box/property-ext-server/webpack/runtime/define property getters","webpack://@messenger-box/property-ext-server/webpack/runtime/hasOwnProperty shorthand","webpack://@messenger-box/property-ext-server/webpack/runtime/make namespace object","webpack://@messenger-box/property-ext-server/webpack/before-startup","webpack://@messenger-box/property-ext-server/webpack/startup","webpack://@messenger-box/property-ext-server/webpack/after-startup"],"sourcesContent":["export default \"extend enum PostTypeEnum{\\n ALERT\\n CARD\\n}\\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 './env-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 } 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, IPostThread, 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 protected name = this.constructor.name;\n\n id = `${this.name}_20230714`;\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: 'auth0|62df21f9e8116e9fce8207cf', // This need to match with auth0 id. Otherwise manually updatein the DB\n familyName: 'property-fixure',\n givenName: 'user1',\n picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',\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: 'auth0|62df22109b1f5f6077c1f57e', // This need to match with auth0 id. Otherwise manually updatein the DB\n // familyName: 'property-fixure',\n // givenName: 'user2',\n // picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',\n // emailVerified: true,\n // notificationEmail: '',\n username: 'followupchatsubadmin',\n email: 'property-automated-user2@resortifi.com',\n alias: 'auth0|62df22109b1f5f6077c1f57e', // This need to match with auth0 id. Otherwise manually updatein the DB\n familyName: 'Admin',\n givenName: 'Folloup Chat',\n picture:\n 'https://play-lh.googleusercontent.com/btIgzqAzlb3OYTag94wYOyO-exTx4qkGZFfwopOydrJBWn4YbgdpNb2otjmBSRsgTA0=w240-h480',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n return Promise.all([userOne, userTwo]);\n }\n\n private createServiceChannel(owner: IUserAccount): Promise<IChannel> {\n return this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.Create}`, {\n data: {\n topic: 'FollowupChatSupport',\n title: 'FOLLOWUP CHAT SUPPORT',\n description: 'FOLLOWUP CHAT SUPPORT SERVICE',\n creator: owner.id as never,\n displayName: `followup-support-${owner.id}`,\n type: IRoomType.Service,\n members: [\n {\n id: undefined,\n schemeAdmin: false,\n roles: 'OWNER',\n user: owner.id as never,\n },\n ],\n },\n });\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.id}:${guest.id}`,\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 Promise.all([\n this.broker.waitForServices(`${IMoleculerTopics.ChannelService}`),\n this.broker.waitForServices('AccountUser'),\n this.broker.waitForServices(`${IMoleculerTopics.PostService}`),\n ]);\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\n const serviceChannel = await this.createServiceChannel(users[1]);\n if (!serviceChannel) {\n return;\n }\n this.logger.debug('(up) service channel created...', serviceChannel);\n\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 criteria: {\n email: { $in: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'] },\n },\n },\n });\n if (!users.length) {\n this.logger.debug(`(down) No Users found, skipping migrations!`);\n return;\n }\n const [userOne, userTwo] = users;\n /////////////////////////....Service Channel....//////////////////////////////////\n const [servicehannel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `followup-support-${userTwo}`,\n },\n },\n );\n if (!servicehannel?.id) {\n this.logger.debug(`(down) No Channel found, skipping channel delete!`);\n } else {\n const posts = await this.broker.call<IPost[], unknown>(`${IMoleculerTopics.PostService}.getAll`, {\n criteria: {\n channel: servicehannel.id,\n },\n });\n await Promise.all(\n posts.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostService}.delete`, {\n id,\n }),\n ),\n );\n const postsThreads = await this.broker.call<IPostThread[], unknown>(\n `${IMoleculerTopics.PostThreadService}.getAll`,\n {\n criteria: {\n channel: servicehannel.id,\n },\n },\n );\n await Promise.all(\n postsThreads.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostThreadService}.delete`, {\n id,\n }),\n ),\n );\n await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.Delete}`, {\n id: servicehannel.id,\n });\n }\n /////////////////////////....Service Channel.... end//////////////////////////////////\n const [channel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `${userTwo.id}:${userOne.id}`,\n },\n },\n );\n if (!channel?.id) {\n this.logger.debug(`(down) No Channel found, skipping channel delete!`);\n } else {\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 }\n await Promise.all(\n users.map(({ id }) =>\n this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id,\n },\n }),\n ),\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/property-ext-core\");","module.exports = require(\"envalid\");","module.exports = require(\"inversify\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;;AAAA,iEAAe,0BAA0B,wBAAwB,GAAG;;;;;;;;;;;;;ACApE,gEAA8C;AAG9C,MAAM,GAAG,GAAI,OAAe,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;AAEvC,cAAM,GAAG,sBAAQ,EAAC,GAAG,EAAE;IAChC,QAAQ,EAAE,iBAAG,EAAC,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CA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,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SACzC;IACL,CAAC;CACJ;AAtUY,4BAA4B;IADxC,0BAAU,GAAE;IAGJ,iCAAM,EAAC,iBAAU,CAAC,gBAAgB,CAAC;IAEnC,iCAAM,EAAC,QAAQ,CAAC;GAJZ,4BAA4B,CAsUxC;AAtUY,oEAA4B;;;;;;;;;;;;;ACVzC,wGAAoD;AACpD,0FAAuD;AACvD,iFAAmC;AAEnC,qBAAe,IAAI,qBAAO,CAAC;IACvB,MAAM,EAAN,gBAAM;IACN,mBAAmB,EAAE,CAAC,oCAAuB,CAAC;CACjD,CAAC,CAAC;;;;;;;;;;;ACPH;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["webpack://@messenger-box/property-ext-server/./src/graphql/schema/post.graphql","webpack://@messenger-box/property-ext-server/./src/config/env-config.ts","webpack://@messenger-box/property-ext-server/./src/config/index.ts","webpack://@messenger-box/property-ext-server/./src/containers/container.ts","webpack://@messenger-box/property-ext-server/./src/containers/index.ts","webpack://@messenger-box/property-ext-server/./src/graphql/index.ts","webpack://@messenger-box/property-ext-server/./src/graphql/schema/index.ts","webpack://@messenger-box/property-ext-server/./src/index.ts","webpack://@messenger-box/property-ext-server/./src/migrations/bot-user-migration.ts","webpack://@messenger-box/property-ext-server/./src/migrations/index.ts","webpack://@messenger-box/property-ext-server/./src/migrations/property-ext-messages-migration.ts","webpack://@messenger-box/property-ext-server/./src/module.ts","webpack://@messenger-box/property-ext-server/external commonjs \"@common-stack/core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@common-stack/server-core\"","webpack://@messenger-box/property-ext-server/external commonjs \"@messenger-box/property-ext-core\"","webpack://@messenger-box/property-ext-server/external commonjs \"envalid\"","webpack://@messenger-box/property-ext-server/external commonjs \"inversify\"","webpack://@messenger-box/property-ext-server/webpack/bootstrap","webpack://@messenger-box/property-ext-server/webpack/runtime/define property getters","webpack://@messenger-box/property-ext-server/webpack/runtime/hasOwnProperty shorthand","webpack://@messenger-box/property-ext-server/webpack/runtime/make namespace object","webpack://@messenger-box/property-ext-server/webpack/before-startup","webpack://@messenger-box/property-ext-server/webpack/startup","webpack://@messenger-box/property-ext-server/webpack/after-startup"],"sourcesContent":["export default \"extend enum PostTypeEnum{\\n ALERT\\n CARD\\n}\\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 APP_NAME: str({ devDefault: 'Support' }),\n});\n","export * from './env-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 } 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, IPostThread, 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 protected name = this.constructor.name;\n\n id = `${this.name}_20231006`;\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: 'auth0|62df21f9e8116e9fce8207cf', // This need to match with auth0 id. Otherwise manually updatein the DB\n familyName: 'property-fixure',\n givenName: 'user1',\n picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',\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: 'auth0|62df22109b1f5f6077c1f57e', // This need to match with auth0 id. Otherwise manually updatein the DB\n familyName: 'property-fixure',\n givenName: 'user2',\n picture: 'https://lh3.googleusercontent.com/a/AATXAJxMARAgr96npkZGf4R2uGbahBP4tLh5SRbS9bVq=s96-c',\n emailVerified: true,\n notificationEmail: '',\n },\n });\n return Promise.all([userOne, userTwo]);\n }\n\n private createServiceChannel(owner: IUserAccount): Promise<IChannel> {\n return this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.Create}`, {\n data: {\n topic: 'CustomerSupportServiceChat',\n title: `${config.APP_NAME} SUPPORT`,\n description: `${config.APP_NAME} SUPPORT SERVICE`,\n creator: owner.id as never,\n displayName: `followup-support-${owner.id}`,\n type: IRoomType.Service,\n members: [\n {\n id: undefined,\n schemeAdmin: false,\n roles: 'OWNER',\n user: owner.id as never,\n },\n ],\n },\n });\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.id}:${guest.id}`,\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 Promise.all([\n this.broker.waitForServices(`${IMoleculerTopics.ChannelService}`),\n this.broker.waitForServices('AccountUser'),\n this.broker.waitForServices(`${IMoleculerTopics.PostService}`),\n this.broker.waitForServices(`${IMoleculerTopics.PostThreadService}`),\n ]);\n }\n }\n\n async up(): Promise<void> {\n await this.down();\n await this.waitForServices();\n // await this.down();\n this.logger.debug(`(up) Starting up migration...`);\n const users = await this.createUsers();\n if (!users) {\n return;\n }\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\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 const serviceChannel = await this.createServiceChannel(users[1]);\n if (!serviceChannel) {\n return;\n }\n this.logger.debug('(up) service channel created...');\n }\n\n async down(): Promise<void> {\n this.logger.debug(`(down) Starting down migration...`);\n await this.waitForServices();\n try {\n const users = await this.broker.call<IUserAccount[], unknown>('AccountUser.getAll', {\n options: {\n criteria: {\n email: {\n $in: ['property-automated-user@resortifi.com', 'property-automated-user2@resortifi.com'],\n },\n },\n },\n });\n\n if (!users.length) {\n this.logger.debug(`(down) No Users found, skipping migrations!`);\n return;\n }\n\n const [userOne, userTwo] = users;\n\n const [channel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `${userTwo.id}:${userOne.id}`,\n },\n },\n );\n if (!channel?.id) {\n this.logger.debug(`(down) No Channel found, skipping channel delete!`);\n } else {\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 }\n /////////////////////////....Service Channel....//////////////////////////////////\n const serviceUsers = await this.broker.call<IUserAccount[], unknown>('AccountUser.getAll', {\n options: {\n criteria: {\n email: 'property-automated-user2@resortifi.com',\n },\n },\n });\n\n if (!serviceUsers.length) {\n this.logger.debug(`(down) No service Users found, skipping migrations!`);\n return;\n }\n const [serviceUser] = serviceUsers;\n const [servicehannel] = await this.broker.call<any, any>(\n `${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.GetAll}`,\n {\n criteria: {\n displayName: `followup-support-${serviceUser?.id}`,\n },\n },\n );\n this.logger.debug(`servicehannel = ${JSON.stringify(servicehannel)}`);\n if (!servicehannel?.id) {\n this.logger.debug(`(down) No Service Channel found, skipping service channel delete!`);\n } else {\n const posts = await this.broker.call<IPost[], unknown>(`${IMoleculerTopics.PostService}.getAll`, {\n criteria: {\n channel: servicehannel.id,\n },\n });\n await Promise.all(\n posts.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostService}.delete`, {\n id,\n }),\n ),\n );\n const postsThreads = await this.broker.call<IPostThread[], unknown>(\n `${IMoleculerTopics.PostThreadService}.getAll`,\n {\n criteria: {\n channel: servicehannel.id,\n },\n },\n );\n await Promise.all(\n postsThreads.map(({ id }) =>\n this.broker.call(`${IMoleculerTopics.PostThreadService}.delete`, {\n id,\n }),\n ),\n );\n await this.broker.call(`${IMoleculerTopics.ChannelService}.${IBaseServiceCommands.Delete}`, {\n id: servicehannel.id,\n });\n }\n /////////////////////////....Service Channel.... end//////////////////////////////////\n await Promise.all(\n users.map(({ id }) =>\n this.broker.call(`AccountUser.deleteAccount`, {\n account: {\n id,\n },\n }),\n ),\n );\n this.logger.debug(`(down) Successful`);\n } catch (e) {\n this.logger.error(e.message, e.stack);\n }\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/property-ext-core\");","module.exports = require(\"envalid\");","module.exports = require(\"inversify\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.ts\");\n",""],"names":[],"sourceRoot":""}
|
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.398",
|
|
4
4
|
"description": "Extension to Messenger to support property",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@messenger-box/core": "0.0.1-alpha.
|
|
42
|
-
"@messenger-box/platform-server": "0.0.1-alpha.
|
|
43
|
-
"@messenger-box/property-ext-core": "0.0.1-alpha.
|
|
41
|
+
"@messenger-box/core": "0.0.1-alpha.398",
|
|
42
|
+
"@messenger-box/platform-server": "0.0.1-alpha.398",
|
|
43
|
+
"@messenger-box/property-ext-core": "0.0.1-alpha.398"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@adminide-stack/account-api-server": "3.1.2-alpha.109",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"typescript": {
|
|
73
73
|
"definition": "lib/index.d.ts"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "a2dc5d24f734d5c7da79fb379756c44837e7ef94"
|
|
76
76
|
}
|