chunk-65K7LC56.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import {
  2. p
  3. } from "./chunk-ATPLLI5W.js";
  4. import {
  5. d,
  6. e,
  7. l3 as l,
  8. n2 as n
  9. } from "./chunk-Y3WMVFTW.js";
  10. import {
  11. s3 as s
  12. } from "./chunk-EMJ4ZSM2.js";
  13. // node_modules/@arcgis/core/portal/PortalFolder.js
  14. var p2 = class extends l {
  15. constructor(t) {
  16. super(t), this.created = null, this.id = null, this.portal = null, this.title = null, this.username = null;
  17. }
  18. get url() {
  19. const t = this.get("portal.restUrl");
  20. return t ? `${t}/content/users/${this.username}/${this.id}` : null;
  21. }
  22. toJSON() {
  23. throw new s("internal:not-yet-implemented", "PortalFolder.toJSON is not yet implemented");
  24. }
  25. };
  26. e([d({ type: Date })], p2.prototype, "created", void 0), e([d()], p2.prototype, "id", void 0), e([d()], p2.prototype, "portal", void 0), e([d()], p2.prototype, "title", void 0), e([d({ readOnly: true })], p2.prototype, "url", null), e([d()], p2.prototype, "username", void 0), p2 = e([n("esri.portal.PortalFolder")], p2);
  27. var l2 = p2;
  28. // node_modules/@arcgis/core/portal/PortalUser.js
  29. var i;
  30. var u = i = class extends l {
  31. constructor(...t) {
  32. super(...t), this.access = null, this.created = null, this.culture = null, this.description = null, this.email = null, this.fullName = null, this.modified = null, this.orgId = null, this.portal = null, this.preferredView = null, this.privileges = null, this.region = null, this.role = null, this.roleId = null, this.sourceJSON = null, this.units = null, this.username = null, this.userType = null;
  33. }
  34. get thumbnailUrl() {
  35. const t = this.url, r = this.thumbnail;
  36. return t && r ? this.portal._normalizeUrl(`${t}/info/${r}?f=json`) : null;
  37. }
  38. get userContentUrl() {
  39. const t = this.get("portal.restUrl");
  40. return t ? `${t}/content/users/${this.username}` : null;
  41. }
  42. get url() {
  43. const t = this.get("portal.restUrl");
  44. return t ? `${t}/community/users/${this.username}` : null;
  45. }
  46. addItem(t) {
  47. const r = t && t.item, e2 = t && t.data, o = t && t.folder, s2 = { method: "post" };
  48. r && (s2.query = r.createPostQuery(), e2 != null && (typeof e2 == "string" ? s2.query.text = e2 : typeof e2 == "object" && (s2.query.text = JSON.stringify(e2))));
  49. let l3 = this.userContentUrl;
  50. return o && (l3 += "/" + (typeof o == "string" ? o : o.id)), this.portal._request(l3 + "/addItem", s2).then((t2) => (r.id = t2.id, r.portal = this.portal, r.loaded ? r.reload() : r.load()));
  51. }
  52. deleteItem(t) {
  53. let r = this.userContentUrl;
  54. return t.ownerFolder && (r += "/" + t.ownerFolder), this.portal._request(r + `/items/${t.id}/delete`, { method: "post" }).then(() => {
  55. t.id = null, t.portal = null;
  56. });
  57. }
  58. deleteItems(t) {
  59. const r = this.userContentUrl + "/deleteItems", e2 = t.map((t2) => t2.id);
  60. if (e2.length) {
  61. const o = { method: "post", query: { items: e2.join(",") } };
  62. return this.portal._request(r, o).then(() => {
  63. t.forEach((t2) => {
  64. t2.id = null, t2.portal = null;
  65. });
  66. });
  67. }
  68. return Promise.resolve(void 0);
  69. }
  70. fetchFolders() {
  71. const t = { query: { num: 1 } };
  72. return this.portal._request(this.userContentUrl, t).then((t2) => {
  73. let r;
  74. return r = t2 && t2.folders ? t2.folders.map((t3) => {
  75. const r2 = l2.fromJSON(t3);
  76. return r2.portal = this.portal, r2;
  77. }) : [], r;
  78. });
  79. }
  80. fetchGroups() {
  81. return this.portal._request(this.url).then((t) => {
  82. let r;
  83. return r = t && t.groups ? t.groups.map((t2) => {
  84. const r2 = p.fromJSON(t2);
  85. return r2.portal = this.portal, r2;
  86. }) : [], r;
  87. });
  88. }
  89. fetchItems(t) {
  90. t || (t = {});
  91. let r, e2 = this.userContentUrl;
  92. return t.folder && (e2 += "/" + t.folder.id), import("./PortalItem-VBDEEBID.js").then(({ default: o }) => {
  93. r = o;
  94. const s2 = { folders: false, num: t.num || 10, start: t.start || 1, sortField: t.sortField || "created", sortOrder: t.sortOrder || "asc" };
  95. return this.portal._request(e2, { query: s2 });
  96. }).then((t2) => {
  97. let e3;
  98. return t2 && t2.items ? (e3 = t2.items.map((t3) => {
  99. const e4 = r.fromJSON(t3);
  100. return e4.portal = this.portal, e4;
  101. }), Promise.all(e3.map((t3) => t3.load())).catch((t3) => t3).then(() => ({ items: e3, nextStart: t2.nextStart, total: t2.total }))) : { items: [], nextStart: -1, total: 0 };
  102. });
  103. }
  104. fetchTags() {
  105. return this.portal._request(this.url + "/tags").then((t) => t.tags);
  106. }
  107. getThumbnailUrl(t) {
  108. let r = this.thumbnailUrl;
  109. return r && t && (r += `&w=${t}`), r;
  110. }
  111. queryFavorites(t) {
  112. return this.favGroupId ? (this._favGroup || (this._favGroup = new p({ id: this.favGroupId, portal: this.portal })), this._favGroup.queryItems(t)) : Promise.reject(new s("internal:unknown", "Unknown internal error", { internalError: "Unknown favGroupId" }));
  113. }
  114. toJSON() {
  115. throw new s("internal:not-yet-implemented", "PortalGroup.toJSON is not yet implemented");
  116. }
  117. static fromJSON(t) {
  118. if (!t)
  119. return null;
  120. if (t.declaredClass)
  121. throw new Error("JSON object is already hydrated");
  122. const r = new i();
  123. return r.sourceJSON = t, r.read(t), r;
  124. }
  125. };
  126. e([d()], u.prototype, "access", void 0), e([d({ type: Date })], u.prototype, "created", void 0), e([d()], u.prototype, "culture", void 0), e([d()], u.prototype, "description", void 0), e([d()], u.prototype, "email", void 0), e([d()], u.prototype, "favGroupId", void 0), e([d()], u.prototype, "fullName", void 0), e([d({ type: Date })], u.prototype, "modified", void 0), e([d()], u.prototype, "orgId", void 0), e([d()], u.prototype, "portal", void 0), e([d()], u.prototype, "preferredView", void 0), e([d()], u.prototype, "privileges", void 0), e([d()], u.prototype, "region", void 0), e([d()], u.prototype, "role", void 0), e([d()], u.prototype, "roleId", void 0), e([d()], u.prototype, "sourceJSON", void 0), e([d()], u.prototype, "thumbnail", void 0), e([d({ readOnly: true })], u.prototype, "thumbnailUrl", null), e([d()], u.prototype, "units", void 0), e([d({ readOnly: true })], u.prototype, "userContentUrl", null), e([d({ readOnly: true })], u.prototype, "url", null), e([d()], u.prototype, "username", void 0), e([d()], u.prototype, "userType", void 0), u = i = e([n("esri.portal.PortalUser")], u);
  127. var p3 = u;
  128. export {
  129. p3 as p
  130. };
  131. //# sourceMappingURL=chunk-65K7LC56.js.map