@nulvless/nulvless-js 0.1.7 → 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.d.cts CHANGED
@@ -684,6 +684,7 @@ interface OAuthApp {
684
684
  client_name?: string;
685
685
  client_uri?: string;
686
686
  logo_uri?: string;
687
+ default_max_age?: number | null;
687
688
  /** Only present right after create/regenerate (confidential apps). */
688
689
  client_secret?: string;
689
690
  created_at?: string;
@@ -697,6 +698,7 @@ interface RegisterOAuthAppParams {
697
698
  client_name?: string;
698
699
  client_uri?: string;
699
700
  logo_uri?: string;
701
+ default_max_age?: number | null;
700
702
  }
701
703
  /** `client_type` is immutable; the secret rotates via `regenerateSecret`. */
702
704
  interface UpdateOAuthAppParams {
@@ -706,6 +708,7 @@ interface UpdateOAuthAppParams {
706
708
  client_name?: string;
707
709
  client_uri?: string;
708
710
  logo_uri?: string;
711
+ default_max_age?: number | null;
709
712
  }
710
713
  /** Query parameters for the `/oauth/authorize` redirect (PKCE required, S256). */
711
714
  interface OAuthAuthorizeParams {
@@ -1949,22 +1952,26 @@ interface SendSMSParams {
1949
1952
  }
1950
1953
  type NotificationChannel = 'email' | 'sms' | 'webhook';
1951
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
+ }
1952
1963
  interface Template {
1953
- id: string;
1954
- name?: string;
1955
- description?: string;
1956
1964
  slug: string;
1957
1965
  channel: NotificationChannel;
1958
- subject?: string;
1959
- content: string;
1966
+ name?: string;
1967
+ description?: string;
1960
1968
  url?: string;
1961
1969
  config?: Record<string, unknown>;
1962
- language: TemplateLanguage;
1963
- last_submission?: string;
1964
- /** `true` when this is a platform-level common template, not a custom one. */
1965
1970
  common: boolean;
1966
- created_at: string;
1967
- updated_at: string;
1971
+ customized: boolean;
1972
+ translations: TemplateTranslation[];
1973
+ created_at?: string;
1974
+ updated_at?: string;
1968
1975
  }
1969
1976
  interface CreateTemplateParams {
1970
1977
  slug: string;
@@ -1982,17 +1989,19 @@ interface CreateTemplateParams {
1982
1989
  interface UpdateTemplateParams {
1983
1990
  name?: string;
1984
1991
  description?: string;
1985
- subject?: string;
1986
- content?: string;
1987
1992
  url?: string;
1988
1993
  config?: Record<string, unknown>;
1989
1994
  }
1995
+ interface TranslationParams {
1996
+ subject?: string;
1997
+ content: string;
1998
+ }
1990
1999
  interface TemplateFilters {
1991
2000
  page?: number;
1992
2001
  page_size?: number;
1993
2002
  sort?: 'asc' | 'desc';
1994
2003
  channel?: NotificationChannel;
1995
- language?: TemplateLanguage;
2004
+ authored?: boolean;
1996
2005
  }
1997
2006
  interface PaginatedTemplates {
1998
2007
  items: Template[];
@@ -2028,32 +2037,43 @@ declare class TemplatesClient {
2028
2037
  */
2029
2038
  create(params: CreateTemplateParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2030
2039
  /**
2031
- * Updates an existing template.
2040
+ * Updates the name, description, URL or config of a template.
2032
2041
  *
2033
- * `language` defaults to `'en-US'` when omitted.
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.
2034
2055
  *
2035
2056
  * @example
2036
- * await nulvless.comms.templates.update('email', 'welcome', { subject: 'Welcome aboard!' })
2057
+ * await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
2037
2058
  */
2038
- update(channel: NotificationChannel, slug: string, params: UpdateTemplateParams, language?: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2059
+ deleteTranslation(channel: NotificationChannel, slug: string, language: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2039
2060
  /**
2040
- * Deletes a template.
2061
+ * Deletes a template and its translations.
2041
2062
  *
2042
- * `language` defaults to `'en-US'` when omitted.
2063
+ * @example
2064
+ * await nulvless.comms.templates.delete('email', 'welcome')
2043
2065
  */
2044
- delete(channel: NotificationChannel, slug: string, language?: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2066
+ delete(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2045
2067
  /**
2046
2068
  * Returns a template by channel and slug, falling back to the common template
2047
2069
  * if no custom one exists.
2048
2070
  *
2049
- * `language` defaults to `'en-US'` when omitted.
2050
- *
2051
- * The response includes `common: true` when the returned template is the
2052
- * platform-level fallback rather than a custom override.
2071
+ * @example
2072
+ * const { data } = await nulvless.comms.templates.get('email', 'welcome')
2053
2073
  */
2054
- get(channel: NotificationChannel, slug: string, language?: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2074
+ get(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2055
2075
  /**
2056
- * Returns a paginated list of templates, optionally filtered by channel and language.
2076
+ * Returns a paginated list of templates, optionally filtered by channel.
2057
2077
  *
2058
2078
  * @example
2059
2079
  * const { data } = await nulvless.comms.templates.list({ channel: 'email', page_size: 20 })
@@ -2351,4 +2371,4 @@ declare function createClient(url: string, publicKey: string, options?: ClientOp
2351
2371
  */
2352
2372
  declare function createServerClient(url: string, privateKey: string, options?: ServerClientOptions): NulvlessServerClient;
2353
2373
 
2354
- 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
@@ -684,6 +684,7 @@ interface OAuthApp {
684
684
  client_name?: string;
685
685
  client_uri?: string;
686
686
  logo_uri?: string;
687
+ default_max_age?: number | null;
687
688
  /** Only present right after create/regenerate (confidential apps). */
688
689
  client_secret?: string;
689
690
  created_at?: string;
@@ -697,6 +698,7 @@ interface RegisterOAuthAppParams {
697
698
  client_name?: string;
698
699
  client_uri?: string;
699
700
  logo_uri?: string;
701
+ default_max_age?: number | null;
700
702
  }
701
703
  /** `client_type` is immutable; the secret rotates via `regenerateSecret`. */
702
704
  interface UpdateOAuthAppParams {
@@ -706,6 +708,7 @@ interface UpdateOAuthAppParams {
706
708
  client_name?: string;
707
709
  client_uri?: string;
708
710
  logo_uri?: string;
711
+ default_max_age?: number | null;
709
712
  }
710
713
  /** Query parameters for the `/oauth/authorize` redirect (PKCE required, S256). */
711
714
  interface OAuthAuthorizeParams {
@@ -1949,22 +1952,26 @@ interface SendSMSParams {
1949
1952
  }
1950
1953
  type NotificationChannel = 'email' | 'sms' | 'webhook';
1951
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
+ }
1952
1963
  interface Template {
1953
- id: string;
1954
- name?: string;
1955
- description?: string;
1956
1964
  slug: string;
1957
1965
  channel: NotificationChannel;
1958
- subject?: string;
1959
- content: string;
1966
+ name?: string;
1967
+ description?: string;
1960
1968
  url?: string;
1961
1969
  config?: Record<string, unknown>;
1962
- language: TemplateLanguage;
1963
- last_submission?: string;
1964
- /** `true` when this is a platform-level common template, not a custom one. */
1965
1970
  common: boolean;
1966
- created_at: string;
1967
- updated_at: string;
1971
+ customized: boolean;
1972
+ translations: TemplateTranslation[];
1973
+ created_at?: string;
1974
+ updated_at?: string;
1968
1975
  }
1969
1976
  interface CreateTemplateParams {
1970
1977
  slug: string;
@@ -1982,17 +1989,19 @@ interface CreateTemplateParams {
1982
1989
  interface UpdateTemplateParams {
1983
1990
  name?: string;
1984
1991
  description?: string;
1985
- subject?: string;
1986
- content?: string;
1987
1992
  url?: string;
1988
1993
  config?: Record<string, unknown>;
1989
1994
  }
1995
+ interface TranslationParams {
1996
+ subject?: string;
1997
+ content: string;
1998
+ }
1990
1999
  interface TemplateFilters {
1991
2000
  page?: number;
1992
2001
  page_size?: number;
1993
2002
  sort?: 'asc' | 'desc';
1994
2003
  channel?: NotificationChannel;
1995
- language?: TemplateLanguage;
2004
+ authored?: boolean;
1996
2005
  }
1997
2006
  interface PaginatedTemplates {
1998
2007
  items: Template[];
@@ -2028,32 +2037,43 @@ declare class TemplatesClient {
2028
2037
  */
2029
2038
  create(params: CreateTemplateParams, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2030
2039
  /**
2031
- * Updates an existing template.
2040
+ * Updates the name, description, URL or config of a template.
2032
2041
  *
2033
- * `language` defaults to `'en-US'` when omitted.
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.
2034
2055
  *
2035
2056
  * @example
2036
- * await nulvless.comms.templates.update('email', 'welcome', { subject: 'Welcome aboard!' })
2057
+ * await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
2037
2058
  */
2038
- update(channel: NotificationChannel, slug: string, params: UpdateTemplateParams, language?: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2059
+ deleteTranslation(channel: NotificationChannel, slug: string, language: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2039
2060
  /**
2040
- * Deletes a template.
2061
+ * Deletes a template and its translations.
2041
2062
  *
2042
- * `language` defaults to `'en-US'` when omitted.
2063
+ * @example
2064
+ * await nulvless.comms.templates.delete('email', 'welcome')
2043
2065
  */
2044
- delete(channel: NotificationChannel, slug: string, language?: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2066
+ delete(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2045
2067
  /**
2046
2068
  * Returns a template by channel and slug, falling back to the common template
2047
2069
  * if no custom one exists.
2048
2070
  *
2049
- * `language` defaults to `'en-US'` when omitted.
2050
- *
2051
- * The response includes `common: true` when the returned template is the
2052
- * platform-level fallback rather than a custom override.
2071
+ * @example
2072
+ * const { data } = await nulvless.comms.templates.get('email', 'welcome')
2053
2073
  */
2054
- get(channel: NotificationChannel, slug: string, language?: TemplateLanguage, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2074
+ get(channel: NotificationChannel, slug: string, options?: RequestOptions): Promise<NulvlessResult<Template>>;
2055
2075
  /**
2056
- * Returns a paginated list of templates, optionally filtered by channel and language.
2076
+ * Returns a paginated list of templates, optionally filtered by channel.
2057
2077
  *
2058
2078
  * @example
2059
2079
  * const { data } = await nulvless.comms.templates.list({ channel: 'email', page_size: 20 })
@@ -2351,4 +2371,4 @@ declare function createClient(url: string, publicKey: string, options?: ClientOp
2351
2371
  */
2352
2372
  declare function createServerClient(url: string, privateKey: string, options?: ServerClientOptions): NulvlessServerClient;
2353
2373
 
2354
- 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 an existing template.
1969
+ * Updates the name, description, URL or config of a template.
1973
1970
  *
1974
- * `language` defaults to `'en-US'` when omitted.
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.update('email', 'welcome', { subject: 'Welcome aboard!' })
1981
+ * await nulvless.comms.templates.putTranslation('email', 'welcome', 'pt-BR', { subject: 'Olá!', content: '<h1>Olá {{name}}</h1>' })
1978
1982
  */
1979
- update(channel, slug, params, language, options) {
1980
- return this.http.patch(templatePath(channel, slug, language), params, options);
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
- * `language` defaults to `'en-US'` when omitted.
1989
+ * @example
1990
+ * await nulvless.comms.templates.deleteTranslation('email', 'welcome', 'pt-BR')
1986
1991
  */
1987
- delete(channel, slug, language, options) {
1988
- return this.http.delete(templatePath(channel, slug, language), options);
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
- * `language` defaults to `'en-US'` when omitted.
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, language, options) {
2000
- return this.http.get(templatePath(channel, slug, language), options);
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 and language.
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?.language ? { language: filters.language } : {}
2028
+ ...filters?.authored ? { authored: filters.authored } : {}
2017
2029
  }
2018
2030
  });
2019
2031
  }