grm-shared-library 1.1.212 → 1.1.214
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/README.md +16 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/alert-intake/dtos/alert-intake.dto.js +229 -0
- package/dist/cjs/modules/alert-intake/dtos/alert-intake.dto.js.map +1 -0
- package/dist/cjs/modules/alert-intake/enums/alert-intake.enum.js +97 -0
- package/dist/cjs/modules/alert-intake/enums/alert-intake.enum.js.map +1 -0
- package/dist/cjs/modules/alert-intake/index.js +25 -0
- package/dist/cjs/modules/alert-intake/index.js.map +1 -0
- package/dist/cjs/modules/alert-intake/interfaces/alert-intake.js +3 -0
- package/dist/cjs/modules/alert-intake/interfaces/alert-intake.js.map +1 -0
- package/dist/cjs/modules/alert-intake/utils/alert-intake.util.js +48 -0
- package/dist/cjs/modules/alert-intake/utils/alert-intake.util.js.map +1 -0
- package/dist/cjs/modules/notification/dtos/billing-notification.dto.js +213 -0
- package/dist/cjs/modules/notification/dtos/billing-notification.dto.js.map +1 -0
- package/dist/cjs/modules/notification/enums/billing-notification.enum.js +33 -0
- package/dist/cjs/modules/notification/enums/billing-notification.enum.js.map +1 -0
- package/dist/cjs/modules/notification/index.js +4 -0
- package/dist/cjs/modules/notification/index.js.map +1 -1
- package/dist/cjs/modules/notification/interfaces/billing-notification-result.js +3 -0
- package/dist/cjs/modules/notification/interfaces/billing-notification-result.js.map +1 -0
- package/dist/cjs/modules/permission/data/permissions.data.js +8 -0
- package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +16 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js +1 -0
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/cjs/modules/role/data/roles.data.js +8 -0
- package/dist/cjs/modules/role/data/roles.data.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/alert-intake/dtos/alert-intake.dto.js +222 -0
- package/dist/esm/modules/alert-intake/dtos/alert-intake.dto.js.map +1 -0
- package/dist/esm/modules/alert-intake/enums/alert-intake.enum.js +94 -0
- package/dist/esm/modules/alert-intake/enums/alert-intake.enum.js.map +1 -0
- package/dist/esm/modules/alert-intake/index.js +9 -0
- package/dist/esm/modules/alert-intake/index.js.map +1 -0
- package/dist/esm/modules/alert-intake/interfaces/alert-intake.js +2 -0
- package/dist/esm/modules/alert-intake/interfaces/alert-intake.js.map +1 -0
- package/dist/esm/modules/alert-intake/utils/alert-intake.util.js +42 -0
- package/dist/esm/modules/alert-intake/utils/alert-intake.util.js.map +1 -0
- package/dist/esm/modules/notification/dtos/billing-notification.dto.js +205 -0
- package/dist/esm/modules/notification/dtos/billing-notification.dto.js.map +1 -0
- package/dist/esm/modules/notification/enums/billing-notification.enum.js +30 -0
- package/dist/esm/modules/notification/enums/billing-notification.enum.js.map +1 -0
- package/dist/esm/modules/notification/index.js +4 -0
- package/dist/esm/modules/notification/index.js.map +1 -1
- package/dist/esm/modules/notification/interfaces/billing-notification-result.js +2 -0
- package/dist/esm/modules/notification/interfaces/billing-notification-result.js.map +1 -0
- package/dist/esm/modules/permission/data/permissions.data.js +8 -0
- package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +16 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/permission/enums/permissions-module.enum.js +1 -0
- package/dist/esm/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/esm/modules/role/data/roles.data.js +8 -0
- package/dist/esm/modules/role/data/roles.data.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modules/alert-intake/dtos/alert-intake.dto.d.ts +37 -0
- package/dist/types/modules/alert-intake/enums/alert-intake.enum.d.ts +83 -0
- package/dist/types/modules/alert-intake/index.d.ts +4 -0
- package/dist/types/modules/alert-intake/interfaces/alert-intake.d.ts +151 -0
- package/dist/types/modules/alert-intake/utils/alert-intake.util.d.ts +24 -0
- package/dist/types/modules/notification/dtos/billing-notification.dto.d.ts +56 -0
- package/dist/types/modules/notification/enums/billing-notification.enum.d.ts +27 -0
- package/dist/types/modules/notification/index.d.ts +3 -0
- package/dist/types/modules/notification/interfaces/billing-notification-result.d.ts +35 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +4 -1
- package/dist/types/modules/permission/enums/permissions-module.enum.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
11
|
+
import { Transform, Type } from 'class-transformer';
|
|
12
|
+
import { IsBoolean, IsEnum, IsInt, IsOptional, IsPositive, IsString, Matches, MaxLength, MinLength, registerDecorator, ValidateIf, } from 'class-validator';
|
|
13
|
+
import { AlertIntakeChannel, AlertIntakeEmergencyPolicy, AlertIntakeProvider, AlertIntakeRouteMatch, } from '../enums/alert-intake.enum';
|
|
14
|
+
import { ALERT_INTAKE_KEYWORD_PATTERN, MAX_ALERT_INTAKE_SETTING_LENGTH } from '../utils/alert-intake.util';
|
|
15
|
+
const trim = ({ value }) => (typeof value === 'string' ? value.trim() : value);
|
|
16
|
+
const SINGLE_LINE = /^[^\r\n]*$/;
|
|
17
|
+
const MAX_SETTINGS = 40;
|
|
18
|
+
/**
|
|
19
|
+
* A flat bag of provider settings: a handful of short primitive values, keyed by the
|
|
20
|
+
* names the provider's descriptor declares. WHICH keys are allowed is the service's
|
|
21
|
+
* job (it has the descriptor); this only guarantees the bag cannot be a way to post
|
|
22
|
+
* a megabyte of nested JSON at a settings table.
|
|
23
|
+
*/
|
|
24
|
+
function IsFlatSettings(options = {}, validationOptions) {
|
|
25
|
+
return (object, propertyName) => registerDecorator({
|
|
26
|
+
name: 'isFlatSettings',
|
|
27
|
+
target: object.constructor,
|
|
28
|
+
propertyName,
|
|
29
|
+
options: validationOptions,
|
|
30
|
+
validator: {
|
|
31
|
+
validate(value) {
|
|
32
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
33
|
+
return false;
|
|
34
|
+
const entries = Object.entries(value);
|
|
35
|
+
if (entries.length > MAX_SETTINGS)
|
|
36
|
+
return false;
|
|
37
|
+
return entries.every(([key, item]) => {
|
|
38
|
+
if (!/^[A-Za-z][A-Za-z0-9_]{0,59}$/.test(key))
|
|
39
|
+
return false;
|
|
40
|
+
if (typeof item === 'string')
|
|
41
|
+
return item.length <= MAX_ALERT_INTAKE_SETTING_LENGTH;
|
|
42
|
+
if (options.stringsOnly)
|
|
43
|
+
return false;
|
|
44
|
+
return typeof item === 'boolean' || (typeof item === 'number' && Number.isFinite(item));
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
defaultMessage(args) {
|
|
48
|
+
return `${args.property} must be a flat object of at most ${MAX_SETTINGS} short ${options.stringsOnly ? 'string' : 'string, number or boolean'} values`;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export class CreateAlertIntakeConnectionDto {
|
|
54
|
+
}
|
|
55
|
+
__decorate([
|
|
56
|
+
ApiProperty({ enum: AlertIntakeChannel }),
|
|
57
|
+
IsEnum(AlertIntakeChannel),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], CreateAlertIntakeConnectionDto.prototype, "channel", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
ApiProperty({ enum: AlertIntakeProvider }),
|
|
62
|
+
IsEnum(AlertIntakeProvider),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], CreateAlertIntakeConnectionDto.prototype, "provider", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
ApiProperty({ example: 'G4S emergency short code' }),
|
|
67
|
+
Transform(trim),
|
|
68
|
+
IsString(),
|
|
69
|
+
MinLength(2),
|
|
70
|
+
MaxLength(100),
|
|
71
|
+
Matches(SINGLE_LINE),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], CreateAlertIntakeConnectionDto.prototype, "name", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
ApiProperty({
|
|
76
|
+
example: '22384',
|
|
77
|
+
description: 'What people send to: the short code or number, the WhatsApp phone-number id, the mailbox address.',
|
|
78
|
+
}),
|
|
79
|
+
Transform(trim),
|
|
80
|
+
IsString(),
|
|
81
|
+
MinLength(1),
|
|
82
|
+
MaxLength(254),
|
|
83
|
+
Matches(SINGLE_LINE),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], CreateAlertIntakeConnectionDto.prototype, "address", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
ApiPropertyOptional({ default: true }),
|
|
88
|
+
IsBoolean(),
|
|
89
|
+
IsOptional(),
|
|
90
|
+
__metadata("design:type", Boolean)
|
|
91
|
+
], CreateAlertIntakeConnectionDto.prototype, "enabled", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
ApiPropertyOptional({ description: 'Non-secret provider settings, as the provider descriptor declares them.' }),
|
|
94
|
+
IsFlatSettings(),
|
|
95
|
+
IsOptional(),
|
|
96
|
+
__metadata("design:type", Object)
|
|
97
|
+
], CreateAlertIntakeConnectionDto.prototype, "config", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
ApiPropertyOptional({
|
|
100
|
+
description: 'Credentials. WRITE-ONLY: encrypted at rest and never returned. Keys are the descriptor\'s secret fields.',
|
|
101
|
+
}),
|
|
102
|
+
IsFlatSettings({ stringsOnly: true }),
|
|
103
|
+
IsOptional(),
|
|
104
|
+
__metadata("design:type", Object)
|
|
105
|
+
], CreateAlertIntakeConnectionDto.prototype, "secrets", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
ApiPropertyOptional({
|
|
108
|
+
description: 'Platform operators only. NAMES of provisioned secrets, used instead of `secrets`. ' +
|
|
109
|
+
'A connection uses one or the other, never both.',
|
|
110
|
+
}),
|
|
111
|
+
IsFlatSettings({ stringsOnly: true }),
|
|
112
|
+
IsOptional(),
|
|
113
|
+
__metadata("design:type", Object)
|
|
114
|
+
], CreateAlertIntakeConnectionDto.prototype, "secretReferences", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
ApiPropertyOptional({ enum: AlertIntakeEmergencyPolicy, default: AlertIntakeEmergencyPolicy.AUTO }),
|
|
117
|
+
IsEnum(AlertIntakeEmergencyPolicy),
|
|
118
|
+
IsOptional(),
|
|
119
|
+
__metadata("design:type", String)
|
|
120
|
+
], CreateAlertIntakeConnectionDto.prototype, "emergencyPolicy", void 0);
|
|
121
|
+
/**
|
|
122
|
+
* Channel and provider cannot change: a connection IS its provider link, and the
|
|
123
|
+
* webhook URL registered with that provider would silently start meaning something
|
|
124
|
+
* else. Create a new connection instead.
|
|
125
|
+
*/
|
|
126
|
+
export class UpdateAlertIntakeConnectionDto {
|
|
127
|
+
}
|
|
128
|
+
__decorate([
|
|
129
|
+
ApiPropertyOptional(),
|
|
130
|
+
Transform(trim),
|
|
131
|
+
IsString(),
|
|
132
|
+
MinLength(2),
|
|
133
|
+
MaxLength(100),
|
|
134
|
+
Matches(SINGLE_LINE),
|
|
135
|
+
IsOptional(),
|
|
136
|
+
__metadata("design:type", String)
|
|
137
|
+
], UpdateAlertIntakeConnectionDto.prototype, "name", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
ApiPropertyOptional(),
|
|
140
|
+
Transform(trim),
|
|
141
|
+
IsString(),
|
|
142
|
+
MinLength(1),
|
|
143
|
+
MaxLength(254),
|
|
144
|
+
Matches(SINGLE_LINE),
|
|
145
|
+
IsOptional(),
|
|
146
|
+
__metadata("design:type", String)
|
|
147
|
+
], UpdateAlertIntakeConnectionDto.prototype, "address", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
ApiPropertyOptional(),
|
|
150
|
+
IsBoolean(),
|
|
151
|
+
IsOptional(),
|
|
152
|
+
__metadata("design:type", Boolean)
|
|
153
|
+
], UpdateAlertIntakeConnectionDto.prototype, "enabled", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
ApiPropertyOptional({ description: 'Merged over the stored settings. A key sent as "" is removed.' }),
|
|
156
|
+
IsFlatSettings(),
|
|
157
|
+
IsOptional(),
|
|
158
|
+
__metadata("design:type", Object)
|
|
159
|
+
], UpdateAlertIntakeConnectionDto.prototype, "config", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
ApiPropertyOptional({ description: 'Only the secrets sent are replaced; the rest are kept. A key sent as "" is removed.' }),
|
|
162
|
+
IsFlatSettings({ stringsOnly: true }),
|
|
163
|
+
IsOptional(),
|
|
164
|
+
__metadata("design:type", Object)
|
|
165
|
+
], UpdateAlertIntakeConnectionDto.prototype, "secrets", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
ApiPropertyOptional({ description: 'Platform operators only.' }),
|
|
168
|
+
IsFlatSettings({ stringsOnly: true }),
|
|
169
|
+
IsOptional(),
|
|
170
|
+
__metadata("design:type", Object)
|
|
171
|
+
], UpdateAlertIntakeConnectionDto.prototype, "secretReferences", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
ApiPropertyOptional({ enum: AlertIntakeEmergencyPolicy }),
|
|
174
|
+
IsEnum(AlertIntakeEmergencyPolicy),
|
|
175
|
+
IsOptional(),
|
|
176
|
+
__metadata("design:type", String)
|
|
177
|
+
], UpdateAlertIntakeConnectionDto.prototype, "emergencyPolicy", void 0);
|
|
178
|
+
/** Platform operators only: sends a PLATFORM connection's messages to an organization. */
|
|
179
|
+
export class CreateAlertIntakeRouteDto {
|
|
180
|
+
}
|
|
181
|
+
__decorate([
|
|
182
|
+
ApiProperty({ enum: AlertIntakeRouteMatch }),
|
|
183
|
+
IsEnum(AlertIntakeRouteMatch),
|
|
184
|
+
__metadata("design:type", String)
|
|
185
|
+
], CreateAlertIntakeRouteDto.prototype, "match", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
ApiPropertyOptional({ example: 'G4S', description: 'Required for KEYWORD; must be absent for DEFAULT.' }),
|
|
188
|
+
Transform(({ value }) => (typeof value === 'string' ? value.trim().toUpperCase() : value)),
|
|
189
|
+
ValidateIf((dto) => dto.match === AlertIntakeRouteMatch.KEYWORD || dto.keyword !== undefined),
|
|
190
|
+
Matches(ALERT_INTAKE_KEYWORD_PATTERN, { message: 'keyword must be 2-20 letters or digits' }),
|
|
191
|
+
__metadata("design:type", String)
|
|
192
|
+
], CreateAlertIntakeRouteDto.prototype, "keyword", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
ApiProperty(),
|
|
195
|
+
Type(() => Number),
|
|
196
|
+
IsInt(),
|
|
197
|
+
IsPositive(),
|
|
198
|
+
__metadata("design:type", Number)
|
|
199
|
+
], CreateAlertIntakeRouteDto.prototype, "organizationId", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
ApiPropertyOptional({ default: true }),
|
|
202
|
+
IsBoolean(),
|
|
203
|
+
IsOptional(),
|
|
204
|
+
__metadata("design:type", Boolean)
|
|
205
|
+
], CreateAlertIntakeRouteDto.prototype, "enabled", void 0);
|
|
206
|
+
export class UpdateAlertIntakeRouteDto {
|
|
207
|
+
}
|
|
208
|
+
__decorate([
|
|
209
|
+
ApiPropertyOptional(),
|
|
210
|
+
Type(() => Number),
|
|
211
|
+
IsInt(),
|
|
212
|
+
IsPositive(),
|
|
213
|
+
IsOptional(),
|
|
214
|
+
__metadata("design:type", Number)
|
|
215
|
+
], UpdateAlertIntakeRouteDto.prototype, "organizationId", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
ApiPropertyOptional(),
|
|
218
|
+
IsBoolean(),
|
|
219
|
+
IsOptional(),
|
|
220
|
+
__metadata("design:type", Boolean)
|
|
221
|
+
], UpdateAlertIntakeRouteDto.prototype, "enabled", void 0);
|
|
222
|
+
//# sourceMappingURL=alert-intake.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-intake.dto.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/dtos/alert-intake.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACH,SAAS,EACT,MAAM,EACN,KAAK,EAEL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,OAAO,EACP,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,UAAU,GAGb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,EACnB,qBAAqB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE3G,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAsB,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACnG,MA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
|
|
3
|
+
* an SMS, a WhatsApp message or an email that clarion-alerts turns into an incident.
|
|
4
|
+
*
|
|
5
|
+
* Not to be confused with `alert-dispatch`, which is about who an SOS raised IN the
|
|
6
|
+
* app is sent to.
|
|
7
|
+
*/
|
|
8
|
+
/** The channel a message arrived on. */
|
|
9
|
+
export var AlertIntakeChannel;
|
|
10
|
+
(function (AlertIntakeChannel) {
|
|
11
|
+
AlertIntakeChannel["SMS"] = "SMS";
|
|
12
|
+
AlertIntakeChannel["WHATSAPP"] = "WHATSAPP";
|
|
13
|
+
AlertIntakeChannel["EMAIL"] = "EMAIL";
|
|
14
|
+
})(AlertIntakeChannel || (AlertIntakeChannel = {}));
|
|
15
|
+
/**
|
|
16
|
+
* The provider a connection talks to.
|
|
17
|
+
*
|
|
18
|
+
* A code here only RESERVES the name. Whether a provider can be connected is
|
|
19
|
+
* answered by clarion-alerts' provider catalogue (`AlertIntakeProviderDescriptor`),
|
|
20
|
+
* which lists only providers with a registered adapter. UWAZII and CELCOM are
|
|
21
|
+
* reserved without an adapter on purpose: their inbound callback formats have not
|
|
22
|
+
* been confirmed, and until they are, GENERIC_SMS connects them by configuration.
|
|
23
|
+
*/
|
|
24
|
+
export var AlertIntakeProvider;
|
|
25
|
+
(function (AlertIntakeProvider) {
|
|
26
|
+
// SMS
|
|
27
|
+
AlertIntakeProvider["AFRICASTALKING"] = "africastalking";
|
|
28
|
+
AlertIntakeProvider["UWAZII"] = "uwazii";
|
|
29
|
+
AlertIntakeProvider["CELCOM"] = "celcom";
|
|
30
|
+
/** Any gateway that POSTs flat JSON or form fields; the field names are configured. */
|
|
31
|
+
AlertIntakeProvider["GENERIC_SMS"] = "generic_sms";
|
|
32
|
+
// WhatsApp
|
|
33
|
+
AlertIntakeProvider["WHATSAPP_CLOUD"] = "whatsapp_cloud";
|
|
34
|
+
// Email
|
|
35
|
+
AlertIntakeProvider["IMAP"] = "imap";
|
|
36
|
+
/** An inbound-parse webhook (Mailgun routes, SendGrid Inbound Parse, or a generic JSON post). */
|
|
37
|
+
AlertIntakeProvider["EMAIL_WEBHOOK"] = "email_webhook";
|
|
38
|
+
})(AlertIntakeProvider || (AlertIntakeProvider = {}));
|
|
39
|
+
/**
|
|
40
|
+
* Where a connection's credentials live. Never in a plaintext column.
|
|
41
|
+
*
|
|
42
|
+
* ENCRYPTED entered by the organization, encrypted at rest by clarion-alerts
|
|
43
|
+
* (AES-256-GCM, bound to the connection and the field). Write-only:
|
|
44
|
+
* the API never returns them.
|
|
45
|
+
* SECRET_REFERENCE the NAME of a secret the platform operator provisioned (Secret
|
|
46
|
+
* Manager / environment). How the legacy per-tenant credentials
|
|
47
|
+
* keep working, and the option for an operator who does not want
|
|
48
|
+
* a credential in the database at all.
|
|
49
|
+
*/
|
|
50
|
+
export var AlertIntakeSecretSource;
|
|
51
|
+
(function (AlertIntakeSecretSource) {
|
|
52
|
+
AlertIntakeSecretSource["ENCRYPTED"] = "ENCRYPTED";
|
|
53
|
+
AlertIntakeSecretSource["SECRET_REFERENCE"] = "SECRET_REFERENCE";
|
|
54
|
+
})(AlertIntakeSecretSource || (AlertIntakeSecretSource = {}));
|
|
55
|
+
/**
|
|
56
|
+
* How the emergency type of an incident raised from a message is decided.
|
|
57
|
+
* AUTO derives it from the organization: a grievance desk never raises an
|
|
58
|
+
* emergency; an incident desk decides from the message's category and priority.
|
|
59
|
+
*/
|
|
60
|
+
export var AlertIntakeEmergencyPolicy;
|
|
61
|
+
(function (AlertIntakeEmergencyPolicy) {
|
|
62
|
+
AlertIntakeEmergencyPolicy["AUTO"] = "AUTO";
|
|
63
|
+
AlertIntakeEmergencyPolicy["ALWAYS_EMERGENCY"] = "ALWAYS_EMERGENCY";
|
|
64
|
+
AlertIntakeEmergencyPolicy["ALWAYS_NON_EMERGENCY"] = "ALWAYS_NON_EMERGENCY";
|
|
65
|
+
})(AlertIntakeEmergencyPolicy || (AlertIntakeEmergencyPolicy = {}));
|
|
66
|
+
/** How a message on a PLATFORM connection finds its organization. */
|
|
67
|
+
export var AlertIntakeRouteMatch;
|
|
68
|
+
(function (AlertIntakeRouteMatch) {
|
|
69
|
+
/** The first word of the message, e.g. `G4S fire at ...` on a shared short code. */
|
|
70
|
+
AlertIntakeRouteMatch["KEYWORD"] = "KEYWORD";
|
|
71
|
+
/** Everything no other route claimed. At most one per connection. */
|
|
72
|
+
AlertIntakeRouteMatch["DEFAULT"] = "DEFAULT";
|
|
73
|
+
})(AlertIntakeRouteMatch || (AlertIntakeRouteMatch = {}));
|
|
74
|
+
/** How a provider proves a webhook call really came from it. */
|
|
75
|
+
export var AlertIntakeWebhookVerification;
|
|
76
|
+
(function (AlertIntakeWebhookVerification) {
|
|
77
|
+
/** The unguessable URL is the only proof (Africa's Talking signs nothing). */
|
|
78
|
+
AlertIntakeWebhookVerification["SECRET_URL"] = "SECRET_URL";
|
|
79
|
+
/** A shared secret the gateway sends in a header, compared in constant time. */
|
|
80
|
+
AlertIntakeWebhookVerification["SHARED_SECRET_HEADER"] = "SHARED_SECRET_HEADER";
|
|
81
|
+
/** `X-Hub-Signature-256`: HMAC-SHA256 of the raw body with the Meta app secret. */
|
|
82
|
+
AlertIntakeWebhookVerification["META_SIGNATURE"] = "META_SIGNATURE";
|
|
83
|
+
})(AlertIntakeWebhookVerification || (AlertIntakeWebhookVerification = {}));
|
|
84
|
+
/** Why a message that arrived did not become an incident. Stored; shown to operators. */
|
|
85
|
+
export var AlertIntakeRejectionReason;
|
|
86
|
+
(function (AlertIntakeRejectionReason) {
|
|
87
|
+
AlertIntakeRejectionReason["UNKNOWN_CONNECTION"] = "UNKNOWN_CONNECTION";
|
|
88
|
+
AlertIntakeRejectionReason["CONNECTION_DISABLED"] = "CONNECTION_DISABLED";
|
|
89
|
+
AlertIntakeRejectionReason["VERIFICATION_FAILED"] = "VERIFICATION_FAILED";
|
|
90
|
+
AlertIntakeRejectionReason["NO_ORGANIZATION"] = "NO_ORGANIZATION";
|
|
91
|
+
AlertIntakeRejectionReason["ORGANIZATION_INACTIVE"] = "ORGANIZATION_INACTIVE";
|
|
92
|
+
AlertIntakeRejectionReason["RATE_LIMITED"] = "RATE_LIMITED";
|
|
93
|
+
})(AlertIntakeRejectionReason || (AlertIntakeRejectionReason = {}));
|
|
94
|
+
//# sourceMappingURL=alert-intake.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-intake.enum.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/enums/alert-intake.enum.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wCAAwC;AACxC,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,iCAAW,CAAA;IACX,2CAAqB,CAAA;IACrB,qCAAe,CAAA;AACnB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B;AAED;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC3B,MAAM;IACN,wDAAiC,CAAA;IACjC,wCAAiB,CAAA;IACjB,wCAAiB,CAAA;IACjB,uFAAuF;IACvF,kDAA2B,CAAA;IAC3B,WAAW;IACX,wDAAiC,CAAA;IACjC,QAAQ;IACR,oCAAa,CAAA;IACb,iGAAiG;IACjG,sDAA+B,CAAA;AACnC,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IAC/B,kDAAuB,CAAA;IACvB,gEAAqC,CAAA;AACzC,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2CAAa,CAAA;IACb,mEAAqC,CAAA;IACrC,2EAA6C,CAAA;AACjD,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,qEAAqE;AACrE,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,oFAAoF;IACpF,4CAAmB,CAAA;IACnB,qEAAqE;IACrE,4CAAmB,CAAA;AACvB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,gEAAgE;AAChE,MAAM,CAAN,IAAY,8BAOX;AAPD,WAAY,8BAA8B;IACtC,8EAA8E;IAC9E,2DAAyB,CAAA;IACzB,gFAAgF;IAChF,+EAA6C,CAAA;IAC7C,mFAAmF;IACnF,mEAAiC,CAAA;AACrC,CAAC,EAPW,8BAA8B,KAA9B,8BAA8B,QAOzC;AAED,yFAAyF;AACzF,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IAClC,uEAAyC,CAAA;IACzC,yEAA2C,CAAA;IAC3C,yEAA2C,CAAA;IAC3C,iEAAmC,CAAA;IACnC,6EAA+C,CAAA;IAC/C,2DAA6B,CAAA;AACjC,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/alert-intake/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAE1C,aAAa;AACb,cAAc,2BAA2B,CAAC;AAE1C,OAAO;AACP,cAAc,yBAAyB,CAAC;AAExC,YAAY;AACZ,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-intake.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/interfaces/alert-intake.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** A routing keyword: 2-20 letters or digits, stored upper-cased. */
|
|
2
|
+
export const ALERT_INTAKE_KEYWORD_PATTERN = /^[A-Z0-9]{2,20}$/;
|
|
3
|
+
/** Upper bounds that keep one organization's settings a form rather than a list to page through. */
|
|
4
|
+
export const MAX_ALERT_INTAKE_CONNECTIONS_PER_ORGANIZATION = 20;
|
|
5
|
+
export const MAX_ALERT_INTAKE_ROUTES_PER_CONNECTION = 200;
|
|
6
|
+
/** One settings value (config or secret). An access token is the longest thing that goes here. */
|
|
7
|
+
export const MAX_ALERT_INTAKE_SETTING_LENGTH = 4096;
|
|
8
|
+
/** Normalises what an operator typed into the stored form. Null when it is not a valid keyword. */
|
|
9
|
+
export function normaliseAlertIntakeKeyword(value) {
|
|
10
|
+
const keyword = (value !== null && value !== void 0 ? value : '').trim().toUpperCase();
|
|
11
|
+
return ALERT_INTAKE_KEYWORD_PATTERN.test(keyword) ? keyword : null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The routing keyword of a message: its first word, upper-cased, punctuation
|
|
15
|
+
* stripped - `g4s, fire at the gate` and `G4S: fire` both give `G4S`.
|
|
16
|
+
* Null when the first word could not be a keyword.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately only the FIRST word. Matching a keyword anywhere in the text would
|
|
19
|
+
* route "I was robbed near the G4S office" to G4S.
|
|
20
|
+
*/
|
|
21
|
+
export function extractAlertIntakeKeyword(text) {
|
|
22
|
+
var _a;
|
|
23
|
+
const first = (_a = (text !== null && text !== void 0 ? text : '').trim().split(/\s+/)[0]) !== null && _a !== void 0 ? _a : '';
|
|
24
|
+
return normaliseAlertIntakeKeyword(first.replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, ''));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The message with its routing keyword removed, so "G4S fire at the gate" is
|
|
28
|
+
* analysed as "fire at the gate". Returns the text unchanged when it does not start
|
|
29
|
+
* with that keyword.
|
|
30
|
+
*/
|
|
31
|
+
export function stripAlertIntakeKeyword(text, keyword) {
|
|
32
|
+
const trimmed = (text !== null && text !== void 0 ? text : '').trim();
|
|
33
|
+
// Keywords are [A-Z0-9] by construction; escaping keeps this safe for a caller that skipped normalising.
|
|
34
|
+
const literal = keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
35
|
+
const match = new RegExp(`^[^A-Za-z0-9]*${literal}(?![A-Za-z0-9])[^A-Za-z0-9]*`, 'i').exec(trimmed);
|
|
36
|
+
if (!match)
|
|
37
|
+
return text;
|
|
38
|
+
const rest = trimmed.slice(match[0].length).trim();
|
|
39
|
+
// A message that was ONLY the keyword is still a message; do not turn it into nothing.
|
|
40
|
+
return rest.length > 0 ? rest : trimmed;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=alert-intake.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-intake.util.js","sourceRoot":"","sources":["../../../../../src/modules/alert-intake/utils/alert-intake.util.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAE/D,oGAAoG;AACpG,MAAM,CAAC,MAAM,6CAA6C,GAAG,EAAE,CAAC;AAChE,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,CAAC;AAC1D,kGAAkG;AAClG,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAEpD,mGAAmG;AACnG,MAAM,UAAU,2BAA2B,CAAC,KAAgC;IACxE,MAAM,OAAO,GAAG,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnD,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAA+B;;IACrE,MAAM,KAAK,GAAG,MAAA,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;IACxD,OAAO,2BAA2B,CAAC,KAAK,CAAC,OAAO,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY,EAAE,OAAe;IACjE,MAAM,OAAO,GAAG,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,yGAAyG;IACzG,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,iBAAiB,OAAO,8BAA8B,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpG,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACnD,uFAAuF;IACvF,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
11
|
+
import { Transform, Type } from 'class-transformer';
|
|
12
|
+
import { ArrayMaxSize, ArrayMinSize, ArrayUnique, IsArray, IsBase64, IsEmail, IsEnum, IsInt, IsObject, IsOptional, IsPositive, IsString, IsUrl, Matches, MaxLength, MinLength, ValidateNested, } from 'class-validator';
|
|
13
|
+
import { BillingDocumentType, BillingEmailTemplate } from '../enums/billing-notification.enum';
|
|
14
|
+
/**
|
|
15
|
+
* clarion-billing -> clarion-notification, over HTTP.
|
|
16
|
+
*
|
|
17
|
+
* Most billing notifications travel as Kafka events. These three routes exist for
|
|
18
|
+
* the cases where billing wants to know, synchronously, whether the message left:
|
|
19
|
+
* `POST /billing/notifications/email | push | sms`.
|
|
20
|
+
*
|
|
21
|
+
* Every limit here is a guard on a route that turns a request into outbound
|
|
22
|
+
* traffic on somebody's behalf, not a tuning choice.
|
|
23
|
+
*/
|
|
24
|
+
/** No line breaks: the value is placed in a header (Subject) or a filename. */
|
|
25
|
+
const SINGLE_LINE = /^[^\r\n]*$/;
|
|
26
|
+
/** A bare file name - no directory part, so it can never be read as a path. */
|
|
27
|
+
const FILE_NAME = /^[^\\/\r\n\0]+$/;
|
|
28
|
+
const HTTPS_ONLY = { protocols: ['https'], require_protocol: true };
|
|
29
|
+
const toArray = ({ value }) => (value === undefined || value === null || Array.isArray(value) ? value : [value]);
|
|
30
|
+
export class BillingDocumentReferenceDto {
|
|
31
|
+
}
|
|
32
|
+
__decorate([
|
|
33
|
+
ApiProperty({ description: 'The clarion-dms document id.' }),
|
|
34
|
+
Type(() => Number),
|
|
35
|
+
IsInt(),
|
|
36
|
+
IsPositive(),
|
|
37
|
+
__metadata("design:type", Number)
|
|
38
|
+
], BillingDocumentReferenceDto.prototype, "documentId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
ApiProperty({ enum: BillingDocumentType }),
|
|
41
|
+
IsEnum(BillingDocumentType),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], BillingDocumentReferenceDto.prototype, "documentType", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
ApiPropertyOptional({ example: 'INV-2026-000123.pdf' }),
|
|
46
|
+
IsString(),
|
|
47
|
+
MaxLength(150),
|
|
48
|
+
Matches(FILE_NAME, { message: 'fileName must be a bare file name' }),
|
|
49
|
+
IsOptional(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], BillingDocumentReferenceDto.prototype, "fileName", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
ApiPropertyOptional({
|
|
54
|
+
description: 'A pre-signed URL for the document. WITH it the PDF is fetched and attached; WITHOUT it the document ' +
|
|
55
|
+
'is only named in the email. Billing documents are private and their signed URLs expire within the hour, ' +
|
|
56
|
+
'so the URL is never placed in the email itself.',
|
|
57
|
+
}),
|
|
58
|
+
IsUrl(HTTPS_ONLY),
|
|
59
|
+
MaxLength(2048),
|
|
60
|
+
IsOptional(),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], BillingDocumentReferenceDto.prototype, "signedUrl", void 0);
|
|
63
|
+
/** @deprecated Raw attachments. Prefer `documents`. */
|
|
64
|
+
export class BillingEmailAttachmentDto {
|
|
65
|
+
}
|
|
66
|
+
__decorate([
|
|
67
|
+
ApiProperty(),
|
|
68
|
+
IsString(),
|
|
69
|
+
MaxLength(150),
|
|
70
|
+
Matches(FILE_NAME, { message: 'filename must be a bare file name' }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], BillingEmailAttachmentDto.prototype, "filename", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
ApiPropertyOptional(),
|
|
75
|
+
IsUrl(HTTPS_ONLY),
|
|
76
|
+
MaxLength(2048),
|
|
77
|
+
IsOptional(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], BillingEmailAttachmentDto.prototype, "url", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
ApiPropertyOptional({ description: 'Base64. About 10 MB of file at most.' }),
|
|
82
|
+
IsBase64(),
|
|
83
|
+
MaxLength(14000000),
|
|
84
|
+
IsOptional(),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], BillingEmailAttachmentDto.prototype, "content", void 0);
|
|
87
|
+
export class BillingEmailNotificationDto {
|
|
88
|
+
}
|
|
89
|
+
__decorate([
|
|
90
|
+
ApiProperty({ type: [String], description: 'One address or several. Each recipient gets an individual email.' }),
|
|
91
|
+
Transform(toArray),
|
|
92
|
+
IsArray(),
|
|
93
|
+
ArrayMinSize(1),
|
|
94
|
+
ArrayMaxSize(50),
|
|
95
|
+
ArrayUnique(),
|
|
96
|
+
IsEmail({}, { each: true }),
|
|
97
|
+
__metadata("design:type", Array)
|
|
98
|
+
], BillingEmailNotificationDto.prototype, "to", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
ApiProperty(),
|
|
101
|
+
IsString(),
|
|
102
|
+
MinLength(1),
|
|
103
|
+
MaxLength(200),
|
|
104
|
+
Matches(SINGLE_LINE, { message: 'subject may not contain line breaks' }),
|
|
105
|
+
__metadata("design:type", String)
|
|
106
|
+
], BillingEmailNotificationDto.prototype, "subject", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
ApiProperty({ enum: BillingEmailTemplate }),
|
|
109
|
+
IsEnum(BillingEmailTemplate),
|
|
110
|
+
__metadata("design:type", String)
|
|
111
|
+
], BillingEmailNotificationDto.prototype, "template", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
ApiPropertyOptional({
|
|
114
|
+
description: 'The organization the email is sent on behalf of: decides the branding and the From address.',
|
|
115
|
+
}),
|
|
116
|
+
Type(() => Number),
|
|
117
|
+
IsInt(),
|
|
118
|
+
IsPositive(),
|
|
119
|
+
IsOptional(),
|
|
120
|
+
__metadata("design:type", Number)
|
|
121
|
+
], BillingEmailNotificationDto.prototype, "organizationId", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
ApiProperty({ description: 'See BillingEmailTemplateData.' }),
|
|
124
|
+
IsObject(),
|
|
125
|
+
__metadata("design:type", Object)
|
|
126
|
+
], BillingEmailNotificationDto.prototype, "data", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
ApiPropertyOptional({ type: [BillingDocumentReferenceDto] }),
|
|
129
|
+
IsArray(),
|
|
130
|
+
ArrayMaxSize(10),
|
|
131
|
+
ValidateNested({ each: true }),
|
|
132
|
+
Type(() => BillingDocumentReferenceDto),
|
|
133
|
+
IsOptional(),
|
|
134
|
+
__metadata("design:type", Array)
|
|
135
|
+
], BillingEmailNotificationDto.prototype, "documents", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
ApiPropertyOptional({ type: [BillingEmailAttachmentDto], deprecated: true }),
|
|
138
|
+
IsArray(),
|
|
139
|
+
ArrayMaxSize(10),
|
|
140
|
+
ValidateNested({ each: true }),
|
|
141
|
+
Type(() => BillingEmailAttachmentDto),
|
|
142
|
+
IsOptional(),
|
|
143
|
+
__metadata("design:type", Array)
|
|
144
|
+
], BillingEmailNotificationDto.prototype, "attachments", void 0);
|
|
145
|
+
export class BillingPushNotificationDto {
|
|
146
|
+
}
|
|
147
|
+
__decorate([
|
|
148
|
+
ApiProperty({ type: [Number] }),
|
|
149
|
+
IsArray(),
|
|
150
|
+
ArrayMinSize(1),
|
|
151
|
+
ArrayMaxSize(500),
|
|
152
|
+
ArrayUnique(),
|
|
153
|
+
Type(() => Number),
|
|
154
|
+
IsInt({ each: true }),
|
|
155
|
+
IsPositive({ each: true }),
|
|
156
|
+
__metadata("design:type", Array)
|
|
157
|
+
], BillingPushNotificationDto.prototype, "userIds", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
ApiProperty(),
|
|
160
|
+
IsString(),
|
|
161
|
+
MinLength(1),
|
|
162
|
+
MaxLength(120),
|
|
163
|
+
__metadata("design:type", String)
|
|
164
|
+
], BillingPushNotificationDto.prototype, "title", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
ApiProperty(),
|
|
167
|
+
IsString(),
|
|
168
|
+
MinLength(1),
|
|
169
|
+
MaxLength(500),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], BillingPushNotificationDto.prototype, "body", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
ApiPropertyOptional({ description: 'Delivered to the app as FCM data; non-string values are JSON-encoded.' }),
|
|
174
|
+
IsObject(),
|
|
175
|
+
IsOptional(),
|
|
176
|
+
__metadata("design:type", Object)
|
|
177
|
+
], BillingPushNotificationDto.prototype, "data", void 0);
|
|
178
|
+
export class BillingSmsNotificationDto {
|
|
179
|
+
}
|
|
180
|
+
__decorate([
|
|
181
|
+
ApiProperty({ type: [String], description: 'E.164, or local numbers of a supported country.' }),
|
|
182
|
+
IsArray(),
|
|
183
|
+
ArrayMinSize(1),
|
|
184
|
+
ArrayMaxSize(100),
|
|
185
|
+
ArrayUnique(),
|
|
186
|
+
IsString({ each: true }),
|
|
187
|
+
MaxLength(20, { each: true }),
|
|
188
|
+
__metadata("design:type", Array)
|
|
189
|
+
], BillingSmsNotificationDto.prototype, "phoneNumbers", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
ApiProperty({ description: 'At most 1000 characters (about six SMS segments).' }),
|
|
192
|
+
IsString(),
|
|
193
|
+
MinLength(1),
|
|
194
|
+
MaxLength(1000),
|
|
195
|
+
__metadata("design:type", String)
|
|
196
|
+
], BillingSmsNotificationDto.prototype, "message", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
ApiPropertyOptional({ description: 'Decides the sender ID the SMS arrives under.' }),
|
|
199
|
+
Type(() => Number),
|
|
200
|
+
IsInt(),
|
|
201
|
+
IsPositive(),
|
|
202
|
+
IsOptional(),
|
|
203
|
+
__metadata("design:type", Number)
|
|
204
|
+
], BillingSmsNotificationDto.prototype, "organizationId", void 0);
|
|
205
|
+
//# sourceMappingURL=billing-notification.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-notification.dto.js","sourceRoot":"","sources":["../../../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@@
|
|
|
1
|
+
/**
|
|
2
|
+
* The emails clarion-billing can ask clarion-notification to send.
|
|
3
|
+
*
|
|
4
|
+
* A closed set on purpose. The route renders a template BY NAME on the say-so of
|
|
5
|
+
* another service; accepting any string would let a caller render any template in
|
|
6
|
+
* the notification service (an OTP email, a password reset) with a body of its
|
|
7
|
+
* choosing. Each value here has copy defaults in the notification service - add
|
|
8
|
+
* the value and the defaults together.
|
|
9
|
+
*/
|
|
10
|
+
export var BillingEmailTemplate;
|
|
11
|
+
(function (BillingEmailTemplate) {
|
|
12
|
+
/** An invoice or settlement invoice is ready. Normally carries the PDF. */
|
|
13
|
+
BillingEmailTemplate["INVOICE"] = "billing_invoice";
|
|
14
|
+
/** A payment was received. Normally carries the receipt PDF. */
|
|
15
|
+
BillingEmailTemplate["RECEIPT"] = "billing_receipt";
|
|
16
|
+
/** A corporate order was placed or confirmed. */
|
|
17
|
+
BillingEmailTemplate["ORDER_CONFIRMATION"] = "billing_order_confirmation";
|
|
18
|
+
/** Anything else billing needs to say; the caller supplies heading and intro. */
|
|
19
|
+
BillingEmailTemplate["GENERIC"] = "billing_generic";
|
|
20
|
+
})(BillingEmailTemplate || (BillingEmailTemplate = {}));
|
|
21
|
+
/** What a referenced billing document is. Mirrors the documents clarion-billing stores in clarion-dms. */
|
|
22
|
+
export var BillingDocumentType;
|
|
23
|
+
(function (BillingDocumentType) {
|
|
24
|
+
BillingDocumentType["INVOICE"] = "INVOICE";
|
|
25
|
+
BillingDocumentType["RECEIPT"] = "RECEIPT";
|
|
26
|
+
BillingDocumentType["CORPORATE_ORDER"] = "CORPORATE_ORDER";
|
|
27
|
+
BillingDocumentType["SETTLEMENT_INVOICE"] = "SETTLEMENT_INVOICE";
|
|
28
|
+
BillingDocumentType["SETTLEMENT_RECEIPT"] = "SETTLEMENT_RECEIPT";
|
|
29
|
+
})(BillingDocumentType || (BillingDocumentType = {}));
|
|
30
|
+
//# sourceMappingURL=billing-notification.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-notification.enum.js","sourceRoot":"","sources":["../../../../../src/modules/notification/enums/billing-notification.enum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,oBASX;AATD,WAAY,oBAAoB;IAC5B,2EAA2E;IAC3E,mDAA2B,CAAA;IAC3B,gEAAgE;IAChE,mDAA2B,CAAA;IAC3B,iDAAiD;IACjD,yEAAiD,CAAA;IACjD,iFAAiF;IACjF,mDAA2B,CAAA;AAC/B,CAAC,EATW,oBAAoB,KAApB,oBAAoB,QAS/B;AAED,0GAA0G;AAC1G,MAAM,CAAN,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC3B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;IACnB,0DAAmC,CAAA;IACnC,gEAAyC,CAAA;IACzC,gEAAyC,CAAA;AAC7C,CAAC,EANW,mBAAmB,KAAnB,mBAAmB,QAM9B"}
|