@notty/types 0.7.1 → 1.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.cjs CHANGED
@@ -20,12 +20,127 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ACTIVITY_ACTION_CATEGORY: () => ACTIVITY_ACTION_CATEGORY,
24
+ ACTIVITY_EXCLUDED_ACTIONS: () => ACTIVITY_EXCLUDED_ACTIONS,
25
+ ACTIVITY_FEED_ACTIONS: () => ACTIVITY_FEED_ACTIONS,
26
+ COMPLIANCE_SCOPES: () => COMPLIANCE_SCOPES,
27
+ DATA_CLASSIFICATIONS: () => DATA_CLASSIFICATIONS,
28
+ DEFAULT_AI_GUARDRAILS: () => DEFAULT_AI_GUARDRAILS,
29
+ DEFAULT_AUTOMATION_THRESHOLDS: () => DEFAULT_AUTOMATION_THRESHOLDS,
30
+ DEFAULT_WORKFLOW: () => DEFAULT_WORKFLOW,
31
+ EXTENSION_PRECEDENCE: () => EXTENSION_PRECEDENCE,
32
+ GovernanceViolationError: () => GovernanceViolationError,
33
+ LEGAL_HOLD_KINDS: () => LEGAL_HOLD_KINDS,
34
+ RESERVED_EXTENSION_PLUGIN_NAMES: () => RESERVED_EXTENSION_PLUGIN_NAMES,
23
35
  SchemaValidationError: () => SchemaValidationError,
36
+ TRANSLATION_STATUSES: () => TRANSLATION_STATUSES,
37
+ classifyPluginSource: () => classifyPluginSource,
38
+ defineAdminMiddleware: () => defineAdminMiddleware,
39
+ defineContentMiddleware: () => defineContentMiddleware,
40
+ definePlugin: () => definePlugin,
41
+ definePluginFactory: () => definePluginFactory,
42
+ defineSystemMiddleware: () => defineSystemMiddleware,
43
+ defineTheme: () => defineTheme,
44
+ exampleBlockComponent: () => exampleBlockComponent,
45
+ exampleComponentSchema: () => exampleComponentSchema,
24
46
  exampleSchema: () => exampleSchema
25
47
  });
26
48
  module.exports = __toCommonJS(index_exports);
27
49
 
50
+ // src/plugin.ts
51
+ function definePlugin(definition) {
52
+ return definition;
53
+ }
54
+ function definePluginFactory(factory) {
55
+ return factory;
56
+ }
57
+
58
+ // src/plugin-extensions.ts
59
+ var RESERVED_EXTENSION_PLUGIN_NAMES = {
60
+ core: "@notty/core",
61
+ appLocal: "@notty/app-local"
62
+ };
63
+ var EXTENSION_PRECEDENCE = {
64
+ core: 0,
65
+ plugin: 1,
66
+ "app-local": 2
67
+ };
68
+ function classifyPluginSource(pluginName, hints) {
69
+ if (hints?.declaredSource) return hints.declaredSource;
70
+ if (pluginName === RESERVED_EXTENSION_PLUGIN_NAMES.core) return "core";
71
+ if (pluginName === RESERVED_EXTENSION_PLUGIN_NAMES.appLocal) return "app-local";
72
+ return "plugin";
73
+ }
74
+
75
+ // src/theme.ts
76
+ function defineTheme(definition) {
77
+ return definition;
78
+ }
79
+
28
80
  // src/notty-schema.ts
81
+ var exampleComponentSchema = {
82
+ uid: "shared.seo-meta",
83
+ category: "shared",
84
+ info: {
85
+ displayName: "SEO Meta",
86
+ description: "SEO metadata for pages",
87
+ icon: "mdi:search-web"
88
+ },
89
+ attributes: {
90
+ metaTitle: {
91
+ type: "string",
92
+ maxLength: 60
93
+ },
94
+ metaDescription: {
95
+ type: "text",
96
+ maxLength: 160
97
+ },
98
+ keywords: {
99
+ type: "string",
100
+ maxLength: 255
101
+ },
102
+ canonicalUrl: {
103
+ type: "string",
104
+ maxLength: 500
105
+ },
106
+ ogImage: {
107
+ type: "media",
108
+ allowedTypes: ["images"],
109
+ multiple: false
110
+ }
111
+ }
112
+ };
113
+ var exampleBlockComponent = {
114
+ uid: "blocks.hero-section",
115
+ category: "blocks",
116
+ info: {
117
+ displayName: "Hero Section",
118
+ description: "Hero banner with title and CTA",
119
+ icon: "mdi:view-dashboard"
120
+ },
121
+ attributes: {
122
+ title: {
123
+ type: "string",
124
+ required: true,
125
+ maxLength: 100
126
+ },
127
+ subtitle: {
128
+ type: "text"
129
+ },
130
+ backgroundImage: {
131
+ type: "media",
132
+ allowedTypes: ["images"]
133
+ },
134
+ ctaText: {
135
+ type: "string",
136
+ maxLength: 50
137
+ },
138
+ ctaLink: {
139
+ type: "string",
140
+ maxLength: 500
141
+ }
142
+ }
143
+ };
29
144
  var exampleSchema = {
30
145
  kind: "collectionType",
31
146
  info: {
@@ -72,13 +187,30 @@ var exampleSchema = {
72
187
  type: "media",
73
188
  allowedTypes: ["images"],
74
189
  multiple: false
75
- // single image
76
190
  },
77
191
  gallery: {
78
192
  type: "media",
79
193
  allowedTypes: ["images", "videos"],
80
194
  multiple: true
81
- // multiple media
195
+ },
196
+ // Component field example - single SEO meta
197
+ seo: {
198
+ type: "component",
199
+ component: "shared.seo-meta",
200
+ repeatable: false
201
+ },
202
+ // Component field example - repeatable FAQ items
203
+ faq: {
204
+ type: "component",
205
+ component: "shared.faq-item",
206
+ repeatable: true,
207
+ min: 0,
208
+ max: 20
209
+ },
210
+ // Dynamic zone example - page builder blocks
211
+ blocks: {
212
+ type: "dynamicZone",
213
+ components: ["blocks.hero-section", "blocks.rich-text", "blocks.gallery", "blocks.cta"]
82
214
  }
83
215
  }
84
216
  };
@@ -91,8 +223,204 @@ var SchemaValidationError = class extends Error {
91
223
  this.name = "SchemaValidationError";
92
224
  }
93
225
  };
226
+
227
+ // src/middleware.ts
228
+ function defineAdminMiddleware(definition) {
229
+ return {
230
+ _type: "admin",
231
+ order: 100,
232
+ enabled: true,
233
+ ...definition
234
+ };
235
+ }
236
+ function defineContentMiddleware(definition) {
237
+ return {
238
+ _type: "content",
239
+ order: 100,
240
+ enabled: true,
241
+ ...definition
242
+ };
243
+ }
244
+ function defineSystemMiddleware(definition) {
245
+ return {
246
+ _type: "system",
247
+ order: 100,
248
+ enabled: true,
249
+ ...definition
250
+ };
251
+ }
252
+
253
+ // src/activity.ts
254
+ var ACTIVITY_ACTION_CATEGORY = {
255
+ "content.create": "content",
256
+ "content.update": "content",
257
+ "content.delete": "content",
258
+ "content.publish": "content",
259
+ "content.unpublish": "content",
260
+ "content.bulk_update": "content",
261
+ "content.bulk_delete": "content",
262
+ "schema.create": "schema",
263
+ "schema.update": "schema",
264
+ "schema.delete": "schema",
265
+ "media.upload": "media",
266
+ "media.update": "media",
267
+ "media.delete": "media",
268
+ "settings.update": "settings",
269
+ "admin.login": "auth",
270
+ "admin.logout": "auth",
271
+ "auth.login": "auth",
272
+ "auth.logout": "auth",
273
+ "auth.register": "auth",
274
+ "comment.create": "collaboration",
275
+ "comment.update": "collaboration",
276
+ "comment.delete": "collaboration",
277
+ "comment.resolve": "collaboration",
278
+ "comment.reopen": "collaboration",
279
+ "assignment.create": "collaboration",
280
+ "assignment.update": "collaboration",
281
+ "assignment.complete": "collaboration",
282
+ "assignment.cancel": "collaboration"
283
+ };
284
+ var ACTIVITY_EXCLUDED_ACTIONS = [
285
+ "auth.token_refresh",
286
+ "admin.token_refresh",
287
+ "auth.login_failed",
288
+ "admin.login_failed",
289
+ "auth.password_reset",
290
+ "policy.denied"
291
+ ];
292
+ var ACTIVITY_FEED_ACTIONS = [
293
+ "content.create",
294
+ "content.update",
295
+ "content.delete",
296
+ "content.publish",
297
+ "content.unpublish",
298
+ "content.bulk_update",
299
+ "content.bulk_delete",
300
+ "schema.create",
301
+ "schema.update",
302
+ "schema.delete",
303
+ "media.upload",
304
+ "media.update",
305
+ "media.delete",
306
+ "settings.update",
307
+ "admin.login",
308
+ "admin.logout",
309
+ "auth.login",
310
+ "auth.logout",
311
+ "auth.register",
312
+ "comment.create",
313
+ "comment.update",
314
+ "comment.delete",
315
+ "comment.resolve",
316
+ "comment.reopen",
317
+ "assignment.create",
318
+ "assignment.update",
319
+ "assignment.complete",
320
+ "assignment.cancel"
321
+ ];
322
+
323
+ // src/workflow.ts
324
+ var DEFAULT_WORKFLOW = {
325
+ enabled: true,
326
+ initialState: "draft",
327
+ states: [
328
+ { name: "draft", label: "Draft", color: "#6b7280" },
329
+ { name: "review", label: "In Review", color: "#f59e0b" },
330
+ { name: "approved", label: "Approved", color: "#3b82f6" },
331
+ { name: "published", label: "Published", color: "#10b981", publishable: true }
332
+ ],
333
+ transitions: [
334
+ { from: "draft", to: "review", label: "Submit for Review" },
335
+ { from: "review", to: "draft", label: "Return to Draft" },
336
+ { from: "review", to: "approved", label: "Approve", roles: ["super-admin", "admin", "editor"] },
337
+ { from: "approved", to: "published", label: "Publish", roles: ["super-admin", "admin"] },
338
+ { from: "published", to: "draft", label: "Unpublish" },
339
+ { from: "approved", to: "draft", label: "Return to Draft" }
340
+ ]
341
+ };
342
+
343
+ // src/translations.ts
344
+ var TRANSLATION_STATUSES = [
345
+ "draft",
346
+ "in_review",
347
+ "approved",
348
+ "published",
349
+ "outdated"
350
+ ];
351
+
352
+ // src/compliance.ts
353
+ var COMPLIANCE_SCOPES = [
354
+ "audit_log",
355
+ "jobs",
356
+ "webhook_logs",
357
+ "operational_alerts",
358
+ "sso_login_states"
359
+ ];
360
+ var LEGAL_HOLD_KINDS = [
361
+ "scope",
362
+ "tenant",
363
+ "content_type",
364
+ "entity",
365
+ "subject"
366
+ ];
367
+ var DATA_CLASSIFICATIONS = [
368
+ "public",
369
+ "internal",
370
+ "confidential",
371
+ "restricted"
372
+ ];
373
+ var GovernanceViolationError = class extends Error {
374
+ constructor(message, tenantId, rule, details) {
375
+ super(message);
376
+ this.tenantId = tenantId;
377
+ this.rule = rule;
378
+ this.details = details;
379
+ this.name = "GovernanceViolationError";
380
+ }
381
+ };
382
+
383
+ // src/ai-automation-advisor.ts
384
+ var DEFAULT_AUTOMATION_THRESHOLDS = {
385
+ abandonedDraftDays: 30,
386
+ staleContentDays: 365,
387
+ workflowStuckDays: 7,
388
+ orphanMediaDays: 30,
389
+ bulkRecommendationMinCount: 5
390
+ };
391
+
392
+ // src/ai-guardrails.ts
393
+ var DEFAULT_AI_GUARDRAILS = {
394
+ perActorMaxCalls: 30,
395
+ windowSeconds: 60,
396
+ maxBodyBytes: 64 * 1024,
397
+ auditEveryCall: true,
398
+ ledgerTtlSeconds: 7 * 24 * 60 * 60
399
+ };
94
400
  // Annotate the CommonJS export names for ESM import in node:
95
401
  0 && (module.exports = {
402
+ ACTIVITY_ACTION_CATEGORY,
403
+ ACTIVITY_EXCLUDED_ACTIONS,
404
+ ACTIVITY_FEED_ACTIONS,
405
+ COMPLIANCE_SCOPES,
406
+ DATA_CLASSIFICATIONS,
407
+ DEFAULT_AI_GUARDRAILS,
408
+ DEFAULT_AUTOMATION_THRESHOLDS,
409
+ DEFAULT_WORKFLOW,
410
+ EXTENSION_PRECEDENCE,
411
+ GovernanceViolationError,
412
+ LEGAL_HOLD_KINDS,
413
+ RESERVED_EXTENSION_PLUGIN_NAMES,
96
414
  SchemaValidationError,
415
+ TRANSLATION_STATUSES,
416
+ classifyPluginSource,
417
+ defineAdminMiddleware,
418
+ defineContentMiddleware,
419
+ definePlugin,
420
+ definePluginFactory,
421
+ defineSystemMiddleware,
422
+ defineTheme,
423
+ exampleBlockComponent,
424
+ exampleComponentSchema,
97
425
  exampleSchema
98
426
  });