@nulvless/nulvless-js 0.1.8 → 0.2.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/dist/index.cjs +32 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -27
- package/dist/index.d.ts +44 -27
- package/dist/index.mjs +32 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1952,22 +1952,26 @@ interface SendSMSParams {
|
|
|
1952
1952
|
}
|
|
1953
1953
|
type NotificationChannel = 'email' | 'sms' | 'webhook';
|
|
1954
1954
|
type TemplateLanguage = 'en-US' | 'pt-BR';
|
|
1955
|
+
interface TemplateTranslation {
|
|
1956
|
+
language: TemplateLanguage;
|
|
1957
|
+
subject?: string;
|
|
1958
|
+
content?: string;
|
|
1959
|
+
last_submission?: string;
|
|
1960
|
+
created_at?: string;
|
|
1961
|
+
updated_at?: string;
|
|
1962
|
+
}
|
|
1955
1963
|
interface Template {
|
|
1956
|
-
id: string;
|
|
1957
|
-
name?: string;
|
|
1958
|
-
description?: string;
|
|
1959
1964
|
slug: string;
|
|
1960
1965
|
channel: NotificationChannel;
|
|
1961
|
-
|
|
1962
|
-
|
|
1966
|
+
name?: string;
|
|
1967
|
+
description?: string;
|
|
1963
1968
|
url?: string;
|
|
1964
1969
|
config?: Record<string, unknown>;
|
|
1965
|
-
language: TemplateLanguage;
|
|
1966
|
-
last_submission?: string;
|
|
1967
|
-
/** `true` when this is a platform-level common template, not a custom one. */
|
|
1968
1970
|
common: boolean;
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
+
customized: boolean;
|
|
1972
|
+
translations: TemplateTranslation[];
|
|
1973
|
+
created_at?: string;
|
|
1974
|
+
updated_at?: string;
|
|
1971
1975
|
}
|
|
1972
1976
|
interface CreateTemplateParams {
|
|
1973
1977
|
slug: string;
|
|
@@ -1985,17 +1989,19 @@ interface CreateTemplateParams {
|
|
|
1985
1989
|
interface UpdateTemplateParams {
|
|
1986
1990
|
name?: string;
|
|
1987
1991
|
description?: string;
|
|
1988
|
-
subject?: string;
|
|
1989
|
-
content?: string;
|
|
1990
1992
|
url?: string;
|
|
1991
1993
|
config?: Record<string, unknown>;
|
|
1992
1994
|
}
|
|
1995
|
+
interface TranslationParams {
|
|
1996
|
+
subject?: string;
|
|
1997
|
+
content: string;
|
|
1998
|
+
}
|
|
1993
1999
|
interface TemplateFilters {
|
|
1994
2000
|
page?: number;
|
|
1995
2001
|
page_size?: number;
|
|
1996
2002
|
sort?: 'asc' | 'desc';
|
|
1997
2003
|
channel?: NotificationChannel;
|
|
1998
|
-
|
|
2004
|
+
authored?: boolean;
|
|
1999
2005
|
}
|
|
2000
2006
|
interface PaginatedTemplates {
|
|
2001
2007
|
items: Template[];
|
|
@@ -2031,32 +2037,43 @@ declare class TemplatesClient {
|
|
|
2031
2037
|
*/
|
|
2032
2038
|
create(params: CreateTemplateParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2033
2039
|
/**
|
|
2034
|
-
* Updates
|
|
2040
|
+
* Updates the name, description, URL or config of a template.
|
|
2035
2041
|
*
|
|
2036
|
-
*
|
|
2042
|
+
* @example
|
|
2043
|
+
* await nulvless.comms.templates.update('email', 'welcome', { name: 'Welcome' })
|
|
2044
|
+
*/
|
|
2045
|
+
update(channel: NotificationChannel, slug: string, params: UpdateTemplateParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2046
|
+
/**
|
|
2047
|
+
* Creates or replaces a template translation.
|
|
2048
|
+
*
|
|
2049
|
+
* @example
|
|
2050
|
+
* await nulvless.comms.templates.putTranslation('email', 'welcome', 'pt-BR', { subject: 'Olá!', content: '<h1>Olá {{name}}</h1>' })
|
|
2051
|
+
*/
|
|
2052
|
+
putTranslation(channel: NotificationChannel, slug: string, language: TemplateLanguage, params: TranslationParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Deletes a template translation.
|
|
2037
2055
|
*
|
|
2038
2056
|
* @example
|
|
2039
|
-
* await nulvless.comms.templates.
|
|
2057
|
+
* await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
|
|
2040
2058
|
*/
|
|
2041
|
-
|
|
2059
|
+
deleteTranslation(channel: NotificationChannel, slug: string, language: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2042
2060
|
/**
|
|
2043
|
-
* Deletes a template.
|
|
2061
|
+
* Deletes a template and its translations.
|
|
2044
2062
|
*
|
|
2045
|
-
*
|
|
2063
|
+
* @example
|
|
2064
|
+
* await nulvless.comms.templates.delete('email', 'welcome')
|
|
2046
2065
|
*/
|
|
2047
|
-
delete(channel: NotificationChannel, slug: string,
|
|
2066
|
+
delete(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2048
2067
|
/**
|
|
2049
2068
|
* Returns a template by channel and slug, falling back to the common template
|
|
2050
2069
|
* if no custom one exists.
|
|
2051
2070
|
*
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
* The response includes `common: true` when the returned template is the
|
|
2055
|
-
* platform-level fallback rather than a custom override.
|
|
2071
|
+
* @example
|
|
2072
|
+
* const { data } = await nulvless.comms.templates.get('email', 'welcome')
|
|
2056
2073
|
*/
|
|
2057
|
-
get(channel: NotificationChannel, slug: string,
|
|
2074
|
+
get(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2058
2075
|
/**
|
|
2059
|
-
* Returns a paginated list of templates, optionally filtered by channel
|
|
2076
|
+
* Returns a paginated list of templates, optionally filtered by channel.
|
|
2060
2077
|
*
|
|
2061
2078
|
* @example
|
|
2062
2079
|
* const { data } = await nulvless.comms.templates.list({ channel: 'email', page_size: 20 })
|
|
@@ -2354,4 +2371,4 @@ declare function createClient(url: string, publicKey: string, options?: ClientOp
|
|
|
2354
2371
|
*/
|
|
2355
2372
|
declare function createServerClient(url: string, privateKey: string, options?: ServerClientOptions): NulvlessServerClient;
|
|
2356
2373
|
|
|
2357
|
-
export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, type AuthErrorCode, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type CommsErrorCode, type ConfirmationType, type CreateChallengeParams, type CreateRoleParams, type CreateTemplateParams, type EdgeFunctionErrorCode, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ErrorCode, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type GatewayErrorCode, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthPrompt, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, type SdkErrorCode, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, TemplatesClient, type TokenType, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
|
|
2374
|
+
export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, type AuthErrorCode, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type CommsErrorCode, type ConfirmationType, type CreateChallengeParams, type CreateRoleParams, type CreateTemplateParams, type EdgeFunctionErrorCode, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ErrorCode, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type GatewayErrorCode, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthPrompt, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, type SdkErrorCode, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, type TemplateTranslation, TemplatesClient, type TokenType, type TranslationParams, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
|
package/dist/index.d.ts
CHANGED
|
@@ -1952,22 +1952,26 @@ interface SendSMSParams {
|
|
|
1952
1952
|
}
|
|
1953
1953
|
type NotificationChannel = 'email' | 'sms' | 'webhook';
|
|
1954
1954
|
type TemplateLanguage = 'en-US' | 'pt-BR';
|
|
1955
|
+
interface TemplateTranslation {
|
|
1956
|
+
language: TemplateLanguage;
|
|
1957
|
+
subject?: string;
|
|
1958
|
+
content?: string;
|
|
1959
|
+
last_submission?: string;
|
|
1960
|
+
created_at?: string;
|
|
1961
|
+
updated_at?: string;
|
|
1962
|
+
}
|
|
1955
1963
|
interface Template {
|
|
1956
|
-
id: string;
|
|
1957
|
-
name?: string;
|
|
1958
|
-
description?: string;
|
|
1959
1964
|
slug: string;
|
|
1960
1965
|
channel: NotificationChannel;
|
|
1961
|
-
|
|
1962
|
-
|
|
1966
|
+
name?: string;
|
|
1967
|
+
description?: string;
|
|
1963
1968
|
url?: string;
|
|
1964
1969
|
config?: Record<string, unknown>;
|
|
1965
|
-
language: TemplateLanguage;
|
|
1966
|
-
last_submission?: string;
|
|
1967
|
-
/** `true` when this is a platform-level common template, not a custom one. */
|
|
1968
1970
|
common: boolean;
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
+
customized: boolean;
|
|
1972
|
+
translations: TemplateTranslation[];
|
|
1973
|
+
created_at?: string;
|
|
1974
|
+
updated_at?: string;
|
|
1971
1975
|
}
|
|
1972
1976
|
interface CreateTemplateParams {
|
|
1973
1977
|
slug: string;
|
|
@@ -1985,17 +1989,19 @@ interface CreateTemplateParams {
|
|
|
1985
1989
|
interface UpdateTemplateParams {
|
|
1986
1990
|
name?: string;
|
|
1987
1991
|
description?: string;
|
|
1988
|
-
subject?: string;
|
|
1989
|
-
content?: string;
|
|
1990
1992
|
url?: string;
|
|
1991
1993
|
config?: Record<string, unknown>;
|
|
1992
1994
|
}
|
|
1995
|
+
interface TranslationParams {
|
|
1996
|
+
subject?: string;
|
|
1997
|
+
content: string;
|
|
1998
|
+
}
|
|
1993
1999
|
interface TemplateFilters {
|
|
1994
2000
|
page?: number;
|
|
1995
2001
|
page_size?: number;
|
|
1996
2002
|
sort?: 'asc' | 'desc';
|
|
1997
2003
|
channel?: NotificationChannel;
|
|
1998
|
-
|
|
2004
|
+
authored?: boolean;
|
|
1999
2005
|
}
|
|
2000
2006
|
interface PaginatedTemplates {
|
|
2001
2007
|
items: Template[];
|
|
@@ -2031,32 +2037,43 @@ declare class TemplatesClient {
|
|
|
2031
2037
|
*/
|
|
2032
2038
|
create(params: CreateTemplateParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2033
2039
|
/**
|
|
2034
|
-
* Updates
|
|
2040
|
+
* Updates the name, description, URL or config of a template.
|
|
2035
2041
|
*
|
|
2036
|
-
*
|
|
2042
|
+
* @example
|
|
2043
|
+
* await nulvless.comms.templates.update('email', 'welcome', { name: 'Welcome' })
|
|
2044
|
+
*/
|
|
2045
|
+
update(channel: NotificationChannel, slug: string, params: UpdateTemplateParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2046
|
+
/**
|
|
2047
|
+
* Creates or replaces a template translation.
|
|
2048
|
+
*
|
|
2049
|
+
* @example
|
|
2050
|
+
* await nulvless.comms.templates.putTranslation('email', 'welcome', 'pt-BR', { subject: 'Olá!', content: '<h1>Olá {{name}}</h1>' })
|
|
2051
|
+
*/
|
|
2052
|
+
putTranslation(channel: NotificationChannel, slug: string, language: TemplateLanguage, params: TranslationParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Deletes a template translation.
|
|
2037
2055
|
*
|
|
2038
2056
|
* @example
|
|
2039
|
-
* await nulvless.comms.templates.
|
|
2057
|
+
* await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
|
|
2040
2058
|
*/
|
|
2041
|
-
|
|
2059
|
+
deleteTranslation(channel: NotificationChannel, slug: string, language: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2042
2060
|
/**
|
|
2043
|
-
* Deletes a template.
|
|
2061
|
+
* Deletes a template and its translations.
|
|
2044
2062
|
*
|
|
2045
|
-
*
|
|
2063
|
+
* @example
|
|
2064
|
+
* await nulvless.comms.templates.delete('email', 'welcome')
|
|
2046
2065
|
*/
|
|
2047
|
-
delete(channel: NotificationChannel, slug: string,
|
|
2066
|
+
delete(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2048
2067
|
/**
|
|
2049
2068
|
* Returns a template by channel and slug, falling back to the common template
|
|
2050
2069
|
* if no custom one exists.
|
|
2051
2070
|
*
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
* The response includes `common: true` when the returned template is the
|
|
2055
|
-
* platform-level fallback rather than a custom override.
|
|
2071
|
+
* @example
|
|
2072
|
+
* const { data } = await nulvless.comms.templates.get('email', 'welcome')
|
|
2056
2073
|
*/
|
|
2057
|
-
get(channel: NotificationChannel, slug: string,
|
|
2074
|
+
get(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
|
|
2058
2075
|
/**
|
|
2059
|
-
* Returns a paginated list of templates, optionally filtered by channel
|
|
2076
|
+
* Returns a paginated list of templates, optionally filtered by channel.
|
|
2060
2077
|
*
|
|
2061
2078
|
* @example
|
|
2062
2079
|
* const { data } = await nulvless.comms.templates.list({ channel: 'email', page_size: 20 })
|
|
@@ -2354,4 +2371,4 @@ declare function createClient(url: string, publicKey: string, options?: ClientOp
|
|
|
2354
2371
|
*/
|
|
2355
2372
|
declare function createServerClient(url: string, privateKey: string, options?: ServerClientOptions): NulvlessServerClient;
|
|
2356
2373
|
|
|
2357
|
-
export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, type AuthErrorCode, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type CommsErrorCode, type ConfirmationType, type CreateChallengeParams, type CreateRoleParams, type CreateTemplateParams, type EdgeFunctionErrorCode, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ErrorCode, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type GatewayErrorCode, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthPrompt, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, type SdkErrorCode, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, TemplatesClient, type TokenType, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
|
|
2374
|
+
export { AUTH_CACHE_HEADERS, type AccountEntry, type AddEmailIdentityParams, type AddPhoneIdentityParams, AdminClient, type AdminCreateUserParams, type AdminUpdateUserParams, type AssuranceLevel, AuthBrowserClient, AuthClient, type AuthErrorCode, AuthEventEmitter, type AuthEvents, type AuthFactorStatus, type AuthMethod, type AuthMethods, type AuthOptions, AuthServerClient, type Authenticated, type BlockGrantParams, type Challenge, type ChallengeSubject, type ChangeChallengeParams, type ChangePasswordParams, type ClientOptions, CommsClient, type CommsErrorCode, type ConfirmationType, type CreateChallengeParams, type CreateRoleParams, type CreateTemplateParams, type EdgeFunctionErrorCode, EmailClient, type EnableFactorParams, type EnrollFactorParams, type ErrorCode, type ExchangeOAuthCodeParams, type FactorEnrollment, FactorsClient, type GatewayErrorCode, type Grant, type GrantMembers, type GrantStatus, GrantsClient, HttpClient, type Identity, type IdentityType, type Invite, type InviteParams, type Language, type LeaveGrantParams, type LookupMatch, type LookupParams, type LookupResult, type MFAMethod, type Nonce, type NotificationChannel, NulvlessClient, type NulvlessError, NulvlessException, type NulvlessResult, NulvlessServerClient, type NulvlessStorage, type OAuthApp, type OAuthAppGrantType, type OAuthAppTokenEndpointAuthMethod, type OAuthAppType, type OAuthAuthorization, type OAuthAuthorizeParams, OAuthClient, type OAuthConsentAction, type OAuthConsentResult, type OAuthDiscovery, OAuthGrantsClient, type OAuthJWKS, type OAuthPrompt, type OAuthProvider, type OAuthTokenResponse, type OAuthUserGrant, type OAuthUserInfo, type PaginateGrantsParams, type PaginateUsersParams, type Paginated, type PaginatedTemplates, type PaginationSort, type Phone, type RecoverParams, type RefreshOAuthTokenParams, type RefreshTokenParams, type RegisterOAuthAppParams, type RemoveIdentityParams, type RequestOptions, type ResetPasswordParams, type RevokeGrantParams, type RevokeSessionParams, type Role, type SdkErrorCode, SecurityClient, type SendEmailParams, type SendOTPToUpdateEmailParams, type SendOTPToUpdatePhoneParams, type SendSMSParams, type ServerClientOptions, type Session, type SessionFingerPrint, SessionManager, SessionsClient, type SetGrantParams, type SignInMethod, type SignInParams, type SignInWithOTPParams, type SignOutScope, type SignUpParams, SmsClient, Storage, type StoredSession, type SudoMethod, type Template, type TemplateFilters, type TemplateLanguage, type TemplateTranslation, TemplatesClient, type TokenType, type TranslationParams, type UnenrollFactorParams, type UpdateGrantParams, type UpdateIdentityParams, type UpdateOAuthAppParams, type UpdateRoleParams, type UpdateTemplateParams, type User, type UserGender, type UserProfile, UsersClient, type Verified, type VerifyChallengeParams, type VerifyParams, type VerifyReason, applyAuthCacheHeaders, createClient, createServerClient, forwardUserHeaders };
|
package/dist/index.mjs
CHANGED
|
@@ -1950,9 +1950,6 @@ var AuthServerClient = class extends AuthClient {
|
|
|
1950
1950
|
};
|
|
1951
1951
|
|
|
1952
1952
|
// src/comms/templates/index.ts
|
|
1953
|
-
function templatePath(channel, slug, language) {
|
|
1954
|
-
return language ? route`/templates/${channel}/${slug}/${language}` : route`/templates/${channel}/${slug}`;
|
|
1955
|
-
}
|
|
1956
1953
|
var TemplatesClient = class {
|
|
1957
1954
|
constructor(http) {
|
|
1958
1955
|
this.http = http;
|
|
@@ -1969,38 +1966,53 @@ var TemplatesClient = class {
|
|
|
1969
1966
|
return this.http.post("/templates", params, options);
|
|
1970
1967
|
}
|
|
1971
1968
|
/**
|
|
1972
|
-
* Updates
|
|
1969
|
+
* Updates the name, description, URL or config of a template.
|
|
1973
1970
|
*
|
|
1974
|
-
*
|
|
1971
|
+
* @example
|
|
1972
|
+
* await nulvless.comms.templates.update('email', 'welcome', { name: 'Welcome' })
|
|
1973
|
+
*/
|
|
1974
|
+
update(channel, slug, params, options) {
|
|
1975
|
+
return this.http.patch(route`/templates/${channel}/${slug}`, params, options);
|
|
1976
|
+
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Creates or replaces a template translation.
|
|
1975
1979
|
*
|
|
1976
1980
|
* @example
|
|
1977
|
-
* await nulvless.comms.templates.
|
|
1981
|
+
* await nulvless.comms.templates.putTranslation('email', 'welcome', 'pt-BR', { subject: 'Olá!', content: '<h1>Olá {{name}}</h1>' })
|
|
1978
1982
|
*/
|
|
1979
|
-
|
|
1980
|
-
return this.http.
|
|
1983
|
+
putTranslation(channel, slug, language, params, options) {
|
|
1984
|
+
return this.http.put(route`/templates/${channel}/${slug}/${language}`, params, options);
|
|
1981
1985
|
}
|
|
1982
1986
|
/**
|
|
1983
|
-
* Deletes a template.
|
|
1987
|
+
* Deletes a template translation.
|
|
1984
1988
|
*
|
|
1985
|
-
*
|
|
1989
|
+
* @example
|
|
1990
|
+
* await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
|
|
1986
1991
|
*/
|
|
1987
|
-
|
|
1988
|
-
return this.http.delete(
|
|
1992
|
+
deleteTranslation(channel, slug, language, options) {
|
|
1993
|
+
return this.http.delete(route`/templates/${channel}/${slug}/${language}`, options);
|
|
1994
|
+
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Deletes a template and its translations.
|
|
1997
|
+
*
|
|
1998
|
+
* @example
|
|
1999
|
+
* await nulvless.comms.templates.delete('email', 'welcome')
|
|
2000
|
+
*/
|
|
2001
|
+
delete(channel, slug, options) {
|
|
2002
|
+
return this.http.delete(route`/templates/${channel}/${slug}`, options);
|
|
1989
2003
|
}
|
|
1990
2004
|
/**
|
|
1991
2005
|
* Returns a template by channel and slug, falling back to the common template
|
|
1992
2006
|
* if no custom one exists.
|
|
1993
2007
|
*
|
|
1994
|
-
*
|
|
1995
|
-
*
|
|
1996
|
-
* The response includes `common: true` when the returned template is the
|
|
1997
|
-
* platform-level fallback rather than a custom override.
|
|
2008
|
+
* @example
|
|
2009
|
+
* const { data } = await nulvless.comms.templates.get('email', 'welcome')
|
|
1998
2010
|
*/
|
|
1999
|
-
get(channel, slug,
|
|
2000
|
-
return this.http.get(
|
|
2011
|
+
get(channel, slug, options) {
|
|
2012
|
+
return this.http.get(route`/templates/${channel}/${slug}`, options);
|
|
2001
2013
|
}
|
|
2002
2014
|
/**
|
|
2003
|
-
* Returns a paginated list of templates, optionally filtered by channel
|
|
2015
|
+
* Returns a paginated list of templates, optionally filtered by channel.
|
|
2004
2016
|
*
|
|
2005
2017
|
* @example
|
|
2006
2018
|
* const { data } = await nulvless.comms.templates.list({ channel: 'email', page_size: 20 })
|
|
@@ -2013,7 +2025,7 @@ var TemplatesClient = class {
|
|
|
2013
2025
|
...filters?.page_size !== void 0 ? { page_size: filters.page_size } : {},
|
|
2014
2026
|
...filters?.sort ? { sort: filters.sort } : {},
|
|
2015
2027
|
...filters?.channel ? { channel: filters.channel } : {},
|
|
2016
|
-
...filters?.
|
|
2028
|
+
...filters?.authored ? { authored: filters.authored } : {}
|
|
2017
2029
|
}
|
|
2018
2030
|
});
|
|
2019
2031
|
}
|