@spotto/contract 1.0.70-alpha.14 → 1.0.70-alpha.16

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.
Files changed (58) hide show
  1. package/README.md +33 -33
  2. package/dist/actions/[id]/patch/request.d.ts +4 -0
  3. package/dist/actions/get/response.d.ts +4 -0
  4. package/dist/assets/download/query.d.ts +7 -0
  5. package/dist/fields/[id]/get.d.ts +3 -0
  6. package/dist/fields/[id]/patch/request.d.ts +4 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/organisations/constants.d.ts +11 -0
  11. package/dist/organisations/sso/constants.d.ts +15 -0
  12. package/dist/organisations/sso/constants.js +16 -1
  13. package/dist/organisations/sso/constants.js.map +1 -1
  14. package/dist/organisations/sso/types.d.ts +48 -0
  15. package/dist/sso/onboard/request.d.ts +12 -1
  16. package/dist/sso/sso-mappings/request.d.ts +10 -5
  17. package/dist/usergroups/[id]/index.d.ts +1 -0
  18. package/dist/usergroups/[id]/index.js +18 -0
  19. package/dist/usergroups/[id]/index.js.map +1 -0
  20. package/dist/usergroups/[id]/patch/index.d.ts +2 -0
  21. package/dist/usergroups/[id]/patch/index.js +19 -0
  22. package/dist/usergroups/[id]/patch/index.js.map +1 -0
  23. package/dist/usergroups/[id]/patch/request.d.ts +12 -0
  24. package/dist/usergroups/[id]/patch/request.js +3 -0
  25. package/dist/usergroups/[id]/patch/request.js.map +1 -0
  26. package/dist/usergroups/[id]/patch/response.d.ts +1 -0
  27. package/dist/usergroups/[id]/patch/response.js +3 -0
  28. package/dist/usergroups/[id]/patch/response.js.map +1 -0
  29. package/dist/usergroups/get/index.d.ts +2 -0
  30. package/dist/usergroups/get/index.js +19 -0
  31. package/dist/usergroups/get/index.js.map +1 -0
  32. package/dist/usergroups/get/query.d.ts +12 -0
  33. package/dist/usergroups/get/query.js +3 -0
  34. package/dist/usergroups/get/query.js.map +1 -0
  35. package/dist/usergroups/get/response.d.ts +35 -0
  36. package/dist/usergroups/get/response.js +3 -0
  37. package/dist/usergroups/get/response.js.map +1 -0
  38. package/dist/usergroups/index.d.ts +4 -0
  39. package/dist/usergroups/index.js +21 -0
  40. package/dist/usergroups/index.js.map +1 -0
  41. package/dist/usergroups/post/index.d.ts +2 -0
  42. package/dist/usergroups/post/index.js +19 -0
  43. package/dist/usergroups/post/index.js.map +1 -0
  44. package/dist/usergroups/post/request.d.ts +11 -0
  45. package/dist/usergroups/post/request.js +3 -0
  46. package/dist/usergroups/post/request.js.map +1 -0
  47. package/dist/usergroups/post/response.d.ts +1 -0
  48. package/dist/usergroups/post/response.js +3 -0
  49. package/dist/usergroups/post/response.js.map +1 -0
  50. package/dist/usergroups/shared.d.ts +25 -0
  51. package/dist/usergroups/shared.js +11 -0
  52. package/dist/usergroups/shared.js.map +1 -0
  53. package/dist/users/[id]/get/response.d.ts +0 -2
  54. package/dist/users/[id]/patch/request.d.ts +5 -1
  55. package/dist/users/current.d.ts +22 -4
  56. package/dist/users/get/query.d.ts +0 -2
  57. package/dist/users/post/request.d.ts +6 -1
  58. package/package.json +2 -2
package/README.md CHANGED
@@ -1,33 +1,33 @@
1
- # README
2
-
3
- This repository is a source of truth / documentation for the spotto-api.
4
-
5
- The repository consists of a series of typescript classes that document the API contract
6
- between the spotto API and its clients
7
-
8
- ### How do I get set up?
9
-
10
- 1. Clone this repository
11
- 1. yarn install
12
- 1. run 'yarn start' to start a documentation server
13
-
14
- ### Contribution guidelines
15
-
16
- When adding endpoints create a new folder / file for your endpoint.
17
- Fill out file using others as a guide.
18
-
19
- Any response and request shapes should be specified in the /types folder. The documentation server
20
- is sometimes unable to understand more complicated interfaces. In these scenarios please create two
21
- types files, one with a logical working type that can be used by other repositories. The other will
22
- be simply for filling the response server.
23
-
24
- Any documentation specific types files should have the suffix 'Docs' within the same folder. e.g.
25
-
26
- - types
27
- - objects
28
- - objectTypes.ts
29
- - objectTypesDocs.ts
30
-
31
- ### Who do I talk to?
32
-
33
- - Repo owner or admin
1
+ # README
2
+
3
+ This repository is a source of truth / documentation for the spotto-api.
4
+
5
+ The repository consists of a series of typescript classes that document the API contract
6
+ between the spotto API and its clients
7
+
8
+ ### How do I get set up?
9
+
10
+ 1. Clone this repository
11
+ 1. yarn install
12
+ 1. run 'yarn start' to start a documentation server
13
+
14
+ ### Contribution guidelines
15
+
16
+ When adding endpoints create a new folder / file for your endpoint.
17
+ Fill out file using others as a guide.
18
+
19
+ Any response and request shapes should be specified in the /types folder. The documentation server
20
+ is sometimes unable to understand more complicated interfaces. In these scenarios please create two
21
+ types files, one with a logical working type that can be used by other repositories. The other will
22
+ be simply for filling the response server.
23
+
24
+ Any documentation specific types files should have the suffix 'Docs' within the same folder. e.g.
25
+
26
+ - types
27
+ - objects
28
+ - objectTypes.ts
29
+ - objectTypesDocs.ts
30
+
31
+ ### Who do I talk to?
32
+
33
+ - Repo owner or admin
@@ -1,4 +1,5 @@
1
1
  import { ActionEffect, ActionEvent, ActionPresentation, ActionTargetEntity } from '../../shared';
2
+ import { PermissionGrant } from '../../../usergroups/shared';
2
3
  /** `name` is immutable. `event: null` clears the custom history label. */
3
4
  export interface UpdateActionRequest {
4
5
  label?: string;
@@ -9,4 +10,7 @@ export interface UpdateActionRequest {
9
10
  event?: ActionEvent | null;
10
11
  /** Replaced wholesale; an empty array clears every effect. */
11
12
  effects?: ActionEffect[];
13
+ /** UI-only visibility grants — replaced wholesale; [] clears them (usable
14
+ * by everyone). Every group id must exist in the org; `level` ignored. */
15
+ permissions?: PermissionGrant[];
12
16
  }
@@ -1,4 +1,5 @@
1
1
  import { IEntityMeta } from '../../shared';
2
+ import { PermissionGrant } from '../../usergroups/shared';
2
3
  import { ActionEffect, ActionEvent, ActionPresentation, ActionTargetEntity } from '../shared';
3
4
  import { GetActionsQuery } from './query';
4
5
  export interface GetActionResponse {
@@ -16,6 +17,9 @@ export interface GetActionResponse {
16
17
  event?: ActionEvent;
17
18
  /** Run on submit in author order (§4.2); absent = none. */
18
19
  effects?: ActionEffect[];
20
+ /** UI-only visibility grants — binary for actions (`level` ignored; any
21
+ * grant ⇒ members-only). Absent/empty = usable by everyone. */
22
+ permissions?: PermissionGrant[];
19
23
  meta?: IEntityMeta;
20
24
  }
21
25
  export interface GetActionsResponse {
@@ -7,4 +7,11 @@ export interface DownloadAssetsQuery extends AssetFilters {
7
7
  timestampFormat?: TimestampFormat;
8
8
  timezone?: string;
9
9
  withEntityLinks?: boolean;
10
+ /**
11
+ * Export column curation: keep only the custom-field columns for these
12
+ * field ids. Omitted ⇒ every field column (existing API callers
13
+ * unchanged). Ids that resolve to no field are dropped silently — this
14
+ * is UI curation, not access control.
15
+ */
16
+ fieldIds?: string[];
10
17
  }
@@ -1,4 +1,5 @@
1
1
  import { FieldDataType, FieldInputType } from '../constants';
2
+ import { PermissionGrant } from '../../usergroups/shared';
2
3
  export interface GetFieldResponse {
3
4
  id: string;
4
5
  name: string;
@@ -14,6 +15,8 @@ export interface GetFieldResponse {
14
15
  decimalMin?: number;
15
16
  decimalMax?: number;
16
17
  decimalPlaces?: number;
18
+ /** UI-only visibility grants (usergroups); absent/empty = open. */
19
+ permissions?: PermissionGrant[];
17
20
  meta?: {
18
21
  created: number;
19
22
  updated?: number;
@@ -1,4 +1,5 @@
1
1
  import { FieldInputType } from '../../constants';
2
+ import { PermissionGrant } from '../../../usergroups/shared';
2
3
  export interface UpdateFieldRequestOption {
3
4
  value: string;
4
5
  previousValue?: string;
@@ -15,4 +16,7 @@ export interface UpdateFieldRequest {
15
16
  decimalMin?: number | null;
16
17
  decimalMax?: number | null;
17
18
  decimalPlaces?: number | null;
19
+ /** UI-only visibility grants — replaced wholesale; [] clears them (open).
20
+ * Every group id must exist in the org. */
21
+ permissions?: PermissionGrant[];
18
22
  }
package/dist/index.d.ts CHANGED
@@ -25,3 +25,4 @@ export * from './views';
25
25
  export * from './forms';
26
26
  export * from './actions';
27
27
  export * from './submissions';
28
+ export * from './usergroups';
package/dist/index.js CHANGED
@@ -41,4 +41,5 @@ __exportStar(require("./views"), exports);
41
41
  __exportStar(require("./forms"), exports);
42
42
  __exportStar(require("./actions"), exports);
43
43
  __exportStar(require("./submissions"), exports);
44
+ __exportStar(require("./usergroups"), exports);
44
45
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,uCAAoB;AACpB,2CAAwB;AACxB,iDAA8B;AAC9B,2CAAwB;AACxB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,wCAAqB;AACrB,0CAAuB;AACvB,0CAAuB;AACvB,4CAAyB;AACzB,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,uCAAoB;AACpB,2CAAwB;AACxB,iDAA8B;AAC9B,2CAAwB;AACxB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,wCAAqB;AACrB,0CAAuB;AACvB,0CAAuB;AACvB,4CAAyB;AACzB,gDAA6B;AAC7B,+CAA4B"}
@@ -21,12 +21,23 @@ export interface SnapshotPreferences {
21
21
  export interface WorkflowPreferences {
22
22
  mainMenuEnabled?: boolean;
23
23
  }
24
+ /**
25
+ * Org toggle for the usergroups feature set (field/action visibility +
26
+ * location record scope). Default OFF: enforcement, hiding, and the
27
+ * /users/current access lists all short-circuit; usergroup data stays
28
+ * inert. Every flip to ON recomputes all user caches (and bootstraps the
29
+ * "all" group iff the org has zero usergroups).
30
+ */
31
+ export interface UsergroupPreferences {
32
+ enabled: boolean;
33
+ }
24
34
  export interface Preferences {
25
35
  readers: ReaderPreferences;
26
36
  assets: AssetPreferences;
27
37
  locations: LocationPreferences;
28
38
  snapshots?: SnapshotPreferences;
29
39
  workflows?: WorkflowPreferences;
40
+ usergroups?: UsergroupPreferences;
30
41
  mainMenuLinks?: Array<{
31
42
  label: string;
32
43
  url: string;
@@ -24,6 +24,21 @@ export declare type UnknownRoleActionType = (typeof UNKNOWN_ROLE_ACTION_TYPES)[n
24
24
  * can be onboarded against it. This is a manual one-off via the AWS console.
25
25
  */
26
26
  export declare const DEFAULT_ROLE_CLAIM_ATTRIBUTE = "custom:g2g_role";
27
+ /**
28
+ * Cognito user attribute that carries the IdP-emitted group memberships.
29
+ * Fixed across all SSO orgs, exactly like `DEFAULT_ROLE_CLAIM_ATTRIBUTE` —
30
+ * per-customer IdP attribute mappings wire the customer's group claim
31
+ * (`idpGroupClaim`, opt-in) into this attribute, and the snapshot trigger +
32
+ * usergroup sync read from it.
33
+ *
34
+ * Operational note: each User Pool (dev / staging / prod) needs the
35
+ * `g2g_groups` custom attribute (String, mutable, max length 2048 — the
36
+ * Cognito maximum) defined once before any org can adopt group mapping.
37
+ * Manual one-off via the AWS console, same as `g2g_role`. The 2048-char
38
+ * ceiling fits ~48 Entra GUIDs — IdP setup guidance must scope the emitted
39
+ * claim to app-assigned groups.
40
+ */
41
+ export declare const DEFAULT_GROUP_CLAIM_ATTRIBUTE = "custom:g2g_groups";
27
42
  /**
28
43
  * The IdP-side claim name customers MUST emit. Mandated rather than
29
44
  * configurable per-customer — every onboarded IdP gets the same Cognito
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildSsoProviderName = exports.DEFAULT_IDP_ROLE_CLAIM = exports.DEFAULT_ROLE_CLAIM_ATTRIBUTE = exports.UNKNOWN_ROLE_ACTION_TYPES = exports.SSO_MODES = void 0;
3
+ exports.buildSsoProviderName = exports.DEFAULT_IDP_ROLE_CLAIM = exports.DEFAULT_GROUP_CLAIM_ATTRIBUTE = exports.DEFAULT_ROLE_CLAIM_ATTRIBUTE = exports.UNKNOWN_ROLE_ACTION_TYPES = exports.SSO_MODES = void 0;
4
4
  /**
5
5
  * Supported SSO protocol modes for an organisation's per-customer Cognito IdP.
6
6
  */
@@ -25,6 +25,21 @@ exports.UNKNOWN_ROLE_ACTION_TYPES = ['deny', 'defaultRole'];
25
25
  * can be onboarded against it. This is a manual one-off via the AWS console.
26
26
  */
27
27
  exports.DEFAULT_ROLE_CLAIM_ATTRIBUTE = 'custom:g2g_role';
28
+ /**
29
+ * Cognito user attribute that carries the IdP-emitted group memberships.
30
+ * Fixed across all SSO orgs, exactly like `DEFAULT_ROLE_CLAIM_ATTRIBUTE` —
31
+ * per-customer IdP attribute mappings wire the customer's group claim
32
+ * (`idpGroupClaim`, opt-in) into this attribute, and the snapshot trigger +
33
+ * usergroup sync read from it.
34
+ *
35
+ * Operational note: each User Pool (dev / staging / prod) needs the
36
+ * `g2g_groups` custom attribute (String, mutable, max length 2048 — the
37
+ * Cognito maximum) defined once before any org can adopt group mapping.
38
+ * Manual one-off via the AWS console, same as `g2g_role`. The 2048-char
39
+ * ceiling fits ~48 Entra GUIDs — IdP setup guidance must scope the emitted
40
+ * claim to app-assigned groups.
41
+ */
42
+ exports.DEFAULT_GROUP_CLAIM_ATTRIBUTE = 'custom:g2g_groups';
28
43
  /**
29
44
  * The IdP-side claim name customers MUST emit. Mandated rather than
30
45
  * configurable per-customer — every onboarded IdP gets the same Cognito
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/organisations/sso/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAA;AAIlD;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,CAAC,MAAM,EAAE,aAAa,CAAU,CAAA;AAIzE;;;;;;;;;;;;GAYG;AACU,QAAA,4BAA4B,GAAG,iBAAiB,CAAA;AAE7D;;;;;;;;;;GAUG;AACU,QAAA,sBAAsB,GAAG,UAAU,CAAA;AAEhD;;;;;;;;GAQG;AACI,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAU,EAAE,CAC/D,OAAO,QAAQ,EAAE,CAAA;AADN,QAAA,oBAAoB,wBACd"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/organisations/sso/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAA;AAIlD;;;;GAIG;AACU,QAAA,yBAAyB,GAAG,CAAC,MAAM,EAAE,aAAa,CAAU,CAAA;AAIzE;;;;;;;;;;;;GAYG;AACU,QAAA,4BAA4B,GAAG,iBAAiB,CAAA;AAE7D;;;;;;;;;;;;;GAaG;AACU,QAAA,6BAA6B,GAAG,mBAAmB,CAAA;AAEhE;;;;;;;;;;GAUG;AACU,QAAA,sBAAsB,GAAG,UAAU,CAAA;AAEhD;;;;;;;;GAQG;AACI,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAU,EAAE,CAC/D,OAAO,QAAQ,EAAE,CAAA;AADN,QAAA,oBAAoB,wBACd"}
@@ -42,6 +42,40 @@ export interface RoleMappingInput {
42
42
  propertyValue: string;
43
43
  roleId: string;
44
44
  }
45
+ /**
46
+ * One row in the org's usergroup-mapping list. At sign-in the IdP-emitted
47
+ * group claim (captured into `custom:g2g_groups` via the per-org Cognito IdP
48
+ * `AttributeMapping`) is normalised to `string[]` and matched against this
49
+ * list; unlike `RoleMapping` (first match wins, order significant) the
50
+ * semantics are **union** — the user joins every group whose `propertyValue`
51
+ * appears in the normalised values, and order is irrelevant.
52
+ *
53
+ * A group referenced here is *SSO-managed* for federated users: membership
54
+ * within the mapped set is reconciled (added AND removed) on every sync, and
55
+ * manual membership edits for `authProvider: 'sso'` users are refused at both
56
+ * write doors. Groups NOT referenced here are untouched by sync.
57
+ *
58
+ * Generic over the identifier type so the same shape covers both the wire
59
+ * layer (string IDs) and the Mongo storage layer (ObjectId).
60
+ */
61
+ export interface UsergroupMapping<TId = string> {
62
+ _id: TId;
63
+ /**
64
+ * Value to look for in the IdP-emitted claim. Compared with `===` against
65
+ * each entry of the normalised `string[]` — case-sensitive, exact match.
66
+ */
67
+ propertyValue: string;
68
+ /** Spotto user group the matching user joins. */
69
+ usergroupId: TId;
70
+ }
71
+ /**
72
+ * Wire shape for creating / replacing usergroup mappings. `_id` is
73
+ * server-assigned on each write, so it's not part of the input.
74
+ */
75
+ export interface UsergroupMappingInput {
76
+ propertyValue: string;
77
+ usergroupId: string;
78
+ }
45
79
  export interface SsoEnabledBase<TRoleId = string> {
46
80
  enabled: true;
47
81
  /** Email domains owned by this org. One domain → one org (enforced at write time). */
@@ -66,6 +100,20 @@ export interface SsoEnabledBase<TRoleId = string> {
66
100
  * through to `unknownRoleAction`. See `RoleMapping`.
67
101
  */
68
102
  roleMappings: RoleMapping<TRoleId>[];
103
+ /**
104
+ * IdP-side claim name that feeds the Cognito `custom:g2g_groups` attribute.
105
+ * Absent ⇒ group sync is off for this org (the pre-feature state; also the
106
+ * default — group mapping is opt-in per org). May name the same IdP claim
107
+ * as `idpRoleClaim`: two `AttributeMapping` entries can read one claim.
108
+ */
109
+ idpGroupClaim?: string;
110
+ /**
111
+ * Org-scoped usergroup-mapping list, union semantics. Absent/empty ⇒ no
112
+ * groups are SSO-managed and sync is a no-op. Unlike the role claim there
113
+ * is no unknown-value fallback — zero matches is a legitimate outcome
114
+ * (`unknownRoleAction` remains the only login gate). See `UsergroupMapping`.
115
+ */
116
+ usergroupMappings?: UsergroupMapping<TRoleId>[];
69
117
  /**
70
118
  * Mixed-mode opt-in: when `true`, the org accepts both SSO-managed users
71
119
  * (via federation) AND password-auth users created through `POST /users`.
@@ -1,4 +1,4 @@
1
- import { RoleMappingInput } from '../../organisations/sso';
1
+ import { RoleMappingInput, UsergroupMappingInput } from '../../organisations/sso';
2
2
  /**
3
3
  * Wire shape for `POST /sso/orgs/:id/onboard`. Operator-supplied fields only.
4
4
  *
@@ -31,6 +31,17 @@ interface OnboardSsoOrgWireBase {
31
31
  * mappings via `PUT /sso/orgs/:id/sso-mappings`.
32
32
  */
33
33
  roleMappings?: RoleMappingInput[];
34
+ /**
35
+ * IdP claim to wire into `custom:g2g_groups`. Optional — group mapping is
36
+ * opt-in; absent means no group sync for the org until configured via
37
+ * `PUT /sso/orgs/:id/sso-mappings`.
38
+ */
39
+ idpGroupClaim?: string;
40
+ /**
41
+ * Initial usergroup mappings (union semantics — see `UsergroupMapping`).
42
+ * Only meaningful alongside `idpGroupClaim`.
43
+ */
44
+ usergroupMappings?: UsergroupMappingInput[];
34
45
  /**
35
46
  * Opt-in to mixed-mode: allow password-auth users alongside SSO-managed
36
47
  * users in the same org. Password-user emails must be OUTSIDE
@@ -1,14 +1,19 @@
1
- import { RoleMappingInput } from '../../organisations/sso';
1
+ import { RoleMappingInput, UsergroupMappingInput } from '../../organisations/sso';
2
2
  /**
3
3
  * Wire shape for `PUT /sso/orgs/:id/sso-mappings`.
4
4
  *
5
- * Atomic full-replace of the org's role-mapping configuration. Sends both
6
- * `idpRoleClaim` (which IdP claim feeds `custom:g2g_role`) and the whole
7
- * `roleMappings` array. The orchestrator validates roleIds, pushes any
8
- * `idpRoleClaim` change to Cognito via `UpdateIdentityProvider`, then
5
+ * Atomic full-replace of the org's mapping configuration — role AND group.
6
+ * Sends `idpRoleClaim` (which IdP claim feeds `custom:g2g_role`) and the
7
+ * whole `roleMappings` array, plus optionally `idpGroupClaim` (feeds
8
+ * `custom:g2g_groups`) and `usergroupMappings`. Because the PUT carries
9
+ * complete state, omitting the group fields CLEARS group mapping for the
10
+ * org. The orchestrator validates role/usergroup ids, pushes any claim-name
11
+ * change (either attribute) to Cognito via `UpdateIdentityProvider`, then
9
12
  * persists. Mapping `_id` values are server-assigned on each write.
10
13
  */
11
14
  export interface UpdateSsoMappingsRequest {
12
15
  idpRoleClaim: string;
13
16
  roleMappings: RoleMappingInput[];
17
+ idpGroupClaim?: string;
18
+ usergroupMappings?: UsergroupMappingInput[];
14
19
  }
@@ -0,0 +1 @@
1
+ export * from './patch';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./patch"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/usergroups/[id]/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB"}
@@ -0,0 +1,2 @@
1
+ export * from './request';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/usergroups/[id]/patch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Membership and scope are replaced wholesale; an empty array clears either
3
+ * (a scope-less group abstains from location scope). `allLocations: false`
4
+ * clears the sentinel. Changes that alter the actor's own membership are
5
+ * rejected (the own-role-guard rule).
6
+ */
7
+ export interface UpdateUsergroupRequest {
8
+ name?: string;
9
+ members?: string[];
10
+ locationScope?: string[];
11
+ allLocations?: boolean;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/usergroups/[id]/patch/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { GetUsergroupResponse as UpdateUsergroupResponse } from '../../get/response';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/usergroups/[id]/patch/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './query';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./query"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/usergroups/get/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,6CAA0B"}
@@ -0,0 +1,12 @@
1
+ import { StandardSortFields, SortOrders } from '../../shared';
2
+ export declare type UsergroupEmbedField = 'meta';
3
+ export interface GetUsergroupsQuery {
4
+ page?: number;
5
+ limit?: number;
6
+ ids?: string[];
7
+ sort?: StandardSortFields;
8
+ sortOrder?: SortOrders;
9
+ embed?: Array<UsergroupEmbedField>;
10
+ /** Usergroups a given user id is a member of. */
11
+ member?: string;
12
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/usergroups/get/query.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import { IEntityMeta } from '../../shared';
2
+ import { GetUsergroupsQuery } from './query';
3
+ export interface GetUsergroupResponse {
4
+ id: string;
5
+ name: string;
6
+ /** User ids. Membership's source of truth lives here, never on the user. */
7
+ members: string[];
8
+ /**
9
+ * Location-name path prefixes this group confines its members to. Absent
10
+ * or empty = the group abstains from location scope (it may exist purely
11
+ * for field/action grants).
12
+ */
13
+ locationScope?: string[];
14
+ /**
15
+ * The explicit "entire organisation" sentinel — never expressed as the
16
+ * root location's path (the root's name is the empty string). Emitted
17
+ * only when true.
18
+ */
19
+ allLocations?: boolean;
20
+ /**
21
+ * True when the group is referenced by the org's SSO `usergroupMappings` —
22
+ * i.e. membership is SSO-managed for federated users (manual membership
23
+ * edits for `authProvider: 'sso'` users are refused; sync adds AND removes
24
+ * within the mapped set). Emitted only when true. Lets group/user admin
25
+ * surfaces mark managed groups without needing `sso:admin` to read the
26
+ * org's SSO config.
27
+ */
28
+ ssoManaged?: boolean;
29
+ meta?: IEntityMeta;
30
+ }
31
+ export interface GetUsergroupsResponse {
32
+ query: GetUsergroupsQuery | null;
33
+ total: number;
34
+ items: GetUsergroupResponse[];
35
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/usergroups/get/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './shared';
2
+ export * from './get';
3
+ export * from './post';
4
+ export * from './[id]';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shared"), exports);
18
+ __exportStar(require("./get"), exports);
19
+ __exportStar(require("./post"), exports);
20
+ __exportStar(require("./[id]"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/usergroups/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,wCAAqB;AACrB,yCAAsB;AACtB,yCAAsB"}
@@ -0,0 +1,2 @@
1
+ export * from './request';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/usergroups/post/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,11 @@
1
+ export interface PostUsergroupRequest {
2
+ name: string;
3
+ /** User ids. The actor's own id is rejected — nobody edits their own
4
+ * memberships (the own-role-guard rule). */
5
+ members?: string[];
6
+ /** Non-empty location-name path prefixes; omitted/empty = the group
7
+ * abstains from location scope. Never the root path — "entire
8
+ * organisation" is `allLocations: true`. */
9
+ locationScope?: string[];
10
+ allLocations?: boolean;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/usergroups/post/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { GetUsergroupResponse as PostUsergroupResponse } from '../get/response';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/usergroups/post/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Effective access level a field grant confers. Most-permissive wins across
3
+ * a user's groups; a field with no grants at all is open (EDIT) to everyone.
4
+ * Actions reuse the grant shape with `level` ignored (binary: any grant ⇒
5
+ * members-only).
6
+ */
7
+ export declare const PERMISSION_GRANT_LEVELS: readonly ["NONE", "VIEW", "EDIT"];
8
+ export declare type PermissionGrantLevel = (typeof PERMISSION_GRANT_LEVELS)[number];
9
+ /** One usergroup's grant on a field or action. */
10
+ export interface PermissionGrant {
11
+ /** Usergroup id — must exist in the organisation at write time. */
12
+ group: string;
13
+ level: PermissionGrantLevel;
14
+ }
15
+ /**
16
+ * A user's resolved location scope, derived from their usergroups: any
17
+ * `allLocations` group — or no location-defining group at all — resolves to
18
+ * unconfined; otherwise the union of the groups' `locationScope` prefixes.
19
+ * Emitted on GET /users/current so the client can detect scope changes.
20
+ */
21
+ export declare type UsergroupsScope = {
22
+ unconfined: true;
23
+ } | {
24
+ paths: string[];
25
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PERMISSION_GRANT_LEVELS = void 0;
4
+ /**
5
+ * Effective access level a field grant confers. Most-permissive wins across
6
+ * a user's groups; a field with no grants at all is open (EDIT) to everyone.
7
+ * Actions reuse the grant shape with `level` ignored (binary: any grant ⇒
8
+ * members-only).
9
+ */
10
+ exports.PERMISSION_GRANT_LEVELS = ['NONE', 'VIEW', 'EDIT'];
11
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/usergroups/shared.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAA"}
@@ -4,8 +4,6 @@ export interface BaseGetUserResponse {
4
4
  name: string;
5
5
  role: IEmbeddedEntity;
6
6
  organisation: IEmbeddedEntity;
7
- permissionLocationId: string;
8
- permissionLocationPath: string;
9
7
  homeLocationId: string;
10
8
  homeLocationPath: string;
11
9
  meta?: IEntityMeta;
@@ -1,6 +1,10 @@
1
1
  export interface UpdateUserRequest {
2
2
  name?: string;
3
3
  role?: string;
4
- permissionLocationId?: string;
5
4
  homeLocationId?: string;
5
+ /**
6
+ * Complete usergroup membership for the target (group ids) — replaced
7
+ * wholesale; [] clears every membership. Never applied to yourself.
8
+ */
9
+ usergroups?: string[];
6
10
  }
@@ -3,6 +3,12 @@ import { Preferences } from '../organisations/constants';
3
3
  import { Integrations } from '../integrations/constants';
4
4
  import { System } from '../system';
5
5
  import { HomeLayout } from './home-layout';
6
+ import { PermissionGrantLevel, UsergroupsScope } from '../usergroups/shared';
7
+ /** One entry of the §1.7 field access list — every org field appears. */
8
+ export interface FieldAccessEntry {
9
+ id: string;
10
+ level: PermissionGrantLevel;
11
+ }
6
12
  export interface EmbeddedRole extends IEmbeddedEntity {
7
13
  permissions: string[];
8
14
  }
@@ -16,8 +22,6 @@ export interface CurrentUserResponse {
16
22
  name: string;
17
23
  role: EmbeddedRole;
18
24
  organisation: EmbeddedOrganisation;
19
- permissionLocationId: string;
20
- permissionLocationPath: string;
21
25
  homeLocationId: string;
22
26
  homeLocationPath: string;
23
27
  meta?: IEntityMeta;
@@ -35,14 +39,28 @@ export interface CurrentUserResponse {
35
39
  * user customises — the client then renders its built-in default layout.
36
40
  */
37
41
  homeLayout?: HomeLayout;
42
+ /**
43
+ * UI-only visibility lists (usergroups feature) — COMPLETE: every org
44
+ * field appears with the caller's effective level (grant-less ⇒ EDIT;
45
+ * admin bypass ⇒ all EDIT), every usable action id appears. All three
46
+ * keys are omitted entirely when the org toggle is OFF — client rule:
47
+ * absent list (or absent id) ⇒ open.
48
+ */
49
+ fieldAccess?: FieldAccessEntry[];
50
+ actionAccess?: string[];
51
+ /**
52
+ * The caller's resolved location scope, verbatim from the user-doc cache.
53
+ * The offline client treats a CHANGE in this value (including appearing/
54
+ * disappearing) as its delta-cursor + cache reset trigger — delta reads
55
+ * never re-deliver docs whose lastChanged predates the cursor.
56
+ */
57
+ usergroupsScope?: UsergroupsScope;
38
58
  }
39
59
  export interface CurrentUserPublicResponse {
40
60
  id: string;
41
61
  name: string;
42
62
  role: EmbeddedRole;
43
63
  organisation: EmbeddedOrganisation;
44
- permissionLocationId: string;
45
- permissionLocationPath: string;
46
64
  homeLocationId: string;
47
65
  homeLocationPath: string;
48
66
  meta?: IEntityMeta;
@@ -10,8 +10,6 @@ export interface GetUsersQuery {
10
10
  sort?: StandardSortFields;
11
11
  sortOrder?: SortOrders;
12
12
  embed?: Array<UserEmbedField>;
13
- permissionLocationId?: string;
14
- permissionLocationPathBeginsWith?: string;
15
13
  homeLocationId?: string;
16
14
  homeLocationPathBeginsWith?: string;
17
15
  }
@@ -1,8 +1,13 @@
1
1
  export interface BasePostUserRequest {
2
2
  name: string;
3
3
  role: string;
4
- permissionLocationId?: string;
5
4
  homeLocationId?: string;
5
+ /**
6
+ * Complete usergroup membership for the new user (group ids). Enforced
7
+ * per the closure invariant when the org toggle is ON; omitted = no
8
+ * groups (resolves unconfined).
9
+ */
10
+ usergroups?: string[];
6
11
  }
7
12
  export interface PostExternalUserRequest extends BasePostUserRequest {
8
13
  type: 'EXTERNAL';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotto/contract",
3
3
  "license": "ISC",
4
- "version": "1.0.70-alpha.14",
4
+ "version": "1.0.70-alpha.16",
5
5
  "description": "Spotto's API Contract type definitions",
6
6
  "main": "./dist/index.js",
7
7
  "files": [
@@ -18,5 +18,5 @@
18
18
  "@types/geojson": "^7946.0.11",
19
19
  "shx": "^0.3.4"
20
20
  },
21
- "gitHead": "ba0e5b9a18578cbd52650398edfc177aff70a595"
21
+ "gitHead": "7ee187bee65f54c5f22a16e28dabf71a272174fe"
22
22
  }