@adobe/aio-commerce-lib-core 1.4.0 → 1.4.1-alpha-20261203134759
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 +8 -0
- package/dist/cjs/commerce/index.cjs +1 -1
- package/dist/cjs/error/index.cjs +1 -1
- package/dist/cjs/error/index.d.cts +2 -1
- package/dist/cjs/{error-D892zgDO.cjs → error-CR9h-yqy.cjs} +5 -6
- package/dist/cjs/headers/index.cjs +8 -10
- package/dist/cjs/headers/index.d.cts +4 -2
- package/dist/cjs/{rolldown-runtime-CoOt0iuZ.cjs → rolldown-runtime-BKfnhsn2.cjs} +4 -4
- package/dist/es/error/index.d.mts +2 -1
- package/dist/es/error/index.mjs +1 -1
- package/dist/es/{error-DHfBWC_D.mjs → error-aTlgfT12.mjs} +5 -4
- package/dist/es/headers/index.d.mts +4 -2
- package/dist/es/headers/index.mjs +7 -9
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-core
|
|
2
2
|
|
|
3
|
+
## 1.4.1-alpha-20261203134759
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0c71244`](https://github.com/adobe/aio-commerce-sdk/commit/0c712442ab25b5bded5cbb9e8011c7f2534f0a80) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - The `error` module now loads in browsers. There, `toString()` returns the plain error string instead of the inspected output.
|
|
8
|
+
|
|
9
|
+
- [#820](https://github.com/adobe/aio-commerce-sdk/pull/820) [`5763fae`](https://github.com/adobe/aio-commerce-sdk/commit/5763faeac0546809a4e468d23d2dab320a75d1ca) Thanks [@renovate](https://github.com/apps/renovate)! - Fix inferred header accessor keys for header names containing digits so they match the runtime keys.
|
|
10
|
+
|
|
3
11
|
## 1.4.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-BKfnhsn2.cjs");
|
|
17
17
|
let valibot = require("valibot");
|
|
18
18
|
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
19
19
|
|
package/dist/cjs/error/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_error = require("../error-
|
|
16
|
+
const require_error = require("../error-CR9h-yqy.cjs");
|
|
17
17
|
|
|
18
18
|
exports.CommerceSdkErrorBase = require_error.CommerceSdkErrorBase;
|
|
19
19
|
exports.CommerceSdkValidationError = require_error.CommerceSdkValidationError;
|
|
@@ -87,7 +87,8 @@ export declare abstract class CommerceSdkErrorBase extends Error {
|
|
|
87
87
|
traceId: string | undefined;
|
|
88
88
|
};
|
|
89
89
|
/**
|
|
90
|
-
* Returns a pretty string representation of the error.
|
|
90
|
+
* Returns a pretty string representation of the error. Outside Node.js, or on Node.js versions without `process.getBuiltinModule`, it returns the plain `Error` string.
|
|
91
|
+
*
|
|
91
92
|
* @param inspect - Whether to inspect the error (returns a more detailed string, useful for debugging).
|
|
92
93
|
*/
|
|
93
94
|
toString(inspect?: boolean): string;
|
|
@@ -12,11 +12,8 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
const require_rolldown_runtime = require("./rolldown-runtime-CoOt0iuZ.cjs");
|
|
16
|
-
let valibot = require("valibot");
|
|
17
|
-
let util = require("util");
|
|
18
|
-
util = require_rolldown_runtime.__toESM(util, 1);
|
|
19
15
|
let ansis = require("ansis");
|
|
16
|
+
let valibot = require("valibot");
|
|
20
17
|
|
|
21
18
|
// source/error/base-error.ts
|
|
22
19
|
/**
|
|
@@ -98,11 +95,13 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
|
98
95
|
};
|
|
99
96
|
}
|
|
100
97
|
/**
|
|
101
|
-
* Returns a pretty string representation of the error.
|
|
98
|
+
* Returns a pretty string representation of the error. Outside Node.js, or on Node.js versions without `process.getBuiltinModule`, it returns the plain `Error` string.
|
|
99
|
+
*
|
|
102
100
|
* @param inspect - Whether to inspect the error (returns a more detailed string, useful for debugging).
|
|
103
101
|
*/
|
|
104
102
|
toString(inspect = true) {
|
|
105
|
-
|
|
103
|
+
const util = inspect ? globalThis.process?.getBuiltinModule?.("node:util") : void 0;
|
|
104
|
+
if (util) return util.inspect(this, {
|
|
106
105
|
colors: true,
|
|
107
106
|
depth: null,
|
|
108
107
|
maxStringLength: Number.POSITIVE_INFINITY,
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
17
|
-
const require_error = require("../error-D892zgDO.cjs");
|
|
18
|
-
let valibot = require("valibot");
|
|
16
|
+
const require_rolldown_runtime = require("../rolldown-runtime-BKfnhsn2.cjs");
|
|
19
17
|
let camelcase = require("camelcase");
|
|
18
|
+
let valibot = require("valibot");
|
|
19
|
+
const require_error = require("../error-CR9h-yqy.cjs");
|
|
20
20
|
camelcase = require_rolldown_runtime.__toESM(camelcase, 1);
|
|
21
21
|
|
|
22
22
|
// source/headers/camelcase.ts
|
|
@@ -229,14 +229,12 @@ 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
|
*
|
|
232
|
-
*
|
|
233
|
-
* `
|
|
234
|
-
* (e.g. `_foo_bar` → `fooBar`). Without stripping them first, runtime keys would diverge
|
|
235
|
-
* from the inferred TypeScript type.
|
|
232
|
+
* Leading underscores are dropped (e.g. `_foo_bar` → `fooBar`), matching
|
|
233
|
+
* `HttpHeaderAccessorMap`, which sets `preserveLeadingUnderscores: false`.
|
|
236
234
|
*
|
|
237
|
-
* @remarks
|
|
238
|
-
*
|
|
239
|
-
*
|
|
235
|
+
* @remarks Preserving leading underscores (a bare `camelcase(header)` call, which is the
|
|
236
|
+
* default for both `camelcase` v9+ and `type-fest` v6+) is a breaking change and must land
|
|
237
|
+
* in a major release, updating this function and `HttpHeaderAccessorMap` together.
|
|
240
238
|
*/
|
|
241
239
|
function toHeaderCamelKey(header) {
|
|
242
240
|
return camelcase$1(header.replace(LEADING_UNDERSCORES, ""));
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* This module exports core HTTP header utilities for the AIO Commerce SDK.
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
|
-
import { RuntimeActionParams } from "../params/index.cjs";
|
|
21
20
|
import { CamelCase } from "type-fest";
|
|
21
|
+
import { RuntimeActionParams } from "../params/index.cjs";
|
|
22
22
|
/** The type of an HTTP header value. */
|
|
23
23
|
type HttpHeaderValue = string | string[] | undefined;
|
|
24
24
|
/** The type of an HTTP headers record. */
|
|
@@ -38,7 +38,9 @@ type GetHeaderReturn<T extends GetHeaderOptions | undefined> = T extends {
|
|
|
38
38
|
splitCommaSeparated: true;
|
|
39
39
|
} ? HttpHeaderValue : Exclude<HttpHeaderValue, string[]>;
|
|
40
40
|
/** The type of an HTTP header accessor object. */
|
|
41
|
-
type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | undefined = undefined> = { [K in T[number] as CamelCase<K
|
|
41
|
+
type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | undefined = undefined> = { [K in T[number] as CamelCase<K, {
|
|
42
|
+
preserveLeadingUnderscores: false;
|
|
43
|
+
}>]: Exclude<GetHeaderReturn<O>, undefined>; };
|
|
42
44
|
/**
|
|
43
45
|
* Creates a type-safe header accessor object with validated required headers.
|
|
44
46
|
* Header names are normalized to camelCase for consistent access.
|
|
@@ -21,12 +21,12 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
21
21
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
22
|
var __copyProps = (to, from, except, desc) => {
|
|
23
23
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (
|
|
25
|
-
key = keys[i];
|
|
24
|
+
for (let key of __getOwnPropNames(from)) {
|
|
26
25
|
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
+
desc = __getOwnPropDesc(from, key);
|
|
27
27
|
__defProp(to, key, {
|
|
28
|
-
get: (
|
|
29
|
-
enumerable: !
|
|
28
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
29
|
+
enumerable: !desc || desc.enumerable
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -87,7 +87,8 @@ export declare abstract class CommerceSdkErrorBase extends Error {
|
|
|
87
87
|
traceId: string | undefined;
|
|
88
88
|
};
|
|
89
89
|
/**
|
|
90
|
-
* Returns a pretty string representation of the error.
|
|
90
|
+
* Returns a pretty string representation of the error. Outside Node.js, or on Node.js versions without `process.getBuiltinModule`, it returns the plain `Error` string.
|
|
91
|
+
*
|
|
91
92
|
* @param inspect - Whether to inspect the error (returns a more detailed string, useful for debugging).
|
|
92
93
|
*/
|
|
93
94
|
toString(inspect?: boolean): string;
|
package/dist/es/error/index.mjs
CHANGED
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as CommerceSdkValidationError, r as CommerceSdkErrorBase, t as stringifyError } from "../error-
|
|
15
|
+
import { n as CommerceSdkValidationError, r as CommerceSdkErrorBase, t as stringifyError } from "../error-aTlgfT12.mjs";
|
|
16
16
|
|
|
17
17
|
export { CommerceSdkErrorBase, CommerceSdkValidationError, stringifyError };
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { getDotPath } from "valibot";
|
|
16
|
-
import util from "util";
|
|
17
15
|
import { cyanBright, dim, whiteBright, yellowBright } from "ansis";
|
|
16
|
+
import { getDotPath } from "valibot";
|
|
18
17
|
|
|
19
18
|
// source/error/base-error.ts
|
|
20
19
|
/**
|
|
@@ -96,11 +95,13 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
|
96
95
|
};
|
|
97
96
|
}
|
|
98
97
|
/**
|
|
99
|
-
* Returns a pretty string representation of the error.
|
|
98
|
+
* Returns a pretty string representation of the error. Outside Node.js, or on Node.js versions without `process.getBuiltinModule`, it returns the plain `Error` string.
|
|
99
|
+
*
|
|
100
100
|
* @param inspect - Whether to inspect the error (returns a more detailed string, useful for debugging).
|
|
101
101
|
*/
|
|
102
102
|
toString(inspect = true) {
|
|
103
|
-
|
|
103
|
+
const util = inspect ? globalThis.process?.getBuiltinModule?.("node:util") : void 0;
|
|
104
|
+
if (util) return util.inspect(this, {
|
|
104
105
|
colors: true,
|
|
105
106
|
depth: null,
|
|
106
107
|
maxStringLength: Number.POSITIVE_INFINITY,
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* This module exports core HTTP header utilities for the AIO Commerce SDK.
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
|
-
import { r as RuntimeActionParams } from "../index-_sNhjzIe.mjs";
|
|
21
20
|
import { CamelCase } from "type-fest";
|
|
21
|
+
import { r as RuntimeActionParams } from "../index-_sNhjzIe.mjs";
|
|
22
22
|
/** The type of an HTTP header value. */
|
|
23
23
|
type HttpHeaderValue = string | string[] | undefined;
|
|
24
24
|
/** The type of an HTTP headers record. */
|
|
@@ -38,7 +38,9 @@ type GetHeaderReturn<T extends GetHeaderOptions | undefined> = T extends {
|
|
|
38
38
|
splitCommaSeparated: true;
|
|
39
39
|
} ? HttpHeaderValue : Exclude<HttpHeaderValue, string[]>;
|
|
40
40
|
/** The type of an HTTP header accessor object. */
|
|
41
|
-
type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | undefined = undefined> = { [K in T[number] as CamelCase<K
|
|
41
|
+
type HttpHeaderAccessorMap<T extends string[], O extends GetHeaderOptions | undefined = undefined> = { [K in T[number] as CamelCase<K, {
|
|
42
|
+
preserveLeadingUnderscores: false;
|
|
43
|
+
}>]: Exclude<GetHeaderReturn<O>, undefined>; };
|
|
42
44
|
/**
|
|
43
45
|
* Creates a type-safe header accessor object with validated required headers.
|
|
44
46
|
* Header names are normalized to camelCase for consistent access.
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { n as CommerceSdkValidationError } from "../error-DHfBWC_D.mjs";
|
|
16
|
-
import { literal, nonEmpty, object, pipe, rawCheck, rawTransform, record, safeParse, string, trim, undefined as undefined$1, union } from "valibot";
|
|
17
15
|
import * as camelcaseModule from "camelcase";
|
|
16
|
+
import { literal, nonEmpty, object, pipe, rawCheck, rawTransform, record, safeParse, string, trim, undefined as undefined$1, union } from "valibot";
|
|
17
|
+
import { n as CommerceSdkValidationError } from "../error-aTlgfT12.mjs";
|
|
18
18
|
|
|
19
19
|
// source/headers/camelcase.ts
|
|
20
20
|
const camelcase = camelcaseModule.default.default ?? camelcaseModule.default;
|
|
@@ -226,14 +226,12 @@ const LEADING_UNDERSCORES = /^_+/u;
|
|
|
226
226
|
/**
|
|
227
227
|
* Converts a header name to a camelCase key aligned with `type-fest`'s `CamelCase` type.
|
|
228
228
|
*
|
|
229
|
-
*
|
|
230
|
-
* `
|
|
231
|
-
* (e.g. `_foo_bar` → `fooBar`). Without stripping them first, runtime keys would diverge
|
|
232
|
-
* from the inferred TypeScript type.
|
|
229
|
+
* Leading underscores are dropped (e.g. `_foo_bar` → `fooBar`), matching
|
|
230
|
+
* `HttpHeaderAccessorMap`, which sets `preserveLeadingUnderscores: false`.
|
|
233
231
|
*
|
|
234
|
-
* @remarks
|
|
235
|
-
*
|
|
236
|
-
*
|
|
232
|
+
* @remarks Preserving leading underscores (a bare `camelcase(header)` call, which is the
|
|
233
|
+
* default for both `camelcase` v9+ and `type-fest` v6+) is a breaking change and must land
|
|
234
|
+
* in a major release, updating this function and `HttpHeaderAccessorMap` together.
|
|
237
235
|
*/
|
|
238
236
|
function toHeaderCamelKey(header) {
|
|
239
237
|
return camelcase(header.replace(LEADING_UNDERSCORES, ""));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-commerce-lib-core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1-alpha-20261203134759",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Core utilities for Adobe Commerce SDK libraries",
|
|
6
6
|
"keywords": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"ansis": "^4.1.0",
|
|
53
53
|
"camelcase": "^10.0.0",
|
|
54
|
-
"type-fest": "^
|
|
54
|
+
"type-fest": "^6.0.0",
|
|
55
55
|
"valibot": "^1.1.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
@@ -74,11 +74,10 @@
|
|
|
74
74
|
"assist:apply": "biome check --write --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
|
|
75
75
|
"build": "tsdown",
|
|
76
76
|
"check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched",
|
|
77
|
-
"code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format
|
|
78
|
-
"docs": "typedoc &&
|
|
77
|
+
"code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format",
|
|
78
|
+
"docs": "typedoc && biome format --write --no-errors-on-unmatched docs",
|
|
79
79
|
"format": "biome format --write --no-errors-on-unmatched",
|
|
80
80
|
"format:check": "biome format --no-errors-on-unmatched",
|
|
81
|
-
"format:markdown": "prettier --no-error-on-unmatched-pattern --write '**/*.md' \"!**/{CODE_OF_CONDUCT.md,COPYRIGHT,LICENSE,SECURITY.md,CONTRIBUTING.md}\"",
|
|
82
81
|
"lint": "biome lint --no-errors-on-unmatched",
|
|
83
82
|
"lint:fix": "biome lint --write --no-errors-on-unmatched",
|
|
84
83
|
"pack": "pnpm pack",
|