@adobe/aio-commerce-lib-app 0.3.2 → 1.0.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 (78) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -4
  3. package/bin/cli.mjs +24 -0
  4. package/dist/cjs/actions/app-config.cjs +27 -0
  5. package/dist/cjs/actions/app-config.d.cts +15 -0
  6. package/dist/cjs/actions/config.cjs +79 -0
  7. package/dist/cjs/actions/config.d.cts +15 -0
  8. package/dist/cjs/actions/installation.cjs +424 -0
  9. package/dist/cjs/actions/{index.d.cts → installation.d.cts} +4 -3
  10. package/dist/cjs/actions/scope-tree.cjs +97 -0
  11. package/dist/cjs/actions/scope-tree.d.cts +8 -0
  12. package/dist/cjs/{app-Dx0ca6oL.d.cts → app-PTKvEBea.d.cts} +6 -6
  13. package/dist/cjs/commands/generate/actions/templates/app-management/app-config.js.template +22 -0
  14. package/dist/cjs/commands/generate/actions/templates/app-management/installation.js.template +1 -1
  15. package/dist/cjs/commands/generate/actions/templates/business-configuration/config.js.template +22 -0
  16. package/dist/cjs/commands/generate/actions/templates/business-configuration/scope-tree.js.template +18 -0
  17. package/dist/cjs/commands/index.cjs +91 -106
  18. package/dist/cjs/config/index.cjs +21 -19
  19. package/dist/cjs/config/index.d.cts +32 -332
  20. package/dist/cjs/error-DJ2UAPH2.cjs +24 -0
  21. package/dist/cjs/installation-nwF2RC7F.cjs +241 -0
  22. package/dist/cjs/{logging-DYwr5WQk.cjs → logging-IDRQG0as.cjs} +2 -2
  23. package/dist/cjs/management/index.cjs +9 -8
  24. package/dist/cjs/management/index.d.cts +2 -2
  25. package/dist/cjs/parser-DIchX9SL.cjs +267 -0
  26. package/dist/cjs/router-DCw7oEQ9.cjs +417 -0
  27. package/dist/cjs/{management-Dm5h0E6l.cjs → runner-CUJ8RHzY.cjs} +24 -30
  28. package/dist/{es/index-Bxr3zvCT.d.mts → cjs/runner-Ds2m27Q4.d.cts} +49 -95
  29. package/dist/cjs/schemas-CZ6c8Id9.cjs +98 -0
  30. package/dist/cjs/validate-BegMfe-i.cjs +235 -0
  31. package/dist/es/actions/app-config.d.mts +15 -0
  32. package/dist/es/actions/app-config.mjs +25 -0
  33. package/dist/es/actions/config.d.mts +15 -0
  34. package/dist/es/actions/config.mjs +77 -0
  35. package/dist/es/actions/{index.d.mts → installation.d.mts} +4 -3
  36. package/dist/es/actions/{index.mjs → installation.mjs} +27 -427
  37. package/dist/es/actions/scope-tree.d.mts +8 -0
  38. package/dist/es/actions/scope-tree.mjs +95 -0
  39. package/dist/es/{app-Cx1-6dn0.d.mts → app-vKXaAr6f.d.mts} +6 -6
  40. package/dist/es/commands/generate/actions/templates/app-management/app-config.js.template +22 -0
  41. package/dist/es/commands/generate/actions/templates/app-management/installation.js.template +1 -1
  42. package/dist/es/commands/generate/actions/templates/business-configuration/config.js.template +22 -0
  43. package/dist/es/commands/generate/actions/templates/business-configuration/scope-tree.js.template +18 -0
  44. package/dist/es/commands/index.mjs +68 -84
  45. package/dist/es/config/index.d.mts +32 -332
  46. package/dist/es/config/index.mjs +3 -2
  47. package/dist/es/error-CMV3IjBz.mjs +18 -0
  48. package/dist/es/{error-P7JgUTds.mjs → installation-SWIwhpKT.mjs} +72 -124
  49. package/dist/es/management/index.d.mts +2 -3
  50. package/dist/es/management/index.mjs +1 -1
  51. package/dist/es/parser-CKQyrTB7.mjs +201 -0
  52. package/dist/es/router-CJ4VWoCt.mjs +404 -0
  53. package/dist/es/{management-Y7pwEbNI.mjs → runner-DB2tDBQS.mjs} +17 -24
  54. package/dist/{cjs/index-C5SutkJQ.d.cts → es/runner-Uk7263hG.d.mts} +49 -95
  55. package/dist/es/schemas-B8yIv0_b.mjs +41 -0
  56. package/dist/es/validate-DXI6gwZ2.mjs +187 -0
  57. package/package.json +38 -24
  58. package/dist/cjs/actions/index.cjs +0 -824
  59. package/dist/cjs/commands/generate/actions/templates/app-management/get-app-config.js.template +0 -62
  60. package/dist/cjs/commands/generate/actions/templates/business-configuration/get-config-schema.js.template +0 -63
  61. package/dist/cjs/commands/generate/actions/templates/business-configuration/get-configuration.js.template +0 -104
  62. package/dist/cjs/commands/generate/actions/templates/business-configuration/get-scope-tree.js.template +0 -69
  63. package/dist/cjs/commands/generate/actions/templates/business-configuration/set-configuration.js.template +0 -125
  64. package/dist/cjs/commands/generate/actions/templates/business-configuration/set-custom-scope-tree.js.template +0 -83
  65. package/dist/cjs/commands/generate/actions/templates/business-configuration/sync-commerce-scopes.js.template +0 -113
  66. package/dist/cjs/commands/generate/actions/templates/business-configuration/unsync-commerce-scopes.js.template +0 -56
  67. package/dist/cjs/config-JQ_n-5Nk.cjs +0 -565
  68. package/dist/cjs/error-Byj1DVHZ.cjs +0 -344
  69. package/dist/es/commands/generate/actions/templates/app-management/get-app-config.js.template +0 -62
  70. package/dist/es/commands/generate/actions/templates/business-configuration/get-config-schema.js.template +0 -63
  71. package/dist/es/commands/generate/actions/templates/business-configuration/get-configuration.js.template +0 -104
  72. package/dist/es/commands/generate/actions/templates/business-configuration/get-scope-tree.js.template +0 -69
  73. package/dist/es/commands/generate/actions/templates/business-configuration/set-configuration.js.template +0 -125
  74. package/dist/es/commands/generate/actions/templates/business-configuration/set-custom-scope-tree.js.template +0 -83
  75. package/dist/es/commands/generate/actions/templates/business-configuration/sync-commerce-scopes.js.template +0 -113
  76. package/dist/es/commands/generate/actions/templates/business-configuration/unsync-commerce-scopes.js.template +0 -56
  77. package/dist/es/config-BSGerqCG.mjs +0 -457
  78. /package/dist/es/{logging-VgerMhp6.mjs → logging-CzmXDzxI.mjs} +0 -0
@@ -0,0 +1,404 @@
1
+ import { badRequest, internalServerError, methodNotAllowed, notFound } from "@adobe/aio-commerce-lib-core/responses";
2
+ import AioLogger from "@adobe/aio-lib-core-logging";
3
+ import { parse } from "regexparam";
4
+
5
+ //#region ../../packages-private/common-utils/source/actions/http/middleware/logger.ts
6
+ /**
7
+ * Creates a logger middleware that adds logging capabilities to the context.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * router.use(logger({ level: "debug", name: () => "my-logger-name" }));
12
+ *
13
+ * router.get("/test", {
14
+ * handler: (req, ctx) => {
15
+ * ctx.logger.info("Hello world");
16
+ * return ok({ body: {} });
17
+ * },
18
+ * });
19
+ * ```
20
+ */
21
+ function logger({ name, ...restOptions } = {}) {
22
+ return (ctx) => {
23
+ const params = ctx.rawParams;
24
+ return { logger: AioLogger(`${params.__ow_method}-${name?.(ctx) ?? process.env.__OW_ACTION_NAME}`, {
25
+ level: `${params.LOG_LEVEL ?? "info"}`,
26
+ ...restOptions
27
+ }) };
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ //#region ../../packages-private/common-utils/source/actions/http/utils.ts
33
+ /**
34
+ * Validates input against a Standard Schema and returns a result.
35
+ *
36
+ * @template TInput - The input type expected by the schema
37
+ * @template TOutput - The output type produced by the schema
38
+ * @param schema - A Standard Schema v1 compliant schema
39
+ * @param input - The input data to validate
40
+ * @returns A promise resolving to either success with validated data or failure with issues
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const result = await validateSchema(mySchema, userInput);
45
+ * if (result.success) {
46
+ * console.log(result.data); // Typed as TOutput
47
+ * } else {
48
+ * console.error(result.issues); // Validation errors
49
+ * }
50
+ * ```
51
+ */
52
+ async function validateSchema(schema, input) {
53
+ const result = await schema["~standard"].validate(input);
54
+ if (result.issues) return {
55
+ success: false,
56
+ issues: result.issues.map((issue) => ({
57
+ message: issue.message,
58
+ path: issue.path?.map((segment) => typeof segment === "object" && segment !== null && "key" in segment ? segment.key : segment)
59
+ }))
60
+ };
61
+ return {
62
+ success: true,
63
+ data: result.value
64
+ };
65
+ }
66
+ /**
67
+ * Parses a request body from OpenWhisk/Runtime.
68
+ * Handles multiple formats:
69
+ * - Base64-encoded strings (__ow_body)
70
+ * - Already-parsed objects
71
+ * - Body properties mixed into args (web actions with JSON content-type)
72
+ *
73
+ * @param owBody - Body from __ow_body (base64 string, JSON string, or object)
74
+ * @param args - Full args object to extract body from if __ow_body is not present
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const body = parseRequestBody(params.__ow_body, params);
79
+ * ```
80
+ */
81
+ function parseRequestBody(owBody, args) {
82
+ if (owBody) {
83
+ if (typeof owBody === "object") return owBody;
84
+ if (typeof owBody === "string") {
85
+ try {
86
+ return JSON.parse(owBody);
87
+ } catch {}
88
+ try {
89
+ const decoded = Buffer.from(owBody, "base64").toString();
90
+ return JSON.parse(decoded);
91
+ } catch {}
92
+ }
93
+ }
94
+ if (args && typeof args === "object") {
95
+ const body = {};
96
+ for (const [key, value] of Object.entries(args)) if (!key.startsWith("__ow_")) body[key] = value;
97
+ return body;
98
+ }
99
+ return {};
100
+ }
101
+ /**
102
+ * Parses query parameters from OpenWhisk/Runtime format.
103
+ *
104
+ * @param queryString - Query string from __ow_query
105
+ * @param fallbackParams - Fallback params object (used when __ow_query is not present)
106
+ * @returns Parsed query parameters as a record
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const query = parseQueryParams(params.__ow_query, params);
111
+ * ```
112
+ */
113
+ function parseQueryParams(queryString, fallbackParams) {
114
+ if (queryString) return Object.fromEntries(new URLSearchParams(queryString));
115
+ if (fallbackParams) {
116
+ const { __ow_method, __ow_path, __ow_headers, __ow_body, __ow_query, ...rest } = fallbackParams;
117
+ return rest;
118
+ }
119
+ return {};
120
+ }
121
+
122
+ //#endregion
123
+ //#region ../../packages-private/common-utils/source/actions/http/router.ts
124
+ /**
125
+ * HTTP router for Adobe I/O Runtime actions.
126
+ * Provides type-safe routing with schema validation and OpenWhisk integration.
127
+ *
128
+ * @example
129
+ * ```typescript
130
+ * const router = new HttpActionRouter();
131
+ *
132
+ * router.get("/users/:id", {
133
+ * handler: (req) => ok({ id: req.params.id, context: req.context })
134
+ * });
135
+ *
136
+ * // Add context builders
137
+ * router.use(async (base) => ({
138
+ * user: await getUser(base.rawParams.__ow_headers?.authorization),
139
+ * }));
140
+ *
141
+ * export const main = router.handler();
142
+ * ```
143
+ */
144
+ var HttpActionRouter = class {
145
+ constructor() {
146
+ this.routes = [];
147
+ this.contextBuilders = [];
148
+ }
149
+ /**
150
+ * Internal method to add a route to the router.
151
+ */
152
+ addRoute(method, path, config) {
153
+ const { pattern, keys } = parse(path);
154
+ this.routes.push({
155
+ method,
156
+ pattern,
157
+ keys,
158
+ params: config.params,
159
+ body: config.body,
160
+ query: config.query,
161
+ handler: config.handler
162
+ });
163
+ return this;
164
+ }
165
+ /**
166
+ * Register a GET route.
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * router.get("/users/:id", {
171
+ * handler: (req) => ok({ id: req.params.id })
172
+ * });
173
+ * ```
174
+ */
175
+ get(path, config) {
176
+ return this.addRoute("GET", path, config);
177
+ }
178
+ /**
179
+ * Register a POST route.
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * router.post("/users", {
184
+ * body: userSchema,
185
+ * handler: (req) => created(req.body)
186
+ * });
187
+ * ```
188
+ */
189
+ post(path, config) {
190
+ return this.addRoute("POST", path, config);
191
+ }
192
+ /**
193
+ * Register a PUT route.
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * router.put("/users/:id", {
198
+ * body: userSchema,
199
+ * handler: (req) => ok(req.body)
200
+ * });
201
+ * ```
202
+ */
203
+ put(path, config) {
204
+ return this.addRoute("PUT", path, config);
205
+ }
206
+ /**
207
+ * Register a PATCH route.
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * router.patch("/users/:id", {
212
+ * body: partialUserSchema,
213
+ * handler: (req) => ok(req.body)
214
+ * });
215
+ * ```
216
+ */
217
+ patch(path, config) {
218
+ return this.addRoute("PATCH", path, config);
219
+ }
220
+ /**
221
+ * Register a DELETE route.
222
+ *
223
+ * @example
224
+ * ```typescript
225
+ * router.delete("/users/:id", {
226
+ * handler: (req) => noContent()
227
+ * });
228
+ * ```
229
+ */
230
+ delete(path, config) {
231
+ return this.addRoute("DELETE", path, config);
232
+ }
233
+ /**
234
+ * Register a context builder that runs before route handlers.
235
+ * Context builders can add properties to the request context.
236
+ * Multiple builders are executed in order and their results are merged.
237
+ *
238
+ * The returned router has an updated context type that includes the new properties,
239
+ * enabling type-safe access in route handlers.
240
+ *
241
+ * @param builder - Function that receives base context and returns additional context
242
+ * @returns The router instance with updated context type for chaining
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * const router = new HttpActionRouter()
247
+ * .use(logger()) // HttpActionRouter<BaseContext & { logger: Logger }>
248
+ * .use(auth()); // HttpActionRouter<BaseContext & { logger: Logger } & { user: User }>
249
+ *
250
+ * router.get("/me", {
251
+ * handler: (req, ctx) => {
252
+ * ctx.logger.info("Hello"); // ✅ typed
253
+ * return ok({ body: ctx.user }); // ✅ typed
254
+ * },
255
+ * });
256
+ * ```
257
+ */
258
+ use(builder) {
259
+ this.contextBuilders.push(builder);
260
+ return this;
261
+ }
262
+ /**
263
+ * Builds the full context by running all context builders.
264
+ */
265
+ async buildContext(args) {
266
+ let context = { rawParams: args };
267
+ for (const builder of this.contextBuilders) {
268
+ const result = await builder(context);
269
+ if (result) context = {
270
+ ...context,
271
+ ...result
272
+ };
273
+ }
274
+ return context;
275
+ }
276
+ /**
277
+ * Validates and extracts route parameters.
278
+ */
279
+ async validateParams(route, params) {
280
+ if (!route.params) return {
281
+ success: true,
282
+ data: params
283
+ };
284
+ const result = await validateSchema(route.params, params);
285
+ if (!result.success) return {
286
+ success: false,
287
+ issues: result.issues
288
+ };
289
+ return {
290
+ success: true,
291
+ data: result.data
292
+ };
293
+ }
294
+ /**
295
+ * Validates request body.
296
+ */
297
+ async validateBody(route, body) {
298
+ if (!route.body) return {
299
+ success: true,
300
+ data: body
301
+ };
302
+ const result = await validateSchema(route.body, body);
303
+ if (!result.success) return {
304
+ success: false,
305
+ issues: result.issues
306
+ };
307
+ return {
308
+ success: true,
309
+ data: result.data
310
+ };
311
+ }
312
+ /**
313
+ * Validates query parameters.
314
+ */
315
+ async validateQuery(route, query) {
316
+ if (!route.query) return {
317
+ success: true,
318
+ data: query
319
+ };
320
+ const result = await validateSchema(route.query, query);
321
+ if (!result.success) return {
322
+ success: false,
323
+ issues: result.issues
324
+ };
325
+ return {
326
+ success: true,
327
+ data: result.data
328
+ };
329
+ }
330
+ /** Handles a matched route by validating inputs and calling the handler. */
331
+ async handleRoute(route, match, body, query, headers, method, path, context) {
332
+ const params = {};
333
+ route.keys.forEach((key, i) => {
334
+ params[key] = decodeURIComponent(match[i + 1] || "");
335
+ });
336
+ const paramsResult = await this.validateParams(route, params);
337
+ if (!paramsResult.success) return badRequest({ body: {
338
+ message: "Invalid route parameters",
339
+ issues: paramsResult.issues
340
+ } });
341
+ const bodyResult = await this.validateBody(route, body);
342
+ if (!bodyResult.success) return badRequest({ body: {
343
+ message: "Invalid request body",
344
+ issues: bodyResult.issues
345
+ } });
346
+ const queryResult = await this.validateQuery(route, query);
347
+ if (!queryResult.success) return badRequest({ body: {
348
+ message: "Invalid query parameters",
349
+ issues: queryResult.issues
350
+ } });
351
+ try {
352
+ return await route.handler({
353
+ params: paramsResult.data,
354
+ body: bodyResult.data,
355
+ query: queryResult.data,
356
+ headers,
357
+ method,
358
+ path
359
+ }, context);
360
+ } catch (err) {
361
+ console.error("Handler error:", err);
362
+ return internalServerError({ body: {
363
+ message: "Internal server error",
364
+ error: err instanceof Error ? err.message : "Unknown error"
365
+ } });
366
+ }
367
+ }
368
+ /**
369
+ * Creates an OpenWhisk/Runtime action handler from the registered routes.
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * const router = new HttpActionRouter();
374
+ * router.get("/hello", { handler: () => ok({ message: "Hello!" }) });
375
+ *
376
+ * export const main = router.handler();
377
+ * ```
378
+ */
379
+ handler() {
380
+ return async (args) => {
381
+ const method = (args.__ow_method ?? "get").toUpperCase();
382
+ const rawPath = args.__ow_path ?? "/";
383
+ const path = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
384
+ const headers = args.__ow_headers ?? {};
385
+ const body = parseRequestBody(args.__ow_body, args);
386
+ const query = parseQueryParams(args.__ow_query, args);
387
+ const context = await this.buildContext(args);
388
+ const matchedMethods = [];
389
+ for (const route of this.routes) {
390
+ const match = route.pattern.exec(path);
391
+ if (!match) continue;
392
+ matchedMethods.push(route.method);
393
+ if (route.method !== method) continue;
394
+ const response = await this.handleRoute(route, match, body, query, headers, method, path, context);
395
+ if (response) return response;
396
+ }
397
+ if (matchedMethods.length > 0) return methodNotAllowed(`Method ${method} not allowed`);
398
+ return notFound(`No route matches ${path}`);
399
+ };
400
+ }
401
+ };
402
+
403
+ //#endregion
404
+ export { logger as n, HttpActionRouter as t };
@@ -1,5 +1,6 @@
1
- import { a as hasExternalEvents, c as hasCustomInstallationSteps, i as hasEventing, r as hasCommerceEvents, t as stringifyError } from "./error-P7JgUTds.mjs";
2
- import { t as inspect } from "./logging-VgerMhp6.mjs";
1
+ import { a as hasCommerceEvents, o as hasEventing, r as hasCustomInstallationSteps, s as hasExternalEvents } from "./installation-SWIwhpKT.mjs";
2
+ import { t as stringifyError } from "./error-CMV3IjBz.mjs";
3
+ import { t as inspect } from "./logging-CzmXDzxI.mjs";
3
4
  import camelcase from "camelcase";
4
5
  import { resolveAuthParams } from "@adobe/aio-commerce-lib-auth";
5
6
  import { resolveCommerceHttpClientParams, resolveIoEventsHttpClientParams } from "@adobe/aio-commerce-lib-api";
@@ -558,9 +559,9 @@ async function getIoEventsExistingData(context) {
558
559
  });
559
560
  const providersWithMetadata = existingProviders.map((providerHal) => {
560
561
  const { _embedded, _links, ...providerData } = providerHal;
561
- const actualMetadata = (_embedded?.eventmetadata ?? []).map(({ _embedded: _embedded$1, _links: _links$1, ...meta }) => ({
562
+ const actualMetadata = (_embedded?.eventmetadata ?? []).map(({ _embedded, _links, ...meta }) => ({
562
563
  ...meta,
563
- sample: _embedded$1?.sample_event ?? null
564
+ sample: _embedded?.sample_event ?? null
564
565
  }));
565
566
  return {
566
567
  ...providerData,
@@ -749,13 +750,13 @@ async function configureCommerceEventing(params, existingData) {
749
750
  enabled: true
750
751
  };
751
752
  if (existingData.isDefaultWorkspaceConfigurationEmpty) {
752
- if (!config.workspaceConfiguration) {
753
+ if (!config.workspace_configuration) {
753
754
  const message = "Workspace configuration is required to enable Commerce Eventing when there is not an existing one.";
754
755
  logger.error(message);
755
756
  throw new Error(message);
756
757
  }
757
758
  logger.info("Default provider workspace configuration already present, it will not be overriden");
758
- const { workspaceConfiguration, ...rest } = updateParams;
759
+ const { workspace_configuration, ...rest } = updateParams;
759
760
  updateParams = rest;
760
761
  }
761
762
  logger.info("Updating Commerce Eventing configuration with provided workspace configuration.");
@@ -779,11 +780,8 @@ async function createCommerceProvider(params) {
779
780
  const { commerceEventsClient, logger } = context;
780
781
  logger.info(`Creating Commerce provider "${provider.label}" with instance ID "${provider.instance_id}"`);
781
782
  return commerceEventsClient.createEventProvider({
782
- providerId: provider.id,
783
- instanceId: provider.instance_id,
784
- label: provider.label,
785
- description: provider.description,
786
- associatedWorkspaceConfiguration: provider.workspaceConfiguration
783
+ ...provider,
784
+ provider_id: provider.id
787
785
  }).then((res) => {
788
786
  logger.info(`Commerce provider "${provider.label}" created with ID '${res.provider_id}'`);
789
787
  return res;
@@ -820,10 +818,10 @@ async function createCommerceEventSubscription(params) {
820
818
  name: eventName,
821
819
  parent: event.config.name,
822
820
  fields: event.config.fields,
823
- providerId: provider.id,
821
+ provider_id: provider.id,
824
822
  destination: event.config.destination,
825
- hipaaAuditRequired: event.config.hipaaAuditRequired,
826
- prioritary: event.config.prioritary,
823
+ hipaa_audit_required: event.config.hipaa_audit_required,
824
+ priority: event.config.priority,
827
825
  force: event.config.force
828
826
  };
829
827
  logger.debug(`Event subscription specification for event "${event.config.name}": ${inspect(eventSpec)}`);
@@ -846,12 +844,7 @@ async function createOrGetCommerceEventSubscription(params, existingData) {
846
844
  const existing = findExistingSubscription(existingData, getNamespacedEvent(metadata, event.config.name));
847
845
  if (existing) {
848
846
  logger.info(`Subscription for event "${event.config.name}" already exists, skipping creation.`);
849
- return {
850
- name: existing.name,
851
- parent: existing.parent,
852
- fields: existing.fields,
853
- providerId: existing.provider_id
854
- };
847
+ return existing;
855
848
  }
856
849
  return createCommerceEventSubscription(params);
857
850
  }
@@ -920,7 +913,7 @@ async function onboardCommerceEventing(params, existingData) {
920
913
  const subscriptions = [];
921
914
  await configureCommerceEventing({
922
915
  context,
923
- config: { workspaceConfiguration }
916
+ config: { workspace_configuration: workspaceConfiguration }
924
917
  }, existingData);
925
918
  const { workspace_configuration: _, ...commerceProviderData } = await createOrGetCommerceProvider({
926
919
  context,
@@ -929,7 +922,7 @@ async function onboardCommerceEventing(params, existingData) {
929
922
  instance_id: instanceId,
930
923
  label: provider.label,
931
924
  description: provider.description,
932
- workspaceConfiguration
925
+ workspace_configuration: workspaceConfiguration
933
926
  }
934
927
  }, existingData.providers);
935
928
  for (const event of events) subscriptions.push(await createOrGetCommerceEventSubscription({
@@ -984,9 +977,9 @@ const commerceEventsStep = defineLeafStep({
984
977
  data: {
985
978
  ioEvents: providerData,
986
979
  commerce: commerceProvider,
987
- events: eventsData.map(({ config: config$1, data }, index) => {
980
+ events: eventsData.map(({ config, data }, index) => {
988
981
  return {
989
- config: config$1,
982
+ config,
990
983
  data: {
991
984
  ...data,
992
985
  subscription: subscriptions[index]