@adobe/aio-commerce-lib-core 1.1.1 → 1.2.0-alpha-20260717142750
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 +19 -0
- package/dist/cjs/commerce/index.cjs +37 -0
- package/dist/cjs/commerce/index.d.cts +33 -0
- package/dist/cjs/error/index.cjs +1 -1
- package/dist/cjs/error/index.d.cts +3 -3
- package/dist/cjs/{error-sJoC2Xru.cjs → error-DcSWQLuA.cjs} +14 -44
- package/dist/cjs/headers/index.cjs +16 -15
- package/dist/cjs/responses/index.cjs +72 -6
- package/dist/cjs/responses/index.d.cts +79 -34
- package/dist/cjs/rolldown-runtime-Cozy-1ZF.cjs +48 -0
- package/dist/es/commerce/index.d.mts +33 -0
- package/dist/es/commerce/index.mjs +32 -0
- package/dist/es/error/index.d.mts +3 -3
- package/dist/es/error/index.mjs +1 -1
- package/dist/es/{error-WnQqveay.mjs → error-hJtCYFBx.mjs} +12 -10
- package/dist/es/headers/index.mjs +14 -14
- package/dist/es/responses/index.d.mts +79 -34
- package/dist/es/responses/index.mjs +70 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-core
|
|
2
2
|
|
|
3
|
+
## 1.2.0-alpha-20260717142750
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#563](https://github.com/adobe/aio-commerce-sdk/pull/563) [`19400fb`](https://github.com/adobe/aio-commerce-sdk/commit/19400fbdfc03c5bbfc30f995a2acdd4272c5e032) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Add response type guards to identify standardized SDK action, success, and error responses.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
- [#510](https://github.com/adobe/aio-commerce-sdk/pull/510) [`ce7768e`](https://github.com/adobe/aio-commerce-sdk/commit/ce7768e0ddc6ca35ad6ccec60f584c8bb5a743f0) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Add a `./commerce` export with the shared Commerce environment schema (`COMMERCE_ENVS`, `CommerceEnv`, `CommerceEnvSchema`, `CommerceEnvArraySchema`).
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
- [#522](https://github.com/adobe/aio-commerce-sdk/pull/522) [`4396a64`](https://github.com/adobe/aio-commerce-sdk/commit/4396a647ad22dba063cdf03a16e04aef9387212f) Thanks [@oshmyheliuk](https://github.com/oshmyheliuk)! - Export the `CommerceSdkErrorBaseOptions` and `CommerceSdkErrorOptions` types from the `./error` entrypoint so error subclasses in other packages can build their own options types from them instead of re-deriving the base shape.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- [#486](https://github.com/adobe/aio-commerce-sdk/pull/486) [`413da36`](https://github.com/adobe/aio-commerce-sdk/commit/413da36dcd83e5a41c194f5af50611097659e725) Thanks [@obarcelonap](https://github.com/obarcelonap)! - Response presets now accept an optional type argument for a typed return value.
|
|
21
|
+
|
|
3
22
|
## 1.1.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
+
const require_rolldown_runtime = require('../rolldown-runtime-Cozy-1ZF.cjs');
|
|
17
|
+
let valibot = require("valibot");
|
|
18
|
+
valibot = require_rolldown_runtime.__toESM(valibot, 1);
|
|
19
|
+
|
|
20
|
+
//#region source/commerce/env.ts
|
|
21
|
+
/** The list of supported Commerce environments an item can be scoped to. */
|
|
22
|
+
const COMMERCE_ENVS = ["paas", "saas"];
|
|
23
|
+
/** Schema for a single Commerce environment an item can be scoped to. */
|
|
24
|
+
const CommerceEnvSchema = valibot.picklist(COMMERCE_ENVS, `Expected one of: ${COMMERCE_ENVS.map((e) => `"${e}"`).join(", ")}`);
|
|
25
|
+
/**
|
|
26
|
+
* Schema for a non-empty array of Commerce environments, used to scope an item
|
|
27
|
+
* (a configuration field, webhook, or event) to specific environments.
|
|
28
|
+
*
|
|
29
|
+
* Apply the optional wrapper at the call site (`v.optional(CommerceEnvArraySchema)`);
|
|
30
|
+
* when omitted, the item applies to all environments.
|
|
31
|
+
*/
|
|
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
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.COMMERCE_ENVS = COMMERCE_ENVS;
|
|
36
|
+
exports.CommerceEnvArraySchema = CommerceEnvArraySchema;
|
|
37
|
+
exports.CommerceEnvSchema = CommerceEnvSchema;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 * as v from "valibot";
|
|
16
|
+
|
|
17
|
+
//#region source/commerce/env.d.ts
|
|
18
|
+
/** The list of supported Commerce environments an item can be scoped to. */
|
|
19
|
+
declare const COMMERCE_ENVS: ["paas", "saas"];
|
|
20
|
+
/** A single Commerce environment an item can be scoped to. */
|
|
21
|
+
type CommerceEnv = (typeof COMMERCE_ENVS)[number];
|
|
22
|
+
/** Schema for a single Commerce environment an item can be scoped to. */
|
|
23
|
+
declare const CommerceEnvSchema: v.PicklistSchema<["paas", "saas"], `Expected one of: ${string}`>;
|
|
24
|
+
/**
|
|
25
|
+
* Schema for a non-empty array of Commerce environments, used to scope an item
|
|
26
|
+
* (a configuration field, webhook, or event) to specific environments.
|
|
27
|
+
*
|
|
28
|
+
* Apply the optional wrapper at the call site (`v.optional(CommerceEnvArraySchema)`);
|
|
29
|
+
* when omitted, the item applies to all environments.
|
|
30
|
+
*/
|
|
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 };
|
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-DcSWQLuA.cjs');
|
|
17
17
|
|
|
18
18
|
exports.CommerceSdkErrorBase = require_error.CommerceSdkErrorBase;
|
|
19
19
|
exports.CommerceSdkValidationError = require_error.CommerceSdkValidationError;
|
|
@@ -78,10 +78,10 @@ declare abstract class CommerceSdkErrorBase extends Error {
|
|
|
78
78
|
get rootCause(): unknown;
|
|
79
79
|
/** Converts the error to a JSON-like representation. */
|
|
80
80
|
toJSON(): {
|
|
81
|
-
|
|
81
|
+
cause: unknown;
|
|
82
82
|
message: string;
|
|
83
|
+
name: string;
|
|
83
84
|
stack: string;
|
|
84
|
-
cause: unknown;
|
|
85
85
|
traceId: string | undefined;
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
@@ -130,4 +130,4 @@ declare class CommerceSdkValidationError extends CommerceSdkErrorBase {
|
|
|
130
130
|
display(withColor?: boolean): string;
|
|
131
131
|
}
|
|
132
132
|
//#endregion
|
|
133
|
-
export { CommerceSdkErrorBase, CommerceSdkValidationError };
|
|
133
|
+
export { CommerceSdkErrorBase, type CommerceSdkErrorBaseOptions, type CommerceSdkErrorOptions, CommerceSdkValidationError };
|
|
@@ -12,37 +12,11 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var __defProp = Object.defineProperty;
|
|
18
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
20
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
21
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
|
-
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
25
|
-
key = keys[i];
|
|
26
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
27
|
-
__defProp(to, key, {
|
|
28
|
-
get: ((k) => from[k]).bind(null, key),
|
|
29
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
37
|
-
value: mod,
|
|
38
|
-
enumerable: true
|
|
39
|
-
}) : target, mod));
|
|
40
|
-
|
|
41
|
-
//#endregion
|
|
15
|
+
const require_rolldown_runtime = require('./rolldown-runtime-Cozy-1ZF.cjs');
|
|
16
|
+
let valibot = require("valibot");
|
|
42
17
|
let util = require("util");
|
|
43
|
-
util = __toESM(util, 1);
|
|
18
|
+
util = require_rolldown_runtime.__toESM(util, 1);
|
|
44
19
|
let ansis = require("ansis");
|
|
45
|
-
let valibot = require("valibot");
|
|
46
20
|
|
|
47
21
|
//#region source/error/base-error.ts
|
|
48
22
|
/**
|
|
@@ -65,6 +39,7 @@ let valibot = require("valibot");
|
|
|
65
39
|
* ```
|
|
66
40
|
*/
|
|
67
41
|
var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
42
|
+
traceId;
|
|
68
43
|
/**
|
|
69
44
|
* Constructs a new CommerceSdkErrorBase instance. This is an abstract class so you
|
|
70
45
|
* should not instantiate it directly. Only invoke this constructor from a subclass.
|
|
@@ -98,27 +73,27 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
|
98
73
|
/** Returns the full stack trace of the error and its causes. */
|
|
99
74
|
get fullStack() {
|
|
100
75
|
let out = this.stack ?? "";
|
|
101
|
-
let cause = this
|
|
76
|
+
let { cause } = this;
|
|
102
77
|
while (cause instanceof Error) {
|
|
103
78
|
out += `\nCaused by: ${cause.stack ?? cause.message}`;
|
|
104
|
-
cause = cause
|
|
79
|
+
({cause} = cause);
|
|
105
80
|
}
|
|
106
81
|
return out;
|
|
107
82
|
}
|
|
108
83
|
/** Returns the root cause of the error. */
|
|
109
84
|
get rootCause() {
|
|
110
|
-
let cause = this
|
|
111
|
-
while (cause) if (typeof cause === "object" && cause !== null && "cause" in cause) cause = cause
|
|
85
|
+
let { cause } = this;
|
|
86
|
+
while (cause) if (typeof cause === "object" && cause !== null && "cause" in cause) ({cause} = cause);
|
|
112
87
|
else break;
|
|
113
88
|
return cause;
|
|
114
89
|
}
|
|
115
90
|
/** Converts the error to a JSON-like representation. */
|
|
116
91
|
toJSON() {
|
|
117
92
|
return {
|
|
118
|
-
|
|
93
|
+
cause: this.cause,
|
|
119
94
|
message: this.message,
|
|
95
|
+
name: this.name,
|
|
120
96
|
stack: this.fullStack,
|
|
121
|
-
cause: this.cause,
|
|
122
97
|
traceId: this.traceId
|
|
123
98
|
};
|
|
124
99
|
}
|
|
@@ -128,10 +103,10 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
|
128
103
|
*/
|
|
129
104
|
toString(inspect = true) {
|
|
130
105
|
if (inspect) return util.default.inspect(this, {
|
|
131
|
-
depth: null,
|
|
132
106
|
colors: true,
|
|
133
|
-
|
|
134
|
-
maxStringLength: Number.POSITIVE_INFINITY
|
|
107
|
+
depth: null,
|
|
108
|
+
maxStringLength: Number.POSITIVE_INFINITY,
|
|
109
|
+
sorted: true
|
|
135
110
|
});
|
|
136
111
|
return super.toString();
|
|
137
112
|
}
|
|
@@ -188,6 +163,7 @@ function displayValidationError(error, withColor = true) {
|
|
|
188
163
|
* ```
|
|
189
164
|
*/
|
|
190
165
|
var CommerceSdkValidationError = class extends CommerceSdkErrorBase {
|
|
166
|
+
issues;
|
|
191
167
|
/**
|
|
192
168
|
* Constructs a new {@link CommerceSdkValidationError} instance.
|
|
193
169
|
*
|
|
@@ -219,10 +195,4 @@ Object.defineProperty(exports, 'CommerceSdkValidationError', {
|
|
|
219
195
|
get: function () {
|
|
220
196
|
return CommerceSdkValidationError;
|
|
221
197
|
}
|
|
222
|
-
});
|
|
223
|
-
Object.defineProperty(exports, '__toESM', {
|
|
224
|
-
enumerable: true,
|
|
225
|
-
get: function () {
|
|
226
|
-
return __toESM;
|
|
227
|
-
}
|
|
228
198
|
});
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
|
-
const
|
|
16
|
+
const require_rolldown_runtime = require('../rolldown-runtime-Cozy-1ZF.cjs');
|
|
17
|
+
const require_error = require('../error-DcSWQLuA.cjs');
|
|
17
18
|
let valibot = require("valibot");
|
|
18
19
|
let camelcase = require("camelcase");
|
|
19
|
-
camelcase =
|
|
20
|
+
camelcase = require_rolldown_runtime.__toESM(camelcase, 1);
|
|
20
21
|
|
|
21
22
|
//#region source/headers/camelcase.ts
|
|
22
23
|
const camelcase$1 = camelcase.default.default ?? camelcase.default;
|
|
@@ -136,12 +137,12 @@ function getMissingOrEmptyHeaders(headers, requiredHeaders) {
|
|
|
136
137
|
function buildHeadersSchema(requiredHeaders) {
|
|
137
138
|
const buildSchema = () => (0, valibot.pipe)((0, valibot.string)("Expected a string value for the header"), (0, valibot.rawCheck)(({ dataset, addIssue }) => {
|
|
138
139
|
if (!dataset.typed) return;
|
|
139
|
-
const value = dataset
|
|
140
|
+
const { value } = dataset;
|
|
140
141
|
if (value.trim() === "") {
|
|
141
142
|
addIssue({
|
|
142
143
|
expected: "a non-empty string value",
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
message: "Header value cannot be empty or contain only whitespace",
|
|
145
|
+
received: `"${value}"`
|
|
145
146
|
});
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
@@ -149,8 +150,8 @@ function buildHeadersSchema(requiredHeaders) {
|
|
|
149
150
|
const parts = value.split(",").map((part) => part.trim());
|
|
150
151
|
if (!parts.some((part) => part !== "")) addIssue({
|
|
151
152
|
expected: "at least one non-empty value in comma-separated list",
|
|
152
|
-
|
|
153
|
-
|
|
153
|
+
message: "Header value contains only empty or whitespace values when split by comma",
|
|
154
|
+
received: `[${parts.join(", ")}]`
|
|
154
155
|
});
|
|
155
156
|
}
|
|
156
157
|
}));
|
|
@@ -324,8 +325,8 @@ const authorizationSchema = (0, valibot.pipe)((0, valibot.string)("Expected a st
|
|
|
324
325
|
return NEVER;
|
|
325
326
|
}
|
|
326
327
|
return {
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
parameters: authorization.slice(spaceIndex + 1).trim(),
|
|
329
|
+
scheme: authorization.slice(0, spaceIndex)
|
|
329
330
|
};
|
|
330
331
|
}));
|
|
331
332
|
/**
|
|
@@ -370,17 +371,17 @@ function parseAuthorization(authorization) {
|
|
|
370
371
|
token: parameters
|
|
371
372
|
};
|
|
372
373
|
if (scheme === "Basic") return {
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
credentials: parameters,
|
|
375
|
+
scheme: "Basic"
|
|
375
376
|
};
|
|
376
377
|
if (scheme === "OAuth") return {
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
parameters: parseKeyValueParameters(parameters),
|
|
379
|
+
scheme: "OAuth"
|
|
379
380
|
};
|
|
380
381
|
return {
|
|
381
|
-
|
|
382
|
+
parseParameters: () => parseKeyValueParameters(parameters),
|
|
382
383
|
rawParameters: parameters,
|
|
383
|
-
|
|
384
|
+
scheme
|
|
384
385
|
};
|
|
385
386
|
}
|
|
386
387
|
const bearerSchema = (0, valibot.object)({ scheme: (0, valibot.literal)("Bearer") });
|
|
@@ -15,6 +15,69 @@
|
|
|
15
15
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
16
16
|
|
|
17
17
|
//#region source/responses/helpers.ts
|
|
18
|
+
function isObjectRecord(value) {
|
|
19
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
function isHeadersRecord(value) {
|
|
22
|
+
return value === void 0 || isObjectRecord(value) && Object.values(value).every((entry) => typeof entry === "string");
|
|
23
|
+
}
|
|
24
|
+
function isBodyRecord(value) {
|
|
25
|
+
return value === void 0 || isObjectRecord(value);
|
|
26
|
+
}
|
|
27
|
+
function isResponsePayload(value) {
|
|
28
|
+
return isObjectRecord(value) && typeof value.statusCode === "number" && isBodyRecord(value.body) && isHeadersRecord(value.headers);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Determines whether a value is a standardized SDK success response.
|
|
32
|
+
*
|
|
33
|
+
* @param response - Value to inspect.
|
|
34
|
+
* @returns True when the value matches the SDK success response shape.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const result = await runAction(params);
|
|
39
|
+
* if (isSuccessResponse(result)) {
|
|
40
|
+
* console.log(result.statusCode);
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
function isSuccessResponse(response) {
|
|
45
|
+
return isObjectRecord(response) && response.type === "success" && isResponsePayload(response);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Determines whether a value is a standardized SDK error response.
|
|
49
|
+
*
|
|
50
|
+
* @param response - Value to inspect.
|
|
51
|
+
* @returns True when the value matches the SDK error response shape.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const result = await runAction(params);
|
|
56
|
+
* if (isErrorResponse(result)) {
|
|
57
|
+
* console.log(result.error.statusCode);
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
function isErrorResponse(response) {
|
|
62
|
+
return isObjectRecord(response) && response.type === "error" && isResponsePayload(response.error);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Determines whether a value is a standardized SDK action response.
|
|
66
|
+
*
|
|
67
|
+
* @param response - Value to inspect.
|
|
68
|
+
* @returns True when the value matches the SDK action response shape.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const result = await runAction(params);
|
|
73
|
+
* if (isActionResponse(result) && result.type === "success") {
|
|
74
|
+
* console.log(result.statusCode);
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
function isActionResponse(response) {
|
|
79
|
+
return isSuccessResponse(response) || isErrorResponse(response);
|
|
80
|
+
}
|
|
18
81
|
/**
|
|
19
82
|
* Creates a standardized error response for runtime actions
|
|
20
83
|
* @see https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions#unsuccessful-response
|
|
@@ -52,12 +115,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
52
115
|
*/
|
|
53
116
|
function buildErrorResponse(statusCode, payload) {
|
|
54
117
|
return {
|
|
55
|
-
type: "error",
|
|
56
118
|
error: {
|
|
57
|
-
...payload
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
119
|
+
...payload.headers && { headers: payload.headers },
|
|
120
|
+
body: payload.body,
|
|
121
|
+
statusCode
|
|
122
|
+
},
|
|
123
|
+
type: "error"
|
|
61
124
|
};
|
|
62
125
|
}
|
|
63
126
|
/**
|
|
@@ -92,8 +155,8 @@ function buildErrorResponse(statusCode, payload) {
|
|
|
92
155
|
*/
|
|
93
156
|
function buildSuccessResponse(statusCode, payload) {
|
|
94
157
|
return {
|
|
95
|
-
type: "success",
|
|
96
158
|
statusCode,
|
|
159
|
+
type: "success",
|
|
97
160
|
...payload?.headers && { headers: payload.headers },
|
|
98
161
|
...payload?.body && { body: payload.body }
|
|
99
162
|
};
|
|
@@ -201,6 +264,9 @@ exports.conflict = conflict;
|
|
|
201
264
|
exports.created = created;
|
|
202
265
|
exports.forbidden = forbidden;
|
|
203
266
|
exports.internalServerError = internalServerError;
|
|
267
|
+
exports.isActionResponse = isActionResponse;
|
|
268
|
+
exports.isErrorResponse = isErrorResponse;
|
|
269
|
+
exports.isSuccessResponse = isSuccessResponse;
|
|
204
270
|
exports.methodNotAllowed = methodNotAllowed;
|
|
205
271
|
exports.noContent = noContent;
|
|
206
272
|
exports.nonAuthoritativeInformation = nonAuthoritativeInformation;
|
|
@@ -51,6 +51,51 @@ type SuccessResponse<TBody extends BodyRecord = BodyRecord, THeaders extends Hea
|
|
|
51
51
|
* @template THeaders - Custom response headers
|
|
52
52
|
*/
|
|
53
53
|
type ActionResponse<TSuccessBody extends BodyRecord = BodyRecord, TErrorBody extends BodyRecordWithMessage = BodyRecordWithMessage, THeaders extends HeadersRecord = HeadersRecord> = SuccessResponse<TSuccessBody, THeaders> | ErrorResponse<TErrorBody, THeaders>;
|
|
54
|
+
/**
|
|
55
|
+
* Determines whether a value is a standardized SDK success response.
|
|
56
|
+
*
|
|
57
|
+
* @param response - Value to inspect.
|
|
58
|
+
* @returns True when the value matches the SDK success response shape.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const result = await runAction(params);
|
|
63
|
+
* if (isSuccessResponse(result)) {
|
|
64
|
+
* console.log(result.statusCode);
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare function isSuccessResponse(response: unknown): response is SuccessResponse;
|
|
69
|
+
/**
|
|
70
|
+
* Determines whether a value is a standardized SDK error response.
|
|
71
|
+
*
|
|
72
|
+
* @param response - Value to inspect.
|
|
73
|
+
* @returns True when the value matches the SDK error response shape.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const result = await runAction(params);
|
|
78
|
+
* if (isErrorResponse(result)) {
|
|
79
|
+
* console.log(result.error.statusCode);
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare function isErrorResponse(response: unknown): response is ErrorResponse;
|
|
84
|
+
/**
|
|
85
|
+
* Determines whether a value is a standardized SDK action response.
|
|
86
|
+
*
|
|
87
|
+
* @param response - Value to inspect.
|
|
88
|
+
* @returns True when the value matches the SDK action response shape.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const result = await runAction(params);
|
|
93
|
+
* if (isActionResponse(result) && result.type === "success") {
|
|
94
|
+
* console.log(result.statusCode);
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
declare function isActionResponse(response: unknown): response is ActionResponse;
|
|
54
99
|
/**
|
|
55
100
|
* Creates a standardized error response for runtime actions
|
|
56
101
|
* @see https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions#unsuccessful-response
|
|
@@ -142,34 +187,34 @@ declare const HTTP_INTERNAL_SERVER_ERROR = 500;
|
|
|
142
187
|
* Creates a success response with the HTTP status code 200.
|
|
143
188
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
144
189
|
*/
|
|
145
|
-
declare const ok: (payload?: string | {
|
|
146
|
-
body?:
|
|
190
|
+
declare const ok: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
191
|
+
body?: TBody;
|
|
147
192
|
headers?: HeadersRecord;
|
|
148
|
-
}) => SuccessResponse<
|
|
193
|
+
}) => SuccessResponse<TBody>;
|
|
149
194
|
/**
|
|
150
195
|
* Creates a success response with the HTTP status code 201.
|
|
151
196
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
152
197
|
*/
|
|
153
|
-
declare const created: (payload?: string | {
|
|
154
|
-
body?:
|
|
198
|
+
declare const created: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
199
|
+
body?: TBody;
|
|
155
200
|
headers?: HeadersRecord;
|
|
156
|
-
}) => SuccessResponse<
|
|
201
|
+
}) => SuccessResponse<TBody>;
|
|
157
202
|
/**
|
|
158
203
|
* Creates a success response with the HTTP status code 202.
|
|
159
204
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
160
205
|
*/
|
|
161
|
-
declare const accepted: (payload?: string | {
|
|
162
|
-
body?:
|
|
206
|
+
declare const accepted: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
207
|
+
body?: TBody;
|
|
163
208
|
headers?: HeadersRecord;
|
|
164
|
-
}) => SuccessResponse<
|
|
209
|
+
}) => SuccessResponse<TBody>;
|
|
165
210
|
/**
|
|
166
211
|
* Creates a success response with the HTTP status code 203.
|
|
167
212
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
168
213
|
*/
|
|
169
|
-
declare const nonAuthoritativeInformation: (payload?: string | {
|
|
170
|
-
body?:
|
|
214
|
+
declare const nonAuthoritativeInformation: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
215
|
+
body?: TBody;
|
|
171
216
|
headers?: HeadersRecord;
|
|
172
|
-
}) => SuccessResponse<
|
|
217
|
+
}) => SuccessResponse<TBody>;
|
|
173
218
|
/**
|
|
174
219
|
* Creates a success response with the HTTP status code 204 (No Content).
|
|
175
220
|
* This response has no body.
|
|
@@ -179,57 +224,57 @@ declare const noContent: () => SuccessResponse<BodyRecord, HeadersRecord>;
|
|
|
179
224
|
* Creates an error response with the HTTP status code 400.
|
|
180
225
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
181
226
|
*/
|
|
182
|
-
declare const badRequest: (payload: string | {
|
|
183
|
-
body:
|
|
227
|
+
declare const badRequest: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
228
|
+
body: TBody;
|
|
184
229
|
headers?: HeadersRecord;
|
|
185
|
-
}) => ErrorResponse<
|
|
230
|
+
}) => ErrorResponse<TBody>;
|
|
186
231
|
/**
|
|
187
232
|
* Creates an error response with the HTTP status code 401.
|
|
188
233
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
189
234
|
*/
|
|
190
|
-
declare const unauthorized: (payload: string | {
|
|
191
|
-
body:
|
|
235
|
+
declare const unauthorized: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
236
|
+
body: TBody;
|
|
192
237
|
headers?: HeadersRecord;
|
|
193
|
-
}) => ErrorResponse<
|
|
238
|
+
}) => ErrorResponse<TBody>;
|
|
194
239
|
/**
|
|
195
240
|
* Creates an error response with the HTTP status code 403.
|
|
196
241
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
197
242
|
*/
|
|
198
|
-
declare const forbidden: (payload: string | {
|
|
199
|
-
body:
|
|
243
|
+
declare const forbidden: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
244
|
+
body: TBody;
|
|
200
245
|
headers?: HeadersRecord;
|
|
201
|
-
}) => ErrorResponse<
|
|
246
|
+
}) => ErrorResponse<TBody>;
|
|
202
247
|
/**
|
|
203
248
|
* Creates an error response with the HTTP status code 404.
|
|
204
249
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
205
250
|
*/
|
|
206
|
-
declare const notFound: (payload: string | {
|
|
207
|
-
body:
|
|
251
|
+
declare const notFound: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
252
|
+
body: TBody;
|
|
208
253
|
headers?: HeadersRecord;
|
|
209
|
-
}) => ErrorResponse<
|
|
254
|
+
}) => ErrorResponse<TBody>;
|
|
210
255
|
/**
|
|
211
256
|
* Creates an error response with the HTTP status code 405.
|
|
212
257
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
213
258
|
*/
|
|
214
|
-
declare const methodNotAllowed: (payload: string | {
|
|
215
|
-
body:
|
|
259
|
+
declare const methodNotAllowed: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
260
|
+
body: TBody;
|
|
216
261
|
headers?: HeadersRecord;
|
|
217
|
-
}) => ErrorResponse<
|
|
262
|
+
}) => ErrorResponse<TBody>;
|
|
218
263
|
/**
|
|
219
264
|
* Creates an error response with the HTTP status code 409.
|
|
220
265
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
221
266
|
*/
|
|
222
|
-
declare const conflict: (payload: string | {
|
|
223
|
-
body:
|
|
267
|
+
declare const conflict: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
268
|
+
body: TBody;
|
|
224
269
|
headers?: HeadersRecord;
|
|
225
|
-
}) => ErrorResponse<
|
|
270
|
+
}) => ErrorResponse<TBody>;
|
|
226
271
|
/**
|
|
227
272
|
* Creates an error response with the HTTP status code 500.
|
|
228
273
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
229
274
|
*/
|
|
230
|
-
declare const internalServerError: (payload: string | {
|
|
231
|
-
body:
|
|
275
|
+
declare const internalServerError: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
276
|
+
body: TBody;
|
|
232
277
|
headers?: HeadersRecord;
|
|
233
|
-
}) => ErrorResponse<
|
|
278
|
+
}) => ErrorResponse<TBody>;
|
|
234
279
|
//#endregion
|
|
235
|
-
export { type ActionResponse, type ErrorResponse, 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, type SuccessResponse, accepted, badRequest, buildErrorResponse, buildSuccessResponse, conflict, created, forbidden, internalServerError, methodNotAllowed, noContent, nonAuthoritativeInformation, notFound, ok, unauthorized };
|
|
280
|
+
export { type ActionResponse, type ErrorResponse, 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, type SuccessResponse, accepted, badRequest, buildErrorResponse, buildSuccessResponse, conflict, created, forbidden, internalServerError, isActionResponse, isErrorResponse, isSuccessResponse, methodNotAllowed, noContent, nonAuthoritativeInformation, notFound, ok, unauthorized };
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
//#region \0rolldown/runtime.js
|
|
16
|
+
var __create = Object.create;
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
20
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
21
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
|
+
var __copyProps = (to, from, except, desc) => {
|
|
23
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
25
|
+
key = keys[i];
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
27
|
+
__defProp(to, key, {
|
|
28
|
+
get: ((k) => from[k]).bind(null, key),
|
|
29
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
37
|
+
value: mod,
|
|
38
|
+
enumerable: true
|
|
39
|
+
}) : target, mod));
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
|
|
43
|
+
Object.defineProperty(exports, '__toESM', {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return __toESM;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
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 * as v from "valibot";
|
|
16
|
+
|
|
17
|
+
//#region source/commerce/env.d.ts
|
|
18
|
+
/** The list of supported Commerce environments an item can be scoped to. */
|
|
19
|
+
declare const COMMERCE_ENVS: ["paas", "saas"];
|
|
20
|
+
/** A single Commerce environment an item can be scoped to. */
|
|
21
|
+
type CommerceEnv = (typeof COMMERCE_ENVS)[number];
|
|
22
|
+
/** Schema for a single Commerce environment an item can be scoped to. */
|
|
23
|
+
declare const CommerceEnvSchema: v.PicklistSchema<["paas", "saas"], `Expected one of: ${string}`>;
|
|
24
|
+
/**
|
|
25
|
+
* Schema for a non-empty array of Commerce environments, used to scope an item
|
|
26
|
+
* (a configuration field, webhook, or event) to specific environments.
|
|
27
|
+
*
|
|
28
|
+
* Apply the optional wrapper at the call site (`v.optional(CommerceEnvArraySchema)`);
|
|
29
|
+
* when omitted, the item applies to all environments.
|
|
30
|
+
*/
|
|
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 };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 * as v from "valibot";
|
|
16
|
+
|
|
17
|
+
//#region source/commerce/env.ts
|
|
18
|
+
/** The list of supported Commerce environments an item can be scoped to. */
|
|
19
|
+
const COMMERCE_ENVS = ["paas", "saas"];
|
|
20
|
+
/** Schema for a single Commerce environment an item can be scoped to. */
|
|
21
|
+
const CommerceEnvSchema = v.picklist(COMMERCE_ENVS, `Expected one of: ${COMMERCE_ENVS.map((e) => `"${e}"`).join(", ")}`);
|
|
22
|
+
/**
|
|
23
|
+
* Schema for a non-empty array of Commerce environments, used to scope an item
|
|
24
|
+
* (a configuration field, webhook, or event) to specific environments.
|
|
25
|
+
*
|
|
26
|
+
* Apply the optional wrapper at the call site (`v.optional(CommerceEnvArraySchema)`);
|
|
27
|
+
* when omitted, the item applies to all environments.
|
|
28
|
+
*/
|
|
29
|
+
const CommerceEnvArraySchema = v.pipe(v.array(CommerceEnvSchema, "Expected an array of commerce environments for the field \"env\""), v.nonEmpty("The \"env\" array must contain at least one commerce environment"));
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { COMMERCE_ENVS, CommerceEnvArraySchema, CommerceEnvSchema };
|
|
@@ -78,10 +78,10 @@ declare abstract class CommerceSdkErrorBase extends Error {
|
|
|
78
78
|
get rootCause(): unknown;
|
|
79
79
|
/** Converts the error to a JSON-like representation. */
|
|
80
80
|
toJSON(): {
|
|
81
|
-
|
|
81
|
+
cause: unknown;
|
|
82
82
|
message: string;
|
|
83
|
+
name: string;
|
|
83
84
|
stack: string;
|
|
84
|
-
cause: unknown;
|
|
85
85
|
traceId: string | undefined;
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
@@ -130,4 +130,4 @@ declare class CommerceSdkValidationError extends CommerceSdkErrorBase {
|
|
|
130
130
|
display(withColor?: boolean): string;
|
|
131
131
|
}
|
|
132
132
|
//#endregion
|
|
133
|
-
export { CommerceSdkErrorBase, CommerceSdkValidationError };
|
|
133
|
+
export { CommerceSdkErrorBase, type CommerceSdkErrorBaseOptions, type CommerceSdkErrorOptions, CommerceSdkValidationError };
|
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 CommerceSdkErrorBase, t as CommerceSdkValidationError } from "../error-
|
|
15
|
+
import { n as CommerceSdkErrorBase, t as CommerceSdkValidationError } from "../error-hJtCYFBx.mjs";
|
|
16
16
|
|
|
17
17
|
export { CommerceSdkErrorBase, CommerceSdkValidationError };
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { getDotPath } from "valibot";
|
|
15
16
|
import util from "util";
|
|
16
17
|
import { cyanBright, dim, whiteBright, yellowBright } from "ansis";
|
|
17
|
-
import { getDotPath } from "valibot";
|
|
18
18
|
|
|
19
19
|
//#region source/error/base-error.ts
|
|
20
20
|
/**
|
|
@@ -37,6 +37,7 @@ import { getDotPath } from "valibot";
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
40
|
+
traceId;
|
|
40
41
|
/**
|
|
41
42
|
* Constructs a new CommerceSdkErrorBase instance. This is an abstract class so you
|
|
42
43
|
* should not instantiate it directly. Only invoke this constructor from a subclass.
|
|
@@ -70,27 +71,27 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
|
70
71
|
/** Returns the full stack trace of the error and its causes. */
|
|
71
72
|
get fullStack() {
|
|
72
73
|
let out = this.stack ?? "";
|
|
73
|
-
let cause = this
|
|
74
|
+
let { cause } = this;
|
|
74
75
|
while (cause instanceof Error) {
|
|
75
76
|
out += `\nCaused by: ${cause.stack ?? cause.message}`;
|
|
76
|
-
cause = cause
|
|
77
|
+
({cause} = cause);
|
|
77
78
|
}
|
|
78
79
|
return out;
|
|
79
80
|
}
|
|
80
81
|
/** Returns the root cause of the error. */
|
|
81
82
|
get rootCause() {
|
|
82
|
-
let cause = this
|
|
83
|
-
while (cause) if (typeof cause === "object" && cause !== null && "cause" in cause) cause = cause
|
|
83
|
+
let { cause } = this;
|
|
84
|
+
while (cause) if (typeof cause === "object" && cause !== null && "cause" in cause) ({cause} = cause);
|
|
84
85
|
else break;
|
|
85
86
|
return cause;
|
|
86
87
|
}
|
|
87
88
|
/** Converts the error to a JSON-like representation. */
|
|
88
89
|
toJSON() {
|
|
89
90
|
return {
|
|
90
|
-
|
|
91
|
+
cause: this.cause,
|
|
91
92
|
message: this.message,
|
|
93
|
+
name: this.name,
|
|
92
94
|
stack: this.fullStack,
|
|
93
|
-
cause: this.cause,
|
|
94
95
|
traceId: this.traceId
|
|
95
96
|
};
|
|
96
97
|
}
|
|
@@ -100,10 +101,10 @@ var CommerceSdkErrorBase = class CommerceSdkErrorBase extends Error {
|
|
|
100
101
|
*/
|
|
101
102
|
toString(inspect = true) {
|
|
102
103
|
if (inspect) return util.inspect(this, {
|
|
103
|
-
depth: null,
|
|
104
104
|
colors: true,
|
|
105
|
-
|
|
106
|
-
maxStringLength: Number.POSITIVE_INFINITY
|
|
105
|
+
depth: null,
|
|
106
|
+
maxStringLength: Number.POSITIVE_INFINITY,
|
|
107
|
+
sorted: true
|
|
107
108
|
});
|
|
108
109
|
return super.toString();
|
|
109
110
|
}
|
|
@@ -160,6 +161,7 @@ function displayValidationError(error, withColor = true) {
|
|
|
160
161
|
* ```
|
|
161
162
|
*/
|
|
162
163
|
var CommerceSdkValidationError = class extends CommerceSdkErrorBase {
|
|
164
|
+
issues;
|
|
163
165
|
/**
|
|
164
166
|
* Constructs a new {@link CommerceSdkValidationError} instance.
|
|
165
167
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { t as CommerceSdkValidationError } from "../error-
|
|
15
|
+
import { t as CommerceSdkValidationError } from "../error-hJtCYFBx.mjs";
|
|
16
16
|
import { literal, nonEmpty, object, pipe, rawCheck, rawTransform, record, safeParse, string, trim, undefined as undefined$1, union } from "valibot";
|
|
17
17
|
import * as camelcaseModule from "camelcase";
|
|
18
18
|
|
|
@@ -134,12 +134,12 @@ function getMissingOrEmptyHeaders(headers, requiredHeaders) {
|
|
|
134
134
|
function buildHeadersSchema(requiredHeaders) {
|
|
135
135
|
const buildSchema = () => pipe(string("Expected a string value for the header"), rawCheck(({ dataset, addIssue }) => {
|
|
136
136
|
if (!dataset.typed) return;
|
|
137
|
-
const value = dataset
|
|
137
|
+
const { value } = dataset;
|
|
138
138
|
if (value.trim() === "") {
|
|
139
139
|
addIssue({
|
|
140
140
|
expected: "a non-empty string value",
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
message: "Header value cannot be empty or contain only whitespace",
|
|
142
|
+
received: `"${value}"`
|
|
143
143
|
});
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -147,8 +147,8 @@ function buildHeadersSchema(requiredHeaders) {
|
|
|
147
147
|
const parts = value.split(",").map((part) => part.trim());
|
|
148
148
|
if (!parts.some((part) => part !== "")) addIssue({
|
|
149
149
|
expected: "at least one non-empty value in comma-separated list",
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
message: "Header value contains only empty or whitespace values when split by comma",
|
|
151
|
+
received: `[${parts.join(", ")}]`
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
}));
|
|
@@ -322,8 +322,8 @@ const authorizationSchema = pipe(string("Expected a string value"), trim(), nonE
|
|
|
322
322
|
return NEVER;
|
|
323
323
|
}
|
|
324
324
|
return {
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
parameters: authorization.slice(spaceIndex + 1).trim(),
|
|
326
|
+
scheme: authorization.slice(0, spaceIndex)
|
|
327
327
|
};
|
|
328
328
|
}));
|
|
329
329
|
/**
|
|
@@ -368,17 +368,17 @@ function parseAuthorization(authorization) {
|
|
|
368
368
|
token: parameters
|
|
369
369
|
};
|
|
370
370
|
if (scheme === "Basic") return {
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
credentials: parameters,
|
|
372
|
+
scheme: "Basic"
|
|
373
373
|
};
|
|
374
374
|
if (scheme === "OAuth") return {
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
parameters: parseKeyValueParameters(parameters),
|
|
376
|
+
scheme: "OAuth"
|
|
377
377
|
};
|
|
378
378
|
return {
|
|
379
|
-
|
|
379
|
+
parseParameters: () => parseKeyValueParameters(parameters),
|
|
380
380
|
rawParameters: parameters,
|
|
381
|
-
|
|
381
|
+
scheme
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
const bearerSchema = object({ scheme: literal("Bearer") });
|
|
@@ -51,6 +51,51 @@ type SuccessResponse<TBody extends BodyRecord = BodyRecord, THeaders extends Hea
|
|
|
51
51
|
* @template THeaders - Custom response headers
|
|
52
52
|
*/
|
|
53
53
|
type ActionResponse<TSuccessBody extends BodyRecord = BodyRecord, TErrorBody extends BodyRecordWithMessage = BodyRecordWithMessage, THeaders extends HeadersRecord = HeadersRecord> = SuccessResponse<TSuccessBody, THeaders> | ErrorResponse<TErrorBody, THeaders>;
|
|
54
|
+
/**
|
|
55
|
+
* Determines whether a value is a standardized SDK success response.
|
|
56
|
+
*
|
|
57
|
+
* @param response - Value to inspect.
|
|
58
|
+
* @returns True when the value matches the SDK success response shape.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const result = await runAction(params);
|
|
63
|
+
* if (isSuccessResponse(result)) {
|
|
64
|
+
* console.log(result.statusCode);
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare function isSuccessResponse(response: unknown): response is SuccessResponse;
|
|
69
|
+
/**
|
|
70
|
+
* Determines whether a value is a standardized SDK error response.
|
|
71
|
+
*
|
|
72
|
+
* @param response - Value to inspect.
|
|
73
|
+
* @returns True when the value matches the SDK error response shape.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const result = await runAction(params);
|
|
78
|
+
* if (isErrorResponse(result)) {
|
|
79
|
+
* console.log(result.error.statusCode);
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
declare function isErrorResponse(response: unknown): response is ErrorResponse;
|
|
84
|
+
/**
|
|
85
|
+
* Determines whether a value is a standardized SDK action response.
|
|
86
|
+
*
|
|
87
|
+
* @param response - Value to inspect.
|
|
88
|
+
* @returns True when the value matches the SDK action response shape.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const result = await runAction(params);
|
|
93
|
+
* if (isActionResponse(result) && result.type === "success") {
|
|
94
|
+
* console.log(result.statusCode);
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
declare function isActionResponse(response: unknown): response is ActionResponse;
|
|
54
99
|
/**
|
|
55
100
|
* Creates a standardized error response for runtime actions
|
|
56
101
|
* @see https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions#unsuccessful-response
|
|
@@ -142,34 +187,34 @@ declare const HTTP_INTERNAL_SERVER_ERROR = 500;
|
|
|
142
187
|
* Creates a success response with the HTTP status code 200.
|
|
143
188
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
144
189
|
*/
|
|
145
|
-
declare const ok: (payload?: string | {
|
|
146
|
-
body?:
|
|
190
|
+
declare const ok: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
191
|
+
body?: TBody;
|
|
147
192
|
headers?: HeadersRecord;
|
|
148
|
-
}) => SuccessResponse<
|
|
193
|
+
}) => SuccessResponse<TBody>;
|
|
149
194
|
/**
|
|
150
195
|
* Creates a success response with the HTTP status code 201.
|
|
151
196
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
152
197
|
*/
|
|
153
|
-
declare const created: (payload?: string | {
|
|
154
|
-
body?:
|
|
198
|
+
declare const created: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
199
|
+
body?: TBody;
|
|
155
200
|
headers?: HeadersRecord;
|
|
156
|
-
}) => SuccessResponse<
|
|
201
|
+
}) => SuccessResponse<TBody>;
|
|
157
202
|
/**
|
|
158
203
|
* Creates a success response with the HTTP status code 202.
|
|
159
204
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
160
205
|
*/
|
|
161
|
-
declare const accepted: (payload?: string | {
|
|
162
|
-
body?:
|
|
206
|
+
declare const accepted: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
207
|
+
body?: TBody;
|
|
163
208
|
headers?: HeadersRecord;
|
|
164
|
-
}) => SuccessResponse<
|
|
209
|
+
}) => SuccessResponse<TBody>;
|
|
165
210
|
/**
|
|
166
211
|
* Creates a success response with the HTTP status code 203.
|
|
167
212
|
* See {@link buildSuccessResponse} for details on the response payload.
|
|
168
213
|
*/
|
|
169
|
-
declare const nonAuthoritativeInformation: (payload?: string | {
|
|
170
|
-
body?:
|
|
214
|
+
declare const nonAuthoritativeInformation: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
|
|
215
|
+
body?: TBody;
|
|
171
216
|
headers?: HeadersRecord;
|
|
172
|
-
}) => SuccessResponse<
|
|
217
|
+
}) => SuccessResponse<TBody>;
|
|
173
218
|
/**
|
|
174
219
|
* Creates a success response with the HTTP status code 204 (No Content).
|
|
175
220
|
* This response has no body.
|
|
@@ -179,57 +224,57 @@ declare const noContent: () => SuccessResponse<BodyRecord, HeadersRecord>;
|
|
|
179
224
|
* Creates an error response with the HTTP status code 400.
|
|
180
225
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
181
226
|
*/
|
|
182
|
-
declare const badRequest: (payload: string | {
|
|
183
|
-
body:
|
|
227
|
+
declare const badRequest: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
228
|
+
body: TBody;
|
|
184
229
|
headers?: HeadersRecord;
|
|
185
|
-
}) => ErrorResponse<
|
|
230
|
+
}) => ErrorResponse<TBody>;
|
|
186
231
|
/**
|
|
187
232
|
* Creates an error response with the HTTP status code 401.
|
|
188
233
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
189
234
|
*/
|
|
190
|
-
declare const unauthorized: (payload: string | {
|
|
191
|
-
body:
|
|
235
|
+
declare const unauthorized: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
236
|
+
body: TBody;
|
|
192
237
|
headers?: HeadersRecord;
|
|
193
|
-
}) => ErrorResponse<
|
|
238
|
+
}) => ErrorResponse<TBody>;
|
|
194
239
|
/**
|
|
195
240
|
* Creates an error response with the HTTP status code 403.
|
|
196
241
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
197
242
|
*/
|
|
198
|
-
declare const forbidden: (payload: string | {
|
|
199
|
-
body:
|
|
243
|
+
declare const forbidden: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
244
|
+
body: TBody;
|
|
200
245
|
headers?: HeadersRecord;
|
|
201
|
-
}) => ErrorResponse<
|
|
246
|
+
}) => ErrorResponse<TBody>;
|
|
202
247
|
/**
|
|
203
248
|
* Creates an error response with the HTTP status code 404.
|
|
204
249
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
205
250
|
*/
|
|
206
|
-
declare const notFound: (payload: string | {
|
|
207
|
-
body:
|
|
251
|
+
declare const notFound: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
252
|
+
body: TBody;
|
|
208
253
|
headers?: HeadersRecord;
|
|
209
|
-
}) => ErrorResponse<
|
|
254
|
+
}) => ErrorResponse<TBody>;
|
|
210
255
|
/**
|
|
211
256
|
* Creates an error response with the HTTP status code 405.
|
|
212
257
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
213
258
|
*/
|
|
214
|
-
declare const methodNotAllowed: (payload: string | {
|
|
215
|
-
body:
|
|
259
|
+
declare const methodNotAllowed: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
260
|
+
body: TBody;
|
|
216
261
|
headers?: HeadersRecord;
|
|
217
|
-
}) => ErrorResponse<
|
|
262
|
+
}) => ErrorResponse<TBody>;
|
|
218
263
|
/**
|
|
219
264
|
* Creates an error response with the HTTP status code 409.
|
|
220
265
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
221
266
|
*/
|
|
222
|
-
declare const conflict: (payload: string | {
|
|
223
|
-
body:
|
|
267
|
+
declare const conflict: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
268
|
+
body: TBody;
|
|
224
269
|
headers?: HeadersRecord;
|
|
225
|
-
}) => ErrorResponse<
|
|
270
|
+
}) => ErrorResponse<TBody>;
|
|
226
271
|
/**
|
|
227
272
|
* Creates an error response with the HTTP status code 500.
|
|
228
273
|
* See {@link buildErrorResponse} for details on the response payload.
|
|
229
274
|
*/
|
|
230
|
-
declare const internalServerError: (payload: string | {
|
|
231
|
-
body:
|
|
275
|
+
declare const internalServerError: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
|
|
276
|
+
body: TBody;
|
|
232
277
|
headers?: HeadersRecord;
|
|
233
|
-
}) => ErrorResponse<
|
|
278
|
+
}) => ErrorResponse<TBody>;
|
|
234
279
|
//#endregion
|
|
235
|
-
export { type ActionResponse, type ErrorResponse, 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, type SuccessResponse, accepted, badRequest, buildErrorResponse, buildSuccessResponse, conflict, created, forbidden, internalServerError, methodNotAllowed, noContent, nonAuthoritativeInformation, notFound, ok, unauthorized };
|
|
280
|
+
export { type ActionResponse, type ErrorResponse, 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, type SuccessResponse, accepted, badRequest, buildErrorResponse, buildSuccessResponse, conflict, created, forbidden, internalServerError, isActionResponse, isErrorResponse, isSuccessResponse, methodNotAllowed, noContent, nonAuthoritativeInformation, notFound, ok, unauthorized };
|
|
@@ -13,6 +13,69 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
//#region source/responses/helpers.ts
|
|
16
|
+
function isObjectRecord(value) {
|
|
17
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
function isHeadersRecord(value) {
|
|
20
|
+
return value === void 0 || isObjectRecord(value) && Object.values(value).every((entry) => typeof entry === "string");
|
|
21
|
+
}
|
|
22
|
+
function isBodyRecord(value) {
|
|
23
|
+
return value === void 0 || isObjectRecord(value);
|
|
24
|
+
}
|
|
25
|
+
function isResponsePayload(value) {
|
|
26
|
+
return isObjectRecord(value) && typeof value.statusCode === "number" && isBodyRecord(value.body) && isHeadersRecord(value.headers);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Determines whether a value is a standardized SDK success response.
|
|
30
|
+
*
|
|
31
|
+
* @param response - Value to inspect.
|
|
32
|
+
* @returns True when the value matches the SDK success response shape.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const result = await runAction(params);
|
|
37
|
+
* if (isSuccessResponse(result)) {
|
|
38
|
+
* console.log(result.statusCode);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function isSuccessResponse(response) {
|
|
43
|
+
return isObjectRecord(response) && response.type === "success" && isResponsePayload(response);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Determines whether a value is a standardized SDK error response.
|
|
47
|
+
*
|
|
48
|
+
* @param response - Value to inspect.
|
|
49
|
+
* @returns True when the value matches the SDK error response shape.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const result = await runAction(params);
|
|
54
|
+
* if (isErrorResponse(result)) {
|
|
55
|
+
* console.log(result.error.statusCode);
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
function isErrorResponse(response) {
|
|
60
|
+
return isObjectRecord(response) && response.type === "error" && isResponsePayload(response.error);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Determines whether a value is a standardized SDK action response.
|
|
64
|
+
*
|
|
65
|
+
* @param response - Value to inspect.
|
|
66
|
+
* @returns True when the value matches the SDK action response shape.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const result = await runAction(params);
|
|
71
|
+
* if (isActionResponse(result) && result.type === "success") {
|
|
72
|
+
* console.log(result.statusCode);
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function isActionResponse(response) {
|
|
77
|
+
return isSuccessResponse(response) || isErrorResponse(response);
|
|
78
|
+
}
|
|
16
79
|
/**
|
|
17
80
|
* Creates a standardized error response for runtime actions
|
|
18
81
|
* @see https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions#unsuccessful-response
|
|
@@ -50,12 +113,12 @@
|
|
|
50
113
|
*/
|
|
51
114
|
function buildErrorResponse(statusCode, payload) {
|
|
52
115
|
return {
|
|
53
|
-
type: "error",
|
|
54
116
|
error: {
|
|
55
|
-
...payload
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
117
|
+
...payload.headers && { headers: payload.headers },
|
|
118
|
+
body: payload.body,
|
|
119
|
+
statusCode
|
|
120
|
+
},
|
|
121
|
+
type: "error"
|
|
59
122
|
};
|
|
60
123
|
}
|
|
61
124
|
/**
|
|
@@ -90,8 +153,8 @@ function buildErrorResponse(statusCode, payload) {
|
|
|
90
153
|
*/
|
|
91
154
|
function buildSuccessResponse(statusCode, payload) {
|
|
92
155
|
return {
|
|
93
|
-
type: "success",
|
|
94
156
|
statusCode,
|
|
157
|
+
type: "success",
|
|
95
158
|
...payload?.headers && { headers: payload.headers },
|
|
96
159
|
...payload?.body && { body: payload.body }
|
|
97
160
|
};
|
|
@@ -179,4 +242,4 @@ const conflict = curryBuildErrorResponse(409);
|
|
|
179
242
|
const internalServerError = curryBuildErrorResponse(500);
|
|
180
243
|
|
|
181
244
|
//#endregion
|
|
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 };
|
|
245
|
+
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, isActionResponse, isErrorResponse, isSuccessResponse, methodNotAllowed, noContent, nonAuthoritativeInformation, notFound, ok, unauthorized };
|