@tellescope/validation 1.3.38 → 1.3.41

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.38",
3
+ "version": "1.3.41",
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.38",
27
- "@tellescope/types-client": "^1.3.38",
28
- "@tellescope/types-models": "^1.3.38",
26
+ "@tellescope/constants": "^1.3.41",
27
+ "@tellescope/types-client": "^1.3.41",
28
+ "@tellescope/types-models": "^1.3.41",
29
29
  "@tellescope/types-utilities": "^1.3.20",
30
- "@tellescope/utilities": "^1.3.38",
30
+ "@tellescope/utilities": "^1.3.41",
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": "672f374369cbffaf534e9676c5402c25cdb118d8",
47
+ "gitHead": "e3d712943ce899bb2c86f729e01d272cbdd5872f",
48
48
  "composite": true
49
49
  }
package/src/validation.ts CHANGED
@@ -128,6 +128,9 @@ import {
128
128
  DatabaseRecordFields,
129
129
  DatabaseRecordValues,
130
130
  DatabaseRecordField,
131
+ OrganizationAccess,
132
+ CalendarEventReminderInfoForType,
133
+ CalendarEventReminderNotificationInfo,
131
134
  } from "@tellescope/types-models"
132
135
  import {
133
136
  DatabaseRecord,
@@ -1375,13 +1378,34 @@ const delayValidation = {
1375
1378
  cancelConditions: cancelConditionsValidator({ isOptional: true, emptyListOk: true, })
1376
1379
  }
1377
1380
 
1378
- export const calendarEventReminderValidator = objectValidator<CalendarEventReminder>({
1379
- type: exactMatchValidator<CalendarEventReminderType>(['webhook'])(), // built-in calendar-specific reminder
1380
- // action: use this field for general pupose automation event actions
1381
- remindAt: nonNegNumberValidator(),
1381
+ const sharedReminderValidators = {
1382
+ msBeforeStartTime: nonNegNumberValidator(),
1382
1383
  didRemind: booleanValidator({ isOptional: true }),
1383
- })()
1384
- 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())
1385
1409
 
1386
1410
  export const automationEventValidator = orValidator<{ [K in AutomationEventType]: AutomationEvent & { type: K } } >({
1387
1411
  enterState: objectValidator<EnterStateAutomationEvent>({
@@ -1734,4 +1758,11 @@ export const databaseRecordValueValidator = orValidator<{ [K in DatabaseRecordFi
1734
1758
  value: numberValidator(),
1735
1759
  })(),
1736
1760
  })
1737
- export const databaseRecordValuesValidator = listValidator(databaseRecordValueValidator())
1761
+ export const databaseRecordValuesValidator = listValidator(databaseRecordValueValidator())
1762
+
1763
+ export const organizationAccessValidator = objectValidator<OrganizationAccess>({
1764
+ create: booleanValidator({ isOptional: true }),
1765
+ update: booleanValidator({ isOptional: true }),
1766
+ read: booleanValidator({ isOptional: true }),
1767
+ delete: booleanValidator({ isOptional: true }),
1768
+ })