@templatical/core 0.34.3 → 0.36.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/dist/cloud/index.d.ts +121 -18
- package/dist/cloud/index.js +405 -92
- package/dist/cloud/index.js.map +1 -1
- package/dist/index.d.ts +27 -2
- package/dist/index.js +122 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cloud/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as UseEditorReturn } from "../editor-Bl4WsPU3.js";
|
|
2
|
-
import { AiChatMessage, AiConfig, AuthConfig, AuthRequestOptions, Block, Collaborator, CommentResponse, CommentsProvider, CustomFont, ExportResult, FontsConfig, HealthCheckResult, McpOperationPayload, MergeTag, PlanConfig, PlanFeatures, RenderProvider, SavedBlock, SavedBlocksProvider, ScoringCategory, ScoringFinding, ScoringResult, SdkAuthConfig, Template, TemplateContent, TemplatePatch, TemplateVersionResponse, TemplatesProvider, TestEmailConfig, TestEmailProvider, UserConfig, VersionHistoryProvider, WebSocketServerConfig } from "@templatical/types";
|
|
2
|
+
import { AiChatMessage, AiConfig, AuthConfig, AuthRequestOptions, Block, Collaborator, CommentResponse, CommentsProvider, CustomFont, ExportResult, FontsConfig, HealthCheckResult, McpOperationPayload, MediaProvider, MergeTag, PlanConfig, PlanFeatures, RenderProvider, SavedBlock, SavedBlocksProvider, ScoringCategory, ScoringFinding, ScoringResult, SdkAuthConfig, Template, TemplateContent, TemplatePatch, TemplateVersionResponse, TemplatesProvider, TestEmailConfig, TestEmailProvider, UserConfig, VersionHistoryProvider, WebSocketServerConfig } from "@templatical/types";
|
|
3
3
|
import { ComputedRef, Ref, ref } from "vue";
|
|
4
4
|
import { Channel, PresenceChannel } from "pusher-js";
|
|
5
5
|
//#region src/cloud/auth.d.ts
|
|
@@ -86,34 +86,34 @@ export declare class ApiClient {
|
|
|
86
86
|
sendTestEmail(templateId: string, payload: {
|
|
87
87
|
recipient: string;
|
|
88
88
|
html: string;
|
|
89
|
-
|
|
89
|
+
allowedEmails: string[];
|
|
90
90
|
signature: string;
|
|
91
91
|
}): Promise<void>;
|
|
92
92
|
private commentsUrl;
|
|
93
93
|
getComments(templateId: string): Promise<CommentResponse[]>;
|
|
94
94
|
createComment(templateId: string, data: {
|
|
95
95
|
body: string;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
blockId?: string;
|
|
97
|
+
parentId?: string;
|
|
98
|
+
userId: string;
|
|
99
|
+
userName: string;
|
|
100
|
+
userSignature: string;
|
|
101
101
|
}, headers?: Record<string, string>): Promise<CommentResponse>;
|
|
102
102
|
updateComment(templateId: string, commentId: string, data: {
|
|
103
103
|
body: string;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
userId: string;
|
|
105
|
+
userName: string;
|
|
106
|
+
userSignature: string;
|
|
107
107
|
}, headers?: Record<string, string>): Promise<CommentResponse>;
|
|
108
108
|
deleteComment(templateId: string, commentId: string, data: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
userId: string;
|
|
110
|
+
userName: string;
|
|
111
|
+
userSignature: string;
|
|
112
112
|
}, headers?: Record<string, string>): Promise<void>;
|
|
113
113
|
resolveComment(templateId: string, commentId: string, data: {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
userId: string;
|
|
115
|
+
userName: string;
|
|
116
|
+
userSignature: string;
|
|
117
117
|
}, headers?: Record<string, string>): Promise<CommentResponse>;
|
|
118
118
|
fetchConfig(): Promise<PlanConfig>;
|
|
119
119
|
listModules(search?: string, category?: string): Promise<SavedBlock[]>;
|
|
@@ -130,6 +130,88 @@ export declare class ApiClient {
|
|
|
130
130
|
deleteModule(id: string): Promise<void>;
|
|
131
131
|
}
|
|
132
132
|
//#endregion
|
|
133
|
+
//#region src/cloud/media-api.d.ts
|
|
134
|
+
/**
|
|
135
|
+
* Cloud's HTTP row for one media file. Same field names as
|
|
136
|
+
* {@link MediaAsset}. `thumbnailUrl` is optional; omit it and the grid
|
|
137
|
+
* uses `url`.
|
|
138
|
+
*/
|
|
139
|
+
interface CloudMediaItem {
|
|
140
|
+
id: string;
|
|
141
|
+
filename: string;
|
|
142
|
+
mimeType: string;
|
|
143
|
+
size: number;
|
|
144
|
+
url: string;
|
|
145
|
+
thumbnailUrl?: string | null;
|
|
146
|
+
folderId: string | null;
|
|
147
|
+
width: number | null;
|
|
148
|
+
height: number | null;
|
|
149
|
+
alt: string;
|
|
150
|
+
createdAt: string;
|
|
151
|
+
updatedAt: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Cloud's wire shape for one folder. The index endpoint may return a tree
|
|
155
|
+
* (`children`) or a flat list (`parentId`); the adapter flattens either.
|
|
156
|
+
*/
|
|
157
|
+
interface CloudMediaFolder {
|
|
158
|
+
id: string;
|
|
159
|
+
name: string;
|
|
160
|
+
parentId?: string | null;
|
|
161
|
+
children?: CloudMediaFolder[];
|
|
162
|
+
projectId?: string;
|
|
163
|
+
createdAt?: string;
|
|
164
|
+
}
|
|
165
|
+
interface CloudMediaBrowseParams {
|
|
166
|
+
folderId?: string | null;
|
|
167
|
+
search?: string;
|
|
168
|
+
category?: string;
|
|
169
|
+
sort?: string;
|
|
170
|
+
cursor?: string;
|
|
171
|
+
}
|
|
172
|
+
interface CloudMediaBrowseResponse {
|
|
173
|
+
data: CloudMediaItem[];
|
|
174
|
+
meta: {
|
|
175
|
+
path: string;
|
|
176
|
+
perPage: number;
|
|
177
|
+
nextCursor: string | null;
|
|
178
|
+
prevCursor: string | null;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
interface CloudMediaUsageInfo {
|
|
182
|
+
templateCount: number;
|
|
183
|
+
templateNames: string[];
|
|
184
|
+
}
|
|
185
|
+
interface CloudMediaUsageResponse {
|
|
186
|
+
data: Record<string, CloudMediaUsageInfo>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Cloud's HTTP client for media. Auth and project/tenant scoping come from
|
|
190
|
+
* {@link AuthManager}. The BYO contract lives on
|
|
191
|
+
* `createCloudMediaProvider`, which maps this client's rows.
|
|
192
|
+
*/
|
|
193
|
+
export declare class MediaApiClient {
|
|
194
|
+
private readonly authManager;
|
|
195
|
+
constructor(authManager: AuthManager);
|
|
196
|
+
private get projectId();
|
|
197
|
+
private get tenantSlug();
|
|
198
|
+
private get baseParams();
|
|
199
|
+
private request;
|
|
200
|
+
browseMedia(params: CloudMediaBrowseParams): Promise<CloudMediaBrowseResponse>;
|
|
201
|
+
uploadMedia(file: File, folderId?: string | null): Promise<CloudMediaItem>;
|
|
202
|
+
updateMedia(mediaId: string, filename?: string, alt?: string): Promise<CloudMediaItem>;
|
|
203
|
+
deleteMedia(ids: string[]): Promise<void>;
|
|
204
|
+
moveMedia(ids: string[], folderId: string | null): Promise<CloudMediaItem[]>;
|
|
205
|
+
getMediaFolders(): Promise<CloudMediaFolder[]>;
|
|
206
|
+
createMediaFolder(name: string, parentId?: string | null): Promise<CloudMediaFolder>;
|
|
207
|
+
renameMediaFolder(folderId: string, name: string): Promise<CloudMediaFolder>;
|
|
208
|
+
deleteMediaFolder(folderId: string): Promise<void>;
|
|
209
|
+
checkMediaUsage(ids: string[]): Promise<CloudMediaUsageResponse>;
|
|
210
|
+
getFrequentlyUsed(): Promise<CloudMediaItem[]>;
|
|
211
|
+
importFromUrl(url: string, folderId?: string | null): Promise<CloudMediaItem>;
|
|
212
|
+
replaceMedia(mediaId: string, file: File): Promise<CloudMediaItem>;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
133
215
|
//#region src/cloud/url-builder.d.ts
|
|
134
216
|
export declare function buildUrl(template: string, params: Record<string, string>): string;
|
|
135
217
|
export declare const API_ROUTES: {
|
|
@@ -345,7 +427,7 @@ interface CreateCloudCommentsProviderOptions {
|
|
|
345
427
|
* Two things about the write payloads are Cloud's alone and stay on this side of
|
|
346
428
|
* the seam:
|
|
347
429
|
*
|
|
348
|
-
* - **The author is signed.** `
|
|
430
|
+
* - **The author is signed.** `userId` / `userName` / `userSignature` come from
|
|
349
431
|
* the JWT, not from the editor's `user` config, so a browser cannot attribute a
|
|
350
432
|
* comment to someone else. The editor's `user` key still gates the feature and
|
|
351
433
|
* drives "you wrote this" in the UI; the two agree because `initCloud()` fills
|
|
@@ -433,6 +515,27 @@ export declare function useWebSocket(options: UseWebSocketOptions): UseWebSocket
|
|
|
433
515
|
*/
|
|
434
516
|
export declare function createCloudSavedBlocksProvider(authManager: AuthManager): SavedBlocksProvider;
|
|
435
517
|
//#endregion
|
|
518
|
+
//#region src/cloud/media-provider.d.ts
|
|
519
|
+
/**
|
|
520
|
+
* Cloud-backed {@link MediaProvider} — the Templatical Cloud adapter for the
|
|
521
|
+
* same DAM contract consumers implement themselves.
|
|
522
|
+
*
|
|
523
|
+
* Every method is a function: Cloud's media storage is what the plan pays
|
|
524
|
+
* for, so there is no Cloud tier that can list but not upload. A consumer
|
|
525
|
+
* who wants a read-only gallery supplies their own provider with the
|
|
526
|
+
* mutations set to `false`.
|
|
527
|
+
*
|
|
528
|
+
* **Ignores `templateId`.** Cloud's library is project-scoped; a CMS that
|
|
529
|
+
* scopes a gallery per template reads that param in its own `list`.
|
|
530
|
+
*
|
|
531
|
+
* **`storage` / `maxFileSize` / `mimeTypes` are live.** They read
|
|
532
|
+
* `getPlanConfig()` at call time, because plan config arrives after
|
|
533
|
+
* construction. Snapshotting at setup would pin `storage()` to `null` and
|
|
534
|
+
* hide the quota ring for the whole session. A spread of this object
|
|
535
|
+
* freezes the getters — `initCloud()` must `Object.assign`, never spread.
|
|
536
|
+
*/
|
|
537
|
+
export declare function createCloudMediaProvider(authManager: AuthManager, getPlanConfig?: () => PlanConfig | null): MediaProvider;
|
|
538
|
+
//#endregion
|
|
436
539
|
//#region src/cloud/templates-provider.d.ts
|
|
437
540
|
/**
|
|
438
541
|
* Cloud-backed {@link TemplatesProvider} — the Templatical Cloud adapter for the
|
|
@@ -638,5 +741,5 @@ interface UseMcpListenerOptions {
|
|
|
638
741
|
}
|
|
639
742
|
export declare function useMcpListener(options: UseMcpListenerOptions): void;
|
|
640
743
|
//#endregion
|
|
641
|
-
export type { AuthConfig, AuthRequestOptions, CreateCloudCommentsProviderOptions, CreateCloudRenderProviderOptions, CreateCloudTestEmailProviderOptions, DesignReferenceInput, ExportFontsPayload, PresenceMember, RealtimeChannel, SdkAuthConfig, TestEmailConfig, UseAiChatOptions, UseAiChatReturn, UseAiConfigReturn, UseAiRewriteOptions, UseAiRewriteReturn, UseCollaborationOptions, UseCollaborationReturn, UseDesignReferenceOptions, UseDesignReferenceReturn, UseExportOptions, UseExportReturn, UseMcpListenerOptions, UsePlanConfigOptions, UsePlanConfigReturn, UseTemplateScoringOptions, UseTemplateScoringReturn, UseTestEmailOptions, UseTestEmailReturn, UseWebSocketOptions, UseWebSocketReturn, UserConfig, WebSocketClientOptions, WebSocketConfig };
|
|
744
|
+
export type { AuthConfig, AuthRequestOptions, CloudMediaBrowseParams, CloudMediaBrowseResponse, CloudMediaFolder, CloudMediaItem, CloudMediaUsageInfo, CloudMediaUsageResponse, CreateCloudCommentsProviderOptions, CreateCloudRenderProviderOptions, CreateCloudTestEmailProviderOptions, DesignReferenceInput, ExportFontsPayload, PresenceMember, RealtimeChannel, SdkAuthConfig, TestEmailConfig, UseAiChatOptions, UseAiChatReturn, UseAiConfigReturn, UseAiRewriteOptions, UseAiRewriteReturn, UseCollaborationOptions, UseCollaborationReturn, UseDesignReferenceOptions, UseDesignReferenceReturn, UseExportOptions, UseExportReturn, UseMcpListenerOptions, UsePlanConfigOptions, UsePlanConfigReturn, UseTemplateScoringOptions, UseTemplateScoringReturn, UseTestEmailOptions, UseTestEmailReturn, UseWebSocketOptions, UseWebSocketReturn, UserConfig, WebSocketClientOptions, WebSocketConfig };
|
|
642
745
|
//# sourceMappingURL=index.d.ts.map
|