npm i @fosscord/server-util
This commit is contained in:
		
							parent
							
								
									4b914bcd32
								
							
						
					
					
						commit
						b40d6b825b
					
				
							
								
								
									
										105
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										105
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -10,14 +10,13 @@ | ||||
| 			"hasInstallScript": true, | ||||
| 			"license": "ISC", | ||||
| 			"dependencies": { | ||||
| 				"@fosscord/fosscord-server-util": "github:fosscord/fosscord-server-util", | ||||
| 				"@fosscord/server-util": "^1.0.2", | ||||
| 				"@types/jest": "^26.0.22", | ||||
| 				"bcrypt": "^5.0.0", | ||||
| 				"body-parser": "^1.19.0", | ||||
| 				"dotenv": "^8.2.0", | ||||
| 				"express": "^4.17.1", | ||||
| 				"express-validator": "^6.9.2", | ||||
| 				"fosscord-server-util": "github:fosscord/fosscord-server-util", | ||||
| 				"i18next": "^19.8.5", | ||||
| 				"i18next-http-middleware": "^3.1.0", | ||||
| 				"i18next-node-fs-backend": "^2.1.3", | ||||
| @ -581,10 +580,10 @@ | ||||
| 				"node": ">=0.1.95" | ||||
| 			} | ||||
| 		}, | ||||
| 		"node_modules/@fosscord/fosscord-server-util": { | ||||
| 		"node_modules/@fosscord/server-util": { | ||||
| 			"version": "1.0.2", | ||||
| 			"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#afc284ec9a6309c9bf486739538de1619b62604d", | ||||
| 			"license": "ISC", | ||||
| 			"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.0.2.tgz", | ||||
| 			"integrity": "sha512-X4l+lzG4nnNsM63bfjQenPkWOQBiPn40iqoSH+vZGw1dBUs25U8Vd4XpDoi/mkOTPiKXIM2fRkhGvTFyEn9l4g==", | ||||
| 			"dependencies": { | ||||
| 				"@types/jsonwebtoken": "^8.5.0", | ||||
| 				"@types/mongoose-autopopulate": "^0.10.1", | ||||
| @ -598,7 +597,7 @@ | ||||
| 				"typescript": "^4.1.3" | ||||
| 			} | ||||
| 		}, | ||||
| 		"node_modules/@fosscord/fosscord-server-util/node_modules/mongodb": { | ||||
| 		"node_modules/@fosscord/server-util/node_modules/mongodb": { | ||||
| 			"version": "3.6.6", | ||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", | ||||
| 			"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", | ||||
| @ -4619,62 +4618,6 @@ | ||||
| 				"node": ">= 0.6" | ||||
| 			} | ||||
| 		}, | ||||
| 		"node_modules/fosscord-server-util": { | ||||
| 			"version": "1.0.0", | ||||
| 			"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#9c62b43664f9808497cdaf5142ef071c4e01275d", | ||||
| 			"license": "ISC", | ||||
| 			"dependencies": { | ||||
| 				"@types/jsonwebtoken": "^8.5.0", | ||||
| 				"@types/mongoose-autopopulate": "^0.10.1", | ||||
| 				"@types/mongoose-lean-virtuals": "^0.5.1", | ||||
| 				"@types/node": "^14.14.25", | ||||
| 				"jsonwebtoken": "^8.5.1", | ||||
| 				"missing-native-js-functions": "^1.2.2", | ||||
| 				"mongodb": "^3.6.6", | ||||
| 				"mongoose": "^5.12.3", | ||||
| 				"mongoose-autopopulate": "^0.12.3", | ||||
| 				"typescript": "^4.1.3" | ||||
| 			} | ||||
| 		}, | ||||
| 		"node_modules/fosscord-server-util/node_modules/mongodb": { | ||||
| 			"version": "3.6.6", | ||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", | ||||
| 			"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", | ||||
| 			"dependencies": { | ||||
| 				"bl": "^2.2.1", | ||||
| 				"bson": "^1.1.4", | ||||
| 				"denque": "^1.4.1", | ||||
| 				"optional-require": "^1.0.2", | ||||
| 				"safe-buffer": "^5.1.2", | ||||
| 				"saslprep": "^1.0.0" | ||||
| 			}, | ||||
| 			"engines": { | ||||
| 				"node": ">=4" | ||||
| 			}, | ||||
| 			"optionalDependencies": { | ||||
| 				"saslprep": "^1.0.0" | ||||
| 			}, | ||||
| 			"peerDependenciesMeta": { | ||||
| 				"aws4": { | ||||
| 					"optional": true | ||||
| 				}, | ||||
| 				"bson-ext": { | ||||
| 					"optional": true | ||||
| 				}, | ||||
| 				"kerberos": { | ||||
| 					"optional": true | ||||
| 				}, | ||||
| 				"mongodb-client-encryption": { | ||||
| 					"optional": true | ||||
| 				}, | ||||
| 				"mongodb-extjson": { | ||||
| 					"optional": true | ||||
| 				}, | ||||
| 				"snappy": { | ||||
| 					"optional": true | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		"node_modules/fragment-cache": { | ||||
| 			"version": "0.2.1", | ||||
| 			"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", | ||||
| @ -12619,9 +12562,10 @@ | ||||
| 				"minimist": "^1.2.0" | ||||
| 			} | ||||
| 		}, | ||||
| 		"@fosscord/fosscord-server-util": { | ||||
| 			"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#afc284ec9a6309c9bf486739538de1619b62604d", | ||||
| 			"from": "@fosscord/fosscord-server-util@github:fosscord/fosscord-server-util", | ||||
| 		"@fosscord/server-util": { | ||||
| 			"version": "1.0.2", | ||||
| 			"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.0.2.tgz", | ||||
| 			"integrity": "sha512-X4l+lzG4nnNsM63bfjQenPkWOQBiPn40iqoSH+vZGw1dBUs25U8Vd4XpDoi/mkOTPiKXIM2fRkhGvTFyEn9l4g==", | ||||
| 			"requires": { | ||||
| 				"@types/jsonwebtoken": "^8.5.0", | ||||
| 				"@types/mongoose-autopopulate": "^0.10.1", | ||||
| @ -15995,37 +15939,6 @@ | ||||
| 			"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", | ||||
| 			"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" | ||||
| 		}, | ||||
| 		"fosscord-server-util": { | ||||
| 			"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#9c62b43664f9808497cdaf5142ef071c4e01275d", | ||||
| 			"from": "fosscord-server-util@github:fosscord/fosscord-server-util", | ||||
| 			"requires": { | ||||
| 				"@types/jsonwebtoken": "^8.5.0", | ||||
| 				"@types/mongoose-autopopulate": "^0.10.1", | ||||
| 				"@types/mongoose-lean-virtuals": "^0.5.1", | ||||
| 				"@types/node": "^14.14.25", | ||||
| 				"jsonwebtoken": "^8.5.1", | ||||
| 				"missing-native-js-functions": "^1.2.2", | ||||
| 				"mongodb": "^3.6.6", | ||||
| 				"mongoose": "^5.12.3", | ||||
| 				"mongoose-autopopulate": "^0.12.3", | ||||
| 				"typescript": "^4.1.3" | ||||
| 			}, | ||||
| 			"dependencies": { | ||||
| 				"mongodb": { | ||||
| 					"version": "3.6.6", | ||||
| 					"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", | ||||
| 					"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", | ||||
| 					"requires": { | ||||
| 						"bl": "^2.2.1", | ||||
| 						"bson": "^1.1.4", | ||||
| 						"denque": "^1.4.1", | ||||
| 						"optional-require": "^1.0.2", | ||||
| 						"safe-buffer": "^5.1.2", | ||||
| 						"saslprep": "^1.0.0" | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		}, | ||||
| 		"fragment-cache": { | ||||
| 			"version": "0.2.1", | ||||
| 			"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", | ||||
|  | ||||
| @ -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 = { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Flam3rboy
						Flam3rboy