From 2d3aa46104894aad0e9d75de7a1f154120ba414e Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 26 Oct 2022 12:05:04 +0700 Subject: [PATCH] v3.1.3 - Fix type declaration for TS (#128) - Sync to last provider list - Update dependencies --- dist/cjs/index.d.ts | 59 +++++++++++++++++++++++++++----- dist/cjs/oembed-parser.js | 10 ++++-- dist/cjs/package.json | 2 +- dist/oembed-parser.esm.js | 10 ++++-- index.d.ts | 59 +++++++++++++++++++++++++++----- package.json | 6 ++-- src/utils/providers.latest.js | 10 ++++-- src/utils/providers.orginal.json | 18 +++++++++- src/utils/providers.prev.js | 32 ++++++++++++++++- 9 files changed, 176 insertions(+), 30 deletions(-) diff --git a/dist/cjs/index.d.ts b/dist/cjs/index.d.ts index 9b282fb..fd2890a 100644 --- a/dist/cjs/index.d.ts +++ b/dist/cjs/index.d.ts @@ -5,21 +5,13 @@ // Marc McIntosh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function extract(url: string, params?: any): Promise; - -export function hasProvider(url: string): boolean - -export function findProvider(url: string): FindProviderResult - -export function setProviderList(providers: Provider[]): void - export interface Endpoint { schemes?: string[]; url: string; formats?: string[]; // "json" "xml" discovery?: boolean; } - + export interface Provider { "provider_name": string; "provider_url": string; @@ -113,3 +105,52 @@ export interface RichTypeData extends OembedData { /** The height in pixels required to display the HTML. */ height: number; } + +export interface Params { + /** + * max width of embed size + * Default: null + */ + maxwidth: number + /** + * max height of embed size + * Default: null + */ + maxheight: number + /** + * theme for the embed, such as "dark" or "light" + * Default: null + */ + theme: string + /** + * language for the embed, e.g. "en", "fr", "vi", etc + * Default: null + */ + lang: string +} + +export interface ProxyConfig { + target?: string; + headers?: string[]; +} + +export interface FetchOptions { + /** + * list of request headers + * default: null + */ + headers?: string[]; + /** + * the values to configure proxy + * default: null + */ + proxy?: ProxyConfig; +} + +export function extract(url: string, params?: Params, fetchOptions?: FetchOptions): Promise; + +export function hasProvider(url: string): boolean + +export function findProvider(url: string): FindProviderResult + +export function setProviderList(providers: Provider[]): void diff --git a/dist/cjs/oembed-parser.js b/dist/cjs/oembed-parser.js index 1d3ab22..a15cd7a 100644 --- a/dist/cjs/oembed-parser.js +++ b/dist/cjs/oembed-parser.js @@ -1,4 +1,4 @@ -// oembed-parser@3.1.2, by @ndaidong - built with esbuild at 2022-10-13T02:16:48.560Z - published under MIT license +// oembed-parser@3.1.3, by @ndaidong - built with esbuild at 2022-10-26T05:04:53.355Z - published under MIT license var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -3955,7 +3955,7 @@ var providers = [ "s": [ "pod\\.univ-lille\\.fr/video/*" ], - "e": "pod.univ-lille.fr/oembed" + "e": "pod.univ-lille.fr/video/oembed" }, { "s": [ @@ -4262,6 +4262,12 @@ var providers = [ ], "e": "api.picturelfy.com/service/oembed/" }, + { + "s": [ + "*\\.builder\\.pikasso\\.xyz/embed/*" + ], + "e": "builder.pikasso.xyz/api/oembed" + }, { "s": [], "e": "beta.pingvp.com.kpnis.nl/p/oembed.php" diff --git a/dist/cjs/package.json b/dist/cjs/package.json index ec577e0..b523ce1 100644 --- a/dist/cjs/package.json +++ b/dist/cjs/package.json @@ -1,5 +1,5 @@ { "name": "oembed-parser", - "version": "3.1.2", + "version": "3.1.3", "main": "./oembed-parser.js" } \ No newline at end of file diff --git a/dist/oembed-parser.esm.js b/dist/oembed-parser.esm.js index 7053f06..7b38709 100644 --- a/dist/oembed-parser.esm.js +++ b/dist/oembed-parser.esm.js @@ -1,4 +1,4 @@ -// oembed-parser@3.1.2, by @ndaidong - built with esbuild at 2022-10-13T02:16:48.560Z - published under MIT license +// oembed-parser@3.1.3, by @ndaidong - built with esbuild at 2022-10-26T05:04:53.355Z - published under MIT license // src/utils/linker.js var isValid = (url = "") => { @@ -1052,7 +1052,7 @@ var providers = [ "s": [ "pod\\.univ-lille\\.fr/video/*" ], - "e": "pod.univ-lille.fr/oembed" + "e": "pod.univ-lille.fr/video/oembed" }, { "s": [ @@ -1359,6 +1359,12 @@ var providers = [ ], "e": "api.picturelfy.com/service/oembed/" }, + { + "s": [ + "*\\.builder\\.pikasso\\.xyz/embed/*" + ], + "e": "builder.pikasso.xyz/api/oembed" + }, { "s": [], "e": "beta.pingvp.com.kpnis.nl/p/oembed.php" diff --git a/index.d.ts b/index.d.ts index 9b282fb..fd2890a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -5,21 +5,13 @@ // Marc McIntosh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function extract(url: string, params?: any): Promise; - -export function hasProvider(url: string): boolean - -export function findProvider(url: string): FindProviderResult - -export function setProviderList(providers: Provider[]): void - export interface Endpoint { schemes?: string[]; url: string; formats?: string[]; // "json" "xml" discovery?: boolean; } - + export interface Provider { "provider_name": string; "provider_url": string; @@ -113,3 +105,52 @@ export interface RichTypeData extends OembedData { /** The height in pixels required to display the HTML. */ height: number; } + +export interface Params { + /** + * max width of embed size + * Default: null + */ + maxwidth: number + /** + * max height of embed size + * Default: null + */ + maxheight: number + /** + * theme for the embed, such as "dark" or "light" + * Default: null + */ + theme: string + /** + * language for the embed, e.g. "en", "fr", "vi", etc + * Default: null + */ + lang: string +} + +export interface ProxyConfig { + target?: string; + headers?: string[]; +} + +export interface FetchOptions { + /** + * list of request headers + * default: null + */ + headers?: string[]; + /** + * the values to configure proxy + * default: null + */ + proxy?: ProxyConfig; +} + +export function extract(url: string, params?: Params, fetchOptions?: FetchOptions): Promise; + +export function hasProvider(url: string): boolean + +export function findProvider(url: string): FindProviderResult + +export function setProviderList(providers: Provider[]): void diff --git a/package.json b/package.json index e71557c..3b3516b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "3.1.2", + "version": "3.1.3", "name": "oembed-parser", "description": "Get oEmbed data from given URL.", "homepage": "https://www.npmjs.com/package/oembed-parser", @@ -39,8 +39,8 @@ "cross-fetch": "^3.1.5" }, "devDependencies": { - "esbuild": "^0.15.10", - "jest": "^29.1.2", + "esbuild": "^0.15.12", + "jest": "^29.2.2", "nock": "^13.2.9", "standard": "^17.0.0" }, diff --git a/src/utils/providers.latest.js b/src/utils/providers.latest.js index 0082ee2..edb91b8 100644 --- a/src/utils/providers.latest.js +++ b/src/utils/providers.latest.js @@ -1,4 +1,4 @@ -// provider data, synchronized at 2022-10-13T02:14:43.201Z +// provider data, synchronized at 2022-10-26T05:04:37.983Z /* eslint-disable */ @@ -974,7 +974,7 @@ export const providers = [ "s": [ "pod\\.univ-lille\\.fr/video/*" ], - "e": "pod.univ-lille.fr/oembed" + "e": "pod.univ-lille.fr/video/oembed" }, { "s": [ @@ -1281,6 +1281,12 @@ export const providers = [ ], "e": "api.picturelfy.com/service/oembed/" }, + { + "s": [ + "*\\.builder\\.pikasso\\.xyz/embed/*" + ], + "e": "builder.pikasso.xyz/api/oembed" + }, { "s": [], "e": "beta.pingvp.com.kpnis.nl/p/oembed.php" diff --git a/src/utils/providers.orginal.json b/src/utils/providers.orginal.json index 3ebd555..ddd181f 100644 --- a/src/utils/providers.orginal.json +++ b/src/utils/providers.orginal.json @@ -2036,7 +2036,7 @@ "schemes": [ "https://pod.univ-lille.fr/video/*" ], - "url": "https://pod.univ-lille.fr/oembed", + "url": "https://pod.univ-lille.fr/video/oembed", "discovery": true } ] @@ -2690,6 +2690,22 @@ } ] }, + { + "provider_name": "Pikasso", + "provider_url": "https://builder.pikasso.xyz", + "endpoints": [ + { + "schemes": [ + "https://*.builder.pikasso.xyz/embed/*" + ], + "url": "https://builder.pikasso.xyz/api/oembed", + "discovery": true, + "formats": [ + "json" + ] + } + ] + }, { "provider_name": "PingVP", "provider_url": "https://www.pingvp.com/", diff --git a/src/utils/providers.prev.js b/src/utils/providers.prev.js index ba6d7e5..0082ee2 100644 --- a/src/utils/providers.prev.js +++ b/src/utils/providers.prev.js @@ -1,4 +1,4 @@ -// provider data, synchronized at 2022-09-19T09:58:06.421Z +// provider data, synchronized at 2022-10-13T02:14:43.201Z /* eslint-disable */ @@ -437,6 +437,13 @@ export const providers = [ ], "e": "www.docdroid.net/api/oembed" }, + { + "s": [ + "docswell\\.com/*/*", + "www\\.docswell\\.com/*/*" + ], + "e": "www.docswell.com/service/oembed" + }, { "s": [ "dotsub\\.com/view/*" @@ -944,6 +951,13 @@ export const providers = [ ], "e": "embed.kooapp.com/services/oembed" }, + { + "s": [ + "kurozora\\.app/episodes*", + "kurozora\\.app/songs*" + ], + "e": "kurozora.app/oembed" + }, { "s": [ "learningapps\\.org/*" @@ -1063,6 +1077,12 @@ export const providers = [ ], "e": "oembed.minervaknows.com" }, + { + "s": [ + "miro\\.com/app/board/*" + ], + "e": "miro.com/api/v1/oembed" + }, { "s": [ "www\\.mixcloud\\.com/*/*/" @@ -1586,6 +1606,15 @@ export const providers = [ ], "e": "open.spotify.com/oembed" }, + { + "s": [ + "*\\.spotlightr\\.com/watch/*", + "*\\.spotlightr\\.com/publish/*", + "*\\.cdn\\.spotlightr\\.com/watch/*", + "*\\.cdn\\.spotlightr\\.com/publish/*" + ], + "e": "api.spotlightr.com/getOEmbed" + }, { "s": [ "*\\.spreaker\\.com/*" @@ -1694,6 +1723,7 @@ export const providers = [ }, { "s": [ + "www\\.tiktok\\.com/*", "www\\.tiktok\\.com/*/video/*" ], "e": "www.tiktok.com/oembed"