@redpanda-data/docs-extensions-and-macros 4.8.1 → 4.9.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.
@@ -28,7 +28,10 @@ module.exports = function renderConnectFields(children, prefix = '') {
28
28
 
29
29
  // Normalize types
30
30
  let displayType;
31
- if (child.type === 'string' && child.kind === 'array') {
31
+ const isArrayTitle = typeof child.name === 'string' && child.name.endsWith('[]');
32
+ if (isArrayTitle) {
33
+ displayType = 'array<object>';
34
+ } else if (child.type === 'string' && child.kind === 'array') {
32
35
  displayType = 'array';
33
36
  } else if (child.type === 'unknown' && child.kind === 'map') {
34
37
  displayType = 'object';
@@ -42,14 +45,38 @@ module.exports = function renderConnectFields(children, prefix = '') {
42
45
 
43
46
  let block = '';
44
47
  const isArray = child.kind === 'array';
48
+ // Only append [] if kind is array and name does not already end with []
49
+ const nameWithArray = (typeof child.name === 'string' && isArray && !child.name.endsWith('[]'))
50
+ ? `${child.name}[]`
51
+ : child.name;
45
52
  const currentPath = prefix
46
- ? `${prefix}.${child.name}${isArray ? '[]' : ''}`
47
- : `${child.name}${isArray ? '[]' : ''}`;
53
+ ? `${prefix}.${nameWithArray}`
54
+ : `${nameWithArray}`;
48
55
 
49
56
  block += `=== \`${currentPath}\`\n\n`;
50
57
 
51
- if (child.description) {
52
- block += `${child.description}\n\n`;
58
+ // --- Beta badge logic (now uses is_beta) ---
59
+ let desc = child.description || '';
60
+ if (child.is_beta) {
61
+ // Remove any leading "BETA:" label (case-insensitive, trims leading whitespace)
62
+ desc = 'badge::[label=Beta, size=large, tooltip={page-beta-text}]\n\n' + desc.replace(/^\s*BETA:\s*/i, '');
63
+ }
64
+
65
+ // --- Interpolation support notice ---
66
+ const interpolationNotice = 'This field supports xref:configuration:interpolation.adoc#bloblang-queries[interpolation functions].';
67
+ if (child.interpolation === true) {
68
+ // Only add if not already present (case-insensitive)
69
+ const descLower = desc.toLowerCase();
70
+ if (!descLower.includes('interpolation functions')) {
71
+ desc = desc.trim() + (desc.trim() ? '\n\n' : '') + interpolationNotice;
72
+ }
73
+ } else {
74
+ // If interpolation is not true, remove the notice if present
75
+ desc = desc.replace(new RegExp(interpolationNotice.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), '').replace(/\n{2,}/g, '\n\n');
76
+ }
77
+
78
+ if (desc) {
79
+ block += `${desc}\n\n`;
53
80
  }
54
81
  if (child.is_secret) {
55
82
  block += `include::redpanda-connect:components:partial$secret_warning.adoc[]\n\n`;
@@ -1,3 +1,103 @@
1
+ /**
2
+ * Generate a JSON diff report between two connector index objects.
3
+ * @param {object} oldIndex - Previous version connector index
4
+ * @param {object} newIndex - Current version connector index
5
+ * @param {object} opts - { oldVersion, newVersion, timestamp }
6
+ * @returns {object} JSON diff report
7
+ */
8
+ function generateConnectorDiffJson(oldIndex, newIndex, opts = {}) {
9
+ const oldMap = buildComponentMap(oldIndex);
10
+ const newMap = buildComponentMap(newIndex);
11
+
12
+ // New components
13
+ const newComponentKeys = Object.keys(newMap).filter(k => !(k in oldMap));
14
+ const newComponents = newComponentKeys.map(key => {
15
+ const [type, name] = key.split(':');
16
+ const raw = newMap[key].raw;
17
+ return {
18
+ name,
19
+ type,
20
+ status: raw.status || raw.type || '',
21
+ version: raw.version || raw.introducedInVersion || '',
22
+ description: raw.description || ''
23
+ };
24
+ });
25
+
26
+ // Removed components
27
+ const removedComponentKeys = Object.keys(oldMap).filter(k => !(k in newMap));
28
+ const removedComponents = removedComponentKeys.map(key => {
29
+ const [type, name] = key.split(':');
30
+ const raw = oldMap[key].raw;
31
+ return {
32
+ name,
33
+ type,
34
+ status: raw.status || raw.type || '',
35
+ version: raw.version || raw.introducedInVersion || '',
36
+ description: raw.description || ''
37
+ };
38
+ });
39
+
40
+ // New fields under existing components
41
+ const newFields = [];
42
+ Object.keys(newMap).forEach(cKey => {
43
+ if (!(cKey in oldMap)) return;
44
+ const oldFields = new Set(oldMap[cKey].fields || []);
45
+ const newFieldsArr = newMap[cKey].fields || [];
46
+ newFieldsArr.forEach(fName => {
47
+ if (!oldFields.has(fName)) {
48
+ const [type, compName] = cKey.split(':');
49
+ let rawFieldObj = null;
50
+ if (type === 'config') {
51
+ rawFieldObj = (newMap[cKey].raw.children || []).find(f => f.name === fName);
52
+ } else {
53
+ rawFieldObj = (newMap[cKey].raw.config?.children || []).find(f => f.name === fName);
54
+ }
55
+ newFields.push({
56
+ component: cKey,
57
+ field: fName,
58
+ introducedIn: rawFieldObj && (rawFieldObj.introducedInVersion || rawFieldObj.version),
59
+ description: rawFieldObj && rawFieldObj.description
60
+ });
61
+ }
62
+ });
63
+ });
64
+
65
+ // Removed fields under existing components
66
+ const removedFields = [];
67
+ Object.keys(oldMap).forEach(cKey => {
68
+ if (!(cKey in newMap)) return;
69
+ const newFieldsSet = new Set(newMap[cKey].fields || []);
70
+ const oldFieldsArr = oldMap[cKey].fields || [];
71
+ oldFieldsArr.forEach(fName => {
72
+ if (!newFieldsSet.has(fName)) {
73
+ removedFields.push({
74
+ component: cKey,
75
+ field: fName
76
+ });
77
+ }
78
+ });
79
+ });
80
+
81
+ return {
82
+ comparison: {
83
+ oldVersion: opts.oldVersion || '',
84
+ newVersion: opts.newVersion || '',
85
+ timestamp: opts.timestamp || new Date().toISOString()
86
+ },
87
+ summary: {
88
+ newComponents: newComponents.length,
89
+ removedComponents: removedComponents.length,
90
+ newFields: newFields.length,
91
+ removedFields: removedFields.length
92
+ },
93
+ details: {
94
+ newComponents,
95
+ removedComponents,
96
+ newFields,
97
+ removedFields
98
+ }
99
+ };
100
+ }
1
101
  // tools/redpanda-connect/report-delta.js
2
102
  'use strict';
3
103
 
@@ -149,4 +249,5 @@ module.exports = {
149
249
  buildComponentMap,
150
250
  getRpkConnectVersion,
151
251
  printDeltaReport,
252
+ generateConnectorDiffJson,
152
253
  };
@@ -0,0 +1,28 @@
1
+ // This content is autogenerated. Do not edit manually. To override descriptions, use the doc-tools CLI with the --overrides option: https://redpandadata.atlassian.net/wiki/spaces/DOC/pages/1247543314/Generate+reference+docs+for+Redpanda+Connect
2
+
3
+ = {{name}}
4
+
5
+ {{#if signature}}
6
+ *Signature*: `{{signature}}`
7
+ {{/if}}
8
+
9
+ {{#if description}}
10
+ {{description}}
11
+ {{/if}}
12
+
13
+
14
+ {{#if examples}}
15
+ == Examples
16
+
17
+ {{#each examples}}
18
+ {{{bloblangExample this}}}
19
+ {{/each}}
20
+ {{/if}}
21
+
22
+ {{#if related}}
23
+ == Related
24
+
25
+ {{#each related}}
26
+ * {{this}}
27
+ {{/each}}
28
+ {{/if}}