@semapps/ontologies 1.1.3 → 1.2.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.
Files changed (102) hide show
  1. package/actions/{findNamespace.js → findNamespace.ts} +7 -3
  2. package/actions/{findPrefix.js → findPrefix.ts} +8 -4
  3. package/actions/{get.js → get.ts} +8 -2
  4. package/actions/getPrefixes.ts +16 -0
  5. package/actions/getRdfPrefixes.ts +15 -0
  6. package/actions/list.ts +11 -0
  7. package/actions/{prefixToUri.js → prefixToUri.ts} +8 -3
  8. package/actions/{register.js → register.ts} +11 -3
  9. package/dist/actions/findNamespace.d.ts +10 -0
  10. package/dist/actions/findNamespace.js +19 -0
  11. package/dist/actions/findNamespace.js.map +1 -0
  12. package/dist/actions/findPrefix.d.ts +10 -0
  13. package/dist/actions/findPrefix.js +23 -0
  14. package/dist/actions/findPrefix.js.map +1 -0
  15. package/dist/actions/get.d.ts +22 -0
  16. package/dist/actions/get.js +34 -0
  17. package/dist/actions/get.js.map +1 -0
  18. package/dist/actions/getPrefixes.d.ts +10 -0
  19. package/dist/actions/getPrefixes.js +12 -0
  20. package/dist/actions/getPrefixes.js.map +1 -0
  21. package/dist/actions/getRdfPrefixes.d.ts +8 -0
  22. package/dist/actions/getRdfPrefixes.js +13 -0
  23. package/dist/actions/getRdfPrefixes.js.map +1 -0
  24. package/dist/actions/list.d.ts +6 -0
  25. package/dist/actions/list.js +9 -0
  26. package/dist/actions/list.js.map +1 -0
  27. package/dist/actions/prefixToUri.d.ts +11 -0
  28. package/dist/actions/prefixToUri.js +27 -0
  29. package/dist/actions/prefixToUri.js.map +1 -0
  30. package/dist/actions/register.d.ts +34 -0
  31. package/dist/actions/register.js +59 -0
  32. package/dist/actions/register.js.map +1 -0
  33. package/dist/index.d.ts +7 -0
  34. package/dist/index.js +8 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/ontologies/core/acl.json +28 -0
  37. package/dist/ontologies/core/as.json +6 -0
  38. package/dist/ontologies/core/cred.json +22 -0
  39. package/dist/ontologies/core/dc.json +19 -0
  40. package/dist/ontologies/core/did.json +19 -0
  41. package/dist/ontologies/core/foaf.json +4 -0
  42. package/dist/ontologies/core/index.d.ts +16 -0
  43. package/dist/ontologies/core/index.js +17 -0
  44. package/dist/ontologies/core/index.js.map +1 -0
  45. package/dist/ontologies/core/ldp.json +4 -0
  46. package/dist/ontologies/core/rdf.json +4 -0
  47. package/dist/ontologies/core/rdfs.json +7 -0
  48. package/dist/ontologies/core/sec.json +88 -0
  49. package/dist/ontologies/core/semapps.json +12 -0
  50. package/dist/ontologies/core/skos.json +4 -0
  51. package/dist/ontologies/core/vcard.json +15 -0
  52. package/dist/ontologies/core/void.json +23 -0
  53. package/dist/ontologies/core/xsd.json +4 -0
  54. package/dist/ontologies/custom/index.d.ts +10 -0
  55. package/dist/ontologies/custom/index.js +11 -0
  56. package/dist/ontologies/custom/index.js.map +1 -0
  57. package/dist/ontologies/custom/mp.json +4 -0
  58. package/dist/ontologies/custom/oasis.json +4 -0
  59. package/dist/ontologies/custom/og.json +13 -0
  60. package/dist/ontologies/custom/pair.json +329 -0
  61. package/dist/ontologies/custom/petr.json +4 -0
  62. package/dist/ontologies/custom/schema.json +4 -0
  63. package/dist/ontologies/custom/skos.json +13 -0
  64. package/dist/ontologies/custom/syreen.json +43 -0
  65. package/dist/ontologies/custom/tutor.json +26 -0
  66. package/dist/ontologies/solid/apods.json +79 -0
  67. package/dist/ontologies/solid/index.d.ts +7 -0
  68. package/dist/ontologies/solid/index.js +8 -0
  69. package/dist/ontologies/solid/index.js.map +1 -0
  70. package/dist/ontologies/solid/interop.json +124 -0
  71. package/dist/ontologies/solid/notify.json +62 -0
  72. package/dist/ontologies/solid/oidc.json +22 -0
  73. package/dist/ontologies/solid/pim.json +15 -0
  74. package/dist/ontologies/solid/solid.json +27 -0
  75. package/dist/service.d.ts +126 -0
  76. package/dist/service.js +56 -0
  77. package/dist/service.js.map +1 -0
  78. package/dist/sub-services/registry.d.ts +40 -0
  79. package/dist/sub-services/registry.js +52 -0
  80. package/dist/sub-services/registry.js.map +1 -0
  81. package/dist/tsconfig.tsbuildinfo +1 -0
  82. package/dist/utils.d.ts +3 -0
  83. package/dist/utils.js +15 -0
  84. package/dist/utils.js.map +1 -0
  85. package/index.ts +9 -0
  86. package/ontologies/core/index.ts +34 -0
  87. package/ontologies/custom/index.ts +11 -0
  88. package/ontologies/solid/index.ts +8 -0
  89. package/ontologies/solid/interop.json +12 -0
  90. package/package.json +12 -5
  91. package/{service.js → service.ts} +25 -13
  92. package/sub-services/registry.ts +66 -0
  93. package/tsconfig.json +10 -0
  94. package/{utils.js → utils.ts} +3 -7
  95. package/actions/getPrefixes.js +0 -12
  96. package/actions/getRdfPrefixes.js +0 -11
  97. package/actions/list.js +0 -7
  98. package/index.js +0 -16
  99. package/ontologies/core/index.js +0 -17
  100. package/ontologies/custom/index.js +0 -11
  101. package/ontologies/solid/index.js +0 -8
  102. package/sub-services/registry.js +0 -44
@@ -0,0 +1,52 @@
1
+ import DbService from 'moleculer-db';
2
+ import { TripleStoreAdapter } from '@semapps/triplestore';
3
+ const OntologiesRegistrySchema = {
4
+ name: 'ontologies.registry',
5
+ mixins: [DbService],
6
+ adapter: new TripleStoreAdapter({ type: 'Ontology', dataset: 'settings' }),
7
+ settings: {
8
+ idField: '@id'
9
+ },
10
+ actions: {
11
+ getByPrefix: {
12
+ async handler(ctx) {
13
+ const { prefix } = ctx.params;
14
+ const [ontology] = await this._find(ctx, { query: { prefix } });
15
+ return ontology && { prefix: ontology.prefix, namespace: ontology.namespace };
16
+ }
17
+ },
18
+ getByNamespace: {
19
+ async handler(ctx) {
20
+ const { namespace } = ctx.params;
21
+ const [ontology] = await this._find(ctx, { query: { namespace } });
22
+ return ontology && { prefix: ontology.prefix, namespace: ontology.namespace };
23
+ }
24
+ },
25
+ list: {
26
+ async handler(ctx) {
27
+ const ontologies = await this._list(ctx, {});
28
+ return ontologies.rows.map(({ prefix, namespace }) => ({ prefix, namespace }));
29
+ }
30
+ },
31
+ updateOrCreate: {
32
+ async handler(ctx) {
33
+ const { prefix, namespace } = ctx.params;
34
+ const ontology = await this.actions.getByPrefix({ prefix }, { parentCtx: ctx });
35
+ if (ontology) {
36
+ await this._update(ctx, {
37
+ '@id': ontology['@id'],
38
+ namespace
39
+ });
40
+ }
41
+ else {
42
+ await this._create(ctx, {
43
+ prefix,
44
+ namespace
45
+ });
46
+ }
47
+ }
48
+ }
49
+ }
50
+ };
51
+ export default OntologiesRegistrySchema;
52
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../sub-services/registry.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,wBAAwB,GAAG;IAC/B,IAAI,EAAE,qBAA8B;IACpC,MAAM,EAAE,CAAC,SAAS,CAAC;IACnB,OAAO,EAAE,IAAI,kBAAkB,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAC1E,QAAQ,EAAE;QACR,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,WAAW,EAAE;YACX,KAAK,CAAC,OAAO,CAAC,GAAG;gBACf,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;gBAC9B,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;gBAChE,OAAO,QAAQ,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;YAChF,CAAC;SACF;QAED,cAAc,EAAE;YACd,KAAK,CAAC,OAAO,CAAC,GAAG;gBACf,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;gBACjC,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBACnE,OAAO,QAAQ,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;YAChF,CAAC;SACF;QAED,IAAI,EAAE;YACJ,KAAK,CAAC,OAAO,CAAC,GAAG;gBACf,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAO,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;YACtF,CAAC;SACF;QAED,cAAc,EAAE;YACd,KAAK,CAAC,OAAO,CAAC,GAAG;gBACf,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;gBAEzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;gBAEhF,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;wBACtB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;wBACtB,SAAS;qBACV,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;wBACtB,MAAM;wBACN,SAAS;qBACV,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF;KACF;CACsB,CAAC;AAE1B,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ {"root":["../index.ts","../service.ts","../utils.ts"],"errors":true,"version":"5.9.2"}
@@ -0,0 +1,3 @@
1
+ declare const arrayOf: (value: any) => any[];
2
+ declare const isURL: (value: any) => boolean;
3
+ export { arrayOf, isURL };
package/dist/utils.js ADDED
@@ -0,0 +1,15 @@
1
+ const arrayOf = (value) => {
2
+ // If the field is null-ish, we suppose there are no values.
3
+ if (value === null || value === undefined) {
4
+ return [];
5
+ }
6
+ // Return as is.
7
+ if (Array.isArray(value)) {
8
+ return value;
9
+ }
10
+ // Single value is made an array.
11
+ return [value];
12
+ };
13
+ const isURL = (value) => (typeof value === 'string' || value instanceof String) && value.startsWith('http');
14
+ export { arrayOf, isURL };
15
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,CAAC,KAAU,EAAE,EAAE;IAC7B,4DAA4D;IAC5D,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,gBAAgB;IAChB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,iCAAiC;IACjC,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACjH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/index.ts ADDED
@@ -0,0 +1,9 @@
1
+ import OntologiesService from './service.ts';
2
+ import OntologiesRegistryService from './sub-services/registry.ts';
3
+
4
+ export { OntologiesService, OntologiesRegistryService };
5
+
6
+ export * from './ontologies/core/index.ts';
7
+ export * from './ontologies/solid/index.ts';
8
+ export * from './ontologies/custom/index.ts';
9
+ export { skos } from './ontologies/core/index.ts';
@@ -0,0 +1,34 @@
1
+ import acl from './acl.json' with { type: 'json' };
2
+ import as from './as.json' with { type: 'json' };
3
+ import cred from './cred.json' with { type: 'json' };
4
+ import dc from './dc.json' with { type: 'json' };
5
+ import did from './did.json' with { type: 'json' };
6
+ import foaf from './foaf.json' with { type: 'json' };
7
+ import ldp from './ldp.json' with { type: 'json' };
8
+ import rdf from './rdf.json' with { type: 'json' };
9
+ import rdfs from './rdfs.json' with { type: 'json' };
10
+ import sec from './sec.json' with { type: 'json' };
11
+ import semapps from './semapps.json' with { type: 'json' };
12
+ import skos from './skos.json' with { type: 'json' };
13
+ import vcard from './vcard.json' with { type: 'json' };
14
+ import voidOntology from './void.json' with { type: 'json' };
15
+ import xsd from './xsd.json' with { type: 'json' };
16
+
17
+ export {
18
+ acl,
19
+ as,
20
+ cred,
21
+ dc,
22
+ did,
23
+ foaf,
24
+ ldp,
25
+ rdf,
26
+ rdfs,
27
+ sec,
28
+ semapps,
29
+ skos,
30
+ vcard,
31
+ voidOntology as void,
32
+ xsd,
33
+ voidOntology
34
+ };
@@ -0,0 +1,11 @@
1
+ import mp from './mp.json' with { type: 'json' };
2
+ import oasis from './oasis.json' with { type: 'json' };
3
+ import og from './og.json' with { type: 'json' };
4
+ import pair from './pair.json' with { type: 'json' };
5
+ import petr from './petr.json' with { type: 'json' };
6
+ import schema from './schema.json' with { type: 'json' };
7
+ import skos from './skos.json' with { type: 'json' };
8
+ import syreen from './syreen.json' with { type: 'json' };
9
+ import tutor from './tutor.json' with { type: 'json' };
10
+
11
+ export { mp, oasis, og, pair, petr, schema, skos, syreen, tutor };
@@ -0,0 +1,8 @@
1
+ import apods from './apods.json' with { type: 'json' };
2
+ import interop from './interop.json' with { type: 'json' };
3
+ import notify from './notify.json' with { type: 'json' };
4
+ import oidc from './oidc.json' with { type: 'json' };
5
+ import pim from './pim.json' with { type: 'json' };
6
+ import solid from './solid.json' with { type: 'json' };
7
+
8
+ export { apods, interop, notify, oidc, pim, solid };
@@ -12,6 +12,9 @@
12
12
  "interop:accessScenario": {
13
13
  "@type": "@id"
14
14
  },
15
+ "interop:preferredScope": {
16
+ "@type": "@id"
17
+ },
15
18
  "interop:applicationAuthor": {
16
19
  "@type": "@id"
17
20
  },
@@ -33,6 +36,9 @@
33
36
  "interop:grantee": {
34
37
  "@type": "@id"
35
38
  },
39
+ "interop:granteeType": {
40
+ "@type": "@id"
41
+ },
36
42
  "interop:hasAccessAuthorization": {
37
43
  "@type": "@id"
38
44
  },
@@ -107,6 +113,12 @@
107
113
  },
108
114
  "interop:delegationOfGrant": {
109
115
  "@type": "@id"
116
+ },
117
+ "interop:reciprocalRegistration": {
118
+ "@type": "@id"
119
+ },
120
+ "interop:replaces": {
121
+ "@type": "@id"
110
122
  }
111
123
  }
112
124
  }
package/package.json CHANGED
@@ -1,19 +1,26 @@
1
1
  {
2
2
  "name": "@semapps/ontologies",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "SemApps ontologies",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Virtual Assembly",
7
7
  "dependencies": {
8
- "@semapps/triplestore": "1.1.3",
8
+ "@semapps/triplestore": "1.2.0",
9
9
  "moleculer-db": "^0.8.16",
10
10
  "node-fetch": "^2.6.6"
11
11
  },
12
12
  "publishConfig": {
13
- "access": "public"
13
+ "access": "public",
14
+ "main": "./dist/index.js"
14
15
  },
15
16
  "engines": {
16
- "node": ">=14"
17
+ "node": ">=22.10.0"
17
18
  },
18
- "gitHead": "cc54d6fb548a7c34d3007d159b31145a5f509898"
19
+ "type": "module",
20
+ "main": "./dist/index.js",
21
+ "peerDependencies": {
22
+ "moleculer": "^0.14.35"
23
+ },
24
+ "gitHead": "b2d4edd4ace7346c2452cc8831cb30888afda3a9",
25
+ "xDevMain": "./index.ts"
19
26
  }
@@ -1,16 +1,17 @@
1
- const { TripleStoreAdapter } = require('@semapps/triplestore');
2
- const OntologiesRegistryService = require('./sub-services/registry');
3
- const findPrefixAction = require('./actions/findPrefix');
4
- const findNamespaceAction = require('./actions/findNamespace');
5
- const getAction = require('./actions/get');
6
- const getPrefixesAction = require('./actions/getPrefixes');
7
- const getRdfPrefixesAction = require('./actions/getRdfPrefixes');
8
- const listAction = require('./actions/list');
9
- const prefixToUriAction = require('./actions/prefixToUri');
10
- const registerAction = require('./actions/register');
1
+ import { TripleStoreAdapter } from '@semapps/triplestore';
2
+ import { ServiceSchema } from 'moleculer';
3
+ import OntologiesRegistryService from './sub-services/registry.ts';
4
+ import findPrefixAction from './actions/findPrefix.ts';
5
+ import findNamespaceAction from './actions/findNamespace.ts';
6
+ import getAction from './actions/get.ts';
7
+ import getPrefixesAction from './actions/getPrefixes.ts';
8
+ import getRdfPrefixesAction from './actions/getRdfPrefixes.ts';
9
+ import listAction from './actions/list.ts';
10
+ import prefixToUriAction from './actions/prefixToUri.ts';
11
+ import registerAction from './actions/register.ts';
11
12
 
12
- module.exports = {
13
- name: 'ontologies',
13
+ const OntologiesSchema = {
14
+ name: 'ontologies' as const,
14
15
  settings: {
15
16
  ontologies: [],
16
17
  persistRegistry: false,
@@ -19,6 +20,7 @@ module.exports = {
19
20
  async created() {
20
21
  const { persistRegistry, settingsDataset } = this.settings;
21
22
  if (persistRegistry) {
23
+ // @ts-expect-error TS(2345): Argument of type '{ mixins: { name: "ontologies.re... Remove this comment to see the full error message
22
24
  this.broker.createService({
23
25
  mixins: [OntologiesRegistryService],
24
26
  adapter: new TripleStoreAdapter({ type: 'Ontology', dataset: settingsDataset })
@@ -51,4 +53,14 @@ module.exports = {
51
53
  }
52
54
  }
53
55
  }
54
- };
56
+ } satisfies ServiceSchema;
57
+
58
+ export default OntologiesSchema;
59
+
60
+ declare global {
61
+ export namespace Moleculer {
62
+ export interface AllServices {
63
+ [OntologiesSchema.name]: typeof OntologiesSchema;
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,66 @@
1
+ import DbService from 'moleculer-db';
2
+ import { TripleStoreAdapter } from '@semapps/triplestore';
3
+ import { ServiceSchema } from 'moleculer';
4
+
5
+ const OntologiesRegistrySchema = {
6
+ name: 'ontologies.registry' as const,
7
+ mixins: [DbService],
8
+ adapter: new TripleStoreAdapter({ type: 'Ontology', dataset: 'settings' }),
9
+ settings: {
10
+ idField: '@id'
11
+ },
12
+ actions: {
13
+ getByPrefix: {
14
+ async handler(ctx) {
15
+ const { prefix } = ctx.params;
16
+ const [ontology] = await this._find(ctx, { query: { prefix } });
17
+ return ontology && { prefix: ontology.prefix, namespace: ontology.namespace };
18
+ }
19
+ },
20
+
21
+ getByNamespace: {
22
+ async handler(ctx) {
23
+ const { namespace } = ctx.params;
24
+ const [ontology] = await this._find(ctx, { query: { namespace } });
25
+ return ontology && { prefix: ontology.prefix, namespace: ontology.namespace };
26
+ }
27
+ },
28
+
29
+ list: {
30
+ async handler(ctx) {
31
+ const ontologies = await this._list(ctx, {});
32
+ return ontologies.rows.map(({ prefix, namespace }: any) => ({ prefix, namespace }));
33
+ }
34
+ },
35
+
36
+ updateOrCreate: {
37
+ async handler(ctx) {
38
+ const { prefix, namespace } = ctx.params;
39
+
40
+ const ontology = await this.actions.getByPrefix({ prefix }, { parentCtx: ctx });
41
+
42
+ if (ontology) {
43
+ await this._update(ctx, {
44
+ '@id': ontology['@id'],
45
+ namespace
46
+ });
47
+ } else {
48
+ await this._create(ctx, {
49
+ prefix,
50
+ namespace
51
+ });
52
+ }
53
+ }
54
+ }
55
+ }
56
+ } satisfies ServiceSchema;
57
+
58
+ export default OntologiesRegistrySchema;
59
+
60
+ declare global {
61
+ export namespace Moleculer {
62
+ export interface AllServices {
63
+ [OntologiesRegistrySchema.name]: typeof OntologiesRegistrySchema;
64
+ }
65
+ }
66
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": false,
5
+ "rewriteRelativeImportExtensions": true,
6
+ "outDir": "dist",
7
+ "rootDir": "./"
8
+ },
9
+ "include": ["*"]
10
+ }
@@ -1,4 +1,4 @@
1
- const arrayOf = value => {
1
+ const arrayOf = (value: any) => {
2
2
  // If the field is null-ish, we suppose there are no values.
3
3
  if (value === null || value === undefined) {
4
4
  return [];
@@ -11,9 +11,5 @@ const arrayOf = value => {
11
11
  return [value];
12
12
  };
13
13
 
14
- const isURL = value => (typeof value === 'string' || value instanceof String) && value.startsWith('http');
15
-
16
- module.exports = {
17
- arrayOf,
18
- isURL
19
- };
14
+ const isURL = (value: any) => (typeof value === 'string' || value instanceof String) && value.startsWith('http');
15
+ export { arrayOf, isURL };
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- visibility: 'public',
3
- cache: true,
4
- async handler(ctx) {
5
- const ontologies = await this.actions.list({}, { parentCtx: ctx });
6
- return Object.fromEntries(
7
- ontologies
8
- .sort((a, b) => (a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0))
9
- .map(ontology => [ontology.prefix, ontology.namespace])
10
- );
11
- }
12
- };
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- visibility: 'public',
3
- cache: true,
4
- async handler(ctx) {
5
- const ontologies = await this.actions.list({}, { parentCtx: ctx });
6
- return ontologies
7
- .sort((a, b) => (a.prefix < b.prefix ? -1 : a.prefix > b.prefix ? 1 : 0))
8
- .map(ontology => `PREFIX ${ontology.prefix}: <${ontology.namespace}>`)
9
- .join('\n');
10
- }
11
- };
package/actions/list.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- visibility: 'public',
3
- cache: true,
4
- handler() {
5
- return Object.values(this.ontologies);
6
- }
7
- };
package/index.js DELETED
@@ -1,16 +0,0 @@
1
- const OntologiesService = require('./service');
2
- const OntologiesRegistryService = require('./sub-services/registry');
3
- const coreOntologies = require('./ontologies/core');
4
- const customOntologies = require('./ontologies/custom');
5
- const solidOntologies = require('./ontologies/solid');
6
-
7
- module.exports = {
8
- OntologiesService,
9
- OntologiesRegistryService,
10
- coreOntologies: Object.values(coreOntologies),
11
- solidOntologies: Object.values(solidOntologies),
12
- customOntologies: Object.values(customOntologies),
13
- ...coreOntologies,
14
- ...solidOntologies,
15
- ...customOntologies
16
- };
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- acl: require('./acl.json'),
3
- as: require('./as.json'),
4
- cred: require('./cred.json'),
5
- dc: require('./dc.json'),
6
- did: require('./did.json'),
7
- foaf: require('./foaf.json'),
8
- ldp: require('./ldp.json'),
9
- rdf: require('./rdf.json'),
10
- rdfs: require('./rdfs.json'),
11
- sec: require('./sec.json'),
12
- semapps: require('./semapps.json'),
13
- skos: require('./skos.json'),
14
- vcard: require('./vcard.json'),
15
- void: require('./void.json'),
16
- xsd: require('./xsd.json')
17
- };
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- mp: require('./mp.json'),
3
- oasis: require('./oasis.json'),
4
- og: require('./og.json'),
5
- pair: require('./pair.json'),
6
- petr: require('./petr.json'),
7
- schema: require('./schema.json'),
8
- skos: require('./skos.json'),
9
- syreen: require('./syreen.json'),
10
- tutor: require('./tutor.json')
11
- };
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- apods: require('./apods.json'),
3
- interop: require('./interop.json'),
4
- notify: require('./notify.json'),
5
- oidc: require('./oidc.json'),
6
- pim: require('./pim.json'),
7
- solid: require('./solid.json')
8
- };
@@ -1,44 +0,0 @@
1
- const DbService = require('moleculer-db');
2
- const { TripleStoreAdapter } = require('@semapps/triplestore');
3
-
4
- module.exports = {
5
- name: 'ontologies.registry',
6
- mixins: [DbService],
7
- adapter: new TripleStoreAdapter({ type: 'Ontology', dataset: 'settings' }),
8
- settings: {
9
- idField: '@id'
10
- },
11
- actions: {
12
- async getByPrefix(ctx) {
13
- const { prefix } = ctx.params;
14
- const [ontology] = await this._find(ctx, { query: { prefix } });
15
- return ontology && { prefix: ontology.prefix, namespace: ontology.namespace };
16
- },
17
- async getByNamespace(ctx) {
18
- const { namespace } = ctx.params;
19
- const [ontology] = await this._find(ctx, { query: { namespace } });
20
- return ontology && { prefix: ontology.prefix, namespace: ontology.namespace };
21
- },
22
- async list(ctx) {
23
- const ontologies = await this._list(ctx, {});
24
- return ontologies.rows.map(({ prefix, namespace }) => ({ prefix, namespace }));
25
- },
26
- async updateOrCreate(ctx) {
27
- const { prefix, namespace } = ctx.params;
28
-
29
- const ontology = await this.actions.getByPrefix({ prefix }, { parentCtx: ctx });
30
-
31
- if (ontology) {
32
- await this._update(ctx, {
33
- '@id': ontology['@id'],
34
- namespace
35
- });
36
- } else {
37
- await this._create(ctx, {
38
- prefix,
39
- namespace
40
- });
41
- }
42
- }
43
- }
44
- };