I am not able to comprehend the usecase where you want to make it a page level client library. In any case the issue is with
var outputs = {
"id": idNode,
"name": nameNode,
"description": descriptionNode
};
As the thirdparty code will not understand this.
Recommendation is to make it a client library to be associated with form. So on click of a button, you can write a "visual rule" to invoke a custom function (in follwoing example myForm.execute_service). And the clientlibrary will have the js with the custom function looking like:
var myForm = window.myForm = window.myForm || {};
/**
* @function myForm.execute_service
* @Param {scope} scope in which code inside function will be executed.
*/
myForm.b2_evacuateIndependently_valueCommit0 = function (scope) {
with(scope) {
var operationInfo = {
"formDataModelId": "/content/test/formsanddocuments-fdm/myproject/samplepostgres",
"operationTitle": "Fetch From Attachment Form",
"operationName": "fetch"
};
var inputs = {
"id": id.value
};
var outputs = {
"id": id,
"name": name,
"description": description
};
guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, null, null,);
}
Doc link: Check heading "Custom functions in rule editor" in https://experienceleague.adobe.com/docs/experience-manager-65/content/forms/adaptive-forms-advanced-...