@fluxbase/sdk 0.0.1-rc.94 → 0.0.1-rc.95

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 CHANGED
@@ -4220,10 +4220,158 @@ var EmailTemplateManager = class {
4220
4220
  });
4221
4221
  }
4222
4222
  };
4223
+ var EmailSettingsManager = class {
4224
+ constructor(fetch2) {
4225
+ this.fetch = fetch2;
4226
+ }
4227
+ /**
4228
+ * Get current email provider settings
4229
+ *
4230
+ * Returns the current email configuration. Sensitive values (passwords, API keys)
4231
+ * are not returned - instead, boolean flags indicate whether they are set.
4232
+ *
4233
+ * @returns Promise resolving to EmailProviderSettings
4234
+ *
4235
+ * @example
4236
+ * ```typescript
4237
+ * const settings = await client.admin.settings.email.get()
4238
+ *
4239
+ * console.log('Provider:', settings.provider)
4240
+ * console.log('From:', settings.from_address)
4241
+ * console.log('SMTP password configured:', settings.smtp_password_set)
4242
+ *
4243
+ * // Check for environment variable overrides
4244
+ * if (settings._overrides.provider?.is_overridden) {
4245
+ * console.log('Provider is set by env var:', settings._overrides.provider.env_var)
4246
+ * }
4247
+ * ```
4248
+ */
4249
+ async get() {
4250
+ return await this.fetch.get(
4251
+ "/api/v1/admin/email/settings"
4252
+ );
4253
+ }
4254
+ /**
4255
+ * Update email provider settings
4256
+ *
4257
+ * Supports partial updates - only provide the fields you want to change.
4258
+ * Secret fields (passwords, API keys) are only updated if provided.
4259
+ *
4260
+ * @param request - Settings to update (partial update supported)
4261
+ * @returns Promise resolving to EmailProviderSettings - Updated settings
4262
+ * @throws Error if a setting is overridden by an environment variable
4263
+ *
4264
+ * @example
4265
+ * ```typescript
4266
+ * // Configure SMTP
4267
+ * await client.admin.settings.email.update({
4268
+ * enabled: true,
4269
+ * provider: 'smtp',
4270
+ * from_address: 'noreply@yourapp.com',
4271
+ * from_name: 'Your App',
4272
+ * smtp_host: 'smtp.gmail.com',
4273
+ * smtp_port: 587,
4274
+ * smtp_username: 'your-email@gmail.com',
4275
+ * smtp_password: 'your-app-password',
4276
+ * smtp_tls: true
4277
+ * })
4278
+ *
4279
+ * // Configure SendGrid
4280
+ * await client.admin.settings.email.update({
4281
+ * provider: 'sendgrid',
4282
+ * sendgrid_api_key: 'SG.xxx'
4283
+ * })
4284
+ *
4285
+ * // Update just the from address (password unchanged)
4286
+ * await client.admin.settings.email.update({
4287
+ * from_address: 'new-address@yourapp.com'
4288
+ * })
4289
+ * ```
4290
+ */
4291
+ async update(request) {
4292
+ return await this.fetch.put(
4293
+ "/api/v1/admin/email/settings",
4294
+ request
4295
+ );
4296
+ }
4297
+ /**
4298
+ * Test email configuration by sending a test email
4299
+ *
4300
+ * Sends a test email to verify that the current email configuration is working.
4301
+ *
4302
+ * @param recipientEmail - Email address to send the test email to
4303
+ * @returns Promise resolving to TestEmailSettingsResponse
4304
+ * @throws Error if email sending fails
4305
+ *
4306
+ * @example
4307
+ * ```typescript
4308
+ * try {
4309
+ * const result = await client.admin.settings.email.test('admin@yourapp.com')
4310
+ * console.log('Test email sent:', result.message)
4311
+ * } catch (error) {
4312
+ * console.error('Email configuration error:', error.message)
4313
+ * }
4314
+ * ```
4315
+ */
4316
+ async test(recipientEmail) {
4317
+ return await this.fetch.post(
4318
+ "/api/v1/admin/email/settings/test",
4319
+ { recipient_email: recipientEmail }
4320
+ );
4321
+ }
4322
+ /**
4323
+ * Enable email functionality
4324
+ *
4325
+ * Convenience method to enable the email system.
4326
+ *
4327
+ * @returns Promise resolving to EmailProviderSettings
4328
+ *
4329
+ * @example
4330
+ * ```typescript
4331
+ * await client.admin.settings.email.enable()
4332
+ * ```
4333
+ */
4334
+ async enable() {
4335
+ return await this.update({ enabled: true });
4336
+ }
4337
+ /**
4338
+ * Disable email functionality
4339
+ *
4340
+ * Convenience method to disable the email system.
4341
+ *
4342
+ * @returns Promise resolving to EmailProviderSettings
4343
+ *
4344
+ * @example
4345
+ * ```typescript
4346
+ * await client.admin.settings.email.disable()
4347
+ * ```
4348
+ */
4349
+ async disable() {
4350
+ return await this.update({ enabled: false });
4351
+ }
4352
+ /**
4353
+ * Set the email provider
4354
+ *
4355
+ * Convenience method to change the email provider.
4356
+ * Note: You'll also need to configure the provider-specific settings.
4357
+ *
4358
+ * @param provider - The email provider to use
4359
+ * @returns Promise resolving to EmailProviderSettings
4360
+ *
4361
+ * @example
4362
+ * ```typescript
4363
+ * await client.admin.settings.email.setProvider('sendgrid')
4364
+ * ```
4365
+ */
4366
+ async setProvider(provider) {
4367
+ return await this.update({ provider });
4368
+ }
4369
+ };
4223
4370
  var FluxbaseSettings = class {
4224
4371
  constructor(fetch2) {
4225
4372
  this.system = new SystemSettingsManager(fetch2);
4226
4373
  this.app = new AppSettingsManager(fetch2);
4374
+ this.email = new EmailSettingsManager(fetch2);
4227
4375
  }
4228
4376
  };
4229
4377
  var SettingsClient = class {
@@ -10418,6 +10566,7 @@ exports.APIKeysManager = APIKeysManager;
10418
10566
  exports.AppSettingsManager = AppSettingsManager;
10419
10567
  exports.AuthSettingsManager = AuthSettingsManager;
10420
10568
  exports.DDLManager = DDLManager;
10569
+ exports.EmailSettingsManager = EmailSettingsManager;
10421
10570
  exports.EmailTemplateManager = EmailTemplateManager;
10422
10571
  exports.ExecutionLogsChannel = ExecutionLogsChannel;
10423
10572
  exports.FluxbaseAI = FluxbaseAI;