@adobe/aio-commerce-lib-events 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ var __defProp=Object.defineProperty,__exportAll=(all,symbols)=>{let target={};for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});return symbols&&__defProp(target,Symbol.toStringTag,{value:`Module`}),target};export{__exportAll as t};
@@ -1,23 +1,9 @@
1
- /**
2
- * @license
3
- *
4
- * Copyright 2025 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
-
15
1
  import * as v from "valibot";
16
- import * as _adobe_aio_commerce_lib_api1 from "@adobe/aio-commerce-lib-api";
2
+ import * as _adobe_aio_commerce_lib_api0 from "@adobe/aio-commerce-lib-api";
17
3
  import { AdobeCommerceHttpClient, ApiFunction, CommerceHttpClientParams } from "@adobe/aio-commerce-lib-api";
18
4
  import { Options } from "@adobe/aio-commerce-lib-api/ky";
19
5
  import { CamelCasedPropertiesDeep } from "type-fest";
20
- import * as ky9 from "ky";
6
+ import * as ky0 from "ky";
21
7
 
22
8
  //#region source/commerce/api/event-providers/schema.d.ts
23
9
  declare const EventProviderGetByIdParamsSchema: v.ObjectSchema<{
@@ -205,7 +191,7 @@ declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
205
191
  [x: string]: unknown;
206
192
  }, undefined, `Expected valid JSON data for property '${string}'`>]>], undefined>, undefined>;
207
193
  };
208
- readonly '~standard': v.StandardProps<{
194
+ readonly "~standard": v.StandardProps<{
209
195
  enabled?: boolean | undefined;
210
196
  providerId?: string | undefined;
211
197
  instanceId?: string | undefined;
@@ -222,19 +208,19 @@ declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
222
208
  environmentId?: string | undefined;
223
209
  workspaceConfiguration?: string | undefined;
224
210
  }>;
225
- readonly '~run': (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
211
+ readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
226
212
  enabled?: boolean | undefined;
227
213
  providerId?: string | undefined;
228
214
  instanceId?: string | undefined;
229
215
  merchantId?: string | undefined;
230
216
  environmentId?: string | undefined;
231
217
  workspaceConfiguration?: string | undefined;
232
- }, v.StringIssue | v.ObjectIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.BooleanIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.StringifyJsonIssue<{
218
+ }, v.ObjectIssue | v.BooleanIssue | v.StringIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
233
219
  [x: string]: unknown;
234
- }> | v.UnionIssue<v.StringIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.EmptyIssue<string> | v.StringifyJsonIssue<{
220
+ }> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
235
221
  [x: string]: unknown;
236
222
  }>>>;
237
- readonly '~types'?: {
223
+ readonly "~types"?: {
238
224
  readonly input: {
239
225
  enabled?: boolean | undefined;
240
226
  providerId?: string | undefined;
@@ -253,9 +239,9 @@ declare const UpdateEventingConfigurationParamsSchema: Omit<v.ObjectSchema<{
253
239
  environmentId?: string | undefined;
254
240
  workspaceConfiguration?: string | undefined;
255
241
  };
256
- readonly issue: v.StringIssue | v.ObjectIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.BooleanIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.StringifyJsonIssue<{
242
+ readonly issue: v.ObjectIssue | v.BooleanIssue | v.StringIssue | v.RegexIssue<string> | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
257
243
  [x: string]: unknown;
258
- }> | v.UnionIssue<v.StringIssue | v.ParseJsonIssue<string> | v.RecordIssue | v.EmptyIssue<string> | v.StringifyJsonIssue<{
244
+ }> | v.UnionIssue<v.StringIssue | v.EmptyIssue<string> | v.ParseJsonIssue<string> | v.RecordIssue | v.StringifyJsonIssue<{
259
245
  [x: string]: unknown;
260
246
  }>>;
261
247
  } | undefined;
@@ -285,12 +271,12 @@ declare function updateEventingConfiguration(httpClient: AdobeCommerceHttpClient
285
271
  * Creates a new API client for the Commerce Events API client.
286
272
  * @param params - The parameters to build the Commerce HTTP client that will communicate with the Commerce Events API.
287
273
  */
288
- declare function createCommerceEventsApiClient(params: CommerceHttpClientParams): _adobe_aio_commerce_lib_api1.ApiClientRecord<AdobeCommerceHttpClient, {
274
+ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams): _adobe_aio_commerce_lib_api0.ApiClientRecord<AdobeCommerceHttpClient, {
289
275
  updateEventingConfiguration: typeof updateEventingConfiguration;
290
- getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky9.Options): Promise<CommerceEventSubscriptionManyResponse>;
291
- createEventSubscription(httpClient: AdobeCommerceHttpClient, params: EventSubscriptionCreateParams, fetchOptions?: ky9.Options): Promise<void>;
292
- getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky9.Options): Promise<CommerceEventProviderManyResponse>;
293
- getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: ky9.Options): Promise<{
276
+ getAllEventSubscriptions(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventSubscriptionManyResponse>;
277
+ createEventSubscription(httpClient: AdobeCommerceHttpClient, params: EventSubscriptionCreateParams, fetchOptions?: ky0.Options): Promise<void>;
278
+ getAllEventProviders(httpClient: AdobeCommerceHttpClient, fetchOptions?: ky0.Options): Promise<CommerceEventProviderManyResponse>;
279
+ getEventProviderById(httpClient: AdobeCommerceHttpClient, params: EventProviderGetByIdParams, fetchOptions?: ky0.Options): Promise<{
294
280
  id: string;
295
281
  providerId: string;
296
282
  instanceId?: string | undefined;
@@ -298,7 +284,7 @@ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams)
298
284
  description?: string | undefined;
299
285
  workspaceConfiguration?: string | undefined;
300
286
  }>;
301
- createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: ky9.Options): Promise<{
287
+ createEventProvider(httpClient: AdobeCommerceHttpClient, params: EventProviderCreateParams, fetchOptions?: ky0.Options): Promise<{
302
288
  id: string;
303
289
  providerId: string;
304
290
  instanceId?: string | undefined;
@@ -307,11 +293,16 @@ declare function createCommerceEventsApiClient(params: CommerceHttpClientParams)
307
293
  workspaceConfiguration?: string | undefined;
308
294
  }>;
309
295
  }>;
296
+ /**
297
+ * An API Client for the Commerce Events API.
298
+ * @see {@link createCommerceEventsApiClient}
299
+ */
300
+ type CommerceEventsApiClient = ReturnType<typeof createCommerceEventsApiClient>;
310
301
  /**
311
302
  * Creates a customized Commerce Events API client.
312
303
  * @param params - The parameters to build the Commerce HTTP client that will communicate with the Commerce Events API.
313
304
  * @param functions - The API functions to include in the client.
314
305
  */
315
- declare function createCustomCommerceEventsApiClient<TFunctions extends Record<string, ApiFunction<AdobeCommerceHttpClient, any[], any>>>(params: CommerceHttpClientParams, functions: TFunctions): _adobe_aio_commerce_lib_api1.ApiClientRecord<AdobeCommerceHttpClient, TFunctions>;
306
+ declare function createCustomCommerceEventsApiClient<TFunctions extends Record<string, ApiFunction<AdobeCommerceHttpClient, any[], any>>>(params: CommerceHttpClientParams, functions: TFunctions): _adobe_aio_commerce_lib_api0.ApiClientRecord<AdobeCommerceHttpClient, TFunctions>;
316
307
  //#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 };
308
+ export { type CommerceEventProvider, type CommerceEventProviderManyResponse, type CommerceEventProviderOneResponse, type CommerceEventSubscription, type CommerceEventSubscriptionField, type CommerceEventSubscriptionManyResponse, type CommerceEventSubscriptionOneResponse, type CommerceEventSubscriptionRule, CommerceEventsApiClient, EventProviderCreateParams, EventProviderCreateParamsSchema, EventProviderGetByIdParams, EventProviderGetByIdParamsSchema, EventSubscriptionCreateParams, EventSubscriptionCreateParamsSchema, UpdateEventingConfigurationParams, UpdateEventingConfigurationParamsSchema, createCommerceEventsApiClient, createCustomCommerceEventsApiClient, createEventProvider, createEventSubscription, getAllEventProviders, getAllEventSubscriptions, getEventProviderById, updateEventingConfiguration };
@@ -1,14 +1 @@
1
- /**
2
- * @license
3
- *
4
- * Copyright 2025 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- import{a as parseOrThrow,i as stringValueSchema,n as alphaNumericOrUnderscoreSchema,o as __export,r as booleanValueSchema,t as alphaNumericOrUnderscoreOrHyphenSchema}from"../schemas-D5c1tsDe.mjs";import{buildCamelCaseKeysResponseHook}from"@adobe/aio-commerce-lib-api/utils";import{CommerceSdkValidationError}from"@adobe/aio-commerce-lib-core/error";import*as v from"valibot";import{AdobeCommerceHttpClient,ApiClient}from"@adobe/aio-commerce-lib-api";function workspaceConfigurationSchema(propertyName){return v.union([v.pipe(stringValueSchema(propertyName),v.empty()),v.pipe(stringValueSchema(propertyName),v.parseJson(void 0,`Expected valid JSON string for property '${propertyName}'`),v.record(v.string(),v.unknown()),v.stringifyJson()),v.pipe(v.record(v.string(),v.unknown()),v.stringifyJson(void 0,`Expected valid JSON data for property '${propertyName}'`))])}const EventProviderGetByIdParamsSchema=v.object({providerId:stringValueSchema(`providerId`)}),EventProviderCreateParamsSchema=v.object({providerId:stringValueSchema(`providerId`),instanceId:stringValueSchema(`instanceId`),label:v.optional(stringValueSchema(`label`)),description:v.optional(stringValueSchema(`description`)),associatedWorkspaceConfiguration:v.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports=__export({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/eventProvider`,fetchOptions).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderGetByIdParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderCreateParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).post(`eventing/eventProvider`,{...fetchOptions,json:{eventProvider:{provider_id:validatedParams.providerId,instance_id:validatedParams.instanceId,label:validatedParams.label,description:validatedParams.description,workspace_configuration:validatedParams.associatedWorkspaceConfiguration}}}).json()}function fieldsSchema(propertyName){return v.array(v.object({name:stringValueSchema(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=v.object({name:stringValueSchema(`name`),providerId:v.optional(stringValueSchema(`providerId`)),parent:v.optional(stringValueSchema(`parent`)),fields:fieldsSchema(`fields`),destination:v.optional(stringValueSchema(`destination`)),hipaaAuditRequired:v.optional(booleanValueSchema(`hipaaAuditRequired`)),prioritary:v.optional(booleanValueSchema(`prioritary`)),force:v.optional(booleanValueSchema(`force`))});var endpoints_exports$1=__export({createEventSubscription:()=>createEventSubscription,getAllEventSubscriptions:()=>getAllEventSubscriptions});async function getAllEventSubscriptions(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/getEventSubscriptions`,fetchOptions).json()}async function createEventSubscription(httpClient,params,fetchOptions){let{force,...event}=parseOrThrow(EventSubscriptionCreateParamsSchema,params);return httpClient.post(`eventing/eventSubscribe`,{...fetchOptions,json:{force,event:{name:event.name,parent:event.parent,fields:event.fields,destination:event.destination,hipaa_audit_required:event.hipaaAuditRequired,priority:event.prioritary,provider_id:event.providerId}}}).json().then(_res=>{})}const UpdateEventingConfigurationParamsSchema=v.partial(v.object({enabled:booleanValueSchema(`enabled`),providerId:alphaNumericOrUnderscoreOrHyphenSchema(`providerId`),instanceId:alphaNumericOrUnderscoreOrHyphenSchema(`instanceId`),merchantId:alphaNumericOrUnderscoreSchema(`merchantId`),environmentId:alphaNumericOrUnderscoreSchema(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));async function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}function createCommerceEventsApiClient(params){return ApiClient.create(new AdobeCommerceHttpClient(params),{...endpoints_exports,...endpoints_exports$1,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return ApiClient.create(new AdobeCommerceHttpClient(params),functions)}export{createCommerceEventsApiClient,createCustomCommerceEventsApiClient,createEventProvider,createEventSubscription,getAllEventProviders,getAllEventSubscriptions,getEventProviderById,updateEventingConfiguration};
1
+ import{t as __exportAll}from"../chunk-BKfb2J6I.mjs";import{buildCamelCaseKeysResponseHook}from"@adobe/aio-commerce-lib-api/utils";import"@adobe/aio-commerce-lib-core/error";import{alphaNumericOrUnderscoreOrHyphenSchema,alphaNumericOrUnderscoreSchema,booleanValueSchema,parseOrThrow,stringValueSchema}from"@aio-commerce-sdk/common-utils/valibot";import*as v from"valibot";import{AdobeCommerceHttpClient,ApiClient}from"@adobe/aio-commerce-lib-api";function workspaceConfigurationSchema(propertyName){return v.union([v.pipe(stringValueSchema(propertyName),v.empty()),v.pipe(stringValueSchema(propertyName),v.parseJson(void 0,`Expected valid JSON string for property '${propertyName}'`),v.record(v.string(),v.unknown()),v.stringifyJson()),v.pipe(v.record(v.string(),v.unknown()),v.stringifyJson(void 0,`Expected valid JSON data for property '${propertyName}'`))])}const EventProviderGetByIdParamsSchema=v.object({providerId:stringValueSchema(`providerId`)}),EventProviderCreateParamsSchema=v.object({providerId:stringValueSchema(`providerId`),instanceId:stringValueSchema(`instanceId`),label:v.optional(stringValueSchema(`label`)),description:v.optional(stringValueSchema(`description`)),associatedWorkspaceConfiguration:v.optional(workspaceConfigurationSchema(`associatedWorkspaceConfiguration`))});var endpoints_exports$1=__exportAll({createEventProvider:()=>createEventProvider,getAllEventProviders:()=>getAllEventProviders,getEventProviderById:()=>getEventProviderById});async function getAllEventProviders(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/eventProvider`,fetchOptions).json()}async function getEventProviderById(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderGetByIdParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/eventProvider/${validatedParams.providerId}`,fetchOptions).json()}async function createEventProvider(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(EventProviderCreateParamsSchema,params);return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).post(`eventing/eventProvider`,{...fetchOptions,json:{eventProvider:{provider_id:validatedParams.providerId,instance_id:validatedParams.instanceId,label:validatedParams.label,description:validatedParams.description,workspace_configuration:validatedParams.associatedWorkspaceConfiguration}}}).json()}function fieldsSchema(propertyName){return v.array(v.object({name:stringValueSchema(`${propertyName}[i].name`)}),`Expected an array of objects with a 'name' property for the property "${propertyName}"`)}const EventSubscriptionCreateParamsSchema=v.object({name:stringValueSchema(`name`),providerId:v.optional(stringValueSchema(`providerId`)),parent:v.optional(stringValueSchema(`parent`)),fields:fieldsSchema(`fields`),destination:v.optional(stringValueSchema(`destination`)),hipaaAuditRequired:v.optional(booleanValueSchema(`hipaaAuditRequired`)),prioritary:v.optional(booleanValueSchema(`prioritary`)),force:v.optional(booleanValueSchema(`force`))});var endpoints_exports=__exportAll({createEventSubscription:()=>createEventSubscription,getAllEventSubscriptions:()=>getAllEventSubscriptions});async function getAllEventSubscriptions(httpClient,fetchOptions){return httpClient.extend({hooks:{afterResponse:[buildCamelCaseKeysResponseHook()]}}).get(`eventing/getEventSubscriptions`,fetchOptions).json()}async function createEventSubscription(httpClient,params,fetchOptions){let{force,...event}=parseOrThrow(EventSubscriptionCreateParamsSchema,params);return httpClient.post(`eventing/eventSubscribe`,{...fetchOptions,json:{force,event:{name:event.name,parent:event.parent,fields:event.fields,destination:event.destination,hipaa_audit_required:event.hipaaAuditRequired,priority:event.prioritary,provider_id:event.providerId}}}).json().then(_res=>{})}const UpdateEventingConfigurationParamsSchema=v.partial(v.object({enabled:booleanValueSchema(`enabled`),providerId:alphaNumericOrUnderscoreOrHyphenSchema(`providerId`),instanceId:alphaNumericOrUnderscoreOrHyphenSchema(`instanceId`),merchantId:alphaNumericOrUnderscoreSchema(`merchantId`),environmentId:alphaNumericOrUnderscoreSchema(`environmentId`),workspaceConfiguration:workspaceConfigurationSchema(`workspaceConfiguration`)}));async function updateEventingConfiguration(httpClient,params,fetchOptions){let validatedParams=parseOrThrow(UpdateEventingConfigurationParamsSchema,params);return httpClient.put(`eventing/updateConfiguration`,{...fetchOptions,json:{config:validatedParams}}).json()}function createCommerceEventsApiClient(params){return ApiClient.create(new AdobeCommerceHttpClient(params),{...endpoints_exports$1,...endpoints_exports,updateEventingConfiguration})}function createCustomCommerceEventsApiClient(params,functions){return ApiClient.create(new AdobeCommerceHttpClient(params),functions)}export{createCommerceEventsApiClient,createCustomCommerceEventsApiClient,createEventProvider,createEventSubscription,getAllEventProviders,getAllEventSubscriptions,getEventProviderById,updateEventingConfiguration};