@indiciaosint/sdk 1.2.0 → 1.2.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.
- package/esm/funcs/socials-search-github.d.ts +3 -2
- package/esm/funcs/socials-search-github.d.ts.map +1 -1
- package/esm/funcs/socials-search-github.js +11 -3
- package/esm/funcs/socials-search-github.js.map +1 -1
- package/esm/funcs/socials-search-username.d.ts +3 -2
- package/esm/funcs/socials-search-username.d.ts.map +1 -1
- package/esm/funcs/socials-search-username.js +11 -3
- package/esm/funcs/socials-search-username.js.map +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/operations/search-face.d.ts +4 -4
- package/esm/models/operations/search-face.d.ts.map +1 -1
- package/esm/models/operations/search-face.js +4 -5
- package/esm/models/operations/search-face.js.map +1 -1
- package/esm/models/operations/search-github.d.ts +69 -7
- package/esm/models/operations/search-github.d.ts.map +1 -1
- package/esm/models/operations/search-github.js +83 -9
- package/esm/models/operations/search-github.js.map +1 -1
- package/esm/models/operations/search-username.d.ts +429 -13
- package/esm/models/operations/search-username.d.ts.map +1 -1
- package/esm/models/operations/search-username.js +725 -13
- package/esm/models/operations/search-username.js.map +1 -1
- package/esm/sdk/socials.d.ts +5 -4
- package/esm/sdk/socials.d.ts.map +1 -1
- package/esm/sdk/socials.js +2 -2
- package/esm/sdk/socials.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/socials-search-github.ts +21 -6
- package/src/funcs/socials-search-username.ts +23 -6
- package/src/lib/config.ts +2 -2
- package/src/models/operations/search-face.ts +15 -13
- package/src/models/operations/search-github.ts +225 -41
- package/src/models/operations/search-username.ts +1667 -77
- package/src/sdk/socials.ts +5 -4
|
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { smartUnion } from "../../types/smart-union.js";
|
|
10
11
|
import { SDKValidationError } from "../errors/sdk-validation-error.js";
|
|
11
12
|
|
|
12
13
|
export type SearchGithubRequest = {
|
|
@@ -14,6 +15,25 @@ export type SearchGithubRequest = {
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export type SearchGithubData = {
|
|
18
|
+
status: "error";
|
|
19
|
+
success: false;
|
|
20
|
+
/**
|
|
21
|
+
* Human-readable error message.
|
|
22
|
+
*/
|
|
23
|
+
error: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A data-only event indicating the search failed.
|
|
28
|
+
*/
|
|
29
|
+
export type SearchGithubErrorEvent = {
|
|
30
|
+
data: SearchGithubData;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Completed GitHub profile, commit stats, and discovered emails.
|
|
35
|
+
*/
|
|
36
|
+
export type GithubInfo = {
|
|
17
37
|
avatarUrl: string | null;
|
|
18
38
|
bio: string | null;
|
|
19
39
|
commitEmails: { [k: string]: Array<string> };
|
|
@@ -30,17 +50,54 @@ export type SearchGithubData = {
|
|
|
30
50
|
publicGists: number;
|
|
31
51
|
publicRepos: number;
|
|
32
52
|
username: string;
|
|
53
|
+
/**
|
|
54
|
+
* Activity log id for this search, or null.
|
|
55
|
+
*/
|
|
56
|
+
activityId?: string | null | undefined;
|
|
33
57
|
};
|
|
34
58
|
|
|
35
59
|
/**
|
|
36
|
-
*
|
|
60
|
+
* Terminal `result` event with the completed GitHub profile.
|
|
37
61
|
*/
|
|
38
|
-
export type
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
62
|
+
export type ResultEvent = {
|
|
63
|
+
/**
|
|
64
|
+
* Completed GitHub profile, commit stats, and discovered emails.
|
|
65
|
+
*/
|
|
66
|
+
data: GithubInfo;
|
|
67
|
+
event: "result";
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Keep-alive emitted roughly every 15s as the `heartbeat` event.
|
|
72
|
+
*/
|
|
73
|
+
export type HeartbeatEvent = {
|
|
74
|
+
/**
|
|
75
|
+
* Keep-alive heartbeat. Always an empty string.
|
|
76
|
+
*/
|
|
77
|
+
data: string;
|
|
78
|
+
event: "heartbeat";
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Progress update emitted as the `status` event.
|
|
83
|
+
*/
|
|
84
|
+
export type StatusEvent = {
|
|
85
|
+
/**
|
|
86
|
+
* Human-readable progress message (e.g. "Fetching commit history").
|
|
87
|
+
*/
|
|
88
|
+
data: string;
|
|
89
|
+
event: "status";
|
|
42
90
|
};
|
|
43
91
|
|
|
92
|
+
/**
|
|
93
|
+
* A Server-Sent Event. The `event:` field names the type ("status", "heartbeat", or "result"); errors are delivered as a data-only event.
|
|
94
|
+
*/
|
|
95
|
+
export type GithubSearchEvent =
|
|
96
|
+
| StatusEvent
|
|
97
|
+
| HeartbeatEvent
|
|
98
|
+
| ResultEvent
|
|
99
|
+
| SearchGithubErrorEvent;
|
|
100
|
+
|
|
44
101
|
/** @internal */
|
|
45
102
|
export type SearchGithubRequest$Outbound = {
|
|
46
103
|
query: string;
|
|
@@ -66,33 +123,11 @@ export function searchGithubRequestToJSON(
|
|
|
66
123
|
export const SearchGithubData$inboundSchema: z.ZodMiniType<
|
|
67
124
|
SearchGithubData,
|
|
68
125
|
unknown
|
|
69
|
-
> = z.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
commitRepoCount: types.number(),
|
|
75
|
-
commits: types.number(),
|
|
76
|
-
company: types.nullable(types.string()),
|
|
77
|
-
createdAt: types.nullable(types.string()),
|
|
78
|
-
followers: types.number(),
|
|
79
|
-
following: types.number(),
|
|
80
|
-
id: types.number(),
|
|
81
|
-
lastSeen: types.nullable(types.string()),
|
|
82
|
-
location: types.nullable(types.string()),
|
|
83
|
-
name: types.nullable(types.string()),
|
|
84
|
-
public_gists: types.number(),
|
|
85
|
-
public_repos: types.number(),
|
|
86
|
-
username: types.string(),
|
|
87
|
-
}),
|
|
88
|
-
z.transform((v) => {
|
|
89
|
-
return remap$(v, {
|
|
90
|
-
"avatar_url": "avatarUrl",
|
|
91
|
-
"public_gists": "publicGists",
|
|
92
|
-
"public_repos": "publicRepos",
|
|
93
|
-
});
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
126
|
+
> = z.object({
|
|
127
|
+
status: types.literal("error"),
|
|
128
|
+
success: types.literal(false),
|
|
129
|
+
error: types.string(),
|
|
130
|
+
});
|
|
96
131
|
|
|
97
132
|
export function searchGithubDataFromJSON(
|
|
98
133
|
jsonString: string,
|
|
@@ -105,21 +140,170 @@ export function searchGithubDataFromJSON(
|
|
|
105
140
|
}
|
|
106
141
|
|
|
107
142
|
/** @internal */
|
|
108
|
-
export const
|
|
109
|
-
|
|
143
|
+
export const SearchGithubErrorEvent$inboundSchema: z.ZodMiniType<
|
|
144
|
+
SearchGithubErrorEvent,
|
|
145
|
+
unknown
|
|
146
|
+
> = z.object({
|
|
147
|
+
data: z.pipe(
|
|
148
|
+
z.pipe(
|
|
149
|
+
z.unknown(),
|
|
150
|
+
z.transform((v, ctx) => {
|
|
151
|
+
if (typeof v !== "string") return v;
|
|
152
|
+
try {
|
|
153
|
+
return JSON.parse(v);
|
|
154
|
+
} catch (err) {
|
|
155
|
+
ctx.issues.push({
|
|
156
|
+
input: v,
|
|
157
|
+
code: "custom",
|
|
158
|
+
message: `malformed json: ${err}`,
|
|
159
|
+
});
|
|
160
|
+
return z.NEVER;
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
),
|
|
164
|
+
z.lazy(() => SearchGithubData$inboundSchema),
|
|
165
|
+
),
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
export function searchGithubErrorEventFromJSON(
|
|
169
|
+
jsonString: string,
|
|
170
|
+
): SafeParseResult<SearchGithubErrorEvent, SDKValidationError> {
|
|
171
|
+
return safeParse(
|
|
172
|
+
jsonString,
|
|
173
|
+
(x) => SearchGithubErrorEvent$inboundSchema.parse(JSON.parse(x)),
|
|
174
|
+
`Failed to parse 'SearchGithubErrorEvent' from JSON`,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** @internal */
|
|
179
|
+
export const GithubInfo$inboundSchema: z.ZodMiniType<GithubInfo, unknown> = z
|
|
180
|
+
.pipe(
|
|
181
|
+
z.object({
|
|
182
|
+
avatar_url: types.nullable(types.string()),
|
|
183
|
+
bio: types.nullable(types.string()),
|
|
184
|
+
commitEmails: z.record(z.string(), z.array(types.string())),
|
|
185
|
+
commitRepoCount: types.number(),
|
|
186
|
+
commits: types.number(),
|
|
187
|
+
company: types.nullable(types.string()),
|
|
188
|
+
createdAt: types.nullable(types.string()),
|
|
189
|
+
followers: types.number(),
|
|
190
|
+
following: types.number(),
|
|
191
|
+
id: types.number(),
|
|
192
|
+
lastSeen: types.nullable(types.string()),
|
|
193
|
+
location: types.nullable(types.string()),
|
|
194
|
+
name: types.nullable(types.string()),
|
|
195
|
+
public_gists: types.number(),
|
|
196
|
+
public_repos: types.number(),
|
|
197
|
+
username: types.string(),
|
|
198
|
+
activityId: z.optional(z.nullable(types.string())),
|
|
199
|
+
}),
|
|
200
|
+
z.transform((v) => {
|
|
201
|
+
return remap$(v, {
|
|
202
|
+
"avatar_url": "avatarUrl",
|
|
203
|
+
"public_gists": "publicGists",
|
|
204
|
+
"public_repos": "publicRepos",
|
|
205
|
+
});
|
|
206
|
+
}),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
export function githubInfoFromJSON(
|
|
210
|
+
jsonString: string,
|
|
211
|
+
): SafeParseResult<GithubInfo, SDKValidationError> {
|
|
212
|
+
return safeParse(
|
|
213
|
+
jsonString,
|
|
214
|
+
(x) => GithubInfo$inboundSchema.parse(JSON.parse(x)),
|
|
215
|
+
`Failed to parse 'GithubInfo' from JSON`,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** @internal */
|
|
220
|
+
export const ResultEvent$inboundSchema: z.ZodMiniType<ResultEvent, unknown> = z
|
|
221
|
+
.object({
|
|
222
|
+
data: z.pipe(
|
|
223
|
+
z.pipe(
|
|
224
|
+
z.unknown(),
|
|
225
|
+
z.transform((v, ctx) => {
|
|
226
|
+
if (typeof v !== "string") return v;
|
|
227
|
+
try {
|
|
228
|
+
return JSON.parse(v);
|
|
229
|
+
} catch (err) {
|
|
230
|
+
ctx.issues.push({
|
|
231
|
+
input: v,
|
|
232
|
+
code: "custom",
|
|
233
|
+
message: `malformed json: ${err}`,
|
|
234
|
+
});
|
|
235
|
+
return z.NEVER;
|
|
236
|
+
}
|
|
237
|
+
}),
|
|
238
|
+
),
|
|
239
|
+
z.lazy(() => GithubInfo$inboundSchema),
|
|
240
|
+
),
|
|
241
|
+
event: types.literal("result"),
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
export function resultEventFromJSON(
|
|
245
|
+
jsonString: string,
|
|
246
|
+
): SafeParseResult<ResultEvent, SDKValidationError> {
|
|
247
|
+
return safeParse(
|
|
248
|
+
jsonString,
|
|
249
|
+
(x) => ResultEvent$inboundSchema.parse(JSON.parse(x)),
|
|
250
|
+
`Failed to parse 'ResultEvent' from JSON`,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** @internal */
|
|
255
|
+
export const HeartbeatEvent$inboundSchema: z.ZodMiniType<
|
|
256
|
+
HeartbeatEvent,
|
|
110
257
|
unknown
|
|
111
258
|
> = z.object({
|
|
112
|
-
data:
|
|
113
|
-
|
|
114
|
-
error: types.optional(types.string()),
|
|
259
|
+
data: types.string(),
|
|
260
|
+
event: types.literal("heartbeat"),
|
|
115
261
|
});
|
|
116
262
|
|
|
117
|
-
export function
|
|
263
|
+
export function heartbeatEventFromJSON(
|
|
264
|
+
jsonString: string,
|
|
265
|
+
): SafeParseResult<HeartbeatEvent, SDKValidationError> {
|
|
266
|
+
return safeParse(
|
|
267
|
+
jsonString,
|
|
268
|
+
(x) => HeartbeatEvent$inboundSchema.parse(JSON.parse(x)),
|
|
269
|
+
`Failed to parse 'HeartbeatEvent' from JSON`,
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** @internal */
|
|
274
|
+
export const StatusEvent$inboundSchema: z.ZodMiniType<StatusEvent, unknown> = z
|
|
275
|
+
.object({
|
|
276
|
+
data: types.string(),
|
|
277
|
+
event: types.literal("status"),
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
export function statusEventFromJSON(
|
|
281
|
+
jsonString: string,
|
|
282
|
+
): SafeParseResult<StatusEvent, SDKValidationError> {
|
|
283
|
+
return safeParse(
|
|
284
|
+
jsonString,
|
|
285
|
+
(x) => StatusEvent$inboundSchema.parse(JSON.parse(x)),
|
|
286
|
+
`Failed to parse 'StatusEvent' from JSON`,
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** @internal */
|
|
291
|
+
export const GithubSearchEvent$inboundSchema: z.ZodMiniType<
|
|
292
|
+
GithubSearchEvent,
|
|
293
|
+
unknown
|
|
294
|
+
> = smartUnion([
|
|
295
|
+
z.lazy(() => StatusEvent$inboundSchema),
|
|
296
|
+
z.lazy(() => HeartbeatEvent$inboundSchema),
|
|
297
|
+
z.lazy(() => ResultEvent$inboundSchema),
|
|
298
|
+
z.lazy(() => SearchGithubErrorEvent$inboundSchema),
|
|
299
|
+
]);
|
|
300
|
+
|
|
301
|
+
export function githubSearchEventFromJSON(
|
|
118
302
|
jsonString: string,
|
|
119
|
-
): SafeParseResult<
|
|
303
|
+
): SafeParseResult<GithubSearchEvent, SDKValidationError> {
|
|
120
304
|
return safeParse(
|
|
121
305
|
jsonString,
|
|
122
|
-
(x) =>
|
|
123
|
-
`Failed to parse '
|
|
306
|
+
(x) => GithubSearchEvent$inboundSchema.parse(JSON.parse(x)),
|
|
307
|
+
`Failed to parse 'GithubSearchEvent' from JSON`,
|
|
124
308
|
);
|
|
125
309
|
}
|