@amedia/user 0.14.6 → 0.14.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amedia/user",
3
- "version": "0.14.6",
3
+ "version": "0.14.7",
4
4
  "description": "Client lib for working with aID user and associated data",
5
5
  "repository": "https://github.com/amedia/amedia-user-js",
6
6
  "author": "Amedia Utvikling (ID og data)",
@@ -20,6 +20,7 @@ export const login = (requestedUrl: URL | string) => {
20
20
 
21
21
  function clearCookies() {
22
22
  removeCookie('VSTOKEN');
23
+ removeCookie('VSTOKEN2');
23
24
  removeCookie('aid.session');
24
25
  removeCookie('aid_invitation_code');
25
26
  removeCookie('aid-reload-article');
@@ -2,7 +2,6 @@ import { Record, String } from 'runtypes';
2
2
  import * as MockDate from 'mockdate';
3
3
  import cache, { setCacheEngine } from '.';
4
4
  import { setLogger } from '../utils/log';
5
- import { version } from '../../eik.json';
6
5
 
7
6
  const TestDataSchema = Record({
8
7
  test: String,
@@ -79,7 +78,6 @@ describe('Cache', () => {
79
78
  },
80
79
  cacheData: { invalid: 'data' },
81
80
  origin: '@amedia/user',
82
- originVersion: version,
83
81
  }
84
82
  );
85
83
  });
@@ -4,7 +4,6 @@ import store from '../store';
4
4
  import { getCurrentSession, removeSession } from './pluto';
5
5
  import { Logger, setLogger } from '../utils/log';
6
6
  import { UserAttributes } from '../types';
7
- import { version } from '../../eik.json';
8
7
  import anything = jasmine.anything;
9
8
 
10
9
  beforeEach(async () => {
@@ -191,7 +190,6 @@ describe('Pluto client', () => {
191
190
  {
192
191
  error: { code: 'session.invalid_for_domain' },
193
192
  origin: '@amedia/user',
194
- originVersion: version,
195
193
  response: expect.any(Object),
196
194
  }
197
195
  );
@@ -201,12 +201,12 @@ describe('accessCookieRefresher', () => {
201
201
  );
202
202
  jest.spyOn(cookie, 'removeCookie').mockImplementation();
203
203
  });
204
- it('Should remove user access cookie', async () => {
204
+ it('Should remove user access cookie, but not VSTOKEN2 (keep for Nasjonal avisuke)', async () => {
205
205
  expect(await accessCookieRefresher()).toEqual([undefined, undefined]);
206
206
  expect(authorization.setUserAccessCookie).toHaveBeenCalledTimes(0);
207
207
  expect(authorization.setNonUserAccessCookie).toHaveBeenCalledTimes(0);
208
+ expect(cookie.removeCookie).toHaveBeenCalledTimes(1);
208
209
  expect(cookie.removeCookie).toHaveBeenNthCalledWith(1, 'VSTOKEN');
209
- expect(cookie.removeCookie).toHaveBeenNthCalledWith(2, 'VSTOKEN2');
210
210
  });
211
211
  });
212
212
  });
@@ -83,8 +83,6 @@ function verifyAndSetNonUserAccessCookie() {
83
83
  return;
84
84
  }
85
85
  await setNonUserAccessCookie(publicationDomain);
86
- } else {
87
- removeCookie(cookieName);
88
86
  }
89
87
  })
90
88
  .then(() => {});
@@ -1,5 +1,4 @@
1
1
  import log, { Logger, setLogger } from './log';
2
- import { version } from '../../eik.json';
3
2
 
4
3
  describe('Log', () => {
5
4
  let logger: Logger;
@@ -24,7 +23,6 @@ describe('Log', () => {
24
23
  expect(logger[level]).toHaveBeenCalledWith(expect.anything(), {
25
24
  ...context,
26
25
  origin: '@amedia/user',
27
- originVersion: version,
28
26
  });
29
27
  });
30
28
  }
package/src/utils/log.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import mercury from '../clients/mercuryLog';
2
- // @ts-ignore
3
- import { version } from '../../eik.json';
4
2
 
5
3
  export type Logger = {
6
4
  debug: (message: string | Error, context?: any) => void;
@@ -64,7 +62,6 @@ const processIncomingLogData = async (
64
62
  typeof message === 'string' ? message : message.message;
65
63
  const internalContext: Record<string, unknown> = {
66
64
  origin: '@amedia/user',
67
- originVersion: version,
68
65
  };
69
66
  if (message instanceof Error) {
70
67
  internalContext.error = rewriteErrorObject(message);