@kwiz/common 1.0.129 → 1.0.133

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 (111) hide show
  1. package/LICENSE +21 -21
  2. package/lib/cjs/config.js +2 -0
  3. package/lib/cjs/config.js.map +1 -1
  4. package/lib/cjs/types/libs/msal.types.js +26 -26
  5. package/lib/cjs/utils/sharepoint.rest/user.js +11 -11
  6. package/lib/esm/config.js +2 -0
  7. package/lib/esm/config.js.map +1 -1
  8. package/lib/esm/types/libs/msal.types.js +26 -26
  9. package/lib/esm/utils/sharepoint.rest/user.js +11 -11
  10. package/lib/types/config.d.ts +2 -0
  11. package/package.json +81 -81
  12. package/readme.md +17 -17
  13. package/.github/workflows/npm-publish.yml +0 -24
  14. package/.madgerc +0 -3
  15. package/fix-folder-imports.js +0 -27
  16. package/src/_dependencies.ts +0 -13
  17. package/src/config.ts +0 -17
  18. package/src/exports-index.ts +0 -4
  19. package/src/helpers/Guid.ts +0 -182
  20. package/src/helpers/base64.ts +0 -174
  21. package/src/helpers/browser.test.js +0 -13
  22. package/src/helpers/browser.ts +0 -1505
  23. package/src/helpers/browserinfo.ts +0 -293
  24. package/src/helpers/collections.base.test.js +0 -26
  25. package/src/helpers/collections.base.ts +0 -438
  26. package/src/helpers/collections.ts +0 -108
  27. package/src/helpers/color.ts +0 -55
  28. package/src/helpers/cookies.ts +0 -60
  29. package/src/helpers/date.test.js +0 -120
  30. package/src/helpers/date.ts +0 -189
  31. package/src/helpers/debug.ts +0 -187
  32. package/src/helpers/diagrams.ts +0 -44
  33. package/src/helpers/emails.ts +0 -7
  34. package/src/helpers/eval.ts +0 -5
  35. package/src/helpers/exports-index.ts +0 -30
  36. package/src/helpers/file.test.js +0 -51
  37. package/src/helpers/file.ts +0 -64
  38. package/src/helpers/flatted.ts +0 -150
  39. package/src/helpers/functions.ts +0 -17
  40. package/src/helpers/graph/calendar.types.ts +0 -11
  41. package/src/helpers/graph/exports-index.ts +0 -1
  42. package/src/helpers/http.ts +0 -70
  43. package/src/helpers/images.ts +0 -23
  44. package/src/helpers/json.ts +0 -45
  45. package/src/helpers/md5.ts +0 -190
  46. package/src/helpers/objects.test.js +0 -34
  47. package/src/helpers/objects.ts +0 -275
  48. package/src/helpers/promises.test.js +0 -38
  49. package/src/helpers/promises.ts +0 -166
  50. package/src/helpers/random.ts +0 -27
  51. package/src/helpers/scheduler/exports-index.ts +0 -1
  52. package/src/helpers/scheduler/scheduler.test.js +0 -104
  53. package/src/helpers/scheduler/scheduler.ts +0 -132
  54. package/src/helpers/sharepoint.ts +0 -797
  55. package/src/helpers/strings.test.js +0 -123
  56. package/src/helpers/strings.ts +0 -338
  57. package/src/helpers/typecheckers.test.js +0 -35
  58. package/src/helpers/typecheckers.ts +0 -267
  59. package/src/helpers/url.test.js +0 -44
  60. package/src/helpers/url.ts +0 -208
  61. package/src/helpers/urlhelper.ts +0 -112
  62. package/src/index.ts +0 -6
  63. package/src/types/auth.ts +0 -63
  64. package/src/types/common.types.ts +0 -16
  65. package/src/types/exports-index.ts +0 -15
  66. package/src/types/flatted.types.ts +0 -60
  67. package/src/types/globals.types.ts +0 -7
  68. package/src/types/graph/calendar.types.ts +0 -81
  69. package/src/types/graph/exports-index.ts +0 -1
  70. package/src/types/knownscript.types.ts +0 -19
  71. package/src/types/libs/datajs.types.ts +0 -29
  72. package/src/types/libs/exports-index.ts +0 -3
  73. package/src/types/libs/ics.types.ts +0 -31
  74. package/src/types/libs/msal.types.ts +0 -58
  75. package/src/types/locales.ts +0 -126
  76. package/src/types/localstoragecache.types.ts +0 -9
  77. package/src/types/location.types.ts +0 -28
  78. package/src/types/moment.ts +0 -12
  79. package/src/types/regex.types.ts +0 -17
  80. package/src/types/rest.types.ts +0 -96
  81. package/src/types/sharepoint.types.ts +0 -1467
  82. package/src/types/sharepoint.utils.types.ts +0 -307
  83. package/src/utils/auth/common.ts +0 -119
  84. package/src/utils/auth/discovery.test.js +0 -13
  85. package/src/utils/auth/discovery.ts +0 -132
  86. package/src/utils/auth/exports-index.ts +0 -2
  87. package/src/utils/base64.ts +0 -28
  88. package/src/utils/consolelogger.ts +0 -334
  89. package/src/utils/date.ts +0 -173
  90. package/src/utils/emails.ts +0 -25
  91. package/src/utils/exports-index.ts +0 -11
  92. package/src/utils/knownscript.ts +0 -287
  93. package/src/utils/localstoragecache.ts +0 -447
  94. package/src/utils/rest.ts +0 -502
  95. package/src/utils/script.ts +0 -171
  96. package/src/utils/sharepoint.rest/common.ts +0 -160
  97. package/src/utils/sharepoint.rest/date.ts +0 -63
  98. package/src/utils/sharepoint.rest/exports-index.ts +0 -11
  99. package/src/utils/sharepoint.rest/file.folder.ts +0 -685
  100. package/src/utils/sharepoint.rest/item.ts +0 -547
  101. package/src/utils/sharepoint.rest/list.ts +0 -1572
  102. package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +0 -775
  103. package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +0 -275
  104. package/src/utils/sharepoint.rest/listutils/common.ts +0 -207
  105. package/src/utils/sharepoint.rest/listutils/exports-index.ts +0 -3
  106. package/src/utils/sharepoint.rest/location.ts +0 -142
  107. package/src/utils/sharepoint.rest/navigation-links.ts +0 -87
  108. package/src/utils/sharepoint.rest/user-search.ts +0 -253
  109. package/src/utils/sharepoint.rest/user.ts +0 -559
  110. package/src/utils/sharepoint.rest/web.ts +0 -1385
  111. package/src/utils/sod.ts +0 -195
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 KWIZ Corp
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 KWIZ Corp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/lib/cjs/config.js CHANGED
@@ -9,6 +9,8 @@ function config(params) {
9
9
  return consolelogger_1.ConsoleLogger.get(name, params.ProjectName);
10
10
  }
11
11
  return {
12
+ GetLogger,
13
+ /** @deprecated exported as GetLogger, which is how is used anyways */
12
14
  logger: GetLogger
13
15
  };
14
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAClD,yDAAsD;AAEtD,SAAgB,MAAM,CAAC,MAKtB;IACG,IAAA,+BAAe,EAAC,MAAM,CAAC,CAAC;IACxB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,6BAAa,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACH,MAAM,EAAE,SAAS;KACpB,CAAA;AACL,CAAC;AAbD,wBAaC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAClD,yDAAsD;AAEtD,SAAgB,MAAM,CAAC,MAKtB;IACG,IAAA,+BAAe,EAAC,MAAM,CAAC,CAAC;IACxB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,6BAAa,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACH,SAAS;QACT,uEAAuE;QACvE,MAAM,EAAE,SAAS;KACpB,CAAA;AACL,CAAC;AAfD,wBAeC"}
@@ -1,31 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MSALSampleLoginPopupScript = void 0;
4
- exports.MSALSampleLoginPopupScript = `<p id="msg">please wait...</p>
5
- <script>
6
- function finish() {
7
- try {
8
- var hash = window.location.hash;
9
- if (hash[0] === "#") hash = hash.slice(1);//get rid of #
10
- var hashDictionary = {};
11
- hash.split("&").forEach(function (keyValue) {
12
- if (keyValue !== "") {
13
- var vals = keyValue.split("=");
14
- hashDictionary[vals[0]] = decodeURIComponent(vals[1]);
15
- }
16
- });
17
- if (Object.keys(hashDictionary).length < 1)
18
- window.close();//we lose the hash!
19
- else if (hashDictionary.error && hashDictionary.error_description)
20
- document.getElementById("msg").innerHTML = hashDictionary.error_description.replace(/\\+/g," ").replace(/\\n/g,"<br /><br />");
21
- else if (hashDictionary.state) {
22
- var origin = hashDictionary.state.split("|")[1];
23
- if (origin) {
24
- window.location.href = origin.split("#")[0] + window.location.hash;
25
- }
26
- }
27
- } catch (e) { }
28
- }
29
- finish();
4
+ exports.MSALSampleLoginPopupScript = `<p id="msg">please wait...</p>
5
+ <script>
6
+ function finish() {
7
+ try {
8
+ var hash = window.location.hash;
9
+ if (hash[0] === "#") hash = hash.slice(1);//get rid of #
10
+ var hashDictionary = {};
11
+ hash.split("&").forEach(function (keyValue) {
12
+ if (keyValue !== "") {
13
+ var vals = keyValue.split("=");
14
+ hashDictionary[vals[0]] = decodeURIComponent(vals[1]);
15
+ }
16
+ });
17
+ if (Object.keys(hashDictionary).length < 1)
18
+ window.close();//we lose the hash!
19
+ else if (hashDictionary.error && hashDictionary.error_description)
20
+ document.getElementById("msg").innerHTML = hashDictionary.error_description.replace(/\\+/g," ").replace(/\\n/g,"<br /><br />");
21
+ else if (hashDictionary.state) {
22
+ var origin = hashDictionary.state.split("|")[1];
23
+ if (origin) {
24
+ window.location.href = origin.split("#")[0] + window.location.hash;
25
+ }
26
+ }
27
+ } catch (e) { }
28
+ }
29
+ finish();
30
30
  </script>`;
31
31
  //# sourceMappingURL=msal.types.js.map
@@ -410,17 +410,17 @@ async function SetGroupOwner(siteUrl, groupId, ownerId, ownerIsAGroup) {
410
410
  try {
411
411
  let soapUrl = `${(0, common_1.GetSiteUrl)(siteUrl)}_vti_bin/client.svc/ProcessQuery`;
412
412
  let siteId = await (0, web_1.GetSiteId)(siteUrl);
413
- let serviceJSONResponse = await (0, rest_1.GetJson)(soapUrl, `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
414
- <Actions>
415
- <SetProperty Id="1" ObjectPathId="2" Name="Owner">
416
- <Parameter ObjectPathId="3" />
417
- </SetProperty>
418
- <Method Name="Update" Id="4" ObjectPathId="2" />
419
- </Actions>
420
- <ObjectPaths>
421
- <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
422
- <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
423
- </ObjectPaths>
413
+ let serviceJSONResponse = await (0, rest_1.GetJson)(soapUrl, `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
414
+ <Actions>
415
+ <SetProperty Id="1" ObjectPathId="2" Name="Owner">
416
+ <Parameter ObjectPathId="3" />
417
+ </SetProperty>
418
+ <Method Name="Update" Id="4" ObjectPathId="2" />
419
+ </Actions>
420
+ <ObjectPaths>
421
+ <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
422
+ <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
423
+ </ObjectPaths>
424
424
  </Request>`, {
425
425
  headers: {
426
426
  Accept: rest_types_1.jsonTypes.standard,
package/lib/esm/config.js CHANGED
@@ -6,6 +6,8 @@ export function config(params) {
6
6
  return ConsoleLogger.get(name, params.ProjectName);
7
7
  }
8
8
  return {
9
+ GetLogger,
10
+ /** @deprecated exported as GetLogger, which is how is used anyways */
9
11
  logger: GetLogger
10
12
  };
11
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,UAAU,MAAM,CAAC,MAKtB;IACG,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACH,MAAM,EAAE,SAAS;KACpB,CAAA;AACL,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,UAAU,MAAM,CAAC,MAKtB;IACG,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACH,SAAS;QACT,uEAAuE;QACvE,MAAM,EAAE,SAAS;KACpB,CAAA;AACL,CAAC"}
@@ -1,28 +1,28 @@
1
- export const MSALSampleLoginPopupScript = `<p id="msg">please wait...</p>
2
- <script>
3
- function finish() {
4
- try {
5
- var hash = window.location.hash;
6
- if (hash[0] === "#") hash = hash.slice(1);//get rid of #
7
- var hashDictionary = {};
8
- hash.split("&").forEach(function (keyValue) {
9
- if (keyValue !== "") {
10
- var vals = keyValue.split("=");
11
- hashDictionary[vals[0]] = decodeURIComponent(vals[1]);
12
- }
13
- });
14
- if (Object.keys(hashDictionary).length < 1)
15
- window.close();//we lose the hash!
16
- else if (hashDictionary.error && hashDictionary.error_description)
17
- document.getElementById("msg").innerHTML = hashDictionary.error_description.replace(/\\+/g," ").replace(/\\n/g,"<br /><br />");
18
- else if (hashDictionary.state) {
19
- var origin = hashDictionary.state.split("|")[1];
20
- if (origin) {
21
- window.location.href = origin.split("#")[0] + window.location.hash;
22
- }
23
- }
24
- } catch (e) { }
25
- }
26
- finish();
1
+ export const MSALSampleLoginPopupScript = `<p id="msg">please wait...</p>
2
+ <script>
3
+ function finish() {
4
+ try {
5
+ var hash = window.location.hash;
6
+ if (hash[0] === "#") hash = hash.slice(1);//get rid of #
7
+ var hashDictionary = {};
8
+ hash.split("&").forEach(function (keyValue) {
9
+ if (keyValue !== "") {
10
+ var vals = keyValue.split("=");
11
+ hashDictionary[vals[0]] = decodeURIComponent(vals[1]);
12
+ }
13
+ });
14
+ if (Object.keys(hashDictionary).length < 1)
15
+ window.close();//we lose the hash!
16
+ else if (hashDictionary.error && hashDictionary.error_description)
17
+ document.getElementById("msg").innerHTML = hashDictionary.error_description.replace(/\\+/g," ").replace(/\\n/g,"<br /><br />");
18
+ else if (hashDictionary.state) {
19
+ var origin = hashDictionary.state.split("|")[1];
20
+ if (origin) {
21
+ window.location.href = origin.split("#")[0] + window.location.hash;
22
+ }
23
+ }
24
+ } catch (e) { }
25
+ }
26
+ finish();
27
27
  </script>`;
28
28
  //# sourceMappingURL=msal.types.js.map
@@ -385,17 +385,17 @@ export async function SetGroupOwner(siteUrl, groupId, ownerId, ownerIsAGroup) {
385
385
  try {
386
386
  let soapUrl = `${GetSiteUrl(siteUrl)}_vti_bin/client.svc/ProcessQuery`;
387
387
  let siteId = await GetSiteId(siteUrl);
388
- let serviceJSONResponse = await GetJson(soapUrl, `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
389
- <Actions>
390
- <SetProperty Id="1" ObjectPathId="2" Name="Owner">
391
- <Parameter ObjectPathId="3" />
392
- </SetProperty>
393
- <Method Name="Update" Id="4" ObjectPathId="2" />
394
- </Actions>
395
- <ObjectPaths>
396
- <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
397
- <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
398
- </ObjectPaths>
388
+ let serviceJSONResponse = await GetJson(soapUrl, `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
389
+ <Actions>
390
+ <SetProperty Id="1" ObjectPathId="2" Name="Owner">
391
+ <Parameter ObjectPathId="3" />
392
+ </SetProperty>
393
+ <Method Name="Update" Id="4" ObjectPathId="2" />
394
+ </Actions>
395
+ <ObjectPaths>
396
+ <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
397
+ <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
398
+ </ObjectPaths>
399
399
  </Request>`, {
400
400
  headers: {
401
401
  Accept: jsonTypes.standard,
@@ -5,5 +5,7 @@ export declare function config(params: {
5
5
  ReleaseStatus?: string;
6
6
  ProjectName?: string;
7
7
  }): {
8
+ GetLogger: (name: string) => ConsoleLogger;
9
+ /** @deprecated exported as GetLogger, which is how is used anyways */
8
10
  logger: (name: string) => ConsoleLogger;
9
11
  };
package/package.json CHANGED
@@ -1,81 +1,81 @@
1
- {
2
- "name": "@kwiz/common",
3
- "version": "1.0.129",
4
- "description": "KWIZ common utilities and helpers for M365 platform",
5
- "main": "lib/cjs/index.js",
6
- "module": "lib/esm/index.js",
7
- "types": "lib/types/index.d.ts",
8
- "sideEffects": [
9
- "*.scss*",
10
- "lib/esm/helpers/debug.js",
11
- "lib/esm/config.js"
12
- ],
13
- "exports": {
14
- ".": {
15
- "types": "./lib/types/index.d.ts",
16
- "import": "./lib/esm/index.js",
17
- "require": "./lib/cjs/index.js"
18
- },
19
- "./package.json": "./package.json"
20
- },
21
- "scripts": {
22
- "watch": "npm-run-all --parallel watch:esm watch:cjs",
23
- "watch:esm": "tsc -p tsconfig.esm.json -watch",
24
- "watch:cjs": "tsc -p tsconfig.cjs.json -watch",
25
- "build": "npm run reindex-project && npm run test && npm run build:esm && npm run build:cjs",
26
- "build:esm": "tsc -p tsconfig.esm.json",
27
- "build:cjs": "tsc -p tsconfig.cjs.json",
28
- "build-explain": "tsc --explainFiles",
29
- "check-dependencies": "madge --circular ./src",
30
- "create-link": "npm link",
31
- "test": "node --import tsx --test src",
32
- "npm-v-patch": "npm version patch && git push origin main:main && git push --tags",
33
- "npm-v-major": "npm version major && git push origin main:main && git push --tags",
34
- "___do_not_use_npm-publish": "npm publish --access public",
35
- "reset-repo": "git fetch origin && git reset --hard origin/main",
36
- "reindex-project": "cti create ./src -i _dependencies -w -b -n -o exports-index.ts && node fix-folder-imports.js"
37
- },
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/KWizCom/common.git"
41
- },
42
- "keywords": [
43
- "KWIZ",
44
- "SharePoint",
45
- "SPO",
46
- "Teams",
47
- "Utilities",
48
- "Helpers"
49
- ],
50
- "author": "Shai Petel",
51
- "contributors": [
52
- "Shai Petel",
53
- "Kevin Vieira"
54
- ],
55
- "license": "MIT",
56
- "bugs": {
57
- "url": "https://github.com/KWizCom/common/issues",
58
- "email": "support@kwizcom.com"
59
- },
60
- "homepage": "https://github.com/KWizCom/common#readme",
61
- "private": false,
62
- "engines": {
63
- "node": ">=16"
64
- },
65
- "packageManager": "npm@9.5.1",
66
- "devDependencies": {
67
- "@types/dom-navigation": "^1.0.4",
68
- "create-ts-index": "^1.14.0",
69
- "fs-extra": "^11.2.0",
70
- "madge": "^6.1.0",
71
- "npm-run-all": "^4.1.5",
72
- "tsx": "^4.7.1",
73
- "typescript": "^5.3.3",
74
- "xhr2": "^0.2.1"
75
- },
76
- "dependencies": {
77
- "esbuild": "^0.19.12",
78
- "get-tsconfig": "^4.7.2",
79
- "resolve-pkg-maps": "^1.0.0"
80
- }
81
- }
1
+ {
2
+ "name": "@kwiz/common",
3
+ "version": "1.0.133",
4
+ "description": "KWIZ common utilities and helpers for M365 platform",
5
+ "main": "lib/cjs/index.js",
6
+ "module": "lib/esm/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "sideEffects": [
9
+ "*.scss*",
10
+ "lib/esm/helpers/debug.js",
11
+ "lib/esm/config.js"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./lib/types/index.d.ts",
16
+ "import": "./lib/esm/index.js",
17
+ "require": "./lib/cjs/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "scripts": {
22
+ "watch": "npm-run-all --parallel watch:esm watch:cjs",
23
+ "watch:esm": "tsc -p tsconfig.esm.json -watch",
24
+ "watch:cjs": "tsc -p tsconfig.cjs.json -watch",
25
+ "build": "npm run reindex-project && npm run test && npm run build:esm && npm run build:cjs",
26
+ "build:esm": "tsc -p tsconfig.esm.json",
27
+ "build:cjs": "tsc -p tsconfig.cjs.json",
28
+ "build-explain": "tsc --explainFiles",
29
+ "check-dependencies": "madge --circular ./src",
30
+ "create-link": "npm link",
31
+ "test": "node --import tsx --test src",
32
+ "npm-v-patch": "npm version patch && git push origin main:main && git push --tags",
33
+ "npm-v-major": "npm version major && git push origin main:main && git push --tags",
34
+ "___do_not_use_npm-publish": "npm publish --access public",
35
+ "reset-repo": "git fetch origin && git reset --hard origin/main",
36
+ "reindex-project": "cti create ./src -i _dependencies -w -b -n -o exports-index.ts && node fix-folder-imports.js"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/KWizCom/common.git"
41
+ },
42
+ "keywords": [
43
+ "KWIZ",
44
+ "SharePoint",
45
+ "SPO",
46
+ "Teams",
47
+ "Utilities",
48
+ "Helpers"
49
+ ],
50
+ "author": "Shai Petel",
51
+ "contributors": [
52
+ "Shai Petel",
53
+ "Kevin Vieira"
54
+ ],
55
+ "license": "MIT",
56
+ "bugs": {
57
+ "url": "https://github.com/KWizCom/common/issues",
58
+ "email": "support@kwizcom.com"
59
+ },
60
+ "homepage": "https://github.com/KWizCom/common#readme",
61
+ "private": false,
62
+ "engines": {
63
+ "node": ">=16"
64
+ },
65
+ "packageManager": "npm@9.5.1",
66
+ "devDependencies": {
67
+ "@types/dom-navigation": "^1.0.4",
68
+ "create-ts-index": "^1.14.0",
69
+ "fs-extra": "^11.2.0",
70
+ "madge": "^6.1.0",
71
+ "npm-run-all": "^4.1.5",
72
+ "tsx": "^4.7.1",
73
+ "typescript": "^5.3.3",
74
+ "xhr2": "^0.2.1"
75
+ },
76
+ "dependencies": {
77
+ "esbuild": "^0.19.12",
78
+ "get-tsconfig": "^4.7.2",
79
+ "resolve-pkg-maps": "^1.0.0"
80
+ }
81
+ }
package/readme.md CHANGED
@@ -1,17 +1,17 @@
1
- # KWIZ Common Repo
2
-
3
- A collection of common helpers and utilities used across KWIZ projects
4
-
5
- To get started, configure our modules to your project by calling config:
6
-
7
- ```
8
- import { config } from "@kwiz/common";
9
- export const { logger: GetLogger } = config({
10
- BuildNumber: BuildNumber,
11
- //send true to have verbose logs and turn on debug mode
12
- IsLocalDev: IsLocalDev,
13
- ReleaseStatus: ReleaseStatus,
14
- //prefix logger with your project name
15
- ProjectName: "[cms]"
16
- });
17
- ```
1
+ # KWIZ Common Repo
2
+
3
+ A collection of common helpers and utilities used across KWIZ projects
4
+
5
+ To get started, configure our modules to your project by calling config:
6
+
7
+ ```
8
+ import { config } from "@kwiz/common";
9
+ export const { GetLogger } = config({
10
+ BuildNumber: BuildNumber,
11
+ //send true to have verbose logs and turn on debug mode
12
+ IsLocalDev: IsLocalDev,
13
+ ReleaseStatus: ReleaseStatus,
14
+ //prefix logger with your project name
15
+ ProjectName: "[cms]"
16
+ });
17
+ ```
@@ -1,24 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- push:
8
- tags:
9
- - 'v*.*.*' # run every time we commit with a new version number
10
-
11
- jobs:
12
- build-publish-npm:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v4
17
- with:
18
- node-version: 18
19
- registry-url: https://registry.npmjs.org/
20
- - run: npm ci
21
- - run: npm run build
22
- - run: npm publish --access public
23
- env:
24
- NODE_AUTH_TOKEN: ${{secrets.KWIZ_NPM_TOKEN}}
package/.madgerc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "fileExtensions": ["js", "ts"]
3
- }
@@ -1,27 +0,0 @@
1
- const glob = require('glob');
2
- const fs = require("fs-extra");
3
- const exportsFileName = "exports-index";
4
- const exportsFileNameWithExt = `${exportsFileName}.ts`;
5
- const exportsIndexFiles = glob.sync(`./src/**/${exportsFileNameWithExt}`);
6
- //loop every exportsIndexFiles and find any import to a directory, and replace with /exports-index
7
- console.time("fixing direcry imports");
8
- exportsIndexFiles.forEach(file => {
9
- var content = fs.readFileSync(file, "utf8").split("\n");
10
- var parentFolderContent = fs.readdirSync(file.replace(exportsFileNameWithExt, ''));
11
- var hasChanges = false;
12
- //loop every import - if it does not match a file in the folder, but matches a sub-folder - append exports-index to it
13
- content.forEach((line, idx) => {
14
- if (line.replace(/ /g, '').length > 0) {
15
- let importName = line.slice(line.indexOf('./') + 2, line.length - 2);
16
- if (parentFolderContent.includes(importName))//its a folder, otherwise it would be .ts
17
- {
18
- content[idx] = line.replace(`./${importName}`, `./${importName}/${exportsFileName}`);
19
- hasChanges = true;
20
- }
21
- }
22
- });
23
- if (hasChanges) {
24
- fs.writeFileSync(file, content.join('\n'));
25
- }
26
- });
27
- console.timeEnd("fixing direcry imports");
@@ -1,13 +0,0 @@
1
-
2
- export var BuildNumber = "unset";
3
- export var IsLocalDev = false;
4
- export var ReleaseStatus = "npm";
5
- export function SetDependencies(params: {
6
- BuildNumber?: string;
7
- IsLocalDev?: boolean;
8
- ReleaseStatus?: string;
9
- }) {
10
- if (typeof params.BuildNumber === "string") BuildNumber = params.BuildNumber;
11
- if (typeof params.IsLocalDev === "boolean") IsLocalDev = params.IsLocalDev;
12
- if (typeof params.ReleaseStatus === "string") ReleaseStatus = params.ReleaseStatus;
13
- }
package/src/config.ts DELETED
@@ -1,17 +0,0 @@
1
- import { SetDependencies } from './_dependencies';
2
- import { ConsoleLogger } from './utils/consolelogger';
3
-
4
- export function config(params: {
5
- BuildNumber?: string;
6
- IsLocalDev?: boolean;
7
- ReleaseStatus?: string;
8
- ProjectName?: string;
9
- }) {
10
- SetDependencies(params);
11
- function GetLogger(name: string) {
12
- return ConsoleLogger.get(name, params.ProjectName);
13
- }
14
- return {
15
- logger: GetLogger
16
- }
17
- }
@@ -1,4 +0,0 @@
1
- export * from './helpers/exports-index';
2
- export * from './types/exports-index';
3
- export * from './utils/exports-index';
4
- export * from './config';