@zhuixin/shared 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/dist/index.cjs +161 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +412 -0
- package/dist/index.d.ts +412 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -3
- package/README.md +0 -3
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
type TargetPlatform = "ios" | "windows" | "macos" | "android" | "linux";
|
|
4
|
+
type HostPlatform = "darwin" | "win32" | "linux";
|
|
5
|
+
type SourceId = "app-store" | "local-file" | "direct-url" | "microsoft-store" | "winget";
|
|
6
|
+
type PackageFormat = "ipa" | "msix" | "appx" | "exe" | "msi" | "zip" | "dmg" | "apk";
|
|
7
|
+
interface TargetRef {
|
|
8
|
+
platform: TargetPlatform;
|
|
9
|
+
sourceId: SourceId;
|
|
10
|
+
sourceRef: string;
|
|
11
|
+
}
|
|
12
|
+
interface ResolvedTarget {
|
|
13
|
+
targetRef: TargetRef;
|
|
14
|
+
name: string;
|
|
15
|
+
publisher?: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
bundleId?: string;
|
|
18
|
+
packageId?: string;
|
|
19
|
+
iconUrl?: string;
|
|
20
|
+
storeUrl?: string;
|
|
21
|
+
metadata: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface TargetRecord extends ResolvedTarget {
|
|
24
|
+
id: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
}
|
|
29
|
+
interface ArtifactRecord {
|
|
30
|
+
id: string;
|
|
31
|
+
targetId: string;
|
|
32
|
+
platform: TargetPlatform;
|
|
33
|
+
packageFormat: PackageFormat;
|
|
34
|
+
architecture?: string;
|
|
35
|
+
sha256: string;
|
|
36
|
+
path: string;
|
|
37
|
+
sizeBytes: number;
|
|
38
|
+
version?: string;
|
|
39
|
+
buildNumber?: string;
|
|
40
|
+
signature?: Record<string, unknown>;
|
|
41
|
+
inspection?: Record<string, unknown>;
|
|
42
|
+
sourceUrl?: string;
|
|
43
|
+
downloadedAt: string;
|
|
44
|
+
isCurrent: boolean;
|
|
45
|
+
}
|
|
46
|
+
type FindingType = "technology" | "route" | "network_endpoint" | "module" | "asset" | "storage" | "native_procedure" | "native_string" | "risk" | "limitation";
|
|
47
|
+
type FindingConfidence = "exact" | "high" | "medium" | "low" | "unknown";
|
|
48
|
+
interface FindingRecord {
|
|
49
|
+
id: string;
|
|
50
|
+
targetId: string;
|
|
51
|
+
artifactId?: string;
|
|
52
|
+
jobId: string;
|
|
53
|
+
evidenceId: string;
|
|
54
|
+
type: FindingType;
|
|
55
|
+
value: string;
|
|
56
|
+
group?: string;
|
|
57
|
+
sourcePath?: string;
|
|
58
|
+
start?: {
|
|
59
|
+
line: number;
|
|
60
|
+
column: number;
|
|
61
|
+
};
|
|
62
|
+
end?: {
|
|
63
|
+
line: number;
|
|
64
|
+
column: number;
|
|
65
|
+
};
|
|
66
|
+
confidence: FindingConfidence;
|
|
67
|
+
metadata: Record<string, unknown>;
|
|
68
|
+
createdAt: string;
|
|
69
|
+
}
|
|
70
|
+
interface EvidenceRecord {
|
|
71
|
+
id: string;
|
|
72
|
+
targetId: string;
|
|
73
|
+
artifactId?: string;
|
|
74
|
+
jobId: string;
|
|
75
|
+
kind: string;
|
|
76
|
+
format: "json" | "markdown" | "text";
|
|
77
|
+
path: string;
|
|
78
|
+
sha256: string;
|
|
79
|
+
summary: Record<string, unknown>;
|
|
80
|
+
parentEvidenceId?: string;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
}
|
|
83
|
+
interface FindingSearchResult {
|
|
84
|
+
items: FindingRecord[];
|
|
85
|
+
total: number;
|
|
86
|
+
limit: number;
|
|
87
|
+
offset: number;
|
|
88
|
+
}
|
|
89
|
+
interface AnalysisRunRecord {
|
|
90
|
+
id: string;
|
|
91
|
+
targetId?: string;
|
|
92
|
+
status: "running" | "completed" | "failed" | "interrupted";
|
|
93
|
+
startedAt: string;
|
|
94
|
+
finishedAt?: string;
|
|
95
|
+
result?: Record<string, unknown>;
|
|
96
|
+
error?: {
|
|
97
|
+
code: string;
|
|
98
|
+
message: string;
|
|
99
|
+
details?: unknown;
|
|
100
|
+
};
|
|
101
|
+
updatedAt: string;
|
|
102
|
+
}
|
|
103
|
+
type JobStatus = "queued" | "resolving" | "awaiting_auth" | "awaiting_license" | "acquiring" | "inspecting" | "registering" | "ready" | "analyzing" | "analyzed" | "failed" | "cancelled" | "interrupted";
|
|
104
|
+
interface JobRecord {
|
|
105
|
+
id: string;
|
|
106
|
+
targetId?: string;
|
|
107
|
+
sourceId?: SourceId;
|
|
108
|
+
capabilityId: string;
|
|
109
|
+
status: JobStatus;
|
|
110
|
+
progress: number;
|
|
111
|
+
params: Record<string, unknown>;
|
|
112
|
+
result?: Record<string, unknown>;
|
|
113
|
+
errorCode?: string;
|
|
114
|
+
errorMessage?: string;
|
|
115
|
+
createdAt: string;
|
|
116
|
+
startedAt?: string;
|
|
117
|
+
finishedAt?: string;
|
|
118
|
+
}
|
|
119
|
+
interface JobEvent {
|
|
120
|
+
jobId: string;
|
|
121
|
+
level: "info" | "warn" | "error";
|
|
122
|
+
message: string;
|
|
123
|
+
payload?: Record<string, unknown>;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
}
|
|
126
|
+
interface SourceDescriptor {
|
|
127
|
+
id: SourceId;
|
|
128
|
+
platform: TargetPlatform;
|
|
129
|
+
displayName: string;
|
|
130
|
+
requiresAuth: boolean;
|
|
131
|
+
status: "ready" | "preview" | "evaluate";
|
|
132
|
+
description: string;
|
|
133
|
+
}
|
|
134
|
+
interface CapabilityDescriptor {
|
|
135
|
+
id: string;
|
|
136
|
+
label: string;
|
|
137
|
+
description: string;
|
|
138
|
+
targetPlatforms: TargetPlatform[];
|
|
139
|
+
packageFormats?: PackageFormat[];
|
|
140
|
+
hostPlatforms?: HostPlatform[];
|
|
141
|
+
available: boolean;
|
|
142
|
+
reason?: string;
|
|
143
|
+
requiresArtifact?: boolean;
|
|
144
|
+
requiresInput?: "function" | "query";
|
|
145
|
+
}
|
|
146
|
+
interface ResolveResult {
|
|
147
|
+
resolutionId: string;
|
|
148
|
+
target: ResolvedTarget;
|
|
149
|
+
provider: SourceDescriptor;
|
|
150
|
+
}
|
|
151
|
+
interface TargetDetail {
|
|
152
|
+
target: TargetRecord;
|
|
153
|
+
artifacts: ArtifactRecord[];
|
|
154
|
+
jobs: JobRecord[];
|
|
155
|
+
}
|
|
156
|
+
interface CoreError {
|
|
157
|
+
code: string;
|
|
158
|
+
message: string;
|
|
159
|
+
details?: unknown;
|
|
160
|
+
}
|
|
161
|
+
interface HealthInfo {
|
|
162
|
+
version: string;
|
|
163
|
+
workspaceRoot: string;
|
|
164
|
+
hostPlatform: HostPlatform;
|
|
165
|
+
store: "sqlite" | "json";
|
|
166
|
+
tools?: ToolInfo[];
|
|
167
|
+
}
|
|
168
|
+
interface ToolInfo {
|
|
169
|
+
id: string;
|
|
170
|
+
label: string;
|
|
171
|
+
path: string;
|
|
172
|
+
available: boolean;
|
|
173
|
+
}
|
|
174
|
+
interface AccountStatus {
|
|
175
|
+
authenticated: boolean;
|
|
176
|
+
email?: string;
|
|
177
|
+
name?: string;
|
|
178
|
+
keychain: "unlocked" | "locked" | "unknown";
|
|
179
|
+
checkedAt: string;
|
|
180
|
+
message?: string;
|
|
181
|
+
}
|
|
182
|
+
interface EntitlementRecord {
|
|
183
|
+
appId?: string | number;
|
|
184
|
+
bundleId?: string;
|
|
185
|
+
name: string;
|
|
186
|
+
version?: string;
|
|
187
|
+
platform?: string;
|
|
188
|
+
}
|
|
189
|
+
interface AccountEntitlements {
|
|
190
|
+
items: EntitlementRecord[];
|
|
191
|
+
checkedAt: string;
|
|
192
|
+
truncated: boolean;
|
|
193
|
+
error?: string;
|
|
194
|
+
}
|
|
195
|
+
interface EntitlementCheck {
|
|
196
|
+
status: "owned" | "not_owned" | "unknown";
|
|
197
|
+
checkedAt: string;
|
|
198
|
+
message?: string;
|
|
199
|
+
entitlement?: EntitlementRecord;
|
|
200
|
+
}
|
|
201
|
+
interface CoreRequest<T = unknown> {
|
|
202
|
+
id: string;
|
|
203
|
+
channel: string;
|
|
204
|
+
payload: T;
|
|
205
|
+
}
|
|
206
|
+
type CoreResponse<T = unknown> = {
|
|
207
|
+
id: string;
|
|
208
|
+
ok: true;
|
|
209
|
+
data: T;
|
|
210
|
+
} | {
|
|
211
|
+
id: string;
|
|
212
|
+
ok: false;
|
|
213
|
+
error: CoreError;
|
|
214
|
+
};
|
|
215
|
+
type CoreEvent = {
|
|
216
|
+
type: "job.updated";
|
|
217
|
+
payload: JobRecord;
|
|
218
|
+
} | {
|
|
219
|
+
type: "job.log";
|
|
220
|
+
payload: JobEvent;
|
|
221
|
+
} | {
|
|
222
|
+
type: "target.updated";
|
|
223
|
+
payload: TargetRecord;
|
|
224
|
+
} | {
|
|
225
|
+
type: "terminal.data";
|
|
226
|
+
payload: {
|
|
227
|
+
sessionId: string;
|
|
228
|
+
data: string;
|
|
229
|
+
};
|
|
230
|
+
} | {
|
|
231
|
+
type: "terminal.exit";
|
|
232
|
+
payload: {
|
|
233
|
+
sessionId: string;
|
|
234
|
+
code: number | null;
|
|
235
|
+
signal?: string | null;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
declare const CHANNELS: {
|
|
239
|
+
readonly health: "health";
|
|
240
|
+
readonly sourcesList: "sources:list";
|
|
241
|
+
readonly targetsResolve: "targets:resolve";
|
|
242
|
+
readonly targetsCreate: "targets:create";
|
|
243
|
+
readonly targetsList: "targets:list";
|
|
244
|
+
readonly targetsGet: "targets:get";
|
|
245
|
+
readonly jobsCreate: "jobs:create";
|
|
246
|
+
readonly jobsGet: "jobs:get";
|
|
247
|
+
readonly jobsCancel: "jobs:cancel";
|
|
248
|
+
readonly capabilitiesList: "capabilities:list";
|
|
249
|
+
readonly findingsSearch: "findings:search";
|
|
250
|
+
readonly evidenceList: "evidence:list";
|
|
251
|
+
readonly terminalStart: "terminal:start";
|
|
252
|
+
readonly terminalInput: "terminal:input";
|
|
253
|
+
readonly terminalStop: "terminal:stop";
|
|
254
|
+
readonly accountStatus: "account:status";
|
|
255
|
+
readonly accountEntitlements: "account:entitlements";
|
|
256
|
+
readonly accountCheckEntitlement: "account:check-entitlement";
|
|
257
|
+
};
|
|
258
|
+
declare const resolveInputSchema: z.ZodObject<{
|
|
259
|
+
input: z.ZodString;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
input: string;
|
|
262
|
+
}, {
|
|
263
|
+
input: string;
|
|
264
|
+
}>;
|
|
265
|
+
declare const createTargetSchema: z.ZodObject<{
|
|
266
|
+
resolutionId: z.ZodString;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
resolutionId: string;
|
|
269
|
+
}, {
|
|
270
|
+
resolutionId: string;
|
|
271
|
+
}>;
|
|
272
|
+
declare const createJobSchema: z.ZodObject<{
|
|
273
|
+
targetId: z.ZodString;
|
|
274
|
+
capabilityId: z.ZodString;
|
|
275
|
+
artifactId: z.ZodOptional<z.ZodString>;
|
|
276
|
+
input: z.ZodOptional<z.ZodObject<{
|
|
277
|
+
functionName: z.ZodOptional<z.ZodString>;
|
|
278
|
+
query: z.ZodOptional<z.ZodString>;
|
|
279
|
+
kind: z.ZodOptional<z.ZodEnum<["procedures", "strings"]>>;
|
|
280
|
+
mode: z.ZodOptional<z.ZodEnum<["literal", "regex"]>>;
|
|
281
|
+
}, "strict", z.ZodTypeAny, {
|
|
282
|
+
query?: string | undefined;
|
|
283
|
+
functionName?: string | undefined;
|
|
284
|
+
kind?: "procedures" | "strings" | undefined;
|
|
285
|
+
mode?: "literal" | "regex" | undefined;
|
|
286
|
+
}, {
|
|
287
|
+
query?: string | undefined;
|
|
288
|
+
functionName?: string | undefined;
|
|
289
|
+
kind?: "procedures" | "strings" | undefined;
|
|
290
|
+
mode?: "literal" | "regex" | undefined;
|
|
291
|
+
}>>;
|
|
292
|
+
}, "strip", z.ZodTypeAny, {
|
|
293
|
+
targetId: string;
|
|
294
|
+
capabilityId: string;
|
|
295
|
+
input?: {
|
|
296
|
+
query?: string | undefined;
|
|
297
|
+
functionName?: string | undefined;
|
|
298
|
+
kind?: "procedures" | "strings" | undefined;
|
|
299
|
+
mode?: "literal" | "regex" | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
artifactId?: string | undefined;
|
|
302
|
+
}, {
|
|
303
|
+
targetId: string;
|
|
304
|
+
capabilityId: string;
|
|
305
|
+
input?: {
|
|
306
|
+
query?: string | undefined;
|
|
307
|
+
functionName?: string | undefined;
|
|
308
|
+
kind?: "procedures" | "strings" | undefined;
|
|
309
|
+
mode?: "literal" | "regex" | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
artifactId?: string | undefined;
|
|
312
|
+
}>;
|
|
313
|
+
declare const findingsSearchSchema: z.ZodObject<{
|
|
314
|
+
targetId: z.ZodString;
|
|
315
|
+
query: z.ZodOptional<z.ZodString>;
|
|
316
|
+
types: z.ZodOptional<z.ZodArray<z.ZodEnum<["technology", "route", "network_endpoint", "module", "asset", "storage", "native_procedure", "native_string", "risk", "limitation"]>, "many">>;
|
|
317
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
318
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
targetId: string;
|
|
321
|
+
query?: string | undefined;
|
|
322
|
+
types?: ("technology" | "route" | "network_endpoint" | "module" | "asset" | "storage" | "native_procedure" | "native_string" | "risk" | "limitation")[] | undefined;
|
|
323
|
+
limit?: number | undefined;
|
|
324
|
+
offset?: number | undefined;
|
|
325
|
+
}, {
|
|
326
|
+
targetId: string;
|
|
327
|
+
query?: string | undefined;
|
|
328
|
+
types?: ("technology" | "route" | "network_endpoint" | "module" | "asset" | "storage" | "native_procedure" | "native_string" | "risk" | "limitation")[] | undefined;
|
|
329
|
+
limit?: number | undefined;
|
|
330
|
+
offset?: number | undefined;
|
|
331
|
+
}>;
|
|
332
|
+
declare const evidenceListSchema: z.ZodObject<{
|
|
333
|
+
targetId: z.ZodString;
|
|
334
|
+
}, "strip", z.ZodTypeAny, {
|
|
335
|
+
targetId: string;
|
|
336
|
+
}, {
|
|
337
|
+
targetId: string;
|
|
338
|
+
}>;
|
|
339
|
+
declare const capabilitiesListSchema: z.ZodOptional<z.ZodObject<{
|
|
340
|
+
targetId: z.ZodOptional<z.ZodString>;
|
|
341
|
+
}, "strip", z.ZodTypeAny, {
|
|
342
|
+
targetId?: string | undefined;
|
|
343
|
+
}, {
|
|
344
|
+
targetId?: string | undefined;
|
|
345
|
+
}>>;
|
|
346
|
+
declare const targetIdSchema: z.ZodObject<{
|
|
347
|
+
targetId: z.ZodString;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
targetId: string;
|
|
350
|
+
}, {
|
|
351
|
+
targetId: string;
|
|
352
|
+
}>;
|
|
353
|
+
declare const jobIdSchema: z.ZodObject<{
|
|
354
|
+
jobId: z.ZodString;
|
|
355
|
+
}, "strip", z.ZodTypeAny, {
|
|
356
|
+
jobId: string;
|
|
357
|
+
}, {
|
|
358
|
+
jobId: string;
|
|
359
|
+
}>;
|
|
360
|
+
declare const terminalStartSchema: z.ZodObject<{
|
|
361
|
+
kind: z.ZodLiteral<"ipatool-auth">;
|
|
362
|
+
}, "strip", z.ZodTypeAny, {
|
|
363
|
+
kind: "ipatool-auth";
|
|
364
|
+
}, {
|
|
365
|
+
kind: "ipatool-auth";
|
|
366
|
+
}>;
|
|
367
|
+
declare const terminalInputSchema: z.ZodObject<{
|
|
368
|
+
sessionId: z.ZodString;
|
|
369
|
+
data: z.ZodString;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
sessionId: string;
|
|
372
|
+
data: string;
|
|
373
|
+
}, {
|
|
374
|
+
sessionId: string;
|
|
375
|
+
data: string;
|
|
376
|
+
}>;
|
|
377
|
+
declare const terminalStopSchema: z.ZodObject<{
|
|
378
|
+
sessionId: z.ZodString;
|
|
379
|
+
}, "strip", z.ZodTypeAny, {
|
|
380
|
+
sessionId: string;
|
|
381
|
+
}, {
|
|
382
|
+
sessionId: string;
|
|
383
|
+
}>;
|
|
384
|
+
declare const accountStatusSchema: z.ZodObject<{
|
|
385
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
386
|
+
}, "strip", z.ZodTypeAny, {
|
|
387
|
+
force?: boolean | undefined;
|
|
388
|
+
}, {
|
|
389
|
+
force?: boolean | undefined;
|
|
390
|
+
}>;
|
|
391
|
+
declare const accountCheckSchema: z.ZodEffects<z.ZodObject<{
|
|
392
|
+
appId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
393
|
+
bundleId: z.ZodOptional<z.ZodString>;
|
|
394
|
+
}, "strip", z.ZodTypeAny, {
|
|
395
|
+
appId?: string | number | undefined;
|
|
396
|
+
bundleId?: string | undefined;
|
|
397
|
+
}, {
|
|
398
|
+
appId?: string | number | undefined;
|
|
399
|
+
bundleId?: string | undefined;
|
|
400
|
+
}>, {
|
|
401
|
+
appId?: string | number | undefined;
|
|
402
|
+
bundleId?: string | undefined;
|
|
403
|
+
}, {
|
|
404
|
+
appId?: string | number | undefined;
|
|
405
|
+
bundleId?: string | undefined;
|
|
406
|
+
}>;
|
|
407
|
+
declare function parseAppStoreId(input: string): {
|
|
408
|
+
appId: number;
|
|
409
|
+
country: string;
|
|
410
|
+
} | null;
|
|
411
|
+
|
|
412
|
+
export { type AccountEntitlements, type AccountStatus, type AnalysisRunRecord, type ArtifactRecord, CHANNELS, type CapabilityDescriptor, type CoreError, type CoreEvent, type CoreRequest, type CoreResponse, type EntitlementCheck, type EntitlementRecord, type EvidenceRecord, type FindingConfidence, type FindingRecord, type FindingSearchResult, type FindingType, type HealthInfo, type HostPlatform, type JobEvent, type JobRecord, type JobStatus, type PackageFormat, type ResolveResult, type ResolvedTarget, type SourceDescriptor, type SourceId, type TargetDetail, type TargetPlatform, type TargetRecord, type TargetRef, type ToolInfo, accountCheckSchema, accountStatusSchema, capabilitiesListSchema, createJobSchema, createTargetSchema, evidenceListSchema, findingsSearchSchema, jobIdSchema, parseAppStoreId, resolveInputSchema, targetIdSchema, terminalInputSchema, terminalStartSchema, terminalStopSchema };
|