@indiciaosint/sdk 1.2.0 → 1.2.2

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 (105) hide show
  1. package/README.md +7 -1
  2. package/esm/funcs/infrastructure-virus-total-content.d.ts +18 -0
  3. package/esm/funcs/infrastructure-virus-total-content.d.ts.map +1 -0
  4. package/esm/funcs/infrastructure-virus-total-content.js +84 -0
  5. package/esm/funcs/infrastructure-virus-total-content.js.map +1 -0
  6. package/esm/funcs/intelligence-virus-total-intelligence.d.ts +18 -0
  7. package/esm/funcs/intelligence-virus-total-intelligence.d.ts.map +1 -0
  8. package/esm/funcs/intelligence-virus-total-intelligence.js +84 -0
  9. package/esm/funcs/intelligence-virus-total-intelligence.js.map +1 -0
  10. package/esm/funcs/socials-search-github.d.ts +3 -2
  11. package/esm/funcs/socials-search-github.d.ts.map +1 -1
  12. package/esm/funcs/socials-search-github.js +11 -3
  13. package/esm/funcs/socials-search-github.js.map +1 -1
  14. package/esm/funcs/socials-search-username.d.ts +3 -2
  15. package/esm/funcs/socials-search-username.d.ts.map +1 -1
  16. package/esm/funcs/socials-search-username.js +11 -3
  17. package/esm/funcs/socials-search-username.js.map +1 -1
  18. package/esm/funcs/tools-download-virus-total-file.d.ts +18 -0
  19. package/esm/funcs/tools-download-virus-total-file.d.ts.map +1 -0
  20. package/esm/funcs/tools-download-virus-total-file.js +84 -0
  21. package/esm/funcs/tools-download-virus-total-file.js.map +1 -0
  22. package/esm/lib/config.d.ts +2 -2
  23. package/esm/lib/config.js +2 -2
  24. package/esm/models/operations/download-virus-total-file.d.ts +34 -0
  25. package/esm/models/operations/download-virus-total-file.d.ts.map +1 -0
  26. package/esm/models/operations/download-virus-total-file.js +33 -0
  27. package/esm/models/operations/download-virus-total-file.js.map +1 -0
  28. package/esm/models/operations/get-activity.d.ts +3 -0
  29. package/esm/models/operations/get-activity.d.ts.map +1 -1
  30. package/esm/models/operations/get-activity.js +3 -0
  31. package/esm/models/operations/get-activity.js.map +1 -1
  32. package/esm/models/operations/get-info.d.ts +3 -0
  33. package/esm/models/operations/get-info.d.ts.map +1 -1
  34. package/esm/models/operations/get-info.js +3 -0
  35. package/esm/models/operations/get-info.js.map +1 -1
  36. package/esm/models/operations/index.d.ts +3 -0
  37. package/esm/models/operations/index.d.ts.map +1 -1
  38. package/esm/models/operations/index.js +3 -0
  39. package/esm/models/operations/index.js.map +1 -1
  40. package/esm/models/operations/list-activities.d.ts +3 -0
  41. package/esm/models/operations/list-activities.d.ts.map +1 -1
  42. package/esm/models/operations/list-activities.js +3 -0
  43. package/esm/models/operations/list-activities.js.map +1 -1
  44. package/esm/models/operations/search-face.d.ts +4 -4
  45. package/esm/models/operations/search-face.d.ts.map +1 -1
  46. package/esm/models/operations/search-face.js +4 -5
  47. package/esm/models/operations/search-face.js.map +1 -1
  48. package/esm/models/operations/search-github.d.ts +69 -7
  49. package/esm/models/operations/search-github.d.ts.map +1 -1
  50. package/esm/models/operations/search-github.js +83 -9
  51. package/esm/models/operations/search-github.js.map +1 -1
  52. package/esm/models/operations/search-username.d.ts +429 -13
  53. package/esm/models/operations/search-username.d.ts.map +1 -1
  54. package/esm/models/operations/search-username.js +725 -13
  55. package/esm/models/operations/search-username.js.map +1 -1
  56. package/esm/models/operations/search-web-databases.d.ts +2 -2
  57. package/esm/models/operations/search-web-databases.js +2 -2
  58. package/esm/models/operations/search-web-databases.js.map +1 -1
  59. package/esm/models/operations/virus-total-content.d.ts +62 -0
  60. package/esm/models/operations/virus-total-content.d.ts.map +1 -0
  61. package/esm/models/operations/virus-total-content.js +89 -0
  62. package/esm/models/operations/virus-total-content.js.map +1 -0
  63. package/esm/models/operations/virus-total-intelligence.d.ts +75 -0
  64. package/esm/models/operations/virus-total-intelligence.d.ts.map +1 -0
  65. package/esm/models/operations/virus-total-intelligence.js +92 -0
  66. package/esm/models/operations/virus-total-intelligence.js.map +1 -0
  67. package/esm/sdk/infrastructure.d.ts +7 -0
  68. package/esm/sdk/infrastructure.d.ts.map +1 -1
  69. package/esm/sdk/infrastructure.js +10 -0
  70. package/esm/sdk/infrastructure.js.map +1 -1
  71. package/esm/sdk/intelligence.d.ts +7 -0
  72. package/esm/sdk/intelligence.d.ts.map +1 -1
  73. package/esm/sdk/intelligence.js +10 -0
  74. package/esm/sdk/intelligence.js.map +1 -1
  75. package/esm/sdk/socials.d.ts +5 -4
  76. package/esm/sdk/socials.d.ts.map +1 -1
  77. package/esm/sdk/socials.js +2 -2
  78. package/esm/sdk/socials.js.map +1 -1
  79. package/esm/sdk/tools.d.ts +7 -0
  80. package/esm/sdk/tools.d.ts.map +1 -1
  81. package/esm/sdk/tools.js +10 -0
  82. package/esm/sdk/tools.js.map +1 -1
  83. package/jsr.json +1 -1
  84. package/package.json +1 -1
  85. package/src/funcs/infrastructure-virus-total-content.ts +174 -0
  86. package/src/funcs/intelligence-virus-total-intelligence.ts +174 -0
  87. package/src/funcs/socials-search-github.ts +21 -6
  88. package/src/funcs/socials-search-username.ts +23 -6
  89. package/src/funcs/tools-download-virus-total-file.ts +174 -0
  90. package/src/lib/config.ts +2 -2
  91. package/src/models/operations/download-virus-total-file.ts +93 -0
  92. package/src/models/operations/get-activity.ts +3 -0
  93. package/src/models/operations/get-info.ts +3 -0
  94. package/src/models/operations/index.ts +3 -0
  95. package/src/models/operations/list-activities.ts +3 -0
  96. package/src/models/operations/search-face.ts +15 -13
  97. package/src/models/operations/search-github.ts +225 -41
  98. package/src/models/operations/search-username.ts +1667 -77
  99. package/src/models/operations/search-web-databases.ts +2 -2
  100. package/src/models/operations/virus-total-content.ts +190 -0
  101. package/src/models/operations/virus-total-intelligence.ts +210 -0
  102. package/src/sdk/infrastructure.ts +18 -0
  103. package/src/sdk/intelligence.ts +18 -0
  104. package/src/sdk/socials.ts +5 -4
  105. package/src/sdk/tools.ts +18 -0
@@ -22,7 +22,7 @@ export type SearchFaceRequest = {
22
22
  media: SearchFaceMedia | Blob;
23
23
  };
24
24
 
25
- export type DataError = {
25
+ export type SearchFaceDataError = {
26
26
  status: "error";
27
27
  success: false;
28
28
  /**
@@ -35,7 +35,7 @@ export type DataError = {
35
35
  * A data-only event indicating the search failed.
36
36
  */
37
37
  export type SearchFaceErrorEvent = {
38
- data: DataError;
38
+ data: SearchFaceDataError;
39
39
  };
40
40
 
41
41
  export type SearchFaceResult = {
@@ -155,20 +155,22 @@ export function searchFaceRequestToJSON(
155
155
  }
156
156
 
157
157
  /** @internal */
158
- export const DataError$inboundSchema: z.ZodMiniType<DataError, unknown> = z
159
- .object({
160
- status: types.literal("error"),
161
- success: types.literal(false),
162
- error: types.string(),
163
- });
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
+ });
164
166
 
165
- export function dataErrorFromJSON(
167
+ export function searchFaceDataErrorFromJSON(
166
168
  jsonString: string,
167
- ): SafeParseResult<DataError, SDKValidationError> {
169
+ ): SafeParseResult<SearchFaceDataError, SDKValidationError> {
168
170
  return safeParse(
169
171
  jsonString,
170
- (x) => DataError$inboundSchema.parse(JSON.parse(x)),
171
- `Failed to parse 'DataError' from JSON`,
172
+ (x) => SearchFaceDataError$inboundSchema.parse(JSON.parse(x)),
173
+ `Failed to parse 'SearchFaceDataError' from JSON`,
172
174
  );
173
175
  }
174
176
 
@@ -194,7 +196,7 @@ export const SearchFaceErrorEvent$inboundSchema: z.ZodMiniType<
194
196
  }
195
197
  }),
196
198
  ),
197
- z.lazy(() => DataError$inboundSchema),
199
+ z.lazy(() => SearchFaceDataError$inboundSchema),
198
200
  ),
199
201
  });
200
202
 
@@ -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
- * Search successful
60
+ * Terminal `result` event with the completed GitHub profile.
37
61
  */
38
- export type SearchGithubResponse = {
39
- data: SearchGithubData;
40
- success: boolean;
41
- error?: string | undefined;
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.pipe(
70
- z.object({
71
- avatar_url: types.nullable(types.string()),
72
- bio: types.nullable(types.string()),
73
- commitEmails: z.record(z.string(), z.array(types.string())),
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 SearchGithubResponse$inboundSchema: z.ZodMiniType<
109
- SearchGithubResponse,
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: z.lazy(() => SearchGithubData$inboundSchema),
113
- success: types.boolean(),
114
- error: types.optional(types.string()),
259
+ data: types.string(),
260
+ event: types.literal("heartbeat"),
115
261
  });
116
262
 
117
- export function searchGithubResponseFromJSON(
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<SearchGithubResponse, SDKValidationError> {
303
+ ): SafeParseResult<GithubSearchEvent, SDKValidationError> {
120
304
  return safeParse(
121
305
  jsonString,
122
- (x) => SearchGithubResponse$inboundSchema.parse(JSON.parse(x)),
123
- `Failed to parse 'SearchGithubResponse' from JSON`,
306
+ (x) => GithubSearchEvent$inboundSchema.parse(JSON.parse(x)),
307
+ `Failed to parse 'GithubSearchEvent' from JSON`,
124
308
  );
125
309
  }