@pod-os/core 0.12.1-fef97c9.0 → 0.13.1-5f6551f.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/index.js CHANGED
@@ -10177,125 +10177,118 @@ var decode = (input2) => {
10177
10177
 
10178
10178
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/util/errors.js
10179
10179
  var JOSEError = class extends Error {
10180
- static get code() {
10181
- return "ERR_JOSE_GENERIC";
10182
- }
10183
- constructor(message4) {
10184
- super(message4);
10180
+ constructor(message4, options) {
10181
+ super(message4, options);
10185
10182
  this.code = "ERR_JOSE_GENERIC";
10186
10183
  this.name = this.constructor.name;
10187
10184
  Error.captureStackTrace?.(this, this.constructor);
10188
10185
  }
10189
10186
  };
10187
+ JOSEError.code = "ERR_JOSE_GENERIC";
10190
10188
  var JWTClaimValidationFailed = class extends JOSEError {
10191
- static get code() {
10192
- return "ERR_JWT_CLAIM_VALIDATION_FAILED";
10193
- }
10194
10189
  constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
10195
- super(message4);
10190
+ super(message4, { cause: { claim: claim2, reason: reason2, payload: payload4 } });
10196
10191
  this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
10197
10192
  this.claim = claim2;
10198
10193
  this.reason = reason2;
10199
10194
  this.payload = payload4;
10200
10195
  }
10201
10196
  };
10197
+ JWTClaimValidationFailed.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
10202
10198
  var JWTExpired = class extends JOSEError {
10203
- static get code() {
10204
- return "ERR_JWT_EXPIRED";
10205
- }
10206
10199
  constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
10207
- super(message4);
10200
+ super(message4, { cause: { claim: claim2, reason: reason2, payload: payload4 } });
10208
10201
  this.code = "ERR_JWT_EXPIRED";
10209
10202
  this.claim = claim2;
10210
10203
  this.reason = reason2;
10211
10204
  this.payload = payload4;
10212
10205
  }
10213
10206
  };
10207
+ JWTExpired.code = "ERR_JWT_EXPIRED";
10214
10208
  var JOSEAlgNotAllowed = class extends JOSEError {
10215
10209
  constructor() {
10216
10210
  super(...arguments);
10217
10211
  this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
10218
10212
  }
10219
- static get code() {
10220
- return "ERR_JOSE_ALG_NOT_ALLOWED";
10221
- }
10222
10213
  };
10214
+ JOSEAlgNotAllowed.code = "ERR_JOSE_ALG_NOT_ALLOWED";
10223
10215
  var JOSENotSupported = class extends JOSEError {
10224
10216
  constructor() {
10225
10217
  super(...arguments);
10226
10218
  this.code = "ERR_JOSE_NOT_SUPPORTED";
10227
10219
  }
10228
- static get code() {
10229
- return "ERR_JOSE_NOT_SUPPORTED";
10220
+ };
10221
+ JOSENotSupported.code = "ERR_JOSE_NOT_SUPPORTED";
10222
+ var JWEDecryptionFailed = class extends JOSEError {
10223
+ constructor(message4 = "decryption operation failed", options) {
10224
+ super(message4, options);
10225
+ this.code = "ERR_JWE_DECRYPTION_FAILED";
10230
10226
  }
10231
10227
  };
10228
+ JWEDecryptionFailed.code = "ERR_JWE_DECRYPTION_FAILED";
10229
+ var JWEInvalid = class extends JOSEError {
10230
+ constructor() {
10231
+ super(...arguments);
10232
+ this.code = "ERR_JWE_INVALID";
10233
+ }
10234
+ };
10235
+ JWEInvalid.code = "ERR_JWE_INVALID";
10232
10236
  var JWSInvalid = class extends JOSEError {
10233
10237
  constructor() {
10234
10238
  super(...arguments);
10235
10239
  this.code = "ERR_JWS_INVALID";
10236
10240
  }
10237
- static get code() {
10238
- return "ERR_JWS_INVALID";
10239
- }
10240
10241
  };
10242
+ JWSInvalid.code = "ERR_JWS_INVALID";
10241
10243
  var JWTInvalid = class extends JOSEError {
10242
10244
  constructor() {
10243
10245
  super(...arguments);
10244
10246
  this.code = "ERR_JWT_INVALID";
10245
10247
  }
10246
- static get code() {
10247
- return "ERR_JWT_INVALID";
10248
+ };
10249
+ JWTInvalid.code = "ERR_JWT_INVALID";
10250
+ var JWKInvalid = class extends JOSEError {
10251
+ constructor() {
10252
+ super(...arguments);
10253
+ this.code = "ERR_JWK_INVALID";
10248
10254
  }
10249
10255
  };
10256
+ JWKInvalid.code = "ERR_JWK_INVALID";
10250
10257
  var JWKSInvalid = class extends JOSEError {
10251
10258
  constructor() {
10252
10259
  super(...arguments);
10253
10260
  this.code = "ERR_JWKS_INVALID";
10254
10261
  }
10255
- static get code() {
10256
- return "ERR_JWKS_INVALID";
10257
- }
10258
10262
  };
10263
+ JWKSInvalid.code = "ERR_JWKS_INVALID";
10259
10264
  var JWKSNoMatchingKey = class extends JOSEError {
10260
- constructor() {
10261
- super(...arguments);
10265
+ constructor(message4 = "no applicable key found in the JSON Web Key Set", options) {
10266
+ super(message4, options);
10262
10267
  this.code = "ERR_JWKS_NO_MATCHING_KEY";
10263
- this.message = "no applicable key found in the JSON Web Key Set";
10264
- }
10265
- static get code() {
10266
- return "ERR_JWKS_NO_MATCHING_KEY";
10267
10268
  }
10268
10269
  };
10270
+ JWKSNoMatchingKey.code = "ERR_JWKS_NO_MATCHING_KEY";
10269
10271
  var JWKSMultipleMatchingKeys = class extends JOSEError {
10270
- constructor() {
10271
- super(...arguments);
10272
+ constructor(message4 = "multiple matching keys found in the JSON Web Key Set", options) {
10273
+ super(message4, options);
10272
10274
  this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
10273
- this.message = "multiple matching keys found in the JSON Web Key Set";
10274
- }
10275
- static get code() {
10276
- return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
10277
10275
  }
10278
10276
  };
10277
+ JWKSMultipleMatchingKeys.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
10279
10278
  var JWKSTimeout = class extends JOSEError {
10280
- constructor() {
10281
- super(...arguments);
10279
+ constructor(message4 = "request timed out", options) {
10280
+ super(message4, options);
10282
10281
  this.code = "ERR_JWKS_TIMEOUT";
10283
- this.message = "request timed out";
10284
- }
10285
- static get code() {
10286
- return "ERR_JWKS_TIMEOUT";
10287
10282
  }
10288
10283
  };
10284
+ JWKSTimeout.code = "ERR_JWKS_TIMEOUT";
10289
10285
  var JWSSignatureVerificationFailed = class extends JOSEError {
10290
- constructor() {
10291
- super(...arguments);
10286
+ constructor(message4 = "signature verification failed", options) {
10287
+ super(message4, options);
10292
10288
  this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
10293
- this.message = "signature verification failed";
10294
- }
10295
- static get code() {
10296
- return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
10297
10289
  }
10298
10290
  };
10291
+ JWSSignatureVerificationFailed.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
10299
10292
 
10300
10293
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/crypto_key.js
10301
10294
  function unusable(name7, prop = "algorithm.name") {
@@ -11525,7 +11518,7 @@ function isCloudflareWorkers() {
11525
11518
  var USER_AGENT;
11526
11519
  if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
11527
11520
  const NAME = "jose";
11528
- const VERSION = "v5.9.3";
11521
+ const VERSION = "v5.9.6";
11529
11522
  USER_AGENT = `${NAME}/${VERSION}`;
11530
11523
  }
11531
11524
  var jwksCache = Symbol();
@@ -11746,10 +11739,9 @@ async function generateKeyPair2(alg, options) {
11746
11739
 
11747
11740
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/stringify.js
11748
11741
  var byteToHex = [];
11749
- for (i = 0; i < 256; ++i) {
11742
+ for (let i = 0; i < 256; ++i) {
11750
11743
  byteToHex.push((i + 256).toString(16).slice(1));
11751
11744
  }
11752
- var i;
11753
11745
  function unsafeStringify(arr, offset3 = 0) {
11754
11746
  return (byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]]).toLowerCase();
11755
11747
  }
@@ -11759,19 +11751,17 @@ var getRandomValues;
11759
11751
  var rnds8 = new Uint8Array(16);
11760
11752
  function rng() {
11761
11753
  if (!getRandomValues) {
11762
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
11763
- if (!getRandomValues) {
11754
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
11764
11755
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
11765
11756
  }
11757
+ getRandomValues = crypto.getRandomValues.bind(crypto);
11766
11758
  }
11767
11759
  return getRandomValues(rnds8);
11768
11760
  }
11769
11761
 
11770
11762
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/native.js
11771
11763
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
11772
- var native_default = {
11773
- randomUUID
11774
- };
11764
+ var native_default = { randomUUID };
11775
11765
 
11776
11766
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/v4.js
11777
11767
  function v4(options, buf, offset3) {
@@ -11779,12 +11769,12 @@ function v4(options, buf, offset3) {
11779
11769
  return native_default.randomUUID();
11780
11770
  }
11781
11771
  options = options || {};
11782
- var rnds = options.random || (options.rng || rng)();
11772
+ const rnds = options.random || (options.rng || rng)();
11783
11773
  rnds[6] = rnds[6] & 15 | 64;
11784
11774
  rnds[8] = rnds[8] & 63 | 128;
11785
11775
  if (buf) {
11786
11776
  offset3 = offset3 || 0;
11787
- for (var i = 0; i < 16; ++i) {
11777
+ for (let i = 0; i < 16; ++i) {
11788
11778
  buf[offset3 + i] = rnds[i];
11789
11779
  }
11790
11780
  return buf;
@@ -12467,10 +12457,9 @@ async function buildAuthenticatedFetch(accessToken, options) {
12467
12457
 
12468
12458
  // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/stringify.js
12469
12459
  var byteToHex2 = [];
12470
- for (i = 0; i < 256; ++i) {
12460
+ for (let i = 0; i < 256; ++i) {
12471
12461
  byteToHex2.push((i + 256).toString(16).slice(1));
12472
12462
  }
12473
- var i;
12474
12463
  function unsafeStringify2(arr, offset3 = 0) {
12475
12464
  return (byteToHex2[arr[offset3 + 0]] + byteToHex2[arr[offset3 + 1]] + byteToHex2[arr[offset3 + 2]] + byteToHex2[arr[offset3 + 3]] + "-" + byteToHex2[arr[offset3 + 4]] + byteToHex2[arr[offset3 + 5]] + "-" + byteToHex2[arr[offset3 + 6]] + byteToHex2[arr[offset3 + 7]] + "-" + byteToHex2[arr[offset3 + 8]] + byteToHex2[arr[offset3 + 9]] + "-" + byteToHex2[arr[offset3 + 10]] + byteToHex2[arr[offset3 + 11]] + byteToHex2[arr[offset3 + 12]] + byteToHex2[arr[offset3 + 13]] + byteToHex2[arr[offset3 + 14]] + byteToHex2[arr[offset3 + 15]]).toLowerCase();
12476
12465
  }
@@ -12480,19 +12469,17 @@ var getRandomValues2;
12480
12469
  var rnds82 = new Uint8Array(16);
12481
12470
  function rng2() {
12482
12471
  if (!getRandomValues2) {
12483
- getRandomValues2 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
12484
- if (!getRandomValues2) {
12472
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
12485
12473
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
12486
12474
  }
12475
+ getRandomValues2 = crypto.getRandomValues.bind(crypto);
12487
12476
  }
12488
12477
  return getRandomValues2(rnds82);
12489
12478
  }
12490
12479
 
12491
12480
  // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/native.js
12492
12481
  var randomUUID2 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
12493
- var native_default2 = {
12494
- randomUUID: randomUUID2
12495
- };
12482
+ var native_default2 = { randomUUID: randomUUID2 };
12496
12483
 
12497
12484
  // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/v4.js
12498
12485
  function v42(options, buf, offset3) {
@@ -12500,12 +12487,12 @@ function v42(options, buf, offset3) {
12500
12487
  return native_default2.randomUUID();
12501
12488
  }
12502
12489
  options = options || {};
12503
- var rnds = options.random || (options.rng || rng2)();
12490
+ const rnds = options.random || (options.rng || rng2)();
12504
12491
  rnds[6] = rnds[6] & 15 | 64;
12505
12492
  rnds[8] = rnds[8] & 63 | 128;
12506
12493
  if (buf) {
12507
12494
  offset3 = offset3 || 0;
12508
- for (var i = 0; i < 16; ++i) {
12495
+ for (let i = 0; i < 16; ++i) {
12509
12496
  buf[offset3 + i] = rnds[i];
12510
12497
  }
12511
12498
  return buf;
@@ -13642,6 +13629,30 @@ function labelForType(typeUri) {
13642
13629
  }
13643
13630
  }
13644
13631
 
13632
+ // src/thing/labelFromUri.ts
13633
+ function labelFromUri(uri6) {
13634
+ const url7 = new URL(uri6);
13635
+ if (isTooGeneric(url7.hash)) {
13636
+ return (getFilename(url7) || url7.host + url7.pathname) + url7.hash;
13637
+ }
13638
+ return labelFromFragment(url7.hash) || getFilename(url7) || url7.host;
13639
+ }
13640
+ function labelFromFragment(fragment) {
13641
+ return fragment ? fragment.split("#")[1] : null;
13642
+ }
13643
+ function isTooGeneric(fragment) {
13644
+ const genericFragments = ["#it", "#this", "#me", "#i"];
13645
+ return genericFragments.includes(fragment);
13646
+ }
13647
+ function getFilename(url7) {
13648
+ if (url7.pathname.endsWith("/")) {
13649
+ const containerName = url7.pathname.split("/").at(-2);
13650
+ return containerName ? containerName + "/" : null;
13651
+ } else {
13652
+ return url7.pathname.split("/").pop();
13653
+ }
13654
+ }
13655
+
13645
13656
  // src/thing/Thing.ts
13646
13657
  var Thing = class {
13647
13658
  constructor(uri6, store, editable = false) {
@@ -13663,13 +13674,17 @@ var Thing = class {
13663
13674
  "http://schema.org/caption",
13664
13675
  "https://schema.org/caption"
13665
13676
  );
13666
- return value6 ?? this.uri;
13677
+ if (value6) {
13678
+ return value6;
13679
+ }
13680
+ return labelFromUri(this.uri);
13667
13681
  }
13668
13682
  literals() {
13669
13683
  const statements = this.store.statementsMatching(namedNode(this.uri));
13670
13684
  const values = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
13671
13685
  return Object.keys(values).map((predicate2) => ({
13672
13686
  predicate: predicate2,
13687
+ label: labelFromUri(predicate2),
13673
13688
  values: values[predicate2]
13674
13689
  }));
13675
13690
  }
@@ -13678,6 +13693,7 @@ var Thing = class {
13678
13693
  const values = statements.filter((it) => isNamedNode(it.object) && !isRdfType(it.predicate)).reduce(accumulateValues, {});
13679
13694
  return Object.keys(values).map((predicate2) => ({
13680
13695
  predicate: predicate2,
13696
+ label: labelFromUri(predicate2),
13681
13697
  uris: values[predicate2]
13682
13698
  }));
13683
13699
  }
@@ -13690,6 +13706,7 @@ var Thing = class {
13690
13706
  const values = statements.reduce(accumulateSubjects, {});
13691
13707
  return Object.keys(values).map((predicate2) => ({
13692
13708
  predicate: predicate2,
13709
+ label: labelFromUri(predicate2),
13693
13710
  uris: values[predicate2]
13694
13711
  }));
13695
13712
  }
@@ -34457,7 +34474,8 @@ export {
34457
34474
  RdfDocument,
34458
34475
  SearchIndex,
34459
34476
  Thing,
34460
- WebIdProfile
34477
+ WebIdProfile,
34478
+ labelFromUri
34461
34479
  };
34462
34480
  /*! Bundled license information:
34463
34481
 
package/lib/index.js CHANGED
@@ -44280,7 +44280,8 @@ var PodOS = (() => {
44280
44280
  RdfDocument: () => RdfDocument,
44281
44281
  SearchIndex: () => SearchIndex,
44282
44282
  Thing: () => Thing,
44283
- WebIdProfile: () => WebIdProfile
44283
+ WebIdProfile: () => WebIdProfile,
44284
+ labelFromUri: () => labelFromUri
44284
44285
  });
44285
44286
 
44286
44287
  // ../node_modules/tslib/tslib.es6.mjs
@@ -45975,125 +45976,118 @@ var PodOS = (() => {
45975
45976
 
45976
45977
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/util/errors.js
45977
45978
  var JOSEError = class extends Error {
45978
- static get code() {
45979
- return "ERR_JOSE_GENERIC";
45980
- }
45981
- constructor(message4) {
45982
- super(message4);
45979
+ constructor(message4, options) {
45980
+ super(message4, options);
45983
45981
  this.code = "ERR_JOSE_GENERIC";
45984
45982
  this.name = this.constructor.name;
45985
45983
  Error.captureStackTrace?.(this, this.constructor);
45986
45984
  }
45987
45985
  };
45986
+ JOSEError.code = "ERR_JOSE_GENERIC";
45988
45987
  var JWTClaimValidationFailed = class extends JOSEError {
45989
- static get code() {
45990
- return "ERR_JWT_CLAIM_VALIDATION_FAILED";
45991
- }
45992
45988
  constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
45993
- super(message4);
45989
+ super(message4, { cause: { claim: claim2, reason: reason2, payload: payload4 } });
45994
45990
  this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
45995
45991
  this.claim = claim2;
45996
45992
  this.reason = reason2;
45997
45993
  this.payload = payload4;
45998
45994
  }
45999
45995
  };
45996
+ JWTClaimValidationFailed.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
46000
45997
  var JWTExpired = class extends JOSEError {
46001
- static get code() {
46002
- return "ERR_JWT_EXPIRED";
46003
- }
46004
45998
  constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
46005
- super(message4);
45999
+ super(message4, { cause: { claim: claim2, reason: reason2, payload: payload4 } });
46006
46000
  this.code = "ERR_JWT_EXPIRED";
46007
46001
  this.claim = claim2;
46008
46002
  this.reason = reason2;
46009
46003
  this.payload = payload4;
46010
46004
  }
46011
46005
  };
46006
+ JWTExpired.code = "ERR_JWT_EXPIRED";
46012
46007
  var JOSEAlgNotAllowed = class extends JOSEError {
46013
46008
  constructor() {
46014
46009
  super(...arguments);
46015
46010
  this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
46016
46011
  }
46017
- static get code() {
46018
- return "ERR_JOSE_ALG_NOT_ALLOWED";
46019
- }
46020
46012
  };
46013
+ JOSEAlgNotAllowed.code = "ERR_JOSE_ALG_NOT_ALLOWED";
46021
46014
  var JOSENotSupported = class extends JOSEError {
46022
46015
  constructor() {
46023
46016
  super(...arguments);
46024
46017
  this.code = "ERR_JOSE_NOT_SUPPORTED";
46025
46018
  }
46026
- static get code() {
46027
- return "ERR_JOSE_NOT_SUPPORTED";
46019
+ };
46020
+ JOSENotSupported.code = "ERR_JOSE_NOT_SUPPORTED";
46021
+ var JWEDecryptionFailed = class extends JOSEError {
46022
+ constructor(message4 = "decryption operation failed", options) {
46023
+ super(message4, options);
46024
+ this.code = "ERR_JWE_DECRYPTION_FAILED";
46028
46025
  }
46029
46026
  };
46027
+ JWEDecryptionFailed.code = "ERR_JWE_DECRYPTION_FAILED";
46028
+ var JWEInvalid = class extends JOSEError {
46029
+ constructor() {
46030
+ super(...arguments);
46031
+ this.code = "ERR_JWE_INVALID";
46032
+ }
46033
+ };
46034
+ JWEInvalid.code = "ERR_JWE_INVALID";
46030
46035
  var JWSInvalid = class extends JOSEError {
46031
46036
  constructor() {
46032
46037
  super(...arguments);
46033
46038
  this.code = "ERR_JWS_INVALID";
46034
46039
  }
46035
- static get code() {
46036
- return "ERR_JWS_INVALID";
46037
- }
46038
46040
  };
46041
+ JWSInvalid.code = "ERR_JWS_INVALID";
46039
46042
  var JWTInvalid = class extends JOSEError {
46040
46043
  constructor() {
46041
46044
  super(...arguments);
46042
46045
  this.code = "ERR_JWT_INVALID";
46043
46046
  }
46044
- static get code() {
46045
- return "ERR_JWT_INVALID";
46047
+ };
46048
+ JWTInvalid.code = "ERR_JWT_INVALID";
46049
+ var JWKInvalid = class extends JOSEError {
46050
+ constructor() {
46051
+ super(...arguments);
46052
+ this.code = "ERR_JWK_INVALID";
46046
46053
  }
46047
46054
  };
46055
+ JWKInvalid.code = "ERR_JWK_INVALID";
46048
46056
  var JWKSInvalid = class extends JOSEError {
46049
46057
  constructor() {
46050
46058
  super(...arguments);
46051
46059
  this.code = "ERR_JWKS_INVALID";
46052
46060
  }
46053
- static get code() {
46054
- return "ERR_JWKS_INVALID";
46055
- }
46056
46061
  };
46062
+ JWKSInvalid.code = "ERR_JWKS_INVALID";
46057
46063
  var JWKSNoMatchingKey = class extends JOSEError {
46058
- constructor() {
46059
- super(...arguments);
46064
+ constructor(message4 = "no applicable key found in the JSON Web Key Set", options) {
46065
+ super(message4, options);
46060
46066
  this.code = "ERR_JWKS_NO_MATCHING_KEY";
46061
- this.message = "no applicable key found in the JSON Web Key Set";
46062
- }
46063
- static get code() {
46064
- return "ERR_JWKS_NO_MATCHING_KEY";
46065
46067
  }
46066
46068
  };
46069
+ JWKSNoMatchingKey.code = "ERR_JWKS_NO_MATCHING_KEY";
46067
46070
  var JWKSMultipleMatchingKeys = class extends JOSEError {
46068
- constructor() {
46069
- super(...arguments);
46071
+ constructor(message4 = "multiple matching keys found in the JSON Web Key Set", options) {
46072
+ super(message4, options);
46070
46073
  this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
46071
- this.message = "multiple matching keys found in the JSON Web Key Set";
46072
- }
46073
- static get code() {
46074
- return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
46075
46074
  }
46076
46075
  };
46076
+ JWKSMultipleMatchingKeys.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
46077
46077
  var JWKSTimeout = class extends JOSEError {
46078
- constructor() {
46079
- super(...arguments);
46078
+ constructor(message4 = "request timed out", options) {
46079
+ super(message4, options);
46080
46080
  this.code = "ERR_JWKS_TIMEOUT";
46081
- this.message = "request timed out";
46082
- }
46083
- static get code() {
46084
- return "ERR_JWKS_TIMEOUT";
46085
46081
  }
46086
46082
  };
46083
+ JWKSTimeout.code = "ERR_JWKS_TIMEOUT";
46087
46084
  var JWSSignatureVerificationFailed = class extends JOSEError {
46088
- constructor() {
46089
- super(...arguments);
46085
+ constructor(message4 = "signature verification failed", options) {
46086
+ super(message4, options);
46090
46087
  this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
46091
- this.message = "signature verification failed";
46092
- }
46093
- static get code() {
46094
- return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
46095
46088
  }
46096
46089
  };
46090
+ JWSSignatureVerificationFailed.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
46097
46091
 
46098
46092
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/crypto_key.js
46099
46093
  function unusable(name7, prop = "algorithm.name") {
@@ -47323,7 +47317,7 @@ var PodOS = (() => {
47323
47317
  var USER_AGENT;
47324
47318
  if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
47325
47319
  const NAME = "jose";
47326
- const VERSION = "v5.9.3";
47320
+ const VERSION = "v5.9.6";
47327
47321
  USER_AGENT = `${NAME}/${VERSION}`;
47328
47322
  }
47329
47323
  var jwksCache = Symbol();
@@ -47544,10 +47538,9 @@ var PodOS = (() => {
47544
47538
 
47545
47539
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/stringify.js
47546
47540
  var byteToHex = [];
47547
- for (i = 0; i < 256; ++i) {
47541
+ for (let i = 0; i < 256; ++i) {
47548
47542
  byteToHex.push((i + 256).toString(16).slice(1));
47549
47543
  }
47550
- var i;
47551
47544
  function unsafeStringify(arr, offset3 = 0) {
47552
47545
  return (byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]]).toLowerCase();
47553
47546
  }
@@ -47557,19 +47550,17 @@ var PodOS = (() => {
47557
47550
  var rnds8 = new Uint8Array(16);
47558
47551
  function rng() {
47559
47552
  if (!getRandomValues) {
47560
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
47561
- if (!getRandomValues) {
47553
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
47562
47554
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
47563
47555
  }
47556
+ getRandomValues = crypto.getRandomValues.bind(crypto);
47564
47557
  }
47565
47558
  return getRandomValues(rnds8);
47566
47559
  }
47567
47560
 
47568
47561
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/native.js
47569
47562
  var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
47570
- var native_default = {
47571
- randomUUID
47572
- };
47563
+ var native_default = { randomUUID };
47573
47564
 
47574
47565
  // ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/v4.js
47575
47566
  function v4(options, buf, offset3) {
@@ -47577,12 +47568,12 @@ var PodOS = (() => {
47577
47568
  return native_default.randomUUID();
47578
47569
  }
47579
47570
  options = options || {};
47580
- var rnds = options.random || (options.rng || rng)();
47571
+ const rnds = options.random || (options.rng || rng)();
47581
47572
  rnds[6] = rnds[6] & 15 | 64;
47582
47573
  rnds[8] = rnds[8] & 63 | 128;
47583
47574
  if (buf) {
47584
47575
  offset3 = offset3 || 0;
47585
- for (var i = 0; i < 16; ++i) {
47576
+ for (let i = 0; i < 16; ++i) {
47586
47577
  buf[offset3 + i] = rnds[i];
47587
47578
  }
47588
47579
  return buf;
@@ -48265,10 +48256,9 @@ var PodOS = (() => {
48265
48256
 
48266
48257
  // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/stringify.js
48267
48258
  var byteToHex2 = [];
48268
- for (i = 0; i < 256; ++i) {
48259
+ for (let i = 0; i < 256; ++i) {
48269
48260
  byteToHex2.push((i + 256).toString(16).slice(1));
48270
48261
  }
48271
- var i;
48272
48262
  function unsafeStringify2(arr, offset3 = 0) {
48273
48263
  return (byteToHex2[arr[offset3 + 0]] + byteToHex2[arr[offset3 + 1]] + byteToHex2[arr[offset3 + 2]] + byteToHex2[arr[offset3 + 3]] + "-" + byteToHex2[arr[offset3 + 4]] + byteToHex2[arr[offset3 + 5]] + "-" + byteToHex2[arr[offset3 + 6]] + byteToHex2[arr[offset3 + 7]] + "-" + byteToHex2[arr[offset3 + 8]] + byteToHex2[arr[offset3 + 9]] + "-" + byteToHex2[arr[offset3 + 10]] + byteToHex2[arr[offset3 + 11]] + byteToHex2[arr[offset3 + 12]] + byteToHex2[arr[offset3 + 13]] + byteToHex2[arr[offset3 + 14]] + byteToHex2[arr[offset3 + 15]]).toLowerCase();
48274
48264
  }
@@ -48278,19 +48268,17 @@ var PodOS = (() => {
48278
48268
  var rnds82 = new Uint8Array(16);
48279
48269
  function rng2() {
48280
48270
  if (!getRandomValues2) {
48281
- getRandomValues2 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
48282
- if (!getRandomValues2) {
48271
+ if (typeof crypto === "undefined" || !crypto.getRandomValues) {
48283
48272
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
48284
48273
  }
48274
+ getRandomValues2 = crypto.getRandomValues.bind(crypto);
48285
48275
  }
48286
48276
  return getRandomValues2(rnds82);
48287
48277
  }
48288
48278
 
48289
48279
  // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/native.js
48290
48280
  var randomUUID2 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
48291
- var native_default2 = {
48292
- randomUUID: randomUUID2
48293
- };
48281
+ var native_default2 = { randomUUID: randomUUID2 };
48294
48282
 
48295
48283
  // ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/v4.js
48296
48284
  function v42(options, buf, offset3) {
@@ -48298,12 +48286,12 @@ var PodOS = (() => {
48298
48286
  return native_default2.randomUUID();
48299
48287
  }
48300
48288
  options = options || {};
48301
- var rnds = options.random || (options.rng || rng2)();
48289
+ const rnds = options.random || (options.rng || rng2)();
48302
48290
  rnds[6] = rnds[6] & 15 | 64;
48303
48291
  rnds[8] = rnds[8] & 63 | 128;
48304
48292
  if (buf) {
48305
48293
  offset3 = offset3 || 0;
48306
- for (var i = 0; i < 16; ++i) {
48294
+ for (let i = 0; i < 16; ++i) {
48307
48295
  buf[offset3 + i] = rnds[i];
48308
48296
  }
48309
48297
  return buf;
@@ -49447,6 +49435,30 @@ var PodOS = (() => {
49447
49435
  }
49448
49436
  }
49449
49437
 
49438
+ // src/thing/labelFromUri.ts
49439
+ function labelFromUri(uri6) {
49440
+ const url7 = new URL(uri6);
49441
+ if (isTooGeneric(url7.hash)) {
49442
+ return (getFilename(url7) || url7.host + url7.pathname) + url7.hash;
49443
+ }
49444
+ return labelFromFragment(url7.hash) || getFilename(url7) || url7.host;
49445
+ }
49446
+ function labelFromFragment(fragment) {
49447
+ return fragment ? fragment.split("#")[1] : null;
49448
+ }
49449
+ function isTooGeneric(fragment) {
49450
+ const genericFragments = ["#it", "#this", "#me", "#i"];
49451
+ return genericFragments.includes(fragment);
49452
+ }
49453
+ function getFilename(url7) {
49454
+ if (url7.pathname.endsWith("/")) {
49455
+ const containerName = url7.pathname.split("/").at(-2);
49456
+ return containerName ? containerName + "/" : null;
49457
+ } else {
49458
+ return url7.pathname.split("/").pop();
49459
+ }
49460
+ }
49461
+
49450
49462
  // src/thing/Thing.ts
49451
49463
  var Thing = class {
49452
49464
  constructor(uri6, store, editable = false) {
@@ -49468,13 +49480,17 @@ var PodOS = (() => {
49468
49480
  "http://schema.org/caption",
49469
49481
  "https://schema.org/caption"
49470
49482
  );
49471
- return value6 ?? this.uri;
49483
+ if (value6) {
49484
+ return value6;
49485
+ }
49486
+ return labelFromUri(this.uri);
49472
49487
  }
49473
49488
  literals() {
49474
49489
  const statements = this.store.statementsMatching(namedNode2(this.uri));
49475
49490
  const values = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
49476
49491
  return Object.keys(values).map((predicate2) => ({
49477
49492
  predicate: predicate2,
49493
+ label: labelFromUri(predicate2),
49478
49494
  values: values[predicate2]
49479
49495
  }));
49480
49496
  }
@@ -49483,6 +49499,7 @@ var PodOS = (() => {
49483
49499
  const values = statements.filter((it) => isNamedNode(it.object) && !isRdfType(it.predicate)).reduce(accumulateValues, {});
49484
49500
  return Object.keys(values).map((predicate2) => ({
49485
49501
  predicate: predicate2,
49502
+ label: labelFromUri(predicate2),
49486
49503
  uris: values[predicate2]
49487
49504
  }));
49488
49505
  }
@@ -49495,6 +49512,7 @@ var PodOS = (() => {
49495
49512
  const values = statements.reduce(accumulateSubjects, {});
49496
49513
  return Object.keys(values).map((predicate2) => ({
49497
49514
  predicate: predicate2,
49515
+ label: labelFromUri(predicate2),
49498
49516
  uris: values[predicate2]
49499
49517
  }));
49500
49518
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pod-os/core",
3
- "version": "0.12.1-fef97c9.0",
3
+ "version": "0.13.1-5f6551f.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./types/index.d.ts",
6
6
  "files": [
@@ -24,25 +24,25 @@
24
24
  "author": "Angelo Veltens",
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@babel/preset-env": "^7.25.4",
28
- "@babel/preset-typescript": "^7.24.7",
29
- "@eslint/js": "^9.11.1",
30
- "@types/jest": "^29.5.13",
27
+ "@babel/preset-env": "^7.26.0",
28
+ "@babel/preset-typescript": "^7.26.0",
29
+ "@eslint/js": "^9.17.0",
30
+ "@types/jest": "^29.5.14",
31
31
  "@types/jest-when": "^3.5.5",
32
- "@types/sparqljs": "^3.1.11",
32
+ "@types/sparqljs": "^3.1.12",
33
33
  "esbuild": "^0.24.0",
34
- "eslint": "^9.11.1",
34
+ "eslint": "^9.17.0",
35
35
  "jest": "^29.7.0",
36
- "jest-when": "^3.6.0",
37
- "prettier": "^3.3.3",
36
+ "jest-when": "^3.7.0",
37
+ "prettier": "^3.4.2",
38
38
  "rdf-namespaces": "^1.12.0",
39
39
  "rimraf": "^6.0.1",
40
40
  "sparqljs": "^3.7.3",
41
- "typescript": "5.5.4",
41
+ "typescript": "5.7.2",
42
42
  "typescript-eslint": "^7.18.0"
43
43
  },
44
44
  "dependencies": {
45
- "@inrupt/solid-client-authn-browser": "^2.2.6",
45
+ "@inrupt/solid-client-authn-browser": "^2.3.0",
46
46
  "@solid-data-modules/contacts-rdflib": "^0.7.0",
47
47
  "@types/lunr": "^2.3.7",
48
48
  "buffer": "^6.0.3",
@@ -1,10 +1,12 @@
1
1
  import { IndexedFormula } from "rdflib";
2
2
  export interface Literal {
3
3
  predicate: string;
4
+ label: string;
4
5
  values: string[];
5
6
  }
6
7
  export interface Relation {
7
8
  predicate: string;
9
+ label: string;
8
10
  uris: string[];
9
11
  }
10
12
  export interface RdfType {
@@ -1 +1,2 @@
1
1
  export * from "./Thing";
2
+ export { labelFromUri } from "./labelFromUri";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generates a short human-readable label for a given URI
3
+ * @param uri
4
+ */
5
+ export declare function labelFromUri(uri: string): string;
@@ -0,0 +1 @@
1
+ export {};