@sasjs/api 0.20.1 → 0.21.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/build/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.20.1 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.21.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
2
2
  "use strict";
3
3
  var SASjsApi = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -38,10 +38,12 @@ const groupsOf = (groups) => {
38
38
  /**
39
39
  * The import, over the host's store.
40
40
  *
41
- * `IdentityStore` is the port rather than `RecordService`, because the records
41
+ * `DirectoryStore` is the port rather than `RecordService`, because the records
42
42
  * routes require a password (a local account has one to set) and a
43
43
  * provider-managed account does not: the host's directory is where it
44
- * authenticates, and `passwordMatches` answers for it.
44
+ * authenticates. It is narrower than `IdentityStore` for the same reason - an
45
+ * import is not a sign-in, and a host should not implement token storage to run
46
+ * one.
45
47
  */
46
48
  const createDirectoryService = (store, source, options = {}) => {
47
49
  const provider = options.provider || 'ldap';
@@ -26,7 +26,7 @@
26
26
  * here. The document's description - "Users and groups that already exist are
27
27
  * left untouched" - is what this service implements.
28
28
  */
29
- import type { IdentityStore } from '../identity/types.js';
29
+ import type { IdentityGroupRecord, IdentityUserRecord, NewGroup, NewUser } from '../identity/types.js';
30
30
  export interface DirectoryUser {
31
31
  username: string;
32
32
  displayName: string;
@@ -38,6 +38,22 @@ export interface DirectoryGroup {
38
38
  /** Members the directory says this group holds, by username. */
39
39
  members?: string[];
40
40
  }
41
+ /**
42
+ * The five store methods a directory import needs.
43
+ *
44
+ * Narrower than `IdentityStore` on purpose: importing accounts has nothing to do
45
+ * with issuing tokens or spending authorization codes, and a host that wants to
46
+ * import a directory should not have to implement an identity service to do it.
47
+ * `IdentityStore` satisfies this structurally, so a host that already has one
48
+ * passes it unchanged.
49
+ */
50
+ export interface DirectoryStore {
51
+ users(): Promise<IdentityUserRecord[]>;
52
+ createUser(input: NewUser): Promise<IdentityUserRecord>;
53
+ groups(): Promise<IdentityGroupRecord[]>;
54
+ createGroup(input: NewGroup): Promise<IdentityGroupRecord>;
55
+ addToGroup(groupUid: string, userUid: string): Promise<IdentityGroupRecord | undefined>;
56
+ }
41
57
  /** One look at the directory, as the host read it. */
42
58
  export interface DirectorySource {
43
59
  users(): Promise<DirectoryUser[]>;
@@ -62,10 +78,12 @@ export interface DirectoryServiceOptions {
62
78
  /**
63
79
  * The import, over the host's store.
64
80
  *
65
- * `IdentityStore` is the port rather than `RecordService`, because the records
81
+ * `DirectoryStore` is the port rather than `RecordService`, because the records
66
82
  * routes require a password (a local account has one to set) and a
67
83
  * provider-managed account does not: the host's directory is where it
68
- * authenticates, and `passwordMatches` answers for it.
84
+ * authenticates. It is narrower than `IdentityStore` for the same reason - an
85
+ * import is not a sign-in, and a host should not implement token storage to run
86
+ * one.
69
87
  */
70
- export declare const createDirectoryService: (store: IdentityStore, source: DirectorySource, options?: DirectoryServiceOptions) => DirectoryService;
88
+ export declare const createDirectoryService: (store: DirectoryStore, source: DirectorySource, options?: DirectoryServiceOptions) => DirectoryService;
71
89
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/directory/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAEV,aAAa,EAEd,MAAM,sBAAsB,CAAA;AAE7B,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,sDAAsD;A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,mBAAmB,EAAE,CAAC,CAAA;IACxC,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAC1D,UAAU,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAA;CAC5C;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,KAAK,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAA;IACjC,MAAM,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAA;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AA4DD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,cAAc,EACrB,QAAQ,eAAe,EACvB,UAAS,uBAA4B,KACpC,gBAsFF,CAAA"}
@@ -35,10 +35,12 @@ const groupsOf = (groups) => {
35
35
  /**
36
36
  * The import, over the host's store.
37
37
  *
38
- * `IdentityStore` is the port rather than `RecordService`, because the records
38
+ * `DirectoryStore` is the port rather than `RecordService`, because the records
39
39
  * routes require a password (a local account has one to set) and a
40
40
  * provider-managed account does not: the host's directory is where it
41
- * authenticates, and `passwordMatches` answers for it.
41
+ * authenticates. It is narrower than `IdentityStore` for the same reason - an
42
+ * import is not a sign-in, and a host should not implement token storage to run
43
+ * one.
42
44
  */
43
45
  export const createDirectoryService = (store, source, options = {}) => {
44
46
  const provider = options.provider || 'ldap';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
5
5
  "license": "MIT",
6
6
  "author": "SASjs",