@kwiz/node 1.0.5 → 1.0.7
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/dist/SPO/common.js +20 -9
- package/dist/SPO/common.js.map +1 -1
- package/dist/SPO/exports-index.d.ts +1 -0
- package/dist/SPO/exports-index.js +18 -0
- package/dist/SPO/exports-index.js.map +1 -0
- package/dist/auth/discovery.js +12 -3
- package/dist/auth/discovery.js.map +1 -1
- package/dist/auth/exports-index.d.ts +2 -0
- package/dist/auth/exports-index.js +19 -0
- package/dist/auth/exports-index.js.map +1 -0
- package/dist/auth/msal.js +15 -4
- package/dist/auth/msal.js.map +1 -1
- package/dist/exports-index.d.ts +3 -0
- package/dist/exports-index.js +20 -0
- package/dist/exports-index.js.map +1 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/fix-folder-imports.js +27 -0
- package/package.json +8 -6
- package/src/auth/exports-index.ts +2 -0
- package/src/exports-index.ts +3 -0
- package/src/index.ts +1 -4
- package/src/spo/common.ts +4 -4
- package/src/spo/exports-index.ts +1 -0
package/dist/SPO/common.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.getAxiosConfigSharePoint = exports.ConfigureSPOAuth = void 0;
|
|
4
13
|
const common_1 = require("@kwiz/common");
|
|
@@ -9,15 +18,17 @@ function ConfigureSPOAuth(config) {
|
|
|
9
18
|
auth = config;
|
|
10
19
|
}
|
|
11
20
|
exports.ConfigureSPOAuth = ConfigureSPOAuth;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
function getAxiosConfigSharePoint(tenantInfo, hostName) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
if ((0, common_1.isNullOrUndefined)(auth))
|
|
24
|
+
throw Error("Call ConfigureSPOAuth first");
|
|
25
|
+
// only certificate supported
|
|
26
|
+
// DisableCustomAppAuthentication property, that disable this kind of auth., however it can be overriden using this command:
|
|
27
|
+
// Set-SPOTenant -DisableCustomAppAuthentication $false
|
|
28
|
+
let token = yield (0, msal_1.GetMSALToken)(tenantInfo, (0, common_1.GetMSALSiteScope)(hostName), auth);
|
|
29
|
+
let config = (0, axios_1.getAxiosConfigBearer)(token, { contantType: "application/json; odata=nometadata" });
|
|
30
|
+
return config;
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
exports.getAxiosConfigSharePoint = getAxiosConfigSharePoint;
|
|
23
34
|
//# sourceMappingURL=common.js.map
|
package/dist/SPO/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/spo/common.ts"],"names":[],"mappings":"
|
|
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,MAAM,CAAC;AAClB,CAAC;AAFD,4CAEC;AACD,SAAsB,wBAAwB,CAAC,UAAuB,EAAE,QAAgB;;QACpF,IAAI,IAAA,0BAAiB,EAAC,IAAI,CAAC;YAAE,MAAM,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACxE,6BAA6B;QAC7B,4HAA4H;QAC5H,uDAAuD;QACvD,IAAI,KAAK,GAAG,MAAM,IAAA,mBAAY,EAAC,UAAU,EAAE,IAAA,yBAAgB,EAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;QAC7E,IAAI,MAAM,GAAG,IAAA,4BAAoB,EAAC,KAAK,EAAE,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC,CAAC;QAChG,OAAO,MAAM,CAAC;IAClB,CAAC;CAAA;AARD,4DAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './common';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./common"), exports);
|
|
18
|
+
//# sourceMappingURL=exports-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../../src/spo/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
package/dist/auth/discovery.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.DiscoverTenantInfo = void 0;
|
|
4
13
|
const common_1 = require("@kwiz/common");
|
|
5
14
|
const axios_1 = require("axios");
|
|
6
15
|
function DiscoverTenantInfo(hostName) {
|
|
7
16
|
hostName = hostName.toLowerCase();
|
|
8
|
-
return (0, common_1.promiseOnce)(`DiscoverTenantInfo|${hostName}`,
|
|
17
|
+
return (0, common_1.promiseOnce)(`DiscoverTenantInfo|${hostName}`, () => __awaiter(this, void 0, void 0, function* () {
|
|
9
18
|
let data = {
|
|
10
19
|
environment: common_1.$AzureEnvironment.Production,
|
|
11
20
|
idOrName: null,
|
|
@@ -25,7 +34,7 @@ function DiscoverTenantInfo(hostName) {
|
|
|
25
34
|
}
|
|
26
35
|
else
|
|
27
36
|
friendlyName = hostName; //could be an exchange email domain, or bpos customer
|
|
28
|
-
let config =
|
|
37
|
+
let config = yield axios_1.default.get(`https://login.microsoftonline.com/${friendlyName}/v2.0/.well-known/openid-configuration`);
|
|
29
38
|
let endpoint = config.data.token_endpoint; //https://xxxx/{tenant}/....
|
|
30
39
|
tenantId = endpoint.replace("//", "/").split('/')[2]; //replace :// with :/ split by / and take the second part.
|
|
31
40
|
let instance = config.data.cloud_instance_name; //microsoftonline.us
|
|
@@ -39,7 +48,7 @@ function DiscoverTenantInfo(hostName) {
|
|
|
39
48
|
}
|
|
40
49
|
catch (e) { }
|
|
41
50
|
return data;
|
|
42
|
-
});
|
|
51
|
+
}));
|
|
43
52
|
}
|
|
44
53
|
exports.DiscoverTenantInfo = DiscoverTenantInfo;
|
|
45
54
|
//# sourceMappingURL=discovery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/auth/discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/auth/discovery.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAqK;AACrK,iCAA0B;AAE1B,SAAgB,kBAAkB,CAAC,QAAgB;IAC/C,QAAQ,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAClC,OAAO,IAAA,oBAAW,EAAC,sBAAsB,QAAQ,EAAE,EAAE,GAAS,EAAE;QAC5D,IAAI,IAAI,GAAgB;YACpB,WAAW,EAAE,0BAAiB,CAAC,UAAU;YACzC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,KAAK;SACf,CAAC;QAEF,IAAI,QAAQ,GAAW,IAAI,CAAC;QAC5B,IAAI,YAAY,GAAW,IAAI,CAAC;QAEhC,IAAI,CAAC;YACD,IAAI,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC1C,IAAI,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA,mDAAmD;gBACvF,IAAI,aAAa,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gB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,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpF,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QAEb,OAAO,IAAI,CAAC;IAChB,CAAC,CAAA,CAAC,CAAC;AACP,CAAC;AAzDD,gDAyDC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./discovery"), exports);
|
|
18
|
+
__exportStar(require("./msal"), exports);
|
|
19
|
+
//# sourceMappingURL=exports-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../../src/auth/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,yCAAuB"}
|
package/dist/auth/msal.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.GetMSALToken = void 0;
|
|
4
13
|
const msal_node_1 = require("@azure/msal-node");
|
|
@@ -30,11 +39,13 @@ function GetApp(tenantInfo, auth) {
|
|
|
30
39
|
return apps[key];
|
|
31
40
|
}
|
|
32
41
|
/** client secret not supported by SharePoint, must use certificate */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
function GetMSALToken(tenantInfo, scope, auth) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
let token = yield GetApp(tenantInfo, auth).acquireTokenByClientCredential({
|
|
45
|
+
scopes: [`${scope}/.default`]
|
|
46
|
+
});
|
|
47
|
+
return token.accessToken;
|
|
36
48
|
});
|
|
37
|
-
return token.accessToken;
|
|
38
49
|
}
|
|
39
50
|
exports.GetMSALToken = GetMSALToken;
|
|
40
51
|
//# sourceMappingURL=msal.js.map
|
package/dist/auth/msal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msal.js","sourceRoot":"","sources":["../../src/auth/msal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"msal.js","sourceRoot":"","sources":["../../src/auth/msal.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAiE;AAEjE,4GAA4G;AAC5G,kGAAkG;AAElG,IAAI,IAAI,GAAwD,EAAE,CAAC;AAEnE,SAAS,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|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth/exports-index"), exports);
|
|
18
|
+
__exportStar(require("./spo/exports-index"), exports);
|
|
19
|
+
__exportStar(require("./axios"), exports);
|
|
20
|
+
//# sourceMappingURL=exports-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-index.js","sourceRoot":"","sources":["../src/exports-index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,sDAAoC;AACpC,0CAAwB"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,8 +14,5 @@ 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("./
|
|
18
|
-
__exportStar(require("./auth/msal"), exports);
|
|
19
|
-
__exportStar(require("./axios"), exports);
|
|
20
|
-
__exportStar(require("./spo/common"), exports);
|
|
17
|
+
__exportStar(require("./exports-index"), exports);
|
|
21
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -0,0 +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
|
+
});
|
|
27
|
+
console.timeEnd("fixing direcry imports");
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kwiz/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "KWIZ utilities and helpers for node applications",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
5
|
"module": "dist/index.js",
|
|
7
6
|
"types": "dist/index.d.ts",
|
|
8
7
|
"exports": {
|
|
@@ -15,7 +14,7 @@
|
|
|
15
14
|
},
|
|
16
15
|
"scripts": {
|
|
17
16
|
"watch": "tsc -watch",
|
|
18
|
-
"build": "npm run test && tsc",
|
|
17
|
+
"build": "npm run reindex-project && npm run test && tsc",
|
|
19
18
|
"build-explain": "tsc --explainFiles",
|
|
20
19
|
"check-dependencies": "madge --circular ./src",
|
|
21
20
|
"create-link": "npm link",
|
|
@@ -24,7 +23,8 @@
|
|
|
24
23
|
"npm-v-major": "npm version major",
|
|
25
24
|
"npm-publish": "npm publish --access public",
|
|
26
25
|
"reset-repo": "git fetch origin && git reset --hard origin/main",
|
|
27
|
-
"link-local-common": "npm link @kwiz/common"
|
|
26
|
+
"link-local-common": "npm link @kwiz/common",
|
|
27
|
+
"reindex-project": "cti create ./src -i _dependencies -w -b -n -o exports-index.ts && node fix-folder-imports.js"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
@@ -56,14 +56,16 @@
|
|
|
56
56
|
},
|
|
57
57
|
"packageManager": "npm@9.5.1",
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^18.19.21",
|
|
60
|
+
"create-ts-index": "^1.14.0",
|
|
61
|
+
"fs-extra": "^11.2.0",
|
|
60
62
|
"madge": "^6.1.0",
|
|
61
63
|
"tsx": "^4.7.1",
|
|
62
64
|
"typescript": "^5.3.3"
|
|
63
65
|
},
|
|
64
66
|
"dependencies": {
|
|
65
67
|
"@azure/msal-node": "^2.6.4",
|
|
66
|
-
"@kwiz/common": "^1.0.
|
|
68
|
+
"@kwiz/common": "^1.0.10",
|
|
67
69
|
"axios": "^1.6.7",
|
|
68
70
|
"esbuild": "^0.19.12",
|
|
69
71
|
"get-tsconfig": "^4.7.2",
|
package/src/index.ts
CHANGED
package/src/spo/common.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { GetMSALSiteScope, isNullOrUndefined } from "@kwiz/common";
|
|
1
|
+
import { AuthContextType, GetMSALSiteScope, ITenantInfo, isNullOrUndefined } from "@kwiz/common";
|
|
2
2
|
import { GetMSALToken } from "../auth/msal";
|
|
3
3
|
import { getAxiosConfigBearer } from "../axios";
|
|
4
4
|
|
|
5
|
-
var auth:
|
|
6
|
-
export function ConfigureSPOAuth(config?:
|
|
5
|
+
var auth: AuthContextType = null;
|
|
6
|
+
export function ConfigureSPOAuth(config?: AuthContextType) {
|
|
7
7
|
auth = config;
|
|
8
8
|
}
|
|
9
|
-
export async function getAxiosConfigSharePoint(tenantInfo:
|
|
9
|
+
export async function getAxiosConfigSharePoint(tenantInfo: ITenantInfo, hostName: string) {
|
|
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:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './common';
|