streamby-core 0.21.1 → 0.21.3

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.
@@ -0,0 +1,290 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectRouter = projectRouter;
4
+ const express_1 = require("express");
5
+ const manager_1 = require("../../models/manager");
6
+ const auth_1 = require("../../utils/auth");
7
+ function projectRouter(config) {
8
+ const router = (0, express_1.Router)();
9
+ const Project = (0, manager_1.getModel)('projects');
10
+ const mapProjectToResponseFormat = (project, userId) => {
11
+ const currentUserMember = project.members?.find((member) => member.userId === userId);
12
+ return {
13
+ id: project._id || project.id,
14
+ dbType: project.dbType,
15
+ name: project.name,
16
+ image: project.image || '',
17
+ archived: currentUserMember ? currentUserMember.archived || false : false,
18
+ };
19
+ };
20
+ router.get('/projects', async (req, res) => {
21
+ try {
22
+ const auth = await config.authProvider(req);
23
+ if (!auth ||
24
+ !auth.userId ||
25
+ !auth.role) {
26
+ return res.status(401).json({ error: 'Unauthorized' });
27
+ }
28
+ const archivedQuery = req.query.archived;
29
+ const filterArchived = archivedQuery !== undefined ? String(archivedQuery).toLowerCase() === 'true' : undefined;
30
+ const allProjects = await Project.find({}); // Fetch all projects
31
+ const projects = allProjects
32
+ .filter(project => {
33
+ const isMember = project.members?.some((m) => m.userId?.toString() === auth.userId?.toString());
34
+ if (!isMember)
35
+ return false;
36
+ if (filterArchived !== undefined) {
37
+ const currentUserMember = project.members?.find((member) => member.userId === auth.userId);
38
+ return currentUserMember ? (currentUserMember.archived || false) === filterArchived : false;
39
+ }
40
+ return true;
41
+ })
42
+ .map(project => mapProjectToResponseFormat(project, auth.userId));
43
+ res.json({ projects });
44
+ }
45
+ catch (err) {
46
+ console.error('Error in /projects endpoint:', err);
47
+ res.status(500).json({ error: 'Failed to list projects', details: err });
48
+ }
49
+ });
50
+ router.post('/projects/create', async (req, res) => {
51
+ try {
52
+ const auth = await config.authProvider(req);
53
+ if (!auth ||
54
+ !auth.userId ||
55
+ !auth.role) {
56
+ return res.status(401).json({ error: 'Unauthorized' });
57
+ }
58
+ if (auth.role !== 'admin' && auth.role !== 'editor') {
59
+ return res.status(403).json({ error: 'Permission denied' });
60
+ }
61
+ const { name, description, dbType, image } = req.body;
62
+ const mainDb = config.databases?.find(db => db.main);
63
+ if (!mainDb) {
64
+ return res.status(500).json({ error: 'Main database not configured' });
65
+ }
66
+ const userDbType = mainDb.type;
67
+ const User = (0, manager_1.getModel)('users', userDbType);
68
+ const user = await User.findOne({ _id: auth.userId });
69
+ if (!user) {
70
+ return res.status(404).json({ error: 'User not found' });
71
+ }
72
+ const newProject = await Project.create({
73
+ dbType: dbType || 'nosql',
74
+ name,
75
+ description: description || '',
76
+ image: image || '',
77
+ members: [{ userId: auth.userId, username: user.username, role: "admin", archived: false }]
78
+ });
79
+ res.status(201).json({ project: { ...newProject, id: newProject._id || newProject.id, _id: undefined } });
80
+ }
81
+ catch (err) {
82
+ res.status(500).json({ error: 'Failed to create project', details: err.message });
83
+ }
84
+ });
85
+ router.get('/projects/:id', async (req, res) => {
86
+ try {
87
+ const auth = await config.authProvider(req);
88
+ if (!auth ||
89
+ !auth.userId ||
90
+ !auth.role) {
91
+ return res.status(401).json({ error: 'Unauthorized' });
92
+ }
93
+ const projectId = req.params.id;
94
+ const project = await Project.findOne({ _id: projectId });
95
+ if (!project) {
96
+ return res.status(404).json({ error: 'Project not found' });
97
+ }
98
+ if (!(0, auth_1.isProjectMember)(project, auth.userId)) {
99
+ return res.status(403).json({ error: 'Unauthorized project access' });
100
+ }
101
+ res.json({ project: { ...project, id: project._id || project.id, _id: undefined } });
102
+ }
103
+ catch (err) {
104
+ res.status(500).json({ error: 'Failed to fetch project', details: err.message });
105
+ }
106
+ });
107
+ router.patch('/projects/:id', async (req, res) => {
108
+ try {
109
+ const auth = await config.authProvider(req);
110
+ if (!auth ||
111
+ !auth.userId ||
112
+ !auth.role) {
113
+ return res.status(401).json({ error: 'Unauthorized' });
114
+ }
115
+ if (auth.role !== 'admin' && auth.role !== 'editor') {
116
+ return res.status(403).json({ error: 'Permission denied' });
117
+ }
118
+ const projectId = req.params.id;
119
+ const updates = req.body;
120
+ const project = await Project.findOne({ _id: projectId });
121
+ if (!project) {
122
+ return res.status(404).json({ error: 'Project not found' });
123
+ }
124
+ if (!updates || typeof updates !== 'object') {
125
+ return res.status(400).json({ error: 'Missing updates payload' });
126
+ }
127
+ if (!(0, auth_1.isProjectMember)(project, auth.userId)) {
128
+ return res.status(403).json({ error: 'Unauthorized project access' });
129
+ }
130
+ const updated = await Project.update({ _id: projectId }, updates);
131
+ if (!updated) {
132
+ return res.status(404).json({ error: 'Project not found or not updated' });
133
+ }
134
+ res.status(200).json({ success: true, project: { ...updated, id: updated._id || updated.id, _id: undefined } });
135
+ }
136
+ catch (err) {
137
+ res.status(500).json({ error: 'Failed to update project', details: err.message });
138
+ }
139
+ });
140
+ router.delete('/projects/:id', async (req, res) => {
141
+ try {
142
+ const auth = await config.authProvider(req);
143
+ if (!auth ||
144
+ !auth.userId ||
145
+ !auth.role) {
146
+ return res.status(401).json({ error: 'Unauthorized' });
147
+ }
148
+ const projectId = req.params.id;
149
+ const project = await Project.findOne({ _id: projectId });
150
+ if (!project) {
151
+ return res.status(404).json({ error: 'Project not found' });
152
+ }
153
+ if (!(0, auth_1.isProjectMember)(project, auth.userId)) {
154
+ return res.status(403).json({ error: 'Unauthorized project access' });
155
+ }
156
+ await Project.delete({ _id: projectId });
157
+ res.status(200).json({ success: true });
158
+ }
159
+ catch (err) {
160
+ res.status(500).json({ error: 'Failed to delete project', details: err.message });
161
+ }
162
+ });
163
+ router.patch('/projects/:id/archive', async (req, res) => {
164
+ try {
165
+ const auth = await config.authProvider(req);
166
+ if (!auth ||
167
+ !auth.userId ||
168
+ !auth.role) {
169
+ return res.status(401).json({ error: 'Unauthorized' });
170
+ }
171
+ const projectId = req.params.id;
172
+ const project = await Project.findOne({ _id: projectId });
173
+ if (!project || !(0, auth_1.isProjectMember)(project, auth.userId)) {
174
+ return res.status(403).json({ error: 'Unauthorized project access' });
175
+ }
176
+ await Project.update({ _id: projectId, "members.userId": auth.userId }, { "members.$.archived": true, "members.$.archivedBy": auth.userId, "members.$.archivedAt": new Date() });
177
+ // Re-fetch all projects for the user to ensure the list is up-to-date
178
+ const allProjects = await Project.find({});
179
+ const projects = allProjects
180
+ .filter(project => {
181
+ const isMember = project.members?.some((m) => m.userId?.toString() === auth.userId?.toString());
182
+ return isMember; // Only include projects where the user is a member
183
+ })
184
+ .map(project => mapProjectToResponseFormat(project, auth.userId));
185
+ res.status(200).json({ success: true, projects: projects });
186
+ }
187
+ catch (err) {
188
+ res.status(500).json({ error: 'Failed to archive project', details: err.message });
189
+ }
190
+ });
191
+ router.patch('/projects/:id/unarchive', async (req, res) => {
192
+ try {
193
+ const auth = await config.authProvider(req);
194
+ if (!auth ||
195
+ !auth.userId ||
196
+ !auth.role) {
197
+ return res.status(401).json({ error: 'Unauthorized' });
198
+ }
199
+ const projectId = req.params.id;
200
+ const project = await Project.findOne({ _id: projectId });
201
+ if (!project || !(0, auth_1.isProjectMember)(project, auth.userId)) {
202
+ return res.status(403).json({ error: 'Unauthorized project access' });
203
+ }
204
+ await Project.update({ _id: projectId, "members.userId": auth.userId }, { "members.$.archived": false, "members.$.archivedBy": null, "members.$.archivedAt": null });
205
+ // Re-fetch all projects for the user to ensure the list is up-to-date
206
+ const allProjects = await Project.find({});
207
+ const projects = allProjects
208
+ .filter(project => {
209
+ const isMember = project.members?.some((m) => m.userId?.toString() === auth.userId?.toString());
210
+ return isMember; // Only include projects where the user is a member
211
+ })
212
+ .map(project => mapProjectToResponseFormat(project, auth.userId));
213
+ res.status(200).json({ success: true, projects: projects });
214
+ }
215
+ catch (err) {
216
+ res.status(500).json({ error: 'Failed to unarchive project', details: err.message });
217
+ }
218
+ });
219
+ router.get('/projects/:id/members', async (req, res) => {
220
+ try {
221
+ const auth = await config.authProvider(req);
222
+ if (!auth ||
223
+ !auth.userId ||
224
+ !auth.role) {
225
+ return res.status(401).json({ error: 'Unauthorized' });
226
+ }
227
+ const projectId = req.params.id;
228
+ const project = await Project.findOne({ _id: projectId });
229
+ if (!project) {
230
+ return res.status(404).json({ error: 'Project not found' });
231
+ }
232
+ if (!(0, auth_1.isProjectMember)(project, auth.userId)) {
233
+ return res.status(403).json({ error: 'Unauthorized project access' });
234
+ }
235
+ const mainDb = config.databases?.find(db => db.main);
236
+ if (!mainDb) {
237
+ return res.status(500).json({ error: 'Main database not configured' });
238
+ }
239
+ const userDbType = mainDb.type;
240
+ const User = (0, manager_1.getModel)('users', userDbType);
241
+ const membersWithUsernames = await Promise.all(project.members.map(async (member) => {
242
+ const user = await User.findOne({ _id: member.userId });
243
+ return {
244
+ userId: member.userId,
245
+ username: user ? user.username : 'Unknown',
246
+ role: member.role,
247
+ profilePic: user ? user.profilePic : ''
248
+ };
249
+ }));
250
+ res.json({ members: membersWithUsernames });
251
+ }
252
+ catch (err) {
253
+ res.status(500).json({ error: 'Failed to fetch project members', details: err.message });
254
+ }
255
+ });
256
+ router.post('/projects/:id/image', async (req, res) => {
257
+ try {
258
+ const auth = await config.authProvider(req);
259
+ if (!auth ||
260
+ !auth.userId ||
261
+ !auth.role) {
262
+ return res.status(401).json({ error: 'Unauthorized' });
263
+ }
264
+ if (auth.role !== 'admin' && auth.role !== 'editor') {
265
+ return res.status(403).json({ error: 'Permission denied' });
266
+ }
267
+ const projectId = req.params.id;
268
+ const { imageUrl } = req.body;
269
+ if (!projectId || !imageUrl) {
270
+ return res.status(400).json({ error: 'Missing projectId or imageUrl' });
271
+ }
272
+ const project = await Project.findOne({ _id: projectId });
273
+ if (!project) {
274
+ return res.status(404).json({ error: 'Project not found' });
275
+ }
276
+ if (!(0, auth_1.isProjectMember)(project, auth.userId)) {
277
+ return res.status(403).json({ error: 'Unauthorized project access' });
278
+ }
279
+ const updatedProject = await Project.update({ _id: projectId }, { image: imageUrl });
280
+ if (!updatedProject) {
281
+ return res.status(404).json({ error: 'Project not found or not updated' });
282
+ }
283
+ res.status(200).json({ success: true, project: { ...updatedProject, id: updatedProject._id || updatedProject.id, _id: undefined } });
284
+ }
285
+ catch (err) {
286
+ res.status(500).json({ error: 'Failed to update project image', details: err.message });
287
+ }
288
+ });
289
+ return router;
290
+ }
@@ -3,6 +3,7 @@ export declare class Model<T extends Document> {
3
3
  private connectionIds;
4
4
  private tableName;
5
5
  constructor(connectionIds: string[], tableName: string);
6
+ useDbType(dbType: string): Model<T>;
6
7
  find(filter: any): Promise<T[]>;
7
8
  private transformResult;
8
9
  findOne(filter: any): Promise<T | null>;
@@ -10,6 +10,13 @@ class Model {
10
10
  this.connectionIds = connectionIds;
11
11
  this.tableName = tableName;
12
12
  }
13
+ useDbType(dbType) {
14
+ const filteredConnectionIds = this.connectionIds.filter(id => {
15
+ const connection = (0, connectionManager_1.getConnection)(id);
16
+ return connection.type === dbType;
17
+ });
18
+ return new Model(filteredConnectionIds, this.tableName);
19
+ }
13
20
  async find(filter) {
14
21
  const allResults = [];
15
22
  const activeConnectionIds = this.connectionIds.filter(id => (0, connectionManager_1.getConnectedIds)().includes(id));
@@ -156,6 +163,7 @@ class Model {
156
163
  await sql_1.sqlAdapter.create(connection, 'project_members', {
157
164
  projectId: created.id,
158
165
  userId: member.userId,
166
+ role: member.role,
159
167
  archived: member.archived || false,
160
168
  });
161
169
  }
@@ -169,71 +177,89 @@ class Model {
169
177
  return data;
170
178
  }
171
179
  async update(filter, data) {
172
- const activeConnectionIds = this.connectionIds.filter(id => (0, connectionManager_1.getConnectedIds)().includes(id));
173
- for (const connectionId of activeConnectionIds) {
174
- const clientEntry = (0, connectionManager_1.getConnection)(connectionId);
175
- const connection = clientEntry.client;
176
- const dbType = clientEntry.type;
177
- let processedFilter = { ...filter };
178
- // Handle specific member archiving/unarchiving
179
- if (data["members.$.archived"] !== undefined && processedFilter["_id"] && processedFilter["members.userId"]) {
180
- const projectId = processedFilter["_id"];
181
- const userIdToUpdate = processedFilter["members.userId"];
182
- const newArchivedStatus = data["members.$.archived"];
183
- const archivedBy = data["members.$.archivedBy"];
184
- const archivedAt = data["members.$.archivedAt"];
185
- if (dbType === 'sql') {
186
- // For SQL, directly update the project_members table
187
- const memberUpdateResult = await sql_1.sqlAdapter.update(connection, 'project_members', { projectId: projectId, userId: userIdToUpdate }, { archived: newArchivedStatus, archivedBy: archivedBy, archivedAt: archivedAt });
188
- // After updating the member, fetch the full project to return
189
- if (memberUpdateResult) {
190
- const updatedProject = await this.findOne({ _id: projectId });
191
- return updatedProject;
192
- }
180
+ const existingProject = await this.findOne(filter); // Find the project first
181
+ if (!existingProject) {
182
+ return null; // Project not found
183
+ }
184
+ const targetDbType = existingProject.dbType; // Get the actual dbType of the project
185
+ // Find the connection that matches the targetDbType
186
+ const clientEntry = this.connectionIds
187
+ .map(id => (0, connectionManager_1.getConnection)(id))
188
+ .find(entry => entry.type === targetDbType);
189
+ if (!clientEntry) {
190
+ throw new Error(`No active connection found for database type: ${targetDbType}`);
191
+ }
192
+ const connection = clientEntry.client;
193
+ const dbType = clientEntry.type; // This will be the targetDbType
194
+ let updateFilter = {}; // Initialize updateFilter here
195
+ // Construct the updateFilter based on the actual dbType of the project
196
+ if (dbType === 'sql') {
197
+ updateFilter.id = existingProject.id; // Use the 'id' from the existingProject
198
+ }
199
+ else if (dbType === 'nosql') {
200
+ // Ensure _id is an ObjectId for NoSQL updates
201
+ if (existingProject._id && typeof existingProject._id === 'string') {
202
+ try {
203
+ updateFilter._id = new mongodb_1.ObjectId(existingProject._id);
193
204
  }
194
- else if (dbType === 'nosql') {
195
- // For NoSQL, fetch the project to modify its members array
196
- const projectToUpdate = await this.findOne({ _id: projectId });
197
- if (!projectToUpdate || !projectToUpdate.members) {
198
- continue; // Project not found or has no members, try next connection
199
- }
200
- const updatedMembers = projectToUpdate.members.map((member) => {
201
- if (member.userId === userIdToUpdate) {
202
- return { ...member, archived: newArchivedStatus, archivedBy: archivedBy, archivedAt: archivedAt };
203
- }
204
- return member;
205
- });
206
- let objectIdProjectId;
207
- try {
208
- objectIdProjectId = new mongodb_1.ObjectId(projectId);
209
- }
210
- catch (e) {
211
- // If it's not a valid ObjectId string, it might be a UUID from a SQL project.
212
- // In this case, this NoSQL connection won't find it, so we can just continue.
213
- continue;
214
- }
215
- // Update the project with the modified members array
216
- const result = await nosql_1.nosqlAdapter.update(connection, this.tableName, { _id: objectIdProjectId }, { members: updatedMembers });
217
- if (result)
218
- return result;
205
+ catch (e) {
206
+ // If existingProject._id is not a valid ObjectId string, it's an error for NoSQL
207
+ return null; // Or throw a more specific error
219
208
  }
220
209
  }
221
210
  else {
222
- // General update logic
223
- if (dbType === 'sql') {
224
- if (processedFilter._id) {
225
- processedFilter.id = processedFilter._id;
226
- delete processedFilter._id;
211
+ updateFilter._id = existingProject._id; // Already an ObjectId or other valid type
212
+ }
213
+ }
214
+ // Handle specific member archiving/unarchiving
215
+ if (data["members.$.archived"] !== undefined && filter["_id"] && filter["members.userId"]) { // Use original filter for projectId and userIdToUpdate
216
+ const originalProjectId = filter["_id"]; // Use the original projectId from the request filter
217
+ const userIdToUpdate = filter["members.userId"];
218
+ const newArchivedStatus = data["members.$.archived"];
219
+ const archivedBy = data["members.$.archivedBy"];
220
+ const archivedAt = data["members.$.archivedAt"];
221
+ if (dbType === 'sql') {
222
+ // For SQL, directly update the project_members table
223
+ const memberUpdateResult = await sql_1.sqlAdapter.update(connection, 'project_members', { projectId: originalProjectId, userId: userIdToUpdate }, // originalProjectId is fine for SQL
224
+ { archived: newArchivedStatus, archivedBy: archivedBy, archivedAt: archivedAt });
225
+ // After updating the member, fetch the full project to return
226
+ if (memberUpdateResult) {
227
+ const updatedProject = await this.findOne({ _id: originalProjectId });
228
+ return updatedProject;
229
+ }
230
+ }
231
+ else if (dbType === 'nosql') {
232
+ const projectToUpdate = existingProject; // Already fetched
233
+ const updatedMembers = projectToUpdate.members.map((member) => {
234
+ if (member.userId === userIdToUpdate) {
235
+ return { ...member, archived: newArchivedStatus, archivedBy: archivedBy, archivedAt: archivedAt };
227
236
  }
228
- const result = await sql_1.sqlAdapter.update(connection, this.tableName, processedFilter, data);
229
- if (result)
230
- return result;
237
+ return member;
238
+ });
239
+ let objectIdOriginalProjectId;
240
+ try {
241
+ objectIdOriginalProjectId = new mongodb_1.ObjectId(originalProjectId); // Convert originalProjectId to ObjectId for NoSQL
231
242
  }
232
- else if (dbType === 'nosql') {
233
- const result = await nosql_1.nosqlAdapter.update(connection, this.tableName, processedFilter, data);
234
- if (result)
235
- return result;
243
+ catch (e) {
244
+ return null;
236
245
  }
246
+ const result = await nosql_1.nosqlAdapter.update(connection, this.tableName, { _id: objectIdOriginalProjectId }, { members: updatedMembers });
247
+ if (result)
248
+ return result;
249
+ }
250
+ }
251
+ else {
252
+ // General update logic
253
+ // Use the correctly constructed updateFilter
254
+ if (dbType === 'sql') {
255
+ const result = await sql_1.sqlAdapter.update(connection, this.tableName, updateFilter, data);
256
+ if (result)
257
+ return result;
258
+ }
259
+ else if (dbType === 'nosql') {
260
+ const result = await nosql_1.nosqlAdapter.update(connection, this.tableName, updateFilter, data);
261
+ if (result)
262
+ return result;
237
263
  }
238
264
  }
239
265
  return null;
@@ -1,3 +1,3 @@
1
1
  import { Model } from './Model';
2
2
  export declare const defineModel: (name: string, connectionIds: string[], tableName: string) => void;
3
- export declare const getModel: (name: string) => Model<any>;
3
+ export declare const getModel: (name: string, dbType?: string) => Model<any>;
@@ -7,11 +7,14 @@ const defineModel = (name, connectionIds, tableName) => {
7
7
  models[name] = new Model_1.Model(connectionIds, tableName);
8
8
  };
9
9
  exports.defineModel = defineModel;
10
- const getModel = (name) => {
10
+ const getModel = (name, dbType) => {
11
11
  const model = models[name];
12
12
  if (!model) {
13
13
  throw new Error(`Model ${name} not defined.`);
14
14
  }
15
+ if (dbType) {
16
+ return model.useDbType(dbType);
17
+ }
15
18
  return model;
16
19
  };
17
20
  exports.getModel = getModel;
@@ -50,6 +50,7 @@ export interface DatabaseCredential {
50
50
  id: string;
51
51
  type: DatabaseType;
52
52
  connectionString?: string;
53
+ main?: boolean;
53
54
  }
54
55
  export interface StreamByConfig {
55
56
  storageProviders: {
@@ -0,0 +1 @@
1
+ export declare function isProjectMember(project: any, userId: string): any;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isProjectMember = isProjectMember;
4
+ function isProjectMember(project, userId) {
5
+ return project.members?.some((m) => m.userId?.toString() === userId?.toString());
6
+ }
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "streamby-core",
3
- "version": "0.21.1",
4
- "description": "StreamBy middleware framework for media storage management",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
- "scripts": {
11
- "build": "tsc",
12
- "test": "vitest",
13
- "dev": "ts-node-dev --respawn --clear dev.ts",
14
- "prepublishOnly": "npm run build"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/GwerhDev/StreamBy-Package.git"
19
- },
20
- "keywords": [
21
- "streamby",
22
- "middleware",
23
- "upload",
24
- "storage",
25
- "s3",
26
- "express",
27
- "typescript"
28
- ],
29
- "author": "TerminalCore Labs",
30
- "license": "MIT",
31
- "dependencies": {
32
- "@aws-sdk/client-s3": "^3.528.0",
33
- "@aws-sdk/s3-request-presigner": "^3.787.0",
34
- "@prisma/client": "^6.12.0",
35
- "bcrypt": "^5.1.1",
36
- "dotenv": "^16.5.0",
37
- "express": "^4.0.0",
38
- "mongodb": "^6.17.0",
39
- "mongoose": "^8.13.2",
40
- "pg": "^8.16.3",
41
- "prisma": "^6.12.0"
42
- },
43
- "devDependencies": {
44
- "@types/bcrypt": "^5.0.2",
45
- "@types/cors": "^2.8.18",
46
- "@types/express": "^4.17.17",
47
- "@types/mongodb": "^4.0.7",
48
- "@types/node": "^22.15.21",
49
- "@types/pg": "^8.15.4",
50
- "@types/supertest": "^6.0.3",
51
- "cors": "^2.8.5",
52
- "supertest": "^7.1.0",
53
- "ts-node-dev": "^2.0.0",
54
- "typescript": "^5.8.3",
55
- "vitest": "^3.1.1"
56
- },
57
- "peerDependencies": {
58
- "express": "^4.0.0"
59
- }
60
- }
1
+ {
2
+ "name": "streamby-core",
3
+ "version": "0.21.3",
4
+ "description": "StreamBy middleware framework for media storage management",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "vitest",
13
+ "dev": "ts-node-dev --respawn --clear dev.ts",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/GwerhDev/StreamBy-Package.git"
19
+ },
20
+ "keywords": [
21
+ "streamby",
22
+ "middleware",
23
+ "upload",
24
+ "storage",
25
+ "s3",
26
+ "express",
27
+ "typescript"
28
+ ],
29
+ "author": "TerminalCore Labs",
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "@aws-sdk/client-s3": "^3.528.0",
33
+ "@aws-sdk/s3-request-presigner": "^3.787.0",
34
+ "@prisma/client": "^6.12.0",
35
+ "bcrypt": "^5.1.1",
36
+ "dotenv": "^16.5.0",
37
+ "express": "^4.0.0",
38
+ "mongodb": "^6.17.0",
39
+ "mongoose": "^8.13.2",
40
+ "pg": "^8.16.3",
41
+ "prisma": "^6.12.0"
42
+ },
43
+ "devDependencies": {
44
+ "@types/bcrypt": "^5.0.2",
45
+ "@types/cors": "^2.8.18",
46
+ "@types/express": "^4.17.17",
47
+ "@types/mongodb": "^4.0.7",
48
+ "@types/node": "^22.15.21",
49
+ "@types/pg": "^8.15.4",
50
+ "@types/supertest": "^6.0.3",
51
+ "cors": "^2.8.5",
52
+ "supertest": "^7.1.0",
53
+ "ts-node-dev": "^2.0.0",
54
+ "typescript": "^5.8.3",
55
+ "vitest": "^3.1.1"
56
+ },
57
+ "peerDependencies": {
58
+ "express": "^4.0.0"
59
+ }
60
+ }