@managesome/eposmatic-toolkit 0.4.90 → 0.4.92
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/esm/constants/ENUMS.js +1 -0
- package/esm/constants/enums/storage.js +23 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/storage/index.js +1 -0
- package/esm/helpers/storage/upload-paths.js +384 -0
- package/esm/schemas/models/index.js +1 -0
- package/esm/schemas/models/pending_uploads.js +102 -0
- package/esm/schemas/types/index.js +1 -0
- package/esm/schemas/types/pending_uploads.js +1 -0
- package/lib/constants/ENUMS.d.ts +1 -0
- package/lib/constants/ENUMS.js +1 -0
- package/lib/constants/enums/storage.d.ts +21 -0
- package/lib/constants/enums/storage.js +26 -0
- package/lib/helpers/index.d.ts +1 -0
- package/lib/helpers/index.js +1 -0
- package/lib/helpers/storage/index.d.ts +1 -0
- package/lib/helpers/storage/index.js +17 -0
- package/lib/helpers/storage/upload-paths.d.ts +117 -0
- package/lib/helpers/storage/upload-paths.js +394 -0
- package/lib/schemas/models/index.d.ts +1 -0
- package/lib/schemas/models/index.js +1 -0
- package/lib/schemas/models/pending_uploads.d.ts +118 -0
- package/lib/schemas/models/pending_uploads.js +105 -0
- package/lib/schemas/models/tenant_hr_employees.d.ts +3 -3
- package/lib/schemas/types/index.d.ts +1 -0
- package/lib/schemas/types/index.js +1 -0
- package/lib/schemas/types/pending_uploads.d.ts +30 -0
- package/lib/schemas/types/pending_uploads.js +2 -0
- package/lib/tests/pending-uploads-schema.test.d.ts +1 -0
- package/lib/tests/pending-uploads-schema.test.js +79 -0
- package/lib/tests/storage-upload-paths.test.d.ts +1 -0
- package/lib/tests/storage-upload-paths.test.js +198 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./upload-paths"), exports);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-owned Cloud Storage upload path registry.
|
|
3
|
+
*
|
|
4
|
+
* The client sends a `kind` plus entity ids and file metadata. This module is
|
|
5
|
+
* the only place that turns those inputs into a bucket-relative object path.
|
|
6
|
+
* Nothing here performs I/O, so both backend services can import it and the
|
|
7
|
+
* toolkit build stays usable in browser contexts.
|
|
8
|
+
*
|
|
9
|
+
* Security invariants:
|
|
10
|
+
* - every kind is in a closed registry;
|
|
11
|
+
* - every client-supplied id is a single, validated path segment;
|
|
12
|
+
* - only `images/` and `documents/` roots are reachable;
|
|
13
|
+
* - the final path is re-validated after construction.
|
|
14
|
+
*/
|
|
15
|
+
import { PENDING_UPLOAD_REF_TYPE_ENUM, PENDING_UPLOAD_STAGE_ENUM } from '../../constants/enums/storage';
|
|
16
|
+
export declare const IMAGE_MAX_BYTES: number;
|
|
17
|
+
export declare const DOCUMENT_MAX_BYTES: number;
|
|
18
|
+
export declare const IMAGE_MIME_EXTENSIONS: Record<string, string>;
|
|
19
|
+
export declare const DOCUMENT_MIME_EXTENSIONS: Record<string, readonly string[]>;
|
|
20
|
+
export declare const STORAGE_UPLOAD_KIND: {
|
|
21
|
+
readonly BRAND_CATEGORY_BANNER: "brand.category_banner";
|
|
22
|
+
readonly BRAND_CATEGORY_IMAGE: "brand.category";
|
|
23
|
+
readonly BRAND_HALF_HALF_IMAGE: "brand.halfhalf";
|
|
24
|
+
readonly BRAND_IMAGE: "brand.image";
|
|
25
|
+
readonly BRAND_ITEM_IMAGE: "brand.item";
|
|
26
|
+
readonly BRAND_OFFER_IMAGE: "brand.offer";
|
|
27
|
+
readonly BRAND_SPECIAL_IMAGE: "brand.special";
|
|
28
|
+
readonly BRAND_WAREHOUSE_CATEGORY_IMAGE: "brand.warehouse.category";
|
|
29
|
+
readonly BRAND_WAREHOUSE_ITEM_IMAGE: "brand.warehouse.item";
|
|
30
|
+
readonly DELIVERY_PROOF: "delivery.proof";
|
|
31
|
+
readonly DOCUMENT_HR: "document.hr";
|
|
32
|
+
readonly DOCUMENT_POLICY: "document.policy";
|
|
33
|
+
readonly INTERNAL_EXPENSE_IMAGE: "internal.expense";
|
|
34
|
+
readonly INTERNAL_RESTAURANT_IMAGE: "internal.restaurant";
|
|
35
|
+
readonly RIDER_IMAGE: "rider.image";
|
|
36
|
+
readonly TENANT_DEPARTMENT_IMAGE: "tenant.department";
|
|
37
|
+
readonly TENANT_DIGITAL_MENU: "tenant.digital_menu";
|
|
38
|
+
readonly TENANT_EXPENSE_IMAGE: "tenant.expense";
|
|
39
|
+
readonly TENANT_IMAGE: "tenant.image";
|
|
40
|
+
readonly TENANT_INVENTORY_IMAGE: "tenant.inventory";
|
|
41
|
+
readonly TENANT_MARKETING_IMAGE: "tenant.marketing";
|
|
42
|
+
readonly TENANT_SLIDER: "tenant.slider";
|
|
43
|
+
readonly TENANT_STAFF_IMAGE: "tenant.staff";
|
|
44
|
+
readonly TENANT_WEB_COVER: "tenant.web_cover";
|
|
45
|
+
readonly TENANT_WEB_FAVICON: "tenant.web_favicon";
|
|
46
|
+
readonly WAREHOUSE_EXPENSE_IMAGE: "warehouse.expense";
|
|
47
|
+
readonly WAREHOUSE_IMAGE: "warehouse.image";
|
|
48
|
+
readonly WAREHOUSE_INVENTORY_IMAGE: "warehouse.inventory";
|
|
49
|
+
readonly WAREHOUSE_STAFF_IMAGE: "warehouse.staff";
|
|
50
|
+
};
|
|
51
|
+
export type TStorageUploadKind = (typeof STORAGE_UPLOAD_KIND)[keyof typeof STORAGE_UPLOAD_KIND];
|
|
52
|
+
export type TStorageUploadRoute = 'items' | 'operations' | 'riders';
|
|
53
|
+
export type TStorageUploadOwner = 'tenant' | 'brand' | 'warehouse' | 'document' | 'internal' | 'rider' | 'delivery';
|
|
54
|
+
export type TStorageUploadIdentity = 'tenant_staff' | 'tenant_staff_hr' | 'warehouse_staff' | 'internal' | 'rider' | 'delivery_rider';
|
|
55
|
+
export type TStorageUploadMedia = 'image' | 'document';
|
|
56
|
+
export type TStorageUploadExtension = 'mime' | 'filename';
|
|
57
|
+
export type TStorageUploadLeaf = 'fixed' | 'record' | 'uuid';
|
|
58
|
+
export type TStorageUploadStage = PENDING_UPLOAD_STAGE_ENUM;
|
|
59
|
+
export type TStorageUploadIdField = 'brand_id' | 'tenant_id' | 'warehouse_id' | 'employee_id' | 'delivery_id' | 'record_id' | 'resource_id';
|
|
60
|
+
export interface IStorageUploadIds {
|
|
61
|
+
brand_id?: string;
|
|
62
|
+
tenant_id?: string;
|
|
63
|
+
warehouse_id?: string;
|
|
64
|
+
employee_id?: string;
|
|
65
|
+
delivery_id?: string;
|
|
66
|
+
record_id?: string;
|
|
67
|
+
resource_id?: string;
|
|
68
|
+
stage?: TStorageUploadStage;
|
|
69
|
+
}
|
|
70
|
+
export interface IStorageUploadDefinition {
|
|
71
|
+
kind: TStorageUploadKind;
|
|
72
|
+
routes: readonly TStorageUploadRoute[];
|
|
73
|
+
owner: TStorageUploadOwner;
|
|
74
|
+
identities: readonly TStorageUploadIdentity[];
|
|
75
|
+
media: TStorageUploadMedia;
|
|
76
|
+
maxBytes: number;
|
|
77
|
+
extension: TStorageUploadExtension;
|
|
78
|
+
leaf: TStorageUploadLeaf;
|
|
79
|
+
baseName?: (ids: IStorageUploadIds) => string;
|
|
80
|
+
requiredIds: readonly TStorageUploadIdField[];
|
|
81
|
+
requiredStage?: boolean;
|
|
82
|
+
requiresUid?: boolean;
|
|
83
|
+
build: (ids: IStorageUploadIds, fileName: string, uid: string) => string;
|
|
84
|
+
}
|
|
85
|
+
export interface IBuildStorageUploadPathInput {
|
|
86
|
+
kind: TStorageUploadKind;
|
|
87
|
+
ids: IStorageUploadIds;
|
|
88
|
+
mime: string;
|
|
89
|
+
filename?: string;
|
|
90
|
+
uuid?: string;
|
|
91
|
+
uid?: string;
|
|
92
|
+
}
|
|
93
|
+
export interface IBuildStorageUploadPathResult {
|
|
94
|
+
path: string;
|
|
95
|
+
extension: string;
|
|
96
|
+
maxBytes: number;
|
|
97
|
+
contentType: string;
|
|
98
|
+
refType: PENDING_UPLOAD_REF_TYPE_ENUM;
|
|
99
|
+
refId: string;
|
|
100
|
+
}
|
|
101
|
+
export type TStorageUploadValidationCode = 'INVALID_KIND' | 'INVALID_ID' | 'INVALID_MIME' | 'INVALID_FILENAME' | 'INVALID_UUID' | 'INVALID_STAGE' | 'INVALID_PATH' | 'MISSING_FIELD';
|
|
102
|
+
export declare class StorageUploadValidationError extends Error {
|
|
103
|
+
readonly code: TStorageUploadValidationCode;
|
|
104
|
+
constructor(code: TStorageUploadValidationCode, message: string);
|
|
105
|
+
}
|
|
106
|
+
export declare function normalizeStorageMime(mime: string): string;
|
|
107
|
+
export declare function isStorageUploadKind(value: unknown): value is TStorageUploadKind;
|
|
108
|
+
export declare function getStorageUploadDefinition(kind: TStorageUploadKind): IStorageUploadDefinition;
|
|
109
|
+
export declare function getStorageUploadKinds(): readonly TStorageUploadKind[];
|
|
110
|
+
export declare function getStorageUploadKindsForRoute(route: TStorageUploadRoute): readonly TStorageUploadKind[];
|
|
111
|
+
/**
|
|
112
|
+
* Builds the bucket-relative object path for a validated upload request.
|
|
113
|
+
*
|
|
114
|
+
* Throws `StorageUploadValidationError` for every caller error. The route
|
|
115
|
+
* should map that error to HTTP 400 (or 415 for an unsupported MIME).
|
|
116
|
+
*/
|
|
117
|
+
export declare function buildStorageUploadPath(input: IBuildStorageUploadPathInput): IBuildStorageUploadPathResult;
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Server-owned Cloud Storage upload path registry.
|
|
4
|
+
*
|
|
5
|
+
* The client sends a `kind` plus entity ids and file metadata. This module is
|
|
6
|
+
* the only place that turns those inputs into a bucket-relative object path.
|
|
7
|
+
* Nothing here performs I/O, so both backend services can import it and the
|
|
8
|
+
* toolkit build stays usable in browser contexts.
|
|
9
|
+
*
|
|
10
|
+
* Security invariants:
|
|
11
|
+
* - every kind is in a closed registry;
|
|
12
|
+
* - every client-supplied id is a single, validated path segment;
|
|
13
|
+
* - only `images/` and `documents/` roots are reachable;
|
|
14
|
+
* - the final path is re-validated after construction.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.StorageUploadValidationError = exports.STORAGE_UPLOAD_KIND = exports.DOCUMENT_MIME_EXTENSIONS = exports.IMAGE_MIME_EXTENSIONS = exports.DOCUMENT_MAX_BYTES = exports.IMAGE_MAX_BYTES = void 0;
|
|
18
|
+
exports.normalizeStorageMime = normalizeStorageMime;
|
|
19
|
+
exports.isStorageUploadKind = isStorageUploadKind;
|
|
20
|
+
exports.getStorageUploadDefinition = getStorageUploadDefinition;
|
|
21
|
+
exports.getStorageUploadKinds = getStorageUploadKinds;
|
|
22
|
+
exports.getStorageUploadKindsForRoute = getStorageUploadKindsForRoute;
|
|
23
|
+
exports.buildStorageUploadPath = buildStorageUploadPath;
|
|
24
|
+
const storage_1 = require("../../constants/enums/storage");
|
|
25
|
+
exports.IMAGE_MAX_BYTES = 5 * 1024 * 1024;
|
|
26
|
+
exports.DOCUMENT_MAX_BYTES = 10 * 1024 * 1024;
|
|
27
|
+
exports.IMAGE_MIME_EXTENSIONS = {
|
|
28
|
+
'image/avif': 'avif',
|
|
29
|
+
'image/gif': 'gif',
|
|
30
|
+
'image/heic': 'heic',
|
|
31
|
+
'image/heif': 'heif',
|
|
32
|
+
'image/jpeg': 'jpeg',
|
|
33
|
+
'image/jpg': 'jpeg',
|
|
34
|
+
'image/png': 'png',
|
|
35
|
+
'image/vnd.microsoft.icon': 'ico',
|
|
36
|
+
'image/webp': 'webp',
|
|
37
|
+
'image/x-icon': 'ico',
|
|
38
|
+
};
|
|
39
|
+
exports.DOCUMENT_MIME_EXTENSIONS = {
|
|
40
|
+
'application/msword': ['doc'],
|
|
41
|
+
'application/pdf': ['pdf'],
|
|
42
|
+
'application/vnd.ms-excel': ['xls'],
|
|
43
|
+
'application/vnd.ms-powerpoint': ['ppt'],
|
|
44
|
+
'application/vnd.openxmlformats-officedocument.presentationml.presentation': ['pptx'],
|
|
45
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['xlsx'],
|
|
46
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['docx'],
|
|
47
|
+
'image/heic': ['heic'],
|
|
48
|
+
'image/jpeg': ['jpg', 'jpeg'],
|
|
49
|
+
'image/png': ['png'],
|
|
50
|
+
'image/webp': ['webp'],
|
|
51
|
+
'text/csv': ['csv'],
|
|
52
|
+
'text/plain': ['txt'],
|
|
53
|
+
};
|
|
54
|
+
exports.STORAGE_UPLOAD_KIND = {
|
|
55
|
+
BRAND_CATEGORY_BANNER: 'brand.category_banner',
|
|
56
|
+
BRAND_CATEGORY_IMAGE: 'brand.category',
|
|
57
|
+
BRAND_HALF_HALF_IMAGE: 'brand.halfhalf',
|
|
58
|
+
BRAND_IMAGE: 'brand.image',
|
|
59
|
+
BRAND_ITEM_IMAGE: 'brand.item',
|
|
60
|
+
BRAND_OFFER_IMAGE: 'brand.offer',
|
|
61
|
+
BRAND_SPECIAL_IMAGE: 'brand.special',
|
|
62
|
+
BRAND_WAREHOUSE_CATEGORY_IMAGE: 'brand.warehouse.category',
|
|
63
|
+
BRAND_WAREHOUSE_ITEM_IMAGE: 'brand.warehouse.item',
|
|
64
|
+
DELIVERY_PROOF: 'delivery.proof',
|
|
65
|
+
DOCUMENT_HR: 'document.hr',
|
|
66
|
+
DOCUMENT_POLICY: 'document.policy',
|
|
67
|
+
INTERNAL_EXPENSE_IMAGE: 'internal.expense',
|
|
68
|
+
INTERNAL_RESTAURANT_IMAGE: 'internal.restaurant',
|
|
69
|
+
RIDER_IMAGE: 'rider.image',
|
|
70
|
+
TENANT_DEPARTMENT_IMAGE: 'tenant.department',
|
|
71
|
+
TENANT_DIGITAL_MENU: 'tenant.digital_menu',
|
|
72
|
+
TENANT_EXPENSE_IMAGE: 'tenant.expense',
|
|
73
|
+
TENANT_IMAGE: 'tenant.image',
|
|
74
|
+
TENANT_INVENTORY_IMAGE: 'tenant.inventory',
|
|
75
|
+
TENANT_MARKETING_IMAGE: 'tenant.marketing',
|
|
76
|
+
TENANT_SLIDER: 'tenant.slider',
|
|
77
|
+
TENANT_STAFF_IMAGE: 'tenant.staff',
|
|
78
|
+
TENANT_WEB_COVER: 'tenant.web_cover',
|
|
79
|
+
TENANT_WEB_FAVICON: 'tenant.web_favicon',
|
|
80
|
+
WAREHOUSE_EXPENSE_IMAGE: 'warehouse.expense',
|
|
81
|
+
WAREHOUSE_IMAGE: 'warehouse.image',
|
|
82
|
+
WAREHOUSE_INVENTORY_IMAGE: 'warehouse.inventory',
|
|
83
|
+
WAREHOUSE_STAFF_IMAGE: 'warehouse.staff',
|
|
84
|
+
};
|
|
85
|
+
class StorageUploadValidationError extends Error {
|
|
86
|
+
constructor(code, message) {
|
|
87
|
+
super(message);
|
|
88
|
+
this.name = 'StorageUploadValidationError';
|
|
89
|
+
this.code = code;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.StorageUploadValidationError = StorageUploadValidationError;
|
|
93
|
+
const ID_FIELDS = [
|
|
94
|
+
'brand_id',
|
|
95
|
+
'tenant_id',
|
|
96
|
+
'warehouse_id',
|
|
97
|
+
'employee_id',
|
|
98
|
+
'delivery_id',
|
|
99
|
+
'record_id',
|
|
100
|
+
'resource_id',
|
|
101
|
+
];
|
|
102
|
+
const SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
103
|
+
const FINAL_PATH_PATTERN = /^[A-Za-z0-9._/-]+$/;
|
|
104
|
+
const UUID_V4_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
105
|
+
function fail(code, message) {
|
|
106
|
+
throw new StorageUploadValidationError(code, message);
|
|
107
|
+
}
|
|
108
|
+
function requireId(ids, field) {
|
|
109
|
+
const value = ids[field];
|
|
110
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
111
|
+
fail('MISSING_FIELD', `Missing required storage id: ${field}`);
|
|
112
|
+
}
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
function assertSegment(value, field) {
|
|
116
|
+
if (typeof value !== 'string' || !SEGMENT_PATTERN.test(value) || value.includes('..')) {
|
|
117
|
+
fail('INVALID_ID', `Invalid storage path segment for ${field}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function assertFinalPath(path) {
|
|
121
|
+
if (!path.startsWith('images/') && !path.startsWith('documents/')) {
|
|
122
|
+
fail('INVALID_PATH', 'Storage path must start with images/ or documents/');
|
|
123
|
+
}
|
|
124
|
+
if (path.length === 0 || path.length > 1024) {
|
|
125
|
+
fail('INVALID_PATH', 'Storage path length is out of bounds');
|
|
126
|
+
}
|
|
127
|
+
if (path.includes('//') || path.includes('..') || path.includes('?') || path.includes('#')) {
|
|
128
|
+
fail('INVALID_PATH', 'Storage path contains a forbidden sequence');
|
|
129
|
+
}
|
|
130
|
+
if (!FINAL_PATH_PATTERN.test(path)) {
|
|
131
|
+
fail('INVALID_PATH', 'Storage path contains forbidden characters');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function assertStage(stage) {
|
|
135
|
+
if (stage === storage_1.PENDING_UPLOAD_STAGE_ENUM.PICKUP || stage === storage_1.PENDING_UPLOAD_STAGE_ENUM.DROPOFF) {
|
|
136
|
+
return stage;
|
|
137
|
+
}
|
|
138
|
+
return fail('INVALID_STAGE', 'stage must be PICKUP or DROPOFF');
|
|
139
|
+
}
|
|
140
|
+
function assertUuid(uuid) {
|
|
141
|
+
if (typeof uuid !== 'string' || !UUID_V4_PATTERN.test(uuid)) {
|
|
142
|
+
fail('INVALID_UUID', 'A valid server-generated UUID is required for this kind');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function normalizeStorageMime(mime) {
|
|
146
|
+
if (typeof mime !== 'string') {
|
|
147
|
+
fail('INVALID_MIME', 'mime must be a string');
|
|
148
|
+
}
|
|
149
|
+
return mime.split(';')[0].trim().toLowerCase();
|
|
150
|
+
}
|
|
151
|
+
function imageExtension(mime) {
|
|
152
|
+
const extension = exports.IMAGE_MIME_EXTENSIONS[mime];
|
|
153
|
+
if (!extension) {
|
|
154
|
+
fail('INVALID_MIME', `Unsupported image mime type: ${mime}`);
|
|
155
|
+
}
|
|
156
|
+
return extension;
|
|
157
|
+
}
|
|
158
|
+
function filenameExtension(filename, mime) {
|
|
159
|
+
const allowed = exports.DOCUMENT_MIME_EXTENSIONS[mime];
|
|
160
|
+
if (!allowed) {
|
|
161
|
+
fail('INVALID_MIME', `Unsupported document mime type: ${mime}`);
|
|
162
|
+
}
|
|
163
|
+
const cleaned = filename.split('?')[0].split('#')[0].replace(/\\/g, '/');
|
|
164
|
+
const base = cleaned.slice(cleaned.lastIndexOf('/') + 1);
|
|
165
|
+
if (!base || base.startsWith('.') || base.includes('..')) {
|
|
166
|
+
fail('INVALID_FILENAME', 'Invalid document filename');
|
|
167
|
+
}
|
|
168
|
+
const match = /\.([A-Za-z0-9]{1,8})$/.exec(base);
|
|
169
|
+
if (!match) {
|
|
170
|
+
fail('INVALID_FILENAME', 'Document filename has no usable extension');
|
|
171
|
+
}
|
|
172
|
+
const extension = match[1].toLowerCase();
|
|
173
|
+
if (!allowed.includes(extension)) {
|
|
174
|
+
fail('INVALID_FILENAME', `Filename extension .${extension} does not match ${mime}`);
|
|
175
|
+
}
|
|
176
|
+
return extension;
|
|
177
|
+
}
|
|
178
|
+
function resolveExtension(definition, mime, filename) {
|
|
179
|
+
if (definition.extension === 'mime') {
|
|
180
|
+
if (definition.media !== 'image') {
|
|
181
|
+
fail('INVALID_MIME', 'Mime-derived extensions are only allowed for images');
|
|
182
|
+
}
|
|
183
|
+
return `.${imageExtension(mime)}`;
|
|
184
|
+
}
|
|
185
|
+
if (typeof filename !== 'string' || filename.length === 0) {
|
|
186
|
+
fail('MISSING_FIELD', 'filename is required for this kind');
|
|
187
|
+
}
|
|
188
|
+
return `.${filenameExtension(filename, mime)}`;
|
|
189
|
+
}
|
|
190
|
+
function imageDefinition(kind, owner, identities, routes, requiredIds, build, options) {
|
|
191
|
+
return {
|
|
192
|
+
kind,
|
|
193
|
+
routes,
|
|
194
|
+
owner,
|
|
195
|
+
identities,
|
|
196
|
+
media: 'image',
|
|
197
|
+
maxBytes: exports.IMAGE_MAX_BYTES,
|
|
198
|
+
extension: 'mime',
|
|
199
|
+
...options,
|
|
200
|
+
requiredIds,
|
|
201
|
+
build,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function documentDefinition(kind, requiredIds, build) {
|
|
205
|
+
return {
|
|
206
|
+
kind,
|
|
207
|
+
routes: ['items'],
|
|
208
|
+
owner: 'document',
|
|
209
|
+
identities: ['tenant_staff_hr'],
|
|
210
|
+
media: 'document',
|
|
211
|
+
maxBytes: exports.DOCUMENT_MAX_BYTES,
|
|
212
|
+
extension: 'filename',
|
|
213
|
+
leaf: 'uuid',
|
|
214
|
+
requiredIds,
|
|
215
|
+
build,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
const FIXED_IMAGE_NAME = 'image_url';
|
|
219
|
+
const recordBaseName = (ids) => requireId(ids, 'record_id');
|
|
220
|
+
const STORAGE_UPLOAD_DEFINITIONS = {
|
|
221
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_IMAGE, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), fileName].join('/'), { baseName: () => FIXED_IMAGE_NAME, leaf: 'fixed' }),
|
|
222
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_CATEGORY_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_CATEGORY_IMAGE, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'categories', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
223
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_CATEGORY_BANNER]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_CATEGORY_BANNER, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'categories-banner', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
224
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_ITEM_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_ITEM_IMAGE, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'items', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
225
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_OFFER_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_OFFER_IMAGE, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'offers', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
226
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_SPECIAL_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_SPECIAL_IMAGE, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'specials', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
227
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_HALF_HALF_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_HALF_HALF_IMAGE, 'brand', ['tenant_staff', 'internal'], ['items'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'halfhalf', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
228
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_WAREHOUSE_CATEGORY_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_WAREHOUSE_CATEGORY_IMAGE, 'brand', ['warehouse_staff', 'internal'], ['items', 'operations'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'warehouse-categories', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
229
|
+
[exports.STORAGE_UPLOAD_KIND.BRAND_WAREHOUSE_ITEM_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.BRAND_WAREHOUSE_ITEM_IMAGE, 'brand', ['warehouse_staff', 'internal'], ['items', 'operations'], ['brand_id', 'record_id'], (ids, fileName) => ['images', 'brands', requireId(ids, 'brand_id'), 'warehouse-items', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
230
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_IMAGE, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), fileName].join('/'), { baseName: () => FIXED_IMAGE_NAME, leaf: 'fixed' }),
|
|
231
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_WEB_COVER]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_WEB_COVER, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), fileName].join('/'), { baseName: () => 'web_cover', leaf: 'fixed' }),
|
|
232
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_WEB_FAVICON]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_WEB_FAVICON, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), fileName].join('/'), { baseName: () => 'web_favicon', leaf: 'fixed' }),
|
|
233
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_DIGITAL_MENU]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_DIGITAL_MENU, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'digital-menu', fileName].join('/'), { leaf: 'uuid' }),
|
|
234
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_SLIDER]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_SLIDER, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'sliders', fileName].join('/'), { leaf: 'uuid' }),
|
|
235
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_STAFF_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_STAFF_IMAGE, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id', 'record_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'staff', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
236
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_MARKETING_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_MARKETING_IMAGE, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id', 'record_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'marketing', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
237
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_EXPENSE_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_EXPENSE_IMAGE, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id', 'record_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'expense-details', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
238
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_INVENTORY_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_INVENTORY_IMAGE, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id', 'record_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'inventory', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
239
|
+
[exports.STORAGE_UPLOAD_KIND.TENANT_DEPARTMENT_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.TENANT_DEPARTMENT_IMAGE, 'tenant', ['tenant_staff', 'internal'], ['items'], ['tenant_id', 'record_id'], (ids, fileName) => ['images', 'tenants', requireId(ids, 'tenant_id'), 'departments', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
240
|
+
[exports.STORAGE_UPLOAD_KIND.WAREHOUSE_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.WAREHOUSE_IMAGE, 'warehouse', ['warehouse_staff', 'internal'], ['items', 'operations'], ['warehouse_id'], (ids, fileName) => ['images', 'warehouses', requireId(ids, 'warehouse_id'), fileName].join('/'), { baseName: () => FIXED_IMAGE_NAME, leaf: 'fixed' }),
|
|
241
|
+
[exports.STORAGE_UPLOAD_KIND.WAREHOUSE_STAFF_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.WAREHOUSE_STAFF_IMAGE, 'warehouse', ['warehouse_staff', 'internal'], ['items', 'operations'], ['warehouse_id', 'record_id'], (ids, fileName) => ['images', 'warehouses', requireId(ids, 'warehouse_id'), 'staff', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
242
|
+
[exports.STORAGE_UPLOAD_KIND.WAREHOUSE_INVENTORY_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.WAREHOUSE_INVENTORY_IMAGE, 'warehouse', ['warehouse_staff', 'internal'], ['items', 'operations'], ['warehouse_id', 'record_id'], (ids, fileName) => ['images', 'warehouses', requireId(ids, 'warehouse_id'), 'inventory', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
243
|
+
[exports.STORAGE_UPLOAD_KIND.WAREHOUSE_EXPENSE_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.WAREHOUSE_EXPENSE_IMAGE, 'warehouse', ['warehouse_staff', 'internal'], ['items', 'operations'], ['warehouse_id', 'record_id'], (ids, fileName) => ['images', 'warehouses', requireId(ids, 'warehouse_id'), 'warehouse-expense-details', fileName].join('/'), { baseName: recordBaseName, leaf: 'record' }),
|
|
244
|
+
[exports.STORAGE_UPLOAD_KIND.DOCUMENT_HR]: documentDefinition(exports.STORAGE_UPLOAD_KIND.DOCUMENT_HR, ['tenant_id', 'employee_id'], (ids, fileName) => [
|
|
245
|
+
'documents',
|
|
246
|
+
'tenants',
|
|
247
|
+
requireId(ids, 'tenant_id'),
|
|
248
|
+
'hr-documents',
|
|
249
|
+
requireId(ids, 'employee_id'),
|
|
250
|
+
fileName,
|
|
251
|
+
].join('/')),
|
|
252
|
+
[exports.STORAGE_UPLOAD_KIND.DOCUMENT_POLICY]: documentDefinition(exports.STORAGE_UPLOAD_KIND.DOCUMENT_POLICY, ['tenant_id'], (ids, fileName) => ['documents', 'tenants', requireId(ids, 'tenant_id'), 'hr-policies', fileName].join('/')),
|
|
253
|
+
[exports.STORAGE_UPLOAD_KIND.INTERNAL_RESTAURANT_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.INTERNAL_RESTAURANT_IMAGE, 'internal', ['internal'], ['items'], ['resource_id'], (ids, fileName) => ['images', 'restaurants', requireId(ids, 'resource_id'), fileName].join('/'), { baseName: () => FIXED_IMAGE_NAME, leaf: 'fixed' }),
|
|
254
|
+
[exports.STORAGE_UPLOAD_KIND.INTERNAL_EXPENSE_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.INTERNAL_EXPENSE_IMAGE, 'internal', ['internal'], ['items'], ['resource_id'], (ids, fileName) => ['images', 'expenses', requireId(ids, 'resource_id'), fileName].join('/'), { baseName: () => FIXED_IMAGE_NAME, leaf: 'fixed' }),
|
|
255
|
+
[exports.STORAGE_UPLOAD_KIND.RIDER_IMAGE]: imageDefinition(exports.STORAGE_UPLOAD_KIND.RIDER_IMAGE, 'rider', ['rider'], ['riders'], [], (_ids, fileName, uid) => ['images', 'riders', uid, fileName].join('/'), { baseName: () => FIXED_IMAGE_NAME, leaf: 'fixed', requiresUid: true }),
|
|
256
|
+
[exports.STORAGE_UPLOAD_KIND.DELIVERY_PROOF]: imageDefinition(exports.STORAGE_UPLOAD_KIND.DELIVERY_PROOF, 'delivery', ['delivery_rider'], ['riders'], ['delivery_id'], (ids, fileName) => ['images', 'deliveries', requireId(ids, 'delivery_id'), fileName].join('/'), {
|
|
257
|
+
baseName: (ids) => `${assertStage(ids.stage).toLowerCase()}_food_image_url`,
|
|
258
|
+
leaf: 'fixed',
|
|
259
|
+
requiredStage: true,
|
|
260
|
+
}),
|
|
261
|
+
};
|
|
262
|
+
function resolveStorageUploadRef(definition, ids, uid) {
|
|
263
|
+
switch (definition.owner) {
|
|
264
|
+
case 'brand':
|
|
265
|
+
return {
|
|
266
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.BRAND,
|
|
267
|
+
refId: requireId(ids, 'brand_id'),
|
|
268
|
+
};
|
|
269
|
+
case 'tenant':
|
|
270
|
+
return {
|
|
271
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.TENANT,
|
|
272
|
+
refId: requireId(ids, 'tenant_id'),
|
|
273
|
+
};
|
|
274
|
+
case 'warehouse':
|
|
275
|
+
return {
|
|
276
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.WAREHOUSE,
|
|
277
|
+
refId: requireId(ids, 'warehouse_id'),
|
|
278
|
+
};
|
|
279
|
+
case 'document':
|
|
280
|
+
return definition.kind === exports.STORAGE_UPLOAD_KIND.DOCUMENT_HR
|
|
281
|
+
? {
|
|
282
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.EMPLOYEE,
|
|
283
|
+
refId: requireId(ids, 'employee_id'),
|
|
284
|
+
}
|
|
285
|
+
: {
|
|
286
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.TENANT,
|
|
287
|
+
refId: requireId(ids, 'tenant_id'),
|
|
288
|
+
};
|
|
289
|
+
case 'internal':
|
|
290
|
+
return definition.kind === exports.STORAGE_UPLOAD_KIND.INTERNAL_RESTAURANT_IMAGE
|
|
291
|
+
? {
|
|
292
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.RESTAURANT,
|
|
293
|
+
refId: requireId(ids, 'resource_id'),
|
|
294
|
+
}
|
|
295
|
+
: {
|
|
296
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.EXPENSE,
|
|
297
|
+
refId: requireId(ids, 'resource_id'),
|
|
298
|
+
};
|
|
299
|
+
case 'rider':
|
|
300
|
+
return {
|
|
301
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.RIDER,
|
|
302
|
+
refId: uid,
|
|
303
|
+
};
|
|
304
|
+
case 'delivery':
|
|
305
|
+
return {
|
|
306
|
+
refType: storage_1.PENDING_UPLOAD_REF_TYPE_ENUM.DELIVERY,
|
|
307
|
+
refId: requireId(ids, 'delivery_id'),
|
|
308
|
+
};
|
|
309
|
+
default:
|
|
310
|
+
return fail('INVALID_KIND', `Kind ${definition.kind} has no storage reference`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function isStorageUploadKind(value) {
|
|
314
|
+
return typeof value === 'string' && Object.prototype.hasOwnProperty.call(STORAGE_UPLOAD_DEFINITIONS, value);
|
|
315
|
+
}
|
|
316
|
+
function getStorageUploadDefinition(kind) {
|
|
317
|
+
if (!isStorageUploadKind(kind)) {
|
|
318
|
+
fail('INVALID_KIND', `Unknown storage upload kind: ${String(kind)}`);
|
|
319
|
+
}
|
|
320
|
+
return STORAGE_UPLOAD_DEFINITIONS[kind];
|
|
321
|
+
}
|
|
322
|
+
function getStorageUploadKinds() {
|
|
323
|
+
return Object.values(exports.STORAGE_UPLOAD_KIND);
|
|
324
|
+
}
|
|
325
|
+
function getStorageUploadKindsForRoute(route) {
|
|
326
|
+
return getStorageUploadKinds().filter((kind) => STORAGE_UPLOAD_DEFINITIONS[kind].routes.includes(route));
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Builds the bucket-relative object path for a validated upload request.
|
|
330
|
+
*
|
|
331
|
+
* Throws `StorageUploadValidationError` for every caller error. The route
|
|
332
|
+
* should map that error to HTTP 400 (or 415 for an unsupported MIME).
|
|
333
|
+
*/
|
|
334
|
+
function buildStorageUploadPath(input) {
|
|
335
|
+
const definition = getStorageUploadDefinition(input.kind);
|
|
336
|
+
const ids = input.ids ?? {};
|
|
337
|
+
const mime = normalizeStorageMime(input.mime);
|
|
338
|
+
if (!mime) {
|
|
339
|
+
fail('INVALID_MIME', 'mime is required');
|
|
340
|
+
}
|
|
341
|
+
for (const field of ID_FIELDS) {
|
|
342
|
+
const value = ids[field];
|
|
343
|
+
if (value !== undefined) {
|
|
344
|
+
if (typeof value !== 'string') {
|
|
345
|
+
fail('INVALID_ID', `Invalid storage path segment for ${field}`);
|
|
346
|
+
}
|
|
347
|
+
assertSegment(value, field);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (ids.stage !== undefined) {
|
|
351
|
+
assertStage(ids.stage);
|
|
352
|
+
}
|
|
353
|
+
for (const field of definition.requiredIds) {
|
|
354
|
+
requireId(ids, field);
|
|
355
|
+
}
|
|
356
|
+
if (definition.requiredStage && ids.stage === undefined) {
|
|
357
|
+
fail('MISSING_FIELD', 'stage is required for this kind');
|
|
358
|
+
}
|
|
359
|
+
if (definition.requiresUid) {
|
|
360
|
+
if (!input.uid) {
|
|
361
|
+
fail('MISSING_FIELD', 'uid is required for this kind');
|
|
362
|
+
}
|
|
363
|
+
assertSegment(input.uid, 'uid');
|
|
364
|
+
}
|
|
365
|
+
const extension = resolveExtension(definition, mime, input.filename);
|
|
366
|
+
let base;
|
|
367
|
+
if (definition.leaf === 'uuid') {
|
|
368
|
+
if (!input.uuid) {
|
|
369
|
+
fail('MISSING_FIELD', 'uuid is required for this kind');
|
|
370
|
+
}
|
|
371
|
+
assertUuid(input.uuid);
|
|
372
|
+
base = input.uuid;
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
if (!definition.baseName) {
|
|
376
|
+
fail('INVALID_KIND', `Kind ${definition.kind} has no base name`);
|
|
377
|
+
}
|
|
378
|
+
base = definition.baseName(ids);
|
|
379
|
+
}
|
|
380
|
+
assertSegment(base, 'file name');
|
|
381
|
+
const fileName = `${base}${extension}`;
|
|
382
|
+
const ref = resolveStorageUploadRef(definition, ids, input.uid ?? '');
|
|
383
|
+
assertSegment(ref.refId, 'ref_id');
|
|
384
|
+
const path = definition.build(ids, fileName, input.uid ?? '');
|
|
385
|
+
assertFinalPath(path);
|
|
386
|
+
return {
|
|
387
|
+
path,
|
|
388
|
+
extension,
|
|
389
|
+
maxBytes: definition.maxBytes,
|
|
390
|
+
contentType: mime,
|
|
391
|
+
refType: ref.refType,
|
|
392
|
+
refId: ref.refId,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
@@ -61,6 +61,7 @@ export * from './offers';
|
|
|
61
61
|
export * from './offers_fingerprints';
|
|
62
62
|
export * from './operational_roles';
|
|
63
63
|
export * from './orders';
|
|
64
|
+
export * from './pending_uploads';
|
|
64
65
|
export * from './printer_settings';
|
|
65
66
|
export * from './public_holidays';
|
|
66
67
|
export * from './reservations';
|
|
@@ -77,6 +77,7 @@ __exportStar(require("./offers"), exports);
|
|
|
77
77
|
__exportStar(require("./offers_fingerprints"), exports);
|
|
78
78
|
__exportStar(require("./operational_roles"), exports);
|
|
79
79
|
__exportStar(require("./orders"), exports);
|
|
80
|
+
__exportStar(require("./pending_uploads"), exports);
|
|
80
81
|
__exportStar(require("./printer_settings"), exports);
|
|
81
82
|
__exportStar(require("./public_holidays"), exports);
|
|
82
83
|
__exportStar(require("./reservations"), exports);
|