@adobe/aio-commerce-lib-app 1.0.2 → 1.2.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/cjs/actions/app-config.cjs +18 -4
  3. package/dist/cjs/actions/app-config.d.cts +17 -3
  4. package/dist/cjs/actions/config.cjs +17 -3
  5. package/dist/cjs/actions/config.d.cts +16 -2
  6. package/dist/cjs/actions/installation.cjs +70 -16
  7. package/dist/cjs/actions/installation.d.cts +18 -4
  8. package/dist/cjs/actions/scope-tree.cjs +17 -3
  9. package/dist/cjs/actions/scope-tree.d.cts +17 -3
  10. package/dist/cjs/{app-DWX5-Hsf.d.cts → app-DcQMhW2N.d.cts} +159 -2
  11. package/dist/cjs/commands/index.cjs +41 -27
  12. package/dist/cjs/commands/index.d.cts +14 -0
  13. package/dist/cjs/config/index.cjs +27 -12
  14. package/dist/cjs/config/index.d.cts +614 -6
  15. package/dist/cjs/{parser-BPpg_9QB.cjs → config-BppBKCFj.cjs} +17 -3
  16. package/dist/cjs/error-Dn7ool6k.cjs +38 -0
  17. package/dist/{es/runner-BD-lItnK.d.mts → cjs/index-DZxladgt.d.cts} +122 -9
  18. package/dist/cjs/logging-4s36JTiN.cjs +39 -0
  19. package/dist/cjs/management/index.cjs +23 -8
  20. package/dist/cjs/management/index.d.cts +16 -2
  21. package/dist/cjs/{runner-NHMvoMO2.cjs → management-iLQubQ7K.cjs} +462 -48
  22. package/dist/cjs/{router-DCw7oEQ9.cjs → router-KeQRduO3.cjs} +15 -1
  23. package/dist/cjs/{schemas-CZ6c8Id9.cjs → schemas-nkIxa8sL.cjs} +34 -0
  24. package/dist/cjs/{validate-Btzn9ilZ.cjs → validate-CeUCT_7k.cjs} +36 -15
  25. package/dist/cjs/{installation-CLbceU9F.cjs → webhooks-CLtDxwMa.cjs} +138 -1
  26. package/dist/es/actions/app-config.d.mts +17 -3
  27. package/dist/es/actions/app-config.mjs +17 -3
  28. package/dist/es/actions/config.d.mts +16 -2
  29. package/dist/es/actions/config.mjs +17 -3
  30. package/dist/es/actions/installation.d.mts +18 -4
  31. package/dist/es/actions/installation.mjs +64 -10
  32. package/dist/es/actions/scope-tree.d.mts +17 -3
  33. package/dist/es/actions/scope-tree.mjs +17 -3
  34. package/dist/es/{app-BAiyvNo2.d.mts → app-DJr-mN9d.d.mts} +159 -2
  35. package/dist/es/commands/index.d.mts +14 -0
  36. package/dist/es/commands/index.mjs +21 -7
  37. package/dist/es/config/index.d.mts +614 -6
  38. package/dist/es/config/index.mjs +18 -4
  39. package/dist/es/{parser-CQZTVG6i.mjs → config-BohwKkQS.mjs} +16 -2
  40. package/dist/es/error-DHlYzkbb.mjs +32 -0
  41. package/dist/{cjs/runner-DemKouFJ.d.cts → es/index-BmYXe7kp.d.mts} +122 -9
  42. package/dist/es/logging-XIUXDK5T.mjs +32 -0
  43. package/dist/es/management/index.d.mts +16 -2
  44. package/dist/es/management/index.mjs +16 -2
  45. package/dist/es/{runner-vwAhjD5r.mjs → management-DSexEPTW.mjs} +451 -43
  46. package/dist/es/{router-CJ4VWoCt.mjs → router-BxaxEEu3.mjs} +14 -0
  47. package/dist/es/{schemas-B8yIv0_b.mjs → schemas-CVXHgUhv.mjs} +29 -1
  48. package/dist/es/{validate-DKnju9-R.mjs → validate-CqJdGzyZ.mjs} +27 -6
  49. package/dist/es/{installation-BTL9X7iv.mjs → webhooks-CYo-pqbR.mjs} +115 -2
  50. package/package.json +12 -8
  51. package/dist/cjs/error-DJ2UAPH2.cjs +0 -24
  52. package/dist/cjs/logging-IDRQG0as.cjs +0 -25
  53. package/dist/es/error-CMV3IjBz.mjs +0 -18
  54. package/dist/es/logging-CzmXDzxI.mjs +0 -18
@@ -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 * as v from "valibot";
2
16
 
3
17
  //#region ../../packages-private/common-utils/source/valibot/schemas.ts
@@ -7,6 +21,20 @@ const ALPHANUMERIC_OR_HYPHEN_REGEX = {
7
21
  uppercase: /^[A-Z0-9-]+$/
8
22
  };
9
23
  /**
24
+ * A schema for a number value.
25
+ * @param name The name of the field this schema refers to.
26
+ */
27
+ function numberValueSchema(name) {
28
+ return v.number(`Expected a number value for '${name}'`);
29
+ }
30
+ /**
31
+ * A schema for a positive number value (including zero).
32
+ * @param name The name of the field this schema refers to.
33
+ */
34
+ function positiveNumberValueSchema(name) {
35
+ return v.pipe(numberValueSchema(name), v.minValue(0, `The value of ${name} must be a non-negative number`));
36
+ }
37
+ /**
10
38
  * A schema for a string value.
11
39
  * @param name The name of the field this schema refers to.
12
40
  */
@@ -38,4 +66,4 @@ function alphaNumericOrHyphenSchema(name, casing = "any") {
38
66
  }
39
67
 
40
68
  //#endregion
41
- export { stringValueSchema as i, booleanValueSchema as n, nonEmptyStringValueSchema as r, alphaNumericOrHyphenSchema as t };
69
+ export { stringValueSchema as a, positiveNumberValueSchema as i, booleanValueSchema as n, nonEmptyStringValueSchema as r, alphaNumericOrHyphenSchema as t };
@@ -1,5 +1,19 @@
1
- import { t as alphaNumericOrHyphenSchema } from "./schemas-B8yIv0_b.mjs";
2
- import { a as hasCommerceEvents, i as EventingSchema, n as hasCustomInstallation, r as hasCustomInstallationSteps, s as hasExternalEvents, t as InstallationSchema } from "./installation-BTL9X7iv.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 hasCustomInstallationSteps, d as hasAdminUiSdk, i as hasCustomInstallation, l as hasExternalEvents, n as hasWebhooks, o as EventingSchema, r as InstallationSchema, s as hasCommerceEvents, t as WebhooksSchema, u as AdminUiSdkSchema } from "./webhooks-CYo-pqbR.mjs";
16
+ import { t as alphaNumericOrHyphenSchema } from "./schemas-CVXHgUhv.mjs";
3
17
  import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
4
18
  import * as v from "valibot";
5
19
  import { SchemaBusinessConfig } from "@adobe/aio-commerce-lib-config";
@@ -22,6 +36,7 @@ function hasBusinessConfigSchema(config) {
22
36
 
23
37
  //#endregion
24
38
  //#region source/config/schema/metadata.ts
39
+ const MAX_ID_LENGTH = 100;
25
40
  const MAX_DESCRIPTION_LENGTH = 255;
26
41
  const MAX_DISPLAY_NAME_LENGTH = 50;
27
42
  const NUMERIC_IDENTIFIER = "(0|[1-9]\\d*)";
@@ -31,10 +46,10 @@ function nonEmptyString(fieldName) {
31
46
  }
32
47
  /** The schema for the metadata of the application. */
33
48
  const MetadataSchema = v.object({
34
- id: alphaNumericOrHyphenSchema("application id (metadata.id)"),
49
+ id: v.pipe(alphaNumericOrHyphenSchema("application id (metadata.id)"), v.maxLength(MAX_ID_LENGTH, `The application id must not be longer than ${MAX_ID_LENGTH} characters`)),
35
50
  displayName: v.pipe(nonEmptyString("application display name"), v.maxLength(MAX_DISPLAY_NAME_LENGTH, `The application display name must not be longer than ${MAX_DISPLAY_NAME_LENGTH} characters`)),
36
51
  description: v.pipe(nonEmptyString("metadata description"), v.maxLength(MAX_DESCRIPTION_LENGTH, `The metadata description must not be longer than ${MAX_DESCRIPTION_LENGTH} characters`)),
37
- version: v.pipe(nonEmptyString("version"), v.regex(SEMVER_REGEX, "The version must follow semantic versioning (semver) format"))
52
+ version: v.pipe(nonEmptyString("version"), v.regex(SEMVER_REGEX, "The version must follow semantic versioning (semver) format: Major.Minor.Patch (e.g., '1.0.0', '2.3.1')"))
38
53
  });
39
54
  /**
40
55
  * Check if config has metadata.
@@ -52,7 +67,9 @@ const CommerceAppConfigSchema = v.looseObject({
52
67
  metadata: MetadataSchema,
53
68
  businessConfig: v.optional(SchemaBusinessConfig),
54
69
  eventing: v.optional(EventingSchema),
55
- installation: v.optional(InstallationSchema)
70
+ adminUiSdk: v.optional(AdminUiSdkSchema),
71
+ installation: v.optional(InstallationSchema),
72
+ webhooks: v.optional(WebhooksSchema)
56
73
  });
57
74
 
58
75
  //#endregion
@@ -63,10 +80,12 @@ const CommerceAppConfigSchemas = {
63
80
  businessConfig: SchemaBusinessConfig,
64
81
  eventing: EventingSchema,
65
82
  installation: InstallationSchema,
83
+ webhooks: WebhooksSchema,
66
84
  "businessConfig.schema": v.unwrap(SchemaBusinessConfig.entries.schema),
67
85
  "eventing.commerce": v.unwrap(EventingSchema.entries.commerce),
68
86
  "eventing.external": v.unwrap(EventingSchema.entries.external),
69
- "installation.customInstallationSteps": v.unwrap(InstallationSchema.entries.customInstallationSteps)
87
+ "installation.customInstallationSteps": v.unwrap(InstallationSchema.entries.customInstallationSteps),
88
+ adminUiSdk: AdminUiSdkSchema
70
89
  };
71
90
  /**
72
91
  * Get the config domains that are present in the config.
@@ -80,6 +99,8 @@ function getConfigDomains(config) {
80
99
  businessConfig: hasBusinessConfig(config),
81
100
  eventing: withCommerceEvents || withExternalEvents,
82
101
  installation: hasCustomInstallation(config),
102
+ webhooks: hasWebhooks(config),
103
+ adminUiSdk: hasAdminUiSdk(config),
83
104
  "businessConfig.schema": hasBusinessConfigSchema(config),
84
105
  "eventing.commerce": withCommerceEvents,
85
106
  "eventing.external": withExternalEvents,
@@ -1,6 +1,41 @@
1
- import { i as stringValueSchema, n as booleanValueSchema, r as nonEmptyStringValueSchema, t as alphaNumericOrHyphenSchema } from "./schemas-B8yIv0_b.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 stringValueSchema, i as positiveNumberValueSchema, n as booleanValueSchema, r as nonEmptyStringValueSchema, t as alphaNumericOrHyphenSchema } from "./schemas-CVXHgUhv.mjs";
2
16
  import * as v from "valibot";
3
17
 
18
+ //#region source/config/schema/admin-ui-sdk.ts
19
+ /**
20
+ * Schema for the Admin UI SDK registration parameters (for the `adminUiSdk.registration` config section).
21
+ * @see https://developer.adobe.com/commerce/extensibility/admin-ui-sdk/extension-points/ for more details.
22
+ */
23
+ const AdminUiSdkRegistrationSchema = v.object({ menuItems: v.array(v.object({
24
+ id: v.string(),
25
+ title: v.optional(v.string()),
26
+ parent: v.optional(v.string()),
27
+ sortOrder: v.optional(v.number()),
28
+ sandbox: v.optional(v.string()),
29
+ isSection: v.optional(v.boolean())
30
+ })) });
31
+ /** Schema for Admin UI SDK configuration. */
32
+ const AdminUiSdkSchema = v.object({ registration: AdminUiSdkRegistrationSchema });
33
+ /** Check if config has Admin UI SDK registration configuration. */
34
+ function hasAdminUiSdk(config) {
35
+ return config.adminUiSdk !== void 0 && config.adminUiSdk.registration !== void 0;
36
+ }
37
+
38
+ //#endregion
4
39
  //#region source/config/schema/eventing.ts
5
40
  const MAX_DESCRIPTION_LENGTH$1 = 255;
6
41
  const MAX_LABEL_LENGTH = 100;
@@ -198,4 +233,82 @@ function hasCustomInstallationSteps(config) {
198
233
  }
199
234
 
200
235
  //#endregion
201
- export { hasCommerceEvents as a, EventingSchema as i, hasCustomInstallation as n, hasEventing as o, hasCustomInstallationSteps as r, hasExternalEvents as s, InstallationSchema as t };
236
+ //#region source/config/schema/webhooks.ts
237
+ /** Schema for webhook field configuration (name and optional source). */
238
+ const WebhookFieldSchema = v.object({
239
+ name: nonEmptyStringValueSchema("field name"),
240
+ source: v.optional(stringValueSchema("field source"))
241
+ });
242
+ /** Schema for webhook rule configuration (field, operator, value). */
243
+ const WebhookRuleSchema = v.object({
244
+ field: nonEmptyStringValueSchema("rule field"),
245
+ operator: nonEmptyStringValueSchema("rule operator"),
246
+ value: nonEmptyStringValueSchema("rule value")
247
+ });
248
+ /** Schema for webhook header configuration (name, value). */
249
+ const WebhookHeaderSchema = v.object({
250
+ name: nonEmptyStringValueSchema("header name"),
251
+ value: nonEmptyStringValueSchema("header value")
252
+ });
253
+ /** batch_name and hook_name must contain only letters, numbers, and underscores. */
254
+ const WEBHOOK_IDENTIFIER_REGEX = /^[a-zA-Z0-9_]+$/;
255
+ /** Category for conflict detection: validation, append, or modification. */
256
+ const CATEGORIES = [
257
+ "validation",
258
+ "append",
259
+ "modification"
260
+ ];
261
+ const CategorySchema = v.picklist(CATEGORIES, `Webhook category must be one of: ${CATEGORIES.join(", ")}`);
262
+ /** Schema for the nested webhook payload without url — used when runtimeAction resolves the URL at runtime. */
263
+ const WebhookDefinitionBaseSchema = v.object({
264
+ webhook_method: nonEmptyStringValueSchema("webhook_method"),
265
+ webhook_type: nonEmptyStringValueSchema("webhook_type"),
266
+ batch_name: v.pipe(nonEmptyStringValueSchema("batch_name"), v.regex(WEBHOOK_IDENTIFIER_REGEX, "batch_name must contain only letters, numbers, and underscores")),
267
+ batch_order: v.optional(positiveNumberValueSchema("batch_order")),
268
+ hook_name: v.pipe(nonEmptyStringValueSchema("hook_name"), v.regex(WEBHOOK_IDENTIFIER_REGEX, "hook_name must contain only letters, numbers, and underscores")),
269
+ priority: v.optional(positiveNumberValueSchema("priority")),
270
+ required: v.optional(booleanValueSchema("required")),
271
+ soft_timeout: v.optional(positiveNumberValueSchema("soft_timeout")),
272
+ timeout: v.optional(positiveNumberValueSchema("timeout")),
273
+ method: nonEmptyStringValueSchema("HTTP method"),
274
+ fallback_error_message: v.optional(stringValueSchema("fallback_error_message")),
275
+ ttl: v.optional(positiveNumberValueSchema("ttl")),
276
+ fields: v.optional(v.array(WebhookFieldSchema, "Expected an array of webhook field objects")),
277
+ rules: v.optional(v.array(WebhookRuleSchema, "Expected an array of webhook rule objects")),
278
+ headers: v.optional(v.array(WebhookHeaderSchema, "Expected an array of webhook header objects"))
279
+ });
280
+ /** Schema for the nested webhook payload with a required url. */
281
+ const WebhookDefinitionWithUrlSchema = v.object({
282
+ ...WebhookDefinitionBaseSchema.entries,
283
+ url: v.pipe(stringValueSchema("webhook URL"), v.url("The 'url' field must be a valid absolute URL (e.g., 'https://example.com/webhook')"))
284
+ });
285
+ /** Schema for a webhook entry that resolves its URL from a runtime action. */
286
+ const WebhookEntryWithRuntimeActionSchema = v.object({
287
+ label: nonEmptyStringValueSchema("webhook label"),
288
+ description: nonEmptyStringValueSchema("webhook description"),
289
+ category: v.optional(CategorySchema),
290
+ runtimeAction: nonEmptyStringValueSchema("runtimeAction"),
291
+ requireAdobeAuth: v.optional(booleanValueSchema("requireAdobeAuth")),
292
+ webhook: WebhookDefinitionBaseSchema
293
+ });
294
+ /** Schema for a webhook entry that provides an explicit URL. */
295
+ const WebhookEntryWithUrlSchema = v.object({
296
+ label: nonEmptyStringValueSchema("webhook label"),
297
+ description: nonEmptyStringValueSchema("webhook description"),
298
+ category: v.optional(CategorySchema),
299
+ webhook: WebhookDefinitionWithUrlSchema
300
+ });
301
+ /** Schema for a single webhook entry — either runtimeAction (no url) or explicit url (no runtimeAction). */
302
+ const WebhookEntrySchema = v.union([WebhookEntryWithRuntimeActionSchema, WebhookEntryWithUrlSchema], "Each webhook entry must define either a 'runtimeAction' (to resolve the URL from a runtime action) or an explicit 'url' inside the 'webhook' object, but not both");
303
+ /** Schema for the optional webhooks array (when present, must have at least one item). */
304
+ const WebhooksSchema = v.optional(v.pipe(v.array(WebhookEntrySchema, "Expected an array of webhook entries"), v.minLength(1, "webhooks array must contain at least one webhook when present")));
305
+ /**
306
+ * Check if config has webhooks (non-empty array).
307
+ * @param config - The configuration to check.
308
+ */
309
+ function hasWebhooks(config) {
310
+ return Array.isArray(config?.webhooks) && config.webhooks.length > 0;
311
+ }
312
+
313
+ //#endregion
314
+ export { hasCustomInstallationSteps as a, hasEventing as c, hasAdminUiSdk as d, hasCustomInstallation as i, hasExternalEvents as l, hasWebhooks as n, EventingSchema as o, InstallationSchema as r, hasCommerceEvents as s, WebhooksSchema as t, AdminUiSdkSchema as u };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@adobe/aio-commerce-lib-app",
3
3
  "type": "module",
4
4
  "author": "Adobe Inc.",
5
- "version": "1.0.2",
5
+ "version": "1.2.0",
6
6
  "private": false,
7
7
  "engines": {
8
8
  "node": ">=20 <=24"
@@ -86,6 +86,7 @@
86
86
  "consola": "^3.4.2",
87
87
  "dotenv": "^17.2.3",
88
88
  "jiti": "^2.6.1",
89
+ "ky": "^1.9.0",
89
90
  "openwhisk": "^3.21.8",
90
91
  "prettier": "^3.8.1",
91
92
  "regexparam": "^3.0.0",
@@ -93,20 +94,22 @@
93
94
  "type-fest": "^5.0.0",
94
95
  "valibot": "^1.1.0",
95
96
  "yaml": "^2.8.1",
96
- "@adobe/aio-commerce-lib-api": "1.0.0",
97
- "@adobe/aio-commerce-lib-auth": "1.0.0",
98
- "@adobe/aio-commerce-lib-config": "1.0.2",
97
+ "@adobe/aio-commerce-lib-api": "1.0.1",
98
+ "@adobe/aio-commerce-lib-auth": "1.0.1",
99
+ "@adobe/aio-commerce-lib-config": "1.1.0",
99
100
  "@adobe/aio-commerce-lib-core": "1.0.0",
100
- "@adobe/aio-commerce-lib-events": "1.0.0"
101
+ "@adobe/aio-commerce-lib-events": "1.0.1",
102
+ "@adobe/aio-commerce-lib-webhooks": "0.1.0"
101
103
  },
102
104
  "devDependencies": {
103
- "typescript": "^5.9.2",
104
- "@aio-commerce-sdk/config-tsdown": "1.0.1",
105
+ "msw": "^2.11.1",
106
+ "typescript": "^5.9.3",
107
+ "@aio-commerce-sdk/common-utils": "0.2.3",
105
108
  "@aio-commerce-sdk/config-typedoc": "1.0.0",
106
109
  "@aio-commerce-sdk/config-typescript": "1.0.0",
107
110
  "@aio-commerce-sdk/config-vitest": "1.0.0",
111
+ "@aio-commerce-sdk/config-tsdown": "1.0.1",
108
112
  "@aio-commerce-sdk/scripting-utils": "0.3.0",
109
- "@aio-commerce-sdk/common-utils": "0.2.2",
110
113
  "@aio-commerce-sdk/scripts": "0.1.0"
111
114
  },
112
115
  "sideEffects": false,
@@ -118,6 +121,7 @@
118
121
  "assist": "biome check --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
119
122
  "assist:apply": "biome check --write --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
120
123
  "check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched",
124
+ "code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format && pnpm run format:markdown",
121
125
  "format": "biome format --write --no-errors-on-unmatched",
122
126
  "format:markdown": "prettier --no-error-on-unmatched-pattern --write '**/*.md' \"!**/{CODE_OF_CONDUCT.md,COPYRIGHT,LICENSE,SECURITY.md,CONTRIBUTING.md}\"",
123
127
  "format:check": "biome format --no-errors-on-unmatched",
@@ -1,24 +0,0 @@
1
- const require_schemas = require('./schemas-CZ6c8Id9.cjs');
2
- let _adobe_aio_commerce_lib_core_error = require("@adobe/aio-commerce-lib-core/error");
3
-
4
- //#region ../../packages-private/scripting-utils/source/error.ts
5
- /**
6
- * This module exports shared error utilities for the AIO Commerce SDK.
7
- * @packageDocumentation
8
- */
9
- /**
10
- * Stringify an error to a human-friendly string.
11
- * @param error - The error to stringify.
12
- */
13
- function stringifyError(error) {
14
- if (error instanceof _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError) return error.display();
15
- return error instanceof Error ? error.message : String(error);
16
- }
17
-
18
- //#endregion
19
- Object.defineProperty(exports, 'stringifyError', {
20
- enumerable: true,
21
- get: function () {
22
- return stringifyError;
23
- }
24
- });
@@ -1,25 +0,0 @@
1
- const require_schemas = require('./schemas-CZ6c8Id9.cjs');
2
- let util = require("util");
3
- util = require_schemas.__toESM(util);
4
-
5
- //#region ../../packages-private/common-utils/source/logging.ts
6
- /**
7
- * Shorthand to inspect an object.
8
- *
9
- * @param obj - The object to inspect.
10
- * @returns A string representation of the object.
11
- */
12
- function inspect(obj, params = {}) {
13
- return util.default.inspect(obj, {
14
- depth: null,
15
- ...params
16
- });
17
- }
18
-
19
- //#endregion
20
- Object.defineProperty(exports, 'inspect', {
21
- enumerable: true,
22
- get: function () {
23
- return inspect;
24
- }
25
- });
@@ -1,18 +0,0 @@
1
- import { CommerceSdkValidationError } from "@adobe/aio-commerce-lib-core/error";
2
-
3
- //#region ../../packages-private/scripting-utils/source/error.ts
4
- /**
5
- * This module exports shared error utilities for the AIO Commerce SDK.
6
- * @packageDocumentation
7
- */
8
- /**
9
- * Stringify an error to a human-friendly string.
10
- * @param error - The error to stringify.
11
- */
12
- function stringifyError(error) {
13
- if (error instanceof CommerceSdkValidationError) return error.display();
14
- return error instanceof Error ? error.message : String(error);
15
- }
16
-
17
- //#endregion
18
- export { stringifyError as t };
@@ -1,18 +0,0 @@
1
- import util from "util";
2
-
3
- //#region ../../packages-private/common-utils/source/logging.ts
4
- /**
5
- * Shorthand to inspect an object.
6
- *
7
- * @param obj - The object to inspect.
8
- * @returns A string representation of the object.
9
- */
10
- function inspect(obj, params = {}) {
11
- return util.inspect(obj, {
12
- depth: null,
13
- ...params
14
- });
15
- }
16
-
17
- //#endregion
18
- export { inspect as t };