@maroonedsoftware/scim 0.2.23 → 0.3.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.
@@ -0,0 +1,38 @@
1
+ import { ScimSchema } from '../schemas/schema.types.js';
2
+ /**
3
+ * Requested attribute projection for a SCIM response, from the `attributes` and
4
+ * `excludedAttributes` query parameters (RFC 7644 §3.9). The two are mutually
5
+ * exclusive; when a client sends both, `attributes` wins, being the more
6
+ * restrictive of the pair.
7
+ */
8
+ export interface ScimProjection {
9
+ /** Attribute paths to return, in addition to those whose `returned` is `'always'`. */
10
+ attributes?: string[];
11
+ /** Attribute paths to omit. Attributes whose `returned` is `'always'` are never omitted. */
12
+ excludedAttributes?: string[];
13
+ }
14
+ /**
15
+ * Project a SCIM resource for the wire.
16
+ *
17
+ * Two things happen here, and only the first is optional:
18
+ *
19
+ * 1. `attributes` / `excludedAttributes` are applied, per RFC 7644 §3.9.
20
+ * 2. Attributes the schema declares `returned: 'never'` are stripped
21
+ * unconditionally. `password` is the one that matters: it is `writeOnly` and
22
+ * `never`, so a repository that round-trips whatever it stored must not be
23
+ * able to hand it back to a provisioning client.
24
+ *
25
+ * Attributes declared `returned: 'request'` come back only when named in
26
+ * `attributes`. Keys no schema defines — a repository's own bookkeeping field,
27
+ * an extension the caller did not declare — are kept unless a projection
28
+ * excludes them, since the package cannot know they are safe to drop.
29
+ *
30
+ * @param resource - The resource to project. Not mutated.
31
+ * @param schemas - The resource's schemas: the core one first, then any
32
+ * extensions. An extension's attributes are matched under the resource key
33
+ * named by its schema `id`.
34
+ * @param projection - The requested projection; omit for schema rules only.
35
+ * @returns A new resource object with the projection applied.
36
+ */
37
+ export declare const projectScimResource: <T extends Record<string, unknown>>(resource: T, schemas: ScimSchema[], projection?: ScimProjection) => T;
38
+ //# sourceMappingURL=attribute.projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute.projection.d.ts","sourceRoot":"","sources":["../../src/projection/attribute.projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,4FAA4F;IAC5F,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAmED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnE,UAAU,CAAC,EACX,SAAS,UAAU,EAAE,EACrB,aAAY,cAAmB,KAC9B,CASF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './attribute.projection.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projection/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -22,6 +22,15 @@ export interface CreateScimRouterOptions {
22
22
  * `serviceProviderService` `filter.maxResults` value, falling back to 200.
23
23
  */
24
24
  maxResults?: number;
25
+ /**
26
+ * Absolute base URL this router is reachable at, e.g.
27
+ * `https://api.example.com/scim/v2`. When set, `meta.location` and the
28
+ * `Location` response header are rendered against it, as RFC 7643 §3.1 wants
29
+ * a resource URI. Leave it unset to keep the previous behaviour of emitting a
30
+ * root-relative path (`/Users/{id}`), which is wrong for any deployment that
31
+ * mounts the router under a prefix.
32
+ */
33
+ baseUrl?: string;
25
34
  }
26
35
  /**
27
36
  * Build a SCIM 2.0 server router. Mount it inside a Koa app that already has
@@ -1 +1 @@
1
- {"version":3,"file":"scim.router.d.ts","sourceRoot":"","sources":["../../src/router/scim.router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,KAAK,MAAM,MAAM,aAAa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,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,uBAAuB,KAAG,MAAM,CAAC,OAAO,EAAE,gBAAgB,CA6InG,CAAC"}
@@ -25,7 +25,8 @@ export declare class ScimGroupService {
25
25
  list(query: ScimListQuery): Promise<ScimListResult<ScimGroup>>;
26
26
  /**
27
27
  * Create a new group. Assigns a server-generated `id` and fills `meta`
28
- * timestamps.
28
+ * timestamps. An `id` on the payload is ignored: RFC 7643 §3.1 makes it
29
+ * readOnly and server-assigned.
29
30
  *
30
31
  * @throws {ScimError} 400 `invalidValue` when `displayName` is missing.
31
32
  * @throws {ScimError} 409 `uniqueness` when `displayName` already exists.
@@ -1 +1 @@
1
- {"version":3,"file":"scim.group.service.d.ts","sourceRoot":"","sources":["../../src/services/scim.group.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAKxD;;;;GAIG;AACH,qBACa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,UAAU,EAAE,mBAAmB,EAC/B,MAAM,EAAE,MAAM;IAGjC;;;;OAIG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAMzC;;;OAGG;IACG,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAA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AO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IA4B7D;;;;;;;OAOG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IA2B1E;;;;;;OAMG;IACG,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAY/D;;;;OAIG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,OAAO,CAAC,gBAAgB;CAKzB"}
@@ -28,6 +28,9 @@ export declare class ScimUserService {
28
28
  * and `meta.lastModified`, and ensures the resource's `schemas` includes the
29
29
  * core User URN (and the EnterpriseUser URN when the extension is present).
30
30
  *
31
+ * An `id` on the payload is ignored: RFC 7643 §3.1 makes it readOnly and
32
+ * server-assigned.
33
+ *
31
34
  * @throws {ScimError} 400 `invalidValue` when `userName` is missing.
32
35
  * @throws {ScimError} 409 `uniqueness` when `userName` already exists.
33
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"scim.user.service.d.ts","sourceRoot":"","sources":["../../src/services/scim.user.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;;;GAIG;AACH,qBACa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,UAAU,EAAE,kBAAkB,EAC9B,MAAM,EAAE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EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMxC;;;OAGG;IACG,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAInE;;;;;;;;;;OAUG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IA4B3D;;;;;;;;OAQG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC;IA2BxE;;;;;;;;;;OAUG;IACG,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC;IAqB9D;;;;OAIG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,OAAO,CAAC,gBAAgB;CAQzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maroonedsoftware/scim",
3
- "version": "0.2.23",
3
+ "version": "0.3.0",
4
4
  "description": "SCIM 2.0 (RFC 7643/7644) server toolkit for ServerKit — schemas, filter parser, PATCH applier, error envelope, and a Koa router with abstract repositories.",
5
5
  "author": {
6
6
  "name": "Marooned Software",
@@ -36,11 +36,11 @@
36
36
  "dependencies": {
37
37
  "injectkit": "^1.7.1",
38
38
  "luxon": "^3.7.2",
39
- "@maroonedsoftware/authentication": "4.31.0",
39
+ "@maroonedsoftware/authentication": "4.33.0",
40
+ "@maroonedsoftware/koa": "3.2.5",
40
41
  "@maroonedsoftware/errors": "1.9.1",
41
- "@maroonedsoftware/koa": "3.2.3",
42
- "@maroonedsoftware/logger": "1.1.9",
43
- "@maroonedsoftware/utilities": "1.11.5"
42
+ "@maroonedsoftware/utilities": "1.11.5",
43
+ "@maroonedsoftware/logger": "1.1.9"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@koa/router": "^15.2.0",