@bernierllc/content-management-suite 0.10.0 → 2.0.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 CHANGED
@@ -1,5 +1,5 @@
1
- import { a as ContentManagementSuiteOptions, b as ContentManagementSuite, C as ContentStorageAdapter } from './types-DQpwJ5e3.js';
2
- export { ai as AIConfiguration, o as AIEnhanceService, af as AINamespace, ah as AIReview, l as AIReviewService, m as AIReviewServiceResult, A as AIReviewStorageNamespace, H as AIReviewSuggestion, n as AISocialGeneratorService, k as AnalyticsStorageNamespace, ab as ConfigNamespace, f as ConflictError, O as ContentFilters, J as ContentItem, d as ContentManagementConfig, c as ContentManagementConfigSchema, e as ContentManagementError, a4 as ContentManagementLogger, a6 as ContentNamespace, s as ContentPublishResult, r as ContentPublisher, u as ContentSource, g as ContentStorageNamespace, B as ContentTypeDefinition, T as ContentTypeInfo, h as ContentTypeStorageNamespace, a7 as ContentTypesNamespace, K as CreateContentInput, a1 as CreateUserInput, _ as CreateWorkflowInput, E as EnhanceOptions, p as EnhancedContent, F as ForbiddenError, v as IngestResult, I as InternalError, M as MediaStorageNamespace, N as NotFoundError, R as PaginatedResult, aa as PermissionsNamespace, z as PlatformInfo, x as PlatformPublishResult, ac as PluginsNamespace, t as PreviewResult, P as PublishResult, ad as PublishersNamespace, j as ScheduleStorageNamespace, D as SchemaValidationResult, Q as SearchOptions, y as SocialMetrics, ag as SocialNamespace, w as SocialPlatformAdapter, ak as SocialPost, S as SocialPostStorageNamespace, ae as SourcesNamespace, G as StageConditions, i as StoredContentTypeDefinition, q as Suggestion, a5 as SuiteEventMap, a3 as SuitePlugin, U as UnauthorizedError, L as UpdateContentInput, a2 as UpdateUserInput, $ as UpdateWorkflowInput, a0 as User, a9 as UsersNamespace, V as ValidationError, X as Workflow, aj as WorkflowConfiguration, Y as WorkflowStage, W as WorkflowStorageNamespace, Z as WorkflowTransition, a8 as WorkflowsNamespace } from './types-DQpwJ5e3.js';
1
+ import { a as ContentManagementSuiteOptions, b as ContentManagementSuite, C as ContentStorageAdapter } from './types-DQNP3lLP.js';
2
+ export { ai as AIConfiguration, o as AIEnhanceService, af as AINamespace, ah as AIReview, l as AIReviewService, m as AIReviewServiceResult, A as AIReviewStorageNamespace, H as AIReviewSuggestion, n as AISocialGeneratorService, k as AnalyticsStorageNamespace, ab as ConfigNamespace, f as ConflictError, O as ContentFilters, J as ContentItem, d as ContentManagementConfig, c as ContentManagementConfigSchema, e as ContentManagementError, a4 as ContentManagementLogger, a6 as ContentNamespace, s as ContentPublishResult, r as ContentPublisher, u as ContentSource, g as ContentStorageNamespace, B as ContentTypeDefinition, T as ContentTypeInfo, h as ContentTypeStorageNamespace, a7 as ContentTypesNamespace, K as CreateContentInput, a1 as CreateUserInput, _ as CreateWorkflowInput, E as EnhanceOptions, p as EnhancedContent, F as ForbiddenError, v as IngestResult, I as InternalError, M as MediaStorageNamespace, N as NotFoundError, R as PaginatedResult, aa as PermissionsNamespace, z as PlatformInfo, x as PlatformPublishResult, ac as PluginsNamespace, t as PreviewResult, P as PublishResult, ad as PublishersNamespace, j as ScheduleStorageNamespace, D as SchemaValidationResult, Q as SearchOptions, y as SocialMetrics, ag as SocialNamespace, w as SocialPlatformAdapter, ak as SocialPost, S as SocialPostStorageNamespace, ae as SourcesNamespace, G as StageConditions, i as StoredContentTypeDefinition, q as Suggestion, a5 as SuiteEventMap, a3 as SuitePlugin, U as UnauthorizedError, L as UpdateContentInput, a2 as UpdateUserInput, $ as UpdateWorkflowInput, a0 as User, a9 as UsersNamespace, V as ValidationError, X as Workflow, aj as WorkflowConfiguration, Y as WorkflowStage, W as WorkflowStorageNamespace, Z as WorkflowTransition, a8 as WorkflowsNamespace } from './types-DQNP3lLP.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as ContentManagementSuiteOptions, b as ContentManagementSuite, C as ContentStorageAdapter } from './types-DQpwJ5e3.js';
2
- export { ai as AIConfiguration, o as AIEnhanceService, af as AINamespace, ah as AIReview, l as AIReviewService, m as AIReviewServiceResult, A as AIReviewStorageNamespace, H as AIReviewSuggestion, n as AISocialGeneratorService, k as AnalyticsStorageNamespace, ab as ConfigNamespace, f as ConflictError, O as ContentFilters, J as ContentItem, d as ContentManagementConfig, c as ContentManagementConfigSchema, e as ContentManagementError, a4 as ContentManagementLogger, a6 as ContentNamespace, s as ContentPublishResult, r as ContentPublisher, u as ContentSource, g as ContentStorageNamespace, B as ContentTypeDefinition, T as ContentTypeInfo, h as ContentTypeStorageNamespace, a7 as ContentTypesNamespace, K as CreateContentInput, a1 as CreateUserInput, _ as CreateWorkflowInput, E as EnhanceOptions, p as EnhancedContent, F as ForbiddenError, v as IngestResult, I as InternalError, M as MediaStorageNamespace, N as NotFoundError, R as PaginatedResult, aa as PermissionsNamespace, z as PlatformInfo, x as PlatformPublishResult, ac as PluginsNamespace, t as PreviewResult, P as PublishResult, ad as PublishersNamespace, j as ScheduleStorageNamespace, D as SchemaValidationResult, Q as SearchOptions, y as SocialMetrics, ag as SocialNamespace, w as SocialPlatformAdapter, ak as SocialPost, S as SocialPostStorageNamespace, ae as SourcesNamespace, G as StageConditions, i as StoredContentTypeDefinition, q as Suggestion, a5 as SuiteEventMap, a3 as SuitePlugin, U as UnauthorizedError, L as UpdateContentInput, a2 as UpdateUserInput, $ as UpdateWorkflowInput, a0 as User, a9 as UsersNamespace, V as ValidationError, X as Workflow, aj as WorkflowConfiguration, Y as WorkflowStage, W as WorkflowStorageNamespace, Z as WorkflowTransition, a8 as WorkflowsNamespace } from './types-DQpwJ5e3.js';
1
+ import { a as ContentManagementSuiteOptions, b as ContentManagementSuite, C as ContentStorageAdapter } from './types-DQNP3lLP.js';
2
+ export { ai as AIConfiguration, o as AIEnhanceService, af as AINamespace, ah as AIReview, l as AIReviewService, m as AIReviewServiceResult, A as AIReviewStorageNamespace, H as AIReviewSuggestion, n as AISocialGeneratorService, k as AnalyticsStorageNamespace, ab as ConfigNamespace, f as ConflictError, O as ContentFilters, J as ContentItem, d as ContentManagementConfig, c as ContentManagementConfigSchema, e as ContentManagementError, a4 as ContentManagementLogger, a6 as ContentNamespace, s as ContentPublishResult, r as ContentPublisher, u as ContentSource, g as ContentStorageNamespace, B as ContentTypeDefinition, T as ContentTypeInfo, h as ContentTypeStorageNamespace, a7 as ContentTypesNamespace, K as CreateContentInput, a1 as CreateUserInput, _ as CreateWorkflowInput, E as EnhanceOptions, p as EnhancedContent, F as ForbiddenError, v as IngestResult, I as InternalError, M as MediaStorageNamespace, N as NotFoundError, R as PaginatedResult, aa as PermissionsNamespace, z as PlatformInfo, x as PlatformPublishResult, ac as PluginsNamespace, t as PreviewResult, P as PublishResult, ad as PublishersNamespace, j as ScheduleStorageNamespace, D as SchemaValidationResult, Q as SearchOptions, y as SocialMetrics, ag as SocialNamespace, w as SocialPlatformAdapter, ak as SocialPost, S as SocialPostStorageNamespace, ae as SourcesNamespace, G as StageConditions, i as StoredContentTypeDefinition, q as Suggestion, a5 as SuiteEventMap, a3 as SuitePlugin, U as UnauthorizedError, L as UpdateContentInput, a2 as UpdateUserInput, $ as UpdateWorkflowInput, a0 as User, a9 as UsersNamespace, V as ValidationError, X as Workflow, aj as WorkflowConfiguration, Y as WorkflowStage, W as WorkflowStorageNamespace, Z as WorkflowTransition, a8 as WorkflowsNamespace } from './types-DQNP3lLP.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/index.js CHANGED
@@ -172,16 +172,16 @@ var ContentManagementConfigSchema = import_zod.z.object({
172
172
 
173
173
  // src/errors.ts
174
174
  var ContentManagementError = class extends Error {
175
+ code;
176
+ context;
175
177
  constructor(message, options) {
176
- super(message);
177
- if (options?.cause !== void 0) {
178
- this.cause = options.cause;
179
- }
178
+ super(message, options?.cause ? { cause: options.cause } : void 0);
180
179
  this.name = this.constructor.name;
181
180
  this.code = options?.code ?? "CONTENT_MANAGEMENT_ERROR";
182
- if (options?.details !== void 0) {
183
- this.details = options.details;
181
+ if (options?.context !== void 0) {
182
+ this.context = options.context;
184
183
  }
184
+ Error.captureStackTrace?.(this, this.constructor);
185
185
  }
186
186
  };
187
187
  var ValidationError = class extends ContentManagementError {
@@ -217,9 +217,7 @@ var InternalError = class extends ContentManagementError {
217
217
 
218
218
  // src/in-memory-adapter.ts
219
219
  var InMemoryContentStorage = class {
220
- constructor() {
221
- this.store = /* @__PURE__ */ new Map();
222
- }
220
+ store = /* @__PURE__ */ new Map();
223
221
  async list(filters) {
224
222
  let items = Array.from(this.store.values());
225
223
  if (filters?.type) {
@@ -287,10 +285,8 @@ var InMemoryContentStorage = class {
287
285
  }
288
286
  };
289
287
  var InMemoryWorkflowStorage = class {
290
- constructor() {
291
- this.store = /* @__PURE__ */ new Map();
292
- this.contentTypeMap = /* @__PURE__ */ new Map();
293
- }
288
+ store = /* @__PURE__ */ new Map();
289
+ contentTypeMap = /* @__PURE__ */ new Map();
294
290
  // contentType -> workflowId
295
291
  async list() {
296
292
  return Array.from(this.store.values());
@@ -331,9 +327,7 @@ var InMemoryWorkflowStorage = class {
331
327
  }
332
328
  };
333
329
  var InMemoryContentTypeStorage = class {
334
- constructor() {
335
- this.store = /* @__PURE__ */ new Map();
336
- }
330
+ store = /* @__PURE__ */ new Map();
337
331
  async list() {
338
332
  return Array.from(this.store.values());
339
333
  }
@@ -358,9 +352,7 @@ var InMemoryContentTypeStorage = class {
358
352
  }
359
353
  };
360
354
  var InMemorySocialPostStorage = class {
361
- constructor() {
362
- this.store = /* @__PURE__ */ new Map();
363
- }
355
+ store = /* @__PURE__ */ new Map();
364
356
  async list(filters) {
365
357
  let items = Array.from(this.store.values());
366
358
  if (filters?.contentId) {
@@ -398,9 +390,7 @@ var InMemorySocialPostStorage = class {
398
390
  }
399
391
  };
400
392
  var InMemoryAIReviewStorage = class {
401
- constructor() {
402
- this.store = /* @__PURE__ */ new Map();
403
- }
393
+ store = /* @__PURE__ */ new Map();
404
394
  async list(filters) {
405
395
  let items = Array.from(this.store.values());
406
396
  if (filters?.contentId) {
@@ -440,6 +430,10 @@ function createInMemoryAdapter() {
440
430
  // src/namespaces/content.ts
441
431
  var crypto = __toESM(require("crypto"));
442
432
  var ContentNamespaceImpl = class {
433
+ emitter;
434
+ storage;
435
+ getContentTypes;
436
+ getPublishers;
443
437
  constructor(emitter, storage, getContentTypes, getPublishers) {
444
438
  this.emitter = emitter;
445
439
  this.storage = storage;
@@ -458,7 +452,7 @@ var ContentNamespaceImpl = class {
458
452
  const result = contentTypes.validate(input.type, dataToValidate);
459
453
  if (!result.valid) {
460
454
  throw new ValidationError("Content type schema validation failed", {
461
- details: { errors: result.errors }
455
+ context: { errors: result.errors }
462
456
  });
463
457
  }
464
458
  }
@@ -529,7 +523,7 @@ var ContentNamespaceImpl = class {
529
523
  throw new ValidationError(
530
524
  `Content is not at a publish-eligible stage. Current stage: "${existing.workflowStage ?? "none"}", required publish stage: "${publishStage.id}"`,
531
525
  {
532
- details: {
526
+ context: {
533
527
  currentStage: existing.workflowStage ?? null,
534
528
  requiredStage: publishStage.id
535
529
  }
@@ -621,9 +615,7 @@ var ContentNamespaceImpl = class {
621
615
  // src/namespaces/content-types.ts
622
616
  var import_zod2 = require("zod");
623
617
  var ContentTypesNamespaceImpl = class {
624
- constructor() {
625
- this.store = /* @__PURE__ */ new Map();
626
- }
618
+ store = /* @__PURE__ */ new Map();
627
619
  register(definition) {
628
620
  if ("schema" in definition && definition.schema) {
629
621
  const def = definition;
@@ -683,8 +675,9 @@ var ContentTypesNamespaceImpl = class {
683
675
  // src/namespaces/workflows.ts
684
676
  var crypto2 = __toESM(require("crypto"));
685
677
  var WorkflowsNamespaceImpl = class {
678
+ cache = /* @__PURE__ */ new Map();
679
+ storage;
686
680
  constructor(storage) {
687
- this.cache = /* @__PURE__ */ new Map();
688
681
  this.storage = storage;
689
682
  }
690
683
  /** Load workflows from storage into cache. Called during suite initialization. */
@@ -749,7 +742,7 @@ var WorkflowsNamespaceImpl = class {
749
742
  if (assignedContent.length > 0) {
750
743
  throw new ConflictError(
751
744
  `Cannot delete workflow "${id}": ${assignedContent.length} content item(s) are assigned to it. Reassign or archive them first.`,
752
- { details: { assignedCount: assignedContent.length } }
745
+ { context: { assignedCount: assignedContent.length } }
753
746
  );
754
747
  }
755
748
  await this.storage.workflows.delete(id);
@@ -761,8 +754,9 @@ var WorkflowsNamespaceImpl = class {
761
754
  // src/namespaces/users.ts
762
755
  var crypto3 = __toESM(require("crypto"));
763
756
  var UsersNamespaceImpl = class {
757
+ store = /* @__PURE__ */ new Map();
758
+ emitter;
764
759
  constructor(emitter) {
765
- this.store = /* @__PURE__ */ new Map();
766
760
  this.emitter = emitter;
767
761
  }
768
762
  async create(input) {
@@ -811,9 +805,7 @@ var UsersNamespaceImpl = class {
811
805
  }
812
806
  };
813
807
  var PermissionsNamespaceImpl = class {
814
- constructor() {
815
- this.store = /* @__PURE__ */ new Map();
816
- }
808
+ store = /* @__PURE__ */ new Map();
817
809
  async check(userId, permission) {
818
810
  const perms = this.store.get(userId);
819
811
  return perms?.has(permission) ?? false;
@@ -852,6 +844,8 @@ function deepMerge(target, source) {
852
844
  return result;
853
845
  }
854
846
  var ConfigNamespaceImpl = class {
847
+ config;
848
+ emitter;
855
849
  constructor(initialConfig, emitter) {
856
850
  this.config = initialConfig;
857
851
  this.emitter = emitter;
@@ -876,8 +870,9 @@ var ConfigNamespaceImpl = class {
876
870
 
877
871
  // src/namespaces/plugins.ts
878
872
  var PluginsNamespaceImpl = class {
873
+ store = /* @__PURE__ */ new Map();
874
+ suite;
879
875
  constructor(suite) {
880
- this.store = /* @__PURE__ */ new Map();
881
876
  this.suite = suite;
882
877
  }
883
878
  async register(plugin) {
@@ -901,11 +896,9 @@ var PluginsNamespaceImpl = class {
901
896
 
902
897
  // src/namespaces/publishers.ts
903
898
  var WebsitePublisher = class {
904
- constructor() {
905
- this.id = "website";
906
- this.name = "Website";
907
- this.acceptedTypes = ["blog-post", "article", "page", "generic", "text"];
908
- }
899
+ id = "website";
900
+ name = "Website";
901
+ acceptedTypes = ["blog-post", "article", "page", "generic", "text"];
909
902
  async publish(content) {
910
903
  const slug = content.title ? content.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") : content.id;
911
904
  return {
@@ -916,11 +909,9 @@ var WebsitePublisher = class {
916
909
  }
917
910
  };
918
911
  var RSSPublisher = class {
919
- constructor() {
920
- this.id = "rss";
921
- this.name = "RSS Feed";
922
- this.acceptedTypes = ["blog-post", "article", "rss-article", "generic", "text"];
923
- }
912
+ id = "rss";
913
+ name = "RSS Feed";
914
+ acceptedTypes = ["blog-post", "article", "rss-article", "generic", "text"];
924
915
  async publish(content) {
925
916
  return {
926
917
  channelId: this.id,
@@ -930,8 +921,9 @@ var RSSPublisher = class {
930
921
  }
931
922
  };
932
923
  var PublishersNamespaceImpl = class {
924
+ store = /* @__PURE__ */ new Map();
925
+ emitter;
933
926
  constructor(emitter) {
934
- this.store = /* @__PURE__ */ new Map();
935
927
  this.emitter = emitter;
936
928
  this.store.set("website", new WebsitePublisher());
937
929
  this.store.set("rss", new RSSPublisher());
@@ -957,8 +949,11 @@ var PublishersNamespaceImpl = class {
957
949
  // src/namespaces/sources.ts
958
950
  var crypto4 = __toESM(require("crypto"));
959
951
  var SourcesNamespaceImpl = class {
952
+ store = /* @__PURE__ */ new Map();
953
+ emitter;
954
+ storage;
955
+ workflowDefaults;
960
956
  constructor(emitter, storage, workflowDefaults) {
961
- this.store = /* @__PURE__ */ new Map();
962
957
  this.emitter = emitter;
963
958
  this.storage = storage;
964
959
  this.workflowDefaults = workflowDefaults;
@@ -988,7 +983,7 @@ var SourcesNamespaceImpl = class {
988
983
  const validationErrors = await source.validate(rawPayload);
989
984
  if (validationErrors.length > 0) {
990
985
  throw new ValidationError("Source validation failed", {
991
- details: { errors: validationErrors }
986
+ context: { errors: validationErrors }
992
987
  });
993
988
  }
994
989
  }
@@ -1024,6 +1019,12 @@ var SourcesNamespaceImpl = class {
1024
1019
  // src/namespaces/ai.ts
1025
1020
  var crypto5 = __toESM(require("crypto"));
1026
1021
  var AINamespaceImpl = class {
1022
+ emitter;
1023
+ storage;
1024
+ reviewService;
1025
+ socialGeneratorService;
1026
+ enhanceService;
1027
+ workflowDefaults;
1027
1028
  constructor(emitter, storage, options) {
1028
1029
  this.emitter = emitter;
1029
1030
  this.storage = storage;
@@ -1117,8 +1118,10 @@ var AINamespaceImpl = class {
1117
1118
 
1118
1119
  // src/namespaces/social.ts
1119
1120
  var SocialNamespaceImpl = class {
1121
+ store = /* @__PURE__ */ new Map();
1122
+ emitter;
1123
+ storage;
1120
1124
  constructor(emitter, storage) {
1121
- this.store = /* @__PURE__ */ new Map();
1122
1125
  this.emitter = emitter;
1123
1126
  this.storage = storage;
1124
1127
  }
@@ -1145,7 +1148,7 @@ var SocialNamespaceImpl = class {
1145
1148
  if (missing.length > 0) {
1146
1149
  throw new ValidationError(
1147
1150
  `Unregistered social platform(s): ${missing.join(", ")}`,
1148
- { details: { missingPlatforms: missing } }
1151
+ { context: { missingPlatforms: missing } }
1149
1152
  );
1150
1153
  }
1151
1154
  const content = await this.storage.content.get(contentId);
@@ -1161,7 +1164,7 @@ var SocialNamespaceImpl = class {
1161
1164
  throw new ValidationError(
1162
1165
  `Content is not at a publish-eligible stage. Current stage: "${content.workflowStage ?? "none"}", required publish stage: "${publishStage.id}"`,
1163
1166
  {
1164
- details: {
1167
+ context: {
1165
1168
  currentStage: content.workflowStage ?? null,
1166
1169
  requiredStage: publishStage.id
1167
1170
  }
@@ -1252,9 +1255,23 @@ var SocialNamespaceImpl = class {
1252
1255
 
1253
1256
  // src/content-management-suite.ts
1254
1257
  var ContentManagementSuiteImpl = class extends import_events.EventEmitter {
1258
+ content;
1259
+ contentTypes;
1260
+ workflows;
1261
+ users;
1262
+ permissions;
1263
+ config;
1264
+ plugins;
1265
+ publishers;
1266
+ sources;
1267
+ ai;
1268
+ social;
1269
+ _logger;
1270
+ _options;
1271
+ _storage;
1272
+ _initialized = false;
1255
1273
  constructor(options) {
1256
1274
  super();
1257
- this._initialized = false;
1258
1275
  this._options = options ?? {};
1259
1276
  this._logger = this._options.logger;
1260
1277
  this._storage = this._options.storage ?? createInMemoryAdapter();