@bernierllc/content-management-suite 0.4.2 → 0.7.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.d.mts +9 -1291
- package/dist/index.d.ts +9 -1291
- package/dist/index.js +1144 -831
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1134 -818
- package/dist/index.mjs.map +1 -1
- package/dist/prisma.d.mts +26 -0
- package/dist/prisma.d.ts +26 -0
- package/dist/prisma.js +35 -0
- package/dist/prisma.js.map +1 -0
- package/dist/prisma.mjs +10 -0
- package/dist/prisma.mjs.map +1 -0
- package/dist/types-DQpwJ5e3.d.ts +1234 -0
- package/dist/ui.d.mts +1 -0
- package/dist/ui.d.ts +1 -0
- package/dist/ui.js +37 -0
- package/dist/ui.js.map +1 -0
- package/dist/ui.mjs +14 -0
- package/dist/ui.mjs.map +1 -0
- package/dist/utils.d.mts +9 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +117 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +88 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +40 -22
- package/dist/server.d.mts +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -1102
- package/dist/server.js.map +0 -1
- package/dist/server.mjs +0 -1089
- package/dist/server.mjs.map +0 -1
package/dist/ui.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StageActionButtons, WorkflowAdminConfig, WorkflowStepper, WorkflowTimeline } from '@bernierllc/content-workflow-ui';
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StageActionButtons, WorkflowAdminConfig, WorkflowStepper, WorkflowTimeline } from '@bernierllc/content-workflow-ui';
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ui.ts
|
|
21
|
+
var ui_exports = {};
|
|
22
|
+
__export(ui_exports, {
|
|
23
|
+
StageActionButtons: () => import_content_workflow_ui.StageActionButtons,
|
|
24
|
+
WorkflowAdminConfig: () => import_content_workflow_ui.WorkflowAdminConfig,
|
|
25
|
+
WorkflowStepper: () => import_content_workflow_ui.WorkflowStepper,
|
|
26
|
+
WorkflowTimeline: () => import_content_workflow_ui.WorkflowTimeline
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(ui_exports);
|
|
29
|
+
var import_content_workflow_ui = require("@bernierllc/content-workflow-ui");
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
StageActionButtons,
|
|
33
|
+
WorkflowAdminConfig,
|
|
34
|
+
WorkflowStepper,
|
|
35
|
+
WorkflowTimeline
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=ui.js.map
|
package/dist/ui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nexport {\n WorkflowStepper,\n StageActionButtons,\n WorkflowTimeline,\n WorkflowAdminConfig,\n} from '@bernierllc/content-workflow-ui';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,iCAKO;","names":[]}
|
package/dist/ui.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/ui.ts
|
|
2
|
+
import {
|
|
3
|
+
WorkflowStepper,
|
|
4
|
+
StageActionButtons,
|
|
5
|
+
WorkflowTimeline,
|
|
6
|
+
WorkflowAdminConfig
|
|
7
|
+
} from "@bernierllc/content-workflow-ui";
|
|
8
|
+
export {
|
|
9
|
+
StageActionButtons,
|
|
10
|
+
WorkflowAdminConfig,
|
|
11
|
+
WorkflowStepper,
|
|
12
|
+
WorkflowTimeline
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=ui.mjs.map
|
package/dist/ui.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nexport {\n WorkflowStepper,\n StageActionButtons,\n WorkflowTimeline,\n WorkflowAdminConfig,\n} from '@bernierllc/content-workflow-ui';\n"],"mappings":";AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function getSecurityHeaders(): Record<string, string>;
|
|
2
|
+
declare function getCorsConfig(origins?: string[]): {
|
|
3
|
+
allowedOrigins: string[];
|
|
4
|
+
allowedMethods: string[];
|
|
5
|
+
allowedHeaders: string[];
|
|
6
|
+
};
|
|
7
|
+
declare function errorToHttpStatus(error: Error): number;
|
|
8
|
+
|
|
9
|
+
export { errorToHttpStatus, getCorsConfig, getSecurityHeaders };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function getSecurityHeaders(): Record<string, string>;
|
|
2
|
+
declare function getCorsConfig(origins?: string[]): {
|
|
3
|
+
allowedOrigins: string[];
|
|
4
|
+
allowedMethods: string[];
|
|
5
|
+
allowedHeaders: string[];
|
|
6
|
+
};
|
|
7
|
+
declare function errorToHttpStatus(error: Error): number;
|
|
8
|
+
|
|
9
|
+
export { errorToHttpStatus, getCorsConfig, getSecurityHeaders };
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils.ts
|
|
21
|
+
var utils_exports = {};
|
|
22
|
+
__export(utils_exports, {
|
|
23
|
+
errorToHttpStatus: () => errorToHttpStatus,
|
|
24
|
+
getCorsConfig: () => getCorsConfig,
|
|
25
|
+
getSecurityHeaders: () => getSecurityHeaders
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(utils_exports);
|
|
28
|
+
|
|
29
|
+
// src/errors.ts
|
|
30
|
+
var ContentManagementError = class extends Error {
|
|
31
|
+
constructor(message, options) {
|
|
32
|
+
super(message);
|
|
33
|
+
if (options?.cause !== void 0) {
|
|
34
|
+
this.cause = options.cause;
|
|
35
|
+
}
|
|
36
|
+
this.name = this.constructor.name;
|
|
37
|
+
this.code = options?.code ?? "CONTENT_MANAGEMENT_ERROR";
|
|
38
|
+
if (options?.details !== void 0) {
|
|
39
|
+
this.details = options.details;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var ValidationError = class extends ContentManagementError {
|
|
44
|
+
constructor(message, options) {
|
|
45
|
+
super(message, { ...options, code: "VALIDATION_ERROR" });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var NotFoundError = class extends ContentManagementError {
|
|
49
|
+
constructor(message, options) {
|
|
50
|
+
super(message, { ...options, code: "NOT_FOUND" });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var UnauthorizedError = class extends ContentManagementError {
|
|
54
|
+
constructor(message, options) {
|
|
55
|
+
super(message, { ...options, code: "UNAUTHORIZED" });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var ForbiddenError = class extends ContentManagementError {
|
|
59
|
+
constructor(message, options) {
|
|
60
|
+
super(message, { ...options, code: "FORBIDDEN" });
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var ConflictError = class extends ContentManagementError {
|
|
64
|
+
constructor(message, options) {
|
|
65
|
+
super(message, { ...options, code: "CONFLICT" });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var InternalError = class extends ContentManagementError {
|
|
69
|
+
constructor(message, options) {
|
|
70
|
+
super(message, { ...options, code: "INTERNAL_ERROR" });
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/utils.ts
|
|
75
|
+
function getSecurityHeaders() {
|
|
76
|
+
return {
|
|
77
|
+
"X-Content-Type-Options": "nosniff",
|
|
78
|
+
"X-Frame-Options": "DENY",
|
|
79
|
+
"X-XSS-Protection": "1; mode=block",
|
|
80
|
+
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
|
81
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
82
|
+
"Content-Security-Policy": "default-src 'self'",
|
|
83
|
+
"X-Permitted-Cross-Domain-Policies": "none",
|
|
84
|
+
"X-Download-Options": "noopen"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function getCorsConfig(origins) {
|
|
88
|
+
return {
|
|
89
|
+
allowedOrigins: origins ?? ["*"],
|
|
90
|
+
allowedMethods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
|
91
|
+
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function errorToHttpStatus(error) {
|
|
95
|
+
if (error instanceof ValidationError)
|
|
96
|
+
return 400;
|
|
97
|
+
if (error instanceof UnauthorizedError)
|
|
98
|
+
return 401;
|
|
99
|
+
if (error instanceof ForbiddenError)
|
|
100
|
+
return 403;
|
|
101
|
+
if (error instanceof NotFoundError)
|
|
102
|
+
return 404;
|
|
103
|
+
if (error instanceof ConflictError)
|
|
104
|
+
return 409;
|
|
105
|
+
if (error instanceof InternalError)
|
|
106
|
+
return 500;
|
|
107
|
+
if (error instanceof ContentManagementError)
|
|
108
|
+
return 500;
|
|
109
|
+
return 500;
|
|
110
|
+
}
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
errorToHttpStatus,
|
|
114
|
+
getCorsConfig,
|
|
115
|
+
getSecurityHeaders
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts","../src/errors.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport {\n ContentManagementError,\n ValidationError,\n NotFoundError,\n UnauthorizedError,\n ForbiddenError,\n ConflictError,\n InternalError,\n} from './errors';\n\nexport function getSecurityHeaders(): Record<string, string> {\n return {\n 'X-Content-Type-Options': 'nosniff',\n 'X-Frame-Options': 'DENY',\n 'X-XSS-Protection': '1; mode=block',\n 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',\n 'Referrer-Policy': 'strict-origin-when-cross-origin',\n 'Content-Security-Policy': \"default-src 'self'\",\n 'X-Permitted-Cross-Domain-Policies': 'none',\n 'X-Download-Options': 'noopen',\n };\n}\n\nexport function getCorsConfig(origins?: string[]): {\n allowedOrigins: string[];\n allowedMethods: string[];\n allowedHeaders: string[];\n} {\n return {\n allowedOrigins: origins ?? ['*'],\n allowedMethods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],\n };\n}\n\nexport function errorToHttpStatus(error: Error): number {\n if (error instanceof ValidationError) return 400;\n if (error instanceof UnauthorizedError) return 401;\n if (error instanceof ForbiddenError) return 403;\n if (error instanceof NotFoundError) return 404;\n if (error instanceof ConflictError) return 409;\n if (error instanceof InternalError) return 500;\n if (error instanceof ContentManagementError) return 500;\n return 500;\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nexport class ContentManagementError extends Error {\n readonly code: string;\n readonly details?: Record<string, unknown>;\n\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n details?: Record<string, unknown>;\n }) {\n super(message);\n // Attach cause manually (ES2022 feature; tsconfig targets ES2020 so we set it post-construction)\n if (options?.cause !== undefined) {\n (this as unknown as { cause: Error }).cause = options.cause;\n }\n this.name = this.constructor.name;\n this.code = options?.code ?? 'CONTENT_MANAGEMENT_ERROR';\n if (options?.details !== undefined) {\n this.details = options.details;\n }\n }\n}\n\nexport class ValidationError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'VALIDATION_ERROR' });\n }\n}\n\nexport class NotFoundError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'NOT_FOUND' });\n }\n}\n\nexport class UnauthorizedError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'UNAUTHORIZED' });\n }\n}\n\nexport class ForbiddenError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'FORBIDDEN' });\n }\n}\n\nexport class ConflictError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'CONFLICT' });\n }\n}\n\nexport class InternalError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'INTERNAL_ERROR' });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAIhD,YAAY,SAAiB,SAI1B;AACD,UAAM,OAAO;AAEb,QAAI,SAAS,UAAU,QAAW;AAChC,MAAC,KAAqC,QAAQ,QAAQ;AAAA,IACxD;AACA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AACA,SAAO;AAAA,IACL,gBAAgB,WAAW,CAAC,GAAG;AAAA,IAC/B,gBAAgB,CAAC,OAAO,QAAQ,OAAO,UAAU,SAAS,SAAS;AAAA,IACnE,gBAAgB,CAAC,gBAAgB,iBAAiB,kBAAkB;AAAA,EACtE;AACF;AAEO,SAAS,kBAAkB,OAAsB;AACtD,MAAI,iBAAiB;AAAiB,WAAO;AAC7C,MAAI,iBAAiB;AAAmB,WAAO;AAC/C,MAAI,iBAAiB;AAAgB,WAAO;AAC5C,MAAI,iBAAiB;AAAe,WAAO;AAC3C,MAAI,iBAAiB;AAAe,WAAO;AAC3C,MAAI,iBAAiB;AAAe,WAAO;AAC3C,MAAI,iBAAiB;AAAwB,WAAO;AACpD,SAAO;AACT;","names":[]}
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// src/errors.ts
|
|
2
|
+
var ContentManagementError = class extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message);
|
|
5
|
+
if (options?.cause !== void 0) {
|
|
6
|
+
this.cause = options.cause;
|
|
7
|
+
}
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
this.code = options?.code ?? "CONTENT_MANAGEMENT_ERROR";
|
|
10
|
+
if (options?.details !== void 0) {
|
|
11
|
+
this.details = options.details;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var ValidationError = class extends ContentManagementError {
|
|
16
|
+
constructor(message, options) {
|
|
17
|
+
super(message, { ...options, code: "VALIDATION_ERROR" });
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var NotFoundError = class extends ContentManagementError {
|
|
21
|
+
constructor(message, options) {
|
|
22
|
+
super(message, { ...options, code: "NOT_FOUND" });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var UnauthorizedError = class extends ContentManagementError {
|
|
26
|
+
constructor(message, options) {
|
|
27
|
+
super(message, { ...options, code: "UNAUTHORIZED" });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var ForbiddenError = class extends ContentManagementError {
|
|
31
|
+
constructor(message, options) {
|
|
32
|
+
super(message, { ...options, code: "FORBIDDEN" });
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var ConflictError = class extends ContentManagementError {
|
|
36
|
+
constructor(message, options) {
|
|
37
|
+
super(message, { ...options, code: "CONFLICT" });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var InternalError = class extends ContentManagementError {
|
|
41
|
+
constructor(message, options) {
|
|
42
|
+
super(message, { ...options, code: "INTERNAL_ERROR" });
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/utils.ts
|
|
47
|
+
function getSecurityHeaders() {
|
|
48
|
+
return {
|
|
49
|
+
"X-Content-Type-Options": "nosniff",
|
|
50
|
+
"X-Frame-Options": "DENY",
|
|
51
|
+
"X-XSS-Protection": "1; mode=block",
|
|
52
|
+
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
|
|
53
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
|
54
|
+
"Content-Security-Policy": "default-src 'self'",
|
|
55
|
+
"X-Permitted-Cross-Domain-Policies": "none",
|
|
56
|
+
"X-Download-Options": "noopen"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function getCorsConfig(origins) {
|
|
60
|
+
return {
|
|
61
|
+
allowedOrigins: origins ?? ["*"],
|
|
62
|
+
allowedMethods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
|
|
63
|
+
allowedHeaders: ["Content-Type", "Authorization", "X-Requested-With"]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function errorToHttpStatus(error) {
|
|
67
|
+
if (error instanceof ValidationError)
|
|
68
|
+
return 400;
|
|
69
|
+
if (error instanceof UnauthorizedError)
|
|
70
|
+
return 401;
|
|
71
|
+
if (error instanceof ForbiddenError)
|
|
72
|
+
return 403;
|
|
73
|
+
if (error instanceof NotFoundError)
|
|
74
|
+
return 404;
|
|
75
|
+
if (error instanceof ConflictError)
|
|
76
|
+
return 409;
|
|
77
|
+
if (error instanceof InternalError)
|
|
78
|
+
return 500;
|
|
79
|
+
if (error instanceof ContentManagementError)
|
|
80
|
+
return 500;
|
|
81
|
+
return 500;
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
errorToHttpStatus,
|
|
85
|
+
getCorsConfig,
|
|
86
|
+
getSecurityHeaders
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/utils.ts"],"sourcesContent":["/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nexport class ContentManagementError extends Error {\n readonly code: string;\n readonly details?: Record<string, unknown>;\n\n constructor(message: string, options?: {\n cause?: Error;\n code?: string;\n details?: Record<string, unknown>;\n }) {\n super(message);\n // Attach cause manually (ES2022 feature; tsconfig targets ES2020 so we set it post-construction)\n if (options?.cause !== undefined) {\n (this as unknown as { cause: Error }).cause = options.cause;\n }\n this.name = this.constructor.name;\n this.code = options?.code ?? 'CONTENT_MANAGEMENT_ERROR';\n if (options?.details !== undefined) {\n this.details = options.details;\n }\n }\n}\n\nexport class ValidationError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'VALIDATION_ERROR' });\n }\n}\n\nexport class NotFoundError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'NOT_FOUND' });\n }\n}\n\nexport class UnauthorizedError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'UNAUTHORIZED' });\n }\n}\n\nexport class ForbiddenError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'FORBIDDEN' });\n }\n}\n\nexport class ConflictError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'CONFLICT' });\n }\n}\n\nexport class InternalError extends ContentManagementError {\n constructor(message: string, options?: { cause?: Error; details?: Record<string, unknown> }) {\n super(message, { ...options, code: 'INTERNAL_ERROR' });\n }\n}\n","/*\nCopyright (c) 2025 Bernier LLC\n\nThis file is licensed to the client under a limited-use license.\nThe client may use and modify this code *only within the scope of the project it was delivered for*.\nRedistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.\n*/\n\nimport {\n ContentManagementError,\n ValidationError,\n NotFoundError,\n UnauthorizedError,\n ForbiddenError,\n ConflictError,\n InternalError,\n} from './errors';\n\nexport function getSecurityHeaders(): Record<string, string> {\n return {\n 'X-Content-Type-Options': 'nosniff',\n 'X-Frame-Options': 'DENY',\n 'X-XSS-Protection': '1; mode=block',\n 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',\n 'Referrer-Policy': 'strict-origin-when-cross-origin',\n 'Content-Security-Policy': \"default-src 'self'\",\n 'X-Permitted-Cross-Domain-Policies': 'none',\n 'X-Download-Options': 'noopen',\n };\n}\n\nexport function getCorsConfig(origins?: string[]): {\n allowedOrigins: string[];\n allowedMethods: string[];\n allowedHeaders: string[];\n} {\n return {\n allowedOrigins: origins ?? ['*'],\n allowedMethods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],\n };\n}\n\nexport function errorToHttpStatus(error: Error): number {\n if (error instanceof ValidationError) return 400;\n if (error instanceof UnauthorizedError) return 401;\n if (error instanceof ForbiddenError) return 403;\n if (error instanceof NotFoundError) return 404;\n if (error instanceof ConflictError) return 409;\n if (error instanceof InternalError) return 500;\n if (error instanceof Cont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0BAA0B;AAAA,IAC1B,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,6BAA6B;AAAA,IAC7B,mBAAmB;AAAA,IACnB,2BAA2B;AAAA,IAC3B,qCAAqC;AAAA,IACrC,sBAAsB;AAAA,EACxB;AACF;AAEO,SAAS,cAAc,SAI5B;AACA,SAAO;AAAA,IACL,gBAAgB,WAAW,CAAC,GAAG;AAAA,IAC/B,gBAAgB,CAAC,OAAO,QAAQ,OAAO,UAAU,SAAS,SAAS;AAAA,IACnE,gBAAgB,CAAC,gBAAgB,iBAAiB,kBAAkB;AAAA,EACtE;AACF;AAEO,SAAS,kBAAkB,OAAsB;AACtD,MAAI,iBAAiB;AAAiB,WAAO;AAC7C,MAAI,iBAAiB;AAAmB,WAAO;AAC/C,MAAI,iBAAiB;AAAgB,WAAO;AAC5C,MAAI,iBAAiB;AAAe,WAAO;AAC3C,MAAI,iBAAiB;AAAe,WAAO;AAC3C,MAAI,iBAAiB;AAAe,WAAO;AAC3C,MAAI,iBAAiB;AAAwB,WAAO;AACpD,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bernierllc/content-management-suite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Comprehensive content management suite with editorial workflows, content types, and admin UI",
|
|
5
|
-
"main": "dist/index.
|
|
6
|
-
"module": "dist/index.
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./utils": {
|
|
15
|
+
"import": "./dist/utils.mjs",
|
|
16
|
+
"require": "./dist/utils.cjs",
|
|
17
|
+
"types": "./dist/utils.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./ui": {
|
|
20
|
+
"import": "./dist/ui.mjs",
|
|
21
|
+
"require": "./dist/ui.cjs",
|
|
22
|
+
"types": "./dist/ui.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./prisma": {
|
|
25
|
+
"import": "./dist/prisma.mjs",
|
|
26
|
+
"require": "./dist/prisma.cjs",
|
|
27
|
+
"types": "./dist/prisma.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
8
30
|
"files": [
|
|
9
31
|
"dist"
|
|
10
32
|
],
|
|
@@ -22,37 +44,35 @@
|
|
|
22
44
|
"author": "Bernier LLC",
|
|
23
45
|
"license": "UNLICENSED",
|
|
24
46
|
"dependencies": {
|
|
25
|
-
"compression": "^1.7.4",
|
|
26
|
-
"cors": "^2.8.5",
|
|
27
|
-
"dotenv": "^16.3.0",
|
|
28
|
-
"express": "^4.18.0",
|
|
29
|
-
"helmet": "^7.0.0",
|
|
30
|
-
"morgan": "^1.10.0",
|
|
31
|
-
"uuid": "^9.0.0",
|
|
32
47
|
"zod": "^3.22.0",
|
|
33
48
|
"@bernierllc/content-soft-delete": "1.2.2",
|
|
34
|
-
"@bernierllc/content-editorial-workflow": "0.1.6",
|
|
35
49
|
"@bernierllc/content-type-audio": "1.2.2",
|
|
50
|
+
"@bernierllc/content-editorial-workflow": "0.1.6",
|
|
36
51
|
"@bernierllc/content-type-image": "1.2.2",
|
|
37
52
|
"@bernierllc/content-type-registry": "1.3.2",
|
|
38
|
-
"@bernierllc/content-autosave-manager": "1.2.2",
|
|
39
53
|
"@bernierllc/content-type-text": "1.2.2",
|
|
54
|
+
"@bernierllc/content-autosave-manager": "1.2.2",
|
|
40
55
|
"@bernierllc/content-type-video": "1.2.2",
|
|
41
56
|
"@bernierllc/content-workflow-ui": "0.1.7"
|
|
42
57
|
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"react": ">=18.0.0",
|
|
60
|
+
"react-dom": ">=18.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"react": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"react-dom": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
43
70
|
"devDependencies": {
|
|
44
|
-
"@types/compression": "^1.7.0",
|
|
45
|
-
"@types/cors": "^2.8.0",
|
|
46
|
-
"@types/express": "^4.17.0",
|
|
47
71
|
"@types/jest": "^29.5.0",
|
|
48
|
-
"@types/morgan": "^1.9.0",
|
|
49
|
-
"@types/supertest": "^6.0.0",
|
|
50
|
-
"@types/uuid": "^9.0.0",
|
|
51
72
|
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
52
73
|
"@typescript-eslint/parser": "^6.0.0",
|
|
53
74
|
"eslint": "^8.0.0",
|
|
54
75
|
"jest": "^29.5.0",
|
|
55
|
-
"supertest": "^7.0.0",
|
|
56
76
|
"ts-jest": "^29.1.0",
|
|
57
77
|
"tsup": "^7.0.0",
|
|
58
78
|
"tsx": "^4.0.0",
|
|
@@ -73,8 +93,6 @@
|
|
|
73
93
|
"test:playwright": "playwright test",
|
|
74
94
|
"lint": "eslint src --ext .ts,.tsx",
|
|
75
95
|
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
76
|
-
"type-check": "tsc --noEmit"
|
|
77
|
-
"start": "node dist/index.js",
|
|
78
|
-
"start:dev": "tsx src/index.ts"
|
|
96
|
+
"type-check": "tsc --noEmit"
|
|
79
97
|
}
|
|
80
98
|
}
|
package/dist/server.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
package/dist/server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|