@equinor/fusion-framework-module-http 6.3.5 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,8 +17,28 @@ export declare const requestMethodCasing: () => z.ZodType<string>;
17
17
  *
18
18
  * @link https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
19
19
  */
20
- export declare const requestMethodVerb: () => z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD", "CONNECT", "TRACE"]>;
21
- export declare const requestMethod: () => z.ZodPipeline<z.ZodType<string, z.ZodTypeDef, string>, z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD", "CONNECT", "TRACE"]>>;
20
+ export declare const requestMethodVerb: () => z.ZodEnum<{
21
+ GET: "GET";
22
+ POST: "POST";
23
+ PUT: "PUT";
24
+ DELETE: "DELETE";
25
+ PATCH: "PATCH";
26
+ OPTIONS: "OPTIONS";
27
+ HEAD: "HEAD";
28
+ CONNECT: "CONNECT";
29
+ TRACE: "TRACE";
30
+ }>;
31
+ export declare const requestMethod: () => z.ZodPipe<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodEnum<{
32
+ GET: "GET";
33
+ POST: "POST";
34
+ PUT: "PUT";
35
+ DELETE: "DELETE";
36
+ PATCH: "PATCH";
37
+ OPTIONS: "OPTIONS";
38
+ HEAD: "HEAD";
39
+ CONNECT: "CONNECT";
40
+ TRACE: "TRACE";
41
+ }>>;
22
42
  /**
23
43
  * Schema for validating the initialization options of a request.
24
44
  *
@@ -30,66 +50,66 @@ export declare const requestInitSchema: z.ZodObject<{
30
50
  attributionReporting: z.ZodOptional<z.ZodObject<{
31
51
  eventSourceEligible: z.ZodOptional<z.ZodBoolean>;
32
52
  triggerEligible: z.ZodOptional<z.ZodBoolean>;
33
- }, "strip", z.ZodTypeAny, {
34
- eventSourceEligible?: boolean | undefined;
35
- triggerEligible?: boolean | undefined;
36
- }, {
37
- eventSourceEligible?: boolean | undefined;
38
- triggerEligible?: boolean | undefined;
39
- }>>;
40
- body: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<Blob, z.ZodTypeDef, Blob>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<FormData, z.ZodTypeDef, FormData>, z.ZodType<URLSearchParams, z.ZodTypeDef, URLSearchParams>, z.ZodType<ReadableStream<unknown>, z.ZodTypeDef, ReadableStream<unknown>>]>>;
53
+ }, z.core.$strip>>;
54
+ body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Blob, Blob>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<FormData, FormData>, z.ZodCustom<URLSearchParams, URLSearchParams>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>]>>;
41
55
  browsingTopics: z.ZodOptional<z.ZodBoolean>;
42
- cache: z.ZodOptional<z.ZodEnum<["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"]>>;
43
- credentials: z.ZodOptional<z.ZodEnum<["omit", "same-origin", "include"]>>;
44
- headers: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, z.ZodType<Headers, z.ZodTypeDef, Headers>]>;
56
+ cache: z.ZodOptional<z.ZodEnum<{
57
+ default: "default";
58
+ "no-cache": "no-cache";
59
+ "force-cache": "force-cache";
60
+ "no-store": "no-store";
61
+ "only-if-cached": "only-if-cached";
62
+ reload: "reload";
63
+ }>>;
64
+ credentials: z.ZodOptional<z.ZodEnum<{
65
+ include: "include";
66
+ omit: "omit";
67
+ "same-origin": "same-origin";
68
+ }>>;
69
+ headers: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, z.ZodCustom<Headers, Headers>]>;
45
70
  integrity: z.ZodOptional<z.ZodString>;
46
71
  keepalive: z.ZodOptional<z.ZodBoolean>;
47
- method: z.ZodOptional<z.ZodPipeline<z.ZodType<string, z.ZodTypeDef, string>, z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD", "CONNECT", "TRACE"]>>>;
48
- mode: z.ZodOptional<z.ZodEnum<["same-origin", "cors", "no-cors", "navigate", "websocket"]>>;
49
- priority: z.ZodOptional<z.ZodEnum<["low", "high", "auto"]>>;
50
- redirect: z.ZodOptional<z.ZodEnum<["follow", "error", "manual"]>>;
72
+ method: z.ZodOptional<z.ZodPipe<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodEnum<{
73
+ GET: "GET";
74
+ POST: "POST";
75
+ PUT: "PUT";
76
+ DELETE: "DELETE";
77
+ PATCH: "PATCH";
78
+ OPTIONS: "OPTIONS";
79
+ HEAD: "HEAD";
80
+ CONNECT: "CONNECT";
81
+ TRACE: "TRACE";
82
+ }>>>;
83
+ mode: z.ZodOptional<z.ZodEnum<{
84
+ cors: "cors";
85
+ "same-origin": "same-origin";
86
+ navigate: "navigate";
87
+ "no-cors": "no-cors";
88
+ websocket: "websocket";
89
+ }>>;
90
+ priority: z.ZodOptional<z.ZodEnum<{
91
+ auto: "auto";
92
+ high: "high";
93
+ low: "low";
94
+ }>>;
95
+ redirect: z.ZodOptional<z.ZodEnum<{
96
+ error: "error";
97
+ follow: "follow";
98
+ manual: "manual";
99
+ }>>;
51
100
  referrer: z.ZodOptional<z.ZodString>;
52
- referrerPolicy: z.ZodOptional<z.ZodEnum<["no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"]>>;
53
- signal: z.ZodOptional<z.ZodType<AbortSignal, z.ZodTypeDef, AbortSignal>>;
54
- }, "strip", z.ZodTypeAny, {
55
- body?: string | Blob | ArrayBuffer | FormData | URLSearchParams | ReadableStream<unknown> | undefined;
56
- cache?: "default" | "no-cache" | "force-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
57
- credentials?: "include" | "omit" | "same-origin" | undefined;
58
- headers?: Headers | Record<string, string> | undefined;
59
- integrity?: string | undefined;
60
- keepalive?: boolean | undefined;
61
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD" | "CONNECT" | "TRACE" | undefined;
62
- mode?: "cors" | "same-origin" | "navigate" | "no-cors" | "websocket" | undefined;
63
- priority?: "auto" | "high" | "low" | undefined;
64
- redirect?: "error" | "follow" | "manual" | undefined;
65
- referrer?: string | undefined;
66
- referrerPolicy?: "same-origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined;
67
- signal?: AbortSignal | undefined;
68
- attributionReporting?: {
69
- eventSourceEligible?: boolean | undefined;
70
- triggerEligible?: boolean | undefined;
71
- } | undefined;
72
- browsingTopics?: boolean | undefined;
73
- }, {
74
- body?: string | Blob | ArrayBuffer | FormData | URLSearchParams | ReadableStream<unknown> | undefined;
75
- cache?: "default" | "no-cache" | "force-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
76
- credentials?: "include" | "omit" | "same-origin" | undefined;
77
- headers?: Headers | Record<string, string> | undefined;
78
- integrity?: string | undefined;
79
- keepalive?: boolean | undefined;
80
- method?: string | undefined;
81
- mode?: "cors" | "same-origin" | "navigate" | "no-cors" | "websocket" | undefined;
82
- priority?: "auto" | "high" | "low" | undefined;
83
- redirect?: "error" | "follow" | "manual" | undefined;
84
- referrer?: string | undefined;
85
- referrerPolicy?: "same-origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined;
86
- signal?: AbortSignal | undefined;
87
- attributionReporting?: {
88
- eventSourceEligible?: boolean | undefined;
89
- triggerEligible?: boolean | undefined;
90
- } | undefined;
91
- browsingTopics?: boolean | undefined;
92
- }>;
101
+ referrerPolicy: z.ZodOptional<z.ZodEnum<{
102
+ "same-origin": "same-origin";
103
+ "no-referrer": "no-referrer";
104
+ "no-referrer-when-downgrade": "no-referrer-when-downgrade";
105
+ origin: "origin";
106
+ "origin-when-cross-origin": "origin-when-cross-origin";
107
+ "strict-origin": "strict-origin";
108
+ "strict-origin-when-cross-origin": "strict-origin-when-cross-origin";
109
+ "unsafe-url": "unsafe-url";
110
+ }>>;
111
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
112
+ }, z.core.$strip>;
93
113
  /**
94
114
  * Schema for validating fetch request configurations.
95
115
  *
@@ -101,70 +121,65 @@ export declare const fetchRequestSchema: z.ZodObject<{
101
121
  attributionReporting: z.ZodOptional<z.ZodObject<{
102
122
  eventSourceEligible: z.ZodOptional<z.ZodBoolean>;
103
123
  triggerEligible: z.ZodOptional<z.ZodBoolean>;
104
- }, "strip", z.ZodTypeAny, {
105
- eventSourceEligible?: boolean | undefined;
106
- triggerEligible?: boolean | undefined;
107
- }, {
108
- eventSourceEligible?: boolean | undefined;
109
- triggerEligible?: boolean | undefined;
110
- }>>;
111
- body: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodType<Blob, z.ZodTypeDef, Blob>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<FormData, z.ZodTypeDef, FormData>, z.ZodType<URLSearchParams, z.ZodTypeDef, URLSearchParams>, z.ZodType<ReadableStream<unknown>, z.ZodTypeDef, ReadableStream<unknown>>]>>;
124
+ }, z.core.$strip>>;
125
+ body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Blob, Blob>, z.ZodCustom<ArrayBuffer, ArrayBuffer>, z.ZodCustom<FormData, FormData>, z.ZodCustom<URLSearchParams, URLSearchParams>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>]>>;
112
126
  browsingTopics: z.ZodOptional<z.ZodBoolean>;
113
- cache: z.ZodOptional<z.ZodEnum<["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"]>>;
114
- credentials: z.ZodOptional<z.ZodEnum<["omit", "same-origin", "include"]>>;
115
- headers: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, z.ZodType<Headers, z.ZodTypeDef, Headers>]>;
127
+ cache: z.ZodOptional<z.ZodEnum<{
128
+ default: "default";
129
+ "no-cache": "no-cache";
130
+ "force-cache": "force-cache";
131
+ "no-store": "no-store";
132
+ "only-if-cached": "only-if-cached";
133
+ reload: "reload";
134
+ }>>;
135
+ credentials: z.ZodOptional<z.ZodEnum<{
136
+ include: "include";
137
+ omit: "omit";
138
+ "same-origin": "same-origin";
139
+ }>>;
140
+ headers: z.ZodUnion<[z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>, z.ZodCustom<Headers, Headers>]>;
116
141
  integrity: z.ZodOptional<z.ZodString>;
117
142
  keepalive: z.ZodOptional<z.ZodBoolean>;
118
- method: z.ZodOptional<z.ZodPipeline<z.ZodType<string, z.ZodTypeDef, string>, z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD", "CONNECT", "TRACE"]>>>;
119
- mode: z.ZodOptional<z.ZodEnum<["same-origin", "cors", "no-cors", "navigate", "websocket"]>>;
120
- priority: z.ZodOptional<z.ZodEnum<["low", "high", "auto"]>>;
121
- redirect: z.ZodOptional<z.ZodEnum<["follow", "error", "manual"]>>;
143
+ method: z.ZodOptional<z.ZodPipe<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>, z.ZodEnum<{
144
+ GET: "GET";
145
+ POST: "POST";
146
+ PUT: "PUT";
147
+ DELETE: "DELETE";
148
+ PATCH: "PATCH";
149
+ OPTIONS: "OPTIONS";
150
+ HEAD: "HEAD";
151
+ CONNECT: "CONNECT";
152
+ TRACE: "TRACE";
153
+ }>>>;
154
+ mode: z.ZodOptional<z.ZodEnum<{
155
+ cors: "cors";
156
+ "same-origin": "same-origin";
157
+ navigate: "navigate";
158
+ "no-cors": "no-cors";
159
+ websocket: "websocket";
160
+ }>>;
161
+ priority: z.ZodOptional<z.ZodEnum<{
162
+ auto: "auto";
163
+ high: "high";
164
+ low: "low";
165
+ }>>;
166
+ redirect: z.ZodOptional<z.ZodEnum<{
167
+ error: "error";
168
+ follow: "follow";
169
+ manual: "manual";
170
+ }>>;
122
171
  referrer: z.ZodOptional<z.ZodString>;
123
- referrerPolicy: z.ZodOptional<z.ZodEnum<["no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "same-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"]>>;
124
- signal: z.ZodOptional<z.ZodType<AbortSignal, z.ZodTypeDef, AbortSignal>>;
125
- } & {
172
+ referrerPolicy: z.ZodOptional<z.ZodEnum<{
173
+ "same-origin": "same-origin";
174
+ "no-referrer": "no-referrer";
175
+ "no-referrer-when-downgrade": "no-referrer-when-downgrade";
176
+ origin: "origin";
177
+ "origin-when-cross-origin": "origin-when-cross-origin";
178
+ "strict-origin": "strict-origin";
179
+ "strict-origin-when-cross-origin": "strict-origin-when-cross-origin";
180
+ "unsafe-url": "unsafe-url";
181
+ }>>;
182
+ signal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
126
183
  uri: z.ZodString;
127
184
  path: z.ZodOptional<z.ZodString>;
128
- }, "strip", z.ZodTypeAny, {
129
- uri: string;
130
- body?: string | Blob | ArrayBuffer | FormData | URLSearchParams | ReadableStream<unknown> | undefined;
131
- path?: string | undefined;
132
- cache?: "default" | "no-cache" | "force-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
133
- credentials?: "include" | "omit" | "same-origin" | undefined;
134
- headers?: Headers | Record<string, string> | undefined;
135
- integrity?: string | undefined;
136
- keepalive?: boolean | undefined;
137
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS" | "HEAD" | "CONNECT" | "TRACE" | undefined;
138
- mode?: "cors" | "same-origin" | "navigate" | "no-cors" | "websocket" | undefined;
139
- priority?: "auto" | "high" | "low" | undefined;
140
- redirect?: "error" | "follow" | "manual" | undefined;
141
- referrer?: string | undefined;
142
- referrerPolicy?: "same-origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined;
143
- signal?: AbortSignal | undefined;
144
- attributionReporting?: {
145
- eventSourceEligible?: boolean | undefined;
146
- triggerEligible?: boolean | undefined;
147
- } | undefined;
148
- browsingTopics?: boolean | undefined;
149
- }, {
150
- uri: string;
151
- body?: string | Blob | ArrayBuffer | FormData | URLSearchParams | ReadableStream<unknown> | undefined;
152
- path?: string | undefined;
153
- cache?: "default" | "no-cache" | "force-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
154
- credentials?: "include" | "omit" | "same-origin" | undefined;
155
- headers?: Headers | Record<string, string> | undefined;
156
- integrity?: string | undefined;
157
- keepalive?: boolean | undefined;
158
- method?: string | undefined;
159
- mode?: "cors" | "same-origin" | "navigate" | "no-cors" | "websocket" | undefined;
160
- priority?: "auto" | "high" | "low" | undefined;
161
- redirect?: "error" | "follow" | "manual" | undefined;
162
- referrer?: string | undefined;
163
- referrerPolicy?: "same-origin" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | undefined;
164
- signal?: AbortSignal | undefined;
165
- attributionReporting?: {
166
- eventSourceEligible?: boolean | undefined;
167
- triggerEligible?: boolean | undefined;
168
- } | undefined;
169
- browsingTopics?: boolean | undefined;
170
- }>;
185
+ }, z.core.$strip>;
@@ -1 +1 @@
1
- export declare const version = "6.3.5";
1
+ export declare const version = "7.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-module-http",
3
- "version": "6.3.5",
3
+ "version": "7.0.0",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -58,9 +58,9 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "rxjs": "^7.8.1",
61
- "zod": "^3.25.76",
61
+ "zod": "^4.1.8",
62
62
  "@equinor/fusion-framework-module": "^5.0.1",
63
- "@equinor/fusion-framework-module-msal": "^4.0.9"
63
+ "@equinor/fusion-framework-module-msal": "^5.0.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "typescript": "^5.8.2",
@@ -15,7 +15,7 @@ export const capitalizeRequestMethodOperator =
15
15
  request.method = success ? data : request.method?.toUpperCase();
16
16
 
17
17
  if (error && !options?.silent) {
18
- for (const e of error.errors) {
18
+ for (const e of error.issues) {
19
19
  console.warn(e.message);
20
20
  }
21
21
  }
@@ -6,19 +6,13 @@ import { z } from 'zod';
6
6
  * @link https://www.rfc-editor.org/rfc/rfc7231#section-4.1
7
7
  */
8
8
  export const requestMethodCasing = (): z.ZodType<string> => {
9
- return z.custom<string>(
10
- (value?: string) => value === value?.toUpperCase(),
11
- (value: string) => ({
12
- code: z.ZodIssueCode.custom,
13
- validation: 'uppercase',
14
- path: ['method'],
15
- message: [
16
- `Provided HTTP method '${value}' must be in uppercase.`,
17
- 'See RFC 7231 Section 4.1 for more information',
18
- 'https://www.rfc-editor.org/rfc/rfc7231#section-4.1',
19
- ].join(' '),
20
- }),
21
- );
9
+ return z.string().refine((value) => value === value?.toUpperCase(), {
10
+ message: [
11
+ 'Provided HTTP method must be in uppercase.',
12
+ 'See RFC 7231 Section 4.1 for more information',
13
+ 'https://www.rfc-editor.org/rfc/rfc7231#section-4.1',
14
+ ].join(' '),
15
+ });
22
16
  };
23
17
 
24
18
  /**
@@ -35,17 +29,8 @@ export const requestMethodCasing = (): z.ZodType<string> => {
35
29
  */
36
30
  export const requestMethodVerb = () => {
37
31
  return z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS', 'HEAD', 'CONNECT', 'TRACE'], {
38
- errorMap: (error) => {
39
- const { received, options } = error as z.ZodInvalidEnumValueIssue;
40
- return {
41
- message: [
42
- 'Invalid request method.',
43
- `Expected '${options.join(' | ')}', but received '${received}'.`,
44
- 'See RFC 2615 Section 9 for more information',
45
- 'https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html',
46
- ].join(' '),
47
- };
48
- },
32
+ message:
33
+ 'Invalid request method. Expected one of: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, CONNECT, TRACE. See RFC 2615 Section 9 for more information: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html',
49
34
  });
50
35
  };
51
36
 
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '6.3.5';
2
+ export const version = '7.0.0';