pryv 3.6.0 → 3.7.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/README.md +9 -1
- package/package.json +1 -1
- package/src/Browser/LoginButton.js +5 -0
- package/src/Service.js +5 -4
- package/src/index.d.ts +0 -14
- package/src/lib/getEventStreamed.js +1 -0
- package/test/LoginButton.urlCleanup.test.js +44 -0
package/README.md
CHANGED
|
@@ -733,7 +733,15 @@ Assuming browser files are built and everything is up-to-date, including the REA
|
|
|
733
733
|
```
|
|
734
734
|
just version <version>
|
|
735
735
|
```
|
|
736
|
-
to update the version number of the lib and add-ons in lockstep
|
|
736
|
+
to update the version number of the lib and add-ons in lockstep. This only edits the `package.json` files — **commit and tag manually**:
|
|
737
|
+
|
|
738
|
+
```
|
|
739
|
+
git commit -am "<version>"
|
|
740
|
+
git tag -a <version> -m "<version>"
|
|
741
|
+
git push && git push --tags
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
Tags are bare version numbers (e.g. `3.6.0`, no `v` prefix); every npm publish must have a matching pushed tag so npm, `package.json` and GitHub stay cross-checkable.
|
|
737
745
|
|
|
738
746
|
```
|
|
739
747
|
just publish-npm
|
package/package.json
CHANGED
|
@@ -126,6 +126,11 @@ class LoginButton {
|
|
|
126
126
|
error: e
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
+
// The prYv* params are one-shot; leaving them in the visible URL
|
|
130
|
+
// puts stale auth state into bookmarks / copied links.
|
|
131
|
+
if (window.history && typeof window.history.replaceState === 'function') {
|
|
132
|
+
window.history.replaceState(null, '', utils.cleanURLFromPrYvParams(url));
|
|
133
|
+
}
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
function retrievePollUrl (url) {
|
package/src/Service.js
CHANGED
|
@@ -406,9 +406,9 @@ class Service {
|
|
|
406
406
|
email: opts.email,
|
|
407
407
|
hosting,
|
|
408
408
|
language,
|
|
409
|
-
invitationToken
|
|
409
|
+
invitationToken,
|
|
410
|
+
...(opts.referer != null && { referer: opts.referer })
|
|
410
411
|
};
|
|
411
|
-
if (opts.referer != null) payload.referer = opts.referer;
|
|
412
412
|
} else {
|
|
413
413
|
url = serviceInfo.register + 'user';
|
|
414
414
|
payload = {
|
|
@@ -418,9 +418,9 @@ class Service {
|
|
|
418
418
|
email: opts.email,
|
|
419
419
|
hosting,
|
|
420
420
|
languageCode: language,
|
|
421
|
-
invitationtoken: invitationToken
|
|
421
|
+
invitationtoken: invitationToken,
|
|
422
|
+
...(opts.referer != null && { referer: opts.referer })
|
|
422
423
|
};
|
|
423
|
-
if (opts.referer != null) payload.referer = opts.referer;
|
|
424
424
|
}
|
|
425
425
|
const { response, body } = await utils.fetchPost(url, payload);
|
|
426
426
|
if (!response.ok) throw PryvError.fromApiResponse(response, body);
|
|
@@ -629,6 +629,7 @@ const Connection = require('./Connection');
|
|
|
629
629
|
* @property {string} support The email or URL of the support page.
|
|
630
630
|
* @property {string} terms The terms and conditions, in plain text or the URL displaying them.
|
|
631
631
|
* @property {string} eventTypes The URL of the list of validated event types.
|
|
632
|
+
* @property {string} [version] The platform version.
|
|
632
633
|
* @property {Object} [assets] Holder for service specific Assets (icons, css, ...)
|
|
633
634
|
* @property {string} [assets.definitions] URL to json object with assets definitions
|
|
634
635
|
* @property {Object} [features] Platform feature flags
|
package/src/index.d.ts
CHANGED
|
@@ -100,20 +100,6 @@ declare module 'pryv' {
|
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
// HTTP only
|
|
104
|
-
type AuditLog = {
|
|
105
|
-
id: Identifier;
|
|
106
|
-
type: string;
|
|
107
|
-
time: Timestamp;
|
|
108
|
-
forwardedFor: string;
|
|
109
|
-
action: string;
|
|
110
|
-
query: string;
|
|
111
|
-
accessId: string;
|
|
112
|
-
status: number;
|
|
113
|
-
errorMessage?: string;
|
|
114
|
-
errorId?: string;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
103
|
export type HFSeries = {
|
|
118
104
|
format: 'flatJSON';
|
|
119
105
|
fields: string[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* [BSD-3-Clause](https://github.com/pryv/lib-js/blob/master/LICENSE)
|
|
4
|
+
*/
|
|
5
|
+
/* global describe, it, before, after, expect, JSDOM */
|
|
6
|
+
|
|
7
|
+
const LoginButton = require('../src/Browser/LoginButton');
|
|
8
|
+
const utils = require('../src/utils');
|
|
9
|
+
|
|
10
|
+
describe('[LBRU] LoginButton URL cleanup after redirect', function () {
|
|
11
|
+
const PAGE_URL = 'http://localhost/app?x=1&prYvpoll=http%3A%2F%2Flocalhost%2Fpoll%2Fkey123&prYvstatus=ACCEPTED';
|
|
12
|
+
let dom;
|
|
13
|
+
let cleanupDom = false;
|
|
14
|
+
let originalFetchGet;
|
|
15
|
+
|
|
16
|
+
before(() => {
|
|
17
|
+
if (typeof document === 'undefined') {
|
|
18
|
+
cleanupDom = true;
|
|
19
|
+
dom = new JSDOM('<!DOCTYPE html><body></body>', { url: PAGE_URL });
|
|
20
|
+
global.document = dom.window.document;
|
|
21
|
+
global.window = dom.window;
|
|
22
|
+
global.location = dom.window.location;
|
|
23
|
+
global.navigator = { userAgent: 'Safari' };
|
|
24
|
+
}
|
|
25
|
+
originalFetchGet = utils.fetchGet;
|
|
26
|
+
utils.fetchGet = async () => ({ body: { status: 'ACCEPTED' } });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
after(() => {
|
|
30
|
+
utils.fetchGet = originalFetchGet;
|
|
31
|
+
if (!cleanupDom) return;
|
|
32
|
+
delete global.document;
|
|
33
|
+
delete global.window;
|
|
34
|
+
delete global.location;
|
|
35
|
+
delete global.navigator;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('[LBR1] strips consumed prYv* params from the visible URL', async () => {
|
|
39
|
+
const authController = { serviceInfo: {} };
|
|
40
|
+
await LoginButton.prototype.finishAuthProcessAfterRedirection.call({}, authController);
|
|
41
|
+
expect(authController.state).to.eql({ status: 'ACCEPTED' });
|
|
42
|
+
expect(global.window.location.href).to.equal('http://localhost/app?x=1');
|
|
43
|
+
});
|
|
44
|
+
});
|