Skip to content

Commit b3c2819

Browse files
fix typescript proto import generation (#1076)
1 parent aad9f5e commit b3c2819

File tree

6 files changed

+360
-348
lines changed

6 files changed

+360
-348
lines changed

web/src/AccountService.ts

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
import ServiceBase from "./ServiceBase";
22
import {
33
AccountDefinition,
4-
AccountInfoRequest,
54
AccountInfoResponse,
65
AccountProfile,
7-
AuthorizeWebhookRequest,
8-
AuthorizeWebhookResponse,
96
ConfirmationMethod,
10-
ListDevicesRequest,
11-
ListDevicesResponse,
127
LoginRequest,
138
LoginResponse,
14-
RevokeDeviceRequest,
15-
RevokeDeviceResponse,
169
ServiceOptions,
1710
SignInRequest,
1811
TokenProtection,
1912
} from "./proto";
13+
import * as proto from "./proto";
2014
import { Base64 } from "js-base64";
2115

2216
import type { Client as BrowserClient } from "nice-grpc-web";
@@ -184,36 +178,47 @@ export class AccountService extends ServiceBase {
184178
return await this.info();
185179
}
186180

187-
// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
188-
// target: /home/runner/work/sdk/sdk/web/src/AccountService.ts
189-
190-
/** Get account information */
191-
public async info(): Promise<AccountInfoResponse> {
192-
let request = AccountInfoRequest.fromPartial({});
193-
return this.client.info(request, {
194-
metadata: await this.buildMetadata(AccountInfoRequest.encode(request).finish())
195-
});
196-
}
197-
/** List all connected devices */
198-
public async listDevices(request: ListDevicesRequest): Promise<ListDevicesResponse> {
199-
200-
return this.client.listDevices(request, {
201-
metadata: await this.buildMetadata(ListDevicesRequest.encode(request).finish())
202-
});
203-
}
204-
/** Revoke device access to the account's cloud wallet */
205-
public async revokeDevice(request: RevokeDeviceRequest): Promise<RevokeDeviceResponse> {
206-
207-
return this.client.revokeDevice(request, {
208-
metadata: await this.buildMetadata(RevokeDeviceRequest.encode(request).finish())
209-
});
210-
}
211-
/** Authorize Ecosystem to receive webhook events */
212-
public async authorizeWebhook(request: AuthorizeWebhookRequest): Promise<AuthorizeWebhookResponse> {
213-
214-
return this.client.authorizeWebhook(request, {
215-
metadata: await this.buildMetadata(AuthorizeWebhookRequest.encode(request).finish())
216-
});
217-
}
218-
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
181+
// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
182+
// target: C:\work\sdk\web\src\AccountService.ts
183+
184+
/** Get account information */
185+
public async info(): Promise<proto.AccountInfoResponse> {
186+
let request = proto.AccountInfoRequest.fromPartial({});
187+
return this.client.info(request, {
188+
metadata: await this.buildMetadata(
189+
proto.AccountInfoRequest.encode(request).finish()
190+
),
191+
});
192+
}
193+
/** List all connected devices */
194+
public async listDevices(
195+
request: proto.ListDevicesRequest
196+
): Promise<proto.ListDevicesResponse> {
197+
return this.client.listDevices(request, {
198+
metadata: await this.buildMetadata(
199+
proto.ListDevicesRequest.encode(request).finish()
200+
),
201+
});
202+
}
203+
/** Revoke device access to the account's cloud wallet */
204+
public async revokeDevice(
205+
request: proto.RevokeDeviceRequest
206+
): Promise<proto.RevokeDeviceResponse> {
207+
return this.client.revokeDevice(request, {
208+
metadata: await this.buildMetadata(
209+
proto.RevokeDeviceRequest.encode(request).finish()
210+
),
211+
});
212+
}
213+
/** Authorize Ecosystem to receive webhook events */
214+
public async authorizeWebhook(
215+
request: proto.AuthorizeWebhookRequest
216+
): Promise<proto.AuthorizeWebhookResponse> {
217+
return this.client.authorizeWebhook(request, {
218+
metadata: await this.buildMetadata(
219+
proto.AuthorizeWebhookRequest.encode(request).finish()
220+
),
221+
});
222+
}
223+
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
219224
}

web/src/CredentialService.ts

Lines changed: 78 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
import ServiceBase from "./ServiceBase";
2-
import {
3-
CheckStatusRequest,
4-
CheckStatusResponse,
5-
CreateProofRequest,
6-
CreateProofResponse,
7-
IssueFromTemplateRequest,
8-
IssueFromTemplateResponse,
9-
IssueRequest,
10-
IssueResponse,
11-
SendRequest,
12-
SendResponse,
13-
ServiceOptions,
14-
UpdateStatusRequest,
15-
UpdateStatusResponse,
16-
VerifiableCredentialDefinition,
17-
VerifyProofRequest,
18-
VerifyProofResponse,
19-
} from "./proto";
2+
import { ServiceOptions, VerifiableCredentialDefinition } from "./proto";
3+
import * as proto from "./proto";
204

215
import type { Client as BrowserClient } from "nice-grpc-web";
226

@@ -28,62 +12,81 @@ export class CredentialService extends ServiceBase {
2812

2913
this.client = this.createClient(VerifiableCredentialDefinition);
3014
}
31-
// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
32-
// target: /home/runner/work/sdk/sdk/web/src/CredentialService.ts
15+
// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
16+
// target: C:\work\sdk\web\src\CredentialService.ts
3317

34-
/** Sign and issue a verifiable credential from a submitted document.
35-
* The document must be a valid JSON-LD document. */
36-
public async issue(request: IssueRequest): Promise<IssueResponse> {
37-
38-
return this.client.issue(request, {
39-
metadata: await this.buildMetadata(IssueRequest.encode(request).finish())
40-
});
41-
}
42-
/** Sign and issue a verifiable credential from a pre-defined template.
43-
* This process will also add schema validation and
44-
* revocation registry values to the credential. */
45-
public async issueFromTemplate(request: IssueFromTemplateRequest): Promise<IssueFromTemplateResponse> {
46-
47-
return this.client.issueFromTemplate(request, {
48-
metadata: await this.buildMetadata(IssueFromTemplateRequest.encode(request).finish())
49-
});
50-
}
51-
/** Check credential status in the revocation registry */
52-
public async checkStatus(request: CheckStatusRequest): Promise<CheckStatusResponse> {
53-
54-
return this.client.checkStatus(request, {
55-
metadata: await this.buildMetadata(CheckStatusRequest.encode(request).finish())
56-
});
57-
}
58-
/** Update credential status by setting the revocation value */
59-
public async updateStatus(request: UpdateStatusRequest): Promise<UpdateStatusResponse> {
60-
61-
return this.client.updateStatus(request, {
62-
metadata: await this.buildMetadata(UpdateStatusRequest.encode(request).finish())
63-
});
64-
}
65-
/** Create a proof from a signed document that is a valid
66-
* verifiable credential and contains a signature from which a proof can be derived. */
67-
public async createProof(request: CreateProofRequest): Promise<CreateProofResponse> {
68-
69-
return this.client.createProof(request, {
70-
metadata: await this.buildMetadata(CreateProofRequest.encode(request).finish())
71-
});
72-
}
73-
/** Verifies a proof by checking the signature value, and if possible schema validation,
74-
* revocation status, and issuer status against a trust registry */
75-
public async verifyProof(request: VerifyProofRequest): Promise<VerifyProofResponse> {
76-
77-
return this.client.verifyProof(request, {
78-
metadata: await this.buildMetadata(VerifyProofRequest.encode(request).finish())
79-
});
80-
}
81-
/** Sends a document directly to a user's email within the given ecosystem */
82-
public async send(request: SendRequest): Promise<SendResponse> {
83-
84-
return this.client.send(request, {
85-
metadata: await this.buildMetadata(SendRequest.encode(request).finish())
86-
});
87-
}
88-
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
18+
/** Sign and issue a verifiable credential from a submitted document.
19+
* The document must be a valid JSON-LD document. */
20+
public async issue(
21+
request: proto.IssueRequest
22+
): Promise<proto.IssueResponse> {
23+
return this.client.issue(request, {
24+
metadata: await this.buildMetadata(
25+
proto.IssueRequest.encode(request).finish()
26+
),
27+
});
28+
}
29+
/** Sign and issue a verifiable credential from a pre-defined template.
30+
* This process will also add schema validation and
31+
* revocation registry values to the credential. */
32+
public async issueFromTemplate(
33+
request: proto.IssueFromTemplateRequest
34+
): Promise<proto.IssueFromTemplateResponse> {
35+
return this.client.issueFromTemplate(request, {
36+
metadata: await this.buildMetadata(
37+
proto.IssueFromTemplateRequest.encode(request).finish()
38+
),
39+
});
40+
}
41+
/** Check credential status in the revocation registry */
42+
public async checkStatus(
43+
request: proto.CheckStatusRequest
44+
): Promise<proto.CheckStatusResponse> {
45+
return this.client.checkStatus(request, {
46+
metadata: await this.buildMetadata(
47+
proto.CheckStatusRequest.encode(request).finish()
48+
),
49+
});
50+
}
51+
/** Update credential status by setting the revocation value */
52+
public async updateStatus(
53+
request: proto.UpdateStatusRequest
54+
): Promise<proto.UpdateStatusResponse> {
55+
return this.client.updateStatus(request, {
56+
metadata: await this.buildMetadata(
57+
proto.UpdateStatusRequest.encode(request).finish()
58+
),
59+
});
60+
}
61+
/** Create a proof from a signed document that is a valid
62+
* verifiable credential and contains a signature from which a proof can be derived. */
63+
public async createProof(
64+
request: proto.CreateProofRequest
65+
): Promise<proto.CreateProofResponse> {
66+
return this.client.createProof(request, {
67+
metadata: await this.buildMetadata(
68+
proto.CreateProofRequest.encode(request).finish()
69+
),
70+
});
71+
}
72+
/** Verifies a proof by checking the signature value, and if possible schema validation,
73+
* revocation status, and issuer status against a trust registry */
74+
public async verifyProof(
75+
request: proto.VerifyProofRequest
76+
): Promise<proto.VerifyProofResponse> {
77+
return this.client.verifyProof(request, {
78+
metadata: await this.buildMetadata(
79+
proto.VerifyProofRequest.encode(request).finish()
80+
),
81+
});
82+
}
83+
/** Sends a document directly to a user's email within the given ecosystem */
84+
public async send(request: proto.SendRequest): Promise<proto.SendResponse> {
85+
return this.client.send(request, {
86+
metadata: await this.buildMetadata(
87+
proto.SendRequest.encode(request).finish()
88+
),
89+
});
90+
}
91+
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
8992
}

0 commit comments

Comments
 (0)