Skip to content

Commit

Permalink
feat: updated the Metadata type to allow for custom properties (#975)
Browse files Browse the repository at this point in the history
## This PR
- Updates the `Metadata` type to a `Record` so that Providers can
provide more than just the `name` property as part of the `metadata`.

### Notes
Conversation
[here](https://cloud-native.slack.com/archives/C03J36ZP020/p1721747906370629).

---------

Signed-off-by: Juan Bernal <[email protected]>
  • Loading branch information
juanparadox authored Aug 23, 2024
1 parent 964d65b commit 16b0d74
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions packages/shared/src/client/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Metadata } from '../types';
import { ProviderMetadata } from '../provider/provider';

export interface ClientMetadata extends Metadata {
export interface ClientMetadata {
/**
* @deprecated alias of "domain", use domain instead
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export { ClientProviderStatus as AllProviderStatus };
/**
* Static data about the provider.
*/
export interface ProviderMetadata extends Metadata {
export interface ProviderMetadata extends Readonly<Metadata> {
readonly name: string;
}

Expand All @@ -99,7 +99,7 @@ export interface CommonProvider<S extends ClientProviderStatus | ServerProviderS
/**
* @deprecated the SDK now maintains the provider's state; there's no need for providers to implement this field.
* Returns a representation of the current readiness of the provider.
*
*
* _Providers which do not implement this method are assumed to be ready immediately._
*/
readonly status?: S;
Expand All @@ -125,4 +125,4 @@ export interface CommonProvider<S extends ClientProviderStatus | ServerProviderS
* @param context
*/
initialize?(context?: EvaluationContext): Promise<void>;
}
}
3 changes: 1 addition & 2 deletions packages/shared/src/types/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Metadata {}
export type Metadata = Record<string, string>;

0 comments on commit 16b0d74

Please sign in to comment.