@queue-it/fastly 2.0.0-beta.0 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/package.json +1 -1
- package/src/contextProvider.ts +7 -1
- package/src/helper.ts +1 -1
- package/src/integrationConfigProvider.ts +1 -0
- package/src/sdk/QueueITHelpers.ts +11 -3
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -40,13 +40,16 @@ There are two methods of installation:
|
|
|
40
40
|
You need to edit the Host and name it **origin**.
|
|
41
41
|
- Create a second host that has the hostname of `{yourCustomerId}.queue-it.net` and name it **queue-it**.
|
|
42
42
|
Edit the host, go to advanced options and fill in the same hostname in **Override host**
|
|
43
|
-
- Go to **
|
|
44
|
-
Add the following items in the
|
|
43
|
+
- Go to **Resources -> Config stores** and create a new config store named `IntegrationConfiguration`.
|
|
44
|
+
- Add the following items in the config store (you can find these values in the Go Queue-It self-service platform):
|
|
45
45
|
- customerId: Your customer ID
|
|
46
46
|
- apiKey: The API key for your account
|
|
47
47
|
- secret: Your KnownUserV3 secret
|
|
48
48
|
- queueItOrigin: The name of the queue-it host, in this case it's `queue-it`
|
|
49
|
-
|
|
49
|
+
- Go to **Linked Services** and click on `Link Service`
|
|
50
|
+
- Select your service and click `Next`
|
|
51
|
+
- Click `Link and activate` to link the `Config store` to your service. It should generate a new version
|
|
52
|
+
- You can verify that the `Config store` has been linked by going to your service and see it in the section `Config stores`
|
|
50
53
|
- Download the latest package from the releases page and unarchive it.
|
|
51
54
|
- Edit the `fastly.toml` file and copy the ID of your service (you can see this by opening up the service in Fastly) and
|
|
52
55
|
replace __{YourServiceId}__ with it.
|
package/package.json
CHANGED
package/src/contextProvider.ts
CHANGED
|
@@ -68,7 +68,13 @@ export class FastlyHttpRequest implements IHttpRequest {
|
|
|
68
68
|
if (this.parsedCookieDic.size == 0) {
|
|
69
69
|
this.parseCookies(this.getHeader('cookie'))
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
if (!this.parsedCookieDic.has(cookieKey)) return '';
|
|
72
|
+
const cookieVal = this.parsedCookieDic.get(cookieKey)!;
|
|
73
|
+
try {
|
|
74
|
+
return decodeURIComponent(cookieVal);
|
|
75
|
+
} catch {
|
|
76
|
+
return cookieVal;
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
getHeader(name: string): string {
|
package/src/helper.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Utils } from "./sdk/QueueITHelpers";
|
|
|
2
2
|
import { hmacString } from "./sdk/helpers/crypto";
|
|
3
3
|
|
|
4
4
|
export class QueueITHelper {
|
|
5
|
-
static readonly KUP_VERSION: string = "fastly-
|
|
5
|
+
static readonly KUP_VERSION: string = "fastly-2.0.0";
|
|
6
6
|
|
|
7
7
|
static configureKnownUserHashing(): void {
|
|
8
8
|
Utils.generateSHA256Hash = hmacString;
|
|
@@ -33,7 +33,11 @@ export class Utils {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
static decodeUrl(url: string): string {
|
|
36
|
-
|
|
36
|
+
try {
|
|
37
|
+
return decodeURIComponent(url);
|
|
38
|
+
} catch {
|
|
39
|
+
return url;
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
static generateSHA256Hash: (a: string, b: string) => string = (secretKey: string, stringToHash: string): string => "";
|
|
@@ -107,11 +111,15 @@ export class Utils {
|
|
|
107
111
|
const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
|
|
108
112
|
const results = regex.exec(url);
|
|
109
113
|
if (results === null) return '';
|
|
110
|
-
if (results.length < 3) {
|
|
114
|
+
if (results.length < 3 || results[2] === null || results[2] === undefined) {
|
|
111
115
|
return '';
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
try {
|
|
119
|
+
return decodeURIComponent(results[2].replaceAll('+', ' '));
|
|
120
|
+
} catch {
|
|
121
|
+
return results[2];
|
|
122
|
+
}
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
static removeQueueItToken(url: string): string {
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Queue-it
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|