@redpanda-data/docs-extensions-and-macros 3.4.3 → 3.5.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.
@@ -1,236 +1,119 @@
1
- 'use strict';
1
+ 'use strict'
2
2
 
3
3
  module.exports.register = function ({ config }) {
4
- const logger = this.getLogger('redpanda-connect-category-aggregation-extension');
5
-
6
- // Component name mapping for common names
7
- const componentNameMap = {
8
- "aws_kinesis_data_streams": "AWS Kinesis Data Streams",
9
- "aws_kinesis_firehose": "AWS Kinesis Firehose",
10
- "aws_kinesis": "AWS Kinesis",
11
- "aws_sqs": "AWS SQS",
12
- "aws_sns": "AWS SNS",
13
- "azure_cosmosdb": "Azure Cosmos DB",
14
- "azure_table_storage": "Azure Table Storage",
15
- "gcp_bigquery": "GCP BigQuery",
16
- "oracle": "Oracle",
17
- "snowflake_put": "Snowflake",
18
- "aws_dynamodb": "AWS DynamoDB",
19
- "azure_blob_storage": "Azure Blob Storage",
20
- "aws_s3": "AWS S3",
21
- "cassandra": "Cassandra",
22
- "gcp_cloud_storage": "GCP Cloud Storage",
23
- "amqp": "AMQP",
24
- "avro": "Avro",
25
- "awk": "AWK",
26
- "aws_lambda": "AWS Lambda",
27
- "azure_queue_storage": "Azure Queue Storage",
28
- "clickhouse": "ClickHouse",
29
- "cockroachdb_changefeed": "CockroachDB",
30
- "couchbase": "Couchbase",
31
- "csv": "CSV",
32
- "discord": "Discord",
33
- "elasticsearch": "Elasticsearch",
34
- "kafka_franz": "Franz-go",
35
- "gcp_pubsub": "GCP Pub/Sub",
36
- "grok": "Grok",
37
- "hdfs": "HDFS",
38
- "http": "HTTP",
39
- "javascript": "JavaScript",
40
- "jmespath": "JMESPath",
41
- "json_schema": "JSON Schema",
42
- "kafka": "Kafka",
43
- "memcached": "Memcached",
44
- "msgpack": "MessagePack",
45
- "mongodb": "MongoDB",
46
- "mqtt": "MQTT",
47
- "mysql": "MySQL",
48
- "nats": "NATS",
49
- "nsq": "NSQ",
50
- "opensearch": "OpenSearch",
51
- "parquet": "Parquet",
52
- "postgresql": "PostgreSQL",
53
- "protobuf": "Protobuf",
54
- "pulsar": "Pulsar",
55
- "redis": "Redis",
56
- "ristretto": "Ristretto",
57
- "schema_registry": "Schema Registry",
58
- "sentry": "Sentry",
59
- "splunk_hec": "Splunk",
60
- "snowflake_put": "Snowflake",
61
- "socket": "Socket",
62
- "sql": "SQL",
63
- "sqlite": "SQLite",
64
- "trino": "Trino",
65
- "wasm": "WebAssembly",
66
- "websocket": "WebSocket",
67
- "twitter_search": "X/Twitter",
68
- "xml": "XML"
69
- };
70
-
71
- const certifiedConnectors = {
72
- "amqp_0_9": ["input", "output"],
73
- "archive": ["processor"],
74
- "aws_dynamodb_partiql": ["processor"],
75
- "aws_kinesis": ["input", "output"],
76
- "aws_kinesis_firehose": ["output"],
77
- "aws_lambda": ["processor"],
78
- "aws_s3": ["input", "output"],
79
- "aws_sqs": ["input", "output"],
80
- "bloblang": ["processor"],
81
- "bounds_check": ["processor"],
82
- "cache": ["processor"],
83
- "cached": ["processor"],
84
- "command": ["processor"],
85
- "compress": ["processor"],
86
- "csv": ["input"],
87
- "decompress": ["processor"],
88
- "dedupe": ["processor"],
89
- "file": ["input", "output"],
90
- "generate": ["input"],
91
- "group_by": ["processor"],
92
- "group_by_value": ["processor"],
93
- "http": ["processor"],
94
- "http_client": ["input", "output"],
95
- "http_server": ["input", "output"],
96
- "javascript": ["processor"],
97
- "jmespath": ["processor"],
98
- "jq": ["processor"],
99
- "json_schema": ["processor"],
100
- "kafka": ["input", "output"],
101
- "kafka_franz": ["input", "output"],
102
- "log": ["processor"],
103
- "mapping": ["processor"],
104
- "metric": ["processor"],
105
- "mutation": ["processor"],
106
- "nats": ["input", "output"],
107
- "nats_jetstream": ["input", "output"],
108
- "nats_kv": ["input", "output", "processor"],
109
- "nats_request_reply": ["processor"],
110
- "opensearch": ["output"],
111
- "parquet_decode": ["processor"],
112
- "parquet_encode": ["processor"],
113
- "protobuf": ["processor"],
114
- "rate_limit": ["processor"],
115
- "redis": ["processor"],
116
- "redis_hash": ["output"],
117
- "redis_list": ["input", "output"],
118
- "redis_pubsub": ["input", "output"],
119
- "redis_script": ["processor"],
120
- "redis_streams": ["input", "output"],
121
- "schema_registry_decode": ["processor"],
122
- "schema_registry_encode": ["processor"],
123
- "select_parts": ["processor"],
124
- "sftp": ["output"],
125
- "sleep": ["processor"],
126
- "socket": ["input", "output"],
127
- "socket_server": ["input", "output"],
128
- "sql_insert": ["output", "processor"],
129
- "sql_raw": ["input", "output", "processor"],
130
- "sql_select": ["input", "output", "processor"],
131
- "unarchive": ["processor"],
132
- "websocket": ["input", "output"],
133
- "workflow": ["processor"]
134
- };
4
+ const logger = this.getLogger('redpanda-connect-category-aggregation-extension')
135
5
 
136
6
  this.once('contentClassified', ({ siteCatalog, contentCatalog }) => {
137
- const redpandaConnect = contentCatalog.getComponents().find(component => component.name === 'redpanda-connect');
7
+ const redpandaConnect = contentCatalog.getComponents().find(component => component.name === 'redpanda-connect')
138
8
  if (!redpandaConnect || !redpandaConnect.latest) {
139
- logger.info('Could not find the redpanda-connect component');
140
- return;
9
+ logger.info('Could not find the redpanda-connect component')
10
+ return
141
11
  }
142
12
 
143
- const descriptions = redpandaConnect.latest.asciidoc.attributes.categories;
144
- if (!descriptions) {
145
- logger.info('No categories attribute found in redpanda-connect component');
146
- return;
13
+ const descriptions = redpandaConnect.latest.asciidoc.attributes.categories
14
+ const componentNameMap = redpandaConnect.latest.asciidoc.attributes.components
15
+ const certifiedConnectors = redpandaConnect.latest.asciidoc.attributes['certified-components']
16
+
17
+ if (!descriptions || !componentNameMap || !certifiedConnectors) {
18
+ if (!descriptions) {
19
+ logger.error('No categories attribute found in redpanda-connect component')
20
+ }
21
+ if (!componentNameMap) {
22
+ logger.error('No components attribute found in redpanda-connect component')
23
+ }
24
+ if (!certifiedConnectors) {
25
+ logger.error('No certified-components attribute found in redpanda-connect component')
26
+ }
27
+ return
147
28
  }
148
29
 
149
- const connectCategoriesData = {};
150
- const flatComponentsData = [];
151
- const driverSupportData = {};
152
- const cacheSupportData = {};
153
- const types = Object.keys(descriptions);
30
+ const connectCategoriesData = {}
31
+ const flatComponentsData = []
32
+ const driverSupportData = {}
33
+ const cacheSupportData = {}
34
+ const types = Object.keys(descriptions)
154
35
 
155
36
  // Initialize connectCategoriesData for each type
156
37
  types.forEach(type => {
157
- connectCategoriesData[type] = [];
158
- });
38
+ connectCategoriesData[type] = []
39
+ })
159
40
 
160
41
  try {
161
- const files = contentCatalog.findBy({ component: 'redpanda-connect', family: 'page' });
42
+ const files = contentCatalog.findBy({ component: 'redpanda-connect', family: 'page' })
162
43
 
163
44
  files.forEach(file => {
164
- let content = file.contents.toString('utf8');
165
- const categoryMatch = /:categories: (.*)/.exec(content);
166
- const typeMatch = /:type: (.*)/.exec(content);
167
- const statusMatch = /:status: (.*)/.exec(content);
168
- const driverSupportMatch = /:driver-support: (.*)/.exec(content);
169
- const cacheSupportMatch = /:cache-support: (.*)/.exec(content);
170
- const enterpriseMatch = /:enterprise: true/.exec(content);
171
- const pubUrl = file.pub.url;
172
- const name = file.src.stem;
45
+ let content = file.contents.toString('utf8')
46
+ const categoryMatch = /:categories: (.*)/.exec(content)
47
+ const typeMatch = /:type: (.*)/.exec(content)
48
+ const statusMatch = /:status: (.*)/.exec(content)
49
+ const driverSupportMatch = /:driver-support: (.*)/.exec(content)
50
+ const cacheSupportMatch = /:cache-support: (.*)/.exec(content)
51
+ const enterpriseMatch = /:enterprise: true/.exec(content)
52
+ const pubUrl = file.pub.url
53
+ const name = file.src.stem
173
54
 
174
55
  if (typeMatch) {
175
- const fileType = typeMatch[1];
56
+ const fileType = typeMatch[1]
176
57
 
177
- let status = statusMatch ? statusMatch[1] : 'community';
178
- //if (status === 'beta' || status === 'experimental') status = 'community';
179
- //if (status === 'stable') status = 'certified';
58
+ let status = statusMatch ? statusMatch[1] : 'community'
180
59
 
181
60
  // Skip deprecated components
182
- if (status === 'deprecated') return;
61
+ if (status === 'deprecated') return
62
+
63
+ const isCertified = certifiedConnectors.some(connector => connector.name === name)
183
64
 
184
65
  // Override status to "certified" if in the lookup table
185
- if (certifiedConnectors[name] && certifiedConnectors[name].includes(fileType) || enterpriseMatch) {
186
- status = 'certified';
66
+ if (isCertified || enterpriseMatch) {
67
+ status = 'certified'
187
68
  } else {
188
- status = 'community';
69
+ status = 'community'
189
70
  }
190
71
 
191
- const commonName = componentNameMap?.[name] ?? name;
72
+ // Find the common name
73
+ const componentNameEntry = componentNameMap.find(component => component.key === name)
74
+ const commonName = componentNameEntry ? componentNameEntry.name : name
192
75
 
193
76
  // Populate connectCategoriesData
194
77
  if (types.includes(fileType) && categoryMatch) {
195
- const categories = categoryMatch[1].replace(/[\[\]"]/g, '').split(',').map(category => category.trim());
78
+ const categories = categoryMatch[1].replace(/[\[\]"]/g, '').split(',').map(category => category.trim())
196
79
  categories.forEach(category => {
197
- let categoryObj = connectCategoriesData[fileType].find(cat => cat.name === category);
80
+ let categoryObj = connectCategoriesData[fileType].find(cat => cat.name === category)
198
81
 
199
82
  if (!categoryObj) {
200
- categoryObj = descriptions[fileType].find(desc => desc.name === category) || { name: category, description: "" };
201
- categoryObj.items = [];
202
- connectCategoriesData[fileType].push(categoryObj);
83
+ categoryObj = descriptions[fileType].find(desc => desc.name === category) || { name: category, description: "" }
84
+ categoryObj.items = []
85
+ connectCategoriesData[fileType].push(categoryObj)
203
86
  }
204
87
 
205
- categoryObj.items.push({ name: commonName, url: pubUrl, status: status });
206
- });
88
+ categoryObj.items.push({ name: commonName, url: pubUrl, status: status })
89
+ })
207
90
  }
208
91
 
209
92
  // Populate flatComponentsData
210
- let flatItem = flatComponentsData.find(item => item.name === commonName);
93
+ let flatItem = flatComponentsData.find(item => item.name === commonName)
211
94
  if (!flatItem) {
212
- flatItem = { name: commonName, originalName: name, support: status, types: [], enterprise: enterpriseMatch ? true : false};
213
- flatComponentsData.push(flatItem);
95
+ flatItem = { name: commonName, originalName: name, support: status, types: [], enterprise: enterpriseMatch ? true : false}
96
+ flatComponentsData.push(flatItem)
214
97
  }
215
98
 
216
99
  if (!flatItem.types.some(type => type.type === fileType)) {
217
- flatItem.types.push({ type: fileType, url: pubUrl, enterprise: enterpriseMatch? true : false, support: status});
100
+ flatItem.types.push({ type: fileType, url: pubUrl, enterprise: enterpriseMatch? true : false, support: status})
218
101
  }
219
102
 
220
103
  // Populate support data
221
- if (driverSupportMatch) driverSupportData[name] = driverSupportMatch[1];
222
- if (cacheSupportMatch) cacheSupportData[name] = cacheSupportMatch[1];
104
+ if (driverSupportMatch) driverSupportData[name] = driverSupportMatch[1]
105
+ if (cacheSupportMatch) cacheSupportData[name] = cacheSupportMatch[1]
223
106
  }
224
- });
107
+ })
225
108
 
226
- redpandaConnect.latest.asciidoc.attributes.connectCategoriesData = connectCategoriesData;
227
- redpandaConnect.latest.asciidoc.attributes.flatComponentsData = flatComponentsData;
228
- redpandaConnect.latest.asciidoc.attributes.driverSupportData = driverSupportData;
229
- redpandaConnect.latest.asciidoc.attributes.cacheSupportData = cacheSupportData;
109
+ redpandaConnect.latest.asciidoc.attributes.connectCategoriesData = connectCategoriesData
110
+ redpandaConnect.latest.asciidoc.attributes.flatComponentsData = flatComponentsData
111
+ redpandaConnect.latest.asciidoc.attributes.driverSupportData = driverSupportData
112
+ redpandaConnect.latest.asciidoc.attributes.cacheSupportData = cacheSupportData
230
113
 
231
- logger.info(`Added Redpanda Connect data to latest Asciidoc object: ${JSON.stringify({ connectCategoriesData, flatComponentsData }, null, 2)}`);
114
+ logger.info(`Added Redpanda Connect data to latest Asciidoc object: ${JSON.stringify({ connectCategoriesData, flatComponentsData }, null, 2)}`)
232
115
  } catch (error) {
233
- logger.error(`Error processing Redpanda Connect files: ${error.message}`);
116
+ logger.error(`Error processing Redpanda Connect files: ${error.message}`)
234
117
  }
235
- });
236
- };
118
+ })
119
+ }
@@ -3,38 +3,6 @@
3
3
  module.exports.register = function (registry, context) {
4
4
  let tabsCounter = 1; // Counter for generating unique IDs
5
5
 
6
- const driverNameMap = {
7
- "gocosmos": "Azure Cosmos DB",
8
- "clickhouse": "ClickHouse",
9
- "oracle": "Oracle",
10
- "mssql": "Microsoft SQL Server",
11
- "mysql": "MYSQL",
12
- "snowflake": "Snowflake",
13
- "postgresql": "PostgreSQL",
14
- "postgres": "PostgreSQL",
15
- "sqlite": "SQLite",
16
- "trino": "Trino",
17
- }
18
-
19
- const cacheNameMap = {
20
- "aws_dynamodb": "AWS DynamoDB",
21
- "memcached": "Memcached",
22
- "redis": "Redis",
23
- "aws_s3": "AWS S3",
24
- "memory": "Memory",
25
- "ristretto": "Ristretto",
26
- "couchbase": "Couchbase",
27
- "mongodb": "MongoDB",
28
- "sql": "SQL",
29
- "file": "File",
30
- "multilevel": "Multilevel",
31
- "ttlru": "TTL LRU",
32
- "gcp_cloud_storage": "GCP Cloud Storage",
33
- "nats_kv": "NATS KV",
34
- "lru": "LRU",
35
- "noop": "Noop",
36
- };
37
-
38
6
  // Add the category tabs for components
39
7
  registry.blockMacro(function () {
40
8
  const self = this;
@@ -96,6 +64,8 @@ module.exports.register = function (registry, context) {
96
64
  self.named('component_table');
97
65
  self.process((parent, target, attrs) => {
98
66
  const flatComponentsData = context.config?.attributes?.flatComponentsData || [];
67
+ const driverNameMap = context.config?.attributes?.drivers || [];
68
+ const cacheNameMap = context.config?.attributes?.caches || [];
99
69
  const driverSupportData = context.config?.attributes?.driverSupportData || {};
100
70
  const cacheSupportData = context.config?.attributes?.cacheSupportData || {};
101
71
 
@@ -150,8 +120,9 @@ module.exports.register = function (registry, context) {
150
120
  const drivers = driverSupportData[item.originalName].split(', ');
151
121
  drivers.forEach(driverSupportPair => {
152
122
  const [driver, support] = driverSupportPair.split('=');
153
- // Map driver name to common name
154
- const driverName = driverNameMap[driver] || driver;
123
+ // Find the common name
124
+ const driverNameEntry = driverNameMap.find(driverItem => driverItem.key === driver)
125
+ const driverName = driverNameEntry ? driverNameEntry.name : driver
155
126
 
156
127
  // Filter for types of input, processor, and output only
157
128
  const filteredTypes = item.types.filter(typeOption => ['input', 'processor', 'output'].includes(typeOption.type));
@@ -174,8 +145,9 @@ module.exports.register = function (registry, context) {
174
145
  const caches = cacheSupportData[item.originalName].split(', ');
175
146
  caches.forEach(cacheSupportPair => {
176
147
  const [cache, support] = cacheSupportPair.split('=');
177
- // Map driver name to common name
178
- const cacheName = cacheNameMap[cache] || cache;
148
+ // Find the common name
149
+ const cacheNameEntry = cacheNameMap.find(cacheItem => cacheItem.key === cache)
150
+ const cacheName = cacheNameEntry ? cacheNameEntry.name : cache
179
151
 
180
152
  // Filter for types of input, processor, and output only
181
153
  const filteredTypes = item.types.filter(typeOption => ['input', 'processor', 'output'].includes(typeOption.type));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "3.4.3",
3
+ "version": "3.5.0",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",