This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.githubusercontent.com/wmakeev/09aad933ef9bcb1a8804e3449ec5ff74 | |
import { env } from "../env.js"; | |
/** | |
* Возвращает остатки МойСклад | |
* | |
* @param {import('moysklad').Instance} ms | |
*/ | |
export async function getMoyskladStock(ms) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Создание внутренних заказов для пополнения остатков магазинов по проданным | |
* за последние 7 дней товарам | |
*/ | |
(async () => { | |
// Функция для отображения ошибки | |
const error = (msg) => { | |
alert(msg); | |
throw new Error(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addValue } from "./module2.js"; | |
export const foo = (name) => { | |
console.log(`${addValue(name)} in index.js`); | |
}; | |
window._my_foo = foo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gist: https://gist.github.com/wmakeev/ede27b97b3d227258684c5e80bf7fca3 | |
import { PDFDocument } from "pdf-lib"; | |
/** | |
* Merges pdf files in one (with pdf-lib) | |
* | |
* @see https://stackoverflow.com/a/68482188 | |
* | |
* @param {ArrayBuffer[]} pdfsToMerge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @type {TypedEntries} */ | |
export function typedEntries(obj) { | |
// @ts-expect-error ignore | |
return Object.entries(obj); | |
} | |
/** @type {TypedFromEntries} */ | |
export function typedFromEntries(entries) { | |
return Object.fromEntries(entries); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
// 1. Скопировать этот код на страницу https://caiorss.github.io/bookmarklet-maker/ | |
// 2. Заполнить название закладки | |
// 3. Сюда добвить ID вашей функции в Yandex.Cloud | |
const FUNCTION_ID = "qwertyyuio1234567890"; | |
// 4. Тут указать название закладки с фильтром в разделе "Заказы покупателей" | |
const FILTER_NAME = "Все"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"typescript.tsdk": "node_modules/typescript/lib", | |
"files.watcherExclude": { | |
"**/node_modules": true, | |
"**/-*": false | |
}, | |
"search.exclude": { | |
"**/node_modules": true, | |
"**/-*": true | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as url from "node:url"; | |
/** | |
* Returns `__dirname` like value for ESM | |
* | |
* ```js | |
* const dirname = getDirname(import.meta.url) | |
* ``` | |
* @link https://blog.logrocket.com/alternatives-dirname-node-js-es-modules/ | |
* @param {string} fileUrl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prettier-ignore | |
export class $my_model extends $mol_object { | |
static type() { | |
return '' | |
} | |
@$mol_mem_key | |
static item( id: string ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace $ { | |
/** Элемент очереди на массовую загрузку */ | |
type Queue_item = { | |
id: string | |
resolve: ( value: unknown ) => void | |
reject: ( reason?: any ) => void | |
signal: AbortSignal | |
} |