@react-pakistan/util-functions 1.23.27 → 1.23.29
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/api/stellar-solutions/quote-invoice/index.js +1 -1
- package/general/index.d.ts +4 -2
- package/general/index.js +4 -2
- package/general/upload-image-blob-to-private-supabase.d.ts +11 -0
- package/general/{upload-image-blob-to-supabase.js → upload-image-blob-to-private-supabase.js} +4 -4
- package/general/upload-image-blob-to-public-supabase.d.ts +11 -0
- package/general/upload-image-blob-to-public-supabase.js +27 -0
- package/general/upload-image-to-private-supabase.d.ts +8 -0
- package/general/{upload-image-to-supabase.js → upload-image-to-private-supabase.js} +4 -4
- package/general/upload-image-to-public-supabase.d.ts +8 -0
- package/general/upload-image-to-public-supabase.js +30 -0
- package/package.json +1 -1
- package/general/upload-image-blob-to-supabase.d.ts +0 -11
- package/general/upload-image-to-supabase.d.ts +0 -7
|
@@ -174,7 +174,7 @@ const postQuoteInvoice = (_d) => __awaiter(void 0, [_d], void 0, function* ({ ad
|
|
|
174
174
|
});
|
|
175
175
|
if (filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.length) {
|
|
176
176
|
filteredEditServices === null || filteredEditServices === void 0 ? void 0 : filteredEditServices.map((item) => __awaiter(void 0, void 0, void 0, function* () {
|
|
177
|
-
yield prisma.
|
|
177
|
+
yield prisma.service.update({
|
|
178
178
|
where: {
|
|
179
179
|
id: item.id,
|
|
180
180
|
},
|
package/general/index.d.ts
CHANGED
|
@@ -31,8 +31,10 @@ export * from './resolve-initials';
|
|
|
31
31
|
export * from './slugify';
|
|
32
32
|
export * from './text-to-enum';
|
|
33
33
|
export * from './truncate-text';
|
|
34
|
-
export * from './upload-image-blob-to-supabase';
|
|
35
|
-
export * from './upload-image-to-supabase';
|
|
34
|
+
export * from './upload-image-blob-to-private-supabase';
|
|
35
|
+
export * from './upload-image-blob-to-public-supabase';
|
|
36
|
+
export * from './upload-image-to-private-supabase';
|
|
37
|
+
export * from './upload-image-to-public-supabase';
|
|
36
38
|
export * from './url-to-sentence-case';
|
|
37
39
|
export * from './validate-comment';
|
|
38
40
|
export * from './validate-email';
|
package/general/index.js
CHANGED
|
@@ -48,8 +48,10 @@ __exportStar(require("./resolve-initials"), exports);
|
|
|
48
48
|
__exportStar(require("./slugify"), exports);
|
|
49
49
|
__exportStar(require("./text-to-enum"), exports);
|
|
50
50
|
__exportStar(require("./truncate-text"), exports);
|
|
51
|
-
__exportStar(require("./upload-image-blob-to-supabase"), exports);
|
|
52
|
-
__exportStar(require("./upload-image-to-supabase"), exports);
|
|
51
|
+
__exportStar(require("./upload-image-blob-to-private-supabase"), exports);
|
|
52
|
+
__exportStar(require("./upload-image-blob-to-public-supabase"), exports);
|
|
53
|
+
__exportStar(require("./upload-image-to-private-supabase"), exports);
|
|
54
|
+
__exportStar(require("./upload-image-to-public-supabase"), exports);
|
|
53
55
|
__exportStar(require("./url-to-sentence-case"), exports);
|
|
54
56
|
__exportStar(require("./validate-comment"), exports);
|
|
55
57
|
__exportStar(require("./validate-email"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UploadImageBlobToPrivateSupabaseArgs {
|
|
2
|
+
blob: Blob;
|
|
3
|
+
contentType: string;
|
|
4
|
+
fileRef: string;
|
|
5
|
+
supabase: any;
|
|
6
|
+
upsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadImageBlobToPrivateSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadImageBlobToPrivateSupabaseArgs) => Promise<{
|
|
9
|
+
data: any;
|
|
10
|
+
error: any;
|
|
11
|
+
}>;
|
package/general/{upload-image-blob-to-supabase.js → upload-image-blob-to-private-supabase.js}
RENAMED
|
@@ -10,18 +10,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.
|
|
14
|
-
const
|
|
13
|
+
exports.uploadImageBlobToPrivateSupabase = void 0;
|
|
14
|
+
const uploadImageBlobToPrivateSupabase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ blob, contentType, fileRef, supabase, upsert, }) {
|
|
15
15
|
const { data, error } = yield supabase.storage
|
|
16
16
|
.from(process.env.NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET)
|
|
17
17
|
.upload(fileRef, blob, {
|
|
18
|
-
upsert,
|
|
19
18
|
cacheControl: process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
|
|
20
19
|
contentType,
|
|
20
|
+
upsert,
|
|
21
21
|
});
|
|
22
22
|
return {
|
|
23
23
|
data,
|
|
24
24
|
error,
|
|
25
25
|
};
|
|
26
26
|
});
|
|
27
|
-
exports.
|
|
27
|
+
exports.uploadImageBlobToPrivateSupabase = uploadImageBlobToPrivateSupabase;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UploadImageBlobToPublicSupabaseArgs {
|
|
2
|
+
blob: Blob;
|
|
3
|
+
contentType: string;
|
|
4
|
+
fileRef: string;
|
|
5
|
+
supabase: any;
|
|
6
|
+
upsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadImageBlobToPublicSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadImageBlobToPublicSupabaseArgs) => Promise<{
|
|
9
|
+
data: any;
|
|
10
|
+
error: any;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.uploadImageBlobToPublicSupabase = void 0;
|
|
14
|
+
const uploadImageBlobToPublicSupabase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ blob, contentType, fileRef, supabase, upsert, }) {
|
|
15
|
+
const { data, error } = yield supabase.storage
|
|
16
|
+
.from(process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET)
|
|
17
|
+
.upload(fileRef, blob, {
|
|
18
|
+
cacheControl: process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
|
|
19
|
+
contentType,
|
|
20
|
+
upsert,
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
data,
|
|
24
|
+
error,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
exports.uploadImageBlobToPublicSupabase = uploadImageBlobToPublicSupabase;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface UploadImageToPrivateSupabaseArgs {
|
|
2
|
+
blob: string;
|
|
3
|
+
contentType: string;
|
|
4
|
+
fileRef: string;
|
|
5
|
+
supabase: any;
|
|
6
|
+
upsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadImageToPrivateSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadImageToPrivateSupabaseArgs) => Promise<void>;
|
|
@@ -10,21 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.
|
|
13
|
+
exports.uploadImageToPrivateSupabase = void 0;
|
|
14
14
|
const remove_data_image_prefix_1 = require("./remove-data-image-prefix");
|
|
15
|
-
const
|
|
15
|
+
const uploadImageToPrivateSupabase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ blob, contentType, fileRef, supabase, upsert, }) {
|
|
16
16
|
const base64StringWithoutPrefix = (0, remove_data_image_prefix_1.removeDataImagePrefix)(blob);
|
|
17
17
|
const buffer = Buffer.from(base64StringWithoutPrefix, 'base64');
|
|
18
18
|
const { data, error } = yield supabase.storage
|
|
19
19
|
.from(process.env.NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET)
|
|
20
20
|
.upload(fileRef, buffer, {
|
|
21
|
-
upsert: false,
|
|
22
21
|
cacheControl: process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
|
|
23
22
|
contentType,
|
|
23
|
+
upsert,
|
|
24
24
|
});
|
|
25
25
|
if (error) {
|
|
26
26
|
return error;
|
|
27
27
|
}
|
|
28
28
|
return data;
|
|
29
29
|
});
|
|
30
|
-
exports.
|
|
30
|
+
exports.uploadImageToPrivateSupabase = uploadImageToPrivateSupabase;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface UploadImageToPublicSupabaseArgs {
|
|
2
|
+
blob: string;
|
|
3
|
+
contentType: string;
|
|
4
|
+
fileRef: string;
|
|
5
|
+
supabase: any;
|
|
6
|
+
upsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadImageToPublicSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadImageToPublicSupabaseArgs) => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.uploadImageToPublicSupabase = void 0;
|
|
14
|
+
const remove_data_image_prefix_1 = require("./remove-data-image-prefix");
|
|
15
|
+
const uploadImageToPublicSupabase = (_a) => __awaiter(void 0, [_a], void 0, function* ({ blob, contentType, fileRef, supabase, upsert, }) {
|
|
16
|
+
const base64StringWithoutPrefix = (0, remove_data_image_prefix_1.removeDataImagePrefix)(blob);
|
|
17
|
+
const buffer = Buffer.from(base64StringWithoutPrefix, 'base64');
|
|
18
|
+
const { data, error } = yield supabase.storage
|
|
19
|
+
.from(process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET)
|
|
20
|
+
.upload(fileRef, buffer, {
|
|
21
|
+
cacheControl: process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
|
|
22
|
+
contentType,
|
|
23
|
+
upsert,
|
|
24
|
+
});
|
|
25
|
+
if (error) {
|
|
26
|
+
return error;
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
});
|
|
30
|
+
exports.uploadImageToPublicSupabase = uploadImageToPublicSupabase;
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface UploadImageBlobToSupabaseArgs {
|
|
2
|
-
blob: Blob;
|
|
3
|
-
contentType: string;
|
|
4
|
-
fileRef: string;
|
|
5
|
-
supabase: any;
|
|
6
|
-
upsert: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const uploadImageBlobToSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadImageBlobToSupabaseArgs) => Promise<{
|
|
9
|
-
data: any;
|
|
10
|
-
error: any;
|
|
11
|
-
}>;
|