@nextop-os/daily-tech-radar 0.1.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.
- package/README.md +12 -0
- package/dist/index.d.ts +189 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @nextop-os/daily-tech-radar
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { DailyTechRadarClient } from "@nextop-os/daily-tech-radar";
|
|
5
|
+
|
|
6
|
+
const client = new DailyTechRadarClient();
|
|
7
|
+
const latest = await client.productHunt.latest("zh-CN");
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The client reads from jsDelivr by default and accepts an optional `baseUrl` for
|
|
11
|
+
tests or private mirrors.
|
|
12
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
export type Locale = "en-US" | "zh-CN";
|
|
2
|
+
export type TrendSource = "producthunt" | "github";
|
|
3
|
+
export type TrendMedia = {
|
|
4
|
+
type: string;
|
|
5
|
+
url: string;
|
|
6
|
+
videoUrl?: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type DailyTrendFeedItem = {
|
|
9
|
+
rank: number;
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
tagline: string;
|
|
13
|
+
description: string;
|
|
14
|
+
keywords: string[];
|
|
15
|
+
metrics: Record<string, number>;
|
|
16
|
+
links: {
|
|
17
|
+
homepage?: string | null;
|
|
18
|
+
source: string;
|
|
19
|
+
};
|
|
20
|
+
assets: {
|
|
21
|
+
icon?: string | null;
|
|
22
|
+
thumbnail?: string | null;
|
|
23
|
+
media: TrendMedia[];
|
|
24
|
+
};
|
|
25
|
+
raw: Record<string, unknown>;
|
|
26
|
+
};
|
|
27
|
+
export type DailyTrendFeed = {
|
|
28
|
+
schemaVersion: "daily-tech-radar.v1";
|
|
29
|
+
source: "producthunt";
|
|
30
|
+
locale: Locale;
|
|
31
|
+
date: string;
|
|
32
|
+
sourceTimezone: string;
|
|
33
|
+
generatedAt: string;
|
|
34
|
+
items: DailyTrendFeedItem[];
|
|
35
|
+
};
|
|
36
|
+
export type GitHubTrendRepo = {
|
|
37
|
+
id: string;
|
|
38
|
+
owner: string;
|
|
39
|
+
name: string;
|
|
40
|
+
url: string;
|
|
41
|
+
avatarUrl?: string | null;
|
|
42
|
+
homepageUrl?: string | null;
|
|
43
|
+
source: {
|
|
44
|
+
primary: "github_trending_html" | "huchenme_api" | "github_search";
|
|
45
|
+
sourceRank: number;
|
|
46
|
+
starsGained: number;
|
|
47
|
+
};
|
|
48
|
+
metadata: {
|
|
49
|
+
description: string;
|
|
50
|
+
language: string;
|
|
51
|
+
topics: string[];
|
|
52
|
+
stars: number;
|
|
53
|
+
forks?: number;
|
|
54
|
+
license?: string | null;
|
|
55
|
+
defaultBranch?: string | null;
|
|
56
|
+
pushedAt?: string | null;
|
|
57
|
+
topLanguages?: string[];
|
|
58
|
+
};
|
|
59
|
+
readmeRef: {
|
|
60
|
+
status: "available" | "missing" | "rate_limited" | "unknown";
|
|
61
|
+
path?: string | null;
|
|
62
|
+
sha?: string | null;
|
|
63
|
+
rawUrl?: string | null;
|
|
64
|
+
};
|
|
65
|
+
readmeSignals: {
|
|
66
|
+
title?: string | null;
|
|
67
|
+
summary?: string | null;
|
|
68
|
+
headings: string[];
|
|
69
|
+
commands: string[];
|
|
70
|
+
keywords: string[];
|
|
71
|
+
score: number;
|
|
72
|
+
};
|
|
73
|
+
visual: {
|
|
74
|
+
kind: "readme_image" | "agnes_generated" | "repository_avatar" | "none";
|
|
75
|
+
url?: string | null;
|
|
76
|
+
thumbUrl?: string | null;
|
|
77
|
+
alt?: string | null;
|
|
78
|
+
sourceUrl?: string | null;
|
|
79
|
+
promptHash?: string | null;
|
|
80
|
+
};
|
|
81
|
+
classification: {
|
|
82
|
+
primaryCategoryId: string;
|
|
83
|
+
secondaryCategoryIds: string[];
|
|
84
|
+
confidence: number;
|
|
85
|
+
method: "rules" | "rules_readme" | "llm" | "manual_override";
|
|
86
|
+
reasons: string[];
|
|
87
|
+
signals: string[];
|
|
88
|
+
};
|
|
89
|
+
rank: {
|
|
90
|
+
globalRank: number;
|
|
91
|
+
categoryRank?: number;
|
|
92
|
+
score: number;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export type GitHubTrendView = {
|
|
96
|
+
id: string;
|
|
97
|
+
type: "category" | "curated" | "review";
|
|
98
|
+
label: string;
|
|
99
|
+
categoryId?: string;
|
|
100
|
+
repoIds: string[];
|
|
101
|
+
sort?: "score" | "globalRank" | "starsGained" | "confidence";
|
|
102
|
+
};
|
|
103
|
+
export type DailyTrendPackage = {
|
|
104
|
+
schemaVersion: "trendreader.daily.v1";
|
|
105
|
+
packageId: string;
|
|
106
|
+
locale: Locale;
|
|
107
|
+
generatedAt: string;
|
|
108
|
+
expiresAt: string;
|
|
109
|
+
sourceWindow: {
|
|
110
|
+
since: "daily" | "weekly" | "monthly";
|
|
111
|
+
language: string;
|
|
112
|
+
spokenLanguageCode?: string | null;
|
|
113
|
+
};
|
|
114
|
+
sources: Array<{
|
|
115
|
+
id: "github_trending_html" | "huchenme_api" | "github_search" | "github_rest";
|
|
116
|
+
role: "candidate" | "fallback" | "enrichment";
|
|
117
|
+
status: "ok" | "partial" | "failed" | "skipped";
|
|
118
|
+
itemCount?: number;
|
|
119
|
+
rateLimit?: {
|
|
120
|
+
limit?: number;
|
|
121
|
+
remaining?: number;
|
|
122
|
+
};
|
|
123
|
+
}>;
|
|
124
|
+
taxonomy: {
|
|
125
|
+
version: string;
|
|
126
|
+
generatedAt: string;
|
|
127
|
+
categories: Array<{
|
|
128
|
+
id: string;
|
|
129
|
+
label: string;
|
|
130
|
+
labelEn?: string;
|
|
131
|
+
icon: string;
|
|
132
|
+
order: number;
|
|
133
|
+
description?: string;
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
repos: GitHubTrendRepo[];
|
|
137
|
+
views?: GitHubTrendView[];
|
|
138
|
+
health?: {
|
|
139
|
+
status: "ok" | "partial" | "degraded";
|
|
140
|
+
candidateCount: number;
|
|
141
|
+
enrichedRepoCount: number;
|
|
142
|
+
unclassifiedRepoCount: number;
|
|
143
|
+
warnings: string[];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
export type TrendIndex = {
|
|
147
|
+
schemaVersion: "daily-tech-radar.index.v1";
|
|
148
|
+
source: TrendSource;
|
|
149
|
+
locale: Locale;
|
|
150
|
+
latestDate: string | null;
|
|
151
|
+
dates: string[];
|
|
152
|
+
generatedAt: string;
|
|
153
|
+
};
|
|
154
|
+
export type DailyTechRadarClientOptions = {
|
|
155
|
+
baseUrl?: string;
|
|
156
|
+
fetch?: typeof fetch;
|
|
157
|
+
};
|
|
158
|
+
export declare const DEFAULT_BASE_URL = "https://cdn.jsdelivr.net/gh/nextop-os/daily-tech-radar@main/data";
|
|
159
|
+
export declare class DailyTechRadarClient {
|
|
160
|
+
readonly baseUrl: string;
|
|
161
|
+
private readonly fetchImpl;
|
|
162
|
+
readonly productHunt: {
|
|
163
|
+
latest: (locale?: Locale) => Promise<DailyTrendFeed>;
|
|
164
|
+
byDate: (date: string, locale?: Locale) => Promise<DailyTrendFeed>;
|
|
165
|
+
index: (locale?: Locale) => Promise<TrendIndex>;
|
|
166
|
+
};
|
|
167
|
+
readonly github: {
|
|
168
|
+
latest: (locale?: Locale) => Promise<DailyTrendPackage>;
|
|
169
|
+
byDate: (date: string, locale?: Locale) => Promise<DailyTrendPackage>;
|
|
170
|
+
index: (locale?: Locale) => Promise<TrendIndex>;
|
|
171
|
+
};
|
|
172
|
+
constructor(options?: DailyTechRadarClientOptions);
|
|
173
|
+
fetchLatest(options: {
|
|
174
|
+
source: TrendSource;
|
|
175
|
+
locale: Locale;
|
|
176
|
+
}): Promise<DailyTrendFeed | DailyTrendPackage>;
|
|
177
|
+
fetchByDate(options: {
|
|
178
|
+
source: TrendSource;
|
|
179
|
+
locale: Locale;
|
|
180
|
+
date: string;
|
|
181
|
+
}): Promise<DailyTrendFeed | DailyTrendPackage>;
|
|
182
|
+
fetchIndex(options: {
|
|
183
|
+
source: TrendSource;
|
|
184
|
+
locale: Locale;
|
|
185
|
+
}): Promise<TrendIndex>;
|
|
186
|
+
private urlFor;
|
|
187
|
+
private fetchJson;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AACvC,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE;QACL,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,KAAK,EAAE,UAAU,EAAE,CAAC;KACrB,CAAC;IAC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,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,GAAG,iBAAiB,CAAC;IAI1G,WAAW,CAAC,OAAO,EAAE;QACzB,MAAM,EAAE,WAAW,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,cAAc,GAAG,iBAAiB,CAAC;IAIzC,UAAU,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAIvF,OAAO,CAAC,MAAM;YAIA,SAAS;CAOxB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const DEFAULT_BASE_URL = "https://cdn.jsdelivr.net/gh/nextop-os/daily-tech-radar@main/data";
|
|
2
|
+
export class DailyTechRadarClient {
|
|
3
|
+
baseUrl;
|
|
4
|
+
fetchImpl;
|
|
5
|
+
productHunt = {
|
|
6
|
+
latest: (locale = "en-US") => this.fetchLatest({ source: "producthunt", locale }),
|
|
7
|
+
byDate: (date, locale = "en-US") => this.fetchByDate({ source: "producthunt", locale, date }),
|
|
8
|
+
index: (locale = "en-US") => this.fetchIndex({ source: "producthunt", locale })
|
|
9
|
+
};
|
|
10
|
+
github = {
|
|
11
|
+
latest: (locale = "en-US") => this.fetchLatest({ source: "github", locale }),
|
|
12
|
+
byDate: (date, locale = "en-US") => this.fetchByDate({ source: "github", locale, date }),
|
|
13
|
+
index: (locale = "en-US") => this.fetchIndex({ source: "github", locale })
|
|
14
|
+
};
|
|
15
|
+
constructor(options = {}) {
|
|
16
|
+
this.baseUrl = trimTrailingSlash(options.baseUrl ?? DEFAULT_BASE_URL);
|
|
17
|
+
this.fetchImpl = options.fetch ?? fetch;
|
|
18
|
+
}
|
|
19
|
+
async fetchLatest(options) {
|
|
20
|
+
return this.fetchJson(this.urlFor(options.source, options.locale, "latest.json"));
|
|
21
|
+
}
|
|
22
|
+
async fetchByDate(options) {
|
|
23
|
+
return this.fetchJson(this.urlFor(options.source, options.locale, `${options.date}.json`));
|
|
24
|
+
}
|
|
25
|
+
async fetchIndex(options) {
|
|
26
|
+
return this.fetchJson(this.urlFor(options.source, options.locale, "index.json"));
|
|
27
|
+
}
|
|
28
|
+
urlFor(source, locale, fileName) {
|
|
29
|
+
return `${this.baseUrl}/${source}/${locale}/${fileName}`;
|
|
30
|
+
}
|
|
31
|
+
async fetchJson(url) {
|
|
32
|
+
const response = await this.fetchImpl(url);
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(`DailyTechRadar request failed: ${response.status} ${response.statusText}`);
|
|
35
|
+
}
|
|
36
|
+
return (await response.json());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function trimTrailingSlash(value) {
|
|
40
|
+
return value.replace(/\/+$/, "");
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmKA,MAAM,CAAC,MAAM,gBAAgB,GAAG,kEAAkE,CAAC;AAEnG,MAAM,OAAO,oBAAoB;IACtB,OAAO,CAAS;IACR,SAAS,CAAe;IAEhC,WAAW,GAAG;QACrB,MAAM,EAAE,CAAC,SAAiB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAA4B;QACpH,MAAM,EAAE,CAAC,IAAY,EAAE,SAAiB,OAAO,EAAE,EAAE,CACjD,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAA4B;QACtF,KAAK,EAAE,CAAC,SAAiB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,M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IAEO,MAAM,CAAC,MAAmB,EAAE,MAAc,EAAE,QAAgB;QAClE,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;IAC3D,CAAC;IAEO,KAAK,CAAC,SAAS,CAAI,GAAW;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC9F,CAAC;QACD,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAM,CAAC;IACtC,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nextop-os/daily-tech-radar",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SDK for reading Nextop Daily Tech Radar trend data.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/nextop-os/daily-tech-radar.git",
|
|
11
|
+
"directory": "packages/sdk"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/nextop-os/daily-tech-radar#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/nextop-os/daily-tech-radar/issues"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"nextop",
|
|
22
|
+
"producthunt",
|
|
23
|
+
"github-trending",
|
|
24
|
+
"trends",
|
|
25
|
+
"sdk"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -p tsconfig.json",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
42
|
+
}
|
|
43
|
+
}
|