lisb-hubot
Advanced tools
Comparing version 3.4.0 to 3.5.0
{ | ||
"name": "lisb-hubot", | ||
"version": "3.4.0+forked.3.3.2", | ||
"version": "3.5.0+forked.3.3.2", | ||
"author": "hubot", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -53,2 +53,8 @@ 'use strict' | ||
return !!obj.file_id | ||
case 'note_created': | ||
return !!obj.note_id && !!obj.revision && obj.revision === 1 | ||
case 'note_updated': | ||
return !!obj.note_id && !!obj.revision && obj.revision > 1 | ||
case 'note_deleted': | ||
return !!obj.note_id && obj.revision == null | ||
default: | ||
@@ -55,0 +61,0 @@ return !!obj[prop] |
@@ -10,3 +10,3 @@ // Copyright (c) 2017 Sho Kuroda <krdlab@gmail.com> | ||
TaskClosingType, | ||
ResponseWithJson, RemoteFile, RemoteFiles, | ||
ResponseWithJson, RemoteFile, RemoteFiles, Note, SentNote, | ||
} from "../types"; | ||
@@ -30,2 +30,4 @@ | ||
res.send({path: ["/path/to/image1", "/path/to/image2"], type: ["image/png", "image/png"]}); | ||
res.send({note_title: "title", note_content: "content"}); | ||
res.send({note_title: "title", note_content: "consent", note_attachments: [{path: "/path/to/local-file"}]}); | ||
res.topic(`test`); | ||
@@ -111,2 +113,29 @@ }); | ||
robot.respond(/create note$/i, res => { | ||
const c: Note & OnSend<SentNote> = { | ||
note_title: "タイトル", | ||
note_content: "本文", | ||
onsend: sent => { | ||
sent.note.id; | ||
} | ||
}; | ||
res.send(c); | ||
}); | ||
robot.respond("note_created", res => { | ||
res.json.note_id; | ||
res.json.title; | ||
res.json.revision; | ||
res.json.has_attachments; | ||
}); | ||
robot.respond("note_updated", res => { | ||
res.json.note_id; | ||
res.json.title; | ||
res.json.revision; | ||
res.json.has_attachments; | ||
}); | ||
robot.respond("note_deleted", res => { | ||
res.json.note_id; | ||
res.json.title; | ||
}); | ||
robot.respond(/yesno answers/i, res => { | ||
@@ -113,0 +142,0 @@ const cs: YesNo & OnSend<SentYesNo> = { |
@@ -43,2 +43,4 @@ // Copyright (c) 2017 Sho Kuroda <krdlab@gmail.com> | ||
| Task & SendTaskHandler | ||
| Note | ||
| Note & SendNoteHandler | ||
| CloseYesNo | CloseSelect | CloseTask | ||
@@ -57,2 +59,3 @@ | AttachmentFile | AttachmentFiles | ||
export type CloseTask = {close_task: MessageId}; | ||
export type Note = {note_title: string, note_content: string, note_attachments?: AttachmentFile[]}; | ||
@@ -79,2 +82,14 @@ export type AttachmentFile = { | ||
export type SentTask = SentAction<TaskAnswer, Task>; | ||
export type SentNote = { | ||
note: { | ||
id: string; | ||
noteRevision: { | ||
revision: number; | ||
title: string; | ||
contentType: number; | ||
contentText: string; | ||
contentFiles?: RemoteFile[]; | ||
} | ||
} | ||
}; | ||
@@ -90,2 +105,3 @@ type YesNoAnswer = (trues: DirectUser[], falses: DirectUser[]) => void; | ||
type SendTaskHandler = OnSend<SentTask> | WithOnReadStatusHandler<SentTask> | WithReadStatusProperties<SentTask>; | ||
type SendNoteHandler = OnSend<SentNote>; | ||
@@ -111,2 +127,3 @@ export type WithOnReadStatusHandler<S> = | ||
| ActualLocation | ||
| NoteCreated | NoteUpdated | NoteDeleted | ||
; | ||
@@ -119,5 +136,7 @@ | ||
export type RemoteFile = { | ||
id: string; | ||
name: string; | ||
content_type: string; | ||
content_size: number; | ||
url: string; | ||
}; | ||
@@ -134,1 +153,20 @@ export type RemoteFiles = { | ||
}; | ||
export type NoteCreated = { | ||
note_id: string; | ||
title: string; | ||
revision: number; | ||
has_attachments?: boolean; | ||
}; | ||
export type NoteUpdated = { | ||
note_id: string; | ||
title: string; | ||
revision: number; | ||
has_attachments?: boolean; | ||
}; | ||
export type NoteDeleted = { | ||
note_id: string; | ||
title: string; | ||
}; |
@@ -6,3 +6,3 @@ // Copyright (c) 2017 Sho Kuroda <krdlab@gmail.com> | ||
import { User, Message, MessageId, TextMessage, EnterMessage, LeaveMessage, JoinMessage, TopicMessage, CatchAllMessage } from "./message"; | ||
import { Response, ResponseWithJson, Stamp, YesNoWithResponse, SelectWithResponse, TaskWithResponse, RemoteFile, RemoteFiles, ActualLocation, SendableContent, JsonContent } from "./response"; | ||
import { Response, ResponseWithJson, Stamp, YesNoWithResponse, SelectWithResponse, TaskWithResponse, RemoteFile, RemoteFiles, ActualLocation, SendableContent, JsonContent, NoteCreated, NoteUpdated, NoteDeleted } from "./response"; | ||
@@ -13,3 +13,3 @@ export type Matcher = (msg: Message) => boolean; | ||
export type RespondType = "stamp" | "yesno" | "select" | "task" | "file" | "files" | "map"; | ||
export type RespondType = "stamp" | "yesno" | "select" | "task" | "file" | "files" | "map" | "note_created" | "note_updated" | "note_deleted"; | ||
export type TypedJsonCallback<T extends RespondType, J extends JsonContent> = (res: ResponseWithJson<J>) => void; | ||
@@ -32,2 +32,5 @@ | ||
respond(type: "map", callback: TypedJsonCallback<"map", ActualLocation>): void; | ||
respond(type: "note_created", callback: TypedJsonCallback<"note_created", NoteCreated>): void; | ||
respond(type: "note_updated", callback: TypedJsonCallback<"note_updated", NoteUpdated>): void; | ||
respond(type: "note_deleted", callback: TypedJsonCallback<"note_deleted", NoteDeleted>): void; | ||
@@ -34,0 +37,0 @@ enter(callback: Callback<EnterMessage>): void; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
311083
5254