recal-sdk 0.1.1 → 0.2.1
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 +488 -199
- package/dist/entities/organization.d.ts +2 -2
- package/dist/entities/organization.d.ts.map +1 -1
- package/dist/entities/organization.js +32 -0
- package/dist/entities/organization.js.map +1 -0
- package/dist/entities/user.d.ts +2 -2
- package/dist/entities/user.d.ts.map +1 -1
- package/dist/entities/user.js +45 -0
- package/dist/entities/user.js.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -7046
- package/dist/index.js.map +1 -1
- package/dist/services/calendar.service.d.ts +82 -35
- package/dist/services/calendar.service.d.ts.map +1 -1
- package/dist/services/calendar.service.js +292 -0
- package/dist/services/calendar.service.js.map +1 -0
- package/dist/services/oauth.service.d.ts +2 -1
- package/dist/services/oauth.service.d.ts.map +1 -1
- package/dist/services/oauth.service.js +168 -0
- package/dist/services/oauth.service.js.map +1 -0
- package/dist/services/organizations.service.d.ts +1 -1
- package/dist/services/organizations.service.d.ts.map +1 -1
- package/dist/services/organizations.service.js +132 -0
- package/dist/services/organizations.service.js.map +1 -0
- package/dist/services/scheduling.service.d.ts +32 -29
- package/dist/services/scheduling.service.d.ts.map +1 -1
- package/dist/services/scheduling.service.js +122 -0
- package/dist/services/scheduling.service.js.map +1 -0
- package/dist/services/users.service.js +93 -0
- package/dist/services/users.service.js.map +1 -0
- package/dist/typebox/calendar.tb.d.ts +7 -6
- package/dist/typebox/calendar.tb.d.ts.map +1 -1
- package/dist/typebox/calendar.tb.js +92 -0
- package/dist/typebox/calendar.tb.js.map +1 -0
- package/dist/typebox/oauth.tb.d.ts +2 -2
- package/dist/typebox/oauth.tb.js +16 -0
- package/dist/typebox/oauth.tb.js.map +1 -0
- package/dist/typebox/organization.stripped.tb.js +7 -0
- package/dist/typebox/organization.stripped.tb.js.map +1 -0
- package/dist/typebox/organization.tb.js +8 -0
- package/dist/typebox/organization.tb.js.map +1 -0
- package/dist/typebox/scheduling.tb.js +118 -0
- package/dist/typebox/scheduling.tb.js.map +1 -0
- package/dist/typebox/timeString.tb.js +7 -0
- package/dist/typebox/timeString.tb.js.map +1 -0
- package/dist/typebox/user.stripped.tb.js +6 -0
- package/dist/typebox/user.stripped.tb.js.map +1 -0
- package/dist/typebox/user.tb.d.ts +1 -1
- package/dist/typebox/user.tb.js +10 -0
- package/dist/typebox/user.tb.js.map +1 -0
- package/dist/types/calendar.types.d.ts +5 -7
- package/dist/types/calendar.types.d.ts.map +1 -1
- package/dist/types/calendar.types.js +27 -56
- package/dist/types/calendar.types.js.map +1 -1
- package/dist/types/internal.types.js +2 -0
- package/dist/types/internal.types.js.map +1 -0
- package/dist/types/oauth.types.d.ts +1 -1
- package/dist/types/oauth.types.d.ts.map +1 -1
- package/dist/types/oauth.types.js +2 -0
- package/dist/types/oauth.types.js.map +1 -0
- package/dist/types/scheduling.types.js +2 -0
- package/dist/types/scheduling.types.js.map +1 -0
- package/dist/utils/fetch.helper.d.ts +1 -1
- package/dist/utils/fetch.helper.d.ts.map +1 -1
- package/dist/utils/fetch.helper.js +93 -0
- package/dist/utils/fetch.helper.js.map +1 -0
- package/dist/utils/fetchErrorHandler.js +32 -0
- package/dist/utils/fetchErrorHandler.js.map +1 -0
- package/dist/utils/functionize.js +6 -0
- package/dist/utils/functionize.js.map +1 -0
- package/dist/utils/includes.helper.js +10 -0
- package/dist/utils/includes.helper.js.map +1 -0
- package/dist/utils/omit.js +4 -0
- package/dist/utils/omit.js.map +1 -0
- package/package.json +7 -5
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,Y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E,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QAC5E,sBAAsB;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC/C,IAAI,CAAC,aAAa,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC/D,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACrD,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC7D,CAAC;CACJ;AAED,cAAc,yBAAyB,CAAA;AACvC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,eAAe;AACf,cAAc,wBAAwB,CAAA;AAEtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CreateEvent, CreateEventAcrossCalendars, Event,
|
|
2
|
-
import type { FetchHelper } from '
|
|
1
|
+
import type { Busy, CreateEvent, CreateEventAcrossCalendars, Event, Provider, TimeRange, UpdateEvent, UpdateEventAcrossCalendars } from '../types/calendar.types';
|
|
2
|
+
import type { FetchHelper } from '../utils/fetch.helper';
|
|
3
3
|
export declare class CalendarService {
|
|
4
4
|
private fetchHelper;
|
|
5
5
|
constructor(fetchHelper: FetchHelper);
|
|
@@ -7,100 +7,147 @@ export declare class CalendarService {
|
|
|
7
7
|
* @param userId The ID of the user
|
|
8
8
|
* @param minDate The start date of the free/busy period
|
|
9
9
|
* @param maxDate The end date of the free/busy period
|
|
10
|
-
* @param
|
|
11
|
-
* @param timeZone The time zone of the calendar (optional)
|
|
10
|
+
* @param options The options for the free/busy query (optional)
|
|
12
11
|
* @returns The free/busy period
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
getBusy(userId: string, minDate: Date, maxDate: Date, options?: {
|
|
14
|
+
provider?: Provider | Provider[];
|
|
15
|
+
timeZone?: string;
|
|
16
|
+
}): Promise<Busy>;
|
|
15
17
|
/**
|
|
16
18
|
* @param userId The ID of the user
|
|
17
19
|
* @param minDate The start date of the events
|
|
18
20
|
* @param maxDate The end date of the events
|
|
19
|
-
* @param
|
|
20
|
-
* @param timeZone The time zone of the calendar (optional)
|
|
21
|
+
* @param options The options for the events query (optional)
|
|
21
22
|
* @returns The events
|
|
22
23
|
*/
|
|
23
|
-
getEvents(userId: string, minDate: Date, maxDate: Date,
|
|
24
|
+
getEvents(userId: string, minDate: Date, maxDate: Date, options?: {
|
|
25
|
+
provider?: Provider | Provider[];
|
|
26
|
+
timeZone?: string;
|
|
27
|
+
}): Promise<Event[]>;
|
|
24
28
|
/**
|
|
25
29
|
* @param userId The ID of the user
|
|
26
30
|
* @param metaId The meta ID of the event
|
|
27
|
-
* @param
|
|
28
|
-
* @param timeZone The time zone of the calendar (optional)
|
|
31
|
+
* @param options The options for the event query (optional)
|
|
29
32
|
* @returns The event
|
|
30
33
|
*/
|
|
31
|
-
getEventByMetaId(userId: string, metaId: string,
|
|
34
|
+
getEventByMetaId(userId: string, metaId: string, options?: {
|
|
35
|
+
provider?: Provider | Provider[];
|
|
36
|
+
timeZone?: string;
|
|
37
|
+
}): Promise<Event>;
|
|
32
38
|
/**
|
|
33
39
|
* @param userId The ID of the user
|
|
34
40
|
* @param event The event to create
|
|
35
|
-
* @param
|
|
36
|
-
* @param timeZone The time zone of the calendar (optional)
|
|
41
|
+
* @param options The options for the event creation (optional)
|
|
37
42
|
* @returns The created event
|
|
38
43
|
*/
|
|
39
|
-
createEventByMetaId(userId: string, event: CreateEventAcrossCalendars,
|
|
44
|
+
createEventByMetaId(userId: string, event: CreateEventAcrossCalendars, options?: {
|
|
45
|
+
provider?: Provider | Provider[];
|
|
46
|
+
timeZone?: string;
|
|
47
|
+
}): Promise<Event>;
|
|
40
48
|
/**
|
|
41
49
|
* @param userId The ID of the user
|
|
42
50
|
* @param metaId The meta ID of the event
|
|
43
51
|
* @param event The updated event
|
|
44
|
-
* @param
|
|
45
|
-
* @param timeZone The time zone of the calendar (optional)
|
|
52
|
+
* @param options The options for the event update (optional)
|
|
46
53
|
* @returns The updated event
|
|
47
54
|
*/
|
|
48
|
-
updateEventByMetaId(userId: string, metaId: string, event: UpdateEventAcrossCalendars,
|
|
55
|
+
updateEventByMetaId(userId: string, metaId: string, event: UpdateEventAcrossCalendars, options?: {
|
|
56
|
+
provider?: Provider | Provider[];
|
|
57
|
+
timeZone?: string;
|
|
58
|
+
}): Promise<Event>;
|
|
49
59
|
/**
|
|
50
60
|
* @param userId The ID of the user
|
|
51
61
|
* @param metaId The meta ID of the event
|
|
52
|
-
* @param
|
|
53
|
-
* @
|
|
54
|
-
* @returns The deleted event
|
|
62
|
+
* @param options The options for the event deletion (optional)
|
|
63
|
+
* @returns void
|
|
55
64
|
*/
|
|
56
|
-
deleteEventByMetaId(userId: string, metaId: string,
|
|
65
|
+
deleteEventByMetaId(userId: string, metaId: string, options?: {
|
|
66
|
+
provider?: Provider | Provider[];
|
|
67
|
+
timeZone?: string;
|
|
68
|
+
}): Promise<void>;
|
|
57
69
|
/**
|
|
58
70
|
* @param userId The ID of the user
|
|
59
71
|
* @param provider The provider of the calendar
|
|
60
72
|
* @param calendarId The ID of the calendar
|
|
61
73
|
* @param eventId The ID of the event
|
|
62
|
-
* @param
|
|
74
|
+
* @param options The options for the event query (optional)
|
|
63
75
|
* @returns The event
|
|
64
76
|
*/
|
|
65
|
-
getEvent(userId
|
|
77
|
+
getEvent({ userId, provider, calendarId, eventId, options, }: {
|
|
78
|
+
userId: string;
|
|
79
|
+
provider: Provider;
|
|
80
|
+
calendarId?: string;
|
|
81
|
+
eventId: string;
|
|
82
|
+
options?: {
|
|
83
|
+
timeZone?: string;
|
|
84
|
+
};
|
|
85
|
+
}): Promise<Event>;
|
|
66
86
|
/**
|
|
67
87
|
* @param userId The ID of the user
|
|
68
88
|
* @param provider The provider of the calendar
|
|
69
89
|
* @param calendarId The ID of the calendar
|
|
70
90
|
* @param event The event to create
|
|
71
|
-
* @param
|
|
91
|
+
* @param options The options for the event creation (optional)
|
|
72
92
|
* @returns The created event
|
|
73
93
|
*/
|
|
74
|
-
createEvent(userId
|
|
94
|
+
createEvent({ userId, provider, calendarId, event, options, }: {
|
|
95
|
+
userId: string;
|
|
96
|
+
provider: Provider;
|
|
97
|
+
calendarId?: string;
|
|
98
|
+
event: CreateEvent;
|
|
99
|
+
options?: {
|
|
100
|
+
timeZone?: string;
|
|
101
|
+
};
|
|
102
|
+
}): Promise<Event>;
|
|
75
103
|
/**
|
|
76
104
|
* @param userId The ID of the user
|
|
77
105
|
* @param provider The provider of the calendar
|
|
78
106
|
* @param calendarId The ID of the calendar
|
|
79
107
|
* @param eventId The ID of the event
|
|
80
108
|
* @param event The updated event
|
|
81
|
-
* @param
|
|
109
|
+
* @param options The options for the event update (optional)
|
|
82
110
|
* @returns The updated event
|
|
83
111
|
*/
|
|
84
|
-
updateEvent(userId
|
|
112
|
+
updateEvent({ userId, provider, calendarId, eventId, event, options, }: {
|
|
113
|
+
userId: string;
|
|
114
|
+
provider: Provider;
|
|
115
|
+
calendarId?: string;
|
|
116
|
+
eventId: string;
|
|
117
|
+
event: UpdateEvent;
|
|
118
|
+
options?: {
|
|
119
|
+
timeZone?: string;
|
|
120
|
+
};
|
|
121
|
+
}): Promise<Event>;
|
|
85
122
|
/**
|
|
86
123
|
* @param userId The ID of the user
|
|
87
124
|
* @param provider The provider of the calendar
|
|
88
125
|
* @param calendarId The ID of the calendar
|
|
89
126
|
* @param eventId The ID of the event
|
|
90
|
-
* @param
|
|
91
|
-
* @returns
|
|
127
|
+
* @param options The options for the event deletion (optional)
|
|
128
|
+
* @returns void
|
|
92
129
|
*/
|
|
93
|
-
deleteEvent(userId
|
|
130
|
+
deleteEvent({ userId, provider, calendarId, eventId, options, }: {
|
|
131
|
+
userId: string;
|
|
132
|
+
provider: Provider;
|
|
133
|
+
calendarId?: string;
|
|
134
|
+
eventId: string;
|
|
135
|
+
options?: {
|
|
136
|
+
timeZone?: string;
|
|
137
|
+
};
|
|
138
|
+
}): Promise<void>;
|
|
94
139
|
/**
|
|
95
|
-
* Get the org-wide
|
|
140
|
+
* Get the org-wide busy period
|
|
96
141
|
* @param slug The slug of the organization
|
|
97
142
|
* @param minDate The minimum date
|
|
98
143
|
* @param maxDate The maximum date
|
|
99
|
-
* @param primaryOnly Whether to only include the primary calendar
|
|
100
|
-
* @param
|
|
101
|
-
* @param timeZone The time zone
|
|
144
|
+
* @param primaryOnly Whether to only include the primary calendar (default: true)
|
|
145
|
+
* @param options The options for the org-wide free/busy query (optional)
|
|
102
146
|
* @returns The org-wide free/busy period
|
|
103
147
|
*/
|
|
104
|
-
|
|
148
|
+
getOrgWideBusy(slug: string, minDate: Date, maxDate: Date, primaryOnly?: boolean, options?: {
|
|
149
|
+
provider?: Provider | Provider[];
|
|
150
|
+
timeZone?: string;
|
|
151
|
+
}): Promise<TimeRange[]>;
|
|
105
152
|
}
|
|
106
153
|
//# sourceMappingURL=calendar.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.service.d.ts","sourceRoot":"","sources":["../../src/services/calendar.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,WAAW,EACX,0BAA0B,EAC1B,KAAK,EACL,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"calendar.service.d.ts","sourceRoot":"","sources":["../../src/services/calendar.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACR,IAAI,EACJ,WAAW,EACX,0BAA0B,EAC1B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,0BAA0B,EAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAG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AA;QACf,KAAK,EAAE,WAAW,CAAA;QAClB,OAAO,CAAC,EAAE;YACN,QAAQ,CAAC,EAAE,MAAM,CAAA;SACpB,CAAA;KACJ,GAAG,OAAO,CAAC,KAAK,CAAC;IAqBlB;;;;;;;OAOG;IACU,WAAW,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,UAAsB,EACtB,OAAO,EACP,OAAO,GACV,EAAE;QACC,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,QAAQ,CAAA;QAClB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE;YACN,QAAQ,CAAC,EAAE,MAAM,CAAA;SACpB,CAAA;KACJ,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBjB;;;;;;;;OAQG;IACU,cAAc,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,EACb,WAAW,CAAC,EAAE,OAAO,EACrB,OAAO,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAA;QAChC,QAAQ,CAAC,EAAE,MAAM,CAAA;KACpB,GACF,OAAO,CAAC,SAAS,EAAE,CAAC;CAkB1B"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { Type as T } from '@sinclair/typebox';
|
|
2
|
+
import { EventNotFoundError, OAuthConnectionNotFoundError, OrganizationNotFoundError, ProviderCredentialsNotSetError, UserNotFoundError, } from '../errors.js';
|
|
3
|
+
import { busySchema, eventSchema, timeRangeSchema } from '../typebox/calendar.tb.js';
|
|
4
|
+
import { errorHandler } from '../utils/fetch.helper.js';
|
|
5
|
+
export class CalendarService {
|
|
6
|
+
fetchHelper;
|
|
7
|
+
constructor(fetchHelper) {
|
|
8
|
+
this.fetchHelper = fetchHelper;
|
|
9
|
+
}
|
|
10
|
+
// ==========================================
|
|
11
|
+
// MARK: User Calendar - Busy & Events
|
|
12
|
+
// ==========================================
|
|
13
|
+
/**
|
|
14
|
+
* @param userId The ID of the user
|
|
15
|
+
* @param minDate The start date of the free/busy period
|
|
16
|
+
* @param maxDate The end date of the free/busy period
|
|
17
|
+
* @param options The options for the free/busy query (optional)
|
|
18
|
+
* @returns The free/busy period
|
|
19
|
+
*/
|
|
20
|
+
async getBusy(userId, minDate, maxDate, options) {
|
|
21
|
+
const { provider, timeZone } = options || {};
|
|
22
|
+
return this.fetchHelper
|
|
23
|
+
.get(`/v1/users/${userId}/calendar/busy`, {
|
|
24
|
+
schema: busySchema,
|
|
25
|
+
searchParams: { minDate, maxDate, provider },
|
|
26
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
27
|
+
})
|
|
28
|
+
.catch(errorHandler([
|
|
29
|
+
{
|
|
30
|
+
code: 400,
|
|
31
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(provider) ? provider.join(',') : provider || 'all'),
|
|
32
|
+
},
|
|
33
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
34
|
+
]));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @param userId The ID of the user
|
|
38
|
+
* @param minDate The start date of the events
|
|
39
|
+
* @param maxDate The end date of the events
|
|
40
|
+
* @param options The options for the events query (optional)
|
|
41
|
+
* @returns The events
|
|
42
|
+
*/
|
|
43
|
+
async getEvents(userId, minDate, maxDate, options) {
|
|
44
|
+
const { provider, timeZone } = options || {};
|
|
45
|
+
return this.fetchHelper
|
|
46
|
+
.get(`/v1/users/${userId}/calendar/events`, {
|
|
47
|
+
schema: T.Array(eventSchema),
|
|
48
|
+
searchParams: { minDate, maxDate, provider },
|
|
49
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
50
|
+
})
|
|
51
|
+
.catch(errorHandler([
|
|
52
|
+
{
|
|
53
|
+
code: 400,
|
|
54
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(provider) ? provider.join(',') : provider || 'unknown'),
|
|
55
|
+
statusTextInclFilter: 'User has not the needed calendars connected',
|
|
56
|
+
},
|
|
57
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
58
|
+
]));
|
|
59
|
+
}
|
|
60
|
+
// ==========================================
|
|
61
|
+
// MARK: Meta Event Operations (Cross-Calendar)
|
|
62
|
+
// ==========================================
|
|
63
|
+
/**
|
|
64
|
+
* @param userId The ID of the user
|
|
65
|
+
* @param metaId The meta ID of the event
|
|
66
|
+
* @param options The options for the event query (optional)
|
|
67
|
+
* @returns The event
|
|
68
|
+
*/
|
|
69
|
+
async getEventByMetaId(userId, metaId, options) {
|
|
70
|
+
const { provider, timeZone } = options || {};
|
|
71
|
+
return this.fetchHelper
|
|
72
|
+
.get(`/v1/users/${userId}/calendar/events/meta/${metaId}`, {
|
|
73
|
+
schema: eventSchema,
|
|
74
|
+
searchParams: { provider },
|
|
75
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
76
|
+
})
|
|
77
|
+
.catch(errorHandler([
|
|
78
|
+
{
|
|
79
|
+
code: 400,
|
|
80
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(provider) ? provider.join(',') : provider || 'unknown'),
|
|
81
|
+
},
|
|
82
|
+
{ code: 404, error: new UserNotFoundError(userId), statusTextInclFilter: 'User not found' },
|
|
83
|
+
{ code: 404, error: new EventNotFoundError(metaId) },
|
|
84
|
+
]));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param userId The ID of the user
|
|
88
|
+
* @param event The event to create
|
|
89
|
+
* @param options The options for the event creation (optional)
|
|
90
|
+
* @returns The created event
|
|
91
|
+
*/
|
|
92
|
+
async createEventByMetaId(userId, event, options) {
|
|
93
|
+
const { provider, timeZone } = options || {};
|
|
94
|
+
return this.fetchHelper
|
|
95
|
+
.post(`/v1/users/${userId}/calendar/events/meta`, {
|
|
96
|
+
schema: eventSchema,
|
|
97
|
+
searchParams: { provider },
|
|
98
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
99
|
+
body: { event },
|
|
100
|
+
})
|
|
101
|
+
.catch(errorHandler([
|
|
102
|
+
{
|
|
103
|
+
code: 400,
|
|
104
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(provider) ? provider.join(',') : provider || 'unknown'),
|
|
105
|
+
},
|
|
106
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
107
|
+
]));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @param userId The ID of the user
|
|
111
|
+
* @param metaId The meta ID of the event
|
|
112
|
+
* @param event The updated event
|
|
113
|
+
* @param options The options for the event update (optional)
|
|
114
|
+
* @returns The updated event
|
|
115
|
+
*/
|
|
116
|
+
async updateEventByMetaId(userId, metaId, event, options) {
|
|
117
|
+
const { provider, timeZone } = options || {};
|
|
118
|
+
return this.fetchHelper
|
|
119
|
+
.put(`/v1/users/${userId}/calendar/events/meta/${metaId}`, {
|
|
120
|
+
schema: eventSchema,
|
|
121
|
+
searchParams: { provider },
|
|
122
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
123
|
+
body: { event },
|
|
124
|
+
})
|
|
125
|
+
.catch(errorHandler([
|
|
126
|
+
{
|
|
127
|
+
code: 400,
|
|
128
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(provider) ? provider.join(',') : provider || 'unknown'),
|
|
129
|
+
},
|
|
130
|
+
{ code: 404, error: new UserNotFoundError(userId), statusTextInclFilter: 'User not found' },
|
|
131
|
+
{ code: 404, error: new EventNotFoundError(metaId) },
|
|
132
|
+
]));
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @param userId The ID of the user
|
|
136
|
+
* @param metaId The meta ID of the event
|
|
137
|
+
* @param options The options for the event deletion (optional)
|
|
138
|
+
* @returns void
|
|
139
|
+
*/
|
|
140
|
+
async deleteEventByMetaId(userId, metaId, options) {
|
|
141
|
+
const { provider, timeZone } = options || {};
|
|
142
|
+
return this.fetchHelper
|
|
143
|
+
.delete(`/v1/users/${userId}/calendar/events/meta/${metaId}`, {
|
|
144
|
+
searchParams: { provider },
|
|
145
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
146
|
+
schema: T.Void(),
|
|
147
|
+
})
|
|
148
|
+
.catch(errorHandler([
|
|
149
|
+
{
|
|
150
|
+
code: 400,
|
|
151
|
+
error: new OAuthConnectionNotFoundError(userId, Array.isArray(provider) ? provider.join(',') : provider || 'unknown'),
|
|
152
|
+
},
|
|
153
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
154
|
+
]));
|
|
155
|
+
}
|
|
156
|
+
// ==========================================
|
|
157
|
+
// MARK: Provider-Specific Event Operations
|
|
158
|
+
// ==========================================
|
|
159
|
+
/**
|
|
160
|
+
* @param userId The ID of the user
|
|
161
|
+
* @param provider The provider of the calendar
|
|
162
|
+
* @param calendarId The ID of the calendar
|
|
163
|
+
* @param eventId The ID of the event
|
|
164
|
+
* @param options The options for the event query (optional)
|
|
165
|
+
* @returns The event
|
|
166
|
+
*/
|
|
167
|
+
async getEvent({ userId, provider, calendarId = 'primary', eventId, options, }) {
|
|
168
|
+
const { timeZone } = options || {};
|
|
169
|
+
return this.fetchHelper
|
|
170
|
+
.get(`/v1/users/${userId}/calendar/events/${provider}/${calendarId}/${eventId}`, {
|
|
171
|
+
schema: eventSchema,
|
|
172
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
173
|
+
})
|
|
174
|
+
.catch(errorHandler([
|
|
175
|
+
{
|
|
176
|
+
code: 400,
|
|
177
|
+
error: new OAuthConnectionNotFoundError(userId, provider),
|
|
178
|
+
statusTextInclFilter: 'User has not connected this calendar provider',
|
|
179
|
+
},
|
|
180
|
+
{ code: 404, error: new UserNotFoundError(userId), statusTextInclFilter: 'User not found' },
|
|
181
|
+
{ code: 404, error: new EventNotFoundError(eventId), statusTextInclFilter: 'Event not found' },
|
|
182
|
+
{ code: 404, error: new ProviderCredentialsNotSetError(provider) },
|
|
183
|
+
]));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @param userId The ID of the user
|
|
187
|
+
* @param provider The provider of the calendar
|
|
188
|
+
* @param calendarId The ID of the calendar
|
|
189
|
+
* @param event The event to create
|
|
190
|
+
* @param options The options for the event creation (optional)
|
|
191
|
+
* @returns The created event
|
|
192
|
+
*/
|
|
193
|
+
async createEvent({ userId, provider, calendarId = 'primary', event, options, }) {
|
|
194
|
+
const { timeZone } = options || {};
|
|
195
|
+
return this.fetchHelper
|
|
196
|
+
.post(`/v1/users/${userId}/calendar/events/${provider}/${calendarId}`, {
|
|
197
|
+
schema: eventSchema,
|
|
198
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
199
|
+
body: { event },
|
|
200
|
+
})
|
|
201
|
+
.catch(errorHandler([
|
|
202
|
+
{
|
|
203
|
+
code: 400,
|
|
204
|
+
error: new OAuthConnectionNotFoundError(userId, provider),
|
|
205
|
+
statusTextInclFilter: 'User has not connected this calendar provider',
|
|
206
|
+
},
|
|
207
|
+
{ code: 404, error: new UserNotFoundError(userId), statusTextInclFilter: 'User not found' },
|
|
208
|
+
{ code: 404, error: new ProviderCredentialsNotSetError(provider) },
|
|
209
|
+
]));
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @param userId The ID of the user
|
|
213
|
+
* @param provider The provider of the calendar
|
|
214
|
+
* @param calendarId The ID of the calendar
|
|
215
|
+
* @param eventId The ID of the event
|
|
216
|
+
* @param event The updated event
|
|
217
|
+
* @param options The options for the event update (optional)
|
|
218
|
+
* @returns The updated event
|
|
219
|
+
*/
|
|
220
|
+
async updateEvent({ userId, provider, calendarId = 'primary', eventId, event, options, }) {
|
|
221
|
+
const { timeZone } = options || {};
|
|
222
|
+
return this.fetchHelper
|
|
223
|
+
.put(`/v1/users/${userId}/calendar/events/${provider}/${calendarId}/${eventId}`, {
|
|
224
|
+
schema: eventSchema,
|
|
225
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
226
|
+
body: { event },
|
|
227
|
+
})
|
|
228
|
+
.catch(errorHandler([
|
|
229
|
+
{
|
|
230
|
+
code: 400,
|
|
231
|
+
error: new OAuthConnectionNotFoundError(userId, provider),
|
|
232
|
+
statusTextInclFilter: 'User has not connected this calendar provider',
|
|
233
|
+
},
|
|
234
|
+
{ code: 404, error: new UserNotFoundError(userId), statusTextInclFilter: 'User not found' },
|
|
235
|
+
{ code: 404, error: new ProviderCredentialsNotSetError(provider) },
|
|
236
|
+
]));
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @param userId The ID of the user
|
|
240
|
+
* @param provider The provider of the calendar
|
|
241
|
+
* @param calendarId The ID of the calendar
|
|
242
|
+
* @param eventId The ID of the event
|
|
243
|
+
* @param options The options for the event deletion (optional)
|
|
244
|
+
* @returns void
|
|
245
|
+
*/
|
|
246
|
+
async deleteEvent({ userId, provider, calendarId = 'primary', eventId, options, }) {
|
|
247
|
+
const { timeZone } = options || {};
|
|
248
|
+
return this.fetchHelper
|
|
249
|
+
.delete(`/v1/users/${userId}/calendar/events/${provider}/${calendarId}/${eventId}`, {
|
|
250
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
251
|
+
schema: T.Void(),
|
|
252
|
+
})
|
|
253
|
+
.catch(errorHandler([
|
|
254
|
+
{
|
|
255
|
+
code: 400,
|
|
256
|
+
error: new OAuthConnectionNotFoundError(userId, provider),
|
|
257
|
+
statusTextInclFilter: 'User has not connected this calendar provider',
|
|
258
|
+
},
|
|
259
|
+
{ code: 404, error: new UserNotFoundError(userId) },
|
|
260
|
+
{ code: 404, error: new EventNotFoundError(eventId) },
|
|
261
|
+
]));
|
|
262
|
+
}
|
|
263
|
+
// ==========================================
|
|
264
|
+
// MARK: Organization-Wide Operations
|
|
265
|
+
// ==========================================
|
|
266
|
+
/**
|
|
267
|
+
* Get the org-wide busy period
|
|
268
|
+
* @param slug The slug of the organization
|
|
269
|
+
* @param minDate The minimum date
|
|
270
|
+
* @param maxDate The maximum date
|
|
271
|
+
* @param primaryOnly Whether to only include the primary calendar (default: true)
|
|
272
|
+
* @param options The options for the org-wide free/busy query (optional)
|
|
273
|
+
* @returns The org-wide free/busy period
|
|
274
|
+
*/
|
|
275
|
+
async getOrgWideBusy(slug, minDate, maxDate, primaryOnly, options) {
|
|
276
|
+
const { provider, timeZone } = options || {};
|
|
277
|
+
return this.fetchHelper
|
|
278
|
+
.get(`/v1/organizations/${slug}/calendar/busy`, {
|
|
279
|
+
schema: T.Array(timeRangeSchema),
|
|
280
|
+
searchParams: { minDate, maxDate, primaryOnly, provider },
|
|
281
|
+
headers: timeZone ? { 'x-timezone': timeZone } : undefined,
|
|
282
|
+
})
|
|
283
|
+
.catch(errorHandler([
|
|
284
|
+
{
|
|
285
|
+
code: 400,
|
|
286
|
+
error: new Error(`OAuth credentials for provider ${provider} not found for the user`),
|
|
287
|
+
},
|
|
288
|
+
{ code: 404, error: new OrganizationNotFoundError(slug) },
|
|
289
|
+
]));
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=calendar.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.service.js","sourceRoot":"","sources":["../../src/services/calendar.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EACH,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,8BAA8B,EAC9B,iBAAiB,GACpB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAYhF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD,MAAM,OAAO,eAAe;IACJ;IAApB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD,6CAA6C;IAC7C,sCAAsC;IACtC,6CAA6C;IAE7C;;;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E;SACxD,CAAC,CACL,CAAA;IACT,CAAC;IAED,6CAA6C;IAC7C,qCAAqC;IACrC,6CAA6C;IAE7C;;;;;;;;OAQG;IACI,KAAK,CAAC,cAAc,CACvB,IAAY,EACZ,OAAa,EACb,OAAa,EACb,WAAqB,EACrB,OAGC;QAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QAC5C,OAAO,IAAI,CAAC,WAAW;aAClB,GAAG,CAAC,qBAAqB,IAAI,gBAAgB,EAAE;YAC5C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;YAChC,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;YACzD,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;SAC7D,CAAC;aACD,KAAK,CACF,YAAY,CAAC;YACT;gBACI,IAAI,EAAE,GAAG;gBACT,KAAK,EAAE,IAAI,KAAK,CAAC,kCAAkC,QAAQ,yBAAyB,CAAC;aACxF;YACD,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,EAAE;SAC5D,CAAC,CACL,CAAA;IACT,CAAC;CACJ"}
|
|
@@ -67,11 +67,12 @@ export declare class OAuthService {
|
|
|
67
67
|
* Verify OAuth code (used in OAuth callback flow)
|
|
68
68
|
* @param provider The provider of the OAuth connection
|
|
69
69
|
* @param code The OAuth code
|
|
70
|
+
* @param scope The OAuth scope (free-busy or edit)
|
|
70
71
|
* @param state The OAuth state
|
|
71
72
|
* @param redirectUrl The redirect URL
|
|
72
73
|
* @returns The OAuth verification result
|
|
73
74
|
*/
|
|
74
|
-
verify(provider: Provider, code: string, scope:
|
|
75
|
+
verify(provider: Provider, code: string, scope: 'edit' | 'free-busy', state: string, redirectUrl?: string): Promise<{
|
|
75
76
|
success: boolean;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