@redpanda-data/docs-extensions-and-macros 3.4.3 → 3.5.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.
@@ -1,236 +1,124 @@
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
+ const enterpriseConnectors = redpandaConnect.latest.asciidoc.attributes['enterprise-components']
17
+
18
+ if (!descriptions || !componentNameMap || !certifiedConnectors || !enterpriseConnectors) {
19
+ if (!descriptions) {
20
+ logger.error('No categories attribute found in redpanda-connect component')
21
+ }
22
+ if (!componentNameMap) {
23
+ logger.error('No components attribute found in redpanda-connect component')
24
+ }
25
+ if (!certifiedConnectors) {
26
+ logger.error('No certified-components attribute found in redpanda-connect component')
27
+ }
28
+ if (!enterpriseConnectors) {
29
+ logger.error('No enterprise-components attribute found in redpanda-connect component')
30
+ }
31
+ return
147
32
  }
148
33
 
149
- const connectCategoriesData = {};
150
- const flatComponentsData = [];
151
- const driverSupportData = {};
152
- const cacheSupportData = {};
153
- const types = Object.keys(descriptions);
34
+ const connectCategoriesData = {}
35
+ const flatComponentsData = []
36
+ const driverSupportData = {}
37
+ const cacheSupportData = {}
38
+ const types = Object.keys(descriptions)
154
39
 
155
40
  // Initialize connectCategoriesData for each type
156
41
  types.forEach(type => {
157
- connectCategoriesData[type] = [];
158
- });
42
+ connectCategoriesData[type] = []
43
+ })
159
44
 
160
45
  try {
161
- const files = contentCatalog.findBy({ component: 'redpanda-connect', family: 'page' });
46
+ const files = contentCatalog.findBy({ component: 'redpanda-connect', family: 'page' })
162
47
 
163
48
  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;
49
+ let content = file.contents.toString('utf8')
50
+ const categoryMatch = /:categories: (.*)/.exec(content)
51
+ const typeMatch = /:type: (.*)/.exec(content)
52
+ const statusMatch = /:status: (.*)/.exec(content)
53
+ const driverSupportMatch = /:driver-support: (.*)/.exec(content)
54
+ const cacheSupportMatch = /:cache-support: (.*)/.exec(content)
55
+ const pubUrl = file.pub.url
56
+ const name = file.src.stem
173
57
 
174
58
  if (typeMatch) {
175
- const fileType = typeMatch[1];
59
+ const fileType = typeMatch[1]
176
60
 
177
- let status = statusMatch ? statusMatch[1] : 'community';
178
- //if (status === 'beta' || status === 'experimental') status = 'community';
179
- //if (status === 'stable') status = 'certified';
61
+ let status = statusMatch ? statusMatch[1] : 'community'
180
62
 
181
63
  // Skip deprecated components
182
- if (status === 'deprecated') return;
64
+ if (status === 'deprecated') return
65
+
66
+ const isCertified = certifiedConnectors.some(connector => connector.name === name)
67
+
68
+ const isEnterprise = enterpriseConnectors.some(connector => connector === name)
183
69
 
184
70
  // Override status to "certified" if in the lookup table
185
- if (certifiedConnectors[name] && certifiedConnectors[name].includes(fileType) || enterpriseMatch) {
186
- status = 'certified';
71
+ if (isCertified || isEnterprise) {
72
+ status = 'certified'
187
73
  } else {
188
- status = 'community';
74
+ status = 'community'
189
75
  }
190
76
 
191
- const commonName = componentNameMap?.[name] ?? name;
77
+ // Find the common name
78
+ const componentNameEntry = componentNameMap.find(component => component.key === name)
79
+ const commonName = componentNameEntry ? componentNameEntry.name : name
192
80
 
193
81
  // Populate connectCategoriesData
194
82
  if (types.includes(fileType) && categoryMatch) {
195
- const categories = categoryMatch[1].replace(/[\[\]"]/g, '').split(',').map(category => category.trim());
83
+ const categories = categoryMatch[1].replace(/[\[\]"]/g, '').split(',').map(category => category.trim())
196
84
  categories.forEach(category => {
197
- let categoryObj = connectCategoriesData[fileType].find(cat => cat.name === category);
85
+ let categoryObj = connectCategoriesData[fileType].find(cat => cat.name === category)
198
86
 
199
87
  if (!categoryObj) {
200
- categoryObj = descriptions[fileType].find(desc => desc.name === category) || { name: category, description: "" };
201
- categoryObj.items = [];
202
- connectCategoriesData[fileType].push(categoryObj);
88
+ categoryObj = descriptions[fileType].find(desc => desc.name === category) || { name: category, description: "" }
89
+ categoryObj.items = []
90
+ connectCategoriesData[fileType].push(categoryObj)
203
91
  }
204
92
 
205
- categoryObj.items.push({ name: commonName, url: pubUrl, status: status });
206
- });
93
+ categoryObj.items.push({ name: commonName, url: pubUrl, status: status })
94
+ })
207
95
  }
208
96
 
209
97
  // Populate flatComponentsData
210
- let flatItem = flatComponentsData.find(item => item.name === commonName);
98
+ let flatItem = flatComponentsData.find(item => item.name === commonName)
211
99
  if (!flatItem) {
212
- flatItem = { name: commonName, originalName: name, support: status, types: [], enterprise: enterpriseMatch ? true : false};
213
- flatComponentsData.push(flatItem);
100
+ flatItem = { name: commonName, originalName: name, support: status, types: [], enterprise: isEnterprise ? true : false}
101
+ flatComponentsData.push(flatItem)
214
102
  }
215
103
 
216
104
  if (!flatItem.types.some(type => type.type === fileType)) {
217
- flatItem.types.push({ type: fileType, url: pubUrl, enterprise: enterpriseMatch? true : false, support: status});
105
+ flatItem.types.push({ type: fileType, url: pubUrl, enterprise: isEnterprise? true : false, support: status})
218
106
  }
219
107
 
220
108
  // Populate support data
221
- if (driverSupportMatch) driverSupportData[name] = driverSupportMatch[1];
222
- if (cacheSupportMatch) cacheSupportData[name] = cacheSupportMatch[1];
109
+ if (driverSupportMatch) driverSupportData[name] = driverSupportMatch[1]
110
+ if (cacheSupportMatch) cacheSupportData[name] = cacheSupportMatch[1]
223
111
  }
224
- });
112
+ })
225
113
 
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;
114
+ redpandaConnect.latest.asciidoc.attributes.connectCategoriesData = connectCategoriesData
115
+ redpandaConnect.latest.asciidoc.attributes.flatComponentsData = flatComponentsData
116
+ redpandaConnect.latest.asciidoc.attributes.driverSupportData = driverSupportData
117
+ redpandaConnect.latest.asciidoc.attributes.cacheSupportData = cacheSupportData
230
118
 
231
- logger.info(`Added Redpanda Connect data to latest Asciidoc object: ${JSON.stringify({ connectCategoriesData, flatComponentsData }, null, 2)}`);
119
+ logger.info(`Added Redpanda Connect data to latest Asciidoc object: ${JSON.stringify({ connectCategoriesData, flatComponentsData }, null, 2)}`)
232
120
  } catch (error) {
233
- logger.error(`Error processing Redpanda Connect files: ${error.message}`);
121
+ logger.error(`Error processing Redpanda Connect files: ${error.message}`)
234
122
  }
235
- });
236
- };
123
+ })
124
+ }
@@ -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.1",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",