@budibase/backend-core 3.2.35 → 3.2.38
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/index.js +70 -98
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +2 -6
- package/dist/plugins.js.map +1 -1
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/environment.d.ts +1 -1
- package/dist/src/features/features.d.ts +0 -8
- package/dist/src/objectStore/buckets/app.d.ts +2 -2
- package/dist/src/objectStore/buckets/global.d.ts +1 -1
- package/dist/src/objectStore/buckets/plugins.d.ts +1 -1
- package/dist/src/objectStore/objectStore.d.ts +16 -26
- package/dist/src/objectStore/utils.d.ts +2 -2
- package/package.json +2 -6
package/dist/index.js
CHANGED
|
@@ -11598,10 +11598,6 @@ var TenantResolutionStrategy = /* @__PURE__ */ ((TenantResolutionStrategy2) => {
|
|
|
11598
11598
|
|
|
11599
11599
|
// ../types/src/sdk/featureFlag.ts
|
|
11600
11600
|
var FeatureFlagDefaults = {
|
|
11601
|
-
["DEFAULT_VALUES" /* DEFAULT_VALUES */]: true,
|
|
11602
|
-
["AUTOMATION_BRANCHING" /* AUTOMATION_BRANCHING */]: true,
|
|
11603
|
-
["AI_CUSTOM_CONFIGS" /* AI_CUSTOM_CONFIGS */]: true,
|
|
11604
|
-
["BUDIBASE_AI" /* BUDIBASE_AI */]: true,
|
|
11605
11601
|
["USE_ZOD_VALIDATOR" /* USE_ZOD_VALIDATOR */]: false
|
|
11606
11602
|
};
|
|
11607
11603
|
|
|
@@ -17086,7 +17082,7 @@ function sort(docs, sort2, sortOrder, sortType = "string" /* STRING */) {
|
|
|
17086
17082
|
});
|
|
17087
17083
|
}
|
|
17088
17084
|
function limit(docs, limit2) {
|
|
17089
|
-
const numLimit = parseFloat(limit2);
|
|
17085
|
+
const numLimit = typeof limit2 === "number" ? limit2 : parseFloat(limit2);
|
|
17090
17086
|
if (isNaN(numLimit)) {
|
|
17091
17087
|
return docs;
|
|
17092
17088
|
}
|
|
@@ -17698,7 +17694,7 @@ var environment = {
|
|
|
17698
17694
|
MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY,
|
|
17699
17695
|
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
|
|
17700
17696
|
AWS_SESSION_TOKEN: process.env.AWS_SESSION_TOKEN,
|
|
17701
|
-
AWS_REGION: process.env.AWS_REGION
|
|
17697
|
+
AWS_REGION: process.env.AWS_REGION,
|
|
17702
17698
|
MINIO_URL: process.env.MINIO_URL,
|
|
17703
17699
|
MINIO_ENABLED: process.env.MINIO_ENABLED || 1,
|
|
17704
17700
|
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
|
@@ -18619,9 +18615,7 @@ __export(objectStore_exports2, {
|
|
|
18619
18615
|
});
|
|
18620
18616
|
|
|
18621
18617
|
// src/objectStore/objectStore.ts
|
|
18622
|
-
var
|
|
18623
|
-
var import_lib_storage = require("@aws-sdk/lib-storage");
|
|
18624
|
-
var import_s3_request_presigner = require("@aws-sdk/s3-request-presigner");
|
|
18618
|
+
var import_aws_sdk = __toESM(require("aws-sdk"));
|
|
18625
18619
|
var import_stream2 = __toESM(require("stream"));
|
|
18626
18620
|
var import_node_fetch2 = __toESM(require("node-fetch"));
|
|
18627
18621
|
var import_tar_fs = __toESM(require("tar-fs"));
|
|
@@ -18740,42 +18734,42 @@ function sanitizeKey(input) {
|
|
|
18740
18734
|
function sanitizeBucket(input) {
|
|
18741
18735
|
return input.replace(new RegExp(APP_DEV_PREFIX2, "g"), APP_PREFIX2);
|
|
18742
18736
|
}
|
|
18743
|
-
function ObjectStore(opts = { presigning: false }) {
|
|
18737
|
+
function ObjectStore(bucket, opts = { presigning: false }) {
|
|
18744
18738
|
const config = {
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18739
|
+
s3ForcePathStyle: true,
|
|
18740
|
+
signatureVersion: "v4",
|
|
18741
|
+
apiVersion: "2006-03-01",
|
|
18742
|
+
accessKeyId: environment_default.MINIO_ACCESS_KEY,
|
|
18743
|
+
secretAccessKey: environment_default.MINIO_SECRET_KEY,
|
|
18750
18744
|
region: environment_default.AWS_REGION
|
|
18751
18745
|
};
|
|
18752
|
-
if (
|
|
18753
|
-
config.
|
|
18754
|
-
|
|
18755
|
-
secretAccessKey: environment_default.MINIO_SECRET_KEY,
|
|
18756
|
-
sessionToken: environment_default.AWS_SESSION_TOKEN
|
|
18746
|
+
if (bucket) {
|
|
18747
|
+
config.params = {
|
|
18748
|
+
Bucket: sanitizeBucket(bucket)
|
|
18757
18749
|
};
|
|
18758
18750
|
}
|
|
18751
|
+
if (!environment_default.MINIO_ENABLED && environment_default.AWS_SESSION_TOKEN) {
|
|
18752
|
+
config.sessionToken = environment_default.AWS_SESSION_TOKEN;
|
|
18753
|
+
}
|
|
18759
18754
|
if (environment_default.MINIO_URL) {
|
|
18760
18755
|
if (opts.presigning && environment_default.MINIO_ENABLED) {
|
|
18761
|
-
config.endpoint = "
|
|
18756
|
+
config.endpoint = "minio-service";
|
|
18762
18757
|
} else {
|
|
18763
18758
|
config.endpoint = environment_default.MINIO_URL;
|
|
18764
18759
|
}
|
|
18765
18760
|
}
|
|
18766
|
-
return new
|
|
18761
|
+
return new import_aws_sdk.default.S3(config);
|
|
18767
18762
|
}
|
|
18768
18763
|
async function createBucketIfNotExists(client, bucketName) {
|
|
18769
18764
|
bucketName = sanitizeBucket(bucketName);
|
|
18770
18765
|
try {
|
|
18771
18766
|
await client.headBucket({
|
|
18772
18767
|
Bucket: bucketName
|
|
18773
|
-
});
|
|
18768
|
+
}).promise();
|
|
18774
18769
|
return { created: false, exists: true };
|
|
18775
18770
|
} catch (err) {
|
|
18776
|
-
const statusCode = err.statusCode || err.$response?.statusCode;
|
|
18777
18771
|
const promises = STATE.bucketCreationPromises;
|
|
18778
|
-
const doesntExist = statusCode === 404, noAccess = statusCode === 403;
|
|
18772
|
+
const doesntExist = err.statusCode === 404, noAccess = err.statusCode === 403;
|
|
18779
18773
|
if (promises[bucketName]) {
|
|
18780
18774
|
await promises[bucketName];
|
|
18781
18775
|
return { created: false, exists: true };
|
|
@@ -18783,7 +18777,7 @@ async function createBucketIfNotExists(client, bucketName) {
|
|
|
18783
18777
|
if (doesntExist) {
|
|
18784
18778
|
promises[bucketName] = client.createBucket({
|
|
18785
18779
|
Bucket: bucketName
|
|
18786
|
-
});
|
|
18780
|
+
}).promise();
|
|
18787
18781
|
await promises[bucketName];
|
|
18788
18782
|
delete promises[bucketName];
|
|
18789
18783
|
return { created: true, exists: false };
|
|
@@ -18806,20 +18800,21 @@ async function upload({
|
|
|
18806
18800
|
}) {
|
|
18807
18801
|
const extension = filename.split(".").pop();
|
|
18808
18802
|
const fileBytes = path3 ? (await import_promises.default.open(path3)).createReadStream() : body2;
|
|
18809
|
-
const objectStore = ObjectStore();
|
|
18803
|
+
const objectStore = ObjectStore(bucketName);
|
|
18810
18804
|
const bucketCreated = await createBucketIfNotExists(objectStore, bucketName);
|
|
18811
18805
|
if (ttl && bucketCreated.created) {
|
|
18812
18806
|
let ttlConfig = bucketTTLConfig(bucketName, ttl);
|
|
18813
|
-
await objectStore.putBucketLifecycleConfiguration(ttlConfig);
|
|
18807
|
+
await objectStore.putBucketLifecycleConfiguration(ttlConfig).promise();
|
|
18814
18808
|
}
|
|
18815
18809
|
let contentType = type;
|
|
18816
|
-
|
|
18810
|
+
if (!contentType) {
|
|
18811
|
+
contentType = extension ? CONTENT_TYPE_MAP[extension.toLowerCase()] : CONTENT_TYPE_MAP.txt;
|
|
18812
|
+
}
|
|
18817
18813
|
const config = {
|
|
18818
18814
|
// windows file paths need to be converted to forward slashes for s3
|
|
18819
|
-
Bucket: sanitizeBucket(bucketName),
|
|
18820
18815
|
Key: sanitizeKey(filename),
|
|
18821
18816
|
Body: fileBytes,
|
|
18822
|
-
ContentType:
|
|
18817
|
+
ContentType: contentType
|
|
18823
18818
|
};
|
|
18824
18819
|
if (metadata && typeof metadata === "object") {
|
|
18825
18820
|
for (let key of Object.keys(metadata)) {
|
|
@@ -18829,11 +18824,7 @@ async function upload({
|
|
|
18829
18824
|
}
|
|
18830
18825
|
config.Metadata = metadata;
|
|
18831
18826
|
}
|
|
18832
|
-
|
|
18833
|
-
client: objectStore,
|
|
18834
|
-
params: config
|
|
18835
|
-
});
|
|
18836
|
-
return upload2.done();
|
|
18827
|
+
return objectStore.upload(config).promise();
|
|
18837
18828
|
}
|
|
18838
18829
|
async function streamUpload({
|
|
18839
18830
|
bucket: bucketName,
|
|
@@ -18847,11 +18838,11 @@ async function streamUpload({
|
|
|
18847
18838
|
throw new Error("Stream to upload is invalid/undefined");
|
|
18848
18839
|
}
|
|
18849
18840
|
const extension = filename.split(".").pop();
|
|
18850
|
-
const objectStore = ObjectStore();
|
|
18841
|
+
const objectStore = ObjectStore(bucketName);
|
|
18851
18842
|
const bucketCreated = await createBucketIfNotExists(objectStore, bucketName);
|
|
18852
18843
|
if (ttl && bucketCreated.created) {
|
|
18853
18844
|
let ttlConfig = bucketTTLConfig(bucketName, ttl);
|
|
18854
|
-
await objectStore.putBucketLifecycleConfiguration(ttlConfig);
|
|
18845
|
+
await objectStore.putBucketLifecycleConfiguration(ttlConfig).promise();
|
|
18855
18846
|
}
|
|
18856
18847
|
if (filename?.endsWith(".js")) {
|
|
18857
18848
|
extra = {
|
|
@@ -18876,45 +18867,37 @@ async function streamUpload({
|
|
|
18876
18867
|
ContentType: contentType,
|
|
18877
18868
|
...extra
|
|
18878
18869
|
};
|
|
18879
|
-
const
|
|
18880
|
-
client: objectStore,
|
|
18881
|
-
params: params2
|
|
18882
|
-
});
|
|
18883
|
-
const details = await upload2.done();
|
|
18870
|
+
const details = await objectStore.upload(params2).promise();
|
|
18884
18871
|
const headDetails = await objectStore.headObject({
|
|
18885
18872
|
Bucket: bucket,
|
|
18886
18873
|
Key: objKey
|
|
18887
|
-
});
|
|
18874
|
+
}).promise();
|
|
18888
18875
|
return {
|
|
18889
18876
|
...details,
|
|
18890
18877
|
ContentLength: headDetails.ContentLength
|
|
18891
18878
|
};
|
|
18892
18879
|
}
|
|
18893
18880
|
async function retrieve(bucketName, filepath) {
|
|
18894
|
-
const objectStore = ObjectStore();
|
|
18881
|
+
const objectStore = ObjectStore(bucketName);
|
|
18895
18882
|
const params2 = {
|
|
18896
18883
|
Bucket: sanitizeBucket(bucketName),
|
|
18897
18884
|
Key: sanitizeKey(filepath)
|
|
18898
18885
|
};
|
|
18899
|
-
const response = await objectStore.getObject(params2);
|
|
18900
|
-
if (!response.Body) {
|
|
18901
|
-
throw new Error("Unable to retrieve object");
|
|
18902
|
-
}
|
|
18903
|
-
const nodeResponse = response.Body;
|
|
18886
|
+
const response = await objectStore.getObject(params2).promise();
|
|
18904
18887
|
if (STRING_CONTENT_TYPES.includes(response.ContentType)) {
|
|
18905
|
-
return
|
|
18888
|
+
return response.Body.toString("utf8");
|
|
18906
18889
|
} else {
|
|
18907
|
-
return
|
|
18890
|
+
return response.Body;
|
|
18908
18891
|
}
|
|
18909
18892
|
}
|
|
18910
18893
|
async function listAllObjects(bucketName, path3) {
|
|
18911
|
-
const objectStore = ObjectStore();
|
|
18894
|
+
const objectStore = ObjectStore(bucketName);
|
|
18912
18895
|
const list = (params2 = {}) => {
|
|
18913
18896
|
return objectStore.listObjectsV2({
|
|
18914
18897
|
...params2,
|
|
18915
18898
|
Bucket: sanitizeBucket(bucketName),
|
|
18916
18899
|
Prefix: sanitizeKey(path3)
|
|
18917
|
-
});
|
|
18900
|
+
}).promise();
|
|
18918
18901
|
};
|
|
18919
18902
|
let isTruncated = false, token, objects = [];
|
|
18920
18903
|
do {
|
|
@@ -18931,15 +18914,14 @@ async function listAllObjects(bucketName, path3) {
|
|
|
18931
18914
|
} while (isTruncated && token);
|
|
18932
18915
|
return objects;
|
|
18933
18916
|
}
|
|
18934
|
-
|
|
18935
|
-
const objectStore = ObjectStore({ presigning: true });
|
|
18917
|
+
function getPresignedUrl(bucketName, key, durationSeconds = 3600) {
|
|
18918
|
+
const objectStore = ObjectStore(bucketName, { presigning: true });
|
|
18936
18919
|
const params2 = {
|
|
18937
18920
|
Bucket: sanitizeBucket(bucketName),
|
|
18938
|
-
Key: sanitizeKey(key)
|
|
18921
|
+
Key: sanitizeKey(key),
|
|
18922
|
+
Expires: durationSeconds
|
|
18939
18923
|
};
|
|
18940
|
-
const url =
|
|
18941
|
-
expiresIn: durationSeconds
|
|
18942
|
-
});
|
|
18924
|
+
const url = objectStore.getSignedUrl("getObject", params2);
|
|
18943
18925
|
if (!environment_default.MINIO_ENABLED) {
|
|
18944
18926
|
return url;
|
|
18945
18927
|
} else {
|
|
@@ -18954,11 +18936,7 @@ async function retrieveToTmp(bucketName, filepath) {
|
|
|
18954
18936
|
filepath = sanitizeKey(filepath);
|
|
18955
18937
|
const data = await retrieve(bucketName, filepath);
|
|
18956
18938
|
const outputPath = (0, import_path2.join)(budibaseTempDir(), (0, import_uuid2.v4)());
|
|
18957
|
-
|
|
18958
|
-
data.pipe(import_fs3.default.createWriteStream(outputPath));
|
|
18959
|
-
} else {
|
|
18960
|
-
import_fs3.default.writeFileSync(outputPath, data);
|
|
18961
|
-
}
|
|
18939
|
+
import_fs3.default.writeFileSync(outputPath, data);
|
|
18962
18940
|
return outputPath;
|
|
18963
18941
|
}
|
|
18964
18942
|
async function retrieveDirectory(bucketName, path3) {
|
|
@@ -18995,16 +18973,16 @@ async function retrieveDirectory(bucketName, path3) {
|
|
|
18995
18973
|
return writePath;
|
|
18996
18974
|
}
|
|
18997
18975
|
async function deleteFile(bucketName, filepath) {
|
|
18998
|
-
const objectStore = ObjectStore();
|
|
18976
|
+
const objectStore = ObjectStore(bucketName);
|
|
18999
18977
|
await createBucketIfNotExists(objectStore, bucketName);
|
|
19000
18978
|
const params2 = {
|
|
19001
18979
|
Bucket: bucketName,
|
|
19002
18980
|
Key: sanitizeKey(filepath)
|
|
19003
18981
|
};
|
|
19004
|
-
return objectStore.deleteObject(params2);
|
|
18982
|
+
return objectStore.deleteObject(params2).promise();
|
|
19005
18983
|
}
|
|
19006
18984
|
async function deleteFiles(bucketName, filepaths) {
|
|
19007
|
-
const objectStore = ObjectStore();
|
|
18985
|
+
const objectStore = ObjectStore(bucketName);
|
|
19008
18986
|
await createBucketIfNotExists(objectStore, bucketName);
|
|
19009
18987
|
const params2 = {
|
|
19010
18988
|
Bucket: bucketName,
|
|
@@ -19012,17 +18990,17 @@ async function deleteFiles(bucketName, filepaths) {
|
|
|
19012
18990
|
Objects: filepaths.map((path3) => ({ Key: sanitizeKey(path3) }))
|
|
19013
18991
|
}
|
|
19014
18992
|
};
|
|
19015
|
-
return objectStore.deleteObjects(params2);
|
|
18993
|
+
return objectStore.deleteObjects(params2).promise();
|
|
19016
18994
|
}
|
|
19017
18995
|
async function deleteFolder(bucketName, folder) {
|
|
19018
18996
|
bucketName = sanitizeBucket(bucketName);
|
|
19019
18997
|
folder = sanitizeKey(folder);
|
|
19020
|
-
const client = ObjectStore();
|
|
18998
|
+
const client = ObjectStore(bucketName);
|
|
19021
18999
|
const listParams = {
|
|
19022
19000
|
Bucket: bucketName,
|
|
19023
19001
|
Prefix: folder
|
|
19024
19002
|
};
|
|
19025
|
-
const existingObjectsResponse = await client.listObjects(listParams);
|
|
19003
|
+
const existingObjectsResponse = await client.listObjects(listParams).promise();
|
|
19026
19004
|
if (existingObjectsResponse.Contents?.length === 0) {
|
|
19027
19005
|
return;
|
|
19028
19006
|
}
|
|
@@ -19035,7 +19013,7 @@ async function deleteFolder(bucketName, folder) {
|
|
|
19035
19013
|
existingObjectsResponse.Contents?.forEach((content) => {
|
|
19036
19014
|
deleteParams.Delete.Objects.push({ Key: content.Key });
|
|
19037
19015
|
});
|
|
19038
|
-
const deleteResponse = await client.deleteObjects(deleteParams);
|
|
19016
|
+
const deleteResponse = await client.deleteObjects(deleteParams).promise();
|
|
19039
19017
|
if (deleteResponse.Deleted?.length === 1e3) {
|
|
19040
19018
|
return deleteFolder(bucketName, folder);
|
|
19041
19019
|
}
|
|
@@ -19087,27 +19065,23 @@ async function downloadTarball(url, bucketName, path3) {
|
|
|
19087
19065
|
async function getReadStream(bucketName, path3) {
|
|
19088
19066
|
bucketName = sanitizeBucket(bucketName);
|
|
19089
19067
|
path3 = sanitizeKey(path3);
|
|
19090
|
-
const client = ObjectStore();
|
|
19068
|
+
const client = ObjectStore(bucketName);
|
|
19091
19069
|
const params2 = {
|
|
19092
19070
|
Bucket: bucketName,
|
|
19093
19071
|
Key: path3
|
|
19094
19072
|
};
|
|
19095
|
-
|
|
19096
|
-
if (!response.Body || !(response.Body instanceof import_stream2.default.Readable)) {
|
|
19097
|
-
throw new Error("Unable to retrieve stream - invalid response");
|
|
19098
|
-
}
|
|
19099
|
-
return response.Body;
|
|
19073
|
+
return client.getObject(params2).createReadStream();
|
|
19100
19074
|
}
|
|
19101
19075
|
async function getObjectMetadata(bucket, path3) {
|
|
19102
19076
|
bucket = sanitizeBucket(bucket);
|
|
19103
19077
|
path3 = sanitizeKey(path3);
|
|
19104
|
-
const client = ObjectStore();
|
|
19078
|
+
const client = ObjectStore(bucket);
|
|
19105
19079
|
const params2 = {
|
|
19106
19080
|
Bucket: bucket,
|
|
19107
19081
|
Key: path3
|
|
19108
19082
|
};
|
|
19109
19083
|
try {
|
|
19110
|
-
return await client.headObject(params2);
|
|
19084
|
+
return await client.headObject(params2).promise();
|
|
19111
19085
|
} catch (err) {
|
|
19112
19086
|
throw new Error("Unable to retrieve metadata from object");
|
|
19113
19087
|
}
|
|
@@ -19165,7 +19139,7 @@ var import_querystring = __toESM(require("querystring"));
|
|
|
19165
19139
|
function clientLibraryPath(appId) {
|
|
19166
19140
|
return `${sanitizeKey(appId)}/budibase-client.js`;
|
|
19167
19141
|
}
|
|
19168
|
-
|
|
19142
|
+
function clientLibraryCDNUrl(appId, version) {
|
|
19169
19143
|
let file = clientLibraryPath(appId);
|
|
19170
19144
|
if (environment_default.CLOUDFRONT_CDN) {
|
|
19171
19145
|
if (version) {
|
|
@@ -19173,7 +19147,7 @@ async function clientLibraryCDNUrl(appId, version) {
|
|
|
19173
19147
|
}
|
|
19174
19148
|
return getUrl(file);
|
|
19175
19149
|
} else {
|
|
19176
|
-
return
|
|
19150
|
+
return getPresignedUrl(environment_default.APPS_BUCKET_NAME, file);
|
|
19177
19151
|
}
|
|
19178
19152
|
}
|
|
19179
19153
|
function clientLibraryUrl(appId, version) {
|
|
@@ -19191,16 +19165,16 @@ function clientLibraryUrl(appId, version) {
|
|
|
19191
19165
|
}
|
|
19192
19166
|
return `/api/assets/client?${import_querystring.default.encode(qsParams)}`;
|
|
19193
19167
|
}
|
|
19194
|
-
|
|
19168
|
+
function getAppFileUrl(s3Key) {
|
|
19195
19169
|
if (environment_default.CLOUDFRONT_CDN) {
|
|
19196
19170
|
return getPresignedUrl2(s3Key);
|
|
19197
19171
|
} else {
|
|
19198
|
-
return
|
|
19172
|
+
return getPresignedUrl(environment_default.APPS_BUCKET_NAME, s3Key);
|
|
19199
19173
|
}
|
|
19200
19174
|
}
|
|
19201
19175
|
|
|
19202
19176
|
// src/objectStore/buckets/global.ts
|
|
19203
|
-
var getGlobalFileUrl =
|
|
19177
|
+
var getGlobalFileUrl = (type, name, etag) => {
|
|
19204
19178
|
let file = getGlobalFileS3Key(type, name);
|
|
19205
19179
|
if (environment_default.CLOUDFRONT_CDN) {
|
|
19206
19180
|
if (etag) {
|
|
@@ -19208,7 +19182,7 @@ var getGlobalFileUrl = async (type, name, etag) => {
|
|
|
19208
19182
|
}
|
|
19209
19183
|
return getPresignedUrl2(file);
|
|
19210
19184
|
} else {
|
|
19211
|
-
return
|
|
19185
|
+
return getPresignedUrl(environment_default.GLOBAL_BUCKET_NAME, file);
|
|
19212
19186
|
}
|
|
19213
19187
|
};
|
|
19214
19188
|
var getGlobalFileS3Key = (type, name) => {
|
|
@@ -19221,34 +19195,32 @@ var getGlobalFileS3Key = (type, name) => {
|
|
|
19221
19195
|
};
|
|
19222
19196
|
|
|
19223
19197
|
// src/objectStore/buckets/plugins.ts
|
|
19224
|
-
|
|
19198
|
+
function enrichPluginURLs(plugins) {
|
|
19225
19199
|
if (!plugins || !plugins.length) {
|
|
19226
19200
|
return [];
|
|
19227
19201
|
}
|
|
19228
|
-
return
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
})
|
|
19234
|
-
);
|
|
19202
|
+
return plugins.map((plugin) => {
|
|
19203
|
+
const jsUrl = getPluginJSUrl(plugin);
|
|
19204
|
+
const iconUrl = getPluginIconUrl(plugin);
|
|
19205
|
+
return { ...plugin, jsUrl, iconUrl };
|
|
19206
|
+
});
|
|
19235
19207
|
}
|
|
19236
|
-
|
|
19208
|
+
function getPluginJSUrl(plugin) {
|
|
19237
19209
|
const s3Key = getPluginJSKey(plugin);
|
|
19238
19210
|
return getPluginUrl(s3Key);
|
|
19239
19211
|
}
|
|
19240
|
-
|
|
19212
|
+
function getPluginIconUrl(plugin) {
|
|
19241
19213
|
const s3Key = getPluginIconKey(plugin);
|
|
19242
19214
|
if (!s3Key) {
|
|
19243
19215
|
return;
|
|
19244
19216
|
}
|
|
19245
19217
|
return getPluginUrl(s3Key);
|
|
19246
19218
|
}
|
|
19247
|
-
|
|
19219
|
+
function getPluginUrl(s3Key) {
|
|
19248
19220
|
if (environment_default.CLOUDFRONT_CDN) {
|
|
19249
19221
|
return getPresignedUrl2(s3Key);
|
|
19250
19222
|
} else {
|
|
19251
|
-
return
|
|
19223
|
+
return getPresignedUrl(environment_default.PLUGIN_BUCKET_NAME, s3Key);
|
|
19252
19224
|
}
|
|
19253
19225
|
}
|
|
19254
19226
|
function getPluginJSKey(plugin) {
|