@amedia/user 0.14.118 → 0.14.120
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 +0 -4
- package/dist/user.d.ts +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -146,10 +146,6 @@ Once you have created a request and specified the data you need, the final step
|
|
|
146
146
|
|
|
147
147
|
The response to the request will be an object with attributes for state, attributes and storage. In the examples below these are unpacked for easier access.
|
|
148
148
|
|
|
149
|
-
_Short note about caching_
|
|
150
|
-
To answer as fast as possible, we try to save cache to sessionStorage in the browser, then, on the next page load we have data available for instant delivery, but it's possible that it's outdated. To account for staleness we perform fetches in the background if we haven't fetched data this page load.
|
|
151
|
-
However, this means you may get stale data. If the validity of the data is paramount, you should consider using subscribe instead of fetch.
|
|
152
|
-
|
|
153
149
|
#### Subscribing to updates
|
|
154
150
|
|
|
155
151
|
The most flexible way to get userdata is by subscribing to updates. This is done by calling `.subscribe()` on the `UserDataRequest` with a callback function that can handle the updates once they arrive. This is especially useful when the time it can take to get the data can vary. Getting the user's name is very fast, so you can display the user's name before you have received storage for example.
|
package/dist/user.d.ts
CHANGED
|
@@ -37,14 +37,14 @@ declare class UserDataRequest<TUserAttributes extends UserAttributes, TStorage e
|
|
|
37
37
|
private requestedAttributes?;
|
|
38
38
|
private requestedStorage?;
|
|
39
39
|
private requestedNonUserAccess;
|
|
40
|
+
private context;
|
|
40
41
|
static FETCH_TIMEOUT: Millis;
|
|
41
42
|
private static WITH_NON_USER_ACCESS;
|
|
42
43
|
private fetchTimeoutId;
|
|
43
44
|
private lastReceivedData?;
|
|
44
45
|
private subscriptionEventListeners;
|
|
45
46
|
private resolveNonUserAccess;
|
|
46
|
-
|
|
47
|
-
constructor(requestedAttributes?: TAttributes, requestedStorage?: TRequestedStorage, requestedNonUserAccess?: boolean);
|
|
47
|
+
constructor(requestedAttributes?: TAttributes, requestedStorage?: TRequestedStorage, requestedNonUserAccess?: boolean, context?: string);
|
|
48
48
|
withContext(context: string): this;
|
|
49
49
|
withAttributes<NewAttributes extends Array<keyof TUserAttributes>>(attributes: NewAttributes): UserDataRequest<TUserAttributes, TStorage, (TAttributes[number] & NewAttributes[number])[], TRequestedStorage, TSubscribeResponse & {
|
|
50
50
|
attributes: Pick<TUserAttributes, TAttributes[number] & NewAttributes[number]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amedia/user",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.120",
|
|
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)",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"@changesets/cli": "^2.27.1",
|
|
56
56
|
"@eik/esbuild-plugin": "^1.1.47",
|
|
57
57
|
"@types/jest": "^29.5.12",
|
|
58
|
-
"@types/node": "^20.12.
|
|
58
|
+
"@types/node": "^20.12.10",
|
|
59
59
|
"concurrently": "^8.2.2",
|
|
60
60
|
"cors": "^2.8.5",
|
|
61
|
-
"esbuild": "0.
|
|
61
|
+
"esbuild": "0.21.0",
|
|
62
62
|
"express": "^4.19.2",
|
|
63
63
|
"jest": "^29.7.0",
|
|
64
64
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"jest-fetch-mock": "^3.0.3",
|
|
67
67
|
"mockdate": "^3.0.5",
|
|
68
68
|
"npm-run-all": "^4.1.5",
|
|
69
|
-
"rollup": "4.
|
|
69
|
+
"rollup": "4.17.2",
|
|
70
70
|
"rollup-plugin-dts": "6.1.0",
|
|
71
71
|
"ts-jest": "^29.1.2",
|
|
72
72
|
"tslib": "^2.6.2",
|
|
73
|
-
"typescript": "^5.4.
|
|
73
|
+
"typescript": "^5.4.5"
|
|
74
74
|
}
|
|
75
75
|
}
|