adminforth 2.4.0 → 2.5.1
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 +1 -1
- package/commands/createApp/templates/package.json.hbs +1 -1
- package/commands/createApp/utils.js +27 -2
- package/dist/dataConnectors/mongo.d.ts.map +1 -1
- package/dist/dataConnectors/mongo.js +1 -8
- package/dist/dataConnectors/mongo.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/codeInjector.js +2 -2
- package/dist/modules/codeInjector.js.map +1 -1
- package/dist/spa/src/App.vue +1 -1
- package/dist/spa/src/afcl/Button.vue +3 -3
- package/dist/spa/src/afcl/Input.vue +2 -2
- package/dist/spa/src/afcl/JsonViewer.vue +25 -0
- package/dist/spa/src/afcl/Select.vue +1 -2
- package/dist/spa/src/afcl/Table.vue +8 -8
- package/dist/spa/src/afcl/index.ts +1 -1
- package/dist/spa/src/components/AcceptModal.vue +4 -4
- package/dist/spa/src/components/Filters.vue +1 -1
- package/dist/spa/src/components/ResourceListTable.vue +15 -16
- package/dist/spa/src/components/ResourceListTableVirtual.vue +6 -6
- package/dist/spa/src/components/ShowTable.vue +7 -4
- package/dist/spa/src/components/ValueRenderer.vue +1 -1
- package/dist/spa/src/types/Back.ts +6 -6
- package/dist/spa/src/types/adapters/CompletionAdapter.ts +25 -0
- package/dist/spa/src/types/adapters/EmailAdapter.ts +29 -0
- package/dist/spa/src/types/adapters/ImageGenerationAdapter.ts +50 -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 +5 -0
- package/dist/spa/src/views/CreateView.vue +2 -2
- package/dist/spa/src/views/ListView.vue +2 -2
- package/dist/spa/src/views/ShowView.vue +3 -3
- package/dist/types/Back.d.ts +5 -5
- 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 +21 -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/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 +6 -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 +2 -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
|
@@ -28,21 +28,21 @@
|
|
|
28
28
|
</template>
|
|
29
29
|
<RouterLink v-if="coreStore.resource?.options?.allowedActions?.create"
|
|
30
30
|
:to="{ name: 'resource-create', params: { resourceId: $route.params.resourceId } }"
|
|
31
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
|
|
31
|
+
class="af-add-new-button flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 rounded-default"
|
|
32
32
|
>
|
|
33
33
|
<IconPlusOutline class="w-4 h-4 me-2"/>
|
|
34
34
|
{{ $t('Add new') }}
|
|
35
35
|
</RouterLink>
|
|
36
36
|
|
|
37
37
|
<RouterLink v-if="coreStore?.resourceOptions?.allowedActions?.edit" :to="{ name: 'resource-edit', params: { resourceId: $route.params.resourceId, primaryKey: $route.params.primaryKey } }"
|
|
38
|
-
class="flex items-center py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-default border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
38
|
+
class="flex items-center af-edit-button py-1 px-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-default border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
39
39
|
>
|
|
40
40
|
<IconPenSolid class="w-4 h-4" />
|
|
41
41
|
{{ $t('Edit') }}
|
|
42
42
|
</RouterLink>
|
|
43
43
|
|
|
44
44
|
<button v-if="coreStore?.resourceOptions?.allowedActions?.delete" @click="deleteRecord"
|
|
45
|
-
class="flex items-center py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
45
|
+
class="flex items-center af-delete-button py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
|
|
46
46
|
>
|
|
47
47
|
<IconTrashBinSolid class="w-4 h-4" />
|
|
48
48
|
{{ $t('Delete') }}
|
package/dist/types/Back.d.ts
CHANGED
|
@@ -62,14 +62,14 @@ export interface IExpressHttpServer extends IHttpServer {
|
|
|
62
62
|
* Adds adminUser to request object if user is authorized. Drops request with 401 status if user is not authorized.
|
|
63
63
|
* @param callable : Function which will be called if user is authorized.
|
|
64
64
|
*
|
|
65
|
-
* Example:
|
|
66
65
|
*
|
|
66
|
+
* @example
|
|
67
67
|
* ```ts
|
|
68
|
-
* expressApp.get('/myApi', authorize((req, res) =>
|
|
68
|
+
* expressApp.get('/myApi', authorize((req, res) => {
|
|
69
69
|
* console.log('User is authorized', req.adminUser);
|
|
70
|
-
* res.json(
|
|
71
|
-
*
|
|
72
|
-
*
|
|
70
|
+
* res.json({ message: 'Hello World' });
|
|
71
|
+
* }));
|
|
72
|
+
* ```
|
|
73
73
|
*
|
|
74
74
|
*/
|
|
75
75
|
authorize(callable: Function): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CompletionAdapter {
|
|
2
|
+
/**
|
|
3
|
+
* This method is called to validate the configuration of the adapter
|
|
4
|
+
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
5
|
+
*/
|
|
6
|
+
validate(): void;
|
|
7
|
+
/**
|
|
8
|
+
* This method should return a text completion based on the provided content and stop sequence.
|
|
9
|
+
* @param content - The input text to complete
|
|
10
|
+
* @param stop - An array of stop sequences to indicate where to stop the completion
|
|
11
|
+
* @param maxTokens - The maximum number of tokens to generate
|
|
12
|
+
* @returns A promise that resolves to an object containing the completed text and other metadata
|
|
13
|
+
*/
|
|
14
|
+
complete(content: string, stop: string[], maxTokens: number): Promise<{
|
|
15
|
+
content?: string;
|
|
16
|
+
finishReason?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=CompletionAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompletionAdapter.d.ts","sourceRoot":"","sources":["../../../types/adapters/CompletionAdapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAEhC;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;;;;;OAMG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompletionAdapter.js","sourceRoot":"","sources":["../../../types/adapters/CompletionAdapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface EmailAdapter {
|
|
2
|
+
/**
|
|
3
|
+
* This method is called to validate the configuration of the adapter
|
|
4
|
+
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
5
|
+
*/
|
|
6
|
+
validate(): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* This method should send an email using the adapter
|
|
9
|
+
* @param from - The sender's email address
|
|
10
|
+
* @param to - The recipient's email address
|
|
11
|
+
* @param text - The plain text version of the email
|
|
12
|
+
* @param html - The HTML version of the email
|
|
13
|
+
* @param subject - The subject of the email
|
|
14
|
+
*/
|
|
15
|
+
sendEmail(from: string, to: string, text: string, html: string, subject: string): Promise<{
|
|
16
|
+
error?: string;
|
|
17
|
+
ok?: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export { EmailAdapter };
|
|
21
|
+
//# sourceMappingURL=EmailAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailAdapter.d.ts","sourceRoot":"","sources":["../../../types/adapters/EmailAdapter.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IAEpB;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1B;;;;;;;OAOG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,EAAE,CAAC,EAAE,OAAO,CAAC;KACd,CAAC,CAAC;CACJ;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailAdapter.js","sourceRoot":"","sources":["../../../types/adapters/EmailAdapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ImageGenerationAdapter {
|
|
2
|
+
/**
|
|
3
|
+
* This method is called to validate the configuration of the adapter
|
|
4
|
+
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
5
|
+
*/
|
|
6
|
+
validate(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Return max number of images which model can generate in one request
|
|
9
|
+
*/
|
|
10
|
+
outputImagesMaxCountSupported(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Return the list of supported dimensions in format ["100x500", "200x200"]
|
|
13
|
+
*/
|
|
14
|
+
outputDimensionsSupported(): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Input file extension supported
|
|
17
|
+
*/
|
|
18
|
+
inputFileExtensionSupported(): string[];
|
|
19
|
+
/**
|
|
20
|
+
* This method should generate an image based on the provided prompt and input files.
|
|
21
|
+
* @param prompt - The prompt to generate the image
|
|
22
|
+
* @param inputFiles - An array of input file paths (optional)
|
|
23
|
+
* @param n - The number of images to generate (default is 1)
|
|
24
|
+
* @param size - The size of the generated image (default is the lowest dimension supported)
|
|
25
|
+
* @returns A promise that resolves to an object containing the generated image URLs and any error message
|
|
26
|
+
*/
|
|
27
|
+
generate({ prompt, inputFiles, n, size, }: {
|
|
28
|
+
prompt: string;
|
|
29
|
+
inputFiles: string[];
|
|
30
|
+
size?: string;
|
|
31
|
+
n?: number;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
imageURLs?: string[];
|
|
34
|
+
error?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ImageGenerationAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageGenerationAdapter.d.ts","sourceRoot":"","sources":["../../../types/adapters/ImageGenerationAdapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IAErC;;;OAGG;IACH,QAAQ,IAAI,IAAI,CAAC;IAEjB;;OAEG;IACH,6BAA6B,IAAI,MAAM,CAAC;IAExC;;OAEG;IACH,yBAAyB,IAAI,MAAM,EAAE,CAAC;IAEtC;;OAEG;IACH,2BAA2B,IAAI,MAAM,EAAE,CAAC;IAExC;;;;;;;OAOG;IACH,QAAQ,CAAC,EACP,MAAM,EACN,UAAU,EACV,CAAC,EACD,IAAI,GACL,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,EAAE,CAAC;QAGrB,IAAI,CAAC,EAAE,MAAM,CAAC;QAGd,CAAC,CAAC,EAAE,MAAM,CAAA;KACX,GAAG,OAAO,CAAC;QACV,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageGenerationAdapter.js","sourceRoot":"","sources":["../../../types/adapters/ImageGenerationAdapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface is used to implement OAuth2 authentication adapters.
|
|
3
|
+
*/
|
|
4
|
+
export interface OAuth2Adapter {
|
|
5
|
+
/**
|
|
6
|
+
* This method should return navigatable URL to the OAuth2 provider authentication page.
|
|
7
|
+
*/
|
|
8
|
+
getAuthUrl(): string;
|
|
9
|
+
/**
|
|
10
|
+
* This method should return the token from the OAuth2 provider using the provided code and redirect URI.
|
|
11
|
+
* @param code - The authorization code received from the OAuth2 provider
|
|
12
|
+
* @param redirect_uri - The redirect URI used in the authentication request
|
|
13
|
+
* @returns A promise that resolves to an object containing the email address of the authenticated user
|
|
14
|
+
*/
|
|
15
|
+
getTokenFromCode(code: string, redirect_uri: string): Promise<{
|
|
16
|
+
email: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* This method should return text (content) of SVG icon which will be used in the UI.
|
|
20
|
+
* Use official SVG icons with simplest possible conent, omit icons which have base64 encoded raster images inside.
|
|
21
|
+
*/
|
|
22
|
+
getIcon(): string;
|
|
23
|
+
/**
|
|
24
|
+
* This method should return the text to be displayed on the button in the UI
|
|
25
|
+
*/
|
|
26
|
+
getButtonText?(): string;
|
|
27
|
+
/**
|
|
28
|
+
* This method should return the name of the adapter
|
|
29
|
+
*/
|
|
30
|
+
getName?(): string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=OAuth2Adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuth2Adapter.d.ts","sourceRoot":"","sources":["../../../types/adapters/OAuth2Adapter.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjF;;;OAGG;IACH,OAAO,IAAI,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,IAAI,MAAM,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,IAAI,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuth2Adapter.js","sourceRoot":"","sources":["../../../types/adapters/OAuth2Adapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each storage adapter should support two ways of storing files:
|
|
3
|
+
* - publically (public URL) - the file can be accessed by anyone by HTTP GET / HEAD request with plain URL
|
|
4
|
+
* - privately (presigned URL) - the file can be accessed by anyone by HTTP GET / HEAD request only with presigned URLs, limited by expiration time
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export interface StorageAdapter {
|
|
8
|
+
/**
|
|
9
|
+
* 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).
|
|
10
|
+
* 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.
|
|
11
|
+
* The PUT method should fail if the file already exists.
|
|
12
|
+
*
|
|
13
|
+
* Adapter user will always pass next parameters to the method:
|
|
14
|
+
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
15
|
+
* @param expiresIn - The expiration time in seconds for the presigned URL
|
|
16
|
+
* @param contentType - The content type of the file to be uploaded, e.g. "image/png"
|
|
17
|
+
*
|
|
18
|
+
* @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
|
|
19
|
+
*/
|
|
20
|
+
getUploadSignedUrl(key: string, contentType: string, expiresIn?: number): Promise<{
|
|
21
|
+
uploadUrl: string;
|
|
22
|
+
uploadExtraParams?: Record<string, string>;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* 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).
|
|
26
|
+
* If adapter configured to store objects publically, this method should return the public URL of the file.
|
|
27
|
+
* If adapter configured to no allow public storing of images, this method should return the presigned URL for the file.
|
|
28
|
+
*
|
|
29
|
+
* @param key - The key of the file to be downloaded e.g. "uploads/file.txt"
|
|
30
|
+
* @param expiresIn - The expiration time in seconds for the presigned URL
|
|
31
|
+
*/
|
|
32
|
+
getDownloadUrl(key: string, expiresIn?: number): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* This method should mark the file for deletion.
|
|
35
|
+
* If file is marked for delation and exists more then 24h (since creation date) it should be deleted.
|
|
36
|
+
* This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
|
|
37
|
+
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
38
|
+
*/
|
|
39
|
+
markKeyForDeletation(key: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* This method should mark the file to not be deleted.
|
|
42
|
+
* This method should be used to cancel the deletion of the file if it was marked for deletion.
|
|
43
|
+
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
44
|
+
*/
|
|
45
|
+
markKeyForNotDeletation(key: string): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* This method can start needed schedullers, cron jobs, etc. to clean up the storage.
|
|
48
|
+
* @param adapterUserUniqueRepresentation - The unique representation of the plugin instance which
|
|
49
|
+
* wil use this adapter. Might be handy if you need to distinguish between different instances of the same adapter.
|
|
50
|
+
*/
|
|
51
|
+
setupLifecycle(adapterUserUniqueRepresentation: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* If adapter is configured to publically, this method should return true.
|
|
54
|
+
*/
|
|
55
|
+
objectCanBeAccesedPublicly(): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* This method should return the key as a data URL (base64 encoded string).
|
|
58
|
+
* @param key - The key of the file to be converted to a data URL
|
|
59
|
+
* @returns A promise that resolves to a string containing the data URL
|
|
60
|
+
*/
|
|
61
|
+
getKeyAsDataURL(key: string): Promise<string>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=StorageAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageAdapter.d.ts","sourceRoot":"","sources":["../../../types/adapters/StorageAdapter.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAChF,SAAS,EAAE,MAAM,CAAC;QAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5C,CAAC,CAAC;IAEH;;;;;;;OAOG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGjD;;;;OAIG;IACH,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGpD;;;;OAIG;IACH,cAAc,CAAC,+BAA+B,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvE;;OAEG;IACH,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;;;OAIG;IACH,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageAdapter.js","sourceRoot":"","sources":["../../../types/adapters/StorageAdapter.ts"],"names":[],"mappings":""}
|
|
@@ -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 { OAuth2Adapter } from './OAuth2Adapter.js';
|
|
5
|
+
export type { StorageAdapter } from './StorageAdapter.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../types/adapters/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../types/adapters/index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminforth",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "OpenSource Vue3 powered forth-generation admin panel",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"jsonwebtoken": "^9.0.2",
|
|
80
80
|
"listr2": "^8.2.5",
|
|
81
81
|
"mongodb": "6.6",
|
|
82
|
-
"mysql2": "^3.
|
|
82
|
+
"mysql2": "^3.14.2",
|
|
83
83
|
"node-fetch": "^3.3.2",
|
|
84
84
|
"pg": "^8.11.5",
|
|
85
85
|
"recast": "^0.23.11",
|
|
@@ -1,213 +0,0 @@
|
|
|
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-readbale 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
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface CompletionAdapter {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* This method is called to validate the configuration of the adapter
|
|
33
|
-
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
34
|
-
*/
|
|
35
|
-
validate(): void;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* This method should return a text completion based on the provided content and stop sequence.
|
|
39
|
-
* @param content - The input text to complete
|
|
40
|
-
* @param stop - An array of stop sequences to indicate where to stop the completion
|
|
41
|
-
* @param maxTokens - The maximum number of tokens to generate
|
|
42
|
-
* @returns A promise that resolves to an object containing the completed text and other metadata
|
|
43
|
-
*/
|
|
44
|
-
complete(
|
|
45
|
-
content: string,
|
|
46
|
-
stop: string[],
|
|
47
|
-
maxTokens: number,
|
|
48
|
-
): Promise<{
|
|
49
|
-
content?: string;
|
|
50
|
-
finishReason?: string;
|
|
51
|
-
error?: string;
|
|
52
|
-
}>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ImageGenerationAdapter {
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* This method is called to validate the configuration of the adapter
|
|
59
|
-
* and should throw a clear user-readbale error if the configuration is invalid.
|
|
60
|
-
*/
|
|
61
|
-
validate(): void;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Return max number of images which model can generate in one request
|
|
65
|
-
*/
|
|
66
|
-
outputImagesMaxCountSupported(): number;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Return the list of supported dimensions in format ["100x500", "200x200"]
|
|
70
|
-
*/
|
|
71
|
-
outputDimensionsSupported(): string[];
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Input file extension supported
|
|
75
|
-
*/
|
|
76
|
-
inputFileExtensionSupported(): string[];
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* This method should generate an image based on the provided prompt and input files.
|
|
80
|
-
* @param prompt - The prompt to generate the image
|
|
81
|
-
* @param inputFiles - An array of input file paths (optional)
|
|
82
|
-
* @param n - The number of images to generate (default is 1)
|
|
83
|
-
* @param size - The size of the generated image (default is the lowest dimension supported)
|
|
84
|
-
* @returns A promise that resolves to an object containing the generated image URLs and any error message
|
|
85
|
-
*/
|
|
86
|
-
generate({
|
|
87
|
-
prompt,
|
|
88
|
-
inputFiles,
|
|
89
|
-
n,
|
|
90
|
-
size,
|
|
91
|
-
}: {
|
|
92
|
-
prompt: string,
|
|
93
|
-
inputFiles: string[],
|
|
94
|
-
|
|
95
|
-
// default = lowest dimension supported
|
|
96
|
-
size?: string,
|
|
97
|
-
|
|
98
|
-
// one by default
|
|
99
|
-
n?: number
|
|
100
|
-
}): Promise<{
|
|
101
|
-
imageURLs?: string[];
|
|
102
|
-
error?: string;
|
|
103
|
-
}>;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* This interface is used to implement OAuth2 authentication adapters.
|
|
109
|
-
*/
|
|
110
|
-
export interface OAuth2Adapter {
|
|
111
|
-
/**
|
|
112
|
-
* This method should return navigatable URL to the OAuth2 provider authentication page.
|
|
113
|
-
*/
|
|
114
|
-
getAuthUrl(): string;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* This method should return the token from the OAuth2 provider using the provided code and redirect URI.
|
|
118
|
-
* @param code - The authorization code received from the OAuth2 provider
|
|
119
|
-
* @param redirect_uri - The redirect URI used in the authentication request
|
|
120
|
-
* @returns A promise that resolves to an object containing the email address of the authenticated user
|
|
121
|
-
*/
|
|
122
|
-
getTokenFromCode(code: string, redirect_uri: string): Promise<{ email: string }>;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* This method should return text (content) of SVG icon which will be used in the UI.
|
|
126
|
-
* Use official SVG icons with simplest possible conent, omit icons which have base64 encoded raster images inside.
|
|
127
|
-
*/
|
|
128
|
-
getIcon(): string;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* This method should return the text to be displayed on the button in the UI
|
|
132
|
-
*/
|
|
133
|
-
getButtonText?(): string;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* This method should return the name of the adapter
|
|
137
|
-
*/
|
|
138
|
-
getName?(): string;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Each storage adapter should support two ways of storing files:
|
|
144
|
-
* - publically (public URL) - the file can be accessed by anyone by HTTP GET / HEAD request with plain URL
|
|
145
|
-
* - privately (presigned URL) - the file can be accessed by anyone by HTTP GET / HEAD request only with presigned URLs, limited by expiration time
|
|
146
|
-
*
|
|
147
|
-
*/
|
|
148
|
-
export interface StorageAdapter {
|
|
149
|
-
/**
|
|
150
|
-
* 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).
|
|
151
|
-
* 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.
|
|
152
|
-
* The PUT method should fail if the file already exists.
|
|
153
|
-
*
|
|
154
|
-
* Adapter user will always pass next parameters to the method:
|
|
155
|
-
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
156
|
-
* @param expiresIn - The expiration time in seconds for the presigned URL
|
|
157
|
-
* @param contentType - The content type of the file to be uploaded, e.g. "image/png"
|
|
158
|
-
*
|
|
159
|
-
* @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
|
|
160
|
-
*/
|
|
161
|
-
getUploadSignedUrl(key: string, contentType: string, expiresIn?: number): Promise<{
|
|
162
|
-
uploadUrl: string;
|
|
163
|
-
uploadExtraParams?: Record<string, string>;
|
|
164
|
-
}>;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* 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).
|
|
168
|
-
* If adapter configured to store objects publically, this method should return the public URL of the file.
|
|
169
|
-
* If adapter configured to no allow public storing of images, this method should return the presigned URL for the file.
|
|
170
|
-
*
|
|
171
|
-
* @param key - The key of the file to be downloaded e.g. "uploads/file.txt"
|
|
172
|
-
* @param expiresIn - The expiration time in seconds for the presigned URL
|
|
173
|
-
*/
|
|
174
|
-
getDownloadUrl(key: string, expiresIn?: number): Promise<string>;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* This method should mark the file for deletion.
|
|
178
|
-
* If file is marked for delation and exists more then 24h (since creation date) it should be deleted.
|
|
179
|
-
* This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
|
|
180
|
-
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
181
|
-
*/
|
|
182
|
-
markKeyForDeletation(key: string): Promise<void>;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* This method should mark the file to not be deleted.
|
|
187
|
-
* This method should be used to cancel the deletion of the file if it was marked for deletion.
|
|
188
|
-
* @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
|
|
189
|
-
*/
|
|
190
|
-
markKeyForNotDeletation(key: string): Promise<void>;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* This method can start needed schedullers, cron jobs, etc. to clean up the storage.
|
|
195
|
-
* @param adapterUserUniqueRepresentation - The unique representation of the plugin instance which
|
|
196
|
-
* wil use this adapter. Might be handy if you need to distinguish between different instances of the same adapter.
|
|
197
|
-
*/
|
|
198
|
-
setupLifecycle(adapterUserUniqueRepresentation: string): Promise<void>;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* If adapter is configured to publically, this method should return true.
|
|
202
|
-
*/
|
|
203
|
-
objectCanBeAccesedPublicly(): Promise<boolean>;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* This method should return the key as a data URL (base64 encoded string).
|
|
207
|
-
* @param key - The key of the file to be converted to a data URL
|
|
208
|
-
* @returns A promise that resolves to a string containing the data URL
|
|
209
|
-
*/
|
|
210
|
-
getKeyAsDataURL(key: string): Promise<string>;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|