mirror of
https://github.com/strapi/strapi.git
synced 2025-10-10 23:54:03 +00:00

* feat: chat feat: apply changes feat: integrate with ctb feat: marker chore: remove comment feat: new chat feat: copy message feat: upload modal feat: upload file feat: errors and stop chat chore: refactor transforms chore: format relations chore: chat title chore: remove architect dependency feat: empt state chore: improve text area focus * feat: chat imports feat: resizable text area fix: re add chat chore: translations feat: env vars fix: minor chat issues feat: feedback fix: rebase feat: import folder feat: limits feat: attachments dropzone chore: file attachments cleanup chore: track chat id feat: figma import fix :token feat: figma token fix: attribute status when chat makes updates feat: image upload * feat: staging integration * chore: remove logs * feat: use tool call result instead of annotation * fix: invalid component uid * chore: chat input focus ring * fix: ui issues * fix: default draft and publish and do not modify singular name * fix: minor transforms * fix: linting * test(front): update snapshots * chore: fix misplaced getstarted project schema * chore: remove unused import * security: validate exact path of host * fix: define process better for playwright to work * fix: process env in vite config for playwright * chore: use production url * feat(ctb): Tracking events for AI Chat interaction (#23731) * feat(content-type-builder): WIP tracking events for chat interactions * fix: typescript build errors * fix: event name and build errors * chore: send ai key with analytics * chore: actually send licenseKey * chore: send ailicensekey with groupproperties * fix: didStartNewChat * chore: track new chats * feat: enhance attachment type management in AI chat components * fix: update chat status handling in ChatProvider component * feat: add optional aiLicenseKey to Strapi interface --------- Co-authored-by: Jamie Howard <jhoward1994@gmail.com> * refactor: remove didusersendmessage tracking event (#23777) * fix: merge conflict * fix: send projectId to AI server * feat: add a enabled config for AI features (#24060) * feat: add getAiToken endpoint (#24172) * feat: add getAiToken route * fix: change route name, remove project id * fix: type issue and fix schema * feat: retrieve ai token from frontend (#24226) --------- Co-authored-by: Jamie Howard <jhoward1994@gmail.com> * fix: use primary500 for links in ai chat * chore: migrate to AI SDK v5 (#24252) * fix: migrate code for v5 * t:wq * feat: push schemas to ctb * chore: remove old code * chore: remove ts-no-check * chore: fix comment * fix: ai server logs (#24318) * test(back): fix error log tests --------- Co-authored-by: Marc Roig <marc12info@gmail.com> * fix: configure ai ctb csp middleware without overriding user or default config * future(upload): generate image metadata on file upload (#24365) * chore: create aiMetadata service with isEnabled * chore: extract getAiToken to service * fix: unit test * future(upload): generate metadata with ai * fix: ts build * fix: only send images to ai server * test: add unit tests * fix: unit test --------- Co-authored-by: markkaylor <mark.kaylor@strapi.io> * AI media lib bulk update (#24414) * feat(packages): adding endpoint for bulk update * feat(packages): linting * feat(packages): adding tests * feat(packages): cleanup * feat: guided tour for ai ctb (#24411) * feat(upload): adding aiMetadata into settings (#24468) feat(upload): adding aiMetadata into settings * feat: add AI upload modal (#24407) * chore: create aiMetadata service with isEnabled * chore: extract getAiToken to service * fix: unit test * future(upload): generate metadata with ai * feat: add AI upload modal * feat: add edit and delete to upload modal * fix: remove sparkle icon on edit * fix: add error handling * chore: refactor ai upload modal reducer * fix: catch ai token generation error * chore: add useBulkEdit hook * feat: connect to bulk edit endpoint * fix: e2e test * fix: ci in both ce and ee --------- Co-authored-by: Rémi de Juvigny <remi.dejuvigny@strapi.io> Co-authored-by: Rémi de Juvigny <8087692+remidej@users.noreply.github.com> * feat(upload): applying ai enabled logic for media library (#24486) feat(upload): applying ai enabled logic for media library * fix: sparkle icon * fix: set ai server prod url * fix: default config to enabled * fix: cursor moving to the end when editing text * fix: upload in the right folder * fix: close modal when deleting last item * chore: use STRAPI_AI_URL everywhere * fix: bulk upload from frontend * fix: restore sparkle icon on inputs * fix: unit test ci * feat(upload): generating metadata from thumbnail (#24515) * feat(upload): generating metadata from thumbnail * feat(upload): fixing linting issue * feat(upload): fixing tests and addressiing feedback * feat(upload): fixing lint * fix: check for cms-ai entitlement * fix: tests * fix: race condition failing front unit tests --------- Co-authored-by: Marc-Roig <marc12info@gmail.com> Co-authored-by: Ben Irvin <ben@innerdvations.com> Co-authored-by: Bassel Kanso <bassel.kanso@strapi.io> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Jamie Howard <jhoward1994@gmail.com> Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com> Co-authored-by: Bassel Kanso <basselkanso82@gmail.com> Co-authored-by: Ziyi <daydreamnation@live.com> Co-authored-by: markkaylor <mark.kaylor@strapi.io> Co-authored-by: Araksya Gevorgyan <31159659+araksyagevorgyan@users.noreply.github.com> Co-authored-by: Adrien L <thewebsdoor@gmail.com>
261 lines
5.1 KiB
TypeScript
261 lines
5.1 KiB
TypeScript
import { errors } from '@strapi/utils';
|
|
|
|
type SortOrder = 'ASC' | 'DESC';
|
|
|
|
type SortKey = 'createdAt' | 'name' | 'updatedAt';
|
|
|
|
// Abstract type for comparison operators where the keys are generic strings
|
|
type ComparisonOperators<T> = {
|
|
[operator: string]: T | T[] | boolean; // Any string can be used as an operator key
|
|
};
|
|
|
|
// Abstract type for filter conditions with dynamic field names
|
|
export type FilterCondition<T> = {
|
|
[field: string]: T | ComparisonOperators<T> | FilterCondition<T>; // Field names are dynamic and values are comparison operators
|
|
};
|
|
|
|
// Abstract type for filters where the logical operator (like $and) is a generic string
|
|
type Filters<T> = {
|
|
[logicOperator: string]: FilterCondition<T>[]; // Logical operator key is a generic string
|
|
};
|
|
|
|
export type Query = {
|
|
_q?: string;
|
|
folderPath?: string;
|
|
folder?:
|
|
| null
|
|
| number
|
|
| {
|
|
id: number;
|
|
};
|
|
page?:
|
|
| string
|
|
| number
|
|
| {
|
|
id: string | number;
|
|
};
|
|
pageSize?: string | number;
|
|
pagination?: {
|
|
pageSize: number;
|
|
};
|
|
sort?: `${SortKey}:${SortOrder}`;
|
|
filters?: Filters<string | number | boolean>;
|
|
state?: boolean;
|
|
};
|
|
|
|
type FileFormat = {
|
|
name: string;
|
|
hash: string;
|
|
ext: string;
|
|
mime: string;
|
|
path: null | string;
|
|
width: number;
|
|
height: number;
|
|
size: number;
|
|
sizeInBytes: number;
|
|
url: string;
|
|
};
|
|
|
|
export interface File {
|
|
id: number;
|
|
name: string;
|
|
alternativeText?: string | null;
|
|
caption?: string | null;
|
|
width?: number | null;
|
|
height?: number | null;
|
|
formats?:
|
|
| Record<string, FileFormat>
|
|
| {
|
|
thumbnail: {
|
|
url: string;
|
|
};
|
|
}
|
|
| null;
|
|
hash: string;
|
|
ext?: string;
|
|
mime?: string;
|
|
size?: number;
|
|
sizeInBytes?: number;
|
|
url?: string;
|
|
previewUrl?: string | null;
|
|
path?: string | null;
|
|
provider?: string;
|
|
provider_metadata?: Record<string, unknown> | null;
|
|
isUrlSigned?: boolean;
|
|
folder?: number | string | null;
|
|
folderPath?: string;
|
|
related?: {
|
|
id: string | number;
|
|
__type: string;
|
|
__pivot: { field: string };
|
|
}[];
|
|
createdAt?: string;
|
|
updatedAt?: string;
|
|
createdBy?: number;
|
|
publishedAt?: string;
|
|
updatedBy?: number;
|
|
isLocal?: boolean;
|
|
}
|
|
|
|
export interface RawFile extends Blob {
|
|
size: number;
|
|
lastModified: number;
|
|
name: string;
|
|
type: string;
|
|
}
|
|
|
|
export interface Pagination {
|
|
page: number;
|
|
pageSize: number;
|
|
pageCount: number;
|
|
total: number;
|
|
}
|
|
|
|
/**
|
|
* GET /upload/files - Get files
|
|
*/
|
|
export declare namespace GetFiles {
|
|
export interface Request {
|
|
body: {};
|
|
query: {
|
|
page?: string;
|
|
pageSize?: string;
|
|
folder: number | null;
|
|
sort?: `${SortKey}:${SortOrder}`;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
results: File[];
|
|
pagination: Pagination;
|
|
};
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* GET /upload/files/:id - Get specific file
|
|
*/
|
|
export declare namespace GetFile {
|
|
export interface Request {
|
|
params: { id: number };
|
|
query: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: File;
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload/actions/bulk-delete - Delete Files
|
|
*/
|
|
export declare namespace BulkDeleteFiles {
|
|
export interface Request {
|
|
body: {
|
|
fileIds: number[];
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
data: {
|
|
files: File[];
|
|
folders: [];
|
|
};
|
|
};
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload/actions/bulk-move - Move Files
|
|
*/
|
|
export declare namespace BulkMoveFiles {
|
|
export interface Request {
|
|
body: {
|
|
fileIds: number[];
|
|
destinationFolderId: number;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: {
|
|
data: {
|
|
files: File[];
|
|
folders: [];
|
|
};
|
|
};
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* DELETE /upload/files/:id - Delete a specific asset
|
|
*/
|
|
export declare namespace DeleteFile {
|
|
export interface Request {
|
|
params: { id: number };
|
|
query: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: File;
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload - Create a file
|
|
*/
|
|
export declare namespace CreateFile {
|
|
export interface Request {
|
|
body: FormData;
|
|
files: File[];
|
|
}
|
|
export interface Response {
|
|
data: File[];
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload?id=:id - Update asset
|
|
*/
|
|
export declare namespace UpdateFile {
|
|
export interface Request {
|
|
body: FormData;
|
|
params: { id: number };
|
|
}
|
|
export interface Response {
|
|
data: File;
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /upload/actions/bulk-update - Bulk update files
|
|
*/
|
|
export declare namespace BulkUpdateFiles {
|
|
export interface Request {
|
|
body: {
|
|
updates: Array<{
|
|
id: number;
|
|
fileInfo: {
|
|
name?: string;
|
|
alternativeText?: string | null;
|
|
caption?: string | null;
|
|
folder?: number | null;
|
|
};
|
|
}>;
|
|
};
|
|
}
|
|
|
|
export interface Response {
|
|
data: File[];
|
|
error?: errors.ApplicationError | errors.ValidationError;
|
|
}
|
|
}
|