@coasys/ad4m 0.10.0-rc6 → 0.10.0-rc6.fix2
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/lib/index.cjs +64 -59
- package/lib/index.js +64 -59
- package/lib/src/perspectives/PerspectiveProxy.js +64 -59
- package/package.json +2 -2
- package/src/perspectives/PerspectiveProxy.ts +64 -61
- package/yarn-error.log +90 -0
package/lib/index.cjs
CHANGED
|
@@ -4961,65 +4961,70 @@ class PerspectiveProxy {
|
|
|
4961
4961
|
return instances;
|
|
4962
4962
|
}
|
|
4963
4963
|
buildQueryFromTemplate(obj) {
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
query
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
4964
|
+
let result;
|
|
4965
|
+
// We need to avoid strict mode for the following intropsective code
|
|
4966
|
+
(function (obj) {
|
|
4967
|
+
// Collect all string properties of the object in a list
|
|
4968
|
+
let properties = [];
|
|
4969
|
+
// Collect all collections of the object in a list
|
|
4970
|
+
let collections = [];
|
|
4971
|
+
// Collect all string properties of the object in a list
|
|
4972
|
+
if (Object.getPrototypeOf(obj).__properties) {
|
|
4973
|
+
Object.keys(Object.getPrototypeOf(obj).__properties).forEach(p => properties.push(p));
|
|
4974
|
+
}
|
|
4975
|
+
else {
|
|
4976
|
+
properties.push(...Object.keys(obj).filter(key => !Array.isArray(obj[key])));
|
|
4977
|
+
}
|
|
4978
|
+
// Collect all collections of the object in a list
|
|
4979
|
+
if (Object.getPrototypeOf(obj).__collections) {
|
|
4980
|
+
Object.keys(Object.getPrototypeOf(obj).__collections).filter(key => key !== 'isSubjectInstance').forEach(c => !collections.includes(c) ?? collections.push(c));
|
|
4981
|
+
}
|
|
4982
|
+
else {
|
|
4983
|
+
collections.push(...Object.keys(obj).filter(key => Array.isArray(obj[key])).filter(key => key !== 'isSubjectInstance'));
|
|
4984
|
+
}
|
|
4985
|
+
// Collect all set functions of the object in a list
|
|
4986
|
+
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"));
|
|
4987
|
+
// Add all set functions of the object's prototype to that list
|
|
4988
|
+
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")));
|
|
4989
|
+
// Collect all add functions of the object in a list
|
|
4990
|
+
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("add"));
|
|
4991
|
+
// Add all add functions of the object's prototype to that list
|
|
4992
|
+
addFunctions = addFunctions.concat(Object.keys(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("add")));
|
|
4993
|
+
// Collect all remove functions of the object in a list
|
|
4994
|
+
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("remove"));
|
|
4995
|
+
// Add all remove functions of the object's prototype to that list
|
|
4996
|
+
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("remove")));
|
|
4997
|
+
// Collect all add functions of the object in a list
|
|
4998
|
+
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("setCollection"));
|
|
4999
|
+
// Add all add functions of the object's prototype to that list
|
|
5000
|
+
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("setCollection")));
|
|
5001
|
+
// Construct query to find all subject classes that have the given properties and collections
|
|
5002
|
+
let query = `subject_class(Class, C)`;
|
|
5003
|
+
for (let property of properties) {
|
|
5004
|
+
query += `, property(C, "${property}")`;
|
|
5005
|
+
}
|
|
5006
|
+
for (let collection of collections) {
|
|
5007
|
+
query += `, collection(C, "${collection}")`;
|
|
5008
|
+
}
|
|
5009
|
+
for (let setFunction of setFunctions) {
|
|
5010
|
+
// e.g. "setState" -> "state"
|
|
5011
|
+
let property = setFunction.substring(3);
|
|
5012
|
+
property = property.charAt(0).toLowerCase() + property.slice(1);
|
|
5013
|
+
query += `, property_setter(C, "${property}", _)`;
|
|
5014
|
+
}
|
|
5015
|
+
for (let addFunction of addFunctions) {
|
|
5016
|
+
query += `, collection_adder(C, "${collectionAdderToName(addFunction)}", _)`;
|
|
5017
|
+
}
|
|
5018
|
+
for (let removeFunction of removeFunctions) {
|
|
5019
|
+
query += `, collection_remover(C, "${collectionRemoverToName(removeFunction)}", _)`;
|
|
5020
|
+
}
|
|
5021
|
+
for (let setCollectionFunction of setCollectionFunctions) {
|
|
5022
|
+
query += `, collection_setter(C, "${collectionSetterToName(setCollectionFunction)}", _)`;
|
|
5023
|
+
}
|
|
5024
|
+
query += ".";
|
|
5025
|
+
result = query;
|
|
5026
|
+
}(obj));
|
|
5027
|
+
return result;
|
|
5023
5028
|
}
|
|
5024
5029
|
/** Returns all subject classes that match the given template object.
|
|
5025
5030
|
* This function looks at the properties of the template object and
|
package/lib/index.js
CHANGED
|
@@ -4957,65 +4957,70 @@ class PerspectiveProxy {
|
|
|
4957
4957
|
return instances;
|
|
4958
4958
|
}
|
|
4959
4959
|
buildQueryFromTemplate(obj) {
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
query
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
4960
|
+
let result;
|
|
4961
|
+
// We need to avoid strict mode for the following intropsective code
|
|
4962
|
+
(function (obj) {
|
|
4963
|
+
// Collect all string properties of the object in a list
|
|
4964
|
+
let properties = [];
|
|
4965
|
+
// Collect all collections of the object in a list
|
|
4966
|
+
let collections = [];
|
|
4967
|
+
// Collect all string properties of the object in a list
|
|
4968
|
+
if (Object.getPrototypeOf(obj).__properties) {
|
|
4969
|
+
Object.keys(Object.getPrototypeOf(obj).__properties).forEach(p => properties.push(p));
|
|
4970
|
+
}
|
|
4971
|
+
else {
|
|
4972
|
+
properties.push(...Object.keys(obj).filter(key => !Array.isArray(obj[key])));
|
|
4973
|
+
}
|
|
4974
|
+
// Collect all collections of the object in a list
|
|
4975
|
+
if (Object.getPrototypeOf(obj).__collections) {
|
|
4976
|
+
Object.keys(Object.getPrototypeOf(obj).__collections).filter(key => key !== 'isSubjectInstance').forEach(c => !collections.includes(c) ?? collections.push(c));
|
|
4977
|
+
}
|
|
4978
|
+
else {
|
|
4979
|
+
collections.push(...Object.keys(obj).filter(key => Array.isArray(obj[key])).filter(key => key !== 'isSubjectInstance'));
|
|
4980
|
+
}
|
|
4981
|
+
// Collect all set functions of the object in a list
|
|
4982
|
+
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"));
|
|
4983
|
+
// Add all set functions of the object's prototype to that list
|
|
4984
|
+
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")));
|
|
4985
|
+
// Collect all add functions of the object in a list
|
|
4986
|
+
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("add"));
|
|
4987
|
+
// Add all add functions of the object's prototype to that list
|
|
4988
|
+
addFunctions = addFunctions.concat(Object.keys(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("add")));
|
|
4989
|
+
// Collect all remove functions of the object in a list
|
|
4990
|
+
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("remove"));
|
|
4991
|
+
// Add all remove functions of the object's prototype to that list
|
|
4992
|
+
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("remove")));
|
|
4993
|
+
// Collect all add functions of the object in a list
|
|
4994
|
+
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("setCollection"));
|
|
4995
|
+
// Add all add functions of the object's prototype to that list
|
|
4996
|
+
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("setCollection")));
|
|
4997
|
+
// Construct query to find all subject classes that have the given properties and collections
|
|
4998
|
+
let query = `subject_class(Class, C)`;
|
|
4999
|
+
for (let property of properties) {
|
|
5000
|
+
query += `, property(C, "${property}")`;
|
|
5001
|
+
}
|
|
5002
|
+
for (let collection of collections) {
|
|
5003
|
+
query += `, collection(C, "${collection}")`;
|
|
5004
|
+
}
|
|
5005
|
+
for (let setFunction of setFunctions) {
|
|
5006
|
+
// e.g. "setState" -> "state"
|
|
5007
|
+
let property = setFunction.substring(3);
|
|
5008
|
+
property = property.charAt(0).toLowerCase() + property.slice(1);
|
|
5009
|
+
query += `, property_setter(C, "${property}", _)`;
|
|
5010
|
+
}
|
|
5011
|
+
for (let addFunction of addFunctions) {
|
|
5012
|
+
query += `, collection_adder(C, "${collectionAdderToName(addFunction)}", _)`;
|
|
5013
|
+
}
|
|
5014
|
+
for (let removeFunction of removeFunctions) {
|
|
5015
|
+
query += `, collection_remover(C, "${collectionRemoverToName(removeFunction)}", _)`;
|
|
5016
|
+
}
|
|
5017
|
+
for (let setCollectionFunction of setCollectionFunctions) {
|
|
5018
|
+
query += `, collection_setter(C, "${collectionSetterToName(setCollectionFunction)}", _)`;
|
|
5019
|
+
}
|
|
5020
|
+
query += ".";
|
|
5021
|
+
result = query;
|
|
5022
|
+
}(obj));
|
|
5023
|
+
return result;
|
|
5019
5024
|
}
|
|
5020
5025
|
/** Returns all subject classes that match the given template object.
|
|
5021
5026
|
* This function looks at the properties of the template object and
|
|
@@ -368,65 +368,70 @@ export class PerspectiveProxy {
|
|
|
368
368
|
return instances;
|
|
369
369
|
}
|
|
370
370
|
buildQueryFromTemplate(obj) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
query
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
371
|
+
let result;
|
|
372
|
+
// We need to avoid strict mode for the following intropsective code
|
|
373
|
+
(function (obj) {
|
|
374
|
+
// Collect all string properties of the object in a list
|
|
375
|
+
let properties = [];
|
|
376
|
+
// Collect all collections of the object in a list
|
|
377
|
+
let collections = [];
|
|
378
|
+
// Collect all string properties of the object in a list
|
|
379
|
+
if (Object.getPrototypeOf(obj).__properties) {
|
|
380
|
+
Object.keys(Object.getPrototypeOf(obj).__properties).forEach(p => properties.push(p));
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
properties.push(...Object.keys(obj).filter(key => !Array.isArray(obj[key])));
|
|
384
|
+
}
|
|
385
|
+
// Collect all collections of the object in a list
|
|
386
|
+
if (Object.getPrototypeOf(obj).__collections) {
|
|
387
|
+
Object.keys(Object.getPrototypeOf(obj).__collections).filter(key => key !== 'isSubjectInstance').forEach(c => !collections.includes(c) ?? collections.push(c));
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
collections.push(...Object.keys(obj).filter(key => Array.isArray(obj[key])).filter(key => key !== 'isSubjectInstance'));
|
|
391
|
+
}
|
|
392
|
+
// Collect all set functions of the object in a list
|
|
393
|
+
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"));
|
|
394
|
+
// Add all set functions of the object's prototype to that list
|
|
395
|
+
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")));
|
|
396
|
+
// Collect all add functions of the object in a list
|
|
397
|
+
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("add"));
|
|
398
|
+
// Add all add functions of the object's prototype to that list
|
|
399
|
+
addFunctions = addFunctions.concat(Object.keys(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("add")));
|
|
400
|
+
// Collect all remove functions of the object in a list
|
|
401
|
+
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("remove"));
|
|
402
|
+
// Add all remove functions of the object's prototype to that list
|
|
403
|
+
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("remove")));
|
|
404
|
+
// Collect all add functions of the object in a list
|
|
405
|
+
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("setCollection"));
|
|
406
|
+
// Add all add functions of the object's prototype to that list
|
|
407
|
+
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("setCollection")));
|
|
408
|
+
// Construct query to find all subject classes that have the given properties and collections
|
|
409
|
+
let query = `subject_class(Class, C)`;
|
|
410
|
+
for (let property of properties) {
|
|
411
|
+
query += `, property(C, "${property}")`;
|
|
412
|
+
}
|
|
413
|
+
for (let collection of collections) {
|
|
414
|
+
query += `, collection(C, "${collection}")`;
|
|
415
|
+
}
|
|
416
|
+
for (let setFunction of setFunctions) {
|
|
417
|
+
// e.g. "setState" -> "state"
|
|
418
|
+
let property = setFunction.substring(3);
|
|
419
|
+
property = property.charAt(0).toLowerCase() + property.slice(1);
|
|
420
|
+
query += `, property_setter(C, "${property}", _)`;
|
|
421
|
+
}
|
|
422
|
+
for (let addFunction of addFunctions) {
|
|
423
|
+
query += `, collection_adder(C, "${collectionAdderToName(addFunction)}", _)`;
|
|
424
|
+
}
|
|
425
|
+
for (let removeFunction of removeFunctions) {
|
|
426
|
+
query += `, collection_remover(C, "${collectionRemoverToName(removeFunction)}", _)`;
|
|
427
|
+
}
|
|
428
|
+
for (let setCollectionFunction of setCollectionFunctions) {
|
|
429
|
+
query += `, collection_setter(C, "${collectionSetterToName(setCollectionFunction)}", _)`;
|
|
430
|
+
}
|
|
431
|
+
query += ".";
|
|
432
|
+
result = query;
|
|
433
|
+
}(obj));
|
|
434
|
+
return result;
|
|
430
435
|
}
|
|
431
436
|
/** Returns all subject classes that match the given template object.
|
|
432
437
|
* This function looks at the properties of the template object and
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
|
|
11
11
|
"buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@types/yargs": "*"
|
|
61
61
|
},
|
|
62
62
|
"patchedDependencies": {},
|
|
63
|
-
"version": "0.10.0-rc6",
|
|
63
|
+
"version": "0.10.0-rc6.fix2",
|
|
64
64
|
"pnpm": {
|
|
65
65
|
"patchedDependencies": {
|
|
66
66
|
"graphql@15.7.2": "patches/graphql@15.7.2.patch"
|
|
@@ -432,78 +432,81 @@ export class PerspectiveProxy {
|
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
private buildQueryFromTemplate(obj: object): string {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
Object.keys(Object.getPrototypeOf(obj).__collections).filter(key => key !== 'isSubjectInstance').forEach(c => !collections.includes(c) ?? collections.push(c))
|
|
451
|
-
} else {
|
|
452
|
-
collections.push(...Object.keys(obj).filter(key => Array.isArray(obj[key])).filter(key => key !== 'isSubjectInstance'))
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// Collect all set functions of the object in a list
|
|
456
|
-
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"))
|
|
457
|
-
// Add all set functions of the object's prototype to that list
|
|
458
|
-
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")))
|
|
435
|
+
let result
|
|
436
|
+
// We need to avoid strict mode for the following intropsective code
|
|
437
|
+
(function(obj) {
|
|
438
|
+
// Collect all string properties of the object in a list
|
|
439
|
+
let properties = []
|
|
440
|
+
|
|
441
|
+
// Collect all collections of the object in a list
|
|
442
|
+
let collections = []
|
|
443
|
+
|
|
444
|
+
// Collect all string properties of the object in a list
|
|
445
|
+
if(Object.getPrototypeOf(obj).__properties) {
|
|
446
|
+
Object.keys(Object.getPrototypeOf(obj).__properties).forEach(p => properties.push(p))
|
|
447
|
+
} else {
|
|
448
|
+
properties.push(...Object.keys(obj).filter(key => !Array.isArray(obj[key])))
|
|
449
|
+
}
|
|
459
450
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
451
|
+
// Collect all collections of the object in a list
|
|
452
|
+
if (Object.getPrototypeOf(obj).__collections) {
|
|
453
|
+
Object.keys(Object.getPrototypeOf(obj).__collections).filter(key => key !== 'isSubjectInstance').forEach(c => !collections.includes(c) ?? collections.push(c))
|
|
454
|
+
} else {
|
|
455
|
+
collections.push(...Object.keys(obj).filter(key => Array.isArray(obj[key])).filter(key => key !== 'isSubjectInstance'))
|
|
456
|
+
}
|
|
464
457
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
458
|
+
// Collect all set functions of the object in a list
|
|
459
|
+
let setFunctions = Object.getOwnPropertyNames(obj).filter(key => (typeof obj[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection"))
|
|
460
|
+
// Add all set functions of the object's prototype to that list
|
|
461
|
+
setFunctions = setFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("set") && !key.startsWith("setCollection")))
|
|
469
462
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
463
|
+
// Collect all add functions of the object in a list
|
|
464
|
+
let addFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("add"))
|
|
465
|
+
// Add all add functions of the object's prototype to that list
|
|
466
|
+
addFunctions = addFunctions.concat(Object.keys(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("add")))
|
|
474
467
|
|
|
475
|
-
|
|
476
|
-
|
|
468
|
+
// Collect all remove functions of the object in a list
|
|
469
|
+
let removeFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("remove"))
|
|
470
|
+
// Add all remove functions of the object's prototype to that list
|
|
471
|
+
removeFunctions = removeFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("remove")))
|
|
477
472
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
query += `, collection(C, "${collection}")`
|
|
483
|
-
}
|
|
473
|
+
// Collect all add functions of the object in a list
|
|
474
|
+
let setCollectionFunctions = Object.getOwnPropertyNames(obj).filter(key => (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === "function") && key.startsWith("setCollection"))
|
|
475
|
+
// Add all add functions of the object's prototype to that list
|
|
476
|
+
setCollectionFunctions = setCollectionFunctions.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(key => (Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(obj), key) && typeof Object.getPrototypeOf(obj)[key] === "function") && key.startsWith("setCollection")))
|
|
484
477
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
let property = setFunction.substring(3)
|
|
488
|
-
property = property.charAt(0).toLowerCase() + property.slice(1)
|
|
489
|
-
query += `, property_setter(C, "${property}", _)`
|
|
490
|
-
}
|
|
491
|
-
for(let addFunction of addFunctions) {
|
|
492
|
-
query += `, collection_adder(C, "${collectionAdderToName(addFunction)}", _)`
|
|
493
|
-
}
|
|
478
|
+
// Construct query to find all subject classes that have the given properties and collections
|
|
479
|
+
let query = `subject_class(Class, C)`
|
|
494
480
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
481
|
+
for(let property of properties) {
|
|
482
|
+
query += `, property(C, "${property}")`
|
|
483
|
+
}
|
|
484
|
+
for(let collection of collections) {
|
|
485
|
+
query += `, collection(C, "${collection}")`
|
|
486
|
+
}
|
|
498
487
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
488
|
+
for(let setFunction of setFunctions) {
|
|
489
|
+
// e.g. "setState" -> "state"
|
|
490
|
+
let property = setFunction.substring(3)
|
|
491
|
+
property = property.charAt(0).toLowerCase() + property.slice(1)
|
|
492
|
+
query += `, property_setter(C, "${property}", _)`
|
|
493
|
+
}
|
|
494
|
+
for(let addFunction of addFunctions) {
|
|
495
|
+
query += `, collection_adder(C, "${collectionAdderToName(addFunction)}", _)`
|
|
496
|
+
}
|
|
502
497
|
|
|
498
|
+
for(let removeFunction of removeFunctions) {
|
|
499
|
+
query += `, collection_remover(C, "${collectionRemoverToName(removeFunction)}", _)`
|
|
500
|
+
}
|
|
503
501
|
|
|
504
|
-
|
|
502
|
+
for(let setCollectionFunction of setCollectionFunctions) {
|
|
503
|
+
query += `, collection_setter(C, "${collectionSetterToName(setCollectionFunction)}", _)`
|
|
504
|
+
}
|
|
505
505
|
|
|
506
|
-
|
|
506
|
+
query += "."
|
|
507
|
+
result = query
|
|
508
|
+
}(obj))
|
|
509
|
+
return result
|
|
507
510
|
}
|
|
508
511
|
|
|
509
512
|
/** Returns all subject classes that match the given template object.
|
package/yarn-error.log
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Arguments:
|
|
2
|
+
/Users/nicolasluck/.nvm/versions/node/v18.16.1/bin/node /Users/nicolasluck/.nvm/versions/node/v18.16.1/bin/yarn install
|
|
3
|
+
|
|
4
|
+
PATH:
|
|
5
|
+
/Users/nicolasluck/Library/pnpm:/Users/nicolasluck/.nvm/versions/node/v18.16.1/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/Users/nicolasluck/.cargo/bin
|
|
6
|
+
|
|
7
|
+
Yarn version:
|
|
8
|
+
1.22.19
|
|
9
|
+
|
|
10
|
+
Node version:
|
|
11
|
+
18.16.1
|
|
12
|
+
|
|
13
|
+
Platform:
|
|
14
|
+
darwin arm64
|
|
15
|
+
|
|
16
|
+
Trace:
|
|
17
|
+
Error: ENOENT: no such file or directory, copyfile '/Users/nicolasluck/Library/Caches/Yarn/v6/npm-has-flag-3.0.0-b5d454dc2199ae225699f3467e5a07f3b955bafd-integrity/node_modules/has-flag/index.js' -> '/Users/nicolasluck/Coasys/code/ad4m/node_modules/@changesets/cli/node_modules/has-flag/index.js'
|
|
18
|
+
|
|
19
|
+
npm manifest:
|
|
20
|
+
{
|
|
21
|
+
"name": "@coasys/ad4m",
|
|
22
|
+
"description": "*The Agent-Centric Distributed Application Meta-ontology* or just: *Agent-Centric DApp Meta-ontology* * A new meta-ontology for interoperable, decentralized application design * A spanning-layer to enable seamless integration between Holochain DNAs, blockchains, linked-data structures/ontologies and centralized back-ends * The basis for turning distinct, monolithic and siloed apps into a global, open and interoperable sense-making network",
|
|
23
|
+
"main": "lib/index.cjs",
|
|
24
|
+
"module": "lib/index.js",
|
|
25
|
+
"types": "lib/src/index.d.ts",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"private": true,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
|
|
30
|
+
"buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
|
|
31
|
+
"bundle": "rollup -c rollup.config.js",
|
|
32
|
+
"test": "jest --forceExit"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/perspect3vism/ad4m.git"
|
|
37
|
+
},
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Nicolas Luck",
|
|
40
|
+
"email": "nicolas@lucksus.eu"
|
|
41
|
+
},
|
|
42
|
+
"contributors": [
|
|
43
|
+
{
|
|
44
|
+
"name": "Joshua Parkin",
|
|
45
|
+
"email": "joshuadparkin@gmail.com"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"license": "CAL-1.0",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/perspect3vism/ad4m/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://ad4m.dev",
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@apollo/client": "3.7.10",
|
|
55
|
+
"@holochain/client": "0.16.0",
|
|
56
|
+
"@types/jest": "^26.0.14",
|
|
57
|
+
"class-validator": "^0.13.1",
|
|
58
|
+
"express": "4.18.2",
|
|
59
|
+
"graphql": "15.7.2",
|
|
60
|
+
"reflect-metadata": "^0.1.13",
|
|
61
|
+
"type-graphql": "1.1.1"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@apollo/server": "^4.9.4",
|
|
65
|
+
"@rollup/plugin-alias": "^3.1.5",
|
|
66
|
+
"@rollup/plugin-commonjs": "^20.0.0",
|
|
67
|
+
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
68
|
+
"concat-md": "^0.5.0",
|
|
69
|
+
"cross-fetch": "^3.1.4",
|
|
70
|
+
"graphql-ws": "5.12.0",
|
|
71
|
+
"honkit": "^4.0.0",
|
|
72
|
+
"jest": "^26.6.0",
|
|
73
|
+
"patch-package": "^8.0.0",
|
|
74
|
+
"rollup": "^2.56.3",
|
|
75
|
+
"ts-jest": "^26.5.6",
|
|
76
|
+
"typescript": "^4.6.2",
|
|
77
|
+
"ws": "8.13.0",
|
|
78
|
+
"@types/node": "*",
|
|
79
|
+
"@types/yargs": "*"
|
|
80
|
+
},
|
|
81
|
+
"patchedDependencies": {},
|
|
82
|
+
"version": "0.9.1-prerelease"
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
yarn manifest:
|
|
87
|
+
No manifest
|
|
88
|
+
|
|
89
|
+
Lockfile:
|
|
90
|
+
No lockfile
|