modelence 0.5.14-dev.0 → 0.6.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/chunk-5TLHWYXF.js +2 -0
- package/dist/chunk-5TLHWYXF.js.map +1 -0
- package/dist/client.d.ts +12 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/package-EK42D2UK.js +3 -0
- package/dist/package-EK42D2UK.js.map +1 -0
- package/dist/server.d.ts +12 -20
- package/dist/server.js +11 -11
- package/dist/server.js.map +1 -1
- package/dist/serverRoom-Dn45ATJ4.d.ts +31 -0
- package/package.json +4 -1
- package/dist/chunk-C3UESBRX.js +0 -2
- package/dist/chunk-C3UESBRX.js.map +0 -1
- package/dist/package-4RSIRWA5.js +0 -3
- package/dist/package-4RSIRWA5.js.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Document, ObjectId } from 'mongodb';
|
|
2
|
+
|
|
3
|
+
type User = Document;
|
|
4
|
+
type UserInfo = {
|
|
5
|
+
id: string;
|
|
6
|
+
handle: string;
|
|
7
|
+
};
|
|
8
|
+
type Session = {
|
|
9
|
+
authToken: string;
|
|
10
|
+
expiresAt: Date;
|
|
11
|
+
userId: ObjectId | null;
|
|
12
|
+
};
|
|
13
|
+
type Permission = string;
|
|
14
|
+
type RoleDefinition = {
|
|
15
|
+
description?: string;
|
|
16
|
+
permissions: Permission[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type CanAccessRoom = (props: {
|
|
20
|
+
user: User | null;
|
|
21
|
+
session: Session | null;
|
|
22
|
+
roles: string[];
|
|
23
|
+
}) => Promise<boolean>;
|
|
24
|
+
declare class ServerRoom<T = any> {
|
|
25
|
+
readonly roomCategory: string;
|
|
26
|
+
readonly canAccessRoom: CanAccessRoom | null;
|
|
27
|
+
constructor(roomCategory: string, canAccessRoom?: CanAccessRoom);
|
|
28
|
+
broadcast(roomId: string, data: T): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type Permission as P, type RoleDefinition as R, ServerRoom as S, type UserInfo as U, type Session as a };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "modelence",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0-dev.0",
|
|
5
5
|
"description": "The Node.js Framework for Real-Time MongoDB Apps",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/global.d.ts",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@types/passport-google-oauth20": "^2.0.16",
|
|
47
47
|
"@types/react": "^19.0.0",
|
|
48
48
|
"@types/react-dom": "^19.0.1",
|
|
49
|
+
"@types/socket.io": "^3.0.1",
|
|
49
50
|
"@typescript-eslint/eslint-plugin": "^8.17.0",
|
|
50
51
|
"@typescript-eslint/parser": "^8.17.0",
|
|
51
52
|
"react": "^19.0.0",
|
|
@@ -67,6 +68,8 @@
|
|
|
67
68
|
"open": "^10.1.0",
|
|
68
69
|
"passport": "^0.7.0",
|
|
69
70
|
"passport-google-oauth20": "^2.0.0",
|
|
71
|
+
"socket.io": "^4.8.1",
|
|
72
|
+
"socket.io-client": "^4.8.1",
|
|
70
73
|
"tsup": "^8.3.6",
|
|
71
74
|
"tsx": "^4.19.3",
|
|
72
75
|
"typescript": "^5.7.2",
|
package/dist/chunk-C3UESBRX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=class extends Error{},a=class extends t{constructor(s){super(s);this.status=401;this.name="AuthError";}},n=class extends t{constructor(s){super(s);this.status=400;this.name="ValidationError";}},c=class extends t{constructor(s){super(s);this.status=429;this.name="RateLimitError";}};export{t as a,a as b,n as c,c as d};//# sourceMappingURL=chunk-C3UESBRX.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-C3UESBRX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/error.ts"],"names":["ModelenceError","AuthError","message","ValidationError","RateLimitError"],"mappings":"AAAO,IAAeA,CAAAA,CAAf,cAAsC,KAAM,EAEnD,CAEaC,EAAN,cAAwBD,CAAe,CAG5C,WAAA,CAAYE,CAAAA,CAAiB,CAC3B,MAAMA,CAAO,CAAA,CAHf,IAAA,CAAA,MAAA,CAAS,GAAA,CAIP,IAAA,CAAK,IAAA,CAAO,YACd,CACF,CAAA,CAEaC,CAAAA,CAAN,cAA8BH,CAAe,CAGlD,WAAA,CAAYE,EAAiB,CAC3B,KAAA,CAAMA,CAAO,CAAA,CAHf,IAAA,CAAA,MAAA,CAAS,GAAA,CAIP,KAAK,IAAA,CAAO,kBACd,CACF,CAAA,CAEaE,CAAAA,CAAN,cAA6BJ,CAAe,CAGjD,WAAA,CAAYE,CAAAA,CAAiB,CAC3B,KAAA,CAAMA,CAAO,CAAA,CAHf,IAAA,CAAA,MAAA,CAAS,GAAA,CAIP,IAAA,CAAK,IAAA,CAAO,iBACd,CACF","file":"chunk-C3UESBRX.js","sourcesContent":["export abstract class ModelenceError extends Error {\n abstract status: number;\n}\n\nexport class AuthError extends ModelenceError {\n status = 401;\n\n constructor(message: string) {\n super(message);\n this.name = 'AuthError';\n }\n}\n\nexport class ValidationError extends ModelenceError {\n status = 400;\n\n constructor(message: string) {\n super(message);\n this.name = 'ValidationError';\n }\n}\n\nexport class RateLimitError extends ModelenceError {\n status = 429;\n\n constructor(message: string) {\n super(message);\n this.name = 'RateLimitError';\n }\n}\n"]}
|
package/dist/package-4RSIRWA5.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var s="module",i="modelence",o="0.5.14-dev.0",p="The Node.js Framework for Real-Time MongoDB Apps",r="dist/index.js",n="dist/global.d.ts",d={".":"./dist/index.js","./client":"./dist/client.js","./server":"./dist/server.js","./telemetry":"./dist/telemetry.js","./mongodb":"./dist/mongo.js"},c=["dist","dist/bin"],l={modelence:"./dist/bin/modelence.js"},a={build:"tsup",dev:"tsup --watch",prepublishOnly:"npm run build",test:'echo "Error: no test specified" && exit 1',postversion:"git push && git push --tags"},m={type:"git",url:"git+https://github.com/modelence/modelence.git"},u="Modelence",g="SEE LICENSE IN LICENSE",y={url:"https://github.com/modelence/modelence/issues"},h="https://modelence.com",b={"@types/archiver":"^6.0.3","@types/bcrypt":"^5.0.2","@types/cookie-parser":"^1.4.9","@types/express":"^5.0.0","@types/fs-extra":"^11.0.4","@types/node":"^22.5.1","@types/passport-google-oauth20":"^2.0.16","@types/react":"^19.0.0","@types/react-dom":"^19.0.1","@typescript-eslint/eslint-plugin":"^8.17.0","@typescript-eslint/parser":"^8.17.0",react:"^19.0.0","react-dom":"^19.0.0"},v={"@modelence/types":"^1.0.3","@vitejs/plugin-react":"^4.3.4",archiver:"^7.0.1",bcrypt:"^5.1.1",commander:"^12.0.0","cookie-parser":"^1.4.7",dotenv:"^16.4.5","elastic-apm-node":"^4.8.0",express:"^4.21.0","fs-extra":"^11.2.0",jiti:"^2.4.2",mongodb:"^6.8.1",open:"^10.1.0",passport:"^0.7.0","passport-google-oauth20":"^2.0.0",tsup:"^8.3.6",tsx:"^4.19.3",typescript:"^5.7.2",vite:"^6.0.3","vite-plugin-eslint":"^1.8.1",winston:"^3.15.0","winston-elasticsearch":"^0.19.0",zod:"^3.23.8",zustand:"^5.0.2"},j={react:">=18.0.0","react-dom":">=18.0.0"},x={type:s,name:i,version:o,description:p,main:r,types:n,exports:d,files:c,bin:l,scripts:a,repository:m,author:u,license:g,bugs:y,homepage:h,devDependencies:b,dependencies:v,peerDependencies:j};
|
|
2
|
-
export{u as author,l as bin,y as bugs,x as default,v as dependencies,p as description,b as devDependencies,d as exports,c as files,h as homepage,g as license,r as main,i as name,j as peerDependencies,m as repository,a as scripts,s as type,n as types,o as version};//# sourceMappingURL=package-4RSIRWA5.js.map
|
|
3
|
-
//# sourceMappingURL=package-4RSIRWA5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json"],"names":["type","name","version","description","main","types","exports","files","bin","scripts","repository","author","license","bugs","homepage","devDependencies","dependencies","peerDependencies","package_default"],"mappings":"AACE,IAAAA,CAAAA,CAAQ,SACRC,CAAAA,CAAQ,WAAA,CACRC,EAAW,cAAA,CACXC,CAAAA,CAAe,mDACfC,CAAAA,CAAQ,eAAA,CACRC,EAAS,kBAAA,CACTC,CAAAA,CAAW,CACT,GAAA,CAAK,iBAAA,CACL,WAAY,kBAAA,CACZ,UAAA,CAAY,mBACZ,aAAA,CAAe,qBAAA,CACf,YAAa,iBACf,CAAA,CACAC,EAAS,CACP,MAAA,CACA,UACF,CAAA,CACAC,CAAAA,CAAO,CACL,SAAA,CAAa,yBACf,EACAC,CAAAA,CAAW,CACT,MAAS,MAAA,CACT,GAAA,CAAO,eACP,cAAA,CAAkB,eAAA,CAClB,KAAQ,2CAAA,CACR,WAAA,CAAe,6BACjB,CAAA,CACAC,CAAAA,CAAc,CACZ,IAAA,CAAQ,KAAA,CACR,IAAO,gDACT,CAAA,CACAC,EAAU,WAAA,CACVC,CAAAA,CAAW,yBACXC,CAAAA,CAAQ,CACN,IAAO,+CACT,CAAA,CACAC,EAAY,uBAAA,CACZC,CAAAA,CAAmB,CACjB,iBAAA,CAAmB,QAAA,CACnB,gBAAiB,QAAA,CACjB,sBAAA,CAAwB,SACxB,gBAAA,CAAkB,QAAA,CAClB,kBAAmB,SAAA,CACnB,aAAA,CAAe,UACf,gCAAA,CAAkC,SAAA,CAClC,eAAgB,SAAA,CAChB,kBAAA,CAAoB,UACpB,kCAAA,CAAoC,SAAA,CACpC,4BAA6B,SAAA,CAC7B,KAAA,CAAS,SAAA,CACT,WAAA,CAAa,SACf,CAAA,CACAC,EAAgB,CACd,kBAAA,CAAoB,SACpB,sBAAA,CAAwB,QAAA,CACxB,SAAY,QAAA,CACZ,MAAA,CAAU,SACV,SAAA,CAAa,SAAA,CACb,gBAAiB,QAAA,CACjB,MAAA,CAAU,UACV,kBAAA,CAAoB,QAAA,CACpB,QAAW,SAAA,CACX,UAAA,CAAY,UACZ,IAAA,CAAQ,QAAA,CACR,QAAW,QAAA,CACX,IAAA,CAAQ,UACR,QAAA,CAAY,QAAA,CACZ,0BAA2B,QAAA,CAC3B,IAAA,CAAQ,SACR,GAAA,CAAO,SAAA,CACP,WAAc,QAAA,CACd,IAAA,CAAQ,SACR,oBAAA,CAAsB,QAAA,CACtB,QAAW,SAAA,CACX,uBAAA,CAAyB,UACzB,GAAA,CAAO,SAAA,CACP,QAAW,QACb,CAAA,CACAC,EAAoB,CAClB,KAAA,CAAS,WACT,WAAA,CAAa,UACf,EAlFFC,CAAAA,CAAA,CACE,KAAAlB,CAAAA,CACA,IAAA,CAAAC,EACA,OAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CACA,IAAA,CAAAC,EACA,KAAA,CAAAC,CAAAA,CACA,QAAAC,CAAAA,CAOA,KAAA,CAAAC,EAIA,GAAA,CAAAC,CAAAA,CAGA,QAAAC,CAAAA,CAOA,UAAA,CAAAC,EAIA,MAAA,CAAAC,CAAAA,CACA,QAAAC,CAAAA,CACA,IAAA,CAAAC,EAGA,QAAA,CAAAC,CAAAA,CACA,gBAAAC,CAAAA,CAeA,YAAA,CAAAC,CAAAA,CA0BA,gBAAA,CAAAC,CAIF","file":"package-4RSIRWA5.js","sourcesContent":["{\n \"type\": \"module\",\n \"name\": \"modelence\",\n \"version\": \"0.5.14-dev.0\",\n \"description\": \"The Node.js Framework for Real-Time MongoDB Apps\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/global.d.ts\",\n \"exports\": {\n \".\": \"./dist/index.js\",\n \"./client\": \"./dist/client.js\",\n \"./server\": \"./dist/server.js\",\n \"./telemetry\": \"./dist/telemetry.js\",\n \"./mongodb\": \"./dist/mongo.js\"\n },\n \"files\": [\n \"dist\",\n \"dist/bin\"\n ],\n \"bin\": {\n \"modelence\": \"./dist/bin/modelence.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"prepublishOnly\": \"npm run build\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n \"postversion\": \"git push && git push --tags\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/modelence/modelence.git\"\n },\n \"author\": \"Modelence\",\n \"license\": \"SEE LICENSE IN LICENSE\",\n \"bugs\": {\n \"url\": \"https://github.com/modelence/modelence/issues\"\n },\n \"homepage\": \"https://modelence.com\",\n \"devDependencies\": {\n \"@types/archiver\": \"^6.0.3\",\n \"@types/bcrypt\": \"^5.0.2\",\n \"@types/cookie-parser\": \"^1.4.9\",\n \"@types/express\": \"^5.0.0\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/node\": \"^22.5.1\",\n \"@types/passport-google-oauth20\": \"^2.0.16\",\n \"@types/react\": \"^19.0.0\",\n \"@types/react-dom\": \"^19.0.1\",\n \"@typescript-eslint/eslint-plugin\": \"^8.17.0\",\n \"@typescript-eslint/parser\": \"^8.17.0\",\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\"\n },\n \"dependencies\": {\n \"@modelence/types\": \"^1.0.3\",\n \"@vitejs/plugin-react\": \"^4.3.4\",\n \"archiver\": \"^7.0.1\",\n \"bcrypt\": \"^5.1.1\",\n \"commander\": \"^12.0.0\",\n \"cookie-parser\": \"^1.4.7\",\n \"dotenv\": \"^16.4.5\",\n \"elastic-apm-node\": \"^4.8.0\",\n \"express\": \"^4.21.0\",\n \"fs-extra\": \"^11.2.0\",\n \"jiti\": \"^2.4.2\",\n \"mongodb\": \"^6.8.1\",\n \"open\": \"^10.1.0\",\n \"passport\": \"^0.7.0\",\n \"passport-google-oauth20\": \"^2.0.0\",\n \"tsup\": \"^8.3.6\",\n \"tsx\": \"^4.19.3\",\n \"typescript\": \"^5.7.2\",\n \"vite\": \"^6.0.3\",\n \"vite-plugin-eslint\": \"^1.8.1\",\n \"winston\": \"^3.15.0\",\n \"winston-elasticsearch\": \"^0.19.0\",\n \"zod\": \"^3.23.8\",\n \"zustand\": \"^5.0.2\"\n },\n \"peerDependencies\": {\n \"react\": \">=18.0.0\",\n \"react-dom\": \">=18.0.0\"\n }\n}\n"]}
|