npm i @fosscord/server-util
This commit is contained in:
parent
4b914bcd32
commit
b40d6b825b
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -9,8 +9,8 @@
|
||||
"test:watch": "jest --watch",
|
||||
"start": "npm run build:util && npm run build && node dist/start",
|
||||
"build": "tsc -b .",
|
||||
"build:util": "tsc -b ./node_modules/fosscord-server-util/",
|
||||
"postinstall": "npm i github:fosscord/fosscord-server-util && patch-package"
|
||||
"build:util": "tsc -b ./node_modules/@fosscord/server-util/",
|
||||
"postinstall": "npm i github:fosscord/@fosscord/server-util && patch-package"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -30,7 +30,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/fosscord/fosscord-api#readme",
|
||||
"dependencies": {
|
||||
"@fosscord/server-util": "@fosscord/server-util",
|
||||
"@fosscord/server-util": "^1.0.2",
|
||||
"@types/jest": "^26.0.22",
|
||||
"bcrypt": "^5.0.0",
|
||||
"body-parser": "^1.19.0",
|
||||
|
||||
@ -4,7 +4,7 @@ import { Connection } from "mongoose";
|
||||
import { Server, ServerOptions } from "lambert-server";
|
||||
import { Authentication, GlobalRateLimit } from "./middlewares/";
|
||||
import Config from "./util/Config";
|
||||
import { db } from "fosscord-server-util";
|
||||
import { db } from "@fosscord/server-util";
|
||||
import i18next from "i18next";
|
||||
import i18nextMiddleware, { I18next } from "i18next-http-middleware";
|
||||
import i18nextBackend from "i18next-node-fs-backend";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { checkToken } from "fosscord-server-util";
|
||||
import { checkToken } from "@fosscord/server-util";
|
||||
|
||||
export const NO_AUTHORIZATION_ROUTES = [
|
||||
"/api/v8/auth/login",
|
||||
|
||||
@ -2,7 +2,7 @@ import { Request, Response, Router } from "express";
|
||||
import { check, FieldErrors, Length } from "../../util/instanceOf";
|
||||
import bcrypt from "bcrypt";
|
||||
import jwt from "jsonwebtoken";
|
||||
import { User, UserModel } from "fosscord-server-util";
|
||||
import { User, UserModel } from "@fosscord/server-util";
|
||||
import Config from "../../util/Config";
|
||||
import { adjustEmail } from "./register";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import Config from "../../util/Config";
|
||||
import { trimSpecial, User, Snowflake, UserModel } from "fosscord-server-util";
|
||||
import { trimSpecial, User, Snowflake, UserModel } from "@fosscord/server-util";
|
||||
import bcrypt from "bcrypt";
|
||||
import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf";
|
||||
import "missing-native-js-functions";
|
||||
|
||||
@ -7,7 +7,7 @@ import { emitEvent } from "../../../util/Event";
|
||||
|
||||
import { InviteCreateSchema } from "../../../schema/Invite";
|
||||
|
||||
import { getPermission, ChannelModel, InviteModel, InviteCreateEvent, toObject } from "fosscord-server-util";
|
||||
import { getPermission, ChannelModel, InviteModel, InviteCreateEvent, toObject } from "@fosscord/server-util";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Router } from "express";
|
||||
import { ChannelModel, getPermission, MessageDeleteBulkEvent, MessageModel } from "fosscord-server-util";
|
||||
import { ChannelModel, getPermission, MessageDeleteBulkEvent, MessageModel } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import Config from "../../../../util/Config";
|
||||
import { emitEvent } from "../../../../util/Event";
|
||||
@ -13,7 +13,7 @@ export default router;
|
||||
// TODO: should this request fail, if you provide messages older than 14 days/invalid ids?
|
||||
// https://discord.com/developers/docs/resources/channel#bulk-delete-messages
|
||||
router.post("/", check({ messages: [String] }), async (req, res) => {
|
||||
const channel_id = req.params.channel_id
|
||||
const channel_id = req.params.channel_id;
|
||||
const channel = await ChannelModel.findOne({ id: channel_id }, { permission_overwrites: true, guild_id: true }).exec();
|
||||
if (!channel?.guild_id) throw new HTTPError("Can't bulk delete dm channel messages", 400);
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
MessageModel,
|
||||
Snowflake,
|
||||
toObject,
|
||||
} from "fosscord-server-util";
|
||||
} from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { MessageCreateSchema } from "../../../../schema/Message";
|
||||
import { check, instanceOf, Length } from "../../../../util/instanceOf";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { BanModel, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, GuildModel, toObject } from "fosscord-server-util";
|
||||
import { BanModel, getPermission, GuildBanAddEvent, GuildBanRemoveEvent, GuildModel, toObject } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { getIpAdress } from "../../../middlewares/GlobalRateLimit";
|
||||
import { BanCreateSchema } from "../../../schema/Ban";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Router } from "express";
|
||||
import { ChannelCreateEvent, ChannelModel, ChannelType, GuildModel, Snowflake, toObject } from "fosscord-server-util";
|
||||
import { ChannelCreateEvent, ChannelModel, ChannelType, GuildModel, Snowflake, toObject } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { ChannelModifySchema } from "../../../schema/Channel";
|
||||
import { emitEvent } from "../../../util/Event";
|
||||
|
||||
@ -12,7 +12,7 @@ import {
|
||||
RoleModel,
|
||||
toObject,
|
||||
UserModel,
|
||||
} from "fosscord-server-util";
|
||||
} from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { GuildUpdateSchema } from "../../../schema/Guild";
|
||||
import { emitEvent } from "../../../util/Event";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Request, Response, Router } from "express";
|
||||
import { GuildModel, MemberModel, toObject } from "fosscord-server-util";
|
||||
import { GuildModel, MemberModel, toObject } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { instanceOf, Length } from "../../../util/instanceOf";
|
||||
import { PublicMemberProjection } from "../../../util/Member";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { RoleModel, GuildModel, Snowflake, Guild } from "fosscord-server-util";
|
||||
import { RoleModel, GuildModel, Snowflake, Guild } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { check } from "./../../util/instanceOf";
|
||||
import { GuildCreateSchema } from "../../schema/Guild";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { getPermission, InviteModel, toObject } from "fosscord-server-util";
|
||||
import { getPermission, InviteModel, toObject } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
const router: Router = Router();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { GuildModel, MemberModel, UserModel, GuildDeleteEvent, GuildMemberRemoveEvent, toObject } from "fosscord-server-util";
|
||||
import { GuildModel, MemberModel, UserModel, GuildDeleteEvent, GuildMemberRemoveEvent, toObject } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import { emitEvent } from "../../../util/Event";
|
||||
import { getPublicUser } from "../../../util/User";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { UserModel } from "fosscord-server-util";
|
||||
import { UserModel } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChannelSchema, GuildChannel } from "fosscord-server-util";
|
||||
import { ChannelSchema, GuildChannel } from "@fosscord/server-util";
|
||||
import { Length } from "../util/instanceOf";
|
||||
|
||||
export const GuildCreateSchema = {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Embed, EmbedImage } from "fosscord-server-util";
|
||||
import { Embed, EmbedImage } from "@fosscord/server-util";
|
||||
import { Length } from "../util/instanceOf";
|
||||
|
||||
export const MessageCreateSchema = {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { getPermission } from "fosscord-server-util";
|
||||
import { getPermission } from "@fosscord/server-util";
|
||||
|
||||
async function main() {
|
||||
const t = await getPermission("811642917432066048", "812327318532915201");
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Config, Snowflake } from "fosscord-server-util";
|
||||
import { Config, Snowflake } from "@fosscord/server-util";
|
||||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Event, EventModel } from "fosscord-server-util";
|
||||
import { Event, EventModel } from "@fosscord/server-util";
|
||||
|
||||
export async function emitEvent(payload: Omit<Event, "created_at">) {
|
||||
const obj = {
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
GuildModel,
|
||||
MemberModel,
|
||||
UserModel,
|
||||
} from "fosscord-server-util";
|
||||
} from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
import Config from "./Config";
|
||||
import { emitEvent } from "./Event";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { toObject, UserModel } from "fosscord-server-util";
|
||||
import { toObject, UserModel } from "@fosscord/server-util";
|
||||
import { HTTPError } from "lambert-server";
|
||||
|
||||
export const PublicUserProjection = {
|
||||
|
||||
Reference in New Issue
Block a user