Skip to content

Instantly share code, notes, and snippets.

View hmarcelodn's full-sized avatar

Hugo Marcelo Del Negro hmarcelodn

  • Melon Technologies
  • Argentina
View GitHub Profile
import { Consumer, SQSMessage } from 'sqs-consumer';
import { Agent } from 'https';
import * as Sentry from '@sentry/node';
import { Event } from './base.event';
import AWS from '../../utils/awsConfig';
import { APP_LOGGER } from '../../utils/logger';
export abstract class BaseListener<T extends Event> {
protected abstract queueUrl: string;
protected abstract visibilityTimeout: number;
export abstract class Event {
readonly $name: string;
readonly $version: number;
}
await Promise.all(
documentDrafts.map(async (documentDraft: DocumentDraft) =>
this.updateDocumentDraftPublisher.publish(
new UpdateDocumentDraftCommand(templateId, documentDraft.id, batchId, userId)
)
)
);
@hmarcelodn
hmarcelodn / index.ts
Last active July 7, 2022 16:32
index.ts
/* eslint-disable no-unused-vars */
import 'dotenv/config';
import throng from 'throng';
import { APP_LOGGER } from './utils/logger';
enum ProcessType {
WEB = 'web',
DOCUMENT_DRAFT_PROCESSOR_WORKER = 'document-draft-processor-worker',
}
@hmarcelodn
hmarcelodn / interpreter.ts
Last active May 24, 2022 21:35
interpreter
import peg from 'pegjs';
import HttpException from '../exceptions/HttpException';
import {
Functions,
TemplateFunctionsService,
} from '../services';
import {
[if condition='1=1']Hello world 01![/if]$capitalize([q#1234])
[{
"conditionalStatement": {
"conditional": {
"op": "=",
"lhs": "1",
"rhs": "1"
},
"body1": [
"Hello world 01!"
],
@hmarcelodn
hmarcelodn / thl-grammar.pegjs
Created May 24, 2022 21:23
thl-grammar.pegjs-13
HighlightToken = "[highlight]" / "[/highlight]"
@hmarcelodn
hmarcelodn / thl-grammar.pegjs
Created May 24, 2022 21:21
thl-grammar.pegjs-12
Operator = op:("=" / "!=" / ">" / "<" / ">=" / "<=" / "$=")+
@hmarcelodn
hmarcelodn / thl-grammar.pegjs
Created May 24, 2022 21:20
thl-grammar.pegjs-11
ConditionStatement =
lhs:(Value / FunctionStatement)
operator:Operator
rhs:(Value / FunctionStatement) {
return {op: operator.join(''), lhs, rhs}
}