@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.js CHANGED
@@ -1,4 +1,97 @@
1
+ // src/plugin.ts
2
+ function definePlugin(definition) {
3
+ return definition;
4
+ }
5
+ function definePluginFactory(factory) {
6
+ return factory;
7
+ }
8
+
9
+ // src/plugin-extensions.ts
10
+ var RESERVED_EXTENSION_PLUGIN_NAMES = {
11
+ core: "@notty/core",
12
+ appLocal: "@notty/app-local"
13
+ };
14
+ var EXTENSION_PRECEDENCE = {
15
+ core: 0,
16
+ plugin: 1,
17
+ "app-local": 2
18
+ };
19
+ function classifyPluginSource(pluginName, hints) {
20
+ if (hints?.declaredSource) return hints.declaredSource;
21
+ if (pluginName === RESERVED_EXTENSION_PLUGIN_NAMES.core) return "core";
22
+ if (pluginName === RESERVED_EXTENSION_PLUGIN_NAMES.appLocal) return "app-local";
23
+ return "plugin";
24
+ }
25
+
26
+ // src/theme.ts
27
+ function defineTheme(definition) {
28
+ return definition;
29
+ }
30
+
1
31
  // src/notty-schema.ts
32
+ var exampleComponentSchema = {
33
+ uid: "shared.seo-meta",
34
+ category: "shared",
35
+ info: {
36
+ displayName: "SEO Meta",
37
+ description: "SEO metadata for pages",
38
+ icon: "mdi:search-web"
39
+ },
40
+ attributes: {
41
+ metaTitle: {
42
+ type: "string",
43
+ maxLength: 60
44
+ },
45
+ metaDescription: {
46
+ type: "text",
47
+ maxLength: 160
48
+ },
49
+ keywords: {
50
+ type: "string",
51
+ maxLength: 255
52
+ },
53
+ canonicalUrl: {
54
+ type: "string",
55
+ maxLength: 500
56
+ },
57
+ ogImage: {
58
+ type: "media",
59
+ allowedTypes: ["images"],
60
+ multiple: false
61
+ }
62
+ }
63
+ };
64
+ var exampleBlockComponent = {
65
+ uid: "blocks.hero-section",
66
+ category: "blocks",
67
+ info: {
68
+ displayName: "Hero Section",
69
+ description: "Hero banner with title and CTA",
70
+ icon: "mdi:view-dashboard"
71
+ },
72
+ attributes: {
73
+ title: {
74
+ type: "string",
75
+ required: true,
76
+ maxLength: 100
77
+ },
78
+ subtitle: {
79
+ type: "text"
80
+ },
81
+ backgroundImage: {
82
+ type: "media",
83
+ allowedTypes: ["images"]
84
+ },
85
+ ctaText: {
86
+ type: "string",
87
+ maxLength: 50
88
+ },
89
+ ctaLink: {
90
+ type: "string",
91
+ maxLength: 500
92
+ }
93
+ }
94
+ };
2
95
  var exampleSchema = {
3
96
  kind: "collectionType",
4
97
  info: {
@@ -45,13 +138,30 @@ var exampleSchema = {
45
138
  type: "media",
46
139
  allowedTypes: ["images"],
47
140
  multiple: false
48
- // single image
49
141
  },
50
142
  gallery: {
51
143
  type: "media",
52
144
  allowedTypes: ["images", "videos"],
53
145
  multiple: true
54
- // multiple media
146
+ },
147
+ // Component field example - single SEO meta
148
+ seo: {
149
+ type: "component",
150
+ component: "shared.seo-meta",
151
+ repeatable: false
152
+ },
153
+ // Component field example - repeatable FAQ items
154
+ faq: {
155
+ type: "component",
156
+ component: "shared.faq-item",
157
+ repeatable: true,
158
+ min: 0,
159
+ max: 20
160
+ },
161
+ // Dynamic zone example - page builder blocks
162
+ blocks: {
163
+ type: "dynamicZone",
164
+ components: ["blocks.hero-section", "blocks.rich-text", "blocks.gallery", "blocks.cta"]
55
165
  }
56
166
  }
57
167
  };
@@ -64,7 +174,203 @@ var SchemaValidationError = class extends Error {
64
174
  this.name = "SchemaValidationError";
65
175
  }
66
176
  };
177
+
178
+ // src/middleware.ts
179
+ function defineAdminMiddleware(definition) {
180
+ return {
181
+ _type: "admin",
182
+ order: 100,
183
+ enabled: true,
184
+ ...definition
185
+ };
186
+ }
187
+ function defineContentMiddleware(definition) {
188
+ return {
189
+ _type: "content",
190
+ order: 100,
191
+ enabled: true,
192
+ ...definition
193
+ };
194
+ }
195
+ function defineSystemMiddleware(definition) {
196
+ return {
197
+ _type: "system",
198
+ order: 100,
199
+ enabled: true,
200
+ ...definition
201
+ };
202
+ }
203
+
204
+ // src/activity.ts
205
+ var ACTIVITY_ACTION_CATEGORY = {
206
+ "content.create": "content",
207
+ "content.update": "content",
208
+ "content.delete": "content",
209
+ "content.publish": "content",
210
+ "content.unpublish": "content",
211
+ "content.bulk_update": "content",
212
+ "content.bulk_delete": "content",
213
+ "schema.create": "schema",
214
+ "schema.update": "schema",
215
+ "schema.delete": "schema",
216
+ "media.upload": "media",
217
+ "media.update": "media",
218
+ "media.delete": "media",
219
+ "settings.update": "settings",
220
+ "admin.login": "auth",
221
+ "admin.logout": "auth",
222
+ "auth.login": "auth",
223
+ "auth.logout": "auth",
224
+ "auth.register": "auth",
225
+ "comment.create": "collaboration",
226
+ "comment.update": "collaboration",
227
+ "comment.delete": "collaboration",
228
+ "comment.resolve": "collaboration",
229
+ "comment.reopen": "collaboration",
230
+ "assignment.create": "collaboration",
231
+ "assignment.update": "collaboration",
232
+ "assignment.complete": "collaboration",
233
+ "assignment.cancel": "collaboration"
234
+ };
235
+ var ACTIVITY_EXCLUDED_ACTIONS = [
236
+ "auth.token_refresh",
237
+ "admin.token_refresh",
238
+ "auth.login_failed",
239
+ "admin.login_failed",
240
+ "auth.password_reset",
241
+ "policy.denied"
242
+ ];
243
+ var ACTIVITY_FEED_ACTIONS = [
244
+ "content.create",
245
+ "content.update",
246
+ "content.delete",
247
+ "content.publish",
248
+ "content.unpublish",
249
+ "content.bulk_update",
250
+ "content.bulk_delete",
251
+ "schema.create",
252
+ "schema.update",
253
+ "schema.delete",
254
+ "media.upload",
255
+ "media.update",
256
+ "media.delete",
257
+ "settings.update",
258
+ "admin.login",
259
+ "admin.logout",
260
+ "auth.login",
261
+ "auth.logout",
262
+ "auth.register",
263
+ "comment.create",
264
+ "comment.update",
265
+ "comment.delete",
266
+ "comment.resolve",
267
+ "comment.reopen",
268
+ "assignment.create",
269
+ "assignment.update",
270
+ "assignment.complete",
271
+ "assignment.cancel"
272
+ ];
273
+
274
+ // src/workflow.ts
275
+ var DEFAULT_WORKFLOW = {
276
+ enabled: true,
277
+ initialState: "draft",
278
+ states: [
279
+ { name: "draft", label: "Draft", color: "#6b7280" },
280
+ { name: "review", label: "In Review", color: "#f59e0b" },
281
+ { name: "approved", label: "Approved", color: "#3b82f6" },
282
+ { name: "published", label: "Published", color: "#10b981", publishable: true }
283
+ ],
284
+ transitions: [
285
+ { from: "draft", to: "review", label: "Submit for Review" },
286
+ { from: "review", to: "draft", label: "Return to Draft" },
287
+ { from: "review", to: "approved", label: "Approve", roles: ["super-admin", "admin", "editor"] },
288
+ { from: "approved", to: "published", label: "Publish", roles: ["super-admin", "admin"] },
289
+ { from: "published", to: "draft", label: "Unpublish" },
290
+ { from: "approved", to: "draft", label: "Return to Draft" }
291
+ ]
292
+ };
293
+
294
+ // src/translations.ts
295
+ var TRANSLATION_STATUSES = [
296
+ "draft",
297
+ "in_review",
298
+ "approved",
299
+ "published",
300
+ "outdated"
301
+ ];
302
+
303
+ // src/compliance.ts
304
+ var COMPLIANCE_SCOPES = [
305
+ "audit_log",
306
+ "jobs",
307
+ "webhook_logs",
308
+ "operational_alerts",
309
+ "sso_login_states"
310
+ ];
311
+ var LEGAL_HOLD_KINDS = [
312
+ "scope",
313
+ "tenant",
314
+ "content_type",
315
+ "entity",
316
+ "subject"
317
+ ];
318
+ var DATA_CLASSIFICATIONS = [
319
+ "public",
320
+ "internal",
321
+ "confidential",
322
+ "restricted"
323
+ ];
324
+ var GovernanceViolationError = class extends Error {
325
+ constructor(message, tenantId, rule, details) {
326
+ super(message);
327
+ this.tenantId = tenantId;
328
+ this.rule = rule;
329
+ this.details = details;
330
+ this.name = "GovernanceViolationError";
331
+ }
332
+ };
333
+
334
+ // src/ai-automation-advisor.ts
335
+ var DEFAULT_AUTOMATION_THRESHOLDS = {
336
+ abandonedDraftDays: 30,
337
+ staleContentDays: 365,
338
+ workflowStuckDays: 7,
339
+ orphanMediaDays: 30,
340
+ bulkRecommendationMinCount: 5
341
+ };
342
+
343
+ // src/ai-guardrails.ts
344
+ var DEFAULT_AI_GUARDRAILS = {
345
+ perActorMaxCalls: 30,
346
+ windowSeconds: 60,
347
+ maxBodyBytes: 64 * 1024,
348
+ auditEveryCall: true,
349
+ ledgerTtlSeconds: 7 * 24 * 60 * 60
350
+ };
67
351
  export {
352
+ ACTIVITY_ACTION_CATEGORY,
353
+ ACTIVITY_EXCLUDED_ACTIONS,
354
+ ACTIVITY_FEED_ACTIONS,
355
+ COMPLIANCE_SCOPES,
356
+ DATA_CLASSIFICATIONS,
357
+ DEFAULT_AI_GUARDRAILS,
358
+ DEFAULT_AUTOMATION_THRESHOLDS,
359
+ DEFAULT_WORKFLOW,
360
+ EXTENSION_PRECEDENCE,
361
+ GovernanceViolationError,
362
+ LEGAL_HOLD_KINDS,
363
+ RESERVED_EXTENSION_PLUGIN_NAMES,
68
364
  SchemaValidationError,
365
+ TRANSLATION_STATUSES,
366
+ classifyPluginSource,
367
+ defineAdminMiddleware,
368
+ defineContentMiddleware,
369
+ definePlugin,
370
+ definePluginFactory,
371
+ defineSystemMiddleware,
372
+ defineTheme,
373
+ exampleBlockComponent,
374
+ exampleComponentSchema,
69
375
  exampleSchema
70
376
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notty/types",
3
- "version": "0.7.1",
3
+ "version": "1.0.0",
4
4
  "description": "Shared TypeScript types for Notty CMS",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -17,11 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "publishConfig": {
20
- "access": "restricted"
21
- },
22
- "devDependencies": {
23
- "tsup": "^8.3.0",
24
- "typescript": "^5.6.3"
20
+ "access": "public"
25
21
  },
26
22
  "scripts": {
27
23
  "build": "tsup src/index.ts --format cjs,esm --dts",
@@ -30,5 +26,9 @@
30
26
  "lint": "eslint src",
31
27
  "type-check": "tsc --noEmit",
32
28
  "clean": "rm -rf dist"
29
+ },
30
+ "devDependencies": {
31
+ "tsup": "^8.3.0",
32
+ "typescript": "^5.6.3"
33
33
  }
34
34
  }