@commonpub/layer 0.21.7 → 0.21.9

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.
@@ -25,6 +25,7 @@ export interface FeatureFlags {
25
25
  admin: boolean;
26
26
  emailNotifications: boolean;
27
27
  publicApi: boolean;
28
+ contentImport: boolean;
28
29
  /**
29
30
  * Cross-instance delegated authorization. All sub-flags default false.
30
31
  * Mirrors `@commonpub/config`'s `IdentityFeatures`. Phase 1b+ — see
@@ -44,7 +45,7 @@ export const DEFAULT_FLAGS: FeatureFlags = {
44
45
  content: true, social: true, hubs: true, docs: true, video: true,
45
46
  contests: false, events: false, learning: true, explainers: true,
46
47
  editorial: true, federation: false, admin: false, emailNotifications: false,
47
- publicApi: false,
48
+ publicApi: false, contentImport: true,
48
49
  identity: {
49
50
  linkRemoteAccounts: false,
50
51
  signInWithRemote: false,
@@ -118,6 +119,7 @@ export function useFeatures() {
118
119
  admin: computed(() => flags.value.admin),
119
120
  emailNotifications: computed(() => flags.value.emailNotifications),
120
121
  publicApi: computed(() => flags.value.publicApi),
122
+ contentImport: computed(() => flags.value.contentImport),
121
123
  identity: computed(() => flags.value.identity),
122
124
  };
123
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonpub/layer",
3
- "version": "0.21.7",
3
+ "version": "0.21.9",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "files": [
@@ -50,16 +50,16 @@
50
50
  "vue": "^3.4.0",
51
51
  "vue-router": "^4.3.0",
52
52
  "zod": "^4.3.6",
53
+ "@commonpub/config": "0.13.0",
53
54
  "@commonpub/docs": "0.6.3",
54
- "@commonpub/editor": "0.7.9",
55
55
  "@commonpub/explainer": "0.7.13",
56
- "@commonpub/protocol": "0.9.10",
57
- "@commonpub/config": "0.12.0",
56
+ "@commonpub/auth": "0.6.0",
58
57
  "@commonpub/learning": "0.5.2",
59
- "@commonpub/server": "2.53.1",
60
- "@commonpub/ui": "0.8.5",
61
58
  "@commonpub/schema": "0.16.0",
62
- "@commonpub/auth": "0.6.0"
59
+ "@commonpub/protocol": "0.10.0",
60
+ "@commonpub/editor": "0.7.9",
61
+ "@commonpub/server": "2.54.0",
62
+ "@commonpub/ui": "0.8.5"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@testing-library/jest-dom": "^6.9.1",
@@ -40,10 +40,15 @@ const isOwner = computed(() => user.value?.id === content.value?.author?.id);
40
40
 
41
41
  // Estimate reading time (~200 words per minute)
42
42
  const readTime = computed(() => {
43
- if (!content.value?.content) return undefined;
44
- const blocks = content.value.content as BlockTuple[];
43
+ // Explainer document-format content is an object ({hero,sections,…}),
44
+ // not a BlockTuple[] — only blog/project store an array. Guard the
45
+ // for…of: iterating the object threw "not iterable" and 500'd SSR for
46
+ // every document-format explainer.
47
+ const raw = content.value?.content;
48
+ if (!Array.isArray(raw)) return undefined;
49
+ const blocks = raw as BlockTuple[];
45
50
  let words = 0;
46
- for (const [type, data] of blocks) {
51
+ for (const [, data] of blocks) {
47
52
  // Extract text from any string field in the block data
48
53
  for (const val of Object.values(data)) {
49
54
  if (typeof val === 'string' && val.trim()) {
@@ -7,6 +7,7 @@ const importBodySchema = z.object({
7
7
  });
8
8
 
9
9
  export default defineEventHandler(async (event): Promise<ImportResult> => {
10
+ requireFeature('contentImport');
10
11
  requireAuth(event);
11
12
 
12
13
  const { url } = await parseBody(event, importBodySchema);