@pod-os/core 0.12.1-fef97c9.0 → 0.13.1-0b8a8a5.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/dist/{chunk-7VQUARYZ.js → chunk-XBA7NYKJ.js} +344 -1
- package/dist/{dist-F3EUFQHU.js → dist-5TZZFAHE.js} +2 -344
- package/dist/index.js +159 -85
- package/lib/index.js +176 -97
- package/package.json +13 -12
- package/types/Store.d.ts +2 -0
- package/types/index.d.ts +7 -1
- package/types/namespaces/index.d.ts +1 -0
- package/types/search/addToLabelIndex.d.ts +4 -0
- package/types/search/addToLabelIndex.spec.d.ts +1 -0
- package/types/thing/Thing.d.ts +2 -0
- package/types/thing/index.d.ts +1 -0
- package/types/thing/labelFromUri.d.ts +5 -0
- package/types/thing/labelFromUri.spec.d.ts +1 -0
|
@@ -3,355 +3,13 @@ import {
|
|
|
3
3
|
isNamedNode,
|
|
4
4
|
lit,
|
|
5
5
|
namedNode,
|
|
6
|
+
require_short_unique_id,
|
|
6
7
|
st
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XBA7NYKJ.js";
|
|
8
9
|
import {
|
|
9
|
-
__commonJS,
|
|
10
10
|
__toESM
|
|
11
11
|
} from "./chunk-U67V476Y.js";
|
|
12
12
|
|
|
13
|
-
// ../node_modules/short-unique-id/dist/short-unique-id.js
|
|
14
|
-
var require_short_unique_id = __commonJS({
|
|
15
|
-
"../node_modules/short-unique-id/dist/short-unique-id.js"(exports, module) {
|
|
16
|
-
"use strict";
|
|
17
|
-
var ShortUniqueId2 = (() => {
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
22
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
23
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
24
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
25
|
-
var __spreadValues = (a, b) => {
|
|
26
|
-
for (var prop in b || (b = {}))
|
|
27
|
-
if (__hasOwnProp.call(b, prop))
|
|
28
|
-
__defNormalProp(a, prop, b[prop]);
|
|
29
|
-
if (__getOwnPropSymbols)
|
|
30
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
31
|
-
if (__propIsEnum.call(b, prop))
|
|
32
|
-
__defNormalProp(a, prop, b[prop]);
|
|
33
|
-
}
|
|
34
|
-
return a;
|
|
35
|
-
};
|
|
36
|
-
var __export = (target, all) => {
|
|
37
|
-
for (var name in all)
|
|
38
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
-
};
|
|
40
|
-
var __copyProps = (to, from, except, desc) => {
|
|
41
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
-
for (let key of __getOwnPropNames(from))
|
|
43
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
-
}
|
|
46
|
-
return to;
|
|
47
|
-
};
|
|
48
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
49
|
-
var __publicField = (obj, key, value) => {
|
|
50
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
51
|
-
return value;
|
|
52
|
-
};
|
|
53
|
-
var src_exports = {};
|
|
54
|
-
__export(src_exports, {
|
|
55
|
-
DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
|
|
56
|
-
DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
|
|
57
|
-
default: () => ShortUniqueId3
|
|
58
|
-
});
|
|
59
|
-
var version = "5.2.0";
|
|
60
|
-
var DEFAULT_UUID_LENGTH = 6;
|
|
61
|
-
var DEFAULT_OPTIONS = {
|
|
62
|
-
dictionary: "alphanum",
|
|
63
|
-
shuffle: true,
|
|
64
|
-
debug: false,
|
|
65
|
-
length: DEFAULT_UUID_LENGTH,
|
|
66
|
-
counter: 0
|
|
67
|
-
};
|
|
68
|
-
var _ShortUniqueId = class _ShortUniqueId {
|
|
69
|
-
constructor(argOptions = {}) {
|
|
70
|
-
__publicField(this, "counter");
|
|
71
|
-
__publicField(this, "debug");
|
|
72
|
-
__publicField(this, "dict");
|
|
73
|
-
__publicField(this, "version");
|
|
74
|
-
__publicField(this, "dictIndex", 0);
|
|
75
|
-
__publicField(this, "dictRange", []);
|
|
76
|
-
__publicField(this, "lowerBound", 0);
|
|
77
|
-
__publicField(this, "upperBound", 0);
|
|
78
|
-
__publicField(this, "dictLength", 0);
|
|
79
|
-
__publicField(this, "uuidLength");
|
|
80
|
-
__publicField(this, "_digit_first_ascii", 48);
|
|
81
|
-
__publicField(this, "_digit_last_ascii", 58);
|
|
82
|
-
__publicField(this, "_alpha_lower_first_ascii", 97);
|
|
83
|
-
__publicField(this, "_alpha_lower_last_ascii", 123);
|
|
84
|
-
__publicField(this, "_hex_last_ascii", 103);
|
|
85
|
-
__publicField(this, "_alpha_upper_first_ascii", 65);
|
|
86
|
-
__publicField(this, "_alpha_upper_last_ascii", 91);
|
|
87
|
-
__publicField(this, "_number_dict_ranges", {
|
|
88
|
-
digits: [this._digit_first_ascii, this._digit_last_ascii]
|
|
89
|
-
});
|
|
90
|
-
__publicField(this, "_alpha_dict_ranges", {
|
|
91
|
-
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
|
|
92
|
-
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
93
|
-
});
|
|
94
|
-
__publicField(this, "_alpha_lower_dict_ranges", {
|
|
95
|
-
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
|
|
96
|
-
});
|
|
97
|
-
__publicField(this, "_alpha_upper_dict_ranges", {
|
|
98
|
-
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
99
|
-
});
|
|
100
|
-
__publicField(this, "_alphanum_dict_ranges", {
|
|
101
|
-
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
102
|
-
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
|
|
103
|
-
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
104
|
-
});
|
|
105
|
-
__publicField(this, "_alphanum_lower_dict_ranges", {
|
|
106
|
-
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
107
|
-
lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
|
|
108
|
-
});
|
|
109
|
-
__publicField(this, "_alphanum_upper_dict_ranges", {
|
|
110
|
-
digits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
111
|
-
upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
|
|
112
|
-
});
|
|
113
|
-
__publicField(this, "_hex_dict_ranges", {
|
|
114
|
-
decDigits: [this._digit_first_ascii, this._digit_last_ascii],
|
|
115
|
-
alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
|
|
116
|
-
});
|
|
117
|
-
__publicField(this, "_dict_ranges", {
|
|
118
|
-
_number_dict_ranges: this._number_dict_ranges,
|
|
119
|
-
_alpha_dict_ranges: this._alpha_dict_ranges,
|
|
120
|
-
_alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
|
|
121
|
-
_alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
|
|
122
|
-
_alphanum_dict_ranges: this._alphanum_dict_ranges,
|
|
123
|
-
_alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
|
|
124
|
-
_alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
|
|
125
|
-
_hex_dict_ranges: this._hex_dict_ranges
|
|
126
|
-
});
|
|
127
|
-
__publicField(this, "log", (...args) => {
|
|
128
|
-
const finalArgs = [...args];
|
|
129
|
-
finalArgs[0] = `[short-unique-id] ${args[0]}`;
|
|
130
|
-
if (this.debug === true) {
|
|
131
|
-
if (typeof console !== "undefined" && console !== null) {
|
|
132
|
-
return console.log(...finalArgs);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
__publicField(this, "_normalizeDictionary", (dictionary2, shuffle2) => {
|
|
137
|
-
let finalDict;
|
|
138
|
-
if (dictionary2 && Array.isArray(dictionary2) && dictionary2.length > 1) {
|
|
139
|
-
finalDict = dictionary2;
|
|
140
|
-
} else {
|
|
141
|
-
finalDict = [];
|
|
142
|
-
let i;
|
|
143
|
-
this.dictIndex = i = 0;
|
|
144
|
-
const rangesName = `_${dictionary2}_dict_ranges`;
|
|
145
|
-
const ranges = this._dict_ranges[rangesName];
|
|
146
|
-
Object.keys(ranges).forEach((rangeType) => {
|
|
147
|
-
const rangeTypeKey = rangeType;
|
|
148
|
-
this.dictRange = ranges[rangeTypeKey];
|
|
149
|
-
this.lowerBound = this.dictRange[0];
|
|
150
|
-
this.upperBound = this.dictRange[1];
|
|
151
|
-
for (this.dictIndex = i = this.lowerBound; this.lowerBound <= this.upperBound ? i < this.upperBound : i > this.upperBound; this.dictIndex = this.lowerBound <= this.upperBound ? i += 1 : i -= 1) {
|
|
152
|
-
finalDict.push(String.fromCharCode(this.dictIndex));
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (shuffle2) {
|
|
157
|
-
const PROBABILITY = 0.5;
|
|
158
|
-
finalDict = finalDict.sort(() => Math.random() - PROBABILITY);
|
|
159
|
-
}
|
|
160
|
-
return finalDict;
|
|
161
|
-
});
|
|
162
|
-
__publicField(this, "setDictionary", (dictionary2, shuffle2) => {
|
|
163
|
-
this.dict = this._normalizeDictionary(dictionary2, shuffle2);
|
|
164
|
-
this.dictLength = this.dict.length;
|
|
165
|
-
this.setCounter(0);
|
|
166
|
-
});
|
|
167
|
-
__publicField(this, "seq", () => {
|
|
168
|
-
return this.sequentialUUID();
|
|
169
|
-
});
|
|
170
|
-
__publicField(this, "sequentialUUID", () => {
|
|
171
|
-
let counterDiv;
|
|
172
|
-
let counterRem;
|
|
173
|
-
let id = "";
|
|
174
|
-
counterDiv = this.counter;
|
|
175
|
-
do {
|
|
176
|
-
counterRem = counterDiv % this.dictLength;
|
|
177
|
-
counterDiv = Math.trunc(counterDiv / this.dictLength);
|
|
178
|
-
id += this.dict[counterRem];
|
|
179
|
-
} while (counterDiv !== 0);
|
|
180
|
-
this.counter += 1;
|
|
181
|
-
return id;
|
|
182
|
-
});
|
|
183
|
-
__publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
|
|
184
|
-
return this.randomUUID(uuidLength);
|
|
185
|
-
});
|
|
186
|
-
__publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
|
|
187
|
-
let id;
|
|
188
|
-
let randomPartIdx;
|
|
189
|
-
let j;
|
|
190
|
-
if (uuidLength === null || typeof uuidLength === "undefined" || uuidLength < 1) {
|
|
191
|
-
throw new Error("Invalid UUID Length Provided");
|
|
192
|
-
}
|
|
193
|
-
const isPositive = uuidLength >= 0;
|
|
194
|
-
id = "";
|
|
195
|
-
for (j = 0; j < uuidLength; j += 1) {
|
|
196
|
-
randomPartIdx = parseInt(
|
|
197
|
-
(Math.random() * this.dictLength).toFixed(0),
|
|
198
|
-
10
|
|
199
|
-
) % this.dictLength;
|
|
200
|
-
id += this.dict[randomPartIdx];
|
|
201
|
-
}
|
|
202
|
-
return id;
|
|
203
|
-
});
|
|
204
|
-
__publicField(this, "fmt", (format, date) => {
|
|
205
|
-
return this.formattedUUID(format, date);
|
|
206
|
-
});
|
|
207
|
-
__publicField(this, "formattedUUID", (format, date) => {
|
|
208
|
-
const fnMap = {
|
|
209
|
-
"$r": this.randomUUID,
|
|
210
|
-
"$s": this.sequentialUUID,
|
|
211
|
-
"$t": this.stamp
|
|
212
|
-
};
|
|
213
|
-
const result = format.replace(
|
|
214
|
-
/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
|
|
215
|
-
(m) => {
|
|
216
|
-
const fn = m.slice(0, 2);
|
|
217
|
-
const len = parseInt(m.slice(2), 10);
|
|
218
|
-
if (fn === "$s") {
|
|
219
|
-
return fnMap[fn]().padStart(len, "0");
|
|
220
|
-
}
|
|
221
|
-
if (fn === "$t" && date) {
|
|
222
|
-
return fnMap[fn](len, date);
|
|
223
|
-
}
|
|
224
|
-
return fnMap[fn](len);
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
return result;
|
|
228
|
-
});
|
|
229
|
-
__publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
|
|
230
|
-
return parseFloat(
|
|
231
|
-
Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0)
|
|
232
|
-
);
|
|
233
|
-
});
|
|
234
|
-
__publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
|
|
235
|
-
return parseFloat(
|
|
236
|
-
Math.sqrt(Math.PI / 2 * rounds).toFixed(20)
|
|
237
|
-
);
|
|
238
|
-
});
|
|
239
|
-
__publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
|
|
240
|
-
return parseFloat(
|
|
241
|
-
(this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
|
|
242
|
-
);
|
|
243
|
-
});
|
|
244
|
-
__publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
|
|
245
|
-
const score = parseFloat(
|
|
246
|
-
(1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
|
|
247
|
-
);
|
|
248
|
-
return score > 1 ? 1 : score < 0 ? 0 : score;
|
|
249
|
-
});
|
|
250
|
-
__publicField(this, "getVersion", () => {
|
|
251
|
-
return this.version;
|
|
252
|
-
});
|
|
253
|
-
__publicField(this, "stamp", (finalLength, date) => {
|
|
254
|
-
const hexStamp = Math.floor(+(date || /* @__PURE__ */ new Date()) / 1e3).toString(16);
|
|
255
|
-
if (typeof finalLength === "number" && finalLength === 0) {
|
|
256
|
-
return hexStamp;
|
|
257
|
-
}
|
|
258
|
-
if (typeof finalLength !== "number" || finalLength < 10) {
|
|
259
|
-
throw new Error(
|
|
260
|
-
[
|
|
261
|
-
"Param finalLength must be a number greater than or equal to 10,",
|
|
262
|
-
"or 0 if you want the raw hexadecimal timestamp"
|
|
263
|
-
].join("\n")
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
const idLength = finalLength - 9;
|
|
267
|
-
const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
|
|
268
|
-
const id = this.randomUUID(idLength);
|
|
269
|
-
return `${id.substring(0, rndIdx)}${hexStamp}${id.substring(rndIdx)}${rndIdx.toString(16)}`;
|
|
270
|
-
});
|
|
271
|
-
__publicField(this, "parseStamp", (suid, format) => {
|
|
272
|
-
if (format && !/t0|t[1-9]\d{1,}/.test(format)) {
|
|
273
|
-
throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
|
|
274
|
-
}
|
|
275
|
-
const stamp = format ? format.replace(
|
|
276
|
-
/\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
|
|
277
|
-
(m) => {
|
|
278
|
-
const fnMap = {
|
|
279
|
-
"$r": (len2) => [...Array(len2)].map(() => "r").join(""),
|
|
280
|
-
"$s": (len2) => [...Array(len2)].map(() => "s").join(""),
|
|
281
|
-
"$t": (len2) => [...Array(len2)].map(() => "t").join("")
|
|
282
|
-
};
|
|
283
|
-
const fn = m.slice(0, 2);
|
|
284
|
-
const len = parseInt(m.slice(2), 10);
|
|
285
|
-
return fnMap[fn](len);
|
|
286
|
-
}
|
|
287
|
-
).replace(
|
|
288
|
-
/^(.*?)(t{8,})(.*)$/g,
|
|
289
|
-
(_m, p1, p2) => {
|
|
290
|
-
return suid.substring(p1.length, p1.length + p2.length);
|
|
291
|
-
}
|
|
292
|
-
) : suid;
|
|
293
|
-
if (stamp.length === 8) {
|
|
294
|
-
return new Date(parseInt(stamp, 16) * 1e3);
|
|
295
|
-
}
|
|
296
|
-
if (stamp.length < 10) {
|
|
297
|
-
throw new Error("Stamp length invalid");
|
|
298
|
-
}
|
|
299
|
-
const rndIdx = parseInt(stamp.substring(stamp.length - 1), 16);
|
|
300
|
-
return new Date(parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
|
|
301
|
-
});
|
|
302
|
-
__publicField(this, "setCounter", (counter2) => {
|
|
303
|
-
this.counter = counter2;
|
|
304
|
-
});
|
|
305
|
-
__publicField(this, "validate", (uid2, dictionary2) => {
|
|
306
|
-
const finalDictionary = dictionary2 ? this._normalizeDictionary(dictionary2) : this.dict;
|
|
307
|
-
return uid2.split("").every((c) => finalDictionary.includes(c));
|
|
308
|
-
});
|
|
309
|
-
const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
|
|
310
|
-
this.counter = 0;
|
|
311
|
-
this.debug = false;
|
|
312
|
-
this.dict = [];
|
|
313
|
-
this.version = version;
|
|
314
|
-
const {
|
|
315
|
-
dictionary,
|
|
316
|
-
shuffle,
|
|
317
|
-
length,
|
|
318
|
-
counter
|
|
319
|
-
} = options;
|
|
320
|
-
this.uuidLength = length;
|
|
321
|
-
this.setDictionary(dictionary, shuffle);
|
|
322
|
-
this.setCounter(counter);
|
|
323
|
-
this.debug = options.debug;
|
|
324
|
-
this.log(this.dict);
|
|
325
|
-
this.log(
|
|
326
|
-
`Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
|
|
327
|
-
);
|
|
328
|
-
this.log = this.log.bind(this);
|
|
329
|
-
this.setDictionary = this.setDictionary.bind(this);
|
|
330
|
-
this.setCounter = this.setCounter.bind(this);
|
|
331
|
-
this.seq = this.seq.bind(this);
|
|
332
|
-
this.sequentialUUID = this.sequentialUUID.bind(this);
|
|
333
|
-
this.rnd = this.rnd.bind(this);
|
|
334
|
-
this.randomUUID = this.randomUUID.bind(this);
|
|
335
|
-
this.fmt = this.fmt.bind(this);
|
|
336
|
-
this.formattedUUID = this.formattedUUID.bind(this);
|
|
337
|
-
this.availableUUIDs = this.availableUUIDs.bind(this);
|
|
338
|
-
this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
|
|
339
|
-
this.collisionProbability = this.collisionProbability.bind(this);
|
|
340
|
-
this.uniqueness = this.uniqueness.bind(this);
|
|
341
|
-
this.getVersion = this.getVersion.bind(this);
|
|
342
|
-
this.stamp = this.stamp.bind(this);
|
|
343
|
-
this.parseStamp = this.parseStamp.bind(this);
|
|
344
|
-
return this;
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
__publicField(_ShortUniqueId, "default", _ShortUniqueId);
|
|
348
|
-
var ShortUniqueId3 = _ShortUniqueId;
|
|
349
|
-
return __toCommonJS(src_exports);
|
|
350
|
-
})();
|
|
351
|
-
"undefined" != typeof module && (module.exports = ShortUniqueId2.default), "undefined" != typeof window && (ShortUniqueId2 = ShortUniqueId2.default);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
|
|
355
13
|
// ../node_modules/@solid-data-modules/contacts-rdflib/dist/rdflib/namespaces.js
|
|
356
14
|
var vcard = Namespace("http://www.w3.org/2006/vcard/ns#");
|
|
357
15
|
var dc = Namespace("http://purl.org/dc/elements/1.1/");
|