@instructure/quiz-core 20.20.1-rc.1 → 20.20.1-rc.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/es/common/kinesis/QuizEventsLogger.js +2 -1
- package/es/common/kinesis/StreamQueue.js +22 -1
- package/es/common/kinesis/client.js +1 -0
- package/lib/common/kinesis/QuizEventsLogger.js +2 -1
- package/lib/common/kinesis/StreamQueue.js +23 -1
- package/lib/common/kinesis/client.js +1 -0
- package/package.json +10 -9
|
@@ -108,7 +108,8 @@ var getLogger = /*#__PURE__*/function () {
|
|
|
108
108
|
streamQueues = kinesisConfig.streamConfigs.map(function (config) {
|
|
109
109
|
return new StreamQueue({
|
|
110
110
|
config: config,
|
|
111
|
-
kinesis: kinesisClient
|
|
111
|
+
kinesis: kinesisClient,
|
|
112
|
+
proxyDomain: kinesisConfig.proxyDomain
|
|
112
113
|
});
|
|
113
114
|
});
|
|
114
115
|
logger = _construct(QuizEventsLogger, _toConsumableArray(streamQueues)); // TODO: This appears to work in production, but fixing this eslint violation causes tests to fail.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import { AwsClient } from 'aws4fetch';
|
|
3
4
|
var ERROR_STATE = 'error';
|
|
4
5
|
var WAITING_STATE = 'waiting';
|
|
5
6
|
var SENDING_STATE = 'sending';
|
|
@@ -8,14 +9,23 @@ var SENT_STATE = 'sent';
|
|
|
8
9
|
var StreamQueue = /*#__PURE__*/function () {
|
|
9
10
|
function StreamQueue(_ref) {
|
|
10
11
|
var config = _ref.config,
|
|
11
|
-
kinesis = _ref.kinesis
|
|
12
|
+
kinesis = _ref.kinesis,
|
|
13
|
+
proxyDomain = _ref.proxyDomain;
|
|
12
14
|
|
|
13
15
|
_classCallCheck(this, StreamQueue);
|
|
14
16
|
|
|
15
17
|
this.config = config;
|
|
16
18
|
this.kinesis = kinesis;
|
|
19
|
+
this.proxyDomain = proxyDomain;
|
|
17
20
|
this.timeout = null;
|
|
18
21
|
this.pageQueue = [];
|
|
22
|
+
this.awsClient = new AwsClient({
|
|
23
|
+
accessKeyId: kinesis.config.credentials.accessKeyId,
|
|
24
|
+
secretAccessKey: kinesis.config.credentials.secretAccessKey,
|
|
25
|
+
sessionToken: kinesis.config.credentials.sessionToken,
|
|
26
|
+
region: kinesis.config.client_configuration.region,
|
|
27
|
+
service: 'execute-api'
|
|
28
|
+
});
|
|
19
29
|
|
|
20
30
|
this._addPage();
|
|
21
31
|
|
|
@@ -97,6 +107,15 @@ var StreamQueue = /*#__PURE__*/function () {
|
|
|
97
107
|
value: function _canSendPage(page) {
|
|
98
108
|
return (page.status === WAITING_STATE || page.status === ERROR_STATE) && page.data.length;
|
|
99
109
|
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "_sendRecordsViaProxy",
|
|
112
|
+
value: function _sendRecordsViaProxy(params) {
|
|
113
|
+
if (!this.proxyDomain) return;
|
|
114
|
+
this.awsClient.fetch(this.proxyDomain, {
|
|
115
|
+
method: 'PUT',
|
|
116
|
+
body: JSON.stringify(params)
|
|
117
|
+
});
|
|
118
|
+
}
|
|
100
119
|
}, {
|
|
101
120
|
key: "_sendRecords",
|
|
102
121
|
value: function _sendRecords() {
|
|
@@ -115,6 +134,8 @@ var StreamQueue = /*#__PURE__*/function () {
|
|
|
115
134
|
_this.pageQueue[i].status = ERROR_STATE; // eslint-disable-next-line no-console
|
|
116
135
|
|
|
117
136
|
console.error("KINESIS STREAM ".concat(_this.config.stream, " ERROR: "), err);
|
|
137
|
+
|
|
138
|
+
_this._sendRecordsViaProxy(params);
|
|
118
139
|
} else {
|
|
119
140
|
_this.pageQueue[i].status = SENT_STATE; // eslint-disable-next-line no-console
|
|
120
141
|
|
|
@@ -9,6 +9,7 @@ export var buildKinesisConfiguration = function buildKinesisConfiguration(_ref)
|
|
|
9
9
|
if (serverTime) config.systemClockOffset = Date.parse(serverTime) - Date.now();
|
|
10
10
|
return {
|
|
11
11
|
client: buildKinesisClient(configuration, credentials),
|
|
12
|
+
proxyDomain: configuration.proxy_domain,
|
|
12
13
|
streamConfigs: assembleStreamConfigs(configuration)
|
|
13
14
|
};
|
|
14
15
|
};
|
|
@@ -127,7 +127,8 @@ var getLogger = /*#__PURE__*/function () {
|
|
|
127
127
|
streamQueues = kinesisConfig.streamConfigs.map(function (config) {
|
|
128
128
|
return new _StreamQueue.default({
|
|
129
129
|
config: config,
|
|
130
|
-
kinesis: kinesisClient
|
|
130
|
+
kinesis: kinesisClient,
|
|
131
|
+
proxyDomain: kinesisConfig.proxyDomain
|
|
131
132
|
});
|
|
132
133
|
});
|
|
133
134
|
logger = (0, _construct2.default)(QuizEventsLogger, (0, _toConsumableArray2.default)(streamQueues)); // TODO: This appears to work in production, but fixing this eslint violation causes tests to fail.
|
|
@@ -11,6 +11,8 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
11
|
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
|
|
14
|
+
var _aws4fetch = require("aws4fetch");
|
|
15
|
+
|
|
14
16
|
var ERROR_STATE = 'error';
|
|
15
17
|
var WAITING_STATE = 'waiting';
|
|
16
18
|
var SENDING_STATE = 'sending';
|
|
@@ -19,12 +21,21 @@ var SENT_STATE = 'sent';
|
|
|
19
21
|
var StreamQueue = /*#__PURE__*/function () {
|
|
20
22
|
function StreamQueue(_ref) {
|
|
21
23
|
var config = _ref.config,
|
|
22
|
-
kinesis = _ref.kinesis
|
|
24
|
+
kinesis = _ref.kinesis,
|
|
25
|
+
proxyDomain = _ref.proxyDomain;
|
|
23
26
|
(0, _classCallCheck2.default)(this, StreamQueue);
|
|
24
27
|
this.config = config;
|
|
25
28
|
this.kinesis = kinesis;
|
|
29
|
+
this.proxyDomain = proxyDomain;
|
|
26
30
|
this.timeout = null;
|
|
27
31
|
this.pageQueue = [];
|
|
32
|
+
this.awsClient = new _aws4fetch.AwsClient({
|
|
33
|
+
accessKeyId: kinesis.config.credentials.accessKeyId,
|
|
34
|
+
secretAccessKey: kinesis.config.credentials.secretAccessKey,
|
|
35
|
+
sessionToken: kinesis.config.credentials.sessionToken,
|
|
36
|
+
region: kinesis.config.client_configuration.region,
|
|
37
|
+
service: 'execute-api'
|
|
38
|
+
});
|
|
28
39
|
|
|
29
40
|
this._addPage();
|
|
30
41
|
|
|
@@ -106,6 +117,15 @@ var StreamQueue = /*#__PURE__*/function () {
|
|
|
106
117
|
value: function _canSendPage(page) {
|
|
107
118
|
return (page.status === WAITING_STATE || page.status === ERROR_STATE) && page.data.length;
|
|
108
119
|
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "_sendRecordsViaProxy",
|
|
122
|
+
value: function _sendRecordsViaProxy(params) {
|
|
123
|
+
if (!this.proxyDomain) return;
|
|
124
|
+
this.awsClient.fetch(this.proxyDomain, {
|
|
125
|
+
method: 'PUT',
|
|
126
|
+
body: JSON.stringify(params)
|
|
127
|
+
});
|
|
128
|
+
}
|
|
109
129
|
}, {
|
|
110
130
|
key: "_sendRecords",
|
|
111
131
|
value: function _sendRecords() {
|
|
@@ -124,6 +144,8 @@ var StreamQueue = /*#__PURE__*/function () {
|
|
|
124
144
|
_this.pageQueue[i].status = ERROR_STATE; // eslint-disable-next-line no-console
|
|
125
145
|
|
|
126
146
|
console.error("KINESIS STREAM ".concat(_this.config.stream, " ERROR: "), err);
|
|
147
|
+
|
|
148
|
+
_this._sendRecordsViaProxy(params);
|
|
127
149
|
} else {
|
|
128
150
|
_this.pageQueue[i].status = SENT_STATE; // eslint-disable-next-line no-console
|
|
129
151
|
|
|
@@ -22,6 +22,7 @@ var buildKinesisConfiguration = function buildKinesisConfiguration(_ref) {
|
|
|
22
22
|
if (serverTime) _global.config.systemClockOffset = Date.parse(serverTime) - Date.now();
|
|
23
23
|
return {
|
|
24
24
|
client: buildKinesisClient(configuration, credentials),
|
|
25
|
+
proxyDomain: configuration.proxy_domain,
|
|
25
26
|
streamConfigs: (0, _config.assembleStreamConfigs)(configuration)
|
|
26
27
|
};
|
|
27
28
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.20.1-rc.
|
|
3
|
+
"version": "20.20.1-rc.2+31245886a",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.2.2",
|
|
47
|
-
"@instructure/quiz-common": "20.20.1-rc.
|
|
48
|
-
"@instructure/quiz-i18n": "20.20.1-rc.
|
|
49
|
-
"@instructure/quiz-interactions": "20.20.1-rc.
|
|
50
|
-
"@instructure/quiz-number-input": "20.20.1-rc.
|
|
51
|
-
"@instructure/quiz-rce": "20.20.1-rc.
|
|
47
|
+
"@instructure/quiz-common": "20.20.1-rc.2+31245886a",
|
|
48
|
+
"@instructure/quiz-i18n": "20.20.1-rc.2+31245886a",
|
|
49
|
+
"@instructure/quiz-interactions": "20.20.1-rc.2+31245886a",
|
|
50
|
+
"@instructure/quiz-number-input": "20.20.1-rc.2+31245886a",
|
|
51
|
+
"@instructure/quiz-rce": "20.20.1-rc.2+31245886a",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"@instructure/ui-utils": "^8.51.0",
|
|
100
100
|
"@instructure/ui-view": "^8.51.0",
|
|
101
101
|
"aws-sdk": "^2.3.2",
|
|
102
|
+
"aws4fetch": "^1.0.20",
|
|
102
103
|
"classnames": "^2.2.5",
|
|
103
104
|
"content-disposition": "^0.5.2",
|
|
104
105
|
"d3-array": "^1",
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
"file-saver": "~2.0.5",
|
|
112
113
|
"humps": "^2.0.0",
|
|
113
114
|
"immutable": "^3.8.1",
|
|
114
|
-
"instructure-validations": "20.20.1-rc.
|
|
115
|
+
"instructure-validations": "20.20.1-rc.2+31245886a",
|
|
115
116
|
"ipaddr.js": "^1.5.4",
|
|
116
117
|
"isomorphic-fetch": "^2.2.0",
|
|
117
118
|
"isuuid": "^0.1.0",
|
|
@@ -161,7 +162,7 @@
|
|
|
161
162
|
"jquery": "^2.2.3",
|
|
162
163
|
"karma-junit-reporter": "^2.0.1",
|
|
163
164
|
"most-subject": "^5.3.0",
|
|
164
|
-
"quiz-presets": "20.20.1-rc.
|
|
165
|
+
"quiz-presets": "20.20.1-rc.2+31245886a",
|
|
165
166
|
"react": "^16.8.6",
|
|
166
167
|
"react-addons-test-utils": "^15.6.2",
|
|
167
168
|
"react-dom": "^16.8.6",
|
|
@@ -177,5 +178,5 @@
|
|
|
177
178
|
"publishConfig": {
|
|
178
179
|
"access": "public"
|
|
179
180
|
},
|
|
180
|
-
"gitHead": "
|
|
181
|
+
"gitHead": "31245886a8ec22bb6c6824024d760fe44afdd266"
|
|
181
182
|
}
|