@remit/storage-service 0.0.12 → 0.0.14

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/src/uri.ts DELETED
@@ -1,47 +0,0 @@
1
- import { StorageType } from "@remit/domain-enums";
2
-
3
- export type StorageTypeValue = (typeof StorageType)[keyof typeof StorageType];
4
-
5
- export interface ParsedStorageUri {
6
- storageType: StorageTypeValue;
7
- storageLocation: string;
8
- storageKey: string;
9
- }
10
-
11
- export const parseStorageUri = (uri: string): ParsedStorageUri => {
12
- const url = new URL(uri);
13
-
14
- if (url.protocol === "s3:") {
15
- return {
16
- storageType: StorageType.S3,
17
- storageLocation: url.hostname,
18
- storageKey: url.pathname.slice(1),
19
- };
20
- }
21
-
22
- if (url.protocol === "file:") {
23
- return {
24
- storageType: StorageType.Filesystem,
25
- storageLocation: "",
26
- storageKey: url.pathname,
27
- };
28
- }
29
-
30
- throw new Error(`Unsupported storage URI scheme: ${url.protocol}`);
31
- };
32
-
33
- export const buildStorageUri = (
34
- storageType: StorageTypeValue,
35
- storageLocation: string,
36
- storageKey: string,
37
- ): string => {
38
- if (storageType === StorageType.S3) {
39
- return `s3://${storageLocation}/${storageKey}`;
40
- }
41
-
42
- if (storageType === StorageType.Filesystem) {
43
- return `file://${storageLocation}/${storageKey}`;
44
- }
45
-
46
- throw new Error(`Unsupported storage type: ${storageType}`);
47
- };
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": ["src/**/*.ts"]
8
- }
File without changes