jitz-sharepoint-utilities 2.0.8 → 2.0.10

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.
@@ -11,6 +11,7 @@ interface BigObject<T> {
11
11
  export default class List<T extends IModel> implements IList<T> {
12
12
  context: IJitzContext;
13
13
  listName: string;
14
+ listGuid: string;
14
15
  // _listId: string;
15
16
  _nextPageLink: string;
16
17
  // items: any[];
@@ -33,15 +34,21 @@ export default class List<T extends IModel> implements IList<T> {
33
34
  simpleFields: string[],
34
35
  userTypeFields: string[],
35
36
  lookUpFields: string[],
36
- additionalExpandFields: string[]
37
+ additionalExpandFields: string[],
38
+ listGuid: string = ""
37
39
  ) {
38
40
  this.context = jitzContext;
39
41
  this.listName = listName;
42
+ this.listGuid = listGuid;
40
43
  this.simpleFields = simpleFields || [];
41
44
  this.userTypeFields = userTypeFields || [];
42
45
  this.lookUpFields = lookUpFields || [];
43
46
  this.additionalExpandFields = additionalExpandFields || [];
44
- this.repository = new Repository<T>(this.context.spContext, listName);
47
+ this.repository = new Repository<T>(
48
+ this.context.spContext,
49
+ listName,
50
+ listGuid
51
+ );
45
52
  }
46
53
 
47
54
  getItems = async (
@@ -18,10 +18,10 @@ export default class Repository<T extends IModel> implements IRepository<T> {
18
18
  this.context = context;
19
19
  this.listName = listName;
20
20
  this.listGuid = listGuid;
21
- this.listUrl = `${this.context.siteUrl}/_api/web/lists/${
21
+ this.listUrl = `${this.context.siteUrl}/_api/web/lists${
22
22
  this.listGuid == ""
23
- ? "GetByTitle('" + this.listName + "')"
24
- : "lists(guid'" + this.listGuid + "')"
23
+ ? "/GetByTitle('" + this.listName + "')"
24
+ : "(guid'" + this.listGuid + "')"
25
25
  }`;
26
26
  }
27
27
 
@@ -5,6 +5,7 @@ import { IRepository } from "../interfaces/IRepository";
5
5
  export default class List<T extends IModel> implements IList<T> {
6
6
  context: IJitzContext;
7
7
  listName: string;
8
+ listGuid: string;
8
9
  _nextPageLink: string;
9
10
  top: number;
10
11
  indexLimit: number;
@@ -17,7 +18,7 @@ export default class List<T extends IModel> implements IList<T> {
17
18
  upperId: number;
18
19
  lowerId: number;
19
20
  orderBy?: string | undefined;
20
- constructor(jitzContext: IJitzContext, listName: string, simpleFields: string[], userTypeFields: string[], lookUpFields: string[], additionalExpandFields: string[]);
21
+ constructor(jitzContext: IJitzContext, listName: string, simpleFields: string[], userTypeFields: string[], lookUpFields: string[], additionalExpandFields: string[], listGuid?: string);
21
22
  getItems: (filters?: string, orderby?: string, top?: number, skip?: number) => Promise<T[]>;
22
23
  loadMore: () => Promise<T[]>;
23
24
  getItemsIndexed: (filterQuery?: string, orderby?: string, top?: number) => Promise<T[]>;
@@ -47,7 +47,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  var Repository_1 = require("./Repository");
49
49
  var List = /** @class */ (function () {
50
- function List(jitzContext, listName, simpleFields, userTypeFields, lookUpFields, additionalExpandFields) {
50
+ function List(jitzContext, listName, simpleFields, userTypeFields, lookUpFields, additionalExpandFields, listGuid) {
51
+ if (listGuid === void 0) { listGuid = ""; }
51
52
  var _this = this;
52
53
  // items: any[];
53
54
  this.top = 100;
@@ -450,11 +451,12 @@ var List = /** @class */ (function () {
450
451
  };
451
452
  this.context = jitzContext;
452
453
  this.listName = listName;
454
+ this.listGuid = listGuid;
453
455
  this.simpleFields = simpleFields || [];
454
456
  this.userTypeFields = userTypeFields || [];
455
457
  this.lookUpFields = lookUpFields || [];
456
458
  this.additionalExpandFields = additionalExpandFields || [];
457
- this.repository = new Repository_1.default(this.context.spContext, listName);
459
+ this.repository = new Repository_1.default(this.context.spContext, listName, listGuid);
458
460
  }
459
461
  List.prototype.loadMoreIndexed = function () {
460
462
  return __awaiter(this, void 0, void 0, function () {
@@ -43,9 +43,9 @@ var Repository = /** @class */ (function () {
43
43
  this.context = context;
44
44
  this.listName = listName;
45
45
  this.listGuid = listGuid;
46
- this.listUrl = "".concat(this.context.siteUrl, "/_api/web/lists/").concat(this.listGuid == ""
47
- ? "GetByTitle('" + this.listName + "')"
48
- : "lists(guid'" + this.listGuid + "')");
46
+ this.listUrl = "".concat(this.context.siteUrl, "/_api/web/lists").concat(this.listGuid == ""
47
+ ? "/GetByTitle('" + this.listName + "')"
48
+ : "(guid'" + this.listGuid + "')");
49
49
  }
50
50
  Repository.prototype.getAll = function (selectFields, expand, filters, orderBy, top, skip, skipTokenUniqueField, skipTokenUniqueFieldValue) {
51
51
  var queryUrlGetAllItems = "".concat(this.listUrl, "/items");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitz-sharepoint-utilities",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "Essential SharePoint utilities for SharePoint Add-in and SPFx development",
5
5
  "author": "Jithendra Mani",
6
6
  "license": "ISC",