iamcal 2.1.2 → 3.0.0
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/lib/component.d.ts +25 -4
- package/lib/component.d.ts.map +1 -1
- package/lib/component.js +60 -51
- package/lib/components/Calendar.d.ts +0 -20
- package/lib/components/Calendar.d.ts.map +1 -1
- package/lib/components/Calendar.js +2 -24
- package/lib/components/CalendarEvent.d.ts +1 -25
- package/lib/components/CalendarEvent.d.ts.map +1 -1
- package/lib/components/CalendarEvent.js +4 -29
- package/lib/components/TimeZone.d.ts +0 -38
- package/lib/components/TimeZone.d.ts.map +1 -1
- package/lib/components/TimeZone.js +1 -40
- package/lib/components/TimeZoneOffset.d.ts +0 -28
- package/lib/components/TimeZoneOffset.d.ts.map +1 -1
- package/lib/components/TimeZoneOffset.js +1 -30
- package/lib/date.d.ts +2 -10
- package/lib/date.d.ts.map +1 -1
- package/lib/date.js +15 -20
- package/lib/parse.d.ts +9 -16
- package/lib/parse.d.ts.map +1 -1
- package/lib/parse.js +188 -35
- package/lib/patterns.d.ts +28 -0
- package/lib/patterns.d.ts.map +1 -1
- package/lib/patterns.js +56 -2
- package/lib/property/Property.d.ts +344 -0
- package/lib/property/Property.d.ts.map +1 -0
- package/lib/property/Property.js +508 -0
- package/lib/property/escape.d.ts +46 -0
- package/lib/property/escape.d.ts.map +1 -0
- package/lib/property/escape.js +101 -0
- package/lib/property/index.d.ts +7 -0
- package/lib/property/index.d.ts.map +1 -0
- package/lib/property/index.js +23 -0
- package/lib/property/names.d.ts +11 -0
- package/lib/property/names.d.ts.map +1 -0
- package/lib/property/names.js +62 -0
- package/lib/property/parameter.d.ts +10 -0
- package/lib/property/parameter.d.ts.map +1 -0
- package/lib/property/parameter.js +3 -0
- package/lib/{property.d.ts → property/validate.d.ts} +9 -35
- package/lib/property/validate.d.ts.map +1 -0
- package/lib/property/validate.js +317 -0
- package/lib/property/valueType.d.ts +18 -0
- package/lib/property/valueType.d.ts.map +1 -0
- package/lib/property/valueType.js +82 -0
- package/package.json +3 -1
- package/src/component.ts +58 -52
- package/src/components/Calendar.ts +6 -30
- package/src/components/CalendarEvent.ts +7 -33
- package/src/components/TimeZone.ts +3 -51
- package/src/components/TimeZoneOffset.ts +5 -40
- package/src/date.ts +14 -30
- package/src/parse.ts +212 -40
- package/src/patterns.ts +64 -0
- package/src/property/Property.ts +609 -0
- package/src/property/escape.ts +102 -0
- package/src/property/index.ts +6 -0
- package/src/property/names.ts +65 -0
- package/src/property/parameter.ts +33 -0
- package/src/{property.ts → property/validate.ts} +23 -204
- package/src/property/valueType.ts +87 -0
- package/lib/property.d.ts.map +0 -1
- package/lib/property.js +0 -450
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const knownPropertyNames = [
|
|
2
|
+
'CALSCALE',
|
|
3
|
+
'METHOD',
|
|
4
|
+
'PRODID',
|
|
5
|
+
'VERSION',
|
|
6
|
+
'ATTACH',
|
|
7
|
+
'CATEGORIES',
|
|
8
|
+
'CLASS',
|
|
9
|
+
'COMMENT',
|
|
10
|
+
'DESCRIPTION',
|
|
11
|
+
'GEO',
|
|
12
|
+
'LOCATION',
|
|
13
|
+
'PERCENT-COMPLETE',
|
|
14
|
+
'PRIORITY',
|
|
15
|
+
'RESOURCES',
|
|
16
|
+
'STATUS',
|
|
17
|
+
'SUMMARY',
|
|
18
|
+
'COMPLETED',
|
|
19
|
+
'DTEND',
|
|
20
|
+
'DUE',
|
|
21
|
+
'DTSTART',
|
|
22
|
+
'DURATION',
|
|
23
|
+
'FREEBUSY',
|
|
24
|
+
'TRANSP',
|
|
25
|
+
'TZID',
|
|
26
|
+
'TZNAME',
|
|
27
|
+
'TZOFFSETFROM',
|
|
28
|
+
'TZOFFSETTO',
|
|
29
|
+
'TZURL',
|
|
30
|
+
'ATTENDEE',
|
|
31
|
+
'CONTACT',
|
|
32
|
+
'ORGANIZER',
|
|
33
|
+
'RECURRENCE-ID',
|
|
34
|
+
'RELATED-TO',
|
|
35
|
+
'URL',
|
|
36
|
+
'UID',
|
|
37
|
+
'EXDATE',
|
|
38
|
+
'RDATE',
|
|
39
|
+
'RRULE',
|
|
40
|
+
'ACTION',
|
|
41
|
+
'REPEAT',
|
|
42
|
+
'TRIGGER',
|
|
43
|
+
'CREATED',
|
|
44
|
+
'DTSTAMP',
|
|
45
|
+
'LAST-MODIFIED',
|
|
46
|
+
'SEQUENCE',
|
|
47
|
+
'REQUEST-STATUS',
|
|
48
|
+
] as const
|
|
49
|
+
export type KnownPropertyName = (typeof knownPropertyNames)[number]
|
|
50
|
+
export type AllowedPropertyName =
|
|
51
|
+
| KnownPropertyName
|
|
52
|
+
| (`X-${string}` & {})
|
|
53
|
+
| (string & {})
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Check if a property name is known. A property name is known if it is present
|
|
57
|
+
* in {@link knownPropertyNames}.
|
|
58
|
+
* @param name The property name to check.
|
|
59
|
+
* @returns If the name is a known property name.
|
|
60
|
+
*/
|
|
61
|
+
export function isKnownPropertyName(
|
|
62
|
+
name: AllowedPropertyName
|
|
63
|
+
): name is KnownPropertyName {
|
|
64
|
+
return knownPropertyNames.includes(name as KnownPropertyName)
|
|
65
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type CalendarUserType =
|
|
2
|
+
| 'INDIVIDUAL'
|
|
3
|
+
| 'GROUP'
|
|
4
|
+
| 'RESOURCE'
|
|
5
|
+
| 'ROOM'
|
|
6
|
+
| 'UNKNOWN'
|
|
7
|
+
| (string & {})
|
|
8
|
+
export type Encoding = '8BIT' | 'BASE64'
|
|
9
|
+
export type FreeBusyTimeType =
|
|
10
|
+
| 'FREE'
|
|
11
|
+
| 'BUSY'
|
|
12
|
+
| 'BUSY-UNAVAILABLE'
|
|
13
|
+
| 'BUSY-TENTATIVE'
|
|
14
|
+
| (string & {})
|
|
15
|
+
export type ParticipationStatus =
|
|
16
|
+
| 'NEEDS-ACTION'
|
|
17
|
+
| 'ACCEPTED'
|
|
18
|
+
| 'DECLINED'
|
|
19
|
+
| 'TENTATIVE'
|
|
20
|
+
| 'DELEGATED'
|
|
21
|
+
| 'COMPLETED'
|
|
22
|
+
| 'IN-PROCESS'
|
|
23
|
+
| (string & {})
|
|
24
|
+
export type RecurrenceIdentifierRange = 'THISANDFUTURE'
|
|
25
|
+
export type AlarmTriggerRelationship = 'START' | 'END'
|
|
26
|
+
export type RelationshipType = 'PARENT' | 'CHILD' | 'SIBLING' | (string & {})
|
|
27
|
+
export type ParticipationRole =
|
|
28
|
+
| 'CHAIR'
|
|
29
|
+
| 'REQ-PARTICIPANT'
|
|
30
|
+
| 'OPT-PARTICIPANT'
|
|
31
|
+
| 'NON-PARTICIPANT'
|
|
32
|
+
| (string & {})
|
|
33
|
+
export type RsvpExpectation = 'TRUE' | 'FALSE'
|
|
@@ -1,185 +1,9 @@
|
|
|
1
|
-
import { parseDateString, parseDateTimeString } from '
|
|
2
|
-
import * as patterns from '
|
|
3
|
-
import { matchesWholeString } from '
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
params: string[]
|
|
8
|
-
value: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const knownPropertyNames = [
|
|
12
|
-
'CALSCALE',
|
|
13
|
-
'METHOD',
|
|
14
|
-
'PRODID',
|
|
15
|
-
'VERSION',
|
|
16
|
-
'ATTACH',
|
|
17
|
-
'CATEGORIES',
|
|
18
|
-
'CLASS',
|
|
19
|
-
'COMMENT',
|
|
20
|
-
'DESCRIPTION',
|
|
21
|
-
'GEO',
|
|
22
|
-
'LOCATION',
|
|
23
|
-
'PERCENT-COMPLETE',
|
|
24
|
-
'PRIORITY',
|
|
25
|
-
'RESOURCES',
|
|
26
|
-
'STATUS',
|
|
27
|
-
'SUMMARY',
|
|
28
|
-
'COMPLETED',
|
|
29
|
-
'DTEND',
|
|
30
|
-
'DUE',
|
|
31
|
-
'DTSTART',
|
|
32
|
-
'DURATION',
|
|
33
|
-
'FREEBUSY',
|
|
34
|
-
'TRANSP',
|
|
35
|
-
'TZID',
|
|
36
|
-
'TZNAME',
|
|
37
|
-
'TZOFFSETFROM',
|
|
38
|
-
'TZOFFSETTO',
|
|
39
|
-
'TZURL',
|
|
40
|
-
'ATTENDEE',
|
|
41
|
-
'CONTACT',
|
|
42
|
-
'ORGANIZER',
|
|
43
|
-
'RECURRENCE-ID',
|
|
44
|
-
'RELATED-TO',
|
|
45
|
-
'URL',
|
|
46
|
-
'UID',
|
|
47
|
-
'EXDATE',
|
|
48
|
-
'RDATE',
|
|
49
|
-
'RRULE',
|
|
50
|
-
'ACTION',
|
|
51
|
-
'REPEAT',
|
|
52
|
-
'TRIGGER',
|
|
53
|
-
'CREATED',
|
|
54
|
-
'DTSTAMP',
|
|
55
|
-
'LAST-MODIFIED',
|
|
56
|
-
'SEQUENCE',
|
|
57
|
-
'REQUEST-STATUS',
|
|
58
|
-
] as const
|
|
59
|
-
export type KnownPropertyName = (typeof knownPropertyNames)[number]
|
|
60
|
-
export type AllowedPropertyName =
|
|
61
|
-
| KnownPropertyName
|
|
62
|
-
| (`X-${string}` & {})
|
|
63
|
-
| (string & {})
|
|
64
|
-
|
|
65
|
-
export const knownValueTypes = [
|
|
66
|
-
'BINARY',
|
|
67
|
-
'BOOLEAN',
|
|
68
|
-
'CAL-ADDRESS',
|
|
69
|
-
'DATE',
|
|
70
|
-
'DATE-TIME',
|
|
71
|
-
'DURATION',
|
|
72
|
-
'FLOAT',
|
|
73
|
-
'INTEGER',
|
|
74
|
-
'PERIOD',
|
|
75
|
-
'RECUR',
|
|
76
|
-
'TEXT',
|
|
77
|
-
'TIME',
|
|
78
|
-
'URI',
|
|
79
|
-
'UTC-OFFSET',
|
|
80
|
-
] as const
|
|
81
|
-
export type KnownValueType = (typeof knownValueTypes)[number]
|
|
82
|
-
export type AllowedValueType = KnownValueType | (string & {})
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* The value types that each property supports as defined by the iCalendar
|
|
86
|
-
* specification. The first in the list is the default type.
|
|
87
|
-
*/
|
|
88
|
-
export const supportedValueTypes: {
|
|
89
|
-
[name in KnownPropertyName]: KnownValueType[]
|
|
90
|
-
} = {
|
|
91
|
-
CALSCALE: ['TEXT'],
|
|
92
|
-
METHOD: ['TEXT'],
|
|
93
|
-
PRODID: ['TEXT'],
|
|
94
|
-
VERSION: ['TEXT'],
|
|
95
|
-
ATTACH: ['URI', 'BINARY'],
|
|
96
|
-
CATEGORIES: ['TEXT'],
|
|
97
|
-
CLASS: ['TEXT'],
|
|
98
|
-
COMMENT: ['TEXT'],
|
|
99
|
-
DESCRIPTION: ['TEXT'],
|
|
100
|
-
GEO: ['FLOAT'],
|
|
101
|
-
LOCATION: ['TEXT'],
|
|
102
|
-
'PERCENT-COMPLETE': ['INTEGER'],
|
|
103
|
-
PRIORITY: ['INTEGER'],
|
|
104
|
-
RESOURCES: ['TEXT'],
|
|
105
|
-
STATUS: ['TEXT'],
|
|
106
|
-
SUMMARY: ['TEXT'],
|
|
107
|
-
COMPLETED: ['DATE-TIME'],
|
|
108
|
-
DTEND: ['DATE-TIME', 'DATE'],
|
|
109
|
-
DUE: ['DATE-TIME', 'DATE'],
|
|
110
|
-
DTSTART: ['DATE-TIME', 'DATE'],
|
|
111
|
-
DURATION: ['DURATION'],
|
|
112
|
-
FREEBUSY: ['PERIOD'],
|
|
113
|
-
TRANSP: ['TEXT'],
|
|
114
|
-
TZID: ['TEXT'],
|
|
115
|
-
TZNAME: ['TEXT'],
|
|
116
|
-
TZOFFSETFROM: ['UTC-OFFSET'],
|
|
117
|
-
TZOFFSETTO: ['UTC-OFFSET'],
|
|
118
|
-
TZURL: ['URI'],
|
|
119
|
-
ATTENDEE: ['CAL-ADDRESS'],
|
|
120
|
-
CONTACT: ['TEXT'],
|
|
121
|
-
ORGANIZER: ['CAL-ADDRESS'],
|
|
122
|
-
'RECURRENCE-ID': ['DATE-TIME', 'DATE'],
|
|
123
|
-
'RELATED-TO': ['TEXT'],
|
|
124
|
-
URL: ['URI'],
|
|
125
|
-
UID: ['TEXT'],
|
|
126
|
-
EXDATE: ['DATE-TIME', 'DATE'],
|
|
127
|
-
RDATE: ['DATE-TIME', 'DATE', 'PERIOD'],
|
|
128
|
-
RRULE: ['RECUR'],
|
|
129
|
-
ACTION: ['TEXT'],
|
|
130
|
-
REPEAT: ['INTEGER'],
|
|
131
|
-
TRIGGER: ['DURATION', 'DATE-TIME'],
|
|
132
|
-
CREATED: ['DATE-TIME'],
|
|
133
|
-
DTSTAMP: ['DATE-TIME'],
|
|
134
|
-
'LAST-MODIFIED': ['DATE-TIME'],
|
|
135
|
-
SEQUENCE: ['INTEGER'],
|
|
136
|
-
'REQUEST-STATUS': ['TEXT'],
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Get the value type of a property, as defined by the VALUE parameter.
|
|
141
|
-
* @param property The property to get the value type of.
|
|
142
|
-
* @returns The value type if present, else `undefined`.
|
|
143
|
-
* @throws If the parameter value is misformed.
|
|
144
|
-
*/
|
|
145
|
-
export function getPropertyValueType(
|
|
146
|
-
property: Property
|
|
147
|
-
): AllowedValueType | undefined
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Get the value type of a property, as defined by the VALUE parameter.
|
|
151
|
-
* @param property The property to get the value type of.
|
|
152
|
-
* @param defaultValue The default value to return if the property VALUE parameter is not present.
|
|
153
|
-
* @returns The value type if present, else `defaultValue` or `undefined`.
|
|
154
|
-
* @throws If the parameter value is misformed.
|
|
155
|
-
*/
|
|
156
|
-
export function getPropertyValueType(
|
|
157
|
-
property: Property,
|
|
158
|
-
defaultValue: AllowedValueType
|
|
159
|
-
): AllowedValueType
|
|
160
|
-
export function getPropertyValueType(
|
|
161
|
-
property: Property,
|
|
162
|
-
defaultValue: AllowedValueType | undefined
|
|
163
|
-
): AllowedValueType | undefined
|
|
164
|
-
export function getPropertyValueType(
|
|
165
|
-
property: Property,
|
|
166
|
-
defaultValue?: AllowedValueType | undefined
|
|
167
|
-
): AllowedValueType | undefined {
|
|
168
|
-
const found = property.params.find(param => /^VALUE=.+$/i.test(param))
|
|
169
|
-
if (!found) return defaultValue
|
|
170
|
-
|
|
171
|
-
if (!patterns.matchesWholeString(patterns.paramValue, found)) {
|
|
172
|
-
throw new Error('Parameter value is misformed')
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Return as uppercase if known value
|
|
176
|
-
const value = found?.split('=')[1]
|
|
177
|
-
if ((knownValueTypes as readonly string[]).includes(value.toUpperCase())) {
|
|
178
|
-
return value.toUpperCase()
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return value
|
|
182
|
-
}
|
|
1
|
+
import { parseDateString, parseDateTimeString } from '../date'
|
|
2
|
+
import * as patterns from '../patterns'
|
|
3
|
+
import { matchesWholeString } from '../patterns'
|
|
4
|
+
import type { Property } from './Property'
|
|
5
|
+
import { isKnownPropertyName, type KnownPropertyName } from './names'
|
|
6
|
+
import { type AllowedValueType, supportedValueTypes } from './valueType'
|
|
183
7
|
|
|
184
8
|
/** Represents an error which occurs while validating a calendar property. */
|
|
185
9
|
export class PropertyValidationError extends Error {
|
|
@@ -431,6 +255,18 @@ export function validateValue(value: string, type: AllowedValueType) {
|
|
|
431
255
|
}
|
|
432
256
|
}
|
|
433
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Validate if a value is a valid content type.
|
|
260
|
+
* @param value The value to validate.
|
|
261
|
+
* @throws {PropertyValidationError} If the validation fails.
|
|
262
|
+
*/
|
|
263
|
+
export function validateContentType(value: string) {
|
|
264
|
+
if (!matchesWholeString(patterns.contentType, value))
|
|
265
|
+
throw new PropertyValidationError(
|
|
266
|
+
`${value} does not match pattern for content type`
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
434
270
|
/* eslint-disable jsdoc/require-description-complete-sentence --
|
|
435
271
|
* Does not allow line to end with ':'.
|
|
436
272
|
**/
|
|
@@ -452,32 +288,15 @@ export function validateValue(value: string, type: AllowedValueType) {
|
|
|
452
288
|
export function validateProperty(property: Property) {
|
|
453
289
|
// Get supported and default types
|
|
454
290
|
let supportedTypes: AllowedValueType[] | undefined = undefined
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (knownPropertyNames.includes(property.name as KnownPropertyName)) {
|
|
458
|
-
const name = property.name as KnownPropertyName
|
|
291
|
+
if (isKnownPropertyName(property.name)) {
|
|
292
|
+
const name: KnownPropertyName = property.name
|
|
459
293
|
supportedTypes = supportedValueTypes[name]
|
|
460
|
-
defaultType = supportedTypes[0]
|
|
461
294
|
}
|
|
462
295
|
|
|
463
|
-
//
|
|
464
|
-
const valueType =
|
|
465
|
-
|
|
466
|
-
// If value type is unknown, validate as TEXT
|
|
467
|
-
if (valueType === undefined) {
|
|
468
|
-
try {
|
|
469
|
-
validateText(property.value)
|
|
470
|
-
} catch (e) {
|
|
471
|
-
throw e instanceof PropertyValidationError
|
|
472
|
-
? new PropertyValidationError(
|
|
473
|
-
`Unknown property ${property.name} is not valid text`
|
|
474
|
-
)
|
|
475
|
-
: e
|
|
476
|
-
}
|
|
477
|
-
return
|
|
478
|
-
}
|
|
296
|
+
// Get value type
|
|
297
|
+
const valueType = property.getValueType()
|
|
479
298
|
|
|
480
|
-
// Check if type is unsupported
|
|
299
|
+
// Check if value type is unsupported by the property
|
|
481
300
|
if (supportedTypes !== undefined && !supportedTypes.includes(valueType)) {
|
|
482
301
|
throw new PropertyValidationError(
|
|
483
302
|
supportedTypes.length === 1
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { AllowedPropertyName, KnownPropertyName } from './names'
|
|
2
|
+
|
|
3
|
+
export const knownValueTypes = [
|
|
4
|
+
'BINARY',
|
|
5
|
+
'BOOLEAN',
|
|
6
|
+
'CAL-ADDRESS',
|
|
7
|
+
'DATE',
|
|
8
|
+
'DATE-TIME',
|
|
9
|
+
'DURATION',
|
|
10
|
+
'FLOAT',
|
|
11
|
+
'INTEGER',
|
|
12
|
+
'PERIOD',
|
|
13
|
+
'RECUR',
|
|
14
|
+
'TEXT',
|
|
15
|
+
'TIME',
|
|
16
|
+
'URI',
|
|
17
|
+
'UTC-OFFSET',
|
|
18
|
+
] as const
|
|
19
|
+
export type KnownValueType = (typeof knownValueTypes)[number]
|
|
20
|
+
export type AllowedValueType = KnownValueType | (string & {})
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The value types that each known property supports as defined by the iCalendar
|
|
24
|
+
* specification. The first in the list is the default type.
|
|
25
|
+
*/
|
|
26
|
+
export const supportedValueTypes: {
|
|
27
|
+
[name in KnownPropertyName]: KnownValueType[]
|
|
28
|
+
} = {
|
|
29
|
+
CALSCALE: ['TEXT'],
|
|
30
|
+
METHOD: ['TEXT'],
|
|
31
|
+
PRODID: ['TEXT'],
|
|
32
|
+
VERSION: ['TEXT'],
|
|
33
|
+
ATTACH: ['URI', 'BINARY'],
|
|
34
|
+
CATEGORIES: ['TEXT'],
|
|
35
|
+
CLASS: ['TEXT'],
|
|
36
|
+
COMMENT: ['TEXT'],
|
|
37
|
+
DESCRIPTION: ['TEXT'],
|
|
38
|
+
GEO: ['FLOAT'],
|
|
39
|
+
LOCATION: ['TEXT'],
|
|
40
|
+
'PERCENT-COMPLETE': ['INTEGER'],
|
|
41
|
+
PRIORITY: ['INTEGER'],
|
|
42
|
+
RESOURCES: ['TEXT'],
|
|
43
|
+
STATUS: ['TEXT'],
|
|
44
|
+
SUMMARY: ['TEXT'],
|
|
45
|
+
COMPLETED: ['DATE-TIME'],
|
|
46
|
+
DTEND: ['DATE-TIME', 'DATE'],
|
|
47
|
+
DUE: ['DATE-TIME', 'DATE'],
|
|
48
|
+
DTSTART: ['DATE-TIME', 'DATE'],
|
|
49
|
+
DURATION: ['DURATION'],
|
|
50
|
+
FREEBUSY: ['PERIOD'],
|
|
51
|
+
TRANSP: ['TEXT'],
|
|
52
|
+
TZID: ['TEXT'],
|
|
53
|
+
TZNAME: ['TEXT'],
|
|
54
|
+
TZOFFSETFROM: ['UTC-OFFSET'],
|
|
55
|
+
TZOFFSETTO: ['UTC-OFFSET'],
|
|
56
|
+
TZURL: ['URI'],
|
|
57
|
+
ATTENDEE: ['CAL-ADDRESS'],
|
|
58
|
+
CONTACT: ['TEXT'],
|
|
59
|
+
ORGANIZER: ['CAL-ADDRESS'],
|
|
60
|
+
'RECURRENCE-ID': ['DATE-TIME', 'DATE'],
|
|
61
|
+
'RELATED-TO': ['TEXT'],
|
|
62
|
+
URL: ['URI'],
|
|
63
|
+
UID: ['TEXT'],
|
|
64
|
+
EXDATE: ['DATE-TIME', 'DATE'],
|
|
65
|
+
RDATE: ['DATE-TIME', 'DATE', 'PERIOD'],
|
|
66
|
+
RRULE: ['RECUR'],
|
|
67
|
+
ACTION: ['TEXT'],
|
|
68
|
+
REPEAT: ['INTEGER'],
|
|
69
|
+
TRIGGER: ['DURATION', 'DATE-TIME'],
|
|
70
|
+
CREATED: ['DATE-TIME'],
|
|
71
|
+
DTSTAMP: ['DATE-TIME'],
|
|
72
|
+
'LAST-MODIFIED': ['DATE-TIME'],
|
|
73
|
+
SEQUENCE: ['INTEGER'],
|
|
74
|
+
'REQUEST-STATUS': ['TEXT'],
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get the default value type of a property based on its name.
|
|
79
|
+
* @param name The name of the property.
|
|
80
|
+
* @returns The default value type of the property, or `TEXT` if the property is unknown.
|
|
81
|
+
*/
|
|
82
|
+
export function getDefaultValueType(name: AllowedPropertyName): KnownValueType {
|
|
83
|
+
const defaultType = supportedValueTypes[
|
|
84
|
+
name.toUpperCase() as KnownPropertyName
|
|
85
|
+
]?.[0] as KnownValueType | undefined
|
|
86
|
+
return defaultType ?? 'TEXT'
|
|
87
|
+
}
|
package/lib/property.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../src/property.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MA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