@panora/shared
Advanced tools
Comparing version 1.2.2 to 1.3.0
RELEASE 1.0.0 | ||
## 1.3.0 | ||
### Minor Changes | ||
- 04aec74: added updates | ||
## 1.2.2 | ||
@@ -4,0 +10,0 @@ |
@@ -13,13 +13,6 @@ "use strict"; | ||
exports.constructAuthUrl = void 0; | ||
const metadata_1 = require("./connectors/metadata"); | ||
const envConfig_1 = require("./envConfig"); | ||
const types_1 = require("./types"); | ||
const utils_1 = require("./utils"); | ||
const randomString = () => { | ||
const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
let result = ''; | ||
for (let i = 0; i < length; i++) { | ||
const randomIndex = Math.floor(Math.random() * charSet.length); | ||
result += charSet[randomIndex]; | ||
} | ||
return result; | ||
}; | ||
const constructAuthUrl = (_a) => __awaiter(void 0, [_a], void 0, function* ({ projectId, linkedUserId, providerName, returnUrl, apiUrl, vertical }) { | ||
@@ -31,3 +24,3 @@ const encodedRedirectUrl = encodeURIComponent(`${apiUrl}/connections/oauth/callback`); | ||
} | ||
const config = utils_1.providersConfig[vertical.toLowerCase()][providerName]; | ||
const config = metadata_1.CONNECTORS_METADATA[vertical.toLowerCase()][providerName]; | ||
if (!config) { | ||
@@ -38,3 +31,3 @@ throw new Error(`Unsupported provider: ${providerName}`); | ||
switch (authStrategy) { | ||
case utils_1.AuthStrategy.oauth2: | ||
case types_1.AuthStrategy.oauth2: | ||
return handleOAuth2Url({ | ||
@@ -50,5 +43,5 @@ providerName, | ||
}); | ||
case utils_1.AuthStrategy.api_key: | ||
case types_1.AuthStrategy.api_key: | ||
return handleApiKeyUrl(); | ||
case utils_1.AuthStrategy.basic: | ||
case types_1.AuthStrategy.basic: | ||
return handleBasicUrl(); | ||
@@ -89,6 +82,6 @@ } | ||
case 'gitlab': | ||
params += '&code_challenge=&code_challenge_method='; | ||
params += '&response_type=code&code_challenge=&code_challenge_method='; | ||
break; | ||
case 'gorgias': | ||
params = `&response_type=code&nonce=${randomString()}`; | ||
params = `&response_type=code&nonce=${(0, utils_1.randomString)()}`; | ||
break; | ||
@@ -95,0 +88,0 @@ default: |
@@ -1,2 +0,2 @@ | ||
import { AuthStrategy, SoftwareMode } from './utils'; | ||
import { AuthStrategy, SoftwareMode } from './types'; | ||
export type BasicAuthData = { | ||
@@ -3,0 +3,0 @@ USERNAME: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.needsSubdomain = exports.extractAuthMode = exports.providerToType = exports.extractSoftwareMode = exports.extractVertical = exports.extractProvider = void 0; | ||
const utils_1 = require("./utils"); | ||
const metadata_1 = require("./connectors/metadata"); | ||
const types_1 = require("./types"); | ||
function extractProvider(type) { | ||
@@ -21,9 +22,9 @@ const parts = type.split('_'); | ||
function providerToType(providerName, vertical, authMode, softwareMode) { | ||
const software = softwareMode ? softwareMode.toUpperCase() : utils_1.SoftwareMode.cloud; | ||
const software = softwareMode ? softwareMode.toUpperCase() : types_1.SoftwareMode.cloud; | ||
switch (authMode) { | ||
case utils_1.AuthStrategy.api_key: | ||
case types_1.AuthStrategy.api_key: | ||
return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_${software}_APIKEY`; | ||
case utils_1.AuthStrategy.oauth2: | ||
case types_1.AuthStrategy.oauth2: | ||
return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_${software}_OAUTH`; | ||
case utils_1.AuthStrategy.basic: | ||
case types_1.AuthStrategy.basic: | ||
return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_${software}_BASIC`; | ||
@@ -38,7 +39,7 @@ } | ||
case 'OAUTH': | ||
return utils_1.AuthStrategy.oauth2; | ||
return types_1.AuthStrategy.oauth2; | ||
case 'APIKEY': | ||
return utils_1.AuthStrategy.api_key; | ||
return types_1.AuthStrategy.api_key; | ||
case 'BASIC': | ||
return utils_1.AuthStrategy.basic; | ||
return types_1.AuthStrategy.basic; | ||
default: | ||
@@ -50,11 +51,11 @@ throw new Error('Auth mode not found'); | ||
function needsSubdomain(provider, vertical) { | ||
if (!utils_1.providersConfig[vertical]) { | ||
console.error(`Vertical ${vertical} not found in providersConfig.`); | ||
if (!metadata_1.CONNECTORS_METADATA[vertical]) { | ||
console.error(`Vertical ${vertical} not found in CONNECTORS_METADATA.`); | ||
return false; | ||
} | ||
if (!utils_1.providersConfig[vertical][provider]) { | ||
if (!metadata_1.CONNECTORS_METADATA[vertical][provider]) { | ||
console.error(`Provider ${provider} not found under vertical ${vertical}.`); | ||
return false; | ||
} | ||
const providerConfig = utils_1.providersConfig[vertical][provider]; | ||
const providerConfig = metadata_1.CONNECTORS_METADATA[vertical][provider]; | ||
const authBaseUrlStartsWithSlash = providerConfig.urls.authBaseUrl.substring(0, 1) === '/'; | ||
@@ -61,0 +62,0 @@ const apiUrlStartsWithSlash = providerConfig.urls.apiUrl.substring(0, 1) === '/'; |
@@ -1,3 +0,3 @@ | ||
export * from './providers'; | ||
export * from './enum'; | ||
export * from './connectors'; | ||
export * from './connectors/enum'; | ||
export * from './standardObjects'; | ||
@@ -8,1 +8,4 @@ export * from './webhookScopes'; | ||
export * from './envConfig'; | ||
export * from './connectors/metadata'; | ||
export * from './types'; | ||
export * from './categories'; |
@@ -17,4 +17,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./providers"), exports); | ||
__exportStar(require("./enum"), exports); | ||
__exportStar(require("./connectors"), exports); | ||
__exportStar(require("./connectors/enum"), exports); | ||
__exportStar(require("./standardObjects"), exports); | ||
@@ -25,1 +25,4 @@ __exportStar(require("./webhookScopes"), exports); | ||
__exportStar(require("./envConfig"), exports); | ||
__exportStar(require("./connectors/metadata"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./categories"), exports); |
@@ -1,32 +0,7 @@ | ||
export declare enum AuthStrategy { | ||
oauth2 = "0Auth2", | ||
api_key = "API Key", | ||
basic = "Basic Auth" | ||
} | ||
export declare enum SoftwareMode { | ||
cloud = "CLOUD" | ||
} | ||
export type ProviderConfig = { | ||
scopes?: string; | ||
logoPath: string; | ||
description: string; | ||
active?: boolean; | ||
customPropertiesUrl?: string; | ||
authStrategy?: AuthStrategy; | ||
urls: { | ||
docsUrl: string; | ||
apiUrl: string; | ||
authBaseUrl?: string; | ||
customPropertiesUrl?: string; | ||
}; | ||
}; | ||
type VerticalConfig = { | ||
[key: string]: ProviderConfig; | ||
}; | ||
export type ProvidersConfig = { | ||
[vertical: string]: VerticalConfig; | ||
}; | ||
export declare const providersConfig: ProvidersConfig; | ||
import { AuthStrategy } from './types'; | ||
import { ConnectorCategory } from './categories'; | ||
export declare const randomString: () => string; | ||
export declare const getDescription: (name: string) => string | null; | ||
interface Provider { | ||
export interface Provider { | ||
vertical?: string; | ||
name: string; | ||
@@ -41,7 +16,17 @@ urls: { | ||
description?: string; | ||
authStrategy?: AuthStrategy; | ||
} | ||
export declare function providersArray(vertical: string): Provider[]; | ||
export declare const findProviderVertical: (providerName: string) => string | null; | ||
export declare function providersArray(vertical?: string): Provider[]; | ||
export declare const findConnectorCategory: (providerName: string) => string | null; | ||
export declare function findProviderByName(providerName: string): Provider | null; | ||
export declare function getLogoURL(providerName: string): string; | ||
export {}; | ||
export declare function mergeAllProviders(...arrays: string[][]): { | ||
vertical: string; | ||
value: string; | ||
}[]; | ||
export declare const ALL_PROVIDERS: { | ||
vertical: string; | ||
value: string; | ||
}[]; | ||
export declare function slugFromCategory(category: ConnectorCategory): "crm" | "hris" | "ats" | "tcg" | "mktg" | "fstg" | "actng"; | ||
export declare function categoryFromSlug(slug: string): ConnectorCategory | null; |
@@ -25,2 +25,3 @@ "use strict"; | ||
'ticketing.attachment.pulled', | ||
'ticketing.collection.pulled', | ||
'ticketing.account.pulled', | ||
@@ -27,0 +28,0 @@ 'ticketing.contact.pulled', |
{ | ||
"name": "@panora/shared", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Shared Package of Panora", | ||
@@ -5,0 +5,0 @@ "author": "Panora", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124053
29
2740
2