UNPKG

l7note

Version:

Access your notion notes quick

48 lines (47 loc) 2.14 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.markAsDeleteById = exports.markAsDeleteByNote = void 0; const index_js_1 = require("@notionhq/client/build/src/index.js"); const setup_js_1 = require("../setup.js"); const chalk_1 = __importDefault(require("chalk")); const process_1 = require("process"); const markAsDeleteByNote = (note) => __awaiter(void 0, void 0, void 0, function* () { try { const notion = new index_js_1.Client({ auth: setup_js_1.globalConfig.token }); yield notion.pages.update({ page_id: note.id, archived: true, }); } catch (err) { console.log(chalk_1.default.red('Page id not found')); (0, process_1.exit)(1); } }); exports.markAsDeleteByNote = markAsDeleteByNote; const markAsDeleteById = (noteId) => __awaiter(void 0, void 0, void 0, function* () { try { const notion = new index_js_1.Client({ auth: setup_js_1.globalConfig.token }); yield notion.pages.update({ page_id: noteId, archived: true, }); } catch (err) { console.log(chalk_1.default.red('Page id not found')); (0, process_1.exit)(1); } }); exports.markAsDeleteById = markAsDeleteById;