@pexip-engage-public/graphql 1.1.1 → 1.1.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pexip-engage-public/graphql
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ffd2cb: fix(deps): update all non-major dependencies
8
+ - Updated dependencies [3ffd2cb]
9
+ - @pexip-engage/utils@0.1.45
10
+
11
+ ## 1.1.2
12
+
13
+ ### Patch Changes
14
+
15
+ - fe57fbf: chore: biome@2.0.0
16
+ - Updated dependencies [fe57fbf]
17
+ - @pexip-engage/utils@0.1.44
18
+
3
19
  ## 1.1.1
4
20
 
5
21
  ### Patch Changes
@@ -388,7 +404,6 @@
388
404
  Add the ability to add hubspot integration from the backoffice.
389
405
 
390
406
  Following changes have also been made:
391
-
392
407
  - Moved `Admin > Enabled Features` to `Admin > General > Enabled Features`
393
408
  - Created `Admin > Integrations`
394
409
  - Moved `Admin > General > Scheduling > Office 365 Connect` to `Admin > Integrations > Connections`
@@ -3,13 +3,13 @@ import { GraphQLClient } from "graphql-request";
3
3
  import lzString from "lz-string";
4
4
  export function createGraphQLClient(url) {
5
5
  return new GraphQLClient(url, {
6
+ excludeOperationName: true,
6
7
  fetch: fetch,
7
8
  headers: {
8
9
  // https://github.com/remix-run/remix/issues/4414
9
10
  Connection: "keep-alive",
10
11
  },
11
12
  method: "POST",
12
- excludeOperationName: true,
13
13
  });
14
14
  }
15
15
  const clientMap = new Map();
@@ -41,8 +41,8 @@ export function getGQLOperationName(operationDefinition) {
41
41
  export function createStudioSearchParam({ document, headers, variables, }) {
42
42
  return `?explorerURLState=${lzString.compressToEncodedURIComponent(JSON.stringify({
43
43
  document: document.trim(),
44
- variables: variables ? JSON.stringify(variables, null, 2) : undefined,
45
44
  headers: JSON.stringify(headers),
45
+ variables: variables ? JSON.stringify(variables, null, 2) : undefined,
46
46
  }))}`;
47
47
  }
48
48
  //# sourceMappingURL=get-api-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-api-client.js","sourceRoot":"","sources":["../src/get-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAgC,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE;QAC5B,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE;YACP,iDAAiD;YACjD,UAAU,EAAE,YAAY;SACzB;QACD,MAAM,EAAE,MAAM;QACd,oBAAoB,EAAE,IAAI;KAC3B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,GAAG,EAAyB,CAAC;AACnD,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC3C,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAE9B,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAsB;IAC9D,IAAI,CAAC;QACH,MAAM,mBAAmB,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,CACnD,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC,oBAAoB,CACvB,CAAC;QAEzC,IAAI,CAAC,mBAAmB;YAAE,OAAO,IAAI,CAAC;QAEtC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAA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tE,CAAC,CACH,EAAE,CAAC;AACN,CAAC"}
@@ -2,12 +2,6 @@ import { ClientError } from "graphql-request";
2
2
  import { z } from "zod";
3
3
  import { GraphQLErrorCode } from "./graphql-error-codes.js";
4
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
5
  exception: z.ZodObject<{
12
6
  message: z.ZodString;
13
7
  }, "strip", z.ZodTypeAny, {
@@ -15,17 +9,30 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
15
9
  }, {
16
10
  message: string;
17
11
  }>;
12
+ /**
13
+ * A `400` response code indicates a malformed request.
14
+ *
15
+ * The request should not be retried without changes.
16
+ */
17
+ http: z.ZodLiteral<400>;
18
18
  }, "strip", z.ZodTypeAny, {
19
- http: 400;
20
19
  exception: {
21
20
  message: string;
22
21
  };
23
- }, {
24
22
  http: 400;
23
+ }, {
25
24
  exception: {
26
25
  message: string;
27
26
  };
27
+ http: 400;
28
28
  }>, z.ZodObject<{
29
+ exception: z.ZodObject<{
30
+ message: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ message: string;
33
+ }, {
34
+ message: string;
35
+ }>;
29
36
  /**
30
37
  * A `401` response code indicates an unauthorized request.
31
38
  *
@@ -34,30 +41,17 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
34
41
  * The request should not be retried with the same `Authorization` header value.
35
42
  */
36
43
  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
44
  }, "strip", z.ZodTypeAny, {
45
- http: 401;
46
45
  exception: {
47
46
  message: string;
48
47
  };
49
- }, {
50
48
  http: 401;
49
+ }, {
51
50
  exception: {
52
51
  message: string;
53
52
  };
53
+ http: 401;
54
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
55
  exception: z.ZodObject<{
62
56
  message: z.ZodString;
63
57
  }, "strip", z.ZodTypeAny, {
@@ -65,23 +59,23 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
65
59
  }, {
66
60
  message: string;
67
61
  }>;
62
+ /**
63
+ * A `403` response code indicates a forbidden request.
64
+ *
65
+ * The provided `Authorization` header value is valid but the request is prohibited due to other permission restrictions (e.g., missing scopes or organizational settings).
66
+ */
67
+ http: z.ZodLiteral<403>;
68
68
  }, "strip", z.ZodTypeAny, {
69
- http: 403;
70
69
  exception: {
71
70
  message: string;
72
71
  };
73
- }, {
74
72
  http: 403;
73
+ }, {
75
74
  exception: {
76
75
  message: string;
77
76
  };
77
+ http: 403;
78
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
79
  exception: z.ZodObject<{
86
80
  message: z.ZodString;
87
81
  }, "strip", z.ZodTypeAny, {
@@ -89,23 +83,23 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
89
83
  }, {
90
84
  message: string;
91
85
  }>;
86
+ /**
87
+ * A `404` response code indicates a resource that cannot be found.
88
+ *
89
+ * 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.
90
+ */
91
+ http: z.ZodLiteral<404>;
92
92
  }, "strip", z.ZodTypeAny, {
93
- http: 404;
94
93
  exception: {
95
94
  message: string;
96
95
  };
97
- }, {
98
96
  http: 404;
97
+ }, {
99
98
  exception: {
100
99
  message: string;
101
100
  };
101
+ http: 404;
102
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
103
  exception: z.ZodObject<{
110
104
  message: z.ZodString;
111
105
  }, "strip", z.ZodTypeAny, {
@@ -113,23 +107,23 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
113
107
  }, {
114
108
  message: string;
115
109
  }>;
110
+ /**
111
+ * A `405` response code indicates that the HTTP method being used is not supported for the target URL.
112
+ *
113
+ * The request should not be retried without changes.
114
+ */
115
+ http: z.ZodLiteral<405>;
116
116
  }, "strip", z.ZodTypeAny, {
117
- http: 405;
118
117
  exception: {
119
118
  message: string;
120
119
  };
121
- }, {
122
120
  http: 405;
121
+ }, {
123
122
  exception: {
124
123
  message: string;
125
124
  };
125
+ http: 405;
126
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
127
  exception: z.ZodObject<{
134
128
  message: z.ZodString;
135
129
  }, "strip", z.ZodTypeAny, {
@@ -137,25 +131,24 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
137
131
  }, {
138
132
  message: string;
139
133
  }>;
134
+ /**
135
+ * 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.
136
+ *
137
+ * The request can be retried without changes but will most likely result in another error response code.
138
+ */
139
+ http: z.ZodLiteral<409>;
140
140
  }, "strip", z.ZodTypeAny, {
141
- http: 409;
142
141
  exception: {
143
142
  message: string;
144
143
  };
145
- }, {
146
144
  http: 409;
145
+ }, {
147
146
  exception: {
148
147
  message: string;
149
148
  };
149
+ http: 409;
150
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
151
  code: z.ZodNativeEnum<typeof GraphQLErrorCode>;
158
- type: z.ZodLiteral<"UnprocessableEntity">;
159
152
  exception: z.ZodObject<{
160
153
  message: z.ZodString;
161
154
  }, "strip", z.ZodTypeAny, {
@@ -163,23 +156,28 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
163
156
  }, {
164
157
  message: string;
165
158
  }>;
159
+ /**
160
+ * A `422` response code indicates a failed business validation.
161
+ *
162
+ * 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.
163
+ */
164
+ http: z.ZodLiteral<422>;
165
+ type: z.ZodLiteral<"UnprocessableEntity">;
166
166
  }, "strip", z.ZodTypeAny, {
167
167
  type: "UnprocessableEntity";
168
168
  code: GraphQLErrorCode;
169
- http: 422;
170
169
  exception: {
171
170
  message: string;
172
171
  };
172
+ http: 422;
173
173
  }, {
174
174
  type: "UnprocessableEntity";
175
175
  code: GraphQLErrorCode;
176
- http: 422;
177
176
  exception: {
178
177
  message: string;
179
178
  };
179
+ http: 422;
180
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
181
  exception: z.ZodObject<{
184
182
  message: z.ZodString;
185
183
  }, "strip", z.ZodTypeAny, {
@@ -187,16 +185,18 @@ declare const ExtensionSchema: z.ZodUnion<[z.ZodObject<{
187
185
  }, {
188
186
  message: string;
189
187
  }>;
188
+ /** 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). */
189
+ http: z.ZodLiteral<429>;
190
190
  }, "strip", z.ZodTypeAny, {
191
- http: 429;
192
191
  exception: {
193
192
  message: string;
194
193
  };
195
- }, {
196
194
  http: 429;
195
+ }, {
197
196
  exception: {
198
197
  message: string;
199
198
  };
199
+ http: 429;
200
200
  }>]>;
201
201
  type Extension = z.infer<typeof ExtensionSchema>;
202
202
  type HttpCode = Extension["http"];
@@ -211,15 +211,15 @@ export interface GQLError {
211
211
  errorMap: ErrorMap;
212
212
  }
213
213
  export declare function handleGQLError(error: unknown): GQLError | {
214
- readonly type: "GQL_INVALID";
215
- readonly subtype: "ZOD_VALIDATION_FAILED";
216
- readonly error: ClientError;
217
214
  readonly err: unknown;
215
+ readonly error: ClientError;
216
+ readonly subtype: "ZOD_VALIDATION_FAILED";
217
+ readonly type: "GQL_INVALID";
218
218
  } | {
219
- readonly type: "UNKNOWN";
220
219
  readonly error: unknown;
221
- readonly subtype?: undefined;
220
+ readonly type: "UNKNOWN";
222
221
  readonly err?: undefined;
222
+ readonly subtype?: undefined;
223
223
  };
224
224
  export {};
225
225
  //# 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;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,K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AAE,CAAC,EAAE;CAAE,CAAC;AAE5E,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;;;;;;EA+B5C"}
@@ -3,15 +3,16 @@ import { z } from "zod";
3
3
  import { GraphQLErrorCode } from "./graphql-error-codes.js";
4
4
  const ExtensionSchema = z.union([
5
5
  z.object({
6
+ exception: z.object({ message: z.string() }),
6
7
  /**
7
8
  * A `400` response code indicates a malformed request.
8
9
  *
9
10
  * The request should not be retried without changes.
10
11
  */
11
12
  http: z.literal(400),
12
- exception: z.object({ message: z.string() }),
13
13
  }),
14
14
  z.object({
15
+ exception: z.object({ message: z.string() }),
15
16
  /**
16
17
  * A `401` response code indicates an unauthorized request.
17
18
  *
@@ -20,63 +21,62 @@ const ExtensionSchema = z.union([
20
21
  * The request should not be retried with the same `Authorization` header value.
21
22
  */
22
23
  http: z.literal(401),
23
- exception: z.object({ message: z.string() }),
24
24
  }),
25
25
  z.object({
26
+ exception: z.object({ message: z.string() }),
26
27
  /**
27
28
  * A `403` response code indicates a forbidden request.
28
29
  *
29
30
  * The provided `Authorization` header value is valid but the request is prohibited due to other permission restrictions (e.g., missing scopes or organizational settings).
30
31
  */
31
32
  http: z.literal(403),
32
- exception: z.object({ message: z.string() }),
33
33
  }),
34
34
  z.object({
35
+ exception: z.object({ message: z.string() }),
35
36
  /**
36
37
  * A `404` response code indicates a resource that cannot be found.
37
38
  *
38
39
  * 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.
39
40
  */
40
41
  http: z.literal(404),
41
- exception: z.object({ message: z.string() }),
42
42
  }),
43
43
  z.object({
44
+ exception: z.object({ message: z.string() }),
44
45
  /**
45
46
  * A `405` response code indicates that the HTTP method being used is not supported for the target URL.
46
47
  *
47
48
  * The request should not be retried without changes.
48
49
  */
49
50
  http: z.literal(405),
50
- exception: z.object({ message: z.string() }),
51
51
  }),
52
52
  z.object({
53
+ exception: z.object({ message: z.string() }),
53
54
  /**
54
55
  * 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.
55
56
  *
56
57
  * The request can be retried without changes but will most likely result in another error response code.
57
58
  */
58
59
  http: z.literal(409),
59
- exception: z.object({ message: z.string() }),
60
60
  }),
61
61
  z.object({
62
+ code: z.nativeEnum(GraphQLErrorCode),
63
+ exception: z.object({ message: z.string() }),
62
64
  /**
63
65
  * A `422` response code indicates a failed business validation.
64
66
  *
65
67
  * 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.
66
68
  */
67
69
  http: z.literal(422),
68
- code: z.nativeEnum(GraphQLErrorCode),
69
70
  type: z.literal("UnprocessableEntity"),
70
- exception: z.object({ message: z.string() }),
71
71
  // type: "UnprocessableEntity",
72
72
  // exception: {
73
73
  // message: "No employees available on the chosen time slot.",
74
74
  // },
75
75
  }),
76
76
  z.object({
77
+ exception: z.object({ message: z.string() }),
77
78
  /** 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). */
78
79
  http: z.literal(429),
79
- exception: z.object({ message: z.string() }),
80
80
  }),
81
81
  ]);
82
82
  export function handleGQLError(error) {
@@ -96,13 +96,13 @@ export function handleGQLError(error) {
96
96
  }
97
97
  return acc;
98
98
  }, map) ?? map;
99
- const gqlError = { type: "GQL", error, errorMap };
99
+ const gqlError = { error, errorMap, type: "GQL" };
100
100
  return gqlError;
101
101
  }
102
102
  catch (err) {
103
- return { type: "GQL_INVALID", subtype: "ZOD_VALIDATION_FAILED", error, err };
103
+ return { err, error, subtype: "ZOD_VALIDATION_FAILED", type: "GQL_INVALID" };
104
104
  }
105
105
  }
106
- return { type: "UNKNOWN", error };
106
+ return { error, type: "UNKNOWN" };
107
107
  }
108
108
  //# sourceMappingURL=graphql-error-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-error-handler.js","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,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC;IAC9B,CAAC,CAAC,MAAM,CAAC;QACP;;;;WAIG;QACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAC7C,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP;;;;;;WAMG;QACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAC7C,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP;;;;WAIG;QACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAC7C,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP;;;;WAIG;QACH,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;KAC7C,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP;;;;WAIG;QACH,IAAI,EAAE,CAAC,CAAC,O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,GAAG,CAAC,IAAI,GAAG,CAAC;YAEjB,MAAM,QAAQ,GAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YAE5D,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,aAAa,EAAW,CAAC;QACxF,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAW,CAAC;AAC7C,CAAC"}
package/dist/graphql.d.ts CHANGED
@@ -24,6 +24,6 @@ export declare const graphql: initGraphQLTada<{
24
24
  JSONObject: object;
25
25
  };
26
26
  }>;
27
- export type { FragmentOf, ResultOf, VariablesOf, TadaDocumentNode } from "gql.tada";
27
+ export type { FragmentOf, ResultOf, TadaDocumentNode, VariablesOf } from "gql.tada";
28
28
  export { readFragment } from "gql.tada";
29
29
  //# sourceMappingURL=graphql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,OAAO;mBACH,OAAO,aAAa;aAC1B;QACP,EAAE,EAAE,MAAM,CAAC;QACX;;WAEG;QACH,YAAY,EAAE,kBAAkB,CAAC;QACjC;;;WAGG;QACH,IAAI,EAAE,UAAU,CAAC;QACjB;;sCAE8B;QAC9B,OAAO,EAAE,aAAa,CAAC;QACvB;;4DAEoD;QACpD,aAAa,EAAE,mBAAmB,CAAC;QACnC,UAAU,EAAE,MAAM,CAAC;KACpB;EACC,CAAC;AAEL,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,OAAO;mBACH,OAAO,aAAa;aAC1B;QACP,EAAE,EAAE,MAAM,CAAC;QACX;;WAEG;QACH,YAAY,EAAE,kBAAkB,CAAC;QACjC;;;WAGG;QACH,IAAI,EAAE,UAAU,CAAC;QACjB;;sCAE8B;QAC9B,OAAO,EAAE,aAAa,CAAC;QACvB;;4DAEoD;QACpD,aAAa,EAAE,mBAAmB,CAAC;QACnC,UAAU,EAAE,MAAM,CAAC;KACpB;EACC,CAAC;AAEL,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { createStudioSearchParam, getGraphQLClient, createGraphQLClient, getGQLOperationDefinition, getGQLOperationName, } from "./get-api-client.js";
2
- export { type FragmentOf, graphql, readFragment, type ResultOf, type VariablesOf, type TadaDocumentNode, } from "./graphql.js";
1
+ export { createGraphQLClient, createStudioSearchParam, getGQLOperationDefinition, getGQLOperationName, getGraphQLClient, } from "./get-api-client.js";
2
+ export { type FragmentOf, graphql, type ResultOf, readFragment, type TadaDocumentNode, type VariablesOf, } from "./graphql.js";
3
3
  export { GraphQLErrorCode } from "./graphql-error-codes.js";
4
4
  export { handleGQLError } from "./graphql-error-handler.js";
5
5
  export type * from "./schema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,UAAU,EACf,OAAO,EACP,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,mBAAmB,aAAa,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,UAAU,EACf,OAAO,EACP,KAAK,QAAQ,EACb,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,mBAAmB,aAAa,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { createStudioSearchParam, getGraphQLClient, createGraphQLClient, getGQLOperationDefinition, getGQLOperationName, } from "./get-api-client.js";
1
+ export { createGraphQLClient, createStudioSearchParam, getGQLOperationDefinition, getGQLOperationName, getGraphQLClient, } from "./get-api-client.js";
2
2
  export { graphql, readFragment, } from "./graphql.js";
3
3
  export { GraphQLErrorCode } from "./graphql-error-codes.js";
4
4
  export { handleGQLError } from "./graphql-error-handler.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,OAAO,EACP,YAAY,GAIb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,OAAO,EAEP,YAAY,GAGb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pexip-engage-public/graphql",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "homepage": "https://github.com/skedify/frontend-mono/tree/develop/packages/graphql#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/skedify/frontend-mono/issues"
@@ -37,16 +37,16 @@
37
37
  "graphql": "^16.11.0",
38
38
  "graphql-request": "^7.2.0",
39
39
  "lz-string": "^1.5.0",
40
- "zod": "^3.25.64",
41
- "@pexip-engage/utils": "0.1.43"
40
+ "zod": "^3.25.67",
41
+ "@pexip-engage/utils": "0.1.45"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@graphql-codegen/cli": "^5.0.7",
45
45
  "@graphql-codegen/typescript": "^4.1.6",
46
46
  "@graphql-inspector/cli": "^5.0.8",
47
47
  "typescript": "^5.8.3",
48
- "eslint-config-pexip-engage": "1.1.21",
49
- "@pexip-engage/tsconfig": "0.1.1"
48
+ "@pexip-engage/tsconfig": "0.1.1",
49
+ "eslint-config-pexip-engage": "1.1.23"
50
50
  },
51
51
  "volta": {
52
52
  "extends": "../../package.json"
@@ -4,13 +4,13 @@ import lzString from "lz-string";
4
4
 
5
5
  export function createGraphQLClient(url: string) {
6
6
  return new GraphQLClient(url, {
7
+ excludeOperationName: true,
7
8
  fetch: fetch,
8
9
  headers: {
9
10
  // https://github.com/remix-run/remix/issues/4414
10
11
  Connection: "keep-alive",
11
12
  },
12
13
  method: "POST",
13
- excludeOperationName: true,
14
14
  });
15
15
  }
16
16
 
@@ -61,8 +61,8 @@ export function createStudioSearchParam({
61
61
  return `?explorerURLState=${lzString.compressToEncodedURIComponent(
62
62
  JSON.stringify({
63
63
  document: document.trim(),
64
- variables: variables ? JSON.stringify(variables, null, 2) : undefined,
65
64
  headers: JSON.stringify(headers),
65
+ variables: variables ? JSON.stringify(variables, null, 2) : undefined,
66
66
  }),
67
67
  )}`;
68
68
  }
@@ -5,15 +5,16 @@ import { GraphQLErrorCode } from "./graphql-error-codes.js";
5
5
 
6
6
  const ExtensionSchema = z.union([
7
7
  z.object({
8
+ exception: z.object({ message: z.string() }),
8
9
  /**
9
10
  * A `400` response code indicates a malformed request.
10
11
  *
11
12
  * The request should not be retried without changes.
12
13
  */
13
14
  http: z.literal(400),
14
- exception: z.object({ message: z.string() }),
15
15
  }),
16
16
  z.object({
17
+ exception: z.object({ message: z.string() }),
17
18
  /**
18
19
  * A `401` response code indicates an unauthorized request.
19
20
  *
@@ -22,63 +23,62 @@ const ExtensionSchema = z.union([
22
23
  * The request should not be retried with the same `Authorization` header value.
23
24
  */
24
25
  http: z.literal(401),
25
- exception: z.object({ message: z.string() }),
26
26
  }),
27
27
  z.object({
28
+ exception: z.object({ message: z.string() }),
28
29
  /**
29
30
  * A `403` response code indicates a forbidden request.
30
31
  *
31
32
  * The provided `Authorization` header value is valid but the request is prohibited due to other permission restrictions (e.g., missing scopes or organizational settings).
32
33
  */
33
34
  http: z.literal(403),
34
- exception: z.object({ message: z.string() }),
35
35
  }),
36
36
  z.object({
37
+ exception: z.object({ message: z.string() }),
37
38
  /**
38
39
  * A `404` response code indicates a resource that cannot be found.
39
40
  *
40
41
  * 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.
41
42
  */
42
43
  http: z.literal(404),
43
- exception: z.object({ message: z.string() }),
44
44
  }),
45
45
  z.object({
46
+ exception: z.object({ message: z.string() }),
46
47
  /**
47
48
  * A `405` response code indicates that the HTTP method being used is not supported for the target URL.
48
49
  *
49
50
  * The request should not be retried without changes.
50
51
  */
51
52
  http: z.literal(405),
52
- exception: z.object({ message: z.string() }),
53
53
  }),
54
54
  z.object({
55
+ exception: z.object({ message: z.string() }),
55
56
  /**
56
57
  * 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.
57
58
  *
58
59
  * The request can be retried without changes but will most likely result in another error response code.
59
60
  */
60
61
  http: z.literal(409),
61
- exception: z.object({ message: z.string() }),
62
62
  }),
63
63
  z.object({
64
+ code: z.nativeEnum(GraphQLErrorCode),
65
+ exception: z.object({ message: z.string() }),
64
66
  /**
65
67
  * A `422` response code indicates a failed business validation.
66
68
  *
67
69
  * 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.
68
70
  */
69
71
  http: z.literal(422),
70
- code: z.nativeEnum(GraphQLErrorCode),
71
72
  type: z.literal("UnprocessableEntity"),
72
- exception: z.object({ message: z.string() }),
73
73
  // type: "UnprocessableEntity",
74
74
  // exception: {
75
75
  // message: "No employees available on the chosen time slot.",
76
76
  // },
77
77
  }),
78
78
  z.object({
79
+ exception: z.object({ message: z.string() }),
79
80
  /** 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). */
80
81
  http: z.literal(429),
81
- exception: z.object({ message: z.string() }),
82
82
  }),
83
83
  ]);
84
84
 
@@ -114,13 +114,13 @@ export function handleGQLError(error: unknown) {
114
114
  return acc;
115
115
  }, map) ?? map;
116
116
 
117
- const gqlError: GQLError = { type: "GQL", error, errorMap };
117
+ const gqlError: GQLError = { error, errorMap, type: "GQL" };
118
118
 
119
119
  return gqlError;
120
120
  } catch (err) {
121
- return { type: "GQL_INVALID", subtype: "ZOD_VALIDATION_FAILED", error, err } as const;
121
+ return { err, error, subtype: "ZOD_VALIDATION_FAILED", type: "GQL_INVALID" } as const;
122
122
  }
123
123
  }
124
124
 
125
- return { type: "UNKNOWN", error } as const;
125
+ return { error, type: "UNKNOWN" } as const;
126
126
  }
package/src/graphql.ts CHANGED
@@ -27,5 +27,5 @@ export const graphql = initGraphQLTada<{
27
27
  };
28
28
  }>();
29
29
 
30
- export type { FragmentOf, ResultOf, VariablesOf, TadaDocumentNode } from "gql.tada";
30
+ export type { FragmentOf, ResultOf, TadaDocumentNode, VariablesOf } from "gql.tada";
31
31
  export { readFragment } from "gql.tada";
package/src/index.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export {
2
- createStudioSearchParam,
3
- getGraphQLClient,
4
2
  createGraphQLClient,
3
+ createStudioSearchParam,
5
4
  getGQLOperationDefinition,
6
5
  getGQLOperationName,
6
+ getGraphQLClient,
7
7
  } from "./get-api-client.js";
8
8
  export {
9
9
  type FragmentOf,
10
10
  graphql,
11
- readFragment,
12
11
  type ResultOf,
13
- type VariablesOf,
12
+ readFragment,
14
13
  type TadaDocumentNode,
14
+ type VariablesOf,
15
15
  } from "./graphql.js";
16
16
  export { GraphQLErrorCode } from "./graphql-error-codes.js";
17
17
  export { handleGQLError } from "./graphql-error-handler.js";