New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mharj/openweathermap

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mharj/openweathermap - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

3

dist/interfaces/IOpenWeatherV2.d.ts

@@ -0,1 +1,2 @@

import { Result } from 'mharj-result';
import { WeatherDataV2 } from '../types/v2';

@@ -6,3 +7,3 @@ /**

export interface IOpenWeatherV2 {
dataWeatherApi: (params: URLSearchParams) => Promise<WeatherDataV2>;
dataWeatherApi: (params: URLSearchParams) => Promise<Result<WeatherDataV2, SyntaxError | TypeError>>;
}

@@ -7,11 +7,16 @@ "use strict";

const fetchUtils_1 = require("./lib/fetchUtils");
const fetchResult = (0, mharj_result_1.safeAsyncResultBuilder)(fetch);
const defaultImplementation = {
dataWeatherApi: async (params) => {
const resp = await fetch(`https://api.openweathermap.org/data/2.5/weather?${params.toString()}`);
if (!resp.ok) {
throw new Error(resp.statusText);
const result = await fetchResult(`https://api.openweathermap.org/data/2.5/weather?${params.toString()}`);
if (!result.isOk) {
return (0, mharj_result_1.Err)(result.err());
}
const data = (await resp.json());
const res = result.ok();
if (!res.ok) {
return (0, mharj_result_1.Err)(new TypeError(`OpenWeatherV2 http error: ${res.status} ${res.statusText}`));
}
const data = await (0, mharj_result_1.safeAsyncResult)(res.json());
(0, types_1.assertWeatherDataV2)(data);
return data;
return (0, mharj_result_1.Ok)(data);
},

@@ -162,3 +167,4 @@ };

async handleFetch(cacheKey, params, opts) {
const data = await this.apiHandler.dataWeatherApi(params);
const dataApiResult = await this.apiHandler.dataWeatherApi(params);
const data = dataApiResult.unwrap();
(0, types_1.assertWeatherDataV2)(data);

@@ -165,0 +171,0 @@ if (this.cache) {

@@ -57,20 +57,20 @@ import { z } from 'zod';

rain: z.ZodOptional<z.ZodObject<{
'1h': z.ZodNumber;
'3h': z.ZodNumber;
'1h': z.ZodOptional<z.ZodNumber>;
'3h': z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
}, {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
}>>;
snow: z.ZodOptional<z.ZodObject<{
'1h': z.ZodNumber;
'3h': z.ZodNumber;
'1h': z.ZodOptional<z.ZodNumber>;
'3h': z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
}, {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
}>>;

@@ -170,8 +170,8 @@ sys: z.ZodObject<{

rain?: {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
} | undefined;
snow?: {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
} | undefined;

@@ -221,8 +221,8 @@ }, {

rain?: {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
} | undefined;
snow?: {
'1h': number;
'3h': number;
'1h'?: number | undefined;
'3h'?: number | undefined;
} | undefined;

@@ -229,0 +229,0 @@ }>;

@@ -35,8 +35,8 @@ "use strict";

const rainSchema = zod_1.z.object({
'1h': zod_1.z.number(),
'3h': zod_1.z.number(),
'1h': zod_1.z.number().optional(),
'3h': zod_1.z.number().optional(),
});
const snowSchema = zod_1.z.object({
'1h': zod_1.z.number(),
'3h': zod_1.z.number(),
'1h': zod_1.z.number().optional(),
'3h': zod_1.z.number().optional(),
});

@@ -43,0 +43,0 @@ const sysSchema = zod_1.z.object({

{
"name": "@mharj/openweathermap",
"version": "0.0.2",
"version": "0.0.3",
"description": "Open Weather API Client",

@@ -62,5 +62,5 @@ "main": "./dist/index.js",

"dependencies": {
"@avanio/expire-cache": "^0.2.0",
"mharj-result": "^0.4.5",
"tslib": "^2.6.0",
"@avanio/expire-cache": "^0.3.2",
"mharj-result": "^0.5.1",
"tslib": "^2.6.1",
"zod": "^3.21.4"

@@ -71,11 +71,10 @@ },

"@types/mocha": "^10.0.1",
"@types/node": "^18.17.0",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@types/node": "^18.17.2",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"chai": "^4.3.7",
"dotenv": "^16.3.1",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-deprecation": "^1.4.1",
"eslint-plugin-deprecation": "^1.5.0",
"eslint-plugin-prettier": "^5.0.0",

@@ -85,3 +84,3 @@ "eslint-plugin-sonarjs": "^0.19.0",

"nyc": "^15.1.0",
"prettier": "^3.0.0",
"prettier": "^3.0.1",
"source-map-support": "^0.5.21",

@@ -88,0 +87,0 @@ "ts-node": "^10.9.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc