@yimingliao/cms 0.0.163 → 0.0.165

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.
@@ -0,0 +1 @@
1
+ export { createObjectStorageService } from '../../../src/server/infrastructure/storage/object-storage/object-storage.service.js';
@@ -26,7 +26,7 @@ function HtmlDisplay({
26
26
  }
27
27
  function normalizeHtmlText(html) {
28
28
  if (!html) return "";
29
- return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, "").replace(/\r?\n|\r/g, " ").replace(/\s{2,}/g, " ").trim();
29
+ return html.replace(/<\/(p|div|li|h[1-6]|tr|td)>/gi, " ").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\r?\n|\r/g, " ").replace(/\s{2,}/g, " ").trim();
30
30
  }
31
31
 
32
32
  export { HtmlDisplay };
@@ -1,8 +1,8 @@
1
1
  import { CopyObjectCommand, DeleteObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3';
2
2
  import { createObjectKey } from '../utils.js';
3
3
 
4
- function createR2Service({
5
- r2Client,
4
+ function createObjectStorageService({
5
+ client,
6
6
  bucketName,
7
7
  logger
8
8
  }) {
@@ -17,7 +17,7 @@ function createR2Service({
17
17
  });
18
18
  try {
19
19
  const buffer = Buffer.from(await blobFile.arrayBuffer());
20
- await r2Client.send(
20
+ await client.send(
21
21
  new PutObjectCommand({
22
22
  Bucket: bucketName,
23
23
  Key: key,
@@ -25,44 +25,44 @@ function createR2Service({
25
25
  ContentType: blobFile.type || void 0
26
26
  })
27
27
  );
28
- logger.debug("R2 upload success", { key });
28
+ logger.debug("Upload success", { key });
29
29
  return key;
30
30
  } catch (error) {
31
- logger.error("R2 upload failed", { key, error });
31
+ logger.error("Upload failed", { key, error });
32
32
  throw error;
33
33
  }
34
34
  }
35
35
  async function remove({ key }) {
36
36
  try {
37
- await r2Client.send(
37
+ await client.send(
38
38
  new DeleteObjectCommand({
39
39
  Bucket: bucketName,
40
40
  Key: key
41
41
  })
42
42
  );
43
- logger.debug("R2 object removed", { key });
43
+ logger.debug("Object removed", { key });
44
44
  } catch (error) {
45
- logger.error("R2 remove failed", { key, error });
45
+ logger.error("Remove failed", { key, error });
46
46
  throw error;
47
47
  }
48
48
  }
49
49
  async function move({ fromKey, toKey }) {
50
50
  if (fromKey === toKey) {
51
- logger.debug("R2 move skipped (same key)", { key: fromKey });
51
+ logger.debug("Move skipped (same key)", { key: fromKey });
52
52
  return;
53
53
  }
54
54
  try {
55
- await r2Client.send(
55
+ await client.send(
56
56
  new CopyObjectCommand({
57
57
  Bucket: bucketName,
58
- CopySource: encodeURI(`${bucketName}/${fromKey}`),
58
+ CopySource: `${bucketName}/${encodeURIComponent(fromKey)}`,
59
59
  Key: toKey
60
60
  })
61
61
  );
62
62
  await remove({ key: fromKey });
63
- logger.debug("R2 object moved", { fromKey, toKey });
63
+ logger.debug("Object moved", { fromKey, toKey });
64
64
  } catch (error) {
65
- logger.error("R2 move failed", { fromKey, toKey, error });
65
+ logger.error("Move failed", { fromKey, toKey, error });
66
66
  throw error;
67
67
  }
68
68
  }
@@ -73,4 +73,4 @@ function createR2Service({
73
73
  };
74
74
  }
75
75
 
76
- export { createR2Service };
76
+ export { createObjectStorageService };
@@ -0,0 +1,2 @@
1
+ export { createObjectStorageService, } from "../../../src/server/infrastructure/storage/object-storage";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../export/server/object-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,0BAA0B,GAC3B,MAAM,2DAA2D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createObjectStorageService } from "./object-storage.service";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/object-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { StorageService } from "../types";
2
+ import type { S3Client } from "@aws-sdk/client-s3";
3
+ import type { Logger } from "logry";
4
+ interface CreateObjectStorageServiceParams {
5
+ client: S3Client;
6
+ bucketName: string;
7
+ logger: Logger;
8
+ }
9
+ export declare function createObjectStorageService({ client, bucketName, logger, }: CreateObjectStorageServiceParams): StorageService;
10
+ export {};
11
+ //# sourceMappingURL=object-storage.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-storage.service.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/object-storage/object-storage.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAQpC,UAAU,gCAAgC;IACxC,MAAM,EAAE,QAAQ,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,UAAU,EACV,MAAM,GACP,EAAE,gCAAgC,GAAG,cAAc,CA0FnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.163",
3
+ "version": "0.0.165",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,7 +28,6 @@
28
28
  "types": "./dist/types/export/client/components/editor/index.d.ts",
29
29
  "import": "./dist/export/client/components/editor/index.js"
30
30
  },
31
- "./client/components/editor/css": "./dist/src/client/interfaces/components/ui/inputs/editor/editor.css",
32
31
  "./client/pages": {
33
32
  "types": "./dist/types/export/client/pages/index.d.ts",
34
33
  "import": "./dist/export/client/pages/index.js"
@@ -41,9 +40,9 @@
41
40
  "types": "./dist/types/export/server/index.d.ts",
42
41
  "import": "./dist/export/server/index.js"
43
42
  },
44
- "./server/r2": {
45
- "types": "./dist/types/export/server/r2/index.d.ts",
46
- "import": "./dist/export/server/r2/index.js"
43
+ "./server/object-storage": {
44
+ "types": "./dist/types/export/server/object-storage/index.d.ts",
45
+ "import": "./dist/export/server/object-storage/index.js"
47
46
  },
48
47
  "./server/sftp": {
49
48
  "types": "./dist/types/export/server/sftp/index.d.ts",
@@ -125,7 +124,6 @@
125
124
  "prisma": "6.5.0",
126
125
  "react": "^19.2.4",
127
126
  "rollup": "^4.59.0",
128
- "rollup-plugin-copy": "^3.5.0",
129
127
  "rollup-plugin-esbuild": "^6.2.1",
130
128
  "tsc-alias": "^1.8.16",
131
129
  "typescript": "^5.9.3",
@@ -1 +0,0 @@
1
- export { createR2Service } from '../../../src/server/infrastructure/storage/r2/r2.service.js';
@@ -1,172 +0,0 @@
1
- @import "ckeditor5/ckeditor5-editor.css";
2
-
3
- /*============================================================
4
- | Basic
5
- ============================================================*/
6
- .ck-editor {
7
- min-width: 100% !important;
8
- }
9
- .ck-powered-by-balloon,
10
- .ck-powered-by {
11
- display: none !important;
12
- }
13
-
14
- /*====== Editable Area & Source Editing Area ======*/
15
- .ck-editor__main > .ck-editor__editable,
16
- .ck-editor__main > .ck-source-editing-area,
17
- .ck-editor__main > .ck-source-editing-area > textarea {
18
- min-height: calc(var(--spacing) * 64) !important;
19
- border-bottom-right-radius: var(--radius-lg) !important;
20
- border-bottom-left-radius: var(--radius-lg) !important;
21
- background-color: var(--color-background) !important;
22
- color: var(--color-primary) !important;
23
- border-style: none !important;
24
- }
25
-
26
- /*====== Nested Editable (Table, Image Widget) ======*/
27
- .ck-editor__nested-editable {
28
- border-color: var(--color-ring) !important;
29
- min-height: calc(var(--spacing) * 0) !important;
30
- overflow-x: hidden !important;
31
- border-radius: 0 !important;
32
- }
33
-
34
- /*====== Table ======*/
35
- .ck-insert-table-dropdown-grid-box {
36
- border-color: var(--color-ring) !important;
37
- }
38
-
39
- /*====== Sticky Panel (Toolbar) ======*/
40
- .ck-sticky-panel__content {
41
- border-color: transparent !important;
42
- border-bottom-width: 1px !important;
43
- border-bottom-color: var(--color-border) !important;
44
- }
45
- .ck-rounded-corners .ck.ck-toolbar,
46
- .ck.ck-toolbar.ck-rounded-corners {
47
- border-radius: var(--radius-lg);
48
- }
49
-
50
- /*====== Hide Duplicated Editor (In dev mode) ======*/
51
- .ck-editor + .ck-editor {
52
- display: none !important;
53
- }
54
-
55
- /*====== Word Count Display ======*/
56
- .ck .word-count-display {
57
- border-style: none !important;
58
- }
59
- .ck .word-count-display-html {
60
- margin-left: auto;
61
- }
62
-
63
- /*============================================================
64
- | CKEditor Interface Variables
65
- ============================================================*/
66
- :root {
67
- /*====== color ======*/
68
- --ck-content-font-color: currentColor;
69
- /*====== border-radius ======*/
70
- --ck-border-radius: 4px;
71
- /*====== font-size-base ======*/
72
- --ck-font-size-base: 13px;
73
-
74
- /*====== custom color variables ======*/
75
- --ck-custom-background: var(--color-background);
76
- --ck-custom-foreground: var(--color-primary);
77
- --ck-custom-secondary: var(--color-secondary);
78
- --ck-custom-border: var(--color-ring);
79
- --ck-custom-white: hsl(0, 0%, 100%);
80
-
81
- /*====== generic colors ======*/
82
- --ck-color-base-background: var(--ck-custom-foreground);
83
- --ck-color-base-foreground: var(--ck-custom-background);
84
- --ck-color-focus-border: var(--ck-custom-border);
85
- --ck-color-text: var(--ck-custom-foreground);
86
- --ck-color-shadow-drop: hsla(0, 0%, 0%, 0.2);
87
- --ck-color-shadow-inner: hsla(0, 0%, 0%, 0.1);
88
- --ck-color-base-border: transparent;
89
-
90
- /*====== [.ck-toolbar] toolbar ======*/
91
- --ck-color-toolbar-background: var(--ck-custom-background);
92
- --ck-color-toolbar-border: var(--ck-custom-border);
93
-
94
- /*====== [.ck-tooltip] tooltip ======*/
95
- --ck-color-tooltip-background: hsl(252, 7%, 30%);
96
- --ck-color-tooltip-text: var(--ck-custom-white);
97
-
98
- /*====== [.ck-button] button-default ======*/
99
- --ck-color-button-default-background: var(--ck-custom-background);
100
- --ck-color-button-default-hover-background: var(--ck-custom-secondary);
101
- --ck-color-button-default-active-background: none;
102
- --ck-color-button-default-active-shadow: hsl(270, 2%, 23%);
103
- --ck-color-button-default-disabled-background: var(--ck-custom-background);
104
-
105
- /*====== [.ck-button] button-on ======*/
106
- --ck-color-button-on-color: var(--color-success); /* Active text */
107
- --ck-color-button-on-background: var(--ck-custom-secondary);
108
- --ck-color-button-on-hover-background: var(--ck-custom-secondary);
109
- --ck-color-button-on-active-background: var(--ck-custom-secondary);
110
- --ck-color-button-on-active-shadow: hsl(240, 3%, 19%);
111
- --ck-color-button-on-disabled-background: var(--ck-custom-secondary);
112
-
113
- /*====== [.ck-button] button-action ======*/
114
- --ck-color-button-action-background: hsl(168, 76%, 42%);
115
- --ck-color-button-action-hover-background: hsl(168, 76%, 38%);
116
- --ck-color-button-action-active-background: hsl(168, 76%, 36%);
117
- --ck-color-button-action-active-shadow: hsl(168, 75%, 34%);
118
- --ck-color-button-action-disabled-background: hsl(168, 76%, 42%);
119
- --ck-color-button-action-text: var(--ck-custom-white);
120
-
121
- /*====== [.ck-button] button-save, button-cancel ======*/
122
- --ck-color-button-save: var(--color-success);
123
- --ck-color-button-cancel: var(--color-error);
124
-
125
- /*====== [.ck-dropdown] dropdown ======*/
126
- --ck-color-dropdown-panel-background: var(--ck-custom-background);
127
- --ck-color-dropdown-panel-border: var(--ck-custom-border);
128
-
129
- /*====== [.ck-dialog] dialog ======*/
130
- --ck-color-dialog-background: var(--ck-custom-background);
131
- --ck-color-dialog-form-header-border: var(--ck-custom-border);
132
-
133
- /*====== [.ck-splitbutton] split-button ======*/
134
- --ck-color-split-button-hover-background: var(
135
- --ck-color-button-default-hover-background
136
- );
137
- --ck-color-split-button-hover-border: var(--ck-custom-border);
138
-
139
- /*====== [.ck-input] input ======*/
140
- --ck-color-input-background: var(--ck-custom-background);
141
- --ck-color-input-border: hsl(257, 3%, 43%);
142
- --ck-color-input-text: hsl(0, 0%, 98%);
143
- --ck-color-input-disabled-background: hsl(255, 4%, 21%);
144
- --ck-color-input-disabled-border: hsl(250, 3%, 38%);
145
- --ck-color-input-disabled-text: hsl(0, 0%, 78%);
146
-
147
- /*====== [.ck-labeled-field-view] labeled-field ======*/
148
- --ck-color-labeled-field-label-background: var(--ck-custom-background);
149
-
150
- /*====== [.ck-list] list ======*/
151
- --ck-color-list-background: var(--ck-custom-background);
152
- --ck-color-list-button-hover-background: var(--ck-color-base-foreground);
153
- --ck-color-list-button-on-background: var(--ck-color-base-active);
154
- --ck-color-list-button-on-background-focus: var(--ck-color-base-active-focus);
155
- --ck-color-list-button-on-text: var(--ck-color-base-background);
156
-
157
- /*====== [.ck-balloon-panel] panel ======*/
158
- --ck-color-panel-background: var(--ck-custom-background);
159
- --ck-color-panel-border: var(--ck-custom-border);
160
-
161
- /*====== [ckeditor5-image] image ======*/
162
- /* --ck-color-image-caption-background: hsl(0, 0%, 97%);
163
- --ck-color-image-caption-text: hsl(0, 0%, 20%); */
164
-
165
- /*====== [ ckeditor5-widget] widget ======*/
166
- --ck-color-widget-blurred-border: hsl(0, 0%, 87%);
167
- --ck-color-widget-hover-border: hsl(43, 100%, 68%);
168
- --ck-color-widget-editable-focus-background: var(--ck-custom-white);
169
-
170
- /*====== [ckeditor5-link] link ======*/
171
- --ck-color-link-default: var(--color-info);
172
- }
@@ -1,2 +0,0 @@
1
- export { createR2Service, } from "../../../src/server/infrastructure/storage/r2";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../export/server/r2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,eAAe,GAChB,MAAM,+CAA+C,CAAC"}
@@ -1,2 +0,0 @@
1
- export { createR2Service } from "./r2.service";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/r2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { StorageService } from "../types";
2
- import type { S3Client } from "@aws-sdk/client-s3";
3
- import type { Logger } from "logry";
4
- interface CreateR2ServiceParams {
5
- r2Client: S3Client;
6
- bucketName: string;
7
- logger: Logger;
8
- }
9
- export declare function createR2Service({ r2Client, bucketName, logger, }: CreateR2ServiceParams): StorageService;
10
- export {};
11
- //# sourceMappingURL=r2.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"r2.service.d.ts","sourceRoot":"","sources":["../../../../../../../src/server/infrastructure/storage/r2/r2.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAQpC,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,MAAM,GACP,EAAE,qBAAqB,GAAG,cAAc,CA0FxC"}