@indiciaosint/sdk 1.1.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/FUNCTIONS.md +1 -1
- package/README.md +53 -13
- package/esm/funcs/activity-delete-activity.js +3 -3
- package/esm/funcs/activity-delete-activity.js.map +1 -1
- package/esm/funcs/activity-get-activity.js +3 -3
- package/esm/funcs/activity-get-activity.js.map +1 -1
- package/esm/funcs/activity-list-activities.js +3 -3
- package/esm/funcs/activity-list-activities.js.map +1 -1
- package/esm/funcs/infrastructure-scan-ports.d.ts +2 -127
- package/esm/funcs/infrastructure-scan-ports.d.ts.map +1 -1
- package/esm/funcs/infrastructure-scan-ports.js +12 -131
- package/esm/funcs/infrastructure-scan-ports.js.map +1 -1
- package/esm/funcs/infrastructure-search-certificates.js +3 -3
- package/esm/funcs/infrastructure-search-certificates.js.map +1 -1
- package/esm/funcs/infrastructure-search-dns.js +3 -3
- package/esm/funcs/infrastructure-search-dns.js.map +1 -1
- package/esm/funcs/infrastructure-search-ip-info.js +3 -3
- package/esm/funcs/infrastructure-search-ip-info.js.map +1 -1
- package/esm/funcs/infrastructure-search-shodan.js +3 -3
- package/esm/funcs/infrastructure-search-shodan.js.map +1 -1
- package/esm/funcs/infrastructure-search-whois.js +3 -3
- package/esm/funcs/infrastructure-search-whois.js.map +1 -1
- package/esm/funcs/intelligence-geolocate-media.d.ts +2 -13
- package/esm/funcs/intelligence-geolocate-media.d.ts.map +1 -1
- package/esm/funcs/intelligence-geolocate-media.js +12 -17
- package/esm/funcs/intelligence-geolocate-media.js.map +1 -1
- package/esm/funcs/intelligence-search-address.js +3 -3
- package/esm/funcs/intelligence-search-address.js.map +1 -1
- package/esm/funcs/intelligence-search-email.js +3 -3
- package/esm/funcs/intelligence-search-email.js.map +1 -1
- package/esm/funcs/intelligence-search-face.d.ts +2 -1
- package/esm/funcs/intelligence-search-face.d.ts.map +1 -1
- package/esm/funcs/intelligence-search-face.js +12 -5
- package/esm/funcs/intelligence-search-face.js.map +1 -1
- package/esm/funcs/intelligence-search-gmail.js +3 -3
- package/esm/funcs/intelligence-search-gmail.js.map +1 -1
- package/esm/funcs/intelligence-search-hudson-rock.js +3 -3
- package/esm/funcs/intelligence-search-hudson-rock.js.map +1 -1
- package/esm/funcs/intelligence-search-person.js +3 -3
- package/esm/funcs/intelligence-search-person.js.map +1 -1
- package/esm/funcs/intelligence-search-phone.js +3 -3
- package/esm/funcs/intelligence-search-phone.js.map +1 -1
- package/esm/funcs/intelligence-search-seon.js +3 -3
- package/esm/funcs/intelligence-search-seon.js.map +1 -1
- package/esm/funcs/intelligence-search-web-databases.js +3 -3
- package/esm/funcs/intelligence-search-web-databases.js.map +1 -1
- package/esm/funcs/organizations-get-organization-audit-log.js +3 -3
- package/esm/funcs/organizations-get-organization-audit-log.js.map +1 -1
- package/esm/funcs/organizations-get-organization.js +3 -3
- package/esm/funcs/organizations-get-organization.js.map +1 -1
- package/esm/funcs/organizations-list-organization-cases.js +3 -3
- package/esm/funcs/organizations-list-organization-cases.js.map +1 -1
- package/esm/funcs/organizations-list-organization-members.js +3 -3
- package/esm/funcs/organizations-list-organization-members.js.map +1 -1
- package/esm/funcs/organizations-list-organizations.js +3 -3
- package/esm/funcs/organizations-list-organizations.js.map +1 -1
- package/esm/funcs/organizations-send-organization-credits.js +3 -3
- package/esm/funcs/organizations-send-organization-credits.js.map +1 -1
- package/esm/funcs/pricing-get-pricing.js +3 -3
- package/esm/funcs/pricing-get-pricing.js.map +1 -1
- package/esm/funcs/socials-search-discord.js +3 -3
- package/esm/funcs/socials-search-discord.js.map +1 -1
- 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 +14 -6
- package/esm/funcs/socials-search-github.js.map +1 -1
- package/esm/funcs/socials-search-roblox.js +3 -3
- package/esm/funcs/socials-search-roblox.js.map +1 -1
- package/esm/funcs/socials-search-tiktok.js +3 -3
- package/esm/funcs/socials-search-tiktok.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 +14 -6
- package/esm/funcs/socials-search-username.js.map +1 -1
- package/esm/funcs/tools-bypass-double-counter.js +3 -3
- package/esm/funcs/tools-bypass-double-counter.js.map +1 -1
- package/esm/funcs/tools-download-intelx-file.js +3 -3
- package/esm/funcs/tools-download-intelx-file.js.map +1 -1
- package/esm/funcs/tools-lookup-discord-alt.js +3 -3
- package/esm/funcs/tools-lookup-discord-alt.js.map +1 -1
- package/esm/funcs/users-get-info.js +3 -3
- package/esm/funcs/users-get-info.js.map +1 -1
- package/esm/hooks/hooks.d.ts.map +1 -1
- package/esm/hooks/hooks.js +2 -0
- package/esm/hooks/hooks.js.map +1 -1
- package/esm/hooks/registration.d.ts +3 -0
- package/esm/hooks/registration.d.ts.map +1 -0
- package/esm/hooks/registration.js +12 -0
- package/esm/hooks/registration.js.map +1 -0
- package/esm/lib/config.d.ts +4 -4
- package/esm/lib/config.d.ts.map +1 -1
- package/esm/lib/config.js +3 -3
- package/esm/lib/env.d.ts +1 -1
- package/esm/lib/env.d.ts.map +1 -1
- package/esm/lib/env.js +1 -1
- package/esm/lib/env.js.map +1 -1
- package/esm/lib/event-streams.d.ts +23 -0
- package/esm/lib/event-streams.d.ts.map +1 -0
- package/esm/lib/event-streams.js +163 -0
- package/esm/lib/event-streams.js.map +1 -0
- package/esm/lib/security.js +1 -1
- package/esm/lib/security.js.map +1 -1
- package/esm/models/operations/geolocate-media.d.ts +91 -0
- package/esm/models/operations/geolocate-media.d.ts.map +1 -1
- package/esm/models/operations/geolocate-media.js +74 -0
- package/esm/models/operations/geolocate-media.js.map +1 -1
- package/esm/models/operations/scan-ports.d.ts +355 -0
- package/esm/models/operations/scan-ports.d.ts.map +1 -1
- package/esm/models/operations/scan-ports.js +473 -0
- package/esm/models/operations/scan-ports.js.map +1 -1
- package/esm/models/operations/search-face.d.ts +95 -0
- package/esm/models/operations/search-face.d.ts.map +1 -1
- package/esm/models/operations/search-face.js +97 -0
- 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 +435 -19
- package/esm/models/operations/search-username.d.ts.map +1 -1
- package/esm/models/operations/search-username.js +738 -20
- package/esm/models/operations/search-username.js.map +1 -1
- package/esm/models/operations/search-web-databases.d.ts +4 -5
- package/esm/models/operations/search-web-databases.d.ts.map +1 -1
- package/esm/models/operations/search-web-databases.js +3 -4
- package/esm/models/operations/search-web-databases.js.map +1 -1
- package/esm/models/security.d.ts +2 -2
- package/esm/models/security.d.ts.map +1 -1
- package/esm/models/security.js +2 -2
- package/esm/models/security.js.map +1 -1
- package/esm/sdk/infrastructure.d.ts +2 -127
- package/esm/sdk/infrastructure.d.ts.map +1 -1
- package/esm/sdk/infrastructure.js +0 -126
- package/esm/sdk/infrastructure.js.map +1 -1
- package/esm/sdk/intelligence.d.ts +3 -14
- package/esm/sdk/intelligence.d.ts.map +1 -1
- package/esm/sdk/intelligence.js +0 -12
- package/esm/sdk/intelligence.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/esm/types/discriminated-union.d.ts +25 -0
- package/esm/types/discriminated-union.d.ts.map +1 -0
- package/esm/types/discriminated-union.js +61 -0
- package/esm/types/discriminated-union.js.map +1 -0
- package/esm/types/smart-union.d.ts.map +1 -1
- package/esm/types/smart-union.js +2 -1
- package/esm/types/smart-union.js.map +1 -1
- package/examples/usersGetInfo.example.ts +1 -1
- package/jsr.json +2 -1
- package/package.json +1 -1
- package/src/funcs/activity-delete-activity.ts +3 -3
- package/src/funcs/activity-get-activity.ts +3 -3
- package/src/funcs/activity-list-activities.ts +3 -3
- package/src/funcs/infrastructure-scan-ports.ts +21 -134
- package/src/funcs/infrastructure-search-certificates.ts +3 -3
- package/src/funcs/infrastructure-search-dns.ts +3 -3
- package/src/funcs/infrastructure-search-ip-info.ts +3 -3
- package/src/funcs/infrastructure-search-shodan.ts +3 -3
- package/src/funcs/infrastructure-search-whois.ts +3 -3
- package/src/funcs/intelligence-geolocate-media.ts +21 -20
- package/src/funcs/intelligence-search-address.ts +3 -3
- package/src/funcs/intelligence-search-email.ts +3 -3
- package/src/funcs/intelligence-search-face.ts +21 -8
- package/src/funcs/intelligence-search-gmail.ts +3 -3
- package/src/funcs/intelligence-search-hudson-rock.ts +3 -3
- package/src/funcs/intelligence-search-person.ts +3 -3
- package/src/funcs/intelligence-search-phone.ts +3 -3
- package/src/funcs/intelligence-search-seon.ts +3 -3
- package/src/funcs/intelligence-search-web-databases.ts +3 -3
- package/src/funcs/organizations-get-organization-audit-log.ts +3 -3
- package/src/funcs/organizations-get-organization.ts +3 -3
- package/src/funcs/organizations-list-organization-cases.ts +3 -3
- package/src/funcs/organizations-list-organization-members.ts +3 -3
- package/src/funcs/organizations-list-organizations.ts +3 -3
- package/src/funcs/organizations-send-organization-credits.ts +3 -3
- package/src/funcs/pricing-get-pricing.ts +3 -3
- package/src/funcs/socials-search-discord.ts +3 -3
- package/src/funcs/socials-search-github.ts +24 -9
- package/src/funcs/socials-search-roblox.ts +3 -3
- package/src/funcs/socials-search-tiktok.ts +3 -3
- package/src/funcs/socials-search-username.ts +26 -9
- package/src/funcs/tools-bypass-double-counter.ts +3 -3
- package/src/funcs/tools-download-intelx-file.ts +3 -3
- package/src/funcs/tools-lookup-discord-alt.ts +3 -3
- package/src/funcs/users-get-info.ts +3 -3
- package/src/hooks/hooks.ts +3 -0
- package/src/hooks/registration.ts +14 -0
- package/src/lib/config.ts +4 -4
- package/src/lib/env.ts +2 -2
- package/src/lib/event-streams.ts +191 -0
- package/src/lib/security.ts +1 -1
- package/src/models/operations/geolocate-media.ts +231 -0
- package/src/models/operations/scan-ports.ts +1223 -0
- package/src/models/operations/search-face.ts +261 -0
- package/src/models/operations/search-github.ts +225 -41
- package/src/models/operations/search-username.ts +1690 -92
- package/src/models/operations/search-web-databases.ts +9 -8
- package/src/models/security.ts +4 -4
- package/src/sdk/infrastructure.ts +2 -127
- package/src/sdk/intelligence.ts +3 -14
- package/src/sdk/socials.ts +5 -4
- package/src/types/discriminated-union.ts +101 -0
- package/src/types/smart-union.ts +2 -1
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v4-mini";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
6
7
|
import { blobLikeSchema } from "../../types/blobs.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { smartUnion } from "../../types/smart-union.js";
|
|
11
|
+
import { SDKValidationError } from "../errors/sdk-validation-error.js";
|
|
7
12
|
|
|
8
13
|
export type SearchFaceMedia = {
|
|
9
14
|
fileName: string;
|
|
@@ -17,6 +22,88 @@ export type SearchFaceRequest = {
|
|
|
17
22
|
media: SearchFaceMedia | Blob;
|
|
18
23
|
};
|
|
19
24
|
|
|
25
|
+
export type SearchFaceDataError = {
|
|
26
|
+
status: "error";
|
|
27
|
+
success: false;
|
|
28
|
+
/**
|
|
29
|
+
* Human-readable error message.
|
|
30
|
+
*/
|
|
31
|
+
error: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A data-only event indicating the search failed.
|
|
36
|
+
*/
|
|
37
|
+
export type SearchFaceErrorEvent = {
|
|
38
|
+
data: SearchFaceDataError;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type SearchFaceResult = {
|
|
42
|
+
id: string;
|
|
43
|
+
hash: string;
|
|
44
|
+
group: number;
|
|
45
|
+
quality: number;
|
|
46
|
+
imageUrl: string;
|
|
47
|
+
/**
|
|
48
|
+
* Unix epoch milliseconds the source was crawled.
|
|
49
|
+
*/
|
|
50
|
+
crawledAt: number;
|
|
51
|
+
sourceUrl: string;
|
|
52
|
+
thumbnailUrl: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Completed facial search result set.
|
|
57
|
+
*/
|
|
58
|
+
export type SearchFaceData = {
|
|
59
|
+
/**
|
|
60
|
+
* Time the search took, in seconds.
|
|
61
|
+
*/
|
|
62
|
+
time: number;
|
|
63
|
+
/**
|
|
64
|
+
* Matched faces found across the internet.
|
|
65
|
+
*/
|
|
66
|
+
results: Array<SearchFaceResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Hash identifying this search.
|
|
69
|
+
*/
|
|
70
|
+
searchHash: string;
|
|
71
|
+
/**
|
|
72
|
+
* Total number of matched faces.
|
|
73
|
+
*/
|
|
74
|
+
numberOfResults: number;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Emitted as the `results` event with the completed matches.
|
|
79
|
+
*/
|
|
80
|
+
export type ResultsEvent = {
|
|
81
|
+
/**
|
|
82
|
+
* Completed facial search result set.
|
|
83
|
+
*/
|
|
84
|
+
data: SearchFaceData;
|
|
85
|
+
event: "results";
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Emitted as the `faces` event once detection completes.
|
|
90
|
+
*/
|
|
91
|
+
export type FacesEvent = {
|
|
92
|
+
/**
|
|
93
|
+
* Number of faces detected in the uploaded image, as a decimal string (5 credits charged per face). "0" means no face was detected.
|
|
94
|
+
*/
|
|
95
|
+
data: string;
|
|
96
|
+
event: "faces";
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* A Server-Sent Event. The `event:` field names the type ("faces" or "results"); errors are delivered as a data-only event.
|
|
101
|
+
*/
|
|
102
|
+
export type FacialSearchEvent =
|
|
103
|
+
| FacesEvent
|
|
104
|
+
| ResultsEvent
|
|
105
|
+
| SearchFaceErrorEvent;
|
|
106
|
+
|
|
20
107
|
/** @internal */
|
|
21
108
|
export type SearchFaceMedia$Outbound = {
|
|
22
109
|
fileName: string;
|
|
@@ -66,3 +153,177 @@ export function searchFaceRequestToJSON(
|
|
|
66
153
|
SearchFaceRequest$outboundSchema.parse(searchFaceRequest),
|
|
67
154
|
);
|
|
68
155
|
}
|
|
156
|
+
|
|
157
|
+
/** @internal */
|
|
158
|
+
export const SearchFaceDataError$inboundSchema: z.ZodMiniType<
|
|
159
|
+
SearchFaceDataError,
|
|
160
|
+
unknown
|
|
161
|
+
> = z.object({
|
|
162
|
+
status: types.literal("error"),
|
|
163
|
+
success: types.literal(false),
|
|
164
|
+
error: types.string(),
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export function searchFaceDataErrorFromJSON(
|
|
168
|
+
jsonString: string,
|
|
169
|
+
): SafeParseResult<SearchFaceDataError, SDKValidationError> {
|
|
170
|
+
return safeParse(
|
|
171
|
+
jsonString,
|
|
172
|
+
(x) => SearchFaceDataError$inboundSchema.parse(JSON.parse(x)),
|
|
173
|
+
`Failed to parse 'SearchFaceDataError' from JSON`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** @internal */
|
|
178
|
+
export const SearchFaceErrorEvent$inboundSchema: z.ZodMiniType<
|
|
179
|
+
SearchFaceErrorEvent,
|
|
180
|
+
unknown
|
|
181
|
+
> = z.object({
|
|
182
|
+
data: z.pipe(
|
|
183
|
+
z.pipe(
|
|
184
|
+
z.unknown(),
|
|
185
|
+
z.transform((v, ctx) => {
|
|
186
|
+
if (typeof v !== "string") return v;
|
|
187
|
+
try {
|
|
188
|
+
return JSON.parse(v);
|
|
189
|
+
} catch (err) {
|
|
190
|
+
ctx.issues.push({
|
|
191
|
+
input: v,
|
|
192
|
+
code: "custom",
|
|
193
|
+
message: `malformed json: ${err}`,
|
|
194
|
+
});
|
|
195
|
+
return z.NEVER;
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
),
|
|
199
|
+
z.lazy(() => SearchFaceDataError$inboundSchema),
|
|
200
|
+
),
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export function searchFaceErrorEventFromJSON(
|
|
204
|
+
jsonString: string,
|
|
205
|
+
): SafeParseResult<SearchFaceErrorEvent, SDKValidationError> {
|
|
206
|
+
return safeParse(
|
|
207
|
+
jsonString,
|
|
208
|
+
(x) => SearchFaceErrorEvent$inboundSchema.parse(JSON.parse(x)),
|
|
209
|
+
`Failed to parse 'SearchFaceErrorEvent' from JSON`,
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** @internal */
|
|
214
|
+
export const SearchFaceResult$inboundSchema: z.ZodMiniType<
|
|
215
|
+
SearchFaceResult,
|
|
216
|
+
unknown
|
|
217
|
+
> = z.object({
|
|
218
|
+
id: types.string(),
|
|
219
|
+
hash: types.string(),
|
|
220
|
+
group: types.number(),
|
|
221
|
+
quality: types.number(),
|
|
222
|
+
imageUrl: types.string(),
|
|
223
|
+
crawledAt: types.number(),
|
|
224
|
+
sourceUrl: types.string(),
|
|
225
|
+
thumbnailUrl: types.string(),
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export function searchFaceResultFromJSON(
|
|
229
|
+
jsonString: string,
|
|
230
|
+
): SafeParseResult<SearchFaceResult, SDKValidationError> {
|
|
231
|
+
return safeParse(
|
|
232
|
+
jsonString,
|
|
233
|
+
(x) => SearchFaceResult$inboundSchema.parse(JSON.parse(x)),
|
|
234
|
+
`Failed to parse 'SearchFaceResult' from JSON`,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** @internal */
|
|
239
|
+
export const SearchFaceData$inboundSchema: z.ZodMiniType<
|
|
240
|
+
SearchFaceData,
|
|
241
|
+
unknown
|
|
242
|
+
> = z.object({
|
|
243
|
+
time: types.number(),
|
|
244
|
+
results: z.array(z.lazy(() => SearchFaceResult$inboundSchema)),
|
|
245
|
+
searchHash: types.string(),
|
|
246
|
+
numberOfResults: types.number(),
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
export function searchFaceDataFromJSON(
|
|
250
|
+
jsonString: string,
|
|
251
|
+
): SafeParseResult<SearchFaceData, SDKValidationError> {
|
|
252
|
+
return safeParse(
|
|
253
|
+
jsonString,
|
|
254
|
+
(x) => SearchFaceData$inboundSchema.parse(JSON.parse(x)),
|
|
255
|
+
`Failed to parse 'SearchFaceData' from JSON`,
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** @internal */
|
|
260
|
+
export const ResultsEvent$inboundSchema: z.ZodMiniType<ResultsEvent, unknown> =
|
|
261
|
+
z.object({
|
|
262
|
+
data: z.pipe(
|
|
263
|
+
z.pipe(
|
|
264
|
+
z.unknown(),
|
|
265
|
+
z.transform((v, ctx) => {
|
|
266
|
+
if (typeof v !== "string") return v;
|
|
267
|
+
try {
|
|
268
|
+
return JSON.parse(v);
|
|
269
|
+
} catch (err) {
|
|
270
|
+
ctx.issues.push({
|
|
271
|
+
input: v,
|
|
272
|
+
code: "custom",
|
|
273
|
+
message: `malformed json: ${err}`,
|
|
274
|
+
});
|
|
275
|
+
return z.NEVER;
|
|
276
|
+
}
|
|
277
|
+
}),
|
|
278
|
+
),
|
|
279
|
+
z.lazy(() => SearchFaceData$inboundSchema),
|
|
280
|
+
),
|
|
281
|
+
event: types.literal("results"),
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
export function resultsEventFromJSON(
|
|
285
|
+
jsonString: string,
|
|
286
|
+
): SafeParseResult<ResultsEvent, SDKValidationError> {
|
|
287
|
+
return safeParse(
|
|
288
|
+
jsonString,
|
|
289
|
+
(x) => ResultsEvent$inboundSchema.parse(JSON.parse(x)),
|
|
290
|
+
`Failed to parse 'ResultsEvent' from JSON`,
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** @internal */
|
|
295
|
+
export const FacesEvent$inboundSchema: z.ZodMiniType<FacesEvent, unknown> = z
|
|
296
|
+
.object({
|
|
297
|
+
data: types.string(),
|
|
298
|
+
event: types.literal("faces"),
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
export function facesEventFromJSON(
|
|
302
|
+
jsonString: string,
|
|
303
|
+
): SafeParseResult<FacesEvent, SDKValidationError> {
|
|
304
|
+
return safeParse(
|
|
305
|
+
jsonString,
|
|
306
|
+
(x) => FacesEvent$inboundSchema.parse(JSON.parse(x)),
|
|
307
|
+
`Failed to parse 'FacesEvent' from JSON`,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** @internal */
|
|
312
|
+
export const FacialSearchEvent$inboundSchema: z.ZodMiniType<
|
|
313
|
+
FacialSearchEvent,
|
|
314
|
+
unknown
|
|
315
|
+
> = smartUnion([
|
|
316
|
+
z.lazy(() => FacesEvent$inboundSchema),
|
|
317
|
+
z.lazy(() => ResultsEvent$inboundSchema),
|
|
318
|
+
z.lazy(() => SearchFaceErrorEvent$inboundSchema),
|
|
319
|
+
]);
|
|
320
|
+
|
|
321
|
+
export function facialSearchEventFromJSON(
|
|
322
|
+
jsonString: string,
|
|
323
|
+
): SafeParseResult<FacialSearchEvent, SDKValidationError> {
|
|
324
|
+
return safeParse(
|
|
325
|
+
jsonString,
|
|
326
|
+
(x) => FacialSearchEvent$inboundSchema.parse(JSON.parse(x)),
|
|
327
|
+
`Failed to parse 'FacialSearchEvent' from JSON`,
|
|
328
|
+
);
|
|
329
|
+
}
|
|
@@ -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
|
}
|