Skip to content

Commit f450bcc

Browse files
committed
feat(*): feat
1 parent 005ee58 commit f450bcc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/plugin-js-lambda-microlib/src/MicroserviceType.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,22 @@ export default class MicroserviceType {
488488
requirements['snsPublish'] = true;
489489
return ` ${conditionCode || ''}await snsPublish(${this.stringifyForHook(config['topic'], options)}, ${args ? (Array.isArray(args) ? (<any>args).join(', ') : args) : '{}'});`
490490
}
491+
if ('%message' === type) {
492+
requirements['message'] = true;
493+
switch (options['position']) {
494+
case 'before': return ` ${conditionCode || ''}await message(${this.stringifyForHook(config['topic'], options)}, ${args ? (Array.isArray(args) ? (<any>args).join(', ') : args) : '{}'}, undefined, query);`;
495+
case 'after': return ` ${conditionCode || ''}await message(${this.stringifyForHook(config['topic'], options)}, ${args ? (Array.isArray(args) ? (<any>args).join(', ') : args) : '{}'}, result, query);`;
496+
default: return undefined;
497+
}
498+
}
499+
if ('%message:' === type.slice(0, 9)) {
500+
requirements['message'] = true;
501+
switch (options['position']) {
502+
case 'before': return ` ${conditionCode || ''}await message(${this.stringifyForHook(type.slice(9), options)}, ${args ? (Array.isArray(args) ? (<any>args).join(', ') : args) : '{}'}, undefined, query);`;
503+
case 'after': return ` ${conditionCode || ''}await message(${this.stringifyForHook(type.slice(9), options)}, ${args ? (Array.isArray(args) ? (<any>args).join(', ') : args) : '{}'}, result, query);`;
504+
default: return undefined;
505+
}
506+
}
491507
if ('%event' === type) {
492508
requirements['event'] = true;
493509
return ` ${conditionCode || ''}await event(${this.stringifyForHook(config['name'] || options['operationName'], options)}, result, query);`

0 commit comments

Comments
 (0)