pryv 2.3.9 → 2.4.1
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 +6 -6
- package/src/index.d.ts +20 -20
- package/test/Connection.test.js +11 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pryv",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Pryv JavaScript library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Pryv",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git://github.com/pryv/lib-js"
|
|
16
16
|
},
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"superagent": "^8.0.6"
|
|
19
|
-
},
|
|
20
17
|
"license": "BSD-3-Clause",
|
|
21
18
|
"author": "Pryv S.A. <info@pryv.com> (https://pryv.com)",
|
|
22
19
|
"main": "src/index.js",
|
|
23
|
-
"types": "src/index.d.ts"
|
|
24
|
-
|
|
20
|
+
"types": "src/index.d.ts",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"superagent": "^9.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
declare module 'pryv' {
|
|
2
2
|
type Timestamp = number;
|
|
3
3
|
type Identifier = string;
|
|
4
|
-
type Level = 'read' | 'contribute' | 'manage' | 'create-only';
|
|
5
|
-
type KeyValue = { [key: string]: string | number };
|
|
4
|
+
export type Level = 'read' | 'contribute' | 'manage' | 'create-only';
|
|
5
|
+
export type KeyValue = { [key: string]: string | number };
|
|
6
6
|
|
|
7
|
-
type Attachment = {
|
|
7
|
+
export type Attachment = {
|
|
8
8
|
id: Identifier;
|
|
9
9
|
fileName: string;
|
|
10
10
|
type: string;
|
|
@@ -12,7 +12,7 @@ declare module 'pryv' {
|
|
|
12
12
|
readToken: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
type Stream = {
|
|
15
|
+
export type Stream = {
|
|
16
16
|
id: Identifier;
|
|
17
17
|
name: string;
|
|
18
18
|
parentId?: Identifier;
|
|
@@ -25,7 +25,7 @@ declare module 'pryv' {
|
|
|
25
25
|
modifiedBy: Identifier;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
type Event = {
|
|
28
|
+
export type Event = {
|
|
29
29
|
id: Identifier;
|
|
30
30
|
streamIds: Identifier[];
|
|
31
31
|
streamId: Identifier;
|
|
@@ -44,14 +44,14 @@ declare module 'pryv' {
|
|
|
44
44
|
modifiedBy: Identifier;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
type Permission = {
|
|
47
|
+
export type Permission = {
|
|
48
48
|
streamId: Identifier;
|
|
49
49
|
level: Level;
|
|
50
50
|
feature?: 'selfRevoke';
|
|
51
51
|
setting?: 'forbidden';
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
type Access = {
|
|
54
|
+
export type Access = {
|
|
55
55
|
id: Identifier;
|
|
56
56
|
token: string;
|
|
57
57
|
type?: 'personal' | 'app' | 'shared';
|
|
@@ -77,7 +77,7 @@ declare module 'pryv' {
|
|
|
77
77
|
accessToken: string;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
type AccountInformation = {
|
|
80
|
+
export type AccountInformation = {
|
|
81
81
|
username: string;
|
|
82
82
|
email: string;
|
|
83
83
|
language: string;
|
|
@@ -101,7 +101,7 @@ declare module 'pryv' {
|
|
|
101
101
|
errorId?: string;
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
type HFSeries = {
|
|
104
|
+
export type HFSeries = {
|
|
105
105
|
format: 'flatJSON';
|
|
106
106
|
fields: string[];
|
|
107
107
|
points: Array<number | string>;
|
|
@@ -112,7 +112,7 @@ declare module 'pryv' {
|
|
|
112
112
|
timestamp: Timestamp;
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
type WebHook = {
|
|
115
|
+
export type WebHook = {
|
|
116
116
|
id: Identifier;
|
|
117
117
|
accessId: Identifier;
|
|
118
118
|
url: string;
|
|
@@ -130,25 +130,25 @@ declare module 'pryv' {
|
|
|
130
130
|
modifiedBy: Identifier;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
type ItemDeletion = {
|
|
133
|
+
export type ItemDeletion = {
|
|
134
134
|
id: Identifier;
|
|
135
135
|
deleted?: Timestamp;
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
-
type Error = {
|
|
138
|
+
export type Error = {
|
|
139
139
|
id: string;
|
|
140
140
|
message: string;
|
|
141
141
|
data?: any;
|
|
142
142
|
subErrors?: Error[];
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
type StreamsQuery = {
|
|
145
|
+
export type StreamsQuery = {
|
|
146
146
|
any?: Identifier[];
|
|
147
147
|
all?: Identifier[];
|
|
148
148
|
not?: Identifier[];
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
-
type EventQueryParams = {
|
|
151
|
+
export type EventQueryParams = {
|
|
152
152
|
fromTime: Timestamp;
|
|
153
153
|
toTime: Timestamp;
|
|
154
154
|
streams: string[];
|
|
@@ -163,11 +163,11 @@ declare module 'pryv' {
|
|
|
163
163
|
includeDeletion: boolean;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
type EventQueryParamsStreamQuery = Omit<EventQueryParams, 'streams'> & {
|
|
166
|
+
export type EventQueryParamsStreamQuery = Omit<EventQueryParams, 'streams'> & {
|
|
167
167
|
streams: string[] | StreamsQuery;
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
type EditMetadata = 'created' | 'createdBy' | 'modified' | 'modifiedBy';
|
|
170
|
+
export type EditMetadata = 'created' | 'createdBy' | 'modified' | 'modifiedBy';
|
|
171
171
|
|
|
172
172
|
export type APICallMethods = {
|
|
173
173
|
// mfa
|
|
@@ -534,7 +534,7 @@ declare module 'pryv' {
|
|
|
534
534
|
) => Promise<any>;
|
|
535
535
|
export type StreamedEventsHandler = (event: Event) => void;
|
|
536
536
|
|
|
537
|
-
type StreamedEventsResult = {
|
|
537
|
+
export type StreamedEventsResult = {
|
|
538
538
|
eventsCount?: number;
|
|
539
539
|
eventsDeletionsCount?: number;
|
|
540
540
|
meta: {
|
|
@@ -560,12 +560,12 @@ declare module 'pryv' {
|
|
|
560
560
|
|
|
561
561
|
export type APICallProgressHandler = (percentage: number) => void;
|
|
562
562
|
|
|
563
|
-
interface AccessInfo extends Access {
|
|
563
|
+
export interface AccessInfo extends Access {
|
|
564
564
|
calls: KeyValue;
|
|
565
565
|
user: KeyValue;
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
-
type EventAPICallRes = {
|
|
568
|
+
export type EventAPICallRes = {
|
|
569
569
|
event?: Event;
|
|
570
570
|
} & PossibleError;
|
|
571
571
|
|
|
@@ -681,7 +681,7 @@ declare module 'pryv' {
|
|
|
681
681
|
| 'ACCEPTED'
|
|
682
682
|
| 'SIGNOUT';
|
|
683
683
|
|
|
684
|
-
type StateChangeTypes = {
|
|
684
|
+
export type StateChangeTypes = {
|
|
685
685
|
LOADING: {};
|
|
686
686
|
INITIALIZED: {
|
|
687
687
|
serviceInfo: ServiceInfo;
|
package/test/Connection.test.js
CHANGED
|
@@ -369,6 +369,11 @@ describe('Connection', () => {
|
|
|
369
369
|
|
|
370
370
|
if (typeof window === 'undefined') {
|
|
371
371
|
describe('Browser mock', function () {
|
|
372
|
+
const isNotAvailable = {
|
|
373
|
+
URL: global.URL == null,
|
|
374
|
+
URLSearchParams: global.URLSearchParams == null,
|
|
375
|
+
fetch: global.fetch == null
|
|
376
|
+
};
|
|
372
377
|
beforeEach(function () {
|
|
373
378
|
const browser = new Browser();
|
|
374
379
|
browser.visit('./');
|
|
@@ -378,18 +383,18 @@ describe('Connection', () => {
|
|
|
378
383
|
function fetch (...args) {
|
|
379
384
|
return browser.fetch(...args);
|
|
380
385
|
}
|
|
381
|
-
global.fetch = fetch;
|
|
382
|
-
global.URL = URL;
|
|
383
|
-
global.URLSearchParams = URLSearchParams;
|
|
386
|
+
if (isNotAvailable.fetch) global.fetch = fetch;
|
|
387
|
+
if (isNotAvailable.URL) global.URL = URL;
|
|
388
|
+
if (isNotAvailable.URLSearchParams) global.URLSearchParams = URLSearchParams;
|
|
384
389
|
});
|
|
385
390
|
|
|
386
391
|
afterEach(function () {
|
|
387
392
|
delete global.document;
|
|
388
393
|
delete global.window;
|
|
389
394
|
delete global.location;
|
|
390
|
-
delete global.fetch;
|
|
391
|
-
delete global.URL;
|
|
392
|
-
delete global.URLSearchParams;
|
|
395
|
+
if (isNotAvailable.fetch) delete global.fetch;
|
|
396
|
+
if (isNotAvailable.URL) delete global.URL;
|
|
397
|
+
if (isNotAvailable.URLSearchParams) delete global.URLSearchParams;
|
|
393
398
|
});
|
|
394
399
|
|
|
395
400
|
it(' without fetch', async () => {
|