@dereekb/model 8.13.9 → 8.15.1
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/CHANGELOG.md +17 -0
- package/package.json +2 -2
- package/src/lib/data/index.d.ts +1 -0
- package/src/lib/data/index.js +5 -0
- package/src/lib/data/index.js.map +1 -0
- package/src/lib/data/website/index.d.ts +2 -0
- package/src/lib/data/website/index.js +6 -0
- package/src/lib/data/website/index.js.map +1 -0
- package/src/lib/data/website/link.d.ts +14 -0
- package/src/lib/data/website/link.js +5 -0
- package/src/lib/data/website/link.js.map +1 -0
- package/src/lib/data/website/link.website.d.ts +104 -0
- package/src/lib/data/website/link.website.js +228 -0
- package/src/lib/data/website/link.website.js.map +1 -0
- package/src/lib/index.d.ts +1 -0
- package/src/lib/index.js +1 -0
- package/src/lib/index.js.map +1 -1
- package/src/lib/service/permission/role.d.ts +12 -0
- package/src/lib/service/permission/role.js +12 -1
- package/src/lib/service/permission/role.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [8.15.1](https://github.com/dereekb/dbx-components/compare/v8.15.0-dev...v8.15.1) (2022-08-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [8.15.0](https://github.com/dereekb/dbx-components/compare/v8.14.0-dev...v8.15.0) (2022-08-09)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [8.14.0](https://github.com/dereekb/dbx-components/compare/v8.13.9-dev...v8.14.0) (2022-08-08)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* added WebsiteLink ([68eda11](https://github.com/dereekb/dbx-components/commit/68eda11f78f96c3f875bbd69fdc856b4164ea7a3))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
5
22
|
## [8.13.9](https://github.com/dereekb/dbx-components/compare/v8.13.8-dev...v8.13.9) (2022-08-05)
|
|
6
23
|
|
|
7
24
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/model",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/util": "8.
|
|
9
|
+
"@dereekb/util": "8.15.1",
|
|
10
10
|
"make-error": "^1.3.0",
|
|
11
11
|
"ts-essentials": "^9.1.2",
|
|
12
12
|
"extra-set": "^2.2.11",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './website';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/model/src/lib/data/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/model/src/lib/data/website/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,yDAA+B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModelTypeString } from '@dereekb/util';
|
|
2
|
+
export declare type WebsiteLinkType = ModelTypeString;
|
|
3
|
+
export declare const UNKNOWN_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
4
|
+
export declare type WebsiteLinkEncodedData = string;
|
|
5
|
+
export interface WebsiteLink {
|
|
6
|
+
/**
|
|
7
|
+
* Type of link.
|
|
8
|
+
*/
|
|
9
|
+
t: WebsiteLinkType;
|
|
10
|
+
/**
|
|
11
|
+
* Encoded website link data
|
|
12
|
+
*/
|
|
13
|
+
d: WebsiteLinkEncodedData;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../../../../../../packages/model/src/lib/data/website/link.ts"],"names":[],"mappings":";;;AAIa,QAAA,yBAAyB,GAAoB,GAAG,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { E164PhoneNumber, EmailAddress, IsolateWebsitePathFunction, ModelKey, WebsiteUrl } from '@dereekb/util';
|
|
2
|
+
import { WebsiteLink, WebsiteLinkType } from './link';
|
|
3
|
+
/**
|
|
4
|
+
* Used for isolating a username from a website that has the username as the base url.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* - https://facebook.com/facebook
|
|
8
|
+
*/
|
|
9
|
+
export declare const WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID: IsolateWebsitePathFunction;
|
|
10
|
+
export declare function usernameFromUsernameOrWebsiteWithBaseUrlUsername(input: ModelKey | WebsiteUrl, prefix?: string): string;
|
|
11
|
+
export declare function usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input: ModelKey | WebsiteUrl, isolateFn: IsolateWebsitePathFunction): string;
|
|
12
|
+
export declare function usernameOrWebsiteUrlToWebsiteUrl(input: string): WebsiteUrl;
|
|
13
|
+
export declare const WEBSITE_URL_WEBSITE_LINK_TYPE = "w";
|
|
14
|
+
export declare function websiteUrlToWebsiteLink(input: WebsiteUrl): WebsiteLink;
|
|
15
|
+
export declare const EMAIL_URL_WEBSITE_LINK_TYPE = "e";
|
|
16
|
+
export declare function emailAddressToWebsiteLink(input: EmailAddress): WebsiteLink;
|
|
17
|
+
export declare const PHONE_URL_WEBSITE_LINK_TYPE = "p";
|
|
18
|
+
export declare function phoneNumberToWebsiteLink(input: E164PhoneNumber): WebsiteLink;
|
|
19
|
+
export declare const FACEBOOK_BASE_URL = "https://www.facebook.com";
|
|
20
|
+
export declare const FACEBOOK_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
21
|
+
export declare type FacebookBaseUrl = typeof FACEBOOK_BASE_URL;
|
|
22
|
+
export declare type FacebookProfileUrl<P extends FacebookProfileId> = `${FacebookBaseUrl}/${P}`;
|
|
23
|
+
export declare type FacebookProfileId = string;
|
|
24
|
+
export declare type FacebookWebsiteLinkType = typeof FACEBOOK_WEBSITE_LINK_TYPE;
|
|
25
|
+
export declare function facebookProfileUrlToWebsiteLink(input: FacebookProfileId | WebsiteUrl): WebsiteLink;
|
|
26
|
+
export declare function facebookProfileUrl<P extends FacebookProfileId>(profileId: P): FacebookProfileUrl<P>;
|
|
27
|
+
export declare const INSTAGRAM_BASE_URL = "https://www.instagram.com";
|
|
28
|
+
export declare const INSTAGRAM_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
29
|
+
export declare type InstagramBaseUrl = typeof INSTAGRAM_BASE_URL;
|
|
30
|
+
export declare type InstagramProfileUrl<P extends InstagramProfileId> = `${InstagramBaseUrl}/${P}`;
|
|
31
|
+
export declare type InstagramProfileId = string;
|
|
32
|
+
export declare type InstagramWebsiteLinkType = typeof INSTAGRAM_WEBSITE_LINK_TYPE;
|
|
33
|
+
export declare function instagramProfileUrlToWebsiteLink(input: InstagramProfileId | WebsiteUrl): WebsiteLink;
|
|
34
|
+
export declare function instagramProfileUrl<P extends InstagramProfileId>(profileId: P): InstagramProfileUrl<P>;
|
|
35
|
+
export declare const TWITTER_BASE_URL = "https://www.twitter.com";
|
|
36
|
+
export declare const TWITTER_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
37
|
+
export declare type TwitterBaseUrl = typeof TWITTER_BASE_URL;
|
|
38
|
+
export declare type TwitterProfileUrl<P extends TwitterProfileId> = `${TwitterBaseUrl}/${P}`;
|
|
39
|
+
export declare type TwitterProfileId = string;
|
|
40
|
+
export declare type TwitterWebsiteLinkType = typeof TWITTER_WEBSITE_LINK_TYPE;
|
|
41
|
+
export declare function twitterProfileUrlToWebsiteLink(input: TwitterProfileId | WebsiteUrl): WebsiteLink;
|
|
42
|
+
export declare function twitterProfileUrl<P extends TwitterProfileId>(profileId: P): TwitterProfileUrl<P>;
|
|
43
|
+
export declare const TIKTOK_BASE_URL = "https://tiktok.com";
|
|
44
|
+
export declare const TIKTOK_USERNAME_PREFIX = "@";
|
|
45
|
+
export declare const TIKTOK_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
46
|
+
export declare type TikTokBaseUrl = typeof TIKTOK_BASE_URL;
|
|
47
|
+
export declare type TikTokProfileUrl<P extends TikTokProfileId> = `${TikTokBaseUrl}/@${P}`;
|
|
48
|
+
export declare type TikTokProfileId = string;
|
|
49
|
+
export declare type TikTokWebsiteLinkType = typeof TIKTOK_WEBSITE_LINK_TYPE;
|
|
50
|
+
export declare function tiktokProfileUrlToWebsiteLink(input: TikTokProfileId | WebsiteUrl): WebsiteLink;
|
|
51
|
+
export declare function tiktokProfileUrl<P extends TikTokProfileId>(profileId: P): TikTokProfileUrl<P>;
|
|
52
|
+
export declare const SNAPCHAT_BASE_URL = "https://snapchat.com";
|
|
53
|
+
export declare const SNAPCHAT_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
54
|
+
export declare type SnapchatBaseUrl = typeof SNAPCHAT_BASE_URL;
|
|
55
|
+
export declare type SnapchatProfileUrl<P extends SnapchatProfileId> = `${SnapchatBaseUrl}/add/${P}`;
|
|
56
|
+
export declare type SnapchatProfileId = string;
|
|
57
|
+
export declare type SnapchatWebsiteLinkType = typeof SNAPCHAT_WEBSITE_LINK_TYPE;
|
|
58
|
+
export declare const SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID: IsolateWebsitePathFunction;
|
|
59
|
+
export declare function snapchatProfileUrlToWebsiteLink(input: SnapchatProfileId | WebsiteUrl): WebsiteLink;
|
|
60
|
+
export declare function snapchatProfileUrl<P extends SnapchatProfileId>(profileId: P): SnapchatProfileUrl<P>;
|
|
61
|
+
export declare const YOUTUBE_BASE_URL = "https://youtube.com";
|
|
62
|
+
export declare const YOUTUBE_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
63
|
+
export declare type YouTubeBaseUrl = typeof YOUTUBE_BASE_URL;
|
|
64
|
+
export declare type YouTubeProfileUrl<P extends YouTubeProfileId> = `${YouTubeBaseUrl}/c/${P}`;
|
|
65
|
+
export declare type YouTubeProfileId = string;
|
|
66
|
+
export declare type YouTubeWebsiteLinkType = typeof YOUTUBE_WEBSITE_LINK_TYPE;
|
|
67
|
+
export declare const YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID: IsolateWebsitePathFunction;
|
|
68
|
+
export declare function youtubeProfileUrlToWebsiteLink(input: YouTubeProfileId | WebsiteUrl): WebsiteLink;
|
|
69
|
+
export declare function youtubeProfileUrl<P extends YouTubeProfileId>(profileId: P): YouTubeProfileUrl<P>;
|
|
70
|
+
export declare const PAYPAL_BASE_URL = "https://paypal.me";
|
|
71
|
+
export declare const PAYPAL_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
72
|
+
export declare type PayPalBaseUrl = typeof PAYPAL_BASE_URL;
|
|
73
|
+
export declare type PayPalProfileUrl<P extends PayPalProfileId> = `${PayPalBaseUrl}/${P}`;
|
|
74
|
+
export declare type PayPalProfileId = string;
|
|
75
|
+
export declare type PayPalWebsiteLinkType = typeof PAYPAL_WEBSITE_LINK_TYPE;
|
|
76
|
+
export declare function paypalProfileUrlToWebsiteLink(input: PayPalProfileId | WebsiteUrl): WebsiteLink;
|
|
77
|
+
export declare function paypalProfileUrl<P extends PayPalProfileId>(profileId: P): PayPalProfileUrl<P>;
|
|
78
|
+
export declare const CASHAPP_BASE_URL = "https://cash.app";
|
|
79
|
+
export declare const CASHAPP_USERNAME_PREFIX = "$";
|
|
80
|
+
export declare const CASHAPP_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
81
|
+
export declare type CashappBaseUrl = typeof CASHAPP_BASE_URL;
|
|
82
|
+
export declare type CashappProfileUrl<P extends CashappProfileId> = `${CashappBaseUrl}/$${P}`;
|
|
83
|
+
export declare type CashappProfileId = string;
|
|
84
|
+
export declare type CashappWebsiteLinkType = typeof CASHAPP_WEBSITE_LINK_TYPE;
|
|
85
|
+
export declare function cashappProfileUrlToWebsiteLink(input: CashappProfileId | WebsiteUrl): WebsiteLink;
|
|
86
|
+
export declare function cashappProfileUrl<P extends CashappProfileId>(profileId: P): CashappProfileUrl<P>;
|
|
87
|
+
export declare const VENMO_BASE_URL = "https://account.venmo.com";
|
|
88
|
+
export declare const VENMO_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
89
|
+
export declare type VenmoBaseUrl = typeof VENMO_BASE_URL;
|
|
90
|
+
export declare type VenmoProfileUrl<P extends VenmoProfileId> = `${VenmoBaseUrl}/u/${P}`;
|
|
91
|
+
export declare type VenmoProfileId = string;
|
|
92
|
+
export declare type VenmoWebsiteLinkType = typeof VENMO_WEBSITE_LINK_TYPE;
|
|
93
|
+
export declare const VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID: IsolateWebsitePathFunction;
|
|
94
|
+
export declare function venmoProfileUrlToWebsiteLink(input: VenmoProfileId | WebsiteUrl): WebsiteLink;
|
|
95
|
+
export declare function venmoProfileUrl<P extends VenmoProfileId>(profileId: P): VenmoProfileUrl<P>;
|
|
96
|
+
export declare const SPOTIFY_BASE_URL = "https://open.spotify.com/";
|
|
97
|
+
export declare const SPOTIFY_WEBSITE_LINK_TYPE: WebsiteLinkType;
|
|
98
|
+
export declare type SpotifyBaseUrl = typeof SPOTIFY_BASE_URL;
|
|
99
|
+
export declare type SpotifyProfileUrl<P extends SpotifyProfileId> = `${SpotifyBaseUrl}/user/${P}`;
|
|
100
|
+
export declare type SpotifyProfileId = string;
|
|
101
|
+
export declare type SpotifyWebsiteLinkType = typeof SPOTIFY_WEBSITE_LINK_TYPE;
|
|
102
|
+
export declare const SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID: IsolateWebsitePathFunction;
|
|
103
|
+
export declare function spotifyProfileUrlToWebsiteLink(input: SpotifyProfileId | WebsiteUrl): WebsiteLink;
|
|
104
|
+
export declare function spotifyProfileUrl<P extends SpotifyProfileId>(profileId: P): SpotifyProfileUrl<P>;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.venmoProfileUrlToWebsiteLink = exports.VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID = exports.VENMO_WEBSITE_LINK_TYPE = exports.VENMO_BASE_URL = exports.cashappProfileUrl = exports.cashappProfileUrlToWebsiteLink = exports.CASHAPP_WEBSITE_LINK_TYPE = exports.CASHAPP_USERNAME_PREFIX = exports.CASHAPP_BASE_URL = exports.paypalProfileUrl = exports.paypalProfileUrlToWebsiteLink = exports.PAYPAL_WEBSITE_LINK_TYPE = exports.PAYPAL_BASE_URL = exports.youtubeProfileUrl = exports.youtubeProfileUrlToWebsiteLink = exports.YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID = exports.YOUTUBE_WEBSITE_LINK_TYPE = exports.YOUTUBE_BASE_URL = exports.snapchatProfileUrl = exports.snapchatProfileUrlToWebsiteLink = exports.SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID = exports.SNAPCHAT_WEBSITE_LINK_TYPE = exports.SNAPCHAT_BASE_URL = exports.tiktokProfileUrl = exports.tiktokProfileUrlToWebsiteLink = exports.TIKTOK_WEBSITE_LINK_TYPE = exports.TIKTOK_USERNAME_PREFIX = exports.TIKTOK_BASE_URL = exports.twitterProfileUrl = exports.twitterProfileUrlToWebsiteLink = exports.TWITTER_WEBSITE_LINK_TYPE = exports.TWITTER_BASE_URL = exports.instagramProfileUrl = exports.instagramProfileUrlToWebsiteLink = exports.INSTAGRAM_WEBSITE_LINK_TYPE = exports.INSTAGRAM_BASE_URL = exports.facebookProfileUrl = exports.facebookProfileUrlToWebsiteLink = exports.FACEBOOK_WEBSITE_LINK_TYPE = exports.FACEBOOK_BASE_URL = exports.phoneNumberToWebsiteLink = exports.PHONE_URL_WEBSITE_LINK_TYPE = exports.emailAddressToWebsiteLink = exports.EMAIL_URL_WEBSITE_LINK_TYPE = exports.websiteUrlToWebsiteLink = exports.WEBSITE_URL_WEBSITE_LINK_TYPE = exports.usernameOrWebsiteUrlToWebsiteUrl = exports.usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername = exports.usernameFromUsernameOrWebsiteWithBaseUrlUsername = exports.WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID = void 0;
|
|
4
|
+
exports.spotifyProfileUrl = exports.spotifyProfileUrlToWebsiteLink = exports.SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID = exports.SPOTIFY_WEBSITE_LINK_TYPE = exports.SPOTIFY_BASE_URL = exports.venmoProfileUrl = void 0;
|
|
5
|
+
const util_1 = require("@dereekb/util");
|
|
6
|
+
/**
|
|
7
|
+
* Used for isolating a username from a website that has the username as the base url.
|
|
8
|
+
*
|
|
9
|
+
* Example:
|
|
10
|
+
* - https://facebook.com/facebook
|
|
11
|
+
*/
|
|
12
|
+
exports.WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID = (0, util_1.isolateWebsitePathFunction)({
|
|
13
|
+
isolatePathComponents: 0,
|
|
14
|
+
removeTrailingSlash: true,
|
|
15
|
+
removeQueryParameters: true
|
|
16
|
+
});
|
|
17
|
+
function usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, prefix) {
|
|
18
|
+
const username = (0, util_1.toRelativeSlashPathStartType)((0, exports.WEBSITE_LINK_ISOLATE_BASE_URL_PROFILE_ID)(usernameOrWebsiteUrlToWebsiteUrl(input)));
|
|
19
|
+
if (prefix) {
|
|
20
|
+
return (0, util_1.addPrefix)(prefix, username);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return username;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.usernameFromUsernameOrWebsiteWithBaseUrlUsername = usernameFromUsernameOrWebsiteWithBaseUrlUsername;
|
|
27
|
+
function usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, isolateFn) {
|
|
28
|
+
return (0, util_1.toRelativeSlashPathStartType)(isolateFn(usernameOrWebsiteUrlToWebsiteUrl(input)));
|
|
29
|
+
}
|
|
30
|
+
exports.usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername = usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername;
|
|
31
|
+
function usernameOrWebsiteUrlToWebsiteUrl(input) {
|
|
32
|
+
return (0, util_1.hasWebsiteDomain)(input) ? input : (0, util_1.toAbsoluteSlashPathStartType)((0, util_1.removeHttpFromUrl)(input));
|
|
33
|
+
}
|
|
34
|
+
exports.usernameOrWebsiteUrlToWebsiteUrl = usernameOrWebsiteUrlToWebsiteUrl;
|
|
35
|
+
// MARK: Website
|
|
36
|
+
exports.WEBSITE_URL_WEBSITE_LINK_TYPE = 'w';
|
|
37
|
+
function websiteUrlToWebsiteLink(input) {
|
|
38
|
+
return {
|
|
39
|
+
t: exports.WEBSITE_URL_WEBSITE_LINK_TYPE,
|
|
40
|
+
d: (0, util_1.removeHttpFromUrl)(input) // website urls are stored as-is without http/https
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.websiteUrlToWebsiteLink = websiteUrlToWebsiteLink;
|
|
44
|
+
// MARK: Email
|
|
45
|
+
exports.EMAIL_URL_WEBSITE_LINK_TYPE = 'e';
|
|
46
|
+
function emailAddressToWebsiteLink(input) {
|
|
47
|
+
return {
|
|
48
|
+
t: exports.EMAIL_URL_WEBSITE_LINK_TYPE,
|
|
49
|
+
d: input
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.emailAddressToWebsiteLink = emailAddressToWebsiteLink;
|
|
53
|
+
// MARK: Phone
|
|
54
|
+
exports.PHONE_URL_WEBSITE_LINK_TYPE = 'p';
|
|
55
|
+
function phoneNumberToWebsiteLink(input) {
|
|
56
|
+
return {
|
|
57
|
+
t: exports.PHONE_URL_WEBSITE_LINK_TYPE,
|
|
58
|
+
d: input
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.phoneNumberToWebsiteLink = phoneNumberToWebsiteLink;
|
|
62
|
+
// MARK: Facebook
|
|
63
|
+
exports.FACEBOOK_BASE_URL = `https://www.facebook.com`;
|
|
64
|
+
exports.FACEBOOK_WEBSITE_LINK_TYPE = 'fb';
|
|
65
|
+
function facebookProfileUrlToWebsiteLink(input) {
|
|
66
|
+
return {
|
|
67
|
+
t: exports.FACEBOOK_WEBSITE_LINK_TYPE,
|
|
68
|
+
d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
exports.facebookProfileUrlToWebsiteLink = facebookProfileUrlToWebsiteLink;
|
|
72
|
+
function facebookProfileUrl(profileId) {
|
|
73
|
+
return `${exports.FACEBOOK_BASE_URL}/${profileId}`;
|
|
74
|
+
}
|
|
75
|
+
exports.facebookProfileUrl = facebookProfileUrl;
|
|
76
|
+
// MARK: Instagram
|
|
77
|
+
exports.INSTAGRAM_BASE_URL = `https://www.instagram.com`;
|
|
78
|
+
exports.INSTAGRAM_WEBSITE_LINK_TYPE = 'ig';
|
|
79
|
+
function instagramProfileUrlToWebsiteLink(input) {
|
|
80
|
+
return {
|
|
81
|
+
t: exports.INSTAGRAM_WEBSITE_LINK_TYPE,
|
|
82
|
+
d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
exports.instagramProfileUrlToWebsiteLink = instagramProfileUrlToWebsiteLink;
|
|
86
|
+
function instagramProfileUrl(profileId) {
|
|
87
|
+
return `${exports.INSTAGRAM_BASE_URL}/${profileId}`;
|
|
88
|
+
}
|
|
89
|
+
exports.instagramProfileUrl = instagramProfileUrl;
|
|
90
|
+
// MARK: Twitter
|
|
91
|
+
exports.TWITTER_BASE_URL = `https://www.twitter.com`;
|
|
92
|
+
exports.TWITTER_WEBSITE_LINK_TYPE = 'tw';
|
|
93
|
+
function twitterProfileUrlToWebsiteLink(input) {
|
|
94
|
+
return {
|
|
95
|
+
t: exports.TWITTER_WEBSITE_LINK_TYPE,
|
|
96
|
+
d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
exports.twitterProfileUrlToWebsiteLink = twitterProfileUrlToWebsiteLink;
|
|
100
|
+
function twitterProfileUrl(profileId) {
|
|
101
|
+
return `${exports.TWITTER_BASE_URL}/${profileId}`;
|
|
102
|
+
}
|
|
103
|
+
exports.twitterProfileUrl = twitterProfileUrl;
|
|
104
|
+
// MARK: Tiktok
|
|
105
|
+
exports.TIKTOK_BASE_URL = `https://tiktok.com`;
|
|
106
|
+
exports.TIKTOK_USERNAME_PREFIX = '@';
|
|
107
|
+
exports.TIKTOK_WEBSITE_LINK_TYPE = 'tt';
|
|
108
|
+
function tiktokProfileUrlToWebsiteLink(input) {
|
|
109
|
+
return {
|
|
110
|
+
t: exports.TIKTOK_WEBSITE_LINK_TYPE,
|
|
111
|
+
d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, exports.TIKTOK_USERNAME_PREFIX)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
exports.tiktokProfileUrlToWebsiteLink = tiktokProfileUrlToWebsiteLink;
|
|
115
|
+
function tiktokProfileUrl(profileId) {
|
|
116
|
+
return `${exports.TIKTOK_BASE_URL}/@${profileId}`;
|
|
117
|
+
}
|
|
118
|
+
exports.tiktokProfileUrl = tiktokProfileUrl;
|
|
119
|
+
// MARK: Snapchat
|
|
120
|
+
exports.SNAPCHAT_BASE_URL = `https://snapchat.com`;
|
|
121
|
+
exports.SNAPCHAT_WEBSITE_LINK_TYPE = 'sc';
|
|
122
|
+
exports.SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID = (0, util_1.isolateWebsitePathFunction)({
|
|
123
|
+
ignoredBasePath: 'add',
|
|
124
|
+
isolatePathComponents: 0,
|
|
125
|
+
removeTrailingSlash: true,
|
|
126
|
+
removeQueryParameters: true
|
|
127
|
+
});
|
|
128
|
+
function snapchatProfileUrlToWebsiteLink(input) {
|
|
129
|
+
return {
|
|
130
|
+
t: exports.SNAPCHAT_WEBSITE_LINK_TYPE,
|
|
131
|
+
d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, exports.SNAPCHAT_WEBSITE_LINK_ISOLATE_PROFILE_ID)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
exports.snapchatProfileUrlToWebsiteLink = snapchatProfileUrlToWebsiteLink;
|
|
135
|
+
function snapchatProfileUrl(profileId) {
|
|
136
|
+
return `${exports.SNAPCHAT_BASE_URL}/add/${profileId}`;
|
|
137
|
+
}
|
|
138
|
+
exports.snapchatProfileUrl = snapchatProfileUrl;
|
|
139
|
+
// MARK: YouTube
|
|
140
|
+
exports.YOUTUBE_BASE_URL = `https://youtube.com`;
|
|
141
|
+
exports.YOUTUBE_WEBSITE_LINK_TYPE = 'yt';
|
|
142
|
+
exports.YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID = (0, util_1.isolateWebsitePathFunction)({
|
|
143
|
+
ignoredBasePath: 'c',
|
|
144
|
+
isolatePathComponents: 0,
|
|
145
|
+
removeTrailingSlash: true,
|
|
146
|
+
removeQueryParameters: true
|
|
147
|
+
});
|
|
148
|
+
function youtubeProfileUrlToWebsiteLink(input) {
|
|
149
|
+
return {
|
|
150
|
+
t: exports.YOUTUBE_WEBSITE_LINK_TYPE,
|
|
151
|
+
d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, exports.YOUTUBE_WEBSITE_LINK_ISOLATE_PROFILE_ID)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
exports.youtubeProfileUrlToWebsiteLink = youtubeProfileUrlToWebsiteLink;
|
|
155
|
+
function youtubeProfileUrl(profileId) {
|
|
156
|
+
return `${exports.YOUTUBE_BASE_URL}/c/${profileId}`;
|
|
157
|
+
}
|
|
158
|
+
exports.youtubeProfileUrl = youtubeProfileUrl;
|
|
159
|
+
// MARK: PayPal
|
|
160
|
+
exports.PAYPAL_BASE_URL = `https://paypal.me`;
|
|
161
|
+
exports.PAYPAL_WEBSITE_LINK_TYPE = 'pp';
|
|
162
|
+
function paypalProfileUrlToWebsiteLink(input) {
|
|
163
|
+
return {
|
|
164
|
+
t: exports.PAYPAL_WEBSITE_LINK_TYPE,
|
|
165
|
+
d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
exports.paypalProfileUrlToWebsiteLink = paypalProfileUrlToWebsiteLink;
|
|
169
|
+
function paypalProfileUrl(profileId) {
|
|
170
|
+
return `${exports.PAYPAL_BASE_URL}/${profileId}`;
|
|
171
|
+
}
|
|
172
|
+
exports.paypalProfileUrl = paypalProfileUrl;
|
|
173
|
+
// MARK: Cashapp
|
|
174
|
+
exports.CASHAPP_BASE_URL = `https://cash.app`;
|
|
175
|
+
exports.CASHAPP_USERNAME_PREFIX = '$';
|
|
176
|
+
exports.CASHAPP_WEBSITE_LINK_TYPE = 'ca';
|
|
177
|
+
function cashappProfileUrlToWebsiteLink(input) {
|
|
178
|
+
return {
|
|
179
|
+
t: exports.CASHAPP_WEBSITE_LINK_TYPE,
|
|
180
|
+
d: usernameFromUsernameOrWebsiteWithBaseUrlUsername(input, exports.CASHAPP_USERNAME_PREFIX)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
exports.cashappProfileUrlToWebsiteLink = cashappProfileUrlToWebsiteLink;
|
|
184
|
+
function cashappProfileUrl(profileId) {
|
|
185
|
+
return `${exports.CASHAPP_BASE_URL}/$${profileId}`;
|
|
186
|
+
}
|
|
187
|
+
exports.cashappProfileUrl = cashappProfileUrl;
|
|
188
|
+
// MARK: Venmo
|
|
189
|
+
exports.VENMO_BASE_URL = `https://account.venmo.com`;
|
|
190
|
+
exports.VENMO_WEBSITE_LINK_TYPE = 'vn';
|
|
191
|
+
exports.VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID = (0, util_1.isolateWebsitePathFunction)({
|
|
192
|
+
ignoredBasePath: 'u',
|
|
193
|
+
isolatePathComponents: 0,
|
|
194
|
+
removeTrailingSlash: true,
|
|
195
|
+
removeQueryParameters: true
|
|
196
|
+
});
|
|
197
|
+
function venmoProfileUrlToWebsiteLink(input) {
|
|
198
|
+
return {
|
|
199
|
+
t: exports.VENMO_WEBSITE_LINK_TYPE,
|
|
200
|
+
d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, exports.VENMO_WEBSITE_LINK_ISOLATE_PROFILE_ID)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
exports.venmoProfileUrlToWebsiteLink = venmoProfileUrlToWebsiteLink;
|
|
204
|
+
function venmoProfileUrl(profileId) {
|
|
205
|
+
return `${exports.VENMO_BASE_URL}/u/${profileId}`;
|
|
206
|
+
}
|
|
207
|
+
exports.venmoProfileUrl = venmoProfileUrl;
|
|
208
|
+
// MARK: Spotify
|
|
209
|
+
exports.SPOTIFY_BASE_URL = `https://open.spotify.com/`;
|
|
210
|
+
exports.SPOTIFY_WEBSITE_LINK_TYPE = 'sp';
|
|
211
|
+
exports.SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID = (0, util_1.isolateWebsitePathFunction)({
|
|
212
|
+
ignoredBasePath: 'user',
|
|
213
|
+
isolatePathComponents: 0,
|
|
214
|
+
removeTrailingSlash: true,
|
|
215
|
+
removeQueryParameters: true
|
|
216
|
+
});
|
|
217
|
+
function spotifyProfileUrlToWebsiteLink(input) {
|
|
218
|
+
return {
|
|
219
|
+
t: exports.SPOTIFY_WEBSITE_LINK_TYPE,
|
|
220
|
+
d: usernameFromUsernameOrWebsiteWithOneOffBaseUrlUsername(input, exports.SPOTIFY_WEBSITE_LINK_ISOLATE_PROFILE_ID)
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
exports.spotifyProfileUrlToWebsiteLink = spotifyProfileUrlToWebsiteLink;
|
|
224
|
+
function spotifyProfileUrl(profileId) {
|
|
225
|
+
return `${exports.SPOTIFY_BASE_URL}/user/${profileId}`;
|
|
226
|
+
}
|
|
227
|
+
exports.spotifyProfileUrl = spotifyProfileUrl;
|
|
228
|
+
//# sourceMappingURL=link.website.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.website.js","sourceRoot":"","sources":["../../../../../../../packages/model/src/lib/data/website/link.website.ts"],"names":[],"mappings":";;;;AAAA,wCAAqQ;AAGrQ;;;;;GAKG;AACU,QAAA,wCAAwC,GAAG,IAAA,iCAA0B,EAAC;IACjF,qBAAqB,EAAE,CAAC;IACxB,mBAAmB,EAAE,IAAI;IACzB,qBAAqB,EAAE,IAAI;CAC5B,CAAC,CAAC;AAEH,SAAgB,gDAAgD,CAAC,KAA4B,EAAE,MAAe;IAC5G,MAAM,QAAQ,GAAG,IAAA,mCAA4B,EAAC,IAAA,gDAAwC,EAAC,gCAAgC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEjI,IAAI,MAAM,EAAE;QACV,OAAO,IAAA,gBAAS,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KACpC;SAAM;QACL,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC;AARD,4GAQC;AAED,SAAgB,sDAAsD,CAAC,KAA4B,EAAE,SAAqC;IACxI,OAAO,IAAA,mCAA4B,EAAC,SAAS,CAAC,gCAAgC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAFD,wHAEC;AAED,SAAgB,gCAAgC,CAAC,KAAa;IAC5D,OAAO,IAAA,uBAAgB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,mCAA4B,EAAC,IAAA,wBAAiB,EAAC,KAAK,CAAC,CAAC,CAAC;AAClG,CAAC;AAFD,4EAEC;AAED,gBAAgB;AACH,QAAA,6BAA6B,GAAG,GAAG,CAAC;AAEjD,SAAgB,uBA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CAAC;AACjD,CAAC;AAFD,8CAEC"}
|
package/src/lib/index.d.ts
CHANGED
package/src/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./data"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./service"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./transform"), exports);
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/src/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/model/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,sDAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/model/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,oDAA0B;AAC1B,sDAA4B"}
|
|
@@ -8,11 +8,23 @@ export declare type GrantedRole = string;
|
|
|
8
8
|
*/
|
|
9
9
|
export declare type GrantedSysAdminRole = typeof GRANTED_SYS_ADMIN_ROLE_KEY;
|
|
10
10
|
export declare const GRANTED_SYS_ADMIN_ROLE_KEY = "sysadmin";
|
|
11
|
+
/**
|
|
12
|
+
* Communicates that the current context is an admin/owner.
|
|
13
|
+
*/
|
|
14
|
+
export declare type GrantedOwnerRole = typeof GRANTED_OWNER_ROLE_KEY;
|
|
15
|
+
export declare const GRANTED_OWNER_ROLE_KEY = "owner";
|
|
11
16
|
/**
|
|
12
17
|
* Communicates that the current context is an admin.
|
|
13
18
|
*/
|
|
14
19
|
export declare type GrantedAdminRole = typeof GRANTED_ADMIN_ROLE_KEY;
|
|
15
20
|
export declare const GRANTED_ADMIN_ROLE_KEY = "admin";
|
|
21
|
+
/**
|
|
22
|
+
* Returns true if the input role is a GrantedAdminRole or a GrantedOwnerRole.
|
|
23
|
+
*
|
|
24
|
+
* @param role
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare function isGrantedAdminLevelRole(role: GrantedRole): boolean;
|
|
16
28
|
/**
|
|
17
29
|
* Communicates that the current context has read access to a model.
|
|
18
30
|
*/
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GrantedRoleMapReaderInstance = exports.grantedRoleMapReader = exports.isFullAccessRoleMap = exports.fullAccessRoleMap = exports.isNoAccessRoleMap = exports.noAccessRoleMap = exports.NO_ACCESS_ROLE_KEY = exports.FULL_ACCESS_ROLE_KEY = exports.GRANTED_DELETE_ROLE_KEY = exports.GRANTED_UPDATE_ROLE_KEY = exports.GRANTED_READ_ROLE_KEY = exports.GRANTED_ADMIN_ROLE_KEY = exports.GRANTED_SYS_ADMIN_ROLE_KEY = void 0;
|
|
3
|
+
exports.GrantedRoleMapReaderInstance = exports.grantedRoleMapReader = exports.isFullAccessRoleMap = exports.fullAccessRoleMap = exports.isNoAccessRoleMap = exports.noAccessRoleMap = exports.NO_ACCESS_ROLE_KEY = exports.FULL_ACCESS_ROLE_KEY = exports.GRANTED_DELETE_ROLE_KEY = exports.GRANTED_UPDATE_ROLE_KEY = exports.GRANTED_READ_ROLE_KEY = exports.isGrantedAdminLevelRole = exports.GRANTED_ADMIN_ROLE_KEY = exports.GRANTED_OWNER_ROLE_KEY = exports.GRANTED_SYS_ADMIN_ROLE_KEY = void 0;
|
|
4
4
|
const util_1 = require("@dereekb/util");
|
|
5
5
|
exports.GRANTED_SYS_ADMIN_ROLE_KEY = 'sysadmin';
|
|
6
|
+
exports.GRANTED_OWNER_ROLE_KEY = 'owner';
|
|
6
7
|
exports.GRANTED_ADMIN_ROLE_KEY = 'admin';
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the input role is a GrantedAdminRole or a GrantedOwnerRole.
|
|
10
|
+
*
|
|
11
|
+
* @param role
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function isGrantedAdminLevelRole(role) {
|
|
15
|
+
return role === exports.GRANTED_ADMIN_ROLE_KEY || role === exports.GRANTED_OWNER_ROLE_KEY;
|
|
16
|
+
}
|
|
17
|
+
exports.isGrantedAdminLevelRole = isGrantedAdminLevelRole;
|
|
7
18
|
exports.GRANTED_READ_ROLE_KEY = 'read';
|
|
8
19
|
exports.GRANTED_UPDATE_ROLE_KEY = 'update';
|
|
9
20
|
exports.GRANTED_DELETE_ROLE_KEY = 'delete';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.js","sourceRoot":"","sources":["../../../../../../../packages/model/src/lib/service/permission/role.ts"],"names":[],"mappings":";;;AAAA,wCAA8E;AAWjE,QAAA,0BAA0B,GAAG,UAAU,CAAC;AAMxC,QAAA,sBAAsB,GAAG,OAAO,CAAC;AAMjC,QAAA,qBAAqB,GAAG,MAAM,CAAC;AAM/B,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AAMnC,QAAA,uBAAuB,GAAG,QAAQ,CAAC;AAInC,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAOlC,QAAA,kBAAkB,GAAG,WAAW,CAAC;AAO9C,SAAgB,eAAe;IAC7B,OAAO;QACL,CAAC,0BAAkB,CAAC,EAAE,IAAI;KAC3B,CAAC;AACJ,CAAC;AAJD,0CAIC;AAED,SAAgB,iBAAiB,CAA4B,KAA0C;IACrG,OAAQ,KAAyB,CAAC,0BAAkB,CAAC,KAAK,IAAI,CAAC;AACjE,CAAC;AAFD,8CAEC;AAMD,SAAgB,iBAAiB;IAC/B,OAAO;QACL,CAAC,4BAAoB,CAAC,EAAE,IAAI;KAC7B,CAAC;AACJ,CAAC;AAJD,8CAIC;AAED,SAAgB,mBAAmB,CAA4B,KAA4C;IACzG,OAAQ,KAA2B,CAAC,4BAAoB,CAAC,KAAK,IAAI,CAAC;AACrE,CAAC;AAFD,kDAEC;AA8BD,S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