@dotcms/client 0.0.1-alpha.37 → 0.0.1-alpha.39

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.
Files changed (66) hide show
  1. package/.eslintrc.json +18 -0
  2. package/README.md +4 -4
  3. package/jest.config.ts +15 -0
  4. package/package.json +3 -15
  5. package/project.json +72 -0
  6. package/src/index.ts +30 -0
  7. package/src/lib/client/content/builders/collection/collection.spec.ts +515 -0
  8. package/src/lib/client/content/builders/collection/collection.ts +416 -0
  9. package/src/lib/client/content/content-api.ts +139 -0
  10. package/src/lib/client/content/shared/const.ts +15 -0
  11. package/src/lib/client/content/shared/types.ts +155 -0
  12. package/src/lib/client/content/shared/utils.ts +28 -0
  13. package/src/lib/client/models/index.ts +19 -0
  14. package/src/lib/client/models/types.ts +14 -0
  15. package/src/lib/client/sdk-js-client.spec.ts +483 -0
  16. package/src/lib/client/sdk-js-client.ts +442 -0
  17. package/src/lib/editor/listeners/listeners.spec.ts +119 -0
  18. package/src/lib/editor/listeners/listeners.ts +223 -0
  19. package/src/lib/editor/models/{client.model.d.ts → client.model.ts} +19 -16
  20. package/src/lib/editor/models/{editor.model.d.ts → editor.model.ts} +9 -5
  21. package/src/lib/editor/models/{listeners.model.d.ts → listeners.model.ts} +9 -6
  22. package/src/lib/editor/sdk-editor-vtl.ts +31 -0
  23. package/src/lib/editor/sdk-editor.spec.ts +116 -0
  24. package/src/lib/editor/sdk-editor.ts +105 -0
  25. package/src/lib/editor/utils/editor.utils.spec.ts +206 -0
  26. package/src/lib/editor/utils/editor.utils.ts +258 -0
  27. package/src/lib/query-builder/lucene-syntax/{Equals.d.ts → Equals.ts} +83 -18
  28. package/src/lib/query-builder/lucene-syntax/Field.ts +40 -0
  29. package/src/lib/query-builder/lucene-syntax/{NotOperand.d.ts → NotOperand.ts} +18 -6
  30. package/src/lib/query-builder/lucene-syntax/{Operand.d.ts → Operand.ts} +21 -7
  31. package/src/lib/query-builder/sdk-query-builder.spec.ts +159 -0
  32. package/src/lib/query-builder/sdk-query-builder.ts +87 -0
  33. package/src/lib/query-builder/utils/index.ts +179 -0
  34. package/src/lib/utils/graphql/transforms.spec.ts +150 -0
  35. package/src/lib/utils/graphql/transforms.ts +99 -0
  36. package/src/lib/utils/page/common-utils.spec.ts +37 -0
  37. package/src/lib/utils/page/common-utils.ts +64 -0
  38. package/tsconfig.json +22 -0
  39. package/tsconfig.lib.json +13 -0
  40. package/tsconfig.spec.json +9 -0
  41. package/index.cjs.d.ts +0 -1
  42. package/index.cjs.default.js +0 -1
  43. package/index.cjs.js +0 -1490
  44. package/index.cjs.mjs +0 -2
  45. package/index.esm.d.ts +0 -1
  46. package/index.esm.js +0 -1481
  47. package/src/index.d.ts +0 -6
  48. package/src/lib/client/content/builders/collection/collection.d.ts +0 -148
  49. package/src/lib/client/content/content-api.d.ts +0 -78
  50. package/src/lib/client/content/shared/const.d.ts +0 -3
  51. package/src/lib/client/content/shared/types.d.ts +0 -62
  52. package/src/lib/client/content/shared/utils.d.ts +0 -12
  53. package/src/lib/client/models/index.d.ts +0 -1
  54. package/src/lib/client/models/types.d.ts +0 -5
  55. package/src/lib/client/sdk-js-client.d.ts +0 -193
  56. package/src/lib/editor/listeners/listeners.d.ts +0 -46
  57. package/src/lib/editor/sdk-editor-vtl.d.ts +0 -6
  58. package/src/lib/editor/sdk-editor.d.ts +0 -29
  59. package/src/lib/editor/utils/editor.utils.d.ts +0 -83
  60. package/src/lib/query-builder/lucene-syntax/Field.d.ts +0 -23
  61. package/src/lib/query-builder/sdk-query-builder.d.ts +0 -42
  62. package/src/lib/query-builder/utils/index.d.ts +0 -91
  63. package/src/lib/utils/graphql/transforms.d.ts +0 -11
  64. package/src/lib/utils/page/common-utils.d.ts +0 -11
  65. /package/src/lib/query-builder/lucene-syntax/{index.d.ts → index.ts} +0 -0
  66. /package/src/lib/utils/{index.d.ts → index.ts} +0 -0
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
@@ -31,19 +31,19 @@ yarn add @dotcms/client
31
31
  ### ES Modules
32
32
 
33
33
  ```javascript
34
- import { dotcmsClient } from '@dotcms/client';
34
+ import { DotCmsClient } from '@dotcms/client';
35
35
  ```
36
36
 
37
37
  ### CommonJS
38
38
 
39
39
  ```javascript
40
- const { dotcmsClient } = require('@dotcms/client');
40
+ const { DotCmsClient } = require('@dotcms/client');
41
41
  ```
42
42
 
43
43
  First, initialize the client with your DotCMS instance details.
44
44
 
45
45
  ```javascript
46
- const client = dotcmsClient.init({
46
+ const client = DotCmsClient.init({
47
47
  dotcmsUrl: 'https://your-dotcms-instance.com',
48
48
  authToken: 'your-auth-token',
49
49
  siteId: 'your-site-id'
@@ -82,7 +82,7 @@ console.log(navData);
82
82
 
83
83
  Detailed documentation of the `@dotcms/client` methods, parameters, and types can be found below:
84
84
 
85
- ### `dotcmsClient.init(config: ClientConfig): DotCmsClient`
85
+ ### `DotCmsClient.init(config: ClientConfig): DotCmsClient`
86
86
 
87
87
  Initializes the DotCMS client with the specified configuration.
88
88
 
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/client",
3
- "version": "0.0.1-alpha.37",
3
+ "version": "0.0.1-alpha.39",
4
4
  "description": "Official JavaScript library for interacting with DotCMS REST APIs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,17 +21,5 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/dotCMS/core/issues"
23
23
  },
24
- "homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/client/README.md",
25
- "exports": {
26
- "./package.json": "./package.json",
27
- ".": {
28
- "module": "./index.esm.js",
29
- "types": "./index.esm.d.ts",
30
- "import": "./index.cjs.mjs",
31
- "default": "./index.cjs.js"
32
- }
33
- },
34
- "module": "./index.esm.js",
35
- "main": "./index.cjs.js",
36
- "types": "./index.esm.d.ts"
37
- }
24
+ "homepage": "https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/client/README.md"
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
+ };