Skip to content

Commit 7d02967

Browse files
authoredAug 13, 2024
Merge pull request #6938 from segmentio/develop
Release 24.33.1
2 parents 9aa1fb8 + 6e9bac4 commit 7d02967

File tree

325 files changed

+1320
-1275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+1320
-1275
lines changed
 

‎CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Sources pages check if the source is a cloud-app, then include information about
7575

7676
## Edit pages
7777

78-
Content with in each `.md` file is markdown. For information about styling, and available extensions, see `_src/utils/formatguide.md` or the live version [here](https://segment.com/docs/utils/formatguide).
78+
Content with in each `.md` file is markdown. For information about styling, and available extensions, see `_src/utils/formatguide.md` or the live version in the [utils section of the docs](/docs/utils/formatguide).
7979

8080
## Building a preview
8181

‎scripts/catalog/updateSources.js

+32-30
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ const PAPI_URL = "https://api.segmentapis.com";
1414

1515
const regionalSupport = yaml.load(fs.readFileSync(path.resolve(__dirname, `../../src/_data/regional-support.yml`)));
1616

17-
// This file keeps a list of known test sources that show up in the system.
17+
// This file keeps a list of known test sources that show up in the system.
1818
// Because we don't have a status value for sources, they end up showing in our catalog.
1919
// We use this below to prevent them from being written to yaml.
2020
const testSources = yaml.load(fs.readFileSync(path.resolve(__dirname, `../../src/_data/catalog/test_sources.yml`)));
2121

2222

2323
const updateSources = async () => {
24-
let sources = []; // Initialize an empty array to hold all sources
25-
let sourcesUpdated = []; // Initialize an empty array to hold all sources that have been updated
26-
let regionalSourcesUpdated = []; // Initialize an empty array to hold updated source regional information
27-
let nextPageToken = "MA=="; // Set the initial page token to the first page
28-
let categories = new Set(); // Initialize an empty set to hold all categories
29-
let sourceCategories = []; // Initialize an empty array to hold all source categories
30-
31-
24+
let sources = []; // Initialize an empty array to hold all sources
25+
let sourcesUpdated = []; // Initialize an empty array to hold all sources that have been updated
26+
let regionalSourcesUpdated = []; // Initialize an empty array to hold updated source regional information
27+
let nextPageToken = "MA=="; // Set the initial page token to the first page
28+
let categories = new Set(); // Initialize an empty set to hold all categories
29+
let sourceCategories = []; // Initialize an empty array to hold all source categories
30+
31+
3232
// Get all sources from the catalog
3333
while (nextPageToken !== undefined) {
3434
const res = await getCatalog(`${PAPI_URL}/catalog/sources/`, nextPageToken);
3535
sources = sources.concat(res.data.sourcesCatalog);
3636
nextPageToken = res.data.pagination.next;
3737
}
38-
38+
3939
// Sort the sources alphabetically
4040
sources.sort((a, b) => {
4141
if (a.name.toLowerCase() < b.name.toLowerCase()) {
@@ -46,7 +46,7 @@ const updateSources = async () => {
4646
}
4747
return 0;
4848
});
49-
49+
5050
// Set the list of categories for libraries
5151
const libraryCategories = [
5252
'server',
@@ -55,20 +55,20 @@ const updateSources = async () => {
5555
'roku',
5656
'website'
5757
];
58-
58+
5959
// Here, define some sources that are real, but that we want to hide.
6060
const hiddenSources = [
6161
'amp',
6262
'factual-engine',
6363
'twilio-event-streams-beta',
6464
'ibm-watson-assistant'
6565
];
66-
66+
6767
// More regional stuff
6868
const regionalSourceEndpoint = regionalSupport.sources.endpoint;
6969
const regionalSourceRegion = regionalSupport.sources.region;
70-
71-
70+
71+
7272
// Loop through all sources and create a new object with the data we want
7373
sources.forEach(source => {
7474
let slug = slugify(source.name, "sources");
@@ -77,14 +77,14 @@ const updateSources = async () => {
7777
let regions = ['us'];
7878
let endpoints = ['us'];
7979
let mainCategory = source.categories[0] ? source.categories[0].toLowerCase() : '';
80-
80+
8181
if (libraryCategories.includes(mainCategory)) {
8282
url = `connections/sources/catalog/libraries/${mainCategory}/${slug}`;
8383
} else {
8484
url = `connections/sources/catalog/cloud-apps/${slug}`;
8585
mainCategory = 'cloud-app';
8686
}
87-
87+
8888
// Sort the settings alphabetically
8989
settings.sort((a, b) => {
9090
if (a.name.toLowerCase() < b.name.toLowerCase()) {
@@ -95,19 +95,19 @@ const updateSources = async () => {
9595
}
9696
return 0;
9797
});
98-
98+
9999
if (hiddenSources.includes(slug)) {
100100
hidden = true;
101101
}
102-
102+
103103
if (regionalSourceEndpoint.includes(slug)) {
104104
endpoints.push('eu');
105105
}
106-
106+
107107
if (regionalSourceRegion.includes(slug)) {
108108
regions.push('eu');
109109
}
110-
110+
111111
// If the source ID is in the list of test sources, skip it.
112112
// If it's not, add it to the list of sources to be written to yaml.
113113
if (testSources.includes(source.id)) {
@@ -128,13 +128,15 @@ const updateSources = async () => {
128128
url: source.logos.default
129129
},
130130
categories: source.categories,
131+
status: source.status,
132+
partnerOwned: source.partnerOwned
131133
};
132134
sourcesUpdated.push(updatedSource);
133135
doesCatalogItemExist(updatedSource);
134136
}
135-
137+
136138
source.categories.reduce((s, e) => s.add(e), categories);
137-
139+
138140
// Sources don't yet have regional information in the Public API, so we write that info here.
139141
let updatedRegional = {
140142
id: source.id,
@@ -147,7 +149,7 @@ const updateSources = async () => {
147149
};
148150
regionalSourcesUpdated.push(updatedRegional);
149151
});
150-
152+
151153
const sourceArray = Array.from(categories);
152154
sourceArray.forEach(category => {
153155
sourceCategories.push({
@@ -164,36 +166,36 @@ const updateSources = async () => {
164166
return 0;
165167
});
166168
});
167-
169+
168170
const options = {
169171
noArrayIndent: false
170172
};
171173
const todayDate = new Date().toISOString().slice(0, 10);
172-
174+
173175
// Create source catalog YAML file
174176
let output = "# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT\n";
175177
output += "# sources last updated " + todayDate + " \n";
176178
output += yaml.dump({
177179
items: sourcesUpdated
178180
}, options);
179181
fs.writeFileSync(path.resolve(__dirname, `../../src/_data/catalog/sources.yml`), output);
180-
182+
181183
// Create source-category mapping YAML file
182184
output = "# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT\n";
183185
output += "# source categories last updated " + todayDate + " \n";
184186
output += yaml.dump({
185187
items: sourceCategories
186188
}, options);
187189
fs.writeFileSync(path.resolve(__dirname, `../../src/_data/catalog/source_categories.yml`), output);
188-
190+
189191
// Create regional support YAML file
190192
output = yaml.dump({
191193
sources: regionalSourcesUpdated
192194
}, options);
193195
fs.writeFileSync(path.resolve(__dirname, `../../src/_data/catalog/regional-supported.yml`), output);
194-
196+
195197
console.log("sources done");
196198
};
197199

198200

199-
exports.updateSources = updateSources;
201+
exports.updateSources = updateSources;

0 commit comments

Comments
 (0)
Please sign in to comment.