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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- //#region source/params/helpers.ts
15
+ // source/params/helpers.ts
16
16
  /**
17
17
  * Checks if the given runtime action input value is non-empty.
18
18
  *
@@ -21,7 +21,7 @@
21
21
  */
22
22
  function nonEmpty(name, value) {
23
23
  if (value === void 0 || value === null) return false;
24
- const v = String(value)?.trim();
24
+ const v = String(value).trim();
25
25
  return !!v && v !== `$${name}`;
26
26
  }
27
27
  /**
@@ -34,5 +34,4 @@ function allNonEmpty(params, required) {
34
34
  return required.every((name) => nonEmpty(name, params[name]));
35
35
  }
36
36
 
37
- //#endregion
38
37
  export { allNonEmpty, nonEmpty };
@@ -12,7 +12,6 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- //#region source/responses/helpers.d.ts
16
15
  type HeadersRecord = Record<string, string>;
17
16
  type BodyRecord = Record<string, unknown>;
18
17
  type BodyRecordWithMessage = BodyRecord & {
@@ -65,7 +64,7 @@ type ActionResponse<TSuccessBody extends BodyRecord = BodyRecord, TErrorBody ext
65
64
  * }
66
65
  * ```
67
66
  */
68
- declare function isSuccessResponse(response: unknown): response is SuccessResponse;
67
+ export declare function isSuccessResponse(response: unknown): response is SuccessResponse;
69
68
  /**
70
69
  * Determines whether a value is a standardized SDK error response.
71
70
  *
@@ -80,7 +79,7 @@ declare function isSuccessResponse(response: unknown): response is SuccessRespon
80
79
  * }
81
80
  * ```
82
81
  */
83
- declare function isErrorResponse(response: unknown): response is ErrorResponse;
82
+ export declare function isErrorResponse(response: unknown): response is ErrorResponse;
84
83
  /**
85
84
  * Determines whether a value is a standardized SDK action response.
86
85
  *
@@ -95,7 +94,7 @@ declare function isErrorResponse(response: unknown): response is ErrorResponse;
95
94
  * }
96
95
  * ```
97
96
  */
98
- declare function isActionResponse(response: unknown): response is ActionResponse;
97
+ export declare function isActionResponse(response: unknown): response is ActionResponse;
99
98
  /**
100
99
  * Creates a standardized error response for runtime actions
101
100
  * @see https://developer.adobe.com/app-builder/docs/guides/runtime_guides/creating-actions#unsuccessful-response
@@ -131,7 +130,7 @@ declare function isActionResponse(response: unknown): response is ActionResponse
131
130
  * });
132
131
  * ```
133
132
  */
134
- declare function buildErrorResponse<TBody extends BodyRecordWithMessage = BodyRecordWithMessage, THeaders extends HeadersRecord = HeadersRecord>(statusCode: number, payload: {
133
+ export declare function buildErrorResponse<TBody extends BodyRecordWithMessage = BodyRecordWithMessage, THeaders extends HeadersRecord = HeadersRecord>(statusCode: number, payload: {
135
134
  body: TBody;
136
135
  headers?: THeaders;
137
136
  }): ErrorResponse<TBody, THeaders>;
@@ -165,29 +164,27 @@ declare function buildErrorResponse<TBody extends BodyRecordWithMessage = BodyRe
165
164
  * });
166
165
  * ```
167
166
  */
168
- declare function buildSuccessResponse<TBody extends BodyRecord = BodyRecord, THeaders extends HeadersRecord = HeadersRecord>(statusCode: number, payload?: {
167
+ export declare function buildSuccessResponse<TBody extends BodyRecord = BodyRecord, THeaders extends HeadersRecord = HeadersRecord>(statusCode: number, payload?: {
169
168
  body?: TBody;
170
169
  headers?: THeaders;
171
170
  }): SuccessResponse<TBody, THeaders>;
172
- //#endregion
173
- //#region source/responses/presets.d.ts
174
- declare const HTTP_OK = 200;
175
- declare const HTTP_CREATED = 201;
176
- declare const HTTP_ACCEPTED = 202;
177
- declare const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
178
- declare const HTTP_NO_CONTENT = 204;
179
- declare const HTTP_BAD_REQUEST = 400;
180
- declare const HTTP_UNAUTHORIZED = 401;
181
- declare const HTTP_FORBIDDEN = 403;
182
- declare const HTTP_NOT_FOUND = 404;
183
- declare const HTTP_METHOD_NOT_ALLOWED = 405;
184
- declare const HTTP_CONFLICT = 409;
185
- declare const HTTP_INTERNAL_SERVER_ERROR = 500;
171
+ export declare const HTTP_OK = 200;
172
+ export declare const HTTP_CREATED = 201;
173
+ export declare const HTTP_ACCEPTED = 202;
174
+ export declare const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
175
+ export declare const HTTP_NO_CONTENT = 204;
176
+ export declare const HTTP_BAD_REQUEST = 400;
177
+ export declare const HTTP_UNAUTHORIZED = 401;
178
+ export declare const HTTP_FORBIDDEN = 403;
179
+ export declare const HTTP_NOT_FOUND = 404;
180
+ export declare const HTTP_METHOD_NOT_ALLOWED = 405;
181
+ export declare const HTTP_CONFLICT = 409;
182
+ export declare const HTTP_INTERNAL_SERVER_ERROR = 500;
186
183
  /**
187
184
  * Creates a success response with the HTTP status code 200.
188
185
  * See {@link buildSuccessResponse} for details on the response payload.
189
186
  */
190
- declare const ok: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
187
+ export declare const ok: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
191
188
  body?: TBody;
192
189
  headers?: HeadersRecord;
193
190
  }) => SuccessResponse<TBody>;
@@ -195,7 +192,7 @@ declare const ok: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
195
192
  * Creates a success response with the HTTP status code 201.
196
193
  * See {@link buildSuccessResponse} for details on the response payload.
197
194
  */
198
- declare const created: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
195
+ export declare const created: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
199
196
  body?: TBody;
200
197
  headers?: HeadersRecord;
201
198
  }) => SuccessResponse<TBody>;
@@ -203,7 +200,7 @@ declare const created: <TBody extends BodyRecord = BodyRecord>(payload?: string
203
200
  * Creates a success response with the HTTP status code 202.
204
201
  * See {@link buildSuccessResponse} for details on the response payload.
205
202
  */
206
- declare const accepted: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
203
+ export declare const accepted: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
207
204
  body?: TBody;
208
205
  headers?: HeadersRecord;
209
206
  }) => SuccessResponse<TBody>;
@@ -211,7 +208,7 @@ declare const accepted: <TBody extends BodyRecord = BodyRecord>(payload?: string
211
208
  * Creates a success response with the HTTP status code 203.
212
209
  * See {@link buildSuccessResponse} for details on the response payload.
213
210
  */
214
- declare const nonAuthoritativeInformation: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
211
+ export declare const nonAuthoritativeInformation: <TBody extends BodyRecord = BodyRecord>(payload?: string | {
215
212
  body?: TBody;
216
213
  headers?: HeadersRecord;
217
214
  }) => SuccessResponse<TBody>;
@@ -219,12 +216,12 @@ declare const nonAuthoritativeInformation: <TBody extends BodyRecord = BodyRecor
219
216
  * Creates a success response with the HTTP status code 204 (No Content).
220
217
  * This response has no body.
221
218
  */
222
- declare const noContent: () => SuccessResponse<BodyRecord, HeadersRecord>;
219
+ export declare const noContent: () => SuccessResponse<BodyRecord, HeadersRecord>;
223
220
  /**
224
221
  * Creates an error response with the HTTP status code 400.
225
222
  * See {@link buildErrorResponse} for details on the response payload.
226
223
  */
227
- declare const badRequest: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
224
+ export declare const badRequest: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
228
225
  body: TBody;
229
226
  headers?: HeadersRecord;
230
227
  }) => ErrorResponse<TBody>;
@@ -232,7 +229,7 @@ declare const badRequest: <TBody extends BodyRecordWithMessage = BodyRecordWithM
232
229
  * Creates an error response with the HTTP status code 401.
233
230
  * See {@link buildErrorResponse} for details on the response payload.
234
231
  */
235
- declare const unauthorized: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
232
+ export declare const unauthorized: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
236
233
  body: TBody;
237
234
  headers?: HeadersRecord;
238
235
  }) => ErrorResponse<TBody>;
@@ -240,7 +237,7 @@ declare const unauthorized: <TBody extends BodyRecordWithMessage = BodyRecordWit
240
237
  * Creates an error response with the HTTP status code 403.
241
238
  * See {@link buildErrorResponse} for details on the response payload.
242
239
  */
243
- declare const forbidden: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
240
+ export declare const forbidden: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
244
241
  body: TBody;
245
242
  headers?: HeadersRecord;
246
243
  }) => ErrorResponse<TBody>;
@@ -248,7 +245,7 @@ declare const forbidden: <TBody extends BodyRecordWithMessage = BodyRecordWithMe
248
245
  * Creates an error response with the HTTP status code 404.
249
246
  * See {@link buildErrorResponse} for details on the response payload.
250
247
  */
251
- declare const notFound: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
248
+ export declare const notFound: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
252
249
  body: TBody;
253
250
  headers?: HeadersRecord;
254
251
  }) => ErrorResponse<TBody>;
@@ -256,7 +253,7 @@ declare const notFound: <TBody extends BodyRecordWithMessage = BodyRecordWithMes
256
253
  * Creates an error response with the HTTP status code 405.
257
254
  * See {@link buildErrorResponse} for details on the response payload.
258
255
  */
259
- declare const methodNotAllowed: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
256
+ export declare const methodNotAllowed: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
260
257
  body: TBody;
261
258
  headers?: HeadersRecord;
262
259
  }) => ErrorResponse<TBody>;
@@ -264,7 +261,7 @@ declare const methodNotAllowed: <TBody extends BodyRecordWithMessage = BodyRecor
264
261
  * Creates an error response with the HTTP status code 409.
265
262
  * See {@link buildErrorResponse} for details on the response payload.
266
263
  */
267
- declare const conflict: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
264
+ export declare const conflict: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
268
265
  body: TBody;
269
266
  headers?: HeadersRecord;
270
267
  }) => ErrorResponse<TBody>;
@@ -272,9 +269,8 @@ declare const conflict: <TBody extends BodyRecordWithMessage = BodyRecordWithMes
272
269
  * Creates an error response with the HTTP status code 500.
273
270
  * See {@link buildErrorResponse} for details on the response payload.
274
271
  */
275
- declare const internalServerError: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
272
+ export declare const internalServerError: <TBody extends BodyRecordWithMessage = BodyRecordWithMessage>(payload: string | {
276
273
  body: TBody;
277
274
  headers?: HeadersRecord;
278
275
  }) => ErrorResponse<TBody>;
279
- //#endregion
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 };
276
+ export type { ActionResponse, ErrorResponse, SuccessResponse };
@@ -12,7 +12,7 @@
12
12
  * governing permissions and limitations under the License.
13
13
  */
14
14
 
15
- //#region source/responses/helpers.ts
15
+ // source/responses/helpers.ts
16
16
  function isObjectRecord(value) {
17
17
  return typeof value === "object" && value !== null && !Array.isArray(value);
18
18
  }
@@ -160,8 +160,7 @@ function buildSuccessResponse(statusCode, payload) {
160
160
  };
161
161
  }
162
162
 
163
- //#endregion
164
- //#region source/responses/presets.ts
163
+ // source/responses/presets.ts
165
164
  const HTTP_OK = 200;
166
165
  const HTTP_CREATED = 201;
167
166
  const HTTP_ACCEPTED = 202;
@@ -241,5 +240,4 @@ const conflict = curryBuildErrorResponse(409);
241
240
  */
242
241
  const internalServerError = curryBuildErrorResponse(500);
243
242
 
244
- //#endregion
245
243
  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 };
package/package.json CHANGED
@@ -1,13 +1,7 @@
1
1
  {
2
2
  "name": "@adobe/aio-commerce-lib-core",
3
- "type": "module",
4
- "author": "Adobe Inc.",
5
- "version": "1.2.0",
3
+ "version": "1.3.0-beta-20261028171115",
6
4
  "private": false,
7
- "engines": {
8
- "node": ">=22 <=24"
9
- },
10
- "license": "Apache-2.0",
11
5
  "description": "Core utilities for Adobe Commerce SDK libraries",
12
6
  "keywords": [
13
7
  "aio",
@@ -27,9 +21,13 @@
27
21
  "url": "git+https://github.com/adobe/aio-commerce-sdk.git",
28
22
  "directory": "packages/aio-commerce-lib-core"
29
23
  },
30
- "publishConfig": {
31
- "registry": "https://registry.npmjs.org",
32
- "access": "public"
24
+ "license": "Apache-2.0",
25
+ "author": "Adobe Inc.",
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "imports": {
29
+ "#*": "./source/*.ts",
30
+ "#test/*": "./test/*.ts"
33
31
  },
34
32
  "exports": {
35
33
  "./*": {
@@ -44,10 +42,6 @@
44
42
  },
45
43
  "./package.json": "./package.json"
46
44
  },
47
- "imports": {
48
- "#*": "./source/*.ts",
49
- "#test/*": "./test/*.ts"
50
- },
51
45
  "files": [
52
46
  "dist",
53
47
  "package.json",
@@ -56,35 +50,42 @@
56
50
  ],
57
51
  "dependencies": {
58
52
  "ansis": "^4.1.0",
59
- "camelcase": "^9.0.0",
53
+ "camelcase": "^10.0.0",
60
54
  "type-fest": "^5.0.0",
61
55
  "valibot": "^1.1.0"
62
56
  },
63
57
  "devDependencies": {
64
- "typescript": "^6.0.0",
65
58
  "@aio-commerce-sdk/config-tsdown": "1.0.1",
66
59
  "@aio-commerce-sdk/config-typedoc": "1.0.0",
67
60
  "@aio-commerce-sdk/config-typescript": "1.0.0",
68
- "@aio-commerce-sdk/config-vitest": "1.0.0"
61
+ "@aio-commerce-sdk/config-vitest": "1.0.0",
62
+ "@aio-commerce-sdk/scripts": "0.1.1",
63
+ "typescript": "^6.0.0"
64
+ },
65
+ "engines": {
66
+ "node": ">=22 <=24"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public",
70
+ "registry": "https://registry.npmjs.org"
69
71
  },
70
- "sideEffects": false,
71
72
  "scripts": {
72
- "build": "tsdown",
73
- "pack": "pnpm pack",
74
- "publint": "publint",
75
- "docs": "typedoc && prettier --write '**/*.md'",
76
73
  "assist": "biome check --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
77
74
  "assist:apply": "biome check --write --formatter-enabled=false --linter-enabled=false --assist-enabled=true --no-errors-on-unmatched",
75
+ "build": "tsdown",
78
76
  "check:ci": "biome ci --formatter-enabled=true --linter-enabled=true --assist-enabled=true --no-errors-on-unmatched",
79
77
  "code:fix": "pnpm run lint:fix && pnpm run assist:apply && pnpm run format && pnpm run format:markdown",
78
+ "docs": "typedoc && prettier --write '**/*.md'",
80
79
  "format": "biome format --write --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
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}\"",
83
82
  "lint": "biome lint --no-errors-on-unmatched",
84
83
  "lint:fix": "biome lint --write --no-errors-on-unmatched",
85
- "typecheck": "tsc --noEmit && echo '✅ No type errors found.'",
84
+ "pack": "pnpm pack",
85
+ "publint": "publint",
86
86
  "test": "vitest run --coverage",
87
+ "test:ui": "vitest --ui",
87
88
  "test:watch": "vitest --coverage",
88
- "test:ui": "vitest --ui"
89
+ "typecheck": "tsc --noEmit && echo '✅ No type errors found.'"
89
90
  }
90
91
  }