@adobe/aio-commerce-lib-core 1.0.0 → 1.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @adobe/aio-commerce-lib-core
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#345](https://github.com/adobe/aio-commerce-sdk/pull/345) [`38adb09`](https://github.com/adobe/aio-commerce-sdk/commit/38adb09e1e2bd1b8fa764ecc2e0d21ecc0071ca7) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Drop Node 20 support (EOL April 2026).
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  ### Major Changes
@@ -1,5 +1,19 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_validation_error = require('../validation-error-DuipISU5.cjs');
16
+ const require_error = require('../error-QC7QKZdI.cjs');
3
17
 
4
- exports.CommerceSdkErrorBase = require_validation_error.CommerceSdkErrorBase;
5
- exports.CommerceSdkValidationError = require_validation_error.CommerceSdkValidationError;
18
+ exports.CommerceSdkErrorBase = require_error.CommerceSdkErrorBase;
19
+ exports.CommerceSdkValidationError = require_error.CommerceSdkValidationError;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  import { GenericIssue } from "valibot";
2
16
 
3
17
  //#region source/error/base-error.d.ts
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region \0rolldown/runtime.js
2
16
  var __create = Object.create;
3
17
  var __defProp = Object.defineProperty;
@@ -26,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
40
 
27
41
  //#endregion
28
42
  let util = require("util");
29
- util = __toESM(util);
43
+ util = __toESM(util, 1);
30
44
  let ansis = require("ansis");
31
45
  let valibot = require("valibot");
32
46
 
@@ -1,8 +1,22 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_validation_error = require('../validation-error-DuipISU5.cjs');
16
+ const require_error = require('../error-QC7QKZdI.cjs');
3
17
  let valibot = require("valibot");
4
18
  let camelcase = require("camelcase");
5
- camelcase = require_validation_error.__toESM(camelcase);
19
+ camelcase = require_error.__toESM(camelcase, 1);
6
20
 
7
21
  //#region source/headers/helpers.ts
8
22
  /**
@@ -63,7 +77,7 @@ function getHeader(headers, name, options) {
63
77
  */
64
78
  function getHeadersFromParams(params) {
65
79
  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);
66
- if (!parsed.success) throw new require_validation_error.CommerceSdkValidationError("Missing __ow_headers in action params", { issues: parsed.issues });
80
+ if (!parsed.success) throw new require_error.CommerceSdkValidationError("Missing __ow_headers in action params", { issues: parsed.issues });
67
81
  return parsed.output.__ow_headers;
68
82
  }
69
83
 
@@ -170,7 +184,7 @@ function assertRequiredHeadersSchema(headers, requiredHeaders) {
170
184
  if (value !== void 0 && value !== null) normalized[key.toLowerCase()] = value;
171
185
  }
172
186
  const parsed = (0, valibot.safeParse)(buildHeadersSchema(requiredHeaders), normalized);
173
- if (!parsed.success) throw new require_validation_error.CommerceSdkValidationError("The headers object does not match the required headers (case-insensitive)", { issues: parsed.issues });
187
+ if (!parsed.success) throw new require_error.CommerceSdkValidationError("The headers object does not match the required headers (case-insensitive)", { issues: parsed.issues });
174
188
  }
175
189
  /**
176
190
  * Validates that required headers are present and non-empty in the headers object.
@@ -206,6 +220,22 @@ function assertRequiredHeaders(headers, requiredHeaders) {
206
220
 
207
221
  //#endregion
208
222
  //#region source/headers/accessor.ts
223
+ const LEADING_UNDERSCORES = /^_+/;
224
+ /**
225
+ * Converts a header name to a camelCase key aligned with `type-fest`'s `CamelCase` type.
226
+ *
227
+ * `camelcase` v9+ preserves leading underscores (e.g. `_foo_bar` → `_fooBar`), but
228
+ * `type-fest`'s `CamelCase` — used by `HttpHeaderAccessorMap` — drops them
229
+ * (e.g. `_foo_bar` → `fooBar`). Without stripping them first, runtime keys would diverge
230
+ * from the inferred TypeScript type.
231
+ *
232
+ * @remarks This function must be removed and replaced with a bare `camelcase(header)` call
233
+ * once the two helpers agree on leading-underscore handling. That cleanup is a breaking
234
+ * change and must land in a major release.
235
+ */
236
+ function toHeaderCamelKey(header) {
237
+ return (0, camelcase.default)(header.replace(LEADING_UNDERSCORES, ""));
238
+ }
209
239
  /**
210
240
  * Creates a type-safe header accessor object with validated required headers.
211
241
  * Header names are normalized to camelCase for consistent access.
@@ -240,7 +270,7 @@ function createHeaderAccessor(headers, requiredHeaders, options) {
240
270
  assertRequiredHeaders(headers, requiredHeaders);
241
271
  const accessor = {};
242
272
  for (const header of requiredHeaders) {
243
- const camelKey = (0, camelcase.default)(header);
273
+ const camelKey = toHeaderCamelKey(header);
244
274
  accessor[camelKey] = getHeader(headers, header, options);
245
275
  }
246
276
  return accessor;
@@ -278,7 +308,7 @@ function parseKeyValueParameters(parametersString) {
278
308
  let match = paramPattern.exec(parametersString);
279
309
  while (match !== null) {
280
310
  const [, key, quotedValue, unquotedValue] = match;
281
- params[key] = quotedValue !== void 0 ? quotedValue : unquotedValue;
311
+ params[key] = quotedValue === void 0 ? unquotedValue : quotedValue;
282
312
  match = paramPattern.exec(parametersString);
283
313
  }
284
314
  return params;
@@ -329,7 +359,7 @@ const authorizationSchema = (0, valibot.pipe)((0, valibot.string)("Expected a st
329
359
  */
330
360
  function parseAuthorization(authorization) {
331
361
  const parsed = (0, valibot.safeParse)(authorizationSchema, authorization);
332
- if (!parsed.success) throw new require_validation_error.CommerceSdkValidationError("Invalid Authorization header format", { issues: parsed.issues });
362
+ if (!parsed.success) throw new require_error.CommerceSdkValidationError("Invalid Authorization header format", { issues: parsed.issues });
333
363
  const { scheme, parameters } = parsed.output;
334
364
  if (scheme === "Bearer") return {
335
365
  scheme: "Bearer",
@@ -374,7 +404,7 @@ const bearerSchema = (0, valibot.object)({ scheme: (0, valibot.literal)("Bearer"
374
404
  function parseBearerToken(authorization) {
375
405
  const auth = parseAuthorization(authorization);
376
406
  const parsed = (0, valibot.safeParse)(bearerSchema, auth);
377
- if (!parsed.success) throw new require_validation_error.CommerceSdkValidationError("Authorization header must be a Bearer token", { issues: parsed.issues });
407
+ if (!parsed.success) throw new require_error.CommerceSdkValidationError("Authorization header must be a Bearer token", { issues: parsed.issues });
378
408
  return auth;
379
409
  }
380
410
  const basicSchema = (0, valibot.object)({ scheme: (0, valibot.literal)("Basic") });
@@ -393,7 +423,7 @@ const basicSchema = (0, valibot.object)({ scheme: (0, valibot.literal)("Basic")
393
423
  function parseBasicToken(authorization) {
394
424
  const auth = parseAuthorization(authorization);
395
425
  const parsed = (0, valibot.safeParse)(basicSchema, auth);
396
- if (!parsed.success) throw new require_validation_error.CommerceSdkValidationError("Authorization header must be Basic authentication", { issues: parsed.issues });
426
+ if (!parsed.success) throw new require_error.CommerceSdkValidationError("Authorization header must be Basic authentication", { issues: parsed.issues });
397
427
  return auth;
398
428
  }
399
429
  const oauthSchema = (0, valibot.object)({ scheme: (0, valibot.literal)("OAuth") });
@@ -413,7 +443,7 @@ const oauthSchema = (0, valibot.object)({ scheme: (0, valibot.literal)("OAuth")
413
443
  function parseOAuthToken(authorization) {
414
444
  const auth = parseAuthorization(authorization);
415
445
  const parsed = (0, valibot.safeParse)(oauthSchema, auth);
416
- if (!parsed.success) throw new require_validation_error.CommerceSdkValidationError("Authorization header must be OAuth", { issues: parsed.issues });
446
+ if (!parsed.success) throw new require_error.CommerceSdkValidationError("Authorization header must be OAuth", { issues: parsed.issues });
417
447
  return auth;
418
448
  }
419
449
 
@@ -1,4 +1,18 @@
1
- import { r as RuntimeActionParams } from "../types-CfxNboCU.cjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { r as RuntimeActionParams } from "../index-Ddzq9z7b.cjs";
2
16
  import { CamelCase } from "type-fest";
3
17
 
4
18
  //#region source/headers/types.d.ts
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region source/params/helpers.d.ts
2
16
  /**
3
17
  * Checks if the given runtime action input value is non-empty.
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
16
 
3
17
  //#region source/params/helpers.ts
@@ -1,2 +1,16 @@
1
- import { a as nonEmpty, i as allNonEmpty, n as HttpMethodLowercase, r as RuntimeActionParams, t as HttpMethod } from "../types-CfxNboCU.cjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { a as nonEmpty, i as allNonEmpty, n as HttpMethodLowercase, r as RuntimeActionParams, t as HttpMethod } from "../index-Ddzq9z7b.cjs";
2
16
  export { HttpMethod, HttpMethodLowercase, RuntimeActionParams, allNonEmpty, nonEmpty };
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
16
 
3
17
  //#region source/responses/helpers.ts
@@ -109,62 +123,62 @@ function curryBuildErrorResponse(code) {
109
123
  * Creates a success response with the HTTP status code 200.
110
124
  * See {@link buildSuccessResponse} for details on the response payload.
111
125
  */
112
- const ok = curryBuildSuccessResponse(HTTP_OK);
126
+ const ok = curryBuildSuccessResponse(200);
113
127
  /**
114
128
  * Creates a success response with the HTTP status code 201.
115
129
  * See {@link buildSuccessResponse} for details on the response payload.
116
130
  */
117
- const created = curryBuildSuccessResponse(HTTP_CREATED);
131
+ const created = curryBuildSuccessResponse(201);
118
132
  /**
119
133
  * Creates a success response with the HTTP status code 202.
120
134
  * See {@link buildSuccessResponse} for details on the response payload.
121
135
  */
122
- const accepted = curryBuildSuccessResponse(HTTP_ACCEPTED);
136
+ const accepted = curryBuildSuccessResponse(202);
123
137
  /**
124
138
  * Creates a success response with the HTTP status code 203.
125
139
  * See {@link buildSuccessResponse} for details on the response payload.
126
140
  */
127
- const nonAuthoritativeInformation = curryBuildSuccessResponse(HTTP_NON_AUTHORITATIVE_INFORMATION);
141
+ const nonAuthoritativeInformation = curryBuildSuccessResponse(203);
128
142
  /**
129
143
  * Creates a success response with the HTTP status code 204 (No Content).
130
144
  * This response has no body.
131
145
  */
132
- const noContent = () => buildSuccessResponse(HTTP_NO_CONTENT);
146
+ const noContent = () => buildSuccessResponse(204);
133
147
  /**
134
148
  * Creates an error response with the HTTP status code 400.
135
149
  * See {@link buildErrorResponse} for details on the response payload.
136
150
  */
137
- const badRequest = curryBuildErrorResponse(HTTP_BAD_REQUEST);
151
+ const badRequest = curryBuildErrorResponse(400);
138
152
  /**
139
153
  * Creates an error response with the HTTP status code 401.
140
154
  * See {@link buildErrorResponse} for details on the response payload.
141
155
  */
142
- const unauthorized = curryBuildErrorResponse(HTTP_UNAUTHORIZED);
156
+ const unauthorized = curryBuildErrorResponse(401);
143
157
  /**
144
158
  * Creates an error response with the HTTP status code 403.
145
159
  * See {@link buildErrorResponse} for details on the response payload.
146
160
  */
147
- const forbidden = curryBuildErrorResponse(HTTP_FORBIDDEN);
161
+ const forbidden = curryBuildErrorResponse(403);
148
162
  /**
149
163
  * Creates an error response with the HTTP status code 404.
150
164
  * See {@link buildErrorResponse} for details on the response payload.
151
165
  */
152
- const notFound = curryBuildErrorResponse(HTTP_NOT_FOUND);
166
+ const notFound = curryBuildErrorResponse(404);
153
167
  /**
154
168
  * Creates an error response with the HTTP status code 405.
155
169
  * See {@link buildErrorResponse} for details on the response payload.
156
170
  */
157
- const methodNotAllowed = curryBuildErrorResponse(HTTP_METHOD_NOT_ALLOWED);
171
+ const methodNotAllowed = curryBuildErrorResponse(405);
158
172
  /**
159
173
  * Creates an error response with the HTTP status code 409.
160
174
  * See {@link buildErrorResponse} for details on the response payload.
161
175
  */
162
- const conflict = curryBuildErrorResponse(HTTP_CONFLICT);
176
+ const conflict = curryBuildErrorResponse(409);
163
177
  /**
164
178
  * Creates an error response with the HTTP status code 500.
165
179
  * See {@link buildErrorResponse} for details on the response payload.
166
180
  */
167
- const internalServerError = curryBuildErrorResponse(HTTP_INTERNAL_SERVER_ERROR);
181
+ const internalServerError = curryBuildErrorResponse(500);
168
182
 
169
183
  //#endregion
170
184
  exports.HTTP_ACCEPTED = HTTP_ACCEPTED;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region source/responses/helpers.d.ts
2
16
  type HeadersRecord = Record<string, string>;
3
17
  type BodyRecord = Record<string, unknown>;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  import { GenericIssue } from "valibot";
2
16
 
3
17
  //#region source/error/base-error.d.ts
@@ -1,3 +1,17 @@
1
- import { n as CommerceSdkErrorBase, t as CommerceSdkValidationError } from "../validation-error-DT4-Oa0Z.mjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { n as CommerceSdkErrorBase, t as CommerceSdkValidationError } from "../error-dCuAZfGs.mjs";
2
16
 
3
17
  export { CommerceSdkErrorBase, CommerceSdkValidationError };
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  import util from "util";
2
16
  import { cyanBright, dim, whiteBright, yellowBright } from "ansis";
3
17
  import { getDotPath } from "valibot";
@@ -1,4 +1,18 @@
1
- import { r as RuntimeActionParams } from "../types-CMBSX5l-.mjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { r as RuntimeActionParams } from "../index-2lCs6JZP.mjs";
2
16
  import { CamelCase } from "type-fest";
3
17
 
4
18
  //#region source/headers/types.d.ts
@@ -1,4 +1,18 @@
1
- import { t as CommerceSdkValidationError } from "../validation-error-DT4-Oa0Z.mjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { t as CommerceSdkValidationError } from "../error-dCuAZfGs.mjs";
2
16
  import { literal, nonEmpty, object, pipe, rawCheck, rawTransform, record, safeParse, string, trim, undefined as undefined$1, union } from "valibot";
3
17
  import camelcase from "camelcase";
4
18
 
@@ -204,6 +218,22 @@ function assertRequiredHeaders(headers, requiredHeaders) {
204
218
 
205
219
  //#endregion
206
220
  //#region source/headers/accessor.ts
221
+ const LEADING_UNDERSCORES = /^_+/;
222
+ /**
223
+ * Converts a header name to a camelCase key aligned with `type-fest`'s `CamelCase` type.
224
+ *
225
+ * `camelcase` v9+ preserves leading underscores (e.g. `_foo_bar` → `_fooBar`), but
226
+ * `type-fest`'s `CamelCase` — used by `HttpHeaderAccessorMap` — drops them
227
+ * (e.g. `_foo_bar` → `fooBar`). Without stripping them first, runtime keys would diverge
228
+ * from the inferred TypeScript type.
229
+ *
230
+ * @remarks This function must be removed and replaced with a bare `camelcase(header)` call
231
+ * once the two helpers agree on leading-underscore handling. That cleanup is a breaking
232
+ * change and must land in a major release.
233
+ */
234
+ function toHeaderCamelKey(header) {
235
+ return camelcase(header.replace(LEADING_UNDERSCORES, ""));
236
+ }
207
237
  /**
208
238
  * Creates a type-safe header accessor object with validated required headers.
209
239
  * Header names are normalized to camelCase for consistent access.
@@ -238,7 +268,7 @@ function createHeaderAccessor(headers, requiredHeaders, options) {
238
268
  assertRequiredHeaders(headers, requiredHeaders);
239
269
  const accessor = {};
240
270
  for (const header of requiredHeaders) {
241
- const camelKey = camelcase(header);
271
+ const camelKey = toHeaderCamelKey(header);
242
272
  accessor[camelKey] = getHeader(headers, header, options);
243
273
  }
244
274
  return accessor;
@@ -276,7 +306,7 @@ function parseKeyValueParameters(parametersString) {
276
306
  let match = paramPattern.exec(parametersString);
277
307
  while (match !== null) {
278
308
  const [, key, quotedValue, unquotedValue] = match;
279
- params[key] = quotedValue !== void 0 ? quotedValue : unquotedValue;
309
+ params[key] = quotedValue === void 0 ? unquotedValue : quotedValue;
280
310
  match = paramPattern.exec(parametersString);
281
311
  }
282
312
  return params;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region source/params/helpers.d.ts
2
16
  /**
3
17
  * Checks if the given runtime action input value is non-empty.
@@ -1,2 +1,16 @@
1
- import { a as nonEmpty, i as allNonEmpty, n as HttpMethodLowercase, r as RuntimeActionParams, t as HttpMethod } from "../types-CMBSX5l-.mjs";
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { a as nonEmpty, i as allNonEmpty, n as HttpMethodLowercase, r as RuntimeActionParams, t as HttpMethod } from "../index-2lCs6JZP.mjs";
2
16
  export { HttpMethod, HttpMethodLowercase, RuntimeActionParams, allNonEmpty, nonEmpty };
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region source/params/helpers.ts
2
16
  /**
3
17
  * Checks if the given runtime action input value is non-empty.
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region source/responses/helpers.d.ts
2
16
  type HeadersRecord = Record<string, string>;
3
17
  type BodyRecord = Record<string, unknown>;
@@ -1,3 +1,17 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2026 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
1
15
  //#region source/responses/helpers.ts
2
16
  /**
3
17
  * Creates a standardized error response for runtime actions
@@ -107,62 +121,62 @@ function curryBuildErrorResponse(code) {
107
121
  * Creates a success response with the HTTP status code 200.
108
122
  * See {@link buildSuccessResponse} for details on the response payload.
109
123
  */
110
- const ok = curryBuildSuccessResponse(HTTP_OK);
124
+ const ok = curryBuildSuccessResponse(200);
111
125
  /**
112
126
  * Creates a success response with the HTTP status code 201.
113
127
  * See {@link buildSuccessResponse} for details on the response payload.
114
128
  */
115
- const created = curryBuildSuccessResponse(HTTP_CREATED);
129
+ const created = curryBuildSuccessResponse(201);
116
130
  /**
117
131
  * Creates a success response with the HTTP status code 202.
118
132
  * See {@link buildSuccessResponse} for details on the response payload.
119
133
  */
120
- const accepted = curryBuildSuccessResponse(HTTP_ACCEPTED);
134
+ const accepted = curryBuildSuccessResponse(202);
121
135
  /**
122
136
  * Creates a success response with the HTTP status code 203.
123
137
  * See {@link buildSuccessResponse} for details on the response payload.
124
138
  */
125
- const nonAuthoritativeInformation = curryBuildSuccessResponse(HTTP_NON_AUTHORITATIVE_INFORMATION);
139
+ const nonAuthoritativeInformation = curryBuildSuccessResponse(203);
126
140
  /**
127
141
  * Creates a success response with the HTTP status code 204 (No Content).
128
142
  * This response has no body.
129
143
  */
130
- const noContent = () => buildSuccessResponse(HTTP_NO_CONTENT);
144
+ const noContent = () => buildSuccessResponse(204);
131
145
  /**
132
146
  * Creates an error response with the HTTP status code 400.
133
147
  * See {@link buildErrorResponse} for details on the response payload.
134
148
  */
135
- const badRequest = curryBuildErrorResponse(HTTP_BAD_REQUEST);
149
+ const badRequest = curryBuildErrorResponse(400);
136
150
  /**
137
151
  * Creates an error response with the HTTP status code 401.
138
152
  * See {@link buildErrorResponse} for details on the response payload.
139
153
  */
140
- const unauthorized = curryBuildErrorResponse(HTTP_UNAUTHORIZED);
154
+ const unauthorized = curryBuildErrorResponse(401);
141
155
  /**
142
156
  * Creates an error response with the HTTP status code 403.
143
157
  * See {@link buildErrorResponse} for details on the response payload.
144
158
  */
145
- const forbidden = curryBuildErrorResponse(HTTP_FORBIDDEN);
159
+ const forbidden = curryBuildErrorResponse(403);
146
160
  /**
147
161
  * Creates an error response with the HTTP status code 404.
148
162
  * See {@link buildErrorResponse} for details on the response payload.
149
163
  */
150
- const notFound = curryBuildErrorResponse(HTTP_NOT_FOUND);
164
+ const notFound = curryBuildErrorResponse(404);
151
165
  /**
152
166
  * Creates an error response with the HTTP status code 405.
153
167
  * See {@link buildErrorResponse} for details on the response payload.
154
168
  */
155
- const methodNotAllowed = curryBuildErrorResponse(HTTP_METHOD_NOT_ALLOWED);
169
+ const methodNotAllowed = curryBuildErrorResponse(405);
156
170
  /**
157
171
  * Creates an error response with the HTTP status code 409.
158
172
  * See {@link buildErrorResponse} for details on the response payload.
159
173
  */
160
- const conflict = curryBuildErrorResponse(HTTP_CONFLICT);
174
+ const conflict = curryBuildErrorResponse(409);
161
175
  /**
162
176
  * Creates an error response with the HTTP status code 500.
163
177
  * See {@link buildErrorResponse} for details on the response payload.
164
178
  */
165
- const internalServerError = curryBuildErrorResponse(HTTP_INTERNAL_SERVER_ERROR);
179
+ const internalServerError = curryBuildErrorResponse(500);
166
180
 
167
181
  //#endregion
168
182
  export { HTTP_ACCEPTED, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_CREATED, HTTP_FORBIDDEN, HTTP_INTERNAL_SERVER_ERROR, HTTP_METHOD_NOT_ALLOWED, HTTP_NON_AUTHORITATIVE_INFORMATION, HTTP_NOT_FOUND, HTTP_NO_CONTENT, HTTP_OK, HTTP_UNAUTHORIZED, accepted, badRequest, buildErrorResponse, buildSuccessResponse, conflict, created, forbidden, internalServerError, methodNotAllowed, noContent, nonAuthoritativeInformation, notFound, ok, unauthorized };
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "@adobe/aio-commerce-lib-core",
3
3
  "type": "module",
4
4
  "author": "Adobe Inc.",
5
- "version": "1.0.0",
5
+ "version": "1.1.0",
6
6
  "private": false,
7
7
  "engines": {
8
- "node": ">=20 <=24"
8
+ "node": ">=22 <=24"
9
9
  },
10
10
  "license": "Apache-2.0",
11
11
  "description": "Core utilities for Adobe Commerce SDK libraries",
@@ -52,12 +52,12 @@
52
52
  ],
53
53
  "dependencies": {
54
54
  "ansis": "^4.1.0",
55
- "camelcase": "^8.0.0",
55
+ "camelcase": "^9.0.0",
56
56
  "type-fest": "^5.0.0",
57
57
  "valibot": "^1.1.0"
58
58
  },
59
59
  "devDependencies": {
60
- "typescript": "^5.9.2",
60
+ "typescript": "^6.0.0",
61
61
  "@aio-commerce-sdk/config-tsdown": "1.0.1",
62
62
  "@aio-commerce-sdk/config-typedoc": "1.0.0",
63
63
  "@aio-commerce-sdk/config-typescript": "1.0.0",
@@ -72,6 +72,7 @@
72
72
  "assist": "biome check --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
73
73
  "assist:apply": "biome check --write --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
74
74
  "check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched",
75
+ "code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format && pnpm run format:markdown",
75
76
  "format": "biome format --write --no-errors-on-unmatched",
76
77
  "format:markdown": "prettier --no-error-on-unmatched-pattern --write '**/*.md' \"!**/{CODE_OF_CONDUCT.md,COPYRIGHT,LICENSE,SECURITY.md,CONTRIBUTING.md}\"",
77
78
  "format:check": "biome format --no-errors-on-unmatched",