@pod-os/core 0.30.0-rc.fcadbb6.0 → 0.30.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 +137 -32
- package/lib/index.js +137 -32
- package/package.json +3 -3
- package/types/thing/Thing.d.ts +16 -0
package/dist/index.js
CHANGED
|
@@ -13785,8 +13785,8 @@ function __generator(thisArg, body) {
|
|
|
13785
13785
|
var _ = { label: 0, sent: function() {
|
|
13786
13786
|
if (t[0] & 1) throw t[1];
|
|
13787
13787
|
return t[1];
|
|
13788
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
13789
|
-
return g =
|
|
13788
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13789
|
+
return g.next = verb2(0), g["throw"] = verb2(1), g["return"] = verb2(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
13790
13790
|
return this;
|
|
13791
13791
|
}), g;
|
|
13792
13792
|
function verb2(n2) {
|
|
@@ -13893,16 +13893,24 @@ function __await(v2) {
|
|
|
13893
13893
|
function __asyncGenerator(thisArg, _arguments, generator3) {
|
|
13894
13894
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13895
13895
|
var g = generator3.apply(thisArg, _arguments || []), i, q = [];
|
|
13896
|
-
return i =
|
|
13896
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb2("next"), verb2("throw"), verb2("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
13897
13897
|
return this;
|
|
13898
13898
|
}, i;
|
|
13899
|
-
function
|
|
13900
|
-
|
|
13901
|
-
return
|
|
13902
|
-
q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
|
|
13903
|
-
});
|
|
13899
|
+
function awaitReturn(f) {
|
|
13900
|
+
return function(v2) {
|
|
13901
|
+
return Promise.resolve(v2).then(f, reject);
|
|
13904
13902
|
};
|
|
13905
13903
|
}
|
|
13904
|
+
function verb2(n2, f) {
|
|
13905
|
+
if (g[n2]) {
|
|
13906
|
+
i[n2] = function(v2) {
|
|
13907
|
+
return new Promise(function(a, b) {
|
|
13908
|
+
q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
|
|
13909
|
+
});
|
|
13910
|
+
};
|
|
13911
|
+
if (f) i[n2] = f(i[n2]);
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13906
13914
|
function resume(n2, v2) {
|
|
13907
13915
|
try {
|
|
13908
13916
|
step4(g[n2](v2));
|
|
@@ -15529,6 +15537,23 @@ function debounceTime(dueTime, scheduler) {
|
|
|
15529
15537
|
});
|
|
15530
15538
|
}
|
|
15531
15539
|
|
|
15540
|
+
// ../node_modules/rxjs/dist/esm5/internal/operators/take.js
|
|
15541
|
+
function take(count2) {
|
|
15542
|
+
return count2 <= 0 ? function() {
|
|
15543
|
+
return EMPTY;
|
|
15544
|
+
} : operate(function(source8, subscriber3) {
|
|
15545
|
+
var seen = 0;
|
|
15546
|
+
source8.subscribe(createOperatorSubscriber(subscriber3, function(value7) {
|
|
15547
|
+
if (++seen <= count2) {
|
|
15548
|
+
subscriber3.next(value7);
|
|
15549
|
+
if (count2 <= seen) {
|
|
15550
|
+
subscriber3.complete();
|
|
15551
|
+
}
|
|
15552
|
+
}
|
|
15553
|
+
}));
|
|
15554
|
+
});
|
|
15555
|
+
}
|
|
15556
|
+
|
|
15532
15557
|
// ../node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js
|
|
15533
15558
|
function distinctUntilChanged(comparator2, keySelector) {
|
|
15534
15559
|
if (keySelector === void 0) {
|
|
@@ -15564,6 +15589,32 @@ function startWith() {
|
|
|
15564
15589
|
});
|
|
15565
15590
|
}
|
|
15566
15591
|
|
|
15592
|
+
// ../node_modules/rxjs/dist/esm5/internal/operators/switchMap.js
|
|
15593
|
+
function switchMap(project, resultSelector) {
|
|
15594
|
+
return operate(function(source8, subscriber3) {
|
|
15595
|
+
var innerSubscriber = null;
|
|
15596
|
+
var index2 = 0;
|
|
15597
|
+
var isComplete = false;
|
|
15598
|
+
var checkComplete = function() {
|
|
15599
|
+
return isComplete && !innerSubscriber && subscriber3.complete();
|
|
15600
|
+
};
|
|
15601
|
+
source8.subscribe(createOperatorSubscriber(subscriber3, function(value7) {
|
|
15602
|
+
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
|
15603
|
+
var innerIndex = 0;
|
|
15604
|
+
var outerIndex = index2++;
|
|
15605
|
+
innerFrom(project(value7, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber3, function(innerValue) {
|
|
15606
|
+
return subscriber3.next(resultSelector ? resultSelector(value7, innerValue, outerIndex, innerIndex++) : innerValue);
|
|
15607
|
+
}, function() {
|
|
15608
|
+
innerSubscriber = null;
|
|
15609
|
+
checkComplete();
|
|
15610
|
+
}));
|
|
15611
|
+
}, function() {
|
|
15612
|
+
isComplete = true;
|
|
15613
|
+
checkComplete();
|
|
15614
|
+
}));
|
|
15615
|
+
});
|
|
15616
|
+
}
|
|
15617
|
+
|
|
15567
15618
|
// ../node_modules/rxjs/dist/esm5/internal/operators/tap.js
|
|
15568
15619
|
function tap(observerOrNext, error4, complete2) {
|
|
15569
15620
|
var tapObserver = isFunction(observerOrNext) || error4 || complete2 ? { next: observerOrNext, error: error4, complete: complete2 } : observerOrNext;
|
|
@@ -28116,6 +28167,30 @@ function getFilename(url7) {
|
|
|
28116
28167
|
}
|
|
28117
28168
|
|
|
28118
28169
|
// src/thing/Thing.ts
|
|
28170
|
+
var LABEL_PREDICATES = [
|
|
28171
|
+
"http://www.w3.org/2006/vcard/ns#fn",
|
|
28172
|
+
"http://xmlns.com/foaf/0.1/name",
|
|
28173
|
+
"http://xmlns.com/foaf/0.1/nick",
|
|
28174
|
+
"https://schema.org/name",
|
|
28175
|
+
"http://schema.org/name",
|
|
28176
|
+
"http://purl.org/dc/terms/title",
|
|
28177
|
+
"http://purl.org/dc/elements/1.1/title",
|
|
28178
|
+
"http://www.w3.org/2000/01/rdf-schema#label",
|
|
28179
|
+
"https://www.w3.org/ns/activitystreams#name",
|
|
28180
|
+
"http://schema.org/caption",
|
|
28181
|
+
"https://schema.org/caption"
|
|
28182
|
+
];
|
|
28183
|
+
var DESCRIPTION_PREDICATES = [
|
|
28184
|
+
"http://purl.org/dc/terms/description",
|
|
28185
|
+
"http://purl.org/dc/elements/1.1/description",
|
|
28186
|
+
"http://schema.org/description",
|
|
28187
|
+
"https://schema.org/description",
|
|
28188
|
+
"https://schema.org/text",
|
|
28189
|
+
"http://www.w3.org/2000/01/rdf-schema#comment",
|
|
28190
|
+
"https://www.w3.org/ns/activitystreams#summary",
|
|
28191
|
+
"https://www.w3.org/ns/activitystreams#content",
|
|
28192
|
+
"http://www.w3.org/2006/vcard/ns#note"
|
|
28193
|
+
];
|
|
28119
28194
|
var Thing = class {
|
|
28120
28195
|
constructor(uri6, store, editable = false) {
|
|
28121
28196
|
this.uri = uri6;
|
|
@@ -28129,24 +28204,20 @@ var Thing = class {
|
|
|
28129
28204
|
* If no such term is present, it will derive a label from the URI.
|
|
28130
28205
|
*/
|
|
28131
28206
|
label() {
|
|
28132
|
-
const value7 = this.anyValue(
|
|
28133
|
-
"http://www.w3.org/2006/vcard/ns#fn",
|
|
28134
|
-
"http://xmlns.com/foaf/0.1/name",
|
|
28135
|
-
"http://xmlns.com/foaf/0.1/nick",
|
|
28136
|
-
"https://schema.org/name",
|
|
28137
|
-
"http://schema.org/name",
|
|
28138
|
-
"http://purl.org/dc/terms/title",
|
|
28139
|
-
"http://purl.org/dc/elements/1.1/title",
|
|
28140
|
-
"http://www.w3.org/2000/01/rdf-schema#label",
|
|
28141
|
-
"https://www.w3.org/ns/activitystreams#name",
|
|
28142
|
-
"http://schema.org/caption",
|
|
28143
|
-
"https://schema.org/caption"
|
|
28144
|
-
);
|
|
28207
|
+
const value7 = this.anyValue(...LABEL_PREDICATES);
|
|
28145
28208
|
if (value7) {
|
|
28146
28209
|
return value7;
|
|
28147
28210
|
}
|
|
28148
28211
|
return labelFromUri(this.uri);
|
|
28149
28212
|
}
|
|
28213
|
+
/**
|
|
28214
|
+
* Observe changes in human-readable label for this thing. See `label`.
|
|
28215
|
+
*/
|
|
28216
|
+
observeLabel() {
|
|
28217
|
+
return this.observeAnyValue(...LABEL_PREDICATES).pipe(
|
|
28218
|
+
map((value7) => value7 ?? labelFromUri(this.uri))
|
|
28219
|
+
);
|
|
28220
|
+
}
|
|
28150
28221
|
/**
|
|
28151
28222
|
* Returns all the literal values that are linked to this thing
|
|
28152
28223
|
*/
|
|
@@ -28238,22 +28309,56 @@ var Thing = class {
|
|
|
28238
28309
|
});
|
|
28239
28310
|
return value7;
|
|
28240
28311
|
}
|
|
28312
|
+
/**
|
|
28313
|
+
* Observe changes in a value linked from this thing via one of the given predicates
|
|
28314
|
+
*
|
|
28315
|
+
* Note that return value may differ from that from `anyValue` when more than one value is present.
|
|
28316
|
+
*
|
|
28317
|
+
* @param predicateUris
|
|
28318
|
+
*/
|
|
28319
|
+
observeAnyValue(...predicateUris) {
|
|
28320
|
+
const currentValue = this.anyValue(...predicateUris);
|
|
28321
|
+
const relevantChanges$ = (observable2) => observable2.pipe(
|
|
28322
|
+
filter(
|
|
28323
|
+
(quad3) => quad3.subject.value === this.uri && predicateUris.includes(quad3.predicate.value)
|
|
28324
|
+
)
|
|
28325
|
+
);
|
|
28326
|
+
const removalOrInitial$ = relevantChanges$(this.store.removals$).pipe(
|
|
28327
|
+
map(() => ({ type: "removal" })),
|
|
28328
|
+
currentValue === void 0 ? startWith({ type: "removal" }) : identity
|
|
28329
|
+
);
|
|
28330
|
+
const addition$ = removalOrInitial$.pipe(
|
|
28331
|
+
switchMap(
|
|
28332
|
+
() => relevantChanges$(this.store.additions$).pipe(
|
|
28333
|
+
take(1),
|
|
28334
|
+
map((quad3) => ({
|
|
28335
|
+
type: "addition",
|
|
28336
|
+
value: quad3.object.value
|
|
28337
|
+
}))
|
|
28338
|
+
)
|
|
28339
|
+
)
|
|
28340
|
+
);
|
|
28341
|
+
return merge(removalOrInitial$, addition$).pipe(
|
|
28342
|
+
debounceTime(250),
|
|
28343
|
+
map(
|
|
28344
|
+
(event4) => event4.type === "addition" ? event4.value : this.anyValue(...predicateUris)
|
|
28345
|
+
// determine a new value after a removal
|
|
28346
|
+
),
|
|
28347
|
+
startWith(currentValue)
|
|
28348
|
+
);
|
|
28349
|
+
}
|
|
28241
28350
|
/**
|
|
28242
28351
|
* Returns a literal value that describes this thing. Tries to match common RDF terms
|
|
28243
28352
|
* used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
|
|
28244
28353
|
*/
|
|
28245
28354
|
description() {
|
|
28246
|
-
return this.anyValue(
|
|
28247
|
-
|
|
28248
|
-
|
|
28249
|
-
|
|
28250
|
-
|
|
28251
|
-
|
|
28252
|
-
|
|
28253
|
-
"https://www.w3.org/ns/activitystreams#summary",
|
|
28254
|
-
"https://www.w3.org/ns/activitystreams#content",
|
|
28255
|
-
"http://www.w3.org/2006/vcard/ns#note"
|
|
28256
|
-
);
|
|
28355
|
+
return this.anyValue(...DESCRIPTION_PREDICATES);
|
|
28356
|
+
}
|
|
28357
|
+
/**
|
|
28358
|
+
* Observe changes in literal values that describe this thing. See `description`
|
|
28359
|
+
*/
|
|
28360
|
+
observeDescription() {
|
|
28361
|
+
return this.observeAnyValue(...DESCRIPTION_PREDICATES);
|
|
28257
28362
|
}
|
|
28258
28363
|
/**
|
|
28259
28364
|
* Returns the url of a picture or logo associated with this thing
|
package/lib/index.js
CHANGED
|
@@ -22222,8 +22222,8 @@ var PodOS = (() => {
|
|
|
22222
22222
|
var _ = { label: 0, sent: function() {
|
|
22223
22223
|
if (t[0] & 1) throw t[1];
|
|
22224
22224
|
return t[1];
|
|
22225
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
22226
|
-
return g =
|
|
22225
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
22226
|
+
return g.next = verb2(0), g["throw"] = verb2(1), g["return"] = verb2(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
22227
22227
|
return this;
|
|
22228
22228
|
}), g;
|
|
22229
22229
|
function verb2(n2) {
|
|
@@ -22330,16 +22330,24 @@ var PodOS = (() => {
|
|
|
22330
22330
|
function __asyncGenerator(thisArg, _arguments, generator3) {
|
|
22331
22331
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
22332
22332
|
var g = generator3.apply(thisArg, _arguments || []), i, q = [];
|
|
22333
|
-
return i =
|
|
22333
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb2("next"), verb2("throw"), verb2("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
22334
22334
|
return this;
|
|
22335
22335
|
}, i;
|
|
22336
|
-
function
|
|
22337
|
-
|
|
22338
|
-
return
|
|
22339
|
-
q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
|
|
22340
|
-
});
|
|
22336
|
+
function awaitReturn(f) {
|
|
22337
|
+
return function(v2) {
|
|
22338
|
+
return Promise.resolve(v2).then(f, reject);
|
|
22341
22339
|
};
|
|
22342
22340
|
}
|
|
22341
|
+
function verb2(n2, f) {
|
|
22342
|
+
if (g[n2]) {
|
|
22343
|
+
i[n2] = function(v2) {
|
|
22344
|
+
return new Promise(function(a, b) {
|
|
22345
|
+
q.push([n2, v2, a, b]) > 1 || resume(n2, v2);
|
|
22346
|
+
});
|
|
22347
|
+
};
|
|
22348
|
+
if (f) i[n2] = f(i[n2]);
|
|
22349
|
+
}
|
|
22350
|
+
}
|
|
22343
22351
|
function resume(n2, v2) {
|
|
22344
22352
|
try {
|
|
22345
22353
|
step4(g[n2](v2));
|
|
@@ -23966,6 +23974,23 @@ var PodOS = (() => {
|
|
|
23966
23974
|
});
|
|
23967
23975
|
}
|
|
23968
23976
|
|
|
23977
|
+
// ../node_modules/rxjs/dist/esm5/internal/operators/take.js
|
|
23978
|
+
function take(count2) {
|
|
23979
|
+
return count2 <= 0 ? function() {
|
|
23980
|
+
return EMPTY;
|
|
23981
|
+
} : operate(function(source8, subscriber3) {
|
|
23982
|
+
var seen = 0;
|
|
23983
|
+
source8.subscribe(createOperatorSubscriber(subscriber3, function(value7) {
|
|
23984
|
+
if (++seen <= count2) {
|
|
23985
|
+
subscriber3.next(value7);
|
|
23986
|
+
if (count2 <= seen) {
|
|
23987
|
+
subscriber3.complete();
|
|
23988
|
+
}
|
|
23989
|
+
}
|
|
23990
|
+
}));
|
|
23991
|
+
});
|
|
23992
|
+
}
|
|
23993
|
+
|
|
23969
23994
|
// ../node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js
|
|
23970
23995
|
function distinctUntilChanged(comparator2, keySelector) {
|
|
23971
23996
|
if (keySelector === void 0) {
|
|
@@ -24001,6 +24026,32 @@ var PodOS = (() => {
|
|
|
24001
24026
|
});
|
|
24002
24027
|
}
|
|
24003
24028
|
|
|
24029
|
+
// ../node_modules/rxjs/dist/esm5/internal/operators/switchMap.js
|
|
24030
|
+
function switchMap(project, resultSelector) {
|
|
24031
|
+
return operate(function(source8, subscriber3) {
|
|
24032
|
+
var innerSubscriber = null;
|
|
24033
|
+
var index2 = 0;
|
|
24034
|
+
var isComplete = false;
|
|
24035
|
+
var checkComplete = function() {
|
|
24036
|
+
return isComplete && !innerSubscriber && subscriber3.complete();
|
|
24037
|
+
};
|
|
24038
|
+
source8.subscribe(createOperatorSubscriber(subscriber3, function(value7) {
|
|
24039
|
+
innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
|
|
24040
|
+
var innerIndex = 0;
|
|
24041
|
+
var outerIndex = index2++;
|
|
24042
|
+
innerFrom(project(value7, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber3, function(innerValue) {
|
|
24043
|
+
return subscriber3.next(resultSelector ? resultSelector(value7, innerValue, outerIndex, innerIndex++) : innerValue);
|
|
24044
|
+
}, function() {
|
|
24045
|
+
innerSubscriber = null;
|
|
24046
|
+
checkComplete();
|
|
24047
|
+
}));
|
|
24048
|
+
}, function() {
|
|
24049
|
+
isComplete = true;
|
|
24050
|
+
checkComplete();
|
|
24051
|
+
}));
|
|
24052
|
+
});
|
|
24053
|
+
}
|
|
24054
|
+
|
|
24004
24055
|
// ../node_modules/rxjs/dist/esm5/internal/operators/tap.js
|
|
24005
24056
|
function tap(observerOrNext, error4, complete2) {
|
|
24006
24057
|
var tapObserver = isFunction(observerOrNext) || error4 || complete2 ? { next: observerOrNext, error: error4, complete: complete2 } : observerOrNext;
|
|
@@ -36553,6 +36604,30 @@ _:patch
|
|
|
36553
36604
|
}
|
|
36554
36605
|
|
|
36555
36606
|
// src/thing/Thing.ts
|
|
36607
|
+
var LABEL_PREDICATES = [
|
|
36608
|
+
"http://www.w3.org/2006/vcard/ns#fn",
|
|
36609
|
+
"http://xmlns.com/foaf/0.1/name",
|
|
36610
|
+
"http://xmlns.com/foaf/0.1/nick",
|
|
36611
|
+
"https://schema.org/name",
|
|
36612
|
+
"http://schema.org/name",
|
|
36613
|
+
"http://purl.org/dc/terms/title",
|
|
36614
|
+
"http://purl.org/dc/elements/1.1/title",
|
|
36615
|
+
"http://www.w3.org/2000/01/rdf-schema#label",
|
|
36616
|
+
"https://www.w3.org/ns/activitystreams#name",
|
|
36617
|
+
"http://schema.org/caption",
|
|
36618
|
+
"https://schema.org/caption"
|
|
36619
|
+
];
|
|
36620
|
+
var DESCRIPTION_PREDICATES = [
|
|
36621
|
+
"http://purl.org/dc/terms/description",
|
|
36622
|
+
"http://purl.org/dc/elements/1.1/description",
|
|
36623
|
+
"http://schema.org/description",
|
|
36624
|
+
"https://schema.org/description",
|
|
36625
|
+
"https://schema.org/text",
|
|
36626
|
+
"http://www.w3.org/2000/01/rdf-schema#comment",
|
|
36627
|
+
"https://www.w3.org/ns/activitystreams#summary",
|
|
36628
|
+
"https://www.w3.org/ns/activitystreams#content",
|
|
36629
|
+
"http://www.w3.org/2006/vcard/ns#note"
|
|
36630
|
+
];
|
|
36556
36631
|
var Thing = class {
|
|
36557
36632
|
constructor(uri6, store, editable = false) {
|
|
36558
36633
|
this.uri = uri6;
|
|
@@ -36566,24 +36641,20 @@ _:patch
|
|
|
36566
36641
|
* If no such term is present, it will derive a label from the URI.
|
|
36567
36642
|
*/
|
|
36568
36643
|
label() {
|
|
36569
|
-
const value7 = this.anyValue(
|
|
36570
|
-
"http://www.w3.org/2006/vcard/ns#fn",
|
|
36571
|
-
"http://xmlns.com/foaf/0.1/name",
|
|
36572
|
-
"http://xmlns.com/foaf/0.1/nick",
|
|
36573
|
-
"https://schema.org/name",
|
|
36574
|
-
"http://schema.org/name",
|
|
36575
|
-
"http://purl.org/dc/terms/title",
|
|
36576
|
-
"http://purl.org/dc/elements/1.1/title",
|
|
36577
|
-
"http://www.w3.org/2000/01/rdf-schema#label",
|
|
36578
|
-
"https://www.w3.org/ns/activitystreams#name",
|
|
36579
|
-
"http://schema.org/caption",
|
|
36580
|
-
"https://schema.org/caption"
|
|
36581
|
-
);
|
|
36644
|
+
const value7 = this.anyValue(...LABEL_PREDICATES);
|
|
36582
36645
|
if (value7) {
|
|
36583
36646
|
return value7;
|
|
36584
36647
|
}
|
|
36585
36648
|
return labelFromUri(this.uri);
|
|
36586
36649
|
}
|
|
36650
|
+
/**
|
|
36651
|
+
* Observe changes in human-readable label for this thing. See `label`.
|
|
36652
|
+
*/
|
|
36653
|
+
observeLabel() {
|
|
36654
|
+
return this.observeAnyValue(...LABEL_PREDICATES).pipe(
|
|
36655
|
+
map((value7) => value7 ?? labelFromUri(this.uri))
|
|
36656
|
+
);
|
|
36657
|
+
}
|
|
36587
36658
|
/**
|
|
36588
36659
|
* Returns all the literal values that are linked to this thing
|
|
36589
36660
|
*/
|
|
@@ -36675,22 +36746,56 @@ _:patch
|
|
|
36675
36746
|
});
|
|
36676
36747
|
return value7;
|
|
36677
36748
|
}
|
|
36749
|
+
/**
|
|
36750
|
+
* Observe changes in a value linked from this thing via one of the given predicates
|
|
36751
|
+
*
|
|
36752
|
+
* Note that return value may differ from that from `anyValue` when more than one value is present.
|
|
36753
|
+
*
|
|
36754
|
+
* @param predicateUris
|
|
36755
|
+
*/
|
|
36756
|
+
observeAnyValue(...predicateUris) {
|
|
36757
|
+
const currentValue = this.anyValue(...predicateUris);
|
|
36758
|
+
const relevantChanges$ = (observable2) => observable2.pipe(
|
|
36759
|
+
filter(
|
|
36760
|
+
(quad3) => quad3.subject.value === this.uri && predicateUris.includes(quad3.predicate.value)
|
|
36761
|
+
)
|
|
36762
|
+
);
|
|
36763
|
+
const removalOrInitial$ = relevantChanges$(this.store.removals$).pipe(
|
|
36764
|
+
map(() => ({ type: "removal" })),
|
|
36765
|
+
currentValue === void 0 ? startWith({ type: "removal" }) : identity
|
|
36766
|
+
);
|
|
36767
|
+
const addition$ = removalOrInitial$.pipe(
|
|
36768
|
+
switchMap(
|
|
36769
|
+
() => relevantChanges$(this.store.additions$).pipe(
|
|
36770
|
+
take(1),
|
|
36771
|
+
map((quad3) => ({
|
|
36772
|
+
type: "addition",
|
|
36773
|
+
value: quad3.object.value
|
|
36774
|
+
}))
|
|
36775
|
+
)
|
|
36776
|
+
)
|
|
36777
|
+
);
|
|
36778
|
+
return merge(removalOrInitial$, addition$).pipe(
|
|
36779
|
+
debounceTime(250),
|
|
36780
|
+
map(
|
|
36781
|
+
(event4) => event4.type === "addition" ? event4.value : this.anyValue(...predicateUris)
|
|
36782
|
+
// determine a new value after a removal
|
|
36783
|
+
),
|
|
36784
|
+
startWith(currentValue)
|
|
36785
|
+
);
|
|
36786
|
+
}
|
|
36678
36787
|
/**
|
|
36679
36788
|
* Returns a literal value that describes this thing. Tries to match common RDF terms
|
|
36680
36789
|
* used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
|
|
36681
36790
|
*/
|
|
36682
36791
|
description() {
|
|
36683
|
-
return this.anyValue(
|
|
36684
|
-
|
|
36685
|
-
|
|
36686
|
-
|
|
36687
|
-
|
|
36688
|
-
|
|
36689
|
-
|
|
36690
|
-
"https://www.w3.org/ns/activitystreams#summary",
|
|
36691
|
-
"https://www.w3.org/ns/activitystreams#content",
|
|
36692
|
-
"http://www.w3.org/2006/vcard/ns#note"
|
|
36693
|
-
);
|
|
36792
|
+
return this.anyValue(...DESCRIPTION_PREDICATES);
|
|
36793
|
+
}
|
|
36794
|
+
/**
|
|
36795
|
+
* Observe changes in literal values that describe this thing. See `description`
|
|
36796
|
+
*/
|
|
36797
|
+
observeDescription() {
|
|
36798
|
+
return this.observeAnyValue(...DESCRIPTION_PREDICATES);
|
|
36694
36799
|
}
|
|
36695
36800
|
/**
|
|
36696
36801
|
* Returns the url of a picture or logo associated with this thing
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/core",
|
|
3
3
|
"description": "Core module of PodOS",
|
|
4
|
-
"version": "0.30.0
|
|
4
|
+
"version": "0.30.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@types/sparqljs": "^3.1.12",
|
|
50
50
|
"esbuild": "^0.28.0",
|
|
51
51
|
"eslint": "^9.39.4",
|
|
52
|
-
"jest": "^30.
|
|
53
|
-
"jest-when": "^
|
|
52
|
+
"jest": "^30.4.0",
|
|
53
|
+
"jest-when": "^4.0.3",
|
|
54
54
|
"npm-run-all": "^4.1.5",
|
|
55
55
|
"prettier": "^3.8.3",
|
|
56
56
|
"rimraf": "^6.1.3",
|
package/types/thing/Thing.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export declare class Thing {
|
|
|
33
33
|
* If no such term is present, it will derive a label from the URI.
|
|
34
34
|
*/
|
|
35
35
|
label(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Observe changes in human-readable label for this thing. See `label`.
|
|
38
|
+
*/
|
|
39
|
+
observeLabel(): Observable<string>;
|
|
36
40
|
/**
|
|
37
41
|
* Returns all the literal values that are linked to this thing
|
|
38
42
|
*/
|
|
@@ -58,11 +62,23 @@ export declare class Thing {
|
|
|
58
62
|
* @param predicateUris
|
|
59
63
|
*/
|
|
60
64
|
anyValue(...predicateUris: string[]): undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Observe changes in a value linked from this thing via one of the given predicates
|
|
67
|
+
*
|
|
68
|
+
* Note that return value may differ from that from `anyValue` when more than one value is present.
|
|
69
|
+
*
|
|
70
|
+
* @param predicateUris
|
|
71
|
+
*/
|
|
72
|
+
observeAnyValue(...predicateUris: string[]): Observable<string | undefined>;
|
|
61
73
|
/**
|
|
62
74
|
* Returns a literal value that describes this thing. Tries to match common RDF terms
|
|
63
75
|
* used for descriptions, like `dct:description`, `schema:description` or `rdfs:comment`
|
|
64
76
|
*/
|
|
65
77
|
description(): undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Observe changes in literal values that describe this thing. See `description`
|
|
80
|
+
*/
|
|
81
|
+
observeDescription(): Observable<string | undefined>;
|
|
66
82
|
/**
|
|
67
83
|
* Returns the url of a picture or logo associated with this thing
|
|
68
84
|
* Tries to match common RDF terms used for pictures like `schema:image`,
|