@conloca/content-api-client 0.1.16 → 0.2.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.
Files changed (45) hide show
  1. package/README.md +190 -105
  2. package/dist/client.d.ts +12 -14
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +26 -25
  5. package/dist/client.js.map +1 -0
  6. package/dist/data-bindings.d.ts +13 -0
  7. package/dist/data-bindings.d.ts.map +1 -0
  8. package/dist/data-bindings.js +71 -0
  9. package/dist/data-bindings.js.map +1 -0
  10. package/dist/hooks.d.ts +42 -39
  11. package/dist/hooks.d.ts.map +1 -1
  12. package/dist/hooks.js +93 -47
  13. package/dist/hooks.js.map +1 -0
  14. package/dist/index.d.ts +5 -5
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +5 -4
  17. package/dist/index.js.map +1 -0
  18. package/dist/lib/content-api-client.js +1 -0
  19. package/dist/lib/content-api-client.js.map +1 -0
  20. package/dist/test-helpers.d.ts +1 -2
  21. package/dist/test-helpers.d.ts.map +1 -1
  22. package/dist/test-helpers.js +2 -2
  23. package/dist/test-helpers.js.map +1 -0
  24. package/dist/testing.d.ts +1 -1
  25. package/dist/testing.d.ts.map +1 -1
  26. package/dist/testing.js +2 -1
  27. package/dist/testing.js.map +1 -0
  28. package/package.json +44 -44
  29. package/src/client.ts +513 -0
  30. package/src/data-bindings.ts +104 -0
  31. package/src/hooks.tsx +959 -0
  32. package/src/index.ts +50 -0
  33. package/src/lib/content-api-client.ts +3 -0
  34. package/src/test-helpers.ts +282 -0
  35. package/src/testing.ts +8 -0
  36. package/dist/index.d.mts +0 -234
  37. package/dist/index.d.mts.map +0 -1
  38. package/dist/index.mjs +0 -1106
  39. package/dist/index.mjs.map +0 -1
  40. package/dist/test-helpers-BFyjmKzv.mjs +0 -221
  41. package/dist/test-helpers-BFyjmKzv.mjs.map +0 -1
  42. package/dist/test-helpers-B_YQhpE2.d.mts +0 -93
  43. package/dist/test-helpers-B_YQhpE2.d.mts.map +0 -1
  44. package/dist/testing.d.mts +0 -2
  45. package/dist/testing.mjs +0 -2
package/src/index.ts ADDED
@@ -0,0 +1,50 @@
1
+ // Type re-exports for cms-spa layer compliance
2
+ export type {
3
+ AssetEntry,
4
+ AssetUsage,
5
+ ContentData,
6
+ ContentEntry,
7
+ ContentIdentity,
8
+ ContentManifest,
9
+ ContentMeta,
10
+ ContentMetaPatch,
11
+ ContentType,
12
+ CreateResult,
13
+ DataBindingConfig,
14
+ DataCollectionEntry,
15
+ DataContext,
16
+ DataEditable,
17
+ DeleteResult,
18
+ EditorDataBindings,
19
+ FolderListing,
20
+ FolderTreeNode,
21
+ FragmentEditable,
22
+ HostPageMeta,
23
+ LocaleVersion,
24
+ LocalizedEntry,
25
+ LocalizedManifest,
26
+ MDXCompileResponse,
27
+ MDXHeading,
28
+ PageReference,
29
+ PathnameValidationReason,
30
+ PathnameValidationResult,
31
+ SitesConfig,
32
+ UpdateResult,
33
+ } from '@conloca/content-api';
34
+ // Runtime re-exports for cms-spa layer compliance
35
+ export {
36
+ dataEditableSchema,
37
+ ErrorCodes,
38
+ formatFileSize,
39
+ fragmentEditableSchema,
40
+ IMAGE_EXTENSION_MIME,
41
+ isContentPublished,
42
+ localesOf,
43
+ metaString,
44
+ normalizeAndValidatePathname,
45
+ pageReferenceOf,
46
+ } from '@conloca/content-api';
47
+
48
+ export * from './client.js';
49
+ export * from './hooks.js';
50
+ export { API_ROUTES } from './test-helpers.js';
@@ -0,0 +1,3 @@
1
+ export function contentApiClient(): string {
2
+ return 'content-api-client';
3
+ }
@@ -0,0 +1,282 @@
1
+ import type {
2
+ BatchResult,
3
+ ContentEntry,
4
+ ContentManifest,
5
+ CreateResult,
6
+ DeleteResult,
7
+ LocalizedEntry,
8
+ UpdateResult,
9
+ } from '@conloca/content-api';
10
+
11
+ /**
12
+ * Test helpers for mocking Content API Client
13
+ */
14
+
15
+ /**
16
+ * API route patterns used by the content API
17
+ * These match the routes defined in content-api/src/middleware.ts
18
+ */
19
+ export const API_ROUTES = {
20
+ SITES: '/sites',
21
+ ALL_CONTENT: '/content',
22
+ CONTENT_BY_ID: (id: string) => `/content/${id}`,
23
+ LOCALIZED_CONTENT: (id: string, locale: string) => `/content/${id}/${locale}`,
24
+ SITE_PAGES: (site: string) => `/${site}/pages`,
25
+ FRAGMENTS: '/fragments',
26
+ COLLECTIONS: '/content/collections',
27
+ BATCH_UPDATE: '/content/batch',
28
+ FIND_UNTRANSLATED: (locale: string) => `/untranslated/${locale}`,
29
+ } as const;
30
+
31
+ export interface MockResponse {
32
+ status?: number;
33
+ headers?: Record<string, string>;
34
+ body?: any;
35
+ }
36
+
37
+ /**
38
+ * Creates a mock fetch function for testing
39
+ * Note: This requires a mock function from your test framework (e.g., bun:test, jest, vitest)
40
+ */
41
+ export function createMockFetch(mockFn: (impl?: any) => any) {
42
+ return mockFn(() => Promise.resolve(new Response()));
43
+ }
44
+
45
+ /**
46
+ * Creates a Response object with JSON body
47
+ */
48
+ export function jsonResponse(body: any, options: { status?: number; headers?: Record<string, string> } = {}): Response {
49
+ return new Response(JSON.stringify(body), {
50
+ status: options.status || 200,
51
+ headers: {
52
+ 'Content-Type': 'application/json',
53
+ ...options.headers,
54
+ },
55
+ });
56
+ }
57
+
58
+ /**
59
+ * Creates a mock ContentEntry
60
+ */
61
+ export function mockContentEntry(overrides?: Partial<ContentEntry>): ContentEntry {
62
+ return {
63
+ id: 'test-id',
64
+ site: 'test-site',
65
+ collection: 'pages',
66
+ type: 'puck',
67
+ kind: 'page',
68
+ locales: {
69
+ en: {
70
+ locale: 'en',
71
+ etag: 'metaHash.contentHash',
72
+ created: '2024-01-01T00:00:00Z',
73
+ modified: '2024-01-01T00:00:00Z',
74
+ pathname: '/test',
75
+ meta: {
76
+ title: 'Test Page',
77
+ },
78
+ content: { puckData: {} },
79
+ },
80
+ },
81
+ ...overrides,
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Creates a mock ContentManifest
87
+ */
88
+ export function mockContentManifest(overrides?: Partial<ContentManifest>): ContentManifest {
89
+ return {
90
+ id: 'test-id',
91
+ site: 'test-site',
92
+ collection: 'pages',
93
+ type: 'puck',
94
+ kind: 'page',
95
+ locales: {
96
+ en: {
97
+ locale: 'en',
98
+ etag: 'metaHash.contentHash',
99
+ created: '2024-01-01T00:00:00Z',
100
+ modified: '2024-01-01T00:00:00Z',
101
+ pathname: '/test',
102
+ meta: {
103
+ title: 'Test Page',
104
+ },
105
+ },
106
+ },
107
+ ...overrides,
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Creates a mock LocalizedEntry
113
+ */
114
+ export function mockLocalizedEntry(overrides?: Partial<LocalizedEntry>): LocalizedEntry {
115
+ return {
116
+ id: 'test-id',
117
+ site: 'test-site',
118
+ collection: 'pages',
119
+ type: 'puck',
120
+ kind: 'page',
121
+ localized: {
122
+ locale: 'en',
123
+ etag: 'metaHash.contentHash',
124
+ created: '2024-01-01T00:00:00Z',
125
+ modified: '2024-01-01T00:00:00Z',
126
+ pathname: '/test',
127
+ meta: {
128
+ title: 'Test Page',
129
+ },
130
+ content: { puckData: {} },
131
+ },
132
+ ...overrides,
133
+ };
134
+ }
135
+
136
+ /**
137
+ * Creates a mock CreateResult
138
+ */
139
+ export function mockCreateResult(overrides?: Partial<CreateResult>): CreateResult {
140
+ return {
141
+ success: true,
142
+ id: 'new-id',
143
+ etag: 'newMetaHash.newContentHash',
144
+ created: new Date('2024-01-01T00:00:00.000Z'),
145
+ ...overrides,
146
+ };
147
+ }
148
+
149
+ /**
150
+ * Creates a mock UpdateResult
151
+ */
152
+ export function mockUpdateResult(overrides?: Partial<UpdateResult>): UpdateResult {
153
+ return {
154
+ success: true,
155
+ etag: 'updatedMetaHash.updatedContentHash',
156
+ modified: new Date('2024-01-01T00:00:00.000Z'),
157
+ ...overrides,
158
+ };
159
+ }
160
+
161
+ /**
162
+ * Creates a mock DeleteResult
163
+ */
164
+ export function mockDeleteResult(overrides?: Partial<DeleteResult>): DeleteResult {
165
+ return {
166
+ success: true,
167
+ ...overrides,
168
+ };
169
+ }
170
+
171
+ /**
172
+ * Creates a mock BatchResult
173
+ */
174
+ export function mockBatchResult(overrides?: Partial<BatchResult>): BatchResult {
175
+ return {
176
+ operations: [],
177
+ success: true,
178
+ updated: 0,
179
+ failed: 0,
180
+ ...overrides,
181
+ };
182
+ }
183
+
184
+ /**
185
+ * Mock helper for setting up common API responses
186
+ */
187
+ export class MockAPIResponses {
188
+ constructor(private fetchMock: any) {}
189
+
190
+ mockGetContent(content: ContentEntry | null, status = 200) {
191
+ if (content) {
192
+ this.fetchMock.mockResolvedValueOnce(jsonResponse(content, { status }));
193
+ } else {
194
+ this.fetchMock.mockResolvedValueOnce(new Response('Not found', { status: 404 }));
195
+ }
196
+ return this;
197
+ }
198
+
199
+ mockGetLocalized(entry: LocalizedEntry | null, status = 200) {
200
+ if (entry) {
201
+ this.fetchMock.mockResolvedValueOnce(jsonResponse(entry, { status }));
202
+ } else {
203
+ this.fetchMock.mockResolvedValueOnce(new Response('Not found', { status: 404 }));
204
+ }
205
+ return this;
206
+ }
207
+
208
+ mockListContent(items: ContentManifest[], status = 200) {
209
+ this.fetchMock.mockResolvedValueOnce(jsonResponse({ items }, { status }));
210
+ return this;
211
+ }
212
+
213
+ mockCreateContent(result: CreateResult, status = 200) {
214
+ this.fetchMock.mockResolvedValueOnce(
215
+ jsonResponse(
216
+ {
217
+ ...result,
218
+ created: result.created?.toISOString(),
219
+ },
220
+ { status },
221
+ ),
222
+ );
223
+ return this;
224
+ }
225
+
226
+ mockUpdateContent(result: UpdateResult, status = 200) {
227
+ this.fetchMock.mockResolvedValueOnce(
228
+ jsonResponse(
229
+ {
230
+ ...result,
231
+ modified: result.modified?.toISOString(),
232
+ },
233
+ { status },
234
+ ),
235
+ );
236
+ return this;
237
+ }
238
+
239
+ mockDeleteContent(result: DeleteResult, status = 200) {
240
+ this.fetchMock.mockResolvedValueOnce(jsonResponse(result, { status }));
241
+ return this;
242
+ }
243
+
244
+ mockStaleWrite(currentEtag: string) {
245
+ this.fetchMock.mockResolvedValueOnce(
246
+ jsonResponse(
247
+ {
248
+ error: {
249
+ code: 'STALE_WRITE',
250
+ message: 'Content has been modified',
251
+ details: { currentEtag },
252
+ },
253
+ },
254
+ { status: 412 },
255
+ ),
256
+ );
257
+ return this;
258
+ }
259
+
260
+ mockError(message: string, status = 500) {
261
+ this.fetchMock.mockResolvedValueOnce(new Response(message, { status }));
262
+ return this;
263
+ }
264
+
265
+ mockNetworkError() {
266
+ this.fetchMock.mockRejectedValueOnce(new Error('Network error'));
267
+ return this;
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Setup fetch mock with helper
273
+ * @param mockFn - Mock function from your test framework (e.g., mock from bun:test)
274
+ */
275
+ export function setupFetchMock(mockFn: (impl?: any) => any) {
276
+ const fetchMock = createMockFetch(mockFn);
277
+ global.fetch = fetchMock;
278
+ return {
279
+ fetchMock,
280
+ responses: new MockAPIResponses(fetchMock),
281
+ };
282
+ }
package/src/testing.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Test helpers for @conloca/content-api-client
3
+ *
4
+ * Import from '@conloca/content-api-client/testing' to use these helpers in tests.
5
+ * This keeps test utilities separate from production code for better tree-shaking.
6
+ */
7
+
8
+ export * from './test-helpers.js';
package/dist/index.d.mts DELETED
@@ -1,234 +0,0 @@
1
- import { t as API_ROUTES } from "./test-helpers-B_YQhpE2.mjs";
2
- import { AssetEntry, AssetEntry as AssetEntry$1, AssetUsage, AssetUsage as AssetUsage$1, BatchResult, BlockEditable, ContentData, ContentEntry, ContentEntry as ContentEntry$1, ContentIdentity, ContentListResult, ContentManifest, ContentManifest as ContentManifest$1, ContentType, CreateContentInput, CreateResult, CreateResult as CreateResult$1, DataCollectionEntry, DataContext, DataContext as DataContext$1, DataEditable, DeleteResult, DeleteResult as DeleteResult$1, ErrorCode, ErrorCodes, FolderListing, FolderListing as FolderListing$1, FolderTreeNode, FolderTreeNode as FolderTreeNode$1, GitCommitResult, GitCommitResult as GitCommitResult$1, GitPullResult, GitPullResult as GitPullResult$1, GitPushResult, GitPushResult as GitPushResult$1, GitStatus, GitStatus as GitStatus$1, GlobalFilters, LocaleVersion, LocalizedEntry, LocalizedEntry as LocalizedEntry$1, LocalizedManifest, MDXCompileResponse, MDXCompileResponse as MDXCompileResponse$1, MoveResult, PageReference, PathnameValidationReason, PathnameValidationResult, SitesConfig, SitesConfig as SitesConfig$1, UpdateLocaleInput, UpdateResult, UpdateResult as UpdateResult$1, blockEditableSchema, dataEditableSchema, formatFileSize, localesOf, normalizeAndValidatePathname } from "@conloca/content-api";
3
- //#region src/client.d.ts
4
- interface ContentAPIClientOptions {
5
- baseUrl?: string;
6
- fetch?: typeof fetch;
7
- }
8
- declare class ContentAPIClient {
9
- private baseUrl;
10
- private fetch;
11
- constructor(options?: ContentAPIClientOptions);
12
- private encodeAssetPath;
13
- private fetchAPI;
14
- getContent(id: string): Promise<ContentEntry$1 | null>;
15
- getLocalized(id: string, locale: string): Promise<LocalizedEntry$1 | null>;
16
- createContent(data: CreateContentInput): Promise<CreateResult$1>;
17
- updateLocalized(input: UpdateLocaleInput): Promise<UpdateResult$1>;
18
- deleteContent(id: string, etag: string): Promise<DeleteResult$1>;
19
- deleteLocalized(input: {
20
- id: string;
21
- locale: string;
22
- etag: string;
23
- }): Promise<DeleteResult$1>;
24
- getSitePages(site: string, locale?: string): Promise<ContentListResult>;
25
- getPageByPathname(site: string, pathname: string, locale?: string): Promise<ContentManifest$1 | null>;
26
- isPathnameAvailable(site: string, pathname: string, excludeId?: string): Promise<boolean>;
27
- movePage(site: string, id: string, pathname: string, locale: string, etag: string): Promise<MoveResult>;
28
- getBlocks(collection?: string, locale?: string): Promise<ContentListResult>;
29
- getBlockByName(name: string, collection?: string, locale?: string): Promise<ContentManifest$1 | null>;
30
- compileMDX(mdxContent: string): Promise<MDXCompileResponse$1>;
31
- getData(collection?: string, locale?: string): Promise<ContentListResult>;
32
- getDataByName(name: string, collection: string, locale?: string): Promise<ContentManifest$1 | null>;
33
- isDataNameAvailable(name: string, collection: string, excludeId?: string): Promise<boolean>;
34
- getDataCollections(): Promise<string[]>;
35
- getDataContext(pageId: string): Promise<{
36
- dataContext: DataContext$1;
37
- }>;
38
- listAllContent(filters?: GlobalFilters): Promise<ContentListResult>;
39
- findUntranslatedContent(targetLocale: string, excludeSites?: string[], includeUnpublished?: boolean): Promise<ContentListResult>;
40
- getSitesConfig(): Promise<SitesConfig$1>;
41
- batchUpdate(operations: UpdateLocaleInput[]): Promise<BatchResult>;
42
- getGitStatus(): Promise<GitStatus$1>;
43
- commitChanges(message?: string): Promise<GitCommitResult$1>;
44
- pushChanges(): Promise<GitPushResult$1>;
45
- pullChanges(): Promise<GitPullResult$1>;
46
- listAssets(): Promise<{
47
- assets: AssetEntry$1[];
48
- }>;
49
- getAsset(filename: string): Promise<AssetEntry$1 | null>;
50
- uploadAsset(formData: FormData): Promise<AssetEntry$1>;
51
- importAssetUrl(url: string, alt?: string, folder?: string): Promise<AssetEntry$1>;
52
- deleteAsset(filename: string): Promise<{
53
- success: boolean;
54
- }>;
55
- listFolder(path?: string): Promise<FolderListing$1>;
56
- createFolder(path: string): Promise<void>;
57
- updateAssetMetadata(filename: string, updates: {
58
- alt?: string;
59
- tags?: string[];
60
- }): Promise<AssetEntry$1>;
61
- getAssetUsage(filename: string): Promise<AssetUsage$1[]>;
62
- moveAssets(filenames: string[], sourceFolder: string, targetFolder: string): Promise<{
63
- success: boolean;
64
- moved?: number;
65
- error?: string;
66
- }>;
67
- getFolderTree(): Promise<{
68
- tree: FolderTreeNode$1[];
69
- }>;
70
- getCurrentUser(): Promise<{
71
- authenticated: boolean;
72
- user?: {
73
- email: string;
74
- sub: string;
75
- };
76
- }>;
77
- }
78
- declare class APIClientError extends Error {
79
- code: ErrorCode;
80
- details?: any | undefined;
81
- constructor(message: string, code: ErrorCode, details?: any | undefined);
82
- }
83
- declare class StaleWriteError extends APIClientError {
84
- data: {
85
- code: ErrorCode;
86
- message: string;
87
- currentEtag?: string;
88
- };
89
- constructor(data: {
90
- code: ErrorCode;
91
- message: string;
92
- currentEtag?: string;
93
- });
94
- get currentEtag(): string | undefined;
95
- }
96
- //#endregion
97
- //#region src/hooks.d.ts
98
- declare function getContentAPIClient(): ContentAPIClient;
99
- declare function setContentAPIClient(client: ContentAPIClient): void;
100
- declare function useContent(id: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentEntry$1 | null>, Error>;
101
- declare function useLocalizedContent(id: string, locale: string): import("@tanstack/react-query").UseQueryResult<NoInfer<LocalizedEntry$1 | null>, Error>;
102
- interface UseCompileMDXOptions {
103
- mdxContent: string | null;
104
- cacheKey?: string;
105
- }
106
- declare function useCompileMDX({ mdxContent, cacheKey }: UseCompileMDXOptions): import("@tanstack/react-query").UseQueryResult<NoInfer<MDXCompileResponse$1>, Error>;
107
- declare function useCreateContent(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").CreateResult | {
108
- fullContent: ContentEntry$1 | null;
109
- success: boolean;
110
- id?: string;
111
- etag?: string;
112
- created?: Date;
113
- reason?: "already_exists" | "write_error" | "invalid_name" | "invalid_pathname" | "name_taken" | "pathname_taken" | "pathname_in_redirects" | "metadata_too_large";
114
- error?: Error;
115
- existingId?: string;
116
- }, Error, CreateContentInput, unknown>;
117
- declare function useUpdateLocalized(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").UpdateResult | {
118
- updatedContent: LocalizedEntry$1 | null;
119
- success: boolean;
120
- etag?: string;
121
- modified?: Date;
122
- reason?: "not_found" | "stale_write" | "write_error";
123
- error?: Error;
124
- currentEtag?: string;
125
- conflictDetails?: {
126
- metaChanged: boolean;
127
- contentChanged: boolean;
128
- currentMeta?: import("@conloca/content-api").ContentMeta;
129
- currentContent?: import("@conloca/content-api").ContentData;
130
- localContent?: import("@conloca/content-api").ContentData;
131
- };
132
- }, Error, UpdateLocaleInput, unknown>;
133
- interface DeleteContentArgs {
134
- id: string;
135
- etag: string;
136
- locale?: string;
137
- }
138
- declare function useDeleteContent(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").DeleteResult, Error, DeleteContentArgs, unknown>;
139
- interface DeleteLocalizedArgs {
140
- id: string;
141
- locale: string;
142
- etag: string;
143
- }
144
- declare function useDeleteLocalized(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").DeleteResult, Error, DeleteLocalizedArgs, unknown>;
145
- declare function useSitePages(site: string, locale?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentListResult>, Error>;
146
- declare function usePageByPathname(site: string, pathname: string, locale?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentManifest$1 | null>, Error>;
147
- declare function usePathnameAvailability(site: string, pathname: string, excludeId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<{
148
- available: boolean;
149
- }>, Error>;
150
- interface MovePageArgs {
151
- site: string;
152
- id: string;
153
- pathname: string;
154
- locale?: string;
155
- etag: string;
156
- }
157
- declare function useMovePage(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").MoveResult, Error, MovePageArgs, unknown>;
158
- declare function useBlocks(collection?: string, locale?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentListResult>, Error>;
159
- declare function useBlockByName(name: string, collection?: string, locale?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentManifest$1 | null>, Error>;
160
- declare function useData(collection?: string, locale?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentListResult>, Error>;
161
- declare function useDataByName(name: string, collection: string, locale?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentManifest$1 | null>, Error>;
162
- declare function useDataNameAvailability(name: string, collection: string, excludeId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<{
163
- available: boolean;
164
- }>, Error>;
165
- declare function useDataCollections(): import("@tanstack/react-query").UseQueryResult<NoInfer<string[]>, Error>;
166
- declare function useDataContext(pageId?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<{
167
- dataContext: DataContext$1;
168
- }>, Error>;
169
- declare function useAllContent(filters?: GlobalFilters): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentListResult>, Error>;
170
- declare function useUntranslatedContent(targetLocale: string, excludeSites?: string[], includeUnpublished?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<ContentListResult>, Error>;
171
- declare function useSitesConfig(): import("@tanstack/react-query").UseQueryResult<NoInfer<SitesConfig$1>, Error>;
172
- declare function useCurrentUser(): import("@tanstack/react-query").UseQueryResult<NoInfer<{
173
- authenticated: boolean;
174
- user?: {
175
- email: string;
176
- sub: string;
177
- };
178
- }>, Error>;
179
- declare function useBatchUpdate(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").BatchResult | {
180
- updatedContents: {
181
- index: number;
182
- content: LocalizedEntry$1;
183
- }[];
184
- operations: import("@conloca/content-api").BatchOperationResult[];
185
- success: boolean;
186
- failed: number;
187
- updated: number;
188
- }, Error, UpdateLocaleInput[], unknown>;
189
- declare function useGitStatus(): import("@tanstack/react-query").UseQueryResult<NoInfer<GitStatus>, Error>;
190
- declare function useCommitChanges(): import("@tanstack/react-query").UseMutationResult<GitCommitResult, Error, string | undefined, unknown>;
191
- declare function usePushChanges(): import("@tanstack/react-query").UseMutationResult<GitPushResult, Error, void, unknown>;
192
- declare function usePullChanges(): import("@tanstack/react-query").UseMutationResult<GitPullResult, Error, void, unknown>;
193
- declare function useAssets(): import("@tanstack/react-query").UseQueryResult<NoInfer<{
194
- assets: AssetEntry$1[];
195
- }>, Error>;
196
- declare function useAsset(filename: string): import("@tanstack/react-query").UseQueryResult<NoInfer<AssetEntry$1 | null>, Error>;
197
- declare function useUploadAsset(): import("@tanstack/react-query").UseMutationResult<AssetEntry$1, Error, FormData, unknown>;
198
- declare function useImportAssetUrl(): import("@tanstack/react-query").UseMutationResult<AssetEntry$1, Error, {
199
- url: string;
200
- alt?: string;
201
- folder?: string;
202
- }, unknown>;
203
- declare function useDeleteAsset(): import("@tanstack/react-query").UseMutationResult<{
204
- success: boolean;
205
- }, Error, string, unknown>;
206
- declare function useBulkDeleteAssets(): import("@tanstack/react-query").UseMutationResult<{
207
- successCount: number;
208
- failCount: number;
209
- }, Error, string[], unknown>;
210
- declare function useAssetFolders(path?: string): import("@tanstack/react-query").UseQueryResult<NoInfer<FolderListing$1>, Error>;
211
- declare function useCreateFolder(): import("@tanstack/react-query").UseMutationResult<void, Error, string, unknown>;
212
- declare function useUpdateAssetMetadata(): import("@tanstack/react-query").UseMutationResult<AssetEntry$1, Error, {
213
- filename: string;
214
- updates: {
215
- alt?: string;
216
- tags?: string[];
217
- };
218
- }, unknown>;
219
- declare function useAssetUsage(filename: string | null): import("@tanstack/react-query").UseQueryResult<NoInfer<AssetUsage$1[]>, Error>;
220
- declare function useFolderTree(): import("@tanstack/react-query").UseQueryResult<NoInfer<{
221
- tree: FolderTreeNode$1[];
222
- }>, Error>;
223
- declare function useMoveAssets(): import("@tanstack/react-query").UseMutationResult<{
224
- success: boolean;
225
- moved?: number;
226
- error?: string;
227
- }, Error, {
228
- filenames: string[];
229
- sourceFolder: string;
230
- targetFolder: string;
231
- }, unknown>;
232
- //#endregion
233
- export { APIClientError, API_ROUTES, type AssetEntry, type AssetUsage, type BlockEditable, ContentAPIClient, ContentAPIClientOptions, type ContentData, type ContentEntry, type ContentIdentity, type ContentManifest, type ContentType, type CreateResult, type DataCollectionEntry, type DataContext, type DataEditable, type DeleteResult, ErrorCodes, type FolderListing, type FolderTreeNode, type GitCommitResult, type GitPullResult, type GitPushResult, type GitStatus, type LocaleVersion, type LocalizedEntry, type LocalizedManifest, type MDXCompileResponse, type PageReference, type PathnameValidationReason, type PathnameValidationResult, type SitesConfig, StaleWriteError, type UpdateResult, UseCompileMDXOptions, blockEditableSchema, dataEditableSchema, formatFileSize, getContentAPIClient, localesOf, normalizeAndValidatePathname, setContentAPIClient, useAllContent, useAsset, useAssetFolders, useAssetUsage, useAssets, useBatchUpdate, useBlockByName, useBlocks, useBulkDeleteAssets, useCommitChanges, useCompileMDX, useContent, useCreateContent, useCreateFolder, useCurrentUser, useData, useDataByName, useDataCollections, useDataContext, useDataNameAvailability, useDeleteAsset, useDeleteContent, useDeleteLocalized, useFolderTree, useGitStatus, useImportAssetUrl, useLocalizedContent, useMoveAssets, useMovePage, usePageByPathname, usePathnameAvailability, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUntranslatedContent, useUpdateAssetMetadata, useUpdateLocalized, useUploadAsset };
234
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts","../src/hooks.tsx"],"mappings":";;;UA6BiB;EACf;EACA,eAAe;;cAGJ;UACH;UACA;EAEI,YAAA,UAAS;UAab;UAOM;EAgDR,WAAW,aAAa,QAAQ;EAgBhC,aAAa,YAAY,iBAAiB,QAAQ;EAgBlD,cAAc,MAAM,qBAAqB,QAAQ;EAOjD,gBAAgB,OAAO,oBAAoB,QAAQ;EASnD,cAAc,YAAY,eAAe,QAAQ;EASjD,gBAAgB;IAAS;IAAY;IAAgB;MAAiB,QAAQ;EAU9E,aAAa,cAAc,kBAAkB,QAAQ;EAKrD,kBAAkB,cAAc,kBAAkB,kBAAkB,QAAQ;EAmB5E,oBAAoB,cAAc,kBAAkB,qBAAqB;EAezE,SAAS,cAAc,YAAY,kBAAkB,gBAAgB,eAAe,QAAQ;EAQ5F,UAAU,qBAAqB,kBAAkB,QAAQ;EASzD,eAAe,cAAc,qBAAqB,kBAAkB,QAAQ;EAqB5E,WAAW,qBAAqB,QAAQ;EAQxC,QAAQ,qBAAqB,kBAAkB,QAAQ;EASvD,cAAc,cAAc,oBAAoB,kBAAkB,QAAQ;EAqB1E,oBAAoB,cAAc,oBAAoB,qBAAqB;EAgB3E,sBAAsB;EAMtB,eAAe,iBAAiB;IAAU,aAAa;;EAKvD,eAAe,UAAU,gBAAgB,QAAQ;EAejD,wBACJ,sBACA,yBACA,+BACC,QAAQ;EASL,kBAAkB,QAAQ;EAK1B,YAAY,Y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