@sprucelabs/spruce-calendar-components 21.0.3 → 21.0.4
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/build/.spruce/errors/errors.types.d.ts +122 -0
- package/build/.spruce/errors/errors.types.js +4 -0
- package/build/.spruce/errors/options.types.d.ts +28 -0
- package/build/.spruce/errors/options.types.js +2 -0
- package/build/constants.d.ts +5 -0
- package/build/constants.js +9 -0
- package/build/errors/SpruceError.d.ts +5 -0
- package/build/errors/SpruceError.js +45 -0
- package/build/esm/.spruce/errors/errors.types.d.ts +122 -0
- package/build/esm/.spruce/errors/errors.types.js +3 -0
- package/build/esm/.spruce/errors/options.types.d.ts +28 -0
- package/build/esm/.spruce/errors/options.types.js +1 -0
- package/build/esm/constants.d.ts +5 -0
- package/build/esm/constants.js +6 -0
- package/build/esm/errors/SpruceError.d.ts +5 -0
- package/build/esm/errors/SpruceError.js +39 -0
- package/build/esm/index-module.d.ts +30 -0
- package/build/esm/index-module.js +7 -0
- package/build/esm/skillViewControllers/Root.svc.d.ts +73 -0
- package/build/esm/skillViewControllers/Root.svc.js +404 -0
- package/build/esm/toolBelt/CalendarToolTestFactory.d.ts +5 -0
- package/build/esm/toolBelt/CalendarToolTestFactory.js +28 -0
- package/build/esm/toolBelt/states/PrerequisitesToolBeltState.d.ts +37 -0
- package/build/esm/toolBelt/states/PrerequisitesToolBeltState.js +190 -0
- package/build/esm/toolBelt/states/RootToolBeltState.d.ts +37 -0
- package/build/esm/toolBelt/states/RootToolBeltState.js +122 -0
- package/build/esm/toolBelt/states/makeEventTyped.d.ts +2 -0
- package/build/esm/toolBelt/states/makeEventTyped.js +8 -0
- package/build/esm/types/calendar.types.d.ts +2 -0
- package/build/esm/utilities/CalendarEventManager.d.ts +72 -0
- package/build/esm/utilities/CalendarEventManager.js +321 -0
- package/build/esm/utilities/CalendarPeopleManager.d.ts +56 -0
- package/build/esm/utilities/CalendarPeopleManager.js +182 -0
- package/build/esm/utilities/calendarShiftGenerator.d.ts +8 -0
- package/build/esm/utilities/calendarShiftGenerator.js +24 -0
- package/build/esm/viewControllers/CalendarSelectTool.vc.d.ts +28 -0
- package/build/esm/viewControllers/CalendarSelectTool.vc.js +103 -0
- package/build/esm/viewControllers/DateSelectCard.vc.d.ts +29 -0
- package/build/esm/viewControllers/DateSelectCard.vc.js +77 -0
- package/build/esm/viewControllers/PersonSelectTool.vc.d.ts +36 -0
- package/build/esm/viewControllers/PersonSelectTool.vc.js +156 -0
- package/build/esm/viewControllers/SelectUpdateRepeatingStrategyCard.vc.d.ts +18 -0
- package/build/esm/viewControllers/SelectUpdateRepeatingStrategyCard.vc.js +85 -0
- package/build/index-module.d.ts +30 -0
- package/build/index-module.js +32 -0
- package/build/skillViewControllers/Root.svc.d.ts +73 -0
- package/build/skillViewControllers/Root.svc.js +359 -0
- package/build/toolBelt/CalendarToolTestFactory.d.ts +5 -0
- package/build/toolBelt/CalendarToolTestFactory.js +34 -0
- package/build/toolBelt/states/PrerequisitesToolBeltState.d.ts +37 -0
- package/build/toolBelt/states/PrerequisitesToolBeltState.js +172 -0
- package/build/toolBelt/states/RootToolBeltState.d.ts +37 -0
- package/build/toolBelt/states/RootToolBeltState.js +113 -0
- package/build/toolBelt/states/makeEventTyped.d.ts +2 -0
- package/build/toolBelt/states/makeEventTyped.js +14 -0
- package/build/types/calendar.types.d.ts +2 -0
- package/build/utilities/CalendarEventManager.d.ts +72 -0
- package/build/utilities/CalendarEventManager.js +279 -0
- package/build/utilities/CalendarPeopleManager.d.ts +56 -0
- package/build/utilities/CalendarPeopleManager.js +163 -0
- package/build/utilities/calendarShiftGenerator.d.ts +8 -0
- package/build/utilities/calendarShiftGenerator.js +26 -0
- package/build/viewControllers/CalendarSelectTool.vc.d.ts +28 -0
- package/build/viewControllers/CalendarSelectTool.vc.js +93 -0
- package/build/viewControllers/DateSelectCard.vc.d.ts +29 -0
- package/build/viewControllers/DateSelectCard.vc.js +69 -0
- package/build/viewControllers/PersonSelectTool.vc.d.ts +36 -0
- package/build/viewControllers/PersonSelectTool.vc.js +140 -0
- package/build/viewControllers/SelectUpdateRepeatingStrategyCard.vc.d.ts +18 -0
- package/build/viewControllers/SelectUpdateRepeatingStrategyCard.vc.js +88 -0
- package/package.json +99 -30
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { default as SchemaEntity } from '@sprucelabs/schema';
|
|
2
|
+
import * as SpruceSchema from '@sprucelabs/schema';
|
|
3
|
+
export declare namespace SpruceErrors.Calendar {
|
|
4
|
+
interface ValidatorNotInitialized {
|
|
5
|
+
}
|
|
6
|
+
interface ValidatorNotInitializedSchema extends SpruceSchema.Schema {
|
|
7
|
+
id: 'validatorNotInitialized';
|
|
8
|
+
namespace: 'Calendar';
|
|
9
|
+
name: 'validator not initialized';
|
|
10
|
+
fields: {};
|
|
11
|
+
}
|
|
12
|
+
type ValidatorNotInitializedEntity = SchemaEntity<SpruceErrors.Calendar.ValidatorNotInitializedSchema>;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace SpruceErrors.Calendar {
|
|
15
|
+
interface UnauthorizedAccess {
|
|
16
|
+
}
|
|
17
|
+
interface UnauthorizedAccessSchema extends SpruceSchema.Schema {
|
|
18
|
+
id: 'unauthorizedAccess';
|
|
19
|
+
namespace: 'Calendar';
|
|
20
|
+
name: 'Unauthorized access';
|
|
21
|
+
fields: {};
|
|
22
|
+
}
|
|
23
|
+
type UnauthorizedAccessEntity = SchemaEntity<SpruceErrors.Calendar.UnauthorizedAccessSchema>;
|
|
24
|
+
}
|
|
25
|
+
export declare namespace SpruceErrors.Calendar {
|
|
26
|
+
interface RecordNotFound {
|
|
27
|
+
'parameters': string[];
|
|
28
|
+
}
|
|
29
|
+
interface RecordNotFoundSchema extends SpruceSchema.Schema {
|
|
30
|
+
id: 'recordNotFound';
|
|
31
|
+
namespace: 'Calendar';
|
|
32
|
+
name: 'record not found';
|
|
33
|
+
fields: {
|
|
34
|
+
/** . */
|
|
35
|
+
'parameters': {
|
|
36
|
+
type: 'text';
|
|
37
|
+
isRequired: true;
|
|
38
|
+
isArray: true;
|
|
39
|
+
options: undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
type RecordNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.RecordNotFoundSchema>;
|
|
44
|
+
}
|
|
45
|
+
export declare namespace SpruceErrors.Calendar {
|
|
46
|
+
interface PersonNotFound {
|
|
47
|
+
'personId': string;
|
|
48
|
+
}
|
|
49
|
+
interface PersonNotFoundSchema extends SpruceSchema.Schema {
|
|
50
|
+
id: 'personNotFound';
|
|
51
|
+
namespace: 'Calendar';
|
|
52
|
+
name: 'Person not found';
|
|
53
|
+
fields: {
|
|
54
|
+
/** . */
|
|
55
|
+
'personId': {
|
|
56
|
+
type: 'id';
|
|
57
|
+
isRequired: true;
|
|
58
|
+
options: undefined;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
type PersonNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.PersonNotFoundSchema>;
|
|
63
|
+
}
|
|
64
|
+
export declare namespace SpruceErrors.Calendar {
|
|
65
|
+
interface EventNotFound {
|
|
66
|
+
}
|
|
67
|
+
interface EventNotFoundSchema extends SpruceSchema.Schema {
|
|
68
|
+
id: 'eventNotFound';
|
|
69
|
+
namespace: 'Calendar';
|
|
70
|
+
name: 'Event Not Found';
|
|
71
|
+
fields: {};
|
|
72
|
+
}
|
|
73
|
+
type EventNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.EventNotFoundSchema>;
|
|
74
|
+
}
|
|
75
|
+
export declare namespace SpruceErrors.Calendar {
|
|
76
|
+
interface DuplicateEventType {
|
|
77
|
+
}
|
|
78
|
+
interface DuplicateEventTypeSchema extends SpruceSchema.Schema {
|
|
79
|
+
id: 'duplicateEventType';
|
|
80
|
+
namespace: 'Calendar';
|
|
81
|
+
name: 'Duplicate event type';
|
|
82
|
+
fields: {};
|
|
83
|
+
}
|
|
84
|
+
type DuplicateEventTypeEntity = SchemaEntity<SpruceErrors.Calendar.DuplicateEventTypeSchema>;
|
|
85
|
+
}
|
|
86
|
+
export declare namespace SpruceErrors.Calendar {
|
|
87
|
+
interface DuplicateCalendar {
|
|
88
|
+
}
|
|
89
|
+
interface DuplicateCalendarSchema extends SpruceSchema.Schema {
|
|
90
|
+
id: 'duplicateCalendar';
|
|
91
|
+
namespace: 'Calendar';
|
|
92
|
+
name: 'Duplicate Calendar';
|
|
93
|
+
fields: {};
|
|
94
|
+
}
|
|
95
|
+
type DuplicateCalendarEntity = SchemaEntity<SpruceErrors.Calendar.DuplicateCalendarSchema>;
|
|
96
|
+
}
|
|
97
|
+
export declare namespace SpruceErrors.Calendar {
|
|
98
|
+
interface CalendarNotFound {
|
|
99
|
+
'calendarIds'?: string[] | undefined | null;
|
|
100
|
+
'calendarSlugs'?: string[] | undefined | null;
|
|
101
|
+
}
|
|
102
|
+
interface CalendarNotFoundSchema extends SpruceSchema.Schema {
|
|
103
|
+
id: 'calendarNotFound';
|
|
104
|
+
namespace: 'Calendar';
|
|
105
|
+
name: 'calendar not found';
|
|
106
|
+
fields: {
|
|
107
|
+
/** . */
|
|
108
|
+
'calendarIds': {
|
|
109
|
+
type: 'text';
|
|
110
|
+
isArray: true;
|
|
111
|
+
options: undefined;
|
|
112
|
+
};
|
|
113
|
+
/** . */
|
|
114
|
+
'calendarSlugs': {
|
|
115
|
+
type: 'text';
|
|
116
|
+
isArray: true;
|
|
117
|
+
options: undefined;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
type CalendarNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.CalendarNotFoundSchema>;
|
|
122
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SpruceErrors } from "./errors.types";
|
|
2
|
+
import { ErrorOptions as ISpruceErrorOptions } from "@sprucelabs/error";
|
|
3
|
+
export interface ValidatorNotInitializedErrorOptions extends SpruceErrors.Calendar.ValidatorNotInitialized, ISpruceErrorOptions {
|
|
4
|
+
code: 'VALIDATOR_NOT_INITIALIZED';
|
|
5
|
+
}
|
|
6
|
+
export interface UnauthorizedAccessErrorOptions extends SpruceErrors.Calendar.UnauthorizedAccess, ISpruceErrorOptions {
|
|
7
|
+
code: 'UNAUTHORIZED_ACCESS';
|
|
8
|
+
}
|
|
9
|
+
export interface RecordNotFoundErrorOptions extends SpruceErrors.Calendar.RecordNotFound, ISpruceErrorOptions {
|
|
10
|
+
code: 'RECORD_NOT_FOUND';
|
|
11
|
+
}
|
|
12
|
+
export interface PersonNotFoundErrorOptions extends SpruceErrors.Calendar.PersonNotFound, ISpruceErrorOptions {
|
|
13
|
+
code: 'PERSON_NOT_FOUND';
|
|
14
|
+
}
|
|
15
|
+
export interface EventNotFoundErrorOptions extends SpruceErrors.Calendar.EventNotFound, ISpruceErrorOptions {
|
|
16
|
+
code: 'EVENT_NOT_FOUND';
|
|
17
|
+
}
|
|
18
|
+
export interface DuplicateEventTypeErrorOptions extends SpruceErrors.Calendar.DuplicateEventType, ISpruceErrorOptions {
|
|
19
|
+
code: 'DUPLICATE_EVENT_TYPE';
|
|
20
|
+
}
|
|
21
|
+
export interface DuplicateCalendarErrorOptions extends SpruceErrors.Calendar.DuplicateCalendar, ISpruceErrorOptions {
|
|
22
|
+
code: 'DUPLICATE_CALENDAR';
|
|
23
|
+
}
|
|
24
|
+
export interface CalendarNotFoundErrorOptions extends SpruceErrors.Calendar.CalendarNotFound, ISpruceErrorOptions {
|
|
25
|
+
code: 'CALENDAR_NOT_FOUND';
|
|
26
|
+
}
|
|
27
|
+
declare type ErrorOptions = ValidatorNotInitializedErrorOptions | UnauthorizedAccessErrorOptions | RecordNotFoundErrorOptions | PersonNotFoundErrorOptions | EventNotFoundErrorOptions | DuplicateEventTypeErrorOptions | DuplicateCalendarErrorOptions | CalendarNotFoundErrorOptions;
|
|
28
|
+
export default ErrorOptions;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const MAX_GET_SCHEDULE_DAYS: number;
|
|
2
|
+
export declare const UPDATE_STRATEGY_SPECIFIC_DATES: "only-this-one";
|
|
3
|
+
export declare const UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD: "all-going-forward";
|
|
4
|
+
export declare const UPDATE_STRATEGY_ALL: "all";
|
|
5
|
+
export declare type UpdateRepeatingStrategy = typeof UPDATE_STRATEGY_SPECIFIC_DATES | typeof UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD | typeof UPDATE_STRATEGY_ALL;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.UPDATE_STRATEGY_ALL = exports.UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD = exports.UPDATE_STRATEGY_SPECIFIC_DATES = exports.MAX_GET_SCHEDULE_DAYS = void 0;
|
|
5
|
+
require('dotenv').config();
|
|
6
|
+
exports.MAX_GET_SCHEDULE_DAYS = parseInt((_a = process.env.MAX_GETSCHEDULE_DAYS) !== null && _a !== void 0 ? _a : '365');
|
|
7
|
+
exports.UPDATE_STRATEGY_SPECIFIC_DATES = 'only-this-one';
|
|
8
|
+
exports.UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD = 'all-going-forward';
|
|
9
|
+
exports.UPDATE_STRATEGY_ALL = 'all';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const error_1 = __importDefault(require("@sprucelabs/error"));
|
|
7
|
+
class SpruceError extends error_1.default {
|
|
8
|
+
friendlyMessage() {
|
|
9
|
+
const { options } = this;
|
|
10
|
+
let message;
|
|
11
|
+
switch (options === null || options === void 0 ? void 0 : options.code) {
|
|
12
|
+
case 'CALENDAR_NOT_FOUND':
|
|
13
|
+
message = 'I could not find that calendar!';
|
|
14
|
+
break;
|
|
15
|
+
case 'EVENT_NOT_FOUND':
|
|
16
|
+
message = 'I could not find that event!';
|
|
17
|
+
break;
|
|
18
|
+
case 'UNAUTHORIZED_ACCESS':
|
|
19
|
+
message = 'A Unauthorized access just happened!';
|
|
20
|
+
break;
|
|
21
|
+
case 'VALIDATOR_NOT_INITIALIZED':
|
|
22
|
+
message = 'A validator not initialized just happened!';
|
|
23
|
+
break;
|
|
24
|
+
case 'RECORD_NOT_FOUND':
|
|
25
|
+
message = 'A record not found just happened!';
|
|
26
|
+
break;
|
|
27
|
+
case 'DUPLICATE_EVENT_TYPE':
|
|
28
|
+
message = 'A Duplicate event type just happened!';
|
|
29
|
+
break;
|
|
30
|
+
case 'DUPLICATE_CALENDAR':
|
|
31
|
+
message = 'A Duplicate Calendar just happened!';
|
|
32
|
+
break;
|
|
33
|
+
case 'PERSON_NOT_FOUND':
|
|
34
|
+
message = `I could not find that person!!`;
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
message = super.friendlyMessage();
|
|
38
|
+
}
|
|
39
|
+
const fullMessage = options.friendlyMessage
|
|
40
|
+
? options.friendlyMessage
|
|
41
|
+
: message;
|
|
42
|
+
return fullMessage;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = SpruceError;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { default as SchemaEntity } from '@sprucelabs/schema';
|
|
2
|
+
import * as SpruceSchema from '@sprucelabs/schema';
|
|
3
|
+
export declare namespace SpruceErrors.Calendar {
|
|
4
|
+
interface ValidatorNotInitialized {
|
|
5
|
+
}
|
|
6
|
+
interface ValidatorNotInitializedSchema extends SpruceSchema.Schema {
|
|
7
|
+
id: 'validatorNotInitialized';
|
|
8
|
+
namespace: 'Calendar';
|
|
9
|
+
name: 'validator not initialized';
|
|
10
|
+
fields: {};
|
|
11
|
+
}
|
|
12
|
+
type ValidatorNotInitializedEntity = SchemaEntity<SpruceErrors.Calendar.ValidatorNotInitializedSchema>;
|
|
13
|
+
}
|
|
14
|
+
export declare namespace SpruceErrors.Calendar {
|
|
15
|
+
interface UnauthorizedAccess {
|
|
16
|
+
}
|
|
17
|
+
interface UnauthorizedAccessSchema extends SpruceSchema.Schema {
|
|
18
|
+
id: 'unauthorizedAccess';
|
|
19
|
+
namespace: 'Calendar';
|
|
20
|
+
name: 'Unauthorized access';
|
|
21
|
+
fields: {};
|
|
22
|
+
}
|
|
23
|
+
type UnauthorizedAccessEntity = SchemaEntity<SpruceErrors.Calendar.UnauthorizedAccessSchema>;
|
|
24
|
+
}
|
|
25
|
+
export declare namespace SpruceErrors.Calendar {
|
|
26
|
+
interface RecordNotFound {
|
|
27
|
+
'parameters': string[];
|
|
28
|
+
}
|
|
29
|
+
interface RecordNotFoundSchema extends SpruceSchema.Schema {
|
|
30
|
+
id: 'recordNotFound';
|
|
31
|
+
namespace: 'Calendar';
|
|
32
|
+
name: 'record not found';
|
|
33
|
+
fields: {
|
|
34
|
+
/** . */
|
|
35
|
+
'parameters': {
|
|
36
|
+
type: 'text';
|
|
37
|
+
isRequired: true;
|
|
38
|
+
isArray: true;
|
|
39
|
+
options: undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
type RecordNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.RecordNotFoundSchema>;
|
|
44
|
+
}
|
|
45
|
+
export declare namespace SpruceErrors.Calendar {
|
|
46
|
+
interface PersonNotFound {
|
|
47
|
+
'personId': string;
|
|
48
|
+
}
|
|
49
|
+
interface PersonNotFoundSchema extends SpruceSchema.Schema {
|
|
50
|
+
id: 'personNotFound';
|
|
51
|
+
namespace: 'Calendar';
|
|
52
|
+
name: 'Person not found';
|
|
53
|
+
fields: {
|
|
54
|
+
/** . */
|
|
55
|
+
'personId': {
|
|
56
|
+
type: 'id';
|
|
57
|
+
isRequired: true;
|
|
58
|
+
options: undefined;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
type PersonNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.PersonNotFoundSchema>;
|
|
63
|
+
}
|
|
64
|
+
export declare namespace SpruceErrors.Calendar {
|
|
65
|
+
interface EventNotFound {
|
|
66
|
+
}
|
|
67
|
+
interface EventNotFoundSchema extends SpruceSchema.Schema {
|
|
68
|
+
id: 'eventNotFound';
|
|
69
|
+
namespace: 'Calendar';
|
|
70
|
+
name: 'Event Not Found';
|
|
71
|
+
fields: {};
|
|
72
|
+
}
|
|
73
|
+
type EventNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.EventNotFoundSchema>;
|
|
74
|
+
}
|
|
75
|
+
export declare namespace SpruceErrors.Calendar {
|
|
76
|
+
interface DuplicateEventType {
|
|
77
|
+
}
|
|
78
|
+
interface DuplicateEventTypeSchema extends SpruceSchema.Schema {
|
|
79
|
+
id: 'duplicateEventType';
|
|
80
|
+
namespace: 'Calendar';
|
|
81
|
+
name: 'Duplicate event type';
|
|
82
|
+
fields: {};
|
|
83
|
+
}
|
|
84
|
+
type DuplicateEventTypeEntity = SchemaEntity<SpruceErrors.Calendar.DuplicateEventTypeSchema>;
|
|
85
|
+
}
|
|
86
|
+
export declare namespace SpruceErrors.Calendar {
|
|
87
|
+
interface DuplicateCalendar {
|
|
88
|
+
}
|
|
89
|
+
interface DuplicateCalendarSchema extends SpruceSchema.Schema {
|
|
90
|
+
id: 'duplicateCalendar';
|
|
91
|
+
namespace: 'Calendar';
|
|
92
|
+
name: 'Duplicate Calendar';
|
|
93
|
+
fields: {};
|
|
94
|
+
}
|
|
95
|
+
type DuplicateCalendarEntity = SchemaEntity<SpruceErrors.Calendar.DuplicateCalendarSchema>;
|
|
96
|
+
}
|
|
97
|
+
export declare namespace SpruceErrors.Calendar {
|
|
98
|
+
interface CalendarNotFound {
|
|
99
|
+
'calendarIds'?: string[] | undefined | null;
|
|
100
|
+
'calendarSlugs'?: string[] | undefined | null;
|
|
101
|
+
}
|
|
102
|
+
interface CalendarNotFoundSchema extends SpruceSchema.Schema {
|
|
103
|
+
id: 'calendarNotFound';
|
|
104
|
+
namespace: 'Calendar';
|
|
105
|
+
name: 'calendar not found';
|
|
106
|
+
fields: {
|
|
107
|
+
/** . */
|
|
108
|
+
'calendarIds': {
|
|
109
|
+
type: 'text';
|
|
110
|
+
isArray: true;
|
|
111
|
+
options: undefined;
|
|
112
|
+
};
|
|
113
|
+
/** . */
|
|
114
|
+
'calendarSlugs': {
|
|
115
|
+
type: 'text';
|
|
116
|
+
isArray: true;
|
|
117
|
+
options: undefined;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
type CalendarNotFoundEntity = SchemaEntity<SpruceErrors.Calendar.CalendarNotFoundSchema>;
|
|
122
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SpruceErrors } from "./errors.types";
|
|
2
|
+
import { ErrorOptions as ISpruceErrorOptions } from "@sprucelabs/error";
|
|
3
|
+
export interface ValidatorNotInitializedErrorOptions extends SpruceErrors.Calendar.ValidatorNotInitialized, ISpruceErrorOptions {
|
|
4
|
+
code: 'VALIDATOR_NOT_INITIALIZED';
|
|
5
|
+
}
|
|
6
|
+
export interface UnauthorizedAccessErrorOptions extends SpruceErrors.Calendar.UnauthorizedAccess, ISpruceErrorOptions {
|
|
7
|
+
code: 'UNAUTHORIZED_ACCESS';
|
|
8
|
+
}
|
|
9
|
+
export interface RecordNotFoundErrorOptions extends SpruceErrors.Calendar.RecordNotFound, ISpruceErrorOptions {
|
|
10
|
+
code: 'RECORD_NOT_FOUND';
|
|
11
|
+
}
|
|
12
|
+
export interface PersonNotFoundErrorOptions extends SpruceErrors.Calendar.PersonNotFound, ISpruceErrorOptions {
|
|
13
|
+
code: 'PERSON_NOT_FOUND';
|
|
14
|
+
}
|
|
15
|
+
export interface EventNotFoundErrorOptions extends SpruceErrors.Calendar.EventNotFound, ISpruceErrorOptions {
|
|
16
|
+
code: 'EVENT_NOT_FOUND';
|
|
17
|
+
}
|
|
18
|
+
export interface DuplicateEventTypeErrorOptions extends SpruceErrors.Calendar.DuplicateEventType, ISpruceErrorOptions {
|
|
19
|
+
code: 'DUPLICATE_EVENT_TYPE';
|
|
20
|
+
}
|
|
21
|
+
export interface DuplicateCalendarErrorOptions extends SpruceErrors.Calendar.DuplicateCalendar, ISpruceErrorOptions {
|
|
22
|
+
code: 'DUPLICATE_CALENDAR';
|
|
23
|
+
}
|
|
24
|
+
export interface CalendarNotFoundErrorOptions extends SpruceErrors.Calendar.CalendarNotFound, ISpruceErrorOptions {
|
|
25
|
+
code: 'CALENDAR_NOT_FOUND';
|
|
26
|
+
}
|
|
27
|
+
declare type ErrorOptions = ValidatorNotInitializedErrorOptions | UnauthorizedAccessErrorOptions | RecordNotFoundErrorOptions | PersonNotFoundErrorOptions | EventNotFoundErrorOptions | DuplicateEventTypeErrorOptions | DuplicateCalendarErrorOptions | CalendarNotFoundErrorOptions;
|
|
28
|
+
export default ErrorOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const MAX_GET_SCHEDULE_DAYS: number;
|
|
2
|
+
export declare const UPDATE_STRATEGY_SPECIFIC_DATES: "only-this-one";
|
|
3
|
+
export declare const UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD: "all-going-forward";
|
|
4
|
+
export declare const UPDATE_STRATEGY_ALL: "all";
|
|
5
|
+
export declare type UpdateRepeatingStrategy = typeof UPDATE_STRATEGY_SPECIFIC_DATES | typeof UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD | typeof UPDATE_STRATEGY_ALL;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
require('dotenv').config();
|
|
3
|
+
export const MAX_GET_SCHEDULE_DAYS = parseInt((_a = process.env.MAX_GETSCHEDULE_DAYS) !== null && _a !== void 0 ? _a : '365');
|
|
4
|
+
export const UPDATE_STRATEGY_SPECIFIC_DATES = 'only-this-one';
|
|
5
|
+
export const UPDATE_STRATEGY_THIS_AND_ALL_GOING_FORWARD = 'all-going-forward';
|
|
6
|
+
export const UPDATE_STRATEGY_ALL = 'all';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import AbstractSpruceError from '@sprucelabs/error';
|
|
2
|
+
export default class SpruceError extends AbstractSpruceError {
|
|
3
|
+
friendlyMessage() {
|
|
4
|
+
const { options } = this;
|
|
5
|
+
let message;
|
|
6
|
+
switch (options === null || options === void 0 ? void 0 : options.code) {
|
|
7
|
+
case 'CALENDAR_NOT_FOUND':
|
|
8
|
+
message = 'I could not find that calendar!';
|
|
9
|
+
break;
|
|
10
|
+
case 'EVENT_NOT_FOUND':
|
|
11
|
+
message = 'I could not find that event!';
|
|
12
|
+
break;
|
|
13
|
+
case 'UNAUTHORIZED_ACCESS':
|
|
14
|
+
message = 'A Unauthorized access just happened!';
|
|
15
|
+
break;
|
|
16
|
+
case 'VALIDATOR_NOT_INITIALIZED':
|
|
17
|
+
message = 'A validator not initialized just happened!';
|
|
18
|
+
break;
|
|
19
|
+
case 'RECORD_NOT_FOUND':
|
|
20
|
+
message = 'A record not found just happened!';
|
|
21
|
+
break;
|
|
22
|
+
case 'DUPLICATE_EVENT_TYPE':
|
|
23
|
+
message = 'A Duplicate event type just happened!';
|
|
24
|
+
break;
|
|
25
|
+
case 'DUPLICATE_CALENDAR':
|
|
26
|
+
message = 'A Duplicate Calendar just happened!';
|
|
27
|
+
break;
|
|
28
|
+
case 'PERSON_NOT_FOUND':
|
|
29
|
+
message = `I could not find that person!!`;
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
message = super.friendlyMessage();
|
|
33
|
+
}
|
|
34
|
+
const fullMessage = options.friendlyMessage
|
|
35
|
+
? options.friendlyMessage
|
|
36
|
+
: message;
|
|
37
|
+
return fullMessage;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { default as calendarAssert } from './__tests__/support/utilities/calendarAssert';
|
|
2
|
+
export { default as calendarSkillAssert } from './__tests__/support/utilities/calendarSkillAssert';
|
|
3
|
+
export { default as CalendarToolBeltStateMachineTestFactory } from './__tests__/support/CalendarToolBeltStateMachineTestFactory';
|
|
4
|
+
export { default as CalendarToolTestFactory } from './toolBelt/CalendarToolTestFactory';
|
|
5
|
+
export * from './toolBelt/CalendarToolTestFactory';
|
|
6
|
+
export { default as calendarToolBeltInteractor } from './__tests__/support/utilities/calendarToolBeltInteractor';
|
|
7
|
+
import CalendarViewController from './viewControllers/Calendar.vc';
|
|
8
|
+
import EventControlsCardViewController from './viewControllers/EventControlsCard.vc';
|
|
9
|
+
import EventDateTimeToolViewController from './viewControllers/EventDateTimeTool.vc';
|
|
10
|
+
import EventRepeatingToolViewController from './viewControllers/EventRepeatingTool.vc';
|
|
11
|
+
import EventTitleToolViewController from './viewControllers/EventTitleTool.vc';
|
|
12
|
+
import RepeatingControlsListViewController from './viewControllers/RepeatingControlsList.vc';
|
|
13
|
+
export * from './index-components';
|
|
14
|
+
declare module '@sprucelabs/heartwood-view-controllers/build/types/heartwood.types' {
|
|
15
|
+
interface ViewControllerMap {
|
|
16
|
+
'calendar.repeating-controls-list': RepeatingControlsListViewController;
|
|
17
|
+
'calendar.calendar': CalendarViewController;
|
|
18
|
+
'calendar.event-date-time-tool': EventDateTimeToolViewController;
|
|
19
|
+
'calendar.event-repeating-tool': EventRepeatingToolViewController;
|
|
20
|
+
'calendar.event-title-tool': EventTitleToolViewController;
|
|
21
|
+
'calendar.event-controls-card': EventControlsCardViewController;
|
|
22
|
+
}
|
|
23
|
+
interface ViewControllerOptionsMap {
|
|
24
|
+
'calendar.repeating-controls-list': ConstructorParameters<typeof RepeatingControlsListViewController>[0];
|
|
25
|
+
'calendar.calendar': ConstructorParameters<typeof CalendarViewController>[0];
|
|
26
|
+
'calendar.event-date-time-tool': ConstructorParameters<typeof EventDateTimeToolViewController>[0];
|
|
27
|
+
'calendar.event-repeating-tool': ConstructorParameters<typeof EventRepeatingToolViewController>[0];
|
|
28
|
+
'calendar.event-title-tool': ConstructorParameters<typeof EventTitleToolViewController>[0];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as calendarAssert } from './__tests__/support/utilities/calendarAssert.js';
|
|
2
|
+
export { default as calendarSkillAssert } from './__tests__/support/utilities/calendarSkillAssert.js';
|
|
3
|
+
export { default as CalendarToolBeltStateMachineTestFactory } from './__tests__/support/CalendarToolBeltStateMachineTestFactory.js';
|
|
4
|
+
export { default as CalendarToolTestFactory } from './toolBelt/CalendarToolTestFactory.js';
|
|
5
|
+
export * from './toolBelt/CalendarToolTestFactory.js';
|
|
6
|
+
export { default as calendarToolBeltInteractor } from './__tests__/support/utilities/calendarToolBeltInteractor.js';
|
|
7
|
+
export * from './index-components.js';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AbstractSkillViewController, SkillViewControllerLoadOptions, SpruceSchemas, ViewControllerOptions, ScopeFlag } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { RemoteViewControllerFactory } from '@sprucelabs/spruce-heartwood-utils';
|
|
3
|
+
import RemotePreferencesStore from '../stores/RemotePreferencesStore';
|
|
4
|
+
import { CalendarToolBeltStateMachine } from '../types/calendar.types';
|
|
5
|
+
import { CalendarEventManager } from '../utilities/CalendarEventManager';
|
|
6
|
+
import CalendarPeopleManager from '../utilities/CalendarPeopleManager';
|
|
7
|
+
import CalendarViewController from '../viewControllers/Calendar.vc';
|
|
8
|
+
export default class RootSkillViewController extends AbstractSkillViewController<Args> {
|
|
9
|
+
static id: string;
|
|
10
|
+
private calendarVc;
|
|
11
|
+
private toolBeltVc;
|
|
12
|
+
private person?;
|
|
13
|
+
private sm;
|
|
14
|
+
private toolBeltStates;
|
|
15
|
+
private remoteEventStore;
|
|
16
|
+
private selectingTypePromise?;
|
|
17
|
+
private selectingTypeResolve?;
|
|
18
|
+
private client;
|
|
19
|
+
private organizationId;
|
|
20
|
+
private locationId;
|
|
21
|
+
private transitionPromise?;
|
|
22
|
+
private loadEventsPromise?;
|
|
23
|
+
protected events: CalendarEventManager;
|
|
24
|
+
protected preferences: RemotePreferencesStore;
|
|
25
|
+
protected people: CalendarPeopleManager;
|
|
26
|
+
protected remoteVc: RemoteViewControllerFactory;
|
|
27
|
+
constructor(options: ViewControllerOptions);
|
|
28
|
+
getScope: () => ScopeFlag[];
|
|
29
|
+
private createToolBeltStates;
|
|
30
|
+
private ToolBeltStateMachine;
|
|
31
|
+
private handleCancelEvent;
|
|
32
|
+
private askForUpdateStrategy;
|
|
33
|
+
private handleSelectEventType;
|
|
34
|
+
private restoreDraftAfterStateLoadError;
|
|
35
|
+
private transitionToStateFromDraftEvent;
|
|
36
|
+
private transitionToolBeltForEvent;
|
|
37
|
+
private transitionTo;
|
|
38
|
+
waitUntilDoneSaving(): Promise<void>;
|
|
39
|
+
private handleSelectCalendar;
|
|
40
|
+
getToolBeltStateMachine(): CalendarToolBeltStateMachine<import("../types/calendar.types").CalendarToolBeltContext>;
|
|
41
|
+
getToolBeltStateId(): string | undefined;
|
|
42
|
+
private CalendarVc;
|
|
43
|
+
private handleChangeDate;
|
|
44
|
+
private makeDateSelectMatchSelectedDateFromCalendar;
|
|
45
|
+
private setSelectedDateInDateSelectVc;
|
|
46
|
+
private getStartDate;
|
|
47
|
+
private handleDeselectEvent;
|
|
48
|
+
private resetToRootState;
|
|
49
|
+
private ToolBeltVc;
|
|
50
|
+
private handleClickEvent;
|
|
51
|
+
private handleDraftEventAdded;
|
|
52
|
+
private handleEventSwapped;
|
|
53
|
+
private handleDropEvent;
|
|
54
|
+
private handleDraftEventRemoved;
|
|
55
|
+
getPersonSelectVc(): import("../viewControllers/PersonSelectTool.vc").default;
|
|
56
|
+
renderToolBelt(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.ToolBelt;
|
|
57
|
+
getCalendarSelectVc(): import("../viewControllers/CalendarSelectTool.vc").default | undefined;
|
|
58
|
+
getCalendarVc(): CalendarViewController;
|
|
59
|
+
load(options: SkillViewControllerLoadOptions<Args>): Promise<void>;
|
|
60
|
+
private syncPeopleOnCalendar;
|
|
61
|
+
private syncOffsetWithLocale;
|
|
62
|
+
private loadEvents;
|
|
63
|
+
private _loadEvents;
|
|
64
|
+
protected transitionToRoot(): Promise<void>;
|
|
65
|
+
private loadLoggedInPerson;
|
|
66
|
+
private getVisibleEvents;
|
|
67
|
+
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.SkillView;
|
|
68
|
+
}
|
|
69
|
+
export declare type CalendarPerson = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.CalendarPerson;
|
|
70
|
+
interface Args {
|
|
71
|
+
startDate?: number;
|
|
72
|
+
}
|
|
73
|
+
export {};
|