From 35319164594f0999cbd4d3e10ca89b0937caa9f8 Mon Sep 17 00:00:00 2001 From: takker99 <37929109+takker99@users.noreply.github.com> Date: Sun, 24 Apr 2022 19:41:07 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20rest/mod.ts=E3=81=AFdeno.window?= =?UTF-8?q?=E3=81=A7=E3=82=82=E4=BD=BF=E3=81=88=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- browser/websocket/patch.ts | 2 +- browser/websocket/pull.ts | 2 +- deps/scrapbox-rest.ts | 24 ++++++++++++++++++++++++ deps/scrapbox.ts | 25 +------------------------ is.ts | 2 +- rest/getGyazoToken.ts | 2 +- rest/getTweetInfo.ts | 2 +- rest/getWebPageTitle.ts | 2 +- rest/link.ts | 2 +- rest/page-data.ts | 2 +- rest/pages.ts | 2 +- rest/profile.ts | 2 +- rest/project.ts | 2 +- rest/replaceLinks.ts | 2 +- rest/search.ts | 2 +- 15 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 deps/scrapbox-rest.ts diff --git a/browser/websocket/patch.ts b/browser/websocket/patch.ts index cde51c4..dcd47d3 100644 --- a/browser/websocket/patch.ts +++ b/browser/websocket/patch.ts @@ -3,7 +3,7 @@ import { connect, disconnect } from "./socket.ts"; import { getProjectId, getUserId } from "./id.ts"; import { makeChanges } from "./makeChanges.ts"; import { HeadData, pull } from "./pull.ts"; -import type { Line } from "../../deps/scrapbox.ts"; +import type { Line } from "../../deps/scrapbox-rest.ts"; import { pushCommit, pushWithRetry } from "./_fetch.ts"; export interface PatchOptions { diff --git a/browser/websocket/pull.ts b/browser/websocket/pull.ts index e974137..58d4182 100644 --- a/browser/websocket/pull.ts +++ b/browser/websocket/pull.ts @@ -1,4 +1,4 @@ -import type { Line } from "../../deps/scrapbox.ts"; +import type { Line } from "../../deps/scrapbox-rest.ts"; import { getPage } from "../../rest/pages.ts"; export interface HeadData { diff --git a/deps/scrapbox-rest.ts b/deps/scrapbox-rest.ts new file mode 100644 index 0000000..e5cfbd2 --- /dev/null +++ b/deps/scrapbox-rest.ts @@ -0,0 +1,24 @@ +export type { + BadRequestError, + BaseLine as Line, + ErrorLike, + ExportedData, + GuestUser, + ImportedData, + InvalidURLError, + MemberProject, + MemberUser, + NoQueryError, + NotFoundError, + NotLoggedInError, + NotMemberError, + NotMemberProject, + NotPrivilegeError, + Page, + PageList, + ProjectSearchResult, + SearchedTitle, + SearchResult, + SessionError, + TweetInfo, +} from "https://raw.githubusercontent.com/scrapbox-jp/types/0.3.3/rest.ts"; diff --git a/deps/scrapbox.ts b/deps/scrapbox.ts index 0860b32..fdd09be 100644 --- a/deps/scrapbox.ts +++ b/deps/scrapbox.ts @@ -1,28 +1,5 @@ export type { - BadRequestError, - BaseLine as Line, - ErrorLike, - ExportedData, - GuestUser, - ImportedData, - InvalidURLError, - MemberProject, - MemberUser, - NoQueryError, - NotFoundError, - NotLoggedInError, - NotMemberError, - NotMemberProject, - NotPrivilegeError, - Page, - PageList, - ProjectSearchResult, - SearchedTitle, - SearchResult, - SessionError, - TweetInfo, -} from "https://raw.githubusercontent.com/scrapbox-jp/types/0.3.3/rest.ts"; -export type { + Line, Scrapbox, } from "https://raw.githubusercontent.com/scrapbox-jp/types/0.3.3/userscript.ts"; export type { diff --git a/is.ts b/is.ts index d32b173..eacc3b5 100644 --- a/is.ts +++ b/is.ts @@ -1,4 +1,4 @@ -import type { ErrorLike } from "./deps/scrapbox.ts"; +import type { ErrorLike } from "./deps/scrapbox-rest.ts"; // These code are based on https://deno.land/x/unknownutil@v1.1.0/is.ts export const isNone = (value: unknown): value is undefined | null => diff --git a/rest/getGyazoToken.ts b/rest/getGyazoToken.ts index 7489c2f..c354336 100644 --- a/rest/getGyazoToken.ts +++ b/rest/getGyazoToken.ts @@ -1,4 +1,4 @@ -import type { NotLoggedInError } from "../deps/scrapbox.ts"; +import type { NotLoggedInError } from "../deps/scrapbox-rest.ts"; import { cookie } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/getTweetInfo.ts b/rest/getTweetInfo.ts index 32c3499..13ed3f2 100644 --- a/rest/getTweetInfo.ts +++ b/rest/getTweetInfo.ts @@ -3,7 +3,7 @@ import type { InvalidURLError, SessionError, TweetInfo, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie, getCSRFToken } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/getWebPageTitle.ts b/rest/getWebPageTitle.ts index 1203ae3..9685ab4 100644 --- a/rest/getWebPageTitle.ts +++ b/rest/getWebPageTitle.ts @@ -2,7 +2,7 @@ import type { BadRequestError, InvalidURLError, SessionError, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie, getCSRFToken } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/link.ts b/rest/link.ts index 34c4457..36c9fc8 100644 --- a/rest/link.ts +++ b/rest/link.ts @@ -3,7 +3,7 @@ import type { NotFoundError, NotLoggedInError, SearchedTitle, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/page-data.ts b/rest/page-data.ts index 76996ea..910222d 100644 --- a/rest/page-data.ts +++ b/rest/page-data.ts @@ -5,7 +5,7 @@ import type { NotFoundError, NotLoggedInError, NotPrivilegeError, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie, getCSRFToken } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/pages.ts b/rest/pages.ts index 361a17f..5955851 100644 --- a/rest/pages.ts +++ b/rest/pages.ts @@ -4,7 +4,7 @@ import type { NotMemberError, Page, PageList, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/profile.ts b/rest/profile.ts index 8bddc5d..b688006 100644 --- a/rest/profile.ts +++ b/rest/profile.ts @@ -1,4 +1,4 @@ -import type { GuestUser, MemberUser } from "../deps/scrapbox.ts"; +import type { GuestUser, MemberUser } from "../deps/scrapbox-rest.ts"; import { cookie } from "./auth.ts"; import { BaseOptions, setDefaults } from "./util.ts"; import { UnexpectedResponseError } from "./error.ts"; diff --git a/rest/project.ts b/rest/project.ts index c407c35..70cc96f 100644 --- a/rest/project.ts +++ b/rest/project.ts @@ -4,7 +4,7 @@ import type { NotLoggedInError, NotMemberError, NotMemberProject, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/replaceLinks.ts b/rest/replaceLinks.ts index 8fba580..0627987 100644 --- a/rest/replaceLinks.ts +++ b/rest/replaceLinks.ts @@ -2,7 +2,7 @@ import type { NotFoundError, NotLoggedInError, NotMemberError, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie, getCSRFToken } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts"; diff --git a/rest/search.ts b/rest/search.ts index 06f7fdb..d5a8d23 100644 --- a/rest/search.ts +++ b/rest/search.ts @@ -5,7 +5,7 @@ import type { NotMemberError, ProjectSearchResult, SearchResult, -} from "../deps/scrapbox.ts"; +} from "../deps/scrapbox-rest.ts"; import { cookie } from "./auth.ts"; import { UnexpectedResponseError } from "./error.ts"; import { tryToErrorLike } from "../is.ts";