adminforth 2.4.0-next.15 → 2.4.0-next.151
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/commands/callTsProxy.js +14 -4
- package/commands/cli.js +12 -4
- package/commands/createApp/templates/custom/tsconfig.json.hbs +2 -3
- package/commands/createApp/templates/index.ts.hbs +10 -2
- package/commands/createApp/templates/package.json.hbs +1 -1
- package/commands/createApp/utils.js +27 -2
- package/commands/createCustomComponent/configLoader.js +3 -0
- package/commands/createCustomComponent/main.js +1 -0
- package/commands/createCustomComponent/templates/customCrud/beforeActionButtons.vue.hbs +38 -0
- package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
- package/dist/dataConnectors/baseConnector.js +46 -15
- package/dist/dataConnectors/baseConnector.js.map +1 -1
- package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
- package/dist/dataConnectors/clickhouse.js +15 -0
- package/dist/dataConnectors/clickhouse.js.map +1 -1
- package/dist/dataConnectors/mongo.d.ts.map +1 -1
- package/dist/dataConnectors/mongo.js +44 -15
- package/dist/dataConnectors/mongo.js.map +1 -1
- package/dist/dataConnectors/mysql.d.ts.map +1 -1
- package/dist/dataConnectors/mysql.js +11 -0
- package/dist/dataConnectors/mysql.js.map +1 -1
- package/dist/dataConnectors/postgres.d.ts.map +1 -1
- package/dist/dataConnectors/postgres.js +11 -0
- package/dist/dataConnectors/postgres.js.map +1 -1
- package/dist/dataConnectors/sqlite.d.ts.map +1 -1
- package/dist/dataConnectors/sqlite.js +11 -0
- package/dist/dataConnectors/sqlite.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.d.ts.map +1 -1
- package/dist/modules/codeInjector.js +22 -5
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/modules/configValidator.d.ts.map +1 -1
- package/dist/modules/configValidator.js +54 -3
- package/dist/modules/configValidator.js.map +1 -1
- package/dist/modules/restApi.d.ts.map +1 -1
- package/dist/modules/restApi.js +147 -25
- package/dist/modules/restApi.js.map +1 -1
- package/dist/modules/styles.d.ts +457 -13
- package/dist/modules/styles.d.ts.map +1 -1
- package/dist/modules/styles.js +513 -31
- package/dist/modules/styles.js.map +1 -1
- package/dist/modules/utils.d.ts +1 -0
- package/dist/modules/utils.d.ts.map +1 -1
- package/dist/modules/utils.js +9 -0
- package/dist/modules/utils.js.map +1 -1
- package/dist/spa/index.html +1 -1
- package/dist/spa/src/App.vue +33 -15
- package/dist/spa/src/adminforth.ts +30 -10
- package/dist/spa/src/afcl/BarChart.vue +2 -2
- package/dist/spa/src/afcl/Button.vue +6 -6
- package/dist/spa/src/afcl/Checkbox.vue +21 -13
- package/dist/spa/src/afcl/CountryFlag.vue +4 -1
- package/dist/spa/src/{components/CustomDatePicker.vue → afcl/DatePicker.vue} +95 -9
- package/dist/spa/src/afcl/Dialog.vue +44 -27
- package/dist/spa/src/afcl/Dropzone.vue +12 -12
- package/dist/spa/src/afcl/Input.vue +6 -6
- package/dist/spa/src/afcl/JsonViewer.vue +25 -0
- package/dist/spa/src/afcl/LinkButton.vue +1 -1
- package/dist/spa/src/afcl/PieChart.vue +5 -5
- package/dist/spa/src/afcl/ProgressBar.vue +7 -7
- package/dist/spa/src/afcl/Select.vue +68 -34
- package/dist/spa/src/afcl/Skeleton.vue +6 -6
- package/dist/spa/src/afcl/Table.vue +199 -71
- package/dist/spa/src/afcl/Textarea.vue +31 -0
- package/dist/spa/src/afcl/Toggle.vue +32 -0
- package/dist/spa/src/afcl/Tooltip.vue +1 -2
- package/dist/spa/src/afcl/VerticalTabs.vue +3 -3
- package/dist/spa/src/afcl/index.ts +4 -3
- package/dist/spa/src/components/AcceptModal.vue +7 -7
- package/dist/spa/src/components/Breadcrumbs.vue +5 -5
- package/dist/spa/src/components/ColumnValueInput.vue +38 -18
- package/dist/spa/src/components/ColumnValueInputWrapper.vue +4 -3
- package/dist/spa/src/components/CustomDateRangePicker.vue +9 -8
- package/dist/spa/src/components/CustomRangePicker.vue +37 -8
- package/dist/spa/src/components/ErrorMessage.vue +21 -0
- package/dist/spa/src/components/Filters.vue +83 -37
- package/dist/spa/src/components/GroupsTable.vue +9 -8
- package/dist/spa/src/components/MenuLink.vue +3 -3
- package/dist/spa/src/components/ResourceForm.vue +94 -51
- package/dist/spa/src/components/ResourceListTable.vue +78 -80
- package/dist/spa/src/components/ResourceListTableVirtual.vue +70 -72
- package/dist/spa/src/components/ShowTable.vue +17 -12
- package/dist/spa/src/components/SingleSkeletLoader.vue +6 -6
- package/dist/spa/src/components/SkeleteLoader.vue +3 -3
- package/dist/spa/src/components/ThreeDotsMenu.vue +73 -14
- package/dist/spa/src/components/Toast.vue +27 -9
- package/dist/spa/src/components/ValueRenderer.vue +43 -16
- package/dist/spa/src/controls/BoolToggle.vue +34 -0
- package/dist/spa/src/i18n.ts +1 -1
- package/dist/spa/src/shims-vue.d.ts +5 -0
- package/dist/spa/src/spa_types/core.ts +8 -1
- package/dist/spa/src/stores/core.ts +1 -1
- package/dist/spa/src/stores/modal.ts +6 -1
- package/dist/spa/src/stores/toast.ts +22 -3
- package/dist/spa/src/types/Back.ts +107 -21
- package/dist/spa/src/types/Common.ts +45 -31
- package/dist/spa/src/types/FrontendAPI.ts +15 -2
- package/dist/spa/src/types/adapters/CompletionAdapter.ts +25 -0
- package/dist/spa/src/types/adapters/EmailAdapter.ts +27 -0
- package/dist/spa/src/types/adapters/ImageGenerationAdapter.ts +50 -0
- package/dist/spa/src/types/adapters/ImageVisionAdapter.ts +30 -0
- package/dist/spa/src/types/adapters/OAuth2Adapter.ts +34 -0
- package/dist/spa/src/types/adapters/StorageAdapter.ts +73 -0
- package/dist/spa/src/types/adapters/index.ts +6 -0
- package/dist/spa/src/utils.ts +217 -7
- package/dist/spa/src/views/CreateView.vue +18 -19
- package/dist/spa/src/views/EditView.vue +25 -19
- package/dist/spa/src/views/ListView.vue +124 -79
- package/dist/spa/src/views/LoginView.vue +36 -44
- package/dist/spa/src/views/ResourceParent.vue +2 -2
- package/dist/spa/src/views/ShowView.vue +59 -39
- package/dist/spa/src/websocket.ts +6 -1
- package/dist/spa/tsconfig.app.json +1 -1
- package/dist/spa/vite.config.ts +45 -2
- package/dist/types/Back.d.ts +75 -14
- package/dist/types/Back.d.ts.map +1 -1
- package/dist/types/Back.js +15 -0
- package/dist/types/Back.js.map +1 -1
- package/dist/types/Common.d.ts +38 -28
- package/dist/types/Common.d.ts.map +1 -1
- package/dist/types/Common.js.map +1 -1
- package/dist/types/FrontendAPI.d.ts +15 -1
- package/dist/types/FrontendAPI.d.ts.map +1 -1
- package/dist/types/FrontendAPI.js.map +1 -1
- package/dist/types/adapters/CompletionAdapter.d.ts +20 -0
- package/dist/types/adapters/CompletionAdapter.d.ts.map +1 -0
- package/dist/types/adapters/CompletionAdapter.js +2 -0
- package/dist/types/adapters/CompletionAdapter.js.map +1 -0
- package/dist/types/adapters/EmailAdapter.d.ts +20 -0
- package/dist/types/adapters/EmailAdapter.d.ts.map +1 -0
- package/dist/types/adapters/EmailAdapter.js +2 -0
- package/dist/types/adapters/EmailAdapter.js.map +1 -0
- package/dist/types/adapters/ImageGenerationAdapter.d.ts +37 -0
- package/dist/types/adapters/ImageGenerationAdapter.d.ts.map +1 -0
- package/dist/types/adapters/ImageGenerationAdapter.js +2 -0
- package/dist/types/adapters/ImageGenerationAdapter.js.map +1 -0
- package/dist/types/adapters/ImageVisionAdapter.d.ts +25 -0
- package/dist/types/adapters/ImageVisionAdapter.d.ts.map +1 -0
- package/dist/types/adapters/ImageVisionAdapter.js +2 -0
- package/dist/types/adapters/ImageVisionAdapter.js.map +1 -0
- package/dist/types/adapters/OAuth2Adapter.d.ts +32 -0
- package/dist/types/adapters/OAuth2Adapter.d.ts.map +1 -0
- package/dist/types/adapters/OAuth2Adapter.js +2 -0
- package/dist/types/adapters/OAuth2Adapter.js.map +1 -0
- package/dist/types/adapters/StorageAdapter.d.ts +63 -0
- package/dist/types/adapters/StorageAdapter.d.ts.map +1 -0
- package/dist/types/adapters/StorageAdapter.js +2 -0
- package/dist/types/adapters/StorageAdapter.js.map +1 -0
- package/dist/types/adapters/index.d.ts +7 -0
- package/dist/types/adapters/index.d.ts.map +1 -0
- package/dist/types/adapters/index.js +2 -0
- package/dist/types/adapters/index.js.map +1 -0
- package/package.json +3 -2
- package/dist/spa/src/types/Adapters.ts +0 -213
- package/dist/types/Adapters.d.ts +0 -168
- package/dist/types/Adapters.d.ts.map +0 -1
- package/dist/types/Adapters.js +0 -2
- package/dist/types/Adapters.js.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
/**
|
|
3
2
|
* Types that are common for both frontend side (SPA) and backend side (server).
|
|
4
3
|
*/
|
|
@@ -95,12 +94,9 @@ export interface AdminForthBulkActionCommon {
|
|
|
95
94
|
label: string,
|
|
96
95
|
|
|
97
96
|
/**
|
|
98
|
-
*
|
|
99
|
-
* * 'danger' - red button
|
|
100
|
-
* * 'success' - green button
|
|
101
|
-
* * 'active' - blue button
|
|
97
|
+
* Add custom class
|
|
102
98
|
**/
|
|
103
|
-
|
|
99
|
+
buttonCustomCssClass?: string;
|
|
104
100
|
|
|
105
101
|
/**
|
|
106
102
|
* Optional small badge for button which will be displayed in the list view
|
|
@@ -122,6 +118,10 @@ export interface AdminForthBulkActionCommon {
|
|
|
122
118
|
*/
|
|
123
119
|
successMessage?: string,
|
|
124
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Show in three dots dropdown menu in list view.
|
|
123
|
+
*/
|
|
124
|
+
showInThreeDotsDropdown?: boolean,
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
export interface AdminForthFieldComponents {
|
|
@@ -263,9 +263,17 @@ export interface AdminForthComponentDeclarationFull {
|
|
|
263
263
|
*/
|
|
264
264
|
meta?: any,
|
|
265
265
|
}
|
|
266
|
+
import { type AdminForthActionInput } from './Back.js'
|
|
267
|
+
export { type AdminForthActionInput } from './Back.js'
|
|
266
268
|
|
|
267
269
|
export type AdminForthComponentDeclaration = AdminForthComponentDeclarationFull | string;
|
|
268
270
|
|
|
271
|
+
export type FieldGroup = {
|
|
272
|
+
groupName: string;
|
|
273
|
+
columns: string[];
|
|
274
|
+
noTitle?: boolean;
|
|
275
|
+
};
|
|
276
|
+
|
|
269
277
|
/**
|
|
270
278
|
* Resource describes one table or collection in database.
|
|
271
279
|
* AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
|
|
@@ -347,6 +355,11 @@ export interface AdminForthResourceInputCommon {
|
|
|
347
355
|
direction: AdminForthSortDirections | string,
|
|
348
356
|
}
|
|
349
357
|
|
|
358
|
+
/*
|
|
359
|
+
* Custom actions list. Actions available in show, edit and create views.
|
|
360
|
+
*/
|
|
361
|
+
actions?: AdminForthActionInput[],
|
|
362
|
+
|
|
350
363
|
/**
|
|
351
364
|
* Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
|
|
352
365
|
* using checkboxes.
|
|
@@ -374,26 +387,10 @@ export interface AdminForthResourceInputCommon {
|
|
|
374
387
|
/**
|
|
375
388
|
* Allows to make groups of columns in show, create and edit resource pages.
|
|
376
389
|
*/
|
|
377
|
-
fieldGroups?:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}[];
|
|
382
|
-
createFieldGroups?: {
|
|
383
|
-
groupName: string;
|
|
384
|
-
columns: string[];
|
|
385
|
-
noTitle?: boolean;
|
|
386
|
-
}[];
|
|
387
|
-
editFieldGroups?: {
|
|
388
|
-
groupName: string;
|
|
389
|
-
columns: string[];
|
|
390
|
-
noTitle?: boolean;
|
|
391
|
-
}[];
|
|
392
|
-
showFieldGroups?: {
|
|
393
|
-
groupName: string;
|
|
394
|
-
columns: string[];
|
|
395
|
-
noTitle?: boolean;
|
|
396
|
-
}[];
|
|
390
|
+
fieldGroups?: FieldGroup[];
|
|
391
|
+
createFieldGroups?: FieldGroup[];
|
|
392
|
+
editFieldGroups?: FieldGroup[];
|
|
393
|
+
showFieldGroups?: FieldGroup[];
|
|
397
394
|
|
|
398
395
|
/**
|
|
399
396
|
* Page size for list view
|
|
@@ -471,6 +468,7 @@ export interface AdminForthResourceInputCommon {
|
|
|
471
468
|
list?: {
|
|
472
469
|
beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
473
470
|
afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
471
|
+
beforeActionButtons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
474
472
|
bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
475
473
|
threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
476
474
|
customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
|
|
@@ -584,6 +582,8 @@ export interface AdminForthForeignResourceCommon {
|
|
|
584
582
|
polymorphicResources?: Array<AdminForthPolymorphicForeignResource>,
|
|
585
583
|
polymorphicOn?: string,
|
|
586
584
|
unsetLabel?: string,
|
|
585
|
+
searchableFields?: string | string[],
|
|
586
|
+
searchIsCaseSensitive?: boolean,
|
|
587
587
|
}
|
|
588
588
|
|
|
589
589
|
export type FillOnCreateFunction = (params: {
|
|
@@ -810,9 +810,6 @@ export interface AdminForthResourceColumnInputCommon {
|
|
|
810
810
|
*/
|
|
811
811
|
minLength?: number,
|
|
812
812
|
|
|
813
|
-
min?: number,
|
|
814
|
-
max?: number,
|
|
815
|
-
|
|
816
813
|
/**
|
|
817
814
|
* Minimum value that can be entered in this field.
|
|
818
815
|
*/
|
|
@@ -878,6 +875,15 @@ export interface AdminForthResourceColumnCommon extends AdminForthResourceColumn
|
|
|
878
875
|
|
|
879
876
|
editingNote?: { create?: string, edit?: string },
|
|
880
877
|
|
|
878
|
+
/**
|
|
879
|
+
* Minimal value stored in this field.
|
|
880
|
+
*/
|
|
881
|
+
min?: number,
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Maximum value stored in this field.
|
|
885
|
+
*/
|
|
886
|
+
max?: number,
|
|
881
887
|
}
|
|
882
888
|
|
|
883
889
|
export enum AdminForthMenuTypes {
|
|
@@ -1055,16 +1061,19 @@ export interface AdminForthConfigForFrontend {
|
|
|
1055
1061
|
usernameFieldName: string,
|
|
1056
1062
|
loginBackgroundImage: string,
|
|
1057
1063
|
loginBackgroundPosition: string,
|
|
1064
|
+
removeBackgroundBlendMode: boolean,
|
|
1058
1065
|
title?: string,
|
|
1059
1066
|
demoCredentials?: string,
|
|
1060
|
-
loginPromptHTML?: string
|
|
1067
|
+
loginPromptHTML?: string | (() => string | Promise<string> | void | Promise<void> | Promise<undefined>) | undefined
|
|
1061
1068
|
loginPageInjections: {
|
|
1062
1069
|
underInputs: Array<AdminForthComponentDeclaration>,
|
|
1063
1070
|
panelHeader: Array<AdminForthComponentDeclaration>,
|
|
1064
1071
|
},
|
|
1065
1072
|
rememberMeDays: number,
|
|
1066
1073
|
showBrandNameInSidebar: boolean,
|
|
1074
|
+
showBrandLogoInSidebar: boolean,
|
|
1067
1075
|
brandLogo?: string,
|
|
1076
|
+
singleTheme?: 'light' | 'dark',
|
|
1068
1077
|
datesFormat: string,
|
|
1069
1078
|
timeFormat: string,
|
|
1070
1079
|
auth: any,
|
|
@@ -1079,8 +1088,13 @@ export interface AdminForthConfigForFrontend {
|
|
|
1079
1088
|
userMenu: Array<AdminForthComponentDeclarationFull>,
|
|
1080
1089
|
header: Array<AdminForthComponentDeclarationFull>,
|
|
1081
1090
|
sidebar: Array<AdminForthComponentDeclarationFull>,
|
|
1091
|
+
sidebarTop: Array<AdminForthComponentDeclarationFull>,
|
|
1082
1092
|
everyPageBottom: Array<AdminForthComponentDeclarationFull>,
|
|
1083
|
-
}
|
|
1093
|
+
},
|
|
1094
|
+
customHeadItems?: {
|
|
1095
|
+
tagName: string;
|
|
1096
|
+
attributes: Record<string, string | boolean>;
|
|
1097
|
+
}[],
|
|
1084
1098
|
}
|
|
1085
1099
|
|
|
1086
1100
|
export interface GetBaseConfigResponse {
|
|
@@ -55,7 +55,7 @@ export interface FrontendAPIInterface {
|
|
|
55
55
|
*
|
|
56
56
|
* @param params - The parameters of the alert
|
|
57
57
|
*/
|
|
58
|
-
alert(params:AlertParams): void;
|
|
58
|
+
alert(params:AlertParams): void | Promise<string> | string;
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
list: {
|
|
@@ -121,6 +121,14 @@ export interface FrontendAPIInterface {
|
|
|
121
121
|
clearFilters(): void;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
show: {
|
|
125
|
+
/**
|
|
126
|
+
* Full refresh the current record on the show page. Loader may be shown during fetching.
|
|
127
|
+
* Fire-and-forget; you don't need to await it.
|
|
128
|
+
*/
|
|
129
|
+
refresh(): void;
|
|
130
|
+
}
|
|
131
|
+
|
|
124
132
|
menu: {
|
|
125
133
|
/**
|
|
126
134
|
* Refreshes the badges in the menu, by recalling the badge function for each menu item
|
|
@@ -171,7 +179,12 @@ export type AlertParams = {
|
|
|
171
179
|
* Default is 10 seconds;
|
|
172
180
|
*/
|
|
173
181
|
timeout?: number | 'unlimited';
|
|
174
|
-
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Optional buttons to display in the alert
|
|
185
|
+
*/
|
|
186
|
+
buttons?: {value: any, label: string}[];
|
|
187
|
+
|
|
175
188
|
}
|
|
176
189
|
|
|
177
190
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface CompletionAdapter {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This method is called to validate the configuration of the adapter
|
|
5
|
+
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
6
|
+
*/
|
|
7
|
+
validate(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This method should return a text completion based on the provided content and stop sequence.
|
|
11
|
+
* @param content - The input text to complete
|
|
12
|
+
* @param stop - An array of stop sequences to indicate where to stop the completion
|
|
13
|
+
* @param maxTokens - The maximum number of tokens to generate
|
|
14
|
+
* @returns A promise that resolves to an object containing the completed text and other metadata
|
|
15
|
+
*/
|
|
16
|
+
complete(
|
|
17
|
+
content: string,
|
|
18
|
+
stop: string[],
|
|
19
|
+
maxTokens: number,
|
|
20
|
+
): Promise<{
|
|
21
|
+
content?: string;
|
|
22
|
+
finishReason?: string;
|
|
23
|
+
error?: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface EmailAdapter {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This method is called to validate the configuration of the adapter
|
|
5
|
+
* and should throw a clear user-readable error if the configuration is invalid.
|
|
6
|
+
*/
|
|
7
|
+
validate(): Promise<void>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This method should send an email using the adapter
|
|
11
|
+
* @param from - The sender's email address
|
|
12
|
+
* @param to - The recipient's email address
|
|
13
|
+
* @param text - The plain text version of the email
|
|
14
|
+
* @param html - The HTML version of the email
|
|
15
|
+
* @param subject - The subject of the email
|
|
16
|
+
*/
|
|
17
|
+
sendEmail(
|
|
18
|
+
from: string,
|
|
19
|
+
to: string,
|
|
20
|
+
text: string,
|
|
21
|
+
html: string,
|
|
22
|
+
subject: string
|
|
23
|
+
): Promise<{
|
|
24
|
+
error?: string;
|
|
25
|
+
ok?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface ImageGenerationAdapter {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This method is called to validate the configuration of the adapter
|
|
5
|
+
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
6
|
+
*/
|
|
7
|
+
validate(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Return max number of images which model can generate in one request
|
|
11
|
+
*/
|
|
12
|
+
outputImagesMaxCountSupported(): number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Return the list of supported dimensions in format ["100x500", "200x200"]
|
|
16
|
+
*/
|
|
17
|
+
outputDimensionsSupported(): string[];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Input file extension supported
|
|
21
|
+
*/
|
|
22
|
+
inputFileExtensionSupported(): string[];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This method should generate an image based on the provided prompt and input files.
|
|
26
|
+
* @param prompt - The prompt to generate the image
|
|
27
|
+
* @param inputFiles - An array of input file paths (optional)
|
|
28
|
+
* @param n - The number of images to generate (default is 1)
|
|
29
|
+
* @param size - The size of the generated image (default is the lowest dimension supported)
|
|
30
|
+
* @returns A promise that resolves to an object containing the generated image URLs and any error message
|
|
31
|
+
*/
|
|
32
|
+
generate({
|
|
33
|
+
prompt,
|
|
34
|
+
inputFiles,
|
|
35
|
+
n,
|
|
36
|
+
size,
|
|
37
|
+
}: {
|
|
38
|
+
prompt: string,
|
|
39
|
+
inputFiles: string[],
|
|
40
|
+
|
|
41
|
+
// default = lowest dimension supported
|
|
42
|
+
size?: string,
|
|
43
|
+
|
|
44
|
+
// one by default
|
|
45
|
+
n?: number
|
|
46
|
+
}): Promise<{
|
|
47
|
+
imageURLs?: string[];
|
|
48
|
+
error?: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ImageVisionAdapter {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This method is called to validate the configuration of the adapter
|
|
5
|
+
* and should throw a clear user-readable error if the configuration is invalid.
|
|
6
|
+
*/
|
|
7
|
+
validate(): void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Input file extension supported
|
|
11
|
+
*/
|
|
12
|
+
inputFileExtensionSupported(): string[];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This method should generate an image based on the provided prompt and input files.
|
|
16
|
+
* @param prompt - The prompt to generate the image
|
|
17
|
+
* @param inputFileUrls - An array of input file paths (optional)
|
|
18
|
+
* @returns A promise that resolves to an object containing the generated image and any error message
|
|
19
|
+
*/
|
|
20
|
+
generate({
|
|
21
|
+
prompt,
|
|
22
|
+
inputFileUrls,
|
|
23
|
+
}: {
|
|
24
|
+
prompt: string,
|
|
25
|
+
inputFileUrls: string[],
|
|
26
|
+
}): Promise<{
|
|
27
|
+
response: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This interface is used to implement OAuth2 authentication adapters.
|
|
4
|
+
*/
|
|
5
|
+
export interface OAuth2Adapter {
|
|
6
|
+
/**
|
|
7
|
+
* This method should return navigatable URL to the OAuth2 provider authentication page.
|
|
8
|
+
*/
|
|
9
|
+
getAuthUrl(): string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This method should return the token from the OAuth2 provider using the provided code and redirect URI.
|
|
13
|
+
* @param code - The authorization code received from the OAuth2 provider
|
|
14
|
+
* @param redirect_uri - The redirect URI used in the authentication request
|
|
15
|
+
* @returns A promise that resolves to an object containing the email address of the authenticated user
|
|
16
|
+
*/
|
|
17
|
+
getTokenFromCode(code: string, redirect_uri: string): Promise<{ email: string }>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This method should return text (content) of SVG icon which will be used in the UI.
|
|
21
|
+
* Use official SVG icons with simplest possible conent, omit icons which have base64 encoded raster images inside.
|
|
22
|
+
*/
|
|
23
|
+
getIcon(): string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* This method should return the text to be displayed on the button in the UI
|
|
27
|
+
*/
|
|
28
|
+
getButtonText?(): string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This method should return the name of the adapter
|
|
32
|
+
*/
|
|
33
|
+
getName?(): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Each storage adapter should support two ways of storing files:
|
|
4
|
+
* - publically (public URL) - the file can be accessed by anyone by HTTP GET / HEAD request with plain URL
|
|
5
|
+
* - privately (presigned URL) - the file can be accessed by anyone by HTTP GET / HEAD request only with presigned URLs, limited by expiration time
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export interface StorageAdapter {
|
|
9
|
+
/**
|
|
10
|
+
* This method should return the presigned URL for the given key capable of upload (adapter user will call PUT multipart form data to this URL within expiresIn seconds after link generation).
|
|
11
|
+
* By default file which will be uploaded on PUT should be marked for deletion. So if during 24h it is not marked for not deletion, it adapter should delete it forever.
|
|
12
|
+
* The PUT method should fail if the file already exists.
|
|
13
|
+
*
|
|
14
|
+
* Adapter user will always pass next parameters to the method:
|
|
15
|
+
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
16
|
+
* @param expiresIn - The expiration time in seconds for the presigned URL
|
|
17
|
+
* @param contentType - The content type of the file to be uploaded, e.g. "image/png"
|
|
18
|
+
*
|
|
19
|
+
* @returns A promise that resolves to an object containing the upload URL and any extra parameters which should be sent with PUT multipart form data
|
|
20
|
+
*/
|
|
21
|
+
getUploadSignedUrl(key: string, contentType: string, expiresIn?: number): Promise<{
|
|
22
|
+
uploadUrl: string;
|
|
23
|
+
uploadExtraParams?: Record<string, string>;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* This method should return the URL for the given key capable of download (200 GET request with response body or 200 HEAD request without response body).
|
|
28
|
+
* If adapter configured to store objects publically, this method should return the public URL of the file.
|
|
29
|
+
* If adapter configured to no allow public storing of images, this method should return the presigned URL for the file.
|
|
30
|
+
*
|
|
31
|
+
* @param key - The key of the file to be downloaded e.g. "uploads/file.txt"
|
|
32
|
+
* @param expiresIn - The expiration time in seconds for the presigned URL
|
|
33
|
+
*/
|
|
34
|
+
getDownloadUrl(key: string, expiresIn?: number): Promise<string>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* This method should mark the file for deletion.
|
|
38
|
+
* If file is marked for delation and exists more then 24h (since creation date) it should be deleted.
|
|
39
|
+
* This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
|
|
40
|
+
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
41
|
+
*/
|
|
42
|
+
markKeyForDeletation(key: string): Promise<void>;
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* This method should mark the file to not be deleted.
|
|
47
|
+
* This method should be used to cancel the deletion of the file if it was marked for deletion.
|
|
48
|
+
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
49
|
+
*/
|
|
50
|
+
markKeyForNotDeletation(key: string): Promise<void>;
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* This method can start needed schedullers, cron jobs, etc. to clean up the storage.
|
|
55
|
+
* @param adapterUserUniqueRepresentation - The unique representation of the plugin instance which
|
|
56
|
+
* wil use this adapter. Might be handy if you need to distinguish between different instances of the same adapter.
|
|
57
|
+
*/
|
|
58
|
+
setupLifecycle(adapterUserUniqueRepresentation: string): Promise<void>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* If adapter is configured to publically, this method should return true.
|
|
62
|
+
*/
|
|
63
|
+
objectCanBeAccesedPublicly(): Promise<boolean>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* This method should return the key as a data URL (base64 encoded string).
|
|
67
|
+
* @param key - The key of the file to be converted to a data URL
|
|
68
|
+
* @returns A promise that resolves to a string containing the data URL
|
|
69
|
+
*/
|
|
70
|
+
getKeyAsDataURL(key: string): Promise<string>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { EmailAdapter } from './EmailAdapter.js';
|
|
2
|
+
export type { CompletionAdapter } from './CompletionAdapter.js';
|
|
3
|
+
export type { ImageGenerationAdapter } from './ImageGenerationAdapter.js';
|
|
4
|
+
export type { ImageVisionAdapter } from './ImageVisionAdapter.js';
|
|
5
|
+
export type { OAuth2Adapter } from './OAuth2Adapter.js';
|
|
6
|
+
export type { StorageAdapter } from './StorageAdapter.js';
|