@kwiz/common 1.0.20 → 1.0.21
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/helpers/browser.js +7 -13
- package/dist/helpers/browser.js.map +1 -1
- package/dist/utils/sharepoint.rest/file.folder.d.ts +0 -4
- package/dist/utils/sharepoint.rest/file.folder.js +1 -15
- package/dist/utils/sharepoint.rest/file.folder.js.map +1 -1
- package/dist/utils/sharepoint.rest/item.d.ts +0 -4
- package/dist/utils/sharepoint.rest/item.js +1 -22
- package/dist/utils/sharepoint.rest/item.js.map +1 -1
- package/dist/utils/sharepoint.rest/list.d.ts +1 -2
- package/dist/utils/sharepoint.rest/list.js +3 -5
- package/dist/utils/sharepoint.rest/list.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/rest.ts +6 -4
- package/dist/helpers/index.d.ts +0 -29
- package/dist/helpers/index.js +0 -46
- package/dist/helpers/index.js.map +0 -1
- package/dist/types/graph/index.d.ts +0 -1
- package/dist/types/graph/index.js +0 -18
- package/dist/types/graph/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.js +0 -30
- package/dist/types/index.js.map +0 -1
- package/dist/types/libs/index.d.ts +0 -3
- package/dist/types/libs/index.js +0 -20
- package/dist/types/libs/index.js.map +0 -1
- package/dist/types/locales copy.d.ts +0 -122
- package/dist/types/locales copy.js +0 -1
- package/dist/types/locales copy.js.map +0 -1
- package/dist/types/locales.export.d.ts +0 -1
- package/dist/types/locales.export.js +0 -3
- package/dist/types/locales.export.js.map +0 -1
- package/dist/utils/auth/adal.d.ts +0 -3
- package/dist/utils/auth/adal.js +0 -35
- package/dist/utils/auth/adal.js.map +0 -1
- package/dist/utils/auth/index.d.ts +0 -2
- package/dist/utils/auth/index.js +0 -19
- package/dist/utils/auth/index.js.map +0 -1
- package/dist/utils/auth/msal.d.ts +0 -4
- package/dist/utils/auth/msal.js +0 -59
- package/dist/utils/auth/msal.js.map +0 -1
- package/dist/utils/axios.d.ts +0 -6
- package/dist/utils/axios.js +0 -30
- package/dist/utils/axios.js.map +0 -1
- package/dist/utils/index.d.ts +0 -14
- package/dist/utils/index.js +0 -32
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/sharepoint.rest/index.d.ts +0 -11
- package/dist/utils/sharepoint.rest/index.js +0 -28
- package/dist/utils/sharepoint.rest/index.js.map +0 -1
package/dist/utils/auth/msal.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetMSALRestOptions = exports.GetMSALToken = void 0;
|
|
4
|
-
const msal_node_1 = require("@azure/msal-node");
|
|
5
|
-
const _dependencies_1 = require("../_dependencies");
|
|
6
|
-
const common_1 = require("./common");
|
|
7
|
-
//find tenant id? https://login.microsoftonline.com/kwizcom.onmicrosoft.com/.well-known/openid-configuration
|
|
8
|
-
//https://stackoverflow.com/questions/54771270/msal-ad-token-not-valid-with-sharepoint-online-csom
|
|
9
|
-
var apps = {};
|
|
10
|
-
function GetApp(tenantInfo, authContext) {
|
|
11
|
-
let key = `${tenantInfo.idOrName}|${authContext.authenticationMode}`;
|
|
12
|
-
if (!apps[key]) {
|
|
13
|
-
authContext.authenticationMode === _dependencies_1.AuthenticationModes.clientSecret
|
|
14
|
-
? apps[key] = new msal_node_1.ConfidentialClientApplication({
|
|
15
|
-
auth: {
|
|
16
|
-
clientId: authContext.clientId,
|
|
17
|
-
authority: tenantInfo.authorityUrl,
|
|
18
|
-
clientSecret: authContext.clientSecret
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
: apps[key] = new msal_node_1.ConfidentialClientApplication({
|
|
22
|
-
auth: {
|
|
23
|
-
clientId: authContext.clientId,
|
|
24
|
-
authority: tenantInfo.authorityUrl,
|
|
25
|
-
clientCertificate: {
|
|
26
|
-
thumbprint: authContext.thumbprint,
|
|
27
|
-
privateKey: authContext.privateKey
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return apps[key];
|
|
33
|
-
}
|
|
34
|
-
/** client secret not supported by SharePoint, must use certificate */
|
|
35
|
-
async function GetMSALToken(tenantInfo, scope) {
|
|
36
|
-
const authContext = (0, common_1.$AuthConfig)();
|
|
37
|
-
if ((0, _dependencies_1.isNullOrUndefined)(authContext))
|
|
38
|
-
throw Error("You must call ADALConfig before using this function");
|
|
39
|
-
let token = await GetApp(tenantInfo, authContext).acquireTokenByClientCredential({
|
|
40
|
-
scopes: [`${scope}/.default`]
|
|
41
|
-
});
|
|
42
|
-
return token.accessToken;
|
|
43
|
-
}
|
|
44
|
-
exports.GetMSALToken = GetMSALToken;
|
|
45
|
-
function getSiteScope(siteUrl) {
|
|
46
|
-
return `https://${new URL(siteUrl).hostname}`;
|
|
47
|
-
}
|
|
48
|
-
async function GetMSALRestOptions(tenantInfo, siteUrl) {
|
|
49
|
-
let token = await GetMSALToken(tenantInfo, getSiteScope(siteUrl));
|
|
50
|
-
const options = {
|
|
51
|
-
jsonMetadata: _dependencies_1.jsonTypes.nometadata,
|
|
52
|
-
headers: {
|
|
53
|
-
Authorization: `Bearer ${token}`
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
return options;
|
|
57
|
-
}
|
|
58
|
-
exports.GetMSALRestOptions = GetMSALRestOptions;
|
|
59
|
-
//# sourceMappingURL=msal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msal.js","sourceRoot":"","sources":["../../../src/utils/auth/msal.ts"],"names":[],"mappings":";;;AAAA,gDAAiE;AACjE,oDAAgH;AAChH,qCAAwD;AACxD,4GAA4G;AAG5G,kGAAkG;AAElG,IAAI,IAAI,GAAwD,EAAE,CAAC;AAEnE,SAAS,MAAM,CAAC,UAAuB,EAAE,WAA4B;IAEjE,IAAI,GAAG,GAAG,GAAG,UAAU,CAAC,QAAQ,IAAI,WAAW,CAAC,kBAAkB,EAAE,CAAA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,UAAU,kBAAkB,CAAC,UAAuB,EAAE,OAAe;IAC7E,IAAI,KAAK,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAElE,MAAM,OAAO,GAAiB;QAC1B,YAAY,EAAE,yBAAS,CAAC,UAAU;QAClC,OAAO,EAAE;YACL,aAAa,EAAE,UAAU,KAAK,EAAE;SACnC;KACJ,CAAC;IACF,OAAO,OAAO,CAAC;AACnB,CAAC;AAVD,gDAUC"}
|
package/dist/utils/axios.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
type axiosConfigOptions = {
|
|
2
|
-
contantType?: "application/json" | "application/json; odata=nometadata" | "application/xml";
|
|
3
|
-
};
|
|
4
|
-
export declare function getAxiosConfigBearer(token: string, options?: axiosConfigOptions): AxiosRequestConfig<any>;
|
|
5
|
-
export declare function getAxiosConfig(token?: string, options?: axiosConfigOptions): AxiosRequestConfig<any>;
|
|
6
|
-
export {};
|
package/dist/utils/axios.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAxiosConfig = exports.getAxiosConfigBearer = void 0;
|
|
4
|
-
const https_1 = require("https");
|
|
5
|
-
const _modules_1 = require("../../sync/_modules");
|
|
6
|
-
function getAxiosConfigBearer(token, options) {
|
|
7
|
-
return getAxiosConfig(`Bearer ${token}`, options);
|
|
8
|
-
}
|
|
9
|
-
exports.getAxiosConfigBearer = getAxiosConfigBearer;
|
|
10
|
-
function getAxiosConfig(token, options) {
|
|
11
|
-
//allow self sign ssl certificates
|
|
12
|
-
https_1.globalAgent.options.rejectUnauthorized = false;
|
|
13
|
-
const config = {
|
|
14
|
-
httpAgent: new https_1.Agent({
|
|
15
|
-
rejectUnauthorized: false
|
|
16
|
-
}),
|
|
17
|
-
headers: {}
|
|
18
|
-
};
|
|
19
|
-
if (!(0, _modules_1.isNullOrEmptyString)(token))
|
|
20
|
-
config.headers.Authorization = token;
|
|
21
|
-
if (options) {
|
|
22
|
-
if (!(0, _modules_1.isNullOrEmptyString)(options.contantType)) {
|
|
23
|
-
config.headers["Content-Type"] = options.contantType;
|
|
24
|
-
config.headers["Accept"] = options.contantType;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return config;
|
|
28
|
-
}
|
|
29
|
-
exports.getAxiosConfig = getAxiosConfig;
|
|
30
|
-
//# sourceMappingURL=axios.js.map
|
package/dist/utils/axios.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"axios.js","sourceRoot":"","sources":["../../src/utils/axios.ts"],"names":[],"mappings":";;;AACA,iCAA2C;AAC3C,kDAA0D;AAK1D,SAAgB,oBAAoB,CAAC,KAAa,EAAE,OAA4B;IAC5E,OAAO,cAAc,CAAC,UAAU,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAFD,oDAEC;AAED,SAAgB,cAAc,CAAC,KAAc,EAAE,OAA4B;IACvE,kCAAkC;IAClC,mBAAW,CAAC,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAC/C,MAAM,MAAM,GAA4B;QACpC,SAAS,EAAE,IAAI,aAAK,CAAC;YACjB,kBAAkB,EAAE,KAAK;SAC5B,CAAC;QACF,OAAO,EAAE,EAAE;KACd,CAAC;IAEF,IAAI,CAAC,IAAA,8BAAmB,EAAC,KAAK,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;IAEzC,IAAI,OAAO,EAAE,CAAC;QACV,IAAI,CAAC,IAAA,8BAAmB,EAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;YACrD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;QACnD,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AApBD,wCAoBC"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { default as _script } from "./script";
|
|
2
|
-
import { default as _sod } from "./sod";
|
|
3
|
-
export * from './base64';
|
|
4
|
-
export * from "./consolelogger";
|
|
5
|
-
export * from './date';
|
|
6
|
-
export * from './emails';
|
|
7
|
-
export * from './knownscript';
|
|
8
|
-
export * from './localstoragecache';
|
|
9
|
-
export * from './rest';
|
|
10
|
-
export * from './sharepoint.rest';
|
|
11
|
-
export * from './sod';
|
|
12
|
-
export * from './auth';
|
|
13
|
-
export declare const script: typeof _script;
|
|
14
|
-
export declare const Sod: typeof _sod;
|
package/dist/utils/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
exports.Sod = exports.script = void 0;
|
|
18
|
-
const script_1 = require("./script");
|
|
19
|
-
const sod_1 = require("./sod");
|
|
20
|
-
__exportStar(require("./base64"), exports);
|
|
21
|
-
__exportStar(require("./consolelogger"), exports);
|
|
22
|
-
__exportStar(require("./date"), exports);
|
|
23
|
-
__exportStar(require("./emails"), exports);
|
|
24
|
-
__exportStar(require("./knownscript"), exports);
|
|
25
|
-
__exportStar(require("./localstoragecache"), exports);
|
|
26
|
-
__exportStar(require("./rest"), exports);
|
|
27
|
-
__exportStar(require("./sharepoint.rest"), exports);
|
|
28
|
-
__exportStar(require("./sod"), exports);
|
|
29
|
-
__exportStar(require("./auth"), exports);
|
|
30
|
-
exports.script = script_1.default;
|
|
31
|
-
exports.Sod = sod_1.default;
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA8C;AAC9C,+BAAwC;AACxC,2CAAyB;AACzB,kDAAgC;AAChC,yCAAuB;AACvB,2CAAyB;AACzB,gDAA8B;AAC9B,sDAAoC;AACpC,yCAAuB;AACvB,oDAAkC;AAClC,wCAAsB;AACtB,yCAAuB;AACV,QAAA,MAAM,GAAG,gBAAO,CAAC;AACjB,QAAA,GAAG,GAAG,aAAI,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from "./common";
|
|
2
|
-
export * from "./date";
|
|
3
|
-
export * from "./file.folder";
|
|
4
|
-
export * from "./item";
|
|
5
|
-
export * from "./list";
|
|
6
|
-
export * from "./listutils/GetListItemsByCaml";
|
|
7
|
-
export * from "./listutils/GetListItemsById";
|
|
8
|
-
export * from "./listutils/common";
|
|
9
|
-
export * from "./user";
|
|
10
|
-
export * from "./user-search";
|
|
11
|
-
export * from "./web";
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
__exportStar(require("./date"), exports);
|
|
19
|
-
__exportStar(require("./file.folder"), exports);
|
|
20
|
-
__exportStar(require("./item"), exports);
|
|
21
|
-
__exportStar(require("./list"), exports);
|
|
22
|
-
__exportStar(require("./listutils/GetListItemsByCaml"), exports);
|
|
23
|
-
__exportStar(require("./listutils/GetListItemsById"), exports);
|
|
24
|
-
__exportStar(require("./listutils/common"), exports);
|
|
25
|
-
__exportStar(require("./user"), exports);
|
|
26
|
-
__exportStar(require("./user-search"), exports);
|
|
27
|
-
__exportStar(require("./web"), exports);
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/sharepoint.rest/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,gDAA8B;AAC9B,yCAAuB;AACvB,yCAAuB;AACvB,iEAA+C;AAC/C,+DAA6C;AAC7C,qDAAmC;AACnC,yCAAuB;AACvB,gDAA8B;AAC9B,wCAAsB"}
|