@joai/core 4.4.0 → 4.6.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.
@@ -0,0 +1,128 @@
1
+ //#region src/http/types.d.ts
2
+ interface IHttpService {
3
+ readonly baseUrl: string;
4
+ readonly authToken: string | null;
5
+ onNetworkError: (error: Error) => void;
6
+ onUnauthorized: (response: IAppResponse<any>) => void;
7
+ onSuccessfulResponse: (response: IAppResponse<any>) => void;
8
+ onMaintenanceMode: (response: IAppResponse<any>) => void;
9
+ get: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
10
+ post: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
11
+ put: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
12
+ patch: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
13
+ delete: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
14
+ }
15
+ interface IAppResponse<T> {
16
+ data: T;
17
+ meta?: any;
18
+ body: any;
19
+ errors: any;
20
+ ok: boolean;
21
+ paymentRequired: boolean;
22
+ noContent: boolean;
23
+ original: Response;
24
+ }
25
+ interface IRequestOptions {
26
+ isJson?: boolean;
27
+ headers?: {
28
+ [name: string]: string;
29
+ };
30
+ }
31
+ //#endregion
32
+ //#region src/json/types.d.ts
33
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
34
+ [key: string]: JsonValue;
35
+ };
36
+ //#endregion
37
+ //#region src/media/types.d.ts
38
+ type AppFileType = 'abi' | 'pdf' | 'image' | 'video' | 'json';
39
+ type AppFile = {
40
+ type: AppFileType;
41
+ original: File;
42
+ };
43
+ type MediaLibraryAttributes = {
44
+ uuid: string;
45
+ order: number;
46
+ name: string;
47
+ custom_properties: {
48
+ [key: string]: JsonValue;
49
+ };
50
+ preview_url: null | string;
51
+ original_url: null | string;
52
+ extension?: string;
53
+ size?: number;
54
+ };
55
+ type MediaMime = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'video/mp4' | 'video/webm' | 'video/quicktime' | 'video/x-msvideo' | 'audio/mpeg' | 'audio/mp3' | 'audio/ogg' | 'audio/wav' | 'audio/webm' | 'audio/aac' | 'audio/m4a' | 'audio/m4b' | 'audio/m4p' | 'audio/m4v' | 'application/pdf' | 'application/json';
56
+ type MediaAspectRatio = 'free' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
57
+ type Media = {
58
+ id: string;
59
+ name: string;
60
+ mime: MediaMime;
61
+ url: string;
62
+ library: MediaLibraryAttributes;
63
+ tags?: string[];
64
+ copyright?: string | null;
65
+ aiGenerated?: boolean;
66
+ };
67
+ //#endregion
68
+ //#region src/content/types.d.ts
69
+ type ContentStatus = 'draft' | 'published' | 'archived';
70
+ type ContentFieldType = 'text' | 'richText' | 'number' | 'boolean' | 'url' | 'image' | 'media' | 'list' | 'object' | 'reference';
71
+ type ContentField = {
72
+ key: string;
73
+ type: ContentFieldType;
74
+ label?: string;
75
+ required?: boolean;
76
+ };
77
+ type ContentDefinition = {
78
+ fields: ContentField[];
79
+ };
80
+ type ContentValue = string | number | boolean | null | ContentValue[] | {
81
+ [key: string]: ContentValue;
82
+ };
83
+ type ContentEntry = {
84
+ key: string;
85
+ value: ContentValue;
86
+ updatedAt: string;
87
+ };
88
+ type ContentVersion = {
89
+ id: string;
90
+ number: number;
91
+ status: ContentStatus;
92
+ entries: ContentEntry[];
93
+ snapshotHash: string;
94
+ origin: string;
95
+ createdAt: string;
96
+ updatedAt: string;
97
+ publishedAt: string | null;
98
+ };
99
+ type Content = {
100
+ id: string;
101
+ name: string;
102
+ slug: string;
103
+ schema: string | null;
104
+ definition: ContentDefinition;
105
+ metadata: Record<string, ContentValue>;
106
+ version: ContentVersion | null;
107
+ createdAt: string;
108
+ updatedAt: string;
109
+ };
110
+ type ContentPatch = {
111
+ key: string;
112
+ value: ContentValue;
113
+ };
114
+ type CreateContentInput = {
115
+ team: string;
116
+ name: string;
117
+ slug: string;
118
+ schema?: string | null;
119
+ definition: ContentDefinition;
120
+ metadata?: Record<string, ContentValue>;
121
+ };
122
+ type PatchContentInput = {
123
+ expectedVersion: number;
124
+ patches: ContentPatch[];
125
+ origin?: 'api' | 'inlineEditor' | 'joai' | 'mcp';
126
+ };
127
+ //#endregion
128
+ export { MediaMime as _, ContentFieldType as a, IHttpService as b, ContentValue as c, PatchContentInput as d, AppFile as f, MediaLibraryAttributes as g, MediaAspectRatio as h, ContentField as i, ContentVersion as l, Media as m, ContentDefinition as n, ContentPatch as o, AppFileType as p, ContentEntry as r, ContentStatus as s, Content as t, CreateContentInput as u, JsonValue as v, IRequestOptions as x, IAppResponse as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/core",
3
- "version": "4.4.0",
3
+ "version": "4.6.0",
4
4
  "description": "JoAi shared types, HTTP service, and config",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,32 +0,0 @@
1
- //#region src/http/types.d.ts
2
- interface IHttpService {
3
- readonly baseUrl: string;
4
- readonly authToken: string | null;
5
- onNetworkError: (error: Error) => void;
6
- onUnauthorized: (response: IAppResponse<any>) => void;
7
- onSuccessfulResponse: (response: IAppResponse<any>) => void;
8
- onMaintenanceMode: (response: IAppResponse<any>) => void;
9
- get: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
10
- post: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
11
- put: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
12
- patch: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
13
- delete: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
14
- }
15
- interface IAppResponse<T> {
16
- data: T;
17
- meta?: any;
18
- body: any;
19
- errors: any;
20
- ok: boolean;
21
- paymentRequired: boolean;
22
- noContent: boolean;
23
- original: Response;
24
- }
25
- interface IRequestOptions {
26
- isJson?: boolean;
27
- headers?: {
28
- [name: string]: string;
29
- };
30
- }
31
- //#endregion
32
- export { IHttpService as n, IRequestOptions as r, IAppResponse as t };