Releases: octet-stream/dinky
2.0.0-beta.4
Update
- Rewrite documentation.
Add
-
Implement classes for every search type:
SearchImages
,SearchComments
,SearchTags
,SearchGalleries
,SearchPosts
. All of these extend abstractSearch
class;import {SearchImages, SearchComments, SearchTags, SearchGalleries, SearchPosts} from "dinky.js"
-
Add shortcuts for all
entities
andsearch
types.Entities shortcuts:
import {images, comments, filters, images, profiles, tags} from "dinky.js"
Search shortcuts:
import {search} from "dinky.js" search.images() // Creates instance for `SearchImages` search.comments() // Creates instance for `SearchComments` search.tags() // Creates instance for `SearchTags` search.galleries() // Creates instance for `SearchGalleries` search.posts() // Creates instance for `SearchPosts`
In addition to these shortcuts,
search
object hasreverse
method. That way you can send images reverse-search query:import {search} from "dinky.js" // Same as `new SearchImage().reverse(...)` await search.reverse("https://derpicdn.net/img/2019/12/24/2228439/full.jpg")
Remove
- Most of the
Search
class methods moved toSearchImages
.
All changes: v2.0.0-beta.3...v2.0.0-beta.4
2.0.0-beta.3
2.0.0-beta.2
Breaking
- Set minimal required Node.js version to v14.17;
Add
- Expose callable version for every entity class and for Search. You can now create request similarly to
v1.x
:
import {tags} from "dinky.js"
await tags.getById("artist-colon-rainbow")
dinky.js exposes functions for these types of requests: search
, tags
, comments
, images
, profiles
and filters
. More will be added in next releases!
Update
- Improve url normalization. It will also enforce
https
protocol for custom URLs:
import {images} from "dinky.js"
images({url: "furbooru.org"}) // will add https protocol -> https://furbooru.org/api/v1/json/images
images({url: "http://furbooru.org"}) // will replace http protocol with https -> https://furbooru.org/api/v1/json/images
- Replace
cross-fetch
withnode-fetch
. Starting from this version dinky.js will tryglobalThis.fetch
first, so you can use polyfills or just rely on the environment. Iffetch
is not defined onglobalThis
object and on thelinkOptions.fetch
option, dinky.js will usenode-fetch
as default fallback; - Replace
fetch-mock
withnock
for tests, becausefetch-mock
does not support ESM. Note thatnock
relies on Node.js' http module to operate, so requests from alternative http clients (like native Node.js' fetch implementation, which is based on undici) will not be handled bynock
.
All changes: v2.0.0-beta.1...v2.0.0-beta.2
2.0.0-beta.1
Highlights
- [BREAKING] This package is ESM only from now on!
- [BREAKING] Minimal required version is 12.20
Add
- Add
Search#reverse()
method allows to perform reverse search against Philomena API:
import {Search} from "dinky.js"
const search = new Search()
await search.reverse("https://derpicdn.net/img/2019/12/24/2228439/full.jpg")
- Add
Filters
class that helps to get a list of system or user filters;
Update
- Various improvements for typings.
- Minimal required Node.js version is 12.4 for not. This might change before the actual 2.x release came out because I am thinking to keep this package ESM only since v2.
- Replace
isomorphic-fetch
withcross-fetch
All changes: v2.0.0-beta.0...v2.0.0-beta.1
v2.0.0-beta.0
This is the first pre-relase update for Dinky.js on its way to 2.x major update
Breaking
-
Codebase has been rewritten from the ground up on TypeScript.
-
The package comes with improved ESM support, while it still has CommonJS version of its modules.
-
From now on, the public API has separated class for each of Dinky entity:
import {Search, Images, Comments, Tags} from "dinky.js" // Etc
- Every class constructor now takes an options arguments, allowing you to configure custom URL for requests, set request parameters for link and even use your own link or fetch function to perform API requests!
import fetch from "node-fetch"
import {Search} from "dinky.js"
// Custom base URL usage
new Search({url: "https://furbooru.org"})
// Custom fetch usage
new Search({linkOptions: {fetch}})
// ...link API is not stable yet, I will add docs for it later...
Add
- A new
Profiles
entity to handle requests to/api/json/profiles
endpoint
Remove
- Lists class
All changes: v1.1.0...v2.0.0-beta.0
1.1.0
1.0.0
Remove
- Drop Node 8 support. The minimal required version is 10.
Lists
class now contains only shortcuts. TheLists#last()
method has been removed.
Update
-
Breaking:
Images#id()
method has been renamed toImages#getById()
-
Breaking:
Search#tags()
method has been renamed toSearch#query()
-
Breaking:
Search#random()
method is no more executes a request to take a random image.
Instead, it addssf=random
param to the request, so if you want to keep previous behaviour,
you have to call.limit()
method with 1 as its value, then execute your query:import dinky from "dinky.js" // Don't forget that a reesponse will always contain an array of images. dinky().search(["pinkie pie", "safe"]).random().limit(1) .then(console.log)
It also means that you can search for more than just one random image at the same time.
Add
-
Casting for fields that contains dates.
-
The
Search
request has a few types to seatch on. Use the those methods to set the request type to search on:
Search#{comments,galleries,posts,tags,images}()
-
New classes:
Comments
andTags
andDinky#{comments,tags}()
methods to access them.
Both of those classes the following methods:-
.getById()
– returrns an entity by its ID on Derpibooruimport dinky from "dinky.js" // Will create a request to // https://derpibooru.org/api/v1/json/images/0 dinky().images().getById(0) .then(console.log)
-
.search(query)
– returns a Search query with the type of entity on which the method has been called.import dinky from "dinky.js" // Will create a Search request to // https://derpibooru.org/api/v1/json/search/images dinky().images().search(["amending fences", "minuette", "safe"]) .then(console.log)
-
-
Images#featured()
– returns a featured image.
All changes: v0.8.1...v1.0.0
0.8.1
0.8.0
Remove
- Request#{ascending,descending}() methods. Use Search#{ascending,descending}() instead.
Update
- Drop Node 11 support (because of AVA).
All changes: v0.7.2...v0.8.0
0.7.2
Update
-
Search#tags()
will consider empty arrays as no tags:import dinky from "dinky.js" // Empty array will be considered the same way as "undefined". // So, the * wildcard will be used for this request: // https://derpibooru.org/search.json?q=*&random_image=true dinky().search([]).random() .then(console.log) // And this request will not set any tags: dinky().search([]) .catch(console.error) // This request will crash because of no tags
All changes: v0.7.1...v0.7.2