@esri/hub-common 14.184.0 → 14.184.2

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 (64) hide show
  1. package/dist/esm/content/_internal/computeProps.js +3 -5
  2. package/dist/esm/content/_internal/computeProps.js.map +1 -1
  3. package/dist/esm/content/compose.js +10 -12
  4. package/dist/esm/content/compose.js.map +1 -1
  5. package/dist/esm/content/hostedServiceUtils.js +4 -1
  6. package/dist/esm/content/hostedServiceUtils.js.map +1 -1
  7. package/dist/esm/content/index.js +1 -0
  8. package/dist/esm/content/index.js.map +1 -1
  9. package/dist/esm/content/isAGOHostedService.js +30 -0
  10. package/dist/esm/content/isAGOHostedService.js.map +1 -0
  11. package/dist/esm/core/_internal/computeItemProps.js +23 -0
  12. package/dist/esm/core/_internal/computeItemProps.js.map +1 -0
  13. package/dist/esm/discussions/_internal/computeProps.js +2 -9
  14. package/dist/esm/discussions/_internal/computeProps.js.map +1 -1
  15. package/dist/esm/initiative-templates/_internal/computeProps.js +2 -9
  16. package/dist/esm/initiative-templates/_internal/computeProps.js.map +1 -1
  17. package/dist/esm/initiatives/_internal/computeProps.js +2 -9
  18. package/dist/esm/initiatives/_internal/computeProps.js.map +1 -1
  19. package/dist/esm/pages/_internal/computeProps.js +2 -7
  20. package/dist/esm/pages/_internal/computeProps.js.map +1 -1
  21. package/dist/esm/projects/_internal/computeProps.js +2 -9
  22. package/dist/esm/projects/_internal/computeProps.js.map +1 -1
  23. package/dist/esm/sites/_internal/computeProps.js +2 -9
  24. package/dist/esm/sites/_internal/computeProps.js.map +1 -1
  25. package/dist/esm/surveys/_internal/computeProps.js +3 -9
  26. package/dist/esm/surveys/_internal/computeProps.js.map +1 -1
  27. package/dist/esm/templates/_internal/computeProps.js +2 -10
  28. package/dist/esm/templates/_internal/computeProps.js.map +1 -1
  29. package/dist/node/content/_internal/computeProps.js +3 -5
  30. package/dist/node/content/_internal/computeProps.js.map +1 -1
  31. package/dist/node/content/compose.js +10 -12
  32. package/dist/node/content/compose.js.map +1 -1
  33. package/dist/node/content/hostedServiceUtils.js +4 -1
  34. package/dist/node/content/hostedServiceUtils.js.map +1 -1
  35. package/dist/node/content/index.js +1 -0
  36. package/dist/node/content/index.js.map +1 -1
  37. package/dist/node/content/isAGOHostedService.js +34 -0
  38. package/dist/node/content/isAGOHostedService.js.map +1 -0
  39. package/dist/node/core/_internal/computeItemProps.js +27 -0
  40. package/dist/node/core/_internal/computeItemProps.js.map +1 -0
  41. package/dist/node/discussions/_internal/computeProps.js +2 -9
  42. package/dist/node/discussions/_internal/computeProps.js.map +1 -1
  43. package/dist/node/initiative-templates/_internal/computeProps.js +2 -9
  44. package/dist/node/initiative-templates/_internal/computeProps.js.map +1 -1
  45. package/dist/node/initiatives/_internal/computeProps.js +2 -9
  46. package/dist/node/initiatives/_internal/computeProps.js.map +1 -1
  47. package/dist/node/pages/_internal/computeProps.js +2 -7
  48. package/dist/node/pages/_internal/computeProps.js.map +1 -1
  49. package/dist/node/projects/_internal/computeProps.js +2 -9
  50. package/dist/node/projects/_internal/computeProps.js.map +1 -1
  51. package/dist/node/sites/_internal/computeProps.js +2 -9
  52. package/dist/node/sites/_internal/computeProps.js.map +1 -1
  53. package/dist/node/surveys/_internal/computeProps.js +3 -9
  54. package/dist/node/surveys/_internal/computeProps.js.map +1 -1
  55. package/dist/node/templates/_internal/computeProps.js +4 -12
  56. package/dist/node/templates/_internal/computeProps.js.map +1 -1
  57. package/dist/types/content/index.d.ts +1 -0
  58. package/dist/types/content/isAGOHostedService.d.ts +9 -0
  59. package/dist/types/core/_internal/{computeBaseProps.d.ts → computeItemProps.d.ts} +1 -1
  60. package/package.json +1 -1
  61. package/dist/esm/core/_internal/computeBaseProps.js +0 -15
  62. package/dist/esm/core/_internal/computeBaseProps.js.map +0 -1
  63. package/dist/node/core/_internal/computeBaseProps.js +0 -19
  64. package/dist/node/core/_internal/computeBaseProps.js.map +0 -1
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computeProps = void 0;
4
- const utils_1 = require("../../discussions/utils");
5
4
  const processEntityFeatures_1 = require("../../permissions/_internal/processEntityFeatures");
6
5
  const TemplateBusinessRules_1 = require("./TemplateBusinessRules");
7
6
  const computeLinks_1 = require("./computeLinks");
8
7
  const objects_1 = require("../../objects");
9
- const utils_2 = require("../utils");
10
- const computeBaseProps_1 = require("../../core/_internal/computeBaseProps");
8
+ const utils_1 = require("../utils");
9
+ const computeItemProps_1 = require("../../core/_internal/computeItemProps");
11
10
  /**
12
11
  * @private
13
12
  * Given a model and a template, set various computed
@@ -19,23 +18,16 @@ const computeBaseProps_1 = require("../../core/_internal/computeBaseProps");
19
18
  */
20
19
  function computeProps(model, template, requestOptions) {
21
20
  // 1. compute base properties on template
22
- template = computeBaseProps_1.computeBaseProps(model.item, template);
21
+ template = computeItemProps_1.computeItemProps(model.item, template);
23
22
  // 2. compute relevant template links
24
23
  template.links = computeLinks_1.computeLinks(model.item, requestOptions);
25
24
  // 3. append the template's thumbnail url at the top-level
26
25
  template.thumbnailUrl = template.links.thumbnail;
27
- // 4. compute relevant template dates
28
- template.createdDate = new Date(model.item.created);
29
- template.createdDateSource = "item.created";
30
- template.updatedDate = new Date(model.item.modified);
31
- template.updatedDateSource = "item.modified";
32
- // 5. determine whether the template is discussable
33
- template.isDiscussable = utils_1.isDiscussable(template);
34
26
  // 6. process features that can be disabled by the entity owner
35
27
  template.features = processEntityFeatures_1.processEntityFeatures(objects_1.getProp(model, "data.settings.features") || {}, TemplateBusinessRules_1.TemplateDefaultFeatures);
36
28
  // 7. compute additional template-specific properties
37
29
  template.isDeployed = (objects_1.getProp(model, "item.typeKeywords") || []).includes("Deployed");
38
- template.deployedType = utils_2.getDeployedTemplateType(model.item);
30
+ template.deployedType = utils_1.getDeployedTemplateType(model.item);
39
31
  // 8. cast b/c this takes a partial but returns a full template
40
32
  return template;
41
33
  }
@@ -1 +1 @@
1
- {"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uB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE5D,+DAA+D;IAC/D,OAAO,QAAwB,CAAC;AAClC,CAAC;AArCD,oCAqCC"}
1
+ {"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/templates/_internal/computeProps.ts"],"names":[],"mappings":";;;AAEA,6FAA0F;AAE1F,mEAAkE;AAElE,iDAA8C;AAC9C,2CAAwC;AACxC,oCAAmD;AACnD,4EAAyE;AAEzE;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,KAAa,EACb,QAA+B,EAC/B,cAA+B;IAE/B,yCAAyC;IACzC,QAAQ,GAAG,mCAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAElD,qCAAqC;IACrC,QAAQ,CAAC,KAAK,GAAG,2BAAY,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAE1D,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;IAEjD,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,GAAG,6CAAqB,CACvC,iBAAO,CAAC,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE,EAC9C,+CAAuB,CACxB,CAAC;IAEF,qDAAqD;IACrD,QAAQ,CAAC,UAAU,GAAG,CAAC,iBAAO,CAAC,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CACxE,UAAU,CACX,CAAC;IACF,QAAQ,CAAC,YAAY,GAAG,+BAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE5D,+DAA+D;IAC/D,OAAO,QAAwB,CAAC;AAClC,CAAC;AA5BD,oCA4BC"}
@@ -13,3 +13,4 @@ export * from "./slugs";
13
13
  export * from "./types";
14
14
  export * from "./hostedServiceUtils";
15
15
  export * from "./fetchItemJobRecords";
16
+ export * from "./isAGOHostedService";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Used to determine if a service is hosted on ArcGIS Online
3
+ *
4
+ * Includes exlusion logic that prevents (secured) proxied services from returning true
5
+ * as we can't be sure if they are hosted or not
6
+ * @param url
7
+ * @returns true if the url is an ArcGIS Online hosted service
8
+ */
9
+ export declare function isAGOHostedService(url: string): boolean;
@@ -6,4 +6,4 @@ import { IHubItemEntity } from "../types";
6
6
  * @param entity IHubItemEntity
7
7
  * @returns
8
8
  */
9
- export declare function computeBaseProps<T extends Partial<IHubItemEntity>>(item: IItem, entity: T): T;
9
+ export declare function computeItemProps<T extends Partial<IHubItemEntity>>(item: IItem, entity: T): T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.184.0",
3
+ "version": "14.184.2",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1,15 +0,0 @@
1
- import { deriveLocationFromItem } from "../../content/_internal/internalContentUtils";
2
- /**
3
- * Base property mapping for item backed entity types
4
- * @param item IItem
5
- * @param entity IHubItemEntity
6
- * @returns
7
- */
8
- export function computeBaseProps(item, entity) {
9
- // TODO: Currently only location is determined for base
10
- // properties, but all properties that are commonly shared
11
- // across items should be moved here.
12
- entity.location = entity.location || deriveLocationFromItem(item);
13
- return entity;
14
- }
15
- //# sourceMappingURL=computeBaseProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeBaseProps.js","sourceRoot":"","sources":["../../../../src/core/_internal/computeBaseProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAW,EACX,MAAS;IAET,uDAAuD;IACvD,0DAA0D;IAC1D,qCAAqC;IACrC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computeBaseProps = void 0;
4
- const internalContentUtils_1 = require("../../content/_internal/internalContentUtils");
5
- /**
6
- * Base property mapping for item backed entity types
7
- * @param item IItem
8
- * @param entity IHubItemEntity
9
- * @returns
10
- */
11
- function computeBaseProps(item, entity) {
12
- // TODO: Currently only location is determined for base
13
- // properties, but all properties that are commonly shared
14
- // across items should be moved here.
15
- entity.location = entity.location || internalContentUtils_1.deriveLocationFromItem(item);
16
- return entity;
17
- }
18
- exports.computeBaseProps = computeBaseProps;
19
- //# sourceMappingURL=computeBaseProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeBaseProps.js","sourceRoot":"","sources":["../../../../src/core/_internal/computeBaseProps.ts"],"names":[],"mappings":";;;AAEA,uFAAsF;AAEtF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,IAAW,EACX,MAAS;IAET,uDAAuD;IACvD,0DAA0D;IAC1D,qCAAqC;IACrC,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,6CAAsB,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC;AATD,4CASC"}