@pod-os/core 0.13.1-ebe6b8e.0 → 0.14.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.
@@ -12983,6 +12983,348 @@ var require_browser_ponyfill = __commonJS({
12983
12983
  }
12984
12984
  });
12985
12985
 
12986
+ // ../node_modules/short-unique-id/dist/short-unique-id.js
12987
+ var require_short_unique_id = __commonJS({
12988
+ "../node_modules/short-unique-id/dist/short-unique-id.js"(exports, module2) {
12989
+ "use strict";
12990
+ var ShortUniqueId = (() => {
12991
+ var __defProp = Object.defineProperty;
12992
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12993
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12994
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
12995
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12996
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12997
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12998
+ var __spreadValues = (a, b) => {
12999
+ for (var prop in b || (b = {}))
13000
+ if (__hasOwnProp.call(b, prop))
13001
+ __defNormalProp(a, prop, b[prop]);
13002
+ if (__getOwnPropSymbols)
13003
+ for (var prop of __getOwnPropSymbols(b)) {
13004
+ if (__propIsEnum.call(b, prop))
13005
+ __defNormalProp(a, prop, b[prop]);
13006
+ }
13007
+ return a;
13008
+ };
13009
+ var __export2 = (target, all) => {
13010
+ for (var name in all)
13011
+ __defProp(target, name, { get: all[name], enumerable: true });
13012
+ };
13013
+ var __copyProps = (to, from, except, desc) => {
13014
+ if (from && typeof from === "object" || typeof from === "function") {
13015
+ for (let key of __getOwnPropNames(from))
13016
+ if (!__hasOwnProp.call(to, key) && key !== except)
13017
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13018
+ }
13019
+ return to;
13020
+ };
13021
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
13022
+ var __publicField = (obj, key, value) => {
13023
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13024
+ return value;
13025
+ };
13026
+ var src_exports = {};
13027
+ __export2(src_exports, {
13028
+ DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
13029
+ DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
13030
+ default: () => ShortUniqueId2
13031
+ });
13032
+ var version = "5.2.0";
13033
+ var DEFAULT_UUID_LENGTH = 6;
13034
+ var DEFAULT_OPTIONS = {
13035
+ dictionary: "alphanum",
13036
+ shuffle: true,
13037
+ debug: false,
13038
+ length: DEFAULT_UUID_LENGTH,
13039
+ counter: 0
13040
+ };
13041
+ var _ShortUniqueId = class _ShortUniqueId {
13042
+ constructor(argOptions = {}) {
13043
+ __publicField(this, "counter");
13044
+ __publicField(this, "debug");
13045
+ __publicField(this, "dict");
13046
+ __publicField(this, "version");
13047
+ __publicField(this, "dictIndex", 0);
13048
+ __publicField(this, "dictRange", []);
13049
+ __publicField(this, "lowerBound", 0);
13050
+ __publicField(this, "upperBound", 0);
13051
+ __publicField(this, "dictLength", 0);
13052
+ __publicField(this, "uuidLength");
13053
+ __publicField(this, "_digit_first_ascii", 48);
13054
+ __publicField(this, "_digit_last_ascii", 58);
13055
+ __publicField(this, "_alpha_lower_first_ascii", 97);
13056
+ __publicField(this, "_alpha_lower_last_ascii", 123);
13057
+ __publicField(this, "_hex_last_ascii", 103);
13058
+ __publicField(this, "_alpha_upper_first_ascii", 65);
13059
+ __publicField(this, "_alpha_upper_last_ascii", 91);
13060
+ __publicField(this, "_number_dict_ranges", {
13061
+ digits: [this._digit_first_ascii, this._digit_last_ascii]
13062
+ });
13063
+ __publicField(this, "_alpha_dict_ranges", {
13064
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
13065
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13066
+ });
13067
+ __publicField(this, "_alpha_lower_dict_ranges", {
13068
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
13069
+ });
13070
+ __publicField(this, "_alpha_upper_dict_ranges", {
13071
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13072
+ });
13073
+ __publicField(this, "_alphanum_dict_ranges", {
13074
+ digits: [this._digit_first_ascii, this._digit_last_ascii],
13075
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
13076
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13077
+ });
13078
+ __publicField(this, "_alphanum_lower_dict_ranges", {
13079
+ digits: [this._digit_first_ascii, this._digit_last_ascii],
13080
+ lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
13081
+ });
13082
+ __publicField(this, "_alphanum_upper_dict_ranges", {
13083
+ digits: [this._digit_first_ascii, this._digit_last_ascii],
13084
+ upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
13085
+ });
13086
+ __publicField(this, "_hex_dict_ranges", {
13087
+ decDigits: [this._digit_first_ascii, this._digit_last_ascii],
13088
+ alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
13089
+ });
13090
+ __publicField(this, "_dict_ranges", {
13091
+ _number_dict_ranges: this._number_dict_ranges,
13092
+ _alpha_dict_ranges: this._alpha_dict_ranges,
13093
+ _alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
13094
+ _alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
13095
+ _alphanum_dict_ranges: this._alphanum_dict_ranges,
13096
+ _alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
13097
+ _alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
13098
+ _hex_dict_ranges: this._hex_dict_ranges
13099
+ });
13100
+ __publicField(this, "log", (...args) => {
13101
+ const finalArgs = [...args];
13102
+ finalArgs[0] = `[short-unique-id] ${args[0]}`;
13103
+ if (this.debug === true) {
13104
+ if (typeof console !== "undefined" && console !== null) {
13105
+ return console.log(...finalArgs);
13106
+ }
13107
+ }
13108
+ });
13109
+ __publicField(this, "_normalizeDictionary", (dictionary2, shuffle2) => {
13110
+ let finalDict;
13111
+ if (dictionary2 && Array.isArray(dictionary2) && dictionary2.length > 1) {
13112
+ finalDict = dictionary2;
13113
+ } else {
13114
+ finalDict = [];
13115
+ let i;
13116
+ this.dictIndex = i = 0;
13117
+ const rangesName = `_${dictionary2}_dict_ranges`;
13118
+ const ranges = this._dict_ranges[rangesName];
13119
+ Object.keys(ranges).forEach((rangeType) => {
13120
+ const rangeTypeKey = rangeType;
13121
+ this.dictRange = ranges[rangeTypeKey];
13122
+ this.lowerBound = this.dictRange[0];
13123
+ this.upperBound = this.dictRange[1];
13124
+ 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) {
13125
+ finalDict.push(String.fromCharCode(this.dictIndex));
13126
+ }
13127
+ });
13128
+ }
13129
+ if (shuffle2) {
13130
+ const PROBABILITY = 0.5;
13131
+ finalDict = finalDict.sort(() => Math.random() - PROBABILITY);
13132
+ }
13133
+ return finalDict;
13134
+ });
13135
+ __publicField(this, "setDictionary", (dictionary2, shuffle2) => {
13136
+ this.dict = this._normalizeDictionary(dictionary2, shuffle2);
13137
+ this.dictLength = this.dict.length;
13138
+ this.setCounter(0);
13139
+ });
13140
+ __publicField(this, "seq", () => {
13141
+ return this.sequentialUUID();
13142
+ });
13143
+ __publicField(this, "sequentialUUID", () => {
13144
+ let counterDiv;
13145
+ let counterRem;
13146
+ let id3 = "";
13147
+ counterDiv = this.counter;
13148
+ do {
13149
+ counterRem = counterDiv % this.dictLength;
13150
+ counterDiv = Math.trunc(counterDiv / this.dictLength);
13151
+ id3 += this.dict[counterRem];
13152
+ } while (counterDiv !== 0);
13153
+ this.counter += 1;
13154
+ return id3;
13155
+ });
13156
+ __publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
13157
+ return this.randomUUID(uuidLength);
13158
+ });
13159
+ __publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
13160
+ let id3;
13161
+ let randomPartIdx;
13162
+ let j;
13163
+ if (uuidLength === null || typeof uuidLength === "undefined" || uuidLength < 1) {
13164
+ throw new Error("Invalid UUID Length Provided");
13165
+ }
13166
+ const isPositive = uuidLength >= 0;
13167
+ id3 = "";
13168
+ for (j = 0; j < uuidLength; j += 1) {
13169
+ randomPartIdx = parseInt(
13170
+ (Math.random() * this.dictLength).toFixed(0),
13171
+ 10
13172
+ ) % this.dictLength;
13173
+ id3 += this.dict[randomPartIdx];
13174
+ }
13175
+ return id3;
13176
+ });
13177
+ __publicField(this, "fmt", (format, date) => {
13178
+ return this.formattedUUID(format, date);
13179
+ });
13180
+ __publicField(this, "formattedUUID", (format, date) => {
13181
+ const fnMap = {
13182
+ "$r": this.randomUUID,
13183
+ "$s": this.sequentialUUID,
13184
+ "$t": this.stamp
13185
+ };
13186
+ const result = format.replace(
13187
+ /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
13188
+ (m) => {
13189
+ const fn = m.slice(0, 2);
13190
+ const len = parseInt(m.slice(2), 10);
13191
+ if (fn === "$s") {
13192
+ return fnMap[fn]().padStart(len, "0");
13193
+ }
13194
+ if (fn === "$t" && date) {
13195
+ return fnMap[fn](len, date);
13196
+ }
13197
+ return fnMap[fn](len);
13198
+ }
13199
+ );
13200
+ return result;
13201
+ });
13202
+ __publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
13203
+ return parseFloat(
13204
+ Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0)
13205
+ );
13206
+ });
13207
+ __publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
13208
+ return parseFloat(
13209
+ Math.sqrt(Math.PI / 2 * rounds).toFixed(20)
13210
+ );
13211
+ });
13212
+ __publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
13213
+ return parseFloat(
13214
+ (this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
13215
+ );
13216
+ });
13217
+ __publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
13218
+ const score = parseFloat(
13219
+ (1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
13220
+ );
13221
+ return score > 1 ? 1 : score < 0 ? 0 : score;
13222
+ });
13223
+ __publicField(this, "getVersion", () => {
13224
+ return this.version;
13225
+ });
13226
+ __publicField(this, "stamp", (finalLength, date) => {
13227
+ const hexStamp = Math.floor(+(date || /* @__PURE__ */ new Date()) / 1e3).toString(16);
13228
+ if (typeof finalLength === "number" && finalLength === 0) {
13229
+ return hexStamp;
13230
+ }
13231
+ if (typeof finalLength !== "number" || finalLength < 10) {
13232
+ throw new Error(
13233
+ [
13234
+ "Param finalLength must be a number greater than or equal to 10,",
13235
+ "or 0 if you want the raw hexadecimal timestamp"
13236
+ ].join("\n")
13237
+ );
13238
+ }
13239
+ const idLength = finalLength - 9;
13240
+ const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
13241
+ const id3 = this.randomUUID(idLength);
13242
+ return `${id3.substring(0, rndIdx)}${hexStamp}${id3.substring(rndIdx)}${rndIdx.toString(16)}`;
13243
+ });
13244
+ __publicField(this, "parseStamp", (suid, format) => {
13245
+ if (format && !/t0|t[1-9]\d{1,}/.test(format)) {
13246
+ throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
13247
+ }
13248
+ const stamp = format ? format.replace(
13249
+ /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
13250
+ (m) => {
13251
+ const fnMap = {
13252
+ "$r": (len2) => [...Array(len2)].map(() => "r").join(""),
13253
+ "$s": (len2) => [...Array(len2)].map(() => "s").join(""),
13254
+ "$t": (len2) => [...Array(len2)].map(() => "t").join("")
13255
+ };
13256
+ const fn = m.slice(0, 2);
13257
+ const len = parseInt(m.slice(2), 10);
13258
+ return fnMap[fn](len);
13259
+ }
13260
+ ).replace(
13261
+ /^(.*?)(t{8,})(.*)$/g,
13262
+ (_m, p1, p2) => {
13263
+ return suid.substring(p1.length, p1.length + p2.length);
13264
+ }
13265
+ ) : suid;
13266
+ if (stamp.length === 8) {
13267
+ return new Date(parseInt(stamp, 16) * 1e3);
13268
+ }
13269
+ if (stamp.length < 10) {
13270
+ throw new Error("Stamp length invalid");
13271
+ }
13272
+ const rndIdx = parseInt(stamp.substring(stamp.length - 1), 16);
13273
+ return new Date(parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
13274
+ });
13275
+ __publicField(this, "setCounter", (counter2) => {
13276
+ this.counter = counter2;
13277
+ });
13278
+ __publicField(this, "validate", (uid, dictionary2) => {
13279
+ const finalDictionary = dictionary2 ? this._normalizeDictionary(dictionary2) : this.dict;
13280
+ return uid.split("").every((c) => finalDictionary.includes(c));
13281
+ });
13282
+ const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
13283
+ this.counter = 0;
13284
+ this.debug = false;
13285
+ this.dict = [];
13286
+ this.version = version;
13287
+ const {
13288
+ dictionary,
13289
+ shuffle,
13290
+ length,
13291
+ counter
13292
+ } = options;
13293
+ this.uuidLength = length;
13294
+ this.setDictionary(dictionary, shuffle);
13295
+ this.setCounter(counter);
13296
+ this.debug = options.debug;
13297
+ this.log(this.dict);
13298
+ this.log(
13299
+ `Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
13300
+ );
13301
+ this.log = this.log.bind(this);
13302
+ this.setDictionary = this.setDictionary.bind(this);
13303
+ this.setCounter = this.setCounter.bind(this);
13304
+ this.seq = this.seq.bind(this);
13305
+ this.sequentialUUID = this.sequentialUUID.bind(this);
13306
+ this.rnd = this.rnd.bind(this);
13307
+ this.randomUUID = this.randomUUID.bind(this);
13308
+ this.fmt = this.fmt.bind(this);
13309
+ this.formattedUUID = this.formattedUUID.bind(this);
13310
+ this.availableUUIDs = this.availableUUIDs.bind(this);
13311
+ this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
13312
+ this.collisionProbability = this.collisionProbability.bind(this);
13313
+ this.uniqueness = this.uniqueness.bind(this);
13314
+ this.getVersion = this.getVersion.bind(this);
13315
+ this.stamp = this.stamp.bind(this);
13316
+ this.parseStamp = this.parseStamp.bind(this);
13317
+ return this;
13318
+ }
13319
+ };
13320
+ __publicField(_ShortUniqueId, "default", _ShortUniqueId);
13321
+ var ShortUniqueId2 = _ShortUniqueId;
13322
+ return __toCommonJS(src_exports);
13323
+ })();
13324
+ "undefined" != typeof module2 && (module2.exports = ShortUniqueId.default), "undefined" != typeof window && (ShortUniqueId = ShortUniqueId.default);
13325
+ }
13326
+ });
13327
+
12986
13328
  // ../node_modules/@babel/runtime/helpers/esm/typeof.js
12987
13329
  function _typeof(o) {
12988
13330
  "@babel/helpers - typeof";
@@ -25528,7 +25870,8 @@ export {
25528
25870
  graph2 as graph,
25529
25871
  lit2 as lit,
25530
25872
  st2 as st,
25531
- namedNode3 as namedNode
25873
+ namedNode3 as namedNode,
25874
+ require_short_unique_id
25532
25875
  };
25533
25876
  /*! Bundled license information:
25534
25877
 
@@ -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-7VQUARYZ.js";
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/");
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ Namespace,
2
3
  UpdateManager,
3
4
  fetcher,
4
5
  graph,
@@ -7,8 +8,9 @@ import {
7
8
  isNamedNode,
8
9
  lit,
9
10
  namedNode,
11
+ require_short_unique_id,
10
12
  st
11
- } from "./chunk-7VQUARYZ.js";
13
+ } from "./chunk-XBA7NYKJ.js";
12
14
  import {
13
15
  __commonJS,
14
16
  __export,
@@ -13587,7 +13589,7 @@ var FileFetcher = class {
13587
13589
 
13588
13590
  // src/modules/contacts.ts
13589
13591
  async function loadContactsModule(store) {
13590
- const module2 = await import("./dist-F3EUFQHU.js");
13592
+ const module2 = await import("./dist-5TZZFAHE.js");
13591
13593
  return new module2.default({
13592
13594
  store: store.graph,
13593
13595
  fetcher: store.fetcher,
@@ -13898,6 +13900,9 @@ var RdfDocument = class extends Thing {
13898
13900
  }
13899
13901
  };
13900
13902
 
13903
+ // src/namespaces/index.ts
13904
+ var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
13905
+
13901
13906
  // src/search/LabelIndex.ts
13902
13907
  var LabelIndex = class extends RdfDocument {
13903
13908
  constructor(uri6, store, editable = false) {
@@ -13912,7 +13917,7 @@ var LabelIndex = class extends RdfDocument {
13912
13917
  getIndexedItems() {
13913
13918
  const matches = this.store.statementsMatching(
13914
13919
  null,
13915
- namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
13920
+ rdfs("label"),
13916
13921
  null,
13917
13922
  namedNode(this.uri)
13918
13923
  );
@@ -13923,6 +13928,48 @@ var LabelIndex = class extends RdfDocument {
13923
13928
  };
13924
13929
  });
13925
13930
  }
13931
+ contains(uri6) {
13932
+ return this.store.holds(namedNode(uri6), rdfs("label"), null, namedNode(this.uri));
13933
+ }
13934
+ };
13935
+
13936
+ // node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
13937
+ async function executeUpdate(fetcher2, updater, operation3) {
13938
+ await updater.updateMany(operation3.deletions, operation3.insertions);
13939
+ operation3.filesToCreate.map((file2) => {
13940
+ createEmptyTurtleFile(fetcher2, file2.url);
13941
+ });
13942
+ }
13943
+ function createEmptyTurtleFile(fetcher2, url7) {
13944
+ return fetcher2.webOperation("PUT", url7, {
13945
+ contentType: "text/turtle"
13946
+ });
13947
+ }
13948
+
13949
+ // node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
13950
+ var rdf = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
13951
+ var solid = Namespace("http://www.w3.org/ns/solid/terms#");
13952
+ var pim = Namespace("http://www.w3.org/ns/pim/space#");
13953
+ var ldp = Namespace("http://www.w3.org/ns/ldp#");
13954
+
13955
+ // node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
13956
+ var import_short_unique_id = __toESM(require_short_unique_id(), 1);
13957
+ var uid = new import_short_unique_id.default({ length: 10 });
13958
+
13959
+ // src/search/addToLabelIndex.ts
13960
+ var addToLabelIndex = (thing, labelIndex) => {
13961
+ return {
13962
+ deletions: [],
13963
+ filesToCreate: [],
13964
+ insertions: [
13965
+ st(
13966
+ namedNode(thing.uri),
13967
+ rdfs("label"),
13968
+ lit(thing.label()),
13969
+ namedNode(labelIndex.uri)
13970
+ )
13971
+ ]
13972
+ };
13926
13973
  };
13927
13974
 
13928
13975
  // src/Store.ts
@@ -14009,6 +14056,10 @@ var Store = class {
14009
14056
  }
14010
14057
  );
14011
14058
  }
14059
+ async addToLabelIndex(thing, labelIndex) {
14060
+ const operation3 = addToLabelIndex(thing, labelIndex);
14061
+ await executeUpdate(this.fetcher, this.updater, operation3);
14062
+ }
14012
14063
  };
14013
14064
 
14014
14065
  // ../node_modules/rdf-namespaces/dist/index.es.js
@@ -14025,21 +14076,21 @@ __export(index_es_exports, {
14025
14076
  foaf: () => foaf,
14026
14077
  http: () => http,
14027
14078
  hydra: () => hydra,
14028
- ldp: () => ldp,
14079
+ ldp: () => ldp2,
14029
14080
  link: () => link3,
14030
14081
  log: () => log,
14031
14082
  meeting: () => meeting,
14032
14083
  owl: () => owl,
14033
14084
  qu: () => qu,
14034
- rdf: () => rdf,
14035
- rdfs: () => rdfs,
14085
+ rdf: () => rdf2,
14086
+ rdfs: () => rdfs2,
14036
14087
  sched: () => sched,
14037
14088
  schema: () => schema,
14038
14089
  schema_https: () => schema_https,
14039
14090
  sec: () => sec,
14040
14091
  sioc: () => sioc,
14041
14092
  skos: () => skos,
14042
- solid: () => solid,
14093
+ solid: () => solid2,
14043
14094
  space: () => space,
14044
14095
  tab: () => tab,
14045
14096
  tabont: () => tabont,
@@ -14392,7 +14443,7 @@ var recurrenceId = "http://www.w3.org/2002/12/cal/ical#recurrenceId";
14392
14443
  var DomainOf_rrule = "http://www.w3.org/2002/12/cal/ical#DomainOf_rrule";
14393
14444
  var relatedTo = "http://www.w3.org/2002/12/cal/ical#relatedTo";
14394
14445
  var url2 = "http://www.w3.org/2002/12/cal/ical#url";
14395
- var uid = "http://www.w3.org/2002/12/cal/ical#uid";
14446
+ var uid2 = "http://www.w3.org/2002/12/cal/ical#uid";
14396
14447
  var exdate = "http://www.w3.org/2002/12/cal/ical#exdate";
14397
14448
  var exrule = "http://www.w3.org/2002/12/cal/ical#exrule";
14398
14449
  var Value_RECUR = "http://www.w3.org/2002/12/cal/ical#Value_RECUR";
@@ -14452,7 +14503,7 @@ var calImport = /* @__PURE__ */ Object.freeze({
14452
14503
  DomainOf_rrule,
14453
14504
  relatedTo,
14454
14505
  url: url2,
14455
- uid,
14506
+ uid: uid2,
14456
14507
  exdate,
14457
14508
  exrule,
14458
14509
  Value_RECUR,
@@ -16880,7 +16931,7 @@ var _containedItemQuantity = "http://hl7.org/fhir/_containedItemQuantity";
16880
16931
  var _daysSupply = "http://hl7.org/fhir/_daysSupply";
16881
16932
  var reportingVendor = "http://hl7.org/fhir/reportingVendor";
16882
16933
  var current = "http://hl7.org/fhir/current";
16883
- var uid2 = "http://hl7.org/fhir/uid";
16934
+ var uid3 = "http://hl7.org/fhir/uid";
16884
16935
  var order = "http://hl7.org/fhir/order";
16885
16936
  var priorPrescription = "http://hl7.org/fhir/priorPrescription";
16886
16937
  var distanceFromLandmark = "http://hl7.org/fhir/distanceFromLandmark";
@@ -21113,7 +21164,7 @@ var fhirImport = /* @__PURE__ */ Object.freeze({
21113
21164
  _daysSupply,
21114
21165
  reportingVendor,
21115
21166
  current,
21116
- uid: uid2,
21167
+ uid: uid3,
21117
21168
  order,
21118
21169
  priorPrescription,
21119
21170
  distanceFromLandmark,
@@ -34274,22 +34325,22 @@ var fhir = fhirImport;
34274
34325
  var foaf = foafImport;
34275
34326
  var http = httpImport;
34276
34327
  var hydra = hydraImport;
34277
- var ldp = ldpImport;
34328
+ var ldp2 = ldpImport;
34278
34329
  var link3 = linkImport;
34279
34330
  var log = logImport;
34280
34331
  var meeting = meetingImport;
34281
34332
  var owl = owlImport;
34282
34333
  var qu = quImport;
34283
34334
  var trip3 = tripImport;
34284
- var rdf = rdfImport;
34285
- var rdfs = rdfsImport;
34335
+ var rdf2 = rdfImport;
34336
+ var rdfs2 = rdfsImport;
34286
34337
  var sched = schedImport;
34287
34338
  var schema = schemaImport;
34288
34339
  var schema_https = schema_httpsImport;
34289
34340
  var sec = secImport;
34290
34341
  var sioc = siocImport;
34291
34342
  var skos = skosImport;
34292
- var solid = solidImport;
34343
+ var solid2 = solidImport;
34293
34344
  var space = spaceImport;
34294
34345
  var tab = tabImport;
34295
34346
  var tabont = tabontImport;
@@ -34462,6 +34513,14 @@ var PodOS = class {
34462
34513
  loadContactsModule() {
34463
34514
  return loadContactsModule(this.store);
34464
34515
  }
34516
+ /**
34517
+ * Adds a label of the given thing to the label index, so that it can be found after the search index has been rebuilt
34518
+ * @param thing - The thing to index
34519
+ * @param labelIndex - The index to update
34520
+ */
34521
+ async addToLabelIndex(thing, labelIndex) {
34522
+ await this.store.addToLabelIndex(thing, labelIndex);
34523
+ }
34465
34524
  };
34466
34525
  export {
34467
34526
  BinaryFile,
package/lib/index.js CHANGED
@@ -13470,12 +13470,12 @@ var PodOS = (() => {
13470
13470
  bookmark: "http://www.w3.org/2002/01/bookmark#",
13471
13471
  vann: "http://purl.org/vocab/vann/"
13472
13472
  };
13473
- function vocab(rdf5 = { namedNode: (u) => u }) {
13473
+ function vocab(rdf6 = { namedNode: (u) => u }) {
13474
13474
  const namespaces = {};
13475
13475
  for (const alias2 in aliases) {
13476
13476
  const expansion2 = aliases[alias2];
13477
13477
  namespaces[alias2] = function(localName = "") {
13478
- return rdf5.namedNode(expansion2 + localName);
13478
+ return rdf6.namedNode(expansion2 + localName);
13479
13479
  };
13480
13480
  }
13481
13481
  ;
@@ -41222,7 +41222,7 @@ var PodOS = (() => {
41222
41222
  var require_short_unique_id = __commonJS({
41223
41223
  "../node_modules/short-unique-id/dist/short-unique-id.js"(exports, module3) {
41224
41224
  "use strict";
41225
- var ShortUniqueId2 = (() => {
41225
+ var ShortUniqueId3 = (() => {
41226
41226
  var __defProp2 = Object.defineProperty;
41227
41227
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
41228
41228
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
@@ -41262,7 +41262,7 @@ var PodOS = (() => {
41262
41262
  __export2(src_exports, {
41263
41263
  DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
41264
41264
  DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
41265
- default: () => ShortUniqueId3
41265
+ default: () => ShortUniqueId4
41266
41266
  });
41267
41267
  var version6 = "5.2.0";
41268
41268
  var DEFAULT_UUID_LENGTH = 6;
@@ -41510,9 +41510,9 @@ var PodOS = (() => {
41510
41510
  __publicField(this, "setCounter", (counter2) => {
41511
41511
  this.counter = counter2;
41512
41512
  });
41513
- __publicField(this, "validate", (uid4, dictionary2) => {
41513
+ __publicField(this, "validate", (uid5, dictionary2) => {
41514
41514
  const finalDictionary = dictionary2 ? this._normalizeDictionary(dictionary2) : this.dict;
41515
- return uid4.split("").every((c) => finalDictionary.includes(c));
41515
+ return uid5.split("").every((c) => finalDictionary.includes(c));
41516
41516
  });
41517
41517
  const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
41518
41518
  this.counter = 0;
@@ -41553,10 +41553,10 @@ var PodOS = (() => {
41553
41553
  }
41554
41554
  };
41555
41555
  __publicField(_ShortUniqueId, "default", _ShortUniqueId);
41556
- var ShortUniqueId3 = _ShortUniqueId;
41556
+ var ShortUniqueId4 = _ShortUniqueId;
41557
41557
  return __toCommonJS2(src_exports);
41558
41558
  })();
41559
- "undefined" != typeof module3 && (module3.exports = ShortUniqueId2.default), "undefined" != typeof window && (ShortUniqueId2 = ShortUniqueId2.default);
41559
+ "undefined" != typeof module3 && (module3.exports = ShortUniqueId3.default), "undefined" != typeof window && (ShortUniqueId3 = ShortUniqueId3.default);
41560
41560
  }
41561
41561
  });
41562
41562
 
@@ -49708,6 +49708,10 @@ var PodOS = (() => {
49708
49708
  }
49709
49709
  };
49710
49710
 
49711
+ // src/namespaces/index.ts
49712
+ init_esm();
49713
+ var rdfs = Namespace("http://www.w3.org/2000/01/rdf-schema#");
49714
+
49711
49715
  // src/search/LabelIndex.ts
49712
49716
  var LabelIndex = class extends RdfDocument {
49713
49717
  constructor(uri6, store, editable = false) {
@@ -49722,7 +49726,7 @@ var PodOS = (() => {
49722
49726
  getIndexedItems() {
49723
49727
  const matches = this.store.statementsMatching(
49724
49728
  null,
49725
- namedNode2("http://www.w3.org/2000/01/rdf-schema#label"),
49729
+ rdfs("label"),
49726
49730
  null,
49727
49731
  namedNode2(this.uri)
49728
49732
  );
@@ -49733,10 +49737,56 @@ var PodOS = (() => {
49733
49737
  };
49734
49738
  });
49735
49739
  }
49740
+ contains(uri6) {
49741
+ return this.store.holds(namedNode2(uri6), rdfs("label"), null, namedNode2(this.uri));
49742
+ }
49736
49743
  };
49737
49744
 
49738
49745
  // src/Store.ts
49739
49746
  init_esm();
49747
+
49748
+ // node_modules/@solid-data-modules/rdflib-utils/dist/web-operations/executeUpdate.js
49749
+ async function executeUpdate2(fetcher3, updater, operation3) {
49750
+ await updater.updateMany(operation3.deletions, operation3.insertions);
49751
+ operation3.filesToCreate.map((file2) => {
49752
+ createEmptyTurtleFile2(fetcher3, file2.url);
49753
+ });
49754
+ }
49755
+ function createEmptyTurtleFile2(fetcher3, url7) {
49756
+ return fetcher3.webOperation("PUT", url7, {
49757
+ contentType: "text/turtle"
49758
+ });
49759
+ }
49760
+
49761
+ // node_modules/@solid-data-modules/rdflib-utils/dist/namespaces/index.js
49762
+ init_esm();
49763
+ var rdf4 = Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
49764
+ var solid2 = Namespace("http://www.w3.org/ns/solid/terms#");
49765
+ var pim2 = Namespace("http://www.w3.org/ns/pim/space#");
49766
+ var ldp2 = Namespace("http://www.w3.org/ns/ldp#");
49767
+
49768
+ // node_modules/@solid-data-modules/rdflib-utils/dist/identifier/generate-id.js
49769
+ var import_short_unique_id2 = __toESM(require_short_unique_id(), 1);
49770
+ var uid2 = new import_short_unique_id2.default({ length: 10 });
49771
+
49772
+ // src/search/addToLabelIndex.ts
49773
+ init_esm();
49774
+ var addToLabelIndex = (thing, labelIndex) => {
49775
+ return {
49776
+ deletions: [],
49777
+ filesToCreate: [],
49778
+ insertions: [
49779
+ st2(
49780
+ namedNode2(thing.uri),
49781
+ rdfs("label"),
49782
+ lit2(thing.label()),
49783
+ namedNode2(labelIndex.uri)
49784
+ )
49785
+ ]
49786
+ };
49787
+ };
49788
+
49789
+ // src/Store.ts
49740
49790
  var Store = class {
49741
49791
  constructor(session4) {
49742
49792
  this.graph = graph2();
@@ -49820,6 +49870,10 @@ var PodOS = (() => {
49820
49870
  }
49821
49871
  );
49822
49872
  }
49873
+ async addToLabelIndex(thing, labelIndex) {
49874
+ const operation3 = addToLabelIndex(thing, labelIndex);
49875
+ await executeUpdate2(this.fetcher, this.updater, operation3);
49876
+ }
49823
49877
  };
49824
49878
 
49825
49879
  // ../node_modules/rdf-namespaces/dist/index.es.js
@@ -49836,21 +49890,21 @@ var PodOS = (() => {
49836
49890
  foaf: () => foaf,
49837
49891
  http: () => http,
49838
49892
  hydra: () => hydra,
49839
- ldp: () => ldp2,
49893
+ ldp: () => ldp3,
49840
49894
  link: () => link3,
49841
49895
  log: () => log2,
49842
49896
  meeting: () => meeting,
49843
49897
  owl: () => owl,
49844
49898
  qu: () => qu,
49845
- rdf: () => rdf4,
49846
- rdfs: () => rdfs,
49899
+ rdf: () => rdf5,
49900
+ rdfs: () => rdfs2,
49847
49901
  sched: () => sched,
49848
49902
  schema: () => schema,
49849
49903
  schema_https: () => schema_https,
49850
49904
  sec: () => sec,
49851
49905
  sioc: () => sioc,
49852
49906
  skos: () => skos,
49853
- solid: () => solid2,
49907
+ solid: () => solid3,
49854
49908
  space: () => space,
49855
49909
  tab: () => tab,
49856
49910
  tabont: () => tabont,
@@ -50203,7 +50257,7 @@ var PodOS = (() => {
50203
50257
  var DomainOf_rrule = "http://www.w3.org/2002/12/cal/ical#DomainOf_rrule";
50204
50258
  var relatedTo = "http://www.w3.org/2002/12/cal/ical#relatedTo";
50205
50259
  var url2 = "http://www.w3.org/2002/12/cal/ical#url";
50206
- var uid2 = "http://www.w3.org/2002/12/cal/ical#uid";
50260
+ var uid3 = "http://www.w3.org/2002/12/cal/ical#uid";
50207
50261
  var exdate = "http://www.w3.org/2002/12/cal/ical#exdate";
50208
50262
  var exrule = "http://www.w3.org/2002/12/cal/ical#exrule";
50209
50263
  var Value_RECUR = "http://www.w3.org/2002/12/cal/ical#Value_RECUR";
@@ -50263,7 +50317,7 @@ var PodOS = (() => {
50263
50317
  DomainOf_rrule,
50264
50318
  relatedTo,
50265
50319
  url: url2,
50266
- uid: uid2,
50320
+ uid: uid3,
50267
50321
  exdate,
50268
50322
  exrule,
50269
50323
  Value_RECUR,
@@ -52691,7 +52745,7 @@ var PodOS = (() => {
52691
52745
  var _daysSupply = "http://hl7.org/fhir/_daysSupply";
52692
52746
  var reportingVendor = "http://hl7.org/fhir/reportingVendor";
52693
52747
  var current = "http://hl7.org/fhir/current";
52694
- var uid3 = "http://hl7.org/fhir/uid";
52748
+ var uid4 = "http://hl7.org/fhir/uid";
52695
52749
  var order = "http://hl7.org/fhir/order";
52696
52750
  var priorPrescription = "http://hl7.org/fhir/priorPrescription";
52697
52751
  var distanceFromLandmark = "http://hl7.org/fhir/distanceFromLandmark";
@@ -56924,7 +56978,7 @@ var PodOS = (() => {
56924
56978
  _daysSupply,
56925
56979
  reportingVendor,
56926
56980
  current,
56927
- uid: uid3,
56981
+ uid: uid4,
56928
56982
  order,
56929
56983
  priorPrescription,
56930
56984
  distanceFromLandmark,
@@ -70085,22 +70139,22 @@ var PodOS = (() => {
70085
70139
  var foaf = foafImport;
70086
70140
  var http = httpImport;
70087
70141
  var hydra = hydraImport;
70088
- var ldp2 = ldpImport;
70142
+ var ldp3 = ldpImport;
70089
70143
  var link3 = linkImport;
70090
70144
  var log2 = logImport;
70091
70145
  var meeting = meetingImport;
70092
70146
  var owl = owlImport;
70093
70147
  var qu = quImport;
70094
70148
  var trip3 = tripImport;
70095
- var rdf4 = rdfImport;
70096
- var rdfs = rdfsImport;
70149
+ var rdf5 = rdfImport;
70150
+ var rdfs2 = rdfsImport;
70097
70151
  var sched = schedImport;
70098
70152
  var schema = schemaImport;
70099
70153
  var schema_https = schema_httpsImport;
70100
70154
  var sec = secImport;
70101
70155
  var sioc = siocImport;
70102
70156
  var skos = skosImport;
70103
- var solid2 = solidImport;
70157
+ var solid3 = solidImport;
70104
70158
  var space = spaceImport;
70105
70159
  var tab = tabImport;
70106
70160
  var tabont = tabontImport;
@@ -70274,6 +70328,14 @@ var PodOS = (() => {
70274
70328
  loadContactsModule() {
70275
70329
  return loadContactsModule(this.store);
70276
70330
  }
70331
+ /**
70332
+ * Adds a label of the given thing to the label index, so that it can be found after the search index has been rebuilt
70333
+ * @param thing - The thing to index
70334
+ * @param labelIndex - The index to update
70335
+ */
70336
+ async addToLabelIndex(thing, labelIndex) {
70337
+ await this.store.addToLabelIndex(thing, labelIndex);
70338
+ }
70277
70339
  };
70278
70340
  return __toCommonJS(index_exports);
70279
70341
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.13.1-ebe6b8e.0",
3
+ "version": "0.14.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
@@ -44,6 +44,7 @@
44
44
  "dependencies": {
45
45
  "@inrupt/solid-client-authn-browser": "^2.3.0",
46
46
  "@solid-data-modules/contacts-rdflib": "^0.7.0",
47
+ "@solid-data-modules/rdflib-utils": "^0.5.0",
47
48
  "@types/lunr": "^2.3.7",
48
49
  "buffer": "^6.0.3",
49
50
  "lunr": "^2.3.9",
package/types/Store.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Fetcher, IndexedFormula, UpdateManager } from "rdflib";
2
2
  import { PodOsSession } from "./authentication";
3
3
  import { Thing } from "./thing";
4
+ import { LabelIndex } from "./search";
4
5
  /**
5
6
  * The store contains all data that is known locally.
6
7
  * It can be used to fetch additional data from the web and also update data and sync it back to editable resources.
@@ -33,4 +34,5 @@ export declare class Store {
33
34
  */
34
35
  addPropertyValue(thing: Thing, property: string, value: string): Promise<void>;
35
36
  addNewThing(uri: string, name: string, type: string): Promise<void>;
37
+ addToLabelIndex(thing: Thing, labelIndex: LabelIndex): Promise<void>;
36
38
  }
package/types/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { BehaviorSubject } from "rxjs";
3
3
  import { SessionInfo } from "./authentication";
4
4
  import { SolidFile } from "./files";
5
5
  import { WebIdProfile } from "./profile";
6
- import { SearchIndex } from "./search";
6
+ import { LabelIndex, SearchIndex } from "./search";
7
7
  import { Store } from "./Store";
8
8
  import { Term } from "./terms";
9
9
  import { Thing } from "./thing";
@@ -57,4 +57,10 @@ export declare class PodOS {
57
57
  logout(): Promise<void>;
58
58
  login(oidcIssuer?: string): Promise<void>;
59
59
  loadContactsModule(): Promise<ContactsModule>;
60
+ /**
61
+ * Adds a label of the given thing to the label index, so that it can be found after the search index has been rebuilt
62
+ * @param thing - The thing to index
63
+ * @param labelIndex - The index to update
64
+ */
65
+ addToLabelIndex(thing: Thing, labelIndex: LabelIndex): Promise<void>;
60
66
  }
@@ -0,0 +1 @@
1
+ export declare const rdfs: (ln: string) => import("rdflib/lib/tf-types").NamedNode;
@@ -16,4 +16,5 @@ export declare class LabelIndex extends RdfDocument {
16
16
  uri: string;
17
17
  label: string;
18
18
  }[];
19
+ contains(uri: string): boolean;
19
20
  }
@@ -0,0 +1,4 @@
1
+ import { UpdateOperation } from "@solid-data-modules/rdflib-utils";
2
+ import { LabelIndex } from "./LabelIndex";
3
+ import { Thing } from "../thing";
4
+ export declare const addToLabelIndex: (thing: Thing, labelIndex: LabelIndex) => UpdateOperation;
@@ -0,0 +1 @@
1
+ export {};