@kwiz/common 1.0.149 → 1.0.151
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.
- package/.mocharc.js +12 -0
- package/lib/cjs/_dependencies.js +2 -2
- package/lib/cjs/_dependencies.js.map +1 -1
- package/lib/cjs/config.js +1 -2
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/helpers/base64.js +7 -8
- package/lib/cjs/helpers/base64.js.map +1 -1
- package/lib/cjs/helpers/browser.js +80 -93
- package/lib/cjs/helpers/browser.js.map +1 -1
- package/lib/cjs/helpers/browserinfo.js +10 -5
- package/lib/cjs/helpers/browserinfo.js.map +1 -1
- package/lib/cjs/helpers/collections.base.js +33 -34
- package/lib/cjs/helpers/collections.base.js.map +1 -1
- package/lib/cjs/helpers/collections.js +3 -4
- package/lib/cjs/helpers/collections.js.map +1 -1
- package/lib/cjs/helpers/color.js +3 -4
- package/lib/cjs/helpers/color.js.map +1 -1
- package/lib/cjs/helpers/cookies.js +5 -6
- package/lib/cjs/helpers/cookies.js.map +1 -1
- package/lib/cjs/helpers/date.js +17 -17
- package/lib/cjs/helpers/date.js.map +1 -1
- package/lib/cjs/helpers/debug.js +7 -8
- package/lib/cjs/helpers/debug.js.map +1 -1
- package/lib/cjs/helpers/emails.js +2 -2
- package/lib/cjs/helpers/emails.js.map +1 -1
- package/lib/cjs/helpers/eval.js +1 -2
- package/lib/cjs/helpers/eval.js.map +1 -1
- package/lib/cjs/helpers/file.js +4 -4
- package/lib/cjs/helpers/file.js.map +1 -1
- package/lib/cjs/helpers/flatted.js +2 -2
- package/lib/cjs/helpers/flatted.js.map +1 -1
- package/lib/cjs/helpers/functions.js +1 -2
- package/lib/cjs/helpers/functions.js.map +1 -1
- package/lib/cjs/helpers/graph/calendar.types.js +2 -3
- package/lib/cjs/helpers/graph/calendar.types.js.map +1 -1
- package/lib/cjs/helpers/http.js +3 -3
- package/lib/cjs/helpers/http.js.map +1 -1
- package/lib/cjs/helpers/json.js +3 -4
- package/lib/cjs/helpers/json.js.map +1 -1
- package/lib/cjs/helpers/md5.js +5 -2
- package/lib/cjs/helpers/md5.js.map +1 -1
- package/lib/cjs/helpers/objects.js +16 -16
- package/lib/cjs/helpers/objects.js.map +1 -1
- package/lib/cjs/helpers/promises.js +8 -9
- package/lib/cjs/helpers/promises.js.map +1 -1
- package/lib/cjs/helpers/random.js +2 -3
- package/lib/cjs/helpers/random.js.map +1 -1
- package/lib/cjs/helpers/scheduler/scheduler.js +4 -4
- package/lib/cjs/helpers/scheduler/scheduler.js.map +1 -1
- package/lib/cjs/helpers/sharepoint.js +57 -55
- package/lib/cjs/helpers/sharepoint.js.map +1 -1
- package/lib/cjs/helpers/strings.js +29 -30
- package/lib/cjs/helpers/strings.js.map +1 -1
- package/lib/cjs/helpers/typecheckers.js +36 -36
- package/lib/cjs/helpers/typecheckers.js.map +1 -1
- package/lib/cjs/helpers/url.js +14 -15
- package/lib/cjs/helpers/url.js.map +1 -1
- package/lib/cjs/utils/auth/common.js +11 -10
- package/lib/cjs/utils/auth/common.js.map +1 -1
- package/lib/cjs/utils/auth/discovery.js +4 -5
- package/lib/cjs/utils/auth/discovery.js.map +1 -1
- package/lib/cjs/utils/base64.js +1 -2
- package/lib/cjs/utils/base64.js.map +1 -1
- package/lib/cjs/utils/date.js +2 -3
- package/lib/cjs/utils/date.js.map +1 -1
- package/lib/cjs/utils/emails.js +1 -2
- package/lib/cjs/utils/emails.js.map +1 -1
- package/lib/cjs/utils/localstoragecache.js +8 -8
- package/lib/cjs/utils/localstoragecache.js.map +1 -1
- package/lib/cjs/utils/rest.js +52 -42
- package/lib/cjs/utils/rest.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/common.js +32 -27
- package/lib/cjs/utils/sharepoint.rest/common.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/date.js +8 -6
- package/lib/cjs/utils/sharepoint.rest/date.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/file.folder.js +28 -29
- package/lib/cjs/utils/sharepoint.rest/file.folder.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/item.js +33 -32
- package/lib/cjs/utils/sharepoint.rest/item.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/list.js +116 -72
- package/lib/cjs/utils/sharepoint.rest/list.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsByCaml.js +1 -2
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsById.js +2 -3
- package/lib/cjs/utils/sharepoint.rest/listutils/GetListItemsById.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/listutils/common.js +2 -2
- package/lib/cjs/utils/sharepoint.rest/listutils/common.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/location.js +2 -3
- package/lib/cjs/utils/sharepoint.rest/location.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/navigation-links.js +3 -4
- package/lib/cjs/utils/sharepoint.rest/navigation-links.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/user.js +26 -27
- package/lib/cjs/utils/sharepoint.rest/user.js.map +1 -1
- package/lib/cjs/utils/sharepoint.rest/web.js +109 -73
- package/lib/cjs/utils/sharepoint.rest/web.js.map +1 -1
- package/lib/esm/helpers/browser.js +8 -20
- package/lib/esm/helpers/browser.js.map +1 -1
- package/lib/esm/helpers/browserinfo.js +5 -1
- package/lib/esm/helpers/browserinfo.js.map +1 -1
- package/lib/esm/helpers/md5.js +4 -0
- package/lib/esm/helpers/md5.js.map +1 -1
- package/lib/esm/helpers/sharepoint.js +12 -10
- package/lib/esm/helpers/sharepoint.js.map +1 -1
- package/lib/esm/helpers/typecheckers.js +1 -1
- package/lib/esm/helpers/typecheckers.js.map +1 -1
- package/lib/esm/utils/auth/common.js +7 -5
- package/lib/esm/utils/auth/common.js.map +1 -1
- package/lib/esm/utils/rest.js +48 -38
- package/lib/esm/utils/rest.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/common.js +20 -16
- package/lib/esm/utils/sharepoint.rest/common.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/date.js +7 -4
- package/lib/esm/utils/sharepoint.rest/date.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/item.js +7 -6
- package/lib/esm/utils/sharepoint.rest/item.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/list.js +57 -13
- package/lib/esm/utils/sharepoint.rest/list.js.map +1 -1
- package/lib/esm/utils/sharepoint.rest/web.js +46 -9
- package/lib/esm/utils/sharepoint.rest/web.js.map +1 -1
- package/lib/types/helpers/browser.d.ts +1 -1
- package/lib/types/helpers/browserinfo.d.ts +1 -0
- package/lib/types/helpers/sharepoint.d.ts +1 -1
- package/lib/types/utils/sharepoint.rest/common.d.ts +2 -0
- package/lib/types/utils/sharepoint.rest/item.d.ts +4 -1
- package/lib/types/utils/sharepoint.rest/list.d.ts +11 -2
- package/lib/types/utils/sharepoint.rest/web.d.ts +3 -1
- package/package.json +12 -3
- package/test/auth.ts +31 -0
- package/test/hooks.ts +181 -0
- package/test/readme.md +61 -0
- package/test/sp/files-folders.ts +258 -0
- package/test/sp/items.ts +295 -0
- package/test/sp/lists.ts +679 -0
- package/test/sp/users.ts +57 -0
- package/test/sp/webs.ts +43 -0
package/test/sp/users.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
GetUserLoginName,
|
|
5
|
+
GetCurrentUser,
|
|
6
|
+
EnsureUser,
|
|
7
|
+
GetUser,
|
|
8
|
+
IUserInfo
|
|
9
|
+
} from "../../src";
|
|
10
|
+
|
|
11
|
+
describe("Users", function () {
|
|
12
|
+
|
|
13
|
+
specify("GetUserLoginName", async function () {
|
|
14
|
+
const loginName = await GetUserLoginName(this.siteUrl);
|
|
15
|
+
assert.strictEqual(typeof loginName, "string", "Login name should be a string");
|
|
16
|
+
assert.ok(loginName.length > 0, "Login name should not be empty");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
specify("GetCurrentUser", async function () {
|
|
20
|
+
const currentUser = await GetCurrentUser(this.siteUrl);
|
|
21
|
+
assert.strictEqual(typeof currentUser.Id, "number", "User ID should be a number");
|
|
22
|
+
assert.ok(currentUser.Id > 0, "User ID should be a positive number");
|
|
23
|
+
assert.strictEqual(typeof currentUser.LoginName, "string", "User LoginName should be a string");
|
|
24
|
+
assert.strictEqual(typeof currentUser.Title, "string", "User Title should be a string");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("GetUser", function () {
|
|
28
|
+
let currentUserId: number;
|
|
29
|
+
let currentUserLogin: string;
|
|
30
|
+
|
|
31
|
+
before(async function () {
|
|
32
|
+
({ Id: currentUserId, LoginName: currentUserLogin } = await GetCurrentUser(this.siteUrl));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
specify("get current user", async function () {
|
|
36
|
+
const retrievedUser = await GetUser(this.siteUrl, currentUserId);
|
|
37
|
+
assert.strictEqual(retrievedUser.Id, currentUserId, "Retrieved user ID should match the requested ID");
|
|
38
|
+
assert.strictEqual(retrievedUser.LoginName, currentUserLogin, "Retrieved user LoginName should match the current user's login name");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe("EnsureUser", function () {
|
|
43
|
+
let currentUserLogin: string;
|
|
44
|
+
let currentUserId: number;
|
|
45
|
+
|
|
46
|
+
before(async function () {
|
|
47
|
+
({ LoginName: currentUserLogin, Id: currentUserId } = await GetCurrentUser(this.siteUrl));
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
specify("ensures the current user", async function () {
|
|
51
|
+
const ensuredUser = await EnsureUser(this.siteUrl, currentUserLogin);
|
|
52
|
+
assert.strictEqual(ensuredUser.Id, currentUserId, "Ensured user's ID should match the current user's ID");
|
|
53
|
+
assert.strictEqual(ensuredUser.LoginName, currentUserLogin, "Ensured user's login name should match");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
});
|
|
57
|
+
});
|
package/test/sp/webs.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import {
|
|
3
|
+
GetSiteId,
|
|
4
|
+
GetWebId,
|
|
5
|
+
GetWebTitle,
|
|
6
|
+
GetAllSubWebs,
|
|
7
|
+
IsRootWeb,
|
|
8
|
+
isValidGuid,
|
|
9
|
+
normalizeGuid,
|
|
10
|
+
IWebBasicInfo
|
|
11
|
+
} from "../../src";
|
|
12
|
+
|
|
13
|
+
describe("Web", function () {
|
|
14
|
+
|
|
15
|
+
specify("GetSiteId", async function () {
|
|
16
|
+
const siteId = await GetSiteId(this.siteUrl);
|
|
17
|
+
assert.ok(siteId, "Site ID should be defined");
|
|
18
|
+
assert.ok(isValidGuid(siteId), "Site ID should be a valid GUID");
|
|
19
|
+
assert.strictEqual(siteId, this.siteId, "Site ID should match the ID of the test site");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
specify("GetWebId", async function () {
|
|
23
|
+
const webId = await GetWebId(this.siteUrl);
|
|
24
|
+
assert.strictEqual(typeof webId, "string", "Web ID should be a string");
|
|
25
|
+
assert.ok(isValidGuid(webId), "Web ID should be a valid GUID");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
specify("GetWebTitle", async function () {
|
|
29
|
+
const title = await GetWebTitle(this.siteUrl);
|
|
30
|
+
assert.strictEqual(typeof title, "string", "Web title should be a string");
|
|
31
|
+
assert.ok(title.includes("kwiz/common [integration tests]"), "Web title should match the expected format for the test site");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
specify("GetAllSubWebs", async function () {
|
|
35
|
+
const subWebs: IWebBasicInfo[] = await GetAllSubWebs(this.siteUrl);
|
|
36
|
+
assert.ok(Array.isArray(subWebs), "Result should be an array");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
specify("IsRootWeb", async function () {
|
|
40
|
+
const isRoot = await IsRootWeb(this.siteUrl);
|
|
41
|
+
assert.ok(typeof isRoot === "boolean", "IsRootWeb should return a boolean value");
|
|
42
|
+
});
|
|
43
|
+
});
|