@superblocksteam/util 0.0.17 → 0.0.18
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/dist/component-configs.d.ts +1 -0
- package/dist/component-configs.js +10 -1
- package/dist/file-uploader.d.ts +1 -0
- package/dist/file-uploader.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +4 -2
- package/src/component-configs.ts +9 -0
- package/src/file-uploader.ts +27 -0
- package/src/index.ts +1 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getComponentConfigs = void 0;
|
|
3
|
+
exports.getContentType = exports.getComponentConfigs = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const node_os_1 = tslib_1.__importDefault(require("node:os"));
|
|
7
7
|
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
8
8
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
9
|
+
const mimeTypes = tslib_1.__importStar(require("mime-types"));
|
|
9
10
|
const constants_1 = require("./constants");
|
|
10
11
|
const generate_component_types_1 = require("./generate-component-types");
|
|
11
12
|
const validation_1 = require("./validation");
|
|
@@ -128,3 +129,11 @@ async function getComponentConfigs(generateTypesFiles) {
|
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
exports.getComponentConfigs = getComponentConfigs;
|
|
132
|
+
const getContentType = (filename) => {
|
|
133
|
+
const mimeType = mimeTypes.lookup(filename);
|
|
134
|
+
if (!mimeType) {
|
|
135
|
+
return "";
|
|
136
|
+
}
|
|
137
|
+
return mimeType;
|
|
138
|
+
};
|
|
139
|
+
exports.getContentType = getContentType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBucketeerUrlFromSuperblocksUrl: (superblocksBaseUrl: string) => string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBucketeerUrlFromSuperblocksUrl = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
// retrieves bucketeer base URL given the superblocks server base URL
|
|
6
|
+
const getBucketeerUrlFromSuperblocksUrl = (superblocksBaseUrl) => {
|
|
7
|
+
superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
|
|
8
|
+
// if superblocks base URL is an EE, return bucketeer's dev URL
|
|
9
|
+
if (!(0, lodash_1.isEmpty)(superblocksBaseUrl.match(new RegExp("pr-.*.superblocks.dev")))) {
|
|
10
|
+
return "https://bucketeer.dev.superblocks.com";
|
|
11
|
+
}
|
|
12
|
+
switch (superblocksBaseUrl) {
|
|
13
|
+
case "https://eu.superblocks.com":
|
|
14
|
+
return "https://bucketeer.eu.superblocks.com";
|
|
15
|
+
case "https://staging.superblocks.com":
|
|
16
|
+
return "https://bucketeer.staging.superblocks.com";
|
|
17
|
+
case "https://app.superblocks.com":
|
|
18
|
+
case "https://app.superblockshq.com":
|
|
19
|
+
return "https://bucketeer.superblocks.com";
|
|
20
|
+
case "https://dev.superblocks.com":
|
|
21
|
+
return "https://bucketeer.dev.superblocks.com";
|
|
22
|
+
case "http://localhost:3000":
|
|
23
|
+
default:
|
|
24
|
+
return "http://localhost:8030";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.getBucketeerUrlFromSuperblocksUrl = getBucketeerUrlFromSuperblocksUrl;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./component-configs"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./file-uploader"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./login"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./resource-configs"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./input-types"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/util",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"homepage": "https://www.superblocks.com",
|
|
6
6
|
"scripts": {
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
"description": "",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"ajv": "^8.12.0",
|
|
18
|
-
"better-ajv-errors": "^1.2.0"
|
|
18
|
+
"better-ajv-errors": "^1.2.0",
|
|
19
|
+
"mime-types": "^2.1.35"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
22
|
+
"@types/mime-types": "^2.1.1",
|
|
21
23
|
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
22
24
|
"@typescript-eslint/parser": "^5.60.1",
|
|
23
25
|
"eslint": "^8.45.0",
|
package/src/component-configs.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { execFile } from "child_process";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import * as fs from "fs-extra";
|
|
5
|
+
import * as mimeTypes from "mime-types";
|
|
5
6
|
import { CUSTOM_COMPONENTS_PATH } from "./constants";
|
|
6
7
|
import { generateComponentTypesFile } from "./generate-component-types";
|
|
7
8
|
import { validateCustomComponents } from "./validation";
|
|
@@ -143,3 +144,11 @@ export async function getComponentConfigs(
|
|
|
143
144
|
hasError,
|
|
144
145
|
};
|
|
145
146
|
}
|
|
147
|
+
|
|
148
|
+
export const getContentType = (filename: string): string => {
|
|
149
|
+
const mimeType = mimeTypes.lookup(filename);
|
|
150
|
+
if (!mimeType) {
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
return mimeType as string;
|
|
154
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isEmpty } from "lodash";
|
|
2
|
+
|
|
3
|
+
// retrieves bucketeer base URL given the superblocks server base URL
|
|
4
|
+
export const getBucketeerUrlFromSuperblocksUrl = (
|
|
5
|
+
superblocksBaseUrl: string
|
|
6
|
+
): string => {
|
|
7
|
+
superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
|
|
8
|
+
// if superblocks base URL is an EE, return bucketeer's dev URL
|
|
9
|
+
if (!isEmpty(superblocksBaseUrl.match(new RegExp("pr-.*.superblocks.dev")))) {
|
|
10
|
+
return "https://bucketeer.dev.superblocks.com";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
switch (superblocksBaseUrl) {
|
|
14
|
+
case "https://eu.superblocks.com":
|
|
15
|
+
return "https://bucketeer.eu.superblocks.com";
|
|
16
|
+
case "https://staging.superblocks.com":
|
|
17
|
+
return "https://bucketeer.staging.superblocks.com";
|
|
18
|
+
case "https://app.superblocks.com":
|
|
19
|
+
case "https://app.superblockshq.com":
|
|
20
|
+
return "https://bucketeer.superblocks.com";
|
|
21
|
+
case "https://dev.superblocks.com":
|
|
22
|
+
return "https://bucketeer.dev.superblocks.com";
|
|
23
|
+
case "http://localhost:3000":
|
|
24
|
+
default:
|
|
25
|
+
return "http://localhost:8030";
|
|
26
|
+
}
|
|
27
|
+
};
|