@adobe/aio-commerce-lib-events 0.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # @adobe/aio-commerce-lib-events
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#72](https://github.com/adobe/aio-commerce-sdk/pull/72) [`31eb4e4`](https://github.com/adobe/aio-commerce-sdk/commit/31eb4e403f30b593aafff57dc268bf9e6cf49f3e) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Introduce return types for API operations, and transform API responses to `camelCase`. Fixes some validation pipelines and wrongful API payloads.
8
+
9
+ - [#70](https://github.com/adobe/aio-commerce-sdk/pull/70) [`b2f7c2e`](https://github.com/adobe/aio-commerce-sdk/commit/b2f7c2efb46b54ba6819a19ead465f24b9f00de9) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Create library and introduce the following API operations:
10
+
11
+ **For Adobe I/O Events**:
12
+
13
+ | Category | Operations |
14
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | Event Providers | `getAllEventProviders`, `getEventProviderById`, `createEventProvider` |
16
+ | Event Providers (Shortcuts) | `getAllCommerceEventProviders`, `getAll3rdPartyCustomEventsProviders`, `createCommerceProvider`, `create3rdPartyCustomEventsProvider` |
17
+ | Event Metadata | `getAllEventMetadataForProvider`, `getEventMetadataForEventAndProvider`, `createEventMetadataForProvider` |
18
+
19
+ **For Adobe Commerce**:
20
+
21
+ | Category | Operations |
22
+ | ---------------------- | --------------------------------------------------------------------- |
23
+ | Event Providers | `getAllEventProviders`, `getEventProviderById`, `createEventProvider` |
24
+ | Event Subscriptions | `getAllEventSubscriptions`, `createEventSubscription` |
25
+ | Eventing Configuration | `updateEventingConfiguration` |
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Adobe
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@adobe/aio-commerce-lib-events`
2
+
3
+ Description for `@adobe/aio-commerce-lib-events`
@@ -0,0 +1,14 @@
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
+ const require_ky=require(`../ky-Rubdb7BL.cjs`),__adobe_aio_commerce_lib_core_error=require_ky.p(require(`@adobe/aio-commerce-lib-core/error`)),valibot=require_ky.p(require(`valibot`)),ky=require_ky.p(require(`ky`));function workspaceConfigurationSchema(propertyName){return valibot.union([valibot.pipe(require_ky.l(propertyName),valibot.empty()),valibot.pipe(require_ky.l(propertyName),valibot.parseJson(void 0,`Expected valid JSON string for property '${propertyName}'`),valibot.record(valibot.string(),valibot.unknown()),valibot.stringifyJson()),valibot.pipe(valibot.record(valibot.string(),valibot.unknown()),valibot.stringifyJson(void 0,`Expected valid JSON data for property '${propertyName}'`))])}const EventProviderGetByIdParamsSchema=valibot.object({providerId:require_ky.l(`providerId`)}),EventProviderCreateParamsSchema=valibot.object({providerId:require_ky.l(`providerId`),instanceId:require_ky.l(`instanceId`),label:valibot.optional(require_ky.l(`label`)),description:valibot.optional(require_ky.l(`description`)),associatedWorkspaceConfiguration:valibot.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports={};require_ky.o(endpoints_exports,{createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});function getAllEventProviders(httpClient,fetchOptions){let withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`eventing/eventProvider`,fetchOptions).json()}function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=require_ky.m(EventProviderGetByIdParamsSchema,params),withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}function createEventProvider(httpClient,params,fetchOptions){let validatedParams=require_ky.m(EventProviderCreateParamsSchema,params),withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.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 valibot.array(valibot.object({name:require_ky.l(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=valibot.object({name:require_ky.l(`name`),providerId:valibot.optional(require_ky.l(`providerId`)),parent:valibot.optional(require_ky.l(`parent`)),fields:fieldsSchema(`fields`),destination:valibot.optional(require_ky.l(`destination`)),hipaaAuditRequired:valibot.optional(require_ky.k(`hipaaAuditRequired`)),prioritary:valibot.optional(require_ky.k(`prioritary`)),force:valibot.optional(require_ky.k(`force`))});var endpoints_exports$1={};require_ky.o(endpoints_exports$1,{createEventSubscription:()=>createEventSubscription,getAllEventSubscriptions:()=>getAllEventSubscriptions});function getAllEventSubscriptions(httpClient,fetchOptions){let withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`eventing/getEventSubscriptions`,fetchOptions).json()}function createEventSubscription(httpClient,params,fetchOptions){let validatedParams=require_ky.m(EventSubscriptionCreateParamsSchema,params),{force,...event}=validatedParams;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()}const UpdateEventingConfigurationParamsSchema=valibot.partial(valibot.object({enabled:require_ky.k(`enabled`),providerId:require_ky.i(`providerId`),instanceId:require_ky.i(`instanceId`),merchantId:require_ky.j(`merchantId`),environmentId:require_ky.j(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=require_ky.m(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}const COMMERCE_SAAS_IMS_REQUIRED_SCOPES=[`openid`,`additional_info.projectedProductContext`,`commerce.accs`];function getCommerceUrl(config){let{baseUrl,storeViewCode,version}=config,commerceUrl=new URL(baseUrl),uppercasedVersion=version?.toUpperCase();return config.flavor===`paas`?commerceUrl.pathname+=`rest/${storeViewCode}/${uppercasedVersion}`:config.flavor===`saas`&&(commerceUrl.pathname+=`/${uppercasedVersion}`),commerceUrl.toString()}function buildCommerceHttpClientPaaS(params){let{auth,config,fetchOptions}=params,commerceUrl=getCommerceUrl(config),beforeRequestAuthHook=require_ky.e(auth),httpClient=ky.default.create({prefixUrl:commerceUrl,hooks:{beforeRequest:[beforeRequestAuthHook]}});return require_ky.b(httpClient,fetchOptions)}function buildCommerceHttpClientSaaS(params){let{auth,config,fetchOptions}=params,commerceUrl=getCommerceUrl(config),beforeRequestAuthHook=require_ky.f(auth)?require_ky.d(auth):require_ky.d(require_ky.c(auth,COMMERCE_SAAS_IMS_REQUIRED_SCOPES)),httpClient=ky.default.create({prefixUrl:commerceUrl,hooks:{beforeRequest:[beforeRequestAuthHook,request=>{request.headers.set(`Store`,config.storeViewCode)}]}});return require_ky.b(httpClient,fetchOptions)}function isPaaSParams(params){return params.config.flavor===`paas`}function isSaaSParams(params){return params.config.flavor===`saas`}function buildCommerceHttpClient(params){let flavor=params.config.flavor;if(isPaaSParams(params))return buildCommerceHttpClientPaaS(params);if(isSaaSParams(params))return buildCommerceHttpClientSaaS(params);throw Error(`Invalid Commerce configuration. Unknown flavor: ${flavor}`)}const DEFAULT_STORE_VIEW_CODE=`all`,DEFAULT_API_VERSION=`V1`;var AdobeCommerceHttpClient=class extends require_ky.g{constructor(params){let config={...params.config,storeViewCode:params.config.storeViewCode??`all`,version:params.config.version??`V1`},requiredParams={...params,config},httpClient=buildCommerceHttpClient(requiredParams);super(config,httpClient)}};function createCommerceEventsApiClient(params){return require_ky.h.create(new AdobeCommerceHttpClient(params),{...endpoints_exports,...endpoints_exports$1,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return require_ky.h.create(new AdobeCommerceHttpClient(params),functions)}exports.createCommerceEventsApiClient=createCommerceEventsApiClient,exports.createCustomCommerceEventsApiClient=createCustomCommerceEventsApiClient,exports.createEventProvider=createEventProvider,exports.createEventSubscription=createEventSubscription,exports.getAllEventProviders=getAllEventProviders,exports.getAllEventSubscriptions=getAllEventSubscriptions,exports.getEventProviderById=getEventProviderById,exports.updateEventingConfiguration=updateEventingConfiguration;
@@ -0,0 +1,316 @@
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
+ import * as ky0 from "ky";
16
+ import { Options } from "ky";
17
+ import * as v from "valibot";
18
+ import { CamelCasedPropertiesDeep } from "type-fest";
19
+
20
+ //#region source/commerce/api/event-providers/schema.d.ts
21
+ declare const EventProviderGetByIdParamsSchema: v.ObjectSchema<{
22
+ readonly providerId: v.StringSchema<`Expected a string value for property '${string}'`>;
23
+ }, undefined>;
24
+ declare const EventProviderCreateParamsSchema: v.ObjectSchema<{
25
+ readonly providerId: v.StringSchema<`Expected a string value for property '${string}'`>;
26
+ readonly instanceId: v.StringSchema<`Expected a string value for property '${string}'`>;
27
+ readonly label: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
28
+ readonly description: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
29
+ 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<{
30
+ [x: string]: unknown;
31
+ }, undefined, undefined>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
32
+ [x: string]: unknown;
33
+ }, undefined, `Expected valid JSON data for property '${string}'`>]>], undefined>, undefined>;
34
+ }, undefined>;
35
+ /**
36
+ * The schema of the parameters received by the GET `eventing/eventProvider/:id` Commerce API endpoint.
37
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#get-event-provider-by-id
38
+ */
39
+ type EventProviderGetByIdParams = v.InferInput<typeof EventProviderGetByIdParamsSchema>;
40
+ /**
41
+ * The schema of the parameters received by the POST `eventing/eventProvider` Commerce API endpoint.
42
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#create-an-event-provider
43
+ */
44
+ type EventProviderCreateParams = v.InferInput<typeof EventProviderCreateParamsSchema>;
45
+ //#endregion
46
+ //#region source/commerce/api/event-providers/types.d.ts
47
+ /** Defines the structure of a Commerce event provider. */
48
+ type CommerceEventProvider = {
49
+ id: string;
50
+ provider_id: string;
51
+ instance_id?: string;
52
+ label?: string;
53
+ description?: string;
54
+ workspace_configuration?: string;
55
+ };
56
+ /** Defines the fields of an event provider entity returned by the Commerce API. */
57
+ type CommerceEventProviderOneResponse = CamelCasedPropertiesDeep<CommerceEventProvider>;
58
+ /** Defines the fields of many event provider entities returned by the Commerce API. */
59
+ type CommerceEventProviderManyResponse = CommerceEventProviderOneResponse[];
60
+ //#endregion
61
+ //#region source/commerce/api/event-providers/endpoints.d.ts
62
+ /**
63
+ * Lists all event providers of the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
64
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#get-list-of-all-event-providers
65
+ *
66
+ * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
67
+ * @param params - The parameters to list the event providers with.
68
+ * @param fetchOptions - The {@link Options} to use to make the request.
69
+ *
70
+ * @throws An {@link HTTPError} If the status code is not 2XX.
71
+ */
72
+ declare function getAllEventProviders(httpClient: AdobeCommerceHttpClient$3, fetchOptions?: Options): Promise<CommerceEventProviderManyResponse>;
73
+ /**
74
+ * Gets the info of the event provider with the given ID of the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
75
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#get-event-provider-by-id
76
+ *
77
+ * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
78
+ * @param params - The parameters to get the event provider by.
79
+ * @param fetchOptions - The {@link Options} to use to make the request.
80
+ *
81
+ * @throws A {@link CommerceSdkValidationError} If the parameters are in the wrong format.
82
+ * @throws An {@link HTTPError} If the status code is not 2XX.
83
+ */
84
+ declare function getEventProviderById(httpClient: AdobeCommerceHttpClient$3, params: EventProviderGetByIdParams, fetchOptions?: Options): Promise<{
85
+ id: string;
86
+ providerId: string;
87
+ instanceId?: string | undefined;
88
+ label?: string | undefined;
89
+ description?: string | undefined;
90
+ workspaceConfiguration?: string | undefined;
91
+ }>;
92
+ /**
93
+ * Creates an event provider in the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
94
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#create-an-event-provider
95
+ *
96
+ * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
97
+ * @param params - The parameters to create the event provider with.
98
+ * @param fetchOptions - The {@link Options} to use to make the request.
99
+ *
100
+ * @throws A {@link CommerceSdkValidationError} If the parameters are in the wrong format.
101
+ * @throws An {@link HTTPError} If the status code is not 2XX.
102
+ */
103
+ declare function createEventProvider(httpClient: AdobeCommerceHttpClient$3, params: EventProviderCreateParams, fetchOptions?: Options): Promise<{
104
+ id: string;
105
+ providerId: string;
106
+ instanceId?: string | undefined;
107
+ label?: string | undefined;
108
+ description?: string | undefined;
109
+ workspaceConfiguration?: string | undefined;
110
+ }>;
111
+ //#endregion
112
+ //#region source/commerce/api/event-subscriptions/schema.d.ts
113
+ declare const EventSubscriptionCreateParamsSchema: v.ObjectSchema<{
114
+ readonly name: v.StringSchema<`Expected a string value for property '${string}'`>;
115
+ readonly providerId: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
116
+ readonly parent: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
117
+ readonly fields: v.ArraySchema<v.ObjectSchema<{
118
+ readonly name: v.StringSchema<`Expected a string value for property '${string}'`>;
119
+ }, undefined>, `Expected an array of objects with a 'name' property for the property "${string}"`>;
120
+ readonly destination: v.OptionalSchema<v.StringSchema<`Expected a string value for property '${string}'`>, undefined>;
121
+ readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
122
+ readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
123
+ readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
124
+ }, undefined>;
125
+ /**
126
+ * The schema of the parameters received by the POST `eventing/eventSubscribe` Commerce API endpoint.
127
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#subscribe-to-events
128
+ */
129
+ type EventSubscriptionCreateParams = v.InferInput<typeof EventSubscriptionCreateParamsSchema>;
130
+ //#endregion
131
+ //#region source/commerce/api/event-subscriptions/types.d.ts
132
+ /** Defines the structure of a field in a Commerce event subscription. */
133
+ type CommerceEventSubscriptionField = {
134
+ name: string;
135
+ converter?: string;
136
+ };
137
+ /** Defines the structure of a filtering rule in a Commerce event subscription. */
138
+ type CommerceEventSubscriptionRule = {
139
+ field: string;
140
+ value: string;
141
+ operator: string;
142
+ };
143
+ /** Defines the structure of a Commerce event subscription. */
144
+ type CommerceEventSubscription = {
145
+ name: string;
146
+ parent: string;
147
+ provider_id: "default" | string;
148
+ fields: CommerceEventSubscriptionField[];
149
+ rules: CommerceEventSubscriptionRule[];
150
+ destination: "default" | string;
151
+ priority: boolean;
152
+ hipaa_audit_required: boolean;
153
+ };
154
+ /** Defines the fields of an event subscription entity returned by the Commerce API. */
155
+ type CommerceEventSubscriptionOneResponse = CamelCasedPropertiesDeep<CommerceEventSubscription>;
156
+ /** Defines the fields of many event subscription entities returned by the Commerce API. */
157
+ type CommerceEventSubscriptionManyResponse = CommerceEventSubscriptionOneResponse[];
158
+ //#endregion
159
+ //#region source/commerce/api/event-subscriptions/endpoints.d.ts
160
+ /**
161
+ * Gets all event subscriptions in the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
162
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#get-a-list-of-all-subscribed-events
163
+ *
164
+ * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
165
+ * @param fetchOptions - The {@link Options} to use to make the request.
166
+ */
167
+ declare function getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient$2, fetchOptions?: Options): Promise<CommerceEventSubscriptionManyResponse>;
168
+ /**
169
+ * Creates an event subscription in the Commerce instance bound to the given {@link AdobeCommerceHttpClient}.
170
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#subscribe-to-events
171
+ *
172
+ * @param httpClient - The {@link AdobeCommerceHttpClient} to use to make the request.
173
+ * @param params - The parameters to create the event subscription with.
174
+ * @param fetchOptions - The {@link Options} to use to make the request.
175
+ *
176
+ * @throws A {@link CommerceSdkValidationError} If the parameters are in the wrong format.
177
+ * @throws An {@link HTTPError} If the status code is not 2XX.
178
+ */
179
+ declare function createEventSubscription(httpClient: AdobeCommerceHttpClient$2, params: EventSubscriptionCreateParams, fetchOptions?: Options): void;
180
+ //#endregion
181
+ //#region source/commerce/api/eventing-configuration/schema.d.ts
182
+ /** The schema of the parameters received by the `updateConfiguration` Commerce Eventing API endpoint. */
183
+ declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
184
+ readonly enabled: v.BooleanSchema<`Expected a boolean value for property '${string}'`>;
185
+ 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}"`>]>;
186
+ 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}"`>]>;
187
+ 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}"`>]>;
188
+ 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}"`>]>;
189
+ 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<{
190
+ [x: string]: unknown;
191
+ }, undefined, undefined>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
192
+ [x: string]: unknown;
193
+ }, undefined, `Expected valid JSON data for property '${string}'`>]>], undefined>;
194
+ }, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
195
+ readonly entries: {
196
+ readonly enabled: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for property '${string}'`>, undefined>;
197
+ 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>;
198
+ 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>;
199
+ 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>;
200
+ 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>;
201
+ 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<{
202
+ [x: string]: unknown;
203
+ }, undefined, undefined>]>, v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, v.StringifyJsonAction<{
204
+ [x: string]: unknown;
205
+ }, undefined, `Expected valid JSON data for property '${string}'`>]>], undefined>, undefined>;
206
+ };
207
+ readonly '~standard': v.StandardProps<{
208
+ enabled?: boolean | undefined;
209
+ providerId?: string | undefined;
210
+ instanceId?: string | undefined;
211
+ merchantId?: string | undefined;
212
+ environmentId?: string | undefined;
213
+ workspaceConfiguration?: string | {
214
+ [x: string]: unknown;
215
+ } | undefined;
216
+ }, {
217
+ enabled?: boolean | undefined;
218
+ providerId?: string | undefined;
219
+ instanceId?: string | undefined;
220
+ merchantId?: string | undefined;
221
+ environmentId?: string | undefined;
222
+ workspaceConfiguration?: string | undefined;
223
+ }>;
224
+ readonly '~run': (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
225
+ enabled?: boolean | undefined;
226
+ providerId?: string | undefined;
227
+ instanceId?: string | undefined;
228
+ merchantId?: string | undefined;
229
+ environmentId?: string | undefined;
230
+ workspaceConfiguration?: string | undefined;
231
+ }, v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
232
+ [x: string]: unknown;
233
+ }> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
234
+ [x: string]: unknown;
235
+ }>> | v.ObjectIssue | v.BooleanIssue | v.RegexIssue<string>>;
236
+ readonly '~types'?: {
237
+ readonly input: {
238
+ enabled?: boolean | undefined;
239
+ providerId?: string | undefined;
240
+ instanceId?: string | undefined;
241
+ merchantId?: string | undefined;
242
+ environmentId?: string | undefined;
243
+ workspaceConfiguration?: string | {
244
+ [x: string]: unknown;
245
+ } | undefined;
246
+ };
247
+ readonly output: {
248
+ enabled?: boolean | undefined;
249
+ providerId?: string | undefined;
250
+ instanceId?: string | undefined;
251
+ merchantId?: string | undefined;
252
+ environmentId?: string | undefined;
253
+ workspaceConfiguration?: string | undefined;
254
+ };
255
+ readonly issue: v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
256
+ [x: string]: unknown;
257
+ }> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
258
+ [x: string]: unknown;
259
+ }>> | v.ObjectIssue | v.BooleanIssue | v.RegexIssue<string>;
260
+ } | undefined;
261
+ };
262
+ /**
263
+ * Defines the parameters received by the `updateConfiguration` Commerce Eventing API endpoint.
264
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#configure-commerce-eventing
265
+ */
266
+ type UpdateEventingConfigurationParams = v.InferInput<typeof UpdateEventingConfigurationParamsSchema>;
267
+ //#endregion
268
+ //#region source/commerce/api/eventing-configuration/endpoints.d.ts
269
+ /**
270
+ * Updates the configuration of the Commerce Eventing API.
271
+ * @see https://developer.adobe.com/commerce/extensibility/events/api/#configure-commerce-eventing
272
+ *
273
+ * @param httpClient - The {@link CommerceHttpClient} to use to make the request.
274
+ * @param params - The parameters to update the configuration with.
275
+ * @param fetchOptions - The {@link Options} to use to make the request.
276
+ *
277
+ * @throws A {@link CommerceSdkValidationError} If the parameters are in the wrong format.
278
+ * @throws An {@link HTTPError} If the status code is not 2XX.
279
+ */
280
+ declare function updateEventingConfiguration(httpClient: AdobeCommerceHttpClient$1, params: UpdateEventingConfigurationParams, fetchOptions?: Options): Promise<boolean>;
281
+ //#endregion
282
+ //#region source/commerce/lib/api-client.d.ts
283
+ /**
284
+ * Creates a new API client for the Commerce Events API client.
285
+ * @param params - The parameters to build the Commerce HTTP client that will communicate with the Commerce Events API.
286
+ */
287
+ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams): void 0<AdobeCommerceHttpClient, {
288
+ updateEventingConfiguration: typeof updateEventingConfiguration;
289
+ getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventSubscriptionManyResponse>;
290
+ createEventSubscription(httpClient: AdobeCommerceHttpClient, params: EventSubscriptionCreateParams, fetchOptions?: ky0.Options): void;
291
+ getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventProviderManyResponse>;
292
+ getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: ky0.Options): Promise<{
293
+ id: string;
294
+ providerId: string;
295
+ instanceId?: string | undefined;
296
+ label?: string | undefined;
297
+ description?: string | undefined;
298
+ workspaceConfiguration?: string | undefined;
299
+ }>;
300
+ createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: ky0.Options): Promise<{
301
+ id: string;
302
+ providerId: string;
303
+ instanceId?: string | undefined;
304
+ label?: string | undefined;
305
+ description?: string | undefined;
306
+ workspaceConfiguration?: string | undefined;
307
+ }>;
308
+ }>;
309
+ /**
310
+ * Creates a customized Commerce Events API client.
311
+ * @param params - The parameters to build the Commerce HTTP client that will communicate with the Commerce Events API.
312
+ * @param functions - The API functions to include in the client.
313
+ */
314
+ declare function createCustomCommerceEventsApiClient<TFunctions extends Record<string, ApiFunction<AdobeCommerceHttpClient, unknown[], unknown>>>(params: CommerceHttpClientParams, functions: TFunctions): void 0<AdobeCommerceHttpClient, TFunctions>;
315
+ //#endregion
316
+ 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 };
@@ -0,0 +1,14 @@
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
+ const require_ky=require(`../ky-Rubdb7BL.cjs`),valibot=require_ky.p(require(`valibot`)),ky=require_ky.p(require(`ky`)),IO_EVENTS_IMS_REQUIRED_SCOPES=[`adobeio_api`];function buildIoEventsHttpClient(params){let{auth,config,fetchOptions}=params,beforeRequestAuthHook=require_ky.f(auth)?require_ky.d(auth):require_ky.d(require_ky.c(auth,IO_EVENTS_IMS_REQUIRED_SCOPES)),adobeIoBaseUrl=config.baseUrl,httpClient=ky.default.create({prefixUrl:adobeIoBaseUrl,headers:{Accept:`application/hal+json`},hooks:{beforeRequest:[beforeRequestAuthHook]}});return require_ky.b(httpClient,fetchOptions)}const DEFAULT_IO_EVENTS_BASE_URL=`https://api.adobe.io/events`;var AdobeIoEventsHttpClient=class extends require_ky.g{constructor(params){let config={...params.config,baseUrl:params.config?.baseUrl??`https://api.adobe.io/events`},httpClient=buildIoEventsHttpClient({...params,config});super(config,httpClient)}};const BASE64_ENCODED_STRING_REGEX=/^[A-Za-z0-9+/]*={0,2}$/,BASE64_ENCODED_STRING_LENGTH_REMAINDER=4;function isBase64EncodedString(value){return BASE64_ENCODED_STRING_REGEX.test(value)&&value.length%4==0}function encodeToBase64(value){return Buffer.from(value).toString(`base64`)}function tryDecodeFromBase64(value){return isBase64EncodedString(value)?Buffer.from(value,`base64`).toString(`utf-8`):value}function sampleEventTemplateSchema(fieldName){return valibot.pipe(valibot.union([valibot.pipe(require_ky.l(fieldName),valibot.transform(tryDecodeFromBase64),valibot.parseJson(void 0,`Expected valid JSON string for property '${fieldName}'`),valibot.record(valibot.string(),valibot.unknown()),valibot.stringifyJson()),valibot.record(valibot.string(),valibot.unknown()),valibot.array(valibot.unknown())]),valibot.stringifyJson(void 0,`Expected valid JSON data for property '${fieldName}'`),valibot.transform(encodeToBase64))}const GetAllEventMetadataForProviderSchema=valibot.object({providerId:require_ky.l(`providerId`)}),GetEventMetadataForEventAndProviderSchema=valibot.object({eventCode:require_ky.l(`eventCode`),providerId:require_ky.l(`providerId`)}),CreateEventMetadataForProviderSchema=valibot.object({consumerOrgId:require_ky.l(`consumerOrgId`),projectId:require_ky.l(`projectId`),workspaceId:require_ky.l(`workspaceId`),providerId:require_ky.l(`providerId`),label:require_ky.l(`label`),description:require_ky.l(`description`),eventCode:require_ky.l(`eventCode`),sampleEventTemplate:valibot.optional(sampleEventTemplateSchema(`sampleEventTemplate`))});var endpoints_exports={};require_ky.o(endpoints_exports,{createEventMetadataForProvider:()=>createEventMetadataForProvider,getAllEventMetadataForProvider:()=>getAllEventMetadataForProvider,getEventMetadataForEventAndProvider:()=>getEventMetadataForEventAndProvider});function getAllEventMetadataForProvider(httpClient,params,fetchOptions){let validatedParams=require_ky.m(GetAllEventMetadataForProviderSchema,params),withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`providers/${validatedParams.providerId}/eventmetadata`,fetchOptions).json()}function getEventMetadataForEventAndProvider(httpClient,params,fetchOptions){let validatedParams=require_ky.m(GetEventMetadataForEventAndProviderSchema,params),withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`providers/${validatedParams.providerId}/eventmetadata/${validatedParams.eventCode}`,fetchOptions).json()}function createEventMetadataForProvider(httpClient,params,fetchOptions){let validatedParams=require_ky.m(CreateEventMetadataForProviderSchema,params),withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.post(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/providers/${validatedParams.providerId}/eventmetadata`,{...fetchOptions,json:{label:validatedParams.label,description:validatedParams.description,event_code:validatedParams.eventCode,sample_event_template:validatedParams.sampleEventTemplate}}).json()}function setQueryParamIfTruthy(queryParams,key,value){value&&queryParams.set(key,`${value}`)}function setArrayQueryParam(queryParams,key,values){if(values!==void 0&&values.length>0)for(let value of values)queryParams.set(key,`${value}`)}const VALID_EVENT_PROVIDER_TYPES=[`dx_commerce_events`,`3rd_party_custom_events`],VALID_DATA_RESIDENCY_REGIONS=[`va6`,`irl1`],EventProviderTypeSchema=valibot.picklist(VALID_EVENT_PROVIDER_TYPES),DataResidencyRegionSchema=valibot.picklist(VALID_DATA_RESIDENCY_REGIONS),EventProviderListAllParamsSchema=valibot.object({consumerOrgId:require_ky.l(`consumerOrgId`),withEventMetadata:valibot.optional(require_ky.k(`withEventMetadata`)),filterBy:valibot.optional(valibot.object({instanceId:valibot.optional(require_ky.l(`instanceId`)),providerTypes:valibot.optional(valibot.union([valibot.array(EventProviderTypeSchema,`Expected an array of event provider types`)]))}))}),EventProviderGetByIdParamsSchema=valibot.object({providerId:require_ky.l(`providerId`),withEventMetadata:valibot.optional(require_ky.k(`withEventMetadata`))}),EventProviderCreateParamsSchema=valibot.object({consumerOrgId:require_ky.l(`consumerOrgId`),projectId:require_ky.l(`projectId`),workspaceId:require_ky.l(`workspaceId`),label:require_ky.l(`label`),description:valibot.optional(require_ky.l(`description`)),docsUrl:valibot.optional(require_ky.l(`docsUrl`)),instanceId:valibot.optional(require_ky.l(`instanceId`)),providerType:valibot.optional(EventProviderTypeSchema),dataResidencyRegion:valibot.optional(DataResidencyRegionSchema)});var endpoints_exports$1={};require_ky.o(endpoints_exports$1,{createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});function getAllEventProviders(httpClient,params,fetchOptions){let validatedParams=require_ky.m(EventProviderListAllParamsSchema,params),queryParams=new URLSearchParams,{providerTypes=[],instanceId}=validatedParams.filterBy??{};setArrayQueryParam(queryParams,`providerMetadataIds`,providerTypes),setQueryParamIfTruthy(queryParams,`instanceId`,instanceId),setQueryParamIfTruthy(queryParams,`eventmetadata`,validatedParams.withEventMetadata);let withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`${validatedParams.consumerOrgId}/providers`,{...fetchOptions,searchParams:queryParams}).json()}function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=require_ky.m(EventProviderGetByIdParamsSchema,params),searchParams=new URLSearchParams;setQueryParamIfTruthy(searchParams,`eventmetadata`,validatedParams.withEventMetadata);let withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.get(`providers/${params.providerId}`,{...fetchOptions,searchParams}).json()}function createEventProvider(httpClient,params,fetchOptions){let validatedParams=require_ky.m(EventProviderCreateParamsSchema,params),withHooksClient=httpClient.extend({hooks:{afterResponse:[require_ky.n()]}});return withHooksClient.post(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/providers`,{...fetchOptions,json:{...validatedParams,docs_url:validatedParams.docsUrl,provider_metadata:validatedParams.providerType,instance_id:validatedParams.instanceId,data_residency_region:validatedParams.dataResidencyRegion}}).json()}var shorthands_exports={};require_ky.o(shorthands_exports,{create3rdPartyCustomEventProvider:()=>create3rdPartyCustomEventProvider,createCommerceEventProvider:()=>createCommerceEventProvider,getAll3rdPartyCustomEventProviders:()=>getAll3rdPartyCustomEventProviders,getAllCommerceEventProviders:()=>getAllCommerceEventProviders});function getAllCommerceEventProviders(httpClient,params,fetchOptions){return getAllEventProviders(httpClient,{...params,filterBy:{...params.filterBy,providerTypes:[`dx_commerce_events`]}},fetchOptions)}function getAll3rdPartyCustomEventProviders(httpClient,params,fetchOptions){return getAllEventProviders(httpClient,{...params,filterBy:{...params.filterBy,providerTypes:[`3rd_party_custom_events`]}},fetchOptions)}function createCommerceEventProvider(httpClient,params,fetchOptions){return createEventProvider(httpClient,{...params,providerType:`dx_commerce_events`},fetchOptions)}function create3rdPartyCustomEventProvider(httpClient,params,fetchOptions){return createEventProvider(httpClient,{...params,providerType:`3rd_party_custom_events`},fetchOptions)}function createAdobeIoEventsApiClient(params){return require_ky.h.create(new AdobeIoEventsHttpClient(params),{...endpoints_exports$1,...endpoints_exports,...shorthands_exports})}function createCustomAdobeIoEventsApiClient(params,functions){return require_ky.h.create(new AdobeIoEventsHttpClient(params),functions)}exports.create3rdPartyCustomEventProvider=create3rdPartyCustomEventProvider,exports.createAdobeIoEventsApiClient=createAdobeIoEventsApiClient,exports.createCommerceEventProvider=createCommerceEventProvider,exports.createCustomAdobeIoEventsApiClient=createCustomAdobeIoEventsApiClient,exports.createEventMetadataForProvider=createEventMetadataForProvider,exports.createEventProvider=createEventProvider,exports.getAll3rdPartyCustomEventProviders=getAll3rdPartyCustomEventProviders,exports.getAllCommerceEventProviders=getAllCommerceEventProviders,exports.getAllEventMetadataForProvider=getAllEventMetadataForProvider,exports.getAllEventProviders=getAllEventProviders,exports.getEventMetadataForEventAndProvider=getEventMetadataForEventAndProvider,exports.getEventProviderById=getEventProviderById;