@kwiz/common 1.0.101 → 1.0.102

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 (95) 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/types/libs/msal.types.js +26 -26
  6. package/lib/cjs/utils/sharepoint.rest/user.js +11 -11
  7. package/lib/esm/types/libs/msal.types.js +26 -26
  8. package/lib/esm/utils/sharepoint.rest/user.js +11 -11
  9. package/package.json +81 -81
  10. package/readme.md +17 -17
  11. package/src/_dependencies.ts +12 -12
  12. package/src/config.ts +17 -17
  13. package/src/helpers/Guid.ts +181 -181
  14. package/src/helpers/base64.ts +173 -173
  15. package/src/helpers/browser.test.js +13 -13
  16. package/src/helpers/browser.ts +1399 -1399
  17. package/src/helpers/browserinfo.ts +292 -292
  18. package/src/helpers/collections.base.test.js +25 -25
  19. package/src/helpers/collections.base.ts +437 -437
  20. package/src/helpers/collections.ts +107 -107
  21. package/src/helpers/color.ts +54 -54
  22. package/src/helpers/cookies.ts +59 -59
  23. package/src/helpers/date.test.js +119 -119
  24. package/src/helpers/date.ts +188 -188
  25. package/src/helpers/debug.ts +186 -186
  26. package/src/helpers/diagrams.ts +43 -43
  27. package/src/helpers/emails.ts +6 -6
  28. package/src/helpers/eval.ts +5 -5
  29. package/src/helpers/file.test.js +50 -50
  30. package/src/helpers/file.ts +63 -63
  31. package/src/helpers/flatted.ts +149 -149
  32. package/src/helpers/functions.ts +16 -16
  33. package/src/helpers/graph/calendar.types.ts +10 -10
  34. package/src/helpers/http.ts +69 -69
  35. package/src/helpers/images.ts +22 -22
  36. package/src/helpers/json.ts +44 -44
  37. package/src/helpers/md5.ts +189 -189
  38. package/src/helpers/objects.test.js +33 -33
  39. package/src/helpers/objects.ts +274 -274
  40. package/src/helpers/promises.test.js +37 -37
  41. package/src/helpers/promises.ts +165 -165
  42. package/src/helpers/random.ts +27 -27
  43. package/src/helpers/scheduler/scheduler.test.js +103 -103
  44. package/src/helpers/scheduler/scheduler.ts +131 -131
  45. package/src/helpers/sharepoint.ts +785 -785
  46. package/src/helpers/strings.test.js +122 -122
  47. package/src/helpers/strings.ts +337 -337
  48. package/src/helpers/typecheckers.test.js +34 -34
  49. package/src/helpers/typecheckers.ts +266 -266
  50. package/src/helpers/url.test.js +43 -43
  51. package/src/helpers/url.ts +207 -207
  52. package/src/helpers/urlhelper.ts +111 -111
  53. package/src/index.ts +6 -6
  54. package/src/types/auth.ts +54 -54
  55. package/src/types/common.types.ts +15 -15
  56. package/src/types/flatted.types.ts +59 -59
  57. package/src/types/globals.types.ts +6 -6
  58. package/src/types/graph/calendar.types.ts +80 -80
  59. package/src/types/knownscript.types.ts +18 -18
  60. package/src/types/libs/datajs.types.ts +28 -28
  61. package/src/types/libs/ics.types.ts +30 -30
  62. package/src/types/libs/msal.types.ts +49 -49
  63. package/src/types/locales.ts +124 -124
  64. package/src/types/localstoragecache.types.ts +8 -8
  65. package/src/types/location.types.ts +27 -27
  66. package/src/types/moment.ts +11 -11
  67. package/src/types/regex.types.ts +16 -16
  68. package/src/types/rest.types.ts +95 -95
  69. package/src/types/sharepoint.types.ts +1466 -1466
  70. package/src/types/sharepoint.utils.types.ts +287 -287
  71. package/src/utils/auth/common.ts +74 -74
  72. package/src/utils/auth/discovery.test.js +12 -12
  73. package/src/utils/auth/discovery.ts +132 -132
  74. package/src/utils/base64.ts +27 -27
  75. package/src/utils/consolelogger.ts +320 -320
  76. package/src/utils/date.ts +35 -35
  77. package/src/utils/emails.ts +24 -24
  78. package/src/utils/knownscript.ts +286 -286
  79. package/src/utils/localstoragecache.ts +446 -446
  80. package/src/utils/rest.ts +501 -501
  81. package/src/utils/script.ts +170 -170
  82. package/src/utils/sharepoint.rest/common.ts +154 -154
  83. package/src/utils/sharepoint.rest/date.ts +62 -62
  84. package/src/utils/sharepoint.rest/file.folder.ts +598 -598
  85. package/src/utils/sharepoint.rest/item.ts +547 -547
  86. package/src/utils/sharepoint.rest/list.ts +1481 -1481
  87. package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +774 -774
  88. package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +275 -275
  89. package/src/utils/sharepoint.rest/listutils/common.ts +206 -206
  90. package/src/utils/sharepoint.rest/location.ts +141 -141
  91. package/src/utils/sharepoint.rest/navigation-links.ts +86 -86
  92. package/src/utils/sharepoint.rest/user-search.ts +252 -252
  93. package/src/utils/sharepoint.rest/user.ts +491 -491
  94. package/src/utils/sharepoint.rest/web.ts +1384 -1384
  95. package/src/utils/sod.ts +194 -194
@@ -1,24 +1,24 @@
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 run npm-publish
23
- env:
24
- NODE_AUTH_TOKEN: ${{secrets.KWIZ_NPM_TOKEN}}
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 run npm-publish
23
+ env:
24
+ NODE_AUTH_TOKEN: ${{secrets.KWIZ_NPM_TOKEN}}
package/.madgerc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "fileExtensions": ["js", "ts"]
1
+ {
2
+ "fileExtensions": ["js", "ts"]
3
3
  }
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.
@@ -1,27 +1,27 @@
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
- });
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
27
  console.timeEnd("fixing direcry imports");
@@ -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
@@ -409,17 +409,17 @@ async function SetGroupOwner(siteUrl, groupId, ownerId, ownerIsAGroup) {
409
409
  try {
410
410
  let soapUrl = `${(0, common_1.GetSiteUrl)(siteUrl)}_vti_bin/client.svc/ProcessQuery`;
411
411
  let siteId = await (0, web_1.GetSiteId)(siteUrl);
412
- 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">
413
- <Actions>
414
- <SetProperty Id="1" ObjectPathId="2" Name="Owner">
415
- <Parameter ObjectPathId="3" />
416
- </SetProperty>
417
- <Method Name="Update" Id="4" ObjectPathId="2" />
418
- </Actions>
419
- <ObjectPaths>
420
- <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
421
- <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
422
- </ObjectPaths>
412
+ 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">
413
+ <Actions>
414
+ <SetProperty Id="1" ObjectPathId="2" Name="Owner">
415
+ <Parameter ObjectPathId="3" />
416
+ </SetProperty>
417
+ <Method Name="Update" Id="4" ObjectPathId="2" />
418
+ </Actions>
419
+ <ObjectPaths>
420
+ <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
421
+ <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
422
+ </ObjectPaths>
423
423
  </Request>`, {
424
424
  headers: {
425
425
  Accept: rest_types_1.jsonTypes.standard,
@@ -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
@@ -384,17 +384,17 @@ export async function SetGroupOwner(siteUrl, groupId, ownerId, ownerIsAGroup) {
384
384
  try {
385
385
  let soapUrl = `${GetSiteUrl(siteUrl)}_vti_bin/client.svc/ProcessQuery`;
386
386
  let siteId = await GetSiteId(siteUrl);
387
- 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">
388
- <Actions>
389
- <SetProperty Id="1" ObjectPathId="2" Name="Owner">
390
- <Parameter ObjectPathId="3" />
391
- </SetProperty>
392
- <Method Name="Update" Id="4" ObjectPathId="2" />
393
- </Actions>
394
- <ObjectPaths>
395
- <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
396
- <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
397
- </ObjectPaths>
387
+ 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">
388
+ <Actions>
389
+ <SetProperty Id="1" ObjectPathId="2" Name="Owner">
390
+ <Parameter ObjectPathId="3" />
391
+ </SetProperty>
392
+ <Method Name="Update" Id="4" ObjectPathId="2" />
393
+ </Actions>
394
+ <ObjectPaths>
395
+ <Identity Id="2" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${groupId}" />
396
+ <Identity Id="3" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:g:${ownerId}" />
397
+ </ObjectPaths>
398
398
  </Request>`, {
399
399
  headers: {
400
400
  Accept: jsonTypes.standard,
package/package.json CHANGED
@@ -1,81 +1,81 @@
1
- {
2
- "name": "@kwiz/common",
3
- "version": "1.0.101",
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
- "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.102",
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
+ "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 { 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,13 +1,13 @@
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;
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
13
  }
package/src/config.ts CHANGED
@@ -1,17 +1,17 @@
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
+ 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
+ }