@tellescope/validation 1.3.40 → 1.3.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/validation",
3
- "version": "1.3.40",
3
+ "version": "1.3.42",
4
4
  "description": "Input validation functions for server, client, and schema definition",
5
5
  "main": "./lib/cjs/validation.js",
6
6
  "module": "./lib/esm/validation.js",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "homepage": "https://github.com/tellescope-os/tellescope#readme",
25
25
  "dependencies": {
26
- "@tellescope/constants": "^1.3.40",
27
- "@tellescope/types-client": "^1.3.40",
28
- "@tellescope/types-models": "^1.3.40",
26
+ "@tellescope/constants": "^1.3.42",
27
+ "@tellescope/types-client": "^1.3.42",
28
+ "@tellescope/types-models": "^1.3.42",
29
29
  "@tellescope/types-utilities": "^1.3.20",
30
- "@tellescope/utilities": "^1.3.40",
30
+ "@tellescope/utilities": "^1.3.42",
31
31
  "validator": "^13.5.2"
32
32
  },
33
33
  "devDependencies": {
@@ -44,6 +44,6 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "5b9a87e9daf8b38a7e177bf6910618d91d42c042",
47
+ "gitHead": "0482cefdbb0f2fed94d3dd0ee7c173ca1302a99b",
48
48
  "composite": true
49
49
  }
package/src/validation.ts CHANGED
@@ -129,6 +129,8 @@ import {
129
129
  DatabaseRecordValues,
130
130
  DatabaseRecordField,
131
131
  OrganizationAccess,
132
+ CalendarEventReminderInfoForType,
133
+ CalendarEventReminderNotificationInfo,
132
134
  } from "@tellescope/types-models"
133
135
  import {
134
136
  DatabaseRecord,
@@ -1376,13 +1378,34 @@ const delayValidation = {
1376
1378
  cancelConditions: cancelConditionsValidator({ isOptional: true, emptyListOk: true, })
1377
1379
  }
1378
1380
 
1379
- export const calendarEventReminderValidator = objectValidator<CalendarEventReminder>({
1380
- type: exactMatchValidator<CalendarEventReminderType>(['webhook'])(), // built-in calendar-specific reminder
1381
- // action: use this field for general pupose automation event actions
1382
- remindAt: nonNegNumberValidator(),
1381
+ const sharedReminderValidators = {
1382
+ msBeforeStartTime: nonNegNumberValidator(),
1383
1383
  didRemind: booleanValidator({ isOptional: true }),
1384
- })()
1385
- export const listOfCalendarEventRemindersValidator = listValidator(calendarEventReminderValidator)
1384
+ }
1385
+
1386
+ export const calendarEventReminderValidator = orValidator<{ [K in CalendarEventReminderType]: CalendarEventReminderInfoForType[K] } >({
1387
+ webhook: objectValidator<CalendarEventReminderInfoForType['webhook']>({
1388
+ info: objectValidator<{}>({}, { emptyOk: true })({ isOptional: true }),
1389
+ type: exactMatchValidator<'webhook'>(['webhook'])(),
1390
+ ...sharedReminderValidators,
1391
+ })(),
1392
+ "enduser-notification": objectValidator<CalendarEventReminderInfoForType['enduser-notification']>({
1393
+ info: objectValidator<CalendarEventReminderNotificationInfo>({
1394
+ templateId: mongoIdOptional,
1395
+ }, { emptyOk: true })(),
1396
+ type: exactMatchValidator<'enduser-notification'>(['enduser-notification'])(),
1397
+ ...sharedReminderValidators,
1398
+ })(),
1399
+ "user-notification": objectValidator<CalendarEventReminderInfoForType['user-notification']>({
1400
+ info: objectValidator<CalendarEventReminderNotificationInfo>({
1401
+ templateId: mongoIdOptional,
1402
+ }, { emptyOk: true })(),
1403
+ type: exactMatchValidator<'user-notification'>(['user-notification'])(),
1404
+ ...sharedReminderValidators,
1405
+ })(),
1406
+ })
1407
+
1408
+ export const listOfCalendarEventRemindersValidator = listValidatorEmptyOk(calendarEventReminderValidator())
1386
1409
 
1387
1410
  export const automationEventValidator = orValidator<{ [K in AutomationEventType]: AutomationEvent & { type: K } } >({
1388
1411
  enterState: objectValidator<EnterStateAutomationEvent>({