Socket
Socket
Sign inDemoInstall

rickmortyapi

Package Overview
Dependencies
9
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 2.0.0
### Breaking Changes
- Only Node 18 is supported.
- Use `fetch` API ([experimental](https://nodejs.org/en/blog/announcements/v18-release-announce/#fetch-experimental) in Node 18) instead of the `https` module. This makes it easier to use in applications running Webpack 5.
## 1.0.0

@@ -2,0 +8,0 @@

2

dist/character/index.d.ts

@@ -6,3 +6,3 @@ import { ApiResponse, Character, CharacterFilter, Info } from '../interfaces';

*/
export declare const getCharacters: (filters?: CharacterFilter | undefined) => Promise<ApiResponse<Info<Character[]>>>;
export declare const getCharacters: (filters?: CharacterFilter) => Promise<ApiResponse<Info<Character[]>>>;
/**

@@ -9,0 +9,0 @@ * Gets a Character by `id` or array of `ids`.<br/>

@@ -6,3 +6,3 @@ import { ApiResponse, Episode, EpisodeFilter, Info } from '../interfaces';

*/
export declare const getEpisodes: (filters?: EpisodeFilter | undefined) => Promise<ApiResponse<Info<Episode[]>>>;
export declare const getEpisodes: (filters?: EpisodeFilter) => Promise<ApiResponse<Info<Episode[]>>>;
/**

@@ -9,0 +9,0 @@ * Gets an Episode by `id` or array of `ids`.<br/>

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

var F=Object.create;var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var u=e=>a(e,"__esModule",{value:!0});var w=(e,t)=>{u(e);for(var o in t)a(e,o,{get:t[o],enumerable:!0})},$=(e,t,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of P(t))!S.call(e,n)&&n!=="default"&&a(e,n,{get:()=>t[n],enumerable:!(o=y(t,n))||o.enumerable});return e},k=e=>$(u(a(e!=null?F(T(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);w(exports,{getCharacter:()=>b,getCharacters:()=>x,getEndpoints:()=>I,getEpisode:()=>L,getEpisodes:()=>C,getLocation:()=>A,getLocations:()=>h});var G={required:"You are using an invalid argument. As an argument use an integer (Id) or an array of integers (Ids).",optional:"You are using an invalid argument. As an argument use a filter object or leave it blank."},m=e=>typeof e=="number"&&Number.isInteger(e),O=e=>Array.isArray(e)&&e.every(t=>m(t)),M=(e,t)=>{if(t&&m(e))return`/${e}`;if(t&&O(e)){let o=e;return`/${o.length?o:"[-1]"}`}if(!t&&typeof e=="object"&&!Array.isArray(e))return`/?${new URLSearchParams(e).toString()}`;throw new Error(G[t?"required":"optional"])},d=M;var g=k(require("https")),Q="https://rickandmortyapi.com/api",j=e=>new Promise((t,o)=>{let n=`${Q}/${e}`;g.default.get(n,s=>{s.setEncoding("utf8");let c="";s.on("data",i=>c+=i),s.on("error",i=>o(i)),s.on("end",()=>{let i=s.statusCode&&s.statusCode>=200&&s.statusCode<300,p=JSON.parse(c);t({data:i?p:{},status:s.statusCode,statusMessage:!i&&p.error?p.error:s.statusMessage})})})}),f=j;var v=async({endpoint:e,options:t,isIdRequired:o=!1})=>{let n=d(t,o);return f(`${e}/${n}`)},r=v;var R="character",x=e=>r({endpoint:R,options:e!=null?e:{}}),b=e=>r({endpoint:R,options:e,isIdRequired:!0});var l="location",h=e=>r({endpoint:l,options:e!=null?e:{}}),A=e=>r({endpoint:l,options:e,isIdRequired:!0});var E="episode",C=e=>r({endpoint:E,options:e!=null?e:{}}),L=e=>r({endpoint:E,options:e,isIdRequired:!0});var I=()=>r({endpoint:"",options:{}});0&&(module.exports={getCharacter,getCharacters,getEndpoints,getEpisode,getEpisodes,getLocation,getLocations});
"use strict";var i=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},C=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of E(t))!I.call(e,s)&&s!==o&&i(e,s,{get:()=>t[s],enumerable:!(n=A(t,s))||n.enumerable});return e};var F=e=>C(i({},"__esModule",{value:!0}),e);var $={};L($,{getCharacter:()=>d,getCharacters:()=>u,getEndpoints:()=>h,getEpisode:()=>b,getEpisodes:()=>R,getLocation:()=>l,getLocations:()=>f});module.exports=F($);var T={required:"You are using an invalid argument. As an argument use an integer (Id) or an array of integers (Ids).",optional:"You are using an invalid argument. As an argument use a filter object or leave it blank."},a=e=>typeof e=="number"&&Number.isInteger(e),y=e=>Array.isArray(e)&&e.every(t=>a(t)),P=(e,t)=>{if(t&&a(e))return`/${e}`;if(t&&y(e)){let o=e;return`/${o.length?o:"[-1]"}`}if(!t&&typeof e=="object"&&!Array.isArray(e))return`/?${new URLSearchParams(e).toString()}`;throw new Error(T[t?"required":"optional"])},p=P;var w=async e=>{let t=await fetch(`https://rickandmortyapi.com/api/${e}`);return t.ok?{data:await t.json(),status:t.status,statusMessage:t.statusText}:{data:{},status:t.status,statusMessage:t.statusText}},c=w;var k=async({endpoint:e,options:t,isIdRequired:o=!1})=>{let n=p(t,o);return c(`${e}/${n}`)},r=k;var m="character",u=e=>r({endpoint:m,options:e??{}}),d=e=>r({endpoint:m,options:e,isIdRequired:!0});var g="location",f=e=>r({endpoint:g,options:e??{}}),l=e=>r({endpoint:g,options:e,isIdRequired:!0});var x="episode",R=e=>r({endpoint:x,options:e??{}}),b=e=>r({endpoint:x,options:e,isIdRequired:!0});var h=()=>r({endpoint:"",options:{}});0&&(module.exports={getCharacter,getCharacters,getEndpoints,getEpisode,getEpisodes,getLocation,getLocations});
//# sourceMappingURL=index.js.map

@@ -6,3 +6,3 @@ import { ApiResponse, Info, Location, LocationFilter } from '../interfaces';

*/
export declare const getLocations: (filters?: LocationFilter | undefined) => Promise<ApiResponse<Info<Location[]>>>;
export declare const getLocations: (filters?: LocationFilter) => Promise<ApiResponse<Info<Location[]>>>;
/**

@@ -9,0 +9,0 @@ * Gets a Location by `id` or array of `ids`.<br/>

@@ -7,3 +7,3 @@ import { GetResource } from './getResource';

export declare const isArrayOfIntegers: (val: unknown) => boolean;
declare const generateQueryString: (query: GetResource['options'], isIdRequired?: boolean | undefined) => string;
declare const generateQueryString: (query: GetResource['options'], isIdRequired?: boolean) => string;
export default generateQueryString;

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

declare const get: (endpoint: string) => Promise<unknown>;
declare const get: (endpoint: string) => Promise<{
data: unknown;
status: number;
statusMessage: string;
}>;
export default get;
{
"name": "rickmortyapi",
"version": "1.0.0",
"version": "2.0.0",
"author": "Axel Fuhrmann",

@@ -10,3 +10,3 @@ "description": "The Rick and Morty API JS client",

"engines": {
"node": ">= 10"
"node": ">= 18"
},

@@ -16,3 +16,3 @@ "scripts": {

"build": "rm -rf dist && tsc -p tsconfig.json --emitDeclarationOnly",
"postbuild": "esbuild src/index.ts --platform=node --target=node10 --sourcemap --minify --bundle --outfile=dist/index.js",
"postbuild": "esbuild src/index.ts --platform=node --target=node18 --sourcemap --minify --bundle --outfile=dist/index.js",
"lint": "eslint src/. --cache --fix",

@@ -29,18 +29,18 @@ "test": "jest",

"devDependencies": {
"@types/jest": "^27.0.1",
"@types/node": "^16.6.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.10",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"bundlesize": "^0.18.1",
"doctoc": "^2.0.1",
"esbuild": "^0.12.20",
"eslint": "^7.32.0",
"esbuild": "^0.15.16",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^7.0.0",
"jest": "^27.0.6",
"jest": "^29.3.1",
"prettier": "^2.3.2",
"ts-jest": "^27.0.4",
"typedoc": "^0.21.5",
"typescript": "^4.3.5"
"ts-jest": "^29.0.3",
"typedoc": "^0.23.21",
"typescript": "^4.9.3"
},

@@ -66,3 +66,5 @@ "bundlesize": [

"homepage": "https://github.com/afuh/rick-and-morty-api-node#readme",
"dependencies": {}
"dependencies": {
"isomorphic-unfetch": "^3.1.0"
}
}

@@ -25,2 +25,3 @@ [![Tests](https://github.com/afuh/rick-and-morty-api-node/workflows/Tests/badge.svg)](https://github.com/afuh/rick-and-morty-api-node/actions?query=workflow:Tests)

- [Get endpoints](#get-endpoints)
- [Support](#support)

@@ -44,3 +45,4 @@ <!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Client Reference
https://javascript.rickandmortyapi.com
- [Methods](https://javascript.rickandmortyapi.com/modules/index.html)
- [Interfaces](https://javascript.rickandmortyapi.com/modules/interfaces.html)

@@ -115,1 +117,6 @@ ## Response schema

`getEndpoints()`: This method will response with the available resouces, you can use it to ping the server status.
## Support
[Help to maintain The Rick and Morty API's infrastructure](https://rickandmortyapi.com/help-us).
If you want to know more about The Rick and Morty API click [here](https://rickandmortyapi.com/about).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc