@adobe/aio-commerce-lib-auth 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.
@@ -1,88 +1,65 @@
1
- import { ErrorType, Result } from "@adobe/aio-commerce-lib-core/result";
2
- import { ValidationErrorType } from "@adobe/aio-commerce-lib-core/validation";
3
- import * as valibot25 from "valibot";
4
- import { InferInput, InferIssue, InferOutput } from "valibot";
5
- import * as url5 from "url";
1
+ import * as valibot24 from "valibot";
2
+ import { InferOutput } from "valibot";
6
3
 
7
4
  //#region source/lib/ims-auth/schema.d.ts
8
5
  declare const IMS_AUTH_ENV: {
9
6
  readonly PROD: "prod";
10
7
  readonly STAGE: "stage";
11
8
  };
12
- declare const ImsAuthEnvSchema: valibot25.EnumSchema<{
9
+ declare const ImsAuthEnvSchema: valibot24.EnumSchema<{
13
10
  readonly PROD: "prod";
14
11
  readonly STAGE: "stage";
15
12
  }, undefined>;
16
- declare const ImsAuthParamsSchema: valibot25.ObjectSchema<{
17
- readonly AIO_COMMERCE_IMS_CLIENT_ID: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
18
- readonly AIO_COMMERCE_IMS_CLIENT_SECRETS: valibot25.SchemaWithPipe<readonly [valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>, valibot25.ParseJsonAction<string, undefined, undefined>]>, valibot25.ArraySchema<valibot25.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>;
19
- readonly AIO_COMMERCE_IMS_TECHNICAL_ACCOUNT_ID: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
20
- readonly AIO_COMMERCE_IMS_TECHNICAL_ACCOUNT_EMAIL: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
21
- readonly AIO_COMMERCE_IMS_IMS_ORG_ID: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
22
- readonly AIO_COMMERCE_IMS_ENV: valibot25.SchemaWithPipe<readonly [valibot25.OptionalSchema<valibot25.EnumSchema<{
13
+ declare const ImsAuthParamsSchema: valibot24.ObjectSchema<{
14
+ readonly clientId: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
15
+ readonly clientSecrets: valibot24.SchemaWithPipe<readonly [valibot24.SchemaWithPipe<readonly [valibot24.ArraySchema<valibot24.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>, valibot24.MinLengthAction<string[], 1, "Expected at least one client secret for IMS auth">]>;
16
+ readonly technicalAccountId: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
17
+ readonly technicalAccountEmail: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<"Expected a string value for the IMS auth parameter technicalAccountEmail">, valibot24.EmailAction<string, "Expected a valid email format for technicalAccountEmail">]>;
18
+ readonly imsOrgId: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
19
+ readonly environment: valibot24.SchemaWithPipe<readonly [valibot24.OptionalSchema<valibot24.EnumSchema<{
23
20
  readonly PROD: "prod";
24
21
  readonly STAGE: "stage";
25
22
  }, undefined>, "prod">]>;
26
- readonly AIO_COMMERCE_IMS_CTX: valibot25.SchemaWithPipe<readonly [valibot25.OptionalSchema<valibot25.StringSchema<undefined>, "aio-commerce-sdk-creds">]>;
27
- readonly AIO_COMMERCE_IMS_SCOPES: valibot25.SchemaWithPipe<readonly [valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>, valibot25.ParseJsonAction<string, undefined, undefined>]>, valibot25.ArraySchema<valibot25.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>;
23
+ readonly context: valibot24.SchemaWithPipe<readonly [valibot24.OptionalSchema<valibot24.StringSchema<undefined>, "aio-commerce-sdk-creds">]>;
24
+ readonly scopes: valibot24.SchemaWithPipe<readonly [valibot24.SchemaWithPipe<readonly [valibot24.ArraySchema<valibot24.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>, valibot24.MinLengthAction<string[], 1, "Expected at least one scope for IMS auth">]>;
28
25
  }, undefined>;
29
26
  type ImsAuthParams = InferOutput<typeof ImsAuthParamsSchema>;
30
27
  type ImsAuthEnv = InferOutput<typeof ImsAuthEnvSchema>;
31
28
  //#endregion
32
29
  //#region source/lib/ims-auth/provider.d.ts
33
- type ImsAccessToken = string;
34
30
  type ImsAuthHeader = "Authorization" | "x-api-key";
35
31
  type ImsAuthHeaders = Record<ImsAuthHeader, string>;
36
- type ImsAuthValidationError = ValidationErrorType<"ImsAuthValidationError", InferIssue<typeof ImsAuthParamsSchema>[]>;
37
- type ImsAuthError<TError = unknown> = ErrorType<"ImsAuthError", {
38
- message: string;
39
- error: TError;
40
- }>;
41
- interface ImsAuthConfig {
42
- clientId: string;
43
- clientSecrets: string[];
44
- technicalAccountId: string;
45
- technicalAccountEmail: string;
46
- imsOrgId: string;
47
- scopes: string[];
48
- environment: ImsAuthEnv;
49
- context: string;
50
- }
51
32
  interface ImsAuthProvider {
52
- getAccessToken: () => Promise<Result<ImsAccessToken, ImsAuthError>>;
53
- getHeaders: () => Promise<Result<ImsAuthHeaders, ImsAuthError>>;
33
+ getAccessToken: () => Promise<string>;
34
+ getHeaders: () => Promise<ImsAuthHeaders>;
54
35
  }
55
- declare function getImsAuthProvider(config: ImsAuthConfig): ImsAuthProvider;
56
- declare function tryGetImsAuthProvider(params: InferInput<typeof ImsAuthParamsSchema>): Result<ImsAuthProvider, ImsAuthValidationError>;
36
+ declare function assertImsAuthParams(config: Record<PropertyKey, unknown>): asserts config is ImsAuthParams;
37
+ declare function getImsAuthProvider(authParams: ImsAuthParams): {
38
+ getAccessToken: () => Promise<string>;
39
+ getHeaders: () => Promise<{
40
+ Authorization: string;
41
+ "x-api-key": string;
42
+ }>;
43
+ };
57
44
  //#endregion
58
45
  //#region source/lib/integration-auth/schema.d.ts
59
- declare const HttpMethodSchema: valibot25.PicklistSchema<readonly ["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
60
- type HttpMethodInput = InferInput<typeof HttpMethodSchema>;
61
- declare const UrlSchema: valibot25.SchemaWithPipe<readonly [valibot25.UnionSchema<[valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<"Expected a string for the Adobe Commerce endpoint">, valibot25.NonEmptyAction<string, "Expected a non-empty string for the Adobe Commerce endpoint">, valibot25.UrlAction<string, "Expected a valid url for the Adobe Commerce endpoint">]>, valibot25.InstanceSchema<typeof url5.URL, undefined>], undefined>, valibot25.TransformAction<string | url5.URL, string>]>;
62
- type AdobeCommerceUri = InferInput<typeof UrlSchema>;
63
- declare const IntegrationAuthParamsSchema: valibot25.NonOptionalSchema<valibot25.ObjectSchema<{
64
- readonly AIO_COMMERCE_INTEGRATIONS_CONSUMER_KEY: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
65
- readonly AIO_COMMERCE_INTEGRATIONS_CONSUMER_SECRET: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
66
- readonly AIO_COMMERCE_INTEGRATIONS_ACCESS_TOKEN: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
67
- readonly AIO_COMMERCE_INTEGRATIONS_ACCESS_TOKEN_SECRET: valibot25.SchemaWithPipe<readonly [valibot25.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot25.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
46
+ type HttpMethodInput = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
47
+ declare const IntegrationAuthParamsSchema: valibot24.NonOptionalSchema<valibot24.ObjectSchema<{
48
+ readonly consumerKey: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
49
+ readonly consumerSecret: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
50
+ readonly accessToken: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
51
+ readonly accessTokenSecret: valibot24.SchemaWithPipe<readonly [valibot24.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot24.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
68
52
  }, undefined>, undefined>;
69
- type IntegrationAuthParams = InferInput<typeof IntegrationAuthParamsSchema>;
53
+ type IntegrationAuthParams = InferOutput<typeof IntegrationAuthParamsSchema>;
70
54
  //#endregion
71
55
  //#region source/lib/integration-auth/provider.d.ts
72
56
  type IntegrationAuthHeader = "Authorization";
73
57
  type IntegrationAuthHeaders = Record<IntegrationAuthHeader, string>;
74
- interface IntegrationConfig {
75
- consumerKey: string;
76
- consumerSecret: string;
77
- accessToken: string;
78
- accessTokenSecret: string;
79
- }
80
- type ValidationIssues = InferIssue<typeof IntegrationAuthParamsSchema>[] | InferIssue<typeof UrlSchema>[];
81
- type IntegrationAuthError = ValidationErrorType<"IntegrationAuthValidationError", ValidationIssues>;
58
+ type AdobeCommerceUrl = string | URL;
82
59
  interface IntegrationAuthProvider {
83
- getHeaders: (method: HttpMethodInput, url: AdobeCommerceUri) => Result<IntegrationAuthHeaders, IntegrationAuthError>;
60
+ getHeaders: (method: HttpMethodInput, url: AdobeCommerceUrl) => IntegrationAuthHeaders;
84
61
  }
85
- declare function getIntegrationAuthProvider(config: IntegrationConfig): IntegrationAuthProvider;
86
- declare function tryGetIntegrationAuthProvider(params: IntegrationAuthParams): Result<IntegrationAuthProvider, IntegrationAuthError>;
62
+ declare function assertIntegrationAuthParams(config: Record<PropertyKey, unknown>): asserts config is IntegrationAuthParams;
63
+ declare function getIntegrationAuthProvider(authParams: IntegrationAuthParams): IntegrationAuthProvider;
87
64
  //#endregion
88
- export { IMS_AUTH_ENV, ImsAuthConfig, ImsAuthEnv, ImsAuthError, ImsAuthParams, ImsAuthProvider, IntegrationAuthError, IntegrationAuthParams, IntegrationAuthProvider, IntegrationConfig, getImsAuthProvider, getIntegrationAuthProvider, tryGetImsAuthProvider, tryGetIntegrationAuthProvider };
65
+ export { IMS_AUTH_ENV, ImsAuthEnv, ImsAuthParams, ImsAuthProvider, IntegrationAuthParams, IntegrationAuthProvider, assertImsAuthParams, assertIntegrationAuthParams, getImsAuthProvider, getIntegrationAuthProvider };
@@ -1,8 +1,5 @@
1
- import { ErrorType, Result } from "@adobe/aio-commerce-lib-core/result";
2
1
  import * as valibot0 from "valibot";
3
- import { InferInput, InferIssue, InferOutput } from "valibot";
4
- import { ValidationErrorType } from "@adobe/aio-commerce-lib-core/validation";
5
- import * as url39 from "url";
2
+ import { InferOutput } from "valibot";
6
3
 
7
4
  //#region source/lib/ims-auth/schema.d.ts
8
5
  declare const IMS_AUTH_ENV: {
@@ -14,75 +11,55 @@ declare const ImsAuthEnvSchema: valibot0.EnumSchema<{
14
11
  readonly STAGE: "stage";
15
12
  }, undefined>;
16
13
  declare const ImsAuthParamsSchema: valibot0.ObjectSchema<{
17
- readonly AIO_COMMERCE_IMS_CLIENT_ID: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
18
- readonly AIO_COMMERCE_IMS_CLIENT_SECRETS: valibot0.SchemaWithPipe<readonly [valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>, valibot0.ParseJsonAction<string, undefined, undefined>]>, valibot0.ArraySchema<valibot0.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>;
19
- readonly AIO_COMMERCE_IMS_TECHNICAL_ACCOUNT_ID: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
20
- readonly AIO_COMMERCE_IMS_TECHNICAL_ACCOUNT_EMAIL: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
21
- readonly AIO_COMMERCE_IMS_IMS_ORG_ID: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
22
- readonly AIO_COMMERCE_IMS_ENV: valibot0.SchemaWithPipe<readonly [valibot0.OptionalSchema<valibot0.EnumSchema<{
14
+ readonly clientId: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
15
+ readonly clientSecrets: valibot0.SchemaWithPipe<readonly [valibot0.SchemaWithPipe<readonly [valibot0.ArraySchema<valibot0.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>, valibot0.MinLengthAction<string[], 1, "Expected at least one client secret for IMS auth">]>;
16
+ readonly technicalAccountId: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
17
+ readonly technicalAccountEmail: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<"Expected a string value for the IMS auth parameter technicalAccountEmail">, valibot0.EmailAction<string, "Expected a valid email format for technicalAccountEmail">]>;
18
+ readonly imsOrgId: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>]>;
19
+ readonly environment: valibot0.SchemaWithPipe<readonly [valibot0.OptionalSchema<valibot0.EnumSchema<{
23
20
  readonly PROD: "prod";
24
21
  readonly STAGE: "stage";
25
22
  }, undefined>, "prod">]>;
26
- readonly AIO_COMMERCE_IMS_CTX: valibot0.SchemaWithPipe<readonly [valibot0.OptionalSchema<valibot0.StringSchema<undefined>, "aio-commerce-sdk-creds">]>;
27
- readonly AIO_COMMERCE_IMS_SCOPES: valibot0.SchemaWithPipe<readonly [valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the IMS auth parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the IMS auth parameter ${string}`>, valibot0.ParseJsonAction<string, undefined, undefined>]>, valibot0.ArraySchema<valibot0.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>;
23
+ readonly context: valibot0.SchemaWithPipe<readonly [valibot0.OptionalSchema<valibot0.StringSchema<undefined>, "aio-commerce-sdk-creds">]>;
24
+ readonly scopes: valibot0.SchemaWithPipe<readonly [valibot0.SchemaWithPipe<readonly [valibot0.ArraySchema<valibot0.StringSchema<undefined>, `Expected a stringified JSON array value for the IMS auth parameter ${string}`>]>, valibot0.MinLengthAction<string[], 1, "Expected at least one scope for IMS auth">]>;
28
25
  }, undefined>;
29
26
  type ImsAuthParams = InferOutput<typeof ImsAuthParamsSchema>;
30
27
  type ImsAuthEnv = InferOutput<typeof ImsAuthEnvSchema>;
31
28
  //#endregion
32
29
  //#region source/lib/ims-auth/provider.d.ts
33
- type ImsAccessToken = string;
34
30
  type ImsAuthHeader = "Authorization" | "x-api-key";
35
31
  type ImsAuthHeaders = Record<ImsAuthHeader, string>;
36
- type ImsAuthValidationError = ValidationErrorType<"ImsAuthValidationError", InferIssue<typeof ImsAuthParamsSchema>[]>;
37
- type ImsAuthError<TError = unknown> = ErrorType<"ImsAuthError", {
38
- message: string;
39
- error: TError;
40
- }>;
41
- interface ImsAuthConfig {
42
- clientId: string;
43
- clientSecrets: string[];
44
- technicalAccountId: string;
45
- technicalAccountEmail: string;
46
- imsOrgId: string;
47
- scopes: string[];
48
- environment: ImsAuthEnv;
49
- context: string;
50
- }
51
32
  interface ImsAuthProvider {
52
- getAccessToken: () => Promise<Result<ImsAccessToken, ImsAuthError>>;
53
- getHeaders: () => Promise<Result<ImsAuthHeaders, ImsAuthError>>;
33
+ getAccessToken: () => Promise<string>;
34
+ getHeaders: () => Promise<ImsAuthHeaders>;
54
35
  }
55
- declare function getImsAuthProvider(config: ImsAuthConfig): ImsAuthProvider;
56
- declare function tryGetImsAuthProvider(params: InferInput<typeof ImsAuthParamsSchema>): Result<ImsAuthProvider, ImsAuthValidationError>;
36
+ declare function assertImsAuthParams(config: Record<PropertyKey, unknown>): asserts config is ImsAuthParams;
37
+ declare function getImsAuthProvider(authParams: ImsAuthParams): {
38
+ getAccessToken: () => Promise<string>;
39
+ getHeaders: () => Promise<{
40
+ Authorization: string;
41
+ "x-api-key": string;
42
+ }>;
43
+ };
57
44
  //#endregion
58
45
  //#region source/lib/integration-auth/schema.d.ts
59
- declare const HttpMethodSchema: valibot0.PicklistSchema<readonly ["GET", "POST", "PUT", "PATCH", "DELETE"], undefined>;
60
- type HttpMethodInput = InferInput<typeof HttpMethodSchema>;
61
- declare const UrlSchema: valibot0.SchemaWithPipe<readonly [valibot0.UnionSchema<[valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<"Expected a string for the Adobe Commerce endpoint">, valibot0.NonEmptyAction<string, "Expected a non-empty string for the Adobe Commerce endpoint">, valibot0.UrlAction<string, "Expected a valid url for the Adobe Commerce endpoint">]>, valibot0.InstanceSchema<typeof url39.URL, undefined>], undefined>, valibot0.TransformAction<string | url39.URL, string>]>;
62
- type AdobeCommerceUri = InferInput<typeof UrlSchema>;
46
+ type HttpMethodInput = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
63
47
  declare const IntegrationAuthParamsSchema: valibot0.NonOptionalSchema<valibot0.ObjectSchema<{
64
- readonly AIO_COMMERCE_INTEGRATIONS_CONSUMER_KEY: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
65
- readonly AIO_COMMERCE_INTEGRATIONS_CONSUMER_SECRET: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
66
- readonly AIO_COMMERCE_INTEGRATIONS_ACCESS_TOKEN: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
67
- readonly AIO_COMMERCE_INTEGRATIONS_ACCESS_TOKEN_SECRET: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
48
+ readonly consumerKey: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
49
+ readonly consumerSecret: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
50
+ readonly accessToken: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
51
+ readonly accessTokenSecret: valibot0.SchemaWithPipe<readonly [valibot0.StringSchema<`Expected a string value for the Commerce Integration parameter ${string}`>, valibot0.NonEmptyAction<string, `Expected a non-empty string value for the Commerce Integration parameter ${string}`>]>;
68
52
  }, undefined>, undefined>;
69
- type IntegrationAuthParams = InferInput<typeof IntegrationAuthParamsSchema>;
53
+ type IntegrationAuthParams = InferOutput<typeof IntegrationAuthParamsSchema>;
70
54
  //#endregion
71
55
  //#region source/lib/integration-auth/provider.d.ts
72
56
  type IntegrationAuthHeader = "Authorization";
73
57
  type IntegrationAuthHeaders = Record<IntegrationAuthHeader, string>;
74
- interface IntegrationConfig {
75
- consumerKey: string;
76
- consumerSecret: string;
77
- accessToken: string;
78
- accessTokenSecret: string;
79
- }
80
- type ValidationIssues = InferIssue<typeof IntegrationAuthParamsSchema>[] | InferIssue<typeof UrlSchema>[];
81
- type IntegrationAuthError = ValidationErrorType<"IntegrationAuthValidationError", ValidationIssues>;
58
+ type AdobeCommerceUrl = string | URL;
82
59
  interface IntegrationAuthProvider {
83
- getHeaders: (method: HttpMethodInput, url: AdobeCommerceUri) => Result<IntegrationAuthHeaders, IntegrationAuthError>;
60
+ getHeaders: (method: HttpMethodInput, url: AdobeCommerceUrl) => IntegrationAuthHeaders;
84
61
  }
85
- declare function getIntegrationAuthProvider(config: IntegrationConfig): IntegrationAuthProvider;
86
- declare function tryGetIntegrationAuthProvider(params: IntegrationAuthParams): Result<IntegrationAuthProvider, IntegrationAuthError>;
62
+ declare function assertIntegrationAuthParams(config: Record<PropertyKey, unknown>): asserts config is IntegrationAuthParams;
63
+ declare function getIntegrationAuthProvider(authParams: IntegrationAuthParams): IntegrationAuthProvider;
87
64
  //#endregion
88
- export { IMS_AUTH_ENV, ImsAuthConfig, ImsAuthEnv, ImsAuthError, ImsAuthParams, ImsAuthProvider, IntegrationAuthError, IntegrationAuthParams, IntegrationAuthProvider, IntegrationConfig, getImsAuthProvider, getIntegrationAuthProvider, tryGetImsAuthProvider, tryGetIntegrationAuthProvider };
65
+ export { IMS_AUTH_ENV, ImsAuthEnv, ImsAuthParams, ImsAuthProvider, IntegrationAuthParams, IntegrationAuthProvider, assertImsAuthParams, assertIntegrationAuthParams, getImsAuthProvider, getIntegrationAuthProvider };