@adonisjs/content 1.4.0 → 1.6.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.
|
@@ -11,15 +11,16 @@ import { dirname } from "path";
|
|
|
11
11
|
async function fetchAllSponsors({
|
|
12
12
|
login,
|
|
13
13
|
isOrg,
|
|
14
|
-
ghToken
|
|
14
|
+
ghToken,
|
|
15
|
+
includeInactive
|
|
15
16
|
}) {
|
|
16
17
|
let hasNext = true;
|
|
17
18
|
let cursor = null;
|
|
18
19
|
const allSponsors = [];
|
|
19
20
|
const query = `
|
|
20
|
-
query($login: String!, $cursor: String) {
|
|
21
|
+
query($login: String!, $cursor: String, $activeOnly: Boolean) {
|
|
21
22
|
${isOrg ? `organization(login: $login)` : `user(login: $login)`} {
|
|
22
|
-
sponsorshipsAsMaintainer(first: 100, after: $cursor) {
|
|
23
|
+
sponsorshipsAsMaintainer(first: 100, after: $cursor, activeOnly: $activeOnly) {
|
|
23
24
|
nodes {
|
|
24
25
|
id
|
|
25
26
|
createdAt
|
|
@@ -60,7 +61,8 @@ async function fetchAllSponsors({
|
|
|
60
61
|
authorization: `token ${ghToken}`
|
|
61
62
|
},
|
|
62
63
|
login,
|
|
63
|
-
cursor
|
|
64
|
+
cursor,
|
|
65
|
+
activeOnly: includeInactive === true ? false : true
|
|
64
66
|
});
|
|
65
67
|
const root = isOrg ? data.organization : data.user;
|
|
66
68
|
if (!root) {
|
|
@@ -75,6 +77,7 @@ async function fetchAllSponsors({
|
|
|
75
77
|
allSponsors.push({
|
|
76
78
|
id: node.id,
|
|
77
79
|
createdAt: node.createdAt,
|
|
80
|
+
isActive: node.isActive,
|
|
78
81
|
privacyLevel: node.privacyLevel,
|
|
79
82
|
tierName: node.tier?.name ?? null,
|
|
80
83
|
tierMonthlyPriceInCents: node.tier?.monthlyPriceInCents ?? null,
|
package/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
fetchContributorsForOrg,
|
|
7
7
|
fetchReleases,
|
|
8
8
|
mergeArrays
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-7MAXCXCX.js";
|
|
10
10
|
import {
|
|
11
11
|
debug_default
|
|
12
12
|
} from "../../chunk-LB6JFRVG.js";
|
|
@@ -100,21 +100,29 @@ var OssStatsLoader = class {
|
|
|
100
100
|
* ```
|
|
101
101
|
*/
|
|
102
102
|
async #fetchStats() {
|
|
103
|
-
|
|
104
|
-
let totalInstalls = 0;
|
|
103
|
+
const aggregates = [];
|
|
105
104
|
for (const source of this.#options.sources) {
|
|
106
|
-
if (source
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
if (typeof source === "function") {
|
|
106
|
+
aggregates.push(await source());
|
|
107
|
+
} else if (source.type === "github") {
|
|
108
|
+
aggregates.push({
|
|
109
|
+
key: "stars",
|
|
110
|
+
count: await aggregateStars({
|
|
111
|
+
org: source.org,
|
|
112
|
+
ghToken: source.ghToken
|
|
113
|
+
})
|
|
110
114
|
});
|
|
111
|
-
totalStars += stars;
|
|
112
115
|
} else if (source.type === "npm") {
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
aggregates.push({
|
|
117
|
+
key: "installs",
|
|
118
|
+
count: await aggregateInstalls(source.packages)
|
|
119
|
+
});
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
|
-
return {
|
|
122
|
+
return aggregates.reduce((result, { key, count }) => {
|
|
123
|
+
result[key] = count;
|
|
124
|
+
return result;
|
|
125
|
+
}, {});
|
|
118
126
|
}
|
|
119
127
|
/**
|
|
120
128
|
* Loads and validates OSS statistics data.
|
package/build/src/types.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ export type GithubReleasesOptions = {
|
|
|
137
137
|
export type GithubSponsor = {
|
|
138
138
|
/** Unique identifier for the sponsorship */
|
|
139
139
|
id: string;
|
|
140
|
+
isActive: boolean;
|
|
140
141
|
/** ISO 8601 timestamp when the sponsorship was created */
|
|
141
142
|
createdAt: string;
|
|
142
143
|
/** Privacy level of the sponsorship (PUBLIC, PRIVATE, etc.) */
|
|
@@ -173,6 +174,7 @@ export type GithubSponsor = {
|
|
|
173
174
|
export type GithubSponsorsOptions = {
|
|
174
175
|
/** GitHub username or organization name */
|
|
175
176
|
login: string;
|
|
177
|
+
includeInactive?: boolean;
|
|
176
178
|
/** Whether the login is an organization (true) or user (false) */
|
|
177
179
|
isOrg: boolean;
|
|
178
180
|
/** GitHub personal access token for authentication */
|
|
@@ -294,11 +296,14 @@ export type OssStatsOptions = {
|
|
|
294
296
|
/** Source type: npm package download statistics */
|
|
295
297
|
type: 'npm';
|
|
296
298
|
/** Array of npm packages with their tracking start dates */
|
|
297
|
-
packages:
|
|
299
|
+
packages: {
|
|
298
300
|
name: string;
|
|
299
301
|
startDate: string;
|
|
300
|
-
}];
|
|
301
|
-
})
|
|
302
|
+
}[];
|
|
303
|
+
} | (() => Promise<{
|
|
304
|
+
key: string;
|
|
305
|
+
count: number;
|
|
306
|
+
}>))[];
|
|
302
307
|
};
|
|
303
308
|
/**
|
|
304
309
|
* Type representing the aggregated open source statistics
|
|
@@ -308,7 +313,7 @@ export type OssStats = {
|
|
|
308
313
|
stars: number;
|
|
309
314
|
/** Total npm package downloads across all sources */
|
|
310
315
|
installs: number;
|
|
311
|
-
}
|
|
316
|
+
} & Record<string, number>;
|
|
312
317
|
/**
|
|
313
318
|
* Represents a GitHub contributor with their profile information and contribution count.
|
|
314
319
|
* This matches the shape returned by GitHub REST API /contributors endpoint.
|
package/build/src/utils.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { type GithubSponsor, type GithubReleasesOptions, type GithubReleaseWithR
|
|
|
14
14
|
* })
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export declare function fetchAllSponsors({ login, isOrg, ghToken, }: GithubSponsorsOptions): Promise<GithubSponsor[]>;
|
|
17
|
+
export declare function fetchAllSponsors({ login, isOrg, ghToken, includeInactive, }: GithubSponsorsOptions): Promise<GithubSponsor[]>;
|
|
18
18
|
/**
|
|
19
19
|
* Fetches all releases from public repositories of a GitHub organization.
|
|
20
20
|
* Handles pagination and supports filtering releases by name patterns.
|