gemcap-be-common 1.5.137 → 1.5.138

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.
@@ -23,14 +23,26 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose from 'mongoose';
26
- export declare const FILE_SOURCE_TYPES: readonly ["upload", "copy", "generated", "legacy"];
27
- export type TFileSource = (typeof FILE_SOURCE_TYPES)[number];
28
- export declare const FILE_STORAGE_PROVIDER_TYPES: readonly ["s3"];
29
- export type TFileStorageProvider = (typeof FILE_STORAGE_PROVIDER_TYPES)[number];
26
+ export declare const FILE_BUCKET: {
27
+ readonly compliance: "compliance";
28
+ readonly CRM: "crm";
29
+ };
30
+ export type TFileBucket = (typeof FILE_BUCKET)[keyof typeof FILE_BUCKET];
31
+ export declare const FILE_SOURCE_TYPES: {
32
+ readonly upload: "upload";
33
+ readonly copy: "copy";
34
+ readonly generated: "generated";
35
+ readonly legacy: "legacy";
36
+ };
37
+ export type TFileSource = (typeof FILE_SOURCE_TYPES)[keyof typeof FILE_SOURCE_TYPES];
38
+ export declare const FILE_STORAGE_PROVIDER_TYPES: {
39
+ readonly s3: "s3";
40
+ };
41
+ export type TFileStorageProvider = (typeof FILE_STORAGE_PROVIDER_TYPES)[keyof typeof FILE_STORAGE_PROVIDER_TYPES];
30
42
  export interface IFile {
31
43
  storageKey: string;
32
44
  storageProvider: TFileStorageProvider;
33
- bucket?: string;
45
+ bucket?: TFileBucket;
34
46
  filename: string;
35
47
  mimeType?: string;
36
48
  size?: number;
@@ -3,18 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.File = exports.FileSchema = exports.FILE_STORAGE_PROVIDER_TYPES = exports.FILE_SOURCE_TYPES = void 0;
6
+ exports.File = exports.FileSchema = exports.FILE_STORAGE_PROVIDER_TYPES = exports.FILE_SOURCE_TYPES = exports.FILE_BUCKET = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
8
  const _models_1 = require("./_models");
9
- exports.FILE_SOURCE_TYPES = [
10
- 'upload',
11
- 'copy',
12
- 'generated',
13
- 'legacy',
14
- ];
15
- exports.FILE_STORAGE_PROVIDER_TYPES = [
16
- 's3',
17
- ];
9
+ exports.FILE_BUCKET = {
10
+ compliance: 'compliance',
11
+ CRM: 'crm',
12
+ };
13
+ exports.FILE_SOURCE_TYPES = {
14
+ upload: 'upload',
15
+ copy: 'copy',
16
+ generated: 'generated',
17
+ legacy: 'legacy',
18
+ };
19
+ exports.FILE_STORAGE_PROVIDER_TYPES = {
20
+ s3: 's3',
21
+ };
18
22
  exports.FileSchema = new mongoose_1.default.Schema({
19
23
  storageKey: {
20
24
  type: String,
@@ -22,11 +26,13 @@ exports.FileSchema = new mongoose_1.default.Schema({
22
26
  },
23
27
  storageProvider: {
24
28
  type: String,
25
- enum: exports.FILE_STORAGE_PROVIDER_TYPES,
29
+ enum: Object.values(exports.FILE_STORAGE_PROVIDER_TYPES),
26
30
  required: true,
27
31
  },
28
32
  bucket: {
29
33
  type: String,
34
+ enum: Object.values(exports.FILE_BUCKET),
35
+ required: true,
30
36
  },
31
37
  filename: {
32
38
  type: String,
@@ -46,13 +52,13 @@ exports.FileSchema = new mongoose_1.default.Schema({
46
52
  source: {
47
53
  type: {
48
54
  type: String,
49
- enum: exports.FILE_SOURCE_TYPES,
55
+ enum: Object.values(exports.FILE_SOURCE_TYPES),
50
56
  required: true,
51
57
  },
52
58
  fileId: {
53
59
  type: String,
54
- }
55
- }
60
+ },
61
+ },
56
62
  }, {
57
63
  timestamps: { createdAt: true, updatedAt: true },
58
64
  versionKey: false,
@@ -1,26 +1,33 @@
1
1
  import mongoose from 'mongoose';
2
2
 
3
- import { MODEL_NAMES, TModelName } from './_models';
3
+ import { MODEL_NAMES } from './_models';
4
4
 
5
- export const FILE_SOURCE_TYPES = [
6
- 'upload',
7
- 'copy',
8
- 'generated',
9
- 'legacy',
10
- ] as const;
5
+ export const FILE_BUCKET = {
6
+ compliance: 'compliance',
7
+ CRM: 'crm',
8
+ } as const;
11
9
 
12
- export type TFileSource = (typeof FILE_SOURCE_TYPES)[number];
10
+ export type TFileBucket = (typeof FILE_BUCKET)[keyof typeof FILE_BUCKET];
13
11
 
14
- export const FILE_STORAGE_PROVIDER_TYPES = [
15
- 's3',
16
- ] as const;
12
+ export const FILE_SOURCE_TYPES = {
13
+ upload: 'upload',
14
+ copy: 'copy',
15
+ generated: 'generated',
16
+ legacy: 'legacy',
17
+ } as const;
17
18
 
18
- export type TFileStorageProvider = (typeof FILE_STORAGE_PROVIDER_TYPES)[number];
19
+ export type TFileSource = (typeof FILE_SOURCE_TYPES)[keyof typeof FILE_SOURCE_TYPES];
20
+
21
+ export const FILE_STORAGE_PROVIDER_TYPES = {
22
+ s3: 's3',
23
+ } as const;
24
+
25
+ export type TFileStorageProvider = (typeof FILE_STORAGE_PROVIDER_TYPES)[keyof typeof FILE_STORAGE_PROVIDER_TYPES];
19
26
 
20
27
  export interface IFile {
21
28
  storageKey: string;
22
29
  storageProvider: TFileStorageProvider;
23
- bucket?: string;
30
+ bucket?: TFileBucket;
24
31
 
25
32
  filename: string;
26
33
  mimeType?: string;
@@ -58,11 +65,13 @@ export const FileSchema = new mongoose.Schema<IFile, TFileModel>(
58
65
  },
59
66
  storageProvider: {
60
67
  type: String,
61
- enum: FILE_STORAGE_PROVIDER_TYPES,
68
+ enum: Object.values(FILE_STORAGE_PROVIDER_TYPES),
62
69
  required: true,
63
70
  },
64
71
  bucket: {
65
72
  type: String,
73
+ enum: Object.values(FILE_BUCKET),
74
+ required: true,
66
75
  },
67
76
  filename: {
68
77
  type: String,
@@ -82,13 +91,13 @@ export const FileSchema = new mongoose.Schema<IFile, TFileModel>(
82
91
  source: {
83
92
  type: {
84
93
  type: String,
85
- enum: FILE_SOURCE_TYPES,
94
+ enum: Object.values(FILE_SOURCE_TYPES),
86
95
  required: true,
87
96
  },
88
97
  fileId: {
89
98
  type: String,
90
- }
91
- }
99
+ },
100
+ },
92
101
  },
93
102
  {
94
103
  timestamps: { createdAt: true, updatedAt: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemcap-be-common",
3
- "version": "1.5.137",
3
+ "version": "1.5.138",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {