@adobe/aio-commerce-lib-app 0.2.0 → 0.3.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 +14 -0
- package/dist/cjs/actions/index.cjs +815 -170
- package/dist/cjs/actions/index.d.cts +2 -2
- package/dist/cjs/app-Dx0ca6oL.d.cts +181 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/get-config-schema.js.template +63 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/get-configuration.js.template +104 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/get-scope-tree.js.template +69 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/set-configuration.js.template +125 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/set-custom-scope-tree.js.template +83 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/sync-commerce-scopes.js.template +113 -0
- package/dist/cjs/commands/generate/actions/templates/business-configuration/unsync-commerce-scopes.js.template +56 -0
- package/dist/cjs/commands/index.cjs +1075 -119
- package/dist/cjs/config/index.cjs +20 -1
- package/dist/cjs/config/index.d.cts +532 -3
- package/dist/cjs/config-JQ_n-5Nk.cjs +565 -0
- package/dist/cjs/error-Byj1DVHZ.cjs +344 -0
- package/dist/cjs/{index-DS3IlISO.d.cts → index-C5SutkJQ.d.cts} +1 -1
- package/dist/cjs/logging-DYwr5WQk.cjs +25 -0
- package/dist/cjs/management/index.cjs +9 -1
- package/dist/cjs/management/index.d.cts +1 -1
- package/dist/cjs/management-Dm5h0E6l.cjs +1246 -0
- package/dist/es/actions/index.d.mts +2 -2
- package/dist/es/actions/index.mjs +813 -170
- package/dist/es/app-Cx1-6dn0.d.mts +181 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/get-config-schema.js.template +63 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/get-configuration.js.template +104 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/get-scope-tree.js.template +69 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/set-configuration.js.template +125 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/set-custom-scope-tree.js.template +83 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/sync-commerce-scopes.js.template +113 -0
- package/dist/es/commands/generate/actions/templates/business-configuration/unsync-commerce-scopes.js.template +56 -0
- package/dist/es/commands/index.mjs +1070 -119
- package/dist/es/config/index.d.mts +532 -3
- package/dist/es/config/index.mjs +4 -1
- package/dist/es/config-BSGerqCG.mjs +457 -0
- package/dist/es/error-P7JgUTds.mjs +251 -0
- package/dist/es/{index-DQepSWYP.d.mts → index-Bxr3zvCT.d.mts} +2 -2
- package/dist/es/logging-VgerMhp6.mjs +18 -0
- package/dist/es/management/index.d.mts +2 -2
- package/dist/es/management/index.mjs +3 -1
- package/dist/es/management-Y7pwEbNI.mjs +1204 -0
- package/package.json +20 -8
- package/dist/cjs/app-C4HhkXbP.d.cts +0 -451
- package/dist/cjs/error-yAk1zzvx.cjs +0 -1
- package/dist/cjs/management-CE3_DJw4.cjs +0 -2
- package/dist/cjs/parser-Dovux8ce.cjs +0 -1
- package/dist/cjs/schemas-CdaP-Exw.cjs +0 -1
- package/dist/es/app-CMpx3D7Y.d.mts +0 -451
- package/dist/es/chunk-VmiN0kV1.mjs +0 -1
- package/dist/es/error-hBHRgZ9R.mjs +0 -1
- package/dist/es/management-BM2WcbV6.mjs +0 -2
- package/dist/es/parser-DOVfvr9l.mjs +0 -1
- package/dist/es/schemas-eemlD-xS.mjs +0 -1
- /package/dist/cjs/commands/generate/actions/templates/{custom-scripts.js.template → app-management/custom-scripts.js.template} +0 -0
- /package/dist/cjs/commands/generate/actions/templates/{get-app-config.js.template → app-management/get-app-config.js.template} +0 -0
- /package/dist/cjs/commands/generate/actions/templates/{installation.js.template → app-management/installation.js.template} +0 -0
- /package/dist/es/commands/generate/actions/templates/{custom-scripts.js.template → app-management/custom-scripts.js.template} +0 -0
- /package/dist/es/commands/generate/actions/templates/{get-app-config.js.template → app-management/get-app-config.js.template} +0 -0
- /package/dist/es/commands/generate/actions/templates/{installation.js.template → app-management/installation.js.template} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const require_error=require(`./error-yAk1zzvx.cjs`),require_schemas=require(`./schemas-CdaP-Exw.cjs`);let fs=require(`fs`),path=require(`path`),valibot=require(`valibot`);valibot=require_error.o(valibot);let _adobe_aio_commerce_lib_core_error=require(`@adobe/aio-commerce-lib-core/error`),fs_promises=require(`fs/promises`),jiti=require(`jiti`);async function findUp(name,options={}){let names=Array.isArray(name)?name:[name],cwd=options.cwd||process.cwd(),{root}=(0,path.parse)(cwd),stopAt=options.stopAt||root,currentDir=cwd;for(;;){for(let fileName of names){let filePath=(0,path.join)(currentDir,fileName);try{return await(0,fs_promises.access)(filePath),filePath}catch{}}if(currentDir===stopAt||currentDir===root)return;currentDir=(0,path.dirname)(currentDir)}}async function findNearestPackageJson(cwd=process.cwd()){return await findUp(`package.json`,{cwd})||null}async function getProjectRootDirectory(cwd=process.cwd()){let packageJsonPath=await findNearestPackageJson(cwd);if(!packageJsonPath)throw Error("Could not find a the root directory of the project. `package.json` file not found.");return(0,path.dirname)(packageJsonPath)}async function makeOutputDirFor(fileOrFolder){let outputDir=(0,path.join)(await getProjectRootDirectory(),fileOrFolder);return(0,fs.existsSync)(outputDir)||await(0,fs_promises.mkdir)(outputDir,{recursive:!0}),outputDir}async function detectPackageManager(cwd=process.cwd()){let rootDirectory=await getProjectRootDirectory(cwd),lockFileMap={"bun.lockb":`bun`,"pnpm-lock.yaml":`pnpm`,"yarn.lock":`yarn`,"package-lock.json":`npm`},lockFileName=Object.keys(lockFileMap).find(name=>(0,fs.existsSync)((0,path.join)(rootDirectory,name)));return lockFileName?lockFileMap[lockFileName]:`npm`}function getExecCommand(packageManager){return{pnpm:`pnpx`,yarn:`yarn dlx`,bun:`bunx`,npm:`npx`}[packageManager]}const BaseOptionSchema=valibot.object({name:valibot.pipe(valibot.string(`Expected a string for the field name`),valibot.nonEmpty(`The field name must not be empty`)),label:valibot.optional(valibot.string(`Expected a string for the field label`)),description:valibot.optional(valibot.string(`Expected a string for the field description`))}),ListOptionSchema=valibot.object({label:valibot.string(`Expected a string for the option label`),value:valibot.string(`Expected a string for the option value`)}),SingleListSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`list`,`Expected the type to be 'list'`),selectionMode:valibot.literal(`single`,`Expected the selectionMode to be 'single'`),options:valibot.array(ListOptionSchema,`Expected an array of list options`),default:valibot.pipe(valibot.string(`Expected a string for the default value`),valibot.nonEmpty(`The default value must not be empty`))}),MultipleListSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`list`,`Expected the type to be 'list'`),selectionMode:valibot.literal(`multiple`,`Expected the selectionMode to be 'multiple'`),options:valibot.array(ListOptionSchema,`Expected an array of list options`),default:valibot.optional(valibot.array(valibot.pipe(valibot.string(`Expected a string for each default value`),valibot.nonEmpty(`Each default value must not be empty`)),`Expected an array of default values`),[])}),ListSchema=valibot.variant(`selectionMode`,[SingleListSchema,MultipleListSchema]),TextSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`text`,`Expected the type to be 'text'`),default:valibot.optional(valibot.string(`Expected a string for the default value`))}),PasswordSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`password`,`Expected the type to be 'password'`),default:valibot.optional(valibot.string(`Expected a string for the default value`))}),EmailSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`email`,`Expected the type to be 'email'`),default:valibot.optional(valibot.pipe(valibot.string(`Expected a string for the default email value`),valibot.email(`The email must be a valid email address`)))}),UrlSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`url`,`Expected the type to be 'url'`),default:valibot.optional(valibot.pipe(valibot.string(`Expected a string for the default URL value`),valibot.url(`The URL must be a valid URL`)))}),PhoneSchema=valibot.object({...BaseOptionSchema.entries,type:valibot.literal(`tel`,`Expected the type to be 'tel'`),default:valibot.optional(valibot.pipe(valibot.string(`Expected a string for the default phone number value`),valibot.regex(/^\+?[0-9\s\-()]+$/,`The phone number must contain only numbers and/or country codes`)))}),FieldSchema=valibot.variant(`type`,[ListSchema,TextSchema,PasswordSchema,EmailSchema,UrlSchema,PhoneSchema]),SchemaBusinessConfigSchema=valibot.pipe(valibot.array(FieldSchema,`Expected an array of configuration fields`),valibot.minLength(1,`At least one configuration parameter is required`)),SchemaBusinessConfig=valibot.object({schema:valibot.optional(SchemaBusinessConfigSchema,[])}),MAX_DESCRIPTION_LENGTH$2=255,MAX_LABEL_LENGTH=100,MAX_KEY_LENGTH=50,COMMERCE_EVENT_NAME_REGEX=/^(?:plugin|observer)\.[a-z_]+$/,FIELD_NAME_REGEX=/^([a-zA-Z0-9_\-.[\]]+|\*)$/;function commerceEventNameSchema(){return valibot.pipe(require_schemas.i(`event name`),valibot.regex(COMMERCE_EVENT_NAME_REGEX,`Event name must start with "plugin." or "observer." followed by lowercase letters and underscores only (e.g., "plugin.order_placed")`))}function fieldNameSchema(){return valibot.pipe(require_schemas.i(`field name`),valibot.regex(FIELD_NAME_REGEX,`Field name must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), dashes (-), dots (.), and square brackets ([, ]), or be exactly "*"`))}function commerceEventFieldSchema(){return valibot.object({name:fieldNameSchema(),source:valibot.optional(require_schemas.a(`field source`))})}const ProviderSchema=valibot.object({label:valibot.pipe(require_schemas.o(`provider label`),valibot.maxLength(100,`The provider label must not be longer than 100 characters`)),description:valibot.pipe(require_schemas.i(`provider description`),valibot.maxLength(255,`The provider description must not be longer than 255 characters`)),key:valibot.optional(valibot.pipe(require_schemas.t(`provider key`),valibot.maxLength(50,`The provider key must not be longer than 50 characters`)))}),BaseEventSchema=valibot.object({label:valibot.pipe(require_schemas.o(`event label`),valibot.maxLength(100,`The event label must not be longer than 100 characters`)),description:valibot.pipe(require_schemas.i(`event description`),valibot.maxLength(255,`The event description must not be longer than 255 characters`)),runtimeActions:valibot.array(valibot.pipe(require_schemas.i(`runtime action`),valibot.regex(/^[a-z0-9-]+\/[a-z0-9-]+$/,`Runtime action must be in the format "<package>/<action>" (e.g., "my-package/my-action")`)),`Expected an array of runtime actions in the format <package>/<action>`)}),OPERATORS=[`greaterThan`,`lessThan`,`equal`,`regex`,`in`,`onChange`],ruleOperatorSchema=valibot.union(OPERATORS.map(op=>valibot.literal(op)),`Operator must be one of: ${OPERATORS.join(`, `)}`),CommerceEventRuleSchema=valibot.object({field:require_schemas.i(`rule field`),operator:ruleOperatorSchema,value:require_schemas.i(`rule value`)}),CommerceEventSchema=valibot.object({...BaseEventSchema.entries,name:commerceEventNameSchema(),fields:valibot.array(commerceEventFieldSchema(),`Expected an array of event field objects with a 'name' property`),rules:valibot.optional(valibot.array(CommerceEventRuleSchema,`Expected an array of event rules with field, operator, and value`)),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`))}),ExternalEventSchema=valibot.object({...BaseEventSchema.entries,name:require_schemas.n(`event name`,`lowercase`)}),CommerceEventSourceSchema=valibot.object({provider:ProviderSchema,events:valibot.array(CommerceEventSchema,`Expected an array of Commerce events`)}),ExternalEventSourceSchema=valibot.object({provider:ProviderSchema,events:valibot.array(ExternalEventSchema,`Expected an array of external events`)}),EventingSchema=valibot.object({commerce:valibot.optional(valibot.array(CommerceEventSourceSchema,`Expected an array of Commerce event sources`)),external:valibot.optional(valibot.array(ExternalEventSourceSchema,`Expected an array of external event sources`))}),MAX_DESCRIPTION_LENGTH$1=255,MAX_NAME_LENGTH=255,MAX_MESSAGE_LENGTH=1e3,CustomInstallationStepSchema=valibot.object({script:valibot.pipe(require_schemas.i(`script path`),valibot.regex(/^(?:\.{0,2}\/)*[\w-/]*[\w-]+\.js$/,`Script path must end with .js (e.g., "./setup.js", "./scripts/setup.js", or "../../scripts/setup.js")`)),name:valibot.pipe(require_schemas.i(`step name`),valibot.maxLength(255,`The step name must not be longer than 255 characters`)),description:valibot.pipe(require_schemas.i(`step description`),valibot.maxLength(255,`The step description must not be longer than 255 characters`))}),MessagesSchema=valibot.object({preInstallation:valibot.optional(valibot.pipe(require_schemas.i(`preInstallation message`),valibot.maxLength(MAX_MESSAGE_LENGTH,`The preInstallation message must not be longer than ${MAX_MESSAGE_LENGTH} characters`))),postInstallation:valibot.optional(valibot.pipe(require_schemas.i(`postInstallation message`),valibot.maxLength(MAX_MESSAGE_LENGTH,`The postInstallation message must not be longer than ${MAX_MESSAGE_LENGTH} characters`)))}),InstallationSchema=valibot.object({messages:valibot.optional(MessagesSchema),customInstallationSteps:valibot.optional(valibot.array(CustomInstallationStepSchema,`Expected an array of custom installation steps`))}),MAX_DESCRIPTION_LENGTH=255,MAX_DISPLAY_NAME_LENGTH=50,NUMERIC_IDENTIFIER=`(0|[1-9]\\d*)`,SEMVER_REGEX=RegExp(`^${NUMERIC_IDENTIFIER}\\.${NUMERIC_IDENTIFIER}\\.${NUMERIC_IDENTIFIER}$`);function nonEmptyString(fieldName){return valibot.pipe(valibot.string(`Expected a string for the ${fieldName}`),valibot.nonEmpty(`The ${fieldName} must not be empty`))}const MetadataSchema=valibot.object({id:require_schemas.t(`application id (metadata.id)`),displayName:valibot.pipe(nonEmptyString(`application display name`),valibot.maxLength(50,`The application display name must not be longer than 50 characters`)),description:valibot.pipe(nonEmptyString(`metadata description`),valibot.maxLength(255,`The metadata description must not be longer than 255 characters`)),version:valibot.pipe(nonEmptyString(`version`),valibot.regex(SEMVER_REGEX,`The version must follow semantic versioning (semver) format`))}),CommerceAppConfigSchemas={metadata:MetadataSchema,businessConfig:SchemaBusinessConfig,"businessConfig.schema":SchemaBusinessConfigSchema,eventing:EventingSchema,installation:InstallationSchema},CommerceAppConfigSchema=valibot.looseObject({metadata:MetadataSchema,businessConfig:valibot.optional(SchemaBusinessConfig),eventing:valibot.optional(EventingSchema),installation:valibot.optional(InstallationSchema)}),commerceAppConfigDomainsSchema=valibot.picklist(Object.keys(CommerceAppConfigSchemas));function validateCommerceAppConfig(config){let validatedConfig=valibot.safeParse(CommerceAppConfigSchema,config);if(!validatedConfig.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid commerce app config`,{issues:validatedConfig.issues});return validatedConfig.output}function validateCommerceAppConfigDomain(config,domain){let domainSchema=valibot.safeParse(commerceAppConfigDomainsSchema,domain);if(!domainSchema.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid commerce app config domain`,{issues:domainSchema.issues});let domainConfigSchema=CommerceAppConfigSchemas[domain],validatedConfig=valibot.safeParse(domainConfigSchema,config);if(!validatedConfig.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid commerce app config: ${domain}`,{issues:validatedConfig.issues});return validatedConfig.output}const jiti$1=(0,jiti.createJiti)(require(`url`).pathToFileURL(__filename).href),configPaths=Object.freeze([`app.commerce.config.js`,`app.commerce.config.ts`,`app.commerce.config.cjs`,`app.commerce.config.mjs`,`app.commerce.config.mts`,`app.commerce.config.cts`]);async function resolveCommerceAppConfig(cwd=process.cwd()){let packageJsonPath=await findNearestPackageJson(cwd);if(!packageJsonPath)return null;let rootDirectory=(0,path.dirname)(packageJsonPath);for(let configPath of configPaths){let configFilePath=await findUp(configPath,{cwd,stopAt:rootDirectory});if(configFilePath)return configFilePath}return null}async function readCommerceAppConfig(cwd=process.cwd()){let configFilePath=await resolveCommerceAppConfig(cwd);if(!configFilePath)throw Error(`Could not find a commerce app config file in the current working directory or its parents.`);let config=null;try{config=await jiti$1.import(configFilePath)}catch(error){let message=require_error.t(error);throw Error(`Failed to read commerce app config file at ${configFilePath}: ${message}`,{cause:error})}if(!(config&&`default`in config)||config.default===void 0||config.default===null||typeof config.default==`object`&&Object.keys(config.default).length===0)throw Error("Commerce app config file does not export a default export. Make sure you use `export default` or `module.exports = { /* your config */ }`");return config.default}async function parseCommerceAppConfig(cwd=process.cwd()){return validateCommerceAppConfig(await readCommerceAppConfig(cwd))}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return validateCommerceAppConfigDomain}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return getProjectRootDirectory}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return validateCommerceAppConfig}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return makeOutputDirFor}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return readCommerceAppConfig}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return detectPackageManager}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return resolveCommerceAppConfig}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return getExecCommand}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return parseCommerceAppConfig}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const require_error=require(`./error-yAk1zzvx.cjs`);let valibot=require(`valibot`);valibot=require_error.o(valibot);const ALPHANUMERIC_OR_UNDERSCORE_REGEX={any:/^[a-zA-Z0-9_]+$/,lowercase:/^[a-z0-9_]+$/,uppercase:/^[A-Z0-9_]+$/},ALPHANUMERIC_OR_HYPHEN_REGEX={any:/^[a-zA-Z0-9-]+$/,lowercase:/^[a-z0-9-]+$/,uppercase:/^[A-Z0-9-]+$/},TITLE_CASE_REGEX=/^[A-Z][a-z]*(?:\s[A-Z][a-z]*)*$/;function stringValueSchema(name){return valibot.string(`Expected a string value for '${name}'`)}function nonEmptyStringValueSchema(name){return valibot.pipe(stringValueSchema(name),valibot.nonEmpty(`The value of "${name}" must not be empty`))}function booleanValueSchema(name){return valibot.boolean(`Expected a boolean value for '${name}'`)}function alphaNumericOrUnderscoreSchema(name,casing=`any`){let casingLabel=casing===`any`?``:` (${casing} only)`;return valibot.pipe(stringValueSchema(name),valibot.regex(ALPHANUMERIC_OR_UNDERSCORE_REGEX[casing],`Only alphanumeric characters and underscores are allowed in string value of "${name}"${casingLabel}`))}function alphaNumericOrHyphenSchema(name,casing=`any`){let casingLabel=casing===`any`?``:` (${casing} only)`;return valibot.pipe(stringValueSchema(name),valibot.regex(ALPHANUMERIC_OR_HYPHEN_REGEX[casing],`Only alphanumeric characters and hyphens are allowed in string value of "${name}"${casingLabel}`))}function titleCaseSchema(name){return valibot.pipe(nonEmptyStringValueSchema(name),valibot.regex(TITLE_CASE_REGEX,`The value of "${name}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`))}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return stringValueSchema}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return nonEmptyStringValueSchema}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return alphaNumericOrUnderscoreSchema}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return titleCaseSchema}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return booleanValueSchema}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return alphaNumericOrHyphenSchema}});
|
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
|
|
3
|
-
//#region source/config/schema/app.d.ts
|
|
4
|
-
declare const CommerceAppConfigSchemas: {
|
|
5
|
-
readonly metadata: v.ObjectSchema<{
|
|
6
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
|
|
7
|
-
readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
|
|
8
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
|
|
9
|
-
readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format">]>;
|
|
10
|
-
}, undefined>;
|
|
11
|
-
readonly businessConfig: v.ObjectSchema<{
|
|
12
|
-
readonly schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.VariantSchema<"selectionMode", [v.ObjectSchema<{
|
|
13
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
14
|
-
readonly selectionMode: v.LiteralSchema<"single", "Expected the selectionMode to be 'single'">;
|
|
15
|
-
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
16
|
-
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
17
|
-
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
18
|
-
}, undefined>, "Expected an array of list options">;
|
|
19
|
-
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default value">, v.NonEmptyAction<string, "The default value must not be empty">]>;
|
|
20
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
21
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
22
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
23
|
-
}, undefined>, v.ObjectSchema<{
|
|
24
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
25
|
-
readonly selectionMode: v.LiteralSchema<"multiple", "Expected the selectionMode to be 'multiple'">;
|
|
26
|
-
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
27
|
-
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
28
|
-
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
29
|
-
}, undefined>, "Expected an array of list options">;
|
|
30
|
-
readonly default: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for each default value">, v.NonEmptyAction<string, "Each default value must not be empty">]>, "Expected an array of default values">, readonly []>;
|
|
31
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
32
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
33
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
34
|
-
}, undefined>], undefined>, v.ObjectSchema<{
|
|
35
|
-
readonly type: v.LiteralSchema<"text", "Expected the type to be 'text'">;
|
|
36
|
-
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
37
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
38
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
39
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
40
|
-
}, undefined>, v.ObjectSchema<{
|
|
41
|
-
readonly type: v.LiteralSchema<"password", "Expected the type to be 'password'">;
|
|
42
|
-
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
43
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
44
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
45
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
46
|
-
}, undefined>, v.ObjectSchema<{
|
|
47
|
-
readonly type: v.LiteralSchema<"email", "Expected the type to be 'email'">;
|
|
48
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default email value">, v.EmailAction<string, "The email must be a valid email address">]>, undefined>;
|
|
49
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
50
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
51
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
52
|
-
}, undefined>, v.ObjectSchema<{
|
|
53
|
-
readonly type: v.LiteralSchema<"url", "Expected the type to be 'url'">;
|
|
54
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default URL value">, v.UrlAction<string, "The URL must be a valid URL">]>, undefined>;
|
|
55
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
56
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
57
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
58
|
-
}, undefined>, v.ObjectSchema<{
|
|
59
|
-
readonly type: v.LiteralSchema<"tel", "Expected the type to be 'tel'">;
|
|
60
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default phone number value">, v.RegexAction<string, "The phone number must contain only numbers and/or country codes">]>, undefined>;
|
|
61
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
62
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
63
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
64
|
-
}, undefined>], undefined>, "Expected an array of configuration fields">, v.MinLengthAction<({
|
|
65
|
-
type: "list";
|
|
66
|
-
selectionMode: "single";
|
|
67
|
-
options: {
|
|
68
|
-
label: string;
|
|
69
|
-
value: string;
|
|
70
|
-
}[];
|
|
71
|
-
default: string;
|
|
72
|
-
name: string;
|
|
73
|
-
label?: string | undefined;
|
|
74
|
-
description?: string | undefined;
|
|
75
|
-
} | {
|
|
76
|
-
type: "list";
|
|
77
|
-
selectionMode: "multiple";
|
|
78
|
-
options: {
|
|
79
|
-
label: string;
|
|
80
|
-
value: string;
|
|
81
|
-
}[];
|
|
82
|
-
default: string[];
|
|
83
|
-
name: string;
|
|
84
|
-
label?: string | undefined;
|
|
85
|
-
description?: string | undefined;
|
|
86
|
-
} | {
|
|
87
|
-
type: "text";
|
|
88
|
-
default?: string | undefined;
|
|
89
|
-
name: string;
|
|
90
|
-
label?: string | undefined;
|
|
91
|
-
description?: string | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
type: "password";
|
|
94
|
-
default?: string | undefined;
|
|
95
|
-
name: string;
|
|
96
|
-
label?: string | undefined;
|
|
97
|
-
description?: string | undefined;
|
|
98
|
-
} | {
|
|
99
|
-
type: "email";
|
|
100
|
-
default?: string | undefined;
|
|
101
|
-
name: string;
|
|
102
|
-
label?: string | undefined;
|
|
103
|
-
description?: string | undefined;
|
|
104
|
-
} | {
|
|
105
|
-
type: "url";
|
|
106
|
-
default?: string | undefined;
|
|
107
|
-
name: string;
|
|
108
|
-
label?: string | undefined;
|
|
109
|
-
description?: string | undefined;
|
|
110
|
-
} | {
|
|
111
|
-
type: "tel";
|
|
112
|
-
default?: string | undefined;
|
|
113
|
-
name: string;
|
|
114
|
-
label?: string | undefined;
|
|
115
|
-
description?: string | undefined;
|
|
116
|
-
})[], 1, "At least one configuration parameter is required">]>, readonly []>;
|
|
117
|
-
}, undefined>;
|
|
118
|
-
readonly "businessConfig.schema": v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.VariantSchema<"selectionMode", [v.ObjectSchema<{
|
|
119
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
120
|
-
readonly selectionMode: v.LiteralSchema<"single", "Expected the selectionMode to be 'single'">;
|
|
121
|
-
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
122
|
-
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
123
|
-
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
124
|
-
}, undefined>, "Expected an array of list options">;
|
|
125
|
-
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default value">, v.NonEmptyAction<string, "The default value must not be empty">]>;
|
|
126
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
127
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
128
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
129
|
-
}, undefined>, v.ObjectSchema<{
|
|
130
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
131
|
-
readonly selectionMode: v.LiteralSchema<"multiple", "Expected the selectionMode to be 'multiple'">;
|
|
132
|
-
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
133
|
-
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
134
|
-
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
135
|
-
}, undefined>, "Expected an array of list options">;
|
|
136
|
-
readonly default: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for each default value">, v.NonEmptyAction<string, "Each default value must not be empty">]>, "Expected an array of default values">, readonly []>;
|
|
137
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
138
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
139
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
140
|
-
}, undefined>], undefined>, v.ObjectSchema<{
|
|
141
|
-
readonly type: v.LiteralSchema<"text", "Expected the type to be 'text'">;
|
|
142
|
-
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
143
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
144
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
145
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
146
|
-
}, undefined>, v.ObjectSchema<{
|
|
147
|
-
readonly type: v.LiteralSchema<"password", "Expected the type to be 'password'">;
|
|
148
|
-
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
149
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
150
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
151
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
152
|
-
}, undefined>, v.ObjectSchema<{
|
|
153
|
-
readonly type: v.LiteralSchema<"email", "Expected the type to be 'email'">;
|
|
154
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default email value">, v.EmailAction<string, "The email must be a valid email address">]>, undefined>;
|
|
155
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
156
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
157
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
158
|
-
}, undefined>, v.ObjectSchema<{
|
|
159
|
-
readonly type: v.LiteralSchema<"url", "Expected the type to be 'url'">;
|
|
160
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default URL value">, v.UrlAction<string, "The URL must be a valid URL">]>, undefined>;
|
|
161
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
162
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
163
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
164
|
-
}, undefined>, v.ObjectSchema<{
|
|
165
|
-
readonly type: v.LiteralSchema<"tel", "Expected the type to be 'tel'">;
|
|
166
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default phone number value">, v.RegexAction<string, "The phone number must contain only numbers and/or country codes">]>, undefined>;
|
|
167
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
168
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
169
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
170
|
-
}, undefined>], undefined>, "Expected an array of configuration fields">, v.MinLengthAction<({
|
|
171
|
-
type: "list";
|
|
172
|
-
selectionMode: "single";
|
|
173
|
-
options: {
|
|
174
|
-
label: string;
|
|
175
|
-
value: string;
|
|
176
|
-
}[];
|
|
177
|
-
default: string;
|
|
178
|
-
name: string;
|
|
179
|
-
label?: string | undefined;
|
|
180
|
-
description?: string | undefined;
|
|
181
|
-
} | {
|
|
182
|
-
type: "list";
|
|
183
|
-
selectionMode: "multiple";
|
|
184
|
-
options: {
|
|
185
|
-
label: string;
|
|
186
|
-
value: string;
|
|
187
|
-
}[];
|
|
188
|
-
default: string[];
|
|
189
|
-
name: string;
|
|
190
|
-
label?: string | undefined;
|
|
191
|
-
description?: string | undefined;
|
|
192
|
-
} | {
|
|
193
|
-
type: "text";
|
|
194
|
-
default?: string | undefined;
|
|
195
|
-
name: string;
|
|
196
|
-
label?: string | undefined;
|
|
197
|
-
description?: string | undefined;
|
|
198
|
-
} | {
|
|
199
|
-
type: "password";
|
|
200
|
-
default?: string | undefined;
|
|
201
|
-
name: string;
|
|
202
|
-
label?: string | undefined;
|
|
203
|
-
description?: string | undefined;
|
|
204
|
-
} | {
|
|
205
|
-
type: "email";
|
|
206
|
-
default?: string | undefined;
|
|
207
|
-
name: string;
|
|
208
|
-
label?: string | undefined;
|
|
209
|
-
description?: string | undefined;
|
|
210
|
-
} | {
|
|
211
|
-
type: "url";
|
|
212
|
-
default?: string | undefined;
|
|
213
|
-
name: string;
|
|
214
|
-
label?: string | undefined;
|
|
215
|
-
description?: string | undefined;
|
|
216
|
-
} | {
|
|
217
|
-
type: "tel";
|
|
218
|
-
default?: string | undefined;
|
|
219
|
-
name: string;
|
|
220
|
-
label?: string | undefined;
|
|
221
|
-
description?: string | undefined;
|
|
222
|
-
})[], 1, "At least one configuration parameter is required">]>;
|
|
223
|
-
readonly eventing: v.ObjectSchema<{
|
|
224
|
-
readonly commerce: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
225
|
-
readonly provider: v.ObjectSchema<{
|
|
226
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
227
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
228
|
-
readonly key: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 50, "The provider key must not be longer than 50 characters">]>, undefined>;
|
|
229
|
-
}, undefined>;
|
|
230
|
-
readonly events: v.ArraySchema<v.ObjectSchema<{
|
|
231
|
-
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Event name must start with \"plugin.\" or \"observer.\" followed by lowercase letters and underscores only (e.g., \"plugin.order_placed\")">]>;
|
|
232
|
-
readonly fields: v.ArraySchema<v.ObjectSchema<{
|
|
233
|
-
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Field name must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), dashes (-), dots (.), and square brackets ([, ]), or be exactly \"*\"">]>;
|
|
234
|
-
readonly source: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
|
|
235
|
-
}, undefined>, "Expected an array of event field objects with a 'name' property">;
|
|
236
|
-
readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
237
|
-
readonly field: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
238
|
-
readonly operator: v.UnionSchema<v.LiteralSchema<"regex" | "greaterThan" | "lessThan" | "equal" | "in" | "onChange", undefined>[], `Operator must be one of: ${string}`>;
|
|
239
|
-
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
240
|
-
}, undefined>, "Expected an array of event rules with field, operator, and value">, undefined>;
|
|
241
|
-
readonly destination: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, undefined>;
|
|
242
|
-
readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
243
|
-
readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
244
|
-
readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
245
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The event label must not be longer than 100 characters">]>;
|
|
246
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
247
|
-
readonly runtimeActions: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")">]>, "Expected an array of runtime actions in the format <package>/<action>">;
|
|
248
|
-
}, undefined>, "Expected an array of Commerce events">;
|
|
249
|
-
}, undefined>, "Expected an array of Commerce event sources">, undefined>;
|
|
250
|
-
readonly external: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
251
|
-
readonly provider: v.ObjectSchema<{
|
|
252
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
253
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
254
|
-
readonly key: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 50, "The provider key must not be longer than 50 characters">]>, undefined>;
|
|
255
|
-
}, undefined>;
|
|
256
|
-
readonly events: v.ArraySchema<v.ObjectSchema<{
|
|
257
|
-
readonly name: 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}`>]>;
|
|
258
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The event label must not be longer than 100 characters">]>;
|
|
259
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
260
|
-
readonly runtimeActions: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")">]>, "Expected an array of runtime actions in the format <package>/<action>">;
|
|
261
|
-
}, undefined>, "Expected an array of external events">;
|
|
262
|
-
}, undefined>, "Expected an array of external event sources">, undefined>;
|
|
263
|
-
}, undefined>;
|
|
264
|
-
readonly installation: v.ObjectSchema<{
|
|
265
|
-
readonly messages: v.OptionalSchema<v.ObjectSchema<{
|
|
266
|
-
readonly preInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The preInstallation message must not be longer than 1000 characters">]>, undefined>;
|
|
267
|
-
readonly postInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The postInstallation message must not be longer than 1000 characters">]>, undefined>;
|
|
268
|
-
}, undefined>, undefined>;
|
|
269
|
-
readonly customInstallationSteps: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
270
|
-
readonly script: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Script path must end with .js (e.g., \"./setup.js\", \"./scripts/setup.js\", or \"../../scripts/setup.js\")">]>;
|
|
271
|
-
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step name must not be longer than 255 characters">]>;
|
|
272
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step description must not be longer than 255 characters">]>;
|
|
273
|
-
}, undefined>, "Expected an array of custom installation steps">, undefined>;
|
|
274
|
-
}, undefined>;
|
|
275
|
-
};
|
|
276
|
-
/** Individual validatable domains of the commerce app config. */
|
|
277
|
-
type CommerceAppConfigDomain = keyof typeof CommerceAppConfigSchemas;
|
|
278
|
-
/** The schema used to validate the commerce app config file. */
|
|
279
|
-
declare const CommerceAppConfigSchema: v.LooseObjectSchema<{
|
|
280
|
-
readonly metadata: v.ObjectSchema<{
|
|
281
|
-
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>;
|
|
282
|
-
readonly displayName: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 50, "The application display name must not be longer than 50 characters">]>;
|
|
283
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.MaxLengthAction<string, 255, "The metadata description must not be longer than 255 characters">]>;
|
|
284
|
-
readonly version: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string for the ${string}`>, v.NonEmptyAction<string, `The ${string} must not be empty`>]>, v.RegexAction<string, "The version must follow semantic versioning (semver) format">]>;
|
|
285
|
-
}, undefined>;
|
|
286
|
-
readonly businessConfig: v.OptionalSchema<v.ObjectSchema<{
|
|
287
|
-
readonly schema: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.VariantSchema<"type", [v.VariantSchema<"selectionMode", [v.ObjectSchema<{
|
|
288
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
289
|
-
readonly selectionMode: v.LiteralSchema<"single", "Expected the selectionMode to be 'single'">;
|
|
290
|
-
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
291
|
-
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
292
|
-
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
293
|
-
}, undefined>, "Expected an array of list options">;
|
|
294
|
-
readonly default: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default value">, v.NonEmptyAction<string, "The default value must not be empty">]>;
|
|
295
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
296
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
297
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
298
|
-
}, undefined>, v.ObjectSchema<{
|
|
299
|
-
readonly type: v.LiteralSchema<"list", "Expected the type to be 'list'">;
|
|
300
|
-
readonly selectionMode: v.LiteralSchema<"multiple", "Expected the selectionMode to be 'multiple'">;
|
|
301
|
-
readonly options: v.ArraySchema<v.ObjectSchema<{
|
|
302
|
-
readonly label: v.StringSchema<"Expected a string for the option label">;
|
|
303
|
-
readonly value: v.StringSchema<"Expected a string for the option value">;
|
|
304
|
-
}, undefined>, "Expected an array of list options">;
|
|
305
|
-
readonly default: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for each default value">, v.NonEmptyAction<string, "Each default value must not be empty">]>, "Expected an array of default values">, readonly []>;
|
|
306
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
307
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
308
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
309
|
-
}, undefined>], undefined>, v.ObjectSchema<{
|
|
310
|
-
readonly type: v.LiteralSchema<"text", "Expected the type to be 'text'">;
|
|
311
|
-
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
312
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
313
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
314
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
315
|
-
}, undefined>, v.ObjectSchema<{
|
|
316
|
-
readonly type: v.LiteralSchema<"password", "Expected the type to be 'password'">;
|
|
317
|
-
readonly default: v.OptionalSchema<v.StringSchema<"Expected a string for the default value">, undefined>;
|
|
318
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
319
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
320
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
321
|
-
}, undefined>, v.ObjectSchema<{
|
|
322
|
-
readonly type: v.LiteralSchema<"email", "Expected the type to be 'email'">;
|
|
323
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default email value">, v.EmailAction<string, "The email must be a valid email address">]>, undefined>;
|
|
324
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
325
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
326
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
327
|
-
}, undefined>, v.ObjectSchema<{
|
|
328
|
-
readonly type: v.LiteralSchema<"url", "Expected the type to be 'url'">;
|
|
329
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default URL value">, v.UrlAction<string, "The URL must be a valid URL">]>, undefined>;
|
|
330
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
331
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
332
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
333
|
-
}, undefined>, v.ObjectSchema<{
|
|
334
|
-
readonly type: v.LiteralSchema<"tel", "Expected the type to be 'tel'">;
|
|
335
|
-
readonly default: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the default phone number value">, v.RegexAction<string, "The phone number must contain only numbers and/or country codes">]>, undefined>;
|
|
336
|
-
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<"Expected a string for the field name">, v.NonEmptyAction<string, "The field name must not be empty">]>;
|
|
337
|
-
readonly label: v.OptionalSchema<v.StringSchema<"Expected a string for the field label">, undefined>;
|
|
338
|
-
readonly description: v.OptionalSchema<v.StringSchema<"Expected a string for the field description">, undefined>;
|
|
339
|
-
}, undefined>], undefined>, "Expected an array of configuration fields">, v.MinLengthAction<({
|
|
340
|
-
type: "list";
|
|
341
|
-
selectionMode: "single";
|
|
342
|
-
options: {
|
|
343
|
-
label: string;
|
|
344
|
-
value: string;
|
|
345
|
-
}[];
|
|
346
|
-
default: string;
|
|
347
|
-
name: string;
|
|
348
|
-
label?: string | undefined;
|
|
349
|
-
description?: string | undefined;
|
|
350
|
-
} | {
|
|
351
|
-
type: "list";
|
|
352
|
-
selectionMode: "multiple";
|
|
353
|
-
options: {
|
|
354
|
-
label: string;
|
|
355
|
-
value: string;
|
|
356
|
-
}[];
|
|
357
|
-
default: string[];
|
|
358
|
-
name: string;
|
|
359
|
-
label?: string | undefined;
|
|
360
|
-
description?: string | undefined;
|
|
361
|
-
} | {
|
|
362
|
-
type: "text";
|
|
363
|
-
default?: string | undefined;
|
|
364
|
-
name: string;
|
|
365
|
-
label?: string | undefined;
|
|
366
|
-
description?: string | undefined;
|
|
367
|
-
} | {
|
|
368
|
-
type: "password";
|
|
369
|
-
default?: string | undefined;
|
|
370
|
-
name: string;
|
|
371
|
-
label?: string | undefined;
|
|
372
|
-
description?: string | undefined;
|
|
373
|
-
} | {
|
|
374
|
-
type: "email";
|
|
375
|
-
default?: string | undefined;
|
|
376
|
-
name: string;
|
|
377
|
-
label?: string | undefined;
|
|
378
|
-
description?: string | undefined;
|
|
379
|
-
} | {
|
|
380
|
-
type: "url";
|
|
381
|
-
default?: string | undefined;
|
|
382
|
-
name: string;
|
|
383
|
-
label?: string | undefined;
|
|
384
|
-
description?: string | undefined;
|
|
385
|
-
} | {
|
|
386
|
-
type: "tel";
|
|
387
|
-
default?: string | undefined;
|
|
388
|
-
name: string;
|
|
389
|
-
label?: string | undefined;
|
|
390
|
-
description?: string | undefined;
|
|
391
|
-
})[], 1, "At least one configuration parameter is required">]>, readonly []>;
|
|
392
|
-
}, undefined>, undefined>;
|
|
393
|
-
readonly eventing: v.OptionalSchema<v.ObjectSchema<{
|
|
394
|
-
readonly commerce: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
395
|
-
readonly provider: v.ObjectSchema<{
|
|
396
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
397
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
398
|
-
readonly key: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 50, "The provider key must not be longer than 50 characters">]>, undefined>;
|
|
399
|
-
}, undefined>;
|
|
400
|
-
readonly events: v.ArraySchema<v.ObjectSchema<{
|
|
401
|
-
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Event name must start with \"plugin.\" or \"observer.\" followed by lowercase letters and underscores only (e.g., \"plugin.order_placed\")">]>;
|
|
402
|
-
readonly fields: v.ArraySchema<v.ObjectSchema<{
|
|
403
|
-
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Field name must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), dashes (-), dots (.), and square brackets ([, ]), or be exactly \"*\"">]>;
|
|
404
|
-
readonly source: v.OptionalSchema<v.StringSchema<`Expected a string value for '${string}'`>, undefined>;
|
|
405
|
-
}, undefined>, "Expected an array of event field objects with a 'name' property">;
|
|
406
|
-
readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
407
|
-
readonly field: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
408
|
-
readonly operator: v.UnionSchema<v.LiteralSchema<"regex" | "greaterThan" | "lessThan" | "equal" | "in" | "onChange", undefined>[], `Operator must be one of: ${string}`>;
|
|
409
|
-
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>;
|
|
410
|
-
}, undefined>, "Expected an array of event rules with field, operator, and value">, undefined>;
|
|
411
|
-
readonly destination: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, undefined>;
|
|
412
|
-
readonly hipaaAuditRequired: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
413
|
-
readonly prioritary: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
414
|
-
readonly force: v.OptionalSchema<v.BooleanSchema<`Expected a boolean value for '${string}'`>, undefined>;
|
|
415
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The event label must not be longer than 100 characters">]>;
|
|
416
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
417
|
-
readonly runtimeActions: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")">]>, "Expected an array of runtime actions in the format <package>/<action>">;
|
|
418
|
-
}, undefined>, "Expected an array of Commerce events">;
|
|
419
|
-
}, undefined>, "Expected an array of Commerce event sources">, undefined>;
|
|
420
|
-
readonly external: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
421
|
-
readonly provider: v.ObjectSchema<{
|
|
422
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The provider label must not be longer than 100 characters">]>;
|
|
423
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The provider description must not be longer than 255 characters">]>;
|
|
424
|
-
readonly key: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.RegexAction<string, `Only alphanumeric characters and hyphens are allowed in string value of "${string}"${string}`>]>, v.MaxLengthAction<string, 50, "The provider key must not be longer than 50 characters">]>, undefined>;
|
|
425
|
-
}, undefined>;
|
|
426
|
-
readonly events: v.ArraySchema<v.ObjectSchema<{
|
|
427
|
-
readonly name: 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}`>]>;
|
|
428
|
-
readonly label: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, `The value of "${string}" must be in Title Case, which means, an uppercase letter after each space (e.g., "Some Title Case")`>]>, v.MaxLengthAction<string, 100, "The event label must not be longer than 100 characters">]>;
|
|
429
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The event description must not be longer than 255 characters">]>;
|
|
430
|
-
readonly runtimeActions: v.ArraySchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Runtime action must be in the format \"<package>/<action>\" (e.g., \"my-package/my-action\")">]>, "Expected an array of runtime actions in the format <package>/<action>">;
|
|
431
|
-
}, undefined>, "Expected an array of external events">;
|
|
432
|
-
}, undefined>, "Expected an array of external event sources">, undefined>;
|
|
433
|
-
}, undefined>, undefined>;
|
|
434
|
-
readonly installation: v.OptionalSchema<v.ObjectSchema<{
|
|
435
|
-
readonly messages: v.OptionalSchema<v.ObjectSchema<{
|
|
436
|
-
readonly preInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The preInstallation message must not be longer than 1000 characters">]>, undefined>;
|
|
437
|
-
readonly postInstallation: v.OptionalSchema<v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 1000, "The postInstallation message must not be longer than 1000 characters">]>, undefined>;
|
|
438
|
-
}, undefined>, undefined>;
|
|
439
|
-
readonly customInstallationSteps: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
440
|
-
readonly script: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.RegexAction<string, "Script path must end with .js (e.g., \"./setup.js\", \"./scripts/setup.js\", or \"../../scripts/setup.js\")">]>;
|
|
441
|
-
readonly name: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step name must not be longer than 255 characters">]>;
|
|
442
|
-
readonly description: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<`Expected a string value for '${string}'`>, v.NonEmptyAction<string, `The value of "${string}" must not be empty`>]>, v.MaxLengthAction<string, 255, "The step description must not be longer than 255 characters">]>;
|
|
443
|
-
}, undefined>, "Expected an array of custom installation steps">, undefined>;
|
|
444
|
-
}, undefined>, undefined>;
|
|
445
|
-
}, undefined>;
|
|
446
|
-
/** The input shape of the commerce app config schema. */
|
|
447
|
-
type CommerceAppConfig = v.InferInput<typeof CommerceAppConfigSchema>;
|
|
448
|
-
/** The output shape of the commerce app config schema. */
|
|
449
|
-
type CommerceAppConfigOutputModel = v.InferOutput<typeof CommerceAppConfigSchema>;
|
|
450
|
-
//#endregion
|
|
451
|
-
export { CommerceAppConfigDomain as n, CommerceAppConfigOutputModel as r, CommerceAppConfig as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire}from"module";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__esmMin=(fn,res)=>()=>(fn&&(res=fn(fn=0)),res),__commonJSMin=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),__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)),__toCommonJS=mod=>__hasOwnProp.call(mod,`module.exports`)?mod[`module.exports`]:__copyProps(__defProp({},`__esModule`,{value:!0}),mod),__require=createRequire(import.meta.url);export{__toCommonJS as a,__require as i,__esmMin as n,__toESM as o,__exportAll as r,__commonJSMin as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CommerceSdkValidationError}from"@adobe/aio-commerce-lib-core/error";function stringifyError(error){return error instanceof CommerceSdkValidationError?error.display():error instanceof Error?error.message:String(error)}export{stringifyError as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as stringifyError}from"./error-hBHRgZ9R.mjs";import util from"util";import{resolveAuthParams}from"@adobe/aio-commerce-lib-auth";import{resolveCommerceHttpClientParams,resolveIoEventsHttpClientParams}from"@adobe/aio-commerce-lib-api";import{createCustomCommerceEventsApiClient,createEventProvider,createEventSubscription,getAllEventProviders,getAllEventSubscriptions,updateEventingConfiguration}from"@adobe/aio-commerce-lib-events/commerce";import{createCustomAdobeIoEventsApiClient,createEventMetadataForProvider,createEventProvider as createEventProvider$1,createRegistration,getAllEventProviders as getAllEventProviders$1,getAllRegistrations}from"@adobe/aio-commerce-lib-events/io-events";async function callHook(hooks,hookName,...args){let hook=hooks?.[hookName];hook&&await hook(...args)}function isLeafStep(step){return step.type===`leaf`}function isBranchStep(step){return step.type===`branch`}function defineLeafStep(options){return{type:`leaf`,name:options.name,meta:options.meta,when:options.when,run:options.run}}function defineBranchStep(options){return{type:`branch`,name:options.name,meta:options.meta,when:options.when,context:options.context,children:options.children}}function nowIsoString(){return new Date().toISOString()}function setAtPath(data,path,value){let lastKey=path.at(-1);if(!lastKey)return;let current=data;for(let i=0;i<path.length-1;i++){let key=path[i];current[key]??={},current=current[key]}current[lastKey]=value}function getAtPath(data,path){let current=data;for(let key of path){if(typeof current!=`object`||!current)return;current=current[key]}return current}function createInstallationError(err,path,key=`STEP_EXECUTION_FAILED`){return{path,key,message:err instanceof Error?err.message:String(err)}}function createSucceededState(base){return{...base,status:`succeeded`,completedAt:nowIsoString()}}function createFailedState(base,error){return{...base,status:`failed`,completedAt:nowIsoString(),error}}function createInitialState(options){let{rootStep,config}=options;return{id:crypto.randomUUID(),startedAt:nowIsoString(),status:`in-progress`,step:buildInitialStepStatus(rootStep,config,[]),data:null}}async function executeWorkflow(options){let{rootStep,installationContext,config,initialState,hooks}=options,step=structuredClone(initialState.step),context={installationContext,config,id:initialState.id,startedAt:initialState.startedAt,step,data:null,error:null,hooks};await callHook(hooks,`onInstallationStart`,snapshot(context));try{await executeStep(rootStep,context.step,{},context);let succeeded=createSucceededState({id:context.id,startedAt:context.startedAt,step:context.step,data:context.data});return await callHook(hooks,`onInstallationSuccess`,succeeded),succeeded}catch(err){let error=context.error??createInstallationError(err,[],`INSTALLATION_FAILED`),failed=createFailedState({step:context.step,id:context.id,startedAt:context.startedAt,data:context.data},error);return await callHook(hooks,`onInstallationFailure`,failed),failed}}function buildInitialStepStatus(step,config,parentPath){let path=[...parentPath,step.name],children=[];if(isBranchStep(step)&&step.children.length>0)for(let child of step.children)child.when&&!child.when(config)||children.push(buildInitialStepStatus(child,config,path));return{id:crypto.randomUUID(),name:step.name,path,meta:step.meta,status:`pending`,children}}function snapshot(context){return{id:context.id,startedAt:context.startedAt,status:`in-progress`,step:context.step,data:context.data}}async function executeStep(step,stepStatus,inherited,context){let{path}=stepStatus,isLeaf=isLeafStep(step);stepStatus.status=`in-progress`,await callHook(context.hooks,`onStepStart`,{path,stepName:step.name,isLeaf},snapshot(context));try{isBranchStep(step)?await executeBranchStep(step,stepStatus,inherited,context):isLeafStep(step)&&await executeLeafStep(step,stepStatus,inherited,context),stepStatus.status=`succeeded`,context.data??={},await callHook(context.hooks,`onStepSuccess`,{path,stepName:step.name,isLeaf,result:getAtPath(context.data,path)},snapshot(context))}catch(err){throw stepStatus.status=`failed`,context.error??=createInstallationError(err,path),await callHook(context.hooks,`onStepFailure`,{path,stepName:step.name,isLeaf,error:context.error},snapshot(context)),err}}async function executeBranchStep(step,stepStatus,inherited,context){let childContext=inherited;if(step.context){let stepContext=await step.context(context.installationContext);childContext={...inherited,...stepContext}}for(let child of stepStatus.children){let childStep=step.children.find(c=>c.name===child.name);if(!childStep)throw Error(`Step "${child.name}" not found`);await executeStep(childStep,child,childContext,context)}}async function executeLeafStep(step,stepStatus,inherited,context){let executionContext={...context.installationContext,...inherited},result=await step.run(context.config,executionContext);context.data??={},setAtPath(context.data,stepStatus.path,result)}function isInProgressState(state){return state.status===`in-progress`}function isSucceededState(state){return state.status===`succeeded`}function isFailedState(state){return state.status===`failed`}function isCompletedState(state){return state.status===`succeeded`||state.status===`failed`}function hasCustomInstallationSteps(config){return Array.isArray(config?.installation?.customInstallationSteps)&&config.installation.customInstallationSteps.length>0}function createCustomScriptStep(scriptConfig){let{script,name,description}=scriptConfig;return defineLeafStep({name,meta:{label:name,description},run:async(config,context)=>{let{logger}=context,customScripts=context.customScripts||{};logger.info(`Executing custom installation script: ${name}`),logger.debug(`Script path: ${script}`);let scriptModule=customScripts[script];if(!scriptModule)throw Error(`Script ${script} not found in customScripts context. Make sure the script is defined in the configuration and the action was generated with custom scripts support.`);if(typeof scriptModule!=`object`||!(`default`in scriptModule))throw Error(`Script ${script} must export a default function. Use defineCustomInstallationStep helper.`);let runFunction=scriptModule.default;if(typeof runFunction!=`function`)throw Error(`Script ${script} default export must be a function, got ${typeof runFunction}`);let scriptResult=await runFunction(config,context);return logger.info(`Successfully executed script: ${name}`),{script,data:scriptResult}}})}function createCustomScriptSteps(config){return hasCustomInstallationSteps(config)?config.installation.customInstallationSteps.map(scriptConfig=>createCustomScriptStep(scriptConfig)):[]}function hasCustomInstallation(config){return hasCustomInstallationSteps(config)}const customInstallationStepBase=defineBranchStep({name:`Custom Installation Steps`,meta:{label:`Custom Installation Steps`,description:`Executes custom installation scripts defined in the application configuration`},when:hasCustomInstallation,children:[]});function createCustomInstallationStep(config){return{...customInstallationStepBase,children:createCustomScriptSteps(config)}}function defineCustomInstallationStep(handler){return handler}function inspect(obj,params={}){return util.inspect(obj,{depth:null,...params})}const COMMERCE_PROVIDER_TYPE=`dx_commerce_events`,EXTERNAL_PROVIDER_TYPE=`3rd_party_custom_events`,PROVIDER_TYPE_TO_LABEL={[COMMERCE_PROVIDER_TYPE]:`Commerce`,[EXTERNAL_PROVIDER_TYPE]:`External`};function generateInstanceId(metadata,provider){let slugLabel=provider.label.toLowerCase().replace(/\s+/g,`-`);return`${metadata.id}-${provider.key??slugLabel}`}function findExistingProvider(allProviders,instanceId){return allProviders.find(provider=>provider.instance_id===instanceId)??null}function findExistingProviderMetadata(allMetadata,eventName){return allMetadata.find(meta=>meta.event_code===eventName)??null}function findExistingRegistrations(allRegistrations,clientId,name){return allRegistrations.find(reg=>reg.client_id===clientId&®.name===name)}function getNamespacedEvent(metadata,name){return`${metadata.id}.${name}`}function getIoEventCode(name,providerType){return providerType===COMMERCE_PROVIDER_TYPE?`com.adobe.commerce.${name}`:name}function getRegistrationName(provider,runtimeAction){let providerLabel=PROVIDER_TYPE_TO_LABEL[provider.provider_metadata]??`Unknown`,[packageName,actionName]=runtimeAction.split(`/`).map(kebabToTitleCase);return`${providerLabel} Event Registration: ${actionName} (${packageName})`}function getRegistrationDescription(provider,events,runtimeAction){return[`This registration was automatically created by @adobe/aio-commerce-lib-app. `,`It belongs to the provider "${provider.label}" (instance ID: ${provider.instance_id}). `,`It routes ${events.length} event(s) to the runtime action "${runtimeAction}".`].join(`
|
|
2
|
-
`)}function groupEventsByRuntimeActions(events){let actionEventsMap=new Map;for(let event of events)for(let runtimeAction of event.runtimeActions){let existingEvents=actionEventsMap.get(runtimeAction)??[];actionEventsMap.set(runtimeAction,[...existingEvents,event])}return actionEventsMap}function kebabToTitleCase(str){return str.split(`-`).map(word=>word.charAt(0).toUpperCase()+word.slice(1)).join(` `)}function findExistingSubscription(allSubscriptions,eventName){return allSubscriptions.get(eventName)??null}function makeWorkspaceConfig(context){let{appData,params}=context,{consumerOrgId,orgName,projectId,projectName,projectTitle,workspaceId,workspaceName,workspaceTitle}=appData,authParams=resolveAuthParams(params);if(authParams.strategy!==`ims`)throw Error(`Failed to resolve IMS authentication parameters from the runtime action inputs.`);let{clientId,clientSecrets,technicalAccountEmail,technicalAccountId,imsOrgId,scopes}=authParams;return{project:{id:projectId,name:projectName,title:projectTitle,org:{id:consumerOrgId,name:orgName,ims_org_id:imsOrgId},workspace:{id:workspaceId,name:workspaceName,title:workspaceTitle,action_url:`https://${process.env.__OW_NAMESPACE}.adobeioruntime.net`,app_url:`https://${process.env.__OW_NAMESPACE}.adobeio-static.net`,details:{credentials:[{id:`000000`,name:`aio-${workspaceId}`,integration_type:`oauth_server_to_server`,oauth_server_to_server:{client_id:clientId,client_secrets:clientSecrets,technical_account_email:technicalAccountEmail,technical_account_id:technicalAccountId,scopes:scopes.map(scope=>scope.trim())}}]}}}}}async function getIoEventsExistingData(context){let{ioEventsClient,appData}=context,appCredentials={consumerOrgId:appData.consumerOrgId,projectId:appData.projectId,workspaceId:appData.workspaceId},{_embedded:{providers:existingProviders}}=await ioEventsClient.getAllEventProviders({consumerOrgId:appData.consumerOrgId,withEventMetadata:!0}),providersWithMetadata=existingProviders.map(providerHal=>{let{_embedded,_links,...providerData}=providerHal,actualMetadata=(_embedded?.eventmetadata??[]).map(({_embedded:_embedded$1,_links:_links$1,...meta})=>({...meta,sample:_embedded$1?.sample_event??null}));return{...providerData,metadata:actualMetadata}}),{_embedded:{registrations:registrationsHal}}=await ioEventsClient.getAllRegistrations(appCredentials);return{providersWithMetadata,registrations:registrationsHal.map(({_links,...reg})=>reg)}}async function getCommerceEventingExistingData(context){let{commerceEventsClient}=context,existingProviders=await commerceEventsClient.getAllEventProviders(),existingSubscriptions=await commerceEventsClient.getAllEventSubscriptions();return{isDefaultWorkspaceConfigurationEmpty:existingProviders.some(provider=>!(`id`in provider)&&!provider.workspace_configuration?.trim()),providers:existingProviders,subscriptions:new Map(existingSubscriptions.map(subscription=>[subscription.name,subscription]))}}async function createIoEventProvider(params){let{context,provider}=params,{appData,ioEventsClient,logger}=context,appCredentials={consumerOrgId:appData.consumerOrgId,projectId:appData.projectId,workspaceId:appData.workspaceId};return logger.info(`Creating provider "${provider.label}" with instance ID "${provider.instanceId}"`),ioEventsClient.createEventProvider({...appCredentials,label:provider.label,providerType:provider.type,instanceId:provider.instanceId,description:provider.description}).then(res=>(logger.info(`Provider "${provider.label}" created with ID '${res.id}'`),res)).catch(error=>{throw logger.error(`Failed to create provider "${provider.label}": ${stringifyError(error)}`),error})}async function createOrGetIoEventProvider(params,existingData){let{context,provider}=params,{logger}=context,{instanceId,...providerData}=provider,existing=findExistingProvider(existingData,instanceId);return existing?(logger.info(`Provider "${provider.label}" already exists with ID "${existing.id}", skipping creation.`),existing):createIoEventProvider({context,provider:{...providerData,instanceId}})}async function createIoEventProviderEventMetadata(params){let{context,event,provider,type,metadata}=params,{appData,ioEventsClient,logger}=context,appCredentials={consumerOrgId:appData.consumerOrgId,projectId:appData.projectId,workspaceId:appData.workspaceId},eventCode=getIoEventCode(getNamespacedEvent(metadata,event.name),type);return logger.info(`Creating event metadata (${eventCode}) for provider "${provider.label}" (instance ID: ${provider.instance_id}))`),ioEventsClient.createEventMetadataForProvider({...appCredentials,providerId:provider.id,label:event.label,description:event.description,eventCode}).then(res=>(logger.info(`Event metadata "${event.label}" created for provider "${provider.label}"`),res)).catch(error=>{throw logger.error(`Failed to create event metadata "${event.label}" for provider "${provider.label}": ${stringifyError(error)}`),error})}async function createOrGetIoProviderEventMetadata(params,existingData){let{context,event,provider,type,metadata}=params,{logger}=context,existing=findExistingProviderMetadata(existingData,getIoEventCode(getNamespacedEvent(metadata,event.name),type));return existing?(logger.info(`Event metadata "${event.label}" already exists for provider "${provider.label}" (instance ID: ${provider.instance_id}), skipping creation.`),existing):createIoEventProviderEventMetadata(params)}async function createIoEventRegistration(params){let{context,events,provider,runtimeAction,metadata}=params,{appData,ioEventsClient,logger,params:runtimeParams}=context,appCredentials={consumerOrgId:appData.consumerOrgId,projectId:appData.projectId,workspaceId:appData.workspaceId};logger.info(`Creating registration(s) to runtime action "${runtimeAction}" for ${events.length} event(s) with provider "${provider.label}" (instance ID: ${provider.instance_id}))`);let name=getRegistrationName(provider,runtimeAction),description=getRegistrationDescription(provider,events,runtimeAction);return ioEventsClient.createRegistration({...appCredentials,name,clientId:runtimeParams.AIO_COMMERCE_AUTH_IMS_CLIENT_ID,description,deliveryType:`webhook`,runtimeAction,enabled:!0,eventsOfInterest:events.map(event=>({providerId:provider.id,eventCode:getIoEventCode(getNamespacedEvent(metadata,event.name),provider.provider_metadata)}))}).then(res=>(logger.info(`Registration "${name}" created for provider "${provider.label}" with ID '${res.id}'`),res)).catch(error=>{throw logger.error(`Failed to create registration "${name}" for provider "${provider.label}": ${stringifyError(error)}`),error})}async function createOrGetIoEventRegistration(params,registrations){let{context,provider,runtimeAction}=params,{logger,params:runtimeParams}=context,name=getRegistrationName(provider,runtimeAction),existing=findExistingRegistrations(registrations,runtimeParams.AIO_COMMERCE_AUTH_IMS_CLIENT_ID,name);return existing?(logger.info(`Registration "${name}" already exists for provider "${provider.label}" with ID '${existing.id}', skipping creation.`),existing):createIoEventRegistration(params)}async function configureCommerceEventing(params,existingData){let{context,config}=params,{commerceEventsClient,logger}=context;logger.info(`Starting configuration of the Commerce Eventing Module`);let updateParams={...config,enabled:!0};if(existingData.isDefaultWorkspaceConfigurationEmpty){if(!config.workspaceConfiguration){let message=`Workspace configuration is required to enable Commerce Eventing when there is not an existing one.`;throw logger.error(message),Error(message)}logger.info(`Default provider workspace configuration already present, it will not be overriden`);let{workspaceConfiguration,...rest}=updateParams;updateParams=rest}return logger.info(`Updating Commerce Eventing configuration with provided workspace configuration.`),commerceEventsClient.updateEventingConfiguration(updateParams).then(success=>{if(success){logger.info(`Commerce Eventing Module configured successfully.`);return}throw Error(`Something went wrong while configuring Commerce Eventing Module. Response was not successful but no error was thrown.`)}).catch(err=>{throw logger.error(`Failed to configure Commerce Eventing Module: ${stringifyError(err)}`),err})}async function createCommerceProvider(params){let{context,provider}=params,{commerceEventsClient,logger}=context;return logger.info(`Creating Commerce provider "${provider.label}" with instance ID "${provider.instance_id}"`),commerceEventsClient.createEventProvider({providerId:provider.id,instanceId:provider.instance_id,label:provider.label,description:provider.description,associatedWorkspaceConfiguration:provider.workspaceConfiguration}).then(res=>(logger.info(`Commerce provider "${provider.label}" created with ID '${res.provider_id}'`),res)).catch(err=>{throw logger.error(`Failed to create Commerce provider "${provider.label}": ${stringifyError(err)}`),err})}async function createOrGetCommerceProvider(params,existingProviders){let{context,provider}=params,{logger}=context,existing=findExistingProvider(existingProviders,provider.instance_id);return existing?(logger.info(`Provider "${provider.label}" already exists with ID "${existing.id}", skipping creation.`),existing):createCommerceProvider(params)}async function createCommerceEventSubscription(params){let{context,metadata,provider,event}=params,{logger,commerceEventsClient}=context,eventName=getNamespacedEvent(metadata,event.config.name);logger.info(`Creating event subscription for event "${event.config.name}" to provider "${provider.label}" (instance ID: ${provider.instance_id})`);let eventSpec={name:eventName,parent:event.config.name,fields:event.config.fields,providerId:provider.id,destination:event.config.destination,hipaaAuditRequired:event.config.hipaaAuditRequired,prioritary:event.config.prioritary,force:event.config.force};return logger.debug(`Event subscription specification for event "${event.config.name}": ${inspect(eventSpec)}`),commerceEventsClient.createEventSubscription(eventSpec).then(_res=>(logger.info(`Created event subscription for event "${event.config.name}" to provider "${provider.label} (instance ID: ${provider.instance_id})"`),eventSpec)).catch(err=>{throw logger.error(`Failed to create event subscription for event "${event.config.name}" to provider "${provider.label}": ${stringifyError(err)}`),err})}async function createOrGetCommerceEventSubscription(params,existingData){let{context,metadata,event}=params,{logger}=context,existing=findExistingSubscription(existingData,getNamespacedEvent(metadata,event.config.name));return existing?(logger.info(`Subscription for event "${event.config.name}" already exists, skipping creation.`),{name:existing.name,parent:existing.parent,fields:existing.fields,providerId:existing.provider_id}):createCommerceEventSubscription(params)}async function onboardIoEvents(params,existingData){let{providersWithMetadata,registrations}=existingData,{context,metadata,provider,providerType,events}=params,instanceId=generateInstanceId(metadata,provider),providerData=await createOrGetIoEventProvider({context,provider:{...provider,instanceId,type:providerType}},providersWithMetadata),metadataPromises=events.map(event=>createOrGetIoProviderEventMetadata({metadata,context,type:providerType,provider:providerData,event},providersWithMetadata.find(p=>p.id===providerData.id)?.metadata??[])),actionEventsMap=groupEventsByRuntimeActions(events),registrationPromises=Array.from(actionEventsMap.entries()).map(([runtimeAction,groupedEvents])=>createOrGetIoEventRegistration({metadata,context,events:groupedEvents,provider:providerData,runtimeAction},registrations)),[metadataData,registrationsData]=await Promise.all([Promise.all(metadataPromises),Promise.all(registrationPromises)]);return{providerData,eventsData:events.map((event,index)=>{let eventRegistrations=event.runtimeActions.map(runtimeAction=>registrationsData[Array.from(actionEventsMap.keys()).indexOf(runtimeAction)]);return{config:{...event,providerType},data:{metadata:metadataData[index],registrations:eventRegistrations}}})}}async function onboardCommerceEventing(params,existingData){let{context,metadata,ioData}=params,{events,provider,workspaceConfiguration}=ioData,instanceId=provider.instance_id,subscriptions=[];await configureCommerceEventing({context,config:{workspaceConfiguration}},existingData);let{workspace_configuration:_,...commerceProviderData}=await createOrGetCommerceProvider({context,provider:{id:provider.id,instance_id:instanceId,label:provider.label,description:provider.description,workspaceConfiguration}},existingData.providers);for(let event of events)subscriptions.push(await createOrGetCommerceEventSubscription({context,metadata,provider,event},existingData.subscriptions));return{commerceProvider:commerceProviderData,subscriptions}}function hasCommerceEvents(config){return Array.isArray(config?.eventing?.commerce)&&config.eventing.commerce.length>0}const commerceEventsStep=defineLeafStep({name:`commerce`,meta:{label:`Configure Commerce Events`,description:`Sets up I/O Events for Adobe Commerce event sources`},when:hasCommerceEvents,run:async(config,context)=>{let{logger}=context;logger.debug(`Starting installation of Commerce Events with config:`,config);let stepData=[],workspaceConfiguration=JSON.stringify(makeWorkspaceConfig(context)),existingIoEventsData=await getIoEventsExistingData(context),commerceEventingExistingData=await getCommerceEventingExistingData(context);for(let{provider,events}of config.eventing.commerce){let{providerData,eventsData}=await onboardIoEvents({context,metadata:config.metadata,provider,events,providerType:COMMERCE_PROVIDER_TYPE},existingIoEventsData),{commerceProvider,subscriptions}=await onboardCommerceEventing({context,metadata:config.metadata,provider,ioData:{provider:providerData,events:eventsData,workspaceConfiguration}},commerceEventingExistingData);stepData.push({provider:{config:provider,data:{ioEvents:providerData,commerce:commerceProvider,events:eventsData.map(({config:config$1,data},index)=>({config:config$1,data:{...data,subscription:subscriptions[index]}}))}}})}return logger.debug(`Completed Commerce Events installation step.`),stepData}});function createCommerceEventsApiClient(params){let commerceClientParams=resolveCommerceHttpClientParams(params,{tryForwardAuthProvider:!0});return commerceClientParams.fetchOptions??={},commerceClientParams.fetchOptions.timeout=1e3*60*2,createCustomCommerceEventsApiClient(commerceClientParams,{createEventProvider,getAllEventProviders,createEventSubscription,getAllEventSubscriptions,updateEventingConfiguration})}function createIoEventsApiClient(params){let ioEventsClientParams=resolveIoEventsHttpClientParams(params);return ioEventsClientParams.fetchOptions??={},ioEventsClientParams.fetchOptions.timeout=1e3*60*2,createCustomAdobeIoEventsApiClient(ioEventsClientParams,{createEventProvider:createEventProvider$1,createEventMetadataForProvider,createRegistration,getAllEventProviders:getAllEventProviders$1,getAllRegistrations})}function createEventsStepContext(installation){let{params}=installation,commerceEventsClient=null,ioEventsClient=null;return{get commerceEventsClient(){return commerceEventsClient===null&&(commerceEventsClient=createCommerceEventsApiClient(params)),commerceEventsClient},get ioEventsClient(){return ioEventsClient===null&&(ioEventsClient=createIoEventsApiClient(params)),ioEventsClient}}}function hasExternalEvents(config){return Array.isArray(config?.eventing?.external)&&config.eventing.external.length>0}const externalEventsStep=defineLeafStep({name:`external`,meta:{label:`Configure External Events`,description:`Sets up I/O Events for external event sources`},when:hasExternalEvents,run:async(config,context)=>{let{logger}=context;logger.debug(`Starting installation of External Events with config:`,config);let stepData=[],existingIoEventsData=await getIoEventsExistingData(context);for(let{provider,events}of config.eventing.external){let{providerData,eventsData}=await onboardIoEvents({context,metadata:config.metadata,provider,events,providerType:EXTERNAL_PROVIDER_TYPE},existingIoEventsData);stepData.push({provider:{config:provider,data:{ioEvents:providerData,events:{config:events,data:eventsData}}}})}return logger.debug(`Completed External Events installation step.`),stepData}});function hasEventing(config){return config.eventing!==void 0&&(hasCommerceEvents(config)||hasExternalEvents(config))}const eventingStep=defineBranchStep({name:`eventing`,meta:{label:`Eventing`,description:`Sets up the I/O Events and the Commerce events required by the application`},when:hasEventing,context:createEventsStepContext,children:[commerceEventsStep,externalEventsStep]});function createWebhookSubscriptions(context){let{logger}=context;return logger.info(`Creating webhooks in Commerce`),{subscriptionsCreated:!0}}function hasWebhooks(config){return`webhooks`in config&&Array.isArray(config.webhooks)&&config.webhooks.length,!1}const webhooksStep=defineBranchStep({name:`webhooks`,meta:{label:`Webhooks`,description:`Sets up Commerce webhooks`},when:hasWebhooks,children:[defineLeafStep({name:`subscriptions`,meta:{label:`Create Subscriptions`,description:`Creates webhook subscriptions in Adobe Commerce`},run:(config,context)=>{let{logger}=context;return logger.debug(config),createWebhookSubscriptions(context)}})]});function createDefaultChildSteps(config){return[eventingStep,webhooksStep,createCustomInstallationStep(config)]}function createRootInstallationStep(config){return defineBranchStep({name:`installation`,meta:{label:`Installation`,description:`App installation workflow`},children:createDefaultChildSteps(config)})}function createInitialInstallationState(options){let{config}=options;return createInitialState({rootStep:createRootInstallationStep(config),config})}function runInstallation(options){let{installationContext,config,initialState,hooks}=options;return executeWorkflow({rootStep:createRootInstallationStep(config),installationContext,config,initialState,hooks})}export{isFailedState as a,isCompletedState as i,runInstallation as n,isInProgressState as o,defineCustomInstallationStep as r,isSucceededState as s,createInitialInstallationState as t};
|