-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #742 from jetstreamapp/poc/generic-salesforce-api
Remove reliance on JSForce
- Loading branch information
Showing
216 changed files
with
7,193 additions
and
3,519 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ JETSTREAM_SERVER_DOMAIN='localhost:3333' | |
JETSTREAM_SERVER_URL='http://localhost:3333' | ||
JETSTREAM_POSTGRES_DBURI='postgres://postgres@localhost:5432/postgres' | ||
|
||
# trace, debug (default), info, warn, error, fatal, silent - determines how much server logging is done | ||
LOG_LEVEL='trace' | ||
|
||
# PLAYWRIGHT INTEGRATION TEST LOGIN | ||
E2E_LOGIN_USERNAME='[email protected]' | ||
E2E_LOGIN_PASSWORD='TODO' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
import { ENV } from '@jetstream/api-config'; | ||
import { UserProfileServer } from '@jetstream/types'; | ||
import { v2 as cloudinary } from 'cloudinary'; | ||
import { NextFunction, Request, Response } from 'express'; | ||
import { UserFacingError } from '../utils/error-handler'; | ||
import { sendJson } from '../utils/response.handlers'; | ||
import { createRoute } from '../utils/route.utils'; | ||
|
||
cloudinary.config({ secure: true }); | ||
|
||
export const routeValidators = { | ||
getUploadSignature: [], | ||
export const routeDefinition = { | ||
getUploadSignature: { | ||
controllerFn: () => getUploadSignature, | ||
validators: { | ||
hasSourceOrg: false, | ||
}, | ||
}, | ||
}; | ||
|
||
export async function getUploadSignature(req: Request, res: Response, next: NextFunction) { | ||
const getUploadSignature = createRoute(routeDefinition.getUploadSignature.validators, async ({ user }, req, res, next) => { | ||
try { | ||
const user = req.user as UserProfileServer; | ||
const timestamp = Math.round(new Date().getTime() / 1000); | ||
const cloudName = cloudinary.config().cloud_name; | ||
const apiKey = cloudinary.config().api_key; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const apiSecret = cloudinary.config().api_secret!; | ||
const context = `caption=${user.id.replace('|', '\\|')}|environment=${ENV.JETSTREAM_SERVER_URL}`; | ||
|
||
const signature = cloudinary.utils.api_sign_request({ timestamp: timestamp, upload_preset: 'jetstream-issues', context }, apiSecret); | ||
const signature = cloudinary.utils.api_sign_request({ timestamp, upload_preset: 'jetstream-issues', context }, apiSecret); | ||
|
||
sendJson(res, { signature: signature, timestamp: timestamp, cloudName: cloudName, apiKey: apiKey, context }, 200); | ||
sendJson(res, { signature: signature, timestamp, cloudName: cloudName, apiKey: apiKey, context }, 200); | ||
} catch (ex) { | ||
next(new UserFacingError(ex.message)); | ||
} | ||
} | ||
}); |
Oops, something went wrong.