@verdocs/js-sdk 2.0.6 → 2.0.9

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.
@@ -19,6 +19,16 @@ import { VerdocsEndpoint } from '../VerdocsEndpoint';
19
19
  * ```
20
20
  */
21
21
  export declare const getGroups: (endpoint: VerdocsEndpoint, organizationId: string) => Promise<IGroup[]>;
22
+ /**
23
+ * Get a single group by name. Returns a detail record.
24
+ *
25
+ * ```typescript
26
+ * import {Groups} from '@verdocs/js-sdk/Organizations';
27
+ *
28
+ * const groups = await Groups.getGroups(ORGID);
29
+ * ```
30
+ */
31
+ export declare const getGroupByName: (endpoint: VerdocsEndpoint, organizationId: string, name?: string) => Promise<IGroup>;
22
32
  /**
23
33
  * Get the details for a group.
24
34
  *
@@ -21,6 +21,20 @@ export var getGroups = function (endpoint, organizationId) {
21
21
  .get("/organizations/".concat(organizationId, "/groups"))
22
22
  .then(function (r) { return r.data; });
23
23
  };
24
+ /**
25
+ * Get a single group by name. Returns a detail record.
26
+ *
27
+ * ```typescript
28
+ * import {Groups} from '@verdocs/js-sdk/Organizations';
29
+ *
30
+ * const groups = await Groups.getGroups(ORGID);
31
+ * ```
32
+ */
33
+ export var getGroupByName = function (endpoint, organizationId, name) {
34
+ return endpoint.api //
35
+ .get("/organizations/".concat(organizationId, "/groups"), { params: { name: name } })
36
+ .then(function (r) { return r.data; });
37
+ };
24
38
  /**
25
39
  * Get the details for a group.
26
40
  *
@@ -41,6 +41,8 @@ export interface IGroup {
41
41
  name: string;
42
42
  organization_id: string;
43
43
  /** For future expansion. In the future, Verdocs may support group hierarchies. Until then this field is always null. */
44
+ parent: IGroup | null;
45
+ /** For future expansion. In the future, Verdocs may support group hierarchies. Until then this field is always null. */
44
46
  parent_id: string | null;
45
47
  /** Some operations will additionally return a list of permissions. */
46
48
  permissions?: TPermission[];
@@ -2,6 +2,9 @@ import axios from 'axios';
2
2
  import { decodeAccessTokenBody } from './Utils/Token';
3
3
  import globalThis from './Utils/globalThis';
4
4
  import * as Documents from './Documents';
5
+ // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
6
+ // Also see globalThis for comments about why we're doing this in the first place.
7
+ var ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
5
8
  var requestLogger = function (r) {
6
9
  // tslint:disable-next-line
7
10
  console.debug("[JS-SDK] ".concat(r.method.toUpperCase(), " ").concat(r.baseURL).concat(r.url), r.data ? JSON.stringify(r.data) : '');
@@ -65,6 +68,13 @@ var VerdocsEndpoint = /** @class */ (function () {
65
68
  globalThis[ENDPOINT_KEY] = this;
66
69
  };
67
70
  VerdocsEndpoint.getDefault = function () {
71
+ if (!globalThis[ENDPOINT_KEY]) {
72
+ globalThis[ENDPOINT_KEY] = new VerdocsEndpoint();
73
+ window.console.debug('[JS_SDK] Created default endpoint', globalThis[ENDPOINT_KEY]);
74
+ }
75
+ else {
76
+ window.console.debug('[JS SDK] Re-using existing endpoint', globalThis[ENDPOINT_KEY]);
77
+ }
68
78
  return globalThis[ENDPOINT_KEY];
69
79
  };
70
80
  /**
@@ -289,10 +299,3 @@ var VerdocsEndpoint = /** @class */ (function () {
289
299
  return VerdocsEndpoint;
290
300
  }());
291
301
  export { VerdocsEndpoint };
292
- // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
293
- // Also see globalThis for comments about why we're doing this in the first place.
294
- var ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
295
- if (!globalThis[ENDPOINT_KEY]) {
296
- globalThis[ENDPOINT_KEY] = new VerdocsEndpoint();
297
- window.console.debug('[JS_SDK] Created default endpoint', globalThis[ENDPOINT_KEY]);
298
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/js-sdk",
3
- "version": "2.0.6",
3
+ "version": "2.0.9",
4
4
  "private": false,
5
5
  "homepage": "https://github.com/Verdocs/js-sdk",
6
6
  "description": "Verdocs JS SDK",
@@ -53,13 +53,13 @@
53
53
  "devDependencies": {
54
54
  "@jest/globals": "^28.1.2",
55
55
  "@types/jest": "^28.1.4",
56
- "axios-mock-adapter": "^1.21.1",
56
+ "axios-mock-adapter": "^1.21.2",
57
57
  "jest": "^28.1.2",
58
58
  "prettier": "^2.7.1",
59
- "ts-jest": "^28.0.5",
59
+ "ts-jest": "^28.0.8",
60
60
  "tslint": "^6.1.3",
61
61
  "tslint-config-prettier": "^1.18.0",
62
- "typedoc": "^0.23.9",
62
+ "typedoc": "^0.23.11",
63
63
  "typedoc-plugin-markdown": "^3.13.4",
64
64
  "typescript": "^4.7.4"
65
65
  }