这是indexloc提供的服务,不要输入任何密码
Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/actions/google/drive/google_drive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ export declare class GoogleDriveAction extends Hub.OAuthActionV2 {
oauthHandleRedirect(urlParams: {
[key: string]: string;
}, redirectUri: string): Promise<string>;
oauthFetchAccessToken(request: Hub.ActionRequest): Promise<{
tokens: Credentials;
redirect: any;
}>;
oauthFetchAccessToken(request: Hub.ActionRequest): Promise<Hub.ActionToken>;
oauthCheck(request: Hub.ActionRequest): Promise<boolean>;
oauth2Client(redirectUri: string | undefined): OAuth2Client;
sendData(filename: string, request: Hub.ActionRequest, drive: Drive): Promise<GaxiosResponse<drive_v3.Schema$File>>;
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/google/drive/google_drive.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class GoogleDriveAction extends Hub.OAuthActionV2 {
});
const state = JSON.parse(plaintext);
const tokens = await this.getAccessTokenCredentialsFromCode(state.redirecturi, state.code);
return { tokens, redirect: state.redirecturi };
return new Hub.ActionToken(tokens, state.redirecturi);
}
else {
throw new Error("Request is missing state parameter.");
Expand Down
5 changes: 5 additions & 0 deletions lib/hub/action_token.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare class ActionToken {
tokens: any;
redirect: any;
constructor(tokens: any, redirect: any);
}
10 changes: 10 additions & 0 deletions lib/hub/action_token.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionToken = void 0;
class ActionToken {
constructor(tokens, redirect) {
this.tokens = tokens;
this.redirect = redirect;
}
}
exports.ActionToken = ActionToken;
1 change: 1 addition & 0 deletions lib/hub/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./action";
export * from "./oauth_action";
export * from "./oauth_action_v2";
export * from "./delegate_oauth_action";
export * from "./action_token";
export * from "./sources";
export * from "./utils";
import { LookmlModelExploreField as FieldBase } from "../api_types/lookml_model_explore_field";
Expand Down
1 change: 1 addition & 0 deletions lib/hub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ __exportStar(require("./action"), exports);
__exportStar(require("./oauth_action"), exports);
__exportStar(require("./oauth_action_v2"), exports);
__exportStar(require("./delegate_oauth_action"), exports);
__exportStar(require("./action_token"), exports);
__exportStar(require("./sources"), exports);
__exportStar(require("./utils"), exports);
const aes_transit_crypto_1 = require("../crypto/aes_transit_crypto");
Expand Down
3 changes: 2 additions & 1 deletion lib/hub/oauth_action_v2.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Action, RouteBuilder } from "./action";
import { ActionRequest } from "./action_request";
import { ActionToken } from "./action_token";
export declare abstract class OAuthActionV2 extends Action {
abstract oauthCheck(request: ActionRequest): Promise<boolean>;
abstract oauthUrl(redirectUri: string, encryptedState: string): Promise<string>;
abstract oauthHandleRedirect(urlParams: {
[key: string]: string;
}, redirectUri: string): Promise<string>;
abstract oauthFetchAccessToken(request: ActionRequest): Promise<object>;
abstract oauthFetchAccessToken(request: ActionRequest): Promise<ActionToken>;
asJson(router: RouteBuilder, request: ActionRequest): any;
}
export declare function isOauthActionV2(action: Action): boolean;
2 changes: 1 addition & 1 deletion src/actions/google/drive/google_drive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export class GoogleDriveAction extends Hub.OAuthActionV2 {
const state = JSON.parse(plaintext)

const tokens = await this.getAccessTokenCredentialsFromCode(state.redirecturi, state.code)
return {tokens, redirect: state.redirecturi}
return new Hub.ActionToken(tokens, state.redirecturi)
} else {
throw new Error("Request is missing state parameter.")
}
Expand Down
3 changes: 3 additions & 0 deletions src/hub/action_token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export class ActionToken {
constructor(public tokens: any, public redirect: any) {}
}
1 change: 1 addition & 0 deletions src/hub/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./action"
export * from "./oauth_action"
export * from "./oauth_action_v2"
export * from "./delegate_oauth_action"
export * from "./action_token"
export * from "./sources"
export * from "./utils"

Expand Down
4 changes: 3 additions & 1 deletion src/hub/oauth_action_v2.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {Action, RouteBuilder} from "./action"
import {ActionRequest} from "./action_request"

import {ActionToken} from "./action_token"

export abstract class OAuthActionV2 extends Action {
abstract oauthCheck(request: ActionRequest): Promise<boolean>
abstract oauthUrl(redirectUri: string, encryptedState: string): Promise<string>
abstract oauthHandleRedirect(urlParams: { [key: string]: string }, redirectUri: string): Promise<string>
abstract oauthFetchAccessToken(request: ActionRequest): Promise<object>
abstract oauthFetchAccessToken(request: ActionRequest): Promise<ActionToken>

asJson(router: RouteBuilder, request: ActionRequest): any {
const json = super.asJson(router, request)
Expand Down