From 16e13fa142e52681dc5f1ec74d3708d8f13fc89b Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Thu, 25 Jul 2024 14:24:26 +0200 Subject: [PATCH] refactor: export Resolver interface (#43) --- node/thing-model/package-lock.json | 8 ++++---- node/thing-model/package.json | 2 +- node/thing-model/src/resolver-interface.ts | 18 ++++++++++++++++++ node/thing-model/src/tm-helpers.ts | 5 +---- 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 node/thing-model/src/resolver-interface.ts diff --git a/node/thing-model/package-lock.json b/node/thing-model/package-lock.json index 37b4972..4b0e973 100644 --- a/node/thing-model/package-lock.json +++ b/node/thing-model/package-lock.json @@ -1,12 +1,12 @@ { - "name": "thing-model", - "version": "1.0.0", + "name": "@thingweb/thing-model", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "thing-model", - "version": "1.0.0", + "name": "@thingweb/thing-model", + "version": "1.0.2", "license": "EPL-2.0 OR W3C-20150513", "dependencies": { "ajv": "^8.11.0", diff --git a/node/thing-model/package.json b/node/thing-model/package.json index 41c405c..59862a2 100644 --- a/node/thing-model/package.json +++ b/node/thing-model/package.json @@ -1,6 +1,6 @@ { "name": "@thingweb/thing-model", - "version": "1.0.1", + "version": "1.0.2", "repository": { "type": "git", "url": "git+https://github.com/eclipse-thingweb/td-tools.git", diff --git a/node/thing-model/src/resolver-interface.ts b/node/thing-model/src/resolver-interface.ts new file mode 100644 index 0000000..b4ad34e --- /dev/null +++ b/node/thing-model/src/resolver-interface.ts @@ -0,0 +1,18 @@ +/******************************************************************************** + * Copyright (c) 2022 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the W3C Software Notice and + * Document License (2015-05-13) which is available at + * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document. + * + * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513 + ********************************************************************************/ + +export interface Resolver { + fetch(uri: string): Promise; +} diff --git a/node/thing-model/src/tm-helpers.ts b/node/thing-model/src/tm-helpers.ts index 8c486f2..9f388e8 100644 --- a/node/thing-model/src/tm-helpers.ts +++ b/node/thing-model/src/tm-helpers.ts @@ -22,12 +22,9 @@ import { JsonPlaceholderReplacer } from "json-placeholder-replacer"; import { LinkElement } from "wot-thing-description-types"; import { DataSchema, ExposedThingInit } from "wot-typescript-definitions"; import { ThingModel } from "wot-thing-model-types"; +import { Resolver } from "./resolver-interface"; import TMSchema from "wot-thing-model-types/schema/tm-json-schema-validation.json"; -interface Resolver { - fetch(uri: string): Promise; -} - // TODO: Refactor and reuse debug solution from core package import debug from "debug"; const namespace = "node-wot:td-tools:thing-model-helpers";