-
Notifications
You must be signed in to change notification settings - Fork 1
feat: js local resolver #32
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
base: main
Are you sure you want to change the base?
Conversation
clientKey:string, | ||
clientId:string, | ||
clientSecret:string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clientKey:string, | |
clientId:string, | |
clientSecret:string, | |
flagClientSecret:string, | |
apiClientId:string, | |
apiClientSecret:string, |
openfeature-provider/js/src/lease.ts
Outdated
|
||
export type CachedProvider<T> = () => Promise<T> | ||
|
||
export function leaseFactory<T>(renewer:() => Promise<Lease<T>>, marginMs = 5000):CachedProvider<T> { |
There was a problem hiding this comment.
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.
openfeature-provider/js/src/lease.ts
Outdated
let current:Lease<T> | null = null; | ||
return async () => { | ||
if(!current || isExpired(current)) { | ||
const [value, expiry] = await renewer(); |
There was a problem hiding this comment.
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 }>; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 { |
There was a problem hiding this comment.
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.
declare module "*.wasm" { | ||
const content: string; | ||
export default content; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
// 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); | ||
// } |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ask AI to fix!
No description provided.