notes-to-strapi-export-article-ai 3.0.167 → 3.0.171

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.
@@ -8,23 +8,25 @@ on:
8
8
  jobs:
9
9
  publish:
10
10
  runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ id-token: write # Required for npm provenance
11
14
  steps:
12
- - name: Checkout
13
- uses: actions/checkout@v4
14
- with:
15
- fetch-depth: 0
16
- token: ${{ secrets.GIT_TOKEN }}
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0
17
19
 
18
- - name: Use Node.js
19
- uses: actions/setup-node@v4
20
- with:
21
- node-version: '20'
22
- registry-url: 'https://registry.npmjs.org'
20
+ - name: Use Node.js
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: '20'
24
+ registry-url: 'https://registry.npmjs.org'
23
25
 
24
- - name: Install Dependencies
25
- run: npm ci
26
+ - name: Install Dependencies
27
+ run: npm ci
26
28
 
27
- - name: Publish to npm
28
- run: npm publish
29
- env:
30
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29
+ - name: Publish to npm with provenance
30
+ run: npm publish --provenance --access public
31
+ env:
32
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "notes-to-strapi-export-article-ai",
3
3
  "name": "Strapi Exporter AI",
4
- "version": "3.0.167",
4
+ "version": "3.0.171",
5
5
  "minAppVersion": "1.7.0",
6
6
  "description": "Effortlessly export your notes to Strapi CMS with AI-powered handling and SEO optimization.",
7
7
  "author": "Cinquin Andy",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notes-to-strapi-export-article-ai",
3
- "version": "3.0.167",
3
+ "version": "3.0.171",
4
4
  "description": "Effortlessly export your Obsidian notes to Strapi CMS with AI-powered image handling and SEO optimization. Replace all the images in your notes by uploaded images in Strapi, and add SEO metadata to uploaded images.",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -10,22 +10,25 @@
10
10
  },
11
11
  "keywords": [],
12
12
  "author": "Cinquin Andy",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/CinquinAndy/notes-to-strapi-export-article-ai"
16
+ },
13
17
  "devDependencies": {
14
18
  "@types/node": "22.19.7",
15
19
  "@typescript-eslint/eslint-plugin": "8.53.0",
16
20
  "@typescript-eslint/parser": "8.53.0",
17
21
  "builtin-modules": "4.0.0",
18
- "esbuild": "0.24.0",
22
+ "esbuild": "0.27.2",
19
23
  "obsidian": "latest",
20
24
  "prettier": "3.8.0",
21
25
  "tslib": "2.8.1",
22
26
  "typescript": "5.9.3"
23
27
  },
24
28
  "dependencies": {
25
- "@ai-sdk/openai": "0.0.72",
26
- "ai": "3.4.33",
29
+ "@ai-sdk/openai": "^3.0.12",
30
+ "ai": "^6.0.39",
27
31
  "js-yaml": "4.1.1",
28
- "openai": "4.104.0",
29
32
  "process": "0.11.10"
30
33
  }
31
34
  }
@@ -41,7 +41,11 @@ export class Configuration {
41
41
  this.plugin = plugin
42
42
  this.containerEl = containerEl
43
43
  this.app = plugin.app
44
- this.currentRouteId = this.plugin.settings.routes[0]?.id || ''
44
+ // Use persisted route ID or default to first route
45
+ this.currentRouteId =
46
+ this.plugin.settings.currentConfigRouteId ||
47
+ this.plugin.settings.routes[0]?.id ||
48
+ ''
45
49
 
46
50
  // Initialiser les services avec la clé API
47
51
  this.initializeServices()
@@ -115,6 +119,9 @@ export class Configuration {
115
119
  dropdown.setValue(this.currentRouteId)
116
120
  dropdown.onChange(async value => {
117
121
  this.currentRouteId = value
122
+ // Persist the selected route ID
123
+ this.plugin.settings.currentConfigRouteId = value
124
+ await this.plugin.saveSettings()
118
125
  await this.updateConfigurationFields()
119
126
  })
120
127
  })
@@ -492,6 +499,11 @@ export class Configuration {
492
499
  currentRoute.language || 'en'
493
500
  )
494
501
  }
502
+ if (this.components.contentFieldInput) {
503
+ this.components.contentFieldInput.setValue(
504
+ currentRoute.contentField || 'content'
505
+ )
506
+ }
495
507
  }
496
508
  } catch (error) {
497
509
  this.showError('Failed to update configuration fields' + error.message)
@@ -1,5 +1,5 @@
1
1
  import { createOpenAI } from '@ai-sdk/openai'
2
- import { generateObject } from 'ai'
2
+ import { generateText, Output } from 'ai'
3
3
 
4
4
  export class ConfigurationGenerator {
5
5
  private model
@@ -9,7 +9,7 @@ export class ConfigurationGenerator {
9
9
  apiKey: options.openaiApiKey,
10
10
  })
11
11
 
12
- this.model = openai('gpt-5-mini')
12
+ this.model = openai.chat('gpt-4o-mini')
13
13
  }
14
14
 
15
15
  async generateConfiguration(params: {
@@ -23,14 +23,14 @@ export class ConfigurationGenerator {
23
23
  const descriptions = JSON.parse(params.schemaDescription)
24
24
 
25
25
  // Generate field configurations
26
- const { object } = await generateObject({
26
+ const { output } = await generateText({
27
27
  model: this.model,
28
- output: 'no-schema',
28
+ output: Output.json(),
29
29
  prompt: this.buildPrompt(schema.data, descriptions.data, params.language),
30
30
  })
31
31
 
32
32
  // Transform to final configuration
33
- return this.transformToConfiguration(object)
33
+ return this.transformToConfiguration(output)
34
34
  }
35
35
 
36
36
  private buildPrompt(
@@ -1,36 +1,27 @@
1
- import { z } from 'zod'
2
- import { generateObject } from 'ai'
1
+ import { generateText, Output } from 'ai'
3
2
  import { createOpenAI } from '@ai-sdk/openai'
4
3
 
5
4
  /**
6
- * Schema for field analysis result
5
+ * Interface for field analysis result
7
6
  */
8
- const fieldAnalysisSchema = z.object({
9
- imageFields: z.array(
10
- z.object({
11
- fieldName: z.string(),
12
- fieldType: z.enum(['single-image', 'gallery', 'other']),
13
- required: z.boolean(),
14
- description: z.string(),
15
- })
16
- ),
17
- metadataFields: z.array(
18
- z.object({
19
- fieldName: z.string(),
20
- valueType: z.string(),
21
- description: z.string(),
22
- })
23
- ),
24
- contentFields: z.array(
25
- z.object({
26
- fieldName: z.string(),
27
- contentType: z.string(),
28
- format: z.string().optional(),
29
- })
30
- ),
31
- })
32
-
33
- type FieldAnalysis = z.infer<typeof fieldAnalysisSchema>
7
+ interface FieldAnalysis {
8
+ imageFields: Array<{
9
+ fieldName: string
10
+ fieldType: 'single-image' | 'gallery' | 'other'
11
+ required: boolean
12
+ description: string
13
+ }>
14
+ metadataFields: Array<{
15
+ fieldName: string
16
+ valueType: string
17
+ description: string
18
+ }>
19
+ contentFields: Array<{
20
+ fieldName: string
21
+ contentType: string
22
+ format?: string
23
+ }>
24
+ }
34
25
 
35
26
  export interface FieldAnalyzerOptions {
36
27
  openaiApiKey: string
@@ -43,9 +34,7 @@ export class StructuredFieldAnalyzer {
43
34
  const openai = createOpenAI({
44
35
  apiKey: options.openaiApiKey,
45
36
  })
46
- this.model = openai('gpt-5-mini', {
47
- structuredOutputs: true,
48
- })
37
+ this.model = openai.chat('gpt-5-mini')
49
38
  }
50
39
 
51
40
  /**
@@ -53,16 +42,13 @@ export class StructuredFieldAnalyzer {
53
42
  */
54
43
  async analyzeSchema(schema: string): Promise<FieldAnalysis> {
55
44
  try {
56
- const { object } = await generateObject({
45
+ const { output } = await generateText({
57
46
  model: this.model,
58
- schema: fieldAnalysisSchema,
59
- schemaName: 'SchemaAnalysis',
60
- schemaDescription:
61
- 'Analysis of content schema fields to identify types and purposes',
47
+ output: Output.json(),
62
48
  prompt: this.buildAnalysisPrompt(schema),
63
49
  })
64
50
 
65
- return object as FieldAnalysis
51
+ return output as unknown as FieldAnalysis
66
52
  } catch (error) {
67
53
  throw new Error(`Schema analysis failed: ${error.message}`)
68
54
  }
@@ -74,7 +60,12 @@ export class StructuredFieldAnalyzer {
74
60
  - Metadata fields (SEO, tags, dates, etc.)
75
61
  - Content fields (text, rich text, markdown)
76
62
 
77
- Provide structured categorization of all fields with their purposes and data types.
63
+ Return a JSON object with this exact structure:
64
+ {
65
+ "imageFields": [{ "fieldName": string, "fieldType": "single-image" | "gallery" | "other", "required": boolean, "description": string }],
66
+ "metadataFields": [{ "fieldName": string, "valueType": string, "description": string }],
67
+ "contentFields": [{ "fieldName": string, "contentType": string, "format": string (optional) }]
68
+ }
78
69
 
79
70
  Schema to analyze:
80
71
  ${schema}
@@ -48,7 +48,7 @@ export class FrontmatterGenerator {
48
48
  const openai = createOpenAI({
49
49
  apiKey: this.plugin.settings.openaiApiKey,
50
50
  })
51
- this.model = openai('gpt-5-mini')
51
+ this.model = openai.chat('gpt-4o-mini')
52
52
  }
53
53
 
54
54
  /**
@@ -18,7 +18,7 @@ export class StrapiExportService {
18
18
  const openai = createOpenAI({
19
19
  apiKey: this.settings.openaiApiKey,
20
20
  })
21
- this.model = openai('gpt-5-mini')
21
+ this.model = openai.chat('gpt-4o-mini')
22
22
  }
23
23
 
24
24
  private async sendToStrapi(data: any, route: RouteConfig): Promise<void> {
@@ -9,6 +9,7 @@ export interface StrapiExporterSettings {
9
9
 
10
10
  // UI Settings
11
11
  currentTab: string
12
+ currentConfigRouteId?: string // Persist selected route in Configuration tab
12
13
 
13
14
  // Routes Configuration
14
15
  routes: RouteConfig[]