diff --git a/Finish.omnifocusjs/Resources/finish.js b/Finish.omnifocusjs/Resources/finish.js index df42f9c..958ffbf 100644 --- a/Finish.omnifocusjs/Resources/finish.js +++ b/Finish.omnifocusjs/Resources/finish.js @@ -82,7 +82,7 @@ } }); action.validate = function (selection, sender) { - return (selection.tasks.length === 1 && !selection.tasks[0].hasChildren); + return selection.tasks.length === 1 && !selection.tasks[0].hasChildren; }; return action; })(); diff --git a/Finish.omnifocusjs/Resources/finish.ts b/Finish.omnifocusjs/Resources/finish.ts index 2072327..f607796 100644 --- a/Finish.omnifocusjs/Resources/finish.ts +++ b/Finish.omnifocusjs/Resources/finish.ts @@ -1,10 +1,13 @@ (() => { var action = new PlugIn.Action(async (selection: Selection, sender: any) => { try { - let originalTask = selection.tasks[0] + let originalTask = selection.tasks[0]; originalTask.flagged = false; - let isDoneAlert = new Alert("Is this task completely done?", originalTask.name); + let isDoneAlert = new Alert( + "Is this task completely done?", + originalTask.name + ); isDoneAlert.addOption("Yep!"); isDoneAlert.addOption("Not quite"); isDoneAlert.addOption("Whoops, never mind!"); @@ -20,7 +23,10 @@ let currentSibling = originalTask; while (true) { - let nextThingAlert = new Alert("Is there anything that has to happen next?", currentSibling.name); + let nextThingAlert = new Alert( + "Is there anything that has to happen next?", + currentSibling.name + ); nextThingAlert.addOption("Yep!"); nextThingAlert.addOption("No, we're all done"); @@ -30,17 +36,21 @@ } let nextSiblingForm = new Form(); - nextSiblingForm.addField(new Form.Field.String("name", "What's Next?")); + nextSiblingForm.addField( + new Form.Field.String("name", "What's Next?") + ); nextSiblingForm.addField(new Form.Field.String("note", "Notes")); - await nextSiblingForm.show(`What's the next thing that needs to happen after "${currentSibling.name}"?`, "Save"); + await nextSiblingForm.show( + `What's the next thing that needs to happen after "${currentSibling.name}"?`, + "Save" + ); - var values = nextSiblingForm.values as { name: string, note: string } + var values = nextSiblingForm.values as { name: string; note: string }; currentSibling = new Task(values.name, currentSibling.after); currentSibling.note = values.note; currentSibling.addTags(originalTask.tags); } - } else if (isDoneAnswer == 1) { ///////////////////////////// // No, it's not quite done // @@ -48,16 +58,22 @@ let nextThingForm = new Form(); nextThingForm.addField(new Form.Field.String("name", "What's Next?")); nextThingForm.addField(new Form.Field.String("note", "Notes")); - await nextThingForm.show(`What's the next thing that needs to happen to finish "${originalTask.name}"?`, "Save"); + await nextThingForm.show( + `What's the next thing that needs to happen to finish "${originalTask.name}"?`, + "Save" + ); - var values = nextThingForm.values as { name: string, note: string } + var values = nextThingForm.values as { name: string; note: string }; let currentSibling = new Task(values.name, originalTask.beginning); currentSibling.note = values.note; currentSibling.addTags(originalTask.tags); while (true) { - let nextThingAlert = new Alert("Is there anything that'd have to happen after this is done?", currentSibling.name); + let nextThingAlert = new Alert( + "Is there anything that'd have to happen after this is done?", + currentSibling.name + ); nextThingAlert.addOption("Yep!"); nextThingAlert.addOption("No, not for now"); @@ -67,28 +83,34 @@ } let nextSiblingForm = new Form(); - nextSiblingForm.addField(new Form.Field.String("name", "What's Next?")); + nextSiblingForm.addField( + new Form.Field.String("name", "What's Next?") + ); nextSiblingForm.addField(new Form.Field.String("note", "Notes")); - await nextSiblingForm.show(`What's the next thing that needs to happen after "${currentSibling.name}"?`, "Save"); + await nextSiblingForm.show( + `What's the next thing that needs to happen after "${currentSibling.name}"?`, + "Save" + ); - values = nextSiblingForm.values as { name: string, note: string } + values = nextSiblingForm.values as { name: string; note: string }; currentSibling = new Task(values.name, currentSibling.after); currentSibling.note = values.note; currentSibling.addTags(originalTask.tags); } - } else if (isDoneAnswer == 2) { /////////////////////////////////////// // Whoops, didn't mean to click that // /////////////////////////////////////// return; - } else { ///////////////////////////////////////// // We forgot how many answers we added // ///////////////////////////////////////// - new Alert("Whoops!", `I got a value of '${isDoneAnswer}' from that alert, but I'm not sure what that means. This is a plugin bug!`) + new Alert( + "Whoops!", + `I got a value of '${isDoneAnswer}' from that alert, but I'm not sure what that means. This is a plugin bug!` + ); return; } } catch (err) { @@ -96,9 +118,9 @@ } }); - action.validate = function(selection: Selection, sender: any){ - return (selection.tasks.length === 1 && !selection.tasks[0].hasChildren) + action.validate = function (selection: Selection, sender: any) { + return selection.tasks.length === 1 && !selection.tasks[0].hasChildren; }; - + return action; })(); diff --git a/GitHub.omnifocusjs/Resources/pull.js b/GitHub.omnifocusjs/Resources/pull.js index b7fba53..abd01e3 100644 --- a/GitHub.omnifocusjs/Resources/pull.js +++ b/GitHub.omnifocusjs/Resources/pull.js @@ -33,14 +33,14 @@ req.bodyString = `{"query":"{ search(type: ISSUE, query: \\"is:issue assignee:${login} state:open\\", last: 100) { nodes { ... on Issue { number title body url repository { name owner { login } } } } } }"}`; req.headers = { "Content-Type": "application/json", - "Authorization": `bearer ${key}`, + Authorization: `bearer ${key}`, }; - let resp = await (req.fetch().catch((err) => { + let resp = await req.fetch().catch((err) => { console.error("Problem fetching issues:", err); let alert = new Alert("Problem fetching from GitHub", err); alert.show(); throw err; - })); + }); if (resp.bodyString === null) { throw "body string was null. Did the request succeed?"; } @@ -48,8 +48,10 @@ let toFocus = []; for (let issue of body.data.search.nodes) { let gitHubTag = flattenedTags.byName("from GitHub") || new Tag("from GitHub"); - let orgTag = gitHubTag.tagNamed(issue.repository.owner.login) || new Tag(issue.repository.owner.login, gitHubTag); - let repoTag = orgTag.tagNamed(issue.repository.name) || new Tag(issue.repository.name, orgTag); + let orgTag = gitHubTag.tagNamed(issue.repository.owner.login) || + new Tag(issue.repository.owner.login, gitHubTag); + let repoTag = orgTag.tagNamed(issue.repository.name) || + new Tag(issue.repository.name, orgTag); let repo = `${issue.repository.owner.login}/${issue.repository.name}`; let projectName = `${repo}#${issue.number}: ${issue.title}`; let project = flattenedProjects.byName(projectName) || new Project(projectName); diff --git a/GitHub.omnifocusjs/Resources/pull.ts b/GitHub.omnifocusjs/Resources/pull.ts index 093224e..97e324e 100644 --- a/GitHub.omnifocusjs/Resources/pull.ts +++ b/GitHub.omnifocusjs/Resources/pull.ts @@ -1,102 +1,116 @@ (() => { - let creds = new Credentials(); - - var action = new PlugIn.Action(async () => { - try { - let req = URL.FetchRequest.fromString("https://api.github.com/graphql"); - if (req === null || req.url === null || req.url.host === null) { - throw "could not parse the URL for GitHub's GraphQL API" - } - - ///////////////////////////////////// - // Step 1: make sure we have creds // - ///////////////////////////////////// - let stored = creds.read(req.url.host); - - let login = null; - let key = null; - - if (stored === null || app.optionKeyDown) { - let credsForm = new Form(); - credsForm.addField(new Form.Field.String("login", "Login")); - credsForm.addField(new Form.Field.Password("key", "API Key")); - - await credsForm.show("Let's set up: we need your GitHub username and an API key with the\n`repo` permission to pull issues from your assigned repos.\n\nCreate this at https://github.com/settings/tokens\n\nYou can get back here in the future to rotate tokens by holding\noption while activating the workflow.", "Save Key"); - login = (credsForm.values as { login: string }).login; - key = (credsForm.values as { key: string }).key; - - creds.write(req.url.host, login, key); - } else { - login = stored.user; - key = stored.password; - } - - //////////////////////////// - // Step 2: get the issues // - //////////////////////////// - req.method = "POST"; - req.bodyString = `{"query":"{ search(type: ISSUE, query: \\"is:issue assignee:${login} state:open\\", last: 100) { nodes { ... on Issue { number title body url repository { name owner { login } } } } } }"}`; - req.headers = { - "Content-Type": "application/json", - "Authorization": `bearer ${key}`, - }; - - let resp = await (req.fetch().catch((err) => { - console.error("Problem fetching issues:", err); - let alert = new Alert("Problem fetching from GitHub", err); - alert.show(); - throw err; - })); - - if (resp.bodyString === null) { - throw "body string was null. Did the request succeed?" - } - - let body = JSON.parse(resp.bodyString); - - ////////////////////////////////// - // Step 3: make the tasks in OF // - ////////////////////////////////// - type Issue = { - number: number, - title: string, - body: string, - url: string, - repository: { - name: string, - owner: { - login: string, - }, - }, - }; - - let toFocus: Array = []; - for (let issue of body.data.search.nodes as Issue[]) { - let gitHubTag = flattenedTags.byName("from GitHub") || new Tag("from GitHub"); - let orgTag = gitHubTag.tagNamed(issue.repository.owner.login) || new Tag(issue.repository.owner.login, gitHubTag); - let repoTag = orgTag.tagNamed(issue.repository.name) || new Tag(issue.repository.name, orgTag); - - let repo = `${issue.repository.owner.login}/${issue.repository.name}`; - let projectName = `${repo}#${issue.number}: ${issue.title}`; - let project = flattenedProjects.byName(projectName) || new Project(projectName); - project.addTag(repoTag); - project.note = `${issue.url}\n\n---\n\n${issue.body}`; - toFocus.push(project); - - if (project.tasks.length === 0) { - new Task(`what needs to be done for ${repo}#${issue.number}?`, project); - } - } - - if (app.platformName === "macOS") { - document.windows[0].perspective = Perspective.BuiltIn.Projects; - document.windows[0].focus = toFocus as SectionArray; - } - } catch (err) { - console.error(err); - throw err; + let creds = new Credentials(); + + var action = new PlugIn.Action(async () => { + try { + let req = URL.FetchRequest.fromString("https://api.github.com/graphql"); + if (req === null || req.url === null || req.url.host === null) { + throw "could not parse the URL for GitHub's GraphQL API"; + } + + ///////////////////////////////////// + // Step 1: make sure we have creds // + ///////////////////////////////////// + let stored = creds.read(req.url.host); + + let login = null; + let key = null; + + if (stored === null || app.optionKeyDown) { + let credsForm = new Form(); + credsForm.addField(new Form.Field.String("login", "Login")); + credsForm.addField(new Form.Field.Password("key", "API Key")); + + await credsForm.show( + "Let's set up: we need your GitHub username and an API key with the\n`repo` permission to pull issues from your assigned repos.\n\nCreate this at https://github.com/settings/tokens\n\nYou can get back here in the future to rotate tokens by holding\noption while activating the workflow.", + "Save Key" + ); + login = (credsForm.values as { login: string }).login; + key = (credsForm.values as { key: string }).key; + + creds.write(req.url.host, login, key); + } else { + login = stored.user; + key = stored.password; + } + + //////////////////////////// + // Step 2: get the issues // + //////////////////////////// + req.method = "POST"; + req.bodyString = `{"query":"{ search(type: ISSUE, query: \\"is:issue assignee:${login} state:open\\", last: 100) { nodes { ... on Issue { number title body url repository { name owner { login } } } } } }"}`; + req.headers = { + "Content-Type": "application/json", + Authorization: `bearer ${key}`, + }; + + let resp = await req.fetch().catch((err) => { + console.error("Problem fetching issues:", err); + let alert = new Alert("Problem fetching from GitHub", err); + alert.show(); + throw err; + }); + + if (resp.bodyString === null) { + throw "body string was null. Did the request succeed?"; + } + + let body = JSON.parse(resp.bodyString); + + ////////////////////////////////// + // Step 3: make the tasks in OF // + ////////////////////////////////// + type Issue = { + number: number; + title: string; + body: string; + url: string; + repository: { + name: string; + owner: { + login: string; + }; + }; + }; + + let toFocus: Array = []; + for (let issue of body.data.search.nodes as Issue[]) { + let gitHubTag = + flattenedTags.byName("from GitHub") || new Tag("from GitHub"); + + let orgTag = + gitHubTag.tagNamed(issue.repository.owner.login) || + new Tag(issue.repository.owner.login, gitHubTag); + + let repoTag = + orgTag.tagNamed(issue.repository.name) || + new Tag(issue.repository.name, orgTag); + + let repo = `${issue.repository.owner.login}/${issue.repository.name}`; + let projectName = `${repo}#${issue.number}: ${issue.title}`; + let project = + flattenedProjects.byName(projectName) || new Project(projectName); + project.addTag(repoTag); + project.note = `${issue.url}\n\n---\n\n${issue.body}`; + toFocus.push(project); + + if (project.tasks.length === 0) { + new Task( + `what needs to be done for ${repo}#${issue.number}?`, + project + ); } - }); + } + + if (app.platformName === "macOS") { + document.windows[0].perspective = Perspective.BuiltIn.Projects; + document.windows[0].focus = toFocus as SectionArray; + } + } catch (err) { + console.error(err); + throw err; + } + }); - return action; + return action; })(); diff --git a/Linear.omnifocusjs/Resources/pull.js b/Linear.omnifocusjs/Resources/pull.js index e7f1a96..4630908 100644 --- a/Linear.omnifocusjs/Resources/pull.js +++ b/Linear.omnifocusjs/Resources/pull.js @@ -26,17 +26,18 @@ // Step 2: get the tasks // /////////////////////////// req.method = "POST"; - req.bodyString = '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}'; + req.bodyString = + '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}'; req.headers = { "Content-Type": "application/json", - "Authorization": key, + Authorization: key, }; - let resp = await (req.fetch().catch((err) => { + let resp = await req.fetch().catch((err) => { console.error("Problem fetching tasks:", err); let alert = new Alert("Problem fetching from Linear", err); alert.show(); throw err; - })); + }); if (resp.bodyString === null) { throw "body string was null. Did the request succeed?"; } @@ -47,7 +48,8 @@ let toFocus = []; for (let linearTask of body.data.viewer.assignedIssues.nodes) { let teamsTag = flattenedTags.byName("teams") || new Tag("teams"); - let teamTag = teamsTag.tagNamed(linearTask.team.name) || new Tag(linearTask.team.name, teamsTag); + let teamTag = teamsTag.tagNamed(linearTask.team.name) || + new Tag(linearTask.team.name, teamsTag); let linearTag = flattenedTags.byName("from Linear") || new Tag("from Linear"); let projectName = `${linearTask.team.name} Non-Project Tasks`; if (linearTask.project !== null) { @@ -59,7 +61,8 @@ project.containsSingletonActions = true; project.status = Project.Status.Active; toFocus.push(project); - if (linearTask.project && project.note.indexOf(linearTask.project.url) === -1) { + if (linearTask.project && + project.note.indexOf(linearTask.project.url) === -1) { if (project.note !== "") { project.appendStringToNote(`\n\n${linearTask.project.url}`); } diff --git a/Linear.omnifocusjs/Resources/pull.ts b/Linear.omnifocusjs/Resources/pull.ts index df0bee8..8981561 100644 --- a/Linear.omnifocusjs/Resources/pull.ts +++ b/Linear.omnifocusjs/Resources/pull.ts @@ -1,104 +1,118 @@ (() => { - let creds = new Credentials(); - - var action = new PlugIn.Action(async () => { - try { - let req = URL.FetchRequest.fromString("https://api.linear.app/graphql"); - if (req === null || req.url === null || req.url.host === null) { - throw "could not parse the URL for Linear's API" - } - - ///////////////////////////////////// - // Step 1: make sure we have creds // - ///////////////////////////////////// - let stored = creds.read(req.url.host); - - let key = null; - if (stored === null || app.optionKeyDown) { - let credsForm = new Form(); - credsForm.addField(new Form.Field.Password("key", "API Key")); - - await credsForm.show("Please create a personal API key in the Linear settings and paste it here\n(hold option while activating this workflow in the future to reset this)", "Save Key"); - key = (credsForm.values as { key: string }).key; - - creds.write(req.url.host, "-", key); - } else { - key = stored.password; - } - - /////////////////////////// - // Step 2: get the tasks // - /////////////////////////// - req.method = "POST"; - req.bodyString = '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}'; - req.headers = { - "Content-Type": "application/json", - "Authorization": key, - }; - - let resp = await (req.fetch().catch((err) => { - console.error("Problem fetching tasks:", err); - let alert = new Alert("Problem fetching from Linear", err); - alert.show(); - throw err; - })); - - if (resp.bodyString === null) { - throw "body string was null. Did the request succeed?" - } - - let body = JSON.parse(resp.bodyString); - - ////////////////////////////////// - // Step 3: make the tasks in OF // - ////////////////////////////////// - let toFocus: Array = []; - for (let linearTask of body.data.viewer.assignedIssues.nodes) { - let teamsTag = flattenedTags.byName("teams") || new Tag("teams"); - let teamTag = teamsTag.tagNamed(linearTask.team.name) || new Tag(linearTask.team.name, teamsTag); - - let linearTag = flattenedTags.byName("from Linear") || new Tag("from Linear"); - - let projectName = `${linearTask.team.name} Non-Project Tasks`; - if (linearTask.project !== null) { - projectName = linearTask.project.name; - } - - let project = flattenedProjects.byName(projectName) || new Project(projectName); - project.addTag(teamTag); - project.addTag(linearTag); - project.containsSingletonActions = true; - toFocus.push(project); - if (linearTask.project && project.note.indexOf(linearTask.project.url) === -1) { - if (project.note !== "") { - project.appendStringToNote(`\n\n${linearTask.project.url}`); - } else { - project.appendStringToNote(linearTask.project.url) - } - } - - let taskName = `${linearTask.identifier}: ${linearTask.title}`; - let task = project.taskNamed(taskName) || new Task(taskName, project); - task.addTag(teamTag); - task.addTag(linearTag); - if (task.note.indexOf(linearTask.url) === -1) { - if (task.note !== "") { - task.appendStringToNote(`\n\n${linearTask.url}`); - } else { - task.appendStringToNote(linearTask.url) - } - } - } - - if (app.platformName === "macOS") { - document.windows[0].perspective = Perspective.BuiltIn.Projects; - document.windows[0].focus = toFocus as SectionArray; - } - } catch (err) { - console.error(err); - throw err; + let creds = new Credentials(); + + var action = new PlugIn.Action(async () => { + try { + let req = URL.FetchRequest.fromString("https://api.linear.app/graphql"); + if (req === null || req.url === null || req.url.host === null) { + throw "could not parse the URL for Linear's API"; + } + + ///////////////////////////////////// + // Step 1: make sure we have creds // + ///////////////////////////////////// + let stored = creds.read(req.url.host); + + let key = null; + if (stored === null || app.optionKeyDown) { + let credsForm = new Form(); + credsForm.addField(new Form.Field.Password("key", "API Key")); + + await credsForm.show( + "Please create a personal API key in the Linear settings and paste it here\n(hold option while activating this workflow in the future to reset this)", + "Save Key" + ); + key = (credsForm.values as { key: string }).key; + + creds.write(req.url.host, "-", key); + } else { + key = stored.password; + } + + /////////////////////////// + // Step 2: get the tasks // + /////////////////////////// + req.method = "POST"; + req.bodyString = + '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}'; + req.headers = { + "Content-Type": "application/json", + Authorization: key, + }; + + let resp = await req.fetch().catch((err) => { + console.error("Problem fetching tasks:", err); + let alert = new Alert("Problem fetching from Linear", err); + alert.show(); + throw err; + }); + + if (resp.bodyString === null) { + throw "body string was null. Did the request succeed?"; + } + + let body = JSON.parse(resp.bodyString); + + ////////////////////////////////// + // Step 3: make the tasks in OF // + ////////////////////////////////// + let toFocus: Array = []; + for (let linearTask of body.data.viewer.assignedIssues.nodes) { + let teamsTag = flattenedTags.byName("teams") || new Tag("teams"); + let teamTag = + teamsTag.tagNamed(linearTask.team.name) || + new Tag(linearTask.team.name, teamsTag); + + let linearTag = + flattenedTags.byName("from Linear") || new Tag("from Linear"); + + let projectName = `${linearTask.team.name} Non-Project Tasks`; + if (linearTask.project !== null) { + projectName = linearTask.project.name; } - }); - return action; + let project = + flattenedProjects.byName(projectName) || new Project(projectName); + project.addTag(teamTag); + project.addTag(linearTag); + project.containsSingletonActions = true; + project.status = Project.Status.Active; + + toFocus.push(project); + if ( + linearTask.project && + project.note.indexOf(linearTask.project.url) === -1 + ) { + if (project.note !== "") { + project.appendStringToNote(`\n\n${linearTask.project.url}`); + } else { + project.appendStringToNote(linearTask.project.url); + } + } + + let taskName = `${linearTask.identifier}: ${linearTask.title}`; + let task = project.taskNamed(taskName) || new Task(taskName, project); + task.addTag(teamTag); + task.addTag(linearTag); + task.markIncomplete(); + if (task.note.indexOf(linearTask.url) === -1) { + if (task.note !== "") { + task.appendStringToNote(`\n\n${linearTask.url}`); + } else { + task.appendStringToNote(linearTask.url); + } + } + } + + if (app.platformName === "macOS") { + document.windows[0].perspective = Perspective.BuiltIn.Projects; + document.windows[0].focus = toFocus as SectionArray; + } + } catch (err) { + console.error(err); + throw err; + } + }); + + return action; })(); diff --git a/Session.omnifocusjs/Resources/start.js b/Session.omnifocusjs/Resources/start.js index c0aa4ba..08375ee 100644 --- a/Session.omnifocusjs/Resources/start.js +++ b/Session.omnifocusjs/Resources/start.js @@ -8,21 +8,21 @@ don't! Modify the .ts file and run `tsc` instead! if (tag.name == "Wandering Toolmaker") { return tag.name; } - else if (tag.name == "teams" || (tag.parent && tag.parent.name == "teams") || tag.name == "work" || (tag.parent && tag.parent.name == "work")) { + else if (tag.name == "teams" || + (tag.parent && tag.parent.name == "teams") || + tag.name == "work" || + (tag.parent && tag.parent.name == "work")) { return "Team"; } - else if (tag.name == "personal" || (tag.parent && tag.parent.name == "personal")) { + else if (tag.name == "personal" || + (tag.parent && tag.parent.name == "personal")) { return "Personal"; } return null; } var action = new PlugIn.Action(async (selection, sender) => { try { - let possibleCategories = [ - "Personal", - "Team", - "Wandering Toolmaker", - ]; + let possibleCategories = ["Personal", "Team", "Wandering Toolmaker"]; let defaultCategory = possibleCategories[0]; let defaultProject = null; let defaultMinutes = "25"; @@ -76,7 +76,9 @@ don't! Modify the .ts file and run `tsc` instead! } }); action.validate = function (selection, sender) { - return (selection.tasks.length === 1 || selection.tags.length === 1 || selection.projects.length === 1); + return (selection.tasks.length === 1 || + selection.tags.length === 1 || + selection.projects.length === 1); }; return action; })(); diff --git a/Session.omnifocusjs/Resources/start.ts b/Session.omnifocusjs/Resources/start.ts index 162fe10..3aadfce 100644 --- a/Session.omnifocusjs/Resources/start.ts +++ b/Session.omnifocusjs/Resources/start.ts @@ -5,85 +5,100 @@ don't! Modify the .ts file and run `tsc` instead! (() => { function findCategory(tag: Tag): string | null { if (tag.name == "Wandering Toolmaker") { - return tag.name - - } else if (tag.name == "teams" || (tag.parent && tag.parent.name == "teams") || tag.name == "work" || (tag.parent && tag.parent.name == "work")) { - return "Team" - - } else if (tag.name == "personal" || (tag.parent && tag.parent.name == "personal")) { - return "Personal" + return tag.name; + } else if ( + tag.name == "teams" || + (tag.parent && tag.parent.name == "teams") || + tag.name == "work" || + (tag.parent && tag.parent.name == "work") + ) { + return "Team"; + } else if ( + tag.name == "personal" || + (tag.parent && tag.parent.name == "personal") + ) { + return "Personal"; } - return null + return null; } var action = new PlugIn.Action(async (selection: Selection, sender: any) => { try { - - let possibleCategories = [ - "Personal", - "Team", - "Wandering Toolmaker", - ]; + let possibleCategories = ["Personal", "Team", "Wandering Toolmaker"]; let defaultCategory: string = possibleCategories[0]; let defaultProject: string | null = null; let defaultMinutes: string = "25"; if (selection.tasks[0]) { - let task = selection.tasks[0] + let task = selection.tasks[0]; for (let tag of task.tags) { let category = findCategory(tag); if (category !== null) { - defaultCategory = category - break + defaultCategory = category; + break; } } if (task.containingProject) { defaultProject = task.containingProject.name; } - } else if (selection.tags[0]) { - let tag = selection.tags[0] + let tag = selection.tags[0]; - defaultProject = tag.name + defaultProject = tag.name; - let category = findCategory(tag) + let category = findCategory(tag); if (category !== null) { - defaultCategory = category + defaultCategory = category; } - } else if (selection.projects[0]) { - let project = selection.projects[0] + let project = selection.projects[0]; - defaultProject = project.name + defaultProject = project.name; for (let tag of project.tags) { let category = findCategory(tag); if (category !== null) { - defaultCategory = category - break + defaultCategory = category; + break; } } } let focusForm = new Form(); - focusForm.addField(new Form.Field.String("project", "Project", defaultProject)); - focusForm.addField(new Form.Field.Option("category", "Category", possibleCategories, possibleCategories, defaultCategory)); - focusForm.addField(new Form.Field.String("minutes", "Minutes", defaultMinutes)); + focusForm.addField( + new Form.Field.String("project", "Project", defaultProject) + ); + focusForm.addField( + new Form.Field.Option( + "category", + "Category", + possibleCategories, + possibleCategories, + defaultCategory + ) + ); + focusForm.addField( + new Form.Field.String("minutes", "Minutes", defaultMinutes) + ); await focusForm.show("Focus on…", "Start"); let values = focusForm.values as { - project: string, - category: string, - minutes: string, + project: string; + category: string; + minutes: string; }; - let rawSessionUrl = `session:///start?intent=${encodeURIComponent(values.project)}&categoryName=${encodeURIComponent(values.category)}&duration=${encodeURIComponent(values.minutes)}` - let sessionUrl = URL.fromString(rawSessionUrl) + let rawSessionUrl = `session:///start?intent=${encodeURIComponent( + values.project + )}&categoryName=${encodeURIComponent( + values.category + )}&duration=${encodeURIComponent(values.minutes)}`; + let sessionUrl = URL.fromString(rawSessionUrl); if (sessionUrl === null) { - throw `failed to parse session string ("${rawSessionUrl}") into a URL` + throw `failed to parse session string ("${rawSessionUrl}") into a URL`; } sessionUrl.open(); } catch (err) { @@ -91,8 +106,12 @@ don't! Modify the .ts file and run `tsc` instead! } }); - action.validate = function(selection: Selection, sender: any){ - return (selection.tasks.length === 1 || selection.tags.length === 1 || selection.projects.length === 1) + action.validate = function (selection: Selection, sender: any) { + return ( + selection.tasks.length === 1 || + selection.tags.length === 1 || + selection.projects.length === 1 + ); }; return action; diff --git a/types/omnifocus-globals.d.ts b/types/omnifocus-globals.d.ts index 008903c..243e093 100644 --- a/types/omnifocus-globals.d.ts +++ b/types/omnifocus-globals.d.ts @@ -1,13 +1,13 @@ -declare const app: Application +declare const app: Application; -declare const console: Console +declare const console: Console; -declare const document: DatabaseDocument +declare const document: DatabaseDocument; -declare const inbox: Inbox +declare const inbox: Inbox; -declare const flattenedProjects : ProjectArray +declare const flattenedProjects: ProjectArray; -declare const flattenedTags : TagArray +declare const flattenedTags: TagArray; -declare const flattenedTasks : TaskArray +declare const flattenedTasks: TaskArray; diff --git a/types/omnifocus.d.ts b/types/omnifocus.d.ts index 0c2b8d8..836329b 100644 --- a/types/omnifocus.d.ts +++ b/types/omnifocus.d.ts @@ -11,1689 +11,1748 @@ // } // } - // Alert declare class Alert { - constructor (title: string, message: string); - show(callback?: Function | null): Promise; - addOption(string: string); + constructor(title: string, message: string); + show(callback?: Function | null): Promise; + addOption(string: string); } // Application declare class Application { - openDocument(from: Document | null, url: URL, completed: Function); - readonly buildVersion: Version; - readonly commandKeyDown: boolean; - readonly controlKeyDown: boolean; - readonly name: string; - readonly optionKeyDown: boolean; - readonly platformName: string; - readonly shiftKeyDown: boolean; - readonly userVersion: Version; - readonly version: string; + openDocument(from: Document | null, url: URL, completed: Function); + readonly buildVersion: Version; + readonly commandKeyDown: boolean; + readonly controlKeyDown: boolean; + readonly name: string; + readonly optionKeyDown: boolean; + readonly platformName: string; + readonly shiftKeyDown: boolean; + readonly userVersion: Version; + readonly version: string; } // ApplyResult declare namespace ApplyResult { - const SkipChildren: ApplyResult; - const SkipPeers: ApplyResult; - const Stop: ApplyResult; - const all: Array; + const SkipChildren: ApplyResult; + const SkipPeers: ApplyResult; + const Stop: ApplyResult; + const all: Array; } -declare class ApplyResult { -} +declare class ApplyResult {} // FolderArray declare class FolderArray extends Array { - byName(name: string): Folder | null; + byName(name: string): Folder | null; } // ProjectArray declare class ProjectArray extends Array { - byName(name: string): Project | null; + byName(name: string): Project | null; } // SectionArray declare class SectionArray extends Array { - byName(name: string): Project | Folder | null; + byName(name: string): Project | Folder | null; } // Library declare class Library extends SectionArray { - apply(f: Function): ApplyResult | null; - readonly beginning: Folder.ChildInsertionLocation; - readonly ending: Folder.ChildInsertionLocation; + apply(f: Function): ApplyResult | null; + readonly beginning: Folder.ChildInsertionLocation; + readonly ending: Folder.ChildInsertionLocation; } // TagArray declare class TagArray extends Array { - byName(name: string): Tag | null; + byName(name: string): Tag | null; } // Tags declare class Tags extends TagArray { - apply(f: Function): ApplyResult | null; - readonly beginning: Tag.ChildInsertionLocation; - readonly ending: Tag.ChildInsertionLocation; + apply(f: Function): ApplyResult | null; + readonly beginning: Tag.ChildInsertionLocation; + readonly ending: Tag.ChildInsertionLocation; } // TaskArray declare class TaskArray extends Array { - byName(name: string): Task | null; + byName(name: string): Task | null; } // Inbox declare class Inbox extends TaskArray { - apply(f: Function): ApplyResult | null; - readonly beginning: Task.ChildInsertionLocation; - readonly ending: Task.ChildInsertionLocation; + apply(f: Function): ApplyResult | null; + readonly beginning: Task.ChildInsertionLocation; + readonly ending: Task.ChildInsertionLocation; } // Calendar declare namespace Calendar { - const buddhist: Calendar; - const chinese: Calendar; - const coptic: Calendar; - const current: Calendar; - const ethiopicAmeteAlem: Calendar; - const ethiopicAmeteMihret: Calendar; - const gregorian: Calendar; - const hebrew: Calendar; - const indian: Calendar; - const islamic: Calendar; - const islamicCivil: Calendar; - const islamicTabular: Calendar; - const islamicUmmAlQura: Calendar; - const iso8601: Calendar; - const japanese: Calendar; - const persian: Calendar; - const republicOfChina: Calendar; + const buddhist: Calendar; + const chinese: Calendar; + const coptic: Calendar; + const current: Calendar; + const ethiopicAmeteAlem: Calendar; + const ethiopicAmeteMihret: Calendar; + const gregorian: Calendar; + const hebrew: Calendar; + const indian: Calendar; + const islamic: Calendar; + const islamicCivil: Calendar; + const islamicTabular: Calendar; + const islamicUmmAlQura: Calendar; + const iso8601: Calendar; + const japanese: Calendar; + const persian: Calendar; + const republicOfChina: Calendar; } declare class Calendar { - dateByAddingDateComponents(date: Date, components: DateComponents): Date | null; - dateFromDateComponents(components: DateComponents): Date | null; - dateComponentsFromDate(date: Date): DateComponents; - dateComponentsBetweenDates(start: Date, end: Date): DateComponents; - startOfDay(date: Date): Date; - readonly identifier: string; - readonly locale: Locale | null; - readonly timeZone: TimeZone; + dateByAddingDateComponents( + date: Date, + components: DateComponents + ): Date | null; + dateFromDateComponents(components: DateComponents): Date | null; + dateComponentsFromDate(date: Date): DateComponents; + dateComponentsBetweenDates(start: Date, end: Date): DateComponents; + startOfDay(date: Date): Date; + readonly identifier: string; + readonly locale: Locale | null; + readonly timeZone: TimeZone; } // Color declare namespace Color { - function RGB(r: number, g: number, b: number, a: number | null): Color; - function HSB(h: number, s: number, b: number, a: number | null): Color; - function White(w: number, a: number | null): Color; - const black: Color; - const blue: Color; - const brown: Color; - const clear: Color; - const cyan: Color; - const darkGray: Color; - const gray: Color; - const green: Color; - const lightGray: Color; - const magenta: Color; - const orange: Color; - const purple: Color; - const red: Color; - const white: Color; - const yellow: Color; + function RGB(r: number, g: number, b: number, a: number | null): Color; + function HSB(h: number, s: number, b: number, a: number | null): Color; + function White(w: number, a: number | null): Color; + const black: Color; + const blue: Color; + const brown: Color; + const clear: Color; + const cyan: Color; + const darkGray: Color; + const gray: Color; + const green: Color; + const lightGray: Color; + const magenta: Color; + const orange: Color; + const purple: Color; + const red: Color; + const white: Color; + const yellow: Color; } declare class Color { - blend(otherColor: Color, fraction: number): Color | null; - readonly alpha: number; - readonly blue: number; - readonly brightness: number; - readonly colorSpace: ColorSpace; - readonly green: number; - readonly hue: number; - readonly red: number; - readonly saturation: number; - readonly white: number; + blend(otherColor: Color, fraction: number): Color | null; + readonly alpha: number; + readonly blue: number; + readonly brightness: number; + readonly colorSpace: ColorSpace; + readonly green: number; + readonly hue: number; + readonly red: number; + readonly saturation: number; + readonly white: number; } // ColorSpace declare namespace ColorSpace { - const CMYK: ColorSpace; - const HSB: ColorSpace; - const Named: ColorSpace; - const Pattern: ColorSpace; - const RGB: ColorSpace; - const White: ColorSpace; - const all: Array; + const CMYK: ColorSpace; + const HSB: ColorSpace; + const Named: ColorSpace; + const Pattern: ColorSpace; + const RGB: ColorSpace; + const White: ColorSpace; + const all: Array; } -declare class ColorSpace { -} +declare class ColorSpace {} // Console declare class Console { - log(message: any, additional?: Array); - error(message: any, additional?: Array); - info(message: any, additional?: Array); - warn(message: any, additional?: Array); - clear(); + log(message: any, additional?: Array); + error(message: any, additional?: Array); + info(message: any, additional?: Array); + warn(message: any, additional?: Array); + clear(); } // Credentials declare class Credentials { - constructor (); - read(service: string): { user: string, password: string } | null; - write(service: string, username: string, password: string); - remove(service: string); - readBookmark(service: string): URL.Bookmark | null; - writeBookmark(service: string, bookmark: URL.Bookmark); + constructor(); + read(service: string): { user: string; password: string } | null; + write(service: string, username: string, password: string); + remove(service: string); + readBookmark(service: string): URL.Bookmark | null; + writeBookmark(service: string, bookmark: URL.Bookmark); } // Data declare namespace Data { - function fromString(string: string): Data; - function fromBase64(string: string): Data; + function fromString(string: string): Data; + function fromBase64(string: string): Data; } declare class Data { - toString(): string; - toBase64(): string; - readonly length: number; - readonly toObject: Object | null; + toString(): string; + toBase64(): string; + readonly length: number; + readonly toObject: Object | null; } // Database declare class Database { - tagNamed(name: string): Tag | null; - folderNamed(name: string): Folder | null; - projectNamed(name: string): Project | null; - projectsMatching(search: string): Array; - foldersMatching(search: string): Array; - tagsMatching(search: string): Array; - taskNamed(name: string): Task | null; - save(); - moveTasks(tasks: Array, position: Project | Task | Task.ChildInsertionLocation); - duplicateTasks(tasks: Array, position: Project | Task | Task.ChildInsertionLocation): TaskArray; - convertTasksToProjects(tasks: Array, position: Folder | Folder.ChildInsertionLocation): Array; - moveSections(sections: Array, position: Folder | Folder.ChildInsertionLocation); - duplicateSections(sections: Array, position: Folder | Folder.ChildInsertionLocation): SectionArray; - moveTags(tags: Array, position: Tag | Tag.ChildInsertionLocation); - duplicateTags(tags: Array, position: Tag | Tag.ChildInsertionLocation): TagArray; - cleanUp(); - undo(); - redo(); - deleteObject(object: DatabaseObject); - copyTasksToPasteboard(tasks: Array, pasteboard: Pasteboard); - canPasteTasks(pasteboard: Pasteboard): boolean; - pasteTasksFromPasteboard(pasteboard: Pasteboard): Array; - readonly canRedo: boolean; - readonly canUndo: boolean; - readonly document: DatabaseDocument | null; - readonly flattenedFolders: FolderArray; - readonly flattenedProjects: ProjectArray; - readonly flattenedSections: SectionArray; - readonly flattenedTags: TagArray; - readonly flattenedTasks: TaskArray; - readonly folders: FolderArray; - readonly inbox: Inbox; - readonly library: Library; - readonly projects: ProjectArray; - readonly settings: Settings; - readonly tags: Tags; + tagNamed(name: string): Tag | null; + folderNamed(name: string): Folder | null; + projectNamed(name: string): Project | null; + projectsMatching(search: string): Array; + foldersMatching(search: string): Array; + tagsMatching(search: string): Array; + taskNamed(name: string): Task | null; + save(); + moveTasks( + tasks: Array, + position: Project | Task | Task.ChildInsertionLocation + ); + duplicateTasks( + tasks: Array, + position: Project | Task | Task.ChildInsertionLocation + ): TaskArray; + convertTasksToProjects( + tasks: Array, + position: Folder | Folder.ChildInsertionLocation + ): Array; + moveSections( + sections: Array, + position: Folder | Folder.ChildInsertionLocation + ); + duplicateSections( + sections: Array, + position: Folder | Folder.ChildInsertionLocation + ): SectionArray; + moveTags(tags: Array, position: Tag | Tag.ChildInsertionLocation); + duplicateTags( + tags: Array, + position: Tag | Tag.ChildInsertionLocation + ): TagArray; + cleanUp(); + undo(); + redo(); + deleteObject(object: DatabaseObject); + copyTasksToPasteboard(tasks: Array, pasteboard: Pasteboard); + canPasteTasks(pasteboard: Pasteboard): boolean; + pasteTasksFromPasteboard(pasteboard: Pasteboard): Array; + readonly canRedo: boolean; + readonly canUndo: boolean; + readonly document: DatabaseDocument | null; + readonly flattenedFolders: FolderArray; + readonly flattenedProjects: ProjectArray; + readonly flattenedSections: SectionArray; + readonly flattenedTags: TagArray; + readonly flattenedTasks: TaskArray; + readonly folders: FolderArray; + readonly inbox: Inbox; + readonly library: Library; + readonly projects: ProjectArray; + readonly settings: Settings; + readonly tags: Tags; } // DatabaseObject declare class DatabaseObject { - readonly id: ObjectIdentifier; + readonly id: ObjectIdentifier; } // DatedObject declare class DatedObject extends DatabaseObject { - added: Date | null; - modified: Date | null; + added: Date | null; + modified: Date | null; } // ActiveObject declare class ActiveObject extends DatedObject { - active: boolean; - readonly effectiveActive: boolean; + active: boolean; + readonly effectiveActive: boolean; } // Folder declare namespace Folder { - function byIdentifier(identifier: string): Folder | null; + function byIdentifier(identifier: string): Folder | null; } declare class Folder extends ActiveObject { - constructor (name: string, position: Folder | Folder.ChildInsertionLocation | null); - folderNamed(name: string): Folder | null; - projectNamed(name: string): Project | null; - sectionNamed(name: string): Project | Folder | null; - childNamed(name: string): Project | Folder | null; - apply(f: Function): ApplyResult | null; - readonly after: Folder.ChildInsertionLocation; - readonly before: Folder.ChildInsertionLocation; - readonly beginning: Folder.ChildInsertionLocation; - readonly children: SectionArray; - readonly ending: Folder.ChildInsertionLocation; - readonly flattenedChildren: SectionArray; - readonly flattenedFolders: FolderArray; - readonly flattenedProjects: ProjectArray; - readonly flattenedSections: SectionArray; - readonly folders: FolderArray; - name: string; - readonly parent: Folder | null; - readonly projects: ProjectArray; - readonly sections: SectionArray; - status: Folder.Status; + constructor( + name: string, + position: Folder | Folder.ChildInsertionLocation | null + ); + folderNamed(name: string): Folder | null; + projectNamed(name: string): Project | null; + sectionNamed(name: string): Project | Folder | null; + childNamed(name: string): Project | Folder | null; + apply(f: Function): ApplyResult | null; + readonly after: Folder.ChildInsertionLocation; + readonly before: Folder.ChildInsertionLocation; + readonly beginning: Folder.ChildInsertionLocation; + readonly children: SectionArray; + readonly ending: Folder.ChildInsertionLocation; + readonly flattenedChildren: SectionArray; + readonly flattenedFolders: FolderArray; + readonly flattenedProjects: ProjectArray; + readonly flattenedSections: SectionArray; + readonly folders: FolderArray; + name: string; + readonly parent: Folder | null; + readonly projects: ProjectArray; + readonly sections: SectionArray; + status: Folder.Status; } // Tag declare namespace Tag { - function byIdentifier(identifier: string): Tag | null; - const forecastTag: Tag | null; + function byIdentifier(identifier: string): Tag | null; + const forecastTag: Tag | null; } declare class Tag extends ActiveObject { - constructor (name: string, position?: Tag | Tag.ChildInsertionLocation | null); - tagNamed(name: string): Tag | null; - childNamed(name: string): Tag | null; - apply(f: Function): ApplyResult | null; - readonly after: Tag.ChildInsertionLocation; - allowsNextAction: boolean; - readonly availableTasks: TaskArray; - readonly before: Tag.ChildInsertionLocation; - readonly beginning: Tag.ChildInsertionLocation; - readonly children: TagArray; - readonly ending: Tag.ChildInsertionLocation; - readonly flattenedChildren: TagArray; - readonly flattenedTags: TagArray; - name: string; - readonly parent: Tag | null; - readonly projects: ProjectArray; - readonly remainingTasks: TaskArray; - status: Tag.Status; - readonly tags: TagArray; - readonly tasks: TaskArray; + constructor(name: string, position?: Tag | Tag.ChildInsertionLocation | null); + tagNamed(name: string): Tag | null; + childNamed(name: string): Tag | null; + apply(f: Function): ApplyResult | null; + readonly after: Tag.ChildInsertionLocation; + allowsNextAction: boolean; + readonly availableTasks: TaskArray; + readonly before: Tag.ChildInsertionLocation; + readonly beginning: Tag.ChildInsertionLocation; + readonly children: TagArray; + readonly ending: Tag.ChildInsertionLocation; + readonly flattenedChildren: TagArray; + readonly flattenedTags: TagArray; + name: string; + readonly parent: Tag | null; + readonly projects: ProjectArray; + readonly remainingTasks: TaskArray; + status: Tag.Status; + readonly tags: TagArray; + readonly tasks: TaskArray; } // Task declare namespace Task { - function byParsingTransportText(text: string, singleTask: boolean | null): Array; - function byIdentifier(identifier: string): Task | null; + function byParsingTransportText( + text: string, + singleTask: boolean | null + ): Array; + function byIdentifier(identifier: string): Task | null; } declare class Task extends ActiveObject { - constructor (name: string, position: Project | Task | Task.ChildInsertionLocation | null); - taskNamed(name: string): Task | null; - childNamed(name: string): Task | null; - appendStringToNote(stringToAppend: string); - addLinkedFileURL(url: URL); - removeLinkedFileWithURL(url: URL); - addAttachment(attachment: FileWrapper); - removeAttachmentAtIndex(index: number); - addTag(tag: Tag); - addTags(tags: Array); - removeTag(tag: Tag); - removeTags(tags: Array); - clearTags(); - markComplete(date: Date | null): Task; - markIncomplete(); - drop(allOccurrences: boolean); - apply(f: Function): ApplyResult | null; - addNotification(info: number | Date): Task.Notification; - removeNotification(notification: Task.Notification); - readonly after: Task.ChildInsertionLocation; - assignedContainer: Project | Task | Inbox | null; - attachments: Array; - readonly before: Task.ChildInsertionLocation; - readonly beginning: Task.ChildInsertionLocation; - readonly children: TaskArray; - readonly completed: boolean; - completedByChildren: boolean; - readonly completionDate: Date | null; - readonly containingProject: Project | null; - deferDate: Date | null; - readonly dropDate: Date | null; - dueDate: Date | null; - readonly effectiveCompletedDate: Date | null; - readonly effectiveDeferDate: Date | null; - readonly effectiveDropDate: Date | null; - readonly effectiveDueDate: Date | null; - readonly effectiveFlagged: boolean; - readonly ending: Task.ChildInsertionLocation; - estimatedMinutes: number | null; - flagged: boolean; - readonly flattenedChildren: TaskArray; - readonly flattenedTasks: TaskArray; - readonly hasChildren: boolean; - readonly inInbox: boolean; - readonly linkedFileURLs: Array; - name: string; - note: string; - readonly notifications: Array; - readonly parent: Task | null; - readonly project: Project | null; - repetitionRule: Task.RepetitionRule | null; - sequential: boolean; - shouldUseFloatingTimeZone: boolean; - readonly tags: TagArray; - readonly taskStatus: Task.Status; - readonly tasks: TaskArray; + constructor( + name: string, + position: Project | Task | Task.ChildInsertionLocation | null + ); + taskNamed(name: string): Task | null; + childNamed(name: string): Task | null; + appendStringToNote(stringToAppend: string); + addLinkedFileURL(url: URL); + removeLinkedFileWithURL(url: URL); + addAttachment(attachment: FileWrapper); + removeAttachmentAtIndex(index: number); + addTag(tag: Tag); + addTags(tags: Array); + removeTag(tag: Tag); + removeTags(tags: Array); + clearTags(); + markComplete(date: Date | null): Task; + markIncomplete(); + drop(allOccurrences: boolean); + apply(f: Function): ApplyResult | null; + addNotification(info: number | Date): Task.Notification; + removeNotification(notification: Task.Notification); + readonly after: Task.ChildInsertionLocation; + assignedContainer: Project | Task | Inbox | null; + attachments: Array; + readonly before: Task.ChildInsertionLocation; + readonly beginning: Task.ChildInsertionLocation; + readonly children: TaskArray; + readonly completed: boolean; + completedByChildren: boolean; + readonly completionDate: Date | null; + readonly containingProject: Project | null; + deferDate: Date | null; + readonly dropDate: Date | null; + dueDate: Date | null; + readonly effectiveCompletedDate: Date | null; + readonly effectiveDeferDate: Date | null; + readonly effectiveDropDate: Date | null; + readonly effectiveDueDate: Date | null; + readonly effectiveFlagged: boolean; + readonly ending: Task.ChildInsertionLocation; + estimatedMinutes: number | null; + flagged: boolean; + readonly flattenedChildren: TaskArray; + readonly flattenedTasks: TaskArray; + readonly hasChildren: boolean; + readonly inInbox: boolean; + readonly linkedFileURLs: Array; + name: string; + note: string; + readonly notifications: Array; + readonly parent: Task | null; + readonly project: Project | null; + repetitionRule: Task.RepetitionRule | null; + sequential: boolean; + shouldUseFloatingTimeZone: boolean; + readonly tags: TagArray; + readonly taskStatus: Task.Status; + readonly tasks: TaskArray; } // Perspective.Custom declare namespace Perspective.Custom { - function byName(name: string): Perspective.Custom | null; - function byIdentifier(identifier: string): Perspective.Custom | null; - const all: Array; + function byName(name: string): Perspective.Custom | null; + function byIdentifier(identifier: string): Perspective.Custom | null; + const all: Array; } declare namespace Perspective { - class Custom extends DatedObject { - fileWrapper(): FileWrapper; - writeFileRepresentationIntoDirectory(parentURL: URL): URL; - readonly identifier: string; - readonly name: string; - } + class Custom extends DatedObject { + fileWrapper(): FileWrapper; + writeFileRepresentationIntoDirectory(parentURL: URL): URL; + readonly identifier: string; + readonly name: string; + } } // Task.Notification declare namespace Task { - class Notification extends DatedObject { - absoluteFireDate: Date; - readonly initialFireDate: Date; - readonly isSnoozed: boolean; - readonly kind: Task.Notification.Kind; - readonly nextFireDate: Date | null; - relativeFireOffset: number; - repeatInterval: number; - readonly task: Task | null; - readonly usesFloatingTimeZone: boolean; - } + class Notification extends DatedObject { + absoluteFireDate: Date; + readonly initialFireDate: Date; + readonly isSnoozed: boolean; + readonly kind: Task.Notification.Kind; + readonly nextFireDate: Date | null; + relativeFireOffset: number; + repeatInterval: number; + readonly task: Task | null; + readonly usesFloatingTimeZone: boolean; + } } // Project declare namespace Project { - function byIdentifier(identifier: string): Project | null; + function byIdentifier(identifier: string): Project | null; } declare class Project extends DatabaseObject { - constructor (name: string, position?: Folder | Folder.ChildInsertionLocation | null); - taskNamed(name: string): Task | null; - appendStringToNote(stringToAppend: string); - addAttachment(attachment: FileWrapper); - removeAttachmentAtIndex(index: number); - markComplete(date: Date | null): Task; - markIncomplete(); - addNotification(info: number | Date): Task.Notification; - removeNotification(notification: Task.Notification); - addTag(tag: Tag); - addTags(tags: Array); - removeTag(tag: Tag); - removeTags(tags: Array); - clearTags(); - addLinkedFileURL(url: URL); - removeLinkedFileWithURL(url: URL); - readonly after: Folder.ChildInsertionLocation; - attachments: Array; - readonly before: Folder.ChildInsertionLocation; - readonly beginning: Task.ChildInsertionLocation; - readonly children: TaskArray; - readonly completed: boolean; - completedByChildren: boolean; - completionDate: Date | null; - containsSingletonActions: boolean; - defaultSingletonActionHolder: boolean; - deferDate: Date | null; - dropDate: Date | null; - dueDate: Date | null; - readonly effectiveCompletedDate: Date | null; - readonly effectiveDeferDate: Date | null; - readonly effectiveDropDate: Date | null; - readonly effectiveDueDate: Date | null; - readonly effectiveFlagged: boolean; - readonly ending: Task.ChildInsertionLocation; - estimatedMinutes: number | null; - flagged: boolean; - readonly flattenedChildren: TaskArray; - readonly flattenedTasks: TaskArray; - readonly hasChildren: boolean; - lastReviewDate: Date | null; - readonly linkedFileURLs: Array; - name: string; - nextReviewDate: Date | null; - readonly nextTask: Task | null; - note: string; - readonly notifications: Array; - readonly parentFolder: Folder | null; - repetitionRule: Task.RepetitionRule | null; - reviewInterval: Project.ReviewInterval; - sequential: boolean; - shouldUseFloatingTimeZone: boolean; - status: Project.Status; - readonly tags: TagArray; - readonly task: Task; - readonly taskStatus: Task.Status; - readonly tasks: TaskArray; + constructor( + name: string, + position?: Folder | Folder.ChildInsertionLocation | null + ); + taskNamed(name: string): Task | null; + appendStringToNote(stringToAppend: string); + addAttachment(attachment: FileWrapper); + removeAttachmentAtIndex(index: number); + markComplete(date: Date | null): Task; + markIncomplete(); + addNotification(info: number | Date): Task.Notification; + removeNotification(notification: Task.Notification); + addTag(tag: Tag); + addTags(tags: Array); + removeTag(tag: Tag); + removeTags(tags: Array); + clearTags(); + addLinkedFileURL(url: URL); + removeLinkedFileWithURL(url: URL); + readonly after: Folder.ChildInsertionLocation; + attachments: Array; + readonly before: Folder.ChildInsertionLocation; + readonly beginning: Task.ChildInsertionLocation; + readonly children: TaskArray; + readonly completed: boolean; + completedByChildren: boolean; + completionDate: Date | null; + containsSingletonActions: boolean; + defaultSingletonActionHolder: boolean; + deferDate: Date | null; + dropDate: Date | null; + dueDate: Date | null; + readonly effectiveCompletedDate: Date | null; + readonly effectiveDeferDate: Date | null; + readonly effectiveDropDate: Date | null; + readonly effectiveDueDate: Date | null; + readonly effectiveFlagged: boolean; + readonly ending: Task.ChildInsertionLocation; + estimatedMinutes: number | null; + flagged: boolean; + readonly flattenedChildren: TaskArray; + readonly flattenedTasks: TaskArray; + readonly hasChildren: boolean; + lastReviewDate: Date | null; + readonly linkedFileURLs: Array; + name: string; + nextReviewDate: Date | null; + readonly nextTask: Task | null; + note: string; + readonly notifications: Array; + readonly parentFolder: Folder | null; + repetitionRule: Task.RepetitionRule | null; + reviewInterval: Project.ReviewInterval; + sequential: boolean; + shouldUseFloatingTimeZone: boolean; + status: Project.Status; + readonly tags: TagArray; + readonly task: Task; + readonly taskStatus: Task.Status; + readonly tasks: TaskArray; } // DateComponents declare class DateComponents { - constructor (); - readonly date: Date | null; - day: number | null; - era: number | null; - hour: number | null; - minute: number | null; - month: number | null; - nanosecond: number | null; - second: number | null; - timeZone: TimeZone | null; - year: number | null; + constructor(); + readonly date: Date | null; + day: number | null; + era: number | null; + hour: number | null; + minute: number | null; + month: number | null; + nanosecond: number | null; + second: number | null; + timeZone: TimeZone | null; + year: number | null; } // DateRange declare class DateRange { - readonly end: Date; - readonly name: string; - readonly start: Date; + readonly end: Date; + readonly name: string; + readonly start: Date; } // Decimal declare namespace Decimal { - function fromString(string: string): Decimal; - const maximum: Decimal; - const minimum: Decimal; - const notANumber: Decimal; - const one: Decimal; - const zero: Decimal; + function fromString(string: string): Decimal; + const maximum: Decimal; + const minimum: Decimal; + const notANumber: Decimal; + const one: Decimal; + const zero: Decimal; } declare class Decimal { - toString(): string; - add(number: Decimal): Decimal; - subtract(number: Decimal): Decimal; - multiply(number: Decimal): Decimal; - divide(number: Decimal): Decimal; - compare(number: Decimal): number; - equals(number: Decimal): boolean; + toString(): string; + add(number: Decimal): Decimal; + subtract(number: Decimal): Decimal; + multiply(number: Decimal): Decimal; + divide(number: Decimal): Decimal; + compare(number: Decimal): number; + equals(number: Decimal): boolean; } // Device declare namespace Device { - const current: Device; + const current: Device; } declare class Device { - readonly iOS: boolean; - readonly iPad: boolean; - readonly mac: boolean; - readonly operatingSystemVersion: Version; - readonly type: DeviceType | null; + readonly iOS: boolean; + readonly iPad: boolean; + readonly mac: boolean; + readonly operatingSystemVersion: Version; + readonly type: DeviceType | null; } // DeviceType declare namespace DeviceType { - const all: Array; - const iPad: DeviceType; - const iPhone: DeviceType; - const mac: DeviceType; + const all: Array; + const iPad: DeviceType; + const iPhone: DeviceType; + const mac: DeviceType; } -declare class DeviceType { -} +declare class DeviceType {} // Document declare namespace Document { - function makeNew(resultFunction: Function | null): Promise; - function makeNewAndShow(resultFunction: Function | null): Promise; + function makeNew(resultFunction: Function | null): Promise; + function makeNewAndShow(resultFunction: Function | null): Promise; } declare class Document { - close(didCancel: Function | null); - save(); - fileWrapper(type: string | null): FileWrapper; - makeFileWrapper(baseName: string, type: string | null): Promise; - undo(); - redo(); - show(resultFunction: Function | null); - readonly canRedo: boolean; - readonly canUndo: boolean; - readonly fileType: string | null; - readonly name: string | null; - readonly writableTypes: Array; + close(didCancel: Function | null); + save(); + fileWrapper(type: string | null): FileWrapper; + makeFileWrapper(baseName: string, type: string | null): Promise; + undo(); + redo(); + show(resultFunction: Function | null); + readonly canRedo: boolean; + readonly canUndo: boolean; + readonly fileType: string | null; + readonly name: string | null; + readonly writableTypes: Array; } // DatabaseDocument declare class DatabaseDocument extends Document { - newWindow(): Promise; - newTabOnWindow(window: DocumentWindow): Promise; - readonly windows: Array; + newWindow(): Promise; + newTabOnWindow(window: DocumentWindow): Promise; + readonly windows: Array; } // Email declare class Email { - constructor (); - generate(); - blindCarbonCopy: string | Array | null; - body: string | null; - carbonCopy: string | Array | null; - fileWrappers: Array; - receiver: string | Array | null; - subject: string | null; + constructor(); + generate(); + blindCarbonCopy: string | Array | null; + body: string | null; + carbonCopy: string | Array | null; + fileWrappers: Array; + receiver: string | Array | null; + subject: string | null; } // FilePicker declare class FilePicker { - constructor (); - show(): Promise>; - folders: boolean; - message: string; - multiple: boolean; - types: Array | null; + constructor(); + show(): Promise>; + folders: boolean; + message: string; + multiple: boolean; + types: Array | null; } // FileSaver declare class FileSaver { - constructor (); - show(fileWrapper: FileWrapper): Promise; - message: string; - nameLabel: string; - prompt: string; - types: Array | null; + constructor(); + show(fileWrapper: FileWrapper): Promise; + message: string; + nameLabel: string; + prompt: string; + types: Array | null; } // FileWrapper declare namespace FileWrapper { - function withContents(name: string | null, contents: Data): FileWrapper; - function withChildren(name: string | null, children: Array): FileWrapper; + function withContents(name: string | null, contents: Data): FileWrapper; + function withChildren( + name: string | null, + children: Array + ): FileWrapper; } declare class FileWrapper { - filenameForChild(child: FileWrapper): string | null; - readonly children: Array; - readonly contents: Data | null; - readonly destination: URL | null; - filename: string | null; - preferredFilename: string | null; - readonly type: FileWrapper.Type; + filenameForChild(child: FileWrapper): string | null; + readonly children: Array; + readonly contents: Data | null; + readonly destination: URL | null; + filename: string | null; + preferredFilename: string | null; + readonly type: FileWrapper.Type; } // FileWrapper.Type declare namespace FileWrapper.Type { - const Directory: FileWrapper.Type; - const File: FileWrapper.Type; - const Link: FileWrapper.Type; - const all: Array; + const Directory: FileWrapper.Type; + const File: FileWrapper.Type; + const Link: FileWrapper.Type; + const all: Array; } declare namespace FileWrapper { - class Type { - } + class Type {} } // Folder.ChildInsertionLocation declare namespace Folder { - class ChildInsertionLocation { - } + class ChildInsertionLocation {} } // Folder.Status declare namespace Folder.Status { - const Active: Folder.Status; - const Dropped: Folder.Status; - const all: Array; + const Active: Folder.Status; + const Dropped: Folder.Status; + const all: Array; } declare namespace Folder { - class Status { - } + class Status {} } // ForecastDay declare namespace ForecastDay { - let badgeCountsIncludeDeferredItems: boolean; + let badgeCountsIncludeDeferredItems: boolean; } declare class ForecastDay { - badgeKind(): ForecastDay.Status; - readonly badgeCount: number; - readonly date: Date; - readonly deferredCount: number; - readonly kind: ForecastDay.Kind; - readonly name: string; + badgeKind(): ForecastDay.Status; + readonly badgeCount: number; + readonly date: Date; + readonly deferredCount: number; + readonly kind: ForecastDay.Kind; + readonly name: string; } // ForecastDay.Kind declare namespace ForecastDay.Kind { - const Day: ForecastDay.Kind; - const DistantFuture: ForecastDay.Kind; - const FutureMonth: ForecastDay.Kind; - const Past: ForecastDay.Kind; - const Today: ForecastDay.Kind; - const all: Array; + const Day: ForecastDay.Kind; + const DistantFuture: ForecastDay.Kind; + const FutureMonth: ForecastDay.Kind; + const Past: ForecastDay.Kind; + const Today: ForecastDay.Kind; + const all: Array; } declare namespace ForecastDay { - class Kind { - } + class Kind {} } // ForecastDay.Status declare namespace ForecastDay.Status { - const Available: ForecastDay.Status; - const DueSoon: ForecastDay.Status; - const NoneAvailable: ForecastDay.Status; - const Overdue: ForecastDay.Status; - const all: Array; + const Available: ForecastDay.Status; + const DueSoon: ForecastDay.Status; + const NoneAvailable: ForecastDay.Status; + const Overdue: ForecastDay.Status; + const all: Array; } declare namespace ForecastDay { - class Status { - } + class Status {} } // Form declare class Form { - constructor (); - addField(field: Form.Field, index?: number | null); - removeField(field: Form.Field); - show(title: string, confirmTitle: string): Promise
; - readonly fields: Array; - validate: Function | null; - readonly values: Object; + constructor(); + addField(field: Form.Field, index?: number | null); + removeField(field: Form.Field); + show(title: string, confirmTitle: string): Promise; + readonly fields: Array; + validate: Function | null; + readonly values: Object; } // Form.Field declare namespace Form { - class Field { - readonly displayName: string | null; - readonly key: string; - } + class Field { + readonly displayName: string | null; + readonly key: string; + } } // Form.Field.Checkbox declare namespace Form.Field { - class Checkbox extends Form.Field { - constructor (key: string, displayName: string | null, value: boolean | null); - } + class Checkbox extends Form.Field { + constructor(key: string, displayName: string | null, value: boolean | null); + } } // Form.Field.Date declare namespace Form.Field { - class Date extends Form.Field { - constructor (key: string, displayName: string | null, value: Date | null, formatter: Formatter.Date | null); - } + class Date extends Form.Field { + constructor( + key: string, + displayName: string | null, + value: Date | null, + formatter: Formatter.Date | null + ); + } } // Form.Field.MultipleOptions declare namespace Form.Field { - class MultipleOptions extends Form.Field { - constructor (key: string, displayName: string | null, options: Array, names: Array | null, selected: Array); - } + class MultipleOptions extends Form.Field { + constructor( + key: string, + displayName: string | null, + options: Array, + names: Array | null, + selected: Array + ); + } } // Form.Field.Option declare namespace Form.Field { - class Option extends Form.Field { - constructor (key: string, displayName?: string | null, options?: Array, names?: Array | null, selected?: Object | null, nullOptionTitle?: string | null); - allowsNull: boolean; - nullOptionTitle: string | null; - } + class Option extends Form.Field { + constructor( + key: string, + displayName?: string | null, + options?: Array, + names?: Array | null, + selected?: Object | null, + nullOptionTitle?: string | null + ); + allowsNull: boolean; + nullOptionTitle: string | null; + } } // Form.Field.Password declare namespace Form.Field { - class Password extends Form.Field { - constructor (key: string, displayName?: string | null, value?: string | null); - } + class Password extends Form.Field { + constructor( + key: string, + displayName?: string | null, + value?: string | null + ); + } } // Form.Field.String declare namespace Form.Field { - class String extends Form.Field { - constructor (key: string, displayName?: string | null, value?: Object | null, formatter?: Formatter | null); - } + class String extends Form.Field { + constructor( + key: string, + displayName?: string | null, + value?: Object | null, + formatter?: Formatter | null + ); + } } // Formatter -declare class Formatter { -} +declare class Formatter {} // Formatter.Date declare namespace Formatter.Date { - function withStyle(dateStyle: Formatter.Date.Style, timeStyle: Formatter.Date.Style | null): Formatter.Date; - function withFormat(format: string): Formatter.Date; - const iso8601: Formatter.Date; + function withStyle( + dateStyle: Formatter.Date.Style, + timeStyle: Formatter.Date.Style | null + ): Formatter.Date; + function withFormat(format: string): Formatter.Date; + const iso8601: Formatter.Date; } declare namespace Formatter { - class Date extends Formatter { - stringFromDate(date: Date): string; - dateFromString(string: string): Date | null; - calendar: Calendar; - readonly dateFormat: string; - locale: Locale; - timeZone: TimeZone; - } + class Date extends Formatter { + stringFromDate(date: Date): string; + dateFromString(string: string): Date | null; + calendar: Calendar; + readonly dateFormat: string; + locale: Locale; + timeZone: TimeZone; + } } // Formatter.Decimal declare namespace Formatter.Decimal { - function currency(code: string | null): Formatter.Decimal; - const currencyCodes: Array; - const custom: Formatter.Decimal; - const decimal: Formatter.Decimal; - const percent: Formatter.Decimal; - const percentWithDecimal: Formatter.Decimal; - const plain: Formatter.Decimal; - const thousandsAndDecimal: Formatter.Decimal; + function currency(code: string | null): Formatter.Decimal; + const currencyCodes: Array; + const custom: Formatter.Decimal; + const decimal: Formatter.Decimal; + const percent: Formatter.Decimal; + const percentWithDecimal: Formatter.Decimal; + const plain: Formatter.Decimal; + const thousandsAndDecimal: Formatter.Decimal; } declare namespace Formatter { - class Decimal extends Formatter { - stringFromDecimal(number: Decimal): string | null; - decimalFromString(string: string): Decimal | null; - decimalSeparator: string; - negativeFormat: string; - positiveFormat: string; - thousandsSeparator: string | null; - zeroSymbol: string | null; - } + class Decimal extends Formatter { + stringFromDecimal(number: Decimal): string | null; + decimalFromString(string: string): Decimal | null; + decimalSeparator: string; + negativeFormat: string; + positiveFormat: string; + thousandsSeparator: string | null; + zeroSymbol: string | null; + } } // Formatter.Duration declare namespace Formatter { - class Duration extends Formatter { - constructor (); - stringFromDecimal(number: Decimal): string | null; - decimalFromString(string: string): Decimal | null; - hoursPerDay: number; - hoursPerWeek: number; - useVerboseFormat: boolean; - } + class Duration extends Formatter { + constructor(); + stringFromDecimal(number: Decimal): string | null; + decimalFromString(string: string): Decimal | null; + hoursPerDay: number; + hoursPerWeek: number; + useVerboseFormat: boolean; + } } // Formatter.Date.Style declare namespace Formatter.Date.Style { - const Full: Formatter.Date.Style; - const Long: Formatter.Date.Style; - const Medium: Formatter.Date.Style; - const Short: Formatter.Date.Style; - const all: Array; + const Full: Formatter.Date.Style; + const Long: Formatter.Date.Style; + const Medium: Formatter.Date.Style; + const Short: Formatter.Date.Style; + const all: Array; } declare namespace Formatter.Date { - class Style { - } + class Style {} } // Image -declare class Image { -} +declare class Image {} // LigatureStyle declare namespace LigatureStyle { - const All: LigatureStyle; - const Essential: LigatureStyle; - const Standard: LigatureStyle; - const all: Array; + const All: LigatureStyle; + const Essential: LigatureStyle; + const Standard: LigatureStyle; + const all: Array; } -declare class LigatureStyle { -} +declare class LigatureStyle {} // Locale declare namespace Locale { - const identifiers: Array; + const identifiers: Array; } declare class Locale { - constructor (identifier: string); - readonly calendar: Calendar; - readonly currencyCode: string | null; - readonly identifier: string; + constructor(identifier: string); + readonly calendar: Calendar; + readonly currencyCode: string | null; + readonly identifier: string; } // MenuItem declare class MenuItem { - checked: boolean; - label: string; + checked: boolean; + label: string; } // NamedStyle.List declare namespace NamedStyle { - class List { - add(name: string | null): NamedStyle; - byName(name: string): NamedStyle | null; - byIdentifier(identifier: string): NamedStyle | null; - moveStyles(styles: Array, position: NamedStylePosition); - duplicateStyles(styles: Array, position: NamedStylePosition): Array; - readonly all: Array; - readonly beginning: NamedStylePosition; - readonly end: NamedStylePosition; - } + class List { + add(name: string | null): NamedStyle; + byName(name: string): NamedStyle | null; + byIdentifier(identifier: string): NamedStyle | null; + moveStyles(styles: Array, position: NamedStylePosition); + duplicateStyles( + styles: Array, + position: NamedStylePosition + ): Array; + readonly all: Array; + readonly beginning: NamedStylePosition; + readonly end: NamedStylePosition; + } } // NamedStylePosition -declare class NamedStylePosition { -} +declare class NamedStylePosition {} // ObjectIdentifier declare class ObjectIdentifier { - readonly objectClass: Object | null; - readonly primaryKey: string; + readonly objectClass: Object | null; + readonly primaryKey: string; } // Pasteboard declare namespace Pasteboard { - function makeUnique(): Pasteboard; - const general: Pasteboard; + function makeUnique(): Pasteboard; + const general: Pasteboard; } declare class Pasteboard { - availableType(types: Array): TypeIdentifier | null; - addItems(items: Array); - clear(); - dataForType(type: TypeIdentifier): Data | null; - setDataForType(data: Data, type: TypeIdentifier); - stringForType(type: TypeIdentifier): string | null; - setStringForType(string: string, type: TypeIdentifier); - URL: URL | null; - URLs: Array | null; - color: Color | null; - colors: Array | null; - readonly hasColors: boolean; - readonly hasImages: boolean; - readonly hasStrings: boolean; - readonly hasURLs: boolean; - image: Image | null; - images: Array | null; - items: Array; - string: string | null; - strings: Array | null; - readonly types: Array; + availableType(types: Array): TypeIdentifier | null; + addItems(items: Array); + clear(); + dataForType(type: TypeIdentifier): Data | null; + setDataForType(data: Data, type: TypeIdentifier); + stringForType(type: TypeIdentifier): string | null; + setStringForType(string: string, type: TypeIdentifier); + URL: URL | null; + URLs: Array | null; + color: Color | null; + colors: Array | null; + readonly hasColors: boolean; + readonly hasImages: boolean; + readonly hasStrings: boolean; + readonly hasURLs: boolean; + image: Image | null; + images: Array | null; + items: Array; + string: string | null; + strings: Array | null; + readonly types: Array; } // Pasteboard.Item declare namespace Pasteboard { - class Item { - constructor (); - dataForType(type: TypeIdentifier): Data | null; - setDataForType(data: Data, type: TypeIdentifier); - stringForType(type: TypeIdentifier): string | null; - setStringForType(string: string, type: TypeIdentifier); - readonly types: Array; - } + class Item { + constructor(); + dataForType(type: TypeIdentifier): Data | null; + setDataForType(data: Data, type: TypeIdentifier); + stringForType(type: TypeIdentifier): string | null; + setStringForType(string: string, type: TypeIdentifier); + readonly types: Array; + } } // Perspective declare namespace Perspective { - const all: Array; + const all: Array; } -declare class Perspective { -} +declare class Perspective {} // Perspective.BuiltIn declare namespace Perspective.BuiltIn { - const Flagged: Perspective.BuiltIn; - const Forecast: Perspective.BuiltIn; - const Inbox: Perspective.BuiltIn; - const Nearby: Perspective.BuiltIn; - const Projects: Perspective.BuiltIn; - const Review: Perspective.BuiltIn; - const Search: Perspective.BuiltIn; - const Tags: Perspective.BuiltIn; - const all: Array; + const Flagged: Perspective.BuiltIn; + const Forecast: Perspective.BuiltIn; + const Inbox: Perspective.BuiltIn; + const Nearby: Perspective.BuiltIn; + const Projects: Perspective.BuiltIn; + const Review: Perspective.BuiltIn; + const Search: Perspective.BuiltIn; + const Tags: Perspective.BuiltIn; + const all: Array; } declare namespace Perspective { - class BuiltIn { - readonly name: string; - } + class BuiltIn { + readonly name: string; + } } // PlugIn declare namespace PlugIn { - function find(identifier: string, minimumVersion: Version | null): PlugIn | null; - const all: Array; + function find( + identifier: string, + minimumVersion: Version | null + ): PlugIn | null; + const all: Array; } declare class PlugIn { - library(identifier: string): PlugIn.Library | null; - action(identifier: string): PlugIn.Action | null; - handler(identifier: string): PlugIn.Handler | null; - resourceNamed(name: string): URL | null; - imageNamed(name: string): Image | null; - readonly URL: URL | null; - readonly actions: Array; - readonly author: string; - readonly description: string; - readonly displayName: string; - readonly handlers: Array; - readonly identifier: string; - readonly libraries: Array; - readonly version: Version; + library(identifier: string): PlugIn.Library | null; + action(identifier: string): PlugIn.Action | null; + handler(identifier: string): PlugIn.Handler | null; + resourceNamed(name: string): URL | null; + imageNamed(name: string): Image | null; + readonly URL: URL | null; + readonly actions: Array; + readonly author: string; + readonly description: string; + readonly displayName: string; + readonly handlers: Array; + readonly identifier: string; + readonly libraries: Array; + readonly version: Version; } // PlugIn.Action declare namespace PlugIn { - class Action { - constructor (perform: Function); - readonly description: string; - readonly label: string; - readonly longLabel: string; - readonly mediumLabel: string; - readonly name: string; - readonly paletteLabel: string; - readonly perform: Function; - readonly plugIn: PlugIn; - readonly shortLabel: string; - validate: Function | null; - } + class Action { + constructor(perform: Function); + readonly description: string; + readonly label: string; + readonly longLabel: string; + readonly mediumLabel: string; + readonly name: string; + readonly paletteLabel: string; + readonly perform: Function; + readonly plugIn: PlugIn; + readonly shortLabel: string; + validate: Function | null; + } } // PlugIn.Handler declare namespace PlugIn { - class Handler { - constructor (invoke: Function); - readonly invoke: Function; - readonly name: string; - readonly plugIn: PlugIn; - willAttach: Function | null; - willDetach: Function | null; - } + class Handler { + constructor(invoke: Function); + readonly invoke: Function; + readonly name: string; + readonly plugIn: PlugIn; + willAttach: Function | null; + willDetach: Function | null; + } } // PlugIn.Library declare namespace PlugIn { - class Library { - constructor (version: Version); - readonly name: string; - readonly plugIn: PlugIn; - readonly version: Version; - } + class Library { + constructor(version: Version); + readonly name: string; + readonly plugIn: PlugIn; + readonly version: Version; + } } // Preferences declare class Preferences { - constructor (identifier: string | null); - read(key: string): Object | null; - readBoolean(key: string): boolean; - readString(key: string): string | null; - readNumber(key: string): number; - readDate(key: string): Date | null; - readData(key: string): Data | null; - write(key: string, value: boolean | string | number | Date | Data | null); - remove(key: string); - readonly identifier: string; + constructor(identifier: string | null); + read(key: string): Object | null; + readBoolean(key: string): boolean; + readString(key: string): string | null; + readNumber(key: string): number; + readDate(key: string): Date | null; + readData(key: string): Data | null; + write(key: string, value: boolean | string | number | Date | Data | null); + remove(key: string); + readonly identifier: string; } // Project.ReviewInterval declare namespace Project { - class ReviewInterval { - steps: number; - unit: string; - } + class ReviewInterval { + steps: number; + unit: string; + } } // Project.Status declare namespace Project.Status { - const Active: Project.Status; - const Done: Project.Status; - const Dropped: Project.Status; - const OnHold: Project.Status; - const all: Array; + const Active: Project.Status; + const Done: Project.Status; + const Dropped: Project.Status; + const OnHold: Project.Status; + const all: Array; } declare namespace Project { - class Status { - } + class Status {} } // Selection declare class Selection { - readonly allObjects: Array; - readonly database: Database | null; - readonly databaseObjects: Array; - readonly document: DatabaseDocument | null; - readonly folders: FolderArray; - readonly projects: ProjectArray; - readonly tags: TagArray; - readonly tasks: TaskArray; - readonly window: DocumentWindow | null; + readonly allObjects: Array; + readonly database: Database | null; + readonly databaseObjects: Array; + readonly document: DatabaseDocument | null; + readonly folders: FolderArray; + readonly projects: ProjectArray; + readonly tags: TagArray; + readonly tasks: TaskArray; + readonly window: DocumentWindow | null; } // Settings declare class Settings { - defaultObjectForKey(key: string): Object | null; - hasNonDefaultObjectForKey(key: string): boolean; - objectForKey(key: string): Object | null; - setObjectForKey(value: Object | null, key: string); - boolForKey(key: string): boolean; - setBoolForKey(value: boolean, key: string); - integerForKey(key: string): number; - setIntegerForKey(value: number, key: string); - readonly keys: Array; + defaultObjectForKey(key: string): Object | null; + hasNonDefaultObjectForKey(key: string): boolean; + objectForKey(key: string): Object | null; + setObjectForKey(value: Object | null, key: string); + boolForKey(key: string): boolean; + setBoolForKey(value: boolean, key: string); + integerForKey(key: string): number; + setIntegerForKey(value: number, key: string); + readonly keys: Array; } // SharePanel declare class SharePanel { - constructor (items: Array); - addItem(shareItem: URL | string | Image | FileWrapper); - addItems(shareItems: Array); - removeItem(shareItem: URL | string | Image | FileWrapper); - removeItems(shareItems: Array); - clearItems(); - show(); - items: Array; + constructor(items: Array); + addItem(shareItem: URL | string | Image | FileWrapper); + addItems(shareItems: Array); + removeItem(shareItem: URL | string | Image | FileWrapper); + removeItems(shareItems: Array); + clearItems(); + show(); + items: Array; } // Style declare class Style { - set(attribute: Style.Attribute, value: Object | null): boolean; - get(attribute: Style.Attribute): Object | null; - localValueForAttribute(attribute: Style.Attribute): Object | null; - addNamedStyle(namedStyle: NamedStyle); - removeNamedStyle(namedStyle: NamedStyle); - influencedBy(otherStyle: Style): boolean; - setStyle(style: Style); - clear(); - fontFillColor: Color; - readonly link: URL | null; - readonly locallyDefinedAttributes: Array; - readonly namedStyles: Array; + set(attribute: Style.Attribute, value: Object | null): boolean; + get(attribute: Style.Attribute): Object | null; + localValueForAttribute(attribute: Style.Attribute): Object | null; + addNamedStyle(namedStyle: NamedStyle); + removeNamedStyle(namedStyle: NamedStyle); + influencedBy(otherStyle: Style): boolean; + setStyle(style: Style); + clear(); + fontFillColor: Color; + readonly link: URL | null; + readonly locallyDefinedAttributes: Array; + readonly namedStyles: Array; } // NamedStyle declare class NamedStyle extends Style { - remove(); - readonly after: NamedStylePosition; - readonly before: NamedStylePosition; - readonly identifier: string; - name: string; + remove(); + readonly after: NamedStylePosition; + readonly before: NamedStylePosition; + readonly identifier: string; + name: string; } // Style.Attribute declare namespace Style.Attribute { - const BackgroundColor: Style.Attribute; - const BaselineOffset: Style.Attribute; - const BaselineSuperscript: Style.Attribute; - const Expansion: Style.Attribute; - const FontCondensed: Style.Attribute; - const FontFamily: Style.Attribute; - const FontFillColor: Style.Attribute; - const FontFixedPitch: Style.Attribute; - const FontItalic: Style.Attribute; - const FontName: Style.Attribute; - const FontNarrow: Style.Attribute; - const FontSize: Style.Attribute; - const FontStrokeColor: Style.Attribute; - const FontStrokeWidth: Style.Attribute; - const FontWeight: Style.Attribute; - const KerningAdjustment: Style.Attribute; - const LigatureSelection: Style.Attribute; - const Link: Style.Attribute; - const Obliqueness: Style.Attribute; - const ParagraphAlignment: Style.Attribute; - const ParagraphBaseWritingDirection: Style.Attribute; - const ParagraphDefaultTabInterval: Style.Attribute; - const ParagraphFirstLineHeadIndent: Style.Attribute; - const ParagraphHeadIndent: Style.Attribute; - const ParagraphLineHeightMultiple: Style.Attribute; - const ParagraphLineSpacing: Style.Attribute; - const ParagraphMaximumLineHeight: Style.Attribute; - const ParagraphMinimumLineHeight: Style.Attribute; - const ParagraphSpacing: Style.Attribute; - const ParagraphSpacingBefore: Style.Attribute; - const ParagraphTabStops: Style.Attribute; - const ParagraphTailIndent: Style.Attribute; - const ShadowBlurRadius: Style.Attribute; - const ShadowColor: Style.Attribute; - const ShadowOffset: Style.Attribute; - const StrikethroughAffinity: Style.Attribute; - const StrikethroughColor: Style.Attribute; - const StrikethroughPattern: Style.Attribute; - const StrikethroughStyle: Style.Attribute; - const UnderlineAffinity: Style.Attribute; - const UnderlineColor: Style.Attribute; - const UnderlinePattern: Style.Attribute; - const UnderlineStyle: Style.Attribute; + const BackgroundColor: Style.Attribute; + const BaselineOffset: Style.Attribute; + const BaselineSuperscript: Style.Attribute; + const Expansion: Style.Attribute; + const FontCondensed: Style.Attribute; + const FontFamily: Style.Attribute; + const FontFillColor: Style.Attribute; + const FontFixedPitch: Style.Attribute; + const FontItalic: Style.Attribute; + const FontName: Style.Attribute; + const FontNarrow: Style.Attribute; + const FontSize: Style.Attribute; + const FontStrokeColor: Style.Attribute; + const FontStrokeWidth: Style.Attribute; + const FontWeight: Style.Attribute; + const KerningAdjustment: Style.Attribute; + const LigatureSelection: Style.Attribute; + const Link: Style.Attribute; + const Obliqueness: Style.Attribute; + const ParagraphAlignment: Style.Attribute; + const ParagraphBaseWritingDirection: Style.Attribute; + const ParagraphDefaultTabInterval: Style.Attribute; + const ParagraphFirstLineHeadIndent: Style.Attribute; + const ParagraphHeadIndent: Style.Attribute; + const ParagraphLineHeightMultiple: Style.Attribute; + const ParagraphLineSpacing: Style.Attribute; + const ParagraphMaximumLineHeight: Style.Attribute; + const ParagraphMinimumLineHeight: Style.Attribute; + const ParagraphSpacing: Style.Attribute; + const ParagraphSpacingBefore: Style.Attribute; + const ParagraphTabStops: Style.Attribute; + const ParagraphTailIndent: Style.Attribute; + const ShadowBlurRadius: Style.Attribute; + const ShadowColor: Style.Attribute; + const ShadowOffset: Style.Attribute; + const StrikethroughAffinity: Style.Attribute; + const StrikethroughColor: Style.Attribute; + const StrikethroughPattern: Style.Attribute; + const StrikethroughStyle: Style.Attribute; + const UnderlineAffinity: Style.Attribute; + const UnderlineColor: Style.Attribute; + const UnderlinePattern: Style.Attribute; + const UnderlineStyle: Style.Attribute; } declare namespace Style { - class Attribute { - readonly defaultValue: Object; - readonly key: string; - } + class Attribute { + readonly defaultValue: Object; + readonly key: string; + } } // Tag.ChildInsertionLocation declare namespace Tag { - class ChildInsertionLocation { - } + class ChildInsertionLocation {} } // Tag.Status declare namespace Tag.Status { - const Active: Tag.Status; - const Dropped: Tag.Status; - const OnHold: Tag.Status; - const all: Array; + const Active: Tag.Status; + const Dropped: Tag.Status; + const OnHold: Tag.Status; + const all: Array; } declare namespace Tag { - class Status { - } + class Status {} } // Task.ChildInsertionLocation declare namespace Task { - class ChildInsertionLocation { - } + class ChildInsertionLocation {} } // Task.Notification.Kind declare namespace Task.Notification.Kind { - const Absolute: Task.Notification.Kind; - const DueRelative: Task.Notification.Kind; - const Unknown: Task.Notification.Kind; - const all: Array; + const Absolute: Task.Notification.Kind; + const DueRelative: Task.Notification.Kind; + const Unknown: Task.Notification.Kind; + const all: Array; } declare namespace Task.Notification { - class Kind { - } + class Kind {} } // Task.RepetitionMethod declare namespace Task.RepetitionMethod { - const DeferUntilDate: Task.RepetitionMethod; - const DueDate: Task.RepetitionMethod; - const Fixed: Task.RepetitionMethod; - const None: Task.RepetitionMethod; - const all: Array; + const DeferUntilDate: Task.RepetitionMethod; + const DueDate: Task.RepetitionMethod; + const Fixed: Task.RepetitionMethod; + const None: Task.RepetitionMethod; + const all: Array; } declare namespace Task { - class RepetitionMethod { - } + class RepetitionMethod {} } // Task.RepetitionRule declare namespace Task { - class RepetitionRule { - constructor (ruleString: string, method: Task.RepetitionMethod); - firstDateAfterDate(date: Date): Date; - readonly method: Task.RepetitionMethod; - readonly ruleString: string; - } + class RepetitionRule { + constructor(ruleString: string, method: Task.RepetitionMethod); + firstDateAfterDate(date: Date): Date; + readonly method: Task.RepetitionMethod; + readonly ruleString: string; + } } // Task.Status declare namespace Task.Status { - const Available: Task.Status; - const Blocked: Task.Status; - const Completed: Task.Status; - const Dropped: Task.Status; - const DueSoon: Task.Status; - const Next: Task.Status; - const Overdue: Task.Status; - const all: Array; + const Available: Task.Status; + const Blocked: Task.Status; + const Completed: Task.Status; + const Dropped: Task.Status; + const DueSoon: Task.Status; + const Next: Task.Status; + const Overdue: Task.Status; + const all: Array; } declare namespace Task { - class Status { - } + class Status {} } // Text declare namespace Text { - function makeFileAttachment(fileWrapper: FileWrapper, style: Style): Text; + function makeFileAttachment(fileWrapper: FileWrapper, style: Style): Text; } declare class Text { - constructor (string: string, style: Style); - textInRange(range: Text.Range): Text; - styleForRange(range: Text.Range): Style; - ranges(component: TextComponent, useEnclosingRange: boolean | null): Array; - replace(range: Text.Range, with_: Text); - append(text: Text); - insert(position: Text.Position, text: Text); - remove(range: Text.Range); - find(string: string, options: Array | null, range: Text.Range | null): Text.Range | null; - readonly attachments: Array; - readonly attributeRuns: Array; - readonly characters: Array; - readonly end: Text.Position; - readonly fileWrapper: FileWrapper | null; - readonly paragraphs: Array; - readonly range: Text.Range; - readonly sentences: Array; - readonly start: Text.Position; - string: string; - readonly style: Style; - readonly words: Array; + constructor(string: string, style: Style); + textInRange(range: Text.Range): Text; + styleForRange(range: Text.Range): Style; + ranges( + component: TextComponent, + useEnclosingRange: boolean | null + ): Array; + replace(range: Text.Range, with_: Text); + append(text: Text); + insert(position: Text.Position, text: Text); + remove(range: Text.Range); + find( + string: string, + options: Array | null, + range: Text.Range | null + ): Text.Range | null; + readonly attachments: Array; + readonly attributeRuns: Array; + readonly characters: Array; + readonly end: Text.Position; + readonly fileWrapper: FileWrapper | null; + readonly paragraphs: Array; + readonly range: Text.Range; + readonly sentences: Array; + readonly start: Text.Position; + string: string; + readonly style: Style; + readonly words: Array; } // Text.FindOption declare namespace Text.FindOption { - const Anchored: Text.FindOption; - const Backwards: Text.FindOption; - const CaseInsensitive: Text.FindOption; - const DiacriticInsensitive: Text.FindOption; - const ForcedOrdering: Text.FindOption; - const Literal: Text.FindOption; - const Numeric: Text.FindOption; - const RegularExpression: Text.FindOption; - const WidthInsensitive: Text.FindOption; - const all: Array; + const Anchored: Text.FindOption; + const Backwards: Text.FindOption; + const CaseInsensitive: Text.FindOption; + const DiacriticInsensitive: Text.FindOption; + const ForcedOrdering: Text.FindOption; + const Literal: Text.FindOption; + const Numeric: Text.FindOption; + const RegularExpression: Text.FindOption; + const WidthInsensitive: Text.FindOption; + const all: Array; } declare namespace Text { - class FindOption { - } + class FindOption {} } // Text.Position declare namespace Text { - class Position { - } + class Position {} } // Text.Range declare namespace Text { - class Range { - constructor (start: Text.Position, end: Text.Position); - readonly end: Text.Position; - readonly isEmpty: boolean; - readonly start: Text.Position; - } + class Range { + constructor(start: Text.Position, end: Text.Position); + readonly end: Text.Position; + readonly isEmpty: boolean; + readonly start: Text.Position; + } } // TextAlignment declare namespace TextAlignment { - const Center: TextAlignment; - const Justified: TextAlignment; - const Left: TextAlignment; - const Natural: TextAlignment; - const Right: TextAlignment; - const all: Array; + const Center: TextAlignment; + const Justified: TextAlignment; + const Left: TextAlignment; + const Natural: TextAlignment; + const Right: TextAlignment; + const all: Array; } -declare class TextAlignment { -} +declare class TextAlignment {} // TextComponent declare namespace TextComponent { - const Attachments: TextComponent; - const AttributeRuns: TextComponent; - const Characters: TextComponent; - const Paragraphs: TextComponent; - const Sentences: TextComponent; - const Words: TextComponent; - const all: Array; + const Attachments: TextComponent; + const AttributeRuns: TextComponent; + const Characters: TextComponent; + const Paragraphs: TextComponent; + const Sentences: TextComponent; + const Words: TextComponent; + const all: Array; } -declare class TextComponent { -} +declare class TextComponent {} // TimeZone declare namespace TimeZone { - const abbreviations: Array; + const abbreviations: Array; } declare class TimeZone { - constructor (abbreviation: string); - readonly abbreviation: string | null; - readonly daylightSavingTime: boolean; - readonly secondsFromGMT: number; + constructor(abbreviation: string); + readonly abbreviation: string | null; + readonly daylightSavingTime: boolean; + readonly secondsFromGMT: number; } // Timer declare namespace Timer { - function once(interval: number, action: Function): Timer; - function repeating(interval: number, action: Function): Timer; + function once(interval: number, action: Function): Timer; + function repeating(interval: number, action: Function): Timer; } declare class Timer { - cancel(); - readonly interval: number; + cancel(); + readonly interval: number; } // ToolbarItem declare class ToolbarItem { - image: Image | null; - label: string; - toolTip: string | null; + image: Image | null; + label: string; + toolTip: string | null; } // Tree declare class Tree { - nodeForObject(object: Object): TreeNode | null; - nodesForObjects(object: Array): Array; - reveal(nodes: Array); - select(nodes: Array, extending: boolean | null); - copyNodes(nodes: Array, to: Pasteboard); - paste(from: Pasteboard, parentNode: TreeNode | null, childIndex: number | null); - readonly rootNode: TreeNode; - readonly selectedNodes: Array; + nodeForObject(object: Object): TreeNode | null; + nodesForObjects(object: Array): Array; + reveal(nodes: Array); + select(nodes: Array, extending: boolean | null); + copyNodes(nodes: Array, to: Pasteboard); + paste( + from: Pasteboard, + parentNode: TreeNode | null, + childIndex: number | null + ); + readonly rootNode: TreeNode; + readonly selectedNodes: Array; } // ContentTree -declare class ContentTree extends Tree { -} +declare class ContentTree extends Tree {} // SidebarTree -declare class SidebarTree extends Tree { -} +declare class SidebarTree extends Tree {} // TreeNode declare class TreeNode { - expand(completely: boolean | null); - collapse(completely: boolean | null); - expandNote(completely: boolean | null); - collapseNote(completely: boolean | null); - reveal(); - apply(f: Function); - readonly canCollapse: boolean; - readonly canExpand: boolean; - readonly children: Array; - readonly index: number; - readonly isExpanded: boolean; - readonly isNoteExpanded: boolean; - readonly isRevealed: boolean; - readonly isRootNode: boolean; - readonly isSelectable: boolean; - isSelected: boolean; - readonly level: number; - readonly object: Object; - readonly parent: TreeNode | null; - readonly rootNode: TreeNode; + expand(completely: boolean | null); + collapse(completely: boolean | null); + expandNote(completely: boolean | null); + collapseNote(completely: boolean | null); + reveal(); + apply(f: Function); + readonly canCollapse: boolean; + readonly canExpand: boolean; + readonly children: Array; + readonly index: number; + readonly isExpanded: boolean; + readonly isNoteExpanded: boolean; + readonly isRevealed: boolean; + readonly isRootNode: boolean; + readonly isSelectable: boolean; + isSelected: boolean; + readonly level: number; + readonly object: Object; + readonly parent: TreeNode | null; + readonly rootNode: TreeNode; } // TypeIdentifier declare namespace TypeIdentifier { - const URL: TypeIdentifier; - const binaryPropertyList: TypeIdentifier; - const csv: TypeIdentifier; - const editableTypes: Array; - const gif: TypeIdentifier; - const image: TypeIdentifier; - const jpeg: TypeIdentifier; - const json: TypeIdentifier; - const ofocus: TypeIdentifier; - const pdf: TypeIdentifier; - const plainText: TypeIdentifier; - const png: TypeIdentifier; - const propertyList: TypeIdentifier; - const readableTypes: Array; - const rtf: TypeIdentifier; - const rtfd: TypeIdentifier; - const taskPaper: TypeIdentifier; - const tasks: TypeIdentifier; - const tasksAndFolders: TypeIdentifier; - const tiff: TypeIdentifier; - const writableTypes: Array; - const xmlPropertyList: TypeIdentifier; + const URL: TypeIdentifier; + const binaryPropertyList: TypeIdentifier; + const csv: TypeIdentifier; + const editableTypes: Array; + const gif: TypeIdentifier; + const image: TypeIdentifier; + const jpeg: TypeIdentifier; + const json: TypeIdentifier; + const ofocus: TypeIdentifier; + const pdf: TypeIdentifier; + const plainText: TypeIdentifier; + const png: TypeIdentifier; + const propertyList: TypeIdentifier; + const readableTypes: Array; + const rtf: TypeIdentifier; + const rtfd: TypeIdentifier; + const taskPaper: TypeIdentifier; + const tasks: TypeIdentifier; + const tasksAndFolders: TypeIdentifier; + const tiff: TypeIdentifier; + const writableTypes: Array; + const xmlPropertyList: TypeIdentifier; } declare class TypeIdentifier { - constructor (identifier: string); - conformsTo(other: TypeIdentifier): boolean; - readonly displayName: string; - readonly identifier: string; - readonly pathExtensions: Array; + constructor(identifier: string); + conformsTo(other: TypeIdentifier): boolean; + readonly displayName: string; + readonly identifier: string; + readonly pathExtensions: Array; } // URL declare namespace URL { - function choose(types: Array): URL | null; - function chooseFolder(): URL | null; - function fromString(string: string): URL | null; - function tellScript(app: string, js: string, arg: Object | null): URL | null; - function tellFunction(app: string, jsFunction: Function, arg: Object | null): URL | null; - const currentAppScheme: string; + function choose(types: Array): URL | null; + function chooseFolder(): URL | null; + function fromString(string: string): URL | null; + function tellScript(app: string, js: string, arg: Object | null): URL | null; + function tellFunction( + app: string, + jsFunction: Function, + arg: Object | null + ): URL | null; + const currentAppScheme: string; } declare class URL { - fetch(success: Function, failure: Function | null); - call(success: Function, failure: Function | null); - open(); - find(types: Array, recurse: boolean | null): Promise>; - toString(): string; - appendingPathComponent(component: string): URL; - deletingLastPathComponent(): URL; - readonly string: string; - readonly toObject: Object | null; - readonly host: string | null; + fetch(success: Function, failure: Function | null); + call(success: Function, failure: Function | null); + open(); + find( + types: Array, + recurse: boolean | null + ): Promise>; + toString(): string; + appendingPathComponent(component: string): URL; + deletingLastPathComponent(): URL; + readonly string: string; + readonly toObject: Object | null; + readonly host: string | null; } // URL.Access declare namespace URL { - class Access { - readonly url: URL; - } + class Access { + readonly url: URL; + } } // URL.Bookmark declare namespace URL.Bookmark { - function fromURL(url: URL): URL.Bookmark; + function fromURL(url: URL): URL.Bookmark; } declare namespace URL { - class Bookmark { - access(): Promise; - } + class Bookmark { + access(): Promise; + } } // URL.FetchRequest declare namespace URL.FetchRequest { - function fromString(string: string): URL.FetchRequest | null; + function fromString(string: string): URL.FetchRequest | null; } declare namespace URL { - class FetchRequest { - constructor (); - fetch(): Promise; - bodyData: Data | null; - bodyString: string | null; - cache: string | null; - headers: object; - method: string | null; - url: URL | null; - } + class FetchRequest { + constructor(); + fetch(): Promise; + bodyData: Data | null; + bodyString: string | null; + cache: string | null; + headers: object; + method: string | null; + url: URL | null; + } } // URL.FetchResponse declare namespace URL { - class FetchResponse { - readonly bodyData: Data | null; - readonly bodyString: string | null; - readonly headers: object; - readonly mimeType: string | null; - readonly statusCode: number; - readonly textEncodingName: string | null; - readonly url: URL | null; - } + class FetchResponse { + readonly bodyData: Data | null; + readonly bodyString: string | null; + readonly headers: object; + readonly mimeType: string | null; + readonly statusCode: number; + readonly textEncodingName: string | null; + readonly url: URL | null; + } } // UnderlineAffinity declare namespace UnderlineAffinity { - const ByWord: UnderlineAffinity; - const None: UnderlineAffinity; - const all: Array; + const ByWord: UnderlineAffinity; + const None: UnderlineAffinity; + const all: Array; } -declare class UnderlineAffinity { -} +declare class UnderlineAffinity {} // UnderlinePattern declare namespace UnderlinePattern { - const Dash: UnderlinePattern; - const DashDot: UnderlinePattern; - const DashDotDot: UnderlinePattern; - const Dot: UnderlinePattern; - const Solid: UnderlinePattern; - const all: Array; + const Dash: UnderlinePattern; + const DashDot: UnderlinePattern; + const DashDotDot: UnderlinePattern; + const Dot: UnderlinePattern; + const Solid: UnderlinePattern; + const all: Array; } -declare class UnderlinePattern { -} +declare class UnderlinePattern {} // UnderlineStyle declare namespace UnderlineStyle { - const Double: UnderlineStyle; - const None: UnderlineStyle; - const Single: UnderlineStyle; - const Thick: UnderlineStyle; - const all: Array; + const Double: UnderlineStyle; + const None: UnderlineStyle; + const Single: UnderlineStyle; + const Thick: UnderlineStyle; + const all: Array; } -declare class UnderlineStyle { -} +declare class UnderlineStyle {} // Version declare class Version { - constructor (versionString: string); - equals(version: Version): boolean; - atLeast(version: Version): boolean; - isAfter(version: Version): boolean; - isBefore(version: Version): boolean; - readonly versionString: string; + constructor(versionString: string); + equals(version: Version): boolean; + atLeast(version: Version): boolean; + isAfter(version: Version): boolean; + isBefore(version: Version): boolean; + readonly versionString: string; } // Window declare class Window { - close(); + close(); } // DocumentWindow declare class DocumentWindow extends Window { - selectObjects(objects: Array); - forecastDayForDate(date: Date): ForecastDay; - selectForecastDays(days: Array); - readonly content: ContentTree | null; - focus: SectionArray | null; - readonly isTab: boolean; - perspective: Perspective.BuiltIn | Perspective.Custom | null; - readonly selection: Selection; - readonly sidebar: SidebarTree | null; - readonly tabGroupWindows: Array; + selectObjects(objects: Array); + forecastDayForDate(date: Date): ForecastDay; + selectForecastDays(days: Array); + readonly content: ContentTree | null; + focus: SectionArray | null; + readonly isTab: boolean; + perspective: Perspective.BuiltIn | Perspective.Custom | null; + readonly selection: Selection; + readonly sidebar: SidebarTree | null; + readonly tabGroupWindows: Array; }