@adobe/aio-commerce-lib-core 1.2.0 → 1.3.0-beta-20261028171115

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,11 @@
1
1
  # @adobe/aio-commerce-lib-core
2
2
 
3
+ ## 1.3.0-beta-20261028171115
4
+
5
+ ### Minor Changes
6
+
7
+ - [#778](https://github.com/adobe/aio-commerce-sdk/pull/778) [`9145e82`](https://github.com/adobe/aio-commerce-sdk/commit/9145e822b17b99465bfee649fae69d61c11bc0ab) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Add a `stringifyError` helper to the `error` subpath, which converts any thrown value to a readable string.
8
+
3
9
  ## 1.2.0
4
10
 
5
11
  ### Minor Changes
@@ -13,11 +13,11 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require('../rolldown-runtime-Cozy-1ZF.cjs');
16
+ const require_rolldown_runtime = require("../rolldown-runtime-CoOt0iuZ.cjs");
17
17
  let valibot = require("valibot");
18
18
  valibot = require_rolldown_runtime.__toESM(valibot, 1);
19
19
 
20
- //#region source/commerce/env.ts
20
+ // source/commerce/env.ts
21
21
  /** The list of supported Commerce environments an item can be scoped to. */
22
22
  const COMMERCE_ENVS = ["paas", "saas"];
23
23
  /** Schema for a single Commerce environment an item can be scoped to. */
@@ -31,7 +31,6 @@ const CommerceEnvSchema = valibot.picklist(COMMERCE_ENVS, `Expected one of: ${CO
31
31
  */
32
32
  const CommerceEnvArraySchema = valibot.pipe(valibot.array(CommerceEnvSchema, "Expected an array of commerce environments for the field \"env\""), valibot.nonEmpty("The \"env\" array must contain at least one commerce environment"));
33
33
 
34
- //#endregion
35
34
  exports.COMMERCE_ENVS = COMMERCE_ENVS;
36
35
  exports.CommerceEnvArraySchema = CommerceEnvArraySchema;
37
36
  exports.CommerceEnvSchema = CommerceEnvSchema;
@@ -13,14 +13,12 @@
13
13
  */
14
14
 
15
15
  import * as v from "valibot";
16
-
17
- //#region source/commerce/env.d.ts
18
16
  /** The list of supported Commerce environments an item can be scoped to. */
19
- declare const COMMERCE_ENVS: ["paas", "saas"];
17
+ export declare const COMMERCE_ENVS: ["paas", "saas"];
20
18
  /** A single Commerce environment an item can be scoped to. */
21
19
  type CommerceEnv = (typeof COMMERCE_ENVS)[number];
22
20
  /** Schema for a single Commerce environment an item can be scoped to. */
23
- declare const CommerceEnvSchema: v.PicklistSchema<["paas", "saas"], `Expected one of: ${string}`>;
21
+ export declare const CommerceEnvSchema: v.PicklistSchema<["paas", "saas"], `Expected one of: ${string}`>;
24
22
  /**
25
23
  * Schema for a non-empty array of Commerce environments, used to scope an item
26
24
  * (a configuration field, webhook, or event) to specific environments.
@@ -28,6 +26,5 @@ declare const CommerceEnvSchema: v.PicklistSchema<["paas", "saas"], `Expected on
28
26
  * Apply the optional wrapper at the call site (`v.optional(CommerceEnvArraySchema)`);
29
27
  * when omitted, the item applies to all environments.
30
28
  */
31
- declare const CommerceEnvArraySchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>;
32
- //#endregion
33
- export { COMMERCE_ENVS, type CommerceEnv, CommerceEnvArraySchema, CommerceEnvSchema };
29
+ export declare const CommerceEnvArraySchema: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["paas", "saas"], `Expected one of: ${string}`>, "Expected an array of commerce environments for the field \"env\"">, v.NonEmptyAction<("paas" | "saas")[], "The \"env\" array must contain at least one commerce environment">]>;
30
+ export type { CommerceEnv };
@@ -13,7 +13,8 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_error = require('../error-DcSWQLuA.cjs');
16
+ const require_error = require("../error-D892zgDO.cjs");
17
17
 
18
18
  exports.CommerceSdkErrorBase = require_error.CommerceSdkErrorBase;
19
- exports.CommerceSdkValidationError = require_error.CommerceSdkValidationError;
19
+ exports.CommerceSdkValidationError = require_error.CommerceSdkValidationError;
20
+ exports.stringifyError = require_error.stringifyError;
@@ -13,8 +13,6 @@
13
13
  */
14
14
 
15
15
  import { GenericIssue } from "valibot";
16
-
17
- //#region source/error/base-error.d.ts
18
16
  /** Defines the base options for {@link CommerceSdkErrorBase}. */
19
17
  type CommerceSdkErrorBaseOptions = ErrorOptions & {
20
18
  traceId?: string;
@@ -49,7 +47,7 @@ type CommerceSdkErrorOptions<T extends Record<string, unknown> = Record<string,
49
47
  * console.log(err.toJSON());
50
48
  * ```
51
49
  */
52
- declare abstract class CommerceSdkErrorBase extends Error {
50
+ export declare abstract class CommerceSdkErrorBase extends Error {
53
51
  readonly traceId?: string;
54
52
  /**
55
53
  * Constructs a new CommerceSdkErrorBase instance. This is an abstract class so you
@@ -90,8 +88,22 @@ declare abstract class CommerceSdkErrorBase extends Error {
90
88
  */
91
89
  toString(inspect?: boolean): string;
92
90
  }
93
- //#endregion
94
- //#region source/error/validation-error.d.ts
91
+ /**
92
+ * Converts any thrown value to a human-friendly string.
93
+ *
94
+ * Validation errors use their formatted `display()` output, other errors use their message, and any other value goes through `String()`.
95
+ *
96
+ * @param error - The thrown value to convert.
97
+ * @example
98
+ * ```typescript
99
+ * try {
100
+ * await doSomething();
101
+ * } catch (error) {
102
+ * console.error(stringifyError(error));
103
+ * }
104
+ * ```
105
+ */
106
+ export declare function stringifyError(error: unknown): string;
95
107
  /** Defines the base options for {@link CommerceSdkValidationError}. */
96
108
  type CommerceSdkValidationErrorOptions = CommerceSdkErrorOptions<{
97
109
  issues: GenericIssue[];
@@ -111,7 +123,7 @@ type CommerceSdkValidationErrorOptions = CommerceSdkErrorOptions<{
111
123
  * console.log(error.display());
112
124
  * ```
113
125
  */
114
- declare class CommerceSdkValidationError extends CommerceSdkErrorBase {
126
+ export declare class CommerceSdkValidationError extends CommerceSdkErrorBase {
115
127
  readonly issues: GenericIssue[];
116
128
  /**
117
129
  * Constructs a new {@link CommerceSdkValidationError} instance.
@@ -119,15 +131,11 @@ declare class CommerceSdkValidationError extends CommerceSdkErrorBase {
119
131
  * @param message - A human-friendly description of the validation error.
120
132
  * @param options - Options for the validation error, including the issues that caused the error.
121
133
  */
122
- constructor(message: string, {
123
- issues,
124
- ...options
125
- }: CommerceSdkValidationErrorOptions);
134
+ constructor(message: string, { issues, ...options }: CommerceSdkValidationErrorOptions);
126
135
  /**
127
136
  * Returns a pretty string (and colored) representation of the validation error.
128
137
  * @param withColor Whether to use color in the output.
129
138
  */
130
139
  display(withColor?: boolean): string;
131
140
  }
132
- //#endregion
133
- export { CommerceSdkErrorBase, type CommerceSdkErrorBaseOptions, type CommerceSdkErrorOptions, CommerceSdkValidationError };
141
+ export type { CommerceSdkErrorBaseOptions, CommerceSdkErrorOptions };
@@ -12,13 +12,13 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
15
+ const require_rolldown_runtime = require("./rolldown-runtime-CoOt0iuZ.cjs");
16
16
  let valibot = require("valibot");
17
17
  let util = require("util");
18
18
  util = require_rolldown_runtime.__toESM(util, 1);
19
19
  let ansis = require("ansis");
20
20
 
21
- //#region source/error/base-error.ts
21
+ // source/error/base-error.ts
22
22
  /**
23
23
  * Base class for all the errors in the AIO Commerce SDK.
24
24
  * @example
@@ -112,8 +112,7 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
112
112
  }
113
113
  };
114
114
 
115
- //#endregion
116
- //#region source/error/validation-error.ts
115
+ // source/error/validation-error.ts
117
116
  const LAST_RETURN_CHAR = "└── ";
118
117
  const RETURN_CHAR = "├── ";
119
118
  /** Maps issue kinds to their corresponding error titles for display purposes. */
@@ -183,16 +182,42 @@ var CommerceSdkValidationError = class extends CommerceSdkErrorBase {
183
182
  }
184
183
  };
185
184
 
186
- //#endregion
187
- Object.defineProperty(exports, 'CommerceSdkErrorBase', {
185
+ // source/error/stringify-error.ts
186
+ /**
187
+ * Converts any thrown value to a human-friendly string.
188
+ *
189
+ * Validation errors use their formatted `display()` output, other errors use their message, and any other value goes through `String()`.
190
+ *
191
+ * @param error - The thrown value to convert.
192
+ * @example
193
+ * ```typescript
194
+ * try {
195
+ * await doSomething();
196
+ * } catch (error) {
197
+ * console.error(stringifyError(error));
198
+ * }
199
+ * ```
200
+ */
201
+ function stringifyError(error) {
202
+ if (error instanceof CommerceSdkValidationError) return error.display();
203
+ return error instanceof Error ? error.message : String(error);
204
+ }
205
+
206
+ Object.defineProperty(exports, "CommerceSdkErrorBase", {
188
207
  enumerable: true,
189
208
  get: function () {
190
209
  return CommerceSdkErrorBase;
191
210
  }
192
211
  });
193
- Object.defineProperty(exports, 'CommerceSdkValidationError', {
212
+ Object.defineProperty(exports, "CommerceSdkValidationError", {
194
213
  enumerable: true,
195
214
  get: function () {
196
215
  return CommerceSdkValidationError;
197
216
  }
217
+ });
218
+ Object.defineProperty(exports, "stringifyError", {
219
+ enumerable: true,
220
+ get: function () {
221
+ return stringifyError;
222
+ }
198
223
  });
@@ -13,17 +13,16 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
- const require_rolldown_runtime = require('../rolldown-runtime-Cozy-1ZF.cjs');
17
- const require_error = require('../error-DcSWQLuA.cjs');
16
+ const require_rolldown_runtime = require("../rolldown-runtime-CoOt0iuZ.cjs");
17
+ const require_error = require("../error-D892zgDO.cjs");
18
18
  let valibot = require("valibot");
19
19
  let camelcase = require("camelcase");
20
20
  camelcase = require_rolldown_runtime.__toESM(camelcase, 1);
21
21
 
22
- //#region source/headers/camelcase.ts
22
+ // source/headers/camelcase.ts
23
23
  const camelcase$1 = camelcase.default.default ?? camelcase.default;
24
24
 
25
- //#endregion
26
- //#region source/headers/helpers.ts
25
+ // source/headers/helpers.ts
27
26
  /**
28
27
  * Extracts a header value from an object with case-insensitive lookup.
29
28
  * This is useful for handling HTTP headers which can be case-insensitive per RFC 7230.
@@ -58,7 +57,7 @@ function getHeader(headers, name, options) {
58
57
  if (Object.hasOwn(headers, name)) value = headers[name];
59
58
  else {
60
59
  const lowerName = name.toLowerCase();
61
- for (const key in headers) if (Object.hasOwn(headers, key) && key.toLowerCase() === lowerName) {
60
+ for (const key of Object.keys(headers)) if (key.toLowerCase() === lowerName) {
62
61
  value = headers[key];
63
62
  break;
64
63
  }
@@ -81,13 +80,13 @@ function getHeader(headers, name, options) {
81
80
  * ```
82
81
  */
83
82
  function getHeadersFromParams(params) {
84
- const parsed = (0, valibot.safeParse)((0, valibot.object)({ __ow_headers: (0, valibot.record)((0, valibot.string)(), (0, valibot.union)([(0, valibot.string)(), (0, valibot.undefined)()])) }), params);
83
+ const schema = (0, valibot.object)({ __ow_headers: (0, valibot.record)((0, valibot.string)(), (0, valibot.union)([(0, valibot.string)(), (0, valibot.undefined)()])) });
84
+ const parsed = (0, valibot.safeParse)(schema, params);
85
85
  if (!parsed.success) throw new require_error.CommerceSdkValidationError("Missing __ow_headers in action params", { issues: parsed.issues });
86
86
  return parsed.output.__ow_headers;
87
87
  }
88
88
 
89
- //#endregion
90
- //#region source/headers/validation.ts
89
+ // source/headers/validation.ts
91
90
  /**
92
91
  * Returns an array of missing or empty headers using Valibot validation.
93
92
  * Case-insensitive by default.
@@ -120,7 +119,8 @@ function getMissingOrEmptyHeaders(headers, requiredHeaders) {
120
119
  const value = headers[key];
121
120
  if (value !== void 0 && value !== null) normalized[key.toLowerCase()] = value;
122
121
  }
123
- const parsed = (0, valibot.safeParse)(buildHeadersSchema(requiredHeaders.map((h) => (0, valibot.literal)(h))), normalized);
122
+ const schema = buildHeadersSchema(requiredHeaders.map((h) => (0, valibot.literal)(h)));
123
+ const parsed = (0, valibot.safeParse)(schema, normalized);
124
124
  if (parsed.success) return [];
125
125
  const lookup = new Map(requiredHeaders.map((h) => [h.toLowerCase(), h]));
126
126
  return parsed.issues.flatMap((issue) => {
@@ -188,7 +188,8 @@ function assertRequiredHeadersSchema(headers, requiredHeaders) {
188
188
  const value = headers[key];
189
189
  if (value !== void 0 && value !== null) normalized[key.toLowerCase()] = value;
190
190
  }
191
- const parsed = (0, valibot.safeParse)(buildHeadersSchema(requiredHeaders), normalized);
191
+ const schema = buildHeadersSchema(requiredHeaders);
192
+ const parsed = (0, valibot.safeParse)(schema, normalized);
192
193
  if (!parsed.success) throw new require_error.CommerceSdkValidationError("The headers object does not match the required headers (case-insensitive)", { issues: parsed.issues });
193
194
  }
194
195
  /**
@@ -223,9 +224,8 @@ function assertRequiredHeaders(headers, requiredHeaders) {
223
224
  assertRequiredHeadersSchema(headers, requiredHeaders.map((header) => (0, valibot.literal)(header)));
224
225
  }
225
226
 
226
- //#endregion
227
- //#region source/headers/accessor.ts
228
- const LEADING_UNDERSCORES = /^_+/;
227
+ // source/headers/accessor.ts
228
+ const LEADING_UNDERSCORES = /^_+/u;
229
229
  /**
230
230
  * Converts a header name to a camelCase key aligned with `type-fest`'s `CamelCase` type.
231
231
  *
@@ -281,8 +281,7 @@ function createHeaderAccessor(headers, requiredHeaders, options) {
281
281
  return accessor;
282
282
  }
283
283
 
284
- //#endregion
285
- //#region source/headers/auth.ts
284
+ // source/headers/auth.ts
286
285
  /**
287
286
  * Type guard to check if authorization is Bearer type.
288
287
  */
@@ -309,7 +308,7 @@ function isOAuth(auth) {
309
308
  */
310
309
  function parseKeyValueParameters(parametersString) {
311
310
  const params = {};
312
- const paramPattern = /(\w+)=(?:"([^"]*)"|([^,\s]+))/g;
311
+ const paramPattern = /(?<key>\w+)=(?:"(?<quotedValue>[^"]*)"|(?<unquotedValue>[^,\s]+))/gu;
313
312
  let match = paramPattern.exec(parametersString);
314
313
  while (match !== null) {
315
314
  const [, key, quotedValue, unquotedValue] = match;
@@ -452,7 +451,6 @@ function parseOAuthToken(authorization) {
452
451
  return auth;
453
452
  }
454
453
 
455
- //#endregion
456
454
  exports.assertRequiredHeaders = assertRequiredHeaders;
457
455
  exports.createHeaderAccessor = createHeaderAccessor;
458
456
  exports.getHeader = getHeader;
@@ -12,10 +12,8 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { r as RuntimeActionParams } from "../index-CkxLqyh-.cjs";
15
+ import { r as RuntimeActionParams } from "../index-_sNhjzIe.cjs";
16
16
  import { CamelCase } from "type-fest";
17
-
18
- //#region source/headers/types.d.ts
19
17
  /** The type of an HTTP header value. */
20
18
  type HttpHeaderValue = string | string[] | undefined;
21
19
  /** The type of an HTTP headers record. */
@@ -35,9 +33,7 @@ type GetHeaderReturn<T extends GetHeaderOptions | undefined> = T extends {
35
33
  splitCommaSeparated: true;
36
34
  } ? HttpHeaderValue : Exclude<HttpHeaderValue, string[]>;
37
35
  /** The type of an HTTP header accessor object. */
38
- type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | undefined = undefined> = { [K in T[number] as CamelCase<K>]: Exclude<GetHeaderReturn<O>, undefined> };
39
- //#endregion
40
- //#region source/headers/accessor.d.ts
36
+ type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | undefined = undefined> = { [K in T[number] as CamelCase<K>]: Exclude<GetHeaderReturn<O>, undefined>; };
41
37
  /**
42
38
  * Creates a type-safe header accessor object with validated required headers.
43
39
  * Header names are normalized to camelCase for consistent access.
@@ -68,9 +64,7 @@ type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | unde
68
64
  * // accessor.cacheControl may be string | string[] depending on comma presence
69
65
  * ```
70
66
  */
71
- declare function createHeaderAccessor<const T extends string[], const O extends GetHeaderOptions | undefined = undefined>(headers: HttpHeaders, requiredHeaders: T, options?: O): HttpHeaderAccessorMap<T, O>;
72
- //#endregion
73
- //#region source/headers/auth.d.ts
67
+ export declare function createHeaderAccessor<const T extends string[], const O extends GetHeaderOptions | undefined = undefined>(headers: HttpHeaders, requiredHeaders: T, options?: O): HttpHeaderAccessorMap<T, O>;
74
68
  /**
75
69
  * Represents a Bearer authentication scheme (RFC 6750).
76
70
  */
@@ -153,15 +147,15 @@ type Authorization = BearerAuthorization | BasicAuthorization | OAuth1Authorizat
153
147
  /**
154
148
  * Type guard to check if authorization is Bearer type.
155
149
  */
156
- declare function isBearerAuth(auth: Authorization): auth is BearerAuthorization;
150
+ export declare function isBearerAuth(auth: Authorization): auth is BearerAuthorization;
157
151
  /**
158
152
  * Type guard to check if authorization is Basic type.
159
153
  */
160
- declare function isBasicAuth(auth: Authorization): auth is BasicAuthorization;
154
+ export declare function isBasicAuth(auth: Authorization): auth is BasicAuthorization;
161
155
  /**
162
156
  * Type guard to check if authorization is OAuth type.
163
157
  */
164
- declare function isOAuth(auth: Authorization): auth is OAuth1Authorization;
158
+ export declare function isOAuth(auth: Authorization): auth is OAuth1Authorization;
165
159
  /**
166
160
  * Parses an Authorization header value into its scheme and parameters.
167
161
  *
@@ -195,7 +189,7 @@ declare function isOAuth(auth: Authorization): auth is OAuth1Authorization;
195
189
  * // { realm: "Example", nonce: "abc" }
196
190
  * ```
197
191
  */
198
- declare function parseAuthorization(authorization: string): Authorization;
192
+ export declare function parseAuthorization(authorization: string): Authorization;
199
193
  /**
200
194
  * Parses and validates a Bearer authorization header.
201
195
  *
@@ -217,7 +211,7 @@ declare function parseAuthorization(authorization: string): Authorization;
217
211
  * }
218
212
  * ```
219
213
  */
220
- declare function parseBearerToken(authorization: string): BearerAuthorization;
214
+ export declare function parseBearerToken(authorization: string): BearerAuthorization;
221
215
  /**
222
216
  * Parses and validates a Basic authorization header.
223
217
  *
@@ -230,7 +224,7 @@ declare function parseBearerToken(authorization: string): BearerAuthorization;
230
224
  * console.log(auth.credentials); // "dXNlcjpwYXNz"
231
225
  * ```
232
226
  */
233
- declare function parseBasicToken(authorization: string): BasicAuthorization;
227
+ export declare function parseBasicToken(authorization: string): BasicAuthorization;
234
228
  /**
235
229
  * Parses and validates an OAuth 1.0 authorization header.
236
230
  *
@@ -244,9 +238,7 @@ declare function parseBasicToken(authorization: string): BasicAuthorization;
244
238
  * console.log(auth.parameters.oauth_token); // "token"
245
239
  * ```
246
240
  */
247
- declare function parseOAuthToken(authorization: string): OAuth1Authorization;
248
- //#endregion
249
- //#region source/headers/helpers.d.ts
241
+ export declare function parseOAuthToken(authorization: string): OAuth1Authorization;
250
242
  /**
251
243
  * Extracts a header value from an object with case-insensitive lookup.
252
244
  * This is useful for handling HTTP headers which can be case-insensitive per RFC 7230.
@@ -275,7 +267,7 @@ declare function parseOAuthToken(authorization: string): OAuth1Authorization;
275
267
  * @see https://datatracker.ietf.org/doc/html/rfc7230 - HTTP/1.1 Message Syntax and Routing
276
268
  * @see https://datatracker.ietf.org/doc/html/rfc9110#name-field-lines-and-combined-fi - HTTP Semantics: Field Lines and Combined Field Values
277
269
  */
278
- declare function getHeader<T extends GetHeaderOptions | undefined = undefined>(headers: HttpHeaders, name: string, options?: T): GetHeaderReturn<T>;
270
+ export declare function getHeader<T extends GetHeaderOptions | undefined = undefined>(headers: HttpHeaders, name: string, options?: T): GetHeaderReturn<T>;
279
271
  /**
280
272
  * Extracts the `__ow_headers` object from App Builder runtime action parameters.
281
273
  *
@@ -290,9 +282,7 @@ declare function getHeader<T extends GetHeaderOptions | undefined = undefined>(h
290
282
  * }
291
283
  * ```
292
284
  */
293
- declare function getHeadersFromParams(params: RuntimeActionParams): HttpHeaders;
294
- //#endregion
295
- //#region source/headers/validation.d.ts
285
+ export declare function getHeadersFromParams(params: RuntimeActionParams): HttpHeaders;
296
286
  /**
297
287
  * Returns an array of missing or empty headers using Valibot validation.
298
288
  * Case-insensitive by default.
@@ -319,7 +309,7 @@ declare function getHeadersFromParams(params: RuntimeActionParams): HttpHeaders;
319
309
  * // Returns: ["x-api-key"] (empty string is considered missing)
320
310
  * ```
321
311
  */
322
- declare function getMissingOrEmptyHeaders(headers: HttpHeaders, requiredHeaders: string[]): string[];
312
+ export declare function getMissingOrEmptyHeaders(headers: HttpHeaders, requiredHeaders: string[]): string[];
323
313
  /**
324
314
  * Validates that required headers are present and non-empty in the headers object.
325
315
  * Performs case-insensitive validation with {@link getHeader}.
@@ -348,6 +338,5 @@ declare function getMissingOrEmptyHeaders(headers: HttpHeaders, requiredHeaders:
348
338
  * }
349
339
  * ```
350
340
  */
351
- declare function assertRequiredHeaders(headers: HttpHeaders, requiredHeaders: string[]): void;
352
- //#endregion
353
- export { type Authorization, type BasicAuthorization, type BearerAuthorization, type GenericAuthorization, type HttpHeaderAccessorMap, type HttpHeaderValue, type HttpHeaders, type OAuth1Authorization, type OAuth1Parameters, assertRequiredHeaders, createHeaderAccessor, getHeader, getHeadersFromParams, getMissingOrEmptyHeaders, isBasicAuth, isBearerAuth, isOAuth, parseAuthorization, parseBasicToken, parseBearerToken, parseOAuthToken };
341
+ export declare function assertRequiredHeaders(headers: HttpHeaders, requiredHeaders: string[]): void;
342
+ export type { Authorization, BasicAuthorization, BearerAuthorization, GenericAuthorization, HttpHeaderAccessorMap, HttpHeaderValue, HttpHeaders, OAuth1Authorization, OAuth1Parameters };
@@ -12,7 +12,6 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- //#region source/params/helpers.d.ts
16
15
  /**
17
16
  * Checks if the given runtime action input value is non-empty.
18
17
  *
@@ -27,8 +26,6 @@ declare function nonEmpty(name: string, value: unknown): boolean;
27
26
  * @param required - The list of required parameter names.
28
27
  */
29
28
  declare function allNonEmpty<const T extends string[]>(params: Record<string, unknown>, required: T): params is Record<string, unknown> & Record<T[number], unknown>;
30
- //#endregion
31
- //#region source/params/types.d.ts
32
29
  /**
33
30
  * Standard HTTP methods supported by Adobe I/O Runtime.
34
31
  * These are the methods that can be used when invoking runtime actions via HTTP.
@@ -41,12 +38,16 @@ type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTION
41
38
  type HttpMethodLowercase = Lowercase<HttpMethod>;
42
39
  /** The type of the runtime action parameters. */
43
40
  type RuntimeActionParams = {
44
- /** If the runtime action is invoked via HTTP, this will be the headers of the request. */__ow_headers?: Record<string, string | undefined>; /** If the runtime action is invoked via HTTP, this will be the HTTP method of the request. */
45
- __ow_method?: HttpMethodLowercase; /** If the runtime action is invoked via HTTP, this will be the unmatched path of the request (matching stops after consuming the action extension) */
46
- __ow_path?: string; /** If the runtime action is invoked via HTTP, this will be the request body entity, as a base64-encoded string when its content is binary or JSON object/array, or as a plain string otherwise */
47
- __ow_body?: string; /** If the runtime action is invoked via HTTP, this will be the query parameters of the request, as an unparsed string. */
41
+ /** If the runtime action is invoked via HTTP, this will be the headers of the request. */
42
+ __ow_headers?: Record<string, string | undefined>;
43
+ /** If the runtime action is invoked via HTTP, this will be the HTTP method of the request. */
44
+ __ow_method?: HttpMethodLowercase;
45
+ /** If the runtime action is invoked via HTTP, this will be the unmatched path of the request (matching stops after consuming the action extension) */
46
+ __ow_path?: string;
47
+ /** If the runtime action is invoked via HTTP, this will be the request body entity, as a base64-encoded string when its content is binary or JSON object/array, or as a plain string otherwise */
48
+ __ow_body?: string;
49
+ /** If the runtime action is invoked via HTTP, this will be the query parameters of the request, as an unparsed string. */
48
50
  __ow_query?: string;
49
51
  [key: string]: unknown;
50
52
  };
51
- //#endregion
52
53
  export { nonEmpty as a, allNonEmpty as i, HttpMethodLowercase as n, RuntimeActionParams as r, HttpMethod as t };
@@ -13,8 +13,7 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
-
17
- //#region source/params/helpers.ts
16
+ // source/params/helpers.ts
18
17
  /**
19
18
  * Checks if the given runtime action input value is non-empty.
20
19
  *
@@ -23,7 +22,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
23
22
  */
24
23
  function nonEmpty(name, value) {
25
24
  if (value === void 0 || value === null) return false;
26
- const v = String(value)?.trim();
25
+ const v = String(value).trim();
27
26
  return !!v && v !== `$${name}`;
28
27
  }
29
28
  /**
@@ -36,6 +35,5 @@ function allNonEmpty(params, required) {
36
35
  return required.every((name) => nonEmpty(name, params[name]));
37
36
  }
38
37
 
39
- //#endregion
40
38
  exports.allNonEmpty = allNonEmpty;
41
39
  exports.nonEmpty = nonEmpty;
@@ -12,5 +12,5 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- import { a as nonEmpty, i as allNonEmpty, n as HttpMethodLowercase, r as RuntimeActionParams, t as HttpMethod } from "../index-CkxLqyh-.cjs";
15
+ import { a as nonEmpty, i as allNonEmpty, n as HttpMethodLowercase, r as RuntimeActionParams, t as HttpMethod } from "../index-_sNhjzIe.cjs";
16
16
  export { HttpMethod, HttpMethodLowercase, RuntimeActionParams, allNonEmpty, nonEmpty };
@@ -13,8 +13,7 @@
13
13
  */
14
14
 
15
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
16
-
17
- //#region source/responses/helpers.ts
16
+ // source/responses/helpers.ts
18
17
  function isObjectRecord(value) {
19
18
  return typeof value === "object" && value !== null && !Array.isArray(value);
20
19
  }
@@ -162,8 +161,7 @@ function buildSuccessResponse(statusCode, payload) {
162
161
  };
163
162
  }
164
163
 
165
- //#endregion
166
- //#region source/responses/presets.ts
164
+ // source/responses/presets.ts
167
165
  const HTTP_OK = 200;
168
166
  const HTTP_CREATED = 201;
169
167
  const HTTP_ACCEPTED = 202;
@@ -243,7 +241,6 @@ const conflict = curryBuildErrorResponse(409);
243
241
  */
244
242
  const internalServerError = curryBuildErrorResponse(500);
245
243
 
246
- //#endregion
247
244
  exports.HTTP_ACCEPTED = HTTP_ACCEPTED;
248
245
  exports.HTTP_BAD_REQUEST = HTTP_BAD_REQUEST;
249
246
  exports.HTTP_CONFLICT = HTTP_CONFLICT;