@insforge/sdk 1.0.1 → 1.0.2-dev.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.mts +45 -3
- package/dist/index.d.ts +45 -3
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UserSchema, CreateUserRequest, CreateUserResponse, CreateSessionRequest, CreateSessionResponse, OAuthProvidersSchema, GetPublicAuthConfigResponse, UserIdSchema, EmailSchema, RoleSchema, SendVerificationEmailRequest, SendResetPasswordEmailRequest, ExchangeResetPasswordTokenRequest, VerifyEmailRequest, StorageFileSchema, ListObjectsResponseSchema, ChatCompletionRequest, ImageGenerationRequest, SubscribeResponse, SocketMessage } from '@insforge/shared-schemas';
|
|
2
|
-
export { AuthErrorResponse, CreateSessionRequest, CreateUserRequest, RealtimeErrorPayload, SocketMessage, SubscribeResponse, UserSchema } from '@insforge/shared-schemas';
|
|
1
|
+
import { UserSchema, CreateUserRequest, CreateUserResponse, CreateSessionRequest, CreateSessionResponse, OAuthProvidersSchema, GetPublicAuthConfigResponse, UserIdSchema, EmailSchema, RoleSchema, SendVerificationEmailRequest, SendResetPasswordEmailRequest, ExchangeResetPasswordTokenRequest, VerifyEmailRequest, StorageFileSchema, ListObjectsResponseSchema, ChatCompletionRequest, ImageGenerationRequest, SubscribeResponse, SocketMessage, SendRawEmailRequest, SendEmailResponse } from '@insforge/shared-schemas';
|
|
2
|
+
export { AuthErrorResponse, CreateSessionRequest, CreateUserRequest, RealtimeErrorPayload, SendRawEmailRequest as SendEmailOptions, SendEmailResponse, SocketMessage, SubscribeResponse, UserSchema } from '@insforge/shared-schemas';
|
|
3
3
|
import * as _supabase_postgrest_js from '@supabase/postgrest-js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -709,6 +709,47 @@ declare class Realtime {
|
|
|
709
709
|
getSubscribedChannels(): string[];
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Emails client for sending custom emails
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```typescript
|
|
717
|
+
* // Send a simple email
|
|
718
|
+
* const { data, error } = await client.emails.send({
|
|
719
|
+
* to: 'user@example.com',
|
|
720
|
+
* subject: 'Welcome!',
|
|
721
|
+
* html: '<h1>Welcome to our platform</h1>'
|
|
722
|
+
* });
|
|
723
|
+
*
|
|
724
|
+
* if (error) {
|
|
725
|
+
* console.error('Failed to send:', error.message);
|
|
726
|
+
* return;
|
|
727
|
+
* }
|
|
728
|
+
* // Email sent successfully - data is {} (empty object)
|
|
729
|
+
*
|
|
730
|
+
* // Send to multiple recipients with CC
|
|
731
|
+
* const { data, error } = await client.emails.send({
|
|
732
|
+
* to: ['user1@example.com', 'user2@example.com'],
|
|
733
|
+
* cc: 'manager@example.com',
|
|
734
|
+
* subject: 'Team Update',
|
|
735
|
+
* html: '<p>Here is the latest update...</p>',
|
|
736
|
+
* replyTo: 'support@example.com'
|
|
737
|
+
* });
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
declare class Emails {
|
|
741
|
+
private http;
|
|
742
|
+
constructor(http: HttpClient);
|
|
743
|
+
/**
|
|
744
|
+
* Send a custom HTML email
|
|
745
|
+
* @param options Email options including recipients, subject, and HTML content
|
|
746
|
+
*/
|
|
747
|
+
send(options: SendRawEmailRequest): Promise<{
|
|
748
|
+
data: SendEmailResponse | null;
|
|
749
|
+
error: Error | null;
|
|
750
|
+
}>;
|
|
751
|
+
}
|
|
752
|
+
|
|
712
753
|
/**
|
|
713
754
|
* Main InsForge SDK Client
|
|
714
755
|
*
|
|
@@ -756,6 +797,7 @@ declare class InsForgeClient {
|
|
|
756
797
|
readonly ai: AI;
|
|
757
798
|
readonly functions: Functions;
|
|
758
799
|
readonly realtime: Realtime;
|
|
800
|
+
readonly emails: Emails;
|
|
759
801
|
constructor(config?: InsForgeConfig);
|
|
760
802
|
/**
|
|
761
803
|
* Get the underlying HTTP client for custom requests
|
|
@@ -777,4 +819,4 @@ declare class InsForgeClient {
|
|
|
777
819
|
|
|
778
820
|
declare function createClient(config: InsForgeConfig): InsForgeClient;
|
|
779
821
|
|
|
780
|
-
export { AI, type ApiError, Auth, type AuthSession, type InsForgeConfig as ClientOptions, type ConnectionState, Database, type EventCallback, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, type ProfileData, Realtime, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, InsForgeClient as default };
|
|
822
|
+
export { AI, type ApiError, Auth, type AuthSession, type InsForgeConfig as ClientOptions, type ConnectionState, Database, Emails, type EventCallback, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, type ProfileData, Realtime, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, InsForgeClient as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UserSchema, CreateUserRequest, CreateUserResponse, CreateSessionRequest, CreateSessionResponse, OAuthProvidersSchema, GetPublicAuthConfigResponse, UserIdSchema, EmailSchema, RoleSchema, SendVerificationEmailRequest, SendResetPasswordEmailRequest, ExchangeResetPasswordTokenRequest, VerifyEmailRequest, StorageFileSchema, ListObjectsResponseSchema, ChatCompletionRequest, ImageGenerationRequest, SubscribeResponse, SocketMessage } from '@insforge/shared-schemas';
|
|
2
|
-
export { AuthErrorResponse, CreateSessionRequest, CreateUserRequest, RealtimeErrorPayload, SocketMessage, SubscribeResponse, UserSchema } from '@insforge/shared-schemas';
|
|
1
|
+
import { UserSchema, CreateUserRequest, CreateUserResponse, CreateSessionRequest, CreateSessionResponse, OAuthProvidersSchema, GetPublicAuthConfigResponse, UserIdSchema, EmailSchema, RoleSchema, SendVerificationEmailRequest, SendResetPasswordEmailRequest, ExchangeResetPasswordTokenRequest, VerifyEmailRequest, StorageFileSchema, ListObjectsResponseSchema, ChatCompletionRequest, ImageGenerationRequest, SubscribeResponse, SocketMessage, SendRawEmailRequest, SendEmailResponse } from '@insforge/shared-schemas';
|
|
2
|
+
export { AuthErrorResponse, CreateSessionRequest, CreateUserRequest, RealtimeErrorPayload, SendRawEmailRequest as SendEmailOptions, SendEmailResponse, SocketMessage, SubscribeResponse, UserSchema } from '@insforge/shared-schemas';
|
|
3
3
|
import * as _supabase_postgrest_js from '@supabase/postgrest-js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -709,6 +709,47 @@ declare class Realtime {
|
|
|
709
709
|
getSubscribedChannels(): string[];
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Emails client for sending custom emails
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```typescript
|
|
717
|
+
* // Send a simple email
|
|
718
|
+
* const { data, error } = await client.emails.send({
|
|
719
|
+
* to: 'user@example.com',
|
|
720
|
+
* subject: 'Welcome!',
|
|
721
|
+
* html: '<h1>Welcome to our platform</h1>'
|
|
722
|
+
* });
|
|
723
|
+
*
|
|
724
|
+
* if (error) {
|
|
725
|
+
* console.error('Failed to send:', error.message);
|
|
726
|
+
* return;
|
|
727
|
+
* }
|
|
728
|
+
* // Email sent successfully - data is {} (empty object)
|
|
729
|
+
*
|
|
730
|
+
* // Send to multiple recipients with CC
|
|
731
|
+
* const { data, error } = await client.emails.send({
|
|
732
|
+
* to: ['user1@example.com', 'user2@example.com'],
|
|
733
|
+
* cc: 'manager@example.com',
|
|
734
|
+
* subject: 'Team Update',
|
|
735
|
+
* html: '<p>Here is the latest update...</p>',
|
|
736
|
+
* replyTo: 'support@example.com'
|
|
737
|
+
* });
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
declare class Emails {
|
|
741
|
+
private http;
|
|
742
|
+
constructor(http: HttpClient);
|
|
743
|
+
/**
|
|
744
|
+
* Send a custom HTML email
|
|
745
|
+
* @param options Email options including recipients, subject, and HTML content
|
|
746
|
+
*/
|
|
747
|
+
send(options: SendRawEmailRequest): Promise<{
|
|
748
|
+
data: SendEmailResponse | null;
|
|
749
|
+
error: Error | null;
|
|
750
|
+
}>;
|
|
751
|
+
}
|
|
752
|
+
|
|
712
753
|
/**
|
|
713
754
|
* Main InsForge SDK Client
|
|
714
755
|
*
|
|
@@ -756,6 +797,7 @@ declare class InsForgeClient {
|
|
|
756
797
|
readonly ai: AI;
|
|
757
798
|
readonly functions: Functions;
|
|
758
799
|
readonly realtime: Realtime;
|
|
800
|
+
readonly emails: Emails;
|
|
759
801
|
constructor(config?: InsForgeConfig);
|
|
760
802
|
/**
|
|
761
803
|
* Get the underlying HTTP client for custom requests
|
|
@@ -777,4 +819,4 @@ declare class InsForgeClient {
|
|
|
777
819
|
|
|
778
820
|
declare function createClient(config: InsForgeConfig): InsForgeClient;
|
|
779
821
|
|
|
780
|
-
export { AI, type ApiError, Auth, type AuthSession, type InsForgeConfig as ClientOptions, type ConnectionState, Database, type EventCallback, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, type ProfileData, Realtime, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, InsForgeClient as default };
|
|
822
|
+
export { AI, type ApiError, Auth, type AuthSession, type InsForgeConfig as ClientOptions, type ConnectionState, Database, Emails, type EventCallback, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, type ProfileData, Realtime, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, InsForgeClient as default };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
AI: () => AI,
|
|
24
24
|
Auth: () => Auth,
|
|
25
25
|
Database: () => Database,
|
|
26
|
+
Emails: () => Emails,
|
|
26
27
|
Functions: () => Functions,
|
|
27
28
|
HttpClient: () => HttpClient,
|
|
28
29
|
InsForgeClient: () => InsForgeClient,
|
|
@@ -1595,6 +1596,29 @@ var Realtime = class {
|
|
|
1595
1596
|
}
|
|
1596
1597
|
};
|
|
1597
1598
|
|
|
1599
|
+
// src/modules/email.ts
|
|
1600
|
+
var Emails = class {
|
|
1601
|
+
constructor(http) {
|
|
1602
|
+
this.http = http;
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Send a custom HTML email
|
|
1606
|
+
* @param options Email options including recipients, subject, and HTML content
|
|
1607
|
+
*/
|
|
1608
|
+
async send(options) {
|
|
1609
|
+
try {
|
|
1610
|
+
const data = await this.http.post(
|
|
1611
|
+
"/api/email/send-raw",
|
|
1612
|
+
options
|
|
1613
|
+
);
|
|
1614
|
+
return { data, error: null };
|
|
1615
|
+
} catch (error) {
|
|
1616
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
1617
|
+
return { data: null, error: normalizedError };
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1598
1622
|
// src/client.ts
|
|
1599
1623
|
var InsForgeClient = class {
|
|
1600
1624
|
constructor(config = {}) {
|
|
@@ -1621,6 +1645,7 @@ var InsForgeClient = class {
|
|
|
1621
1645
|
this.ai = new AI(this.http);
|
|
1622
1646
|
this.functions = new Functions(this.http);
|
|
1623
1647
|
this.realtime = new Realtime(this.http.baseUrl, this.tokenManager);
|
|
1648
|
+
this.emails = new Emails(this.http);
|
|
1624
1649
|
}
|
|
1625
1650
|
/**
|
|
1626
1651
|
* Get the underlying HTTP client for custom requests
|
|
@@ -1654,6 +1679,7 @@ var index_default = InsForgeClient;
|
|
|
1654
1679
|
AI,
|
|
1655
1680
|
Auth,
|
|
1656
1681
|
Database,
|
|
1682
|
+
Emails,
|
|
1657
1683
|
Functions,
|
|
1658
1684
|
HttpClient,
|
|
1659
1685
|
InsForgeClient,
|