@amedia/user 0.14.141 → 0.14.143
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 +8 -3
- package/dist/user.d.ts +15 -13
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ NOTE2: ~If you need to know if the current user is an employee, you are encourag
|
|
|
76
76
|
|
|
77
77
|
#### Storage
|
|
78
78
|
|
|
79
|
-
Storage contains namespaces stored in Europa. A namespace is a named set of key value pairs stored for a specific user. An example could be favourite_teams, which could contain team_id as key and timestamp it was stored as favourite as value.
|
|
79
|
+
Storage contains namespaces stored in aID (Europa). A namespace is a named set of key value pairs stored for a specific user. An example could be favourite_teams, which could contain team_id as key and timestamp it was stored as favourite as value.
|
|
80
80
|
|
|
81
81
|
Storage is requested by calling `.withStorage(namespaces: Array<string>)` on a `UserDataRequest`. If a namespace does not exist it will be "created" in that you'll get an empty object back. Saving data to it will perform the actual creation.
|
|
82
82
|
|
|
@@ -282,6 +282,11 @@ If you need to ensure the latest data is available, you may request a data refre
|
|
|
282
282
|
|
|
283
283
|
This action will log the user out of aID. The logout is global, meaning it will log the session out of all sites and aid.no. After logout has completed the promise will resolve, giving your app the opportunity to reset state / reload the page etc.
|
|
284
284
|
|
|
285
|
+
### `pollForAccess(requredAccessFeatures = ['pluss'], timeout_millis = 3000): Promise<true>`
|
|
286
|
+
|
|
287
|
+
Polling for expected access. Will either return true when required access
|
|
288
|
+
features are attained, or TimeoutError.
|
|
289
|
+
|
|
285
290
|
### `aidUrls: Record<string, URL>`
|
|
286
291
|
|
|
287
292
|
Get various, environment aware, URLs to pages often linked to from other apps. This includes pages like the aID profile page, Terms of Service, Privacy Statement, Privacy Preferences, Family Sharing and the like.
|
|
@@ -289,7 +294,7 @@ Get various, environment aware, URLs to pages often linked to from other apps. T
|
|
|
289
294
|
### DEPRECATED: `~updateStorage(storage: Storage): void~`
|
|
290
295
|
|
|
291
296
|
[See: Writing-to-storage-namespaces](#writing-to-storage-namespaces)
|
|
292
|
-
The safest way to update a value is to use `updateStorage()`. This will send a `PATCH` to Europa to only update the specified attributes of a namespace, and keep the rest as it is. This reduces concurrency issues where someone could have updated a different attribute after you read the namespace.
|
|
297
|
+
The safest way to update a value is to use `updateStorage()`. This will send a `PATCH` to aID (Europa) to only update the specified attributes of a namespace, and keep the rest as it is. This reduces concurrency issues where someone could have updated a different attribute after you read the namespace.
|
|
293
298
|
|
|
294
299
|
Example of use:
|
|
295
300
|
|
|
@@ -304,7 +309,7 @@ updateStorage({
|
|
|
304
309
|
### DEPRECATED: `~saveStorage(storage: Storage): void~`
|
|
305
310
|
|
|
306
311
|
[See: Writing-to-storage-namespaces](#writing-to-storage-namespaces)
|
|
307
|
-
Will send a `PUT` to Europa to update the entire namespace/namespaces, deleting missing data in the process. Please be advised that you may be overwriting updates done by other apps to these namespaces, so it's best to save with a recent namespace if it sees heavy writes :)
|
|
312
|
+
Will send a `PUT` to aID (Europa) to update the entire namespace/namespaces, deleting missing data in the process. Please be advised that you may be overwriting updates done by other apps to these namespaces, so it's best to save with a recent namespace if it sees heavy writes :)
|
|
308
313
|
|
|
309
314
|
Example of use:
|
|
310
315
|
|
package/dist/user.d.ts
CHANGED
|
@@ -140,8 +140,20 @@ declare class ValidationError extends Error {
|
|
|
140
140
|
constructor(code: string, message: string);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
declare class TimeoutError extends Error {
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Poll for access on current site.
|
|
147
|
+
* Use this when you expect the reader to have gained access, but need to
|
|
148
|
+
* be sure before telling the reader that everything's good.
|
|
149
|
+
*
|
|
150
|
+
* @throws EmergencyModeError if in emergency mode
|
|
151
|
+
* @throws TimeoutError if access cannot be attained within given timeout
|
|
152
|
+
* @throws Error if unknown error
|
|
153
|
+
* @returns true
|
|
154
|
+
*/
|
|
155
|
+
declare function pollForAccess(requiredAccessFeatures?: string[], timeout_millis?: number): Promise<true>;
|
|
156
|
+
|
|
145
157
|
type LoginPageParams = {
|
|
146
158
|
requestedUrl?: string;
|
|
147
159
|
context?: string;
|
|
@@ -154,16 +166,6 @@ type LoginPageParams = {
|
|
|
154
166
|
declare const goToLoginPage: (requestedUrlOrParams?: string | LoginPageParams) => void;
|
|
155
167
|
declare const getLoginUrl: (requestedUrlOrParams?: string | LoginPageParams) => URL;
|
|
156
168
|
declare const logout: () => Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* @deprecated Use Namespace.save() instead
|
|
159
|
-
* No longer used by any active app. Can be removed
|
|
160
|
-
*/
|
|
161
|
-
declare const updateStorage: (storage: Storage) => void;
|
|
162
|
-
/**
|
|
163
|
-
* @deprecated Use Namespace.save() instead
|
|
164
|
-
* No longer used by any active app. Can be removed
|
|
165
|
-
*/
|
|
166
|
-
declare const saveStorage: (storage: Storage) => void;
|
|
167
169
|
declare const requestDataRefresh: () => void;
|
|
168
170
|
declare const aidUrls: {
|
|
169
171
|
mainPage: URL;
|
|
@@ -174,5 +176,5 @@ declare const aidUrls: {
|
|
|
174
176
|
sites: URL;
|
|
175
177
|
};
|
|
176
178
|
|
|
177
|
-
export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout,
|
|
179
|
+
export { EmergencyModeError, FetchTimeoutError, PaywallError, PaywallUnlockRequest, SiteAccessRequest, TimeoutError, UserDataRequest, ValidationError, aidUrls, getLoginUrl, goToLoginPage, logout, pollForAccess, requestDataRefresh };
|
|
178
180
|
export type { PaywallUnlockResponse, PrivacyPreferences, SiteAccessResponse, State, UserAttributes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.143",
|
|
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)",
|
|
@@ -46,20 +46,20 @@
|
|
|
46
46
|
"@amedia/browserid": "1.0.17",
|
|
47
47
|
"@amedia/frontend-rpc": "0.0.12",
|
|
48
48
|
"runtypes": "6.7.0",
|
|
49
|
-
"ts-deepmerge": "7.0.
|
|
49
|
+
"ts-deepmerge": "7.0.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@amedia/eslint-config": "4.0.4",
|
|
53
|
-
"@amedia/kragl": "5.0.
|
|
54
|
-
"@amedia/prettier-config": "2.0.
|
|
53
|
+
"@amedia/kragl": "5.0.6",
|
|
54
|
+
"@amedia/prettier-config": "2.0.1",
|
|
55
55
|
"@changesets/changelog-github": "0.5.1",
|
|
56
|
-
"@changesets/cli": "2.29.
|
|
56
|
+
"@changesets/cli": "2.29.4",
|
|
57
57
|
"@eik/esbuild-plugin": "1.1.54",
|
|
58
58
|
"@types/jest": "29.5.14",
|
|
59
|
-
"@types/node": "22.15.
|
|
59
|
+
"@types/node": "22.15.19",
|
|
60
60
|
"concurrently": "9.1.2",
|
|
61
61
|
"cors": "2.8.5",
|
|
62
|
-
"esbuild": "0.25.
|
|
62
|
+
"esbuild": "0.25.4",
|
|
63
63
|
"express": "4.21.2",
|
|
64
64
|
"jest": "29.7.0",
|
|
65
65
|
"jest-environment-jsdom": "29.7.0",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"jest-fetch-mock": "3.0.3",
|
|
68
68
|
"mockdate": "3.0.5",
|
|
69
69
|
"npm-run-all": "4.1.5",
|
|
70
|
-
"rollup": "4.
|
|
70
|
+
"rollup": "4.41.0",
|
|
71
71
|
"rollup-plugin-dts": "6.2.1",
|
|
72
|
-
"ts-jest": "29.3.
|
|
72
|
+
"ts-jest": "29.3.4",
|
|
73
73
|
"tslib": "2.8.1",
|
|
74
74
|
"typescript": "5.8.3"
|
|
75
75
|
}
|