@defjs/core 0.0.0-test-0004 → 0.0.0-test-0005

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/dist/index.d.ts CHANGED
@@ -111,6 +111,7 @@ export type RequestOptions<Output = unknown, Input extends Field<any> | Record<P
111
111
  responseType?: HttpResponseType;
112
112
  context?: HttpContext;
113
113
  observe?: "body" | "response";
114
+ withCredentials?: boolean;
114
115
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
115
116
  transformRequest?: TransformRequestFn;
116
117
  transformResponse?: TransformResponseFn<Output>;
@@ -129,6 +130,7 @@ export declare function defineRequest<Output = unknown, Input extends Field<any>
129
130
  responseType?: "json";
130
131
  observe?: "body";
131
132
  context?: HttpContext;
133
+ withCredentials?: boolean;
132
134
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
133
135
  transformRequest?: TransformRequestFn;
134
136
  transformResponse?: TransformResponseFn<Output>;
@@ -141,6 +143,7 @@ export declare function defineRequest<Input extends Field<any> | Record<Property
141
143
  responseType: "text";
142
144
  observe?: "body";
143
145
  context?: HttpContext;
146
+ withCredentials?: boolean;
144
147
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
145
148
  transformRequest?: TransformRequestFn;
146
149
  transformResponse?: TransformResponseFn;
@@ -153,6 +156,7 @@ export declare function defineRequest<Input extends Field<any> | Record<Property
153
156
  responseType: "blob";
154
157
  observe?: "body";
155
158
  context?: HttpContext;
159
+ withCredentials?: boolean;
156
160
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
157
161
  transformRequest?: TransformRequestFn;
158
162
  transformResponse?: TransformResponseFn;
@@ -165,6 +169,7 @@ export declare function defineRequest<Input extends Field<any> | Record<Property
165
169
  responseType: "arraybuffer";
166
170
  observe?: "body";
167
171
  context?: HttpContext;
172
+ withCredentials?: boolean;
168
173
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
169
174
  transformRequest?: TransformRequestFn;
170
175
  transformResponse?: TransformResponseFn;
@@ -178,6 +183,7 @@ export declare function defineRequest<Output = unknown, Input extends Field<any>
178
183
  responseType?: "json";
179
184
  observe: "response";
180
185
  context?: HttpContext;
186
+ withCredentials?: boolean;
181
187
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
182
188
  transformRequest?: TransformRequestFn;
183
189
  transformResponse?: TransformResponseFn<Output>;
@@ -190,6 +196,7 @@ export declare function defineRequest<Input extends Field<any> | Record<Property
190
196
  responseType?: "text";
191
197
  observe: "response";
192
198
  context?: HttpContext;
199
+ withCredentials?: boolean;
193
200
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
194
201
  transformRequest?: TransformRequestFn;
195
202
  transformResponse?: TransformResponseFn;
@@ -202,6 +209,7 @@ export declare function defineRequest<Input extends Field<any> | Record<Property
202
209
  responseType: "blob";
203
210
  observe: "response";
204
211
  context?: HttpContext;
212
+ withCredentials?: boolean;
205
213
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
206
214
  transformRequest?: TransformRequestFn;
207
215
  transformResponse?: TransformResponseFn;
@@ -214,6 +222,7 @@ export declare function defineRequest<Input extends Field<any> | Record<Property
214
222
  responseType?: "arraybuffer";
215
223
  observe: "response";
216
224
  context?: HttpContext;
225
+ withCredentials?: boolean;
217
226
  validators?: (ValidatorFn<RequestInputValue<Input>> | AsyncValidatorFn<RequestInputValue<Input>>)[];
218
227
  transformRequest?: TransformRequestFn;
219
228
  transformResponse?: TransformResponseFn;
package/dist/index.js CHANGED
@@ -242,11 +242,10 @@ async function fillRequestFromField(request, fieldOrFieldGroup, input) {
242
242
  const json = {};
243
243
  let body = undefined;
244
244
  for (const [propertyKey, field3] of Object.entries(fieldOrFieldGroup)) {
245
- const defaultValue = field3();
246
245
  const meta = getFieldMetadata(field3);
247
246
  for (const [type, aliasName] of meta.alias) {
248
247
  const valueKey = aliasName || propertyKey;
249
- const value = input[valueKey] || defaultValue;
248
+ const value = input[propertyKey] || field3();
250
249
  const err = await doValid([...meta.validators, ...meta.asyncValidator], value);
251
250
  if (err) {
252
251
  throw err;
@@ -332,6 +331,7 @@ async function doRequest(...args) {
332
331
  queryParams: new URLSearchParams,
333
332
  headers: new Headers,
334
333
  body: undefined,
334
+ withCredentials: requestOptions.withCredentials,
335
335
  responseType: requestOptions.responseType ?? "json",
336
336
  context: requestOptions.context || makeHttpContext(),
337
337
  observe: requestOptions.observe ?? "body",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defjs/core",
3
- "version": "0.0.0-test-0004",
3
+ "version": "0.0.0-test-0005",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "bun run ./scripts/build.ts",