@programisto/edrm-storage 1.0.1 → 1.0.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.
package/dist/bin/www.js CHANGED
@@ -9,5 +9,5 @@ if (fs.existsSync(localAppPath)) {
9
9
  await import(localAppPath);
10
10
  }
11
11
  else {
12
- await import('@programisto/endurance-core');
12
+ await import('@programisto/endurance');
13
13
  }
@@ -1,4 +1,4 @@
1
- import { EnduranceSchema } from '@programisto/endurance-core';
1
+ import { EnduranceSchema } from '@programisto/endurance';
2
2
  export declare enum FileStatus {
3
3
  PENDING = "PENDING",
4
4
  UPLOADING = "UPLOADING",
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  /* eslint-disable @typescript-eslint/no-unused-vars, no-use-before-define */
11
- import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance-core';
11
+ import { EnduranceSchema, EnduranceModelType } from '@programisto/endurance';
12
12
  // Enums pour les statuts de fichiers
13
13
  export var FileStatus;
14
14
  (function (FileStatus) {
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter } from '@programisto/endurance-core';
1
+ import { EnduranceRouter } from '@programisto/endurance';
2
2
  declare class EdrmStorageRouter extends EnduranceRouter {
3
3
  private storageService;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- import { EnduranceRouter } from '@programisto/endurance-core';
1
+ import { EnduranceRouter } from '@programisto/endurance';
2
2
  import { EdrmStorageService } from '../services/edrm-storage.service.js';
3
3
  class EdrmStorageRouter extends EnduranceRouter {
4
4
  storageService;
@@ -9,14 +9,13 @@ class EdrmStorageRouter extends EnduranceRouter {
9
9
  setupRoutes() {
10
10
  const adminOptions = {
11
11
  requireAuth: true,
12
- permissions: ['admin', 'file:manage']
12
+ permissions: ['Admin_ManageFiles']
13
13
  };
14
14
  const userOptions = {
15
- requireAuth: true,
16
- permissions: ['file:read']
15
+ requireAuth: true
17
16
  };
18
17
  // Routes publiques pour l'initialisation d'upload
19
- this.post('/files/init', { requireAuth: true, permissions: ['file:upload'] }, async (req, res) => {
18
+ this.post('/files/init', userOptions, async (req, res) => {
20
19
  try {
21
20
  const { originalName, mimeType, size, tenantId, entityName, entityId, provider = 'S3', metadata, tags } = req.body;
22
21
  if (!originalName || !mimeType || !size || !tenantId || !entityName || !entityId) {
@@ -40,7 +39,7 @@ class EdrmStorageRouter extends EnduranceRouter {
40
39
  }
41
40
  });
42
41
  // Finaliser un upload
43
- this.post('/files/:fileId/complete', adminOptions, async (req, res) => {
42
+ this.post('/files/:fileId/complete', userOptions, async (req, res) => {
44
43
  try {
45
44
  const { fileId } = req.params;
46
45
  const result = await this.storageService.completeUpload(fileId);
@@ -95,7 +94,7 @@ class EdrmStorageRouter extends EnduranceRouter {
95
94
  }
96
95
  });
97
96
  // Lister les fichiers
98
- this.get('/files', userOptions, async (req, res) => {
97
+ this.get('/files', adminOptions, async (req, res) => {
99
98
  try {
100
99
  const { tenantId, entityName, entityId, status, page = 1, limit = 20 } = req.query;
101
100
  const result = await this.storageService.listFiles(tenantId, entityName, entityId, status, parseInt(page), parseInt(limit));
@@ -1,4 +1,4 @@
1
- import { enduranceEmitter, enduranceEventTypes } from '@programisto/endurance-core';
1
+ import { enduranceEmitter, enduranceEventTypes } from '@programisto/endurance';
2
2
  import FileModel, { FileStatus, FileProvider, FileType } from '../models/file.model.js';
3
3
  import { S3StorageProvider } from '../providers/s3-storage.provider.js';
4
4
  import crypto from 'crypto';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@programisto/edrm-storage",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@aws-sdk/client-s3": "^3.879.0",
21
21
  "@aws-sdk/s3-request-presigner": "^3.879.0",
22
- "@programisto/endurance-core": "^1.1.6",
22
+ "@programisto/endurance": "^1.0.2",
23
23
  "aws-sdk": "^2.1692.0",
24
24
  "debug": "^4.3.7",
25
25
  "fs": "^0.0.1-security",