@redpanda-data/docs-extensions-and-macros 4.17.3 → 5.0.1

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.
Files changed (31) hide show
  1. package/extension-utils/llms-utils.js +2 -5
  2. package/extensions/algolia-indexer/generate-index.js +99 -54
  3. package/extensions/collect-bloblang-samples.js +6 -6
  4. package/extensions/compute-end-of-life.js +8 -4
  5. package/extensions/conditional-home-redirect.js +90 -0
  6. package/extensions/convert-to-markdown.js +23 -1
  7. package/extensions/find-related-docs.js +3 -3
  8. package/extensions/find-related-labs.js +1 -1
  9. package/extensions/generate-fields-only-pages.js +7 -7
  10. package/extensions/generate-rp-connect-categories.js +5 -5
  11. package/extensions/generate-rp-connect-info.js +6 -6
  12. package/extensions/modify-connect-tag-playbook.js +1 -1
  13. package/extensions/unified-navigation.js +669 -0
  14. package/extensions/unlisted-pages.js +5 -1
  15. package/extensions/unpublish-pages.js +12 -0
  16. package/extensions/version-fetcher/fetch-latest-docker-tag.js +7 -2
  17. package/extensions/version-fetcher/get-latest-connect.js +6 -2
  18. package/extensions/version-fetcher/get-latest-console-version.js +13 -4
  19. package/extensions/version-fetcher/get-latest-redpanda-helm-version-from-operator.js +31 -5
  20. package/extensions/version-fetcher/get-latest-redpanda-version.js +8 -3
  21. package/extensions/version-fetcher/retry-util.js +10 -3
  22. package/extensions/version-fetcher/set-latest-version.js +9 -8
  23. package/macros/rp-connect-components.js +63 -1
  24. package/package.json +3 -1
  25. package/tools/redpanda-connect/AUTOMATION.md +5 -5
  26. package/tools/redpanda-connect/helpers/renderConnectFields.js +1 -1
  27. package/tools/redpanda-connect/pr-summary-formatter.js +4 -4
  28. package/tools/redpanda-connect/rpcn-connector-docs-handler.js +133 -83
  29. package/tools/redpanda-connect/templates/bloblang-functions-overview.hbs +1 -1
  30. package/tools/redpanda-connect/templates/bloblang-methods-overview.hbs +1 -1
  31. package/tools/redpanda-connect/templates/connector.hbs +2 -2
@@ -106,6 +106,94 @@ function stripPlatformMetadata (connectors) {
106
106
  })
107
107
  }
108
108
 
109
+ /**
110
+ * Augment connector data with platform metadata from binary analysis.
111
+ * This adds cloudSupported/requiresCgo flags and includes CGO-only and cloud-only connectors.
112
+ *
113
+ * @param {Object} connectorData - Connector index object with arrays for each component type
114
+ * @param {Object} binaryAnalysis - Binary analysis results from analyzeAllBinaries()
115
+ * @returns {Object} Object with augmentedData, augmentedCount, addedCgoCount, addedCloudOnlyCount
116
+ */
117
+ function augmentConnectorData (connectorData, binaryAnalysis) {
118
+ if (!binaryAnalysis) {
119
+ return { augmentedData: connectorData, augmentedCount: 0, addedCgoCount: 0, addedCloudOnlyCount: 0 }
120
+ }
121
+
122
+ // Deep clone to avoid mutating original
123
+ const augmentedData = JSON.parse(JSON.stringify(connectorData))
124
+
125
+ const cloudSet = new Set(
126
+ (binaryAnalysis.comparison?.inCloud || []).map(c => `${c.type}:${c.name}`)
127
+ )
128
+ const cgoOnlySet = new Set(
129
+ (binaryAnalysis.cgoOnly || []).map(c => `${c.type}:${c.name}`)
130
+ )
131
+
132
+ let augmentedCount = 0
133
+ let addedCgoCount = 0
134
+ let addedCloudOnlyCount = 0
135
+
136
+ const connectorTypes = ['inputs', 'outputs', 'processors', 'caches', 'rate_limits',
137
+ 'buffers', 'metrics', 'scanners', 'tracers']
138
+
139
+ for (const type of connectorTypes) {
140
+ if (!Array.isArray(augmentedData[type])) {
141
+ augmentedData[type] = []
142
+ }
143
+
144
+ // Add cloudSupported and requiresCgo flags to existing connectors
145
+ for (const connector of augmentedData[type]) {
146
+ const key = `${type}:${connector.name}`
147
+ connector.cloudSupported = cloudSet.has(key)
148
+ connector.requiresCgo = cgoOnlySet.has(key)
149
+ augmentedCount++
150
+ }
151
+
152
+ // Add CGO-only connectors that aren't in the OSS list
153
+ if (binaryAnalysis.cgoOnly) {
154
+ for (const cgoConn of binaryAnalysis.cgoOnly) {
155
+ if (cgoConn.type === type) {
156
+ const exists = augmentedData[type].some(c => c.name === cgoConn.name)
157
+ if (!exists) {
158
+ // Singularize type for consistency with stored data (except "metrics" which stays plural)
159
+ const componentType = cgoConn.type === 'metrics' ? 'metrics' : cgoConn.type.replace(/s$/, '')
160
+ augmentedData[type].push({
161
+ ...cgoConn,
162
+ type: componentType,
163
+ cloudSupported: false,
164
+ requiresCgo: true
165
+ })
166
+ addedCgoCount++
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ // Add cloud-only connectors that aren't in the OSS list
173
+ if (binaryAnalysis.comparison?.cloudOnly) {
174
+ for (const cloudConn of binaryAnalysis.comparison.cloudOnly) {
175
+ if (cloudConn.type === type) {
176
+ const exists = augmentedData[type].some(c => c.name === cloudConn.name)
177
+ if (!exists) {
178
+ // Singularize type for consistency with stored data (except "metrics" which stays plural)
179
+ const componentType = cloudConn.type === 'metrics' ? 'metrics' : cloudConn.type.replace(/s$/, '')
180
+ augmentedData[type].push({
181
+ ...cloudConn,
182
+ type: componentType,
183
+ cloudSupported: true,
184
+ requiresCgo: false,
185
+ cloudOnly: true
186
+ })
187
+ addedCloudOnlyCount++
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+
194
+ return { augmentedData, augmentedCount, addedCgoCount, addedCloudOnlyCount }
195
+ }
196
+
109
197
  /**
110
198
  * Update whats-new.adoc with new release information
111
199
  * @param {Object} params - Parameters
@@ -830,13 +918,22 @@ async function handleRpcnConnectorDocs (options) {
830
918
  }
831
919
  }
832
920
 
921
+ // Augment newData with binary analysis results before generating diff
922
+ // This ensures CGO-only and cloud-only connectors are included and metadata is accurate
923
+ const { augmentedData: augmentedNewData, addedCgoCount, addedCloudOnlyCount } =
924
+ augmentConnectorData(newData, intermediateAnalysis)
925
+
926
+ if (addedCgoCount > 0 || addedCloudOnlyCount > 0) {
927
+ console.log(` • Augmented newData: +${addedCgoCount} CGO-only, +${addedCloudOnlyCount} cloud-only`)
928
+ }
929
+
833
930
  // Generate diff
834
931
  console.log(`\nGenerating diff: ${fromVer} → ${toVer}...`)
835
932
  const { generateConnectorDiffJson } = require('./report-delta.js')
836
933
 
837
934
  const diffData = generateConnectorDiffJson(
838
935
  oldData,
839
- newData,
936
+ augmentedNewData,
840
937
  {
841
938
  oldVersion: fromVer,
842
939
  newVersion: toVer,
@@ -850,6 +947,12 @@ async function handleRpcnConnectorDocs (options) {
850
947
  fs.writeFileSync(diffPath, JSON.stringify(diffData, null, 2), 'utf8')
851
948
  console.log(`✓ Diff saved: ${path.basename(diffPath)}`)
852
949
 
950
+ // Save augmented data back to file for subsequent iterations
951
+ // This ensures the next version pair has consistent metadata when loading this version as oldData
952
+ const augmentedDataPath = path.join(dataDir, `connect-${toVer}.json`)
953
+ fs.writeFileSync(augmentedDataPath, JSON.stringify(augmentedNewData, null, 2), 'utf8')
954
+ console.log(`✓ Augmented data saved: connect-${toVer}.json`)
955
+
853
956
  // Update what's-new if requested
854
957
  if (options.updateWhatsNew) {
855
958
  console.log(`Updating what's-new.adoc for ${toVer}...`)
@@ -1097,73 +1200,10 @@ async function handleRpcnConnectorDocs (options) {
1097
1200
 
1098
1201
  const connectorData = JSON.parse(fs.readFileSync(dataFile, 'utf8'))
1099
1202
 
1100
- const cloudSet = new Set(
1101
- (binaryAnalysis.comparison?.inCloud || []).map(c => `${c.type}:${c.name}`)
1102
- )
1103
- const cgoOnlySet = new Set(
1104
- (binaryAnalysis.cgoOnly || []).map(c => `${c.type}:${c.name}`)
1105
- )
1106
-
1107
- let augmentedCount = 0
1108
- let addedCgoCount = 0
1109
- let addedCloudOnlyCount = 0
1110
-
1111
- const connectorTypes = ['inputs', 'outputs', 'processors', 'caches', 'rate_limits',
1112
- 'buffers', 'metrics', 'scanners', 'tracers']
1203
+ const { augmentedData, augmentedCount, addedCgoCount, addedCloudOnlyCount } =
1204
+ augmentConnectorData(connectorData, binaryAnalysis)
1113
1205
 
1114
- for (const type of connectorTypes) {
1115
- if (!Array.isArray(connectorData[type])) {
1116
- connectorData[type] = []
1117
- }
1118
-
1119
- for (const connector of connectorData[type]) {
1120
- const key = `${type}:${connector.name}`
1121
- connector.cloudSupported = cloudSet.has(key)
1122
- connector.requiresCgo = cgoOnlySet.has(key)
1123
- augmentedCount++
1124
- }
1125
-
1126
- if (binaryAnalysis.cgoOnly) {
1127
- for (const cgoConn of binaryAnalysis.cgoOnly) {
1128
- if (cgoConn.type === type) {
1129
- const exists = connectorData[type].some(c => c.name === cgoConn.name)
1130
- if (!exists) {
1131
- // Singularize type for consistency with stored data (except "metrics" which stays plural)
1132
- const componentType = cgoConn.type === 'metrics' ? 'metrics' : cgoConn.type.replace(/s$/, '')
1133
- connectorData[type].push({
1134
- ...cgoConn,
1135
- type: componentType,
1136
- cloudSupported: false,
1137
- requiresCgo: true
1138
- })
1139
- addedCgoCount++
1140
- }
1141
- }
1142
- }
1143
- }
1144
-
1145
- if (binaryAnalysis.comparison?.cloudOnly) {
1146
- for (const cloudConn of binaryAnalysis.comparison.cloudOnly) {
1147
- if (cloudConn.type === type) {
1148
- const exists = connectorData[type].some(c => c.name === cloudConn.name)
1149
- if (!exists) {
1150
- // Singularize type for consistency with stored data (except "metrics" which stays plural)
1151
- const componentType = cloudConn.type === 'metrics' ? 'metrics' : cloudConn.type.replace(/s$/, '')
1152
- connectorData[type].push({
1153
- ...cloudConn,
1154
- type: componentType,
1155
- cloudSupported: true,
1156
- requiresCgo: false,
1157
- cloudOnly: true
1158
- })
1159
- addedCloudOnlyCount++
1160
- }
1161
- }
1162
- }
1163
- }
1164
- }
1165
-
1166
- fs.writeFileSync(dataFile, JSON.stringify(connectorData, null, 2), 'utf8')
1206
+ fs.writeFileSync(dataFile, JSON.stringify(augmentedData, null, 2), 'utf8')
1167
1207
  console.log(`Done: Augmented ${augmentedCount} connectors with cloud/cgo fields`)
1168
1208
  if (addedCgoCount > 0) {
1169
1209
  console.log(` • Added ${addedCgoCount} cgo-only connectors to data file`)
@@ -1172,8 +1212,7 @@ async function handleRpcnConnectorDocs (options) {
1172
1212
  console.log(` • Added ${addedCloudOnlyCount} cloud-only connectors to data file`)
1173
1213
  }
1174
1214
 
1175
- // Keep only the latest version (delete all older versions)
1176
- // BUT preserve any files from intermediate processing during this run
1215
+ // Keep only the latest 2 versions (by semver), delete all others
1177
1216
  const dataVersions = fs.readdirSync(dataDir)
1178
1217
  .filter(f => /^connect-(\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?)\.json$/.test(f))
1179
1218
  .map(f => {
@@ -1181,21 +1220,12 @@ async function handleRpcnConnectorDocs (options) {
1181
1220
  return match ? match[1] : null
1182
1221
  })
1183
1222
  .filter(v => v && semver.valid(v))
1223
+ .sort((a, b) => semver.rcompare(a, b)) // Sort descending (newest first)
1184
1224
 
1185
- // Build list of versions we need to keep for this run
1186
- const versionsToKeep = new Set([newVersion]); // Always keep the latest
1187
- if (intermediateProcessingResults.length > 0) {
1188
- // Keep intermediate versions from this run
1189
- intermediateProcessingResults.forEach(r => {
1190
- versionsToKeep.add(r.fromVersion);
1191
- versionsToKeep.add(r.toVersion);
1192
- });
1193
- }
1194
- if (oldVersion) {
1195
- versionsToKeep.add(oldVersion); // Keep old version for diff
1196
- }
1225
+ // Keep only the latest 2 versions
1226
+ const versionsToKeep = new Set(dataVersions.slice(0, 2))
1197
1227
 
1198
- // Delete only files that are NOT needed for this run
1228
+ // Delete all older versions
1199
1229
  for (const version of dataVersions) {
1200
1230
  if (!versionsToKeep.has(version)) {
1201
1231
  const dataFile = `connect-${version}.json`
@@ -1205,9 +1235,29 @@ async function handleRpcnConnectorDocs (options) {
1205
1235
  }
1206
1236
  }
1207
1237
 
1238
+ // Also clean up old CSV files (keep latest 2)
1239
+ const csvVersions = fs.readdirSync(dataDir)
1240
+ .filter(f => /^connect-info-(\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?)\.csv$/.test(f))
1241
+ .map(f => {
1242
+ const match = f.match(/^connect-info-(\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?)\.csv$/)
1243
+ return match ? match[1] : null
1244
+ })
1245
+ .filter(v => v && semver.valid(v))
1246
+ .sort((a, b) => semver.rcompare(a, b))
1247
+
1248
+ const csvToKeep = new Set(csvVersions.slice(0, 2))
1249
+ for (const version of csvVersions) {
1250
+ if (!csvToKeep.has(version)) {
1251
+ const csvFile = `connect-info-${version}.csv`
1252
+ const csvPath = path.join(dataDir, csvFile);
1253
+ fs.unlinkSync(csvPath);
1254
+ console.log(`🧹 Deleted old CSV from docs-data: ${csvFile}`);
1255
+ }
1256
+ }
1257
+
1208
1258
  // IMPORTANT: Reload newIndex with augmented data for unified diff
1209
1259
  // The unified diff approach compares platform metadata to detect transitions
1210
- newIndex = connectorData
1260
+ newIndex = augmentedData
1211
1261
  console.log(`✓ Reloaded newIndex with augmented data for diff comparison`)
1212
1262
  } catch (err) {
1213
1263
  console.error(`Warning: Failed to augment data file: ${err.message}`)
@@ -23,7 +23,7 @@ root.values_two = range(0, this.max, 2)
23
23
  ```
24
24
  {{#each functions}}
25
25
 
26
- include::redpanda-connect:components:partial$bloblang-functions/{{this}}.adoc[leveloffset=+1]
26
+ include::connect:components:partial$bloblang-functions/{{this}}.adoc[leveloffset=+1]
27
27
  {{/each}}
28
28
 
29
29
  // end::single-source[]
@@ -32,7 +32,7 @@ root.foo_two = this.(bar | baz).trim().replace_all("dog", "cat")
32
32
  == {{{toSentenceCase this.name}}}
33
33
  {{#each this.methods}}
34
34
 
35
- include::redpanda-connect:components:partial$bloblang-methods/{{this}}.adoc[leveloffset=+2]
35
+ include::connect:components:partial$bloblang-methods/{{this}}.adoc[leveloffset=+2]
36
36
  {{/each}}
37
37
  {{/each}}
38
38
 
@@ -47,11 +47,11 @@ You can either xref:install:prebuilt-binary.adoc[download a prebuilt cgo-enabled
47
47
 
48
48
  {{/if}}
49
49
  {{#if (or this.config.children children)}}
50
- include::redpanda-connect:components:partial$fields/{{typeDir}}/{{name}}.adoc[]
50
+ include::connect:components:partial$fields/{{typeDir}}/{{name}}.adoc[]
51
51
  {{/if}}
52
52
 
53
53
  {{#if this.examples}}
54
- include::redpanda-connect:components:partial$examples/{{typeDir}}/{{name}}.adoc[]
54
+ include::connect:components:partial$examples/{{typeDir}}/{{name}}.adoc[]
55
55
  {{/if}}
56
56
 
57
57