Skip to content

Commit de9464b

Browse files
update TS types after changing End of these files: delegating.py, grouping.py, ipexing.py, notifying.py, exchanging.py
1 parent 6338ac4 commit de9464b

16 files changed

+431
-71
lines changed

scripts/generate-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const content = ast.filter((s) => {
2727
return false;
2828
});
2929

30-
const header = `// AUTO-GENERATED: Only components retained from OpenAPI schema\n\n`;
30+
const header = `// AUTO-GENERATED: Only components and enums retained from OpenAPI schema\n\n`;
3131
await writeFile(outputFile, `${header}${astToString(content)}`);
3232

3333
console.log(`🚀 ${specUrl}${outputFile}`);

src/keri/app/aiding.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class Identifier {
183183

184184
if (!transferable) {
185185
ncount = 0;
186-
nsith = 0;
186+
nsith = '0';
187187
dcode = MtrDex.Ed25519N;
188188
}
189189

src/keri/app/contacting.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,21 @@ export class Challenges {
183183
* Mark challenge response as signed and accepted
184184
* @param source Prefix of the identifier that was challenged
185185
* @param said qb64 AID of exn message representing the signed response
186-
* @returns {Promise<Response>} A promise to the result
186+
* @returns {Promise<Operation<any>>} A promise to the result
187187
*/
188-
async responded(source: string, said: string): Promise<Response> {
188+
async responded(source: string, said: string): Promise<Operation<any>> {
189189
const path = `/challenges_verify/${source}`;
190190
const method = 'PUT';
191-
const data = {
192-
said: said,
193-
};
191+
const data = { said: said };
194192
const res = await this.client.fetch(path, method, data);
195-
return res;
193+
// Check for empty response
194+
if (res.status === 204 || res.headers.get('content-length') === '0') {
195+
return {} as Operation<any>;
196+
}
197+
const text = await res.text();
198+
if (!text) {
199+
return {} as Operation<any>;
200+
}
201+
return JSON.parse(text) as Operation<any>;
196202
}
197203
}

src/keri/app/credentialing.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ export class Ipex {
781781
exn: Serder,
782782
sigs: string[],
783783
recp: string[]
784-
): Promise<any> {
784+
): Promise<Operation<any>> {
785785
const body = {
786786
exn: exn.sad,
787787
sigs,
@@ -825,7 +825,7 @@ export class Ipex {
825825
sigs: string[],
826826
atc: string,
827827
recp: string[]
828-
): Promise<any> {
828+
): Promise<Operation<any>> {
829829
const body = {
830830
exn: exn.sad,
831831
sigs,
@@ -869,7 +869,7 @@ export class Ipex {
869869
exn: Serder,
870870
sigs: string[],
871871
recp: string[]
872-
): Promise<any> {
872+
): Promise<Operation<any>> {
873873
const body = {
874874
exn: exn.sad,
875875
sigs,
@@ -937,7 +937,7 @@ export class Ipex {
937937
sigs: string[],
938938
atc: string,
939939
recp: string[]
940-
): Promise<any> {
940+
): Promise<Operation<any>> {
941941
const body = {
942942
exn: exn.sad,
943943
sigs: sigs,
@@ -982,7 +982,7 @@ export class Ipex {
982982
sigs: string[],
983983
atc: string,
984984
recp: string[]
985-
): Promise<any> {
985+
): Promise<Operation<any>> {
986986
const body = {
987987
exn: exn.sad,
988988
sigs: sigs,

src/keri/app/exchanging.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { Pather } from '../core/pather.ts';
66
import { Counter, CtrDex } from '../core/counter.ts';
77
import { Saider } from '../core/saider.ts';
88
import { HabState } from '../core/keyState.ts';
9+
import { Exn } from './grouping.ts';
10+
import { components } from '../../types/keria-api-schema.ts';
11+
12+
export type ExchangeResource = components['schemas']['ExchangeResource'];
913

1014
/**
1115
* Exchanges
@@ -101,7 +105,7 @@ export class Exchanges {
101105
/**
102106
* Send exn messaget to list of recipients
103107
* @async
104-
* @returns {Promise<any>} A promise to the list of replay messages
108+
* @returns {Promise<Exn>} A promise to the list of replay messages
105109
* @param name
106110
* @param topic
107111
* @param exn
@@ -137,7 +141,7 @@ export class Exchanges {
137141
* @returns A promise to the exn message
138142
* @param said The said of the exn message
139143
*/
140-
async get(said: string): Promise<any> {
144+
async get(said: string): Promise<ExchangeResource> {
141145
const path = `/exchanges/${said}`;
142146
const method = 'GET';
143147
const res = await this.client.fetch(path, method, null);

src/keri/app/grouping.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { SignifyClient } from './clienting.ts';
22
import { Dict } from '../core/core.ts';
3+
import { Operation } from './coring.ts';
4+
import { components } from '../../types/keria-api-schema.ts';
5+
6+
export type Exn = components['schemas']['Exn'];
7+
export type ExnMultisig = components['schemas']['ExnMultisig'];
38

49
/**
510
* Groups
@@ -19,9 +24,9 @@ export class Groups {
1924
* Get group request messages
2025
* @async
2126
* @param {string} [said] SAID of exn message to load
22-
* @returns {Promise<any>} A promise to the list of replay messages
27+
* @returns {Promise<ExnMultisig[]>} A promise to the list of replay messages
2328
*/
24-
async getRequest(said: string): Promise<any> {
29+
async getRequest(said: string): Promise<ExnMultisig[]> {
2530
const path = `/multisig/request/` + said;
2631
const method = 'GET';
2732
const res = await this.client.fetch(path, method, null);
@@ -35,14 +40,14 @@ export class Groups {
3540
* @param {Dict<any>} [exn] exn message to send to other members
3641
* @param {string[]} [sigs] signature of the participant over the exn
3742
* @param {string} [atc] additional attachments from embedded events in exn
38-
* @returns {Promise<any>} A promise to the list of replay messages
43+
* @returns {Promise<Exn>} A promise to the list of replay messages
3944
*/
4045
async sendRequest(
4146
name: string,
4247
exn: Dict<any>,
4348
sigs: string[],
4449
atc: string
45-
): Promise<any> {
50+
): Promise<Exn> {
4651
const path = `/identifiers/${name}/multisig/request`;
4752
const method = 'POST';
4853
const data = {
@@ -64,7 +69,7 @@ export class Groups {
6469
* @param {string} [gid] prefix
6570
* @param {string[]} [smids] array of particpants
6671
* @param {string[]} [rmids] array of particpants
67-
* @returns {Promise<any>} A promise to the list of replay messages
72+
* @returns {Promise<Operation<any>} A promise to the list of replay messages
6873
*/
6974
async join(
7075
name: string,
@@ -73,7 +78,7 @@ export class Groups {
7378
gid: string,
7479
smids: string[],
7580
rmids: string[]
76-
): Promise<any> {
81+
): Promise<Operation<any>> {
7782
const path = `/identifiers/${name}/multisig/join`;
7883
const method = 'POST';
7984
const data = {

src/keri/core/keyState.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,17 @@ export type ExternState = components['schemas']['ExternState'];
3434
* Defining properties of an identifier habitat, know as a Hab in KERIpy.
3535
*/
3636
export type HabState = components['schemas']['Identifier'];
37+
38+
export type Icp =
39+
| components['schemas']['ICP_V_1']
40+
| components['schemas']['ICP_V_2'];
41+
export type Ixn =
42+
| components['schemas']['IXN_V_1']
43+
| components['schemas']['IXN_V_2'];
44+
export type ExnV1 =
45+
| components['schemas']['EXN_V_1']
46+
| components['schemas']['EXN_V_2'];
47+
export type MultisigExnEmbeds = components['schemas']['MultisigExnEmbeds'];
48+
export type MultisigInceptEmbeds =
49+
components['schemas']['MultisigInceptEmbeds'];
50+
export type MultisigRpyEmbeds = components['schemas']['MultisigRpyEmbeds'];

src/types/keria-api-schema.ts

Lines changed: 173 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// AUTO-GENERATED: Only components retained from OpenAPI schema
1+
// AUTO-GENERATED: Only components and enums retained from OpenAPI schema
22

33
export interface components {
44
schemas: {
@@ -252,6 +252,49 @@ export interface components {
252252
r: string;
253253
a: unknown;
254254
};
255+
VCP_V_1: {
256+
v: string;
257+
t: string;
258+
d: string;
259+
i: string;
260+
ii: string;
261+
s: string;
262+
c: string[];
263+
bt: string;
264+
b: string[];
265+
n: string;
266+
};
267+
EXN_V_1: {
268+
v: string;
269+
t: string;
270+
d: string;
271+
i: string;
272+
rp: string;
273+
p: string;
274+
dt: string;
275+
r: string;
276+
q: {
277+
[key: string]: unknown;
278+
};
279+
a: unknown;
280+
e: {
281+
[key: string]: unknown;
282+
};
283+
};
284+
EXN_V_2: {
285+
v: string;
286+
t: string;
287+
d: string;
288+
i: string;
289+
x: string;
290+
p: string;
291+
dt: string;
292+
r: string;
293+
q: {
294+
[key: string]: unknown;
295+
};
296+
a: unknown;
297+
};
255298
Credential: {
256299
sad:
257300
| components['schemas']['ACDC_V_1']
@@ -557,6 +600,135 @@ export interface components {
557600
AgentConfig: {
558601
iurls?: string[];
559602
};
603+
Exn:
604+
| components['schemas']['EXN_V_1']
605+
| components['schemas']['EXN_V_2'];
606+
Icp:
607+
| components['schemas']['ICP_V_1']
608+
| components['schemas']['ICP_V_2'];
609+
Rot:
610+
| components['schemas']['ROT_V_1']
611+
| components['schemas']['ROT_V_2'];
612+
Vcp: components['schemas']['VCP_V_1'];
613+
Iss: components['schemas']['ISS_V_1'];
614+
Ixn:
615+
| components['schemas']['IXN_V_1']
616+
| components['schemas']['IXN_V_2'];
617+
NotificationData: {
618+
r?: string;
619+
d?: string;
620+
m?: string;
621+
} & {
622+
[key: string]: unknown;
623+
};
624+
Notification: {
625+
i: string;
626+
dt: string;
627+
r: boolean;
628+
a: components['schemas']['NotificationData'];
629+
};
630+
ExchangeResource: {
631+
exn: components['schemas']['Exn'];
632+
pathed: {
633+
[key: string]: unknown;
634+
};
635+
};
636+
MultisigInceptEmbeds: {
637+
icp: components['schemas']['Icp'];
638+
rot?: components['schemas']['Rot'];
639+
};
640+
MultisigRotateEmbeds: {
641+
rot: unknown;
642+
};
643+
MultisigInteractEmbeds: {
644+
ixn: components['schemas']['Ixn'];
645+
};
646+
MultisigRegistryInceptEmbeds: {
647+
vcp: components['schemas']['Vcp'];
648+
anc:
649+
| components['schemas']['ICP_V_1']
650+
| components['schemas']['ICP_V_2']
651+
| components['schemas']['ROT_V_1']
652+
| components['schemas']['ROT_V_2']
653+
| components['schemas']['DIP_V_1']
654+
| components['schemas']['DIP_V_2']
655+
| components['schemas']['DRT_V_1']
656+
| components['schemas']['DRT_V_2']
657+
| components['schemas']['IXN_V_1']
658+
| components['schemas']['IXN_V_2'];
659+
};
660+
ISS_V_1: {
661+
v: string;
662+
t: string;
663+
d: string;
664+
i: string;
665+
s: string;
666+
ri: string;
667+
dt: string;
668+
};
669+
MultisigIssueEmbeds: {
670+
acdc:
671+
| components['schemas']['ACDC_V_1']
672+
| components['schemas']['ACDC_V_2'];
673+
iss: components['schemas']['Iss'];
674+
anc:
675+
| components['schemas']['ICP_V_1']
676+
| components['schemas']['ICP_V_2']
677+
| components['schemas']['ROT_V_1']
678+
| components['schemas']['ROT_V_2']
679+
| components['schemas']['DIP_V_1']
680+
| components['schemas']['DIP_V_2']
681+
| components['schemas']['DRT_V_1']
682+
| components['schemas']['DRT_V_2']
683+
| components['schemas']['IXN_V_1']
684+
| components['schemas']['IXN_V_2'];
685+
};
686+
REV_V_1: {
687+
v: string;
688+
t: string;
689+
d: string;
690+
i: string;
691+
s: string;
692+
ri: string;
693+
p: string;
694+
dt: string;
695+
};
696+
MultisigRevokeEmbeds: {
697+
rev: components['schemas']['REV_V_1'];
698+
anc: unknown;
699+
};
700+
MultisigRpyEmbeds: {
701+
rpy: components['schemas']['Rpy'];
702+
anc: unknown;
703+
};
704+
MultisigExnEmbeds: {
705+
exn: components['schemas']['Exn'];
706+
};
707+
ExnEmbeds: {
708+
d: string;
709+
} & (
710+
| components['schemas']['MultisigInceptEmbeds']
711+
| components['schemas']['MultisigRotateEmbeds']
712+
| components['schemas']['MultisigInteractEmbeds']
713+
| components['schemas']['MultisigRegistryInceptEmbeds']
714+
| components['schemas']['MultisigIssueEmbeds']
715+
| components['schemas']['MultisigRevokeEmbeds']
716+
| components['schemas']['MultisigRpyEmbeds']
717+
| components['schemas']['MultisigExnEmbeds']
718+
);
719+
ExnMultisig: {
720+
exn: components['schemas']['Exn'];
721+
paths: {
722+
[key: string]: unknown;
723+
};
724+
e: components['schemas']['ExnEmbeds'];
725+
/** @default null */
726+
groupName: string | null;
727+
/** @default null */
728+
memberName: string | null;
729+
/** @default null */
730+
sender: string | null;
731+
};
560732
};
561733
responses: never;
562734
parameters: never;

0 commit comments

Comments
 (0)