@pexip-engage-public/graphql 1.0.1 → 1.0.3
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/CHANGELOG.md +12 -0
- package/dist/graphql-error-codes.d.ts +11 -11
- package/dist/graphql-error-codes.d.ts.map +1 -1
- package/dist/graphql-error-codes.js +11 -11
- package/dist/graphql-error-handler.d.ts +208 -57
- package/dist/graphql-error-handler.d.ts.map +1 -1
- package/dist/graphql-error-handler.js +13 -3
- package/dist/schema.d.ts +8 -8
- package/dist/schema.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/graphql-error-codes.ts +11 -11
- package/src/graphql-error-handler.ts +20 -3
- package/src/schema.ts +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pexip-engage-public/graphql
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- df27bfc8c: SKED-10986: Error handling when API throws a business error
|
|
8
|
+
|
|
9
|
+
## 1.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 04f98b5db: SKED-11576: Control the setting for manually accepting appointments via a feature flag
|
|
14
|
+
|
|
3
15
|
## 1.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** https://developer.pexipengage.com/topic/topic-error-codes */
|
|
2
2
|
export declare enum GraphQLErrorCode {
|
|
3
|
-
/**Cannot provide selected answer options for a question that is not of input type SELECT or MULTI_SELECT. */
|
|
3
|
+
/** Cannot provide selected answer options for a question that is not of input type SELECT or MULTI_SELECT. */
|
|
4
4
|
ANSWER_SELECTED_OPTIONS_FOR_NON_SELECTION_TYPE = "ANSWER_SELECTED_OPTIONS_FOR_NON_SELECTION_TYPE",
|
|
5
|
-
/**Cannot provide single answer value for a question with input type SELECT or MULTI_SELECT. */
|
|
5
|
+
/** Cannot provide single answer value for a question with input type SELECT or MULTI_SELECT. */
|
|
6
6
|
ANSWER_VALUE_FOR_SELECTION_TYPE = "ANSWER_VALUE_FOR_SELECTION_TYPE",
|
|
7
|
-
/**The default availability template cannot be applied. */
|
|
7
|
+
/** The default availability template cannot be applied. */
|
|
8
8
|
APPLIED_TEMPLATE_DEFAULT_TEMPLATE = "APPLIED_TEMPLATE_DEFAULT_TEMPLATE",
|
|
9
9
|
/** The applied template overlaps with an existing applied template. */
|
|
10
10
|
APPLIED_TEMPLATE_OVERLAP = "APPLIED_TEMPLATE_OVERLAP",
|
|
@@ -30,7 +30,7 @@ export declare enum GraphQLErrorCode {
|
|
|
30
30
|
AVAILABILITY_TEMPLATE_DEFAULT_TEMPLATE_MODIFICATION_NOT_ALLOWED = "AVAILABILITY_TEMPLATE_DEFAULT_TEMPLATE_MODIFICATION_NOT_ALLOWED",
|
|
31
31
|
/** The day of the week cannot be set on availability time ranges for DAY availability templates. */
|
|
32
32
|
AVAILABILITY_TIME_RANGE_DAY_TEMPLATE_WITH_DAY_OF_WEEK = "AVAILABILITY_TIME_RANGE_DAY_TEMPLATE_WITH_DAY_OF_WEEK",
|
|
33
|
-
/**
|
|
33
|
+
/** Availability time ranges cannot overlap. */
|
|
34
34
|
AVAILABILITY_TIME_RANGE_OVERLAP = "AVAILABILITY_TIME_RANGE_OVERLAP",
|
|
35
35
|
/** The end must be strictly greater than or equal to the start of an availability time range. */
|
|
36
36
|
AVAILABILITY_TIME_RANGE_START_AFTER_END = "AVAILABILITY_TIME_RANGE_START_AFTER_END",
|
|
@@ -46,13 +46,13 @@ export declare enum GraphQLErrorCode {
|
|
|
46
46
|
EMPLOYEE_EMAIL_ALREADY_IN_USE = "EMPLOYEE_EMAIL_ALREADY_IN_USE",
|
|
47
47
|
/** The office relation roles should match the available employee roles. */
|
|
48
48
|
EMPLOYEE_OFFICE_RELATION_ROLE_MISMATCH = "EMPLOYEE_OFFICE_RELATION_ROLE_MISMATCH",
|
|
49
|
-
/**
|
|
49
|
+
/** Online planning can only be enabled for ACTIVE employees with the AGENT role. */
|
|
50
50
|
EMPLOYEE_ONLINE_PLANNING_NON_AGENT = "EMPLOYEE_ONLINE_PLANNING_NON_AGENT",
|
|
51
51
|
/** The operation cannot be performed on the employe because the employee is SUSPENDED. */
|
|
52
52
|
EMPLOYEE_SUSPENDED = "EMPLOYEE_SUSPENDED",
|
|
53
53
|
/** Cannot set employee status to PENDING. */
|
|
54
54
|
EMPLOYEE_UPDATE_STATUS_PENDING = "EMPLOYEE_UPDATE_STATUS_PENDING",
|
|
55
|
-
/** A fetch configuration can only be deleted if it is not linked to a question.
|
|
55
|
+
/** A fetch configuration can only be deleted if it is not linked to a question. */
|
|
56
56
|
FETCH_CONFIGURATION_LINKED_TO_QUESTION_ON_DELETE = "FETCH_CONFIGURATION_LINKED_TO_QUESTION_ON_DELETE",
|
|
57
57
|
/** The provided URL for an uploaded file is invalid. */
|
|
58
58
|
FILE_URL_INVALID = "FILE_URL_INVALID",
|
|
@@ -66,7 +66,7 @@ export declare enum GraphQLErrorCode {
|
|
|
66
66
|
LISTING_TIME_SLOT_OVERLAP = "LISTING_TIME_SLOT_OVERLAP",
|
|
67
67
|
/** The geolocation could not be determined for the provided location. */
|
|
68
68
|
LOCATION_GEOCODING_FAILED = "LOCATION_GEOCODING_FAILED",
|
|
69
|
-
/** An error occurred while determining the time zone for the given location.
|
|
69
|
+
/** An error occurred while determining the time zone for the given location. */
|
|
70
70
|
LOCATION_TIME_ZONE_RESOLUTION_FAILED = "LOCATION_TIME_ZONE_RESOLUTION_FAILED",
|
|
71
71
|
/** A question with input type FETCH should have a fetch configuration ID. */
|
|
72
72
|
QUESTION_FETCH_TYPE_WITHOUT_FETCH_CONFIGURATION = "QUESTION_FETCH_TYPE_WITHOUT_FETCH_CONFIGURATION",
|
|
@@ -76,17 +76,17 @@ export declare enum GraphQLErrorCode {
|
|
|
76
76
|
QUESTION_NON_SELECTION_TYPE_WITH_ANSWER_OPTIONS = "QUESTION_NON_SELECTION_TYPE_WITH_ANSWER_OPTIONS",
|
|
77
77
|
/** A question with input type SELECT or MULTI_SELECT should have at least one answer option. */
|
|
78
78
|
QUESTION_SELECTION_TYPE_WITHOUT_ANSWER_OPTIONS = "QUESTION_SELECTION_TYPE_WITHOUT_ANSWER_OPTIONS",
|
|
79
|
-
/** The appointmentLatestPossible enterprise setting must be greater than or equal to appointmentEarliestPossible.
|
|
79
|
+
/** The appointmentLatestPossible enterprise setting must be greater than or equal to appointmentEarliestPossible. */
|
|
80
80
|
SETTING_APPOINTMENT_EARLIEST_LATEST_POSSIBLE_INVALID = "SETTING_APPOINTMENT_EARLIEST_LATEST_POSSIBLE_INVALID",
|
|
81
|
-
/** Cannot update a manageable enterprise setting to a non-manageable enterprise setting.
|
|
81
|
+
/** Cannot update a manageable enterprise setting to a non-manageable enterprise setting. */
|
|
82
82
|
SETTING_MANAGEABILITY_MODIFICATION_NOT_ALLOWED = "SETTING_MANAGEABILITY_MODIFICATION_NOT_ALLOWED",
|
|
83
83
|
/** Cannot update a non-manageable enterprise setting. */
|
|
84
84
|
SETTING_NON_MANAGEABLE = "SETTING_NON_MANAGEABLE",
|
|
85
|
-
/** The value of the enterprise setting is invalid.
|
|
85
|
+
/** The value of the enterprise setting is invalid. */
|
|
86
86
|
SETTING_VALUE_INVALID = "SETTING_VALUE_INVALID",
|
|
87
87
|
/** A subject group can only be deleted if it has no subjects. */
|
|
88
88
|
SUBJECT_GROUP_NOT_EMPTY_ON_DELETE = "SUBJECT_GROUP_NOT_EMPTY_ON_DELETE",
|
|
89
|
-
/**
|
|
89
|
+
/** The requested combination is not schedulable. */
|
|
90
90
|
TIMETABLE_NOT_SCHEDULABLE = "TIMETABLE_NOT_SCHEDULABLE",
|
|
91
91
|
/** The user-defined unavailability overlaps with another existing user-defined unavailability. */
|
|
92
92
|
UNAVAILABILITY_OVERLAP = "UNAVAILABILITY_OVERLAP"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-error-codes.d.ts","sourceRoot":"","sources":["../src/graphql-error-codes.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,oBAAY,gBAAgB;IAC1B,
|
|
1
|
+
{"version":3,"file":"graphql-error-codes.d.ts","sourceRoot":"","sources":["../src/graphql-error-codes.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,oBAAY,gBAAgB;IAC1B,8GAA8G;IAC9G,8CAA8C,mDAAmD;IACjG,gGAAgG;IAChG,+BAA+B,oCAAoC;IACnE,2DAA2D;IAC3D,iCAAiC,sCAAsC;IACvE,uEAAuE;IACvE,wBAAwB,6BAA6B;IACrD,yFAAyF;IACzF,gCAAgC,qCAAqC;IACrE,6JAA6J;IAC7J,gCAAgC,qCAAqC;IACrE,sEAAsE;IACtE,oCAAoC,yCAAyC;IAC7E,sEAAsE;IACtE,oCAAoC,yCAAyC;IAC7E,mEAAmE;IACnE,gDAAgD,qDAAqD;IACrG,uDAAuD;IACvD,6BAA6B,kCAAkC;IAC/D,uDAAuD;IACvD,2BAA2B,gCAAgC;IAC3D,0EAA0E;IAC1E,2BAA2B,gCAAgC;IAC3D,6GAA6G;IAC7G,0BAA0B,+BAA+B;IACzD,4DAA4D;IAC5D,+DAA+D,oEAAoE;IACnI,oGAAoG;IACpG,qDAAqD,0DAA0D;IAC/G,+CAA+C;IAC/C,+BAA+B,oCAAoC;IACnE,iGAAiG;IACjG,uCAAuC,4CAA4C;IACnF,mGAAmG;IACnG,yDAAyD,8DAA8D;IACvH,qIAAqI;IACrI,yBAAyB,8BAA8B;IACvD,2DAA2D;IAC3D,uCAAuC,4CAA4C;IACnF,qEAAqE;IACrE,uBAAuB,4BAA4B;IACnD,0FAA0F;IAC1F,6BAA6B,kCAAkC;IAC/D,2EAA2E;IAC3E,sCAAsC,2CAA2C;IACjF,oFAAoF;IACpF,kCAAkC,uCAAuC;IACzE,0FAA0F;IAC1F,kBAAkB,uBAAuB;IACzC,6CAA6C;IAC7C,8BAA8B,mCAAmC;IACjE,mFAAmF;IACnF,gDAAgD,qDAAqD;IACrG,wDAAwD;IACxD,gBAAgB,qBAAqB;IACrC,yFAAyF;IACzF,gCAAgC,qCAAqC;IACrE,sFAAsF;IACtF,wEAAwE,6EAA6E;IACrJ,sFAAsF;IACtF,qCAAqC,0CAA0C;IAC/E,yCAAyC;IACzC,yBAAyB,8BAA8B;IACvD,yEAAyE;IACzE,yBAAyB,8BAA8B;IACvD,gFAAgF;IAChF,oCAAoC,yCAAyC;IAC7E,6EAA6E;IAC7E,+CAA+C,oDAAoD;IACnG,+EAA+E;IAC/E,gDAAgD,qDAAqD;IACrG,qGAAqG;IACrG,+CAA+C,oDAAoD;IACnG,gGAAgG;IAChG,8CAA8C,mDAAmD;IACjG,qHAAqH;IACrH,oDAAoD,yDAAyD;IAC7G,4FAA4F;IAC5F,8CAA8C,mDAAmD;IACjG,yDAAyD;IACzD,sBAAsB,2BAA2B;IACjD,sDAAsD;IACtD,qBAAqB,0BAA0B;IAC/C,iEAAiE;IACjE,iCAAiC,sCAAsC;IACvE,oDAAoD;IACpD,yBAAyB,8BAA8B;IACvD,kGAAkG;IAClG,sBAAsB,2BAA2B;CAClD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** https://developer.pexipengage.com/topic/topic-error-codes */
|
|
2
2
|
export var GraphQLErrorCode;
|
|
3
3
|
(function (GraphQLErrorCode) {
|
|
4
|
-
/**Cannot provide selected answer options for a question that is not of input type SELECT or MULTI_SELECT. */
|
|
4
|
+
/** Cannot provide selected answer options for a question that is not of input type SELECT or MULTI_SELECT. */
|
|
5
5
|
GraphQLErrorCode["ANSWER_SELECTED_OPTIONS_FOR_NON_SELECTION_TYPE"] = "ANSWER_SELECTED_OPTIONS_FOR_NON_SELECTION_TYPE";
|
|
6
|
-
/**Cannot provide single answer value for a question with input type SELECT or MULTI_SELECT. */
|
|
6
|
+
/** Cannot provide single answer value for a question with input type SELECT or MULTI_SELECT. */
|
|
7
7
|
GraphQLErrorCode["ANSWER_VALUE_FOR_SELECTION_TYPE"] = "ANSWER_VALUE_FOR_SELECTION_TYPE";
|
|
8
|
-
/**The default availability template cannot be applied. */
|
|
8
|
+
/** The default availability template cannot be applied. */
|
|
9
9
|
GraphQLErrorCode["APPLIED_TEMPLATE_DEFAULT_TEMPLATE"] = "APPLIED_TEMPLATE_DEFAULT_TEMPLATE";
|
|
10
10
|
/** The applied template overlaps with an existing applied template. */
|
|
11
11
|
GraphQLErrorCode["APPLIED_TEMPLATE_OVERLAP"] = "APPLIED_TEMPLATE_OVERLAP";
|
|
@@ -31,7 +31,7 @@ export var GraphQLErrorCode;
|
|
|
31
31
|
GraphQLErrorCode["AVAILABILITY_TEMPLATE_DEFAULT_TEMPLATE_MODIFICATION_NOT_ALLOWED"] = "AVAILABILITY_TEMPLATE_DEFAULT_TEMPLATE_MODIFICATION_NOT_ALLOWED";
|
|
32
32
|
/** The day of the week cannot be set on availability time ranges for DAY availability templates. */
|
|
33
33
|
GraphQLErrorCode["AVAILABILITY_TIME_RANGE_DAY_TEMPLATE_WITH_DAY_OF_WEEK"] = "AVAILABILITY_TIME_RANGE_DAY_TEMPLATE_WITH_DAY_OF_WEEK";
|
|
34
|
-
/**
|
|
34
|
+
/** Availability time ranges cannot overlap. */
|
|
35
35
|
GraphQLErrorCode["AVAILABILITY_TIME_RANGE_OVERLAP"] = "AVAILABILITY_TIME_RANGE_OVERLAP";
|
|
36
36
|
/** The end must be strictly greater than or equal to the start of an availability time range. */
|
|
37
37
|
GraphQLErrorCode["AVAILABILITY_TIME_RANGE_START_AFTER_END"] = "AVAILABILITY_TIME_RANGE_START_AFTER_END";
|
|
@@ -47,13 +47,13 @@ export var GraphQLErrorCode;
|
|
|
47
47
|
GraphQLErrorCode["EMPLOYEE_EMAIL_ALREADY_IN_USE"] = "EMPLOYEE_EMAIL_ALREADY_IN_USE";
|
|
48
48
|
/** The office relation roles should match the available employee roles. */
|
|
49
49
|
GraphQLErrorCode["EMPLOYEE_OFFICE_RELATION_ROLE_MISMATCH"] = "EMPLOYEE_OFFICE_RELATION_ROLE_MISMATCH";
|
|
50
|
-
/**
|
|
50
|
+
/** Online planning can only be enabled for ACTIVE employees with the AGENT role. */
|
|
51
51
|
GraphQLErrorCode["EMPLOYEE_ONLINE_PLANNING_NON_AGENT"] = "EMPLOYEE_ONLINE_PLANNING_NON_AGENT";
|
|
52
52
|
/** The operation cannot be performed on the employe because the employee is SUSPENDED. */
|
|
53
53
|
GraphQLErrorCode["EMPLOYEE_SUSPENDED"] = "EMPLOYEE_SUSPENDED";
|
|
54
54
|
/** Cannot set employee status to PENDING. */
|
|
55
55
|
GraphQLErrorCode["EMPLOYEE_UPDATE_STATUS_PENDING"] = "EMPLOYEE_UPDATE_STATUS_PENDING";
|
|
56
|
-
/** A fetch configuration can only be deleted if it is not linked to a question.
|
|
56
|
+
/** A fetch configuration can only be deleted if it is not linked to a question. */
|
|
57
57
|
GraphQLErrorCode["FETCH_CONFIGURATION_LINKED_TO_QUESTION_ON_DELETE"] = "FETCH_CONFIGURATION_LINKED_TO_QUESTION_ON_DELETE";
|
|
58
58
|
/** The provided URL for an uploaded file is invalid. */
|
|
59
59
|
GraphQLErrorCode["FILE_URL_INVALID"] = "FILE_URL_INVALID";
|
|
@@ -67,7 +67,7 @@ export var GraphQLErrorCode;
|
|
|
67
67
|
GraphQLErrorCode["LISTING_TIME_SLOT_OVERLAP"] = "LISTING_TIME_SLOT_OVERLAP";
|
|
68
68
|
/** The geolocation could not be determined for the provided location. */
|
|
69
69
|
GraphQLErrorCode["LOCATION_GEOCODING_FAILED"] = "LOCATION_GEOCODING_FAILED";
|
|
70
|
-
/** An error occurred while determining the time zone for the given location.
|
|
70
|
+
/** An error occurred while determining the time zone for the given location. */
|
|
71
71
|
GraphQLErrorCode["LOCATION_TIME_ZONE_RESOLUTION_FAILED"] = "LOCATION_TIME_ZONE_RESOLUTION_FAILED";
|
|
72
72
|
/** A question with input type FETCH should have a fetch configuration ID. */
|
|
73
73
|
GraphQLErrorCode["QUESTION_FETCH_TYPE_WITHOUT_FETCH_CONFIGURATION"] = "QUESTION_FETCH_TYPE_WITHOUT_FETCH_CONFIGURATION";
|
|
@@ -77,17 +77,17 @@ export var GraphQLErrorCode;
|
|
|
77
77
|
GraphQLErrorCode["QUESTION_NON_SELECTION_TYPE_WITH_ANSWER_OPTIONS"] = "QUESTION_NON_SELECTION_TYPE_WITH_ANSWER_OPTIONS";
|
|
78
78
|
/** A question with input type SELECT or MULTI_SELECT should have at least one answer option. */
|
|
79
79
|
GraphQLErrorCode["QUESTION_SELECTION_TYPE_WITHOUT_ANSWER_OPTIONS"] = "QUESTION_SELECTION_TYPE_WITHOUT_ANSWER_OPTIONS";
|
|
80
|
-
/** The appointmentLatestPossible enterprise setting must be greater than or equal to appointmentEarliestPossible.
|
|
80
|
+
/** The appointmentLatestPossible enterprise setting must be greater than or equal to appointmentEarliestPossible. */
|
|
81
81
|
GraphQLErrorCode["SETTING_APPOINTMENT_EARLIEST_LATEST_POSSIBLE_INVALID"] = "SETTING_APPOINTMENT_EARLIEST_LATEST_POSSIBLE_INVALID";
|
|
82
|
-
/** Cannot update a manageable enterprise setting to a non-manageable enterprise setting.
|
|
82
|
+
/** Cannot update a manageable enterprise setting to a non-manageable enterprise setting. */
|
|
83
83
|
GraphQLErrorCode["SETTING_MANAGEABILITY_MODIFICATION_NOT_ALLOWED"] = "SETTING_MANAGEABILITY_MODIFICATION_NOT_ALLOWED";
|
|
84
84
|
/** Cannot update a non-manageable enterprise setting. */
|
|
85
85
|
GraphQLErrorCode["SETTING_NON_MANAGEABLE"] = "SETTING_NON_MANAGEABLE";
|
|
86
|
-
/** The value of the enterprise setting is invalid.
|
|
86
|
+
/** The value of the enterprise setting is invalid. */
|
|
87
87
|
GraphQLErrorCode["SETTING_VALUE_INVALID"] = "SETTING_VALUE_INVALID";
|
|
88
88
|
/** A subject group can only be deleted if it has no subjects. */
|
|
89
89
|
GraphQLErrorCode["SUBJECT_GROUP_NOT_EMPTY_ON_DELETE"] = "SUBJECT_GROUP_NOT_EMPTY_ON_DELETE";
|
|
90
|
-
/**
|
|
90
|
+
/** The requested combination is not schedulable. */
|
|
91
91
|
GraphQLErrorCode["TIMETABLE_NOT_SCHEDULABLE"] = "TIMETABLE_NOT_SCHEDULABLE";
|
|
92
92
|
/** The user-defined unavailability overlaps with another existing user-defined unavailability. */
|
|
93
93
|
GraphQLErrorCode["UNAVAILABILITY_OVERLAP"] = "UNAVAILABILITY_OVERLAP";
|
|
@@ -1,64 +1,214 @@
|
|
|
1
1
|
import { ClientError } from "graphql-request";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { GraphQLErrorCode } from "./graphql-error-codes.js";
|
|
4
|
+
declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
|
|
5
|
+
/**
|
|
6
|
+
* A `400` response code indicates a malformed request.
|
|
7
|
+
*
|
|
8
|
+
* The request should not be retried without changes.
|
|
9
|
+
*/
|
|
10
|
+
http: z.ZodLiteral<400>;
|
|
11
|
+
exception: z.ZodObject<{
|
|
12
|
+
message: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
message: string;
|
|
15
|
+
}, {
|
|
16
|
+
message: string;
|
|
17
|
+
}>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
http: 400;
|
|
20
|
+
exception: {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
http: 400;
|
|
25
|
+
exception: {
|
|
26
|
+
message: string;
|
|
27
|
+
};
|
|
28
|
+
}>, z.ZodObject<{
|
|
29
|
+
/**
|
|
30
|
+
* A `401` response code indicates an unauthorized request.
|
|
31
|
+
*
|
|
32
|
+
* This response can be expected when the `Authorization` header value is invalid, expired or missing.
|
|
33
|
+
*
|
|
34
|
+
* The request should not be retried with the same `Authorization` header value.
|
|
35
|
+
*/
|
|
36
|
+
http: z.ZodLiteral<401>;
|
|
37
|
+
exception: z.ZodObject<{
|
|
38
|
+
message: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
message: string;
|
|
41
|
+
}, {
|
|
42
|
+
message: string;
|
|
43
|
+
}>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
http: 401;
|
|
46
|
+
exception: {
|
|
47
|
+
message: string;
|
|
48
|
+
};
|
|
49
|
+
}, {
|
|
50
|
+
http: 401;
|
|
51
|
+
exception: {
|
|
52
|
+
message: string;
|
|
53
|
+
};
|
|
54
|
+
}>, z.ZodObject<{
|
|
55
|
+
/**
|
|
56
|
+
* A `403` response code indicates a forbidden request.
|
|
57
|
+
*
|
|
58
|
+
* The provided `Authorization` header value is valid but the request is prohibited due to other permission restrictions (e.g., missing scopes or organizational settings).
|
|
59
|
+
*/
|
|
60
|
+
http: z.ZodLiteral<403>;
|
|
61
|
+
exception: z.ZodObject<{
|
|
62
|
+
message: z.ZodString;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
message: string;
|
|
65
|
+
}, {
|
|
66
|
+
message: string;
|
|
67
|
+
}>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
http: 403;
|
|
70
|
+
exception: {
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
}, {
|
|
74
|
+
http: 403;
|
|
75
|
+
exception: {
|
|
76
|
+
message: string;
|
|
77
|
+
};
|
|
78
|
+
}>, z.ZodObject<{
|
|
79
|
+
/**
|
|
80
|
+
* A `404` response code indicates a resource that cannot be found.
|
|
81
|
+
*
|
|
82
|
+
* This response code will be returned in case of a non-existent URL being used or a non-existent resource ID being used in a valid URL structure.
|
|
83
|
+
*/
|
|
84
|
+
http: z.ZodLiteral<404>;
|
|
85
|
+
exception: z.ZodObject<{
|
|
86
|
+
message: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
message: string;
|
|
89
|
+
}, {
|
|
90
|
+
message: string;
|
|
91
|
+
}>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
http: 404;
|
|
94
|
+
exception: {
|
|
95
|
+
message: string;
|
|
96
|
+
};
|
|
97
|
+
}, {
|
|
98
|
+
http: 404;
|
|
99
|
+
exception: {
|
|
100
|
+
message: string;
|
|
101
|
+
};
|
|
102
|
+
}>, z.ZodObject<{
|
|
103
|
+
/**
|
|
104
|
+
* A `405` response code indicates that the HTTP method being used is not supported for the target URL.
|
|
105
|
+
*
|
|
106
|
+
* The request should not be retried without changes.
|
|
107
|
+
*/
|
|
108
|
+
http: z.ZodLiteral<405>;
|
|
109
|
+
exception: z.ZodObject<{
|
|
110
|
+
message: z.ZodString;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
message: string;
|
|
113
|
+
}, {
|
|
114
|
+
message: string;
|
|
115
|
+
}>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
http: 405;
|
|
118
|
+
exception: {
|
|
119
|
+
message: string;
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
http: 405;
|
|
123
|
+
exception: {
|
|
124
|
+
message: string;
|
|
125
|
+
};
|
|
126
|
+
}>, z.ZodObject<{
|
|
127
|
+
/**
|
|
128
|
+
* A `409` response code indicates a conflict, caused by concurrent operations, that resulted in a situation where the requested operation could not be performed simultaneously with another operation.
|
|
129
|
+
*
|
|
130
|
+
* The request can be retried without changes but will most likely result in another error response code.
|
|
131
|
+
*/
|
|
132
|
+
http: z.ZodLiteral<409>;
|
|
133
|
+
exception: z.ZodObject<{
|
|
134
|
+
message: z.ZodString;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
message: string;
|
|
137
|
+
}, {
|
|
138
|
+
message: string;
|
|
139
|
+
}>;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
http: 409;
|
|
142
|
+
exception: {
|
|
143
|
+
message: string;
|
|
144
|
+
};
|
|
145
|
+
}, {
|
|
146
|
+
http: 409;
|
|
147
|
+
exception: {
|
|
148
|
+
message: string;
|
|
149
|
+
};
|
|
150
|
+
}>, z.ZodObject<{
|
|
151
|
+
/**
|
|
152
|
+
* A `422` response code indicates a failed business validation.
|
|
153
|
+
*
|
|
154
|
+
* More information on the business validation concerned can be found in [Error codes](https://developer.pexipengage.com/topic/topic-error-codes) by looking up the specific error code mentioned in the `errors` array in the response body.
|
|
155
|
+
*/
|
|
156
|
+
http: z.ZodLiteral<422>;
|
|
157
|
+
code: z.ZodNativeEnum<typeof GraphQLErrorCode>;
|
|
158
|
+
type: z.ZodLiteral<"UnprocessableEntity">;
|
|
159
|
+
exception: z.ZodObject<{
|
|
160
|
+
message: z.ZodString;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
message: string;
|
|
163
|
+
}, {
|
|
164
|
+
message: string;
|
|
165
|
+
}>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
code: GraphQLErrorCode;
|
|
168
|
+
type: "UnprocessableEntity";
|
|
169
|
+
http: 422;
|
|
170
|
+
exception: {
|
|
171
|
+
message: string;
|
|
172
|
+
};
|
|
173
|
+
}, {
|
|
174
|
+
code: GraphQLErrorCode;
|
|
175
|
+
type: "UnprocessableEntity";
|
|
176
|
+
http: 422;
|
|
177
|
+
exception: {
|
|
178
|
+
message: string;
|
|
179
|
+
};
|
|
180
|
+
}>, z.ZodObject<{
|
|
181
|
+
/** A `429` response code indicates that too many requests were sent in a given amount of time. See [Rate limiting](https://developer.pexipengage.com/topic/topic-rate-limiting). */
|
|
182
|
+
http: z.ZodLiteral<429>;
|
|
183
|
+
exception: z.ZodObject<{
|
|
184
|
+
message: z.ZodString;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
message: string;
|
|
187
|
+
}, {
|
|
188
|
+
message: string;
|
|
189
|
+
}>;
|
|
190
|
+
}, "strip", z.ZodTypeAny, {
|
|
191
|
+
http: 429;
|
|
192
|
+
exception: {
|
|
193
|
+
message: string;
|
|
194
|
+
};
|
|
195
|
+
}, {
|
|
196
|
+
http: 429;
|
|
197
|
+
exception: {
|
|
198
|
+
message: string;
|
|
199
|
+
};
|
|
200
|
+
}>]>;
|
|
201
|
+
type Extension = z.infer<typeof ExtensionSchema>;
|
|
202
|
+
type HttpCode = Extension["http"];
|
|
203
|
+
type ErrorMap = {
|
|
204
|
+
[key in HttpCode]?: Extract<Extension, {
|
|
205
|
+
http: key;
|
|
206
|
+
}>[];
|
|
207
|
+
};
|
|
4
208
|
export declare function handleGQLError(error: unknown): {
|
|
5
209
|
readonly type: "GQL";
|
|
6
210
|
readonly error: ClientError;
|
|
7
|
-
readonly
|
|
8
|
-
extensions: {
|
|
9
|
-
http: 400;
|
|
10
|
-
exception: {
|
|
11
|
-
message: string;
|
|
12
|
-
};
|
|
13
|
-
} | {
|
|
14
|
-
http: 401;
|
|
15
|
-
exception: {
|
|
16
|
-
message: string;
|
|
17
|
-
};
|
|
18
|
-
} | {
|
|
19
|
-
http: 403;
|
|
20
|
-
exception: {
|
|
21
|
-
message: string;
|
|
22
|
-
};
|
|
23
|
-
} | {
|
|
24
|
-
http: 404;
|
|
25
|
-
exception: {
|
|
26
|
-
message: string;
|
|
27
|
-
};
|
|
28
|
-
} | {
|
|
29
|
-
http: 405;
|
|
30
|
-
exception: {
|
|
31
|
-
message: string;
|
|
32
|
-
};
|
|
33
|
-
} | {
|
|
34
|
-
http: 409;
|
|
35
|
-
exception: {
|
|
36
|
-
message: string;
|
|
37
|
-
};
|
|
38
|
-
} | {
|
|
39
|
-
code: GraphQLErrorCode;
|
|
40
|
-
type: "UnprocessableEntity";
|
|
41
|
-
http: 422;
|
|
42
|
-
exception: {
|
|
43
|
-
message: string;
|
|
44
|
-
};
|
|
45
|
-
} | {
|
|
46
|
-
http: 429;
|
|
47
|
-
exception: {
|
|
48
|
-
message: string;
|
|
49
|
-
};
|
|
50
|
-
} | z.objectOutputType<{}, z.ZodTypeAny, "passthrough">;
|
|
51
|
-
locations: readonly import("graphql").SourceLocation[] | undefined;
|
|
52
|
-
path: readonly (string | number)[] | undefined;
|
|
53
|
-
nodes: readonly import("graphql").ASTNode[] | undefined;
|
|
54
|
-
source: import("graphql").Source | undefined;
|
|
55
|
-
positions: readonly number[] | undefined;
|
|
56
|
-
originalError: Error | undefined;
|
|
57
|
-
name: string;
|
|
58
|
-
message: string;
|
|
59
|
-
stack?: string | undefined;
|
|
60
|
-
cause?: unknown;
|
|
61
|
-
}[] | undefined;
|
|
211
|
+
readonly errorMap: ErrorMap;
|
|
62
212
|
readonly subtype?: undefined;
|
|
63
213
|
readonly err?: undefined;
|
|
64
214
|
} | {
|
|
@@ -66,12 +216,13 @@ export declare function handleGQLError(error: unknown): {
|
|
|
66
216
|
readonly subtype: "ZOD_VALIDATION_FAILED";
|
|
67
217
|
readonly error: ClientError;
|
|
68
218
|
readonly err: unknown;
|
|
69
|
-
readonly
|
|
219
|
+
readonly errorMap?: undefined;
|
|
70
220
|
} | {
|
|
71
221
|
readonly type: "UNKNOWN";
|
|
72
222
|
readonly error: unknown;
|
|
73
|
-
readonly
|
|
223
|
+
readonly errorMap?: undefined;
|
|
74
224
|
readonly subtype?: undefined;
|
|
75
225
|
readonly err?: undefined;
|
|
76
226
|
};
|
|
227
|
+
export {};
|
|
77
228
|
//# sourceMappingURL=graphql-error-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-error-handler.d.ts","sourceRoot":"","sources":["../src/graphql-error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql-error-handler.d.ts","sourceRoot":"","sources":["../src/graphql-error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,QAAA,MAAM,eAAe;IAEjB;;;;OAIG;;;;;;;;;;;;;;;;;;;;IAKH;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;IAKH;;;;OAIG;;;;;;;;;;;;;;;;;;;;IAKH;;;;OAIG;;;;;;;;;;;;;;;;;;;;IAKH;;;;OAIG;;;;;;;;;;;;;;;;;;;;IAKH;;;;OAIG;;;;;;;;;;;;;;;;;;;;IAKH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;IAWH,oLAAoL;;;;;;;;;;;;;;;;;;;IAItL,CAAC;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACjD,KAAK,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAClC,KAAK,QAAQ,GAAG;KAAG,GAAG,IAAI,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC,EAAE;CAAE,CAAC;AAE5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;;;;;;;;;;;;;;EA8B5C"}
|
|
@@ -78,17 +78,27 @@ const ExtensionSchema = z.union([
|
|
|
78
78
|
http: z.literal(429),
|
|
79
79
|
exception: z.object({ message: z.string() }),
|
|
80
80
|
}),
|
|
81
|
-
z.object({}).passthrough(),
|
|
82
81
|
]);
|
|
83
82
|
export function handleGQLError(error) {
|
|
84
83
|
if (error instanceof ClientError) {
|
|
85
|
-
// TODO fix this mess..
|
|
86
84
|
try {
|
|
87
85
|
const errors = error.response.errors?.map((err) => ({
|
|
88
86
|
...err,
|
|
89
87
|
extensions: ExtensionSchema.parse(err.extensions),
|
|
90
88
|
}));
|
|
91
|
-
|
|
89
|
+
const map = {};
|
|
90
|
+
const errorMap = errors?.reduce((acc, curr) => {
|
|
91
|
+
const extension = curr.extensions;
|
|
92
|
+
const currentEntry = acc[extension.http];
|
|
93
|
+
if (currentEntry) {
|
|
94
|
+
currentEntry.push(extension);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
acc[extension.http] = [extension];
|
|
98
|
+
}
|
|
99
|
+
return acc;
|
|
100
|
+
}, map) ?? map;
|
|
101
|
+
return { type: "GQL", error, errorMap };
|
|
92
102
|
}
|
|
93
103
|
catch (err) {
|
|
94
104
|
return { type: "GQL", subtype: "ZOD_VALIDATION_FAILED", error, err };
|
package/dist/schema.d.ts
CHANGED
|
@@ -212,8 +212,8 @@ export type AppointmentAutoAcceptEnterpriseSetting = {
|
|
|
212
212
|
createdAt: Scalars["ISO8601"]["output"];
|
|
213
213
|
manageable: Scalars["Boolean"]["output"];
|
|
214
214
|
updatedAt: Scalars["ISO8601"]["output"];
|
|
215
|
-
/**
|
|
216
|
-
value:
|
|
215
|
+
/** Manage the default auto accept setting value or disable manual manual accept. */
|
|
216
|
+
value: AutoAcceptSetting;
|
|
217
217
|
};
|
|
218
218
|
export type AppointmentCancelInput = {
|
|
219
219
|
answers?: InputMaybe<Array<AppointmentAnswerInput>>;
|
|
@@ -366,7 +366,6 @@ export type AppointmentRescheduleInput = {
|
|
|
366
366
|
answers?: InputMaybe<Array<AppointmentAnswerInput>>;
|
|
367
367
|
end: Scalars["ISO8601"]["input"];
|
|
368
368
|
message?: InputMaybe<Scalars["String"]["input"]>;
|
|
369
|
-
metadata?: InputMaybe<Scalars["JSONObject"]["input"]>;
|
|
370
369
|
start: Scalars["ISO8601"]["input"];
|
|
371
370
|
};
|
|
372
371
|
export type AppointmentSort = {
|
|
@@ -393,6 +392,7 @@ export type AppointmentTravelBufferTimeEnterpriseSetting = {
|
|
|
393
392
|
/** The default travel buffer time after an appointment. */
|
|
394
393
|
value: Scalars["Int"]["output"];
|
|
395
394
|
};
|
|
395
|
+
export type AutoAcceptSetting = "DEFAULT_FALSE" | "DEFAULT_TRUE" | "MANDATORY";
|
|
396
396
|
export type AvailabilitySetting = {
|
|
397
397
|
autoAccept: BooleanAvailabilitySetting;
|
|
398
398
|
estimatedDuration: IntegerAvailabilitySetting;
|
|
@@ -960,7 +960,7 @@ export type EnterpriseSettings = {
|
|
|
960
960
|
allowedExternalCalendarAccountProviders: AllowedExternalCalendarAccountProvidersEnterpriseSetting;
|
|
961
961
|
/** The domains on which the plugin can be integrated. */
|
|
962
962
|
allowedPluginDomains: AllowedPluginDomainsEnterpriseSetting;
|
|
963
|
-
/**
|
|
963
|
+
/** Manage the default auto accept setting value or disable manual manual accept. */
|
|
964
964
|
appointmentAutoAccept: AppointmentAutoAcceptEnterpriseSetting;
|
|
965
965
|
/** The number of days before its start from when an appointment can be completed. */
|
|
966
966
|
appointmentCompletionAllowedDaysBeforeStart: AppointmentCompletionAllowedDaysBeforeStartEnterpriseSetting;
|
|
@@ -1052,7 +1052,7 @@ export type EnterpriseSettingsPatchInput = {
|
|
|
1052
1052
|
allowedExternalCalendarAccountProviders?: InputMaybe<AllowedExternalCalendarAccountProvidersInput>;
|
|
1053
1053
|
/** The domains on which the plugin can be integrated. */
|
|
1054
1054
|
allowedPluginDomains?: InputMaybe<AllowedPluginDomainsInput>;
|
|
1055
|
-
/**
|
|
1055
|
+
/** Manage the default auto accept setting value or disable manual manual accept. */
|
|
1056
1056
|
appointmentAutoAccept?: InputMaybe<AppointmentAutoAcceptInput>;
|
|
1057
1057
|
/** The number of days before its start from when an appointment can be completed. */
|
|
1058
1058
|
appointmentCompletionAllowedDaysBeforeStart?: InputMaybe<AppointmentCompletionAllowedDaysBeforeStartInput>;
|
|
@@ -3876,7 +3876,7 @@ export type TranslationObjectInput = {
|
|
|
3876
3876
|
language: Language;
|
|
3877
3877
|
value: Scalars["String"]["input"];
|
|
3878
3878
|
};
|
|
3879
|
-
export type UiFeature = "APPOINTMENT_CREATION" | "APPOINTMENT_CUSTOMER_SELECTION" | "APPOINTMENT_SUBJECT_SELECTION" | "CUSTOMER_CREATION" | "CUSTOMER_DETAILS" | "DEFAULT_AVAILABILITY_SETTINGS_OVERRIDE" | "DEFINED_AVAILABILITY_SYNCHRONIZATION" | "FORMS" | "INDEPENDENT_AGENTS" | "INVITE_CREATION" | "LEAD_SEGMENTS" | "LISTINGS" | "
|
|
3879
|
+
export type UiFeature = "APPOINTMENT_CREATION" | "APPOINTMENT_CUSTOMER_SELECTION" | "APPOINTMENT_SUBJECT_SELECTION" | "CUSTOMER_CREATION" | "CUSTOMER_DETAILS" | "DEFAULT_AVAILABILITY_SETTINGS_OVERRIDE" | "DEFINED_AVAILABILITY_SYNCHRONIZATION" | "FORMS" | "INDEPENDENT_AGENTS" | "INVITE_CREATION" | "LEAD_SEGMENTS" | "LISTINGS" | "MEETING_LINK_CREATION" | "MY_APPOINTMENTS" | "MY_APPOINTMENT_HOURS" | "MY_AUTHENTICATION" | "MY_PROFILE" | "MY_SYNCHRONIZED_CALENDARS" | "RESCHEDULE_REQUEST" | "TEAM_APPOINTMENTS_OVERVIEW" | "TEAM_APPOINTMENT_INSIGHTS" | "TEAM_COVERAGE_REGIONS_ON_LOCATION" | "TEAM_COVERAGE_REGIONS_PHONE" | "TEAM_COVERAGE_REGIONS_VIDEO" | "TEAM_MEMBERS_OVERVIEW" | "TEAM_MEMBER_APPOINTMENT_HOURS" | "TEAM_MEMBER_EXPERTISE" | "TEAM_MEMBER_PROFILE" | "TEAM_MEMBER_REMOVAL" | "TEAM_MEMBER_SYNCHRONIZED_CALENDARS" | "TEAM_OFFICE_DETAILS" | "TEAM_OFFICE_EXPERTISE" | "TEAM_OFFICE_PLANNING_RULES" | "VIRTUAL_OFFICES";
|
|
3880
3880
|
export type UiFeatureToggleEnterpriseSettingInput = {
|
|
3881
3881
|
enabled: Scalars["Boolean"]["input"];
|
|
3882
3882
|
feature: UiFeature;
|
|
@@ -4074,8 +4074,8 @@ export type AllowedPluginDomainsInput = {
|
|
|
4074
4074
|
};
|
|
4075
4075
|
export type AppointmentAutoAcceptInput = {
|
|
4076
4076
|
manageable?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
4077
|
-
/**
|
|
4078
|
-
value?: InputMaybe<
|
|
4077
|
+
/** Manage the default auto accept setting value or disable manual manual accept. */
|
|
4078
|
+
value?: InputMaybe<AutoAcceptSetting>;
|
|
4079
4079
|
};
|
|
4080
4080
|
export type AppointmentCompletionAllowedDaysBeforeStartInput = {
|
|
4081
4081
|
manageable?: InputMaybe<Scalars["Boolean"]["input"]>;
|