@raycast/utils
Advanced tools
Comparing version 1.12.0 to 1.12.1
import { OAuthService } from "./OAuthService"; | ||
import { OnAuthorizeParams } from "./withAccessToken"; | ||
export type ClientConstructor = { | ||
type ClientConstructor = { | ||
clientId?: string; | ||
@@ -10,5 +9,7 @@ scope: string; | ||
refreshTokenUrl?: string; | ||
onAuthorize?: (params: OnAuthorizeParams) => void; | ||
onAuthorize?: ({ token, type }: { | ||
token: string; | ||
type: "personal" | "oauth"; | ||
}) => void; | ||
}; | ||
export declare const asanaService: (options: ClientConstructor) => OAuthService; | ||
/** | ||
@@ -119,2 +120,3 @@ * Class to use Asana OAuth with Raycast. | ||
} | ||
export {}; | ||
//# sourceMappingURL=clients.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ZoomOAuthService = exports.SlackOAuthService = exports.LinearOAuthService = exports.JiraOAuthService = exports.GoogleOAuthService = exports.GitHubOAuthService = exports.AsanaOAuthService = exports.asanaService = void 0; | ||
exports.ZoomOAuthService = exports.SlackOAuthService = exports.LinearOAuthService = exports.JiraOAuthService = exports.GoogleOAuthService = exports.GitHubOAuthService = exports.AsanaOAuthService = void 0; | ||
const api_1 = require("@raycast/api"); | ||
@@ -37,19 +37,2 @@ const OAuthService_1 = require("./OAuthService"); | ||
const getIcon = (markup) => `data:image/svg+xml,${markup}`; | ||
const asanaService = (options) => new OAuthService_1.OAuthService({ | ||
client: new api_1.OAuth.PKCEClient({ | ||
redirectMethod: api_1.OAuth.RedirectMethod.Web, | ||
providerName: "Asana", | ||
providerIcon: getIcon(PROVIDERS_CONFIG.asana.icon), | ||
providerId: "asana", | ||
description: "Connect your Asana account", | ||
}), | ||
clientId: options.clientId ?? PROVIDERS_CONFIG.asana.clientId, | ||
authorizeUrl: options.authorizeUrl ?? "https://asana.oauth.raycast.com/authorize", | ||
tokenUrl: options.tokenUrl ?? "https://asana.oauth.raycast.com/token", | ||
refreshTokenUrl: options.refreshTokenUrl ?? "https://asana.oauth.raycast.com/refresh-token", | ||
scope: options.scope ?? "default", | ||
personalAccessToken: options.personalAccessToken, | ||
onAuthorize: options.onAuthorize, | ||
}); | ||
exports.asanaService = asanaService; | ||
/** | ||
@@ -56,0 +39,0 @@ * Class to use Asana OAuth with Raycast. |
@@ -52,7 +52,3 @@ import { OAuth } from "@raycast/api"; | ||
* ```typescript | ||
* const asana = OAuthService.asana({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'default', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API directly | ||
* }); | ||
* const asana = OAuthService.asana({ scope: 'default' }) | ||
* ``` | ||
@@ -66,7 +62,3 @@ */ | ||
* ```typescript | ||
* const github = OAuthService.github({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'repo user', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API directly | ||
* }); | ||
* const github = OAuthService.github({ scope: 'repo user' }) | ||
* ``` | ||
@@ -81,5 +73,6 @@ */ | ||
* const google = OAuthService.google({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'https://www.googleapis.com/auth/drive.readonly', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API directly | ||
* clientId: 'custom-client-id', | ||
* authorizeUrl: 'https://accounts.google.com/o/oauth2/v2/auth', | ||
* tokenUrl: 'https://oauth2.googleapis.com/token', | ||
* scope: 'https://www.googleapis.com/auth/drive.readonly', | ||
* }); | ||
@@ -95,5 +88,6 @@ * ``` | ||
* const jira = OAuthService.jira({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'read:jira-user read:jira-work', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* clientId: 'custom-client-id', | ||
* authorizeUrl: 'https://auth.atlassian.com/authorize', | ||
* tokenUrl: 'https://api.atlassian.com/oauth/token', | ||
* scope: 'read:jira-user read:jira-work offline_access' | ||
* }); | ||
@@ -108,7 +102,3 @@ * ``` | ||
* ```typescript | ||
* const linear = OAuthService.linear({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'read write', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* }); | ||
* const linear = OAuthService.linear({ scope: 'read write' }) | ||
* ``` | ||
@@ -122,7 +112,3 @@ */ | ||
* ```typescript | ||
* const slack = OAuthService.slack({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'emoji:read', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* }); | ||
* const slack = OAuthService.slack({ scope: 'emoji:read' }) | ||
* ``` | ||
@@ -137,5 +123,7 @@ */ | ||
* const zoom = OAuthService.zoom({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: '', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* clientId: 'custom-client-id', | ||
* authorizeUrl: 'https://zoom.us/oauth/authorize', | ||
* tokenUrl: 'https://zoom.us/oauth/token', | ||
* scope: 'meeting:write', | ||
* personalAccessToken: 'personal-access-token', | ||
* }); | ||
@@ -142,0 +130,0 @@ * ``` |
@@ -54,7 +54,9 @@ "use strict"; | ||
if (currentTokenSet.refreshToken && currentTokenSet.isExpired()) { | ||
await this.client.setTokens(await this.refreshTokens({ | ||
const tokens = await this.refreshTokens({ | ||
token: currentTokenSet.refreshToken, | ||
clientId: this.clientId, | ||
tokenUrl: this.refreshTokenUrl ?? this.tokenUrl, | ||
})); | ||
}); | ||
await this.client.setTokens(tokens); | ||
return tokens.access_token; | ||
} | ||
@@ -148,7 +150,3 @@ return currentTokenSet.accessToken; | ||
* ```typescript | ||
* const asana = OAuthService.asana({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'default', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API directly | ||
* }); | ||
* const asana = OAuthService.asana({ scope: 'default' }) | ||
* ``` | ||
@@ -162,7 +160,3 @@ */ | ||
* ```typescript | ||
* const github = OAuthService.github({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'repo user', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API directly | ||
* }); | ||
* const github = OAuthService.github({ scope: 'repo user' }) | ||
* ``` | ||
@@ -177,5 +171,6 @@ */ | ||
* const google = OAuthService.google({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'https://www.googleapis.com/auth/drive.readonly', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API directly | ||
* clientId: 'custom-client-id', | ||
* authorizeUrl: 'https://accounts.google.com/o/oauth2/v2/auth', | ||
* tokenUrl: 'https://oauth2.googleapis.com/token', | ||
* scope: 'https://www.googleapis.com/auth/drive.readonly', | ||
* }); | ||
@@ -191,5 +186,6 @@ * ``` | ||
* const jira = OAuthService.jira({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'read:jira-user read:jira-work', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* clientId: 'custom-client-id', | ||
* authorizeUrl: 'https://auth.atlassian.com/authorize', | ||
* tokenUrl: 'https://api.atlassian.com/oauth/token', | ||
* scope: 'read:jira-user read:jira-work offline_access' | ||
* }); | ||
@@ -204,7 +200,3 @@ * ``` | ||
* ```typescript | ||
* const linear = OAuthService.linear({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'read write', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* }); | ||
* const linear = OAuthService.linear({ scope: 'read write' }) | ||
* ``` | ||
@@ -218,7 +210,3 @@ */ | ||
* ```typescript | ||
* const slack = OAuthService.slack({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: 'emoji:read', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* }); | ||
* const slack = OAuthService.slack({ scope: 'emoji:read' }) | ||
* ``` | ||
@@ -233,5 +221,7 @@ */ | ||
* const zoom = OAuthService.zoom({ | ||
* clientId: 'custom-client-id', // Optional: If omitted, defaults to a pre-configured client ID | ||
* scope: '', // Specify the scopes your application requires | ||
* personalAccessToken: 'personal-access-token', // Optional: For accessing the API using a personal token | ||
* clientId: 'custom-client-id', | ||
* authorizeUrl: 'https://zoom.us/oauth/authorize', | ||
* tokenUrl: 'https://zoom.us/oauth/token', | ||
* scope: 'meeting:write', | ||
* personalAccessToken: 'personal-access-token', | ||
* }); | ||
@@ -238,0 +228,0 @@ * ``` |
@@ -33,2 +33,5 @@ import React from "react"; | ||
}; | ||
/** | ||
* The component (for a view/menu-bar commands) or function (for a no-view command) that is passed to withAccessToken. | ||
*/ | ||
export type WithAccessTokenComponentOrFn<T = any> = ((params: T) => Promise<void> | void) | React.ComponentType<T>; | ||
@@ -35,0 +38,0 @@ /** |
{ | ||
"name": "@raycast/utils", | ||
"version": "1.12.0", | ||
"version": "1.12.1", | ||
"description": "Set of utilities to streamline building Raycast extensions", | ||
@@ -5,0 +5,0 @@ "author": "Raycast Technologies Ltd.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
218064
104
4481