@kwiz/node 1.0.12 → 1.0.13

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.
@@ -1,3 +1,3 @@
1
1
  import { AuthContextType, ITenantInfo } from "@kwiz/common";
2
2
  export declare function ConfigureSPOAuth(config?: AuthContextType): void;
3
- export declare function getAxiosConfigSharePoint(tenantInfo: ITenantInfo, hostName: string): Promise<import("axios").AxiosRequestConfig<any>>;
3
+ export declare function getAxiosConfigSharePoint(tenantInfo: ITenantInfo, hostName: string, clearCache?: boolean): Promise<import("axios").AxiosRequestConfig<any>>;
@@ -18,14 +18,14 @@ function ConfigureSPOAuth(config) {
18
18
  auth = config;
19
19
  }
20
20
  exports.ConfigureSPOAuth = ConfigureSPOAuth;
21
- function getAxiosConfigSharePoint(tenantInfo, hostName) {
21
+ function getAxiosConfigSharePoint(tenantInfo, hostName, clearCache) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
23
  if ((0, common_1.isNullOrUndefined)(auth))
24
24
  throw Error("Call ConfigureSPOAuth first");
25
25
  // only certificate supported
26
26
  // DisableCustomAppAuthentication property, that disable this kind of auth., however it can be overriden using this command:
27
27
  // Set-SPOTenant -DisableCustomAppAuthentication $false
28
- let token = yield (0, msal_1.GetMSALToken)(tenantInfo, (0, common_1.GetMSALSiteScope)(hostName), auth);
28
+ let token = yield (0, msal_1.GetMSALToken)(tenantInfo, (0, common_1.GetMSALSiteScope)(hostName), auth, clearCache);
29
29
  let config = (0, axios_1.getAxiosConfigBearer)(token, { contantType: "application/json; odata=nometadata" });
30
30
  return config;
31
31
  });
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/spo/common.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAiG;AACjG,uCAA4C;AAC5C,oCAAgD;AAEhD,IAAI,IAAI,GAAoB,IAAI,CAAC;AACjC,SAAgB,gBAAgB,CAAC,MAAwB;IACrD,IAAI,GAAG,MA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"}
@@ -1 +1 @@
1
- {"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../../src/spo/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
1
+ {"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../../src/SPO/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
@@ -1,3 +1,3 @@
1
1
  import { AuthContextType, ITenantInfo } from "@kwiz/common";
2
2
  /** client secret not supported by SharePoint, must use certificate */
3
- export declare function GetMSALToken(tenantInfo: ITenantInfo, scope: string, auth: AuthContextType): Promise<string>;
3
+ export declare function GetMSALToken(tenantInfo: ITenantInfo, scope: string, auth: AuthContextType, clearCache?: boolean): Promise<string>;
package/dist/auth/msal.js CHANGED
@@ -40,9 +40,12 @@ function GetApp(tenantInfo, auth) {
40
40
  return apps[key];
41
41
  }
42
42
  /** client secret not supported by SharePoint, must use certificate */
43
- function GetMSALToken(tenantInfo, scope, auth) {
43
+ function GetMSALToken(tenantInfo, scope, auth, clearCache) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
- let token = yield GetApp(tenantInfo, auth).acquireTokenByClientCredential({
45
+ const app = GetApp(tenantInfo, auth);
46
+ if (clearCache)
47
+ app.clearCache();
48
+ let token = yield app.acquireTokenByClientCredential({
46
49
  scopes: [`${scope}/.default`]
47
50
  });
48
51
  return token.accessToken;
@@ -1 +1 @@
1
- {"version":3,"file":"msal.js","sourceRoot":"","sources":["../../src/auth/msal.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAiE;AACjE,yCAAiF;AACjF,4GAA4G;AAC5G,kGAAkG;AAElG,IAAI,IAAI,GAAwD,EAAE,CAAC;AAEnE,SAAS,MAAM,CAAC,UAAuB,EAAE,IAAqB;IAC1D,IAAI,GAAG,GAAG,GAAG,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAA;IAC7D,IAAI,CAAC,IAAI,CAAC,GAA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I,CAAC,kBAAkB,EAAE,CAAA;IAC7D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,IAAI,CAAC,kBAAkB,KAAK,4BAAmB,CAAC,YAAY;YACxD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,yCAA6B,CAAC;gBAC5C,IAAI,EAAE;oBACF,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,SAAS,EAAE,UAAU,CAAC,YAAY;oBAClC,YAAY,EAAE,IAAI,CAAC,YAAY;iBAClC;aAEJ,CAAC;YACF,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,yCAA6B,CAAC;gBAC5C,IAAI,EAAE;oBACF,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,SAAS,EAAE,UAAU,CAAC,YAAY;oBAClC,iBAAiB,EAAE;wBACf,UAAU,EAAE,IAAI,CAAC,UAAU;wBAC3B,UAAU,EAAE,IAAI,CAAC,UAAU;qBAC9B;iBACJ;aAEJ,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,sEAAsE;AACtE,SAAsB,YAAY,CAAC,UAAuB,EAAE,KAAa,EAAE,IAAqB,EAAE,UAAoB;;QAClH,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,UAAU;YACV,GAAG,CAAC,UAAU,EAAE,CAAC;QACrB,IAAI,KAAK,GAAG,MAAM,GAAG,CAAC,8BAA8B,CAAC;YACjD,MAAM,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC;SAChC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC,WAAW,CAAC;IAC7B,CAAC;CAAA;AARD,oCAQC"}
@@ -1,5 +1,5 @@
1
+ export * from './SPO/exports-index';
1
2
  export * from './auth/exports-index';
2
3
  export * from './graph/exports-index';
3
- export * from './spo/exports-index';
4
4
  export * from './storage/exports-index';
5
5
  export * from './axios';
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SPO/exports-index"), exports);
17
18
  __exportStar(require("./auth/exports-index"), exports);
18
19
  __exportStar(require("./graph/exports-index"), exports);
19
- __exportStar(require("./spo/exports-index"), exports);
20
20
  __exportStar(require("./storage/exports-index"), exports);
21
21
  __exportStar(require("./axios"), exports);
22
22
  //# sourceMappingURL=exports-index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../src/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,wDAAsC;AACtC,sDAAoC;AACpC,0DAAwC;AACxC,0CAAwB"}
1
+ {"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../src/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,0DAAwC;AACxC,0CAAwB"}
@@ -2,4 +2,4 @@ import { AuthContextType, ITenantInfo } from "@kwiz/common";
2
2
  /** "https://graph.microsoft.com" */
3
3
  export declare const graphScope = "https://graph.microsoft.com";
4
4
  export declare function ConfigureGraphAuth(config?: AuthContextType): void;
5
- export declare function getAxiosConfigGraph(tenantInfo: ITenantInfo): Promise<import("axios").AxiosRequestConfig<any>>;
5
+ export declare function getAxiosConfigGraph(tenantInfo: ITenantInfo, clearCache?: boolean): Promise<import("axios").AxiosRequestConfig<any>>;
@@ -20,12 +20,12 @@ function ConfigureGraphAuth(config) {
20
20
  auth = config;
21
21
  }
22
22
  exports.ConfigureGraphAuth = ConfigureGraphAuth;
23
- function getAxiosConfigGraph(tenantInfo) {
23
+ function getAxiosConfigGraph(tenantInfo, clearCache) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  if ((0, common_1.isNullOrUndefined)(auth))
26
26
  throw Error("Call ConfigureGraphAuth first");
27
27
  // secret or certificate supported
28
- let token = yield (0, msal_1.GetMSALToken)(tenantInfo, exports.graphScope, auth);
28
+ let token = yield (0, msal_1.GetMSALToken)(tenantInfo, exports.graphScope, auth, clearCache);
29
29
  return (0, axios_1.getAxiosConfigBearer)(token);
30
30
  });
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/graph/graph.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA+E;AAC/E,uCAA4C;AAC5C,oCAAgD;AAEhD,oCAAoC;AACvB,QAAA,UAAU,GAAG,6BAA6B,CAAC;AAExD,IAAI,IAAI,GAAoB,IAAI,CAAC;AACjC,SAAgB,kBAAkB,CAAC,MAAwB;IACvD,IAAI,GAAG,MAAM,CAAC;AAClB,CAAC;AAFD,gDAEC;AACD,SAAsB,mBAAmB,CAAC,UAAuB;;QAC7D,IAAI,IAAA,0BAAiB,EAAC,IAAI,CAAC;YAAE,MAAM,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAE1E,kCAAkC;QAClC,IAAI,KAAK,GAAG,MAAM,IAAA,mBAAY,EAAC,UAAU,EAAE,kBAAU,EAAE,IAAI,CAAC,CAAC;QAC7D,OAAO,IAAA,4BAAoB,EAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CAAA;AAND,kDAMC"}
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/graph/graph.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA+E;AAC/E,uCAA4C;AAC5C,oCAAgD;AAEhD,oCAAoC;AACvB,QAAA,UAAU,GAAG,6BAA6B,CAAC;AAExD,IAAI,IAAI,GAAoB,IAAI,CAAC;AACjC,SAAgB,kBAAkB,CAAC,MAAwB;IACvD,IAAI,GAAG,MAAM,CAAC;AAClB,CAAC;AAFD,gDAEC;AACD,SAAsB,mBAAmB,CAAC,UAAuB,EAAE,UAAoB;;QACnF,IAAI,IAAA,0BAAiB,EAAC,IAAI,CAAC;YAAE,MAAM,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAE1E,kCAAkC;QAClC,IAAI,KAAK,GAAG,MAAM,IAAA,mBAAY,EAAC,UAAU,EAAE,kBAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACzE,OAAO,IAAA,4BAAoB,EAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CAAA;AAND,kDAMC"}
package/package.json CHANGED
@@ -1,78 +1,78 @@
1
- {
2
- "name": "@kwiz/node",
3
- "version": "1.0.12",
4
- "description": "KWIZ utilities and helpers for node applications",
5
- "module": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.js",
11
- "default": "./dist/index.js"
12
- },
13
- "./package.json": "./package.json"
14
- },
15
- "scripts": {
16
- "watch": "tsc -watch",
17
- "build": "npm run reindex-project && npm run test && tsc",
18
- "build-explain": "tsc --explainFiles",
19
- "check-dependencies": "madge --circular ./src",
20
- "create-link": "npm link",
21
- "test": "node --import tsx --test src",
22
- "npm-v-patch": "npm version patch",
23
- "npm-v-major": "npm version major",
24
- "npm-publish": "npm publish --access public",
25
- "reset-repo": "git fetch origin && git reset --hard origin/main",
26
- "__update-kwiz-packages": "npm install @kwiz/common@latest",
27
- "link-local-common": "npm link @kwiz/common",
28
- "reindex-project": "cti create ./src -i _dependencies -w -b -n -o exports-index.ts && node fix-folder-imports.js",
29
- "install-packages": "npm install azurite -g && npm ci",
30
- "startDevStorage": "azurite -s -l"
31
- },
32
- "repository": {
33
- "type": "git",
34
- "url": "git+https://github.com/KWizCom/node.git"
35
- },
36
- "keywords": [
37
- "KWIZ",
38
- "SharePoint",
39
- "SPO",
40
- "Teams",
41
- "Utilities",
42
- "Helpers",
43
- "Node"
44
- ],
45
- "author": "Shai Petel",
46
- "contributors": [
47
- "Shai Petel",
48
- "Kevin Vieira"
49
- ],
50
- "license": "MIT",
51
- "bugs": {
52
- "url": "https://github.com/KWizCom/node/issues",
53
- "email": "support@kwizcom.com"
54
- },
55
- "homepage": "https://github.com/KWizCom/node#readme",
56
- "private": false,
57
- "engines": {
58
- "node": ">=16"
59
- },
60
- "packageManager": "npm@9.5.1",
61
- "devDependencies": {
62
- "@types/node": "^18.19.21",
63
- "create-ts-index": "^1.14.0",
64
- "fs-extra": "^11.2.0",
65
- "madge": "^6.1.0",
66
- "tsx": "^4.7.1",
67
- "typescript": "^5.3.3"
68
- },
69
- "dependencies": {
70
- "@azure/data-tables": "^13.2.2",
71
- "@azure/msal-node": "^2.6.4",
72
- "@kwiz/common": "^1.0.19",
73
- "axios": "^1.6.7",
74
- "esbuild": "^0.19.12",
75
- "get-tsconfig": "^4.7.2",
76
- "resolve-pkg-maps": "^1.0.0"
77
- }
78
- }
1
+ {
2
+ "name": "@kwiz/node",
3
+ "version": "1.0.13",
4
+ "description": "KWIZ utilities and helpers for node applications",
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "scripts": {
16
+ "watch": "tsc -watch",
17
+ "build": "npm run reindex-project && npm run test && tsc",
18
+ "build-explain": "tsc --explainFiles",
19
+ "check-dependencies": "madge --circular ./src",
20
+ "create-link": "npm link",
21
+ "test": "node --import tsx --test src",
22
+ "npm-v-patch": "npm version patch",
23
+ "npm-v-major": "npm version major",
24
+ "npm-publish": "npm publish --access public",
25
+ "reset-repo": "git fetch origin && git reset --hard origin/main",
26
+ "__update-kwiz-packages": "npm install @kwiz/common@latest",
27
+ "link-local-common": "npm link @kwiz/common",
28
+ "reindex-project": "cti create ./src -i _dependencies -w -b -n -o exports-index.ts && node fix-folder-imports.js",
29
+ "install-packages": "npm install azurite -g && npm ci",
30
+ "startDevStorage": "azurite -s -l"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/KWizCom/node.git"
35
+ },
36
+ "keywords": [
37
+ "KWIZ",
38
+ "SharePoint",
39
+ "SPO",
40
+ "Teams",
41
+ "Utilities",
42
+ "Helpers",
43
+ "Node"
44
+ ],
45
+ "author": "Shai Petel",
46
+ "contributors": [
47
+ "Shai Petel",
48
+ "Kevin Vieira"
49
+ ],
50
+ "license": "MIT",
51
+ "bugs": {
52
+ "url": "https://github.com/KWizCom/node/issues",
53
+ "email": "support@kwizcom.com"
54
+ },
55
+ "homepage": "https://github.com/KWizCom/node#readme",
56
+ "private": false,
57
+ "engines": {
58
+ "node": ">=16"
59
+ },
60
+ "packageManager": "npm@9.5.1",
61
+ "devDependencies": {
62
+ "@types/node": "^18.19.21",
63
+ "create-ts-index": "^1.14.0",
64
+ "fs-extra": "^11.2.0",
65
+ "madge": "^6.1.0",
66
+ "tsx": "^4.7.1",
67
+ "typescript": "^5.3.3"
68
+ },
69
+ "dependencies": {
70
+ "@azure/data-tables": "^13.2.2",
71
+ "@azure/msal-node": "^2.6.4",
72
+ "@kwiz/common": "^1.0.19",
73
+ "axios": "^1.6.7",
74
+ "esbuild": "^0.19.12",
75
+ "get-tsconfig": "^4.7.2",
76
+ "resolve-pkg-maps": "^1.0.0"
77
+ }
78
+ }
@@ -6,12 +6,12 @@ var auth: AuthContextType = null;
6
6
  export function ConfigureSPOAuth(config?: AuthContextType) {
7
7
  auth = config;
8
8
  }
9
- export async function getAxiosConfigSharePoint(tenantInfo: ITenantInfo, hostName: string) {
9
+ export async function getAxiosConfigSharePoint(tenantInfo: ITenantInfo, hostName: string, clearCache?: boolean) {
10
10
  if (isNullOrUndefined(auth)) throw Error("Call ConfigureSPOAuth first");
11
11
  // only certificate supported
12
12
  // DisableCustomAppAuthentication property, that disable this kind of auth., however it can be overriden using this command:
13
13
  // Set-SPOTenant -DisableCustomAppAuthentication $false
14
- let token = await GetMSALToken(tenantInfo, GetMSALSiteScope(hostName), auth);
14
+ let token = await GetMSALToken(tenantInfo, GetMSALSiteScope(hostName), auth, clearCache);
15
15
  let config = getAxiosConfigBearer(token, { contantType: "application/json; odata=nometadata" });
16
16
  return config;
17
17
  }
package/src/auth/msal.ts CHANGED
@@ -33,8 +33,11 @@ function GetApp(tenantInfo: ITenantInfo, auth: AuthContextType) {
33
33
  }
34
34
 
35
35
  /** client secret not supported by SharePoint, must use certificate */
36
- export async function GetMSALToken(tenantInfo: ITenantInfo, scope: string, auth: AuthContextType) {
37
- let token = await GetApp(tenantInfo, auth).acquireTokenByClientCredential({
36
+ export async function GetMSALToken(tenantInfo: ITenantInfo, scope: string, auth: AuthContextType, clearCache?: boolean) {
37
+ const app = GetApp(tenantInfo, auth);
38
+ if (clearCache)
39
+ app.clearCache();
40
+ let token = await app.acquireTokenByClientCredential({
38
41
  scopes: [`${scope}/.default`]
39
42
  });
40
43
  return token.accessToken;
@@ -1,5 +1,5 @@
1
+ export * from './SPO/exports-index';
1
2
  export * from './auth/exports-index';
2
3
  export * from './graph/exports-index';
3
- export * from './spo/exports-index';
4
4
  export * from './storage/exports-index';
5
5
  export * from './axios';
@@ -9,10 +9,10 @@ var auth: AuthContextType = null;
9
9
  export function ConfigureGraphAuth(config?: AuthContextType) {
10
10
  auth = config;
11
11
  }
12
- export async function getAxiosConfigGraph(tenantInfo: ITenantInfo) {
12
+ export async function getAxiosConfigGraph(tenantInfo: ITenantInfo, clearCache?: boolean) {
13
13
  if (isNullOrUndefined(auth)) throw Error("Call ConfigureGraphAuth first");
14
14
 
15
15
  // secret or certificate supported
16
- let token = await GetMSALToken(tenantInfo, graphScope, auth);
16
+ let token = await GetMSALToken(tenantInfo, graphScope, auth, clearCache);
17
17
  return getAxiosConfigBearer(token);
18
18
  }
File without changes