core: Move some simple properties JS => C.

This commit is contained in:
2025-10-06 06:53:41 -04:00
parent 5d8d02515d
commit 97fcf72d63
2 changed files with 9 additions and 5 deletions

View File

@@ -178,6 +178,7 @@ async function getProcessBlob(blobId, key, options) {
process.task = new Task();
process.packageOwner = options.packageOwner;
process.packageName = options.packageName;
process.url = options?.url;
process.eventHandlers = {};
if (!options?.script || options?.script === 'app.js') {
process.app = new app.App();
@@ -287,11 +288,6 @@ async function getProcessBlob(blobId, key, options) {
throw Error(`Permission denied: ${permission}.`);
}
},
app: {
owner: options?.packageOwner,
name: options?.packageName,
},
url: options?.url,
},
};
process.sendIdentities = async function () {

View File

@@ -333,6 +333,14 @@ static JSValue _tf_api_register_imports(JSContext* context, JSValueConst this_va
JS_SetPropertyStr(context, core, "users", JS_NewCFunctionData(context, _tf_api_core_users, 0, 0, 1, &process));
JS_SetPropertyStr(context, core, "permissionsForUser", JS_NewCFunctionData(context, _tf_api_core_permissionsForUser, 1, 0, 1, &process));
JSValue app = JS_NewObject(context);
JS_SetPropertyStr(context, app, "owner", JS_GetPropertyStr(context, process, "packageOwner"));
JS_SetPropertyStr(context, app, "name", JS_GetPropertyStr(context, process, "packageName"));
JS_SetPropertyStr(context, core, "app", app);
JS_SetPropertyStr(context, core, "url", JS_GetPropertyStr(context, process, "url"));
JS_FreeValue(context, core);
return JS_UNDEFINED;
}