@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.
- package/CHANGELOG.md +29 -0
- package/dist/cjs/chunk-BZ64pZp-.cjs +1 -0
- package/dist/cjs/commerce/index.cjs +1 -14
- package/dist/cjs/commerce/index.d.cts +60 -98
- package/dist/cjs/io-events/index.cjs +1 -14
- package/dist/cjs/io-events/index.d.cts +436 -1911
- package/dist/es/chunk-BKfb2J6I.mjs +1 -0
- package/dist/es/commerce/index.d.mts +67 -105
- package/dist/es/commerce/index.mjs +1 -14
- package/dist/es/io-events/index.d.mts +437 -1912
- package/dist/es/io-events/index.mjs +1 -14
- package/package.json +5 -4
- package/dist/cjs/schemas-CwY-HoKq.cjs +0 -14
- package/dist/es/schemas-D5c1tsDe.mjs +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-events
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#220](https://github.com/adobe/aio-commerce-sdk/pull/220) [`43cd7d1`](https://github.com/adobe/aio-commerce-sdk/commit/43cd7d16ae676e59ee501ccbe89a38c20d777740) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - [BREAKING]: Remove camel case transformations on responses
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`43cd7d1`](https://github.com/adobe/aio-commerce-sdk/commit/43cd7d16ae676e59ee501ccbe89a38c20d777740), [`6063a97`](https://github.com/adobe/aio-commerce-sdk/commit/6063a97299c9b44f663314420b59cee7998b2f89), [`6063a97`](https://github.com/adobe/aio-commerce-sdk/commit/6063a97299c9b44f663314420b59cee7998b2f89)]:
|
|
12
|
+
- @adobe/aio-commerce-lib-api@0.6.0
|
|
13
|
+
- @aio-commerce-sdk/common-utils@0.1.0
|
|
14
|
+
- @adobe/aio-commerce-lib-auth@0.8.0
|
|
15
|
+
|
|
16
|
+
## 0.4.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [#201](https://github.com/adobe/aio-commerce-sdk/pull/201) [`ed5d4ac`](https://github.com/adobe/aio-commerce-sdk/commit/ed5d4ac86b6fd62129715de7a94c511dd54985e4) Thanks [@jnatherley](https://github.com/jnatherley)! - Refactor library to extract common code out to use common-utils package
|
|
21
|
+
|
|
22
|
+
- [#200](https://github.com/adobe/aio-commerce-sdk/pull/200) [`5373ab9`](https://github.com/adobe/aio-commerce-sdk/commit/5373ab9d151ca420df3052d33d163d66af02fe71) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Implement event registration endpoints for Adobe I/O events
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`f2b6f34`](https://github.com/adobe/aio-commerce-sdk/commit/f2b6f34709a5adcca93b852b5855cb6b1c852312), [`ac46985`](https://github.com/adobe/aio-commerce-sdk/commit/ac46985186961c65eddc6be3200dbe1e00369055), [`f2b6f34`](https://github.com/adobe/aio-commerce-sdk/commit/f2b6f34709a5adcca93b852b5855cb6b1c852312), [`ed5d4ac`](https://github.com/adobe/aio-commerce-sdk/commit/ed5d4ac86b6fd62129715de7a94c511dd54985e4), [`ac46985`](https://github.com/adobe/aio-commerce-sdk/commit/ac46985186961c65eddc6be3200dbe1e00369055), [`ac46985`](https://github.com/adobe/aio-commerce-sdk/commit/ac46985186961c65eddc6be3200dbe1e00369055), [`ac46985`](https://github.com/adobe/aio-commerce-sdk/commit/ac46985186961c65eddc6be3200dbe1e00369055)]:
|
|
27
|
+
- @adobe/aio-commerce-lib-core@0.6.0
|
|
28
|
+
- @adobe/aio-commerce-lib-api@0.5.0
|
|
29
|
+
- @aio-commerce-sdk/common-utils@0.0.2
|
|
30
|
+
- @adobe/aio-commerce-lib-auth@0.7.0
|
|
31
|
+
|
|
3
32
|
## 0.3.6
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__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},__copyProps=(to,from,except,desc)=>{if(from&&typeof from==`object`||typeof from==`function`)for(var keys=__getOwnPropNames(from),i=0,n=keys.length,key;i<n;i++)key=keys[i],!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:(k=>from[k]).bind(null,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM=(mod,isNodeMode,target)=>(target=mod==null?{}:__create(__getProtoOf(mod)),__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,`default`,{value:mod,enumerable:!0}):target,mod));Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return __toESM}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return __exportAll}});
|
|
@@ -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
|
-
const require_schemas=require(`../schemas-CwY-HoKq.cjs`);let __adobe_aio_commerce_lib_api_utils=require(`@adobe/aio-commerce-lib-api/utils`),__adobe_aio_commerce_lib_core_error=require(`@adobe/aio-commerce-lib-core/error`),valibot=require(`valibot`);valibot=require_schemas.s(valibot);let __adobe_aio_commerce_lib_api=require(`@adobe/aio-commerce-lib-api`);function workspaceConfigurationSchema(propertyName){return valibot.union([valibot.pipe(require_schemas.i(propertyName),valibot.empty()),valibot.pipe(require_schemas.i(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_schemas.i(`providerId`)}),EventProviderCreateParamsSchema=valibot.object({providerId:require_schemas.i(`providerId`),instanceId:require_schemas.i(`instanceId`),label:valibot.optional(require_schemas.i(`label`)),description:valibot.optional(require_schemas.i(`description`)),associatedWorkspaceConfiguration:valibot.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports=require_schemas.o({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`eventing/eventProvider`,fetchOptions).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(EventProviderGetByIdParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(EventProviderCreateParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.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 valibot.array(valibot.object({name:require_schemas.i(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=valibot.object({name:require_schemas.i(`name`),providerId:valibot.optional(require_schemas.i(`providerId`)),parent:valibot.optional(require_schemas.i(`parent`)),fields:fieldsSchema(`fields`),destination:valibot.optional(require_schemas.i(`destination`)),hipaaAuditRequired:valibot.optional(require_schemas.r(`hipaaAuditRequired`)),prioritary:valibot.optional(require_schemas.r(`prioritary`)),force:valibot.optional(require_schemas.r(`force`))});var endpoints_exports$1=require_schemas.o({createEventSubscription:()=>createEventSubscription,getAllEventSubscriptions:()=>getAllEventSubscriptions});async function getAllEventSubscriptions(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`eventing/getEventSubscriptions`,fetchOptions).json()}async function createEventSubscription(httpClient,params,fetchOptions){let{force,...event}=require_schemas.a(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=valibot.partial(valibot.object({enabled:require_schemas.r(`enabled`),providerId:require_schemas.t(`providerId`),instanceId:require_schemas.t(`instanceId`),merchantId:require_schemas.n(`merchantId`),environmentId:require_schemas.n(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));async function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}function createCommerceEventsApiClient(params){return __adobe_aio_commerce_lib_api.ApiClient.create(new __adobe_aio_commerce_lib_api.AdobeCommerceHttpClient(params),{...endpoints_exports,...endpoints_exports$1,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return __adobe_aio_commerce_lib_api.ApiClient.create(new __adobe_aio_commerce_lib_api.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;
|
|
1
|
+
const require_chunk=require(`../chunk-BZ64pZp-.cjs`);require(`@adobe/aio-commerce-lib-core/error`);let _aio_commerce_sdk_common_utils_valibot=require(`@aio-commerce-sdk/common-utils/valibot`),valibot=require(`valibot`);valibot=require_chunk.n(valibot);let _adobe_aio_commerce_lib_api=require(`@adobe/aio-commerce-lib-api`);function workspaceConfigurationSchema(propertyName){return valibot.union([valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(propertyName),valibot.empty()),valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(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:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`)}),EventProviderCreateParamsSchema=valibot.object({providerId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`),instanceId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`instanceId`),label:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`label`)),description:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`description`)),associatedWorkspaceConfiguration:valibot.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports$1=require_chunk.t({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=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(EventProviderGetByIdParamsSchema,params);return httpClient.get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.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 valibot.array(valibot.object({name:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=valibot.object({name:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`name`),providerId:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`)),parent:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`parent`)),fields:fieldsSchema(`fields`),destination:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`destination`)),hipaaAuditRequired:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`hipaaAuditRequired`)),prioritary:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`prioritary`)),force:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`force`))});var endpoints_exports=require_chunk.t({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}=(0,_aio_commerce_sdk_common_utils_valibot.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=valibot.partial(valibot.object({enabled:(0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`enabled`),providerId:(0,_aio_commerce_sdk_common_utils_valibot.alphaNumericOrUnderscoreOrHyphenSchema)(`providerId`),instanceId:(0,_aio_commerce_sdk_common_utils_valibot.alphaNumericOrUnderscoreOrHyphenSchema)(`instanceId`),merchantId:(0,_aio_commerce_sdk_common_utils_valibot.alphaNumericOrUnderscoreSchema)(`merchantId`),environmentId:(0,_aio_commerce_sdk_common_utils_valibot.alphaNumericOrUnderscoreSchema)(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));async function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}function createCommerceEventsApiClient(params){return _adobe_aio_commerce_lib_api.ApiClient.create(new _adobe_aio_commerce_lib_api.AdobeCommerceHttpClient(params),{...endpoints_exports$1,...endpoints_exports,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return _adobe_aio_commerce_lib_api.ApiClient.create(new _adobe_aio_commerce_lib_api.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;
|
|
@@ -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 _adobe_aio_commerce_lib_api0 from "@adobe/aio-commerce-lib-api";
|
|
16
2
|
import { AdobeCommerceHttpClient, ApiFunction, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
|
|
17
3
|
import { Options } from "@adobe/aio-commerce-lib-api/ky";
|
|
18
4
|
import * as v from "valibot";
|
|
19
|
-
import { CamelCasedPropertiesDeep } from "type-fest";
|
|
20
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
|
|
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
|
|
28
|
-
readonly instanceId: v.StringSchema<`Expected a string value for
|
|
29
|
-
readonly label: v.OptionalSchema<v.StringSchema<`Expected a string value for
|
|
30
|
-
readonly description: v.OptionalSchema<v.StringSchema<`Expected a string value for
|
|
31
|
-
readonly associatedWorkspaceConfiguration: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
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
|
|
116
|
-
readonly providerId: v.OptionalSchema<v.StringSchema<`Expected a string value for
|
|
117
|
-
readonly parent: v.OptionalSchema<v.StringSchema<`Expected a string value for
|
|
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
|
|
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
|
|
122
|
-
readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for
|
|
123
|
-
readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for
|
|
124
|
-
readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for
|
|
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 =
|
|
127
|
+
type CommerceEventSubscriptionOneResponse = CommerceEventSubscription;
|
|
157
128
|
/** Defines the fields of many event subscription entities returned by the Commerce API. */
|
|
158
|
-
type CommerceEventSubscriptionManyResponse =
|
|
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
|
|
186
|
-
readonly providerId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
187
|
-
readonly instanceId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
188
|
-
readonly merchantId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
189
|
-
readonly environmentId: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
190
|
-
readonly workspaceConfiguration: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
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
|
|
198
|
-
readonly providerId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
199
|
-
readonly instanceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
200
|
-
readonly merchantId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
201
|
-
readonly environmentId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
202
|
-
readonly workspaceConfiguration: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
205
|
+
}> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
|
|
235
206
|
[x: string]: unknown;
|
|
236
207
|
}>>>;
|
|
237
|
-
readonly
|
|
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.
|
|
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.
|
|
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;
|
|
@@ -290,23 +261,14 @@ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams)
|
|
|
290
261
|
getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventSubscriptionManyResponse>;
|
|
291
262
|
createEventSubscription(httpClient: AdobeCommerceHttpClient, params: EventSubscriptionCreateParams, fetchOptions?: ky0.Options): Promise<void>;
|
|
292
263
|
getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventProviderManyResponse>;
|
|
293
|
-
getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: ky0.Options): Promise<
|
|
294
|
-
|
|
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?: ky0.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
|
-
}>;
|
|
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.
|
|
@@ -314,4 +276,4 @@ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams)
|
|
|
314
276
|
*/
|
|
315
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
|
-
const require_schemas=require(`../schemas-CwY-HoKq.cjs`);let __adobe_aio_commerce_lib_api_utils=require(`@adobe/aio-commerce-lib-api/utils`),valibot=require(`valibot`);valibot=require_schemas.s(valibot);let __adobe_aio_commerce_lib_api=require(`@adobe/aio-commerce-lib-api`);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_schemas.i(fieldName),valibot.transform(tryDecodeFromBase64),valibot.parseJson(void 0,`Expected valid JSON string for property '${fieldName}'`),valibot.record(valibot.string(),valibot.unknown())),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_schemas.i(`providerId`)}),GetEventMetadataForEventAndProviderSchema=valibot.object({eventCode:require_schemas.i(`eventCode`),providerId:require_schemas.i(`providerId`)}),CreateEventMetadataForProviderSchema=valibot.object({consumerOrgId:require_schemas.i(`consumerOrgId`),projectId:require_schemas.i(`projectId`),workspaceId:require_schemas.i(`workspaceId`),providerId:require_schemas.i(`providerId`),label:require_schemas.i(`label`),description:require_schemas.i(`description`),eventCode:require_schemas.i(`eventCode`),sampleEventTemplate:valibot.optional(sampleEventTemplateSchema(`sampleEventTemplate`))});var endpoints_exports=require_schemas.o({createEventMetadataForProvider:()=>createEventMetadataForProvider,getAllEventMetadataForProvider:()=>getAllEventMetadataForProvider,getEventMetadataForEventAndProvider:()=>getEventMetadataForEventAndProvider});async function getAllEventMetadataForProvider(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(GetAllEventMetadataForProviderSchema,params);return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`providers/${validatedParams.providerId}/eventmetadata`,fetchOptions).json()}async function getEventMetadataForEventAndProvider(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(GetEventMetadataForEventAndProviderSchema,params);return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`providers/${validatedParams.providerId}/eventmetadata/${validatedParams.eventCode}`,fetchOptions).json()}async function createEventMetadataForProvider(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(CreateEventMetadataForProviderSchema,params);return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).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_schemas.i(`consumerOrgId`),withEventMetadata:valibot.optional(require_schemas.r(`withEventMetadata`)),filterBy:valibot.optional(valibot.object({instanceId:valibot.optional(require_schemas.i(`instanceId`)),providerTypes:valibot.optional(valibot.union([valibot.array(EventProviderTypeSchema,`Expected an array of event provider types`)]))}))}),EventProviderGetByIdParamsSchema=valibot.object({providerId:require_schemas.i(`providerId`),withEventMetadata:valibot.optional(require_schemas.r(`withEventMetadata`))}),EventProviderCreateParamsSchema=valibot.object({consumerOrgId:require_schemas.i(`consumerOrgId`),projectId:require_schemas.i(`projectId`),workspaceId:require_schemas.i(`workspaceId`),label:require_schemas.i(`label`),description:valibot.optional(require_schemas.i(`description`)),docsUrl:valibot.optional(require_schemas.i(`docsUrl`)),instanceId:valibot.optional(require_schemas.i(`instanceId`)),providerType:valibot.optional(EventProviderTypeSchema),dataResidencyRegion:valibot.optional(DataResidencyRegionSchema)});var endpoints_exports$1=require_schemas.o({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(EventProviderListAllParamsSchema,params),queryParams=new URLSearchParams,{providerTypes=[],instanceId}=validatedParams.filterBy??{};return setArrayQueryParam(queryParams,`providerMetadataIds`,providerTypes),setQueryParamIfTruthy(queryParams,`instanceId`,instanceId),setQueryParamIfTruthy(queryParams,`eventmetadata`,validatedParams.withEventMetadata),httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`${validatedParams.consumerOrgId}/providers`,{...fetchOptions,searchParams:queryParams}).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(EventProviderGetByIdParamsSchema,params),searchParams=new URLSearchParams;return setQueryParamIfTruthy(searchParams,`eventmetadata`,validatedParams.withEventMetadata),httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).get(`providers/${params.providerId}`,{...fetchOptions,searchParams}).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=require_schemas.a(EventProviderCreateParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[(0,__adobe_aio_commerce_lib_api_utils.buildCamelCaseKeysResponseHook)()]}}).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_schemas.o({create3rdPartyCustomEventProvider:()=>create3rdPartyCustomEventProvider,createCommerceEventProvider:()=>createCommerceEventProvider,getAll3rdPartyCustomEventProviders:()=>getAll3rdPartyCustomEventProviders,getAllCommerceEventProviders:()=>getAllCommerceEventProviders});async function getAllCommerceEventProviders(httpClient,params,fetchOptions){return getAllEventProviders(httpClient,{...params,filterBy:{...params.filterBy,providerTypes:[`dx_commerce_events`]}},fetchOptions)}async function getAll3rdPartyCustomEventProviders(httpClient,params,fetchOptions){return getAllEventProviders(httpClient,{...params,filterBy:{...params.filterBy,providerTypes:[`3rd_party_custom_events`]}},fetchOptions)}async function createCommerceEventProvider(httpClient,params,fetchOptions){return createEventProvider(httpClient,{...params,providerType:`dx_commerce_events`},fetchOptions)}async function create3rdPartyCustomEventProvider(httpClient,params,fetchOptions){return createEventProvider(httpClient,{...params,providerType:`3rd_party_custom_events`},fetchOptions)}function createAdobeIoEventsApiClient(params){return __adobe_aio_commerce_lib_api.ApiClient.create(new __adobe_aio_commerce_lib_api.AdobeIoEventsHttpClient(params),{...endpoints_exports$1,...endpoints_exports,...shorthands_exports})}function createCustomAdobeIoEventsApiClient(params,functions){return __adobe_aio_commerce_lib_api.ApiClient.create(new __adobe_aio_commerce_lib_api.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;
|
|
1
|
+
const require_chunk=require(`../chunk-BZ64pZp-.cjs`);let _aio_commerce_sdk_common_utils_valibot=require(`@aio-commerce-sdk/common-utils/valibot`),valibot=require(`valibot`);valibot=require_chunk.n(valibot);let _adobe_aio_commerce_lib_api=require(`@adobe/aio-commerce-lib-api`);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((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(fieldName),valibot.transform(tryDecodeFromBase64),valibot.parseJson(void 0,`Expected valid JSON string for property '${fieldName}'`),valibot.record(valibot.string(),valibot.unknown())),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:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`)}),GetEventMetadataForEventAndProviderSchema=valibot.object({eventCode:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`eventCode`),providerId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`)}),CreateEventMetadataForProviderSchema=valibot.object({consumerOrgId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`consumerOrgId`),projectId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`projectId`),workspaceId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`workspaceId`),providerId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`),label:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`label`),description:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`description`),eventCode:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`eventCode`),sampleEventTemplate:valibot.optional(sampleEventTemplateSchema(`sampleEventTemplate`))});var endpoints_exports$2=require_chunk.t({createEventMetadataForProvider:()=>createEventMetadataForProvider,getAllEventMetadataForProvider:()=>getAllEventMetadataForProvider,getEventMetadataForEventAndProvider:()=>getEventMetadataForEventAndProvider});async function getAllEventMetadataForProvider(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(GetAllEventMetadataForProviderSchema,params);return httpClient.get(`providers/${validatedParams.providerId}/eventmetadata`,fetchOptions).json()}async function getEventMetadataForEventAndProvider(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(GetEventMetadataForEventAndProviderSchema,params);return httpClient.get(`providers/${validatedParams.providerId}/eventmetadata/${validatedParams.eventCode}`,fetchOptions).json()}async function createEventMetadataForProvider(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(CreateEventMetadataForProviderSchema,params);return httpClient.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:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`consumerOrgId`),withEventMetadata:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`withEventMetadata`)),filterBy:valibot.optional(valibot.object({instanceId:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`instanceId`)),providerTypes:valibot.optional(valibot.union([valibot.array(EventProviderTypeSchema,`Expected an array of event provider types`)]))}))}),EventProviderGetByIdParamsSchema=valibot.object({providerId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`),withEventMetadata:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`withEventMetadata`))}),EventProviderCreateParamsSchema=valibot.object({consumerOrgId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`consumerOrgId`),projectId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`projectId`),workspaceId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`workspaceId`),label:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`label`),description:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`description`)),docsUrl:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`docsUrl`)),instanceId:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`instanceId`)),providerType:valibot.optional(EventProviderTypeSchema),dataResidencyRegion:valibot.optional(DataResidencyRegionSchema)});var endpoints_exports$1=require_chunk.t({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(EventProviderListAllParamsSchema,params),queryParams=new URLSearchParams,{providerTypes=[],instanceId}=validatedParams.filterBy??{};return setArrayQueryParam(queryParams,`providerMetadataIds`,providerTypes),setQueryParamIfTruthy(queryParams,`instanceId`,instanceId),setQueryParamIfTruthy(queryParams,`eventmetadata`,validatedParams.withEventMetadata),httpClient.get(`${validatedParams.consumerOrgId}/providers`,{...fetchOptions,searchParams:queryParams}).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(EventProviderGetByIdParamsSchema,params),searchParams=new URLSearchParams;return setQueryParamIfTruthy(searchParams,`eventmetadata`,validatedParams.withEventMetadata),httpClient.get(`providers/${params.providerId}`,{...fetchOptions,searchParams}).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(EventProviderCreateParamsSchema,params);return httpClient.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_chunk.t({create3rdPartyCustomEventProvider:()=>create3rdPartyCustomEventProvider,createCommerceEventProvider:()=>createCommerceEventProvider,getAll3rdPartyCustomEventProviders:()=>getAll3rdPartyCustomEventProviders,getAllCommerceEventProviders:()=>getAllCommerceEventProviders});async function getAllCommerceEventProviders(httpClient,params,fetchOptions){return getAllEventProviders(httpClient,{...params,filterBy:{...params.filterBy,providerTypes:[`dx_commerce_events`]}},fetchOptions)}async function getAll3rdPartyCustomEventProviders(httpClient,params,fetchOptions){return getAllEventProviders(httpClient,{...params,filterBy:{...params.filterBy,providerTypes:[`3rd_party_custom_events`]}},fetchOptions)}async function createCommerceEventProvider(httpClient,params,fetchOptions){return createEventProvider(httpClient,{...params,providerType:`dx_commerce_events`},fetchOptions)}async function create3rdPartyCustomEventProvider(httpClient,params,fetchOptions){return createEventProvider(httpClient,{...params,providerType:`3rd_party_custom_events`},fetchOptions)}const VALID_DELIVERY_TYPES=[`webhook`,`webhook_batch`,`journal`,`aws_eventbridge`],AWS_REGION_REGEX=/^(us|ca|eu|af|ap|cn|me|sa|il)-[a-z]+-\d$/,AWS_ACCOUNT_ID_REGEX=/^\d{12}$/,DeliveryTypeSchema=valibot.picklist(VALID_DELIVERY_TYPES,`Expected delivery type to be one of: ${VALID_DELIVERY_TYPES.join(`, `)}`),EventsOfInterestSchema=valibot.object({providerId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerId`),eventCode:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`eventCode`),providerMetadataId:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`providerMetadataId`))}),DestinationMetadataSchema=valibot.object({awsRegion:valibot.optional(valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`awsRegion`),valibot.regex(AWS_REGION_REGEX,`Expected AWS region in format like 'us-east-1'`))),awsAccountId:valibot.optional(valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`awsAccountId`),valibot.regex(AWS_ACCOUNT_ID_REGEX,`Expected AWS account ID to be a 12-digit number`)))}),SubscriberFilterSchema=valibot.object({name:valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`name`),valibot.minLength(3,`Expected subscriber filter name to be at least 3 characters`),valibot.maxLength(80,`Expected subscriber filter name to be at most 80 characters`)),description:valibot.optional(valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`description`),valibot.maxLength(250,`Expected subscriber filter description to be at most 250 characters`))),subscriberFilter:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`subscriberFilter`)}),WorkspacePathParamsSchema=valibot.object({consumerOrgId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`consumerOrgId`),projectId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`projectId`),workspaceId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`workspaceId`)}),EventsOfInterestArraySchema=valibot.pipe(valibot.array(EventsOfInterestSchema,`Expected eventsOfInterest to be an array of event interest objects`),valibot.minLength(1,`Expected at least one event of interest`)),RegistrationBodySchema=valibot.object({clientId:valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`clientId`),valibot.minLength(3,`Expected clientId to be at least 1 character`),valibot.maxLength(255,`Expected clientId to be at most 255 characters`)),name:valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`name`),valibot.minLength(3,`Expected registration name to be at least 3 characters`),valibot.maxLength(255,`Expected registration name to be at most 255 characters`)),description:valibot.optional(valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`description`),valibot.maxLength(5e3,`Expected description to be at most 5000 characters`))),webhookUrl:valibot.optional(valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`webhookUrl`),valibot.maxLength(4e3,`Expected webhook URL to be at most 4000 characters`))),eventsOfInterest:EventsOfInterestArraySchema,deliveryType:DeliveryTypeSchema,runtimeAction:valibot.optional(valibot.pipe((0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`runtimeAction`),valibot.maxLength(255,`Expected runtime action to be at most 255 characters`))),enabled:valibot.optional((0,_aio_commerce_sdk_common_utils_valibot.booleanValueSchema)(`enabled`)),destinationMetadata:valibot.optional(DestinationMetadataSchema),subscriberFilters:valibot.optional(valibot.pipe(valibot.array(SubscriberFilterSchema,`Expected subscriberFilters to be an array of subscriber filter objects`),valibot.maxLength(1,`Expected at most 1 subscriber filter`)))}),GetAllRegistrationsParamsSchema=WorkspacePathParamsSchema,GetAllRegistrationsByConsumerOrgParamsSchema=valibot.object({consumerOrgId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`consumerOrgId`)}),GetRegistrationByIdParamsSchema=valibot.object({...WorkspacePathParamsSchema.entries,registrationId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`registrationId`)}),CreateRegistrationParamsSchema=valibot.object({...WorkspacePathParamsSchema.entries,...RegistrationBodySchema.entries}),UpdateRegistrationParamsSchema=valibot.object({...WorkspacePathParamsSchema.entries,registrationId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`registrationId`),...RegistrationBodySchema.entries}),DeleteRegistrationParamsSchema=valibot.object({...WorkspacePathParamsSchema.entries,registrationId:(0,_aio_commerce_sdk_common_utils_valibot.stringValueSchema)(`registrationId`)});var endpoints_exports=require_chunk.t({createRegistration:()=>createRegistration,deleteRegistration:()=>deleteRegistration,getAllRegistrations:()=>getAllRegistrations,getAllRegistrationsByConsumerOrg:()=>getAllRegistrationsByConsumerOrg,getRegistrationById:()=>getRegistrationById,updateRegistration:()=>updateRegistration});async function getAllRegistrationsByConsumerOrg(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(GetAllRegistrationsByConsumerOrgParamsSchema,params);return httpClient.get(`${validatedParams.consumerOrgId}/registrations`,fetchOptions).json()}async function getAllRegistrations(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(GetAllRegistrationsParamsSchema,params);return httpClient.get(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/registrations`,fetchOptions).json()}async function getRegistrationById(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(GetRegistrationByIdParamsSchema,params);return httpClient.get(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/registrations/${validatedParams.registrationId}`,fetchOptions).json()}async function createRegistration(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(CreateRegistrationParamsSchema,params);return httpClient.post(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/registrations`,{...fetchOptions,json:{client_id:validatedParams.clientId,name:validatedParams.name,description:validatedParams.description,webhook_url:validatedParams.webhookUrl,events_of_interest:validatedParams.eventsOfInterest.map(event=>({provider_id:event.providerId,event_code:event.eventCode,provider_metadata_id:event.providerMetadataId})),delivery_type:validatedParams.deliveryType,runtime_action:validatedParams.runtimeAction,enabled:validatedParams.enabled,destination_metadata:validatedParams.destinationMetadata?{aws_region:validatedParams.destinationMetadata.awsRegion,aws_account_id:validatedParams.destinationMetadata.awsAccountId}:void 0,subscriber_filters:validatedParams.subscriberFilters?.map(filter=>({name:filter.name,description:filter.description,subscriber_filter:filter.subscriberFilter}))}}).json()}async function updateRegistration(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(UpdateRegistrationParamsSchema,params);return httpClient.put(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/registrations/${validatedParams.registrationId}`,{...fetchOptions,json:{name:validatedParams.name,description:validatedParams.description,webhook_url:validatedParams.webhookUrl,events_of_interest:validatedParams.eventsOfInterest.map(event=>({provider_id:event.providerId,event_code:event.eventCode,provider_metadata_id:event.providerMetadataId})),delivery_type:validatedParams.deliveryType,runtime_action:validatedParams.runtimeAction,enabled:validatedParams.enabled,destination_metadata:validatedParams.destinationMetadata?{aws_region:validatedParams.destinationMetadata.awsRegion,aws_account_id:validatedParams.destinationMetadata.awsAccountId}:void 0,subscriber_filters:validatedParams.subscriberFilters?.map(filter=>({name:filter.name,description:filter.description,subscriber_filter:filter.subscriberFilter}))}}).json()}async function deleteRegistration(httpClient,params,fetchOptions){let validatedParams=(0,_aio_commerce_sdk_common_utils_valibot.parseOrThrow)(DeleteRegistrationParamsSchema,params);return httpClient.delete(`${validatedParams.consumerOrgId}/${validatedParams.projectId}/${validatedParams.workspaceId}/registrations/${validatedParams.registrationId}`,fetchOptions).then(_res=>{})}function createAdobeIoEventsApiClient(params){return _adobe_aio_commerce_lib_api.ApiClient.create(new _adobe_aio_commerce_lib_api.AdobeIoEventsHttpClient(params),{...endpoints_exports$1,...endpoints_exports$2,...shorthands_exports,...endpoints_exports})}function createCustomAdobeIoEventsApiClient(params,functions){return _adobe_aio_commerce_lib_api.ApiClient.create(new _adobe_aio_commerce_lib_api.AdobeIoEventsHttpClient(params),functions)}exports.create3rdPartyCustomEventProvider=create3rdPartyCustomEventProvider,exports.createAdobeIoEventsApiClient=createAdobeIoEventsApiClient,exports.createCommerceEventProvider=createCommerceEventProvider,exports.createCustomAdobeIoEventsApiClient=createCustomAdobeIoEventsApiClient,exports.createEventMetadataForProvider=createEventMetadataForProvider,exports.createEventProvider=createEventProvider,exports.createRegistration=createRegistration,exports.deleteRegistration=deleteRegistration,exports.getAll3rdPartyCustomEventProviders=getAll3rdPartyCustomEventProviders,exports.getAllCommerceEventProviders=getAllCommerceEventProviders,exports.getAllEventMetadataForProvider=getAllEventMetadataForProvider,exports.getAllEventProviders=getAllEventProviders,exports.getAllRegistrations=getAllRegistrations,exports.getAllRegistrationsByConsumerOrg=getAllRegistrationsByConsumerOrg,exports.getEventMetadataForEventAndProvider=getEventMetadataForEventAndProvider,exports.getEventProviderById=getEventProviderById,exports.getRegistrationById=getRegistrationById,exports.updateRegistration=updateRegistration;
|