@eeplatform/core 1.7.2 → 1.7.4
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/demo-transcription.js +0 -145
- package/test-first-phoneme.js +0 -92
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -281,7 +281,7 @@ declare function useRoleRepo(): {
|
|
|
281
281
|
createIndex: () => Promise<void>;
|
|
282
282
|
createTextIndex: () => Promise<void>;
|
|
283
283
|
createUniqueIndex: () => Promise<void>;
|
|
284
|
-
addRole: (value: TRole, session?: ClientSession) => Promise<ObjectId>;
|
|
284
|
+
addRole: (value: TRole, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
|
|
285
285
|
getRoles: ({ search, page, limit, sort, type, id, }?: {
|
|
286
286
|
search?: string;
|
|
287
287
|
page?: number;
|
|
@@ -300,6 +300,7 @@ declare function useRoleRepo(): {
|
|
|
300
300
|
updateRole: (_id: string | ObjectId, value: TMiniRole, session?: ClientSession) => Promise<string>;
|
|
301
301
|
deleteRole: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
|
|
302
302
|
updatePermissionsById: (_id: string | ObjectId, permissions: TRole["permissions"], session?: ClientSession) => Promise<string>;
|
|
303
|
+
delCachedData: () => void;
|
|
303
304
|
};
|
|
304
305
|
|
|
305
306
|
declare function useRoleController(): {
|
package/dist/index.js
CHANGED
|
@@ -2221,11 +2221,13 @@ function useRoleRepo() {
|
|
|
2221
2221
|
throw new import_nodejs_utils10.InternalServerError("Failed to create unique index on role.");
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
|
-
async function addRole(value, session) {
|
|
2224
|
+
async function addRole(value, session, clearCache = true) {
|
|
2225
2225
|
value = new MRole(value);
|
|
2226
2226
|
try {
|
|
2227
2227
|
const res = await collection.insertOne(value, { session });
|
|
2228
|
-
|
|
2228
|
+
if (clearCache) {
|
|
2229
|
+
delCachedData();
|
|
2230
|
+
}
|
|
2229
2231
|
return res.insertedId;
|
|
2230
2232
|
} catch (error) {
|
|
2231
2233
|
import_nodejs_utils10.logger.log({ level: "error", message: `${error}` });
|
|
@@ -2498,7 +2500,8 @@ function useRoleRepo() {
|
|
|
2498
2500
|
getRoleByName,
|
|
2499
2501
|
updateRole,
|
|
2500
2502
|
deleteRole,
|
|
2501
|
-
updatePermissionsById
|
|
2503
|
+
updatePermissionsById,
|
|
2504
|
+
delCachedData
|
|
2502
2505
|
};
|
|
2503
2506
|
}
|
|
2504
2507
|
|
|
@@ -3875,6 +3878,7 @@ function useRoleController() {
|
|
|
3875
3878
|
// src/resources/file/file.service.ts
|
|
3876
3879
|
var import_nodejs_utils19 = require("@eeplatform/nodejs-utils");
|
|
3877
3880
|
var import_node_cron = __toESM(require("node-cron"));
|
|
3881
|
+
var fs = __toESM(require("fs"));
|
|
3878
3882
|
function useFileService() {
|
|
3879
3883
|
const {
|
|
3880
3884
|
createFile: _createFile,
|
|
@@ -3898,12 +3902,23 @@ function useFileService() {
|
|
|
3898
3902
|
};
|
|
3899
3903
|
try {
|
|
3900
3904
|
const id = await _createFile(file, session);
|
|
3905
|
+
const fileBuffer = value.buffer || await fs.promises.readFile(value.path);
|
|
3901
3906
|
await s3.uploadObject({
|
|
3902
3907
|
key: id,
|
|
3903
|
-
body:
|
|
3908
|
+
body: fileBuffer,
|
|
3904
3909
|
contentType: value.mimetype
|
|
3905
3910
|
});
|
|
3906
3911
|
await session?.commitTransaction();
|
|
3912
|
+
if (value.path) {
|
|
3913
|
+
try {
|
|
3914
|
+
await fs.promises.unlink(value.path);
|
|
3915
|
+
} catch (cleanupError) {
|
|
3916
|
+
console.error(
|
|
3917
|
+
`Failed to cleanup temporary file ${value.path}:`,
|
|
3918
|
+
cleanupError
|
|
3919
|
+
);
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3907
3922
|
return id;
|
|
3908
3923
|
} catch (error) {
|
|
3909
3924
|
await session?.abortTransaction();
|
|
@@ -6257,7 +6272,7 @@ function useGitHubService() {
|
|
|
6257
6272
|
const octokit = new import_rest.Octokit({ auth: githubToken });
|
|
6258
6273
|
const { owner, repo } = parseRepoUrl(repoUrl);
|
|
6259
6274
|
await checkAdminPermission(owner, repo, octokit);
|
|
6260
|
-
const lines = keyValues.split(
|
|
6275
|
+
const lines = keyValues.split(";").map((l) => l.trim()).filter(Boolean);
|
|
6261
6276
|
for (const line of lines) {
|
|
6262
6277
|
const equalIndex = line.indexOf("=");
|
|
6263
6278
|
if (equalIndex === -1)
|
|
@@ -6873,7 +6888,7 @@ function useUtilController() {
|
|
|
6873
6888
|
availableEndpoints: [
|
|
6874
6889
|
"POST /github/variables - Set GitHub environment variables or secrets"
|
|
6875
6890
|
],
|
|
6876
|
-
keyValueFormat: "KEY=value pairs separated by
|
|
6891
|
+
keyValueFormat: "KEY=value pairs separated by semicolons"
|
|
6877
6892
|
}
|
|
6878
6893
|
});
|
|
6879
6894
|
} catch (error) {
|
|
@@ -6927,14 +6942,14 @@ function useUtilController() {
|
|
|
6927
6942
|
);
|
|
6928
6943
|
return;
|
|
6929
6944
|
}
|
|
6930
|
-
const lines = keyValues.split(
|
|
6945
|
+
const lines = keyValues.split(";").map((l) => l.trim()).filter(Boolean);
|
|
6931
6946
|
const invalidLines = lines.filter(
|
|
6932
6947
|
(line) => !line.includes("=") || line.indexOf("=") === -1
|
|
6933
6948
|
);
|
|
6934
6949
|
if (invalidLines.length > 0) {
|
|
6935
6950
|
next(
|
|
6936
6951
|
new import_nodejs_utils38.BadRequestError(
|
|
6937
|
-
"Invalid key-value format. Each pair should be in format: KEY=value. Pairs
|
|
6952
|
+
"Invalid key-value format. Each pair should be in format: KEY=value. Pairs should be separated by semicolons."
|
|
6938
6953
|
)
|
|
6939
6954
|
);
|
|
6940
6955
|
return;
|