@unchainedshop/cockpit-api 2.2.1 → 2.2.2
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/client.d.ts +3 -3
- package/dist/methods/assets.d.ts +17 -7
- package/dist/methods/pages.js +3 -0
- package/dist/methods/routes.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -39,14 +39,14 @@ export interface CockpitAPIClient {
|
|
|
39
39
|
/**
|
|
40
40
|
* Get a transformed image asset URL.
|
|
41
41
|
*
|
|
42
|
-
* **Important:**
|
|
43
|
-
*
|
|
42
|
+
* **Important:** At least one of `w` (width) or `h` (height) must be provided.
|
|
43
|
+
* The Cockpit CMS API requires this and returns a 400 error without it.
|
|
44
44
|
*
|
|
45
45
|
* @param assetId - The asset ID
|
|
46
46
|
* @param queryParams - Image transformation parameters (w or h required)
|
|
47
47
|
* @returns URL string to the generated image, or null if not found
|
|
48
48
|
*/
|
|
49
|
-
imageAssetById(assetId: string, queryParams
|
|
49
|
+
imageAssetById(assetId: string, queryParams: ImageAssetQueryParams): Promise<string | null>;
|
|
50
50
|
getFullRouteForSlug(slug: string): Promise<string | undefined>;
|
|
51
51
|
/**
|
|
52
52
|
* Clear cache entries matching pattern
|
package/dist/methods/assets.d.ts
CHANGED
|
@@ -38,28 +38,38 @@ export declare enum MimeType {
|
|
|
38
38
|
WEBP = "webp",
|
|
39
39
|
BMP = "bmp"
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Image transformation parameters for imageAssetById.
|
|
43
|
+
*
|
|
44
|
+
* At least one of `w` (width) or `h` (height) must be provided.
|
|
45
|
+
* The Cockpit CMS API requires this and returns a 400 error without it.
|
|
46
|
+
*/
|
|
47
|
+
export type ImageAssetQueryParams = {
|
|
42
48
|
m?: ImageSizeMode;
|
|
43
|
-
w?: number;
|
|
44
|
-
h?: number;
|
|
45
49
|
q?: number;
|
|
46
50
|
mime?: MimeType;
|
|
47
51
|
re?: number;
|
|
48
52
|
t?: string;
|
|
49
53
|
o?: number;
|
|
50
|
-
}
|
|
54
|
+
} & ({
|
|
55
|
+
w: number;
|
|
56
|
+
h?: number;
|
|
57
|
+
} | {
|
|
58
|
+
w?: number;
|
|
59
|
+
h: number;
|
|
60
|
+
});
|
|
51
61
|
export interface AssetMethods {
|
|
52
62
|
assetById<T = CockpitAsset>(assetId: string): Promise<T | null>;
|
|
53
63
|
/**
|
|
54
64
|
* Get a transformed image asset URL.
|
|
55
65
|
*
|
|
56
|
-
* **Important:**
|
|
57
|
-
*
|
|
66
|
+
* **Important:** At least one of `w` (width) or `h` (height) must be provided.
|
|
67
|
+
* The Cockpit CMS API requires this and returns a 400 error without it.
|
|
58
68
|
*
|
|
59
69
|
* @param assetId - The asset ID
|
|
60
70
|
* @param queryParams - Image transformation parameters (w or h required)
|
|
61
71
|
* @returns URL string to the generated image, or null if not found
|
|
62
72
|
*/
|
|
63
|
-
imageAssetById(assetId: string, queryParams
|
|
73
|
+
imageAssetById(assetId: string, queryParams: ImageAssetQueryParams): Promise<string | null>;
|
|
64
74
|
}
|
|
65
75
|
export declare function createAssetMethods(ctx: MethodContext): AssetMethods;
|
package/dist/methods/pages.js
CHANGED
|
@@ -12,6 +12,9 @@ export function createPagesMethods(ctx) {
|
|
|
12
12
|
});
|
|
13
13
|
const result = await ctx.http.fetch(url);
|
|
14
14
|
// Normalize response to always return { data, meta? }
|
|
15
|
+
// Note: The Cockpit /api/pages/pages endpoint returns a raw array even when skip
|
|
16
|
+
// is provided, unlike /api/content/items/{model} which returns { data, meta }.
|
|
17
|
+
// This means meta.total will not be available for pages() method.
|
|
15
18
|
if (result === null) {
|
|
16
19
|
return null;
|
|
17
20
|
}
|
package/dist/methods/routes.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface CockpitSettings {
|
|
|
28
28
|
logo?: CockpitAsset | null;
|
|
29
29
|
small?: CockpitAsset | null;
|
|
30
30
|
favicon?: CockpitAsset | null;
|
|
31
|
-
[key: string]: CockpitAsset | null
|
|
31
|
+
[key: string]: CockpitAsset | null;
|
|
32
32
|
};
|
|
33
33
|
scripts?: {
|
|
34
34
|
header?: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/cockpit-api",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "A package to interact with the Cockpit CMS API, including functionalities to handle GraphQL requests and various CMS content manipulations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"homepage": "https://unchained.shop",
|