@fonderie/client 1.2.0 → 1.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/brain/signatures.md +22 -0
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1590,4 +1590,32 @@ declare class CourierAdminClient {
|
|
|
1590
1590
|
previewTemplate(type: string, input: IPreviewTemplateInput, locale?: string | null): Promise<IApiResponse<IRenderedTemplateResult>>;
|
|
1591
1591
|
}
|
|
1592
1592
|
|
|
1593
|
-
|
|
1593
|
+
type ConfigValueType = 'string' | 'number' | 'boolean' | 'json';
|
|
1594
|
+
declare const CONFIG_VALUE_TYPES: readonly ConfigValueType[];
|
|
1595
|
+
/** The editor type for a stored value. Objects, arrays and null are JSON. */
|
|
1596
|
+
declare function configValueType(value: unknown): ConfigValueType;
|
|
1597
|
+
/** What an input should show for a stored value of that type. */
|
|
1598
|
+
declare function formatConfigValue(value: unknown, type?: ConfigValueType): string;
|
|
1599
|
+
type CastResult = {
|
|
1600
|
+
ok: true;
|
|
1601
|
+
value: unknown;
|
|
1602
|
+
} | {
|
|
1603
|
+
ok: false;
|
|
1604
|
+
error: string;
|
|
1605
|
+
};
|
|
1606
|
+
/**
|
|
1607
|
+
* Turn what an operator typed into the typed value to store.
|
|
1608
|
+
* - string: kept verbatim (an empty string is a valid value)
|
|
1609
|
+
* - number: finite numbers only — "1e3" and "-2.5" are fine, "12px" is not
|
|
1610
|
+
* - boolean: true/false, also 1/0, yes/no, on/off (case-insensitive)
|
|
1611
|
+
* - json: any valid JSON
|
|
1612
|
+
*/
|
|
1613
|
+
declare function castConfigValue(type: ConfigValueType, raw: string): CastResult;
|
|
1614
|
+
/**
|
|
1615
|
+
* Config keys: letters, digits, `.`, `_`, `-`; must start with a letter; up to
|
|
1616
|
+
* 128 characters. Both styles work — `ENABLE_JOB_LISTING` and `feature.dark-mode`.
|
|
1617
|
+
*/
|
|
1618
|
+
declare const CONFIG_KEY_PATTERN: RegExp;
|
|
1619
|
+
declare function configKeyProblem(key: string): string | null;
|
|
1620
|
+
|
|
1621
|
+
export { AdminClient, type AdminRouteGuard, type AdminScope, AuditAdminClient, AuditClient, AuthAdminClient, AuthClient, BillingAdminClient, BillingClient, CONFIG_KEY_PATTERN, CONFIG_VALUE_TYPES, type CastResult, ConfigAdminClient, type ConfigValueType, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IAdminAttention, type IAdminAttentionItem, type IAdminAuditQuery, type IAdminCatalog, type IAdminCheckResult, type IAdminClientOptions, type IAdminDoctorReport, type IAdminEnvironmentReport, type IAdminGrantInput, type IAdminIssueTokenInput, type IAdminIssuedToken, type IAdminLedgerQuery, type IAdminLogEntry, type IAdminLogPage, type IAdminLogQuery, type IAdminLoginHistoryQuery, type IAdminManifest, type IAdminMigrationModule, type IAdminMigrationsReport, type IAdminModuleEntry, type IAdminPendingMigration, type IAdminPlanInput, type IAdminReadiness, type IAdminReadinessProblem, type IAdminRouteEntry, type IAdminRoutesReport, type IAdminSubscriptionDTO, type IAdminSubscriptionPage, type IAdminSubscriptionsQuery, type IAdminTokenRecord, type IAdminTokensReport, type IAdminUserDTO, type IAdminUserPageResult, type IAdminUsersQuery, type IAdminWalletDTO, type IAdminWalletLedgerPage, type IApiError, type IApiResponse, type IAppleNativeInput, type IAuditAdminClientOptions, type IAuditEventDTO, type IAuditPageResult, type IAuthAdminClientOptions, type IBillingAdminClientOptions, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IPreviewTemplateInput, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRenderedTemplateResult, type IRequestConfig, type IRequestLocationDTO, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type MigrationImpact, type SubscriberType, WebhooksClient, WorkspacesClient, castConfigValue, configKeyProblem, configValueType, createMemoryCache, describeLocation, formatConfigValue, isMfaRequired };
|
package/dist/index.d.ts
CHANGED
|
@@ -1590,4 +1590,32 @@ declare class CourierAdminClient {
|
|
|
1590
1590
|
previewTemplate(type: string, input: IPreviewTemplateInput, locale?: string | null): Promise<IApiResponse<IRenderedTemplateResult>>;
|
|
1591
1591
|
}
|
|
1592
1592
|
|
|
1593
|
-
|
|
1593
|
+
type ConfigValueType = 'string' | 'number' | 'boolean' | 'json';
|
|
1594
|
+
declare const CONFIG_VALUE_TYPES: readonly ConfigValueType[];
|
|
1595
|
+
/** The editor type for a stored value. Objects, arrays and null are JSON. */
|
|
1596
|
+
declare function configValueType(value: unknown): ConfigValueType;
|
|
1597
|
+
/** What an input should show for a stored value of that type. */
|
|
1598
|
+
declare function formatConfigValue(value: unknown, type?: ConfigValueType): string;
|
|
1599
|
+
type CastResult = {
|
|
1600
|
+
ok: true;
|
|
1601
|
+
value: unknown;
|
|
1602
|
+
} | {
|
|
1603
|
+
ok: false;
|
|
1604
|
+
error: string;
|
|
1605
|
+
};
|
|
1606
|
+
/**
|
|
1607
|
+
* Turn what an operator typed into the typed value to store.
|
|
1608
|
+
* - string: kept verbatim (an empty string is a valid value)
|
|
1609
|
+
* - number: finite numbers only — "1e3" and "-2.5" are fine, "12px" is not
|
|
1610
|
+
* - boolean: true/false, also 1/0, yes/no, on/off (case-insensitive)
|
|
1611
|
+
* - json: any valid JSON
|
|
1612
|
+
*/
|
|
1613
|
+
declare function castConfigValue(type: ConfigValueType, raw: string): CastResult;
|
|
1614
|
+
/**
|
|
1615
|
+
* Config keys: letters, digits, `.`, `_`, `-`; must start with a letter; up to
|
|
1616
|
+
* 128 characters. Both styles work — `ENABLE_JOB_LISTING` and `feature.dark-mode`.
|
|
1617
|
+
*/
|
|
1618
|
+
declare const CONFIG_KEY_PATTERN: RegExp;
|
|
1619
|
+
declare function configKeyProblem(key: string): string | null;
|
|
1620
|
+
|
|
1621
|
+
export { AdminClient, type AdminRouteGuard, type AdminScope, AuditAdminClient, AuditClient, AuthAdminClient, AuthClient, BillingAdminClient, BillingClient, CONFIG_KEY_PATTERN, CONFIG_VALUE_TYPES, type CastResult, ConfigAdminClient, type ConfigValueType, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IAdminAttention, type IAdminAttentionItem, type IAdminAuditQuery, type IAdminCatalog, type IAdminCheckResult, type IAdminClientOptions, type IAdminDoctorReport, type IAdminEnvironmentReport, type IAdminGrantInput, type IAdminIssueTokenInput, type IAdminIssuedToken, type IAdminLedgerQuery, type IAdminLogEntry, type IAdminLogPage, type IAdminLogQuery, type IAdminLoginHistoryQuery, type IAdminManifest, type IAdminMigrationModule, type IAdminMigrationsReport, type IAdminModuleEntry, type IAdminPendingMigration, type IAdminPlanInput, type IAdminReadiness, type IAdminReadinessProblem, type IAdminRouteEntry, type IAdminRoutesReport, type IAdminSubscriptionDTO, type IAdminSubscriptionPage, type IAdminSubscriptionsQuery, type IAdminTokenRecord, type IAdminTokensReport, type IAdminUserDTO, type IAdminUserPageResult, type IAdminUsersQuery, type IAdminWalletDTO, type IAdminWalletLedgerPage, type IApiError, type IApiResponse, type IAppleNativeInput, type IAuditAdminClientOptions, type IAuditEventDTO, type IAuditPageResult, type IAuthAdminClientOptions, type IBillingAdminClientOptions, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IGetLoginHistoryInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginEventDTO, type ILoginHistoryPageResult, type ILoginInput, type ILoginResult, type IMeResult, type IMediaAssetDTO, type IMediaAssetResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IPreviewTemplateInput, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRenderedTemplateResult, type IRequestConfig, type IRequestLocationDTO, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISessionDTO, type ISessionsResult, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUploadMediaInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, MediaClient, type MigrationImpact, type SubscriberType, WebhooksClient, WorkspacesClient, castConfigValue, configKeyProblem, configValueType, createMemoryCache, describeLocation, formatConfigValue, isMfaRequired };
|
package/dist/index.js
CHANGED
|
@@ -2081,6 +2081,46 @@ function describeLocation(loc, countryName) {
|
|
|
2081
2081
|
);
|
|
2082
2082
|
return parts.length > 0 ? parts.join(", ") : null;
|
|
2083
2083
|
}
|
|
2084
|
+
|
|
2085
|
+
// src/config-value.ts
|
|
2086
|
+
var CONFIG_VALUE_TYPES = ["string", "number", "boolean", "json"];
|
|
2087
|
+
function configValueType(value) {
|
|
2088
|
+
if (typeof value === "string") return "string";
|
|
2089
|
+
if (typeof value === "number") return "number";
|
|
2090
|
+
if (typeof value === "boolean") return "boolean";
|
|
2091
|
+
return "json";
|
|
2092
|
+
}
|
|
2093
|
+
function formatConfigValue(value, type = configValueType(value)) {
|
|
2094
|
+
if (type === "string") return typeof value === "string" ? value : String(value ?? "");
|
|
2095
|
+
if (type === "number") return typeof value === "number" ? String(value) : "";
|
|
2096
|
+
if (type === "boolean") return value === true ? "true" : "false";
|
|
2097
|
+
return JSON.stringify(value ?? null, null, 2);
|
|
2098
|
+
}
|
|
2099
|
+
function castConfigValue(type, raw) {
|
|
2100
|
+
if (type === "string") return { ok: true, value: raw };
|
|
2101
|
+
const t = raw.trim();
|
|
2102
|
+
if (type === "number") {
|
|
2103
|
+
if (t === "") return { ok: false, error: "Enter a number." };
|
|
2104
|
+
const n = Number(t);
|
|
2105
|
+
return Number.isFinite(n) ? { ok: true, value: n } : { ok: false, error: `"${raw}" is not a number.` };
|
|
2106
|
+
}
|
|
2107
|
+
if (type === "boolean") {
|
|
2108
|
+
const v = t.toLowerCase();
|
|
2109
|
+
if (["true", "1", "yes", "on"].includes(v)) return { ok: true, value: true };
|
|
2110
|
+
if (["false", "0", "no", "off"].includes(v)) return { ok: true, value: false };
|
|
2111
|
+
return { ok: false, error: "Use true or false." };
|
|
2112
|
+
}
|
|
2113
|
+
try {
|
|
2114
|
+
return { ok: true, value: JSON.parse(t) };
|
|
2115
|
+
} catch (err) {
|
|
2116
|
+
return { ok: false, error: `Not valid JSON: ${err.message}` };
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
var CONFIG_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9._-]{0,127}$/;
|
|
2120
|
+
function configKeyProblem(key) {
|
|
2121
|
+
if (!key) return "Enter a key.";
|
|
2122
|
+
return CONFIG_KEY_PATTERN.test(key) ? null : 'Start with a letter; use letters, digits, ".", "_" or "-" (max 128).';
|
|
2123
|
+
}
|
|
2084
2124
|
export {
|
|
2085
2125
|
AdminClient,
|
|
2086
2126
|
AuditAdminClient,
|
|
@@ -2089,6 +2129,8 @@ export {
|
|
|
2089
2129
|
AuthClient,
|
|
2090
2130
|
BillingAdminClient,
|
|
2091
2131
|
BillingClient,
|
|
2132
|
+
CONFIG_KEY_PATTERN,
|
|
2133
|
+
CONFIG_VALUE_TYPES,
|
|
2092
2134
|
ConfigAdminClient,
|
|
2093
2135
|
CourierAdminClient,
|
|
2094
2136
|
CustomersClient,
|
|
@@ -2097,8 +2139,12 @@ export {
|
|
|
2097
2139
|
MediaClient,
|
|
2098
2140
|
WebhooksClient,
|
|
2099
2141
|
WorkspacesClient,
|
|
2142
|
+
castConfigValue,
|
|
2143
|
+
configKeyProblem,
|
|
2144
|
+
configValueType,
|
|
2100
2145
|
createMemoryCache,
|
|
2101
2146
|
describeLocation,
|
|
2147
|
+
formatConfigValue,
|
|
2102
2148
|
isMfaRequired
|
|
2103
2149
|
};
|
|
2104
2150
|
//# sourceMappingURL=index.js.map
|