@things-factory/integration-weather 10.1.113 → 10.1.117
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.
|
@@ -14,11 +14,13 @@ export declare class WeatherAPIConnector implements Connector {
|
|
|
14
14
|
}[];
|
|
15
15
|
};
|
|
16
16
|
optional?: undefined;
|
|
17
|
+
useDomainAttribute?: undefined;
|
|
17
18
|
} | {
|
|
18
19
|
type: string;
|
|
19
20
|
name: string;
|
|
20
21
|
label: string;
|
|
21
22
|
optional: boolean;
|
|
23
|
+
useDomainAttribute: boolean;
|
|
22
24
|
property?: undefined;
|
|
23
25
|
})[];
|
|
24
26
|
get taskPrefixes(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weather-api-connector.js","sourceRoot":"","sources":["../../../server/engine/connector/weather-api-connector.ts"],"names":[],"mappings":";;;AAAA,uEAA2F;AAE3F,mEAA0D,CAAC,gBAAgB;AAC3E,uEAAiE,CAAC,qBAAqB;AACvF,+DAAsD,CAAC,eAAe;AAEtE,MAAa,mBAAmB;IAC9B,KAAK,CAAC,KAAK,CAAC,iBAAiB;QAC3B,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjE,oCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAA;IACpE,CAAC;IAED,4EAA4E;IAC5E,UAAU;IACV,qGAAqG;IACrG,0BAA0B;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,MAAM;IACN,IAAI;IAEJ,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,MAAM,EACJ,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAC7B,GAAG,UAAU,CAAA;QAEd,IAAI,CAAC;YACH,IAAI,cAA8B,CAAA;YAElC,QAAQ,QAAQ,EAAE,CAAC;gBAC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;wBACD;4BACE,KAAK,EAAE,UAAU;4BACjB,OAAO,EAAE,cAAc;yBACxB;qBACF;iBACF;aACF;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,sBAAsB;gBAC7B,QAAQ,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"weather-api-connector.js","sourceRoot":"","sources":["../../../server/engine/connector/weather-api-connector.ts"],"names":[],"mappings":";;;AAAA,uEAA2F;AAE3F,mEAA0D,CAAC,gBAAgB;AAC3E,uEAAiE,CAAC,qBAAqB;AACvF,+DAAsD,CAAC,eAAe;AAEtE,MAAa,mBAAmB;IAC9B,KAAK,CAAC,KAAK,CAAC,iBAAiB;QAC3B,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjE,oCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAA;IACpE,CAAC;IAED,4EAA4E;IAC5E,UAAU;IACV,qGAAqG;IACrG,0BAA0B;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,MAAM;IACN,IAAI;IAEJ,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,MAAM,EACJ,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAC7B,GAAG,UAAU,CAAA;QAEd,IAAI,CAAC;YACH,IAAI,cAA8B,CAAA;YAElC,QAAQ,QAAQ,EAAE,CAAC;gBACjB,KAAK,YAAY;oBACf,cAAc,GAAG,IAAI,wCAAgB,EAAE,CAAA;oBACvC,MAAK;gBACP,KAAK,gBAAgB;oBACnB,IAAI,CAAC,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;oBACtE,cAAc,GAAG,IAAI,+CAAqB,CAAC,MAAM,CAAC,CAAA;oBAClD,MAAK;gBACP,KAAK,UAAU;oBACb,c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AAO,CAAC,SAAS,CAAC,CAAA;IACpB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,6CAA6C,CAAA;IACtD,CAAC;CACF;AA7FD,kDA6FC;AAED,aAAa;AACb,oCAAiB,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,IAAI,mBAAmB,EAAE,CAAC,CAAA","sourcesContent":["import { Connection, ConnectionManager, Connector } from '@things-factory/integration-base'\nimport { WeatherService } from '../types.js' // WeatherService 인터페이스\nimport { OpenMeteoService } from './open-meteo-adapter.js' // OpenMeteo 구현체\nimport { OpenWeatherMapService } from './open-weather-adapter.js' // OpenWeatherMap 구현체\nimport { NoaaGfsService } from './noaa-gps-adapter.js' // NOAA GFS 구현체\n\nexport class WeatherAPIConnector implements Connector {\n async ready(connectionConfigs) {\n await Promise.all(connectionConfigs.map(this.connect.bind(this)))\n ConnectionManager.logger.info('Weather API connections are ready')\n }\n\n // async checkConnectionInstance(domain, connectionName): Promise<boolean> {\n // try {\n // const connection = await ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n // return !!connection\n // } catch (e) {\n // return false\n // }\n // }\n\n async connect(connection) {\n const {\n params: { provider, apiKey }\n } = connection\n\n try {\n let weatherService: WeatherService\n\n switch (provider) {\n case 'open-meteo':\n weatherService = new OpenMeteoService()\n break\n case 'openweathermap':\n if (!apiKey) throw new Error(`API Key is required for OpenWeatherMap`)\n weatherService = new OpenWeatherMapService(apiKey)\n break\n case 'noaa-gfs':\n weatherService = new NoaaGfsService()\n break\n default:\n throw new Error(`Unsupported weather provider: ${provider}`)\n }\n\n ConnectionManager.addConnectionInstance(connection, weatherService)\n ConnectionManager.logger.info(\n `Weather API connection(${connection.name}) is connected with provider: ${provider}`\n )\n } catch (ex) {\n ConnectionManager.logger.error(`Weather API connection(${connection.name}) failed`, ex)\n throw ex\n }\n }\n\n async disconnect(connection: Connection) {\n ConnectionManager.removeConnectionInstance(connection)\n ConnectionManager.logger.info(`Weather API connection(${connection.name}) is disconnected`)\n }\n\n get parameterSpec() {\n return [\n {\n type: 'select',\n name: 'provider',\n label: 'label.api-provider',\n property: {\n options: [\n {\n value: 'open-meteo',\n display: 'Open Meteo API'\n },\n {\n value: 'openweathermap',\n display: 'Open Weather API'\n },\n {\n value: 'noaa-gfs',\n display: 'NOAA GFS API'\n }\n ]\n }\n },\n {\n type: 'secret',\n name: 'apiKey',\n label: 'label.weather-apikey',\n optional: true,\n useDomainAttribute: true\n }\n ]\n }\n\n get taskPrefixes() {\n return ['weather']\n }\n\n get help() {\n return 'integration/connector/weather-api-connector'\n }\n}\n\n// 🏗️ 커넥터 등록\nConnectionManager.registerConnector('weather-api-connector', new WeatherAPIConnector())\n"]}
|