@conloca/content-api-client 0.1.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/README.md ADDED
@@ -0,0 +1,378 @@
1
+ # @conloca/content-api-client
2
+
3
+ TypeScript client library for interacting with the Conloca Content API. Provides both HTTP client and React hooks for
4
+ content operations.
5
+
6
+ ## Overview
7
+
8
+ This package provides:
9
+
10
+ - `ContentAPIClient` - HTTP client for content operations
11
+ - React hooks (`useContent`, `useUpdateContent`, etc.) for seamless integration
12
+ - Full TypeScript support with comprehensive types
13
+ - Dual ETag system for optimistic conflict resolution
14
+ - Test helpers for both unit and integration testing
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ bun add @conloca/content-api-client
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Basic Client Usage
25
+
26
+ ```typescript
27
+ import { ContentAPIClient } from '@conloca/content-api-client';
28
+
29
+ // Create client instance
30
+ const client = new ContentAPIClient({
31
+ baseUrl: '/__conloca/api', // optional, defaults to '/__conloca/api'
32
+ });
33
+
34
+ // Get content by ID
35
+ const content = await client.getContent('page-id');
36
+
37
+ // Get localized content
38
+ const localizedContent = await client.getLocalized('page-id', 'en');
39
+
40
+ // Create new content
41
+ const result = await client.createContent({
42
+ kind: 'page',
43
+ site: 'default',
44
+ collection: 'pages',
45
+ type: 'puck',
46
+ locales: {
47
+ en: {
48
+ pathname: '/about',
49
+ meta: { title: 'About Us' },
50
+ content: { puckData: { root: {} } },
51
+ },
52
+ },
53
+ });
54
+
55
+ // Update content with ETag validation
56
+ const updateResult = await client.updateLocalized({
57
+ id: 'page-id',
58
+ locale: 'en',
59
+ data: {
60
+ meta: { title: 'Updated Title' },
61
+ },
62
+ etag: localizedContent.localized.etag,
63
+ });
64
+ ```
65
+
66
+ ### React Hooks Usage
67
+
68
+ ```typescript
69
+ import { useContent, useUpdateContent } from '@conloca/content-api-client';
70
+
71
+ function MyComponent({ contentId }) {
72
+ // Fetch content
73
+ const { data: content, isLoading } = useContent(contentId);
74
+
75
+ // Update mutation
76
+ const updateContent = useUpdateContent();
77
+
78
+ const handleUpdate = async () => {
79
+ try {
80
+ await updateContent.mutateAsync({
81
+ id: contentId,
82
+ locale: 'en',
83
+ data: { meta: { title: 'New Title' } },
84
+ etag: content.localized.etag
85
+ });
86
+ } catch (error) {
87
+ if (error instanceof StaleWriteError) {
88
+ // Handle conflict - error.data.currentEtag contains latest version
89
+ }
90
+ }
91
+ };
92
+
93
+ return (
94
+ // Your UI here
95
+ );
96
+ }
97
+ ```
98
+
99
+ ## Testing Approach
100
+
101
+ The content-api-client package uses a **dual testing strategy** to ensure both unit-level correctness and integration
102
+ reliability:
103
+
104
+ ### 1. Unit Tests with Mocks (`client.test.ts`)
105
+
106
+ Unit tests focus on testing the client's behavior in isolation, ensuring proper request formation, response handling,
107
+ and error cases.
108
+
109
+ **When to use mocks:**
110
+
111
+ - Testing specific HTTP status codes and error conditions
112
+ - Testing request parameter formation and headers
113
+ - Testing client configuration options
114
+ - Testing edge cases that are hard to reproduce with real implementations
115
+ - Testing network failures and timeouts
116
+
117
+ **Example:**
118
+
119
+ ```typescript
120
+ import { beforeEach, describe, expect, it, mock } from 'bun:test';
121
+ import { ContentAPIClient } from '../src/client';
122
+ import { setupFetchMock } from '../src/test-helpers';
123
+
124
+ describe('ContentAPIClient', () => {
125
+ const { fetchMock, responses } = setupFetchMock(mock);
126
+
127
+ it('should handle 404 responses', async () => {
128
+ responses.mockGetContent(null); // Returns 404
129
+
130
+ const result = await client.getContent('non-existent');
131
+ expect(result).toBeNull();
132
+ });
133
+
134
+ it('should handle stale writes', async () => {
135
+ responses.mockStaleWrite('current.etag');
136
+
137
+ await expect(
138
+ client.updateLocalized({
139
+ id: 'test-id',
140
+ locale: 'en',
141
+ data: {},
142
+ etag: 'stale.etag',
143
+ })
144
+ ).rejects.toThrow(StaleWriteError);
145
+ });
146
+ });
147
+ ```
148
+
149
+ ### 2. Integration Tests with InMemoryContentAPI (`client-integration.test.ts`)
150
+
151
+ Integration tests use the real `InMemoryContentAPI` implementation with the full middleware stack to test end-to-end
152
+ behavior.
153
+
154
+ **When to use InMemoryContentAPI:**
155
+
156
+ - Testing complete workflows (create → read → update → delete)
157
+ - Testing complex scenarios like conflict resolution
158
+ - Testing batch operations and transactions
159
+ - Testing API contract compliance
160
+ - Testing React components and hooks
161
+
162
+ **Example:**
163
+
164
+ ```typescript
165
+ import { createContentAPIRouter, InMemoryContentAPI } from '@conloca/content-api/node';
166
+ import { ContentAPIClient } from '../src/client';
167
+
168
+ describe('ContentAPIClient Integration Tests', () => {
169
+ let contentApi: InMemoryContentAPI;
170
+ let client: ContentAPIClient;
171
+
172
+ beforeEach(() => {
173
+ // Create in-memory API
174
+ contentApi = new InMemoryContentAPI({
175
+ sites: { default: { locales: ['en', 'nl'] } }
176
+ });
177
+
178
+ // Create router with middleware
179
+ const honoApp = createContentAPIRouter(contentApi);
180
+
181
+ // Override fetch to use the router directly
182
+ global.fetch = async (input, init) => {
183
+ const request = new Request(input, init);
184
+ return honoApp.fetch(request);
185
+ };
186
+
187
+ client = new ContentAPIClient({ baseUrl: 'http://test/__conloca/api' });
188
+ });
189
+
190
+ it('should handle complete content lifecycle', async () => {
191
+ // Create content
192
+ const createResult = await client.createContent({...});
193
+
194
+ // Read it back
195
+ const content = await client.getContent(createResult.id);
196
+
197
+ // Update it
198
+ await client.updateLocalized({...});
199
+
200
+ // Delete it
201
+ await client.deleteContent(createResult.id, content.etag);
202
+ });
203
+ });
204
+ ```
205
+
206
+ ## Test Helpers
207
+
208
+ The package provides comprehensive test helpers in `src/test-helpers.ts`:
209
+
210
+ ### Mock Factories
211
+
212
+ ```typescript
213
+ import {
214
+ mockContentEntry,
215
+ mockLocalizedEntry,
216
+ mockCreateResult,
217
+ mockUpdateResult,
218
+ } from '@conloca/content-api-client/test-helpers';
219
+
220
+ // Create mock data with proper types
221
+ const content = mockContentEntry({
222
+ id: 'custom-id',
223
+ site: 'my-site',
224
+ });
225
+ ```
226
+
227
+ ### Fetch Mock Setup
228
+
229
+ ```typescript
230
+ import { setupFetchMock } from '@conloca/content-api-client/test-helpers';
231
+ import { mock } from 'bun:test';
232
+
233
+ const { fetchMock, responses } = setupFetchMock(mock);
234
+
235
+ // Chain mock responses
236
+ responses
237
+ .mockGetContent(mockContent)
238
+ .mockUpdateContent({ success: true, etag: 'new.etag' })
239
+ .mockStaleWrite('current.etag');
240
+ ```
241
+
242
+ ## Dual ETag System
243
+
244
+ The content API uses a dual ETag system for optimistic conflict resolution:
245
+
246
+ - **Format**: `metaHash.contentHash`
247
+ - **Meta Hash**: Changes when metadata (title, description, etc.) changes
248
+ - **Content Hash**: Changes when actual content changes
249
+
250
+ This allows non-conflicting updates to proceed:
251
+
252
+ ```typescript
253
+ // User 1 updates metadata
254
+ await client.updateLocalized({
255
+ id: 'page-id',
256
+ locale: 'en',
257
+ data: { meta: { title: 'New Title' } },
258
+ etag: 'oldMeta.oldContent',
259
+ });
260
+
261
+ // User 2 can still update content if they have the new meta hash
262
+ await client.updateLocalized({
263
+ id: 'page-id',
264
+ locale: 'en',
265
+ data: {
266
+ content: {
267
+ puckData: {
268
+ /* ... */
269
+ },
270
+ },
271
+ },
272
+ etag: 'newMeta.oldContent', // Will succeed!
273
+ });
274
+ ```
275
+
276
+ ## Best Practices
277
+
278
+ ### 1. Choose the Right Testing Approach
279
+
280
+ - **Use mocks** for testing client behavior, error handling, and edge cases
281
+ - **Use InMemoryContentAPI** for testing workflows, integrations, and React components
282
+ - Don't mock what you can easily test with InMemoryContentAPI
283
+
284
+ ### 2. Handle Stale Writes Gracefully
285
+
286
+ ```typescript
287
+ try {
288
+ await updateContent(data);
289
+ } catch (error) {
290
+ if (error instanceof StaleWriteError) {
291
+ // Fetch latest version
292
+ const latest = await client.getLocalized(id, locale);
293
+
294
+ // Retry with current etag if changes don't conflict
295
+ await updateContent({
296
+ ...data,
297
+ etag: error.data.currentEtag,
298
+ });
299
+ }
300
+ }
301
+ ```
302
+
303
+ ### 3. Use React Query Features
304
+
305
+ The React hooks are built on @tanstack/react-query, so you get:
306
+
307
+ - Automatic caching and invalidation
308
+ - Background refetching
309
+ - Optimistic updates
310
+ - Offline support
311
+
312
+ ```typescript
313
+ const { data, isLoading, error, refetch } = useContent(id);
314
+
315
+ // Manually refetch
316
+ await refetch();
317
+
318
+ // Optimistic update
319
+ updateContent.mutate(data, {
320
+ onMutate: async (newData) => {
321
+ // Cancel outgoing refetches
322
+ await queryClient.cancelQueries(['content', id]);
323
+
324
+ // Optimistically update
325
+ const previous = queryClient.getQueryData(['content', id]);
326
+ queryClient.setQueryData(['content', id], newData);
327
+
328
+ return { previous };
329
+ },
330
+ onError: (err, newData, context) => {
331
+ // Rollback on error
332
+ queryClient.setQueryData(['content', id], context.previous);
333
+ },
334
+ });
335
+ ```
336
+
337
+ ## API Reference
338
+
339
+ ### ContentAPIClient
340
+
341
+ Main client class for content operations.
342
+
343
+ #### Constructor
344
+
345
+ ```typescript
346
+ new ContentAPIClient(options?: { baseUrl?: string })
347
+ ```
348
+
349
+ #### Methods
350
+
351
+ - `getContent(id: string): Promise<ContentEntry | null>`
352
+ - `getLocalized(id: string, locale: string): Promise<LocalizedEntry | null>`
353
+ - `createContent(data: CreateContentInput): Promise<CreateResult>`
354
+ - `updateLocalized(input: UpdateLocaleInput): Promise<UpdateResult>`
355
+ - `deleteContent(id: string, etag: string): Promise<DeleteResult>`
356
+ - `listAllContent(filters?: ContentFilters): Promise<ListResult>`
357
+ - `batchUpdate(operations: UpdateLocaleInput[]): Promise<BatchResult>`
358
+ - `isPathnameAvailable(site: string, pathname: string, excludeId?: string): Promise<boolean>`
359
+
360
+ ### React Hooks
361
+
362
+ - `useContent(id: string)` - Fetch content by ID
363
+ - `useLocalizedContent(id: string, locale: string)` - Fetch localized content
364
+ - `useCreateContent()` - Create content mutation
365
+ - `useUpdateContent()` - Update content mutation
366
+ - `useDeleteContent()` - Delete content mutation
367
+ - `useSitePages(site: string, locale?: string)` - List site pages
368
+ - `useBlocks(collection?: string, locale?: string)` - List blocks
369
+
370
+ ## Building
371
+
372
+ ```bash
373
+ # Build the library
374
+ nx build content-api-client
375
+
376
+ # Run tests
377
+ nx run content-api-client:test
378
+ ```
@@ -0,0 +1,214 @@
1
+ import { t as API_ROUTES } from "./test-helpers-WDeFd8FH.mjs";
2
+ import { AssetEntry as AssetEntry$1, AssetEntry as AssetEntry$2, AssetUsage as AssetUsage$1, AssetUsage as AssetUsage$2, BatchResult, ContentData, ContentEntry, ContentEntry as ContentEntry$1, ContentIdentity, ContentListResult as ContentListResult$1, ContentManifest, ContentManifest as ContentManifest$1, ContentType, CreateContentInput as CreateContentInput$1, CreateResult, DeleteResult as DeleteResult$1, ErrorCode, ErrorCodes, FolderListing as FolderListing$1, FolderListing as FolderListing$2, FolderTreeNode, FolderTreeNode as FolderTreeNode$1, GlobalFilters, LocaleVersion, LocalizedEntry, LocalizedEntry as LocalizedEntry$1, LocalizedManifest, MoveResult as MoveResult$1, SitesConfig as SitesConfig$1, SitesConfig as SitesConfig$2, UpdateLocaleInput as UpdateLocaleInput$1, UpdateResult, UpdateResult as UpdateResult$1, localesOf } from "@conloca/content-api";
3
+ import * as _tanstack_react_query0 from "@tanstack/react-query";
4
+
5
+ //#region src/client.d.ts
6
+ interface GitStatus {
7
+ hasChanges: boolean;
8
+ changedFiles: number;
9
+ ahead: number;
10
+ behind: number;
11
+ branch: string;
12
+ isRepo: boolean;
13
+ }
14
+ interface GitCommitResult {
15
+ success: boolean;
16
+ commit?: string;
17
+ summary?: string;
18
+ error?: string;
19
+ }
20
+ interface GitPushResult {
21
+ success: boolean;
22
+ error?: string;
23
+ }
24
+ interface ContentAPIClientOptions {
25
+ baseUrl?: string;
26
+ fetch?: typeof fetch;
27
+ }
28
+ declare class ContentAPIClient {
29
+ private baseUrl;
30
+ private fetch;
31
+ constructor(options?: ContentAPIClientOptions);
32
+ private fetchAPI;
33
+ getContent(id: string): Promise<ContentEntry$1 | null>;
34
+ getLocalized(id: string, locale: string): Promise<LocalizedEntry$1 | null>;
35
+ createContent(data: CreateContentInput$1): Promise<CreateResult>;
36
+ updateLocalized(input: UpdateLocaleInput$1): Promise<UpdateResult$1>;
37
+ deleteContent(id: string, etag: string): Promise<DeleteResult$1>;
38
+ deleteLocalized(input: {
39
+ id: string;
40
+ locale: string;
41
+ etag: string;
42
+ }): Promise<DeleteResult$1>;
43
+ getSitePages(site: string, locale?: string): Promise<ContentListResult$1>;
44
+ getPageByPathname(site: string, pathname: string, locale?: string): Promise<ContentManifest$1 | null>;
45
+ isPathnameAvailable(site: string, pathname: string, excludeId?: string): Promise<boolean>;
46
+ movePage(site: string, id: string, pathname: string, locale: string, etag: string): Promise<MoveResult$1>;
47
+ getBlocks(collection?: string, locale?: string): Promise<ContentListResult$1>;
48
+ getBlockByName(name: string, collection?: string, locale?: string): Promise<ContentManifest$1 | null>;
49
+ getData(collection?: string, locale?: string): Promise<ContentListResult$1>;
50
+ getDataByName(name: string, collection: string, locale?: string): Promise<ContentManifest$1 | null>;
51
+ isDataNameAvailable(name: string, collection: string, excludeId?: string): Promise<boolean>;
52
+ getDataCollections(): Promise<string[]>;
53
+ listAllContent(filters?: GlobalFilters): Promise<ContentListResult$1>;
54
+ findUntranslatedContent(targetLocale: string, excludeSites?: string[], includeUnpublished?: boolean): Promise<ContentListResult$1>;
55
+ getSitesConfig(): Promise<SitesConfig$2>;
56
+ batchUpdate(operations: UpdateLocaleInput$1[]): Promise<BatchResult>;
57
+ getGitStatus(): Promise<GitStatus>;
58
+ commitChanges(message?: string): Promise<GitCommitResult>;
59
+ pushChanges(): Promise<GitPushResult>;
60
+ listAssets(): Promise<{
61
+ assets: AssetEntry$2[];
62
+ }>;
63
+ getAsset(filename: string): Promise<AssetEntry$2 | null>;
64
+ uploadAsset(formData: FormData): Promise<{
65
+ success: true;
66
+ asset: AssetEntry$2;
67
+ }>;
68
+ importAssetUrl(url: string, alt?: string, folder?: string): Promise<{
69
+ success: true;
70
+ asset: AssetEntry$2;
71
+ }>;
72
+ deleteAsset(filename: string): Promise<{
73
+ success: boolean;
74
+ }>;
75
+ listFolder(path?: string): Promise<FolderListing$2>;
76
+ createFolder(path: string): Promise<void>;
77
+ updateAssetMetadata(filename: string, updates: {
78
+ alt?: string;
79
+ tags?: string[];
80
+ }): Promise<AssetEntry$2>;
81
+ getAssetUsage(filename: string): Promise<AssetUsage$2[]>;
82
+ moveAssets(filenames: string[], sourceFolder: string, targetFolder: string): Promise<{
83
+ success: boolean;
84
+ moved?: number;
85
+ error?: string;
86
+ }>;
87
+ getFolderTree(): Promise<{
88
+ tree: FolderTreeNode$1[];
89
+ }>;
90
+ getCurrentUser(): Promise<{
91
+ authenticated: boolean;
92
+ user?: {
93
+ email: string;
94
+ sub: string;
95
+ };
96
+ }>;
97
+ }
98
+ declare class APIClientError extends Error {
99
+ code: ErrorCode;
100
+ details?: any | undefined;
101
+ constructor(message: string, code: ErrorCode, details?: any | undefined);
102
+ }
103
+ declare class StaleWriteError extends APIClientError {
104
+ data: {
105
+ code: ErrorCode;
106
+ message: string;
107
+ currentEtag?: string;
108
+ };
109
+ constructor(data: {
110
+ code: ErrorCode;
111
+ message: string;
112
+ currentEtag?: string;
113
+ });
114
+ get currentEtag(): string | undefined;
115
+ }
116
+ //#endregion
117
+ //#region src/hooks.d.ts
118
+ declare function getContentAPIClient(): ContentAPIClient;
119
+ declare function setContentAPIClient(client: ContentAPIClient): void;
120
+ declare function useContent(id: string): _tanstack_react_query0.UseQueryResult<any, Error>;
121
+ declare function useLocalizedContent(id: string, locale: string): _tanstack_react_query0.UseQueryResult<any, Error>;
122
+ declare function useCreateContent(): _tanstack_react_query0.UseMutationResult<any, Error, CreateContentInput, unknown>;
123
+ declare function useUpdateLocalized(): _tanstack_react_query0.UseMutationResult<any, Error, UpdateLocaleInput, unknown>;
124
+ interface DeleteContentArgs {
125
+ id: string;
126
+ etag: string;
127
+ locale?: string;
128
+ }
129
+ declare function useDeleteContent(): _tanstack_react_query0.UseMutationResult<DeleteResult, Error, DeleteContentArgs, unknown>;
130
+ interface DeleteLocalizedArgs {
131
+ id: string;
132
+ locale: string;
133
+ etag: string;
134
+ }
135
+ declare function useDeleteLocalized(): _tanstack_react_query0.UseMutationResult<DeleteResult, Error, DeleteLocalizedArgs, unknown>;
136
+ declare function useSitePages(site: string, locale?: string): _tanstack_react_query0.UseQueryResult<ContentListResult, Error>;
137
+ declare function usePageByPathname(site: string, pathname: string, locale?: string): _tanstack_react_query0.UseQueryResult<any, Error>;
138
+ declare function usePathnameAvailability(site: string, pathname: string, excludeId?: string): _tanstack_react_query0.UseQueryResult<{
139
+ available: boolean;
140
+ }, Error>;
141
+ interface MovePageArgs {
142
+ site: string;
143
+ id: string;
144
+ pathname: string;
145
+ locale?: string;
146
+ etag: string;
147
+ }
148
+ declare function useMovePage(): _tanstack_react_query0.UseMutationResult<MoveResult, Error, MovePageArgs, unknown>;
149
+ declare function useBlocks(collection?: string, locale?: string): _tanstack_react_query0.UseQueryResult<ContentListResult, Error>;
150
+ declare function useBlockByName(name: string, collection?: string, locale?: string): _tanstack_react_query0.UseQueryResult<any, Error>;
151
+ declare function useData(collection?: string, locale?: string): _tanstack_react_query0.UseQueryResult<ContentListResult, Error>;
152
+ declare function useDataByName(name: string, collection: string, locale?: string): _tanstack_react_query0.UseQueryResult<any, Error>;
153
+ declare function useDataNameAvailability(name: string, collection: string, excludeId?: string): _tanstack_react_query0.UseQueryResult<{
154
+ available: boolean;
155
+ }, Error>;
156
+ declare function useDataCollections(): _tanstack_react_query0.UseQueryResult<string[], Error>;
157
+ declare function useAllContent(filters?: GlobalFilters): _tanstack_react_query0.UseQueryResult<ContentListResult, Error>;
158
+ declare function useUntranslatedContent(targetLocale: string, excludeSites?: string[], includeUnpublished?: boolean): _tanstack_react_query0.UseQueryResult<ContentListResult, Error>;
159
+ declare function useSitesConfig(): _tanstack_react_query0.UseQueryResult<SitesConfig, Error>;
160
+ declare function useCurrentUser(): _tanstack_react_query0.UseQueryResult<{
161
+ authenticated: boolean;
162
+ user?: {
163
+ email: string;
164
+ sub: string;
165
+ };
166
+ }, Error>;
167
+ declare function useBatchUpdate(): _tanstack_react_query0.UseMutationResult<any, Error, UpdateLocaleInput[], unknown>;
168
+ declare function useGitStatus(): _tanstack_react_query0.UseQueryResult<GitStatus, Error>;
169
+ declare function useCommitChanges(): _tanstack_react_query0.UseMutationResult<GitCommitResult, Error, string | undefined, unknown>;
170
+ declare function usePushChanges(): _tanstack_react_query0.UseMutationResult<GitPushResult, Error, void, unknown>;
171
+ declare function useAssets(): _tanstack_react_query0.UseQueryResult<{
172
+ assets: ContentEntry$1[];
173
+ }, Error>;
174
+ declare function useAsset(filename: string): _tanstack_react_query0.UseQueryResult<any, Error>;
175
+ declare function useUploadAsset(): _tanstack_react_query0.UseMutationResult<{
176
+ success: true;
177
+ asset: ContentEntry$1;
178
+ }, Error, FormData, unknown>;
179
+ declare function useImportAssetUrl(): _tanstack_react_query0.UseMutationResult<{
180
+ success: true;
181
+ asset: ContentEntry$1;
182
+ }, Error, {
183
+ url: string;
184
+ alt?: string;
185
+ folder?: string;
186
+ }, unknown>;
187
+ declare function useDeleteAsset(): _tanstack_react_query0.UseMutationResult<{
188
+ success: boolean;
189
+ }, Error, string, unknown>;
190
+ declare function useAssetFolders(path?: string): _tanstack_react_query0.UseQueryResult<FolderListing, Error>;
191
+ declare function useCreateFolder(): _tanstack_react_query0.UseMutationResult<void, Error, string, unknown>;
192
+ declare function useUpdateAssetMetadata(): _tanstack_react_query0.UseMutationResult<AssetEntry, Error, {
193
+ filename: string;
194
+ updates: {
195
+ alt?: string;
196
+ tags?: string[];
197
+ };
198
+ }, unknown>;
199
+ declare function useAssetUsage(filename: string | null): _tanstack_react_query0.UseQueryResult<AssetUsage[], Error>;
200
+ declare function useFolderTree(): _tanstack_react_query0.UseQueryResult<{
201
+ tree: ContentEntry$1[];
202
+ }, Error>;
203
+ declare function useMoveAssets(): _tanstack_react_query0.UseMutationResult<{
204
+ success: boolean;
205
+ moved?: number;
206
+ error?: string;
207
+ }, Error, {
208
+ filenames: string[];
209
+ sourceFolder: string;
210
+ targetFolder: string;
211
+ }, unknown>;
212
+ //#endregion
213
+ export { APIClientError, API_ROUTES, type AssetEntry$1 as AssetEntry, type AssetUsage$1 as AssetUsage, ContentAPIClient, ContentAPIClientOptions, type ContentData, type ContentEntry, type ContentIdentity, type ContentManifest, type ContentType, ErrorCodes, type FolderListing$1 as FolderListing, type FolderTreeNode, type GitCommitResult, type GitPushResult, type GitStatus, type LocaleVersion, type LocalizedEntry, type LocalizedManifest, type SitesConfig$1 as SitesConfig, StaleWriteError, type UpdateResult, getContentAPIClient, localesOf, setContentAPIClient, useAllContent, useAsset, useAssetFolders, useAssetUsage, useAssets, useBatchUpdate, useBlockByName, useBlocks, useCommitChanges, useContent, useCreateContent, useCreateFolder, useCurrentUser, useData, useDataByName, useDataCollections, useDataNameAvailability, useDeleteAsset, useDeleteContent, useDeleteLocalized, useFolderTree, useGitStatus, useImportAssetUrl, useLocalizedContent, useMoveAssets, useMovePage, usePageByPathname, usePathnameAvailability, usePushChanges, useSitePages, useSitesConfig, useUntranslatedContent, useUpdateAssetMetadata, useUpdateLocalized, useUploadAsset };
214
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts","../src/hooks.tsx"],"sourcesContent":[],"mappings":";;;;;UAwBiB,SAAA;;;;EAAA,MAAA,EAAA,MAAS;EAST,MAAA,EAAA,MAAA;EAOA,MAAA,EAAA,OAAA;AAKjB;AAKa,UAjBI,eAAA,CAiBY;EAIN,OAAA,EAAA,OAAA;EA6DiB,MAAA,CAAA,EAAA,MAAA;EAAR,OAAA,CAAA,EAAA,MAAA;EAgB0B,KAAA,CAAA,EAAA,MAAA;;AAgB9B,UA3GX,aAAA,CA2GW;EAA6B,OAAA,EAAA,OAAA;EAAR,KAAA,CAAA,EAAA,MAAA;;AAOU,UA7G1C,uBAAA,CA6G0C;EAAR,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