@unchainedshop/cockpit-api 1.0.15 → 1.0.17
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 +3 -60
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -1,31 +1,12 @@
|
|
|
1
|
-
Sure! Here's a well-structured `README.md` for your `cockpit-api` package:
|
|
2
|
-
|
|
3
|
-
```markdown
|
|
4
1
|
# Cockpit API
|
|
5
2
|
|
|
6
3
|
A package to interact with the Cockpit CMS API, including functionalities to handle GraphQL requests and various CMS content manipulations.
|
|
7
|
-
|
|
8
|
-
## Table of Contents
|
|
9
|
-
|
|
10
|
-
- [Installation](#installation)
|
|
11
|
-
- [Usage](#usage)
|
|
12
|
-
- [Initialization](#initialization)
|
|
13
|
-
- [GraphQL Requests](#graphql-requests)
|
|
14
|
-
- [Content Operations](#content-operations)
|
|
15
|
-
- [API Reference](#api-reference)
|
|
16
|
-
- [generateCmsRouteReplacements](#generatecmsroutereplacements)
|
|
17
|
-
- [FixImagePaths](#fiximagepaths)
|
|
18
|
-
- [CockpitAPI](#cockpitapi)
|
|
19
|
-
- [makeCockpitSchema](#makecockpitschema)
|
|
20
|
-
- [Contributing](#contributing)
|
|
21
|
-
- [License](#license)
|
|
22
|
-
|
|
23
4
|
## Installation
|
|
24
5
|
|
|
25
6
|
Install the package via npm:
|
|
26
7
|
|
|
27
8
|
```sh
|
|
28
|
-
npm install cockpit-api
|
|
9
|
+
npm install --save @unchainedshop/cockpit-api
|
|
29
10
|
```
|
|
30
11
|
|
|
31
12
|
## Usage
|
|
@@ -35,7 +16,7 @@ npm install cockpit-api
|
|
|
35
16
|
First, import and initialize the API:
|
|
36
17
|
|
|
37
18
|
```javascript
|
|
38
|
-
import CockpitAPI from 'cockpit-api';
|
|
19
|
+
import { CockpitAPI } from '@unchainedshop/cockpit-api';
|
|
39
20
|
|
|
40
21
|
const cockpit = await CockpitAPI();
|
|
41
22
|
```
|
|
@@ -71,33 +52,6 @@ const contentItem = await cockpit.getContentItem({ model: 'posts', id: '123' });
|
|
|
71
52
|
console.log(contentItem);
|
|
72
53
|
```
|
|
73
54
|
|
|
74
|
-
## API Reference
|
|
75
|
-
|
|
76
|
-
### generateCmsRouteReplacements
|
|
77
|
-
|
|
78
|
-
Generates route replacements for CMS.
|
|
79
|
-
|
|
80
|
-
```javascript
|
|
81
|
-
import { generateCmsRouteReplacements } from 'cockpit-api';
|
|
82
|
-
|
|
83
|
-
const replacements = await generateCmsRouteReplacements();
|
|
84
|
-
console.log(replacements);
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### FixImagePaths
|
|
88
|
-
|
|
89
|
-
Transforms and fixes image paths in CMS responses.
|
|
90
|
-
|
|
91
|
-
```javascript
|
|
92
|
-
import { FixImagePaths } from 'cockpit-api';
|
|
93
|
-
|
|
94
|
-
const replacements = await generateCmsRouteReplacements();
|
|
95
|
-
const { transformResult } = FixImagePaths(replacements);
|
|
96
|
-
|
|
97
|
-
const fixedResponse = transformResult(originalResponse);
|
|
98
|
-
console.log(fixedResponse);
|
|
99
|
-
```
|
|
100
|
-
|
|
101
55
|
### CockpitAPI
|
|
102
56
|
|
|
103
57
|
Provides various methods to interact with the Cockpit CMS.
|
|
@@ -119,17 +73,6 @@ Provides various methods to interact with the Cockpit CMS.
|
|
|
119
73
|
- `pagesSitemap()`
|
|
120
74
|
- `pagesSetting(locale)`
|
|
121
75
|
|
|
122
|
-
### makeCockpitSchema
|
|
123
|
-
|
|
124
|
-
Creates a GraphQL schema from the Cockpit CMS API.
|
|
125
|
-
|
|
126
|
-
```javascript
|
|
127
|
-
import { makeCockpitSchema } from 'cockpit-api';
|
|
128
|
-
|
|
129
|
-
const schema = await makeCockpitSchema();
|
|
130
|
-
console.log(schema);
|
|
131
|
-
```
|
|
132
|
-
|
|
133
76
|
## Contributing
|
|
134
77
|
|
|
135
78
|
Contributions are welcome! Please open an issue or submit a pull request.
|
|
@@ -145,4 +88,4 @@ Contributions are welcome! Please open an issue or submit a pull request.
|
|
|
145
88
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
146
89
|
```
|
|
147
90
|
|
|
148
|
-
This `README.md` covers installation, basic usage, detailed API reference, contribution guidelines, and licensing information. Adjust the details as needed for your specific implementation.
|
|
91
|
+
This `README.md` covers installation, basic usage, detailed API reference, contribution guidelines, and licensing information. Adjust the details as needed for your specific implementation.
|
package/package.json
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/cockpit-api",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Cockpit
|
|
3
|
+
"version": "1.0.17",
|
|
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
|
+
"homepage": "https://unchained.shop",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"build": "tsc"
|
|
8
|
-
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/unchainedshop/cockpit-api.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/unchainedshop/cockpit-api/issues"
|
|
9
16
|
},
|
|
10
17
|
"keywords": [
|
|
11
18
|
"unchainedshop",
|
|
12
19
|
"cockpit",
|
|
13
20
|
"api"
|
|
14
21
|
],
|
|
15
|
-
"author": "
|
|
22
|
+
"author": "Mikael Araya",
|
|
16
23
|
"license": "ISC",
|
|
17
24
|
"dependencies": {
|
|
18
25
|
"@unchainedshop/logger": "^2.10.5",
|