@llmnative/react 2.3.0 → 3.0.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/README.md +3 -2
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6768 -6811
- package/dist/index.mjs.map +1 -1
- package/dist/modelIdentity-CIXNPtTA.mjs +624 -0
- package/dist/modelIdentity-CIXNPtTA.mjs.map +1 -0
- package/dist/modelIdentity-DX62i7g2.js +3 -0
- package/dist/modelIdentity-DX62i7g2.js.map +1 -0
- package/dist/server-B430eH0y.mjs +352 -0
- package/dist/server-B430eH0y.mjs.map +1 -0
- package/dist/server-CDheNgME.js +2 -0
- package/dist/server-CDheNgME.js.map +1 -0
- package/dist/server.js +1 -1
- package/dist/server.mjs +3 -3
- package/dist/types/src/App.d.ts +6 -4
- package/dist/types/src/I18n.d.ts +2 -0
- package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/types.d.ts +2 -0
- package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +6 -2
- package/dist/types/src/index.d.ts +21 -8
- package/dist/types/src/libs/index.d.ts +0 -1
- package/dist/types/src/providers/ProviderRegistryContext.d.ts +7 -5
- package/dist/types/src/providers/ai/server.d.ts +20 -0
- package/dist/types/src/providers/api/ApiProvider.d.ts +1 -1
- package/dist/types/src/providers/data/DataProvider.d.ts +29 -0
- package/dist/types/src/providers/data/firebase.d.ts +2 -2
- package/dist/types/src/providers/data/firestore.d.ts +2 -2
- package/dist/types/src/providers/data/query.d.ts +14 -0
- package/dist/types/src/providers/data/useDataSubscription.d.ts +20 -0
- package/dist/types/src/providers/email/EmailError.d.ts +27 -0
- package/dist/types/src/providers/email/EmailProviderContext.d.ts +13 -7
- package/dist/types/src/providers/email/EmailRead.d.ts +48 -0
- package/dist/types/src/providers/email/EmailSend.d.ts +54 -0
- package/dist/types/src/providers/email/brevo/BrevoEmailSender.d.ts +21 -0
- package/dist/types/src/providers/email/definitions.d.ts +4 -2
- package/dist/types/src/providers/email/gmail/GmailEmailReader.d.ts +37 -0
- package/dist/types/src/providers/email/gmail/GmailEmailSender.d.ts +21 -0
- package/dist/types/src/providers/email/gmail/browser.d.ts +10 -0
- package/dist/types/src/providers/email/gmail/gmailApi.d.ts +53 -0
- package/dist/types/src/providers/email/gmail/gmailOAuth.d.ts +25 -0
- package/dist/types/src/providers/email/imap/ImapEmailReader.d.ts +70 -0
- package/dist/types/src/providers/email/resend/ResendEmailSender.d.ts +20 -0
- package/dist/types/src/providers/manifest.d.ts +7 -5
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/llms-full.txt +1690 -1625
- package/llms.txt +83 -82
- package/package.json +18 -1
- package/dist/modelIdentity-CGWliGDU.mjs +0 -183
- package/dist/modelIdentity-CGWliGDU.mjs.map +0 -1
- package/dist/modelIdentity-CgRMrC5H.js +0 -2
- package/dist/modelIdentity-CgRMrC5H.js.map +0 -1
- package/dist/server-CCbjPJEz.js +0 -2
- package/dist/server-CCbjPJEz.js.map +0 -1
- package/dist/server-CiWwr3Zg.mjs +0 -107
- package/dist/server-CiWwr3Zg.mjs.map +0 -1
- package/dist/types/src/libs/email.d.ts +0 -16
- package/dist/types/src/providers/email/EmailProvider.d.ts +0 -10
- package/dist/types/src/providers/email/google/GmailEmailProvider.d.ts +0 -7
- package/dist/types/src/providers/email/google/email.d.ts +0 -13
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type GmailOAuthConfig = {
|
|
2
|
+
clientId: string;
|
|
3
|
+
clientSecret: string;
|
|
4
|
+
/** Where Google comes back with the code: a route of the app's server. */
|
|
5
|
+
redirectUri: string;
|
|
6
|
+
fetch?: typeof fetch;
|
|
7
|
+
};
|
|
8
|
+
export type GmailOAuth = {
|
|
9
|
+
/** The consent page of Google, with a refresh token (offline, consent asked again). */
|
|
10
|
+
authorizationUrl(options: {
|
|
11
|
+
state: string;
|
|
12
|
+
scopes: string[];
|
|
13
|
+
loginHint?: string;
|
|
14
|
+
}): string;
|
|
15
|
+
/** The code Google came back with → the address of the mailbox and its refresh token. */
|
|
16
|
+
exchangeCode(code: string): Promise<{
|
|
17
|
+
email: string;
|
|
18
|
+
refreshToken: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Connecting a Gmail mailbox from a server (CR-130): the consent page, then the refresh token the Gmail
|
|
23
|
+
* adapters take as `auth`. The client secret and the refresh token stay on the server.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createGmailOAuth(config: GmailOAuthConfig): GmailOAuth;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type ProviderConfigurationState } from '../../ProviderConfiguration';
|
|
2
|
+
import { type EmailReadAdapter, type EmailReadBatch, type EmailReadOptions, type EmailReadStart } from '../EmailRead';
|
|
3
|
+
export type ImapEmailReaderConfig = {
|
|
4
|
+
host: string;
|
|
5
|
+
/** Default 993. */
|
|
6
|
+
port?: number;
|
|
7
|
+
/** TLS from the start (default `true`, port 993); `false` for STARTTLS or plain (port 143). */
|
|
8
|
+
secure?: boolean;
|
|
9
|
+
user: string;
|
|
10
|
+
/** The password, or an app password where the provider has them. */
|
|
11
|
+
password: string;
|
|
12
|
+
/** Default `INBOX`. */
|
|
13
|
+
mailbox?: string;
|
|
14
|
+
};
|
|
15
|
+
/** The parts of `imapflow` and `mailparser` the reader uses: injectable for tests. */
|
|
16
|
+
export type ImapModules = {
|
|
17
|
+
ImapFlow: new (options: Record<string, unknown>) => ImapClient;
|
|
18
|
+
simpleParser: (source: Buffer) => Promise<ParsedMail>;
|
|
19
|
+
};
|
|
20
|
+
type ImapClient = {
|
|
21
|
+
connect(): Promise<void>;
|
|
22
|
+
mailboxOpen(path: string, options?: {
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
uidValidity: bigint | number;
|
|
26
|
+
uidNext: number;
|
|
27
|
+
}>;
|
|
28
|
+
fetch(range: string, query: {
|
|
29
|
+
uid?: boolean;
|
|
30
|
+
source?: boolean;
|
|
31
|
+
}, options?: {
|
|
32
|
+
uid?: boolean;
|
|
33
|
+
}): AsyncIterable<{
|
|
34
|
+
uid: number;
|
|
35
|
+
source?: Buffer;
|
|
36
|
+
}>;
|
|
37
|
+
logout(): Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
type ParsedAddress = {
|
|
40
|
+
text?: string;
|
|
41
|
+
};
|
|
42
|
+
type ParsedMail = {
|
|
43
|
+
messageId?: string;
|
|
44
|
+
from?: ParsedAddress;
|
|
45
|
+
to?: ParsedAddress | ParsedAddress[];
|
|
46
|
+
subject?: string;
|
|
47
|
+
date?: Date;
|
|
48
|
+
text?: string;
|
|
49
|
+
html?: string | false;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Reads a mailbox with IMAP (CR-130), for the providers without push: the app calls `read()` every few
|
|
53
|
+
* minutes. The cursor is the UIDVALIDITY of the mailbox and the last UID read; a new UIDVALIDITY (the
|
|
54
|
+
* mailbox renumbered) starts again from now. Server only: it opens a TCP connection. Needs the optional
|
|
55
|
+
* packages `imapflow` and `mailparser`, loaded on the first read.
|
|
56
|
+
*/
|
|
57
|
+
export declare class ImapEmailReader implements EmailReadAdapter {
|
|
58
|
+
private readonly config;
|
|
59
|
+
private readonly options;
|
|
60
|
+
constructor(config: ImapEmailReaderConfig, options?: {
|
|
61
|
+
modules?: () => Promise<ImapModules>;
|
|
62
|
+
});
|
|
63
|
+
getConfigurationState(): ProviderConfigurationState;
|
|
64
|
+
isConfigured(): boolean;
|
|
65
|
+
/** Opens the mailbox read-only, runs `work`, logs out whatever happens. */
|
|
66
|
+
private withMailbox;
|
|
67
|
+
start(): Promise<EmailReadStart>;
|
|
68
|
+
read(cursor: string, { limit }?: EmailReadOptions): Promise<EmailReadBatch>;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ProviderConfigurationState } from '../../ProviderConfiguration';
|
|
2
|
+
import { type EmailRecipient, type EmailSendAdapter, type EmailSendParams, type EmailSendResult } from '../EmailSend';
|
|
3
|
+
export declare const RESEND_EMAIL_URL = "https://api.resend.com/emails";
|
|
4
|
+
export type ResendEmailSenderConfig = {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
/** The default sender, on a domain verified in Resend. */
|
|
7
|
+
from?: EmailRecipient;
|
|
8
|
+
/** The `fetch` to use (a proxy, a test). */
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Sends with Resend (CR-130). The key is a secret: use it on a server, not in a browser bundle.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ResendEmailSender implements EmailSendAdapter {
|
|
15
|
+
private readonly config;
|
|
16
|
+
constructor(config: ResendEmailSenderConfig);
|
|
17
|
+
getConfigurationState(): ProviderConfigurationState;
|
|
18
|
+
isConfigured(): boolean;
|
|
19
|
+
send(params: EmailSendParams): Promise<EmailSendResult>;
|
|
20
|
+
}
|
|
@@ -5,12 +5,13 @@ import type { AIProviderAdapter } from './ai/AIProvider';
|
|
|
5
5
|
import type { DataProviderAdapter } from './data/DataProvider';
|
|
6
6
|
import type { StorageProviderAdapter } from './storage/StorageProvider';
|
|
7
7
|
import type { AuthProviderAdapter } from './auth/AuthProvider';
|
|
8
|
-
import type {
|
|
8
|
+
import type { EmailSendAdapter } from './email/EmailSend';
|
|
9
|
+
import type { EmailReadAdapter } from './email/EmailRead';
|
|
9
10
|
import type { AIConfig, DropboxConfig, FirebaseConfig, GitHubAuthConfig, GoogleOAuth2, GoogleServiceAccount, SupabaseConfig } from '../Config';
|
|
10
11
|
import type { ProviderService } from './ProviderRegistryContext';
|
|
11
|
-
/** The
|
|
12
|
+
/** The 7 built-in categories — alias of ProviderService (ProviderRegistryContext.tsx), derived from ProviderAdapterMap so the two can't drift. */
|
|
12
13
|
export type ServiceCategory = ProviderService;
|
|
13
|
-
type AnyAdapter = DataProviderAdapter | StorageProviderAdapter | AuthProviderAdapter |
|
|
14
|
+
type AnyAdapter = DataProviderAdapter | StorageProviderAdapter | AuthProviderAdapter | EmailSendAdapter | EmailReadAdapter | AIProviderAdapter | CredentialsAdapter;
|
|
14
15
|
export interface DriverDescriptor<TConfig = unknown> {
|
|
15
16
|
service: ServiceCategory;
|
|
16
17
|
create: (config: TConfig) => AnyAdapter;
|
|
@@ -38,14 +39,15 @@ export declare const PROVIDER_MANIFESTS: Record<string, DriverManifest<any>>;
|
|
|
38
39
|
export type DataDriverName = 'dbRealtime' | 'firestoreDb' | 'supabaseDb' | 'mock';
|
|
39
40
|
export type StorageDriverName = 'firestorage' | 'supabaseStorage';
|
|
40
41
|
export type AuthDriverName = 'googleAuth' | 'firebaseAuth' | 'dropboxAuth' | 'supabaseAuth' | 'githubAuth' | 'mockAuth';
|
|
41
|
-
export type
|
|
42
|
+
export type EmailSendDriverName = 'gmail';
|
|
42
43
|
export type AIDriverName = 'openai' | 'openrouter' | 'opencode' | 'opencode-go' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral' | 'cloudflare' | 'groq';
|
|
43
44
|
export type CredentialsDriverName = 'googleServiceAccount';
|
|
44
45
|
export type ServicesConfig = {
|
|
45
46
|
data?: DataDriverName | string;
|
|
46
47
|
storage?: StorageDriverName | string;
|
|
47
48
|
auth?: AuthDriverName | string;
|
|
48
|
-
|
|
49
|
+
emailSend?: EmailSendDriverName | string;
|
|
50
|
+
emailRead?: string;
|
|
49
51
|
ai?: AIDriverName | string;
|
|
50
52
|
credentials?: CredentialsDriverName | string;
|
|
51
53
|
};
|
package/dist/vite.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./logHeader-CUsdmGAo.js"),t=require("./server-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./logHeader-CUsdmGAo.js"),t=require("./server-CDheNgME.js");let n=require("node:fs/promises"),r=require("node:path");r=e.r(r);var i=`x-llmnative-proxy`,a=`/api/proxy`,o=async e=>{let t=[];for await(let n of e)t.push(Buffer.isBuffer(n)?n:Buffer.from(n));return t.length===0?void 0:Buffer.concat(t)};function s(e){return e.replace(/[^a-zA-Z0-9_-]/g,``).slice(0,128)||`unknown`}function c(e){if(!e.trim())return`(empty body)`;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}async function l(e,t,i,a,o,l){try{await(0,n.mkdir)(e.dir,{recursive:!0});let u=[``,`=`.repeat(80),`Turn @ ${new Date().toISOString()}`,`Target: ${i}`,`--- REQUEST BODY ---`,c(a),`--- RESPONSE BODY (status ${o}) ---`,c(l),`=`.repeat(80),``].join(`
|
|
2
2
|
`);await(0,n.appendFile)(r.default.join(e.dir,`${s(t)}.txt`),u,`utf-8`)}catch(e){console.warn(`[llmnative-dev-proxy] Failed to write LLM log:`,e)}}var u=async(n,r,a,s,c)=>{let u=new URL(n.url||`/`,`http://localhost`).searchParams.get(`url`);if(n.headers[i]!==`1`){r.statusCode=403,r.setHeader(`Content-Type`,`application/json`),r.end(JSON.stringify({error:`Proxy access denied.`}));return}if(!u){r.statusCode=400,r.setHeader(`Content-Type`,`application/json`),r.end(JSON.stringify({error:`Missing "url" query parameter.`}));return}try{let d=new URL(u);if(d.pathname.startsWith(a)&&[`localhost`,`127.0.0.1`].includes(d.hostname)){r.statusCode=508,r.setHeader(`Content-Type`,`application/json`),r.end(JSON.stringify({error:`Recursive proxy target detected.`,target:u}));return}let f=await o(n),p=n.headers[e.t],m=new Headers,h=new Set([i,e.t,`host`,`origin`,`referer`,`content-length`,`transfer-encoding`,`connection`]);Object.entries(n.headers).forEach(([e,t])=>{t&&!h.has(e.toLowerCase())&&m.set(e,Array.isArray(t)?t.join(`, `):t)});let g=await t.t({url:u,headers:Object.fromEntries(m)},c??(()=>void 0));if(!g.ok){r.statusCode=g.status,r.setHeader(`Content-Type`,`application/json`),r.end(JSON.stringify({error:g.error,provider:g.provider}));return}let _=await fetch(g.url,{method:n.method||`GET`,headers:new Headers(g.headers),body:f&&![`GET`,`HEAD`].includes((n.method||`GET`).toUpperCase())?Uint8Array.from(f):void 0,redirect:`follow`}),v=Buffer.from(await _.arrayBuffer());s?.enabled&&typeof p==`string`&&p&&l(s,p,u,f?.toString(`utf-8`)??``,_.status,v.toString(`utf-8`)),r.statusCode=_.status,_.headers.forEach((e,t)=>{t.toLowerCase()!==`content-encoding`&&r.setHeader(t,e)}),r.end(v)}catch(e){r.statusCode=502,r.setHeader(`Content-Type`,`application/json`),r.end(JSON.stringify({error:e instanceof Error?e.message:`Proxy request failed.`}))}},d=(e=a,t,n)=>({name:`llmnative-dev-proxy`,configureServer(r){r.middlewares.use(e,(r,i)=>{u(r,i,e,t,n)})},configurePreviewServer(r){r.middlewares.use(e,(r,i)=>{u(r,i,e,t,n)})}});exports.PROXY_PATH=a,exports.createProxyPlugin=d;
|
|
3
3
|
//# sourceMappingURL=vite.js.map
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./logHeader-Busbc8OO.mjs";
|
|
2
|
-
import { t } from "./server-
|
|
2
|
+
import { t } from "./server-B430eH0y.mjs";
|
|
3
3
|
import { appendFile as n, mkdir as r } from "node:fs/promises";
|
|
4
4
|
import i from "node:path";
|
|
5
5
|
//#region src/providers/proxy/vite.ts
|