@sprucelabs/spruce-calendar-components 21.0.5 → 21.1.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.
@@ -63,12 +63,19 @@ export declare namespace SpruceErrors.Calendar {
63
63
  }
64
64
  export declare namespace SpruceErrors.Calendar {
65
65
  interface EventNotFound {
66
+ 'id'?: string | undefined | null;
66
67
  }
67
68
  interface EventNotFoundSchema extends SpruceSchema.Schema {
68
69
  id: 'eventNotFound';
69
70
  namespace: 'Calendar';
70
71
  name: 'Event Not Found';
71
- fields: {};
72
+ fields: {
73
+ /** . */
74
+ 'id': {
75
+ type: 'id';
76
+ options: undefined;
77
+ };
78
+ };
72
79
  }
73
80
  type EventNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.EventNotFoundSchema>;
74
81
  }
@@ -63,12 +63,19 @@ export declare namespace SpruceErrors.Calendar {
63
63
  }
64
64
  export declare namespace SpruceErrors.Calendar {
65
65
  interface EventNotFound {
66
+ 'id'?: string | undefined | null;
66
67
  }
67
68
  interface EventNotFoundSchema extends SpruceSchema.Schema {
68
69
  id: 'eventNotFound';
69
70
  namespace: 'Calendar';
70
71
  name: 'Event Not Found';
71
- fields: {};
72
+ fields: {
73
+ /** . */
74
+ 'id': {
75
+ type: 'id';
76
+ options: undefined;
77
+ };
78
+ };
72
79
  }
73
80
  type EventNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.EventNotFoundSchema>;
74
81
  }
@@ -52,6 +52,7 @@ export declare class CalendarEventManager {
52
52
  private setEventInContext;
53
53
  selectEvent(eventId: string): Promise<void>;
54
54
  load(): Promise<void>;
55
+ getEvent(id: string): CalendarEvent;
55
56
  private loadCalendars;
56
57
  private handleWillUpdateContext;
57
58
  private handleDidUpdateContext;
@@ -249,6 +249,16 @@ export class CalendarEventManager {
249
249
  .map((c) => c.id);
250
250
  });
251
251
  }
252
+ getEvent(id) {
253
+ const event = this.allEvents.find((e) => e.id === id);
254
+ if (!event) {
255
+ throw new SpruceError({
256
+ code: 'EVENT_NOT_FOUND',
257
+ id,
258
+ });
259
+ }
260
+ return event;
261
+ }
252
262
  loadCalendars() {
253
263
  return __awaiter(this, void 0, void 0, function* () {
254
264
  this.calendars = yield this.events.loadCalendars();
@@ -52,6 +52,7 @@ export declare class CalendarEventManager {
52
52
  private setEventInContext;
53
53
  selectEvent(eventId: string): Promise<void>;
54
54
  load(): Promise<void>;
55
+ getEvent(id: string): CalendarEvent;
55
56
  private loadCalendars;
56
57
  private handleWillUpdateContext;
57
58
  private handleDidUpdateContext;
@@ -216,6 +216,16 @@ class CalendarEventManager {
216
216
  .filter((c) => c.availableTimeSlotBehavior === 'include')
217
217
  .map((c) => c.id);
218
218
  }
219
+ getEvent(id) {
220
+ const event = this.allEvents.find((e) => e.id === id);
221
+ if (!event) {
222
+ throw new SpruceError_1.default({
223
+ code: 'EVENT_NOT_FOUND',
224
+ id,
225
+ });
226
+ }
227
+ return event;
228
+ }
219
229
  async loadCalendars() {
220
230
  this.calendars = await this.events.loadCalendars();
221
231
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-calendar-components",
3
3
  "description": "Calendar components for working with calendars and Sprucebot.",
4
- "version": "21.0.5",
4
+ "version": "21.1.0",
5
5
  "skill": {
6
6
  "namespace": "calendar"
7
7
  },