@unchainedshop/cockpit-api 1.0.21 → 1.0.22
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 +13 -0
- package/package.json +1 -1
- package/src/api.ts +3 -5
package/README.md
CHANGED
|
@@ -77,6 +77,19 @@ Provides various methods to interact with the Cockpit CMS.
|
|
|
77
77
|
- `pagesRoutes(locale)`
|
|
78
78
|
- `pagesSitemap()`
|
|
79
79
|
- `pagesSetting(locale)`
|
|
80
|
+
- `healthCheck()`
|
|
81
|
+
- `lokalize(projectName,locale, nested)`
|
|
82
|
+
- `assetById(assetId)`
|
|
83
|
+
- `imageAssetById(assetId, queryParams)`
|
|
84
|
+
- `getFullRouteForSlug(slug)`
|
|
85
|
+
|
|
86
|
+
### Optional configuration
|
|
87
|
+
you can change the caching behavior by setting the envs below
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
COCKPIT_CACHE__MAX_LIMIT # number of records to store in before overwriting it
|
|
91
|
+
COCKPIT_CACHE_TTL # caching period in milliseconds
|
|
92
|
+
```
|
|
80
93
|
|
|
81
94
|
## Contributing
|
|
82
95
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/cockpit-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
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",
|
package/src/api.ts
CHANGED
|
@@ -104,13 +104,11 @@ export const FixImagePaths = (replacements: any, tenant?: string) => {
|
|
|
104
104
|
.replace(/"path":"\//g, `"path":"${url}/storage/uploads/`)
|
|
105
105
|
.replace(/src=\\"\/storage/gi, `src=\\"${url}/storage`)
|
|
106
106
|
.replace(/href=\\"\/storage/gi, `href=\\"${url}/storage`)
|
|
107
|
+
.replace(/src=\\"\/(\:.*\/)storage/gi, `src=\\"${url}/storage`)
|
|
108
|
+
.replace(/href=\\"\/(\:.*\/)storage/gi, `href=\\"${url}/storage`)
|
|
107
109
|
.replace(pattern, (match) => replacements[match])
|
|
108
110
|
// fixes image paths which already had a path including storage/uploads
|
|
109
|
-
.replace(
|
|
110
|
-
/"path":"\/storage\/uploads\/storage\/uploads\//g,
|
|
111
|
-
`"path":"/storage/uploads/`,
|
|
112
|
-
);
|
|
113
|
-
|
|
111
|
+
.replace(/\/storage\/uploads\/storage\/uploads\//g, `/storage/uploads/`)
|
|
114
112
|
return JSON.parse(fixedDataString);
|
|
115
113
|
} catch (e) {
|
|
116
114
|
return originalResponse;
|