@coasys/ad4m-connect 0.13.0-test-interpretation → 0.13.0-test-interpretation-2
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/core.js +157 -110
- package/dist/core.js.map +2 -2
- package/dist/index.js +157 -110
- package/dist/index.js.map +3 -3
- package/dist/utils.js +1 -1
- package/dist/web.js +157 -110
- package/dist/web.js.map +3 -3
- package/package.json +2 -2
package/dist/utils.js
CHANGED
package/dist/web.js
CHANGED
|
@@ -704,7 +704,7 @@ function autoBind(self, { include, exclude } = {}) {
|
|
|
704
704
|
}
|
|
705
705
|
|
|
706
706
|
// ../package.json
|
|
707
|
-
var version = "0.13.0-test-interpretation";
|
|
707
|
+
var version = "0.13.0-test-interpretation-2";
|
|
708
708
|
|
|
709
709
|
// src/utils.ts
|
|
710
710
|
function localStorageSupported() {
|
|
@@ -1937,6 +1937,14 @@ var Literal = class {
|
|
|
1937
1937
|
const numberString = body.substring(7);
|
|
1938
1938
|
return parseFloat(numberString);
|
|
1939
1939
|
}
|
|
1940
|
+
if (body.startsWith("boolean:")) {
|
|
1941
|
+
const boolString = decodeURIComponent(body.substring(8));
|
|
1942
|
+
if (boolString === "true")
|
|
1943
|
+
return true;
|
|
1944
|
+
if (boolString === "false")
|
|
1945
|
+
return false;
|
|
1946
|
+
throw new Error(`Can't parse boolean literal: ${boolString}`);
|
|
1947
|
+
}
|
|
1940
1948
|
if (body.startsWith("json:")) {
|
|
1941
1949
|
const json = body.substring(5);
|
|
1942
1950
|
return JSON.parse(decodeURIComponent(json));
|
|
@@ -2263,6 +2271,10 @@ var SHACLShape = class {
|
|
|
2263
2271
|
}
|
|
2264
2272
|
if (prop.writable !== void 0) {
|
|
2265
2273
|
turtle += ` ad4m:writable ${prop.writable} ;
|
|
2274
|
+
`;
|
|
2275
|
+
}
|
|
2276
|
+
if (prop.identity !== void 0) {
|
|
2277
|
+
turtle += ` ad4m:identity ${prop.identity} ;
|
|
2266
2278
|
`;
|
|
2267
2279
|
}
|
|
2268
2280
|
turtle = turtle.slice(0, -2) + "\n";
|
|
@@ -2753,7 +2765,8 @@ var SHACLShape = class {
|
|
|
2753
2765
|
where_predicates: p2.wherePredicates,
|
|
2754
2766
|
filter: p2.filter,
|
|
2755
2767
|
transform: p2.transform,
|
|
2756
|
-
interpretation_hint: p2.interpretationHint
|
|
2768
|
+
interpretation_hint: p2.interpretationHint,
|
|
2769
|
+
identity: p2.identity
|
|
2757
2770
|
})),
|
|
2758
2771
|
constructor_actions: this.constructor_actions,
|
|
2759
2772
|
destructor_actions: this.destructor_actions
|
|
@@ -2778,7 +2791,7 @@ var SHACLShape = class {
|
|
|
2778
2791
|
hasValue: p2.has_value,
|
|
2779
2792
|
local: p2.local,
|
|
2780
2793
|
writable: p2.writable,
|
|
2781
|
-
resolveLanguage: p2.resolve_language,
|
|
2794
|
+
resolveLanguage: p2.resolve_language ?? p2.resolveLanguage,
|
|
2782
2795
|
setter: p2.setter,
|
|
2783
2796
|
adder: p2.adder,
|
|
2784
2797
|
remover: p2.remover,
|
|
@@ -2792,7 +2805,8 @@ var SHACLShape = class {
|
|
|
2792
2805
|
wherePredicates: p2.where_predicates,
|
|
2793
2806
|
filter: p2.filter,
|
|
2794
2807
|
transform: p2.transform,
|
|
2795
|
-
interpretationHint: p2.interpretation_hint
|
|
2808
|
+
interpretationHint: p2.interpretation_hint,
|
|
2809
|
+
identity: p2.identity
|
|
2796
2810
|
});
|
|
2797
2811
|
}
|
|
2798
2812
|
if (json.constructor_actions) {
|
|
@@ -2861,16 +2875,19 @@ function buildSHACL(subjectName, target, properties, allRelationsMeta, conforman
|
|
|
2861
2875
|
name: propName,
|
|
2862
2876
|
path: propMeta.through
|
|
2863
2877
|
};
|
|
2864
|
-
if (propMeta.
|
|
2865
|
-
propShape.datatype =
|
|
2866
|
-
} else
|
|
2867
|
-
const
|
|
2868
|
-
if (
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2878
|
+
if (propMeta.datatype) {
|
|
2879
|
+
propShape.datatype = propMeta.datatype;
|
|
2880
|
+
} else {
|
|
2881
|
+
const isLiteral = propMeta.resolveLanguage === void 0 || propMeta.resolveLanguage === "literal";
|
|
2882
|
+
if ((propMeta.initial !== void 0 || isLiteral) && !propMeta.getter) {
|
|
2883
|
+
const initialType = typeof obj[propName];
|
|
2884
|
+
if (initialType === "number") {
|
|
2885
|
+
propShape.datatype = "xsd://integer";
|
|
2886
|
+
} else if (initialType === "boolean") {
|
|
2887
|
+
propShape.datatype = "xsd://boolean";
|
|
2888
|
+
} else if (initialType === "string" || isLiteral) {
|
|
2889
|
+
propShape.datatype = "xsd://string";
|
|
2890
|
+
}
|
|
2874
2891
|
}
|
|
2875
2892
|
}
|
|
2876
2893
|
if (propMeta.required) {
|
|
@@ -2944,7 +2961,12 @@ function buildSHACL(subjectName, target, properties, allRelationsMeta, conforman
|
|
|
2944
2961
|
name: relName,
|
|
2945
2962
|
path: synthesizedPath
|
|
2946
2963
|
};
|
|
2947
|
-
|
|
2964
|
+
if (relMeta.datatype) {
|
|
2965
|
+
relShape.datatype = relMeta.datatype;
|
|
2966
|
+
relShape.nodeKind = "Literal";
|
|
2967
|
+
} else {
|
|
2968
|
+
relShape.nodeKind = "IRI";
|
|
2969
|
+
}
|
|
2948
2970
|
relShape.relationKind = relMeta.kind;
|
|
2949
2971
|
if (relMeta.kind === "hasOne" || relMeta.kind === "belongsToOne") {
|
|
2950
2972
|
relShape.maxCount = 1;
|
|
@@ -3223,33 +3245,6 @@ function Optional(opts) {
|
|
|
3223
3245
|
readOnly: opts.readOnly ?? false
|
|
3224
3246
|
});
|
|
3225
3247
|
}
|
|
3226
|
-
function Flag(opts) {
|
|
3227
|
-
return function(target, key) {
|
|
3228
|
-
if (!opts.through && !opts.value) {
|
|
3229
|
-
throw new Error("SubjectFlag requires a 'through' and 'value' option");
|
|
3230
|
-
}
|
|
3231
|
-
if (!opts.through) {
|
|
3232
|
-
throw new Error("SubjectFlag requires a 'through' option");
|
|
3233
|
-
}
|
|
3234
|
-
if (!opts.value) {
|
|
3235
|
-
throw new Error("SubjectFlag requires a 'value' option");
|
|
3236
|
-
}
|
|
3237
|
-
const entry = {
|
|
3238
|
-
through: opts.through,
|
|
3239
|
-
required: true,
|
|
3240
|
-
initial: opts.value,
|
|
3241
|
-
flag: true,
|
|
3242
|
-
readOnly: true,
|
|
3243
|
-
writable: false
|
|
3244
|
-
};
|
|
3245
|
-
const ctor = target.constructor;
|
|
3246
|
-
if (!propertyRegistry.has(ctor))
|
|
3247
|
-
propertyRegistry.set(ctor, {});
|
|
3248
|
-
propertyRegistry.get(ctor)[key] = entry;
|
|
3249
|
-
target[key] = opts.value;
|
|
3250
|
-
Object.defineProperty(target, key, { configurable: true, writable: true });
|
|
3251
|
-
};
|
|
3252
|
-
}
|
|
3253
3248
|
function Model$1(opts) {
|
|
3254
3249
|
return function(target) {
|
|
3255
3250
|
target.prototype.className = opts.name;
|
|
@@ -3269,7 +3264,6 @@ function Property(opts) {
|
|
|
3269
3264
|
...opts,
|
|
3270
3265
|
required,
|
|
3271
3266
|
readOnly: opts.readOnly ?? false,
|
|
3272
|
-
resolveLanguage: opts.resolveLanguage ?? "literal",
|
|
3273
3267
|
initial: opts.initial ?? (required ? "literal:string:uninitialized" : void 0)
|
|
3274
3268
|
});
|
|
3275
3269
|
}
|
|
@@ -3311,7 +3305,8 @@ function HasMany(first, second) {
|
|
|
3311
3305
|
local: opts.local,
|
|
3312
3306
|
...opts.getter && { getter: opts.getter },
|
|
3313
3307
|
...opts.filter !== void 0 && { filter: opts.filter },
|
|
3314
|
-
...opts.where && { where: opts.where }
|
|
3308
|
+
...opts.where && { where: opts.where },
|
|
3309
|
+
...opts.datatype && { datatype: opts.datatype }
|
|
3315
3310
|
};
|
|
3316
3311
|
const relKey = key;
|
|
3317
3312
|
if (opts.through) {
|
|
@@ -3853,6 +3848,9 @@ var PerspectiveProxy = class {
|
|
|
3853
3848
|
async addAutoProcessorEventListener(cb) {
|
|
3854
3849
|
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addAutoProcessorEventListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, cb);
|
|
3855
3850
|
}
|
|
3851
|
+
async addAutoProcessorNeighbourhoodStateListener(cb) {
|
|
3852
|
+
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").addAutoProcessorNeighbourhoodStateListener(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, cb);
|
|
3853
|
+
}
|
|
3856
3854
|
async infer(query) {
|
|
3857
3855
|
return await __classPrivateFieldGet$a(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$a(this, _PerspectiveProxy_handle, "f").uuid, query);
|
|
3858
3856
|
}
|
|
@@ -4295,16 +4293,14 @@ var PerspectiveProxy = class {
|
|
|
4295
4293
|
return null;
|
|
4296
4294
|
}
|
|
4297
4295
|
const flowUri = flowUriLinks[0].data.target;
|
|
4298
|
-
const
|
|
4299
|
-
const
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
predicate: r4.p,
|
|
4307
|
-
target: r4.o
|
|
4296
|
+
const flowLevelLinks = await this.get(new LinkQuery({ source: flowUri }));
|
|
4297
|
+
const childUris = flowLevelLinks.filter((l5) => l5.data.predicate === "ad4m://hasState" || l5.data.predicate === "ad4m://hasTransition").map((l5) => l5.data.target);
|
|
4298
|
+
const childResults = await Promise.all(childUris.map((uri) => this.get(new LinkQuery({ source: uri }))));
|
|
4299
|
+
const allExprs = [...flowLevelLinks, ...childResults.flat()];
|
|
4300
|
+
const flowLinks = allExprs.map((l5) => ({
|
|
4301
|
+
source: l5.data.source,
|
|
4302
|
+
predicate: l5.data.predicate,
|
|
4303
|
+
target: l5.data.target
|
|
4308
4304
|
}));
|
|
4309
4305
|
return SHACLFlow.fromLinks(flowLinks, flowUri);
|
|
4310
4306
|
}
|
|
@@ -4982,9 +4978,9 @@ var PerspectiveClient = class {
|
|
|
4982
4978
|
async linkMutations(uuid, mutations, status) {
|
|
4983
4979
|
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.linkMutations", { uuid, mutations, status });
|
|
4984
4980
|
}
|
|
4985
|
-
async runInterpretation(uuid, transcript, basePrefix, classes) {
|
|
4981
|
+
async runInterpretation(uuid, transcript, basePrefix, classes, existingScope, mintScope) {
|
|
4986
4982
|
const RUN_INTERPRETATION_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
4987
|
-
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.runInterpretation", { uuid, transcript, basePrefix, classes }, RUN_INTERPRETATION_TIMEOUT_MS);
|
|
4983
|
+
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.runInterpretation", { uuid, transcript, basePrefix, classes, existingScope, mintScope }, RUN_INTERPRETATION_TIMEOUT_MS);
|
|
4988
4984
|
}
|
|
4989
4985
|
async addAutoProcessor(uuid, config) {
|
|
4990
4986
|
return __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").call("perspective.addAutoProcessor", { uuid, ...config });
|
|
@@ -5004,7 +5000,20 @@ var PerspectiveClient = class {
|
|
|
5004
5000
|
cb(data);
|
|
5005
5001
|
}
|
|
5006
5002
|
});
|
|
5007
|
-
__classPrivateFieldGet$9(this,
|
|
5003
|
+
let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
5004
|
+
existing.push(unsub);
|
|
5005
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
5006
|
+
await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
5007
|
+
}
|
|
5008
|
+
async addAutoProcessorNeighbourhoodStateListener(uuid, cb) {
|
|
5009
|
+
const unsub = __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").subscribe((data) => {
|
|
5010
|
+
if (data.type === "auto-processor-neighbourhood-state" && data.perspectiveUuid === uuid) {
|
|
5011
|
+
cb(data);
|
|
5012
|
+
}
|
|
5013
|
+
});
|
|
5014
|
+
let existing = __classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").get(uuid) || [];
|
|
5015
|
+
existing.push(unsub);
|
|
5016
|
+
__classPrivateFieldGet$9(this, _PerspectiveClient_linkUnsubscribers, "f").set(uuid, existing);
|
|
5008
5017
|
await __classPrivateFieldGet$9(this, _PerspectiveClient_apiClient, "f").waitForSubscription();
|
|
5009
5018
|
}
|
|
5010
5019
|
async addLinkExpression(uuid, link, status = "shared", batchId) {
|
|
@@ -9954,10 +9963,6 @@ function isArrayType(schema) {
|
|
|
9954
9963
|
function isObjectType(schema) {
|
|
9955
9964
|
return isSchemaType(schema, "object");
|
|
9956
9965
|
}
|
|
9957
|
-
function isNumericType(schema) {
|
|
9958
|
-
const normalized = normalizeSchemaType(schema.type);
|
|
9959
|
-
return normalized === "number" || normalized === "integer";
|
|
9960
|
-
}
|
|
9961
9966
|
function determineNamespace(schema, options) {
|
|
9962
9967
|
if (options.namespace) {
|
|
9963
9968
|
return options.namespace;
|
|
@@ -10079,10 +10084,6 @@ function buildModelFromJSONSchema(BaseClass, schema, options) {
|
|
|
10079
10084
|
DynamicModelClass.prototype[setterName] = function() {
|
|
10080
10085
|
};
|
|
10081
10086
|
} else {
|
|
10082
|
-
let resolveLanguage = getPropertyOption(propertyName, propertySchema, options, "resolveLanguage");
|
|
10083
|
-
if (!resolveLanguage && options.resolveLanguage) {
|
|
10084
|
-
resolveLanguage = options.resolveLanguage;
|
|
10085
|
-
}
|
|
10086
10087
|
const local = getPropertyOption(propertyName, propertySchema, options, "local");
|
|
10087
10088
|
let readOnly = getPropertyOption(propertyName, propertySchema, options, "readOnly");
|
|
10088
10089
|
if (readOnly === void 0) {
|
|
@@ -10091,16 +10092,10 @@ function buildModelFromJSONSchema(BaseClass, schema, options) {
|
|
|
10091
10092
|
}
|
|
10092
10093
|
const writable = !readOnly;
|
|
10093
10094
|
let initial = getPropertyOption(propertyName, propertySchema, options, "initial");
|
|
10094
|
-
|
|
10095
|
-
|
|
10095
|
+
const resolveLanguage = getPropertyOption(propertyName, propertySchema, options, "resolveLanguage");
|
|
10096
|
+
if (isObjectType(propertySchema)) {
|
|
10096
10097
|
console.warn(`Property "${propertyName}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`);
|
|
10097
10098
|
}
|
|
10098
|
-
if ((resolveLanguage === void 0 || resolveLanguage === null) && isNumericType(propertySchema)) {
|
|
10099
|
-
resolveLanguage = "literal";
|
|
10100
|
-
}
|
|
10101
|
-
if (resolveLanguage === void 0 || resolveLanguage === null) {
|
|
10102
|
-
resolveLanguage = "literal";
|
|
10103
|
-
}
|
|
10104
10099
|
if (isRequired && !initial) {
|
|
10105
10100
|
if (isObjectType(propertySchema)) {
|
|
10106
10101
|
initial = "literal:json:{}";
|
|
@@ -10112,7 +10107,7 @@ function buildModelFromJSONSchema(BaseClass, schema, options) {
|
|
|
10112
10107
|
through: predicate,
|
|
10113
10108
|
required: isRequired,
|
|
10114
10109
|
writable,
|
|
10115
|
-
...resolveLanguage && { resolveLanguage },
|
|
10110
|
+
...resolveLanguage !== void 0 && { resolveLanguage },
|
|
10116
10111
|
...local !== void 0 && { local },
|
|
10117
10112
|
...initial && { initial }
|
|
10118
10113
|
};
|
|
@@ -10175,13 +10170,43 @@ function hasJsOnlyWhereFilters(metadata, allRelationsMetadata, where) {
|
|
|
10175
10170
|
}
|
|
10176
10171
|
return false;
|
|
10177
10172
|
}
|
|
10178
|
-
function
|
|
10179
|
-
if (
|
|
10173
|
+
function looksLikeUri(value) {
|
|
10174
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+\-._]*:/.test(value))
|
|
10180
10175
|
return false;
|
|
10181
|
-
if (
|
|
10176
|
+
if (/[\s<>{}"\u0000-\u001F\u007F-\u009F]/.test(value))
|
|
10182
10177
|
return false;
|
|
10183
10178
|
return true;
|
|
10184
10179
|
}
|
|
10180
|
+
function valueToLiteralIri(value) {
|
|
10181
|
+
if (typeof value === "string") {
|
|
10182
|
+
if (looksLikeUri(value))
|
|
10183
|
+
return value;
|
|
10184
|
+
return Literal.from(value).toUrl();
|
|
10185
|
+
}
|
|
10186
|
+
if (typeof value === "number") {
|
|
10187
|
+
return Literal.from(value).toUrl();
|
|
10188
|
+
}
|
|
10189
|
+
if (typeof value === "boolean") {
|
|
10190
|
+
return Literal.from(value).toUrl();
|
|
10191
|
+
}
|
|
10192
|
+
if (value !== null && typeof value === "object") {
|
|
10193
|
+
return Literal.from(value).toUrl();
|
|
10194
|
+
}
|
|
10195
|
+
return Literal.from(String(value)).toUrl();
|
|
10196
|
+
}
|
|
10197
|
+
function effectiveLiteralStorage(meta) {
|
|
10198
|
+
const lang = meta.resolveLanguage;
|
|
10199
|
+
if (lang === void 0)
|
|
10200
|
+
return { kind: "deterministic" };
|
|
10201
|
+
if (lang === "literal")
|
|
10202
|
+
return { kind: "envelope" };
|
|
10203
|
+
return { kind: "custom", language: lang };
|
|
10204
|
+
}
|
|
10205
|
+
function isLiteralStoredProperty(propMeta) {
|
|
10206
|
+
if (propMeta.flag)
|
|
10207
|
+
return false;
|
|
10208
|
+
return effectiveLiteralStorage(propMeta).kind === "deterministic";
|
|
10209
|
+
}
|
|
10185
10210
|
function escapeSPARQL(value) {
|
|
10186
10211
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\0/g, "").replace(/\f/g, "\\u000C");
|
|
10187
10212
|
}
|
|
@@ -10917,7 +10942,7 @@ var Ad4mModel = class {
|
|
|
10917
10942
|
predicate,
|
|
10918
10943
|
required: isRequired,
|
|
10919
10944
|
readOnly: propertySchema["x-ad4m"]?.writable === false,
|
|
10920
|
-
...propertySchema["x-ad4m"]?.resolveLanguage && { resolveLanguage: propertySchema["x-ad4m"].resolveLanguage },
|
|
10945
|
+
...propertySchema["x-ad4m"]?.resolveLanguage !== void 0 && { resolveLanguage: propertySchema["x-ad4m"].resolveLanguage },
|
|
10921
10946
|
...propertySchema["x-ad4m"]?.initial && { initial: propertySchema["x-ad4m"].initial },
|
|
10922
10947
|
...propertySchema["x-ad4m"]?.local !== void 0 && { local: propertySchema["x-ad4m"].local }
|
|
10923
10948
|
};
|
|
@@ -10933,7 +10958,7 @@ var Ad4mModel = class {
|
|
|
10933
10958
|
}
|
|
10934
10959
|
constructor(perspective, baseExpression) {
|
|
10935
10960
|
this._snapshot = null;
|
|
10936
|
-
this._baseExpression = baseExpression ? baseExpression :
|
|
10961
|
+
this._baseExpression = baseExpression ? baseExpression : `ad4m://obj/${makeRandomId(24)}`;
|
|
10937
10962
|
this._perspective = perspective;
|
|
10938
10963
|
}
|
|
10939
10964
|
get id() {
|
|
@@ -11223,12 +11248,16 @@ var Ad4mModel = class {
|
|
|
11223
11248
|
return;
|
|
11224
11249
|
}
|
|
11225
11250
|
const actions = this.generatePropertySetterAction(key, metadata);
|
|
11226
|
-
let resolveLanguage = metadata.resolveLanguage;
|
|
11227
11251
|
if (value === void 0 || value === null || value === "") {
|
|
11228
11252
|
return;
|
|
11229
11253
|
}
|
|
11230
|
-
|
|
11231
|
-
|
|
11254
|
+
const mode = effectiveLiteralStorage(metadata);
|
|
11255
|
+
if (mode.kind === "custom") {
|
|
11256
|
+
value = await this._perspective.createExpression(value, mode.language);
|
|
11257
|
+
} else if (mode.kind === "envelope") {
|
|
11258
|
+
value = await this._perspective.createExpression(value, "literal");
|
|
11259
|
+
} else {
|
|
11260
|
+
value = valueToLiteralIri(value);
|
|
11232
11261
|
}
|
|
11233
11262
|
await this._perspective.executeAction(actions, this._baseExpression, [{ name: "value", value }], batchId);
|
|
11234
11263
|
}
|
|
@@ -11301,14 +11330,14 @@ var Ad4mModel = class {
|
|
|
11301
11330
|
}
|
|
11302
11331
|
const metadata = this.constructor.getModelMetadata();
|
|
11303
11332
|
const hasConstructor = Object.values(metadata.properties).some((p2) => p2.required || p2.flag || p2.initial !== void 0);
|
|
11304
|
-
const
|
|
11333
|
+
const deferredExpressionProps = [];
|
|
11305
11334
|
if (hasConstructor) {
|
|
11306
11335
|
const initialValues = {};
|
|
11307
11336
|
for (const [key, value] of Object.entries(this)) {
|
|
11308
11337
|
if (value !== void 0 && value !== null && !(Array.isArray(value) && value.length > 0) && !value?.action) {
|
|
11309
11338
|
const propMeta = metadata.properties[key];
|
|
11310
|
-
if (propMeta
|
|
11311
|
-
|
|
11339
|
+
if (propMeta && effectiveLiteralStorage(propMeta).kind !== "deterministic") {
|
|
11340
|
+
deferredExpressionProps.push(key);
|
|
11312
11341
|
continue;
|
|
11313
11342
|
}
|
|
11314
11343
|
initialValues[key] = value;
|
|
@@ -11318,7 +11347,7 @@ var Ad4mModel = class {
|
|
|
11318
11347
|
await this.perspective.createSubject(className, this._baseExpression, initialValues, batchId);
|
|
11319
11348
|
}
|
|
11320
11349
|
await this.innerUpdate(!hasConstructor, batchId);
|
|
11321
|
-
for (const key of
|
|
11350
|
+
for (const key of deferredExpressionProps) {
|
|
11322
11351
|
const value = this[key];
|
|
11323
11352
|
if (value !== void 0 && value !== null) {
|
|
11324
11353
|
await this.setProperty(key, value, batchId);
|
|
@@ -11653,7 +11682,6 @@ var __metadata = function(k2, v2) {
|
|
|
11653
11682
|
var AutoProcessorConfig = class AutoProcessorConfig2 extends Ad4mModel {
|
|
11654
11683
|
constructor() {
|
|
11655
11684
|
super(...arguments);
|
|
11656
|
-
this.type = "ad4m://AutoProcessor";
|
|
11657
11685
|
this.processorId = "";
|
|
11658
11686
|
this.sourceScopeQuery = "";
|
|
11659
11687
|
this.interpretationClasses = [];
|
|
@@ -11662,10 +11690,6 @@ var AutoProcessorConfig = class AutoProcessorConfig2 extends Ad4mModel {
|
|
|
11662
11690
|
this.claimTtlMs = "60000";
|
|
11663
11691
|
}
|
|
11664
11692
|
};
|
|
11665
|
-
__decorate([
|
|
11666
|
-
Flag({ through: "rdf://type", value: "ad4m://AutoProcessor" }),
|
|
11667
|
-
__metadata("design:type", String)
|
|
11668
|
-
], AutoProcessorConfig.prototype, "type", void 0);
|
|
11669
11693
|
__decorate([
|
|
11670
11694
|
Property({ through: "ad4m://processor_id", required: true, identity: true }),
|
|
11671
11695
|
__metadata("design:type", String)
|
|
@@ -11675,11 +11699,11 @@ __decorate([
|
|
|
11675
11699
|
__metadata("design:type", String)
|
|
11676
11700
|
], AutoProcessorConfig.prototype, "sourceScopeQuery", void 0);
|
|
11677
11701
|
__decorate([
|
|
11678
|
-
Optional({ through: "ad4m://base_prefix"
|
|
11702
|
+
Optional({ through: "ad4m://base_prefix" }),
|
|
11679
11703
|
__metadata("design:type", String)
|
|
11680
11704
|
], AutoProcessorConfig.prototype, "basePrefix", void 0);
|
|
11681
11705
|
__decorate([
|
|
11682
|
-
HasMany({ through: "ad4m://interpretation_class" }),
|
|
11706
|
+
HasMany({ through: "ad4m://interpretation_class", datatype: "xsd:string" }),
|
|
11683
11707
|
__metadata("design:type", Array)
|
|
11684
11708
|
], AutoProcessorConfig.prototype, "interpretationClasses", void 0);
|
|
11685
11709
|
__decorate([
|
|
@@ -11687,7 +11711,7 @@ __decorate([
|
|
|
11687
11711
|
__metadata("design:type", String)
|
|
11688
11712
|
], AutoProcessorConfig.prototype, "debounceMs", void 0);
|
|
11689
11713
|
__decorate([
|
|
11690
|
-
Optional({ through: "ad4m://batch_min"
|
|
11714
|
+
Optional({ through: "ad4m://batch_min" }),
|
|
11691
11715
|
__metadata("design:type", String)
|
|
11692
11716
|
], AutoProcessorConfig.prototype, "batchMin", void 0);
|
|
11693
11717
|
__decorate([
|
|
@@ -11695,7 +11719,7 @@ __decorate([
|
|
|
11695
11719
|
__metadata("design:type", String)
|
|
11696
11720
|
], AutoProcessorConfig.prototype, "batchMax", void 0);
|
|
11697
11721
|
__decorate([
|
|
11698
|
-
Optional({ through: "ad4m://max_wait_ms"
|
|
11722
|
+
Optional({ through: "ad4m://max_wait_ms" }),
|
|
11699
11723
|
__metadata("design:type", String)
|
|
11700
11724
|
], AutoProcessorConfig.prototype, "maxWaitMs", void 0);
|
|
11701
11725
|
__decorate([
|
|
@@ -11703,52 +11727,75 @@ __decorate([
|
|
|
11703
11727
|
__metadata("design:type", String)
|
|
11704
11728
|
], AutoProcessorConfig.prototype, "claimTtlMs", void 0);
|
|
11705
11729
|
__decorate([
|
|
11706
|
-
Optional({ through: "ad4m://source_window_ms"
|
|
11730
|
+
Optional({ through: "ad4m://source_window_ms" }),
|
|
11707
11731
|
__metadata("design:type", String)
|
|
11708
11732
|
], AutoProcessorConfig.prototype, "sourceWindowMs", void 0);
|
|
11709
11733
|
__decorate([
|
|
11710
|
-
Optional({ through: "ad4m://dedup_strategy"
|
|
11734
|
+
Optional({ through: "ad4m://dedup_strategy" }),
|
|
11711
11735
|
__metadata("design:type", String)
|
|
11712
11736
|
], AutoProcessorConfig.prototype, "dedupStrategy", void 0);
|
|
11737
|
+
__decorate([
|
|
11738
|
+
Optional({ through: "ad4m://existing_scope" }),
|
|
11739
|
+
__metadata("design:type", String)
|
|
11740
|
+
], AutoProcessorConfig.prototype, "existingScope", void 0);
|
|
11741
|
+
__decorate([
|
|
11742
|
+
Optional({ through: "ad4m://mint_scope" }),
|
|
11743
|
+
__metadata("design:type", String)
|
|
11744
|
+
], AutoProcessorConfig.prototype, "mintScope", void 0);
|
|
11745
|
+
__decorate([
|
|
11746
|
+
Optional({ through: "ad4m://debug_mode", resolveLanguage: "literal" }),
|
|
11747
|
+
__metadata("design:type", String)
|
|
11748
|
+
], AutoProcessorConfig.prototype, "debugMode", void 0);
|
|
11749
|
+
__decorate([
|
|
11750
|
+
Optional({ through: "ad4m://persist_debug", resolveLanguage: "literal" }),
|
|
11751
|
+
__metadata("design:type", String)
|
|
11752
|
+
], AutoProcessorConfig.prototype, "persistDebug", void 0);
|
|
11753
|
+
__decorate([
|
|
11754
|
+
Optional({ through: "ad4m://emit_debug_events", resolveLanguage: "literal" }),
|
|
11755
|
+
__metadata("design:type", String)
|
|
11756
|
+
], AutoProcessorConfig.prototype, "emitDebugEvents", void 0);
|
|
11713
11757
|
AutoProcessorConfig = __decorate([
|
|
11714
|
-
Model$1({ name: "
|
|
11758
|
+
Model$1({ name: "AutoProcessor" })
|
|
11715
11759
|
], AutoProcessorConfig);
|
|
11716
11760
|
var InterpretationRun = class InterpretationRun2 extends Ad4mModel {
|
|
11717
11761
|
constructor() {
|
|
11718
11762
|
super(...arguments);
|
|
11719
|
-
this.type = "ad4m://interpretation-run";
|
|
11720
11763
|
this.runId = "";
|
|
11721
11764
|
this.sources = [];
|
|
11722
11765
|
}
|
|
11723
11766
|
};
|
|
11724
|
-
__decorate([
|
|
11725
|
-
Flag({ through: "ad4m://type", value: "ad4m://interpretation-run" }),
|
|
11726
|
-
__metadata("design:type", String)
|
|
11727
|
-
], InterpretationRun.prototype, "type", void 0);
|
|
11728
11767
|
__decorate([
|
|
11729
11768
|
Property({ through: "ad4m://interp/run_id", required: true, identity: true }),
|
|
11730
11769
|
__metadata("design:type", String)
|
|
11731
11770
|
], InterpretationRun.prototype, "runId", void 0);
|
|
11732
11771
|
__decorate([
|
|
11733
|
-
Optional({ through: "ad4m://interp/model"
|
|
11772
|
+
Optional({ through: "ad4m://interp/model" }),
|
|
11734
11773
|
__metadata("design:type", String)
|
|
11735
11774
|
], InterpretationRun.prototype, "model", void 0);
|
|
11736
11775
|
__decorate([
|
|
11737
|
-
Optional({ through: "ad4m://interp/prompt_version"
|
|
11776
|
+
Optional({ through: "ad4m://interp/prompt_version" }),
|
|
11738
11777
|
__metadata("design:type", String)
|
|
11739
11778
|
], InterpretationRun.prototype, "promptVersion", void 0);
|
|
11740
11779
|
__decorate([
|
|
11741
|
-
Optional({ through: "ad4m://interp/ran_at"
|
|
11780
|
+
Optional({ through: "ad4m://interp/ran_at" }),
|
|
11742
11781
|
__metadata("design:type", String)
|
|
11743
11782
|
], InterpretationRun.prototype, "ranAt", void 0);
|
|
11744
11783
|
__decorate([
|
|
11745
|
-
Optional({ through: "ad4m://interp/processor"
|
|
11784
|
+
Optional({ through: "ad4m://interp/processor" }),
|
|
11746
11785
|
__metadata("design:type", String)
|
|
11747
11786
|
], InterpretationRun.prototype, "processor", void 0);
|
|
11748
11787
|
__decorate([
|
|
11749
|
-
HasMany({ through: "ad4m://interp/sources" }),
|
|
11788
|
+
HasMany({ through: "ad4m://interp/sources", datatype: "xsd:string" }),
|
|
11750
11789
|
__metadata("design:type", Array)
|
|
11751
11790
|
], InterpretationRun.prototype, "sources", void 0);
|
|
11791
|
+
__decorate([
|
|
11792
|
+
Optional({ through: "ad4m://interp/debug_prompt", resolveLanguage: "literal" }),
|
|
11793
|
+
__metadata("design:type", String)
|
|
11794
|
+
], InterpretationRun.prototype, "debugPrompt", void 0);
|
|
11795
|
+
__decorate([
|
|
11796
|
+
Optional({ through: "ad4m://interp/debug_response", resolveLanguage: "literal" }),
|
|
11797
|
+
__metadata("design:type", String)
|
|
11798
|
+
], InterpretationRun.prototype, "debugResponse", void 0);
|
|
11752
11799
|
InterpretationRun = __decorate([
|
|
11753
11800
|
Model$1({ name: "InterpretationRun" })
|
|
11754
11801
|
], InterpretationRun);
|
|
@@ -11759,11 +11806,11 @@ var InterpretationOverlay = class InterpretationOverlay2 extends Ad4mModel {
|
|
|
11759
11806
|
}
|
|
11760
11807
|
};
|
|
11761
11808
|
__decorate([
|
|
11762
|
-
Property({ through: "ad4m://interp/kind", required: true
|
|
11809
|
+
Property({ through: "ad4m://interp/kind", required: true }),
|
|
11763
11810
|
__metadata("design:type", String)
|
|
11764
11811
|
], InterpretationOverlay.prototype, "kind", void 0);
|
|
11765
11812
|
__decorate([
|
|
11766
|
-
Optional({ through: "ad4m://interp/run"
|
|
11813
|
+
Optional({ through: "ad4m://interp/run" }),
|
|
11767
11814
|
__metadata("design:type", String)
|
|
11768
11815
|
], InterpretationOverlay.prototype, "run", void 0);
|
|
11769
11816
|
InterpretationOverlay = __decorate([
|