-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
queue-it
committed
Nov 3, 2021
1 parent
36d258e
commit ed8a9f2
Showing
16 changed files
with
8,520 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[merge] | ||
tool = kdiff3 | ||
guitool = kdiff3 | ||
[diff] | ||
guitool = kdiff3 | ||
tool = vsdiffmerge | ||
[core] | ||
editor = \"F:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor | ||
autocrlf = false | ||
[user] | ||
name = Vasil | ||
email = [email protected] | ||
[pull] | ||
rebase = false | ||
[fetch] | ||
prune = false | ||
[rebase] | ||
autoStash = false | ||
[winUpdater] | ||
recentlySeenVersion = 2.26.1.windows.1 | ||
[mergetool "kdiff3"] | ||
path = C:/Program Files/KDiff3/kdiff3.exe | ||
cmd = \"C:/Program Files/KDiff3/kdiff3.exe\" \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\" | ||
[difftool "kdiff3"] | ||
path = C:/Program Files/KDiff3/kdiff3.exe | ||
cmd = \"C:/Program Files/KDiff3/kdiff3.exe\" \"$LOCAL\" \"$REMOTE\" | ||
[url "[email protected]:"] | ||
insteadOf = https://git.smartmodule.net/ | ||
[difftool] | ||
prompt = true | ||
[difftool "vsdiffmerge"] | ||
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t | ||
keepBackup = false | ||
[filter "lfs"] | ||
clean = git-lfs clean -- %f | ||
smudge = git-lfs smudge -- %f | ||
process = git-lfs filter-process | ||
required = true | ||
[credential] | ||
helper = "!f() { /root/.vscode-server/bin/2b9aebd5354a3629c3aba0a5f5df49f43d6689f8/node /tmp/vscode-remote-containers-9669530c1ddca4fa7b1438b95129151b954035ef.js $*; }; f" |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kuedge.tgz | ||
outDir/ | ||
/.idea | ||
/.vs | ||
/node_modules | ||
/dist |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"flags": { | ||
"gulpfile": "gulpfile.cjs" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/// <reference path="types/akamai.d.ts"/> | ||
import {Cookies} from 'cookies'; | ||
|
||
export class AkamaiHttpContextProvider { | ||
private _httpRequest: AkamaiHttpRequest; | ||
private _httpResponse: AkamaiHttpResponse; | ||
|
||
public constructor(akamiNativeRequest: any, akamaiNativeResponse: any) { | ||
this._httpRequest = new AkamaiHttpRequest(akamiNativeRequest); | ||
this._httpResponse = new AkamaiHttpResponse(akamaiNativeResponse); | ||
} | ||
|
||
public getHttpRequest() { | ||
return this._httpRequest; | ||
} | ||
|
||
public getHttpResponse() { | ||
return this._httpResponse; | ||
} | ||
} | ||
|
||
class AkamaiHttpRequest { | ||
constructor(private _akamiNativeRequest: any) { | ||
} | ||
|
||
public getUserAgent() { | ||
return this.getHeader("user-agent"); | ||
} | ||
|
||
public getHeader(headerNameArg: string) { | ||
return (this._akamiNativeRequest.getHeader(headerNameArg) || []).toString(); | ||
} | ||
|
||
public getAbsoluteUri() { | ||
return `${this._akamiNativeRequest.scheme}://${this._akamiNativeRequest.host}${this._akamiNativeRequest.url}`; | ||
} | ||
|
||
public getUserHostAddress() { | ||
return this._akamiNativeRequest.getVariable('PMUSER_TRUE_CLIENT_IP'); | ||
} | ||
|
||
public getCookieValue(cookieKey: string) { | ||
try { | ||
let cookies = new Cookies(this._akamiNativeRequest.getHeader('Cookie')); | ||
let cookieValue = cookies.get(cookieKey); | ||
if (cookieValue) | ||
return decodeURIComponent(cookieValue); | ||
|
||
} catch { | ||
return undefined; | ||
} | ||
} | ||
|
||
public getRequestBodyAsString() { | ||
return ""; | ||
} | ||
} | ||
|
||
class AkamaiHttpResponse { | ||
constructor(private _akamiNativeRequest: any) { | ||
} | ||
|
||
public setCookie(cookieName: string, cookieValue: string, domain: string, expiration, httpOnly: boolean, isSecure: boolean) { | ||
|
||
// expiration is in secs, but Date needs it in milisecs | ||
let expirationDate = new Date(expiration * 1000); | ||
|
||
let setCookieString = `${cookieName}=${encodeURIComponent(cookieValue)}; expires=${expirationDate.toUTCString()};`; | ||
if (domain) { | ||
setCookieString += ` domain=${domain};`; | ||
} | ||
|
||
if (httpOnly) { | ||
setCookieString += " HttpOnly;" | ||
} | ||
|
||
if (isSecure) { | ||
setCookieString += " Secure;" | ||
} | ||
|
||
setCookieString += " path=/"; | ||
this._akamiNativeRequest.storeCookie(setCookieString); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
const {src, dest} = require("gulp"); | ||
const tar = require('gulp-tar'); | ||
const gzip = require('gulp-gzip'); | ||
const modifyFile = require('gulp-modify-file'); | ||
const path = require('path') | ||
|
||
function addExports(content) { | ||
content = "var exportObject = {};\n" + content; | ||
content += ` | ||
var Utils = exportObject.Utils; | ||
var KnownUser = exportObject.KnownUser; | ||
export { KnownUser, Utils };`; | ||
const lastPropertyDefinition = content.lastIndexOf('Object.defineProperty('); | ||
const newLine = content.indexOf('\n', lastPropertyDefinition); | ||
const firstPart = content.substring(0, newLine); | ||
const secondPart = content.substring(newLine + 1); | ||
return firstPart + ` | ||
exportObject.KnownUser = KnownUser_1.KnownUser; | ||
exportObject.Utils = QueueITHelpers_1.Utils; | ||
` + secondPart; | ||
} | ||
|
||
exports.packageArtifacts = () => { | ||
return src([ | ||
'bundle.json', | ||
'outDir/*.js', | ||
'outDir/**/*.js' | ||
]) | ||
.pipe(modifyFile((content, filePath, _) => { | ||
let filename = path.basename(filePath); | ||
if (filename !== 'queueit-knownuserv3-sdk.js') { | ||
return content; | ||
} | ||
content = addExports(content); | ||
return content; | ||
})) | ||
.pipe(tar('kuedge.tar')) | ||
.pipe(gzip()) | ||
.pipe(dest('dist')); | ||
} | ||
|
||
exports.prepare = ()=>{ | ||
return src([ | ||
'sdk/*.js' | ||
]) | ||
.pipe(modifyFile((content, filePath, _) => { | ||
let filename = path.basename(filePath); | ||
if (filename !== 'queueit-knownuserv3-sdk.js') { | ||
return content; | ||
} | ||
content = addExports(content); | ||
return content; | ||
})) | ||
.pipe(dest('outDir/sdk')); | ||
} | ||
|
||
exports.packageForDeployment = () => { | ||
return src([ | ||
'bundle.json', | ||
'edgegrid.edgerc', | ||
'outDir/*.js', | ||
'outDir/**/*.js' | ||
]) | ||
.pipe(modifyFile((content, filePath, _) => { | ||
let filename = path.basename(filePath); | ||
if (filename !== 'queueit-knownuserv3-sdk.js') { | ||
return content; | ||
} | ||
content = addExports(content); | ||
return content; | ||
})) | ||
.pipe(tar('kuedge.deployment.tar')) | ||
.pipe(gzip()) | ||
.pipe(dest('dist')); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/*INLINE config*/ | ||
const inlineIntegrationConfig = 'IF YOU ARE USING INLINE CONFIGURATION: GET YOUR INTEGRATION CONFIG IN JSON FORMAT FROM GO QUEUE-IT PLATFORM AND PASTE IT HERE'; | ||
/*INLINE config*/ | ||
|
||
import { httpRequest } from 'http-request'; | ||
import { EdgeKV } from './lib/edgekv.js'; | ||
|
||
export { IntegrationConfigProvider }; | ||
class IntegrationConfigProvider { | ||
public static getIntegrationConfig = async function (configType: string, apiKey: string) { | ||
|
||
switch (configType.toLowerCase()) { | ||
case 'inline': | ||
return inlineIntegrationConfig; | ||
case 'cache': | ||
return IntegrationConfigProvider.getIntegrationConfigFromCache(apiKey); | ||
case 'edgekv': | ||
return IntegrationConfigProvider.getIntegrationConfigFromEdgeKV(); | ||
} | ||
return ''; | ||
|
||
} | ||
private static getIntegrationConfigFromCache = async function (apiKey: string) { | ||
const options: any = {} | ||
options.method = "GET"; | ||
options.headers = { "api-key": apiKey }; | ||
options.timeout = 950; | ||
return (await httpRequest("/queueit/integrationconfig/", options)).text(); | ||
} | ||
private static getIntegrationConfigFromEdgeKV = async function () { | ||
let edgeKV = new EdgeKV("QueueIT", "integrations"); | ||
|
||
return await edgeKV.requestHandlerTemplate( | ||
() => edgeKV.getRequest({ namespace: 'QueueIT', group: 'integrations', item: 'integrationConfig' }), | ||
(response) => response.text(), | ||
async (response) => await edgeKV.streamText(response.body), | ||
"GET JSON string", | ||
null); | ||
} | ||
|
||
} |
Oops, something went wrong.