@newskit-render/api 0.10.0 → 0.13.0
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/CHANGELOG.md +41 -0
- package/dist/apolloClient/createApolloClient.d.ts +1 -1
- package/dist/apolloClient/createApolloClient.js +4 -1
- package/dist/apolloClient/createApolloClient.js.map +1 -1
- package/dist/apolloClient/createClient.js +1 -1
- package/dist/apolloClient/createClient.js.map +1 -1
- package/dist/fetchSessionCookie/fetchSessionCookie.d.ts +1 -0
- package/dist/fetchSessionCookie/fetchSessionCookie.js +83 -0
- package/dist/fetchSessionCookie/fetchSessionCookie.js.map +1 -0
- package/dist/fetchSessionCookie/index.d.ts +1 -0
- package/dist/fetchSessionCookie/index.js +14 -0
- package/dist/fetchSessionCookie/index.js.map +1 -0
- package/dist/helpers/externalLinks/index.js +8 -13
- package/dist/helpers/externalLinks/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,47 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.13.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/api@0.12.0...@newskit-render/api@0.13.0) (2022-02-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **PPDSR-615:** Automate login ([#581](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/581)) ([58e9e3d](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/58e9e3df2d9feb659a68f7386a7c62791ff51b00))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.12.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/api@0.11.0...@newskit-render/api@0.12.0) (2022-02-02)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **PPDSR-567:** Account creation checkout ([#575](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/575)) ([b329ec8](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/b329ec853f545c922e169225e7fc1f30796b1994))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [0.11.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/api@0.10.1...@newskit-render/api@0.11.0) (2022-02-01)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **PPDSR-614:** Render demo site - theming dropdown ([#578](https://github.com/newscorp-ghfb/ncu-newskit-render/issues/578)) ([b190144](https://github.com/newscorp-ghfb/ncu-newskit-render/commit/b190144289bf84f2c445fbf6fc57c3583e593259))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [0.10.1](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/api@0.10.0...@newskit-render/api@0.10.1) (2022-01-27)
|
|
40
|
+
|
|
41
|
+
**Note:** Version bump only for package @newskit-render/api
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
6
47
|
# [0.10.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/api@0.9.0...@newskit-render/api@0.10.0) (2022-01-25)
|
|
7
48
|
|
|
8
49
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ApolloHttpClient, Client } from './types';
|
|
2
|
-
export declare const createApolloClient: (client: Client, cookie?: string | undefined) => Promise<ApolloHttpClient>;
|
|
2
|
+
export declare const createApolloClient: (client: Client, cookie?: string | undefined, token?: string | undefined) => Promise<ApolloHttpClient>;
|
|
@@ -40,7 +40,7 @@ exports.createApolloClient = void 0;
|
|
|
40
40
|
var createClient_1 = require("./createClient");
|
|
41
41
|
var helpers_1 = require("../helpers");
|
|
42
42
|
var types_1 = require("./types");
|
|
43
|
-
var createApolloClient = function (client, cookie) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var createApolloClient = function (client, cookie, token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
44
|
var headers;
|
|
45
45
|
return __generator(this, function (_a) {
|
|
46
46
|
switch (_a.label) {
|
|
@@ -49,6 +49,9 @@ var createApolloClient = function (client, cookie) { return __awaiter(void 0, vo
|
|
|
49
49
|
return [4 /*yield*/, (0, helpers_1.getAcsCookie)(types_1.ClientTypes.main, cookie)];
|
|
50
50
|
case 1:
|
|
51
51
|
headers = _a.sent();
|
|
52
|
+
if (!headers && process.env.ACS_SESSION_URL) {
|
|
53
|
+
headers = { Cookie: process.env.MAIN_COOKIE_NAME + "=" + token };
|
|
54
|
+
}
|
|
52
55
|
return [2 /*return*/, (0, createClient_1.createClient)({
|
|
53
56
|
uri: process.env.MAIN_GRAPHQL_URL,
|
|
54
57
|
links: [helpers_1.retryLink, helpers_1.errorLink],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApolloClient.js","sourceRoot":"","sources":["../../src/apolloClient/createApolloClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6C;AAC7C,sCAA+D;AAE/D,iCAA+D;AAExD,IAAM,kBAAkB,GAAG,UAChC,MAAc,EACd,MAAe;;;;;
|
|
1
|
+
{"version":3,"file":"createApolloClient.js","sourceRoot":"","sources":["../../src/apolloClient/createApolloClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6C;AAC7C,sCAA+D;AAE/D,iCAA+D;AAExD,IAAM,kBAAkB,GAAG,UAChC,MAAc,EACd,MAAe,EACf,KAAc;;;;;qBAEV,CAAA,MAAM,KAAK,mBAAW,CAAC,IAAI,CAAA,EAA3B,wBAA2B;gBACf,qBAAM,IAAA,sBAAY,EAAC,mBAAW,CAAC,IAAI,EAAE,MAAM,CAAC,EAAA;;gBAAtD,OAAO,GAAG,SAA4C;gBAE1D,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE;oBAC3C,OAAO,GAAG,EAAE,MAAM,EAAK,OAAO,CAAC,GAAG,CAAC,gBAAgB,SAAI,KAAO,EAAE,CAAA;iBACjE;gBAED,sBAAO,IAAA,2BAAY,EAAC;wBAClB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,gBAA0B;wBAC3C,KAAK,EAAE,CAAC,mBAAS,EAAE,mBAAS,CAAC;wBAC7B,OAAO,SAAA;qBACR,CAAC,EAAA;;gBAEJ,IAAI,MAAM,KAAK,mBAAW,CAAC,KAAK,EAAE;oBAChC,sBAAO,IAAA,2BAAY,EAAC;4BAClB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,mBAA6B;4BAC9C,OAAO,EAAE,MAAM;gCACb,CAAC,CAAC;oCACE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;oCAC9C,mBAAmB,EAAE,IAAA,sBAAY,EAAC,mBAAW,CAAC,KAAK,EAAE,MAAM,CAAC;iCAC7D;gCACH,CAAC,CAAC;oCACE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;iCAC/C;yBACN,CAAC,EAAA;iBACH;gBACD,sBAAO,IAAA,2BAAY,EAAC,MAAM,CAAC,EAAA;;;KAC5B,CAAA;AAhCY,QAAA,kBAAkB,sBAgC9B"}
|
|
@@ -72,7 +72,7 @@ var createClient = function (_a) {
|
|
|
72
72
|
return [2 /*return*/, new client_1.ApolloClient({
|
|
73
73
|
ssrMode: true,
|
|
74
74
|
link: linkObject,
|
|
75
|
-
name: name ||
|
|
75
|
+
name: name || 'ncu-newskit-render',
|
|
76
76
|
version: '0.1.0',
|
|
77
77
|
cache: new client_1.InMemoryCache({ addTypename: addTypename }).restore(initialState),
|
|
78
78
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","sourceRoot":"","sources":["../../src/apolloClient/createClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAKuB;AACvB,4DAA+B;AAIxB,IAAM,YAAY,GAAG,UAAO,EAOpB;QANb,oBAAiB,EAAjB,YAAY,mBAAG,EAAE,KAAA,EACjB,OAAO,aAAA,EACP,GAAG,SAAA,EACH,mBAAkB,EAAlB,WAAW,mBAAG,IAAI,KAAA,EAClB,KAAK,WAAA,EACL,IAAI,UAAA;;;;YAEE,UAAU,GAAG,KAAK;gBACtB,CAAC,CAAC,IAAA,aAAI,kCACC,KAAK;oBACR,IAAA,uBAAc,EAAC;wBACb,GAAG,KAAA;wBACH,OAAO,SAAA;wBACP,KAAK,uBAAA;qBACN,CAAC;0BACF;gBACJ,CAAC,CAAC,IAAA,uBAAc,EAAC;oBACb,GAAG,KAAA;oBACH,OAAO,SAAA;oBACP,KAAK,uBAAA;iBACN,CAAC,CAAA;YACN,sBAAO,IAAI,qBAAY,CAAC;oBACtB,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"createClient.js","sourceRoot":"","sources":["../../src/apolloClient/createClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAKuB;AACvB,4DAA+B;AAIxB,IAAM,YAAY,GAAG,UAAO,EAOpB;QANb,oBAAiB,EAAjB,YAAY,mBAAG,EAAE,KAAA,EACjB,OAAO,aAAA,EACP,GAAG,SAAA,EACH,mBAAkB,EAAlB,WAAW,mBAAG,IAAI,KAAA,EAClB,KAAK,WAAA,EACL,IAAI,UAAA;;;;YAEE,UAAU,GAAG,KAAK;gBACtB,CAAC,CAAC,IAAA,aAAI,kCACC,KAAK;oBACR,IAAA,uBAAc,EAAC;wBACb,GAAG,KAAA;wBACH,OAAO,SAAA;wBACP,KAAK,uBAAA;qBACN,CAAC;0BACF;gBACJ,CAAC,CAAC,IAAA,uBAAc,EAAC;oBACb,GAAG,KAAA;oBACH,OAAO,SAAA;oBACP,KAAK,uBAAA;iBACN,CAAC,CAAA;YACN,sBAAO,IAAI,qBAAY,CAAC;oBACtB,OAAO,EAAE,IAAI;oBACb,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,IAAI,IAAI,oBAAoB;oBAClC,OAAO,EAAE,OAAO;oBAChB,KAAK,EAAE,IAAI,sBAAa,CAAC,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;iBAChE,CAAC,EAAA;;;CACH,CAAA;AA7BY,QAAA,YAAY,gBA6BxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchSessionCookie: () => Promise<string | undefined>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.fetchSessionCookie = void 0;
|
|
43
|
+
var cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
44
|
+
var fetchSessionCookie = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var response, acsToken, e_1;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0: return [4 /*yield*/, (0, cross_fetch_1.default)(process.env.ACS_SESSION_URL, {
|
|
49
|
+
method: 'POST',
|
|
50
|
+
body: JSON.stringify({
|
|
51
|
+
rememberMe: true,
|
|
52
|
+
sso: false,
|
|
53
|
+
authCredentials: {
|
|
54
|
+
username: process.env.ACS_TEST_ACCOUNT,
|
|
55
|
+
password: process.env.ACS_TEST_PASSWORD,
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
headers: {
|
|
59
|
+
'Content-Type': 'application/vnd.newsuk.acs.createsession-v1+json',
|
|
60
|
+
},
|
|
61
|
+
})];
|
|
62
|
+
case 1:
|
|
63
|
+
response = _a.sent();
|
|
64
|
+
_a.label = 2;
|
|
65
|
+
case 2:
|
|
66
|
+
_a.trys.push([2, 4, , 5]);
|
|
67
|
+
return [4 /*yield*/, response.json()];
|
|
68
|
+
case 3:
|
|
69
|
+
acsToken = _a.sent();
|
|
70
|
+
if (acsToken) {
|
|
71
|
+
return [2 /*return*/, acsToken.acsCookies.cookies.find(function (ck) { return ck.name == process.env.MAIN_COOKIE_NAME; }).value];
|
|
72
|
+
}
|
|
73
|
+
return [3 /*break*/, 5];
|
|
74
|
+
case 4:
|
|
75
|
+
e_1 = _a.sent();
|
|
76
|
+
/* istanbul ignore next */ console.error(e_1);
|
|
77
|
+
return [3 /*break*/, 5];
|
|
78
|
+
case 5: return [2 /*return*/];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}); };
|
|
82
|
+
exports.fetchSessionCookie = fetchSessionCookie;
|
|
83
|
+
//# sourceMappingURL=fetchSessionCookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchSessionCookie.js","sourceRoot":"","sources":["../../src/fetchSessionCookie/fetchSessionCookie.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA+B;AAExB,IAAM,kBAAkB,GAAG;;;;oBACf,qBAAM,IAAA,qBAAK,EAAC,OAAO,CAAC,GAAG,CAAC,eAAyB,EAAE;oBAClE,MAAM,EAAE,MAAM;oBACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,UAAU,EAAE,IAAI;wBAChB,GAAG,EAAE,KAAK;wBACV,eAAe,EAAE;4BACf,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;4BACtC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;yBACxC;qBACF,CAAC;oBACF,OAAO,EAAE;wBACP,cAAc,EAAE,kDAAkD;qBACnE;iBACF,CAAC,EAAA;;gBAbI,QAAQ,GAAG,SAaf;;;;gBAGiB,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;gBAAhC,QAAQ,GAAG,SAAqB;gBAEtC,IAAI,QAAQ,EAAE;oBACZ,sBAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CACrC,UAAC,EAAE,IAAK,OAAA,EAAE,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAvC,CAAuC,CAChD,CAAC,KAAK,EAAA;iBACR;;;;gBAED,0BAA0B,CAAC,OAAO,CAAC,KAAK,CAAC,GAAC,CAAC,CAAA;;oBAG7C,sBAAM;;;KACP,CAAA;AA7BY,QAAA,kBAAkB,sBA6B9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fetchSessionCookie';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./fetchSessionCookie"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fetchSessionCookie/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAoC"}
|
|
@@ -4,7 +4,7 @@ exports.errorLink = exports.retryLink = void 0;
|
|
|
4
4
|
var retry_1 = require("@apollo/client/link/retry");
|
|
5
5
|
var error_1 = require("@apollo/client/link/error");
|
|
6
6
|
var client_1 = require("@apollo/client");
|
|
7
|
-
var
|
|
7
|
+
var fetchSessionCookie_1 = require("../../fetchSessionCookie");
|
|
8
8
|
//Error handling for getting a new access token for GraphQL
|
|
9
9
|
exports.retryLink = new retry_1.RetryLink({
|
|
10
10
|
delay: {
|
|
@@ -16,28 +16,23 @@ exports.retryLink = new retry_1.RetryLink({
|
|
|
16
16
|
max: 1,
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
|
-
var getAccessTokenParams = {
|
|
20
|
-
url: process.env.MAIN_OAUTH_TOKEN,
|
|
21
|
-
client_id: process.env.MAIN_CLIENT_ID,
|
|
22
|
-
client_secret: process.env.MAIN_CLIENT_SECRET,
|
|
23
|
-
audience: process.env.MAIN_AUDIENCE,
|
|
24
|
-
};
|
|
25
19
|
exports.errorLink = (0, error_1.onError)(function (_a) {
|
|
26
20
|
var networkError = _a.networkError, operation = _a.operation, forward = _a.forward, graphQLErrors = _a.graphQLErrors;
|
|
27
21
|
if (graphQLErrors) {
|
|
28
22
|
console.error(graphQLErrors);
|
|
29
23
|
}
|
|
30
24
|
//Only retry if it is an external authorization
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
if (graphQLErrors &&
|
|
26
|
+
graphQLErrors[0] &&
|
|
27
|
+
graphQLErrors[0].message ===
|
|
28
|
+
'Context creation failed: cookie doesnt map to valid acs user' &&
|
|
29
|
+
process.env.ACS_SESSION_URL) {
|
|
35
30
|
return new client_1.Observable(function (observer) {
|
|
36
|
-
(0,
|
|
31
|
+
(0, fetchSessionCookie_1.fetchSessionCookie)()
|
|
37
32
|
.then(function (token) {
|
|
38
33
|
operation.setContext(function () { return ({
|
|
39
34
|
headers: {
|
|
40
|
-
|
|
35
|
+
Cookie: process.env.MAIN_COOKIE_NAME + "=" + token,
|
|
41
36
|
},
|
|
42
37
|
}); });
|
|
43
38
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/externalLinks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,mDAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/externalLinks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,mDAAmD;AACnD,yCAAuD;AACvD,+DAA6D;AAE7D,2DAA2D;AAC9C,QAAA,SAAS,GAAG,IAAI,iBAAS,CAAC;IACrC,KAAK,EAAE;QACL,OAAO,EAAE,GAAG;QACZ,GAAG,EAAE,IAAI;QACT,MAAM,EAAE,IAAI;KACb;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,CAAC;KACP;CACF,CAAC,CAAA;AAEW,QAAA,SAAS,GAAe,IAAA,eAAO,EAC1C,UAAC,EAAmD;QAAjD,YAAY,kBAAA,EAAE,SAAS,eAAA,EAAE,OAAO,aAAA,EAAE,aAAa,mBAAA;IAChD,IAAI,aAAa,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;KAC7B;IACD,+CAA+C;IAC/C,IACE,aAAa;QACb,aAAa,CAAC,CAAC,CAAC;QAChB,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO;YACtB,8DAA8D;QAChE,OAAO,CAAC,GAAG,CAAC,eAAe,EAC3B;QACA,OAAO,IAAI,mBAAU,CAAC,UAAC,QAAQ;YAC7B,IAAA,uCAAkB,GAAE;iBACjB,IAAI,CAAC,UAAC,KAAK;gBACV,SAAS,CAAC,UAAU,CAAC,cAAM,OAAA,CAAC;oBAC1B,OAAO,EAAE;wBACP,MAAM,EAAK,OAAO,CAAC,GAAG,CAAC,gBAAgB,SAAI,KAAO;qBACnD;iBACF,CAAC,EAJyB,CAIzB,CAAC,CAAA;YACL,CAAC,CAAC;iBACD,IAAI,CAAC;gBACJ,IAAM,UAAU,GAAG;oBACjB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;oBAClC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;oBACpC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;iBAC3C,CAAA;gBAED,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;YAC1C,CAAC,CAAC;iBACD,KAAK,CAAC,UAAC,KAAK;gBACX,+DAA+D;gBAC/D,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACvB,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;KACH;IACD,OAAM;AACR,CAAC,CACF,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -12,4 +12,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./apolloClient"), exports);
|
|
14
14
|
__exportStar(require("./helpers"), exports);
|
|
15
|
+
__exportStar(require("./fetchSessionCookie"), exports);
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B;AAC9B,4CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B;AAC9B,4CAAyB;AACzB,uDAAoC"}
|