mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-27 12:51:41 +00:00
* Update message de->fabric to v3
* Reinstate get authorization token path which doesn't get called every 5 minutes anymore
* Remove obsolete comment
* Add missing types
* Fix format
* Fix build issue
* Revert "Reinstate get authorization token path which doesn't get called every 5 minutes anymore"
This reverts commit a3f3511043.
* Keep 3 old fabric message types enums for compatibility with the portal
* Re-add warning comment about not changing existing message type enums
---------
Co-authored-by: Laurent Nguyen <languye@microsoft.com>
96 lines
2.1 KiB
TypeScript
96 lines
2.1 KiB
TypeScript
import { AuthorizationToken } from "Contracts/FabricMessageTypes";
|
|
|
|
// This is the version of these messages
|
|
export const FABRIC_RPC_VERSION = "2";
|
|
|
|
// Fabric to Data Explorer
|
|
|
|
// TODO Deprecated. Remove this section once DE is updated
|
|
export type FabricMessageV1 =
|
|
| {
|
|
type: "newContainer";
|
|
databaseName: string;
|
|
}
|
|
| {
|
|
type: "initialize";
|
|
message: {
|
|
endpoint: string | undefined;
|
|
databaseId: string | undefined;
|
|
resourceTokens: unknown | undefined;
|
|
resourceTokensTimestamp: number | undefined;
|
|
error: string | undefined;
|
|
};
|
|
}
|
|
| {
|
|
type: "authorizationToken";
|
|
message: {
|
|
id: string;
|
|
error: string | undefined;
|
|
data: AuthorizationToken | undefined;
|
|
};
|
|
}
|
|
| {
|
|
type: "allResourceTokens";
|
|
message: {
|
|
id: string;
|
|
error: string | undefined;
|
|
endpoint: string | undefined;
|
|
databaseId: string | undefined;
|
|
resourceTokens: unknown | undefined;
|
|
resourceTokensTimestamp: number | undefined;
|
|
};
|
|
};
|
|
// -----------------------------
|
|
|
|
export type FabricMessageV2 =
|
|
| {
|
|
type: "newContainer";
|
|
databaseName: string;
|
|
}
|
|
| {
|
|
type: "initialize";
|
|
version: string;
|
|
id: string;
|
|
message: {
|
|
connectionId: string;
|
|
isVisible: boolean;
|
|
};
|
|
}
|
|
| {
|
|
type: "authorizationToken";
|
|
message: {
|
|
id: string;
|
|
error: string | undefined;
|
|
data: AuthorizationToken | undefined;
|
|
};
|
|
}
|
|
| {
|
|
type: "allResourceTokens_v2";
|
|
message: {
|
|
id: string;
|
|
error: string | undefined;
|
|
data: FabricDatabaseConnectionInfo | undefined;
|
|
};
|
|
}
|
|
| {
|
|
type: "explorerVisible";
|
|
message: {
|
|
visible: boolean;
|
|
};
|
|
};
|
|
|
|
export type CosmosDBTokenResponse = {
|
|
token: string;
|
|
date: string;
|
|
};
|
|
|
|
export type CosmosDBConnectionInfoResponse = {
|
|
endpoint: string;
|
|
databaseId: string;
|
|
resourceTokens: { [resourceId: string]: string };
|
|
};
|
|
|
|
export interface FabricDatabaseConnectionInfo extends CosmosDBConnectionInfoResponse {
|
|
resourceTokensTimestamp: number;
|
|
}
|