optimize ts-node-dev
This commit is contained in:
@ -3,16 +3,15 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && yarn copy-files",
|
"build": "tsc",
|
||||||
"dev": "ts-node-dev --files src/server.ts",
|
"dev": "ts-node-dev --debounce 100 --respawn --transpile-only src/server.ts",
|
||||||
"dev_qp": "ts-node-dev --files src/queue-processor.ts",
|
"dev_qp": "ts-node-dev --debounce 100 --respawn --transpile-only src/queue-processor.ts",
|
||||||
"start": "node dist/server.js",
|
"start": "node dist/server.js",
|
||||||
"start_queue_processor": "node dist/queue-processor.js",
|
"start_queue_processor": "node dist/queue-processor.js",
|
||||||
"lint": "eslint src --ext ts,js,tsx,jsx",
|
"lint": "eslint src --ext ts,js,tsx,jsx",
|
||||||
"lint:fix": "eslint src --fix --ext ts,js,tsx,jsx",
|
"lint:fix": "eslint src --fix --ext ts,js,tsx,jsx",
|
||||||
"test:typecheck": "tsc --noEmit",
|
"test:typecheck": "tsc --noEmit",
|
||||||
"test": "nyc mocha -r ts-node/register --config mocha-config.json --timeout 10000",
|
"test": "nyc mocha -r ts-node/register --config mocha-config.json --timeout 10000"
|
||||||
"copy-files": "copyfiles -u 1 src/**/*.html dist/"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bmatei/apollo-prometheus-exporter": "^3.0.0",
|
"@bmatei/apollo-prometheus-exporter": "^3.0.0",
|
||||||
@ -154,7 +153,6 @@
|
|||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai-string": "^1.5.0",
|
"chai-string": "^1.5.0",
|
||||||
"circular-dependency-plugin": "^5.2.0",
|
"circular-dependency-plugin": "^5.2.0",
|
||||||
"copyfiles": "^2.4.1",
|
|
||||||
"mocha": "^9.0.1",
|
"mocha": "^9.0.1",
|
||||||
"mocha-unfunk-reporter": "^0.4.0",
|
"mocha-unfunk-reporter": "^0.4.0",
|
||||||
"nock": "^13.2.4",
|
"nock": "^13.2.4",
|
||||||
|
|||||||
@ -24,6 +24,7 @@ export enum RuleEventType {
|
|||||||
PageUpdated = 'PAGE_UPDATED',
|
PageUpdated = 'PAGE_UPDATED',
|
||||||
LabelCreated = 'LABEL_CREATED',
|
LabelCreated = 'LABEL_CREATED',
|
||||||
HighlightCreated = 'HIGHLIGHT_CREATED',
|
HighlightCreated = 'HIGHLIGHT_CREATED',
|
||||||
|
HighlightUpdated = 'HIGHLIGHT_UPDATED',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RuleAction {
|
export interface RuleAction {
|
||||||
|
|||||||
@ -2509,6 +2509,7 @@ export enum RuleActionType {
|
|||||||
|
|
||||||
export enum RuleEventType {
|
export enum RuleEventType {
|
||||||
HighlightCreated = 'HIGHLIGHT_CREATED',
|
HighlightCreated = 'HIGHLIGHT_CREATED',
|
||||||
|
HighlightUpdated = 'HIGHLIGHT_UPDATED',
|
||||||
LabelCreated = 'LABEL_CREATED',
|
LabelCreated = 'LABEL_CREATED',
|
||||||
PageCreated = 'PAGE_CREATED',
|
PageCreated = 'PAGE_CREATED',
|
||||||
PageUpdated = 'PAGE_UPDATED'
|
PageUpdated = 'PAGE_UPDATED'
|
||||||
|
|||||||
@ -1885,6 +1885,7 @@ enum RuleActionType {
|
|||||||
|
|
||||||
enum RuleEventType {
|
enum RuleEventType {
|
||||||
HIGHLIGHT_CREATED
|
HIGHLIGHT_CREATED
|
||||||
|
HIGHLIGHT_UPDATED
|
||||||
LABEL_CREATED
|
LABEL_CREATED
|
||||||
PAGE_CREATED
|
PAGE_CREATED
|
||||||
PAGE_UPDATED
|
PAGE_UPDATED
|
||||||
|
|||||||
@ -2185,6 +2185,7 @@ const schema = gql`
|
|||||||
PAGE_UPDATED
|
PAGE_UPDATED
|
||||||
LABEL_CREATED
|
LABEL_CREATED
|
||||||
HIGHLIGHT_CREATED
|
HIGHLIGHT_CREATED
|
||||||
|
HIGHLIGHT_UPDATED
|
||||||
}
|
}
|
||||||
|
|
||||||
input SetRuleInput {
|
input SetRuleInput {
|
||||||
|
|||||||
@ -68,9 +68,12 @@ export const createHighlight = async (
|
|||||||
EntityType.HIGHLIGHT,
|
EntityType.HIGHLIGHT,
|
||||||
{
|
{
|
||||||
id: libraryItemId,
|
id: libraryItemId,
|
||||||
originalUrl: newHighlight.libraryItem.originalUrl, // for Readwise
|
|
||||||
thumbnail: newHighlight.libraryItem.thumbnail, // for Readwise
|
|
||||||
highlights: [cleanData],
|
highlights: [cleanData],
|
||||||
|
// for Readwise
|
||||||
|
originalUrl: newHighlight.libraryItem.originalUrl,
|
||||||
|
title: newHighlight.libraryItem.title,
|
||||||
|
author: newHighlight.libraryItem.author,
|
||||||
|
thumbnail: newHighlight.libraryItem.thumbnail,
|
||||||
},
|
},
|
||||||
userId
|
userId
|
||||||
)
|
)
|
||||||
@ -122,6 +125,8 @@ export const mergeHighlights = async (
|
|||||||
{
|
{
|
||||||
id: libraryItemId,
|
id: libraryItemId,
|
||||||
originalUrl: newHighlight.libraryItem.originalUrl,
|
originalUrl: newHighlight.libraryItem.originalUrl,
|
||||||
|
title: newHighlight.libraryItem.title,
|
||||||
|
author: newHighlight.libraryItem.author,
|
||||||
thumbnail: newHighlight.libraryItem.thumbnail,
|
thumbnail: newHighlight.libraryItem.thumbnail,
|
||||||
highlights: [newHighlight],
|
highlights: [newHighlight],
|
||||||
},
|
},
|
||||||
@ -156,15 +161,14 @@ export const updateHighlight = async (
|
|||||||
})
|
})
|
||||||
|
|
||||||
const libraryItemId = updatedHighlight.libraryItem.id
|
const libraryItemId = updatedHighlight.libraryItem.id
|
||||||
// await pubsub.entityUpdated<ItemEvent>(
|
await pubsub.entityUpdated<ItemEvent>(
|
||||||
// EntityType.HIGHLIGHT,
|
EntityType.HIGHLIGHT,
|
||||||
// {
|
{
|
||||||
// id: libraryItemId,
|
id: libraryItemId,
|
||||||
// slug: updatedHighlight.libraryItem.slug,
|
highlights: [highlight],
|
||||||
// highlights: [highlight],
|
} as ItemEvent,
|
||||||
// } as ItemEvent,
|
userId
|
||||||
// userId
|
)
|
||||||
// )
|
|
||||||
|
|
||||||
await enqueueUpdateHighlight({
|
await enqueueUpdateHighlight({
|
||||||
libraryItemId,
|
libraryItemId,
|
||||||
|
|||||||
@ -258,7 +258,7 @@ export class NotionClient implements IntegrationClient {
|
|||||||
.filter(
|
.filter(
|
||||||
(highlight) =>
|
(highlight) =>
|
||||||
!lastSync ||
|
!lastSync ||
|
||||||
(highlight.updatedAt && highlight.updatedAt > lastSync) // only new highlights
|
new Date(highlight.updatedAt as string) > lastSync // only new highlights
|
||||||
)
|
)
|
||||||
.map((highlight) => ({
|
.map((highlight) => ({
|
||||||
paragraph: {
|
paragraph: {
|
||||||
|
|||||||
@ -102,7 +102,9 @@ export class ReadwiseClient implements IntegrationClient {
|
|||||||
title: item.title,
|
title: item.title,
|
||||||
author: item.author || undefined,
|
author: item.author || undefined,
|
||||||
highlight_url: getHighlightUrl(item.id, highlight.id),
|
highlight_url: getHighlightUrl(item.id, highlight.id),
|
||||||
highlighted_at: highlight.createdAt as string | undefined,
|
highlighted_at: highlight.createdAt
|
||||||
|
? new Date(highlight.createdAt as string).toISOString()
|
||||||
|
: undefined,
|
||||||
category,
|
category,
|
||||||
image_url: item.thumbnail || undefined,
|
image_url: item.thumbnail || undefined,
|
||||||
location_type: 'order',
|
location_type: 'order',
|
||||||
|
|||||||
44
yarn.lock
44
yarn.lock
@ -12914,19 +12914,6 @@ copy-to-clipboard@^3.3.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
toggle-selection "^1.0.6"
|
toggle-selection "^1.0.6"
|
||||||
|
|
||||||
copyfiles@^2.4.1:
|
|
||||||
version "2.4.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.4.1.tgz#d2dcff60aaad1015f09d0b66e7f0f1c5cd3c5da5"
|
|
||||||
integrity sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==
|
|
||||||
dependencies:
|
|
||||||
glob "^7.0.5"
|
|
||||||
minimatch "^3.0.3"
|
|
||||||
mkdirp "^1.0.4"
|
|
||||||
noms "0.0.0"
|
|
||||||
through2 "^2.0.1"
|
|
||||||
untildify "^4.0.0"
|
|
||||||
yargs "^16.1.0"
|
|
||||||
|
|
||||||
core-js-compat@^3.20.2, core-js-compat@^3.21.0:
|
core-js-compat@^3.20.2, core-js-compat@^3.21.0:
|
||||||
version "3.21.1"
|
version "3.21.1"
|
||||||
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.21.1.tgz#cac369f67c8d134ff8f9bd1623e3bc2c42068c82"
|
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.21.1.tgz#cac369f67c8d134ff8f9bd1623e3bc2c42068c82"
|
||||||
@ -16833,7 +16820,7 @@ glob-to-regexp@^0.4.1:
|
|||||||
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
|
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
|
||||||
integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==
|
integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==
|
||||||
|
|
||||||
glob@7, glob@^7.0.5:
|
glob@7:
|
||||||
version "7.2.3"
|
version "7.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
|
||||||
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
|
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
|
||||||
@ -22431,7 +22418,7 @@ minimatch@5.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion "^2.0.1"
|
brace-expansion "^2.0.1"
|
||||||
|
|
||||||
minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2:
|
minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2:
|
||||||
version "3.1.2"
|
version "3.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||||
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
||||||
@ -23427,14 +23414,6 @@ nofilter@^3.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66"
|
resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66"
|
||||||
integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==
|
integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==
|
||||||
|
|
||||||
noms@0.0.0:
|
|
||||||
version "0.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859"
|
|
||||||
integrity sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==
|
|
||||||
dependencies:
|
|
||||||
inherits "^2.0.1"
|
|
||||||
readable-stream "~1.0.31"
|
|
||||||
|
|
||||||
nopt@^5.0.0:
|
nopt@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88"
|
resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88"
|
||||||
@ -27114,16 +27093,6 @@ readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.0.6, readable
|
|||||||
string_decoder "^1.1.1"
|
string_decoder "^1.1.1"
|
||||||
util-deprecate "^1.0.1"
|
util-deprecate "^1.0.1"
|
||||||
|
|
||||||
readable-stream@~1.0.31:
|
|
||||||
version "1.0.34"
|
|
||||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
|
|
||||||
integrity sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==
|
|
||||||
dependencies:
|
|
||||||
core-util-is "~1.0.0"
|
|
||||||
inherits "~2.0.1"
|
|
||||||
isarray "0.0.1"
|
|
||||||
string_decoder "~0.10.x"
|
|
||||||
|
|
||||||
readdir-scoped-modules@^1.1.0:
|
readdir-scoped-modules@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309"
|
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309"
|
||||||
@ -29252,11 +29221,6 @@ string_decoder@^1.0.0, string_decoder@^1.1.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
safe-buffer "~5.2.0"
|
safe-buffer "~5.2.0"
|
||||||
|
|
||||||
string_decoder@~0.10.x:
|
|
||||||
version "0.10.31"
|
|
||||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
|
|
||||||
integrity sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==
|
|
||||||
|
|
||||||
string_decoder@~1.1.1:
|
string_decoder@~1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
|
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
|
||||||
@ -29868,7 +29832,7 @@ throttleit@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"
|
resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c"
|
||||||
integrity sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=
|
integrity sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=
|
||||||
|
|
||||||
through2@^2.0.0, through2@^2.0.1, through2@~2.0.0:
|
through2@^2.0.0, through2@~2.0.0:
|
||||||
version "2.0.5"
|
version "2.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
|
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
|
||||||
integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==
|
integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==
|
||||||
@ -32209,7 +32173,7 @@ yargs-unparser@2.0.0:
|
|||||||
flat "^5.0.2"
|
flat "^5.0.2"
|
||||||
is-plain-obj "^2.1.0"
|
is-plain-obj "^2.1.0"
|
||||||
|
|
||||||
yargs@16.2.0, yargs@^16.0.0, yargs@^16.1.0, yargs@^16.2.0:
|
yargs@16.2.0, yargs@^16.0.0, yargs@^16.2.0:
|
||||||
version "16.2.0"
|
version "16.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
|
||||||
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
|
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
|
||||||
|
|||||||
Reference in New Issue
Block a user