@avenlabs/halal-trace-sdk 0.1.4 → 0.1.6
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/dist/client.d.ts +97 -6
- package/dist/client.js +116 -27
- package/dist/types.d.ts +89 -2
- package/package.json +2 -2
- package/src/client.ts +593 -148
- package/src/types.ts +98 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Anchor, AuditLog, AuditPack, AuditPackManifest, AuthResult, Batch, CertificationRecord, Device, DocumentAnchor, EventDepartment, HealthResponse, Hologram, HologramVerification, Invite, Member, Org, OrgInviteResult, OrgUserLookup, Permission, PublicAttribute, RelayerJobSummary, SignatureRecord, TraceEvent } from "./types.js";
|
|
1
|
+
import type { Anchor, AuditLog, AuditPack, AuditPackWithBatch, AuditPackManifest, AuthResult, Batch, BatchTrace, CertificationRecord, Device, DocumentAnchor, EventDepartment, HealthResponse, Hologram, HologramVerification, Invite, InviteAcceptance, AccessRequest, Member, Org, OrgSummary, OrgInviteResult, OrgUserLookup, Permission, PublicAttribute, RelayerJobSummary, SignatureRecord, TraceEvent } from "./types.js";
|
|
2
2
|
import { ApiError, type AuthOptions, type ClientHooks, type RequestOptions, type RetryOptions } from "./http.js";
|
|
3
3
|
type BaseClientOptions = {
|
|
4
4
|
baseUrl: string;
|
|
@@ -74,6 +74,24 @@ export declare class ApiClient {
|
|
|
74
74
|
}) => Promise<AuthResult>;
|
|
75
75
|
};
|
|
76
76
|
orgs: {
|
|
77
|
+
list: () => Promise<{
|
|
78
|
+
requestId: string;
|
|
79
|
+
status: import("./types.js").ApiStatus;
|
|
80
|
+
data?: Org[] | undefined;
|
|
81
|
+
relayerJob?: RelayerJobSummary | null;
|
|
82
|
+
}>;
|
|
83
|
+
get: (orgId: string) => Promise<{
|
|
84
|
+
requestId: string;
|
|
85
|
+
status: import("./types.js").ApiStatus;
|
|
86
|
+
data?: Org | undefined;
|
|
87
|
+
relayerJob?: RelayerJobSummary | null;
|
|
88
|
+
}>;
|
|
89
|
+
getSummary: (orgId: string) => Promise<{
|
|
90
|
+
requestId: string;
|
|
91
|
+
status: import("./types.js").ApiStatus;
|
|
92
|
+
data?: OrgSummary | undefined;
|
|
93
|
+
relayerJob?: RelayerJobSummary | null;
|
|
94
|
+
}>;
|
|
77
95
|
create: (payload: {
|
|
78
96
|
orgId: string;
|
|
79
97
|
name?: string;
|
|
@@ -115,6 +133,42 @@ export declare class ApiClient {
|
|
|
115
133
|
relayerJob?: RelayerJobSummary | null;
|
|
116
134
|
}>;
|
|
117
135
|
listMembersAll: (orgId: string) => AsyncGenerator<Member, void, unknown>;
|
|
136
|
+
listBatches: (orgId: string, query?: {
|
|
137
|
+
limit?: number;
|
|
138
|
+
offset?: number;
|
|
139
|
+
}) => Promise<{
|
|
140
|
+
requestId: string;
|
|
141
|
+
status: import("./types.js").ApiStatus;
|
|
142
|
+
data?: Batch[] | undefined;
|
|
143
|
+
relayerJob?: RelayerJobSummary | null;
|
|
144
|
+
}>;
|
|
145
|
+
listDevices: (orgId: string, query?: {
|
|
146
|
+
limit?: number;
|
|
147
|
+
offset?: number;
|
|
148
|
+
}) => Promise<{
|
|
149
|
+
requestId: string;
|
|
150
|
+
status: import("./types.js").ApiStatus;
|
|
151
|
+
data?: Device[] | undefined;
|
|
152
|
+
relayerJob?: RelayerJobSummary | null;
|
|
153
|
+
}>;
|
|
154
|
+
listHolograms: (orgId: string, query?: {
|
|
155
|
+
limit?: number;
|
|
156
|
+
offset?: number;
|
|
157
|
+
}) => Promise<{
|
|
158
|
+
requestId: string;
|
|
159
|
+
status: import("./types.js").ApiStatus;
|
|
160
|
+
data?: Hologram[] | undefined;
|
|
161
|
+
relayerJob?: RelayerJobSummary | null;
|
|
162
|
+
}>;
|
|
163
|
+
listAuditPacks: (orgId: string, query?: {
|
|
164
|
+
limit?: number;
|
|
165
|
+
offset?: number;
|
|
166
|
+
}) => Promise<{
|
|
167
|
+
requestId: string;
|
|
168
|
+
status: import("./types.js").ApiStatus;
|
|
169
|
+
data?: AuditPackWithBatch[] | undefined;
|
|
170
|
+
relayerJob?: RelayerJobSummary | null;
|
|
171
|
+
}>;
|
|
118
172
|
listAuditLogs: (orgId: string, query?: {
|
|
119
173
|
limit?: number;
|
|
120
174
|
offset?: number;
|
|
@@ -186,13 +240,14 @@ export declare class ApiClient {
|
|
|
186
240
|
data?: OrgInviteResult | undefined;
|
|
187
241
|
relayerJob?: RelayerJobSummary | null;
|
|
188
242
|
}>;
|
|
189
|
-
acceptInvite: (orgId: string, token: string
|
|
243
|
+
acceptInvite: (orgId: string, token: string, payload?: {
|
|
244
|
+
name?: string;
|
|
245
|
+
password?: string;
|
|
246
|
+
callbackURL?: string;
|
|
247
|
+
}) => Promise<{
|
|
190
248
|
requestId: string;
|
|
191
249
|
status: import("./types.js").ApiStatus;
|
|
192
|
-
data?:
|
|
193
|
-
invite: Invite;
|
|
194
|
-
member: Member;
|
|
195
|
-
} | undefined;
|
|
250
|
+
data?: InviteAcceptance | undefined;
|
|
196
251
|
relayerJob?: RelayerJobSummary | null;
|
|
197
252
|
}>;
|
|
198
253
|
lookupUserByEmail: (orgId: string, email: string) => Promise<{
|
|
@@ -325,6 +380,15 @@ export declare class ApiClient {
|
|
|
325
380
|
data?: AuditPackManifest | undefined;
|
|
326
381
|
relayerJob?: RelayerJobSummary | null;
|
|
327
382
|
}>;
|
|
383
|
+
getTrace: (batchId: string, query?: {
|
|
384
|
+
include?: string;
|
|
385
|
+
eventType?: string;
|
|
386
|
+
}) => Promise<{
|
|
387
|
+
requestId: string;
|
|
388
|
+
status: import("./types.js").ApiStatus;
|
|
389
|
+
data?: BatchTrace | undefined;
|
|
390
|
+
relayerJob?: RelayerJobSummary | null;
|
|
391
|
+
}>;
|
|
328
392
|
listRelayerJobs: (batchId: string, query?: {
|
|
329
393
|
status?: string;
|
|
330
394
|
jobType?: string;
|
|
@@ -411,6 +475,33 @@ export declare class ApiClient {
|
|
|
411
475
|
downloadPdf: (pdfUri: string) => Promise<ArrayBuffer>;
|
|
412
476
|
downloadJson: (jsonUri: string) => Promise<string>;
|
|
413
477
|
};
|
|
478
|
+
accessRequests: {
|
|
479
|
+
create: (payload: {
|
|
480
|
+
companyName: string;
|
|
481
|
+
adminEmail: string;
|
|
482
|
+
companyDomain: string;
|
|
483
|
+
headcountEstimate?: number;
|
|
484
|
+
}) => Promise<{
|
|
485
|
+
requestId: string;
|
|
486
|
+
status: import("./types.js").ApiStatus;
|
|
487
|
+
data?: AccessRequest | undefined;
|
|
488
|
+
relayerJob?: RelayerJobSummary | null;
|
|
489
|
+
}>;
|
|
490
|
+
approve: (id: number, payload?: {
|
|
491
|
+
orgId?: string;
|
|
492
|
+
orgName?: string;
|
|
493
|
+
inviteUrl?: string;
|
|
494
|
+
}) => Promise<{
|
|
495
|
+
requestId: string;
|
|
496
|
+
status: import("./types.js").ApiStatus;
|
|
497
|
+
data?: {
|
|
498
|
+
lead: AccessRequest;
|
|
499
|
+
org: Org;
|
|
500
|
+
invite: Invite;
|
|
501
|
+
} | undefined;
|
|
502
|
+
relayerJob?: RelayerJobSummary | null;
|
|
503
|
+
}>;
|
|
504
|
+
};
|
|
414
505
|
holograms: {
|
|
415
506
|
issue: (payload: {
|
|
416
507
|
batchId: string;
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiError, request, requestRaw } from "./http.js";
|
|
2
|
-
const sdkVersion = "0.1.
|
|
1
|
+
import { ApiError, request, requestRaw, } from "./http.js";
|
|
2
|
+
const sdkVersion = "0.1.6";
|
|
3
3
|
const withDefaults = (client, options = {}) => {
|
|
4
4
|
return {
|
|
5
5
|
...options,
|
|
@@ -11,7 +11,9 @@ const withDefaults = (client, options = {}) => {
|
|
|
11
11
|
sdkHeaders: {
|
|
12
12
|
"x-sdk-name": "@avenlabs/halal-trace-sdk",
|
|
13
13
|
"x-sdk-version": sdkVersion,
|
|
14
|
-
...(client.clientVersion
|
|
14
|
+
...(client.clientVersion
|
|
15
|
+
? { "x-client-version": client.clientVersion }
|
|
16
|
+
: {}),
|
|
15
17
|
...(client.userAgent ? { "User-Agent": client.userAgent } : {}),
|
|
16
18
|
},
|
|
17
19
|
hooks: client.hooks,
|
|
@@ -23,7 +25,10 @@ async function* listPaginated(client, path, query) {
|
|
|
23
25
|
const limit = query?.limit ?? 50;
|
|
24
26
|
let offset = 0;
|
|
25
27
|
while (true) {
|
|
26
|
-
const response = await client.request("GET", path, {
|
|
28
|
+
const response = await client.request("GET", path, {
|
|
29
|
+
query: { ...query, limit, offset },
|
|
30
|
+
canRetry: true,
|
|
31
|
+
});
|
|
27
32
|
const items = response.body.data ?? [];
|
|
28
33
|
for (const item of items) {
|
|
29
34
|
yield item;
|
|
@@ -35,7 +40,10 @@ async function* listPaginated(client, path, query) {
|
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
async function* listSingle(client, path, query) {
|
|
38
|
-
const response = await client.request("GET", path, {
|
|
43
|
+
const response = await client.request("GET", path, {
|
|
44
|
+
query,
|
|
45
|
+
canRetry: true,
|
|
46
|
+
});
|
|
39
47
|
const items = response.body.data ?? [];
|
|
40
48
|
for (const item of items) {
|
|
41
49
|
yield item;
|
|
@@ -45,7 +53,11 @@ async function* listRelayerJobsAll(client, orgId, query) {
|
|
|
45
53
|
const limit = query?.limit ?? 100;
|
|
46
54
|
let offset = 0;
|
|
47
55
|
while (true) {
|
|
48
|
-
const response = await client.orgs.listRelayerJobs(orgId, {
|
|
56
|
+
const response = await client.orgs.listRelayerJobs(orgId, {
|
|
57
|
+
...query,
|
|
58
|
+
limit,
|
|
59
|
+
offset,
|
|
60
|
+
});
|
|
49
61
|
const items = response.data ?? [];
|
|
50
62
|
for (const item of items) {
|
|
51
63
|
yield item;
|
|
@@ -101,13 +113,21 @@ export class ApiClient {
|
|
|
101
113
|
};
|
|
102
114
|
}
|
|
103
115
|
health = {
|
|
104
|
-
get: async () => unwrap((await this.request("GET", "/health", {
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
get: async () => unwrap((await this.request("GET", "/health", {
|
|
117
|
+
canRetry: true,
|
|
118
|
+
})).body),
|
|
119
|
+
live: async () => unwrap((await this.request("GET", "/live", { canRetry: true }))
|
|
120
|
+
.body),
|
|
121
|
+
ready: async () => unwrap((await this.request("GET", "/ready", {
|
|
122
|
+
canRetry: true,
|
|
123
|
+
})).body),
|
|
107
124
|
};
|
|
108
125
|
system = {
|
|
109
126
|
docs: async () => {
|
|
110
|
-
const response = await requestRaw(this.baseUrl, "/docs", "GET", {
|
|
127
|
+
const response = await requestRaw(this.baseUrl, "/docs", "GET", {
|
|
128
|
+
...withDefaults(this, {}),
|
|
129
|
+
canRetry: true,
|
|
130
|
+
});
|
|
111
131
|
return response.body;
|
|
112
132
|
},
|
|
113
133
|
openApi: async () => {
|
|
@@ -115,7 +135,10 @@ export class ApiClient {
|
|
|
115
135
|
return response.body;
|
|
116
136
|
},
|
|
117
137
|
metrics: async () => {
|
|
118
|
-
const response = await requestRaw(this.baseUrl, "/metrics", "GET", {
|
|
138
|
+
const response = await requestRaw(this.baseUrl, "/metrics", "GET", {
|
|
139
|
+
...withDefaults(this, {}),
|
|
140
|
+
canRetry: true,
|
|
141
|
+
});
|
|
119
142
|
return response.body;
|
|
120
143
|
},
|
|
121
144
|
inviteLanding: async (orgId, token) => {
|
|
@@ -134,7 +157,11 @@ export class ApiClient {
|
|
|
134
157
|
body: payload,
|
|
135
158
|
canRetry: false,
|
|
136
159
|
});
|
|
137
|
-
return {
|
|
160
|
+
return {
|
|
161
|
+
data: response.body,
|
|
162
|
+
token: response.headers.get("set-auth-token"),
|
|
163
|
+
requestId: response.requestId,
|
|
164
|
+
};
|
|
138
165
|
},
|
|
139
166
|
signInEmail: async (payload, options) => {
|
|
140
167
|
const response = await requestRaw(this.baseUrl, "/api/auth/sign-in/email", "POST", {
|
|
@@ -142,7 +169,11 @@ export class ApiClient {
|
|
|
142
169
|
body: payload,
|
|
143
170
|
canRetry: false,
|
|
144
171
|
});
|
|
145
|
-
return {
|
|
172
|
+
return {
|
|
173
|
+
data: response.body,
|
|
174
|
+
token: response.headers.get("set-auth-token"),
|
|
175
|
+
requestId: response.requestId,
|
|
176
|
+
};
|
|
146
177
|
},
|
|
147
178
|
verifyEmail: async (token, callbackURL) => {
|
|
148
179
|
const response = await requestRaw(this.baseUrl, "/api/auth/verify-email", "GET", {
|
|
@@ -150,7 +181,11 @@ export class ApiClient {
|
|
|
150
181
|
query: { token, callbackURL },
|
|
151
182
|
canRetry: true,
|
|
152
183
|
});
|
|
153
|
-
return {
|
|
184
|
+
return {
|
|
185
|
+
data: response.body,
|
|
186
|
+
token: response.headers.get("set-auth-token"),
|
|
187
|
+
requestId: response.requestId,
|
|
188
|
+
};
|
|
154
189
|
},
|
|
155
190
|
requestPasswordReset: async (payload) => {
|
|
156
191
|
const response = await requestRaw(this.baseUrl, "/api/auth/request-password-reset", "POST", {
|
|
@@ -158,7 +193,11 @@ export class ApiClient {
|
|
|
158
193
|
body: payload,
|
|
159
194
|
canRetry: false,
|
|
160
195
|
});
|
|
161
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
data: response.body,
|
|
198
|
+
token: response.headers.get("set-auth-token"),
|
|
199
|
+
requestId: response.requestId,
|
|
200
|
+
};
|
|
162
201
|
},
|
|
163
202
|
resetPassword: async (payload) => {
|
|
164
203
|
const response = await requestRaw(this.baseUrl, "/api/auth/reset-password", "POST", {
|
|
@@ -166,10 +205,17 @@ export class ApiClient {
|
|
|
166
205
|
body: payload,
|
|
167
206
|
canRetry: false,
|
|
168
207
|
});
|
|
169
|
-
return {
|
|
208
|
+
return {
|
|
209
|
+
data: response.body,
|
|
210
|
+
token: response.headers.get("set-auth-token"),
|
|
211
|
+
requestId: response.requestId,
|
|
212
|
+
};
|
|
170
213
|
},
|
|
171
214
|
};
|
|
172
215
|
orgs = {
|
|
216
|
+
list: async () => await this.request("GET", "/orgs", { canRetry: true }).then((res) => res.body),
|
|
217
|
+
get: async (orgId) => await this.request("GET", `/orgs/${orgId}`, { canRetry: true }).then((res) => res.body),
|
|
218
|
+
getSummary: async (orgId) => await this.request("GET", `/orgs/${orgId}/summary`, { canRetry: true }).then((res) => res.body),
|
|
173
219
|
create: async (payload, options) => await this.request("POST", "/orgs", {
|
|
174
220
|
...options,
|
|
175
221
|
body: payload,
|
|
@@ -182,18 +228,38 @@ export class ApiClient {
|
|
|
182
228
|
canRetry: true,
|
|
183
229
|
idempotencyKey: options?.idempotencyKey,
|
|
184
230
|
}).then((res) => res.body),
|
|
185
|
-
updateMember: async (orgId, userId, payload) => await this.request("PATCH", `/orgs/${orgId}/members/${userId}`, {
|
|
186
|
-
|
|
187
|
-
|
|
231
|
+
updateMember: async (orgId, userId, payload) => await this.request("PATCH", `/orgs/${orgId}/members/${userId}`, {
|
|
232
|
+
body: payload,
|
|
233
|
+
canRetry: false,
|
|
234
|
+
}).then((res) => res.body),
|
|
235
|
+
removeMember: async (orgId, userId) => await this.request("DELETE", `/orgs/${orgId}/members/${userId}`, {
|
|
236
|
+
canRetry: false,
|
|
237
|
+
}).then((res) => res.body),
|
|
238
|
+
listMembers: async (orgId) => await this.request("GET", `/orgs/${orgId}/members`, {
|
|
239
|
+
canRetry: true,
|
|
240
|
+
}).then((res) => res.body),
|
|
188
241
|
listMembersAll: (orgId) => listSingle(this, `/orgs/${orgId}/members`),
|
|
189
|
-
|
|
242
|
+
listBatches: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/batches`, { query, canRetry: true }).then((res) => res.body),
|
|
243
|
+
listDevices: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/devices`, { query, canRetry: true }).then((res) => res.body),
|
|
244
|
+
listHolograms: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/holograms`, { query, canRetry: true }).then((res) => res.body),
|
|
245
|
+
listAuditPacks: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/audit-packs`, {
|
|
246
|
+
query,
|
|
247
|
+
canRetry: true,
|
|
248
|
+
}).then((res) => res.body),
|
|
249
|
+
listAuditLogs: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/audit-logs`, {
|
|
250
|
+
query,
|
|
251
|
+
canRetry: true,
|
|
252
|
+
}).then((res) => res.body),
|
|
190
253
|
listAuditLogsAll: (orgId, query) => listPaginated(this, `/orgs/${orgId}/audit-logs`, query),
|
|
191
254
|
listRelayerJobs: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/relayer-jobs`, { query, canRetry: true }).then((res) => res.body),
|
|
192
255
|
getRelayerJob: async (orgId, jobId) => await this.request("GET", `/orgs/${orgId}/relayer-jobs/${jobId}`, { canRetry: true }).then((res) => res.body),
|
|
193
256
|
listDeadRelayerJobs: async (orgId) => await this.request("GET", `/orgs/${orgId}/relayer-jobs/dead`, { canRetry: true }).then((res) => res.body),
|
|
194
257
|
retryRelayerJob: async (orgId, jobId) => await this.request("POST", `/orgs/${orgId}/relayer-jobs/${jobId}/retry`, { canRetry: false }).then((res) => res.body),
|
|
195
258
|
backfillOrg: async (orgId) => await this.request("POST", `/orgs/${orgId}/relayer-jobs/backfill`, { canRetry: false }).then((res) => res.body),
|
|
196
|
-
listInvites: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/invites`, {
|
|
259
|
+
listInvites: async (orgId, query) => await this.request("GET", `/orgs/${orgId}/invites`, {
|
|
260
|
+
query,
|
|
261
|
+
canRetry: true,
|
|
262
|
+
}).then((res) => res.body),
|
|
197
263
|
listInvitesAll: (orgId, query) => listSingle(this, `/orgs/${orgId}/invites`, query),
|
|
198
264
|
inviteMember: async (orgId, payload, options) => await this.request("POST", `/orgs/${orgId}/invites`, {
|
|
199
265
|
...options,
|
|
@@ -201,10 +267,18 @@ export class ApiClient {
|
|
|
201
267
|
canRetry: true,
|
|
202
268
|
idempotencyKey: options?.idempotencyKey,
|
|
203
269
|
}).then((res) => res.body),
|
|
204
|
-
acceptInvite: async (orgId, token) => await this.request("POST", `/orgs/${orgId}/invites/${token}/accept`, { canRetry: false }).then((res) => res.body),
|
|
205
|
-
lookupUserByEmail: async (orgId, email) => await this.request("GET", `/orgs/${orgId}/users`, {
|
|
206
|
-
|
|
207
|
-
|
|
270
|
+
acceptInvite: async (orgId, token, payload) => await this.request("POST", `/orgs/${orgId}/invites/${token}/accept`, { body: payload, canRetry: false }).then((res) => res.body),
|
|
271
|
+
lookupUserByEmail: async (orgId, email) => await this.request("GET", `/orgs/${orgId}/users`, {
|
|
272
|
+
query: { email },
|
|
273
|
+
canRetry: true,
|
|
274
|
+
}).then((res) => res.body),
|
|
275
|
+
listPermissions: async (orgId) => await this.request("GET", `/orgs/${orgId}/permissions`, {
|
|
276
|
+
canRetry: true,
|
|
277
|
+
}).then((res) => res.body),
|
|
278
|
+
addPermission: async (orgId, payload) => await this.request("POST", `/orgs/${orgId}/permissions`, {
|
|
279
|
+
body: payload,
|
|
280
|
+
canRetry: false,
|
|
281
|
+
}).then((res) => res.body),
|
|
208
282
|
removePermission: async (orgId, payload) => await this.request("DELETE", `/orgs/${orgId}/permissions`, {
|
|
209
283
|
body: payload,
|
|
210
284
|
canRetry: false,
|
|
@@ -220,7 +294,10 @@ export class ApiClient {
|
|
|
220
294
|
const start = Date.now();
|
|
221
295
|
while (Date.now() - start < timeoutMs) {
|
|
222
296
|
const job = await this.relayerJobs.get(orgId, jobId);
|
|
223
|
-
if (job &&
|
|
297
|
+
if (job &&
|
|
298
|
+
(job.status === "completed" ||
|
|
299
|
+
job.status === "dead" ||
|
|
300
|
+
job.status === "failed")) {
|
|
224
301
|
return job;
|
|
225
302
|
}
|
|
226
303
|
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
@@ -232,7 +309,11 @@ export class ApiClient {
|
|
|
232
309
|
const intervalMs = options?.intervalMs ?? 2000;
|
|
233
310
|
const start = Date.now();
|
|
234
311
|
while (Date.now() - start < timeoutMs) {
|
|
235
|
-
const jobs = await this.orgs.listRelayerJobs(orgId, {
|
|
312
|
+
const jobs = await this.orgs.listRelayerJobs(orgId, {
|
|
313
|
+
requestId,
|
|
314
|
+
limit: 10,
|
|
315
|
+
offset: 0,
|
|
316
|
+
});
|
|
236
317
|
const job = jobs.data?.[0];
|
|
237
318
|
if (job) {
|
|
238
319
|
return job;
|
|
@@ -280,6 +361,7 @@ export class ApiClient {
|
|
|
280
361
|
idempotencyKey: options?.idempotencyKey,
|
|
281
362
|
}).then((res) => res.body),
|
|
282
363
|
getAuditPackManifest: async (batchId) => await this.request("GET", `/batches/${batchId}/audit-pack/manifest`, { canRetry: true }).then((res) => res.body),
|
|
364
|
+
getTrace: async (batchId, query) => await this.request("GET", `/batches/${batchId}/trace`, { query, canRetry: true }).then((res) => res.body),
|
|
283
365
|
listRelayerJobs: async (batchId, query) => await this.request("GET", `/batches/${batchId}/relayer-jobs`, { query, canRetry: true }).then((res) => res.body),
|
|
284
366
|
listRelayerJobsAll: (batchId, query) => listPaginated(this, `/batches/${batchId}/relayer-jobs`, query),
|
|
285
367
|
backfillBatch: async (batchId) => await this.request("POST", `/batches/${batchId}/relayer-jobs/backfill`, { canRetry: false }).then((res) => res.body),
|
|
@@ -334,6 +416,13 @@ export class ApiClient {
|
|
|
334
416
|
return response.text();
|
|
335
417
|
},
|
|
336
418
|
};
|
|
419
|
+
accessRequests = {
|
|
420
|
+
create: async (payload) => await this.request("POST", "/access-requests", {
|
|
421
|
+
body: payload,
|
|
422
|
+
canRetry: false,
|
|
423
|
+
}).then((res) => res.body),
|
|
424
|
+
approve: async (id, payload) => await this.request("POST", `/access-requests/${id}/approve`, { body: payload, canRetry: false }).then((res) => res.body),
|
|
425
|
+
};
|
|
337
426
|
holograms = {
|
|
338
427
|
issue: async (payload, options) => await this.request("POST", "/holograms", {
|
|
339
428
|
...options,
|
package/dist/types.d.ts
CHANGED
|
@@ -20,10 +20,33 @@ export type RelayerJobSummary = {
|
|
|
20
20
|
export type Org = {
|
|
21
21
|
orgId: string;
|
|
22
22
|
name?: string | null;
|
|
23
|
-
adminId
|
|
23
|
+
adminId?: string | null;
|
|
24
24
|
active?: boolean;
|
|
25
|
+
status?: string;
|
|
26
|
+
invitePolicy?: string;
|
|
27
|
+
allowlistedDomains?: string;
|
|
25
28
|
createdAt?: string;
|
|
26
29
|
};
|
|
30
|
+
export type OrgSummary = {
|
|
31
|
+
orgId: string;
|
|
32
|
+
batchesTotal: number;
|
|
33
|
+
batchesActive: number;
|
|
34
|
+
devicesTotal: number;
|
|
35
|
+
devicesActive: number;
|
|
36
|
+
membersTotal: number;
|
|
37
|
+
hologramsTotal: number;
|
|
38
|
+
auditPacksTotal: number;
|
|
39
|
+
relayerJobs: {
|
|
40
|
+
pending: number;
|
|
41
|
+
processing: number;
|
|
42
|
+
completed: number;
|
|
43
|
+
failed: number;
|
|
44
|
+
dead: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type AuditPackWithBatch = AuditPack & {
|
|
48
|
+
batch: Batch;
|
|
49
|
+
};
|
|
27
50
|
export type Batch = {
|
|
28
51
|
batchId: string;
|
|
29
52
|
orgId: string;
|
|
@@ -120,6 +143,52 @@ export type AuditPackManifest = {
|
|
|
120
143
|
auditPack: AuditPack;
|
|
121
144
|
publicAttributes: PublicAttribute[];
|
|
122
145
|
};
|
|
146
|
+
export type TraceTimelineItem = {
|
|
147
|
+
kind: "event";
|
|
148
|
+
id: number;
|
|
149
|
+
recordedAt: string;
|
|
150
|
+
eventType: string;
|
|
151
|
+
metadataHash: string;
|
|
152
|
+
actorRole: string;
|
|
153
|
+
deviceId?: string | null;
|
|
154
|
+
} | {
|
|
155
|
+
kind: "document";
|
|
156
|
+
id: number;
|
|
157
|
+
recordedAt: string;
|
|
158
|
+
docType: string;
|
|
159
|
+
docHash: string;
|
|
160
|
+
uri: string;
|
|
161
|
+
} | {
|
|
162
|
+
kind: "signature";
|
|
163
|
+
id: number;
|
|
164
|
+
recordedAt: string;
|
|
165
|
+
signerRole: string;
|
|
166
|
+
signatureHash: string;
|
|
167
|
+
signerIdHash: string;
|
|
168
|
+
} | {
|
|
169
|
+
kind: "certification";
|
|
170
|
+
id: number;
|
|
171
|
+
recordedAt: string;
|
|
172
|
+
status: "pending" | "approved" | "rejected";
|
|
173
|
+
decisionHash: string;
|
|
174
|
+
reviewerRole: string;
|
|
175
|
+
reviewerIdHash: string;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "public_attribute";
|
|
178
|
+
id: number;
|
|
179
|
+
recordedAt: string;
|
|
180
|
+
key: string;
|
|
181
|
+
value: string;
|
|
182
|
+
};
|
|
183
|
+
export type BatchTrace = {
|
|
184
|
+
batch: Batch;
|
|
185
|
+
timeline: TraceTimelineItem[];
|
|
186
|
+
events: TraceEvent[];
|
|
187
|
+
documents: DocumentAnchor[];
|
|
188
|
+
signatures: SignatureRecord[];
|
|
189
|
+
certifications: CertificationRecord[];
|
|
190
|
+
publicAttributes: PublicAttribute[];
|
|
191
|
+
};
|
|
123
192
|
export type HologramVerification = {
|
|
124
193
|
hologramId: string;
|
|
125
194
|
publicCode: string;
|
|
@@ -161,10 +230,28 @@ export type Invite = {
|
|
|
161
230
|
role: string;
|
|
162
231
|
department: string;
|
|
163
232
|
status: string;
|
|
164
|
-
invitedBy
|
|
233
|
+
invitedBy?: string | null;
|
|
165
234
|
createdAt: string;
|
|
166
235
|
expiresAt: string;
|
|
167
236
|
acceptedAt?: string | null;
|
|
237
|
+
tokenHash?: string | null;
|
|
238
|
+
usedAt?: string | null;
|
|
239
|
+
};
|
|
240
|
+
export type InviteAcceptance = {
|
|
241
|
+
invite: Invite;
|
|
242
|
+
member: Member;
|
|
243
|
+
mode?: "accepted" | "signup";
|
|
244
|
+
};
|
|
245
|
+
export type AccessRequest = {
|
|
246
|
+
id: number;
|
|
247
|
+
companyName: string;
|
|
248
|
+
adminEmail: string;
|
|
249
|
+
companyDomain: string;
|
|
250
|
+
headcountEstimate?: number | null;
|
|
251
|
+
status: string;
|
|
252
|
+
approvedBy?: string | null;
|
|
253
|
+
approvedAt?: string | null;
|
|
254
|
+
createdAt: string;
|
|
168
255
|
};
|
|
169
256
|
export type Permission = {
|
|
170
257
|
orgId: string;
|
package/package.json
CHANGED