@lpshanley/scim-core 0.1.0 → 0.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/dist/scim.d.ts +1 -1
- package/dist/scim.js +11 -1
- package/package.json +1 -1
package/dist/scim.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type ScimOptions<TConnection, TUser extends ScimUser, TTransaction> = Sci
|
|
|
32
32
|
* 400 mutability, except that a deactivation still goes through.
|
|
33
33
|
*/
|
|
34
34
|
externalId?: "mutable" | "fixed";
|
|
35
|
-
/** A refused request can leave a leaver with access, so report these.
|
|
35
|
+
/** A refused request can leave a leaver with access, so report these. A throw or rejection here is ignored. */
|
|
36
36
|
onProblem?(problem: ScimProblem): void;
|
|
37
37
|
};
|
|
38
38
|
/** SCIM 2.0 (RFC 7644) Users and Groups for an identity provider. */
|
package/dist/scim.js
CHANGED
|
@@ -58,7 +58,17 @@ function discovery(items, id) {
|
|
|
58
58
|
/** SCIM 2.0 (RFC 7644) Users and Groups for an identity provider. */
|
|
59
59
|
export function createScim(options) {
|
|
60
60
|
const basePath = (options.basePath ?? "/scim/v2").replace(/\/+$/, "");
|
|
61
|
-
|
|
61
|
+
// A monitoring callback must never turn a protocol answer, or a committed
|
|
62
|
+
// write, into an error. Sync throws and async rejections are both dropped.
|
|
63
|
+
const report = (problem) => {
|
|
64
|
+
try {
|
|
65
|
+
// Promise.resolve adopts any thenable, from this realm or another.
|
|
66
|
+
void Promise.resolve(options.onProblem?.(problem)).catch(() => { });
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// Nothing safe to do: the reporter is the only channel for this.
|
|
70
|
+
}
|
|
71
|
+
};
|
|
62
72
|
const forConnection = (connection, method = "direct") => createOperations({
|
|
63
73
|
...options,
|
|
64
74
|
afterCommitFailed: (error) => report({ kind: "after-commit", method, error }),
|