dlw-machine-setup 0.3.2 → 0.3.3

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 (2) hide show
  1. package/bin/installer.js +26 -15
  2. package/package.json +1 -1
package/bin/installer.js CHANGED
@@ -3277,32 +3277,43 @@ async function fetchWizardOptions(token, repo) {
3277
3277
  var GITHUB_ORG = "DLW-INT-SAP-DEV";
3278
3278
  var REPO_TOPIC = "one-shot-data";
3279
3279
  async function discoverRepo(token) {
3280
- const response = await fetch(
3281
- `https://api.github.com/search/repositories?q=topic:${REPO_TOPIC}+org:${GITHUB_ORG}`,
3282
- {
3283
- headers: {
3284
- "Accept": "application/vnd.github+json",
3285
- "Authorization": `Bearer ${token}`
3280
+ const headers = {
3281
+ "Accept": "application/vnd.github+json",
3282
+ "Authorization": `Bearer ${token}`
3283
+ };
3284
+ const matched = [];
3285
+ let page = 1;
3286
+ while (true) {
3287
+ const response = await fetch(
3288
+ `https://api.github.com/orgs/${GITHUB_ORG}/repos?type=all&per_page=100&page=${page}`,
3289
+ { headers }
3290
+ );
3291
+ if (!response.ok) {
3292
+ throw new Error(
3293
+ `Failed to list organization repositories (HTTP ${response.status}). Check your GitHub token and network.`
3294
+ );
3295
+ }
3296
+ const repos = await response.json();
3297
+ if (repos.length === 0) break;
3298
+ for (const repo of repos) {
3299
+ if (repo.topics?.includes(REPO_TOPIC)) {
3300
+ matched.push(repo.full_name);
3286
3301
  }
3287
3302
  }
3288
- );
3289
- if (!response.ok) {
3290
- throw new Error(
3291
- `Failed to discover data repository (HTTP ${response.status}). Check your GitHub token and network.`
3292
- );
3303
+ if (repos.length < 100) break;
3304
+ page++;
3293
3305
  }
3294
- const data = await response.json();
3295
- if (data.total_count === 0) {
3306
+ if (matched.length === 0) {
3296
3307
  throw new Error(
3297
3308
  "No data repository found. Verify your GitHub account has access to the organization."
3298
3309
  );
3299
3310
  }
3300
- if (data.total_count > 1) {
3311
+ if (matched.length > 1) {
3301
3312
  throw new Error(
3302
3313
  "Multiple data repositories found. Contact your administrator."
3303
3314
  );
3304
3315
  }
3305
- return data.items[0].full_name;
3316
+ return matched[0];
3306
3317
  }
3307
3318
 
3308
3319
  // src/utils/data/fetch-contexts.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dlw-machine-setup",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "One-shot installer for The Machine toolchain",
5
5
  "bin": {
6
6
  "dlw-machine-setup": "bin/installer.js"