Skip to content

Conversation

andreas-karlsson
Copy link
Contributor

No description provided.

Comment on lines 19 to 21
clientKey:string,
clientId:string,
clientSecret:string,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clientKey:string,
clientId:string,
clientSecret:string,
flagClientSecret:string,
apiClientId:string,
apiClientSecret:string,


export type CachedProvider<T> = () => Promise<T>

export function leaseFactory<T>(renewer:() => Promise<Lease<T>>, marginMs = 5000):CachedProvider<T> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do a background update before lease expires. Handle errors with retries.

let current:Lease<T> | null = null;
return async () => {
if(!current || isExpired(current)) {
const [value, expiry] = await renewer();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If renewer fails we MUST AT LEAST clear current value.

status: ProviderStatus = ProviderStatus.NOT_READY;

private tokenProvider:CachedProvider<string>;
private stateUriProvider:CachedProvider<{ signedUri:string, account:string }>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skip caching of uri!

import { CachedProvider, Lease, leaseFactory } from './lease';
import { ResolveReason } from './proto/api';

const DEFAULT_STATE_INTERVAL = 10_000;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const DEFAULT_STATE_INTERVAL = 10_000;
const DEFAULT_STATE_INTERVAL = 30_000;

return key in obj;
}

function valueMatchesSchema<T>(value:unknown, schema:T): value is T {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to something with assignsTo.

Comment on lines 2 to 5
declare module "*.wasm" {
const content: string;
export default content;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment on lines +52 to +63
// private transferResponseSuccess<T>(value: T, codec: Codec<T>): number {
// const data = codec.encode(value).finish();
// return this.transfer({ data }, Response);
// }
// private transferResponseError<T>(error: string): number {
// return this.transfer({ error }, Response);
// }

// private consumeRequest<T>(ptr: number, codec: Codec<T>): T {
// const req: Request = this.consume(ptr, Request);
// return codec.decode(req.data);
// }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

@@ -0,0 +1 @@
# js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ask AI to fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant