@dotcms/client 0.0.1-alpha.4 → 0.0.1-alpha.40
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/.eslintrc.json +18 -0
- package/README.md +17 -6
- package/jest.config.ts +15 -0
- package/package.json +5 -5
- package/project.json +72 -0
- package/src/index.ts +30 -0
- package/src/lib/client/content/builders/collection/collection.spec.ts +515 -0
- package/src/lib/client/content/builders/collection/collection.ts +416 -0
- package/src/lib/client/content/content-api.ts +139 -0
- package/src/lib/client/content/shared/const.ts +15 -0
- package/src/lib/client/content/shared/types.ts +155 -0
- package/src/lib/client/content/shared/utils.ts +28 -0
- package/src/lib/client/models/index.ts +19 -0
- package/src/lib/client/models/types.ts +14 -0
- package/src/lib/client/sdk-js-client.spec.ts +483 -0
- package/src/lib/client/sdk-js-client.ts +442 -0
- package/src/lib/editor/listeners/listeners.spec.ts +119 -0
- package/src/lib/editor/listeners/listeners.ts +223 -0
- package/src/lib/editor/models/client.model.ts +84 -0
- package/src/lib/editor/models/editor.model.ts +53 -0
- package/src/lib/editor/models/listeners.model.ts +50 -0
- package/src/lib/editor/sdk-editor-vtl.ts +31 -0
- package/src/lib/editor/sdk-editor.spec.ts +116 -0
- package/src/lib/editor/sdk-editor.ts +105 -0
- package/src/lib/editor/utils/editor.utils.spec.ts +206 -0
- package/src/lib/editor/utils/editor.utils.ts +258 -0
- package/src/lib/query-builder/lucene-syntax/Equals.ts +148 -0
- package/src/lib/query-builder/lucene-syntax/Field.ts +40 -0
- package/src/lib/query-builder/lucene-syntax/NotOperand.ts +34 -0
- package/src/lib/query-builder/lucene-syntax/Operand.ts +58 -0
- package/src/lib/query-builder/lucene-syntax/index.ts +4 -0
- package/src/lib/query-builder/sdk-query-builder.spec.ts +159 -0
- package/src/lib/query-builder/sdk-query-builder.ts +87 -0
- package/src/lib/query-builder/utils/index.ts +179 -0
- package/src/lib/utils/graphql/transforms.spec.ts +150 -0
- package/src/lib/utils/graphql/transforms.ts +99 -0
- package/src/lib/utils/index.ts +2 -0
- package/src/lib/utils/page/common-utils.spec.ts +37 -0
- package/src/lib/utils/page/common-utils.ts +64 -0
- package/tsconfig.json +22 -0
- package/tsconfig.lib.json +13 -0
- package/tsconfig.spec.json +9 -0
- package/src/index.d.ts +0 -2
- package/src/index.js +0 -3
- package/src/index.js.map +0 -1
- package/src/lib/postMessageToEditor.d.ts +0 -50
- package/src/lib/postMessageToEditor.js +0 -42
- package/src/lib/postMessageToEditor.js.map +0 -1
- package/src/lib/sdk-js-client.d.ts +0 -183
- package/src/lib/sdk-js-client.js +0 -145
- package/src/lib/sdk-js-client.js.map +0 -1
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["../../../.eslintrc.base.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
+
"rules": {}
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"files": ["*.ts", "*.tsx"],
|
|
11
|
+
"rules": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.js", "*.jsx"],
|
|
15
|
+
"rules": {}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/README.md
CHANGED
|
@@ -26,12 +26,24 @@ yarn add @dotcms/client
|
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
`@dotcms/client` supports both ES modules and CommonJS. You can import it using either syntax:
|
|
30
|
+
|
|
31
|
+
### ES Modules
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
import { DotCmsClient } from '@dotcms/client';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### CommonJS
|
|
30
38
|
|
|
31
39
|
```javascript
|
|
32
|
-
|
|
40
|
+
const { DotCmsClient } = require('@dotcms/client');
|
|
41
|
+
```
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
First, initialize the client with your DotCMS instance details.
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
const client = DotCmsClient.init({
|
|
35
47
|
dotcmsUrl: 'https://your-dotcms-instance.com',
|
|
36
48
|
authToken: 'your-auth-token',
|
|
37
49
|
siteId: 'your-site-id'
|
|
@@ -70,7 +82,7 @@ console.log(navData);
|
|
|
70
82
|
|
|
71
83
|
Detailed documentation of the `@dotcms/client` methods, parameters, and types can be found below:
|
|
72
84
|
|
|
73
|
-
### `
|
|
85
|
+
### `DotCmsClient.init(config: ClientConfig): DotCmsClient`
|
|
74
86
|
|
|
75
87
|
Initializes the DotCMS client with the specified configuration.
|
|
76
88
|
|
|
@@ -105,7 +117,6 @@ Always refer to the official [DotCMS documentation](https://www.dotcms.com/docs/
|
|
|
105
117
|
| Installation | [Installation](https://dotcms.com/docs/latest/installation) |
|
|
106
118
|
| Documentation | [Documentation](https://dotcms.com/docs/latest/table-of-contents) |
|
|
107
119
|
| Videos | [Helpful Videos](http://dotcms.com/videos/) |
|
|
108
|
-
| Code Examples | [Codeshare](https://dotcms.com/codeshare/) |
|
|
109
120
|
| Forums/Listserv | [via Google Groups](https://groups.google.com/forum/#!forum/dotCMS) |
|
|
110
121
|
| Twitter | @dotCMS |
|
|
111
|
-
| Main Site | [dotCMS.com](https://dotcms.com/) |
|
|
122
|
+
| Main Site | [dotCMS.com](https://dotcms.com/) |
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
displayName: 'sdk-client',
|
|
4
|
+
preset: '../../../jest.preset.js',
|
|
5
|
+
globals: {
|
|
6
|
+
'ts-jest': {
|
|
7
|
+
tsconfig: '<rootDir>/tsconfig.spec.json'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
transform: {
|
|
11
|
+
'^.+\\.[tj]s$': 'ts-jest'
|
|
12
|
+
},
|
|
13
|
+
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
14
|
+
coverageDirectory: '../../../coverage/libs/sdk/client'
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotcms/client",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.0.1-alpha.40",
|
|
5
4
|
"description": "Official JavaScript library for interacting with DotCMS REST APIs.",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "git+https://github.com/dotCMS/core.git#master"
|
|
9
8
|
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "nx run sdk-client:build:js; cd ../../../../dotCMS/src/main/webapp/html/js/editor-js; rm -rf src package.json *.esm.d.ts"
|
|
11
|
+
},
|
|
10
12
|
"keywords": [
|
|
11
13
|
"dotCMS",
|
|
12
14
|
"CMS",
|
|
@@ -19,7 +21,5 @@
|
|
|
19
21
|
"bugs": {
|
|
20
22
|
"url": "https://github.com/dotCMS/core/issues"
|
|
21
23
|
},
|
|
22
|
-
"homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/client/README.md"
|
|
23
|
-
"module": "./src/index.js",
|
|
24
|
-
"main": "./src/index.js"
|
|
24
|
+
"homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/client/README.md"
|
|
25
25
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sdk-client",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "libs/sdk/client/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"targets": {
|
|
7
|
+
"build": {
|
|
8
|
+
"executor": "@nx/rollup:rollup",
|
|
9
|
+
"outputs": ["{options.outputPath}"],
|
|
10
|
+
"options": {
|
|
11
|
+
"format": ["esm", "cjs"],
|
|
12
|
+
"compiler": "tsc",
|
|
13
|
+
"generateExportsField": true,
|
|
14
|
+
"assets": [{ "input": "libs/sdk/client", "output": ".", "glob": "*.md" }],
|
|
15
|
+
"outputPath": "dist/libs/sdk/client",
|
|
16
|
+
"main": "libs/sdk/client/src/index.ts",
|
|
17
|
+
"tsConfig": "libs/sdk/client/tsconfig.lib.json"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"build:js": {
|
|
21
|
+
"executor": "@nx/esbuild:esbuild",
|
|
22
|
+
"outputs": ["{options.outputPath}"],
|
|
23
|
+
"options": {
|
|
24
|
+
"outputPath": "../dotCMS/src/main/webapp/html/js/editor-js",
|
|
25
|
+
"outputFileName": "sdk-editor",
|
|
26
|
+
"format": ["esm"],
|
|
27
|
+
"tsConfig": "libs/sdk/client/tsconfig.lib.json",
|
|
28
|
+
"project": "libs/sdk/client/package.json",
|
|
29
|
+
"entryFile": "libs/sdk/client/src/lib/editor/sdk-editor-vtl.ts",
|
|
30
|
+
"external": ["react/jsx-runtime"],
|
|
31
|
+
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
|
|
32
|
+
"compiler": "tsc",
|
|
33
|
+
"extractCss": false,
|
|
34
|
+
"minify": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"publish": {
|
|
38
|
+
"executor": "nx:run-commands",
|
|
39
|
+
"options": {
|
|
40
|
+
"command": "node tools/scripts/publish.mjs sdk-client {args.ver} {args.tag}"
|
|
41
|
+
},
|
|
42
|
+
"dependsOn": ["build"]
|
|
43
|
+
},
|
|
44
|
+
"nx-release-publish": {
|
|
45
|
+
"options": {
|
|
46
|
+
"packageRoot": "dist/libs/sdk/client"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"lint": {
|
|
50
|
+
"executor": "@nx/eslint:lint",
|
|
51
|
+
"outputs": ["{options.outputFile}"],
|
|
52
|
+
"options": {
|
|
53
|
+
"lintFilePatterns": ["libs/sdk/client/**/*.ts"]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"test": {
|
|
57
|
+
"executor": "@nrwl/jest:jest",
|
|
58
|
+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
59
|
+
"options": {
|
|
60
|
+
"jestConfig": "libs/sdk/client/jest.config.ts",
|
|
61
|
+
"passWithNoTests": true
|
|
62
|
+
},
|
|
63
|
+
"configurations": {
|
|
64
|
+
"ci": {
|
|
65
|
+
"ci": true,
|
|
66
|
+
"codeCoverage": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"tags": []
|
|
72
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ClientConfig, DotCmsClient } from './lib/client/sdk-js-client';
|
|
2
|
+
import { CUSTOMER_ACTIONS, postMessageToEditor } from './lib/editor/models/client.model';
|
|
3
|
+
import {
|
|
4
|
+
CustomClientParams,
|
|
5
|
+
DotCMSPageEditorConfig,
|
|
6
|
+
EditorConfig
|
|
7
|
+
} from './lib/editor/models/editor.model';
|
|
8
|
+
import {
|
|
9
|
+
destroyEditor,
|
|
10
|
+
initEditor,
|
|
11
|
+
isInsideEditor,
|
|
12
|
+
updateNavigation
|
|
13
|
+
} from './lib/editor/sdk-editor';
|
|
14
|
+
import { getPageRequestParams, graphqlToPageEntity } from './lib/utils';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
graphqlToPageEntity,
|
|
18
|
+
getPageRequestParams,
|
|
19
|
+
isInsideEditor,
|
|
20
|
+
DotCmsClient,
|
|
21
|
+
DotCMSPageEditorConfig,
|
|
22
|
+
CUSTOMER_ACTIONS,
|
|
23
|
+
CustomClientParams,
|
|
24
|
+
postMessageToEditor,
|
|
25
|
+
EditorConfig,
|
|
26
|
+
initEditor,
|
|
27
|
+
updateNavigation,
|
|
28
|
+
destroyEditor,
|
|
29
|
+
ClientConfig
|
|
30
|
+
};
|