@esri/hub-common 9.47.0 → 9.48.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,32 @@
1
+ import { request } from "@esri/arcgis-rest-request";
2
+ /**
3
+ * Generic function to fetch org limits
4
+ * @param orgId
5
+ * @param limitsType
6
+ * @param limitName
7
+ * @param options
8
+ * @returns
9
+ */
10
+ export function fetchOrgLimits(orgId, limitsType, limitName, options) {
11
+ const portal = options.authentication.portal;
12
+ const url = `${portal}/portals/${orgId}/limits?limitsType=${limitsType}&limitName=${limitName}&f=json`;
13
+ return request(url, options);
14
+ }
15
+ /**
16
+ * Fetch the maximum number of groups a user can create in an org
17
+ * @param orgId
18
+ * @param options
19
+ * @returns
20
+ */
21
+ export function fetchMaxNumUserGroupsLimit(orgId, options) {
22
+ return fetchOrgLimits(orgId, "Groups", "MaxNumUserGroups", options)
23
+ .then((response) => {
24
+ return response.limitValue;
25
+ })
26
+ .catch((_) => {
27
+ // it's possible that the org doesn't have this property set, and
28
+ // the api will return a 500 error. So we just return the default value
29
+ return 512;
30
+ });
31
+ }
32
+ //# sourceMappingURL=fetchOrgLimits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchOrgLimits.js","sourceRoot":"","sources":["../../../src/org/fetchOrgLimits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA2BpD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,UAAwB,EACxB,SAAiB,EACjB,OAA4B;IAE5B,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;IAC7C,MAAM,GAAG,GAAG,GAAG,MAAM,YAAY,KAAK,sBAAsB,UAAU,cAAc,SAAS,SAAS,CAAC;IACvG,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAa,EACb,OAA4B;IAE5B,OAAO,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC;SAChE,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACjB,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,iEAAiE;QACjE,uEAAuE;QACvE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./fetch-org";
2
+ export * from "./fetchOrgLimits";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { request } from "@esri/arcgis-rest-request";
2
+ /**
3
+ * Generic function to fetch org limits
4
+ * @param orgId
5
+ * @param limitsType
6
+ * @param limitName
7
+ * @param options
8
+ * @returns
9
+ */
10
+ export function fetchOrgLimits(orgId, limitsType, limitName, options) {
11
+ var portal = options.authentication.portal;
12
+ var url = portal + "/portals/" + orgId + "/limits?limitsType=" + limitsType + "&limitName=" + limitName + "&f=json";
13
+ return request(url, options);
14
+ }
15
+ /**
16
+ * Fetch the maximum number of groups a user can create in an org
17
+ * @param orgId
18
+ * @param options
19
+ * @returns
20
+ */
21
+ export function fetchMaxNumUserGroupsLimit(orgId, options) {
22
+ return fetchOrgLimits(orgId, "Groups", "MaxNumUserGroups", options)
23
+ .then(function (response) {
24
+ return response.limitValue;
25
+ })
26
+ .catch(function (_) {
27
+ // it's possible that the org doesn't have this property set, and
28
+ // the api will return a 500 error. So we just return the default value
29
+ return 512;
30
+ });
31
+ }
32
+ //# sourceMappingURL=fetchOrgLimits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchOrgLimits.js","sourceRoot":"","sources":["../../../src/org/fetchOrgLimits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA2BpD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,UAAwB,EACxB,SAAiB,EACjB,OAA4B;IAE5B,IAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;IAC7C,IAAM,GAAG,GAAM,MAAM,iBAAY,KAAK,2BAAsB,UAAU,mBAAc,SAAS,YAAS,CAAC;IACvG,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAAa,EACb,OAA4B;IAE5B,OAAO,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC;SAChE,IAAI,CAAC,UAAC,QAAQ;QACb,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC,CAAC;SACD,KAAK,CAAC,UAAC,CAAC;QACP,iEAAiE;QACjE,uEAAuE;QACvE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./fetch-org";
2
+ export * from "./fetchOrgLimits";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchMaxNumUserGroupsLimit = exports.fetchOrgLimits = void 0;
4
+ const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
5
+ /**
6
+ * Generic function to fetch org limits
7
+ * @param orgId
8
+ * @param limitsType
9
+ * @param limitName
10
+ * @param options
11
+ * @returns
12
+ */
13
+ function fetchOrgLimits(orgId, limitsType, limitName, options) {
14
+ const portal = options.authentication.portal;
15
+ const url = `${portal}/portals/${orgId}/limits?limitsType=${limitsType}&limitName=${limitName}&f=json`;
16
+ return arcgis_rest_request_1.request(url, options);
17
+ }
18
+ exports.fetchOrgLimits = fetchOrgLimits;
19
+ /**
20
+ * Fetch the maximum number of groups a user can create in an org
21
+ * @param orgId
22
+ * @param options
23
+ * @returns
24
+ */
25
+ function fetchMaxNumUserGroupsLimit(orgId, options) {
26
+ return fetchOrgLimits(orgId, "Groups", "MaxNumUserGroups", options)
27
+ .then((response) => {
28
+ return response.limitValue;
29
+ })
30
+ .catch((_) => {
31
+ // it's possible that the org doesn't have this property set, and
32
+ // the api will return a 500 error. So we just return the default value
33
+ return 512;
34
+ });
35
+ }
36
+ exports.fetchMaxNumUserGroupsLimit = fetchMaxNumUserGroupsLimit;
37
+ //# sourceMappingURL=fetchOrgLimits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchOrgLimits.js","sourceRoot":"","sources":["../../../src/org/fetchOrgLimits.ts"],"names":[],"mappings":";;;AACA,mEAAoD;AA2BpD;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,KAAa,EACb,UAAwB,EACxB,SAAiB,EACjB,OAA4B;IAE5B,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;IAC7C,MAAM,GAAG,GAAG,GAAG,MAAM,YAAY,KAAK,sBAAsB,UAAU,cAAc,SAAS,SAAS,CAAC;IACvG,OAAO,6BAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AATD,wCASC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CACxC,KAAa,EACb,OAA4B;IAE5B,OAAO,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC;SAChE,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QACjB,OAAO,QAAQ,CAAC,UAAU,CAAC;IAC7B,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,iEAAiE;QACjE,uEAAuE;QACvE,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACP,CAAC;AAbD,gEAaC"}
@@ -2,4 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./fetch-org"), exports);
5
+ tslib_1.__exportStar(require("./fetchOrgLimits"), exports);
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/org/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/org/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,2DAAiC"}
@@ -0,0 +1,35 @@
1
+ import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
+ export declare type OrgLimitType = "ScheduleTask" | "Collaboration" | "Community" | "Groups" | "Content";
3
+ /**
4
+ * Definiton of the org limits response.
5
+ */
6
+ export interface IOrgLimit {
7
+ /**
8
+ * Preset limit types
9
+ */
10
+ type: OrgLimitType;
11
+ /**
12
+ * Not constrained as there are too many to list
13
+ */
14
+ name: string;
15
+ /**
16
+ * value of the limit
17
+ */
18
+ limitValue: number;
19
+ }
20
+ /**
21
+ * Generic function to fetch org limits
22
+ * @param orgId
23
+ * @param limitsType
24
+ * @param limitName
25
+ * @param options
26
+ * @returns
27
+ */
28
+ export declare function fetchOrgLimits(orgId: string, limitsType: OrgLimitType, limitName: string, options: IUserRequestOptions): Promise<IOrgLimit>;
29
+ /**
30
+ * Fetch the maximum number of groups a user can create in an org
31
+ * @param orgId
32
+ * @param options
33
+ * @returns
34
+ */
35
+ export declare function fetchMaxNumUserGroupsLimit(orgId: string, options: IUserRequestOptions): Promise<number>;
@@ -1 +1,2 @@
1
1
  export * from "./fetch-org";
2
+ export * from "./fetchOrgLimits";
@@ -1,5 +1,5 @@
1
1
  /* @preserve
2
- * @esri/hub-common - v9.46.1 - Tue Jul 19 2022 15:08:51 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/hub-common - v9.47.0 - Wed Jul 20 2022 22:15:24 GMT+0000 (Coordinated Universal Time)
3
3
  * Copyright (c) 2022 Environmental Systems Research Institute, Inc.
4
4
  * Apache-2.0
5
5
  */
@@ -10011,6 +10011,37 @@
10011
10011
  return getPortal(orgId, __assign(__assign({}, options), { portal: basePortalUrl }));
10012
10012
  };
10013
10013
 
10014
+ /**
10015
+ * Generic function to fetch org limits
10016
+ * @param orgId
10017
+ * @param limitsType
10018
+ * @param limitName
10019
+ * @param options
10020
+ * @returns
10021
+ */
10022
+ function fetchOrgLimits(orgId, limitsType, limitName, options) {
10023
+ var portal = options.authentication.portal;
10024
+ var url = portal + "/portals/" + orgId + "/limits?limitsType=" + limitsType + "&limitName=" + limitName + "&f=json";
10025
+ return request(url, options);
10026
+ }
10027
+ /**
10028
+ * Fetch the maximum number of groups a user can create in an org
10029
+ * @param orgId
10030
+ * @param options
10031
+ * @returns
10032
+ */
10033
+ function fetchMaxNumUserGroupsLimit(orgId, options) {
10034
+ return fetchOrgLimits(orgId, "Groups", "MaxNumUserGroups", options)
10035
+ .then(function (response) {
10036
+ return response.limitValue;
10037
+ })
10038
+ .catch(function (_) {
10039
+ // it's possible that the org doesn't have this property set, and
10040
+ // the api will return a 500 error. So we just return the default value
10041
+ return 512;
10042
+ });
10043
+ }
10044
+
10014
10045
  /**
10015
10046
  * Parse metadataxml into json object
10016
10047
  * @param metadataXml
@@ -20545,8 +20576,10 @@
20545
20576
  exports.fetchContent = fetchContent;
20546
20577
  exports.fetchHubTranslation = fetchHubTranslation;
20547
20578
  exports.fetchImageAsBlob = fetchImageAsBlob;
20579
+ exports.fetchMaxNumUserGroupsLimit = fetchMaxNumUserGroupsLimit;
20548
20580
  exports.fetchModelFromItem = fetchModelFromItem;
20549
20581
  exports.fetchOrg = fetchOrg;
20582
+ exports.fetchOrgLimits = fetchOrgLimits;
20550
20583
  exports.fetchProject = fetchProject;
20551
20584
  exports.fetchSite = fetchSite;
20552
20585
  exports.fetchSiteModel = fetchSiteModel;