@wrcb/cb-common 1.0.872 → 1.0.874
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/build/server.d.ts +1 -0
- package/build/server.js +1 -0
- package/build/services/WasabiUploader.d.ts +4 -1
- package/build/services/WasabiUploader.js +4 -10
- package/build/services/imageResize.d.ts +10 -0
- package/build/services/imageResize.js +36 -0
- package/build/types/trabalhoHomeOffice.d.ts +13 -0
- package/build/types/trabalhoHomeOffice.js +10 -1
- package/package.json +1 -1
package/build/server.d.ts
CHANGED
|
@@ -97,5 +97,6 @@ export * from './events/linkedin-automator/linkedinPostPublishedPublisher';
|
|
|
97
97
|
export * from './services/RedisService';
|
|
98
98
|
export * from './services/TenantDataService';
|
|
99
99
|
export * from './services/WasabiUploader';
|
|
100
|
+
export * from './services/imageResize';
|
|
100
101
|
export * from './services/WhatsappService';
|
|
101
102
|
export * from './services/ai/AIClient';
|
package/build/server.js
CHANGED
|
@@ -116,5 +116,6 @@ __exportStar(require("./events/linkedin-automator/linkedinPostPublishedPublisher
|
|
|
116
116
|
__exportStar(require("./services/RedisService"), exports);
|
|
117
117
|
__exportStar(require("./services/TenantDataService"), exports);
|
|
118
118
|
__exportStar(require("./services/WasabiUploader"), exports);
|
|
119
|
+
__exportStar(require("./services/imageResize"), exports);
|
|
119
120
|
__exportStar(require("./services/WhatsappService"), exports);
|
|
120
121
|
__exportStar(require("./services/ai/AIClient"), exports);
|
|
@@ -7,5 +7,8 @@ export interface UploadToWasabiParams {
|
|
|
7
7
|
region?: string;
|
|
8
8
|
endpoint?: string;
|
|
9
9
|
folder?: string;
|
|
10
|
+
contentType?: string;
|
|
11
|
+
extension?: string;
|
|
12
|
+
cacheControl?: string;
|
|
10
13
|
}
|
|
11
|
-
export declare function uploadToWasabi({ fileBuffer, originalName, accessKeyId, secretAccessKey, bucketName, region, endpoint, folder }: UploadToWasabiParams): Promise<string>;
|
|
14
|
+
export declare function uploadToWasabi({ fileBuffer, originalName, accessKeyId, secretAccessKey, bucketName, region, endpoint, folder, contentType: contentTypeOverride, extension: extensionOverride, cacheControl }: UploadToWasabiParams): Promise<string>;
|
|
@@ -18,9 +18,9 @@ const client_s3_1 = require("@aws-sdk/client-s3");
|
|
|
18
18
|
const uuid_1 = require("uuid");
|
|
19
19
|
const mime_types_1 = __importDefault(require("mime-types"));
|
|
20
20
|
function uploadToWasabi(_a) {
|
|
21
|
-
return __awaiter(this, arguments, void 0, function* ({ fileBuffer, originalName, accessKeyId, secretAccessKey, bucketName, region = 'us-east-1', endpoint = 'https://s3.us-east-1.wasabisys.com', folder = 'uploads' }) {
|
|
22
|
-
const extension = originalName.split('.').pop() || 'jpg';
|
|
23
|
-
const contentType = mime_types_1.default.lookup(extension) || 'application/octet-stream';
|
|
21
|
+
return __awaiter(this, arguments, void 0, function* ({ fileBuffer, originalName, accessKeyId, secretAccessKey, bucketName, region = 'us-east-1', endpoint = 'https://s3.us-east-1.wasabisys.com', folder = 'uploads', contentType: contentTypeOverride, extension: extensionOverride, cacheControl }) {
|
|
22
|
+
const extension = extensionOverride || originalName.split('.').pop() || 'jpg';
|
|
23
|
+
const contentType = contentTypeOverride || mime_types_1.default.lookup(extension) || 'application/octet-stream';
|
|
24
24
|
const filename = `${folder}/${(0, uuid_1.v4)()}.${extension}`;
|
|
25
25
|
const wasabiClient = new client_s3_1.S3Client({
|
|
26
26
|
region,
|
|
@@ -31,13 +31,7 @@ function uploadToWasabi(_a) {
|
|
|
31
31
|
secretAccessKey
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
const params = {
|
|
35
|
-
Bucket: bucketName,
|
|
36
|
-
Key: filename,
|
|
37
|
-
Body: fileBuffer,
|
|
38
|
-
ContentType: contentType,
|
|
39
|
-
ACL: 'public-read'
|
|
40
|
-
};
|
|
34
|
+
const params = Object.assign({ Bucket: bucketName, Key: filename, Body: fileBuffer, ContentType: contentType, ACL: 'public-read' }, (cacheControl ? { CacheControl: cacheControl } : {}));
|
|
41
35
|
yield wasabiClient.send(new client_s3_1.PutObjectCommand(params));
|
|
42
36
|
return `${endpoint.replace(/\/$/, '')}/${bucketName}/${filename}`;
|
|
43
37
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ResizeImageForWebOptions {
|
|
2
|
+
maxDimension: number;
|
|
3
|
+
quality?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ResizedImage {
|
|
6
|
+
buffer: Buffer;
|
|
7
|
+
contentType: 'image/webp';
|
|
8
|
+
extension: 'webp';
|
|
9
|
+
}
|
|
10
|
+
export declare function resizeImageForWeb(input: Buffer, { maxDimension, quality }: ResizeImageForWebOptions): Promise<ResizedImage>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.resizeImageForWeb = resizeImageForWeb;
|
|
16
|
+
const sharp_1 = __importDefault(require("sharp"));
|
|
17
|
+
// Redimensiona (sem ampliar) para caber em `maxDimension`, respeita a
|
|
18
|
+
// orientação EXIF, achata transparência em branco e recomprime em WebP.
|
|
19
|
+
// Lança em imagem inválida — quem chama decide o fallback (ex.: subir o
|
|
20
|
+
// original).
|
|
21
|
+
function resizeImageForWeb(input_1, _a) {
|
|
22
|
+
return __awaiter(this, arguments, void 0, function* (input, { maxDimension, quality = 78 }) {
|
|
23
|
+
const buffer = yield (0, sharp_1.default)(input, { failOn: 'none', animated: false })
|
|
24
|
+
.rotate()
|
|
25
|
+
.resize({
|
|
26
|
+
width: maxDimension,
|
|
27
|
+
height: maxDimension,
|
|
28
|
+
fit: 'inside',
|
|
29
|
+
withoutEnlargement: true
|
|
30
|
+
})
|
|
31
|
+
.flatten({ background: '#ffffff' })
|
|
32
|
+
.webp({ quality })
|
|
33
|
+
.toBuffer();
|
|
34
|
+
return { buffer, contentType: 'image/webp', extension: 'webp' };
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -19,6 +19,7 @@ export declare enum JobListingSource {
|
|
|
19
19
|
Adzuna = "Adzuna",
|
|
20
20
|
Careerjet = "Careerjet",
|
|
21
21
|
Jooble = "Jooble",
|
|
22
|
+
Himalayas = "Himalayas",
|
|
22
23
|
Native = "Native"
|
|
23
24
|
}
|
|
24
25
|
export declare enum JobListingStatus {
|
|
@@ -81,6 +82,18 @@ export interface JobListingApplyInfo {
|
|
|
81
82
|
mode: JobApplyMode;
|
|
82
83
|
url: string | null;
|
|
83
84
|
}
|
|
85
|
+
export declare enum ThoFavoriteType {
|
|
86
|
+
JobListing = "JobListing",
|
|
87
|
+
Freelancer = "Freelancer"
|
|
88
|
+
}
|
|
89
|
+
export interface ThoNotificationSummary {
|
|
90
|
+
unreadMessages: number;
|
|
91
|
+
jobApplicationsReceived: number;
|
|
92
|
+
proposalsReceived: number;
|
|
93
|
+
ordersReceivedToAct: number;
|
|
94
|
+
purchasesToReview: number;
|
|
95
|
+
total: number;
|
|
96
|
+
}
|
|
84
97
|
export declare enum ServicePriceType {
|
|
85
98
|
Fixed = "Fixed",
|
|
86
99
|
Negotiable = "Negotiable"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ThoPaymentMode = exports.ThoRatingCriterion = exports.ThoOrderSettlementReason = exports.ThoDisputeResolution = exports.ThoOrderLineKind = exports.ThoOrderStatus = exports.ConversationContextType = exports.ApplicationStatus = exports.DeliveryUnit = exports.ServicePriceType = exports.JobApplyMode = exports.JobListingSort = exports.RemoteScope = exports.JobSeniority = exports.JobListingStatus = exports.JobListingSource = exports.JobListingOrigin = exports.JobPostingStatus = exports.WorkRegime = exports.JobContractType = void 0;
|
|
3
|
+
exports.ThoPaymentMode = exports.ThoRatingCriterion = exports.ThoOrderSettlementReason = exports.ThoDisputeResolution = exports.ThoOrderLineKind = exports.ThoOrderStatus = exports.ConversationContextType = exports.ApplicationStatus = exports.DeliveryUnit = exports.ServicePriceType = exports.ThoFavoriteType = exports.JobApplyMode = exports.JobListingSort = exports.RemoteScope = exports.JobSeniority = exports.JobListingStatus = exports.JobListingSource = exports.JobListingOrigin = exports.JobPostingStatus = exports.WorkRegime = exports.JobContractType = void 0;
|
|
4
4
|
var JobContractType;
|
|
5
5
|
(function (JobContractType) {
|
|
6
6
|
JobContractType["Clt"] = "Clt";
|
|
@@ -41,6 +41,7 @@ var JobListingSource;
|
|
|
41
41
|
JobListingSource["Adzuna"] = "Adzuna";
|
|
42
42
|
JobListingSource["Careerjet"] = "Careerjet";
|
|
43
43
|
JobListingSource["Jooble"] = "Jooble";
|
|
44
|
+
JobListingSource["Himalayas"] = "Himalayas";
|
|
44
45
|
JobListingSource["Native"] = "Native";
|
|
45
46
|
})(JobListingSource || (exports.JobListingSource = JobListingSource = {}));
|
|
46
47
|
// Ciclo de vida da vaga no quadro.
|
|
@@ -93,6 +94,14 @@ var JobApplyMode;
|
|
|
93
94
|
JobApplyMode["External"] = "External";
|
|
94
95
|
JobApplyMode["Native"] = "Native";
|
|
95
96
|
})(JobApplyMode || (exports.JobApplyMode = JobApplyMode = {}));
|
|
97
|
+
// Tipos de alvo que o usuário pode favoritar (coleção tho_favorites no
|
|
98
|
+
// home-office-backend). Polimórfico — `targetId` é o id da vaga (JobListing._id)
|
|
99
|
+
// ou o userId do freelancer.
|
|
100
|
+
var ThoFavoriteType;
|
|
101
|
+
(function (ThoFavoriteType) {
|
|
102
|
+
ThoFavoriteType["JobListing"] = "JobListing";
|
|
103
|
+
ThoFavoriteType["Freelancer"] = "Freelancer";
|
|
104
|
+
})(ThoFavoriteType || (exports.ThoFavoriteType = ThoFavoriteType = {}));
|
|
96
105
|
var ServicePriceType;
|
|
97
106
|
(function (ServicePriceType) {
|
|
98
107
|
ServicePriceType["Fixed"] = "Fixed";
|