Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdk 845 typescript metadata version #868

Merged
merged 2 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"license": "ISC",
"dependencies": {
"@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
"@trinsic/okapi-node": "^1.6.1-rc1",
"@trinsic/okapi-web": "^1.6.1-rc1",
"@trinsic/okapi-node": "^1.6.1-rc2",
"@trinsic/okapi-web": "^1.6.1-rc2",
"assert": "^2.0.0",
"base64url": "^3.0.1",
"buffer": "^6.0.3",
Expand Down
41 changes: 11 additions & 30 deletions web/src/AccountService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,58 +164,39 @@ export class AccountService extends ServiceBase {

public async getInfo(): Promise<AccountInfoResponse> {
const request = AccountInfoRequest.fromPartial({});

return this.client.info(request, {
metadata: await this.getMetadata(
AccountInfoRequest.encode(request).finish()
),
});
return await this.info(request);
}

// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: ..\sdk\web\src\accountService.ts
// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: ..\sdk\web\src\accountService.ts

public async info(request: AccountInfoRequest): Promise<AccountInfoResponse> {
// TODO - handle metadata
public async info(
request: AccountInfoRequest
): Promise<AccountInfoResponse> {
return this.client.info(request, {
metadata: await this.getMetadata(
AccountInfoRequest.encode(request).finish()
),
metadata: await this.buildMetadata(AccountInfoRequest.encode(request).finish())
});
}

public async listDevices(
request: ListDevicesRequest
): Promise<ListDevicesResponse> {
// TODO - handle metadata
return this.client.listDevices(request, {
metadata: await this.getMetadata(
ListDevicesRequest.encode(request).finish()
),
metadata: await this.buildMetadata(ListDevicesRequest.encode(request).finish())
});
}

public async revokeDevice(
request: RevokeDeviceRequest
): Promise<RevokeDeviceResponse> {
// TODO - handle metadata
return this.client.revokeDevice(request, {
metadata: await this.getMetadata(
RevokeDeviceRequest.encode(request).finish()
),
metadata: await this.buildMetadata(RevokeDeviceRequest.encode(request).finish())
});
}

public async authorizeWebhook(
request: AuthorizeWebhookRequest
): Promise<AuthorizeWebhookResponse> {
// TODO - handle metadata
return this.client.authorizeWebhook(request, {
metadata: await this.getMetadata(
AuthorizeWebhookRequest.encode(request).finish()
),
metadata: await this.buildMetadata(AuthorizeWebhookRequest.encode(request).finish())
});
}

// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
}
35 changes: 7 additions & 28 deletions web/src/CredentialService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,71 +34,50 @@ export class CredentialService extends ServiceBase {
public async issue(
request: IssueRequest
): Promise<IssueResponse> {
// TODO - handle metadata
return this.client.issue(request, {
metadata: await this.getMetadata(
IssueRequest.encode(request).finish()
),
metadata: await this.buildMetadata(IssueRequest.encode(request).finish())
});
}
public async issueFromTemplate(
request: IssueFromTemplateRequest
): Promise<IssueFromTemplateResponse> {
// TODO - handle metadata
return this.client.issueFromTemplate(request, {
metadata: await this.getMetadata(
IssueFromTemplateRequest.encode(request).finish()
),
metadata: await this.buildMetadata(IssueFromTemplateRequest.encode(request).finish())
});
}
public async checkStatus(
request: CheckStatusRequest
): Promise<CheckStatusResponse> {
// TODO - handle metadata
return this.client.checkStatus(request, {
metadata: await this.getMetadata(
CheckStatusRequest.encode(request).finish()
),
metadata: await this.buildMetadata(CheckStatusRequest.encode(request).finish())
});
}
public async updateStatus(
request: UpdateStatusRequest
): Promise<UpdateStatusResponse> {
// TODO - handle metadata
return this.client.updateStatus(request, {
metadata: await this.getMetadata(
UpdateStatusRequest.encode(request).finish()
),
metadata: await this.buildMetadata(UpdateStatusRequest.encode(request).finish())
});
}
public async createProof(
request: CreateProofRequest
): Promise<CreateProofResponse> {
// TODO - handle metadata
return this.client.createProof(request, {
metadata: await this.getMetadata(
CreateProofRequest.encode(request).finish()
),
metadata: await this.buildMetadata(CreateProofRequest.encode(request).finish())
});
}
public async verifyProof(
request: VerifyProofRequest
): Promise<VerifyProofResponse> {
// TODO - handle metadata
return this.client.verifyProof(request, {
metadata: await this.getMetadata(
VerifyProofRequest.encode(request).finish()
),
metadata: await this.buildMetadata(VerifyProofRequest.encode(request).finish())
});
}
public async send(
request: SendRequest
): Promise<SendResponse> {
// TODO - handle metadata
return this.client.send(request, {
metadata: await this.getMetadata(
SendRequest.encode(request).finish()
),
metadata: await this.buildMetadata(SendRequest.encode(request).finish())
});
}
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
Expand Down
8 changes: 7 additions & 1 deletion web/src/OkapiProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// TODO - Include this only for node
import { Hashing, Oberon } from "@trinsic/okapi-node";
import { Hashing, Oberon, OkapiMetadata } from "@trinsic/okapi-node";
import { AccountProfile } from "./proto/services/account/v1/account";
import {TextDecoder, TextEncoder} from "util";
// TODO - Include something else only for web

export async function blake3HashRequest(
Expand Down Expand Up @@ -37,3 +38,8 @@ export async function blindOberon(cloned: AccountProfile, securityCode: Uint8Arr
blinding: [securityCode],
});
}

export async function okapiVersion(): Promise<string> {
const a = (await OkapiMetadata.getMetadata()).version;
return new TextDecoder().decode(new TextEncoder().encode(a));
}
62 changes: 13 additions & 49 deletions web/src/ProviderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ProviderService extends ServiceBase {
): Promise<CreateEcosystemResponse> {
const response = request.name?.trim() || request.details?.email?.trim()
? await this.client.createEcosystem(request, {
metadata: await this.getMetadata(
metadata: await this.buildMetadata(
CreateEcosystemRequest.encode(request).finish()
),
})
Expand All @@ -57,121 +57,85 @@ export class ProviderService extends ServiceBase {
public async updateEcosystem(
request: UpdateEcosystemRequest
): Promise<UpdateEcosystemResponse> {
// TODO - handle metadata
return this.client.updateEcosystem(request, {
metadata: await this.getMetadata(
UpdateEcosystemRequest.encode(request).finish()
),
metadata: await this.buildMetadata(UpdateEcosystemRequest.encode(request).finish())
});
}
public async grantAuthorization(
request: GrantAuthorizationRequest
): Promise<GrantAuthorizationResponse> {
// TODO - handle metadata
return this.client.grantAuthorization(request, {
metadata: await this.getMetadata(
GrantAuthorizationRequest.encode(request).finish()
),
metadata: await this.buildMetadata(GrantAuthorizationRequest.encode(request).finish())
});
}
public async revokeAuthorization(
request: RevokeAuthorizationRequest
): Promise<RevokeAuthorizationResponse> {
// TODO - handle metadata
return this.client.revokeAuthorization(request, {
metadata: await this.getMetadata(
RevokeAuthorizationRequest.encode(request).finish()
),
metadata: await this.buildMetadata(RevokeAuthorizationRequest.encode(request).finish())
});
}
public async getAuthorizations(
request: GetAuthorizationsRequest
): Promise<GetAuthorizationsResponse> {
// TODO - handle metadata
return this.client.getAuthorizations(request, {
metadata: await this.getMetadata(
GetAuthorizationsRequest.encode(request).finish()
),
metadata: await this.buildMetadata(GetAuthorizationsRequest.encode(request).finish())
});
}
public async addWebhook(
request: AddWebhookRequest
): Promise<AddWebhookResponse> {
// TODO - handle metadata
return this.client.addWebhook(request, {
metadata: await this.getMetadata(
AddWebhookRequest.encode(request).finish()
),
metadata: await this.buildMetadata(AddWebhookRequest.encode(request).finish())
});
}
public async deleteWebhook(
request: DeleteWebhookRequest
): Promise<DeleteWebhookResponse> {
// TODO - handle metadata
return this.client.deleteWebhook(request, {
metadata: await this.getMetadata(
DeleteWebhookRequest.encode(request).finish()
),
metadata: await this.buildMetadata(DeleteWebhookRequest.encode(request).finish())
});
}
public async ecosystemInfo(
request: EcosystemInfoRequest
): Promise<EcosystemInfoResponse> {
// TODO - handle metadata
return this.client.ecosystemInfo(request, {
metadata: await this.getMetadata(
EcosystemInfoRequest.encode(request).finish()
),
metadata: await this.buildMetadata(EcosystemInfoRequest.encode(request).finish())
});
}
public async generateToken(
request: GenerateTokenRequest
): Promise<GenerateTokenResponse> {
// TODO - handle metadata
return this.client.generateToken(request, {
metadata: await this.getMetadata(
GenerateTokenRequest.encode(request).finish()
),
metadata: await this.buildMetadata(GenerateTokenRequest.encode(request).finish())
});
}
public async invite(
request: InviteRequest
): Promise<InviteResponse> {
// TODO - handle metadata
return this.client.invite(request, {
metadata: await this.getMetadata(
InviteRequest.encode(request).finish()
),
metadata: await this.buildMetadata(InviteRequest.encode(request).finish())
});
}
public async invitationStatus(
request: InvitationStatusRequest
): Promise<InvitationStatusResponse> {
// TODO - handle metadata
return this.client.invitationStatus(request, {
metadata: await this.getMetadata(
InvitationStatusRequest.encode(request).finish()
),
metadata: await this.buildMetadata(InvitationStatusRequest.encode(request).finish())
});
}
public async getOberonKey(
request: GetOberonKeyRequest
): Promise<GetOberonKeyResponse> {
// TODO - handle metadata
return this.client.getOberonKey(request, {
metadata: await this.getMetadata(
GetOberonKeyRequest.encode(request).finish()
),
metadata: await this.buildMetadata(GetOberonKeyRequest.encode(request).finish())
});
}
public async getEventToken(
request: GetEventTokenRequest
): Promise<GetEventTokenResponse> {
// TODO - handle metadata
return this.client.getEventToken(request, {
metadata: await this.getMetadata(
GetEventTokenRequest.encode(request).finish()
),
metadata: await this.buildMetadata(GetEventTokenRequest.encode(request).finish())
});
}
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
Expand Down