@llmnative/react 0.1.1 → 1.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 +387 -364
- package/bin/cli.js +117 -98
- package/dist/index.css +1 -1
- package/dist/index.js +21 -823
- package/dist/index.mjs +14246 -9296
- package/dist/style.css +1 -0
- package/dist/types/src/App.d.ts +72 -14
- package/dist/types/src/Config.d.ts +28 -5
- package/dist/types/src/Global.d.ts +2 -2
- package/dist/types/src/I18n.d.ts +185 -0
- package/dist/types/src/Theme.d.ts +153 -81
- package/dist/types/src/auth.d.ts +13 -1
- package/dist/types/src/components/Component.d.ts +13 -27
- package/dist/types/src/components/ErrorBoundary.d.ts +30 -0
- package/dist/types/src/components/blocks/Brand.d.ts +4 -4
- package/dist/types/src/components/blocks/Breadcrumbs.d.ts +50 -4
- package/dist/types/src/components/blocks/Carousel.d.ts +5 -5
- package/dist/types/src/components/blocks/Dropdown.d.ts +26 -20
- package/dist/types/src/components/blocks/ListCard.d.ts +31 -0
- package/dist/types/src/components/blocks/Menu.d.ts +13 -16
- package/dist/types/src/components/blocks/Notifications.d.ts +8 -3
- package/dist/types/src/components/blocks/ProviderSwitcher.d.ts +63 -0
- package/dist/types/src/components/blocks/Search.d.ts +2 -2
- package/dist/types/src/components/blocks/SideNav.d.ts +45 -0
- package/dist/types/src/components/blocks/ThemeSwitcher.d.ts +24 -0
- package/dist/types/src/components/blocks/Toolbar.d.ts +19 -0
- package/dist/types/src/components/index.d.ts +27 -6
- package/dist/types/src/components/types.d.ts +10 -3
- package/dist/types/src/components/ui/Alert.d.ts +16 -4
- package/dist/types/src/components/ui/Badge.d.ts +6 -5
- package/dist/types/src/components/ui/Buttons.d.ts +13 -12
- package/dist/types/src/components/ui/Card.d.ts +8 -7
- package/dist/types/src/components/ui/Code.d.ts +1 -1
- package/dist/types/src/components/ui/Gallery.d.ts +13 -14
- package/dist/types/src/components/ui/GridSystem.d.ts +1 -1
- package/dist/types/src/components/ui/Icon.d.ts +3 -1
- package/dist/types/src/components/ui/Image.d.ts +1 -1
- package/dist/types/src/components/ui/ImageAvatar.d.ts +1 -1
- package/dist/types/src/components/ui/Loader.d.ts +1 -1
- package/dist/types/src/components/ui/LocaleSwitcher.d.ts +14 -0
- package/dist/types/src/components/ui/Modal.d.ts +42 -15
- package/dist/types/src/components/ui/Pagination.d.ts +14 -3
- package/dist/types/src/components/ui/Percentage.d.ts +5 -5
- package/dist/types/src/components/ui/Repeat.d.ts +15 -6
- package/dist/types/src/components/ui/Tab.d.ts +29 -2
- package/dist/types/src/components/ui/TabDynamic.d.ts +4 -3
- package/dist/types/src/components/ui/Table.d.ts +15 -14
- package/dist/types/src/components/ui/fields/CodeEditor.d.ts +43 -0
- package/dist/types/src/components/ui/fields/ContextMenu.d.ts +38 -0
- package/dist/types/src/components/ui/fields/Crop.d.ts +4 -2
- package/dist/types/src/components/ui/fields/ImageField.d.ts +31 -0
- package/dist/types/src/components/ui/fields/Input.d.ts +43 -14
- package/dist/types/src/components/ui/fields/Prompt.d.ts +2 -31
- package/dist/types/src/components/ui/fields/RichText.d.ts +86 -0
- package/dist/types/src/components/ui/fields/Select.d.ts +13 -10
- package/dist/types/src/components/ui/fields/Upload.d.ts +37 -2
- package/dist/types/src/components/ui/fields/UploadCSV.d.ts +2 -0
- package/dist/types/src/components/ui/useRecordSelection.d.ts +1 -2
- package/dist/types/src/components/widgets/Form.d.ts +80 -43
- package/dist/types/src/components/widgets/ImageEditor.d.ts +4 -5
- package/dist/types/src/components/widgets/MarkdownReader.d.ts +4 -4
- package/dist/types/src/components/widgets/Prompt.d.ts +71 -23
- package/dist/types/src/components/widgets/TabDynamic.d.ts +4 -3
- package/dist/types/src/components/widgets/form-controller.d.ts +42 -0
- package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridDB.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridGalleryView.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridTableView.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/types.d.ts +77 -27
- package/dist/types/src/components/widgets/grid-core/useGridActions.d.ts +4 -8
- package/dist/types/src/components/widgets/grid-core/useGridColumns.d.ts +2 -2
- package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +1 -2
- package/dist/types/src/components/widgets/grid-core/useGridPreparedRecords.d.ts +2 -2
- package/dist/types/src/components/widgets/grid-core/useGridSelection.d.ts +4 -5
- package/dist/types/src/components/widgets/grid-core/utils.d.ts +11 -3
- package/dist/types/src/conf/Prompt.d.ts +1 -1
- package/dist/types/src/conf/i18n/ar.d.ts +2 -0
- package/dist/types/src/conf/i18n/de.d.ts +2 -0
- package/dist/types/src/conf/i18n/en.d.ts +2 -0
- package/dist/types/src/conf/i18n/index.d.ts +6 -0
- package/dist/types/src/conf/i18n/it.d.ts +2 -0
- package/dist/types/src/conf/i18n/ru.d.ts +2 -0
- package/dist/types/src/conf/i18n/zh.d.ts +2 -0
- package/dist/types/src/constant.d.ts +1 -1
- package/dist/types/src/index.d.ts +38 -13
- package/dist/types/src/libs/converter.d.ts +4 -4
- package/dist/types/src/libs/editorHeight.d.ts +12 -0
- package/dist/types/src/libs/fetch.d.ts +4 -4
- package/dist/types/src/libs/imageBuilder.d.ts +63 -14
- package/dist/types/src/libs/imageVariants.d.ts +35 -0
- package/dist/types/src/libs/index.d.ts +1 -4
- package/dist/types/src/libs/promptUtils.d.ts +24 -0
- package/dist/types/src/libs/sanitizer.d.ts +2 -2
- package/dist/types/src/libs/utils.d.ts +9 -10
- package/dist/types/src/pages/index.d.ts +0 -2
- package/dist/types/src/providers/ProviderConfiguration.d.ts +6 -0
- package/dist/types/src/providers/ProviderRegistryContext.d.ts +51 -0
- package/dist/types/src/providers/ProviderSession.d.ts +68 -0
- package/dist/types/src/providers/ai/AIProvider.d.ts +57 -0
- package/dist/types/src/providers/ai/AIProviderContext.d.ts +13 -0
- package/dist/types/src/providers/ai/anthropic.d.ts +2 -0
- package/dist/types/src/providers/ai/deepseek.d.ts +1 -0
- package/dist/types/src/providers/ai/gemini.d.ts +2 -0
- package/dist/types/src/providers/ai/glm.d.ts +1 -0
- package/dist/types/src/providers/ai/index.d.ts +9 -134
- package/dist/types/src/providers/ai/mistral.d.ts +1 -0
- package/dist/types/src/providers/ai/openai.d.ts +1 -0
- package/dist/types/src/providers/ai/openaiCompatible.d.ts +17 -0
- package/dist/types/src/providers/ai/opencode.d.ts +2 -0
- package/dist/types/src/providers/ai/openrouter.d.ts +1 -0
- package/dist/types/src/providers/ai/shared.d.ts +46 -0
- package/dist/types/src/providers/api/ApiProvider.d.ts +43 -0
- package/dist/types/src/providers/api/direct.d.ts +14 -0
- package/dist/types/src/providers/api/firebase.d.ts +14 -0
- package/dist/types/src/providers/api/mock.d.ts +7 -0
- package/dist/types/src/providers/api/supabase.d.ts +14 -0
- package/dist/types/src/providers/auth/AuthProvider.d.ts +2 -2
- package/dist/types/src/providers/auth/firebase/FirebaseAuthProvider.d.ts +26 -0
- package/dist/types/src/providers/auth/google/GoogleAuth.d.ts +2 -2
- package/dist/types/src/providers/auth/supabase/SupabaseAuthProvider.d.ts +48 -0
- package/dist/types/src/providers/credentials/CredentialsProvider.d.ts +3 -0
- package/dist/types/src/providers/credentials/CredentialsProviderContext.d.ts +12 -0
- package/dist/types/src/providers/credentials/google/GoogleServiceAccountProvider.d.ts +8 -0
- package/dist/types/src/providers/data/DataProvider.d.ts +27 -1
- package/dist/types/src/providers/data/firebase.d.ts +5 -4
- package/dist/types/src/providers/data/firestore.d.ts +38 -0
- package/dist/types/src/providers/data/mock.d.ts +8 -1
- package/dist/types/src/providers/data/supabase.d.ts +36 -10
- package/dist/types/src/providers/firebase-init.d.ts +15 -4
- package/dist/types/src/providers/icon/PhosphorIconProvider.d.ts +1 -1
- package/dist/types/src/providers/manifest.d.ts +20 -14
- package/dist/types/src/providers/proxy/index.d.ts +7 -0
- package/dist/types/src/providers/proxy/vite.d.ts +3 -0
- package/dist/types/src/providers/scrape/index.d.ts +2 -1
- package/dist/types/src/providers/seo/google/keyword.d.ts +6 -1
- package/dist/types/src/providers/storage/StorageProvider.d.ts +155 -4
- package/dist/types/src/providers/storage/dropbox.d.ts +3 -3
- package/dist/types/src/providers/storage/firebase.d.ts +38 -7
- package/dist/types/src/providers/storage/supabase.d.ts +47 -7
- package/dist/types/src/providers/supabase-init.d.ts +35 -0
- package/dist/types/src/types/FormFields.d.ts +4 -2
- package/dist/types/src/types/FormSchema.d.ts +29 -0
- package/dist/types/themes/tokyo-night-light.d.ts +3 -0
- package/dist/types/themes/tokyo-night.d.ts +3 -0
- package/dist/types/themes/vscode-dark-plus.d.ts +3 -0
- package/dist/types/themes/vscode-light-plus.d.ts +3 -0
- package/dist/vite.js +1 -0
- package/dist/vite.mjs +54 -0
- package/package.json +40 -9
- package/scripts/cli/proxy-templates/cloudflare.ts +34 -0
- package/scripts/cli/proxy-templates/express.ts +77 -0
- package/scripts/cli/proxy-templates/nextjs-app.ts +42 -0
- package/scripts/cli/proxy-templates/nextjs-pages.ts +41 -0
- package/scripts/cli/proxy-templates/scaffold.json +33 -0
- package/scripts/cli/setup-devtools.js +155 -85
- package/scripts/cli/setup-project.js +618 -484
- package/themes/cyber.ts +469 -405
- package/themes/default.ts +469 -405
- package/themes/flat.ts +469 -405
- package/themes/tokyo-night-light.ts +38 -0
- package/themes/tokyo-night.ts +38 -0
- package/themes/vscode-dark-plus.ts +29 -0
- package/themes/vscode-light-plus.ts +29 -0
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/types/src/components/FormEnhancer.d.ts +0 -26
- package/dist/types/src/components/Template.d.ts +0 -18
- package/dist/types/src/components/ui/fields/AssistantAI.d.ts +0 -23
- package/dist/types/src/components/ui/fields/Command.d.ts +0 -15
- package/dist/types/src/components/ui/fields/ImageUrl.d.ts +0 -7
- package/dist/types/src/libs/cache.d.ts +0 -9
- package/dist/types/src/libs/database.d.ts +0 -3
- package/dist/types/src/libs/log.d.ts +0 -2
- package/dist/types/src/libs/seo.d.ts +0 -8
- package/dist/types/src/libs/storage.d.ts +0 -2
- package/dist/types/src/pages/Blog.d.ts +0 -3
- package/dist/types/src/pages/BlogPost.d.ts +0 -16
- package/dist/types/src/pages/Helper.d.ts +0 -8
- package/dist/types/src/providers/auth/google/apis/auth.d.ts +0 -4
- package/dist/types/src/types/Block.d.ts +0 -4
- package/dist/types/src/types/Section.d.ts +0 -4
|
@@ -1,19 +1,45 @@
|
|
|
1
|
-
import { DataProviderAdapter, DatabaseOptions, ReadOptions, RecordArray } from
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
1
|
+
import { DataProviderAdapter, DatabaseOptions, ReadOptions, SetChunksOptions, RecordArray } from './DataProvider';
|
|
2
|
+
import type { ProviderConfigurationState } from '../ProviderConfiguration';
|
|
3
|
+
export interface SupabaseDataConfig {
|
|
4
4
|
url: string;
|
|
5
5
|
anonKey: string;
|
|
6
|
+
/**
|
|
7
|
+
* Name of the primary-key column in every Supabase table.
|
|
8
|
+
* Default: 'id'. Must be a text/uuid column.
|
|
9
|
+
*/
|
|
10
|
+
primaryKey?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Tenant-session JWT signed by the control-plane, scoped to this project.
|
|
13
|
+
* When present, the adapter uses an uncached, disposable client with this
|
|
14
|
+
* bearer token instead of the shared single-project client — see
|
|
15
|
+
* createSupabaseClient() in supabase-init.ts.
|
|
16
|
+
*/
|
|
17
|
+
accessToken?: string;
|
|
6
18
|
}
|
|
7
19
|
export declare class SupabaseDataProvider implements DataProviderAdapter {
|
|
8
20
|
private config;
|
|
9
|
-
|
|
21
|
+
private get pk();
|
|
22
|
+
private scopedClient;
|
|
23
|
+
private get client();
|
|
24
|
+
constructor(config: SupabaseDataConfig);
|
|
25
|
+
/** Force-closes any realtime channels left open before this adapter is discarded. No-op for the shared (non-scoped) client. */
|
|
26
|
+
dispose: () => Promise<void>;
|
|
10
27
|
getConfigurationState(): ProviderConfigurationState;
|
|
11
28
|
isConfigured(): boolean;
|
|
12
|
-
read: (path: string,
|
|
13
|
-
set: (path: string, data: object) => Promise<void>;
|
|
14
|
-
update: (path: string, data: object) => Promise<void>;
|
|
15
|
-
remove: (path: string) => Promise<void>;
|
|
16
|
-
|
|
29
|
+
read: (path: string, options?: ReadOptions) => Promise<any>;
|
|
30
|
+
set: (path: string, data: object, exception?: boolean) => Promise<void>;
|
|
31
|
+
update: (path: string, data: object, exception?: boolean) => Promise<void>;
|
|
32
|
+
remove: (path: string, exception?: boolean) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Real-time subscription via Supabase Postgres Changes.
|
|
35
|
+
* Requires the table to have Realtime enabled in the Supabase dashboard.
|
|
36
|
+
* Falls back gracefully if the channel cannot be created.
|
|
37
|
+
*/
|
|
38
|
+
subscribe: (path: string | undefined, setRecords: (records: RecordArray) => void, options?: DatabaseOptions) => (() => void);
|
|
17
39
|
count: (path: string) => Promise<number>;
|
|
40
|
+
/**
|
|
41
|
+
* Writes a large dataset in batches.
|
|
42
|
+
* If opts.purge = true, deletes all existing rows before writing.
|
|
43
|
+
*/
|
|
44
|
+
setChunks: (path: string, data: object, opts?: SetChunksOptions) => Promise<void>;
|
|
18
45
|
}
|
|
19
|
-
export {};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Auth } from "firebase/auth";
|
|
1
|
+
import { type FirebaseApp } from 'firebase/app';
|
|
2
|
+
import { type Auth } from "firebase/auth";
|
|
4
3
|
import { FirebaseConfig } from "../Config";
|
|
5
4
|
import { type ProviderConfigurationState } from "./ProviderConfiguration";
|
|
6
5
|
export declare const setFirebaseConfigState: (config: FirebaseConfig | undefined) => void;
|
|
7
6
|
export declare const getFirebaseConfigurationState: () => ProviderConfigurationState;
|
|
7
|
+
export declare const getFirestoreConfigurationState: () => ProviderConfigurationState;
|
|
8
8
|
export declare const getSafeAuth: () => Auth | null;
|
|
9
|
-
declare const
|
|
9
|
+
export declare const getFirebaseAuthorization: () => Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Signs into the currently-initialized Firebase app using a custom token minted
|
|
12
|
+
* server-side (Admin SDK createCustomToken()) and scoped to a specific project —
|
|
13
|
+
* the multi-tenant session-switch path, distinct from the Google-login flow above.
|
|
14
|
+
*
|
|
15
|
+
* Forces in-memory persistence: this session must never survive a reload or be
|
|
16
|
+
* written to IndexedDB/localStorage by the SDK's default persistence behavior.
|
|
17
|
+
* Call init(config) to point the app at the right project *before* calling this.
|
|
18
|
+
*/
|
|
19
|
+
export declare const signInWithFirebaseCustomToken: (token: string) => Promise<boolean>;
|
|
20
|
+
declare const init: (config: FirebaseConfig) => Promise<FirebaseApp>;
|
|
10
21
|
export default init;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { IconProviderAdapter, IconComponentProps } from './IconProvider';
|
|
3
3
|
export type PhosphorWeight = 'thin' | 'light' | 'regular' | 'bold' | 'fill' | 'duotone';
|
|
4
4
|
export declare class PhosphorIconProvider implements IconProviderAdapter {
|
|
5
|
-
|
|
5
|
+
weight: PhosphorWeight;
|
|
6
6
|
readonly id: "phosphor";
|
|
7
7
|
private readonly _cache;
|
|
8
8
|
constructor(weight?: PhosphorWeight);
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
import type { CredentialsAdapter } from './credentials/CredentialsProvider';
|
|
1
2
|
import { MockDataProvider } from './data/mock';
|
|
3
|
+
import type { AIProviderAdapter } from './ai/AIProvider';
|
|
2
4
|
import type { DataProviderAdapter } from './data/DataProvider';
|
|
3
5
|
import type { StorageProviderAdapter } from './storage/StorageProvider';
|
|
4
6
|
import type { AuthProviderAdapter } from './auth/AuthProvider';
|
|
5
7
|
import type { EmailProviderAdapter } from './email/EmailProvider';
|
|
6
|
-
import type { DropboxConfig, FirebaseConfig, GoogleOAuth2, GoogleServiceAccount } from '../Config';
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import type { AIConfig, DropboxConfig, FirebaseConfig, GoogleOAuth2, GoogleServiceAccount, SupabaseConfig } from '../Config';
|
|
9
|
+
import type { ProviderService } from './ProviderRegistryContext';
|
|
10
|
+
/** The 6 built-in categories — alias of ProviderService (ProviderRegistryContext.tsx), derived from ProviderAdapterMap so the two can't drift. */
|
|
11
|
+
export type ServiceCategory = ProviderService;
|
|
12
|
+
type AnyAdapter = DataProviderAdapter | StorageProviderAdapter | AuthProviderAdapter | EmailProviderAdapter | AIProviderAdapter | CredentialsAdapter;
|
|
9
13
|
export interface DriverDescriptor<TConfig = unknown> {
|
|
10
14
|
service: ServiceCategory;
|
|
11
15
|
create: (config: TConfig) => AnyAdapter;
|
|
16
|
+
when?: (config: TConfig) => boolean;
|
|
12
17
|
}
|
|
13
18
|
export type DriverManifest<TConfig> = Record<string, DriverDescriptor<TConfig>>;
|
|
14
19
|
export type GoogleProviderConfig = GoogleOAuth2 & {
|
|
15
20
|
serviceAccount?: GoogleServiceAccount;
|
|
16
21
|
developerToken?: string;
|
|
17
22
|
};
|
|
18
|
-
export type SupabaseProviderConfig =
|
|
19
|
-
url: string;
|
|
20
|
-
anonKey: string;
|
|
21
|
-
bucket?: string;
|
|
22
|
-
};
|
|
23
|
+
export type SupabaseProviderConfig = SupabaseConfig;
|
|
23
24
|
export type MockProviderConfig = {
|
|
24
25
|
data?: ConstructorParameters<typeof MockDataProvider>[0];
|
|
25
26
|
};
|
|
@@ -28,15 +29,20 @@ export declare const GOOGLE_MANIFEST: DriverManifest<GoogleProviderConfig>;
|
|
|
28
29
|
export declare const DROPBOX_MANIFEST: DriverManifest<DropboxConfig>;
|
|
29
30
|
export declare const SUPABASE_MANIFEST: DriverManifest<SupabaseProviderConfig>;
|
|
30
31
|
export declare const MOCK_MANIFEST: DriverManifest<MockProviderConfig>;
|
|
32
|
+
export declare const AI_MANIFEST: DriverManifest<AIConfig>;
|
|
31
33
|
export declare const PROVIDER_MANIFESTS: Record<string, DriverManifest<any>>;
|
|
32
|
-
export type DataDriverName = 'dbRealtime' | 'supabaseDb' | 'mock';
|
|
34
|
+
export type DataDriverName = 'dbRealtime' | 'firestoreDb' | 'supabaseDb' | 'mock';
|
|
33
35
|
export type StorageDriverName = 'firestorage' | 'supabaseStorage';
|
|
34
|
-
export type AuthDriverName = 'googleAuth' | 'dropboxAuth';
|
|
36
|
+
export type AuthDriverName = 'googleAuth' | 'firebaseAuth' | 'dropboxAuth' | 'supabaseAuth';
|
|
35
37
|
export type EmailDriverName = 'gmail';
|
|
38
|
+
export type AIDriverName = 'openai' | 'openrouter' | 'opencode' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral';
|
|
39
|
+
export type CredentialsDriverName = 'googleServiceAccount';
|
|
36
40
|
export type ServicesConfig = {
|
|
37
|
-
data?: DataDriverName;
|
|
38
|
-
storage?: StorageDriverName;
|
|
39
|
-
auth?: AuthDriverName;
|
|
40
|
-
email?: EmailDriverName;
|
|
41
|
+
data?: DataDriverName | string;
|
|
42
|
+
storage?: StorageDriverName | string;
|
|
43
|
+
auth?: AuthDriverName | string;
|
|
44
|
+
email?: EmailDriverName | string;
|
|
45
|
+
ai?: AIDriverName | string;
|
|
46
|
+
credentials?: CredentialsDriverName | string;
|
|
41
47
|
};
|
|
42
48
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProxyConfig } from '../../Config';
|
|
2
|
+
export declare const PROXY_CALLER_HEADER = "x-llmnative-proxy";
|
|
3
|
+
export declare const DEFAULT_PROXY_ROUTE = "/api/proxy";
|
|
4
|
+
export declare const configureProxy: (config?: ProxyConfig) => void;
|
|
5
|
+
export declare const proxyFetch: typeof fetch;
|
|
6
|
+
export declare const useProxy: () => typeof fetch;
|
|
7
|
+
export declare const isProxyEnabled: () => boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DataProviderAdapter } from "../../providers/data/DataProvider";
|
|
2
|
+
declare const fetchScrape: (dataProvider: DataProviderAdapter) => {
|
|
2
3
|
googleSearch: (search: string) => Promise<any>;
|
|
3
4
|
googleImages: (search: string) => Promise<any>;
|
|
4
5
|
googleAutocomplete: (search: string) => Promise<any>;
|
|
@@ -10,5 +10,10 @@ type GetKeywordIdeasParams = {
|
|
|
10
10
|
geoCode?: string;
|
|
11
11
|
languageCode?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare function getKeywordIdeas({ keyword, googleAdsAccountId, geoCode, languageCode, }: GetKeywordIdeasParams): Promise<
|
|
13
|
+
export declare function getKeywordIdeas({ keyword, googleAdsAccountId, geoCode, languageCode, }: GetKeywordIdeasParams): Promise<{
|
|
14
|
+
keyword: string | undefined;
|
|
15
|
+
avgMonthlySearches: number;
|
|
16
|
+
competition: string;
|
|
17
|
+
cpc: number | null;
|
|
18
|
+
}[]>;
|
|
14
19
|
export {};
|
|
@@ -1,7 +1,158 @@
|
|
|
1
1
|
import type { ProviderConfigurable } from '../ProviderConfiguration';
|
|
2
|
+
export interface UploadOptions {
|
|
3
|
+
/** Target bucket. Falls back to the provider's default bucket if omitted. */
|
|
4
|
+
bucket?: string;
|
|
5
|
+
/** MIME type hint (e.g. 'image/png'). Provider may infer it from the file when omitted. */
|
|
6
|
+
contentType?: string;
|
|
7
|
+
/** Called during upload with the completion percentage (0-100). */
|
|
8
|
+
onProgress?: (percent: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface StorageOptions {
|
|
11
|
+
/** Target bucket. Falls back to the provider's default bucket if omitted. */
|
|
12
|
+
bucket?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DeleteOptions extends StorageOptions {
|
|
15
|
+
/**
|
|
16
|
+
* When true, deletes all files under the given path prefix (folder delete).
|
|
17
|
+
* Returns the total number of files deleted.
|
|
18
|
+
* Default: false - deletes a single file and returns 0 (not found) or 1 (deleted).
|
|
19
|
+
*/
|
|
20
|
+
recursive?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface MoveOptions extends StorageOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Destination bucket. Falls back to the source bucket if omitted.
|
|
25
|
+
* Only relevant for cross-bucket moves.
|
|
26
|
+
*/
|
|
27
|
+
destBucket?: string;
|
|
28
|
+
/**
|
|
29
|
+
* When true, treats `from` as a folder prefix and moves every file under it
|
|
30
|
+
* to the corresponding path under `to`. Returns the number of files moved.
|
|
31
|
+
* Default: false - moves a single file.
|
|
32
|
+
*/
|
|
33
|
+
recursive?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface ListOptions extends StorageOptions {
|
|
36
|
+
/** Traverse sub-folders and return files at any depth. Default: false (direct children only). */
|
|
37
|
+
recursive?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Include file entries in the results.
|
|
40
|
+
* Default: true.
|
|
41
|
+
*/
|
|
42
|
+
includeFiles?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Include virtual folder/directory entries in the results.
|
|
45
|
+
* Default: false. When true, folder entries have isFolder: true.
|
|
46
|
+
*/
|
|
47
|
+
includeFolders?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Only return files whose extension matches.
|
|
50
|
+
* Case-insensitive. Pass a single string ('jpg') or an array (['jpg', 'png']).
|
|
51
|
+
* Has no effect on folder entries.
|
|
52
|
+
*/
|
|
53
|
+
filterByExtension?: string | string[];
|
|
54
|
+
/**
|
|
55
|
+
* Maximum number of entries to return (applied after all other filters).
|
|
56
|
+
* Omit for no limit.
|
|
57
|
+
*/
|
|
58
|
+
limit?: number;
|
|
59
|
+
/**
|
|
60
|
+
* When true, fetches size / contentType / updatedAt for each file.
|
|
61
|
+
* On Firebase this requires one extra network call per file (N+1).
|
|
62
|
+
* On Supabase metadata is always available at no extra cost.
|
|
63
|
+
* Default: false.
|
|
64
|
+
*/
|
|
65
|
+
metadata?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface StorageFileInfo {
|
|
68
|
+
/** Filename without the directory prefix. */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Full path as stored in the provider (e.g. "images/avatar.png"). */
|
|
71
|
+
path: string;
|
|
72
|
+
size?: number;
|
|
73
|
+
contentType?: string;
|
|
74
|
+
updatedAt?: string;
|
|
75
|
+
/** Present and true when this entry represents a virtual folder (only when includeFolders: true). */
|
|
76
|
+
isFolder?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Handle returned by createUpload - allows pause, resume and cancel mid-flight.
|
|
80
|
+
* pause() and resume() are no-ops on providers that do not support them (e.g. Supabase via fetch).
|
|
81
|
+
*/
|
|
82
|
+
export interface UploadHandle {
|
|
83
|
+
/** Resolves to the public download URL when the upload completes, or undefined on failure/cancel. */
|
|
84
|
+
readonly url: Promise<string | undefined>;
|
|
85
|
+
/** Pauses the upload. No-op if the provider does not support it. */
|
|
86
|
+
pause(): void;
|
|
87
|
+
/** Resumes a paused upload. No-op if the provider does not support it. */
|
|
88
|
+
resume(): void;
|
|
89
|
+
/** Cancels the upload. Always supported. */
|
|
90
|
+
cancel(): void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Common storage interface (Ports & Adapters).
|
|
94
|
+
* Concrete implementations: FirebaseStorageProvider, SupabaseStorageProvider.
|
|
95
|
+
*
|
|
96
|
+
* All methods accept an optional `opts.bucket` to target a specific bucket
|
|
97
|
+
* instead of the provider's configured default.
|
|
98
|
+
*/
|
|
2
99
|
export interface StorageProviderAdapter extends ProviderConfigurable {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Upload a file and return its public download URL.
|
|
102
|
+
* Accepts a data URL string, a File, or a Blob.
|
|
103
|
+
* Fire-and-forget: no pause/resume. Use createUpload() for controllable uploads.
|
|
104
|
+
*/
|
|
105
|
+
upload(file: string | File | Blob, path: string, opts?: UploadOptions): Promise<string | undefined>;
|
|
106
|
+
/**
|
|
107
|
+
* Start a controllable upload and return a handle with pause / resume / cancel.
|
|
108
|
+
* pause() and resume() are no-ops on Supabase (only Firebase supports them natively).
|
|
109
|
+
*/
|
|
110
|
+
createUpload(file: string | File | Blob, path: string, opts?: UploadOptions): UploadHandle;
|
|
111
|
+
/**
|
|
112
|
+
* Rename a file or folder in place (same parent directory, new name).
|
|
113
|
+
* For folder rename, set opts.recursive = true.
|
|
114
|
+
* Semantically equivalent to move() - use rename() when only the name changes,
|
|
115
|
+
* move() when relocating across directories or buckets.
|
|
116
|
+
* Returns true if at least one file was successfully renamed.
|
|
117
|
+
*/
|
|
118
|
+
rename(from: string, to: string, opts?: MoveOptions): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Move a file or folder to a different path, directory, or bucket.
|
|
121
|
+
* For folder move, set opts.recursive = true.
|
|
122
|
+
* Use opts.destBucket to move across buckets.
|
|
123
|
+
* Returns the number of files successfully moved (0 on failure, 1 for single file).
|
|
124
|
+
*/
|
|
125
|
+
move(from: string, to: string, opts?: MoveOptions): Promise<number>;
|
|
126
|
+
/** Return the public download URL for a stored file. */
|
|
127
|
+
getURL(path: string, opts?: StorageOptions): Promise<string | undefined>;
|
|
128
|
+
/**
|
|
129
|
+
* Return metadata for a single file.
|
|
130
|
+
* Returns undefined if the file does not exist.
|
|
131
|
+
*/
|
|
132
|
+
getFileInfo(path: string, opts?: StorageOptions): Promise<StorageFileInfo | undefined>;
|
|
133
|
+
/** Download a file as a Blob. */
|
|
134
|
+
download(path: string, opts?: StorageOptions): Promise<Blob | undefined>;
|
|
135
|
+
/**
|
|
136
|
+
* Delete a file or all files under a folder prefix.
|
|
137
|
+
* Returns the number of files deleted:
|
|
138
|
+
* - Single file (default): 0 if not found, 1 if deleted.
|
|
139
|
+
* - Folder (opts.recursive = true): total files deleted.
|
|
140
|
+
*/
|
|
141
|
+
delete(path: string, opts?: DeleteOptions): Promise<number>;
|
|
142
|
+
/**
|
|
143
|
+
* List files (and optionally folders) under a path prefix.
|
|
144
|
+
*
|
|
145
|
+
* Key options:
|
|
146
|
+
* recursive - traverse sub-folders (default: false, direct children only)
|
|
147
|
+
* includeFiles - include file entries (default: true)
|
|
148
|
+
* includeFolders - include folder entries with isFolder: true (default: false)
|
|
149
|
+
* filterByExtension - case-insensitive extension filter: 'jpg' or ['jpg','png']
|
|
150
|
+
* limit - cap the number of results after all other filters
|
|
151
|
+
* metadata - fetch size/contentType/updatedAt (N+1 cost on Firebase)
|
|
152
|
+
*/
|
|
153
|
+
list(path: string, opts?: ListOptions): Promise<StorageFileInfo[]>;
|
|
7
154
|
}
|
|
155
|
+
/** Returns true if `filename` matches any of the allowed extensions. Case-insensitive. */
|
|
156
|
+
export declare function matchesExtension(filename: string, filter: string | string[]): boolean;
|
|
157
|
+
/** Apply limit and extension filter to a list of StorageFileInfo entries. */
|
|
158
|
+
export declare function applyListFilters(items: StorageFileInfo[], opts: ListOptions): StorageFileInfo[];
|
|
@@ -10,7 +10,7 @@ type PathEntry = {
|
|
|
10
10
|
};
|
|
11
11
|
type ThumbnailEntry = {
|
|
12
12
|
path: string;
|
|
13
|
-
[key: string]:
|
|
13
|
+
[key: string]: unknown;
|
|
14
14
|
};
|
|
15
15
|
type ThumbnailRequestOptions = {
|
|
16
16
|
thumbnailsRequest: ThumbnailEntry[];
|
|
@@ -25,7 +25,7 @@ type ThumbnailResult = {
|
|
|
25
25
|
mimetype: string;
|
|
26
26
|
width: number;
|
|
27
27
|
height: number;
|
|
28
|
-
[key: string]:
|
|
28
|
+
[key: string]: unknown;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
export declare const resolvePath: (path: string, includeHost?: boolean) => string;
|
|
@@ -36,7 +36,7 @@ export declare const dropBox: {
|
|
|
36
36
|
setRootPath: (path: string) => void;
|
|
37
37
|
resolvePath: (path: string, includeHost?: boolean) => string;
|
|
38
38
|
createFolders: (paths: string[], basePath?: string) => Promise<any>;
|
|
39
|
-
deleteBulk: (paths: string[], basePath?: string) => Promise<
|
|
39
|
+
deleteBulk: (paths: string[], basePath?: string) => Promise<unknown[] | undefined>;
|
|
40
40
|
addTags: (paths: Record<string, string[]>, basePath?: string) => Promise<void>;
|
|
41
41
|
listFolders: ({ path, recursive }?: ListFoldersParams) => Promise<any[]>;
|
|
42
42
|
getThumbnails: ({ thumbnailsRequest, size, format, mode, }: ThumbnailRequestOptions, setThumbnails?: (thumbs: ThumbnailResult) => void) => Promise<ThumbnailResult>;
|
|
@@ -1,13 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import type { ProviderConfigurationState } from "../ProviderConfiguration";
|
|
1
|
+
import type { StorageProviderAdapter, UploadOptions, StorageOptions, DeleteOptions, MoveOptions, ListOptions, StorageFileInfo, UploadHandle } from './StorageProvider';
|
|
2
|
+
import type { ProviderConfigurationState } from '../ProviderConfiguration';
|
|
4
3
|
export declare class FirebaseStorageProvider implements StorageProviderAdapter {
|
|
4
|
+
private static listenerRegistered;
|
|
5
|
+
constructor();
|
|
5
6
|
getConfigurationState(): ProviderConfigurationState;
|
|
6
7
|
isConfigured(): boolean;
|
|
7
|
-
upload: (file: string, path: string) => Promise<string | undefined>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
upload: (file: string | File | Blob, path: string, opts?: UploadOptions) => Promise<string | undefined>;
|
|
9
|
+
createUpload: (file: string | File | Blob, path: string, opts?: UploadOptions) => UploadHandle;
|
|
10
|
+
/**
|
|
11
|
+
* Rename a file or folder. Semantically: change the name in place.
|
|
12
|
+
* Internally identical to move() - Firebase has no native rename/move API.
|
|
13
|
+
*/
|
|
14
|
+
rename: (from: string, to: string, opts?: MoveOptions) => Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Move a file or folder (download → upload to new path → delete old).
|
|
17
|
+
* Firebase has no native move/rename API.
|
|
18
|
+
* For folder moves, set opts.recursive = true.
|
|
19
|
+
* Returns the number of files successfully moved.
|
|
20
|
+
*/
|
|
21
|
+
move: (from: string, to: string, opts?: MoveOptions) => Promise<number>;
|
|
22
|
+
private _moveFile;
|
|
23
|
+
getURL: (path: string, opts?: StorageOptions) => Promise<string | undefined>;
|
|
24
|
+
getFileInfo: (path: string, opts?: StorageOptions) => Promise<StorageFileInfo | undefined>;
|
|
25
|
+
download: (path: string, opts?: StorageOptions) => Promise<Blob | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a single file or all files under a folder prefix.
|
|
28
|
+
* Returns the number of files deleted (0 or 1 for single file, N for recursive).
|
|
29
|
+
*/
|
|
30
|
+
delete: (path: string, opts?: DeleteOptions) => Promise<number>;
|
|
31
|
+
private _deleteFolder;
|
|
32
|
+
/**
|
|
33
|
+
* List files (and optionally folders) under a path prefix.
|
|
34
|
+
*
|
|
35
|
+
* Firebase note: the SDK's listAll() means "list all pages without pagination" -
|
|
36
|
+
* it is NOT recursive. Recursion over sub-folders is performed manually here.
|
|
37
|
+
*
|
|
38
|
+
* opts.metadata = true fetches size/contentType/updatedAt (one extra call per file).
|
|
39
|
+
*/
|
|
40
|
+
list: (path: string, opts?: ListOptions) => Promise<StorageFileInfo[]>;
|
|
41
|
+
private _listLevel;
|
|
11
42
|
}
|
|
12
43
|
declare const _default: FirebaseStorageProvider;
|
|
13
44
|
export default _default;
|
|
@@ -1,19 +1,59 @@
|
|
|
1
|
-
import { StorageProviderAdapter } from
|
|
2
|
-
import { type ProviderConfigurationState } from
|
|
1
|
+
import type { StorageProviderAdapter, UploadOptions, StorageOptions, DeleteOptions, MoveOptions, ListOptions, StorageFileInfo, UploadHandle } from './StorageProvider';
|
|
2
|
+
import { type ProviderConfigurationState } from '../ProviderConfiguration';
|
|
3
3
|
interface SupabaseStorageConfig {
|
|
4
4
|
url: string;
|
|
5
5
|
anonKey: string;
|
|
6
|
+
/** Default bucket name. Falls back to "public" if omitted. */
|
|
6
7
|
bucket?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Tenant-session JWT signed by the control-plane, scoped to this project.
|
|
10
|
+
* When present, requests authenticate as this session instead of the bare
|
|
11
|
+
* anon key — needed for RLS-protected buckets. `apikey` stays the anon key
|
|
12
|
+
* regardless (Supabase always requires it alongside the bearer token).
|
|
13
|
+
*/
|
|
14
|
+
accessToken?: string;
|
|
7
15
|
}
|
|
8
16
|
export declare class SupabaseStorageProvider implements StorageProviderAdapter {
|
|
9
17
|
private config;
|
|
10
18
|
constructor(config: SupabaseStorageConfig);
|
|
11
19
|
getConfigurationState(): ProviderConfigurationState;
|
|
12
20
|
isConfigured(): boolean;
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
private resolveBucket;
|
|
22
|
+
private authHeaders;
|
|
23
|
+
upload: (file: string | File | Blob, path: string, opts?: UploadOptions) => Promise<string | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Supabase upload with cancel support via AbortController.
|
|
26
|
+
* pause() and resume() are no-ops - Supabase fetch has no native pause/resume.
|
|
27
|
+
*/
|
|
28
|
+
createUpload: (file: string | File | Blob, path: string, opts?: UploadOptions) => UploadHandle;
|
|
29
|
+
/**
|
|
30
|
+
* Rename a file or folder. Internally calls move().
|
|
31
|
+
* For Supabase, single-file rename uses the native move API (one round-trip).
|
|
32
|
+
*/
|
|
33
|
+
rename: (from: string, to: string, opts?: MoveOptions) => Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Move a file or folder.
|
|
36
|
+
* Single file: uses Supabase's native move API (one round-trip).
|
|
37
|
+
* Folder (opts.recursive = true): lists all files then moves each via native API.
|
|
38
|
+
* Returns the number of files successfully moved.
|
|
39
|
+
*/
|
|
40
|
+
move: (from: string, to: string, opts?: MoveOptions) => Promise<number>;
|
|
41
|
+
private _moveFile;
|
|
42
|
+
getURL: (path: string, opts?: StorageOptions) => Promise<string | undefined>;
|
|
43
|
+
getFileInfo: (path: string, opts?: StorageOptions) => Promise<StorageFileInfo | undefined>;
|
|
44
|
+
download: (path: string, opts?: StorageOptions) => Promise<Blob | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Delete a single file or all files under a folder prefix.
|
|
47
|
+
* Uses Supabase's bulk-delete API - single request even for N files.
|
|
48
|
+
* Returns the number of files deleted.
|
|
49
|
+
*/
|
|
50
|
+
delete: (path: string, opts?: DeleteOptions) => Promise<number>;
|
|
51
|
+
/**
|
|
52
|
+
* List files (and optionally folders) under a path prefix.
|
|
53
|
+
* Supabase always returns metadata in the same response (no N+1 cost).
|
|
54
|
+
* Folder entries have id === null in the Supabase response.
|
|
55
|
+
*/
|
|
56
|
+
list: (path: string, opts?: ListOptions) => Promise<StorageFileInfo[]>;
|
|
57
|
+
private _listLevel;
|
|
18
58
|
}
|
|
19
59
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
+
import { type ProviderConfigurationState } from './ProviderConfiguration';
|
|
3
|
+
/**
|
|
4
|
+
* Returns a shared SupabaseClient for the given project.
|
|
5
|
+
* One client per URL - subsequent calls with the same URL return the same instance.
|
|
6
|
+
* For single-project apps only. Multi-tenant session switching must use
|
|
7
|
+
* createSupabaseClient() instead — see below.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getSupabaseClient(url: string, anonKey: string): SupabaseClient;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a fresh, uncached SupabaseClient scoped to one tenant session.
|
|
12
|
+
*
|
|
13
|
+
* Unlike getSupabaseClient(), this never persists a session (Supabase's default
|
|
14
|
+
* client persists to localStorage) and is never reused across calls — each tenant
|
|
15
|
+
* switch must produce a brand new instance with the freshly-resolved credential,
|
|
16
|
+
* never a stale one left over from a previous project.
|
|
17
|
+
*
|
|
18
|
+
* Supabase has no "sign in with custom token" step equivalent to Firebase: the
|
|
19
|
+
* control-plane mints a JWT signed with the tenant project's own JWT secret, and
|
|
20
|
+
* that JWT is simply attached as the Authorization header on every request —
|
|
21
|
+
* PostgREST/Realtime verify it directly, no separate session exchange call.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createSupabaseClient(url: string, anonKey: string, accessToken?: string): SupabaseClient;
|
|
24
|
+
/**
|
|
25
|
+
* Tears down a scoped client before it's discarded: force-closes any realtime
|
|
26
|
+
* channels a caller may have failed to unsubscribe from. Safety net, not a
|
|
27
|
+
* replacement for callers unsubscribing their own subscribe() calls.
|
|
28
|
+
*/
|
|
29
|
+
export declare function disposeSupabaseClient(client: SupabaseClient): Promise<void>;
|
|
30
|
+
export declare function getSupabaseConfigurationState(config: {
|
|
31
|
+
url?: string;
|
|
32
|
+
anonKey?: string;
|
|
33
|
+
} | undefined): ProviderConfigurationState;
|
|
34
|
+
/** Clears all cached clients - useful for tests. */
|
|
35
|
+
export declare function _resetSupabaseClients(): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FieldFactory } from "../components/Component";
|
|
2
2
|
import { InputProps, TextAreaProps, CheckboxProps } from "../components/ui/fields/Input";
|
|
3
3
|
import { SelectProps } from "../components/ui/fields/Select";
|
|
4
|
-
import {
|
|
4
|
+
import { ImageFieldProps } from "../components/ui/fields/ImageField";
|
|
5
5
|
import { UploadDocumentProps, UploadImageProps } from "../components/ui/fields/Upload";
|
|
6
6
|
import { PromptProps } from "../components/widgets/Prompt";
|
|
7
|
+
import { CodeEditorProps } from "../components/ui/fields/CodeEditor";
|
|
7
8
|
export interface ComponentFormFieldsMap {
|
|
8
9
|
string: FieldFactory<Partial<InputProps>>;
|
|
9
10
|
number: FieldFactory<Partial<InputProps>>;
|
|
@@ -24,10 +25,11 @@ export interface ComponentFormFieldsMap {
|
|
|
24
25
|
uploadImage: FieldFactory<Partial<UploadImageProps>>;
|
|
25
26
|
uploadDocument: FieldFactory<Partial<UploadDocumentProps>>;
|
|
26
27
|
prompt: FieldFactory<Partial<PromptProps>>;
|
|
27
|
-
|
|
28
|
+
imageField: FieldFactory<Partial<ImageFieldProps>>;
|
|
28
29
|
menu: FieldFactory<{
|
|
29
30
|
defaultValue?: string;
|
|
30
31
|
}>;
|
|
32
|
+
codeEditor: FieldFactory<Partial<CodeEditorProps>>;
|
|
31
33
|
}
|
|
32
34
|
declare const componentFormFields: ComponentFormFieldsMap;
|
|
33
35
|
export default componentFormFields;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FieldFactory } from "../components/Component";
|
|
2
|
+
import { InputProps, TextAreaProps, CheckboxProps } from "../components/ui/fields/Input";
|
|
3
|
+
import { SelectProps, AutocompleteProps, ChecklistProps } from "../components/ui/fields/Select";
|
|
4
|
+
import { UploadImageProps, UploadDocumentProps } from "../components/ui/fields/Upload";
|
|
5
|
+
import { ImageFieldProps } from "../components/ui/fields/ImageField";
|
|
6
|
+
type SchemaFields = Record<string, ReturnType<FieldFactory>>;
|
|
7
|
+
export interface ComponentFormSchemaMap {
|
|
8
|
+
string: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
9
|
+
number: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
10
|
+
email: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
11
|
+
password: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
12
|
+
color: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
13
|
+
date: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
14
|
+
time: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
15
|
+
datetime: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
16
|
+
week: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
17
|
+
month: (overrides?: Partial<InputProps>) => SchemaFields;
|
|
18
|
+
textarea: (overrides?: Partial<TextAreaProps>) => SchemaFields;
|
|
19
|
+
checkbox: (overrides?: Partial<CheckboxProps>) => SchemaFields;
|
|
20
|
+
switch: (overrides?: Partial<CheckboxProps>) => SchemaFields;
|
|
21
|
+
select: (overrides?: Partial<SelectProps>) => SchemaFields;
|
|
22
|
+
autocomplete: (overrides?: Partial<AutocompleteProps>) => SchemaFields;
|
|
23
|
+
checklist: (overrides?: Partial<ChecklistProps>) => SchemaFields;
|
|
24
|
+
uploadImage: (overrides?: Partial<UploadImageProps>) => SchemaFields;
|
|
25
|
+
uploadDocument: (overrides?: Partial<UploadDocumentProps>) => SchemaFields;
|
|
26
|
+
imageField: (overrides?: Partial<ImageFieldProps>) => SchemaFields;
|
|
27
|
+
}
|
|
28
|
+
declare const componentFormSchema: ComponentFormSchemaMap;
|
|
29
|
+
export default componentFormSchema;
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u="x-llmnative-proxy",p="/api/proxy",h=async t=>{const e=[];for await(const r of t)e.push(Buffer.isBuffer(r)?r:Buffer.from(r));return e.length===0?void 0:Buffer.concat(e)},l=async(t,e,r)=>{const a=new URL(t.url||"/","http://localhost").searchParams.get("url");if(t.headers[u]!=="1"){e.statusCode=403,e.setHeader("Content-Type","application/json"),e.end(JSON.stringify({error:"Proxy access denied."}));return}if(!a){e.statusCode=400,e.setHeader("Content-Type","application/json"),e.end(JSON.stringify({error:'Missing "url" query parameter.'}));return}try{const o=new URL(a);if(o.pathname.startsWith(r)&&["localhost","127.0.0.1"].includes(o.hostname)){e.statusCode=508,e.setHeader("Content-Type","application/json"),e.end(JSON.stringify({error:"Recursive proxy target detected.",target:a}));return}const d=await h(t),f=new Headers,y=new Set([u,"host","origin","referer","content-length","transfer-encoding","connection"]);Object.entries(t.headers).forEach(([i,n])=>{!n||y.has(i.toLowerCase())||f.set(i,Array.isArray(n)?n.join(", "):n)});const c=await fetch(a,{method:t.method||"GET",headers:f,body:d&&!["GET","HEAD"].includes((t.method||"GET").toUpperCase())?d:void 0,redirect:"follow"});e.statusCode=c.status,c.headers.forEach((i,n)=>{n.toLowerCase()!=="content-encoding"&&e.setHeader(n,i)}),e.end(Buffer.from(await c.arrayBuffer()))}catch(o){e.statusCode=502,e.setHeader("Content-Type","application/json"),e.end(JSON.stringify({error:o instanceof Error?o.message:"Proxy request failed."}))}},g=(t=p)=>({name:"llmnative-dev-proxy",configureServer(e){e.middlewares.use(t,(r,s)=>{l(r,s,t)})},configurePreviewServer(e){e.middlewares.use(t,(r,s)=>{l(r,s,t)})}});exports.PROXY_PATH=p;exports.createProxyPlugin=g;
|