@mikezimm/fps-library-v2 1.1.203 → 1.2.0
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/lib/logic/Links/IDetailedLink.d.ts +14 -0
- package/lib/logic/Links/IDetailedLink.d.ts.map +1 -0
- package/lib/logic/Links/IDetailedLink.js +2 -0
- package/lib/logic/Links/IDetailedLink.js.map +1 -0
- package/lib/logic/Links/getAllDomainsFromUrls.d.ts +2 -0
- package/lib/logic/Links/getAllDomainsFromUrls.d.ts.map +1 -0
- package/lib/logic/Links/getAllDomainsFromUrls.js +75 -0
- package/lib/logic/Links/getAllDomainsFromUrls.js.map +1 -0
- package/lib/logic/Links/getDomainTypeFromUrl.d.ts +11 -0
- package/lib/logic/Links/getDomainTypeFromUrl.d.ts.map +1 -0
- package/lib/logic/Links/getDomainTypeFromUrl.js +64 -0
- package/lib/logic/Links/getDomainTypeFromUrl.js.map +1 -0
- package/lib/logic/Links/getDomains.d.ts +28 -0
- package/lib/logic/Links/getDomains.d.ts.map +1 -0
- package/lib/logic/Links/getDomains.js +40 -0
- package/lib/logic/Links/getDomains.js.map +1 -0
- package/lib/logic/Links/getSPOUrl.d.ts +39 -0
- package/lib/logic/Links/getSPOUrl.d.ts.map +1 -0
- package/lib/logic/Links/getSPOUrl.js +57 -0
- package/lib/logic/Links/getSPOUrl.js.map +1 -0
- package/lib/pnpjs/SourceItems/IMinSourceFetchProps.d.ts +2 -0
- package/lib/pnpjs/SourceItems/IMinSourceFetchProps.d.ts.map +1 -1
- package/lib/pnpjs/SourceItems/IMinSourceFetchProps.js +2 -0
- package/lib/pnpjs/SourceItems/IMinSourceFetchProps.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ISimpleLink } from "./Interfaces";
|
|
2
|
+
export type IDetailedLinkDomain = '@SPO' | '@Teams' | '@External' | '@Custom' | 'N/A';
|
|
3
|
+
export interface IDomainDetails {
|
|
4
|
+
domain: string;
|
|
5
|
+
domainGroup: IDetailedLinkDomain;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The purpose of IDetailedLink is to add more detailed context to the link such has what type of domain
|
|
9
|
+
*/
|
|
10
|
+
export interface IDetailedLink extends ISimpleLink {
|
|
11
|
+
domain: string;
|
|
12
|
+
domainGroup: IDetailedLinkDomain;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=IDetailedLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDetailedLink.d.ts","sourceRoot":"","sources":["../../../src/logic/Links/IDetailedLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;GAEG;AAEH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,mBAAmB,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDetailedLink.js","sourceRoot":"","sources":["../../../src/logic/Links/IDetailedLink.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllDomainsFromUrls.d.ts","sourceRoot":"","sources":["../../../src/logic/Links/getAllDomainsFromUrls.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,EAAE,CAmE9K"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { getDomain } from "./getDomains";
|
|
2
|
+
import { getCollectionUrl, getTeamsUrl } from "./getSPOUrl";
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
export function getAllDomainsFromUrls(urls, noDups, includeSharePoint, includeTenant, includeSites, includeTeams) {
|
|
5
|
+
const results = [];
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
let showSPO = false;
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
let showTenant = false;
|
|
10
|
+
// let showSlashSites: any = false;
|
|
11
|
+
// let showSlashTeams: any = false;
|
|
12
|
+
const showSites = [];
|
|
13
|
+
const showTeams = [];
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
urls.map((url) => {
|
|
16
|
+
let urlStr = ``;
|
|
17
|
+
if (!url) { //
|
|
18
|
+
}
|
|
19
|
+
else if (typeof url === 'string') {
|
|
20
|
+
urlStr = url;
|
|
21
|
+
}
|
|
22
|
+
else if (url.Url) {
|
|
23
|
+
urlStr = url.Url;
|
|
24
|
+
}
|
|
25
|
+
if (urlStr) {
|
|
26
|
+
if (showTenant === false && includeTenant === true && urlStr.indexOf(window.location.origin) > -1) {
|
|
27
|
+
showTenant = true;
|
|
28
|
+
}
|
|
29
|
+
if (includeSites === true) {
|
|
30
|
+
if (url.indexOf(window.location.origin) === 0) {
|
|
31
|
+
const thisSite = getCollectionUrl(urlStr);
|
|
32
|
+
if (showSites.indexOf(thisSite) < 0)
|
|
33
|
+
showSites.push(thisSite);
|
|
34
|
+
}
|
|
35
|
+
else if (url.indexOf('/sites/') === 0) {
|
|
36
|
+
const thisSite = url.replace(`/sites/`, '').split('/')[0];
|
|
37
|
+
if (showSites.indexOf(thisSite) < 0)
|
|
38
|
+
showSites.push(thisSite);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (includeTeams === true) {
|
|
42
|
+
if (url.indexOf(window.location.origin) === 0) {
|
|
43
|
+
const thisSite = getTeamsUrl(urlStr);
|
|
44
|
+
if (showTeams.indexOf(thisSite) < 0)
|
|
45
|
+
showTeams.push(thisSite);
|
|
46
|
+
}
|
|
47
|
+
else if (url.indexOf('/teams/') === 0) {
|
|
48
|
+
const thisSite = url.replace(`/teams/`, '').split('/')[0];
|
|
49
|
+
if (showTeams.indexOf(thisSite) < 0)
|
|
50
|
+
showTeams.push(thisSite);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const domain = getDomain(urlStr);
|
|
54
|
+
if (showSPO === false && domain === 'sharepoint' && includeSharePoint === true) {
|
|
55
|
+
showSPO = true;
|
|
56
|
+
}
|
|
57
|
+
else if (results.indexOf(domain) < 0)
|
|
58
|
+
results.push(domain);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
if (showSites.length > 0)
|
|
62
|
+
results.unshift(...showSites);
|
|
63
|
+
if (showSites.length > 0)
|
|
64
|
+
results.unshift('/sites/');
|
|
65
|
+
if (showTeams.length > 0)
|
|
66
|
+
results.unshift(...showTeams);
|
|
67
|
+
if (showTeams.length > 0)
|
|
68
|
+
results.unshift('/teams/');
|
|
69
|
+
if (showTenant === true)
|
|
70
|
+
results.unshift(window.location.origin);
|
|
71
|
+
if (showSPO === true)
|
|
72
|
+
results.unshift('.sharepoint.');
|
|
73
|
+
return results;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=getAllDomainsFromUrls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllDomainsFromUrls.js","sourceRoot":"","sources":["../../../src/logic/Links/getAllDomainsFromUrls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE5D,8DAA8D;AAE9D,MAAM,UAAU,qBAAqB,CAAC,IAAW,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;QAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IACxD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAErD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CAAC;IACxD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAErD,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjE,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAEtD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IDomainDetails } from "./IDetailedLink";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param url
|
|
5
|
+
* @param customDomains You can optionally return a custom label like 'ServiceNow' if you preface the domain with a Label and | like this
|
|
6
|
+
* Youtube|www.youtube.com or ServiceNow|www.servicenow.com
|
|
7
|
+
* @param testType - either contains or begins with this string. Default === 'begins'
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function getDomainTypeFromUrl(url: string, testType?: 'contains' | 'begins', customDomains?: string[]): IDomainDetails;
|
|
11
|
+
//# sourceMappingURL=getDomainTypeFromUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDomainTypeFromUrl.d.ts","sourceRoot":"","sources":["../../../src/logic/Links/getDomainTypeFromUrl.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAItE;;;;;;;GAOG;AAGH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,UAAU,GAAG,QAAmB,EAAE,aAAa,GAAE,MAAM,EAAO,GAAG,cAAc,CAkD1I"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CurrentHostLC } from "../../pnpjs/SourceItems/IMinSourceFetchProps";
|
|
2
|
+
import { getStringArrayFromStringNoDups } from "../Strings/arraysFromString";
|
|
3
|
+
import { getCollectionUrl, getTeamsUrl } from "./getSPOUrl";
|
|
4
|
+
import { getDomain } from "./getDomains";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param url
|
|
8
|
+
* @param customDomains You can optionally return a custom label like 'ServiceNow' if you preface the domain with a Label and | like this
|
|
9
|
+
* Youtube|www.youtube.com or ServiceNow|www.servicenow.com
|
|
10
|
+
* @param testType - either contains or begins with this string. Default === 'begins'
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export function getDomainTypeFromUrl(url, testType = 'begins', customDomains = []) {
|
|
14
|
+
const urlLC = url ? url.toLocaleLowerCase() : '';
|
|
15
|
+
const DomainDetails = {
|
|
16
|
+
domain: ``,
|
|
17
|
+
domainGroup: `N/A`
|
|
18
|
+
};
|
|
19
|
+
if (!urlLC)
|
|
20
|
+
return DomainDetails;
|
|
21
|
+
if (urlLC.indexOf('/sites/') === 0)
|
|
22
|
+
DomainDetails.domainGroup = '@SPO';
|
|
23
|
+
if (urlLC.indexOf('/teams/') === 0)
|
|
24
|
+
DomainDetails.domainGroup = '@Teams';
|
|
25
|
+
if (urlLC.indexOf(`${CurrentHostLC}/sites/`) === 0)
|
|
26
|
+
DomainDetails.domainGroup = '@SPO';
|
|
27
|
+
if (urlLC.indexOf(`${CurrentHostLC}/teams/`) === 0)
|
|
28
|
+
DomainDetails.domainGroup = '@Teams';
|
|
29
|
+
if (DomainDetails.domainGroup === '@SPO')
|
|
30
|
+
DomainDetails.domain = getCollectionUrl(urlLC);
|
|
31
|
+
if (DomainDetails.domainGroup === '@Teams')
|
|
32
|
+
DomainDetails.domain = getTeamsUrl(urlLC);
|
|
33
|
+
if (DomainDetails.domainGroup === '@SPO' || DomainDetails.domainGroup === '@Teams')
|
|
34
|
+
return DomainDetails;
|
|
35
|
+
let foundCustom = false;
|
|
36
|
+
DomainDetails.domainGroup = '@External';
|
|
37
|
+
DomainDetails.domain = getDomain(url);
|
|
38
|
+
if (customDomains.length > 0) {
|
|
39
|
+
customDomains.map((testThis) => {
|
|
40
|
+
// Only run until the first domain is found
|
|
41
|
+
if (foundCustom !== true) {
|
|
42
|
+
let custLabel = '@External';
|
|
43
|
+
// split this test with |... use the first part as the label if it's defined.
|
|
44
|
+
const splits = getStringArrayFromStringNoDups(testThis, '|', true, null, true);
|
|
45
|
+
// testMe is the domain string you are searching for... if testThis has |, it's the second part of the split
|
|
46
|
+
const testMe = splits.length > 1 ? splits[1] : splits[0];
|
|
47
|
+
// set the custLabel based on the first part of the split
|
|
48
|
+
if (splits.length > 1)
|
|
49
|
+
custLabel = `@${splits[0]}`;
|
|
50
|
+
const found = urlLC.indexOf(testMe);
|
|
51
|
+
if (testType === 'contains' && found > -1) {
|
|
52
|
+
DomainDetails.domainGroup = custLabel;
|
|
53
|
+
foundCustom = true;
|
|
54
|
+
}
|
|
55
|
+
else if (testType === 'begins' && found === 0) {
|
|
56
|
+
DomainDetails.domainGroup = custLabel;
|
|
57
|
+
foundCustom = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return DomainDetails;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=getDomainTypeFromUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDomainTypeFromUrl.js","sourceRoot":"","sources":["../../../src/logic/Links/getDomainTypeFromUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE7E,OA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
4
|
+
Explanation of the regex:
|
|
5
|
+
|
|
6
|
+
^ asserts the position at the start of the string.
|
|
7
|
+
(?:https?:\/\/)? matches the protocol part (http:// or https://) but does not capture it (?: makes it a non-capturing group).
|
|
8
|
+
(?:www\.)? matches www. if it is present but does not capture it.
|
|
9
|
+
([^\.]+) captures one or more characters that are not a dot (.) and stores them in a capturing group. This represents the main domain name.
|
|
10
|
+
\. matches the following dot.
|
|
11
|
+
This regex will work for typical URLs with the http or https protocols, optionally prefixed by www.. It captures the domain name part before the first dot in the URL.
|
|
12
|
+
|
|
13
|
+
const url = "https://www.bing.com?searcharam=X";
|
|
14
|
+
const domain = getDomain(url);
|
|
15
|
+
console.log(domain); // Outputs: bing
|
|
16
|
+
|
|
17
|
+
Explanation of the changes:
|
|
18
|
+
|
|
19
|
+
The regex now captures the domain part of the URL in a more generic way by matching ([^:\/?\n]+), which captures the full domain part before the TLD.
|
|
20
|
+
The split and extraction part ensures that if there are subdomains, we get the correct main domain by splitting the captured part by . and returning the second-to-last part.
|
|
21
|
+
(?:[a-z]{2,6}) matches the TLD which is assumed to be 2 to 6 letters long.
|
|
22
|
+
This approach should work for URLs with or without subdomains, extracting the correct main domain name in various scenarios.
|
|
23
|
+
|
|
24
|
+
* @param url
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDomain(url: string): string;
|
|
28
|
+
//# sourceMappingURL=getDomains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDomains.d.ts","sourceRoot":"","sources":["../../../src/logic/Links/getDomains.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc7C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Here is the JavaScript code:
|
|
3
|
+
|
|
4
|
+
Explanation of the regex:
|
|
5
|
+
|
|
6
|
+
^ asserts the position at the start of the string.
|
|
7
|
+
(?:https?:\/\/)? matches the protocol part (http:// or https://) but does not capture it (?: makes it a non-capturing group).
|
|
8
|
+
(?:www\.)? matches www. if it is present but does not capture it.
|
|
9
|
+
([^\.]+) captures one or more characters that are not a dot (.) and stores them in a capturing group. This represents the main domain name.
|
|
10
|
+
\. matches the following dot.
|
|
11
|
+
This regex will work for typical URLs with the http or https protocols, optionally prefixed by www.. It captures the domain name part before the first dot in the URL.
|
|
12
|
+
|
|
13
|
+
const url = "https://www.bing.com?searcharam=X";
|
|
14
|
+
const domain = getDomain(url);
|
|
15
|
+
console.log(domain); // Outputs: bing
|
|
16
|
+
|
|
17
|
+
Explanation of the changes:
|
|
18
|
+
|
|
19
|
+
The regex now captures the domain part of the URL in a more generic way by matching ([^:\/?\n]+), which captures the full domain part before the TLD.
|
|
20
|
+
The split and extraction part ensures that if there are subdomains, we get the correct main domain by splitting the captured part by . and returning the second-to-last part.
|
|
21
|
+
(?:[a-z]{2,6}) matches the TLD which is assumed to be 2 to 6 letters long.
|
|
22
|
+
This approach should work for URLs with or without subdomains, extracting the correct main domain name in various scenarios.
|
|
23
|
+
|
|
24
|
+
* @param url
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export function getDomain(url) {
|
|
28
|
+
// const regex = /^(?:https?:\/\/)?(?:www\.)?([^.]+)\./i;
|
|
29
|
+
// const match = url.match(regex);
|
|
30
|
+
// return match ? match[1] : null;
|
|
31
|
+
// const regex = /^(?:https?:\/\/)?(?:[^@/\n]+@)?(?:www\.)?([^:/?\n]+)\.(?:[a-z]{2,6})(?:[/\n]|\?|$)/i;
|
|
32
|
+
const regex = /^(?:https?:\/\/)?(?:[^@/\n]+@)?(?:www\.)?([^:/?\n]+)/i;
|
|
33
|
+
const match = url.match(regex);
|
|
34
|
+
if (match && match[1]) {
|
|
35
|
+
const parts = match[1].split('.');
|
|
36
|
+
return parts.length > 1 ? parts[parts.length - 2] : parts[0];
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=getDomains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDomains.js","sourceRoot":"","sources":["../../../src/logic/Links/getDomains.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,yDAAyD;IACzD,kCAAkC;IAClC,kCAAkC;IAElC,uGAAuG;IACvG,MAAM,KAAK,GAAG,uDAAuD,CAAC;IACtE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAC9D;IACD,OAAO,IAAI,CAAC;AAEd,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This could be modified to leverage an array of regex
|
|
3
|
+
* @param url
|
|
4
|
+
* @param regex1
|
|
5
|
+
* @param regex2
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDomain2Reg(url: string, regex1: RegExp, regex2: RegExp): string;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
To extract the site collection name from a SharePoint Online site URL, you can use the following JavaScript regular expression. This regex will capture the site collection name from the given URL structure.
|
|
12
|
+
|
|
13
|
+
Here is the JavaScript code:
|
|
14
|
+
|
|
15
|
+
javascript
|
|
16
|
+
Copy code
|
|
17
|
+
function getSiteCollectionName(url) {
|
|
18
|
+
const regex = /https:\/\/[^.]+\.sharepoint\.com\/sites\/([^\/]+)/i;
|
|
19
|
+
const match = url.match(regex);
|
|
20
|
+
return match ? match[1] : null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const url = "https://fuzzypawstech.sharepoint.com/sites/XYZ/MoreStuff";
|
|
24
|
+
const siteCollectionName = getSiteCollectionName(url);
|
|
25
|
+
console.log(siteCollectionName); // Outputs: XYZ
|
|
26
|
+
Explanation of the regex:
|
|
27
|
+
|
|
28
|
+
https:\/\/ matches the https:// part of the URL.
|
|
29
|
+
[^.]+ matches one or more characters that are not a dot, capturing the subdomain part (e.g., fuzzypawstech).
|
|
30
|
+
\.sharepoint\.com\/sites\/ matches .sharepoint.com/sites/.
|
|
31
|
+
([^\/]+) captures one or more characters that are not a forward slash (/), representing the site collection name.
|
|
32
|
+
i is the case-insensitive flag.
|
|
33
|
+
This regex will correctly extract the site collection name (e.g., XYZ) from the given SharePoint Online site URL.
|
|
34
|
+
|
|
35
|
+
* @param url
|
|
36
|
+
*/
|
|
37
|
+
export declare function getCollectionUrl(url: string): string;
|
|
38
|
+
export declare function getTeamsUrl(url: string): string;
|
|
39
|
+
//# sourceMappingURL=getSPOUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSPOUrl.d.ts","sourceRoot":"","sources":["../../../src/logic/Links/getSPOUrl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjF;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This could be modified to leverage an array of regex
|
|
3
|
+
* @param url
|
|
4
|
+
* @param regex1
|
|
5
|
+
* @param regex2
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export function getDomain2Reg(url, regex1, regex2) {
|
|
9
|
+
const match = url.match(regex1);
|
|
10
|
+
if (match)
|
|
11
|
+
return match[1];
|
|
12
|
+
const match2 = url.match(regex2);
|
|
13
|
+
return match2 ? match2[1] : null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
To extract the site collection name from a SharePoint Online site URL, you can use the following JavaScript regular expression. This regex will capture the site collection name from the given URL structure.
|
|
18
|
+
|
|
19
|
+
Here is the JavaScript code:
|
|
20
|
+
|
|
21
|
+
javascript
|
|
22
|
+
Copy code
|
|
23
|
+
function getSiteCollectionName(url) {
|
|
24
|
+
const regex = /https:\/\/[^.]+\.sharepoint\.com\/sites\/([^\/]+)/i;
|
|
25
|
+
const match = url.match(regex);
|
|
26
|
+
return match ? match[1] : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const url = "https://fuzzypawstech.sharepoint.com/sites/XYZ/MoreStuff";
|
|
30
|
+
const siteCollectionName = getSiteCollectionName(url);
|
|
31
|
+
console.log(siteCollectionName); // Outputs: XYZ
|
|
32
|
+
Explanation of the regex:
|
|
33
|
+
|
|
34
|
+
https:\/\/ matches the https:// part of the URL.
|
|
35
|
+
[^.]+ matches one or more characters that are not a dot, capturing the subdomain part (e.g., fuzzypawstech).
|
|
36
|
+
\.sharepoint\.com\/sites\/ matches .sharepoint.com/sites/.
|
|
37
|
+
([^\/]+) captures one or more characters that are not a forward slash (/), representing the site collection name.
|
|
38
|
+
i is the case-insensitive flag.
|
|
39
|
+
This regex will correctly extract the site collection name (e.g., XYZ) from the given SharePoint Online site URL.
|
|
40
|
+
|
|
41
|
+
* @param url
|
|
42
|
+
*/
|
|
43
|
+
export function getCollectionUrl(url) {
|
|
44
|
+
const regex = /https:\/\/[^.]+\.sharepoint\.com\/sites\/([^/]+)/i;
|
|
45
|
+
const regex2 = /\/sites\/([^/]+)/;
|
|
46
|
+
if (url)
|
|
47
|
+
return getDomain2Reg(url, regex, regex2);
|
|
48
|
+
return url ? getDomain2Reg(url, regex, regex2) : null;
|
|
49
|
+
}
|
|
50
|
+
export function getTeamsUrl(url) {
|
|
51
|
+
const regex = /https:\/\/[^.]+\.sharepoint\.com\/teams\/([^/]+)/i;
|
|
52
|
+
const regex2 = /\/teams\/([^/]+)/;
|
|
53
|
+
if (url)
|
|
54
|
+
return getDomain2Reg(url, regex, regex2);
|
|
55
|
+
return url ? getDomain2Reg(url, regex, regex2) : null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=getSPOUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSPOUrl.js","sourceRoot":"","sources":["../../../src/logic/Links/getSPOUrl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,MAAc,EAAE,MAAc;IAEvE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3B,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEnC,CAAC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,KAAK,GAAG,mDAAmD,CAAC;IAClE,MAAM,MAAM,GAAG,kBAAkB,CAAC;IAClC,IAAI,GAAG;QAAE,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,KAAK,GAAG,mDAAmD,CAAC;IAClE,MAAM,MAAM,GAAG,kBAAkB,CAAC;IAClC,IAAI,GAAG;QAAE,OAAO,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { IPerformanceSettings } from "../../components/molecules/Performance/IPerformanceSettings";
|
|
2
2
|
import { ISeriesSortObject } from "../../logic/indexes/ArraySortingNumbers";
|
|
3
|
+
export declare const CurrentHost: string;
|
|
4
|
+
export declare const CurrentHostLC: string;
|
|
3
5
|
export declare const CurrentTenant: string;
|
|
4
6
|
export interface IMinSourceFetchProps {
|
|
5
7
|
tenant: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IMinSourceFetchProps.d.ts","sourceRoot":"","sources":["../../../src/pnpjs/SourceItems/IMinSourceFetchProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,eAAO,MAAM,aAAa,EAAE,MAAgE,CAAC;
|
|
1
|
+
{"version":3,"file":"IMinSourceFetchProps.d.ts","sourceRoot":"","sources":["../../../src/pnpjs/SourceItems/IMinSourceFetchProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,eAAO,MAAM,WAAW,EAAE,MAAkC,CAAC;AAC7D,eAAO,MAAM,aAAa,EAAE,MAA6C,CAAC;AAC1E,eAAO,MAAM,aAAa,EAAE,MAAgE,CAAC;AAG7F,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAE5B,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IMinSourceFetchProps.js","sourceRoot":"","sources":["../../../src/pnpjs/SourceItems/IMinSourceFetchProps.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAC,EAAE,CAAC,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"IMinSourceFetchProps.js","sourceRoot":"","sources":["../../../src/pnpjs/SourceItems/IMinSourceFetchProps.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAW,GAAG,WAAW,CAAC,iBAAiB,EAAE,EAAE,CAAC;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAC,EAAE,CAAC,EAAE,CAAC"}
|