@1mtx/did-api-contract 1.0.1 → 1.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/dist/index.d.mts +4045 -396
- package/dist/index.d.ts +4045 -396
- package/dist/index.js +487 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +463 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -25,24 +25,47 @@ __export(index_exports, {
|
|
|
25
25
|
CheckinSubmitRequestSchema: () => CheckinSubmitRequestSchema,
|
|
26
26
|
CheckinSubmitResponseSchema: () => CheckinSubmitResponseSchema,
|
|
27
27
|
CreateEventSchema: () => CreateEventSchema,
|
|
28
|
+
CreateInvitationSchema: () => CreateInvitationSchema,
|
|
29
|
+
CreateOrganisationSchema: () => CreateOrganisationSchema,
|
|
28
30
|
EventDetailResponseSchema: () => EventDetailResponseSchema,
|
|
31
|
+
EventDiscoverSchema: () => EventDiscoverSchema,
|
|
29
32
|
EventPublicInfoSchema: () => EventPublicInfoSchema,
|
|
30
33
|
EventResponseSchema: () => EventResponseSchema,
|
|
34
|
+
InvitationResponseSchema: () => InvitationResponseSchema,
|
|
35
|
+
IssueVCSchema: () => IssueVCSchema,
|
|
36
|
+
JoinInvitationSchema: () => JoinInvitationSchema,
|
|
37
|
+
MemberResponseSchema: () => MemberResponseSchema,
|
|
38
|
+
OrgDetailResponseSchema: () => OrgDetailResponseSchema,
|
|
39
|
+
OrgListItemSchema: () => OrgListItemSchema,
|
|
40
|
+
OrgResponseSchema: () => OrgResponseSchema,
|
|
31
41
|
ParticipantSchema: () => ParticipantSchema,
|
|
32
42
|
SUPPORTED_FIELDS: () => SUPPORTED_FIELDS,
|
|
43
|
+
TrackScanRequestSchema: () => TrackScanRequestSchema,
|
|
44
|
+
TrackScanResponseSchema: () => TrackScanResponseSchema,
|
|
33
45
|
TurnCredentialsResponseSchema: () => TurnCredentialsResponseSchema,
|
|
34
46
|
UpdateEventSchema: () => UpdateEventSchema,
|
|
47
|
+
UpdateMemberRoleSchema: () => UpdateMemberRoleSchema,
|
|
48
|
+
UpdateOrganisationSchema: () => UpdateOrganisationSchema,
|
|
49
|
+
UploadPresignedUrlSchema: () => UploadPresignedUrlSchema,
|
|
35
50
|
VerifyRequestSchema: () => VerifyRequestSchema,
|
|
36
51
|
VerifyResponseSchema: () => VerifyResponseSchema,
|
|
52
|
+
appConfigContract: () => appConfigContract,
|
|
37
53
|
authContract: () => authContract,
|
|
38
54
|
buildAuthMessage: () => buildAuthMessage,
|
|
39
55
|
checkinContract: () => checkinContract,
|
|
40
56
|
contract: () => contract,
|
|
41
57
|
eventsContract: () => eventsContract,
|
|
42
|
-
|
|
58
|
+
orgCredentialsContract: () => orgCredentialsContract,
|
|
59
|
+
orgCrudContract: () => orgCrudContract,
|
|
60
|
+
orgInvitationsContract: () => orgInvitationsContract,
|
|
61
|
+
orgMembersContract: () => orgMembersContract,
|
|
62
|
+
organisationsContract: () => organisationsContract,
|
|
63
|
+
trackingContract: () => trackingContract,
|
|
64
|
+
turnContract: () => turnContract,
|
|
65
|
+
uploadsContract: () => uploadsContract
|
|
43
66
|
});
|
|
44
67
|
module.exports = __toCommonJS(index_exports);
|
|
45
|
-
var
|
|
68
|
+
var import_core9 = require("@ts-rest/core");
|
|
46
69
|
|
|
47
70
|
// src/v1/auth.ts
|
|
48
71
|
var import_core = require("@ts-rest/core");
|
|
@@ -50,7 +73,7 @@ var import_zod = require("zod");
|
|
|
50
73
|
var c = (0, import_core.initContract)();
|
|
51
74
|
var AuthScheme = import_zod.z.enum(["eip191"]);
|
|
52
75
|
var VerifyRequestSchema = import_zod.z.object({
|
|
53
|
-
did: import_zod.z.string().min(1).describe("DID of the authenticating user (e.g. `did:ethr:0xABC...`)"),
|
|
76
|
+
did: import_zod.z.string().min(1).describe("DID of the authenticating user (e.g. `did:ethr:0xABC...` or `did:vbsn:0xABC...`)"),
|
|
54
77
|
signature: import_zod.z.string().min(1).describe(
|
|
55
78
|
"Hex signature of the `message` string, produced by the scheme specified in the message"
|
|
56
79
|
),
|
|
@@ -83,7 +106,7 @@ var authContract = c.router({
|
|
|
83
106
|
"|----------|-------|",
|
|
84
107
|
'| **Signing scheme** | ECDSA secp256k1 (`scheme: "eip191"`) |',
|
|
85
108
|
"| **Signature format** | [EIP-191](https://eips.ethereum.org/EIPS/eip-191) `personal_sign` (65-byte `r\u2016s\u2016v`, hex-encoded with `0x` prefix) |",
|
|
86
|
-
"| **DID method** | `did:ethr` \u2014 the Ethereum address in the DID must match the signer |",
|
|
109
|
+
"| **DID method** | `did:ethr` or `did:vbsn` \u2014 the Ethereum address in the DID must match the signer |",
|
|
87
110
|
"| **Message encoding** | UTF-8 JSON string |",
|
|
88
111
|
"",
|
|
89
112
|
"### Steps",
|
|
@@ -129,28 +152,37 @@ var import_core2 = require("@ts-rest/core");
|
|
|
129
152
|
var import_zod2 = require("zod");
|
|
130
153
|
var c2 = (0, import_core2.initContract)();
|
|
131
154
|
var SUPPORTED_FIELDS = [
|
|
155
|
+
"documentNumber",
|
|
132
156
|
"fullName",
|
|
133
|
-
"
|
|
134
|
-
"portrait",
|
|
157
|
+
"dateOfBirth",
|
|
135
158
|
"gender",
|
|
136
159
|
"nationality",
|
|
160
|
+
"ethnicity",
|
|
161
|
+
"hometown",
|
|
137
162
|
"permanentAddress",
|
|
138
|
-
"
|
|
163
|
+
"identifyingMarks",
|
|
164
|
+
"issueDate",
|
|
165
|
+
"expiryDate",
|
|
166
|
+
"fatherName",
|
|
167
|
+
"motherName",
|
|
168
|
+
"photo"
|
|
139
169
|
];
|
|
140
170
|
var CreateEventSchema = import_zod2.z.object({
|
|
141
171
|
name: import_zod2.z.string().min(1).max(255).describe("T\xEAn s\u1EF1 ki\u1EC7n"),
|
|
142
|
-
|
|
172
|
+
coverImageId: import_zod2.z.string().optional().describe("ID \u1EA3nh b\xECa s\u1EF1 ki\u1EC7n"),
|
|
143
173
|
description: import_zod2.z.string().optional().describe("M\xF4 t\u1EA3 s\u1EF1 ki\u1EC7n"),
|
|
144
174
|
maxGuests: import_zod2.z.number().int().positive().describe("S\u1ED1 l\u01B0\u1EE3ng kh\xE1ch t\u1ED1i \u0111a"),
|
|
145
|
-
|
|
175
|
+
startDateTime: import_zod2.z.string().datetime().describe("Th\u1EDDi gian b\u1EAFt \u0111\u1EA7u s\u1EF1 ki\u1EC7n"),
|
|
176
|
+
endDateTime: import_zod2.z.string().datetime().describe("Th\u1EDDi gian k\u1EBFt th\xFAc s\u1EF1 ki\u1EC7n"),
|
|
146
177
|
requestedFields: import_zod2.z.array(import_zod2.z.enum(SUPPORTED_FIELDS)).min(1).describe("C\xE1c tr\u01B0\u1EDDng d\u1EEF li\u1EC7u y\xEAu c\u1EA7u x\xE1c th\u1EF1c")
|
|
147
178
|
});
|
|
148
179
|
var UpdateEventSchema = import_zod2.z.object({
|
|
149
180
|
name: import_zod2.z.string().min(1).max(255).optional(),
|
|
150
|
-
|
|
181
|
+
coverImageId: import_zod2.z.string().nullable().optional(),
|
|
151
182
|
description: import_zod2.z.string().nullable().optional(),
|
|
152
183
|
maxGuests: import_zod2.z.number().int().positive().optional(),
|
|
153
|
-
|
|
184
|
+
startDateTime: import_zod2.z.string().datetime().optional(),
|
|
185
|
+
endDateTime: import_zod2.z.string().datetime().optional(),
|
|
154
186
|
status: import_zod2.z.enum(["ACTIVE", "CANCELLED", "COMPLETED"]).optional()
|
|
155
187
|
});
|
|
156
188
|
var ParticipantSchema = import_zod2.z.object({
|
|
@@ -163,9 +195,11 @@ var EventResponseSchema = import_zod2.z.object({
|
|
|
163
195
|
id: import_zod2.z.string(),
|
|
164
196
|
name: import_zod2.z.string(),
|
|
165
197
|
coverImageUrl: import_zod2.z.string().nullable(),
|
|
198
|
+
thumbnailUrl: import_zod2.z.string().nullable(),
|
|
166
199
|
description: import_zod2.z.string().nullable(),
|
|
167
200
|
maxGuests: import_zod2.z.number(),
|
|
168
|
-
|
|
201
|
+
startDateTime: import_zod2.z.string(),
|
|
202
|
+
endDateTime: import_zod2.z.string().nullable(),
|
|
169
203
|
userId: import_zod2.z.string(),
|
|
170
204
|
requestedFields: import_zod2.z.array(import_zod2.z.string()),
|
|
171
205
|
status: import_zod2.z.enum(["ACTIVE", "CANCELLED", "COMPLETED"]),
|
|
@@ -177,8 +211,27 @@ var EventDetailResponseSchema = EventResponseSchema.extend({
|
|
|
177
211
|
participants: import_zod2.z.array(ParticipantSchema),
|
|
178
212
|
vpRequest: import_zod2.z.record(import_zod2.z.unknown())
|
|
179
213
|
});
|
|
214
|
+
var EventDiscoverSchema = import_zod2.z.object({
|
|
215
|
+
id: import_zod2.z.string(),
|
|
216
|
+
name: import_zod2.z.string(),
|
|
217
|
+
coverImageUrl: import_zod2.z.string().nullable(),
|
|
218
|
+
thumbnailUrl: import_zod2.z.string().nullable(),
|
|
219
|
+
description: import_zod2.z.string().nullable(),
|
|
220
|
+
startDateTime: import_zod2.z.string(),
|
|
221
|
+
endDateTime: import_zod2.z.string().nullable(),
|
|
222
|
+
participantCount: import_zod2.z.number()
|
|
223
|
+
});
|
|
180
224
|
var SECURITY = [{ bearerAuth: [] }];
|
|
181
225
|
var eventsContract = c2.router({
|
|
226
|
+
discover: {
|
|
227
|
+
method: "GET",
|
|
228
|
+
path: "/v1/events/public/discover",
|
|
229
|
+
responses: {
|
|
230
|
+
200: import_zod2.z.array(EventDiscoverSchema)
|
|
231
|
+
},
|
|
232
|
+
summary: "List public events for discovery (public)",
|
|
233
|
+
metadata: { openApiTags: ["Events"], openApiSecurity: [] }
|
|
234
|
+
},
|
|
182
235
|
create: {
|
|
183
236
|
method: "POST",
|
|
184
237
|
path: "/v1/events",
|
|
@@ -262,9 +315,11 @@ var EventPublicInfoSchema = import_zod3.z.object({
|
|
|
262
315
|
id: import_zod3.z.string(),
|
|
263
316
|
name: import_zod3.z.string(),
|
|
264
317
|
coverImageUrl: import_zod3.z.string().nullable(),
|
|
318
|
+
thumbnailUrl: import_zod3.z.string().nullable(),
|
|
265
319
|
description: import_zod3.z.string().nullable(),
|
|
266
320
|
maxGuests: import_zod3.z.number(),
|
|
267
|
-
|
|
321
|
+
startDateTime: import_zod3.z.string(),
|
|
322
|
+
endDateTime: import_zod3.z.string().nullable(),
|
|
268
323
|
currentGuests: import_zod3.z.number(),
|
|
269
324
|
status: import_zod3.z.enum(["ACTIVE", "CANCELLED", "COMPLETED"])
|
|
270
325
|
});
|
|
@@ -298,11 +353,12 @@ var checkinContract = c3.router({
|
|
|
298
353
|
responses: {
|
|
299
354
|
200: CheckinSubmitResponseSchema,
|
|
300
355
|
400: import_zod3.z.object({ message: import_zod3.z.string(), errors: import_zod3.z.array(import_zod3.z.string()).optional() }),
|
|
356
|
+
401: import_zod3.z.object({ message: import_zod3.z.string() }),
|
|
301
357
|
404: import_zod3.z.object({ message: import_zod3.z.string() }),
|
|
302
358
|
409: import_zod3.z.object({ message: import_zod3.z.string() })
|
|
303
359
|
},
|
|
304
|
-
summary: "Submit VP for event check-in \u2014 issues participation VC on success
|
|
305
|
-
metadata: { openApiTags: ["Check-in"], openApiSecurity: [] }
|
|
360
|
+
summary: "Submit VP for event check-in \u2014 issues participation VC on success",
|
|
361
|
+
metadata: { openApiTags: ["Check-in"], openApiSecurity: [{ bearerAuth: [] }] }
|
|
306
362
|
},
|
|
307
363
|
myCheckins: {
|
|
308
364
|
method: "GET",
|
|
@@ -313,6 +369,7 @@ var checkinContract = c3.router({
|
|
|
313
369
|
id: import_zod3.z.string(),
|
|
314
370
|
eventId: import_zod3.z.string(),
|
|
315
371
|
checkedInAt: import_zod3.z.string(),
|
|
372
|
+
disclosedFields: import_zod3.z.record(import_zod3.z.unknown()),
|
|
316
373
|
event: EventPublicInfoSchema
|
|
317
374
|
})
|
|
318
375
|
),
|
|
@@ -349,14 +406,401 @@ var turnContract = c4.router({
|
|
|
349
406
|
}
|
|
350
407
|
});
|
|
351
408
|
|
|
352
|
-
// src/
|
|
409
|
+
// src/v1/uploads.ts
|
|
410
|
+
var import_core5 = require("@ts-rest/core");
|
|
411
|
+
var import_zod5 = require("zod");
|
|
353
412
|
var c5 = (0, import_core5.initContract)();
|
|
354
|
-
var
|
|
355
|
-
|
|
413
|
+
var UploadPresignedUrlSchema = import_zod5.z.object({
|
|
414
|
+
fileId: import_zod5.z.string(),
|
|
415
|
+
original: import_zod5.z.object({
|
|
416
|
+
uploadUrl: import_zod5.z.string(),
|
|
417
|
+
key: import_zod5.z.string(),
|
|
418
|
+
publicUrl: import_zod5.z.string()
|
|
419
|
+
}),
|
|
420
|
+
resize: import_zod5.z.object({
|
|
421
|
+
uploadUrl: import_zod5.z.string(),
|
|
422
|
+
key: import_zod5.z.string(),
|
|
423
|
+
publicUrl: import_zod5.z.string()
|
|
424
|
+
})
|
|
425
|
+
});
|
|
426
|
+
var uploadsContract = c5.router(
|
|
427
|
+
{
|
|
428
|
+
generatePresignedUrls: {
|
|
429
|
+
method: "POST",
|
|
430
|
+
path: "/urls",
|
|
431
|
+
body: import_zod5.z.object({}),
|
|
432
|
+
responses: {
|
|
433
|
+
201: UploadPresignedUrlSchema
|
|
434
|
+
},
|
|
435
|
+
summary: "Generate pre-signed URLs for event image upload",
|
|
436
|
+
metadata: { openApiTags: ["Uploads"], openApiSecurity: [{ bearerAuth: [] }] }
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
pathPrefix: "/v1/uploads"
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
// src/v1/tracking.ts
|
|
445
|
+
var import_core6 = require("@ts-rest/core");
|
|
446
|
+
var import_zod6 = require("zod");
|
|
447
|
+
var c6 = (0, import_core6.initContract)();
|
|
448
|
+
var TrackScanRequestSchema = import_zod6.z.object({
|
|
449
|
+
platform: import_zod6.z.string(),
|
|
450
|
+
appVersion: import_zod6.z.string().optional()
|
|
451
|
+
});
|
|
452
|
+
var TrackScanResponseSchema = import_zod6.z.object({
|
|
453
|
+
id: import_zod6.z.string()
|
|
454
|
+
});
|
|
455
|
+
var trackingContract = c6.router({
|
|
456
|
+
scan: {
|
|
457
|
+
method: "POST",
|
|
458
|
+
path: "/v1/tracking/scan",
|
|
459
|
+
body: TrackScanRequestSchema,
|
|
460
|
+
responses: {
|
|
461
|
+
201: TrackScanResponseSchema,
|
|
462
|
+
401: import_zod6.z.object({ message: import_zod6.z.string() })
|
|
463
|
+
},
|
|
464
|
+
summary: "Record a successful NFC scan event",
|
|
465
|
+
metadata: { openApiTags: ["Tracking"], openApiSecurity: [{ bearerAuth: [] }] }
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// src/v1/config.ts
|
|
470
|
+
var import_core7 = require("@ts-rest/core");
|
|
471
|
+
var import_zod7 = require("zod");
|
|
472
|
+
var c7 = (0, import_core7.initContract)();
|
|
473
|
+
var appConfigContract = c7.router({
|
|
474
|
+
appConfig: {
|
|
475
|
+
method: "GET",
|
|
476
|
+
path: "/v1/config/app",
|
|
477
|
+
responses: {
|
|
478
|
+
200: import_zod7.z.object({
|
|
479
|
+
demoMode: import_zod7.z.object({ enabled: import_zod7.z.boolean() }),
|
|
480
|
+
publicEvents: import_zod7.z.object({ enabled: import_zod7.z.boolean() })
|
|
481
|
+
})
|
|
482
|
+
},
|
|
483
|
+
summary: "Get app configuration (public)",
|
|
484
|
+
metadata: { openApiTags: ["Config"], openApiSecurity: [] }
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// src/v1/organisations.ts
|
|
489
|
+
var import_core8 = require("@ts-rest/core");
|
|
490
|
+
var import_zod8 = require("zod");
|
|
491
|
+
var c8 = (0, import_core8.initContract)();
|
|
492
|
+
var SECURITY2 = [{ bearerAuth: [] }];
|
|
493
|
+
var CreateOrganisationSchema = import_zod8.z.object({
|
|
494
|
+
name: import_zod8.z.string().min(1).max(255),
|
|
495
|
+
description: import_zod8.z.string().optional(),
|
|
496
|
+
verifiablePresentation: import_zod8.z.record(import_zod8.z.unknown())
|
|
497
|
+
});
|
|
498
|
+
var UpdateOrganisationSchema = import_zod8.z.object({
|
|
499
|
+
name: import_zod8.z.string().min(1).max(255).optional(),
|
|
500
|
+
description: import_zod8.z.string().nullable().optional(),
|
|
501
|
+
avatarUrl: import_zod8.z.string().nullable().optional()
|
|
502
|
+
});
|
|
503
|
+
var OrgResponseSchema = import_zod8.z.object({
|
|
504
|
+
id: import_zod8.z.string(),
|
|
505
|
+
name: import_zod8.z.string(),
|
|
506
|
+
description: import_zod8.z.string().nullable(),
|
|
507
|
+
avatarUrl: import_zod8.z.string().nullable(),
|
|
508
|
+
didUri: import_zod8.z.string().nullable(),
|
|
509
|
+
memberCount: import_zod8.z.number(),
|
|
510
|
+
createdAt: import_zod8.z.string(),
|
|
511
|
+
updatedAt: import_zod8.z.string()
|
|
512
|
+
});
|
|
513
|
+
var OrgListItemSchema = OrgResponseSchema.extend({
|
|
514
|
+
role: import_zod8.z.enum(["OWNER", "ADMIN", "ISSUER", "MEMBER"])
|
|
515
|
+
});
|
|
516
|
+
var OrgDetailResponseSchema = OrgListItemSchema.extend({
|
|
517
|
+
members: import_zod8.z.array(import_zod8.z.object({
|
|
518
|
+
id: import_zod8.z.string(),
|
|
519
|
+
userId: import_zod8.z.string(),
|
|
520
|
+
displayName: import_zod8.z.string().nullable(),
|
|
521
|
+
role: import_zod8.z.enum(["OWNER", "ADMIN", "ISSUER", "MEMBER"]),
|
|
522
|
+
joinedAt: import_zod8.z.string()
|
|
523
|
+
}))
|
|
524
|
+
});
|
|
525
|
+
var MemberResponseSchema = import_zod8.z.object({
|
|
526
|
+
id: import_zod8.z.string(),
|
|
527
|
+
userId: import_zod8.z.string(),
|
|
528
|
+
displayName: import_zod8.z.string().nullable(),
|
|
529
|
+
role: import_zod8.z.enum(["OWNER", "ADMIN", "ISSUER", "MEMBER"]),
|
|
530
|
+
joinedAt: import_zod8.z.string()
|
|
531
|
+
});
|
|
532
|
+
var UpdateMemberRoleSchema = import_zod8.z.object({
|
|
533
|
+
role: import_zod8.z.enum(["ADMIN", "ISSUER", "MEMBER"])
|
|
534
|
+
});
|
|
535
|
+
var CreateInvitationSchema = import_zod8.z.object({
|
|
536
|
+
expiresInDays: import_zod8.z.number().int().positive().default(7).optional()
|
|
537
|
+
});
|
|
538
|
+
var InvitationResponseSchema = import_zod8.z.object({
|
|
539
|
+
id: import_zod8.z.string(),
|
|
540
|
+
orgId: import_zod8.z.string(),
|
|
541
|
+
orgName: import_zod8.z.string(),
|
|
542
|
+
token: import_zod8.z.string(),
|
|
543
|
+
status: import_zod8.z.enum(["PENDING", "SUBMITTED", "ACCEPTED", "DECLINED", "EXPIRED"]),
|
|
544
|
+
inviteeDisplayName: import_zod8.z.string().nullable(),
|
|
545
|
+
createdAt: import_zod8.z.string(),
|
|
546
|
+
expiresAt: import_zod8.z.string()
|
|
547
|
+
});
|
|
548
|
+
var JoinInvitationSchema = import_zod8.z.object({
|
|
549
|
+
verifiablePresentation: import_zod8.z.record(import_zod8.z.unknown())
|
|
550
|
+
});
|
|
551
|
+
var IssueVCSchema = import_zod8.z.object({
|
|
552
|
+
holderDid: import_zod8.z.string(),
|
|
553
|
+
credentialSubject: import_zod8.z.record(import_zod8.z.unknown()),
|
|
554
|
+
type: import_zod8.z.array(import_zod8.z.string()).optional()
|
|
555
|
+
});
|
|
556
|
+
var ErrorSchema = import_zod8.z.object({ message: import_zod8.z.string() });
|
|
557
|
+
var VpRequestResponseSchema = import_zod8.z.object({
|
|
558
|
+
vpRequest: import_zod8.z.record(import_zod8.z.unknown()),
|
|
559
|
+
expiresAt: import_zod8.z.string()
|
|
560
|
+
});
|
|
561
|
+
var orgCrudContract = c8.router({
|
|
562
|
+
createVpRequest: {
|
|
563
|
+
method: "POST",
|
|
564
|
+
path: "/v1/organisations/vp-request",
|
|
565
|
+
body: import_zod8.z.object({}),
|
|
566
|
+
responses: {
|
|
567
|
+
200: VpRequestResponseSchema,
|
|
568
|
+
401: ErrorSchema
|
|
569
|
+
},
|
|
570
|
+
summary: "Get VP request for creating an organisation",
|
|
571
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
572
|
+
},
|
|
573
|
+
create: {
|
|
574
|
+
method: "POST",
|
|
575
|
+
path: "/v1/organisations",
|
|
576
|
+
body: CreateOrganisationSchema,
|
|
577
|
+
responses: {
|
|
578
|
+
201: OrgResponseSchema,
|
|
579
|
+
400: ErrorSchema,
|
|
580
|
+
401: ErrorSchema
|
|
581
|
+
},
|
|
582
|
+
summary: "Create a new organisation (requires CCCD VP)",
|
|
583
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
584
|
+
},
|
|
585
|
+
list: {
|
|
586
|
+
method: "GET",
|
|
587
|
+
path: "/v1/organisations",
|
|
588
|
+
responses: {
|
|
589
|
+
200: import_zod8.z.array(OrgListItemSchema),
|
|
590
|
+
401: ErrorSchema
|
|
591
|
+
},
|
|
592
|
+
summary: "List user's organisations",
|
|
593
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
594
|
+
},
|
|
595
|
+
getById: {
|
|
596
|
+
method: "GET",
|
|
597
|
+
path: "/v1/organisations/:orgId",
|
|
598
|
+
responses: {
|
|
599
|
+
200: OrgDetailResponseSchema,
|
|
600
|
+
401: ErrorSchema,
|
|
601
|
+
403: ErrorSchema,
|
|
602
|
+
404: ErrorSchema
|
|
603
|
+
},
|
|
604
|
+
summary: "Get organisation details (members only)",
|
|
605
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
606
|
+
},
|
|
607
|
+
update: {
|
|
608
|
+
method: "PATCH",
|
|
609
|
+
path: "/v1/organisations/:orgId",
|
|
610
|
+
body: UpdateOrganisationSchema,
|
|
611
|
+
responses: {
|
|
612
|
+
200: OrgResponseSchema,
|
|
613
|
+
400: ErrorSchema,
|
|
614
|
+
401: ErrorSchema,
|
|
615
|
+
403: ErrorSchema,
|
|
616
|
+
404: ErrorSchema
|
|
617
|
+
},
|
|
618
|
+
summary: "Update organisation details (owner/admin only)",
|
|
619
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
620
|
+
},
|
|
621
|
+
delete: {
|
|
622
|
+
method: "DELETE",
|
|
623
|
+
path: "/v1/organisations/:orgId",
|
|
624
|
+
body: c8.noBody(),
|
|
625
|
+
responses: {
|
|
626
|
+
204: import_zod8.z.undefined(),
|
|
627
|
+
401: ErrorSchema,
|
|
628
|
+
403: ErrorSchema,
|
|
629
|
+
404: ErrorSchema
|
|
630
|
+
},
|
|
631
|
+
summary: "Delete organisation (owner only)",
|
|
632
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
var orgMembersContract = c8.router({
|
|
636
|
+
listMembers: {
|
|
637
|
+
method: "GET",
|
|
638
|
+
path: "/v1/organisations/:orgId/members",
|
|
639
|
+
responses: {
|
|
640
|
+
200: import_zod8.z.array(MemberResponseSchema),
|
|
641
|
+
401: ErrorSchema,
|
|
642
|
+
403: ErrorSchema
|
|
643
|
+
},
|
|
644
|
+
summary: "List organisation members",
|
|
645
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
646
|
+
},
|
|
647
|
+
updateMemberRole: {
|
|
648
|
+
method: "PATCH",
|
|
649
|
+
path: "/v1/organisations/:orgId/members/:memberId",
|
|
650
|
+
body: UpdateMemberRoleSchema,
|
|
651
|
+
responses: {
|
|
652
|
+
200: MemberResponseSchema,
|
|
653
|
+
400: ErrorSchema,
|
|
654
|
+
401: ErrorSchema,
|
|
655
|
+
403: ErrorSchema,
|
|
656
|
+
404: ErrorSchema
|
|
657
|
+
},
|
|
658
|
+
summary: "Update member role (owner/admin only)",
|
|
659
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
660
|
+
},
|
|
661
|
+
removeMember: {
|
|
662
|
+
method: "DELETE",
|
|
663
|
+
path: "/v1/organisations/:orgId/members/:memberId",
|
|
664
|
+
body: c8.noBody(),
|
|
665
|
+
responses: {
|
|
666
|
+
204: import_zod8.z.undefined(),
|
|
667
|
+
400: ErrorSchema,
|
|
668
|
+
401: ErrorSchema,
|
|
669
|
+
403: ErrorSchema,
|
|
670
|
+
404: ErrorSchema
|
|
671
|
+
},
|
|
672
|
+
summary: "Remove member from organisation (owner/admin only)",
|
|
673
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
var orgInvitationsContract = c8.router({
|
|
677
|
+
createInvitation: {
|
|
678
|
+
method: "POST",
|
|
679
|
+
path: "/v1/organisations/:orgId/invitations",
|
|
680
|
+
body: CreateInvitationSchema,
|
|
681
|
+
responses: {
|
|
682
|
+
201: InvitationResponseSchema,
|
|
683
|
+
401: ErrorSchema,
|
|
684
|
+
403: ErrorSchema
|
|
685
|
+
},
|
|
686
|
+
summary: "Create invitation (owner/admin only)",
|
|
687
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
688
|
+
},
|
|
689
|
+
listInvitations: {
|
|
690
|
+
method: "GET",
|
|
691
|
+
path: "/v1/organisations/:orgId/invitations",
|
|
692
|
+
responses: {
|
|
693
|
+
200: import_zod8.z.array(InvitationResponseSchema),
|
|
694
|
+
401: ErrorSchema,
|
|
695
|
+
403: ErrorSchema
|
|
696
|
+
},
|
|
697
|
+
summary: "List pending invitations (owner/admin only)",
|
|
698
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
699
|
+
},
|
|
700
|
+
joinVpRequest: {
|
|
701
|
+
method: "POST",
|
|
702
|
+
path: "/v1/organisations/invitations/:token/vp-request",
|
|
703
|
+
body: import_zod8.z.object({}),
|
|
704
|
+
responses: {
|
|
705
|
+
200: VpRequestResponseSchema,
|
|
706
|
+
401: ErrorSchema,
|
|
707
|
+
404: ErrorSchema,
|
|
708
|
+
410: ErrorSchema
|
|
709
|
+
},
|
|
710
|
+
summary: "Get VP request for joining via invitation",
|
|
711
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
712
|
+
},
|
|
713
|
+
joinInvitation: {
|
|
714
|
+
method: "POST",
|
|
715
|
+
path: "/v1/organisations/invitations/:token/join",
|
|
716
|
+
body: JoinInvitationSchema,
|
|
717
|
+
responses: {
|
|
718
|
+
200: import_zod8.z.object({ message: import_zod8.z.string() }),
|
|
719
|
+
400: ErrorSchema,
|
|
720
|
+
401: ErrorSchema,
|
|
721
|
+
410: ErrorSchema
|
|
722
|
+
},
|
|
723
|
+
summary: "Invitee submits CCCD VP to join",
|
|
724
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
725
|
+
},
|
|
726
|
+
acceptInvitation: {
|
|
727
|
+
method: "POST",
|
|
728
|
+
path: "/v1/organisations/:orgId/invitations/:invitationId/accept",
|
|
729
|
+
body: import_zod8.z.object({}),
|
|
730
|
+
responses: {
|
|
731
|
+
200: import_zod8.z.object({ message: import_zod8.z.string(), memberId: import_zod8.z.string() }),
|
|
732
|
+
401: ErrorSchema,
|
|
733
|
+
403: ErrorSchema,
|
|
734
|
+
409: ErrorSchema
|
|
735
|
+
},
|
|
736
|
+
summary: "Accept invitation (owner/admin only)",
|
|
737
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
738
|
+
},
|
|
739
|
+
declineInvitation: {
|
|
740
|
+
method: "POST",
|
|
741
|
+
path: "/v1/organisations/:orgId/invitations/:invitationId/decline",
|
|
742
|
+
body: import_zod8.z.object({}),
|
|
743
|
+
responses: {
|
|
744
|
+
200: import_zod8.z.object({ message: import_zod8.z.string() }),
|
|
745
|
+
401: ErrorSchema,
|
|
746
|
+
403: ErrorSchema,
|
|
747
|
+
409: ErrorSchema
|
|
748
|
+
},
|
|
749
|
+
summary: "Decline invitation (owner/admin only)",
|
|
750
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
var orgCredentialsContract = c8.router({
|
|
754
|
+
issueVC: {
|
|
755
|
+
method: "POST",
|
|
756
|
+
path: "/v1/organisations/:orgId/credentials/issue",
|
|
757
|
+
body: IssueVCSchema,
|
|
758
|
+
responses: {
|
|
759
|
+
201: import_zod8.z.record(import_zod8.z.unknown()),
|
|
760
|
+
400: ErrorSchema,
|
|
761
|
+
401: ErrorSchema,
|
|
762
|
+
403: ErrorSchema
|
|
763
|
+
},
|
|
764
|
+
summary: "Issue VC on behalf of organisation (owner/admin/issuer)",
|
|
765
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
766
|
+
},
|
|
767
|
+
listIssuedCredentials: {
|
|
768
|
+
method: "GET",
|
|
769
|
+
path: "/v1/organisations/:orgId/credentials",
|
|
770
|
+
responses: {
|
|
771
|
+
200: import_zod8.z.array(import_zod8.z.object({
|
|
772
|
+
id: import_zod8.z.string(),
|
|
773
|
+
holderDid: import_zod8.z.string(),
|
|
774
|
+
issuingMemberId: import_zod8.z.string(),
|
|
775
|
+
credentialJson: import_zod8.z.record(import_zod8.z.unknown()),
|
|
776
|
+
issuedAt: import_zod8.z.string()
|
|
777
|
+
})),
|
|
778
|
+
401: ErrorSchema,
|
|
779
|
+
403: ErrorSchema
|
|
780
|
+
},
|
|
781
|
+
summary: "List issued credentials (owner/admin only)",
|
|
782
|
+
metadata: { openApiTags: ["Organisations"], openApiSecurity: SECURITY2 }
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
var organisationsContract = c8.router({
|
|
786
|
+
crud: orgCrudContract,
|
|
787
|
+
members: orgMembersContract,
|
|
788
|
+
invitations: orgInvitationsContract,
|
|
789
|
+
credentials: orgCredentialsContract
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
// src/index.ts
|
|
793
|
+
var c9 = (0, import_core9.initContract)();
|
|
794
|
+
var contract = c9.router({
|
|
795
|
+
v1: c9.router({
|
|
356
796
|
auth: authContract,
|
|
357
797
|
events: eventsContract,
|
|
358
798
|
checkin: checkinContract,
|
|
359
|
-
turn: turnContract
|
|
799
|
+
turn: turnContract,
|
|
800
|
+
uploads: uploadsContract,
|
|
801
|
+
tracking: trackingContract,
|
|
802
|
+
config: appConfigContract,
|
|
803
|
+
organisations: organisationsContract
|
|
360
804
|
})
|
|
361
805
|
});
|
|
362
806
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -366,20 +810,43 @@ var contract = c5.router({
|
|
|
366
810
|
CheckinSubmitRequestSchema,
|
|
367
811
|
CheckinSubmitResponseSchema,
|
|
368
812
|
CreateEventSchema,
|
|
813
|
+
CreateInvitationSchema,
|
|
814
|
+
CreateOrganisationSchema,
|
|
369
815
|
EventDetailResponseSchema,
|
|
816
|
+
EventDiscoverSchema,
|
|
370
817
|
EventPublicInfoSchema,
|
|
371
818
|
EventResponseSchema,
|
|
819
|
+
InvitationResponseSchema,
|
|
820
|
+
IssueVCSchema,
|
|
821
|
+
JoinInvitationSchema,
|
|
822
|
+
MemberResponseSchema,
|
|
823
|
+
OrgDetailResponseSchema,
|
|
824
|
+
OrgListItemSchema,
|
|
825
|
+
OrgResponseSchema,
|
|
372
826
|
ParticipantSchema,
|
|
373
827
|
SUPPORTED_FIELDS,
|
|
828
|
+
TrackScanRequestSchema,
|
|
829
|
+
TrackScanResponseSchema,
|
|
374
830
|
TurnCredentialsResponseSchema,
|
|
375
831
|
UpdateEventSchema,
|
|
832
|
+
UpdateMemberRoleSchema,
|
|
833
|
+
UpdateOrganisationSchema,
|
|
834
|
+
UploadPresignedUrlSchema,
|
|
376
835
|
VerifyRequestSchema,
|
|
377
836
|
VerifyResponseSchema,
|
|
837
|
+
appConfigContract,
|
|
378
838
|
authContract,
|
|
379
839
|
buildAuthMessage,
|
|
380
840
|
checkinContract,
|
|
381
841
|
contract,
|
|
382
842
|
eventsContract,
|
|
383
|
-
|
|
843
|
+
orgCredentialsContract,
|
|
844
|
+
orgCrudContract,
|
|
845
|
+
orgInvitationsContract,
|
|
846
|
+
orgMembersContract,
|
|
847
|
+
organisationsContract,
|
|
848
|
+
trackingContract,
|
|
849
|
+
turnContract,
|
|
850
|
+
uploadsContract
|
|
384
851
|
});
|
|
385
852
|
//# sourceMappingURL=index.js.map
|