@ama-sdk/core 10.3.0-prerelease.66 → 10.3.0-prerelease.68
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/cjs/clients/api-angular-client.js +4 -4
- package/cjs/clients/api-beacon-client.js +4 -4
- package/cjs/clients/api-fetch-client.js +4 -4
- package/cjs/fwk/api.helper.spec.js +20 -20
- package/cjs/fwk/api.helpers.js +13 -13
- package/cjs/fwk/core/api-client.js +1 -1
- package/cjs/fwk/core/base-api-constructor.js +1 -1
- package/cjs/fwk/date.js +9 -9
- package/cjs/fwk/date.spec.js +25 -25
- package/cjs/fwk/errors.js +3 -3
- package/cjs/fwk/mocks/alf-mock-adapter.js +4 -4
- package/cjs/fwk/mocks/base-mock-adapter.js +2 -2
- package/cjs/fwk/mocks/helpers.js +3 -3
- package/cjs/fwk/reviver.spec.js +19 -19
- package/cjs/plugins/additional-params/additional-params-sync.request.js +2 -2
- package/cjs/plugins/additional-params/additional-params.request.js +3 -3
- package/cjs/plugins/additional-params/additional-params.spec.js +30 -30
- package/cjs/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
- package/cjs/plugins/api-configuration-override/api-configuration-override.spec.js +13 -13
- package/cjs/plugins/api-key/api-key.request.js +2 -2
- package/cjs/plugins/api-key/api-key.spec.js +11 -11
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
- package/cjs/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +33 -33
- package/cjs/plugins/client-facts/client-facts.request.js +3 -3
- package/cjs/plugins/client-facts/client-facts.spec.js +27 -27
- package/cjs/plugins/concurrent/concurrent.spec.js +4 -4
- package/cjs/plugins/custom-info/custom-info.spec.js +15 -15
- package/cjs/plugins/exception/exception.reply.js +2 -2
- package/cjs/plugins/exception/exception.spec.js +15 -15
- package/cjs/plugins/fetch-cache/fetch-cache.request.js +4 -4
- package/cjs/plugins/fetch-cache/fetch-cache.spec.js +20 -20
- package/cjs/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
- package/cjs/plugins/fetch-credentials/fetch-credentials.spec.js +8 -8
- package/cjs/plugins/json-token/json-token.reply.js +5 -5
- package/cjs/plugins/json-token/json-token.request.js +4 -4
- package/cjs/plugins/json-token/json-token.spec.js +24 -24
- package/cjs/plugins/keepalive/keepalive.request.js +2 -2
- package/cjs/plugins/keepalive/keepalive.spec.js +4 -4
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +11 -11
- package/cjs/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +25 -25
- package/cjs/plugins/mock-intercept/mock-intercept.fetch.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.interface.js +2 -2
- package/cjs/plugins/mock-intercept/mock-intercept.request.js +3 -3
- package/cjs/plugins/mock-intercept/mock-intercept.spec.js +28 -28
- package/cjs/plugins/perf-metric/perf-metric.fetch.js +1 -1
- package/cjs/plugins/perf-metric/perf-metric.probe.spec.js +9 -9
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.request.js +11 -11
- package/cjs/plugins/pii-tokenizer/pii-tokenizer.spec.js +94 -94
- package/cjs/plugins/raw-response-info/raw-response-info.spec.js +12 -12
- package/cjs/plugins/retry/retry.spec.js +20 -20
- package/cjs/plugins/reviver/reviver.spec.js +4 -4
- package/cjs/plugins/session-id/session-id.request.js +6 -6
- package/cjs/plugins/session-id/session-id.spec.js +13 -13
- package/cjs/plugins/si-token/si-token.spec.js +9 -9
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +4 -4
- package/cjs/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +44 -44
- package/cjs/plugins/timeout/timeout.fetch.js +11 -11
- package/cjs/plugins/timeout/timeout.spec.js +13 -13
- package/cjs/plugins/url-rewrite/url-rewrite.spec.js +9 -9
- package/cjs/plugins/wait-for/wait-for.spec.js +9 -9
- package/cjs/utils/crypto.js +14 -14
- package/cjs/utils/generic-api.js +4 -4
- package/cjs/utils/json-token.js +30 -30
- package/cjs/utils/json-token.spec.js +31 -31
- package/esm2015/clients/api-angular-client.js +8 -8
- package/esm2015/clients/api-beacon-client.js +5 -5
- package/esm2015/clients/api-fetch-client.js +8 -8
- package/esm2015/clients/index.js +2 -2
- package/esm2015/fwk/api.helper.spec.js +21 -21
- package/esm2015/fwk/api.helpers.js +13 -13
- package/esm2015/fwk/core/api-client.js +1 -1
- package/esm2015/fwk/core/base-api-constructor.js +1 -1
- package/esm2015/fwk/core/index.js +2 -2
- package/esm2015/fwk/date.js +9 -9
- package/esm2015/fwk/date.spec.js +26 -26
- package/esm2015/fwk/errors.js +3 -3
- package/esm2015/fwk/index.js +10 -10
- package/esm2015/fwk/mocks/alf-mock-adapter.js +6 -6
- package/esm2015/fwk/mocks/base-mock-adapter.js +3 -3
- package/esm2015/fwk/mocks/helpers.js +3 -3
- package/esm2015/fwk/mocks/index.js +10 -10
- package/esm2015/fwk/mocks/random-mock-adapter.js +1 -1
- package/esm2015/fwk/mocks/sequential-mock-adapter.js +1 -1
- package/esm2015/fwk/reviver.spec.js +20 -20
- package/esm2015/plugins/additional-params/additional-params-sync.request.js +3 -3
- package/esm2015/plugins/additional-params/additional-params.request.js +3 -3
- package/esm2015/plugins/additional-params/additional-params.spec.js +32 -32
- package/esm2015/plugins/additional-params/index.js +2 -2
- package/esm2015/plugins/api-configuration-override/api-configuration-override.request.js +2 -2
- package/esm2015/plugins/api-configuration-override/api-configuration-override.spec.js +14 -14
- package/esm2015/plugins/api-configuration-override/index.js +1 -1
- package/esm2015/plugins/api-key/api-key.request.js +2 -2
- package/esm2015/plugins/api-key/api-key.spec.js +12 -12
- package/esm2015/plugins/api-key/index.js +1 -1
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.request.js +5 -5
- package/esm2015/plugins/bot-protection-fingerprint/bot-protection-fingerprint.spec.js +34 -34
- package/esm2015/plugins/bot-protection-fingerprint/index.js +1 -1
- package/esm2015/plugins/client-facts/client-facts.request.js +4 -4
- package/esm2015/plugins/client-facts/client-facts.spec.js +28 -28
- package/esm2015/plugins/client-facts/index.js +1 -1
- package/esm2015/plugins/concurrent/concurrent.spec.js +5 -5
- package/esm2015/plugins/concurrent/index.js +1 -1
- package/esm2015/plugins/core/index.js +4 -4
- package/esm2015/plugins/custom-info/custom-info.spec.js +17 -17
- package/esm2015/plugins/custom-info/index.js +1 -1
- package/esm2015/plugins/exception/exception.reply.js +4 -4
- package/esm2015/plugins/exception/exception.spec.js +18 -18
- package/esm2015/plugins/exception/index.js +1 -1
- package/esm2015/plugins/fetch-cache/fetch-cache.request.js +4 -4
- package/esm2015/plugins/fetch-cache/fetch-cache.spec.js +21 -21
- package/esm2015/plugins/fetch-cache/index.js +1 -1
- package/esm2015/plugins/fetch-credentials/fetch-credentials.request.js +1 -1
- package/esm2015/plugins/fetch-credentials/fetch-credentials.spec.js +9 -9
- package/esm2015/plugins/fetch-credentials/index.js +1 -1
- package/esm2015/plugins/index.js +25 -25
- package/esm2015/plugins/json-token/index.js +2 -2
- package/esm2015/plugins/json-token/json-token.reply.js +5 -5
- package/esm2015/plugins/json-token/json-token.request.js +4 -4
- package/esm2015/plugins/json-token/json-token.spec.js +27 -27
- package/esm2015/plugins/keepalive/index.js +1 -1
- package/esm2015/plugins/keepalive/keepalive.request.js +2 -2
- package/esm2015/plugins/keepalive/keepalive.spec.js +5 -5
- package/esm2015/plugins/mgw-mdw-auth/index.js +1 -1
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.request.js +13 -13
- package/esm2015/plugins/mgw-mdw-auth/mgw-mdw-auth.spec.js +27 -27
- package/esm2015/plugins/mock-intercept/index.js +2 -2
- package/esm2015/plugins/mock-intercept/mock-intercept.fetch.js +5 -5
- package/esm2015/plugins/mock-intercept/mock-intercept.interface.js +2 -2
- package/esm2015/plugins/mock-intercept/mock-intercept.request.js +4 -4
- package/esm2015/plugins/mock-intercept/mock-intercept.spec.js +32 -32
- package/esm2015/plugins/perf-metric/index.js +1 -1
- package/esm2015/plugins/perf-metric/perf-metric.fetch.js +2 -2
- package/esm2015/plugins/perf-metric/perf-metric.probe.spec.js +10 -10
- package/esm2015/plugins/pii-tokenizer/index.js +1 -1
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.request.js +12 -12
- package/esm2015/plugins/pii-tokenizer/pii-tokenizer.spec.js +96 -96
- package/esm2015/plugins/raw-response-info/index.js +1 -1
- package/esm2015/plugins/raw-response-info/raw-response-info.spec.js +14 -14
- package/esm2015/plugins/retry/index.js +1 -1
- package/esm2015/plugins/retry/retry.fetch.js +1 -1
- package/esm2015/plugins/retry/retry.spec.js +21 -21
- package/esm2015/plugins/reviver/index.js +1 -1
- package/esm2015/plugins/reviver/reviver.spec.js +6 -6
- package/esm2015/plugins/session-id/index.js +1 -1
- package/esm2015/plugins/session-id/session-id.request.js +7 -7
- package/esm2015/plugins/session-id/session-id.spec.js +14 -14
- package/esm2015/plugins/si-token/index.js +1 -1
- package/esm2015/plugins/si-token/si-token.request.js +1 -1
- package/esm2015/plugins/si-token/si-token.spec.js +10 -10
- package/esm2015/plugins/simple-api-key-authentication/index.js +1 -1
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.request.js +5 -5
- package/esm2015/plugins/simple-api-key-authentication/simple-api-key-authentication.spec.js +46 -46
- package/esm2015/plugins/timeout/index.js +1 -1
- package/esm2015/plugins/timeout/timeout.fetch.js +12 -12
- package/esm2015/plugins/timeout/timeout.spec.js +15 -15
- package/esm2015/plugins/url-rewrite/index.js +1 -1
- package/esm2015/plugins/url-rewrite/url-rewrite.spec.js +10 -10
- package/esm2015/plugins/wait-for/index.js +1 -1
- package/esm2015/plugins/wait-for/wait-for.spec.js +10 -10
- package/esm2015/public_api.js +4 -4
- package/esm2015/utils/crypto.js +15 -15
- package/esm2015/utils/generic-api.js +5 -5
- package/esm2015/utils/index.js +6 -6
- package/esm2015/utils/json-token.js +32 -32
- package/esm2015/utils/json-token.spec.js +32 -32
- package/package.json +5 -5
|
@@ -135,16 +135,16 @@ function _ts_generator(thisArg, body) {
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
import { SequentialMockAdapter } from
|
|
139
|
-
import { MockInterceptFetch } from
|
|
140
|
-
import { CUSTOM_MOCK_OPERATION_ID_HEADER } from
|
|
141
|
-
import { MockInterceptRequest } from
|
|
138
|
+
import { SequentialMockAdapter } from '../../fwk';
|
|
139
|
+
import { MockInterceptFetch } from './mock-intercept.fetch';
|
|
140
|
+
import { CUSTOM_MOCK_OPERATION_ID_HEADER } from './mock-intercept.interface';
|
|
141
|
+
import { MockInterceptRequest } from './mock-intercept.request';
|
|
142
142
|
var testMock = {
|
|
143
143
|
mockData: {}
|
|
144
144
|
};
|
|
145
145
|
var getMockSpy = jest.fn().mockReturnValue(testMock);
|
|
146
146
|
var getLatestMockSpy = jest.fn().mockReturnValue(testMock);
|
|
147
|
-
var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve(
|
|
147
|
+
var retrieveOperationIdSpy = jest.fn().mockReturnValue(Promise.resolve('testOperation'));
|
|
148
148
|
var initializeSpy = jest.fn().mockReturnValue(Promise.resolve());
|
|
149
149
|
var testMockAdapter = {
|
|
150
150
|
getMock: getMockSpy,
|
|
@@ -160,13 +160,13 @@ var requestPlugins = [
|
|
|
160
160
|
var apiClient = {
|
|
161
161
|
options: {
|
|
162
162
|
requestPlugins: requestPlugins,
|
|
163
|
-
basePath:
|
|
163
|
+
basePath: 'test',
|
|
164
164
|
replyPlugins: []
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
describe(
|
|
168
|
-
describe(
|
|
169
|
-
it(
|
|
167
|
+
describe('Mock intercept', function() {
|
|
168
|
+
describe('request plugin', function() {
|
|
169
|
+
it('should do nothing if disabled is true', /*#__PURE__*/ _async_to_generator(function() {
|
|
170
170
|
var plugin, originalRequest, loaded;
|
|
171
171
|
return _ts_generator(this, function(_state) {
|
|
172
172
|
switch(_state.label){
|
|
@@ -176,11 +176,11 @@ describe("Mock intercept", function() {
|
|
|
176
176
|
adapter: testMockAdapter
|
|
177
177
|
});
|
|
178
178
|
originalRequest = {
|
|
179
|
-
method:
|
|
179
|
+
method: 'get',
|
|
180
180
|
headers: new Headers({
|
|
181
|
-
test:
|
|
181
|
+
test: 'true'
|
|
182
182
|
}),
|
|
183
|
-
basePath:
|
|
183
|
+
basePath: 'myurl'
|
|
184
184
|
};
|
|
185
185
|
loaded = plugin.load();
|
|
186
186
|
return [
|
|
@@ -198,7 +198,7 @@ describe("Mock intercept", function() {
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
}));
|
|
201
|
-
it.skip(
|
|
201
|
+
it.skip('should intercept the request', /*#__PURE__*/ _async_to_generator(function() {
|
|
202
202
|
var plugin, originalRequest, loaded, transformed, res;
|
|
203
203
|
return _ts_generator(this, function(_state) {
|
|
204
204
|
switch(_state.label){
|
|
@@ -209,10 +209,10 @@ describe("Mock intercept", function() {
|
|
|
209
209
|
});
|
|
210
210
|
originalRequest = {
|
|
211
211
|
headers: new Headers({
|
|
212
|
-
test:
|
|
212
|
+
test: 'true'
|
|
213
213
|
}),
|
|
214
|
-
basePath:
|
|
215
|
-
method:
|
|
214
|
+
basePath: 'myurl',
|
|
215
|
+
method: 'PATCH'
|
|
216
216
|
};
|
|
217
217
|
loaded = plugin.load();
|
|
218
218
|
transformed = loaded.transform(originalRequest);
|
|
@@ -232,8 +232,8 @@ describe("Mock intercept", function() {
|
|
|
232
232
|
});
|
|
233
233
|
}));
|
|
234
234
|
});
|
|
235
|
-
describe(
|
|
236
|
-
describe(
|
|
235
|
+
describe('fetch plugin', function() {
|
|
236
|
+
describe('when using an initialization function', function() {
|
|
237
237
|
var plugin;
|
|
238
238
|
var asyncMockAdapter;
|
|
239
239
|
beforeEach(function() {
|
|
@@ -247,17 +247,17 @@ describe("Mock intercept", function() {
|
|
|
247
247
|
adapter: asyncMockAdapter
|
|
248
248
|
});
|
|
249
249
|
});
|
|
250
|
-
it(
|
|
250
|
+
it('should call initialize fn', /*#__PURE__*/ _async_to_generator(function() {
|
|
251
251
|
var loadedPlugin, testData;
|
|
252
252
|
return _ts_generator(this, function(_state) {
|
|
253
253
|
switch(_state.label){
|
|
254
254
|
case 0:
|
|
255
255
|
loadedPlugin = plugin.load({
|
|
256
256
|
fetchPlugins: [],
|
|
257
|
-
url:
|
|
257
|
+
url: 'myurl',
|
|
258
258
|
apiClient: apiClient,
|
|
259
259
|
options: {
|
|
260
|
-
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER,
|
|
260
|
+
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
testData = {
|
|
@@ -271,24 +271,24 @@ describe("Mock intercept", function() {
|
|
|
271
271
|
_state.sent();
|
|
272
272
|
expect(initializeSpy).toHaveBeenCalled();
|
|
273
273
|
expect(getMockSpy).not.toHaveBeenCalled();
|
|
274
|
-
expect(getLatestMockSpy).toHaveBeenCalledWith(
|
|
274
|
+
expect(getLatestMockSpy).toHaveBeenCalledWith('testOperation');
|
|
275
275
|
return [
|
|
276
276
|
2
|
|
277
277
|
];
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}));
|
|
281
|
-
it(
|
|
281
|
+
it('should throw if there is no request plugin', function() {
|
|
282
282
|
var config = {
|
|
283
283
|
fetchPlugins: [],
|
|
284
|
-
url:
|
|
284
|
+
url: 'myurl',
|
|
285
285
|
apiClient: {
|
|
286
286
|
options: {
|
|
287
287
|
requestPlugins: []
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
290
|
options: {
|
|
291
|
-
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER,
|
|
291
|
+
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
|
|
292
292
|
}
|
|
293
293
|
};
|
|
294
294
|
expect(function() {
|
|
@@ -297,8 +297,8 @@ describe("Mock intercept", function() {
|
|
|
297
297
|
});
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
|
-
describe(
|
|
301
|
-
it(
|
|
300
|
+
describe('with delay', function() {
|
|
301
|
+
it('should delay the response of the specific number', /*#__PURE__*/ _async_to_generator(function() {
|
|
302
302
|
var plugin, loadedPlugin, callback, run;
|
|
303
303
|
return _ts_generator(this, function(_state) {
|
|
304
304
|
switch(_state.label){
|
|
@@ -309,10 +309,10 @@ describe("Mock intercept", function() {
|
|
|
309
309
|
});
|
|
310
310
|
loadedPlugin = plugin.load({
|
|
311
311
|
fetchPlugins: [],
|
|
312
|
-
url:
|
|
312
|
+
url: '',
|
|
313
313
|
apiClient: apiClient,
|
|
314
314
|
options: {
|
|
315
|
-
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER,
|
|
315
|
+
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
callback = jest.fn();
|
|
@@ -343,7 +343,7 @@ describe("Mock intercept", function() {
|
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
}));
|
|
346
|
-
it(
|
|
346
|
+
it('should delay the response based on callback', /*#__PURE__*/ _async_to_generator(function() {
|
|
347
347
|
var plugin, loadedPlugin, callback, run;
|
|
348
348
|
return _ts_generator(this, function(_state) {
|
|
349
349
|
switch(_state.label){
|
|
@@ -356,10 +356,10 @@ describe("Mock intercept", function() {
|
|
|
356
356
|
});
|
|
357
357
|
loadedPlugin = plugin.load({
|
|
358
358
|
fetchPlugins: [],
|
|
359
|
-
url:
|
|
359
|
+
url: '',
|
|
360
360
|
apiClient: apiClient,
|
|
361
361
|
options: {
|
|
362
|
-
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER,
|
|
362
|
+
headers: new Headers(_define_property({}, CUSTOM_MOCK_OPERATION_ID_HEADER, 'testOperation'))
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
callback = jest.fn();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './perf-metric.fetch';
|
|
@@ -193,7 +193,7 @@ function _ts_generator(thisArg, body) {
|
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
import { v4 } from
|
|
196
|
+
import { v4 } from 'uuid';
|
|
197
197
|
/**
|
|
198
198
|
* Performance metric plugin.
|
|
199
199
|
*/ export var PerformanceMetricPlugin = /*#__PURE__*/ function() {
|
|
@@ -215,7 +215,7 @@ import { v4 } from "uuid";
|
|
|
215
215
|
*/ _define_property(this, "getTime", Date.now);
|
|
216
216
|
this.onMarkComplete = options ? options.onMarkComplete : this.onMarkComplete;
|
|
217
217
|
this.onMarkError = options ? options.onMarkError : this.onMarkError;
|
|
218
|
-
if (typeof window !==
|
|
218
|
+
if (typeof window !== 'undefined' && !!window.performance && !!window.performance.now) {
|
|
219
219
|
this.getTime = function() {
|
|
220
220
|
return window.performance.now();
|
|
221
221
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { PerformanceMetricPlugin } from
|
|
1
|
+
import { PerformanceMetricPlugin } from './perf-metric.fetch';
|
|
2
2
|
var perfPlugin;
|
|
3
|
-
describe(
|
|
3
|
+
describe('PerformanceMetricPlugin', function() {
|
|
4
4
|
beforeEach(function() {
|
|
5
5
|
perfPlugin = new PerformanceMetricPlugin({});
|
|
6
6
|
});
|
|
7
|
-
it(
|
|
8
|
-
expect(perfPlugin.openMark(
|
|
7
|
+
it('should generate new mark ids', function() {
|
|
8
|
+
expect(perfPlugin.openMark('', {})).not.toEqual(perfPlugin.openMark('', {}));
|
|
9
9
|
});
|
|
10
|
-
it(
|
|
11
|
-
var markId = perfPlugin.openMark(
|
|
10
|
+
it('should include a new mark when closing', function() {
|
|
11
|
+
var markId = perfPlugin.openMark('my-url', {});
|
|
12
12
|
var ret = new Promise(function(resolve) {
|
|
13
13
|
perfPlugin.onMarkComplete = function(mark) {
|
|
14
14
|
expect(mark).toBeDefined();
|
|
15
15
|
expect(mark.markId).toBe(markId);
|
|
16
|
-
expect(mark.url).toBe(
|
|
16
|
+
expect(mark.url).toBe('my-url');
|
|
17
17
|
expect(mark.requestOptions).toEqual({});
|
|
18
18
|
expect(mark.startTime).toBeDefined();
|
|
19
19
|
expect(mark.response).toEqual({});
|
|
@@ -25,13 +25,13 @@ describe("PerformanceMetricPlugin", function() {
|
|
|
25
25
|
perfPlugin.closeMark(markId, {});
|
|
26
26
|
return ret;
|
|
27
27
|
});
|
|
28
|
-
it(
|
|
29
|
-
var markId = perfPlugin.openMark(
|
|
28
|
+
it('should include a new mark when closing with error', function() {
|
|
29
|
+
var markId = perfPlugin.openMark('my-url', {});
|
|
30
30
|
var ret = new Promise(function(resolve) {
|
|
31
31
|
perfPlugin.onMarkError = function(mark) {
|
|
32
32
|
expect(mark).toBeDefined();
|
|
33
33
|
expect(mark.markId).toBe(markId);
|
|
34
|
-
expect(mark.url).toBe(
|
|
34
|
+
expect(mark.url).toBe('my-url');
|
|
35
35
|
expect(mark.requestOptions).toEqual({});
|
|
36
36
|
expect(mark.startTime).toBeDefined();
|
|
37
37
|
expect(mark.response).not.toBeDefined();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './pii-tokenizer.request';
|
|
@@ -169,7 +169,7 @@ function _ts_generator(thisArg, body) {
|
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
import { createJweEncoder, createJwtEncoder } from
|
|
172
|
+
import { createJweEncoder, createJwtEncoder } from '../../utils/json-token';
|
|
173
173
|
/**
|
|
174
174
|
* Creates a JWT encoding function which transforms the provided token-value associations as a unsecured JWT format https://tools.ietf.org/html/rfc7519#section-6
|
|
175
175
|
* @param applicationId Identifier of the application
|
|
@@ -180,12 +180,12 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
|
|
|
180
180
|
var jwtPayload = function(values) {
|
|
181
181
|
var timestamp = Math.floor(Date.now() / 1000);
|
|
182
182
|
return {
|
|
183
|
-
sub:
|
|
183
|
+
sub: 'pii',
|
|
184
184
|
iat: timestamp,
|
|
185
185
|
exp: timestamp + expirationDelay,
|
|
186
186
|
iss: applicationId,
|
|
187
187
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
188
|
-
|
|
188
|
+
'ama-tokens': values
|
|
189
189
|
};
|
|
190
190
|
};
|
|
191
191
|
return function(values) {
|
|
@@ -207,12 +207,12 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
|
|
|
207
207
|
var jwePayload = function(values) {
|
|
208
208
|
var timestamp = Math.floor(Date.now() / 1000);
|
|
209
209
|
return {
|
|
210
|
-
sub:
|
|
210
|
+
sub: 'pii',
|
|
211
211
|
iat: timestamp,
|
|
212
212
|
exp: timestamp + expirationDelay,
|
|
213
213
|
iss: applicationId,
|
|
214
214
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
215
|
-
|
|
215
|
+
'ama-tokens': values
|
|
216
216
|
};
|
|
217
217
|
};
|
|
218
218
|
return function(values) {
|
|
@@ -285,13 +285,13 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
|
|
|
285
285
|
/** Name of the header that will contain the response to a deeplink token challenge, if any */ _define_property(this, "challengeHeader", void 0);
|
|
286
286
|
/** Token encoding function */ _define_property(this, "tokenEncoder", void 0);
|
|
287
287
|
/** Boolean to specify if an error should be silent or crash the application */ _define_property(this, "silent", void 0);
|
|
288
|
-
this.tokensHeader = options.headerName ||
|
|
289
|
-
this.challengeHeader = options.challengeHeaderName ||
|
|
288
|
+
this.tokensHeader = options.headerName || 'ama-client-facts';
|
|
289
|
+
this.challengeHeader = options.challengeHeaderName || 'ama-client-facts-challenge';
|
|
290
290
|
this.silent = options.silent || false;
|
|
291
291
|
if (options.key) {
|
|
292
292
|
this.tokenEncoder = createJwePiiEncoder(options.applicationId, options.expirationDelay, options.key, options.publicProperties || [
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
'iss',
|
|
294
|
+
'sub'
|
|
295
295
|
], options.useHeaderAsAdditionalAuthenticatedData);
|
|
296
296
|
} else {
|
|
297
297
|
this.tokenEncoder = createJwtPiiEncoder(options.applicationId, options.expirationDelay);
|
|
@@ -329,9 +329,9 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
|
|
|
329
329
|
case 2:
|
|
330
330
|
e = _state.sent();
|
|
331
331
|
if (_this.silent) {
|
|
332
|
-
(logger || console).error(
|
|
332
|
+
(logger || console).error('Couldn\'t encode the token');
|
|
333
333
|
} else {
|
|
334
|
-
throw new Error(
|
|
334
|
+
throw new Error('Couldn\'t encode the token');
|
|
335
335
|
}
|
|
336
336
|
return [
|
|
337
337
|
3,
|
|
@@ -375,7 +375,7 @@ import { createJweEncoder, createJwtEncoder } from "../../utils/json-token";
|
|
|
375
375
|
3,
|
|
376
376
|
2
|
|
377
377
|
];
|
|
378
|
-
((context === null || context === void 0 ? void 0 : context.logger) || console).error(
|
|
378
|
+
((context === null || context === void 0 ? void 0 : context.logger) || console).error('No tokenized options found. Please make sure tokenization is enabled on your ApiClient');
|
|
379
379
|
return [
|
|
380
380
|
3,
|
|
381
381
|
4
|