@kwiz/common 1.0.90 → 1.0.92

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 (99) hide show
  1. package/.github/workflows/npm-publish.yml +24 -24
  2. package/.madgerc +2 -2
  3. package/LICENSE +21 -21
  4. package/fix-folder-imports.js +26 -26
  5. package/lib/cjs/helpers/browser.js +42 -20
  6. package/lib/cjs/helpers/browser.js.map +1 -1
  7. package/lib/cjs/types/libs/msal.types.js +26 -26
  8. package/lib/cjs/utils/sharepoint.rest/user.js +11 -11
  9. package/lib/esm/helpers/browser.js +42 -20
  10. package/lib/esm/helpers/browser.js.map +1 -1
  11. package/lib/esm/types/libs/msal.types.js +26 -26
  12. package/lib/esm/utils/sharepoint.rest/user.js +11 -11
  13. package/lib/types/helpers/browser.d.ts +1 -0
  14. package/package.json +81 -80
  15. package/readme.md +17 -17
  16. package/src/_dependencies.ts +12 -12
  17. package/src/config.ts +17 -17
  18. package/src/helpers/Guid.ts +181 -181
  19. package/src/helpers/base64.ts +173 -173
  20. package/src/helpers/browser.test.js +13 -13
  21. package/src/helpers/browser.ts +1386 -1358
  22. package/src/helpers/browserinfo.ts +292 -292
  23. package/src/helpers/collections.base.test.js +25 -25
  24. package/src/helpers/collections.base.ts +437 -437
  25. package/src/helpers/collections.ts +107 -107
  26. package/src/helpers/color.ts +54 -54
  27. package/src/helpers/cookies.ts +59 -59
  28. package/src/helpers/date.test.js +119 -119
  29. package/src/helpers/date.ts +188 -188
  30. package/src/helpers/debug.ts +186 -186
  31. package/src/helpers/emails.ts +6 -6
  32. package/src/helpers/eval.ts +5 -5
  33. package/src/helpers/file.test.js +50 -50
  34. package/src/helpers/file.ts +60 -60
  35. package/src/helpers/flatted.ts +149 -149
  36. package/src/helpers/functions.ts +16 -16
  37. package/src/helpers/graph/calendar.types.ts +10 -10
  38. package/src/helpers/http.ts +69 -69
  39. package/src/helpers/images.ts +22 -22
  40. package/src/helpers/json.ts +38 -38
  41. package/src/helpers/md5.ts +189 -189
  42. package/src/helpers/objects.test.js +33 -33
  43. package/src/helpers/objects.ts +274 -274
  44. package/src/helpers/promises.test.js +37 -37
  45. package/src/helpers/promises.ts +165 -165
  46. package/src/helpers/random.ts +27 -27
  47. package/src/helpers/scheduler/scheduler.test.js +103 -103
  48. package/src/helpers/scheduler/scheduler.ts +131 -131
  49. package/src/helpers/sharepoint.ts +776 -776
  50. package/src/helpers/strings.test.js +101 -101
  51. package/src/helpers/strings.ts +317 -317
  52. package/src/helpers/typecheckers.test.js +34 -34
  53. package/src/helpers/typecheckers.ts +266 -266
  54. package/src/helpers/url.test.js +43 -43
  55. package/src/helpers/url.ts +207 -207
  56. package/src/helpers/urlhelper.ts +111 -111
  57. package/src/index.ts +6 -6
  58. package/src/types/auth.ts +54 -54
  59. package/src/types/common.types.ts +15 -15
  60. package/src/types/flatted.types.ts +59 -59
  61. package/src/types/globals.types.ts +6 -6
  62. package/src/types/graph/calendar.types.ts +80 -80
  63. package/src/types/knownscript.types.ts +18 -18
  64. package/src/types/libs/datajs.types.ts +28 -28
  65. package/src/types/libs/ics.types.ts +30 -30
  66. package/src/types/libs/msal.types.ts +49 -49
  67. package/src/types/locales.ts +124 -124
  68. package/src/types/localstoragecache.types.ts +8 -8
  69. package/src/types/location.types.ts +27 -27
  70. package/src/types/moment.ts +11 -11
  71. package/src/types/regex.types.ts +16 -16
  72. package/src/types/rest.types.ts +95 -95
  73. package/src/types/sharepoint.types.ts +1465 -1465
  74. package/src/types/sharepoint.utils.types.ts +287 -287
  75. package/src/utils/auth/common.ts +74 -74
  76. package/src/utils/auth/discovery.test.js +12 -12
  77. package/src/utils/auth/discovery.ts +132 -132
  78. package/src/utils/base64.ts +27 -27
  79. package/src/utils/consolelogger.ts +320 -320
  80. package/src/utils/date.ts +35 -35
  81. package/src/utils/emails.ts +24 -24
  82. package/src/utils/knownscript.ts +286 -286
  83. package/src/utils/localstoragecache.ts +441 -441
  84. package/src/utils/rest.ts +501 -501
  85. package/src/utils/script.ts +170 -170
  86. package/src/utils/sharepoint.rest/common.ts +154 -154
  87. package/src/utils/sharepoint.rest/date.ts +62 -62
  88. package/src/utils/sharepoint.rest/file.folder.ts +598 -598
  89. package/src/utils/sharepoint.rest/item.ts +547 -547
  90. package/src/utils/sharepoint.rest/list.ts +1480 -1480
  91. package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +774 -774
  92. package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +275 -275
  93. package/src/utils/sharepoint.rest/listutils/common.ts +206 -206
  94. package/src/utils/sharepoint.rest/location.ts +141 -141
  95. package/src/utils/sharepoint.rest/navigation-links.ts +86 -86
  96. package/src/utils/sharepoint.rest/user-search.ts +252 -252
  97. package/src/utils/sharepoint.rest/user.ts +491 -491
  98. package/src/utils/sharepoint.rest/web.ts +1384 -1384
  99. package/src/utils/sod.ts +194 -194
package/src/utils/date.ts CHANGED
@@ -1,36 +1,36 @@
1
- import { isBoolean, isFunction } from "../helpers/typecheckers";
2
- import { LocaleKnownScript } from "./knownscript";
3
-
4
- /** return date format as yyyy-MM-ddTHH:mm:ssZ
5
- * Optionally: remove Z, remove seconds, or set time to zero
6
- */
7
- export function toIsoDateFormat(date: Date, options?: {
8
- zeroTime?: boolean;
9
- /** remove trailing Z (add do not add local time offset) */
10
- omitZ?: boolean;
11
- omitSeconds?: boolean;
12
- addLocalTimezoneOffset?: boolean;
13
- }): string {
14
- let omitZ = options && options.omitZ === true || false;
15
- let omitSeconds = options && options.omitSeconds === true || false;
16
- let zeroTime = options && options.zeroTime === true || false;
17
-
18
- let addLocalTimezoneOffset = options && isBoolean(options.addLocalTimezoneOffset)
19
- ? options.addLocalTimezoneOffset
20
- : omitZ !== true;
21
-
22
- let format = `yyyy-MM-ddT${zeroTime ? '00:00' : 'HH:mm'}${omitSeconds ? '' : zeroTime ? ':00' : ':ss'}${omitZ ? '' : 'Z'}`;
23
-
24
- if (!isFunction(date.format)) {
25
- LocaleKnownScript.loadSync();
26
- }
27
-
28
- let oDate = new Date(date.getTime());
29
- if (addLocalTimezoneOffset) {
30
- //If we do not omit Z, the caller wants to get the object's UTC time.
31
- //Date format will get the current local time - so we need to compensate.
32
- oDate = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
33
- }
34
- let o = oDate.format(format);
35
- return o;
1
+ import { isBoolean, isFunction } from "../helpers/typecheckers";
2
+ import { LocaleKnownScript } from "./knownscript";
3
+
4
+ /** return date format as yyyy-MM-ddTHH:mm:ssZ
5
+ * Optionally: remove Z, remove seconds, or set time to zero
6
+ */
7
+ export function toIsoDateFormat(date: Date, options?: {
8
+ zeroTime?: boolean;
9
+ /** remove trailing Z (add do not add local time offset) */
10
+ omitZ?: boolean;
11
+ omitSeconds?: boolean;
12
+ addLocalTimezoneOffset?: boolean;
13
+ }): string {
14
+ let omitZ = options && options.omitZ === true || false;
15
+ let omitSeconds = options && options.omitSeconds === true || false;
16
+ let zeroTime = options && options.zeroTime === true || false;
17
+
18
+ let addLocalTimezoneOffset = options && isBoolean(options.addLocalTimezoneOffset)
19
+ ? options.addLocalTimezoneOffset
20
+ : omitZ !== true;
21
+
22
+ let format = `yyyy-MM-ddT${zeroTime ? '00:00' : 'HH:mm'}${omitSeconds ? '' : zeroTime ? ':00' : ':ss'}${omitZ ? '' : 'Z'}`;
23
+
24
+ if (!isFunction(date.format)) {
25
+ LocaleKnownScript.loadSync();
26
+ }
27
+
28
+ let oDate = new Date(date.getTime());
29
+ if (addLocalTimezoneOffset) {
30
+ //If we do not omit Z, the caller wants to get the object's UTC time.
31
+ //Date format will get the current local time - so we need to compensate.
32
+ oDate = new Date(date.getTime() + (date.getTimezoneOffset() * 60000));
33
+ }
34
+ let o = oDate.format(format);
35
+ return o;
36
36
  }
@@ -1,25 +1,25 @@
1
- import { isValidEmail } from "../helpers/emails";
2
- import { GetJsonSync, longLocalCache } from "./rest";
3
-
4
-
5
- /** returns true if a valid email that is from a known free email provider */
6
- export function isFreeEmail(email: string) {
7
- if (isValidEmail(email)) {
8
- var freeEmailListData = GetJsonSync<string>("https://apps.kwizcom.com/products/common/scripts/free-email-list.txt", null, {
9
- ...longLocalCache,
10
- headers: {
11
- "content-type": "text/plain",
12
- "Accept": "*/*"
13
- }
14
- });
15
- var freeEmailList = freeEmailListData.success ? freeEmailListData.result.replace(/\r/g, '').split('\n') : [
16
- "gmail.com",
17
- "yaho.com",
18
- "live.com"
19
- ];
20
-
21
- if (freeEmailList.includes(email.split('@')[1].toLowerCase()))
22
- return true;
23
- }
24
- return false;
1
+ import { isValidEmail } from "../helpers/emails";
2
+ import { GetJsonSync, longLocalCache } from "./rest";
3
+
4
+
5
+ /** returns true if a valid email that is from a known free email provider */
6
+ export function isFreeEmail(email: string) {
7
+ if (isValidEmail(email)) {
8
+ var freeEmailListData = GetJsonSync<string>("https://apps.kwizcom.com/products/common/scripts/free-email-list.txt", null, {
9
+ ...longLocalCache,
10
+ headers: {
11
+ "content-type": "text/plain",
12
+ "Accept": "*/*"
13
+ }
14
+ });
15
+ var freeEmailList = freeEmailListData.success ? freeEmailListData.result.replace(/\r/g, '').split('\n') : [
16
+ "gmail.com",
17
+ "yaho.com",
18
+ "live.com"
19
+ ];
20
+
21
+ if (freeEmailList.includes(email.split('@')[1].toLowerCase()))
22
+ return true;
23
+ }
24
+ return false;
25
25
  }