@adobe/aio-commerce-lib-events 0.3.6 → 0.5.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.
@@ -0,0 +1 @@
1
+ var __defProp=Object.defineProperty,__exportAll=(all,symbols)=>{let target={};for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});return symbols&&__defProp(target,Symbol.toStringTag,{value:`Module`}),target};export{__exportAll as t};
@@ -1,34 +1,34 @@
1
- /**
2
- * @license
3
- *
4
- * Copyright 2025 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
1
  import * as v from "valibot";
16
- import * as _adobe_aio_commerce_lib_api1 from "@adobe/aio-commerce-lib-api";
2
+ import * as _adobe_aio_commerce_lib_api0 from "@adobe/aio-commerce-lib-api";
17
3
  import { AdobeCommerceHttpClient, ApiFunction, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
18
4
  import { Options } from "@adobe/aio-commerce-lib-api/ky";
19
- import { CamelCasedPropertiesDeep } from "type-fest";
20
- import * as ky9 from "ky";
5
+ import * as ky0 from "ky";
21
6
 
7
+ //#region source/commerce/api/event-providers/types.d.ts
8
+ /** Defines the structure of a Commerce event provider. */
9
+ type CommerceEventProvider = {
10
+ id: string;
11
+ provider_id: string;
12
+ instance_id?: string;
13
+ label?: string;
14
+ description?: string;
15
+ workspace_configuration?: string;
16
+ };
17
+ /** Defines the fields of an event provider entity returned by the Commerce API. */
18
+ type CommerceEventProviderOneResponse = CommerceEventProvider;
19
+ /** Defines the fields of many event provider entities returned by the Commerce API. */
20
+ type CommerceEventProviderManyResponse = CommerceEventProvider[];
21
+ //#endregion
22
22
  //#region source/commerce/api/event-providers/schema.d.ts
23
23
  declare const EventProviderGetByIdParamsSchema: v.ObjectSchema<{
24
- readonly providerId: v.StringSchema<`Expected a string value for property '${string}'`>;
24
+ readonly providerId: v.StringSchema<`Expected a string value for '${string}'`>;
25
25
  }, undefined>;
26
26
  declare const EventProviderCreateParamsSchema: v.ObjectSchema<{
27
- readonly providerId: v.StringSchema<`Expected a string value for property '${string}'`>;
28
- readonly instanceId: v.StringSchema<`Expected a string value for property '${string}'`>;
29
- readonly label: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
30
- readonly description: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
31
- readonly associatedWorkspaceConfiguration: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.EmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.ParseJsonAction<string, undefined, `Expected valid JSON string for property '${string}'`>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
27
+ readonly providerId: v.StringSchema<`Expected a string value for '${string}'`>;
28
+ readonly instanceId: v.StringSchema<`Expected a string value for '${string}'`>;
29
+ readonly label: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
30
+ readonly description: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
31
+ readonly associatedWorkspaceConfiguration: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.EmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.ParseJsonAction<string, undefined, `Expected valid JSON string for property '${string}'`>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
32
32
  [x: string]: unknown;
33
33
  }, undefined, undefined>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
34
34
  [x: string]: unknown;
@@ -45,21 +45,6 @@ type EventProviderGetByIdParams = v.InferInput<typeof EventProviderGetByIdParams
45
45
  */
46
46
  type EventProviderCreateParams = v.InferInput<typeof EventProviderCreateParamsSchema>;
47
47
  //#endregion
48
- //#region source/commerce/api/event-providers/types.d.ts
49
- /** Defines the structure of a Commerce event provider. */
50
- type CommerceEventProvider = {
51
- id: string;
52
- provider_id: string;
53
- instance_id?: string;
54
- label?: string;
55
- description?: string;
56
- workspace_configuration?: string;
57
- };
58
- /** Defines the fields of an event provider entity returned by the Commerce API. */
59
- type CommerceEventProviderOneResponse = CamelCasedPropertiesDeep<CommerceEventProvider>;
60
- /** Defines the fields of many event provider entities returned by the Commerce API. */
61
- type CommerceEventProviderManyResponse = CommerceEventProviderOneResponse[];
62
- //#endregion
63
48
  //#region source/commerce/api/event-providers/endpoints.d.ts
64
49
  /**
65
50
  * Lists all event providers of the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
@@ -82,14 +67,7 @@ declare function getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetch
82
67
  * @throws A {@link CommerceSdkValidationError} If the parameters are in the wrong format.
83
68
  * @throws An {@link HTTPError} If the status code is not 2XX.
84
69
  */
85
- declare function getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: Options): Promise<{
86
- id: string;
87
- providerId: string;
88
- instanceId?: string | undefined;
89
- label?: string | undefined;
90
- description?: string | undefined;
91
- workspaceConfiguration?: string | undefined;
92
- }>;
70
+ declare function getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: Options): Promise<CommerceEventProvider>;
93
71
  /**
94
72
  * Creates an event provider in the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
95
73
  * @see https://developer.adobe.com/commerce/extensibility/events/api/#create-an-event-provider
@@ -101,27 +79,20 @@ declare function getEventProviderById(httpClient: AdobeCommerceHttpClient, param
101
79
  * @throws A {@link CommerceSdkValidationError} If the parameters are in the wrong format.
102
80
  * @throws An {@link HTTPError} If the status code is not 2XX.
103
81
  */
104
- declare function createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: Options): Promise<{
105
- id: string;
106
- providerId: string;
107
- instanceId?: string | undefined;
108
- label?: string | undefined;
109
- description?: string | undefined;
110
- workspaceConfiguration?: string | undefined;
111
- }>;
82
+ declare function createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: Options): Promise<CommerceEventProvider>;
112
83
  //#endregion
113
84
  //#region source/commerce/api/event-subscriptions/schema.d.ts
114
85
  declare const EventSubscriptionCreateParamsSchema: v.ObjectSchema<{
115
- readonly name: v.StringSchema<`Expected a string value for property '${string}'`>;
116
- readonly providerId: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
117
- readonly parent: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
86
+ readonly name: v.StringSchema<`Expected a string value for '${string}'`>;
87
+ readonly providerId: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
88
+ readonly parent: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
118
89
  readonly fields: v.ArraySchema<v.ObjectSchema<{
119
- readonly name: v.StringSchema<`Expected a string value for property '${string}'`>;
90
+ readonly name: v.StringSchema<`Expected a string value for '${string}'`>;
120
91
  }, undefined>, `Expected an array of objects with a 'name' property for the property "${string}"`>;
121
- readonly destination: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
122
- readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
123
- readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
124
- readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
92
+ readonly destination: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
93
+ readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
94
+ readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
95
+ readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
125
96
  }, undefined>;
126
97
  /**
127
98
  * The schema of the parameters received by the POST `eventing/eventSubscribe` Commerce API endpoint.
@@ -153,9 +124,9 @@ type CommerceEventSubscription = {
153
124
  hipaa_audit_required: boolean;
154
125
  };
155
126
  /** Defines the fields of an event subscription entity returned by the Commerce API. */
156
- type CommerceEventSubscriptionOneResponse = CamelCasedPropertiesDeep<CommerceEventSubscription>;
127
+ type CommerceEventSubscriptionOneResponse = CommerceEventSubscription;
157
128
  /** Defines the fields of many event subscription entities returned by the Commerce API. */
158
- type CommerceEventSubscriptionManyResponse = CommerceEventSubscriptionOneResponse[];
129
+ type CommerceEventSubscriptionManyResponse = CommerceEventSubscription[];
159
130
  //#endregion
160
131
  //#region source/commerce/api/event-subscriptions/endpoints.d.ts
161
132
  /**
@@ -182,30 +153,30 @@ declare function createEventSubscription(httpClient: AdobeCommerceHttpClient, pa
182
153
  //#region source/commerce/api/eventing-configuration/schema.d.ts
183
154
  /** The schema of the parameters received by the `updateConfiguration` Commerce Eventing API endpoint. */
184
155
  declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
185
- readonly enabled: v.BooleanSchema<`Expected a boolean value for property '${string}'`>;
186
- readonly providerId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed for property "${string}"`>]>;
187
- readonly instanceId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed for property "${string}"`>]>;
188
- readonly merchantId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed for "${string}"`>]>;
189
- readonly environmentId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed for "${string}"`>]>;
190
- readonly workspaceConfiguration: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.EmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.ParseJsonAction<string, undefined, `Expected valid JSON string for property '${string}'`>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
156
+ readonly enabled: v.BooleanSchema<`Expected a boolean value for '${string}'`>;
157
+ readonly providerId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed in string value of "${string}"${string}`>]>;
158
+ readonly instanceId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed in string value of "${string}"${string}`>]>;
159
+ readonly merchantId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed in string value of "${string}"${string}`>]>;
160
+ readonly environmentId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed in string value of "${string}"${string}`>]>;
161
+ readonly workspaceConfiguration: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.EmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.ParseJsonAction<string, undefined, `Expected valid JSON string for property '${string}'`>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
191
162
  [x: string]: unknown;
192
163
  }, undefined, undefined>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
193
164
  [x: string]: unknown;
194
165
  }, undefined, `Expected valid JSON data for property '${string}'`>]>], undefined>;
195
166
  }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
196
167
  readonly entries: {
197
- readonly enabled: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
198
- readonly providerId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed for property "${string}"`>]>, undefined>;
199
- readonly instanceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed for property "${string}"`>]>, undefined>;
200
- readonly merchantId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed for "${string}"`>]>, undefined>;
201
- readonly environmentId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed for "${string}"`>]>, undefined>;
202
- readonly workspaceConfiguration: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.EmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for property '${string}'`>, v.ParseJsonAction<string, undefined, `Expected valid JSON string for property '${string}'`>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
168
+ readonly enabled: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
169
+ readonly providerId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed in string value of "${string}"${string}`>]>, undefined>;
170
+ readonly instanceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters, underscores, and hyphens are allowed in string value of "${string}"${string}`>]>, undefined>;
171
+ readonly merchantId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed in string value of "${string}"${string}`>]>, undefined>;
172
+ readonly environmentId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and underscores are allowed in string value of "${string}"${string}`>]>, undefined>;
173
+ readonly workspaceConfiguration: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.EmptyAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.ParseJsonAction<string, undefined, `Expected valid JSON string for property '${string}'`>, v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
203
174
  [x: string]: unknown;
204
175
  }, undefined, undefined>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
205
176
  [x: string]: unknown;
206
177
  }, undefined, `Expected valid JSON data for property '${string}'`>]>], undefined>, undefined>;
207
178
  };
208
- readonly '~standard': v.StandardProps<{
179
+ readonly "~standard": v.StandardProps<{
209
180
  enabled?: boolean | undefined;
210
181
  providerId?: string | undefined;
211
182
  instanceId?: string | undefined;
@@ -222,19 +193,19 @@ declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
222
193
  environmentId?: string | undefined;
223
194
  workspaceConfiguration?: string | undefined;
224
195
  }>;
225
- readonly '~run': (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
196
+ readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
226
197
  enabled?: boolean | undefined;
227
198
  providerId?: string | undefined;
228
199
  instanceId?: string | undefined;
229
200
  merchantId?: string | undefined;
230
201
  environmentId?: string | undefined;
231
202
  workspaceConfiguration?: string | undefined;
232
- }, v.StringIssue | v.ObjectIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.BooleanIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.StringifyJsonIssue<{
203
+ }, v.ObjectIssue | v.BooleanIssue | v.StringIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
233
204
  [x: string]: unknown;
234
- }> | v.UnionIssue<v.StringIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.EmptyIssue<string> | v.StringifyJsonIssue<{
205
+ }> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
235
206
  [x: string]: unknown;
236
207
  }>>>;
237
- readonly '~types'?: {
208
+ readonly "~types"?: {
238
209
  readonly input: {
239
210
  enabled?: boolean | undefined;
240
211
  providerId?: string | undefined;
@@ -253,9 +224,9 @@ declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
253
224
  environmentId?: string | undefined;
254
225
  workspaceConfiguration?: string | undefined;
255
226
  };
256
- readonly issue: v.StringIssue | v.ObjectIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.BooleanIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.StringifyJsonIssue<{
227
+ readonly issue: v.ObjectIssue | v.BooleanIssue | v.StringIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
257
228
  [x: string]: unknown;
258
- }> | v.UnionIssue<v.StringIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.EmptyIssue<string> | v.StringifyJsonIssue<{
229
+ }> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
259
230
  [x: string]: unknown;
260
231
  }>>;
261
232
  } | undefined;
@@ -285,33 +256,24 @@ declare function updateEventingConfiguration(httpClient: AdobeCommerceHttpClient
285
256
  * Creates a new API client for the Commerce Events API client.
286
257
  * @param params - The parameters to build the Commerce HTTP client that will communicate with the Commerce Events API.
287
258
  */
288
- declare function createCommerceEventsApiClient(params: CommerceHttpClientParams): _adobe_aio_commerce_lib_api1.ApiClientRecord<AdobeCommerceHttpClient, {
259
+ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams): _adobe_aio_commerce_lib_api0.ApiClientRecord<AdobeCommerceHttpClient, {
289
260
  updateEventingConfiguration: typeof updateEventingConfiguration;
290
- getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky9.Options): Promise<CommerceEventSubscriptionManyResponse>;
291
- createEventSubscription(httpClient: AdobeCommerceHttpClient, params: EventSubscriptionCreateParams, fetchOptions?: ky9.Options): Promise<void>;
292
- getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky9.Options): Promise<CommerceEventProviderManyResponse>;
293
- getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: ky9.Options): Promise<{
294
- id: string;
295
- providerId: string;
296
- instanceId?: string | undefined;
297
- label?: string | undefined;
298
- description?: string | undefined;
299
- workspaceConfiguration?: string | undefined;
300
- }>;
301
- createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: ky9.Options): Promise<{
302
- id: string;
303
- providerId: string;
304
- instanceId?: string | undefined;
305
- label?: string | undefined;
306
- description?: string | undefined;
307
- workspaceConfiguration?: string | undefined;
308
- }>;
261
+ getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventSubscriptionManyResponse>;
262
+ createEventSubscription(httpClient: AdobeCommerceHttpClient, params: EventSubscriptionCreateParams, fetchOptions?: ky0.Options): Promise<void>;
263
+ getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventProviderManyResponse>;
264
+ getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: ky0.Options): Promise<CommerceEventProvider>;
265
+ createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: ky0.Options): Promise<CommerceEventProvider>;
309
266
  }>;
267
+ /**
268
+ * An API Client for the Commerce Events API.
269
+ * @see {@link createCommerceEventsApiClient}
270
+ */
271
+ type CommerceEventsApiClient = ReturnType<typeof createCommerceEventsApiClient>;
310
272
  /**
311
273
  * Creates a customized Commerce Events API client.
312
274
  * @param params - The parameters to build the Commerce HTTP client that will communicate with the Commerce Events API.
313
275
  * @param functions - The API functions to include in the client.
314
276
  */
315
- declare function createCustomCommerceEventsApiClient<TFunctions extends Record<string, ApiFunction<AdobeCommerceHttpClient, any[], any>>>(params: CommerceHttpClientParams, functions: TFunctions): _adobe_aio_commerce_lib_api1.ApiClientRecord<AdobeCommerceHttpClient, TFunctions>;
277
+ declare function createCustomCommerceEventsApiClient<TFunctions extends Record<string, ApiFunction<AdobeCommerceHttpClient, any[], any>>>(params: CommerceHttpClientParams, functions: TFunctions): _adobe_aio_commerce_lib_api0.ApiClientRecord<AdobeCommerceHttpClient, TFunctions>;
316
278
  //#endregion
317
- export { type CommerceEventProvider, type CommerceEventProviderManyResponse, type CommerceEventProviderOneResponse, type CommerceEventSubscription, type CommerceEventSubscriptionField, type CommerceEventSubscriptionManyResponse, type CommerceEventSubscriptionOneResponse, type CommerceEventSubscriptionRule, EventProviderCreateParams, EventProviderCreateParamsSchema, EventProviderGetByIdParams, EventProviderGetByIdParamsSchema, EventSubscriptionCreateParams, EventSubscriptionCreateParamsSchema, UpdateEventingConfigurationParams, UpdateEventingConfigurationParamsSchema, createCommerceEventsApiClient, createCustomCommerceEventsApiClient, createEventProvider, createEventSubscription, getAllEventProviders, getAllEventSubscriptions, getEventProviderById, updateEventingConfiguration };
279
+ export { type CommerceEventProvider, type CommerceEventProviderManyResponse, type CommerceEventProviderOneResponse, type CommerceEventSubscription, type CommerceEventSubscriptionField, type CommerceEventSubscriptionManyResponse, type CommerceEventSubscriptionOneResponse, type CommerceEventSubscriptionRule, CommerceEventsApiClient, EventProviderCreateParams, EventProviderCreateParamsSchema, EventProviderGetByIdParams, EventProviderGetByIdParamsSchema, EventSubscriptionCreateParams, EventSubscriptionCreateParamsSchema, UpdateEventingConfigurationParams, UpdateEventingConfigurationParamsSchema, createCommerceEventsApiClient, createCustomCommerceEventsApiClient, createEventProvider, createEventSubscription, getAllEventProviders, getAllEventSubscriptions, getEventProviderById, updateEventingConfiguration };
@@ -1,14 +1 @@
1
- /**
2
- * @license
3
- *
4
- * Copyright 2025 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
- import{a as parseOrThrow,i as stringValueSchema,n as alphaNumericOrUnderscoreSchema,o as __export,r as booleanValueSchema,t as alphaNumericOrUnderscoreOrHyphenSchema}from"../schemas-D5c1tsDe.mjs";import{buildCamelCaseKeysResponseHook}from"@adobe/aio-commerce-lib-api/utils";import{CommerceSdkValidationError}from"@adobe/aio-commerce-lib-core/error";import*as v from"valibot";import{AdobeCommerceHttpClient,ApiClient}from"@adobe/aio-commerce-lib-api";function workspaceConfigurationSchema(propertyName){return v.union([v.pipe(stringValueSchema(propertyName),v.empty()),v.pipe(stringValueSchema(propertyName),v.parseJson(void 0,`Expected valid JSON string for property '${propertyName}'`),v.record(v.string(),v.unknown()),v.stringifyJson()),v.pipe(v.record(v.string(),v.unknown()),v.stringifyJson(void 0,`Expected valid JSON data for property '${propertyName}'`))])}const EventProviderGetByIdParamsSchema=v.object({providerId:stringValueSchema(`providerId`)}),EventProviderCreateParamsSchema=v.object({providerId:stringValueSchema(`providerId`),instanceId:stringValueSchema(`instanceId`),label:v.optional(stringValueSchema(`label`)),description:v.optional(stringValueSchema(`description`)),associatedWorkspaceConfiguration:v.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports=__export({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/eventProvider`,fetchOptions).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderGetByIdParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderCreateParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).post(`eventing/eventProvider`,{...fetchOptions,json:{eventProvider:{provider_id:validatedParams.providerId,instance_id:validatedParams.instanceId,label:validatedParams.label,description:validatedParams.description,workspace_configuration:validatedParams.associatedWorkspaceConfiguration}}}).json()}function fieldsSchema(propertyName){return v.array(v.object({name:stringValueSchema(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=v.object({name:stringValueSchema(`name`),providerId:v.optional(stringValueSchema(`providerId`)),parent:v.optional(stringValueSchema(`parent`)),fields:fieldsSchema(`fields`),destination:v.optional(stringValueSchema(`destination`)),hipaaAuditRequired:v.optional(booleanValueSchema(`hipaaAuditRequired`)),prioritary:v.optional(booleanValueSchema(`prioritary`)),force:v.optional(booleanValueSchema(`force`))});var endpoints_exports$1=__export({createEventSubscription:()=>createEventSubscription,getAllEventSubscriptions:()=>getAllEventSubscriptions});async function getAllEventSubscriptions(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/getEventSubscriptions`,fetchOptions).json()}async function createEventSubscription(httpClient,params,fetchOptions){let{force,...event}=parseOrThrow(EventSubscriptionCreateParamsSchema,params);return httpClient.post(`eventing/eventSubscribe`,{...fetchOptions,json:{force,event:{name:event.name,parent:event.parent,fields:event.fields,destination:event.destination,hipaa_audit_required:event.hipaaAuditRequired,priority:event.prioritary,provider_id:event.providerId}}}).json().then(_res=>{})}const UpdateEventingConfigurationParamsSchema=v.partial(v.object({enabled:booleanValueSchema(`enabled`),providerId:alphaNumericOrUnderscoreOrHyphenSchema(`providerId`),instanceId:alphaNumericOrUnderscoreOrHyphenSchema(`instanceId`),merchantId:alphaNumericOrUnderscoreSchema(`merchantId`),environmentId:alphaNumericOrUnderscoreSchema(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));async function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}function createCommerceEventsApiClient(params){return ApiClient.create(new AdobeCommerceHttpClient(params),{...endpoints_exports,...endpoints_exports$1,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return ApiClient.create(new AdobeCommerceHttpClient(params),functions)}export{createCommerceEventsApiClient,createCustomCommerceEventsApiClient,createEventProvider,createEventSubscription,getAllEventProviders,getAllEventSubscriptions,getEventProviderById,updateEventingConfiguration};
1
+ import{t as __exportAll}from"../chunk-BKfb2J6I.mjs";import"@adobe/aio-commerce-lib-core/error";import{alphaNumericOrUnderscoreOrHyphenSchema,alphaNumericOrUnderscoreSchema,booleanValueSchema,parseOrThrow,stringValueSchema}from"@aio-commerce-sdk/common-utils/valibot";import*as v from"valibot";import{AdobeCommerceHttpClient,ApiClient}from"@adobe/aio-commerce-lib-api";function workspaceConfigurationSchema(propertyName){return v.union([v.pipe(stringValueSchema(propertyName),v.empty()),v.pipe(stringValueSchema(propertyName),v.parseJson(void 0,`Expected valid JSON string for property '${propertyName}'`),v.record(v.string(),v.unknown()),v.stringifyJson()),v.pipe(v.record(v.string(),v.unknown()),v.stringifyJson(void 0,`Expected valid JSON data for property '${propertyName}'`))])}const EventProviderGetByIdParamsSchema=v.object({providerId:stringValueSchema(`providerId`)}),EventProviderCreateParamsSchema=v.object({providerId:stringValueSchema(`providerId`),instanceId:stringValueSchema(`instanceId`),label:v.optional(stringValueSchema(`label`)),description:v.optional(stringValueSchema(`description`)),associatedWorkspaceConfiguration:v.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports$1=__exportAll({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,fetchOptions){return httpClient.get(`eventing/eventProvider`,fetchOptions).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderGetByIdParamsSchema,params);return httpClient.get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderCreateParamsSchema,params);return httpClient.post(`eventing/eventProvider`,{...fetchOptions,json:{eventProvider:{provider_id:validatedParams.providerId,instance_id:validatedParams.instanceId,label:validatedParams.label,description:validatedParams.description,workspace_configuration:validatedParams.associatedWorkspaceConfiguration}}}).json()}function fieldsSchema(propertyName){return v.array(v.object({name:stringValueSchema(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=v.object({name:stringValueSchema(`name`),providerId:v.optional(stringValueSchema(`providerId`)),parent:v.optional(stringValueSchema(`parent`)),fields:fieldsSchema(`fields`),destination:v.optional(stringValueSchema(`destination`)),hipaaAuditRequired:v.optional(booleanValueSchema(`hipaaAuditRequired`)),prioritary:v.optional(booleanValueSchema(`prioritary`)),force:v.optional(booleanValueSchema(`force`))});var endpoints_exports=__exportAll({createEventSubscription:()=>createEventSubscription,getAllEventSubscriptions:()=>getAllEventSubscriptions});async function getAllEventSubscriptions(httpClient,fetchOptions){return httpClient.get(`eventing/getEventSubscriptions`,fetchOptions).json()}async function createEventSubscription(httpClient,params,fetchOptions){let{force,...event}=parseOrThrow(EventSubscriptionCreateParamsSchema,params);return httpClient.post(`eventing/eventSubscribe`,{...fetchOptions,json:{force,event:{name:event.name,parent:event.parent,fields:event.fields,destination:event.destination,hipaa_audit_required:event.hipaaAuditRequired,priority:event.prioritary,provider_id:event.providerId}}}).json().then(_res=>{})}const UpdateEventingConfigurationParamsSchema=v.partial(v.object({enabled:booleanValueSchema(`enabled`),providerId:alphaNumericOrUnderscoreOrHyphenSchema(`providerId`),instanceId:alphaNumericOrUnderscoreOrHyphenSchema(`instanceId`),merchantId:alphaNumericOrUnderscoreSchema(`merchantId`),environmentId:alphaNumericOrUnderscoreSchema(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));async function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}function createCommerceEventsApiClient(params){return ApiClient.create(new AdobeCommerceHttpClient(params),{...endpoints_exports$1,...endpoints_exports,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return ApiClient.create(new AdobeCommerceHttpClient(params),functions)}export{createCommerceEventsApiClient,createCustomCommerceEventsApiClient,createEventProvider,createEventSubscription,getAllEventProviders,getAllEventSubscriptions,getEventProviderById,updateEventingConfiguration};