@conloca/content-api-client 0.1.1 → 0.1.3
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/package.json +2 -2
- package/dist/client.d.ts +0 -112
- package/dist/client.d.ts.map +0 -1
- package/dist/hooks.d.ts +0 -132
- package/dist/hooks.d.ts.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/content-api-client.d.ts +0 -2
- package/dist/lib/content-api-client.d.ts.map +0 -1
- package/dist/test-helpers.d.ts +0 -89
- package/dist/test-helpers.d.ts.map +0 -1
- package/dist/testing.d.ts +0 -8
- package/dist/testing.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conloca/content-api-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test": "tsc-bun-test"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@conloca/content-api": "
|
|
39
|
+
"@conloca/content-api": "0.1.0",
|
|
40
40
|
"@tanstack/react-query": "^5.90.5",
|
|
41
41
|
"tslib": "^2.8.1"
|
|
42
42
|
},
|
package/dist/client.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { AssetEntry, AssetUsage, BatchResult, ContentEntry, ContentListResult, ContentManifest, CreateContentInput, CreateResult, DeleteResult, ErrorCode, FolderListing, FolderTreeNode, GlobalFilters, LocalizedEntry, MoveResult, SitesConfig, UpdateLocaleInput, UpdateResult } from '@conloca/content-api';
|
|
2
|
-
export interface GitStatus {
|
|
3
|
-
hasChanges: boolean;
|
|
4
|
-
changedFiles: number;
|
|
5
|
-
ahead: number;
|
|
6
|
-
behind: number;
|
|
7
|
-
branch: string;
|
|
8
|
-
isRepo: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface GitCommitResult {
|
|
11
|
-
success: boolean;
|
|
12
|
-
commit?: string;
|
|
13
|
-
summary?: string;
|
|
14
|
-
error?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface GitPushResult {
|
|
17
|
-
success: boolean;
|
|
18
|
-
error?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ContentAPIClientOptions {
|
|
21
|
-
baseUrl?: string;
|
|
22
|
-
fetch?: typeof fetch;
|
|
23
|
-
}
|
|
24
|
-
export declare class ContentAPIClient {
|
|
25
|
-
private baseUrl;
|
|
26
|
-
private fetch;
|
|
27
|
-
constructor(options?: ContentAPIClientOptions);
|
|
28
|
-
private fetchAPI;
|
|
29
|
-
getContent(id: string): Promise<ContentEntry | null>;
|
|
30
|
-
getLocalized(id: string, locale: string): Promise<LocalizedEntry | null>;
|
|
31
|
-
createContent(data: CreateContentInput): Promise<CreateResult>;
|
|
32
|
-
updateLocalized(input: UpdateLocaleInput): Promise<UpdateResult>;
|
|
33
|
-
deleteContent(id: string, etag: string): Promise<DeleteResult>;
|
|
34
|
-
deleteLocalized(input: {
|
|
35
|
-
id: string;
|
|
36
|
-
locale: string;
|
|
37
|
-
etag: string;
|
|
38
|
-
}): Promise<DeleteResult>;
|
|
39
|
-
getSitePages(site: string, locale?: string): Promise<ContentListResult>;
|
|
40
|
-
getPageByPathname(site: string, pathname: string, locale?: string): Promise<ContentManifest | null>;
|
|
41
|
-
isPathnameAvailable(site: string, pathname: string, excludeId?: string): Promise<boolean>;
|
|
42
|
-
movePage(site: string, id: string, pathname: string, locale: string, etag: string): Promise<MoveResult>;
|
|
43
|
-
getBlocks(collection?: string, locale?: string): Promise<ContentListResult>;
|
|
44
|
-
getBlockByName(name: string, collection?: string, locale?: string): Promise<ContentManifest | null>;
|
|
45
|
-
getData(collection?: string, locale?: string): Promise<ContentListResult>;
|
|
46
|
-
getDataByName(name: string, collection: string, locale?: string): Promise<ContentManifest | null>;
|
|
47
|
-
isDataNameAvailable(name: string, collection: string, excludeId?: string): Promise<boolean>;
|
|
48
|
-
getDataCollections(): Promise<string[]>;
|
|
49
|
-
listAllContent(filters?: GlobalFilters): Promise<ContentListResult>;
|
|
50
|
-
findUntranslatedContent(targetLocale: string, excludeSites?: string[], includeUnpublished?: boolean): Promise<ContentListResult>;
|
|
51
|
-
getSitesConfig(): Promise<SitesConfig>;
|
|
52
|
-
batchUpdate(operations: UpdateLocaleInput[]): Promise<BatchResult>;
|
|
53
|
-
getGitStatus(): Promise<GitStatus>;
|
|
54
|
-
commitChanges(message?: string): Promise<GitCommitResult>;
|
|
55
|
-
pushChanges(): Promise<GitPushResult>;
|
|
56
|
-
listAssets(): Promise<{
|
|
57
|
-
assets: AssetEntry[];
|
|
58
|
-
}>;
|
|
59
|
-
getAsset(filename: string): Promise<AssetEntry | null>;
|
|
60
|
-
uploadAsset(formData: FormData): Promise<{
|
|
61
|
-
success: true;
|
|
62
|
-
asset: AssetEntry;
|
|
63
|
-
}>;
|
|
64
|
-
importAssetUrl(url: string, alt?: string, folder?: string): Promise<{
|
|
65
|
-
success: true;
|
|
66
|
-
asset: AssetEntry;
|
|
67
|
-
}>;
|
|
68
|
-
deleteAsset(filename: string): Promise<{
|
|
69
|
-
success: boolean;
|
|
70
|
-
}>;
|
|
71
|
-
listFolder(path?: string): Promise<FolderListing>;
|
|
72
|
-
createFolder(path: string): Promise<void>;
|
|
73
|
-
updateAssetMetadata(filename: string, updates: {
|
|
74
|
-
alt?: string;
|
|
75
|
-
tags?: string[];
|
|
76
|
-
}): Promise<AssetEntry>;
|
|
77
|
-
getAssetUsage(filename: string): Promise<AssetUsage[]>;
|
|
78
|
-
moveAssets(filenames: string[], sourceFolder: string, targetFolder: string): Promise<{
|
|
79
|
-
success: boolean;
|
|
80
|
-
moved?: number;
|
|
81
|
-
error?: string;
|
|
82
|
-
}>;
|
|
83
|
-
getFolderTree(): Promise<{
|
|
84
|
-
tree: FolderTreeNode[];
|
|
85
|
-
}>;
|
|
86
|
-
getCurrentUser(): Promise<{
|
|
87
|
-
authenticated: boolean;
|
|
88
|
-
user?: {
|
|
89
|
-
email: string;
|
|
90
|
-
sub: string;
|
|
91
|
-
};
|
|
92
|
-
}>;
|
|
93
|
-
}
|
|
94
|
-
export declare class APIClientError extends Error {
|
|
95
|
-
code: ErrorCode;
|
|
96
|
-
details?: any | undefined;
|
|
97
|
-
constructor(message: string, code: ErrorCode, details?: any | undefined);
|
|
98
|
-
}
|
|
99
|
-
export declare class StaleWriteError extends APIClientError {
|
|
100
|
-
data: {
|
|
101
|
-
code: ErrorCode;
|
|
102
|
-
message: string;
|
|
103
|
-
currentEtag?: string;
|
|
104
|
-
};
|
|
105
|
-
constructor(data: {
|
|
106
|
-
code: ErrorCode;
|
|
107
|
-
message: string;
|
|
108
|
-
currentEtag?: string;
|
|
109
|
-
});
|
|
110
|
-
get currentEtag(): string | undefined;
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAI9B,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,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,CACd,SAAS,EAAE,MAAM,EAAE,EACnB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAQ1D,aAAa,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC;IAKpD,cAAc,IAAI,OAAO,CAAC;QAAE,aAAa,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAOnG;AAGD,qBAAa,cAAe,SAAQ,KAAK;IAG9B,IAAI,EAAE,SAAS;IACf,OAAO,CAAC,EAAE,GAAG;gBAFpB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,GAAG,YAAA;CAKvB;AAGD,qBAAa,eAAgB,SAAQ,cAAc;IAC9B,IAAI,EAAE;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;gBAAhE,IAAI,EAAE;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAKnF,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;CACF"}
|
package/dist/hooks.d.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import type { ContentEntry, ContentListResult, ContentManifest, CreateContentInput, GlobalFilters, LocalizedEntry, UpdateLocaleInput } from '@conloca/content-api';
|
|
2
|
-
import { APIClientError, ContentAPIClient, type GitCommitResult, type GitPushResult, type GitStatus, StaleWriteError } from './client';
|
|
3
|
-
export declare function getContentAPIClient(): ContentAPIClient;
|
|
4
|
-
export declare function setContentAPIClient(client: ContentAPIClient): void;
|
|
5
|
-
export declare function useContent(id: string): import("@tanstack/react-query").UseQueryResult<ContentEntry | null, Error>;
|
|
6
|
-
export declare function useLocalizedContent(id: string, locale: string): import("@tanstack/react-query").UseQueryResult<LocalizedEntry | null, Error>;
|
|
7
|
-
export declare function useCreateContent(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").CreateResult | {
|
|
8
|
-
fullContent: ContentEntry | null;
|
|
9
|
-
success: boolean;
|
|
10
|
-
id?: string;
|
|
11
|
-
etag?: string;
|
|
12
|
-
created?: Date;
|
|
13
|
-
reason?: "already_exists" | "write_error" | "invalid_name" | "name_taken" | "pathname_taken" | "pathname_in_redirects" | "metadata_too_large";
|
|
14
|
-
error?: Error;
|
|
15
|
-
existingId?: string;
|
|
16
|
-
}, Error, CreateContentInput, unknown>;
|
|
17
|
-
export declare function useUpdateLocalized(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").UpdateResult | {
|
|
18
|
-
updatedContent: LocalizedEntry | null;
|
|
19
|
-
success: boolean;
|
|
20
|
-
etag?: string;
|
|
21
|
-
modified?: Date;
|
|
22
|
-
reason?: "not_found" | "stale_write" | "write_error";
|
|
23
|
-
error?: Error;
|
|
24
|
-
currentEtag?: string;
|
|
25
|
-
conflictDetails?: {
|
|
26
|
-
metaChanged: boolean;
|
|
27
|
-
contentChanged: boolean;
|
|
28
|
-
currentMeta?: import("@conloca/content-api").ContentMeta;
|
|
29
|
-
currentContent?: import("@conloca/content-api").ContentData;
|
|
30
|
-
localContent?: import("@conloca/content-api").ContentData;
|
|
31
|
-
};
|
|
32
|
-
}, Error, UpdateLocaleInput, unknown>;
|
|
33
|
-
interface DeleteContentArgs {
|
|
34
|
-
id: string;
|
|
35
|
-
etag: string;
|
|
36
|
-
locale?: string;
|
|
37
|
-
}
|
|
38
|
-
export declare function useDeleteContent(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").DeleteResult, Error, DeleteContentArgs, unknown>;
|
|
39
|
-
interface DeleteLocalizedArgs {
|
|
40
|
-
id: string;
|
|
41
|
-
locale: string;
|
|
42
|
-
etag: string;
|
|
43
|
-
}
|
|
44
|
-
export declare function useDeleteLocalized(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").DeleteResult, Error, DeleteLocalizedArgs, unknown>;
|
|
45
|
-
export declare function useSitePages(site: string, locale?: string): import("@tanstack/react-query").UseQueryResult<ContentListResult, Error>;
|
|
46
|
-
export declare function usePageByPathname(site: string, pathname: string, locale?: string): import("@tanstack/react-query").UseQueryResult<ContentManifest | null, Error>;
|
|
47
|
-
export declare function usePathnameAvailability(site: string, pathname: string, excludeId?: string): import("@tanstack/react-query").UseQueryResult<{
|
|
48
|
-
available: boolean;
|
|
49
|
-
}, Error>;
|
|
50
|
-
interface MovePageArgs {
|
|
51
|
-
site: string;
|
|
52
|
-
id: string;
|
|
53
|
-
pathname: string;
|
|
54
|
-
locale?: string;
|
|
55
|
-
etag: string;
|
|
56
|
-
}
|
|
57
|
-
export declare function useMovePage(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").MoveResult, Error, MovePageArgs, unknown>;
|
|
58
|
-
export declare function useBlocks(collection?: string, locale?: string): import("@tanstack/react-query").UseQueryResult<ContentListResult, Error>;
|
|
59
|
-
export declare function useBlockByName(name: string, collection?: string, locale?: string): import("@tanstack/react-query").UseQueryResult<ContentManifest | null, Error>;
|
|
60
|
-
export declare function useData(collection?: string, locale?: string): import("@tanstack/react-query").UseQueryResult<ContentListResult, Error>;
|
|
61
|
-
export declare function useDataByName(name: string, collection: string, locale?: string): import("@tanstack/react-query").UseQueryResult<ContentManifest | null, Error>;
|
|
62
|
-
export declare function useDataNameAvailability(name: string, collection: string, excludeId?: string): import("@tanstack/react-query").UseQueryResult<{
|
|
63
|
-
available: boolean;
|
|
64
|
-
}, Error>;
|
|
65
|
-
export declare function useDataCollections(): import("@tanstack/react-query").UseQueryResult<string[], Error>;
|
|
66
|
-
export declare function useAllContent(filters?: GlobalFilters): import("@tanstack/react-query").UseQueryResult<ContentListResult, Error>;
|
|
67
|
-
export declare function useUntranslatedContent(targetLocale: string, excludeSites?: string[], includeUnpublished?: boolean): import("@tanstack/react-query").UseQueryResult<ContentListResult, Error>;
|
|
68
|
-
export declare function useSitesConfig(): import("@tanstack/react-query").UseQueryResult<import("@conloca/content-api").SitesConfig, Error>;
|
|
69
|
-
export declare function useCurrentUser(): import("@tanstack/react-query").UseQueryResult<{
|
|
70
|
-
authenticated: boolean;
|
|
71
|
-
user?: {
|
|
72
|
-
email: string;
|
|
73
|
-
sub: string;
|
|
74
|
-
};
|
|
75
|
-
}, Error>;
|
|
76
|
-
export declare function useBatchUpdate(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").BatchResult | {
|
|
77
|
-
updatedContents: {
|
|
78
|
-
index: number;
|
|
79
|
-
content: LocalizedEntry;
|
|
80
|
-
}[];
|
|
81
|
-
operations: import("@conloca/content-api").BatchOperationResult[];
|
|
82
|
-
success: boolean;
|
|
83
|
-
failed: number;
|
|
84
|
-
updated: number;
|
|
85
|
-
}, Error, UpdateLocaleInput[], unknown>;
|
|
86
|
-
export declare function useGitStatus(): import("@tanstack/react-query").UseQueryResult<GitStatus, Error>;
|
|
87
|
-
export declare function useCommitChanges(): import("@tanstack/react-query").UseMutationResult<GitCommitResult, Error, string | undefined, unknown>;
|
|
88
|
-
export declare function usePushChanges(): import("@tanstack/react-query").UseMutationResult<GitPushResult, Error, void, unknown>;
|
|
89
|
-
export declare function useAssets(): import("@tanstack/react-query").UseQueryResult<{
|
|
90
|
-
assets: import("@conloca/content-api").AssetEntry[];
|
|
91
|
-
}, Error>;
|
|
92
|
-
export declare function useAsset(filename: string): import("@tanstack/react-query").UseQueryResult<import("@conloca/content-api").AssetEntry | null, Error>;
|
|
93
|
-
export declare function useUploadAsset(): import("@tanstack/react-query").UseMutationResult<{
|
|
94
|
-
success: true;
|
|
95
|
-
asset: import("@conloca/content-api").AssetEntry;
|
|
96
|
-
}, Error, FormData, unknown>;
|
|
97
|
-
export declare function useImportAssetUrl(): import("@tanstack/react-query").UseMutationResult<{
|
|
98
|
-
success: true;
|
|
99
|
-
asset: import("@conloca/content-api").AssetEntry;
|
|
100
|
-
}, Error, {
|
|
101
|
-
url: string;
|
|
102
|
-
alt?: string;
|
|
103
|
-
folder?: string;
|
|
104
|
-
}, unknown>;
|
|
105
|
-
export declare function useDeleteAsset(): import("@tanstack/react-query").UseMutationResult<{
|
|
106
|
-
success: boolean;
|
|
107
|
-
}, Error, string, unknown>;
|
|
108
|
-
export declare function useAssetFolders(path?: string): import("@tanstack/react-query").UseQueryResult<import("@conloca/content-api").FolderListing, Error>;
|
|
109
|
-
export declare function useCreateFolder(): import("@tanstack/react-query").UseMutationResult<void, Error, string, unknown>;
|
|
110
|
-
export declare function useUpdateAssetMetadata(): import("@tanstack/react-query").UseMutationResult<import("@conloca/content-api").AssetEntry, Error, {
|
|
111
|
-
filename: string;
|
|
112
|
-
updates: {
|
|
113
|
-
alt?: string;
|
|
114
|
-
tags?: string[];
|
|
115
|
-
};
|
|
116
|
-
}, unknown>;
|
|
117
|
-
export declare function useAssetUsage(filename: string | null): import("@tanstack/react-query").UseQueryResult<import("@conloca/content-api").AssetUsage[], Error>;
|
|
118
|
-
export declare function useFolderTree(): import("@tanstack/react-query").UseQueryResult<{
|
|
119
|
-
tree: import("@conloca/content-api").FolderTreeNode[];
|
|
120
|
-
}, Error>;
|
|
121
|
-
export declare function useMoveAssets(): import("@tanstack/react-query").UseMutationResult<{
|
|
122
|
-
success: boolean;
|
|
123
|
-
moved?: number;
|
|
124
|
-
error?: string;
|
|
125
|
-
}, Error, {
|
|
126
|
-
filenames: string[];
|
|
127
|
-
sourceFolder: string;
|
|
128
|
-
targetFolder: string;
|
|
129
|
-
}, unknown>;
|
|
130
|
-
export { ContentAPIClient, StaleWriteError, APIClientError };
|
|
131
|
-
export type { GitStatus, GitCommitResult, GitPushResult };
|
|
132
|
-
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,eAAe,EAChB,MAAM,UAAU,CAAC;AAKlB,wBAAgB,mBAAmB,IAAI,gBAAgB,CAKtD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAElE;AA6CD,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,8EAQpC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gFAQ7D;AAID,wBAAgB,gBAAgB;;;;;;;;;uCA0D/B;AAED,wBAAgB,kBAAkB;;;;;;;;;;;mBA3C1B,CADH;sBACG,CAAR;oBAA+B,CAAC;;sCAgH/B;AAED,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,gBAAgB,sIA2G/B;AAED,UAAU,mBAAmB;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,kBAAkB,wIAiBjC;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,4EAOzD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,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,wBAAgB,gBAAgB,2GAU/B;AAED,wBAAgB,cAAc,2FAU7B;AAID,wBAAgB,SAAS;;UAOxB;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,2GAQxC;AAED,wBAAgB,cAAc;;;6BAW7B;AAED,wBAAgB,iBAAiB;;;;SAKa,MAAM;UAAQ,MAAM;aAAW,MAAM;YAOlF;AAED,wBAAgB,cAAc;;2BAW7B;AAID,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,uGAO5C;AAED,wBAAgB,eAAe,oFAU9B;AAED,wBAAgB,sBAAsB;cAKc,MAAM;aAAW;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE;YAOrG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,sGASpD;AAED,wBAAgB,aAAa;;UAQ5B;AAED,wBAAgB,aAAa;;;;;eAUZ,MAAM,EAAE;kBACL,MAAM;kBACN,MAAM;YASzB;AAGD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC7D,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type { AssetEntry, AssetUsage, ContentData, ContentEntry, ContentIdentity, ContentManifest, ContentType, FolderListing, FolderTreeNode, LocaleVersion, LocalizedEntry, LocalizedManifest, SitesConfig, UpdateResult, } from '@conloca/content-api';
|
|
2
|
-
export { ErrorCodes, localesOf } from '@conloca/content-api';
|
|
3
|
-
export * from './client';
|
|
4
|
-
export * from './hooks';
|
|
5
|
-
export { API_ROUTES } from './test-helpers';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7D,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content-api-client.d.ts","sourceRoot":"","sources":["../../src/lib/content-api-client.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/dist/test-helpers.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { BatchResult, ContentEntry, ContentManifest, CreateResult, DeleteResult, LocalizedEntry, UpdateResult } from '@conloca/content-api';
|
|
2
|
-
/**
|
|
3
|
-
* Test helpers for mocking Content API Client
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* API route patterns used by the content API
|
|
7
|
-
* These match the routes defined in content-api/src/middleware.ts
|
|
8
|
-
*/
|
|
9
|
-
export declare const API_ROUTES: {
|
|
10
|
-
readonly SITES: "/sites";
|
|
11
|
-
readonly ALL_CONTENT: "/content";
|
|
12
|
-
readonly CONTENT_BY_ID: (id: string) => string;
|
|
13
|
-
readonly LOCALIZED_CONTENT: (id: string, locale: string) => string;
|
|
14
|
-
readonly SITE_PAGES: (site: string) => string;
|
|
15
|
-
readonly BLOCKS: "/blocks";
|
|
16
|
-
readonly COLLECTIONS: "/content/collections";
|
|
17
|
-
readonly BATCH_UPDATE: "/content/batch";
|
|
18
|
-
readonly FIND_UNTRANSLATED: "/content/find-untranslated";
|
|
19
|
-
};
|
|
20
|
-
export interface MockResponse {
|
|
21
|
-
status?: number;
|
|
22
|
-
headers?: Record<string, string>;
|
|
23
|
-
body?: any;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Creates a mock fetch function for testing
|
|
27
|
-
* Note: This requires a mock function from your test framework (e.g., bun:test, jest, vitest)
|
|
28
|
-
*/
|
|
29
|
-
export declare function createMockFetch(mockFn: (impl?: any) => any): any;
|
|
30
|
-
/**
|
|
31
|
-
* Creates a Response object with JSON body
|
|
32
|
-
*/
|
|
33
|
-
export declare function jsonResponse(body: any, options?: {
|
|
34
|
-
status?: number;
|
|
35
|
-
headers?: Record<string, string>;
|
|
36
|
-
}): Response;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a mock ContentEntry
|
|
39
|
-
*/
|
|
40
|
-
export declare function mockContentEntry(overrides?: Partial<ContentEntry>): ContentEntry;
|
|
41
|
-
/**
|
|
42
|
-
* Creates a mock ContentManifest
|
|
43
|
-
*/
|
|
44
|
-
export declare function mockContentManifest(overrides?: Partial<ContentManifest>): ContentManifest;
|
|
45
|
-
/**
|
|
46
|
-
* Creates a mock LocalizedEntry
|
|
47
|
-
*/
|
|
48
|
-
export declare function mockLocalizedEntry(overrides?: Partial<LocalizedEntry>): LocalizedEntry;
|
|
49
|
-
/**
|
|
50
|
-
* Creates a mock CreateResult
|
|
51
|
-
*/
|
|
52
|
-
export declare function mockCreateResult(overrides?: Partial<CreateResult>): CreateResult;
|
|
53
|
-
/**
|
|
54
|
-
* Creates a mock UpdateResult
|
|
55
|
-
*/
|
|
56
|
-
export declare function mockUpdateResult(overrides?: Partial<UpdateResult>): UpdateResult;
|
|
57
|
-
/**
|
|
58
|
-
* Creates a mock DeleteResult
|
|
59
|
-
*/
|
|
60
|
-
export declare function mockDeleteResult(overrides?: Partial<DeleteResult>): DeleteResult;
|
|
61
|
-
/**
|
|
62
|
-
* Creates a mock BatchResult
|
|
63
|
-
*/
|
|
64
|
-
export declare function mockBatchResult(overrides?: Partial<BatchResult>): BatchResult;
|
|
65
|
-
/**
|
|
66
|
-
* Mock helper for setting up common API responses
|
|
67
|
-
*/
|
|
68
|
-
export declare class MockAPIResponses {
|
|
69
|
-
private fetchMock;
|
|
70
|
-
constructor(fetchMock: any);
|
|
71
|
-
mockGetContent(content: ContentEntry | null, status?: number): this;
|
|
72
|
-
mockGetLocalized(entry: LocalizedEntry | null, status?: number): this;
|
|
73
|
-
mockListContent(items: ContentManifest[], status?: number): this;
|
|
74
|
-
mockCreateContent(result: CreateResult, status?: number): this;
|
|
75
|
-
mockUpdateContent(result: UpdateResult, status?: number): this;
|
|
76
|
-
mockDeleteContent(result: DeleteResult, status?: number): this;
|
|
77
|
-
mockStaleWrite(currentEtag: string): this;
|
|
78
|
-
mockError(message: string, status?: number): this;
|
|
79
|
-
mockNetworkError(): this;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Setup fetch mock with helper
|
|
83
|
-
* @param mockFn - Mock function from your test framework (e.g., mock from bun:test)
|
|
84
|
-
*/
|
|
85
|
-
export declare function setupFetchMock(mockFn: (impl?: any) => any): {
|
|
86
|
-
fetchMock: any;
|
|
87
|
-
responses: MockAPIResponses;
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=test-helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU;;;iCAGD,MAAM;qCACF,MAAM,UAAU,MAAM;gCAC3B,MAAM;;;;;CAKjB,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM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gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,EAAE,MAAM,SAAM;IAS3D,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,MAAM,SAAM;IAKtD,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,SAAM;IAapD,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,SAAM;IAapD,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,SAAM;IAKpD,cAAc,CAAC,WAAW,EAAE,MAAM;IAgBlC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAM;IAKvC,gBAAgB;CAIjB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,GAAG;;;EAOzD"}
|
package/dist/testing.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
export * from './test-helpers';
|
|
8
|
-
//# sourceMappingURL=testing.d.ts.map
|
package/dist/testing.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC"}
|