profile-pane 3.2.1 → 3.2.2-test.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/README.md +50 -0
- package/lib/303.profile-pane.js +1362 -0
- package/lib/303.profile-pane.js.map +1 -0
- package/lib/303.profile-pane.min.js +2 -0
- package/lib/303.profile-pane.min.js.map +1 -0
- package/lib/ProfileView.css +1090 -0
- package/lib/ProfileView.d.ts +2 -1
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +64 -36
- package/lib/buttonsHelper.d.ts +1 -1
- package/lib/buttonsHelper.d.ts.map +1 -1
- package/lib/buttonsHelper.js +2 -1
- package/lib/editProfilePane/EditCVCard.js +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.js +1 -1
- package/lib/editProfilePane/EditFriendsCard.js +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts.map +1 -1
- package/lib/editProfilePane/EditProfileView.js +4 -5
- package/lib/editProfilePane/editProfilePresenter.d.ts.map +1 -1
- package/lib/editProfilePane/editProfilePresenter.js +5 -4
- package/lib/icons-svg/profileIcons.d.ts +1 -1
- package/lib/icons-svg/profileIcons.d.ts.map +1 -1
- package/lib/icons-svg/profileIcons.js +9 -17
- package/lib/index.d.ts +1 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +74 -40
- package/lib/ontology/otherPreferencesForm.ttl +32 -0
- package/lib/ontology/resumeForm.ttl +349 -0
- package/lib/ontology/socialMedia.ttl +433 -0
- package/lib/profile-pane.js +32266 -13247
- package/lib/profile-pane.js.map +1 -1
- package/lib/profile-pane.min.js +2315 -935
- package/lib/profile-pane.min.js.map +1 -1
- package/lib/rdfFormsHelper.d.ts +13 -1
- package/lib/rdfFormsHelper.d.ts.map +1 -1
- package/lib/rdfFormsHelper.js +13 -1
- package/lib/sections/bio/BioEditDialog.d.ts.map +1 -1
- package/lib/sections/bio/BioEditDialog.js +7 -7
- package/lib/sections/bio/BioSection.css +300 -0
- package/lib/sections/bio/BioSection.d.ts +3 -2
- package/lib/sections/bio/BioSection.d.ts.map +1 -1
- package/lib/sections/bio/BioSection.js +26 -19
- package/lib/sections/bio/mutations.d.ts.map +1 -1
- package/lib/sections/bio/mutations.js +14 -3
- package/lib/sections/contactInfo/ContactInfoEditDialog.css +354 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts +3 -1
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -1
- package/lib/sections/contactInfo/ContactInfoEditDialog.js +183 -98
- package/lib/sections/contactInfo/ContactInfoSection.css +125 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts +2 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -1
- package/lib/sections/contactInfo/ContactInfoSection.js +64 -41
- package/lib/sections/contactInfo/mutations.d.ts.map +1 -1
- package/lib/sections/contactInfo/mutations.js +51 -16
- package/lib/sections/education/EducationEditDialog.d.ts +3 -1
- package/lib/sections/education/EducationEditDialog.d.ts.map +1 -1
- package/lib/sections/education/EducationEditDialog.js +170 -92
- package/lib/sections/education/EducationSection.css +133 -0
- package/lib/sections/education/EducationSection.d.ts +3 -2
- package/lib/sections/education/EducationSection.d.ts.map +1 -1
- package/lib/sections/education/EducationSection.js +32 -25
- package/lib/sections/education/mutations.d.ts.map +1 -1
- package/lib/sections/education/mutations.js +14 -3
- package/lib/sections/heading/HeadingEditDialog.d.ts +4 -1
- package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -1
- package/lib/sections/heading/HeadingEditDialog.js +287 -162
- package/lib/sections/heading/HeadingSection.css +862 -0
- package/lib/sections/heading/HeadingSection.d.ts +3 -2
- package/lib/sections/heading/HeadingSection.d.ts.map +1 -1
- package/lib/sections/heading/HeadingSection.js +63 -32
- package/lib/sections/heading/imageHelpers.d.ts +1 -0
- package/lib/sections/heading/imageHelpers.d.ts.map +1 -1
- package/lib/sections/heading/imageHelpers.js +40 -1
- package/lib/sections/heading/mutations.d.ts.map +1 -1
- package/lib/sections/heading/mutations.js +86 -23
- package/lib/sections/heading/selectors.d.ts.map +1 -1
- package/lib/sections/heading/selectors.js +14 -3
- package/lib/sections/heading/types.d.ts +1 -2
- package/lib/sections/heading/types.d.ts.map +1 -1
- package/lib/sections/languages/LanguageEditDialog.d.ts +3 -1
- package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -1
- package/lib/sections/languages/LanguageEditDialog.js +202 -119
- package/lib/sections/languages/LanguageSection.css +53 -0
- package/lib/sections/languages/LanguageSection.d.ts +2 -0
- package/lib/sections/languages/LanguageSection.d.ts.map +1 -1
- package/lib/sections/languages/LanguageSection.js +42 -31
- package/lib/sections/languages/mutations.d.ts.map +1 -1
- package/lib/sections/languages/mutations.js +60 -161
- package/lib/sections/languages/selectors.d.ts.map +1 -1
- package/lib/sections/languages/selectors.js +1 -2
- package/lib/sections/projects/ProjectEditDialog.d.ts +2 -1
- package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -1
- package/lib/sections/projects/ProjectEditDialog.js +13 -24
- package/lib/sections/projects/ProjectSection.css +368 -0
- package/lib/sections/projects/ProjectSection.d.ts +2 -1
- package/lib/sections/projects/ProjectSection.d.ts.map +1 -1
- package/lib/sections/projects/ProjectSection.js +116 -34
- package/lib/sections/projects/mutations.d.ts.map +1 -1
- package/lib/sections/projects/mutations.js +109 -132
- package/lib/sections/projects/selectors.d.ts.map +1 -1
- package/lib/sections/projects/selectors.js +4 -45
- package/lib/{QRCodeCard.d.ts → sections/qrcode/QRCodeCard.d.ts} +2 -1
- package/lib/sections/qrcode/QRCodeCard.d.ts.map +1 -0
- package/lib/{QRCodeCard.js → sections/qrcode/QRCodeCard.js} +59 -11
- package/lib/sections/qrcode/QRCodeSection.css +108 -0
- package/lib/sections/qrcode/QRCodeSection.d.ts +4 -0
- package/lib/sections/qrcode/QRCodeSection.d.ts.map +1 -0
- package/lib/sections/qrcode/QRCodeSection.js +17 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts +10 -1
- package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -1
- package/lib/sections/resume/ResumeEditDialog.js +531 -149
- package/lib/sections/resume/ResumeSection.css +350 -0
- package/lib/sections/resume/ResumeSection.d.ts +3 -2
- package/lib/sections/resume/ResumeSection.d.ts.map +1 -1
- package/lib/sections/resume/ResumeSection.js +78 -49
- package/lib/sections/resume/mutations.d.ts.map +1 -1
- package/lib/sections/resume/mutations.js +17 -3
- package/lib/sections/resume/selectors.d.ts.map +1 -1
- package/lib/sections/resume/selectors.js +1 -0
- package/lib/sections/resume/types.d.ts +1 -0
- package/lib/sections/resume/types.d.ts.map +1 -1
- package/lib/sections/shared/collapsibleSection.d.ts.map +1 -1
- package/lib/sections/shared/collapsibleSection.js +1 -0
- package/lib/sections/shared/phoneCountries.d.ts +1 -1
- package/lib/sections/shared/phoneCountries.d.ts.map +1 -1
- package/lib/sections/shared/phoneCountries.js +2 -2
- package/lib/sections/shared/projectCommunityNodes.d.ts +6 -0
- package/lib/sections/shared/projectCommunityNodes.d.ts.map +1 -0
- package/lib/sections/shared/projectCommunityNodes.js +56 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts +35 -2
- package/lib/sections/shared/rdfMutationHelpers.d.ts.map +1 -1
- package/lib/sections/shared/rdfMutationHelpers.js +290 -14
- package/lib/sections/shared/sectionCardHelpers.d.ts.map +1 -1
- package/lib/sections/shared/sectionCardHelpers.js +80 -11
- package/lib/sections/shared/types.d.ts +24 -0
- package/lib/sections/shared/types.d.ts.map +1 -1
- package/lib/sections/skills/SkillsEditDialog.d.ts +3 -1
- package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -1
- package/lib/sections/skills/SkillsEditDialog.js +136 -115
- package/lib/sections/skills/SkillsSection.css +173 -0
- package/lib/sections/skills/SkillsSection.d.ts +2 -0
- package/lib/sections/skills/SkillsSection.d.ts.map +1 -1
- package/lib/sections/skills/SkillsSection.js +107 -47
- package/lib/sections/skills/mutations.d.ts.map +1 -1
- package/lib/sections/skills/mutations.js +25 -21
- package/lib/sections/skills/selectors.d.ts.map +1 -1
- package/lib/sections/skills/selectors.js +5 -3
- package/lib/sections/social/SocialEditDialog.d.ts +3 -1
- package/lib/sections/social/SocialEditDialog.d.ts.map +1 -1
- package/lib/sections/social/SocialEditDialog.js +170 -62
- package/lib/sections/social/SocialSection.css +194 -0
- package/lib/sections/social/SocialSection.d.ts +4 -3
- package/lib/sections/social/SocialSection.d.ts.map +1 -1
- package/lib/sections/social/SocialSection.js +59 -43
- package/lib/sections/social/mutations.d.ts.map +1 -1
- package/lib/sections/social/mutations.js +23 -132
- package/lib/specialButtons/AddMeToYourFriends.css +54 -0
- package/lib/specialButtons/addContact/AddMeToYourContacts.css +1118 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.d.ts +10 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.d.ts.map +1 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.js +1123 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.d.ts +16 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.d.ts.map +1 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.js +136 -0
- package/lib/specialButtons/addContact/contactsErrors.d.ts +8 -0
- package/lib/specialButtons/addContact/contactsErrors.d.ts.map +1 -0
- package/lib/specialButtons/addContact/contactsErrors.js +106 -0
- package/lib/specialButtons/addContact/contactsTypes.d.ts +43 -0
- package/lib/specialButtons/addContact/contactsTypes.d.ts.map +1 -0
- package/lib/specialButtons/addContact/contactsTypes.js +5 -0
- package/lib/specialButtons/addContact/helpers.d.ts +7 -0
- package/lib/specialButtons/addContact/helpers.d.ts.map +1 -0
- package/lib/specialButtons/addContact/helpers.js +103 -0
- package/lib/specialButtons/addContact/mutations.d.ts +16 -0
- package/lib/specialButtons/addContact/mutations.d.ts.map +1 -0
- package/lib/specialButtons/addContact/mutations.js +300 -0
- package/lib/specialButtons/addContact/selectors.d.ts +10 -0
- package/lib/specialButtons/addContact/selectors.d.ts.map +1 -0
- package/lib/specialButtons/addContact/selectors.js +163 -0
- package/lib/{addMeToYourFriends.d.ts → specialButtons/addMeToYourFriends.d.ts} +6 -4
- package/lib/specialButtons/addMeToYourFriends.d.ts.map +1 -0
- package/lib/{addMeToYourFriends.js → specialButtons/addMeToYourFriends.js} +46 -11
- package/lib/styles/CollapsibleSection.css +519 -0
- package/lib/styles/EditDialogs.css +506 -686
- package/lib/styles/EditDialogs.responsive.css +989 -0
- package/lib/texts/buttonTexts.d.ts +9 -0
- package/lib/texts/buttonTexts.d.ts.map +1 -0
- package/lib/texts/buttonTexts.js +14 -0
- package/lib/texts/dialogTexts.d.ts +14 -0
- package/lib/texts/dialogTexts.d.ts.map +1 -0
- package/lib/texts/dialogTexts.js +19 -0
- package/lib/texts/messageTexts.d.ts +42 -0
- package/lib/texts/messageTexts.d.ts.map +1 -0
- package/lib/texts/messageTexts.js +47 -0
- package/lib/texts/profileTexts.d.ts +14 -0
- package/lib/texts/profileTexts.d.ts.map +1 -0
- package/lib/texts/profileTexts.js +19 -0
- package/lib/texts/qrCodeTexts.d.ts +2 -0
- package/lib/texts/qrCodeTexts.d.ts.map +1 -0
- package/lib/texts/qrCodeTexts.js +7 -0
- package/lib/texts.d.ts +5 -60
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +55 -70
- package/lib/ui/dialog.css +233 -0
- package/lib/ui/dialog.d.ts +15 -1
- package/lib/ui/dialog.d.ts.map +1 -1
- package/lib/ui/dialog.js +245 -45
- package/lib/ui/dialog.responsive.css +195 -0
- package/lib/ui/errors.d.ts.map +1 -1
- package/lib/ui/errors.js +2 -1
- package/lib/ui/spinner.d.ts +3 -0
- package/lib/ui/spinner.d.ts.map +1 -0
- package/lib/ui/spinner.js +13 -0
- package/lib/utils/debug.d.ts +5 -0
- package/lib/utils/debug.d.ts.map +1 -0
- package/lib/utils/debug.js +23 -0
- package/lib/utils/errorDisplay.d.ts +2 -0
- package/lib/utils/errorDisplay.d.ts.map +1 -0
- package/lib/utils/errorDisplay.js +19 -0
- package/package.json +32 -25
- package/lib/ChatWithMe.d.ts +0 -7
- package/lib/ChatWithMe.d.ts.map +0 -1
- package/lib/ChatWithMe.js +0 -90
- package/lib/QRCodeCard.d.ts.map +0 -1
- package/lib/addMeToYourFriends.d.ts.map +0 -1
- package/lib/sections/heading/camera.d.ts +0 -19
- package/lib/sections/heading/camera.d.ts.map +0 -1
- package/lib/sections/heading/camera.js +0 -199
- package/lib/styles/BioSection.css +0 -77
- package/lib/styles/CVCard.css +0 -142
- package/lib/styles/ChatWithMe.css +0 -6
- package/lib/styles/ContactInfoEditDialog.css +0 -153
- package/lib/styles/EducationCard.css +0 -103
- package/lib/styles/HeadingSection.css +0 -309
- package/lib/styles/ProfileCard.css +0 -66
- package/lib/styles/ProfileView.css +0 -65
- package/lib/styles/ProjectsCard.css +0 -206
- package/lib/styles/QRCodeCard.css +0 -43
- package/lib/styles/SocialCard.css +0 -89
- package/lib/styles/dialog.css +0 -209
- package/lib/styles/utilities.css +0 -740
|
@@ -0,0 +1,1362 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(this["webpackChunkProfilePane"] = this["webpackChunkProfilePane"] || []).push([[303],{
|
|
3
|
+
|
|
4
|
+
/***/ 8068
|
|
5
|
+
(module) {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var ShortUniqueId = (() => {
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
15
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
|
+
var __spreadValues = (a, b) => {
|
|
17
|
+
for (var prop in b || (b = {}))
|
|
18
|
+
if (__hasOwnProp.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
if (__getOwnPropSymbols)
|
|
21
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
22
|
+
if (__propIsEnum.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
};
|
|
27
|
+
var __export = (target, all) => {
|
|
28
|
+
for (var name in all)
|
|
29
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
30
|
+
};
|
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
33
|
+
for (let key of __getOwnPropNames(from))
|
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
36
|
+
}
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
40
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
41
|
+
|
|
42
|
+
// src/index.ts
|
|
43
|
+
var index_exports = {};
|
|
44
|
+
__export(index_exports, {
|
|
45
|
+
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
46
|
+
DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
|
|
47
|
+
default: () => ShortUniqueId
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// package.json
|
|
51
|
+
var version = "5.3.2";
|
|
52
|
+
|
|
53
|
+
// src/index.ts
|
|
54
|
+
var DEFAULT_UUID_LENGTH = 6;
|
|
55
|
+
var DEFAULT_OPTIONS = {
|
|
56
|
+
dictionary: "alphanum",
|
|
57
|
+
shuffle: true,
|
|
58
|
+
debug: false,
|
|
59
|
+
length: DEFAULT_UUID_LENGTH,
|
|
60
|
+
counter: 0
|
|
61
|
+
};
|
|
62
|
+
var _ShortUniqueId = class _ShortUniqueId {
|
|
63
|
+
constructor(argOptions = {}) {
|
|
64
|
+
__publicField(this, "counter");
|
|
65
|
+
__publicField(this, "debug");
|
|
66
|
+
__publicField(this, "dict");
|
|
67
|
+
__publicField(this, "version");
|
|
68
|
+
__publicField(this, "dictIndex", 0);
|
|
69
|
+
__publicField(this, "dictRange", []);
|
|
70
|
+
__publicField(this, "lowerBound", 0);
|
|
71
|
+
__publicField(this, "upperBound", 0);
|
|
72
|
+
__publicField(this, "dictLength", 0);
|
|
73
|
+
__publicField(this, "uuidLength");
|
|
74
|
+
__publicField(this, "_digit_first_ascii", 48);
|
|
75
|
+
__publicField(this, "_digit_last_ascii", 58);
|
|
76
|
+
__publicField(this, "_alpha_lower_first_ascii", 97);
|
|
77
|
+
__publicField(this, "_alpha_lower_last_ascii", 123);
|
|
78
|
+
__publicField(this, "_hex_last_ascii", 103);
|
|
79
|
+
__publicField(this, "_alpha_upper_first_ascii", 65);
|
|
80
|
+
__publicField(this, "_alpha_upper_last_ascii", 91);
|
|
81
|
+
__publicField(this, "_number_dict_ranges", {
|
|
82
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii]
|
|
83
|
+
});
|
|
84
|
+
__publicField(this, "_alpha_dict_ranges", {
|
|
85
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
|
|
86
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
87
|
+
});
|
|
88
|
+
__publicField(this, "_alpha_lower_dict_ranges", {
|
|
89
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
|
|
90
|
+
});
|
|
91
|
+
__publicField(this, "_alpha_upper_dict_ranges", {
|
|
92
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
93
|
+
});
|
|
94
|
+
__publicField(this, "_alphanum_dict_ranges", {
|
|
95
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
96
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
|
|
97
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
98
|
+
});
|
|
99
|
+
__publicField(this, "_alphanum_lower_dict_ranges", {
|
|
100
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
101
|
+
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
|
|
102
|
+
});
|
|
103
|
+
__publicField(this, "_alphanum_upper_dict_ranges", {
|
|
104
|
+
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
105
|
+
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
106
|
+
});
|
|
107
|
+
__publicField(this, "_hex_dict_ranges", {
|
|
108
|
+
decDigits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
109
|
+
alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
|
|
110
|
+
});
|
|
111
|
+
__publicField(this, "_dict_ranges", {
|
|
112
|
+
_number_dict_ranges: this._number_dict_ranges,
|
|
113
|
+
_alpha_dict_ranges: this._alpha_dict_ranges,
|
|
114
|
+
_alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
|
|
115
|
+
_alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
|
|
116
|
+
_alphanum_dict_ranges: this._alphanum_dict_ranges,
|
|
117
|
+
_alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
|
|
118
|
+
_alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
|
|
119
|
+
_hex_dict_ranges: this._hex_dict_ranges
|
|
120
|
+
});
|
|
121
|
+
/* tslint:disable consistent-return */
|
|
122
|
+
__publicField(this, "log", (...args) => {
|
|
123
|
+
const finalArgs = [...args];
|
|
124
|
+
finalArgs[0] = "[short-unique-id] ".concat(args[0]);
|
|
125
|
+
if (this.debug === true) {
|
|
126
|
+
if (typeof console !== "undefined" && console !== null) {
|
|
127
|
+
console.log(...finalArgs);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
/* tslint:enable consistent-return */
|
|
133
|
+
__publicField(this, "_normalizeDictionary", (dictionary, shuffle) => {
|
|
134
|
+
let finalDict;
|
|
135
|
+
if (dictionary && Array.isArray(dictionary) && dictionary.length > 1) {
|
|
136
|
+
finalDict = dictionary;
|
|
137
|
+
} else {
|
|
138
|
+
finalDict = [];
|
|
139
|
+
this.dictIndex = 0;
|
|
140
|
+
const rangesName = "_".concat(dictionary, "_dict_ranges");
|
|
141
|
+
const ranges = this._dict_ranges[rangesName];
|
|
142
|
+
let capacity = 0;
|
|
143
|
+
for (const [, rangeValue] of Object.entries(ranges)) {
|
|
144
|
+
const [lower, upper] = rangeValue;
|
|
145
|
+
capacity += Math.abs(upper - lower);
|
|
146
|
+
}
|
|
147
|
+
finalDict = new Array(capacity);
|
|
148
|
+
let dictIdx = 0;
|
|
149
|
+
for (const [, rangeTypeValue] of Object.entries(ranges)) {
|
|
150
|
+
this.dictRange = rangeTypeValue;
|
|
151
|
+
this.lowerBound = this.dictRange[0];
|
|
152
|
+
this.upperBound = this.dictRange[1];
|
|
153
|
+
const isAscending = this.lowerBound <= this.upperBound;
|
|
154
|
+
const start = this.lowerBound;
|
|
155
|
+
const end = this.upperBound;
|
|
156
|
+
if (isAscending) {
|
|
157
|
+
for (let i = start; i < end; i++) {
|
|
158
|
+
finalDict[dictIdx++] = String.fromCharCode(i);
|
|
159
|
+
this.dictIndex = i;
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
for (let i = start; i > end; i--) {
|
|
163
|
+
finalDict[dictIdx++] = String.fromCharCode(i);
|
|
164
|
+
this.dictIndex = i;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
finalDict.length = dictIdx;
|
|
169
|
+
}
|
|
170
|
+
if (shuffle) {
|
|
171
|
+
const len = finalDict.length;
|
|
172
|
+
for (let i = len - 1; i > 0; i--) {
|
|
173
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
174
|
+
[finalDict[i], finalDict[j]] = [finalDict[j], finalDict[i]];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return finalDict;
|
|
178
|
+
});
|
|
179
|
+
/** Change the dictionary after initialization. */
|
|
180
|
+
__publicField(this, "setDictionary", (dictionary, shuffle) => {
|
|
181
|
+
this.dict = this._normalizeDictionary(dictionary, shuffle);
|
|
182
|
+
this.dictLength = this.dict.length;
|
|
183
|
+
this.setCounter(0);
|
|
184
|
+
});
|
|
185
|
+
__publicField(this, "seq", () => {
|
|
186
|
+
return this.sequentialUUID();
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* Generates UUID based on internal counter that's incremented after each ID generation.
|
|
190
|
+
* @alias `const uid = new ShortUniqueId(); uid.seq();`
|
|
191
|
+
*/
|
|
192
|
+
__publicField(this, "sequentialUUID", () => {
|
|
193
|
+
const dictLen = this.dictLength;
|
|
194
|
+
const dict = this.dict;
|
|
195
|
+
let counterDiv = this.counter;
|
|
196
|
+
const idParts = [];
|
|
197
|
+
do {
|
|
198
|
+
const counterRem = counterDiv % dictLen;
|
|
199
|
+
counterDiv = Math.trunc(counterDiv / dictLen);
|
|
200
|
+
idParts.push(dict[counterRem]);
|
|
201
|
+
} while (counterDiv !== 0);
|
|
202
|
+
const id = idParts.join("");
|
|
203
|
+
this.counter += 1;
|
|
204
|
+
return id;
|
|
205
|
+
});
|
|
206
|
+
__publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
|
|
207
|
+
return this.randomUUID(uuidLength);
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* Generates UUID by creating each part randomly.
|
|
211
|
+
* @alias `const uid = new ShortUniqueId(); uid.rnd(uuidLength: number);`
|
|
212
|
+
*/
|
|
213
|
+
__publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
|
|
214
|
+
if (uuidLength === null || typeof uuidLength === "undefined" || uuidLength < 1) {
|
|
215
|
+
throw new Error("Invalid UUID Length Provided");
|
|
216
|
+
}
|
|
217
|
+
const result = new Array(uuidLength);
|
|
218
|
+
const dictLen = this.dictLength;
|
|
219
|
+
const dict = this.dict;
|
|
220
|
+
for (let j = 0; j < uuidLength; j++) {
|
|
221
|
+
const randomPartIdx = Math.floor(Math.random() * dictLen);
|
|
222
|
+
result[j] = dict[randomPartIdx];
|
|
223
|
+
}
|
|
224
|
+
return result.join("");
|
|
225
|
+
});
|
|
226
|
+
__publicField(this, "fmt", (format, date) => {
|
|
227
|
+
return this.formattedUUID(format, date);
|
|
228
|
+
});
|
|
229
|
+
/**
|
|
230
|
+
* Generates custom UUID with the provided format string.
|
|
231
|
+
* @alias `const uid = new ShortUniqueId(); uid.fmt(format: string);`
|
|
232
|
+
*/
|
|
233
|
+
__publicField(this, "formattedUUID", (format, date) => {
|
|
234
|
+
const fnMap = {
|
|
235
|
+
$r: this.randomUUID,
|
|
236
|
+
$s: this.sequentialUUID,
|
|
237
|
+
$t: this.stamp
|
|
238
|
+
};
|
|
239
|
+
const result = format.replace(/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g, (m) => {
|
|
240
|
+
const fn = m.slice(0, 2);
|
|
241
|
+
const len = Number.parseInt(m.slice(2), 10);
|
|
242
|
+
if (fn === "$s") {
|
|
243
|
+
return fnMap[fn]().padStart(len, "0");
|
|
244
|
+
}
|
|
245
|
+
if (fn === "$t" && date) {
|
|
246
|
+
return fnMap[fn](len, date);
|
|
247
|
+
}
|
|
248
|
+
return fnMap[fn](len);
|
|
249
|
+
});
|
|
250
|
+
return result;
|
|
251
|
+
});
|
|
252
|
+
/**
|
|
253
|
+
* Calculates total number of possible UUIDs.
|
|
254
|
+
*
|
|
255
|
+
* Given that:
|
|
256
|
+
*
|
|
257
|
+
* - `H` is the total number of possible UUIDs
|
|
258
|
+
* - `n` is the number of unique characters in the dictionary
|
|
259
|
+
* - `l` is the UUID length
|
|
260
|
+
*
|
|
261
|
+
* Then `H` is defined as `n` to the power of `l`:
|
|
262
|
+
*
|
|
263
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
264
|
+
* <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOwAAABHCAYAAAAECKs5AAALxUlEQVR4Ae2dd+wFRRHHv1YsGHtXVLBjV9T4jw3FAoIFu2JH7ARFjSVqUCFo7CIIKKioMUrsMdagwdiNvTcs2LCLXe8Tb8lm2L3f/d7evtt7v5nkZe/u3e7OfW/2dmd3ZlZycgQcgVYQ2EXSzSXdX9Khko6QdKykd0k6TdIprTDqfDgCjoB0pKT/Dvy+6yA5Ao5AOwjcpGPleZKO7nvTv5rG+/p2WHVOHAFHwCLwEdNgH2Rv8HNHwBFoA4HzSvqtabBXboM158IRcAQsAjc2jfU79gY/dwQcgXYQeLJpsMe1w5pz4gg4AhYBlnLiGWPXXy1Cfu4INILAeST92jRY118beTnOhiNgEXD91SLi545Awwi4/trwy3HWHAGLgOuvFhE/dwQaRcD110ZfjLPlCKQQcP01hYpfcwQaRWAt+ut9JR0m6TGSHi7pQEn7S9p7xG+//v6D+vy4FZF/DOGKdLikg/u85OM3pt59+nsf2Od9gqRDJF1iTMV+jyNQCYHq+uttzHpRvNhbcjym4di1qpL6Qt4HV3oRXqwjsBUCa9Ff95T06c7p9ltd7/pjSWdJOnubjfgffb4fSMJmEqfdrYiHe6+kr0j6fm8o/cdt1ksjhd8z+jI+JskXqLdC3v+vhcBs+uv5Jd1U0ukDDeizku4iadeJn/7qkl42UC8eEI+WdKWJ6/XiHIFSBJ5i5Hbt9sPPNwyEYedvukZ18dKnG8h/i0y91H/XgXz+lyMwJwKnGrldu/3wWw0DocHW/nIwkRTqitMzJeFn6OQ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m2pZEsNQAAAABJRU5ErkJggg==" />
|
|
265
|
+
* </div>
|
|
266
|
+
*
|
|
267
|
+
* This function returns `H`.
|
|
268
|
+
*/
|
|
269
|
+
__publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
|
|
270
|
+
return Number.parseFloat(([...new Set(this.dict)].length ** uuidLength).toFixed(0));
|
|
271
|
+
});
|
|
272
|
+
/**
|
|
273
|
+
* Calculates approximate number of hashes before first collision.
|
|
274
|
+
*
|
|
275
|
+
* Given that:
|
|
276
|
+
*
|
|
277
|
+
* - `H` is the total number of possible UUIDs, or in terms of this library,
|
|
278
|
+
* the result of running `availableUUIDs()`
|
|
279
|
+
* - the expected number of values we have to choose before finding the
|
|
280
|
+
* first collision can be expressed as the quantity `Q(H)`
|
|
281
|
+
*
|
|
282
|
+
* Then `Q(H)` can be approximated as the square root of the product of half
|
|
283
|
+
* of pi times `H`:
|
|
284
|
+
*
|
|
285
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
286
|
+
* <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM0AAABNCAYAAAAFDOCxAAAP5klEQVR4Ae2dBdD0SBGGX/xwdyjc3eHgkMLdpaCAw71wOeDQQwp3KdwKd3fncLfD3d0d9vlr+mdu/tmkJ8nut5uvuyq1m2Qy0hlpeXsiBQUHVsOBk0n6vKRDZ3ishmOR667nwC0l/WHBhYfM8Nj1LzcYsBoOPF/Sm1aTdeQaHJgnB74h6b7zbFq0KjgwPQdOKum/kvafPuvIMTgwTw5cV9LfJB1tns2LVgUHpufAEyV9cPpsI8fgwHw58ClJh8y3edGy4MC0HDimpH9KuvK02UZuwYH5cuBykv4t6XjzbWK0LDgwLQdwZn5u2iwjt+DAvDnwHklPnXcTo3XBgek4cGRJf5R0Q2eWR5F0Wkmndx4ncOYbyYIDW8OBCyWn5ql6asxgeYykP6f0OEI9x38knb0n77gdHNgqDtxD0nd6anxESW+W9DtJr5f07HT8OPvPtS8tBsir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yflhgDwbkHBgY3iwA/TwFkWdkHQGWiPdZKBLrHMjsEPrrPOUdYu4gA7ELHa4Jsq4/4t6Mzz+ZSpWGbuCOrEZvdBwYGN44Ahz+mkpbJvQWcMnnWRhZx494JYV72inODAXg4ckOk1ZWQoaN+xIdZ7C3L8QSzDL4NzeY7ocgcLIsk2cADgLLoDKw3bcOUECBcn5DoI/w14M6JWg4IDG88BCw8/LKupBZ1hll41gWgGabJug8Oq2xX5z5gD7APBSoNPxCArAFZdu02O5AuoEja0WPZpRxAaY5EnI6sYjwcH9uUAwFkGDYfB8Qk6Y6P5VRLWOnxAywYMZaPfDAkbX2W9I+/ggPjcvA0aE5EIOuuCuYxlGw5MtvPqi6vCf+SJ9R9bn3g+ONDEASxVKOEMHGD7FnR2YFMubYlZQYjPIramdiAeEqhG3FVQcGAjOQBchUFDuAdhG/xfFYD1oGxlsxVu2e+mfwdnI19mVGo9HLBP7dF5QT8Tt78KQhTEwLBskJTXvRtErqKukWdwoJMD18g6Mns4jPnAV1dB6CdYw7zHfl2Zxb3gwE5ygG2O8lk+cF87+Tai7K3hAOHnNnDYLy4oOBAc6OEAXxVg0LD9bJh5e5gVt4MDcMC+A/TOYEdwIDjg4wCx+Kw0B/uSR6rgQHCAmH02GCGGP6jCgf8BynL2Ji/GeXEAAAAASUVORK5CYII=" />
|
|
287
|
+
* </div>
|
|
288
|
+
*
|
|
289
|
+
* This function returns `Q(H)`.
|
|
290
|
+
*
|
|
291
|
+
* (see [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution))
|
|
292
|
+
*/
|
|
293
|
+
// Cache for memoization
|
|
294
|
+
__publicField(this, "_collisionCache", /* @__PURE__ */ new Map());
|
|
295
|
+
__publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
|
|
296
|
+
const cacheKey = rounds;
|
|
297
|
+
const cached = this._collisionCache.get(cacheKey);
|
|
298
|
+
if (cached !== void 0) {
|
|
299
|
+
return cached;
|
|
300
|
+
}
|
|
301
|
+
const result = Number.parseFloat(Math.sqrt(Math.PI / 2 * rounds).toFixed(20));
|
|
302
|
+
this._collisionCache.set(cacheKey, result);
|
|
303
|
+
return result;
|
|
304
|
+
});
|
|
305
|
+
/**
|
|
306
|
+
* Calculates probability of generating duplicate UUIDs (a collision) in a
|
|
307
|
+
* given number of UUID generation rounds.
|
|
308
|
+
*
|
|
309
|
+
* Given that:
|
|
310
|
+
*
|
|
311
|
+
* - `r` is the maximum number of times that `randomUUID()` will be called,
|
|
312
|
+
* or better said the number of _rounds_
|
|
313
|
+
* - `H` is the total number of possible UUIDs, or in terms of this library,
|
|
314
|
+
* the result of running `availableUUIDs()`
|
|
315
|
+
*
|
|
316
|
+
* Then the probability of collision `p(r; H)` can be approximated as the result
|
|
317
|
+
* of dividing the square root of the product of half of pi times `r` by `H`:
|
|
318
|
+
*
|
|
319
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
320
|
+
* <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAABJCAYAAABIOHjCAAAO+klEQVR4Ae2dBfDsxg3GvzIzY8qMaVJMGVNmZpjSlJnbtCmkkDIzTxlSxpSbMjOnzMxwv9fVG42f9yz7zgd/SzOe89mL8pK0n7RSUnJgOzlwA0mflfSODbm2k4tZ6klz4JiSfiHpvZIO3pBr0h8kK7+dHLi7pF9KOtZ2Fj9LnRxYPweOIukHku6//qJkCZID28uB20n6naTjV6pwZEnXk3SApMfOue5WiZ+PkwM7ngNHkvRNSY+s1PQYRW76i6TvSPqNpMPL/c8lcfGc612VNPJxcmDHc+Amkv4s6SSVmr5I0j0lHbW8f52kE5X7+0m6dCVePk4OTIYDR5D0JUlPqtT4uJJu6d6x9PuY+/9GSad2//M2OTBJDlxzpmD4m6RTBWt/a0kHubA/Si2f40beTpYDh0l6do/aHyrpiiU8mr5/SzpFj/gZNDmw4zhwBUn/knTmYM32KbOX7TOxpPuvpL2D8TNYcmBHcoDZ5WU9avZqS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0yCA5ix2DINiFAXeU9Pq/Jp3lWmfJ8cWDsHMMexjhQxaARFYuH3WXvpswDJgQ3hgFkyAw+KkOHrcGWd8lGEYxlmEhywIzOjnnAxVWFGWsQKeRKMzUpOhwPAymyZ1tcTbspH02knWdMODgCxso7U1xNuykcdzM3X0+EA1sR0JDZgI2T7R+DrUj6KcCzD7FgO4KEJb7T44cDnAh0Ja2t8+eGfo+kFCesCvANzWB3+GAjPeVqc2rHfAH8jO5axWbHpcAADUw6g43C7touTIM0xj3GFM7XawvKM8ByqNjr9D+9YuR11hSRCAAAAAElFTkSuQmCC" />
|
|
321
|
+
* </div>
|
|
322
|
+
*
|
|
323
|
+
* This function returns `p(r; H)`.
|
|
324
|
+
*
|
|
325
|
+
* (see [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution))
|
|
326
|
+
*
|
|
327
|
+
* (Useful if you are wondering _"If I use this lib and expect to perform at most
|
|
328
|
+
* `r` rounds of UUID generations, what is the probability that I will hit a duplicate UUID?"_.)
|
|
329
|
+
*/
|
|
330
|
+
__publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
|
|
331
|
+
return Number.parseFloat(
|
|
332
|
+
(this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
|
|
333
|
+
);
|
|
334
|
+
});
|
|
335
|
+
/**
|
|
336
|
+
* Calculate a "uniqueness" score (from 0 to 1) of UUIDs based on size of
|
|
337
|
+
* dictionary and chosen UUID length.
|
|
338
|
+
*
|
|
339
|
+
* Given that:
|
|
340
|
+
*
|
|
341
|
+
* - `H` is the total number of possible UUIDs, or in terms of this library,
|
|
342
|
+
* the result of running `availableUUIDs()`
|
|
343
|
+
* - `Q(H)` is the approximate number of hashes before first collision,
|
|
344
|
+
* or in terms of this library, the result of running `approxMaxBeforeCollision()`
|
|
345
|
+
*
|
|
346
|
+
* Then `uniqueness` can be expressed as the additive inverse of the probability of
|
|
347
|
+
* generating a "word" I had previously generated (a duplicate) at any given iteration
|
|
348
|
+
* up to the the total number of possible UUIDs expressed as the quotiend of `Q(H)` and `H`:
|
|
349
|
+
*
|
|
350
|
+
* <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
|
|
351
|
+
* <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIcAAABDCAYAAAC2nhaoAAAJK0lEQVR4Ae2dB+w9RRHHvyCgYgUVxViCBQIRFRQEFVEERVGKggYwJiAkxCgqECkRJQqiCQjSYsEYCyrFggRDSywUpSN/ihXQINUCCigK4vvEmWS5XJm99/+/37t3O8nl3tudLTc7tzM7M7snFZgVBVaSdLikrWfVYEM7x0vaqCGvJAco8BhJW0raV9IRkg6V9B5JawfKNqGcKOljTZkzTH+apEslvXKGbS5EU8+T9FlJv5Z0jKQ3S3qZpNdJ+rikuySdIekFmU/7YUnfC5Z5iqRf2XWFpPT6paTfS9oqqeuxkq6zPqe4/L7G8LdP8Pm5nqTfSHpWJb38raHAKpL2l3SPzRRPrcEh6en21v3FGKYB7VHJm0q6U9IzH5Xa/udxkp4vCRHwiF0flLSWpNVrisIgMPZnEvyDbPCfUINP0n6T2fHHkhB3BRoosOZED7hI0t8kvb4BJ01mkP8sCQZZJ82o+b2yMdMBNXmRpBNssP8YQZZ0pOHTN0RjG6xqs8pubUhjznuOpOsl3SeJNzwK6A680V2iYg8TRXVve6StZdbO1yLIki4x/O8H8feR9CdJTwzijwbtyZJuNGK+K/OpX2zl/ivphS1l0RGObslvy3rGRM+hfphwzzZEy2OA/234Hwrgg0KZv0uCSQoYBZCzvF0Q/ts9qEJ5xBDl399QHqWR/I0b8ruSd7by1BFRgLdN8FGio/AtSZdFkceAx5sC0XnTIoSvowkrGur4Yl3mRBn8wuSNvGMKhS9X33BlFH0DXScK77XneEm0wCLjPckGjYHF9tAXbjGiNukd5PeZlbw/LE/pY1Tf+EVHf7ze6p1VDu2w3B49YK+AGFzr96QGYuVfVsdpNXW4TsJysg/k6hswfK6+kfb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8S94/THx48DlK/EaQUENGQxF1EzgzB19cIK0JCBNMv9DEBwRhrgILRAE+icFXqLmqG8I5fH5Z5Vn5ymQVz/+Dz0G5q1bKzOzv/wAvzKhnhyEMfQAAAABJRU5ErkJggg==" />
|
|
352
|
+
* </div>
|
|
353
|
+
*
|
|
354
|
+
* (Useful if you need a value to rate the "quality" of the combination of given dictionary
|
|
355
|
+
* and UUID length. The closer to 1, higher the uniqueness and thus better the quality.)
|
|
356
|
+
*/
|
|
357
|
+
__publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
|
|
358
|
+
const score = Number.parseFloat(
|
|
359
|
+
(1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
|
|
360
|
+
);
|
|
361
|
+
return score > 1 ? 1 : score < 0 ? 0 : score;
|
|
362
|
+
});
|
|
363
|
+
/**
|
|
364
|
+
* Return the version of this module.
|
|
365
|
+
*/
|
|
366
|
+
__publicField(this, "getVersion", () => {
|
|
367
|
+
return this.version;
|
|
368
|
+
});
|
|
369
|
+
/**
|
|
370
|
+
* Generates a UUID with a timestamp that can be extracted using `uid.parseStamp(stampString);`.
|
|
371
|
+
*
|
|
372
|
+
* ```js
|
|
373
|
+
* const uidWithTimestamp = uid.stamp(32);
|
|
374
|
+
* console.log(uidWithTimestamp);
|
|
375
|
+
* // GDa608f973aRCHLXQYPTbKDbjDeVsSb3
|
|
376
|
+
*
|
|
377
|
+
* console.log(uid.parseStamp(uidWithTimestamp));
|
|
378
|
+
* // 2021-05-03T06:24:58.000Z
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
__publicField(this, "stamp", (finalLength, date) => {
|
|
382
|
+
const hexStamp = Math.floor(+(date || /* @__PURE__ */ new Date()) / 1e3).toString(16);
|
|
383
|
+
if (typeof finalLength === "number" && finalLength === 0) {
|
|
384
|
+
return hexStamp;
|
|
385
|
+
}
|
|
386
|
+
if (typeof finalLength !== "number" || finalLength < 10) {
|
|
387
|
+
throw new Error(
|
|
388
|
+
[
|
|
389
|
+
"Param finalLength must be a number greater than or equal to 10,",
|
|
390
|
+
"or 0 if you want the raw hexadecimal timestamp"
|
|
391
|
+
].join("\n")
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
const idLength = finalLength - 9;
|
|
395
|
+
const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
|
|
396
|
+
const id = this.randomUUID(idLength);
|
|
397
|
+
return "".concat(id.substring(0, rndIdx)).concat(hexStamp).concat(id.substring(rndIdx)).concat(rndIdx.toString(16));
|
|
398
|
+
});
|
|
399
|
+
/**
|
|
400
|
+
* Extracts the date embeded in a UUID generated using the `uid.stamp(finalLength);` method.
|
|
401
|
+
*
|
|
402
|
+
* ```js
|
|
403
|
+
* const uidWithTimestamp = uid.stamp(32);
|
|
404
|
+
* console.log(uidWithTimestamp);
|
|
405
|
+
* // GDa608f973aRCHLXQYPTbKDbjDeVsSb3
|
|
406
|
+
*
|
|
407
|
+
* console.log(uid.parseStamp(uidWithTimestamp));
|
|
408
|
+
* // 2021-05-03T06:24:58.000Z
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
__publicField(this, "parseStamp", (suid, format) => {
|
|
412
|
+
if (format && !/t0|t[1-9]\d{1,}/.test(format)) {
|
|
413
|
+
throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
|
|
414
|
+
}
|
|
415
|
+
const stamp = format ? format.replace(/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g, (m) => {
|
|
416
|
+
const fnMap = {
|
|
417
|
+
$r: (len2) => [...Array(len2)].map(() => "r").join(""),
|
|
418
|
+
$s: (len2) => [...Array(len2)].map(() => "s").join(""),
|
|
419
|
+
$t: (len2) => [...Array(len2)].map(() => "t").join("")
|
|
420
|
+
};
|
|
421
|
+
const fn = m.slice(0, 2);
|
|
422
|
+
const len = Number.parseInt(m.slice(2), 10);
|
|
423
|
+
return fnMap[fn](len);
|
|
424
|
+
}).replace(/^(.*?)(t{8,})(.*)$/g, (_m, p1, p2) => {
|
|
425
|
+
return suid.substring(p1.length, p1.length + p2.length);
|
|
426
|
+
}) : suid;
|
|
427
|
+
if (stamp.length === 8) {
|
|
428
|
+
return new Date(Number.parseInt(stamp, 16) * 1e3);
|
|
429
|
+
}
|
|
430
|
+
if (stamp.length < 10) {
|
|
431
|
+
throw new Error("Stamp length invalid");
|
|
432
|
+
}
|
|
433
|
+
const rndIdx = Number.parseInt(stamp.substring(stamp.length - 1), 16);
|
|
434
|
+
return new Date(Number.parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
|
|
435
|
+
});
|
|
436
|
+
/**
|
|
437
|
+
* Set the counter to a specific value.
|
|
438
|
+
*/
|
|
439
|
+
__publicField(this, "setCounter", (counter) => {
|
|
440
|
+
this.counter = counter;
|
|
441
|
+
});
|
|
442
|
+
/**
|
|
443
|
+
* Validate given UID contains only characters from the instanced dictionary or optionally provided dictionary.
|
|
444
|
+
*/
|
|
445
|
+
__publicField(this, "validate", (uid, dictionary) => {
|
|
446
|
+
const finalDictionary = dictionary ? this._normalizeDictionary(dictionary) : this.dict;
|
|
447
|
+
return uid.split("").every((c) => finalDictionary.includes(c));
|
|
448
|
+
});
|
|
449
|
+
const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
|
|
450
|
+
this.counter = 0;
|
|
451
|
+
this.debug = false;
|
|
452
|
+
this.dict = [];
|
|
453
|
+
this.version = version;
|
|
454
|
+
const { dictionary, shuffle, length, counter } = options;
|
|
455
|
+
this.uuidLength = length;
|
|
456
|
+
this.setDictionary(dictionary, shuffle);
|
|
457
|
+
this.setCounter(counter);
|
|
458
|
+
this.debug = options.debug;
|
|
459
|
+
this.log(this.dict);
|
|
460
|
+
this.log(
|
|
461
|
+
"Generator instantiated with Dictionary Size ".concat(this.dictLength, " and counter set to ").concat(this.counter)
|
|
462
|
+
);
|
|
463
|
+
this.log = this.log.bind(this);
|
|
464
|
+
this.setDictionary = this.setDictionary.bind(this);
|
|
465
|
+
this.setCounter = this.setCounter.bind(this);
|
|
466
|
+
this.seq = this.seq.bind(this);
|
|
467
|
+
this.sequentialUUID = this.sequentialUUID.bind(this);
|
|
468
|
+
this.rnd = this.rnd.bind(this);
|
|
469
|
+
this.randomUUID = this.randomUUID.bind(this);
|
|
470
|
+
this.fmt = this.fmt.bind(this);
|
|
471
|
+
this.formattedUUID = this.formattedUUID.bind(this);
|
|
472
|
+
this.availableUUIDs = this.availableUUIDs.bind(this);
|
|
473
|
+
this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
|
|
474
|
+
this.collisionProbability = this.collisionProbability.bind(this);
|
|
475
|
+
this.uniqueness = this.uniqueness.bind(this);
|
|
476
|
+
this.getVersion = this.getVersion.bind(this);
|
|
477
|
+
this.stamp = this.stamp.bind(this);
|
|
478
|
+
this.parseStamp = this.parseStamp.bind(this);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
/** @hidden */
|
|
482
|
+
__publicField(_ShortUniqueId, "default", _ShortUniqueId);
|
|
483
|
+
var ShortUniqueId = _ShortUniqueId;
|
|
484
|
+
return __toCommonJS(index_exports);
|
|
485
|
+
})();
|
|
486
|
+
//# sourceMappingURL=short-unique-id.js.map
|
|
487
|
+
true&&(module.exports=ShortUniqueId.default),'undefined'!=typeof window&&(ShortUniqueId=ShortUniqueId.default);
|
|
488
|
+
|
|
489
|
+
/***/ },
|
|
490
|
+
|
|
491
|
+
/***/ 303
|
|
492
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
// EXPORTS
|
|
496
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
497
|
+
"default": () => (/* binding */ dist)
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
// EXTERNAL MODULE: external "rdflib"
|
|
501
|
+
var external_rdflib_ = __webpack_require__(5491);
|
|
502
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/namespaces.js
|
|
503
|
+
|
|
504
|
+
const vcard = (0,external_rdflib_.Namespace)("http://www.w3.org/2006/vcard/ns#");
|
|
505
|
+
const dc = (0,external_rdflib_.Namespace)("http://purl.org/dc/elements/1.1/");
|
|
506
|
+
//# sourceMappingURL=namespaces.js.map
|
|
507
|
+
// EXTERNAL MODULE: ./node_modules/short-unique-id/dist/short-unique-id.js
|
|
508
|
+
var short_unique_id = __webpack_require__(8068);
|
|
509
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
|
|
510
|
+
|
|
511
|
+
const uid = new short_unique_id({ length: 10 });
|
|
512
|
+
/**
|
|
513
|
+
* Generates a short ID that can be used for URI fragments, document or container names.
|
|
514
|
+
*/
|
|
515
|
+
function generateId() {
|
|
516
|
+
return uid.rnd(6);
|
|
517
|
+
}
|
|
518
|
+
//# sourceMappingURL=generate-id.js.map
|
|
519
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/identifier/index.js
|
|
520
|
+
|
|
521
|
+
//# sourceMappingURL=index.js.map
|
|
522
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/AddressBookQuery.js
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
class AddressBookQuery {
|
|
527
|
+
constructor(store, addressBookNode) {
|
|
528
|
+
this.store = store;
|
|
529
|
+
this.addressBookNode = addressBookNode;
|
|
530
|
+
this.addressBookDoc = addressBookNode.doc();
|
|
531
|
+
}
|
|
532
|
+
proposeNewContactNode() {
|
|
533
|
+
return this.proposeNewNode("Person");
|
|
534
|
+
}
|
|
535
|
+
proposeNewGroupNode() {
|
|
536
|
+
return this.proposeNewNode("Group");
|
|
537
|
+
}
|
|
538
|
+
proposeNewNode(containerPath) {
|
|
539
|
+
const id = generateId();
|
|
540
|
+
const baseUri = this.addressBookNode.dir()?.uri;
|
|
541
|
+
return (0,external_rdflib_.sym)(`${baseUri}${containerPath}/${id}/index.ttl#this`);
|
|
542
|
+
}
|
|
543
|
+
queryTitle() {
|
|
544
|
+
return (this.store.anyValue(this.addressBookNode, dc("title"), undefined, this.addressBookDoc) ?? "");
|
|
545
|
+
}
|
|
546
|
+
queryNameEmailIndex() {
|
|
547
|
+
const index = this.store.any(this.addressBookNode, vcard("nameEmailIndex"), undefined, this.addressBookDoc);
|
|
548
|
+
if ((0,external_rdflib_.isNamedNode)(index)) {
|
|
549
|
+
return index;
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
queryContacts() {
|
|
556
|
+
const nameEmailIndex = this.queryNameEmailIndex();
|
|
557
|
+
return nameEmailIndex && (0,external_rdflib_.isNamedNode)(nameEmailIndex)
|
|
558
|
+
? this.store
|
|
559
|
+
.each(null, vcard("inAddressBook"), this.addressBookNode, nameEmailIndex)
|
|
560
|
+
.filter((it) => (0,external_rdflib_.isNamedNode)(it))
|
|
561
|
+
.map((node) => ({
|
|
562
|
+
name: this.store.anyValue(node, vcard("fn"), null, nameEmailIndex) ??
|
|
563
|
+
"",
|
|
564
|
+
uri: node.value,
|
|
565
|
+
}))
|
|
566
|
+
: [];
|
|
567
|
+
}
|
|
568
|
+
queryGroupIndex() {
|
|
569
|
+
const index = this.store.any(this.addressBookNode, vcard("groupIndex"), undefined, this.addressBookDoc);
|
|
570
|
+
if ((0,external_rdflib_.isNamedNode)(index)) {
|
|
571
|
+
return index;
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
queryGroups() {
|
|
578
|
+
const groupIndex = this.queryGroupIndex(); //?
|
|
579
|
+
return groupIndex && (0,external_rdflib_.isNamedNode)(groupIndex)
|
|
580
|
+
? this.store
|
|
581
|
+
.each(this.addressBookNode, vcard("includesGroup"), null, groupIndex)
|
|
582
|
+
.filter((it) => (0,external_rdflib_.isNamedNode)(it))
|
|
583
|
+
.map((node) => ({
|
|
584
|
+
name: this.store.anyValue(node, vcard("fn"), null, groupIndex) ?? "",
|
|
585
|
+
uri: node.value,
|
|
586
|
+
}))
|
|
587
|
+
: [];
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
//# sourceMappingURL=AddressBookQuery.js.map
|
|
591
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/ContactQuery.js
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
const MAILTO_URI_SCHEME = "mailto:";
|
|
595
|
+
const TEl_URI_SCHEME = "tel:";
|
|
596
|
+
class ContactQuery {
|
|
597
|
+
constructor(store, contactNode) {
|
|
598
|
+
this.store = store;
|
|
599
|
+
this.contactNode = contactNode;
|
|
600
|
+
this.contactDoc = contactNode.doc();
|
|
601
|
+
}
|
|
602
|
+
queryName() {
|
|
603
|
+
return (this.store.anyValue(this.contactNode, vcard("fn"), undefined, this.contactDoc) ?? "");
|
|
604
|
+
}
|
|
605
|
+
queryEmails() {
|
|
606
|
+
const uris = this.getValuesOf(vcard("hasEmail"));
|
|
607
|
+
if (uris.length === 0) {
|
|
608
|
+
return [];
|
|
609
|
+
}
|
|
610
|
+
return uris
|
|
611
|
+
.map((uri) => {
|
|
612
|
+
const valueNode = this.getValueNode(uri);
|
|
613
|
+
if (isMailtoNode(valueNode)) {
|
|
614
|
+
return {
|
|
615
|
+
uri,
|
|
616
|
+
value: valueNode.value.split(MAILTO_URI_SCHEME)[1],
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
})
|
|
620
|
+
.filter((value) => !!value);
|
|
621
|
+
}
|
|
622
|
+
queryPhoneNumbers() {
|
|
623
|
+
const uris = this.getValuesOf(vcard("hasTelephone"));
|
|
624
|
+
if (uris.length === 0) {
|
|
625
|
+
return [];
|
|
626
|
+
}
|
|
627
|
+
return uris
|
|
628
|
+
.map((uri) => {
|
|
629
|
+
const valueNode = this.getValueNode(uri);
|
|
630
|
+
if (isTelNode(valueNode)) {
|
|
631
|
+
return {
|
|
632
|
+
uri,
|
|
633
|
+
value: valueNode.value.split(TEl_URI_SCHEME)[1],
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
})
|
|
637
|
+
.filter((value) => !!value);
|
|
638
|
+
}
|
|
639
|
+
getValuesOf(predicate) {
|
|
640
|
+
return this.store
|
|
641
|
+
.statementsMatching(this.contactNode, predicate, undefined, this.contactDoc)
|
|
642
|
+
.map((it) => it.object.value);
|
|
643
|
+
}
|
|
644
|
+
getValueNode(uri) {
|
|
645
|
+
return this.store.any((0,external_rdflib_.sym)(uri), vcard("value"), undefined, this.contactDoc);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function isMailtoNode(valueNode) {
|
|
649
|
+
return ((0,external_rdflib_.isNamedNode)(valueNode) && valueNode.value.startsWith(MAILTO_URI_SCHEME));
|
|
650
|
+
}
|
|
651
|
+
function isTelNode(valueNode) {
|
|
652
|
+
return (0,external_rdflib_.isNamedNode)(valueNode) && valueNode.value.startsWith(TEl_URI_SCHEME);
|
|
653
|
+
}
|
|
654
|
+
//# sourceMappingURL=ContactQuery.js.map
|
|
655
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/GroupQuery.js
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
class GroupQuery {
|
|
659
|
+
constructor(store, groupNode) {
|
|
660
|
+
this.store = store;
|
|
661
|
+
this.groupNode = groupNode;
|
|
662
|
+
this.groupDoc = groupNode.doc();
|
|
663
|
+
}
|
|
664
|
+
queryName() {
|
|
665
|
+
return (this.store.anyValue(this.groupNode, vcard("fn"), undefined, this.groupDoc) ?? "");
|
|
666
|
+
}
|
|
667
|
+
queryMembers() {
|
|
668
|
+
return this.store
|
|
669
|
+
.each(this.groupNode, vcard("hasMember"), null, this.groupDoc)
|
|
670
|
+
.filter((it) => (0,external_rdflib_.isNamedNode)(it))
|
|
671
|
+
.map((node) => ({
|
|
672
|
+
uri: node.value,
|
|
673
|
+
name: this.store.anyValue(node, vcard("fn"), null, this.groupDoc) ?? "",
|
|
674
|
+
}));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
//# sourceMappingURL=GroupQuery.js.map
|
|
678
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/queries/index.js
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
//# sourceMappingURL=index.js.map
|
|
683
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/createAddressBook.js
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
function createAddressBook(container, name) {
|
|
688
|
+
const id = generateId();
|
|
689
|
+
const uri = `${container}${id}/index.ttl#this`;
|
|
690
|
+
const nameEmailIndexUri = `${container}${id}/people.ttl`;
|
|
691
|
+
const groupIndexUri = `${container}${id}/groups.ttl`;
|
|
692
|
+
const insertions = [
|
|
693
|
+
(0,external_rdflib_.st)((0,external_rdflib_.sym)(uri), (0,external_rdflib_.sym)("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), vcard("AddressBook"), (0,external_rdflib_.sym)(uri).doc()),
|
|
694
|
+
(0,external_rdflib_.st)((0,external_rdflib_.sym)(uri), dc("title"), (0,external_rdflib_.lit)(name), (0,external_rdflib_.sym)(uri).doc()),
|
|
695
|
+
(0,external_rdflib_.st)((0,external_rdflib_.sym)(uri), vcard("nameEmailIndex"), (0,external_rdflib_.sym)(nameEmailIndexUri), (0,external_rdflib_.sym)(uri).doc()),
|
|
696
|
+
(0,external_rdflib_.st)((0,external_rdflib_.sym)(uri), vcard("groupIndex"), (0,external_rdflib_.sym)(groupIndexUri), (0,external_rdflib_.sym)(uri).doc()),
|
|
697
|
+
];
|
|
698
|
+
return {
|
|
699
|
+
uri,
|
|
700
|
+
deletions: [],
|
|
701
|
+
insertions,
|
|
702
|
+
filesToCreate: [{ url: nameEmailIndexUri }, { url: groupIndexUri }],
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
//# sourceMappingURL=createAddressBook.js.map
|
|
706
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
|
|
707
|
+
/**
|
|
708
|
+
* Applies the described updates to a Pod
|
|
709
|
+
* @param fetcher - The fetcher to use for the update
|
|
710
|
+
* @param updater - The updater to use for the update
|
|
711
|
+
* @param operation - The operations to perform
|
|
712
|
+
*/
|
|
713
|
+
async function executeUpdate(fetcher, updater, operation) {
|
|
714
|
+
await updater.updateMany(operation.deletions, operation.insertions);
|
|
715
|
+
operation.filesToCreate.map((file) => {
|
|
716
|
+
createEmptyTurtleFile(fetcher, file.url);
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function createEmptyTurtleFile(fetcher, url) {
|
|
720
|
+
return fetcher.webOperation("PUT", url, {
|
|
721
|
+
contentType: "text/turtle",
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
//# sourceMappingURL=executeUpdate.js.map
|
|
725
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/fetchNode.js
|
|
726
|
+
/**
|
|
727
|
+
* Nullsafe fetching of a node
|
|
728
|
+
* @param fetcher - The fetcher to use
|
|
729
|
+
* @param node - A node to fetch, or null to do nothing at all
|
|
730
|
+
*/
|
|
731
|
+
async function fetchNode(fetcher, node) {
|
|
732
|
+
if (node) {
|
|
733
|
+
await fetcher.load(node.value);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
//# sourceMappingURL=fetchNode.js.map
|
|
737
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/index.js
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
//# sourceMappingURL=index.js.map
|
|
741
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
|
|
742
|
+
|
|
743
|
+
const rdf = (0,external_rdflib_.Namespace)("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
|
|
744
|
+
const solid = (0,external_rdflib_.Namespace)("http://www.w3.org/ns/solid/terms#");
|
|
745
|
+
const pim = (0,external_rdflib_.Namespace)("http://www.w3.org/ns/pim/space#");
|
|
746
|
+
const ldp = (0,external_rdflib_.Namespace)("http://www.w3.org/ns/ldp#");
|
|
747
|
+
//# sourceMappingURL=index.js.map
|
|
748
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/queries/PreferencesQuery.js
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Used query data from a user's preferences file
|
|
753
|
+
*/
|
|
754
|
+
class PreferencesQuery {
|
|
755
|
+
constructor(store,
|
|
756
|
+
/**
|
|
757
|
+
* The WebID of the user
|
|
758
|
+
*/
|
|
759
|
+
webIdNode,
|
|
760
|
+
/**
|
|
761
|
+
* The preferences file
|
|
762
|
+
*/
|
|
763
|
+
preferencesDoc) {
|
|
764
|
+
this.store = store;
|
|
765
|
+
this.webIdNode = webIdNode;
|
|
766
|
+
this.preferencesDoc = preferencesDoc;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Look up the private type index. Returns null if none is found or if the predicated does not link to a proper named node
|
|
770
|
+
*/
|
|
771
|
+
queryPrivateTypeIndex() {
|
|
772
|
+
const node = this.store.any(this.webIdNode, solid("privateTypeIndex"), null, this.preferencesDoc);
|
|
773
|
+
if ((0,external_rdflib_.isNamedNode)(node)) {
|
|
774
|
+
return node;
|
|
775
|
+
}
|
|
776
|
+
return null;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
//# sourceMappingURL=PreferencesQuery.js.map
|
|
780
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/queries/ProfileQuery.js
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Used query data from a user's profile document
|
|
785
|
+
*/
|
|
786
|
+
class ProfileQuery {
|
|
787
|
+
constructor(
|
|
788
|
+
/**
|
|
789
|
+
* The WebID of the user
|
|
790
|
+
*/
|
|
791
|
+
webIdNode, store) {
|
|
792
|
+
this.webIdNode = webIdNode;
|
|
793
|
+
this.store = store;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Look up the public type index. Returns null if none is found or if the predicated does not link to a proper named node
|
|
797
|
+
*/
|
|
798
|
+
queryPublicTypeIndex() {
|
|
799
|
+
const predicate = solid("publicTypeIndex");
|
|
800
|
+
return this.queryNamedNode(predicate);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Look up the preferences file. Returns null if none is found or if the predicated does not link to a proper named node
|
|
804
|
+
*/
|
|
805
|
+
queryPreferencesFile() {
|
|
806
|
+
const predicate = pim("preferencesFile");
|
|
807
|
+
return this.queryNamedNode(predicate);
|
|
808
|
+
}
|
|
809
|
+
queryNamedNode(predicate) {
|
|
810
|
+
const node = this.store.any(this.webIdNode, predicate, null, this.webIdNode.doc());
|
|
811
|
+
if ((0,external_rdflib_.isNamedNode)(node)) {
|
|
812
|
+
return node;
|
|
813
|
+
}
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
//# sourceMappingURL=ProfileQuery.js.map
|
|
818
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/queries/TypeIndexQuery.js
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Used query data from a type index document
|
|
823
|
+
*/
|
|
824
|
+
class TypeIndexQuery {
|
|
825
|
+
constructor(store, typeIndexDoc) {
|
|
826
|
+
this.store = store;
|
|
827
|
+
this.typeIndexDoc = typeIndexDoc;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Look up the instances in the type registration for the given RDF class
|
|
831
|
+
* @param type - The RDF class to look up
|
|
832
|
+
* @returns A list of the URIs of the found instances
|
|
833
|
+
*/
|
|
834
|
+
queryInstancesForClass(type) {
|
|
835
|
+
const registrations = this.store.each(null, solid("forClass"), type, this.typeIndexDoc);
|
|
836
|
+
return registrations.flatMap((registration) => {
|
|
837
|
+
if (!(0,external_rdflib_.isNamedNode)(registration))
|
|
838
|
+
return [];
|
|
839
|
+
return this.getInstanceValues(registration);
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
getInstanceValues(registration) {
|
|
843
|
+
return this.store
|
|
844
|
+
.each(registration, solid("instance"), null, this.typeIndexDoc)
|
|
845
|
+
.map((it) => it.value);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
//# sourceMappingURL=TypeIndexQuery.js.map
|
|
849
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/queries/index.js
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
//# sourceMappingURL=index.js.map
|
|
854
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/module/ModuleSupport.js
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Provides common functionality useful for many rdflib-based data modules
|
|
860
|
+
*/
|
|
861
|
+
class ModuleSupport {
|
|
862
|
+
constructor(config) {
|
|
863
|
+
this.store = config.store;
|
|
864
|
+
this.fetcher = config.fetcher;
|
|
865
|
+
this.updater = config.updater;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Nullsafe fetching of a node
|
|
869
|
+
* @param node - A node to fetch, or null to do nothing at all
|
|
870
|
+
*/
|
|
871
|
+
async fetchNode(node) {
|
|
872
|
+
return fetchNode(this.fetcher, node);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Fetch all the given nodes in parallel
|
|
876
|
+
* @param nodes
|
|
877
|
+
*/
|
|
878
|
+
async fetchAll(nodes) {
|
|
879
|
+
return Promise.all(nodes.map((it) => this.fetchNode(it)));
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Checks whether the resource identified by the given URL is a LDP container
|
|
883
|
+
* @param storageUrl - The URL to check
|
|
884
|
+
* @returns true if it is a container, false otherwise
|
|
885
|
+
*/
|
|
886
|
+
async isContainer(storageUrl) {
|
|
887
|
+
const storageNode = (0,external_rdflib_.sym)(storageUrl);
|
|
888
|
+
await this.fetcher.load(storageNode.value);
|
|
889
|
+
return this.store.holds(storageNode, rdf("type"), ldp("Container"), storageNode.doc());
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
//# sourceMappingURL=ModuleSupport.js.map
|
|
893
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/module/index.js
|
|
894
|
+
|
|
895
|
+
//# sourceMappingURL=index.js.map
|
|
896
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/update-operations/addInstanceToTypeIndex.js
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Create a new type registration for the given type that links to the given resource instance
|
|
902
|
+
* @param typeIndexDoc - The type index document (private or public)
|
|
903
|
+
* @param instanceUri - The URI of the instance to add
|
|
904
|
+
* @param type - The RDF class to register the instance for
|
|
905
|
+
*/
|
|
906
|
+
function addInstanceToTypeIndex(typeIndexDoc, instanceUri, type) {
|
|
907
|
+
const registrationNode = (0,external_rdflib_.sym)(`${typeIndexDoc.value}#${generateId()}`);
|
|
908
|
+
return {
|
|
909
|
+
deletions: [],
|
|
910
|
+
filesToCreate: [],
|
|
911
|
+
insertions: [
|
|
912
|
+
(0,external_rdflib_.st)(registrationNode, rdf("type"), solid("TypeRegistration"), typeIndexDoc),
|
|
913
|
+
(0,external_rdflib_.st)(registrationNode, solid("forClass"), type, typeIndexDoc),
|
|
914
|
+
(0,external_rdflib_.st)(registrationNode, solid("instance"), (0,external_rdflib_.sym)(instanceUri), typeIndexDoc),
|
|
915
|
+
],
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
//# sourceMappingURL=addInstanceToTypeIndex.js.map
|
|
919
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/update-operations/index.js
|
|
920
|
+
|
|
921
|
+
//# sourceMappingURL=index.js.map
|
|
922
|
+
;// ./node_modules/@solid-data-modules/rdflib-utils/dist/index.js
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
//# sourceMappingURL=index.js.map
|
|
929
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/createNewContact.js
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
function createNewContact(addressBook, newContact) {
|
|
934
|
+
const contactNode = addressBook.proposeNewContactNode();
|
|
935
|
+
const nameEmailIndex = addressBook.queryNameEmailIndex();
|
|
936
|
+
if (!nameEmailIndex) {
|
|
937
|
+
throw new Error("name-email index is missing or invalid");
|
|
938
|
+
}
|
|
939
|
+
const insertions = [
|
|
940
|
+
(0,external_rdflib_.st)(contactNode, vcard("inAddressBook"), addressBook.addressBookNode, nameEmailIndex),
|
|
941
|
+
(0,external_rdflib_.st)(contactNode, vcard("fn"), (0,external_rdflib_.lit)(newContact.name), nameEmailIndex),
|
|
942
|
+
(0,external_rdflib_.st)(contactNode, vcard("fn"), (0,external_rdflib_.lit)(newContact.name), contactNode.doc()),
|
|
943
|
+
(0,external_rdflib_.st)(contactNode, rdf("type"), vcard("Individual"), contactNode.doc()),
|
|
944
|
+
];
|
|
945
|
+
if (newContact.email) {
|
|
946
|
+
const emailNode = (0,external_rdflib_.sym)(contactNode.doc().uri + "#email");
|
|
947
|
+
insertions.push((0,external_rdflib_.st)(contactNode, vcard("hasEmail"), emailNode, contactNode.doc()), (0,external_rdflib_.st)(emailNode, vcard("value"), (0,external_rdflib_.sym)("mailto:" + newContact.email), contactNode.doc()));
|
|
948
|
+
}
|
|
949
|
+
if (newContact.phoneNumber) {
|
|
950
|
+
const phoneNode = (0,external_rdflib_.sym)(contactNode.doc().uri + "#phone");
|
|
951
|
+
insertions.push((0,external_rdflib_.st)(contactNode, vcard("hasTelephone"), phoneNode, contactNode.doc()), (0,external_rdflib_.st)(phoneNode, vcard("value"), (0,external_rdflib_.sym)("tel:" + newContact.phoneNumber), contactNode.doc()));
|
|
952
|
+
}
|
|
953
|
+
return {
|
|
954
|
+
uri: contactNode.uri,
|
|
955
|
+
deletions: [],
|
|
956
|
+
insertions: insertions,
|
|
957
|
+
filesToCreate: [],
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
//# sourceMappingURL=createNewContact.js.map
|
|
961
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/createNewGroup.js
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
function createNewGroup(addressBook, groupName) {
|
|
966
|
+
const groupIndex = addressBook.queryGroupIndex();
|
|
967
|
+
if (!groupIndex) {
|
|
968
|
+
throw new Error("group index is missing or invalid");
|
|
969
|
+
}
|
|
970
|
+
const groupNode = addressBook.proposeNewGroupNode();
|
|
971
|
+
const groupDoc = groupNode.doc();
|
|
972
|
+
return {
|
|
973
|
+
uri: groupNode.uri,
|
|
974
|
+
insertions: [
|
|
975
|
+
(0,external_rdflib_.st)(groupNode, vcard("fn"), (0,external_rdflib_.lit)(groupName), groupIndex),
|
|
976
|
+
(0,external_rdflib_.st)(groupNode, vcard("fn"), (0,external_rdflib_.lit)(groupName), groupDoc),
|
|
977
|
+
(0,external_rdflib_.st)(groupNode, rdf("type"), vcard("Group"), groupDoc),
|
|
978
|
+
(0,external_rdflib_.st)(addressBook.addressBookNode, vcard("includesGroup"), groupNode, groupIndex),
|
|
979
|
+
],
|
|
980
|
+
deletions: [],
|
|
981
|
+
filesToCreate: [],
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
//# sourceMappingURL=createNewGroup.js.map
|
|
985
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addContactToGroup.js
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
function addContactToGroup(contactQuery, groupQuery) {
|
|
989
|
+
const name = contactQuery.queryName();
|
|
990
|
+
return {
|
|
991
|
+
insertions: [
|
|
992
|
+
(0,external_rdflib_.st)(groupQuery.groupNode, vcard("hasMember"), contactQuery.contactNode, groupQuery.groupNode.doc()),
|
|
993
|
+
(0,external_rdflib_.st)(contactQuery.contactNode, vcard("fn"), (0,external_rdflib_.lit)(name), groupQuery.groupNode.doc()),
|
|
994
|
+
],
|
|
995
|
+
deletions: [],
|
|
996
|
+
filesToCreate: [],
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
//# sourceMappingURL=addContactToGroup.js.map
|
|
1000
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewEmailAddress.js
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
function addNewEmailAddress(contactNode, emailAddress) {
|
|
1005
|
+
const id = generateId();
|
|
1006
|
+
const uri = `${contactNode.doc().uri}#${id}`;
|
|
1007
|
+
return {
|
|
1008
|
+
uri,
|
|
1009
|
+
insertions: [
|
|
1010
|
+
(0,external_rdflib_.st)(contactNode, vcard("hasEmail"), (0,external_rdflib_.sym)(uri), contactNode.doc()),
|
|
1011
|
+
(0,external_rdflib_.st)((0,external_rdflib_.sym)(uri), vcard("value"), (0,external_rdflib_.sym)("mailto:" + emailAddress), contactNode.doc()),
|
|
1012
|
+
],
|
|
1013
|
+
deletions: [],
|
|
1014
|
+
filesToCreate: [],
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
//# sourceMappingURL=addNewEmailAddress.js.map
|
|
1018
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/addNewPhoneNumber.js
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
function addNewPhoneNumber(contactNode, phoneNumber) {
|
|
1023
|
+
const id = generateId();
|
|
1024
|
+
const uri = `${contactNode.doc().uri}#${id}`;
|
|
1025
|
+
return {
|
|
1026
|
+
uri,
|
|
1027
|
+
insertions: [
|
|
1028
|
+
(0,external_rdflib_.st)(contactNode, vcard("hasTelephone"), (0,external_rdflib_.sym)(uri), contactNode.doc()),
|
|
1029
|
+
(0,external_rdflib_.st)((0,external_rdflib_.sym)(uri), vcard("value"), (0,external_rdflib_.sym)("tel:" + phoneNumber), contactNode.doc()),
|
|
1030
|
+
],
|
|
1031
|
+
deletions: [],
|
|
1032
|
+
filesToCreate: [],
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
//# sourceMappingURL=addNewPhoneNumber.js.map
|
|
1036
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removeContactFromGroup.js
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
function removeContactFromGroup(contactQuery, groupQuery) {
|
|
1040
|
+
const contactUri = contactQuery.contactNode.uri;
|
|
1041
|
+
const member = groupQuery.queryMembers().find((it) => it.uri === contactUri);
|
|
1042
|
+
if (!member) {
|
|
1043
|
+
throw new Error("member not found in group");
|
|
1044
|
+
}
|
|
1045
|
+
return {
|
|
1046
|
+
insertions: [],
|
|
1047
|
+
deletions: [
|
|
1048
|
+
(0,external_rdflib_.st)(groupQuery.groupNode, vcard("hasMember"), contactQuery.contactNode, groupQuery.groupNode.doc()),
|
|
1049
|
+
(0,external_rdflib_.st)(contactQuery.contactNode, vcard("fn"), (0,external_rdflib_.lit)(member.name), groupQuery.groupNode.doc()),
|
|
1050
|
+
],
|
|
1051
|
+
filesToCreate: [],
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
//# sourceMappingURL=removeContactFromGroup.js.map
|
|
1055
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removeEmailAddress.js
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
function removeEmailAddress(contactNode, emailNode, store) {
|
|
1059
|
+
const emailStatements = store.statementsMatching(emailNode, null, null, emailNode.doc());
|
|
1060
|
+
return {
|
|
1061
|
+
insertions: [],
|
|
1062
|
+
deletions: [
|
|
1063
|
+
...emailStatements,
|
|
1064
|
+
(0,external_rdflib_.st)(contactNode, vcard("hasEmail"), emailNode, contactNode.doc()),
|
|
1065
|
+
],
|
|
1066
|
+
filesToCreate: [],
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
//# sourceMappingURL=removeEmailAddress.js.map
|
|
1070
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/removePhoneNumber.js
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
function removePhoneNumber(contactNode, phoneNode, store) {
|
|
1074
|
+
const phoneStatements = store.statementsMatching(phoneNode, null, null, phoneNode.doc());
|
|
1075
|
+
return {
|
|
1076
|
+
insertions: [],
|
|
1077
|
+
deletions: [
|
|
1078
|
+
...phoneStatements,
|
|
1079
|
+
(0,external_rdflib_.st)(contactNode, vcard("hasTelephone"), phoneNode, contactNode.doc()),
|
|
1080
|
+
],
|
|
1081
|
+
filesToCreate: [],
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
//# sourceMappingURL=removePhoneNumber.js.map
|
|
1085
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/renameContact.js
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
function renameContact(store, contactNode, newName) {
|
|
1089
|
+
const deletions = store.statementsMatching(contactNode, vcard("fn"), null, null);
|
|
1090
|
+
const insertions = deletions.map((it) => (0,external_rdflib_.st)(it.subject, it.predicate, (0,external_rdflib_.lit)(newName), it.graph));
|
|
1091
|
+
return {
|
|
1092
|
+
insertions,
|
|
1093
|
+
deletions,
|
|
1094
|
+
filesToCreate: [],
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
//# sourceMappingURL=renameContact.js.map
|
|
1098
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/updateEmailAddress.js
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
function updateEmailAddress(emailAddressNode, newEmailAddress, store) {
|
|
1102
|
+
const oldValue = store.any(emailAddressNode, vcard("value"));
|
|
1103
|
+
const deletions = oldValue
|
|
1104
|
+
? [(0,external_rdflib_.st)(emailAddressNode, vcard("value"), oldValue, emailAddressNode.doc())]
|
|
1105
|
+
: [];
|
|
1106
|
+
const insertions = [
|
|
1107
|
+
(0,external_rdflib_.st)(emailAddressNode, vcard("value"), (0,external_rdflib_.sym)("mailto:" + newEmailAddress), emailAddressNode.doc()),
|
|
1108
|
+
];
|
|
1109
|
+
return {
|
|
1110
|
+
insertions,
|
|
1111
|
+
deletions,
|
|
1112
|
+
filesToCreate: [],
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
//# sourceMappingURL=updateEmailAddress.js.map
|
|
1116
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/updatePhoneNumber.js
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
function updatePhoneNumber(phoneNumberNode, newPhoneNumber, store) {
|
|
1120
|
+
const oldValue = store.any(phoneNumberNode, vcard("value"));
|
|
1121
|
+
const deletions = oldValue
|
|
1122
|
+
? [(0,external_rdflib_.st)(phoneNumberNode, vcard("value"), oldValue, phoneNumberNode.doc())]
|
|
1123
|
+
: [];
|
|
1124
|
+
const insertions = [
|
|
1125
|
+
(0,external_rdflib_.st)(phoneNumberNode, vcard("value"), (0,external_rdflib_.sym)("tel:" + newPhoneNumber), phoneNumberNode.doc()),
|
|
1126
|
+
];
|
|
1127
|
+
return {
|
|
1128
|
+
insertions,
|
|
1129
|
+
deletions,
|
|
1130
|
+
filesToCreate: [],
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
//# sourceMappingURL=updatePhoneNumber.js.map
|
|
1134
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/update-operations/index.js
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
//# sourceMappingURL=index.js.map
|
|
1148
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/ContactsModuleRdfLib.js
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
const VCARD_ADDRESS_BOOK = vcard("AddressBook");
|
|
1155
|
+
class ContactsModuleRdfLib {
|
|
1156
|
+
constructor(config) {
|
|
1157
|
+
this.support = new ModuleSupport(config);
|
|
1158
|
+
this.store = config.store;
|
|
1159
|
+
this.fetcher = config.fetcher;
|
|
1160
|
+
this.updater = config.updater;
|
|
1161
|
+
}
|
|
1162
|
+
async readAddressBook(uri) {
|
|
1163
|
+
const addressBookNode = (0,external_rdflib_.sym)(uri);
|
|
1164
|
+
await this.support.fetchNode(addressBookNode);
|
|
1165
|
+
const query = new AddressBookQuery(this.store, addressBookNode);
|
|
1166
|
+
const title = query.queryTitle();
|
|
1167
|
+
const nameEmailIndex = query.queryNameEmailIndex();
|
|
1168
|
+
const groupIndex = query.queryGroupIndex();
|
|
1169
|
+
await this.support.fetchAll([nameEmailIndex, groupIndex]);
|
|
1170
|
+
const contacts = query.queryContacts();
|
|
1171
|
+
const groups = query.queryGroups();
|
|
1172
|
+
return {
|
|
1173
|
+
uri,
|
|
1174
|
+
title,
|
|
1175
|
+
contacts,
|
|
1176
|
+
groups,
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
async createAddressBook({ containerUri, name, ownerWebId, }) {
|
|
1180
|
+
const operation = createAddressBook(containerUri, name);
|
|
1181
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1182
|
+
if (ownerWebId) {
|
|
1183
|
+
await this.updatePrivateTypeIndex(ownerWebId, operation.uri);
|
|
1184
|
+
}
|
|
1185
|
+
return operation.uri;
|
|
1186
|
+
}
|
|
1187
|
+
async updatePrivateTypeIndex(ownerWebId, addressBookUri) {
|
|
1188
|
+
const profileNode = (0,external_rdflib_.sym)(ownerWebId);
|
|
1189
|
+
await this.support.fetchNode(profileNode);
|
|
1190
|
+
const profileQuery = new ProfileQuery(profileNode, this.store);
|
|
1191
|
+
const preferencesFile = profileQuery.queryPreferencesFile();
|
|
1192
|
+
const privateTypeIndex = await this.fetchPrivateTypeIndex(profileNode, preferencesFile);
|
|
1193
|
+
if (!privateTypeIndex) {
|
|
1194
|
+
throw new Error(`Private type not found for WebID ${ownerWebId}.`);
|
|
1195
|
+
}
|
|
1196
|
+
const operation = addInstanceToTypeIndex(privateTypeIndex, addressBookUri, VCARD_ADDRESS_BOOK);
|
|
1197
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1198
|
+
}
|
|
1199
|
+
async createNewContact({ addressBookUri, contact, groupUris, }) {
|
|
1200
|
+
const contactQuery = await this.executeCreateNewContact(addressBookUri, contact);
|
|
1201
|
+
await this.executeAddContactToGroups(groupUris, contactQuery);
|
|
1202
|
+
return contactQuery.contactNode.uri;
|
|
1203
|
+
}
|
|
1204
|
+
async executeAddContactToGroups(groupUris, contactQuery) {
|
|
1205
|
+
const groupNodes = (groupUris ?? []).map((it) => (0,external_rdflib_.sym)(it));
|
|
1206
|
+
await this.support.fetchAll(groupNodes);
|
|
1207
|
+
const groupUpdates = groupNodes.map((groupNode) => {
|
|
1208
|
+
const groupQuery = new GroupQuery(this.store, groupNode);
|
|
1209
|
+
const operation = addContactToGroup(contactQuery, groupQuery);
|
|
1210
|
+
return executeUpdate(this.fetcher, this.updater, operation);
|
|
1211
|
+
});
|
|
1212
|
+
await Promise.allSettled(groupUpdates);
|
|
1213
|
+
}
|
|
1214
|
+
async executeCreateNewContact(addressBookUri, contact) {
|
|
1215
|
+
const addressBookNode = (0,external_rdflib_.sym)(addressBookUri);
|
|
1216
|
+
await this.support.fetchNode(addressBookNode);
|
|
1217
|
+
const operation = createNewContact(new AddressBookQuery(this.store, addressBookNode), contact);
|
|
1218
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1219
|
+
return new ContactQuery(this.store, (0,external_rdflib_.sym)(operation.uri));
|
|
1220
|
+
}
|
|
1221
|
+
async readContact(uri) {
|
|
1222
|
+
const contactNode = (0,external_rdflib_.sym)(uri);
|
|
1223
|
+
await this.support.fetchNode(contactNode);
|
|
1224
|
+
const query = new ContactQuery(this.store, contactNode);
|
|
1225
|
+
const name = query.queryName();
|
|
1226
|
+
const emails = query.queryEmails();
|
|
1227
|
+
const phoneNumbers = query.queryPhoneNumbers();
|
|
1228
|
+
return {
|
|
1229
|
+
uri,
|
|
1230
|
+
name,
|
|
1231
|
+
emails,
|
|
1232
|
+
phoneNumbers,
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
async createNewGroup({ addressBookUri, groupName }) {
|
|
1236
|
+
const addressBookNode = (0,external_rdflib_.sym)(addressBookUri);
|
|
1237
|
+
await this.support.fetchNode(addressBookNode);
|
|
1238
|
+
const query = new AddressBookQuery(this.store, addressBookNode);
|
|
1239
|
+
const operation = createNewGroup(query, groupName);
|
|
1240
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1241
|
+
return operation.uri;
|
|
1242
|
+
}
|
|
1243
|
+
async readGroup(uri) {
|
|
1244
|
+
const groupNode = (0,external_rdflib_.sym)(uri);
|
|
1245
|
+
await this.support.fetchNode(groupNode);
|
|
1246
|
+
const query = new GroupQuery(this.store, groupNode);
|
|
1247
|
+
const name = query.queryName();
|
|
1248
|
+
const members = query.queryMembers();
|
|
1249
|
+
return {
|
|
1250
|
+
uri,
|
|
1251
|
+
name,
|
|
1252
|
+
members,
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
async addContactToGroup({ contactUri, groupUri }) {
|
|
1256
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1257
|
+
const groupNode = (0,external_rdflib_.sym)(groupUri);
|
|
1258
|
+
await this.support.fetchNode(contactNode);
|
|
1259
|
+
const contactQuery = new ContactQuery(this.store, contactNode);
|
|
1260
|
+
const groupQuery = new GroupQuery(this.store, groupNode);
|
|
1261
|
+
const operation = addContactToGroup(contactQuery, groupQuery);
|
|
1262
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1263
|
+
}
|
|
1264
|
+
async removeContactFromGroup({ contactUri, groupUri, }) {
|
|
1265
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1266
|
+
const groupNode = (0,external_rdflib_.sym)(groupUri);
|
|
1267
|
+
await this.support.fetchNode(groupNode);
|
|
1268
|
+
const contactQuery = new ContactQuery(this.store, contactNode);
|
|
1269
|
+
const groupQuery = new GroupQuery(this.store, groupNode);
|
|
1270
|
+
const operation = removeContactFromGroup(contactQuery, groupQuery);
|
|
1271
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1272
|
+
}
|
|
1273
|
+
async addNewPhoneNumber({ contactUri, newPhoneNumber, }) {
|
|
1274
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1275
|
+
const operation = addNewPhoneNumber(contactNode, newPhoneNumber);
|
|
1276
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1277
|
+
return operation.uri;
|
|
1278
|
+
}
|
|
1279
|
+
async addNewEmailAddress({ contactUri, newEmailAddress, }) {
|
|
1280
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1281
|
+
const operation = addNewEmailAddress(contactNode, newEmailAddress);
|
|
1282
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1283
|
+
return operation.uri;
|
|
1284
|
+
}
|
|
1285
|
+
async removePhoneNumber({ contactUri, phoneNumberUri, }) {
|
|
1286
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1287
|
+
const phoneNumberNode = (0,external_rdflib_.sym)(phoneNumberUri);
|
|
1288
|
+
await this.support.fetchNode(phoneNumberNode);
|
|
1289
|
+
const operation = removePhoneNumber(contactNode, phoneNumberNode, this.store);
|
|
1290
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1291
|
+
}
|
|
1292
|
+
async removeEmailAddress({ contactUri, emailAddressUri, }) {
|
|
1293
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1294
|
+
const emailAddressNode = (0,external_rdflib_.sym)(emailAddressUri);
|
|
1295
|
+
await this.support.fetchNode(emailAddressNode);
|
|
1296
|
+
const operation = removeEmailAddress(contactNode, emailAddressNode, this.store);
|
|
1297
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1298
|
+
}
|
|
1299
|
+
async updatePhoneNumber({ phoneNumberUri, newPhoneNumber, }) {
|
|
1300
|
+
const phoneNumberNode = (0,external_rdflib_.sym)(phoneNumberUri);
|
|
1301
|
+
await this.support.fetchNode(phoneNumberNode);
|
|
1302
|
+
const operation = updatePhoneNumber(phoneNumberNode, newPhoneNumber, this.store);
|
|
1303
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1304
|
+
}
|
|
1305
|
+
async updateEmailAddress({ emailAddressUri, newEmailAddress, }) {
|
|
1306
|
+
const emailAddressNode = (0,external_rdflib_.sym)(emailAddressUri);
|
|
1307
|
+
await this.support.fetchNode(emailAddressNode);
|
|
1308
|
+
const operation = updateEmailAddress(emailAddressNode, newEmailAddress, this.store);
|
|
1309
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1310
|
+
}
|
|
1311
|
+
async listAddressBooks(webId) {
|
|
1312
|
+
const profileNode = (0,external_rdflib_.sym)(webId);
|
|
1313
|
+
await this.support.fetchNode(profileNode);
|
|
1314
|
+
const profileQuery = new ProfileQuery(profileNode, this.store);
|
|
1315
|
+
const publicTypeIndexNode = profileQuery.queryPublicTypeIndex();
|
|
1316
|
+
const preferencesFile = profileQuery.queryPreferencesFile();
|
|
1317
|
+
const promisePublicUris = this.fetchIndexedAddressBooks(publicTypeIndexNode);
|
|
1318
|
+
const promisePrivateTypeIndex = this.fetchPrivateTypeIndex(profileNode, preferencesFile);
|
|
1319
|
+
const [publicUris, privateTypeIndex] = await Promise.allSettled([
|
|
1320
|
+
promisePublicUris,
|
|
1321
|
+
promisePrivateTypeIndex,
|
|
1322
|
+
]);
|
|
1323
|
+
const privateUris = privateTypeIndex.status === "fulfilled"
|
|
1324
|
+
? await this.fetchIndexedAddressBooks(privateTypeIndex.value)
|
|
1325
|
+
: [];
|
|
1326
|
+
return {
|
|
1327
|
+
publicUris: publicUris.status === "fulfilled" ? publicUris.value : [],
|
|
1328
|
+
privateUris,
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
async fetchIndexedAddressBooks(publicTypeIndexNode) {
|
|
1332
|
+
if (!publicTypeIndexNode) {
|
|
1333
|
+
return [];
|
|
1334
|
+
}
|
|
1335
|
+
await this.support.fetchNode(publicTypeIndexNode);
|
|
1336
|
+
return new TypeIndexQuery(this.store, publicTypeIndexNode).queryInstancesForClass(VCARD_ADDRESS_BOOK);
|
|
1337
|
+
}
|
|
1338
|
+
async fetchPrivateTypeIndex(profileNode, preferencesFile) {
|
|
1339
|
+
if (!preferencesFile) {
|
|
1340
|
+
return null;
|
|
1341
|
+
}
|
|
1342
|
+
await this.support.fetchNode(preferencesFile);
|
|
1343
|
+
const preferencesQuery = new PreferencesQuery(this.store, profileNode, preferencesFile);
|
|
1344
|
+
return preferencesQuery.queryPrivateTypeIndex();
|
|
1345
|
+
}
|
|
1346
|
+
async renameContact({ contactUri, newName }) {
|
|
1347
|
+
const contactNode = (0,external_rdflib_.sym)(contactUri);
|
|
1348
|
+
await this.support.fetchNode(contactNode);
|
|
1349
|
+
const operation = renameContact(this.store, contactNode, newName);
|
|
1350
|
+
await executeUpdate(this.fetcher, this.updater, operation);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
//# sourceMappingURL=ContactsModuleRdfLib.js.map
|
|
1354
|
+
;// ./node_modules/@solid-data-modules/contacts-rdflib/dist/index.js
|
|
1355
|
+
|
|
1356
|
+
/* harmony default export */ const dist = (ContactsModuleRdfLib);
|
|
1357
|
+
//# sourceMappingURL=index.js.map
|
|
1358
|
+
|
|
1359
|
+
/***/ }
|
|
1360
|
+
|
|
1361
|
+
}]);
|
|
1362
|
+
//# sourceMappingURL=303.profile-pane.js.map
|