@tailor-cms/ce-jodit-html-server 0.0.8 → 0.1.0

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/index.cjs CHANGED
@@ -22,6 +22,7 @@ __export(index_exports, {
22
22
  afterLoaded: () => afterLoaded,
23
23
  afterRetrieve: () => afterRetrieve,
24
24
  afterSave: () => afterSave,
25
+ ai: () => ai,
25
26
  beforeDisplay: () => beforeDisplay,
26
27
  beforeSave: () => beforeSave,
27
28
  default: () => index_default,
@@ -35,26 +36,48 @@ module.exports = __toCommonJS(index_exports);
35
36
  // ../manifest/dist/index.js
36
37
  var type = "JODIT_HTML";
37
38
  var initState = () => ({ content: "" });
39
+ var ai = {
40
+ Schema: {
41
+ type: "json_schema",
42
+ name: "ce_jodit_html",
43
+ schema: {
44
+ type: "object",
45
+ properties: {
46
+ content: { type: "string" }
47
+ },
48
+ required: ["content"],
49
+ additionalProperties: false
50
+ }
51
+ },
52
+ getPrompt: () => `
53
+ Generate rich text for a page as an object with the following
54
+ properties: { "content": "" }
55
+ where:
56
+ - 'content' is the text of the page in HTML format. Include only the text
57
+ content, without the full HTML page structure.
58
+ `,
59
+ processResponse: (val) => val
60
+ };
38
61
 
39
62
  // src/index.ts
40
63
  var IS_CEK = process.env.CEK_RUNTIME;
41
64
  var USER_STATE = {};
42
- function beforeSave(element, services) {
65
+ function beforeSave(element, _services) {
43
66
  return element;
44
67
  }
45
- function afterSave(element, services) {
68
+ function afterSave(element, _services) {
46
69
  return element;
47
70
  }
48
- function afterLoaded(element, services, runtime) {
71
+ function afterLoaded(element, _services, _runtime) {
49
72
  return element;
50
73
  }
51
- function afterRetrieve(element, services, runtime) {
74
+ function afterRetrieve(element, _services, _runtime) {
52
75
  return element;
53
76
  }
54
- function beforeDisplay(element, context) {
77
+ function beforeDisplay(_element, context) {
55
78
  return { ...context, ...USER_STATE };
56
79
  }
57
- function onUserInteraction(element, context, payload) {
80
+ function onUserInteraction(_element, context, payload) {
58
81
  if (IS_CEK) {
59
82
  USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
60
83
  context.contextTimestamp = USER_STATE.interactionTimestamp;
@@ -81,13 +104,15 @@ var index_default = {
81
104
  afterLoaded,
82
105
  afterRetrieve,
83
106
  onUserInteraction,
84
- beforeDisplay
107
+ beforeDisplay,
108
+ ai
85
109
  };
86
110
  // Annotate the CommonJS export names for ESM import in node:
87
111
  0 && (module.exports = {
88
112
  afterLoaded,
89
113
  afterRetrieve,
90
114
  afterSave,
115
+ ai,
91
116
  beforeDisplay,
92
117
  beforeSave,
93
118
  hookMap,
package/dist/index.d.cts CHANGED
@@ -1,14 +1,15 @@
1
+ import * as _tailor_cms_cek_common from '@tailor-cms/cek-common';
2
+ import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
1
3
  import * as _tailor_cms_ce_jodit_html_manifest from '@tailor-cms/ce-jodit-html-manifest';
2
4
  import { Element } from '@tailor-cms/ce-jodit-html-manifest';
3
- export { initState, type } from '@tailor-cms/ce-jodit-html-manifest';
4
- import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
5
+ export { ai, initState, type } from '@tailor-cms/ce-jodit-html-manifest';
5
6
 
6
- declare function beforeSave(element: Element, services: HookServices): Element;
7
- declare function afterSave(element: Element, services: HookServices): Element;
8
- declare function afterLoaded(element: Element, services: HookServices, runtime: ServerRuntime): Element;
9
- declare function afterRetrieve(element: Element, services: HookServices, runtime: ServerRuntime): Element;
10
- declare function beforeDisplay(element: Element, context: any): any;
11
- declare function onUserInteraction(element: Element, context: any, payload: any): any;
7
+ declare function beforeSave(element: Element, _services: HookServices): Element;
8
+ declare function afterSave(element: Element, _services: HookServices): Element;
9
+ declare function afterLoaded(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
10
+ declare function afterRetrieve(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
11
+ declare function beforeDisplay(_element: Element, context: any): any;
12
+ declare function onUserInteraction(_element: Element, context: any, payload: any): any;
12
13
  declare const hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
13
14
  declare const _default: {
14
15
  type: string;
@@ -20,6 +21,11 @@ declare const _default: {
20
21
  afterRetrieve: typeof afterRetrieve;
21
22
  onUserInteraction: typeof onUserInteraction;
22
23
  beforeDisplay: typeof beforeDisplay;
24
+ ai: {
25
+ Schema: _tailor_cms_cek_common.OpenAISchema;
26
+ getPrompt: () => string;
27
+ processResponse: (val: any) => any;
28
+ };
23
29
  };
24
30
 
25
31
  export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
+ import * as _tailor_cms_cek_common from '@tailor-cms/cek-common';
2
+ import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
1
3
  import * as _tailor_cms_ce_jodit_html_manifest from '@tailor-cms/ce-jodit-html-manifest';
2
4
  import { Element } from '@tailor-cms/ce-jodit-html-manifest';
3
- export { initState, type } from '@tailor-cms/ce-jodit-html-manifest';
4
- import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
5
+ export { ai, initState, type } from '@tailor-cms/ce-jodit-html-manifest';
5
6
 
6
- declare function beforeSave(element: Element, services: HookServices): Element;
7
- declare function afterSave(element: Element, services: HookServices): Element;
8
- declare function afterLoaded(element: Element, services: HookServices, runtime: ServerRuntime): Element;
9
- declare function afterRetrieve(element: Element, services: HookServices, runtime: ServerRuntime): Element;
10
- declare function beforeDisplay(element: Element, context: any): any;
11
- declare function onUserInteraction(element: Element, context: any, payload: any): any;
7
+ declare function beforeSave(element: Element, _services: HookServices): Element;
8
+ declare function afterSave(element: Element, _services: HookServices): Element;
9
+ declare function afterLoaded(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
10
+ declare function afterRetrieve(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
11
+ declare function beforeDisplay(_element: Element, context: any): any;
12
+ declare function onUserInteraction(_element: Element, context: any, payload: any): any;
12
13
  declare const hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
13
14
  declare const _default: {
14
15
  type: string;
@@ -20,6 +21,11 @@ declare const _default: {
20
21
  afterRetrieve: typeof afterRetrieve;
21
22
  onUserInteraction: typeof onUserInteraction;
22
23
  beforeDisplay: typeof beforeDisplay;
24
+ ai: {
25
+ Schema: _tailor_cms_cek_common.OpenAISchema;
26
+ getPrompt: () => string;
27
+ processResponse: (val: any) => any;
28
+ };
23
29
  };
24
30
 
25
31
  export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
package/dist/index.js CHANGED
@@ -1,26 +1,48 @@
1
1
  // ../manifest/dist/index.js
2
2
  var type = "JODIT_HTML";
3
3
  var initState = () => ({ content: "" });
4
+ var ai = {
5
+ Schema: {
6
+ type: "json_schema",
7
+ name: "ce_jodit_html",
8
+ schema: {
9
+ type: "object",
10
+ properties: {
11
+ content: { type: "string" }
12
+ },
13
+ required: ["content"],
14
+ additionalProperties: false
15
+ }
16
+ },
17
+ getPrompt: () => `
18
+ Generate rich text for a page as an object with the following
19
+ properties: { "content": "" }
20
+ where:
21
+ - 'content' is the text of the page in HTML format. Include only the text
22
+ content, without the full HTML page structure.
23
+ `,
24
+ processResponse: (val) => val
25
+ };
4
26
 
5
27
  // src/index.ts
6
28
  var IS_CEK = process.env.CEK_RUNTIME;
7
29
  var USER_STATE = {};
8
- function beforeSave(element, services) {
30
+ function beforeSave(element, _services) {
9
31
  return element;
10
32
  }
11
- function afterSave(element, services) {
33
+ function afterSave(element, _services) {
12
34
  return element;
13
35
  }
14
- function afterLoaded(element, services, runtime) {
36
+ function afterLoaded(element, _services, _runtime) {
15
37
  return element;
16
38
  }
17
- function afterRetrieve(element, services, runtime) {
39
+ function afterRetrieve(element, _services, _runtime) {
18
40
  return element;
19
41
  }
20
- function beforeDisplay(element, context) {
42
+ function beforeDisplay(_element, context) {
21
43
  return { ...context, ...USER_STATE };
22
44
  }
23
- function onUserInteraction(element, context, payload) {
45
+ function onUserInteraction(_element, context, payload) {
24
46
  if (IS_CEK) {
25
47
  USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
26
48
  context.contextTimestamp = USER_STATE.interactionTimestamp;
@@ -47,12 +69,14 @@ var index_default = {
47
69
  afterLoaded,
48
70
  afterRetrieve,
49
71
  onUserInteraction,
50
- beforeDisplay
72
+ beforeDisplay,
73
+ ai
51
74
  };
52
75
  export {
53
76
  afterLoaded,
54
77
  afterRetrieve,
55
78
  afterSave,
79
+ ai,
56
80
  beforeDisplay,
57
81
  beforeSave,
58
82
  index_default as default,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Tailor CMS Jodit HTML editor server component",
4
4
  "author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
5
5
  "type": "module",
6
- "version": "0.0.8",
6
+ "version": "0.1.0",
7
7
  "exports": {
8
8
  ".": {
9
9
  "import": "./dist/index.js",
@@ -16,11 +16,11 @@
16
16
  "dist"
17
17
  ],
18
18
  "devDependencies": {
19
- "@tailor-cms/cek-common": "^0.0.4",
20
- "@tailor-cms/eslint-config": "0.0.2",
21
- "tsup": "^8.3.6",
22
- "typescript": "^5.7.3",
23
- "@tailor-cms/ce-jodit-html-manifest": "0.0.8"
19
+ "@tailor-cms/cek-common": "^1.3.2",
20
+ "@tailor-cms/eslint-config": "1.1.2",
21
+ "tsup": "^8.5.0",
22
+ "typescript": "^5.8.3",
23
+ "@tailor-cms/ce-jodit-html-manifest": "0.1.0"
24
24
  },
25
25
  "tsup": {
26
26
  "entry": [
@@ -44,8 +44,11 @@
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "tsup --watch src --watch ../manifest/dist",
47
- "build": "tsup",
48
- "lint": "eslint --ext .js,.ts .",
49
- "lint:fix": "pnpm lint --fix"
47
+ "build": "pnpm nuke:dist && tsup",
48
+ "lint": "eslint .",
49
+ "lint:fix": "pnpm lint --fix",
50
+ "nuke": "pnpm dlx del-cli dist node_modules",
51
+ "nuke:dist": "pnpm dlx del-cli dist",
52
+ "prepublish": "pnpm build"
50
53
  }
51
54
  }