@syncmatters/script-api 1.0.24 → 1.0.25
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.
|
@@ -12,6 +12,7 @@ import { XlsxWriter, XlsxWriterOptions } from "./xlsx-writer/xlsx-writer.js";
|
|
|
12
12
|
import { emailCleanse } from "./www-utils/www-utils.js";
|
|
13
13
|
import { emailIsPublic } from "./www-utils/www-utils.js";
|
|
14
14
|
import { domainParse } from "./www-utils/www-utils.js";
|
|
15
|
+
import { domainCleanse, domainCompare, domainIsShared } from "./www-utils/www-utils.js";
|
|
15
16
|
import { xmlParse } from "./xml-utils/xml-utils.js";
|
|
16
17
|
import { nameParser } from "./name-parser/name-parser.js";
|
|
17
18
|
import { tempDir, tempFile } from "./file-utils/file-utils.js";
|
|
@@ -47,6 +48,9 @@ export declare const utilities: {
|
|
|
47
48
|
emailCleanse: typeof emailCleanse;
|
|
48
49
|
emailIsPublic: typeof emailIsPublic;
|
|
49
50
|
domainParse: typeof domainParse;
|
|
51
|
+
domainCleanse: typeof domainCleanse;
|
|
52
|
+
domainCompare: typeof domainCompare;
|
|
53
|
+
domainIsShared: typeof domainIsShared;
|
|
50
54
|
fileProvider: typeof fileProvider;
|
|
51
55
|
gzip: {
|
|
52
56
|
compressB64: typeof gzipB64;
|
|
@@ -4,7 +4,46 @@ interface ParsedDomain {
|
|
|
4
4
|
tld: string;
|
|
5
5
|
tldListed: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Break a hostname or URL into its domain, subdomain and public suffix (tld). The parts of an
|
|
9
|
+
* internationalized name are returned in the form the value was written in: unicode for "münchen.de",
|
|
10
|
+
* punycode for "xn--mnchen-3ya.de".
|
|
11
|
+
*/
|
|
7
12
|
export declare function domainParse(hostname: string): ParsedDomain;
|
|
13
|
+
/** How far domainCleanse reduces a value: to the company's registered domain, or only to the host. */
|
|
14
|
+
export type DomainLevel = "company_domain" | "full_host";
|
|
15
|
+
/**
|
|
16
|
+
* Reduce a hostname or URL to a lowercased domain, dropping the scheme, port and path.
|
|
17
|
+
* - "company_domain" (the default) also drops every subdomain, leaving the registrable domain:
|
|
18
|
+
* "https://www.shop.Acme.co.uk/about" becomes "acme.co.uk".
|
|
19
|
+
* - "full_host" keeps the host and drops only a leading "www.": "shop.acme.co.uk".
|
|
20
|
+
*
|
|
21
|
+
* An internationalized name is returned in the form it was written in ("münchen.de" stays unicode,
|
|
22
|
+
* "xn--mnchen-3ya.de" stays punycode). Returns undefined when the value does not parse to a domain with a
|
|
23
|
+
* listed public suffix (e.g. "n/a", "john.smith").
|
|
24
|
+
*/
|
|
25
|
+
export declare function domainCleanse(value: string | undefined, level?: DomainLevel): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Compare a stored domain or website value with the domain a domain[ci] match rule is looking for.
|
|
28
|
+
* - "host": the stored value is at exactly that host ("https://www.acme.com/about" and "acme.com").
|
|
29
|
+
* - "company": the domain sought has no subdomain and the stored value is on a subdomain of it
|
|
30
|
+
* ("https://portal.acme.com/login" and "acme.com").
|
|
31
|
+
* - undefined: no match, including when the stored value is a page or subdomain on a shared host
|
|
32
|
+
* ("facebook.com/acme"), which never identifies a company.
|
|
33
|
+
*
|
|
34
|
+
* A connector that finds candidates by a contains search keeps the "host" candidates when there are any,
|
|
35
|
+
* and otherwise may keep the "company" ones. Case and the unicode or punycode form of an internationalized
|
|
36
|
+
* name are ignored.
|
|
37
|
+
*/
|
|
38
|
+
export declare function domainCompare(storedValue: string | undefined, matchDomain: string | undefined): "host" | "company" | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a hostname or URL is a shared address rather than a company's own site, so it should not be used to
|
|
41
|
+
* identify a company: a page or subdomain on a shared host such as a social network, site builder, directory,
|
|
42
|
+
* URL shortener or public email provider ("facebook.com/acme", "sites.google.com/view/acme"). The shared
|
|
43
|
+
* host's own address ("facebook.com", "https://www.google.com/") is not shared: it belongs to that company.
|
|
44
|
+
* Pass the original value, not the result of domainCleanse.
|
|
45
|
+
*/
|
|
46
|
+
export declare function domainIsShared(value: string | undefined): boolean;
|
|
8
47
|
export declare function emailCleanse(email: string | undefined): string | undefined;
|
|
9
48
|
export declare function emailIsPublic(email: string | undefined): boolean;
|
|
10
49
|
export declare function tldCheck(tld: string | undefined): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncmatters/script-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "TypeScript type definitions for the SyncMatters script API (types only - scripts execute on the SyncMatters platform)",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"author": "SyncMatters",
|
|
30
30
|
"homepage": "https://syncmatters.com",
|
|
31
|
-
"typesContentHash": "
|
|
31
|
+
"typesContentHash": "a67babb6161481dc866ec520eb17814edf406e0be328319a66082e58751d90f3",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@types/node": "*"
|
|
34
34
|
}
|