Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle SDK Parser #173

Merged
merged 11 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
495 changes: 256 additions & 239 deletions generator/generators/aws/generator.js

Large diffs are not rendered by default.

600 changes: 311 additions & 289 deletions generator/generators/azure/generator.js

Large diffs are not rendered by default.

489 changes: 254 additions & 235 deletions generator/generators/do/generator.js

Large diffs are not rendered by default.

1,257 changes: 682 additions & 575 deletions generator/generators/googleCloud/generator.js

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions generator/generators/lib/aws/awsHelper.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
"use strict";
'use strict';
exports.__esModule = true;
exports.filterAWSMethods = exports.groupAWSMethods = void 0;
function groupAWSMethods(methods) {
var methodArr = Object.values(
methods.reduce(function(result, _a) {
var functionName = _a.functionName,
SDKFunctionName = _a.SDKFunctionName,
params = _a.params;
// Create new group
if (!result[functionName])
result[functionName] = {
functionName: functionName,
array: []
};
// Append to group
result[functionName].array.push({
functionName: functionName,
SDKFunctionName: SDKFunctionName,
params: params
});
return result;
}, {})
);
return methodArr;
var methodArr = Object.values(
methods.reduce(function(result, _a) {
var functionName = _a.functionName,
SDKFunctionName = _a.SDKFunctionName,
params = _a.params;
// Create new group
if (!result[functionName])
result[functionName] = {
functionName: functionName,
array: [],
};
// Append to group
result[functionName].array.push({
functionName: functionName,
SDKFunctionName: SDKFunctionName,
params: params,
});
return result;
}, {})
);
return methodArr;
}
exports.groupAWSMethods = groupAWSMethods;
function filterAWSMethods(groupedMethods) {
var methods = [];
groupedMethods.map(function(group) {
group.array.sort(function(a, b) {
return a.params.length - b.params.length;
});
methods.push(group.array.slice(-1)[0]);
});
return methods;
var methods = [];
groupedMethods.map(function(group) {
group.array.sort(function(a, b) {
return a.params.length - b.params.length;
});
methods.push(group.array.slice(-1)[0]);
});
return methods;
}
exports.filterAWSMethods = filterAWSMethods;
104 changes: 52 additions & 52 deletions generator/generators/lib/azure/azureHelper.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
"use strict";
'use strict';
exports.__esModule = true;
exports.filterAzureMethods = exports.groupAzureMethods = void 0;
function groupAzureMethods(methods) {
var methodArr = Object.values(
methods.reduce(function(result, _a) {
var functionName = _a.functionName,
SDKFunctionName = _a.SDKFunctionName,
params = _a.params,
pkgName = _a.pkgName,
fileName = _a.fileName,
client = _a.client,
returnType = _a.returnType;
// Create new group
if (!result[functionName])
result[functionName] = {
functionName: functionName,
array: []
};
// Append to group
result[functionName].array.push({
functionName: functionName,
SDKFunctionName: SDKFunctionName,
params: params,
pkgName: pkgName,
fileName: fileName,
client: client,
returnType: returnType
});
return result;
}, {})
);
return methodArr;
var methodArr = Object.values(
methods.reduce(function(result, _a) {
var functionName = _a.functionName,
SDKFunctionName = _a.SDKFunctionName,
params = _a.params,
pkgName = _a.pkgName,
fileName = _a.fileName,
client = _a.client,
returnType = _a.returnType;
// Create new group
if (!result[functionName])
result[functionName] = {
functionName: functionName,
array: [],
};
// Append to group
result[functionName].array.push({
functionName: functionName,
SDKFunctionName: SDKFunctionName,
params: params,
pkgName: pkgName,
fileName: fileName,
client: client,
returnType: returnType,
});
return result;
}, {})
);
return methodArr;
}
exports.groupAzureMethods = groupAzureMethods;
function filterAzureMethods(groupedMethods) {
var methods = [];
groupedMethods.map(function(group) {
if (group.array.length === 1) {
methods.push(group.array[0]);
} else {
var methodPushed_1 = false;
group.array.map(function(method) {
if (
!method.params.find(function(param) {
return param.name === "callback";
})
) {
methods.push(method);
methodPushed_1 = true;
}
});
if (!methodPushed_1) {
methods.push(group.array[0]);
}
}
});
return methods;
var methods = [];
groupedMethods.map(function(group) {
if (group.array.length === 1) {
methods.push(group.array[0]);
} else {
var methodPushed_1 = false;
group.array.map(function(method) {
if (
!method.params.find(function(param) {
return param.name === 'callback';
})
) {
methods.push(method);
methodPushed_1 = true;
}
});
if (!methodPushed_1) {
methods.push(group.array[0]);
}
}
});
return methods;
}
exports.filterAzureMethods = filterAzureMethods;
112 changes: 56 additions & 56 deletions generator/generators/lib/googleCloud/gcpHelper.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
"use strict";
'use strict';
exports.__esModule = true;
exports.filterGCPMethods = exports.groupGCPMethods = void 0;
function groupGCPMethods(methods) {
var methodArr = Object.values(
methods.reduce(function(result, _a) {
var functionName = _a.functionName,
SDKFunctionName = _a.SDKFunctionName,
params = _a.params,
pkgName = _a.pkgName,
fileName = _a.fileName,
client = _a.client,
returnType = _a.returnType,
returnTypeName = _a.returnTypeName,
classConstructorData = _a.classConstructorData;
// Create new group
if (!result[functionName])
result[functionName] = {
functionName: functionName,
array: []
};
// Append to group
result[functionName].array.push({
functionName: functionName,
SDKFunctionName: SDKFunctionName,
params: params,
pkgName: pkgName,
fileName: fileName,
client: client,
returnType: returnType,
returnTypeName: returnTypeName,
classConstructorData: classConstructorData
});
return result;
}, {})
);
return methodArr;
var methodArr = Object.values(
methods.reduce(function(result, _a) {
var functionName = _a.functionName,
SDKFunctionName = _a.SDKFunctionName,
params = _a.params,
pkgName = _a.pkgName,
fileName = _a.fileName,
client = _a.client,
returnType = _a.returnType,
returnTypeName = _a.returnTypeName,
classConstructorData = _a.classConstructorData;
// Create new group
if (!result[functionName])
result[functionName] = {
functionName: functionName,
array: [],
};
// Append to group
result[functionName].array.push({
functionName: functionName,
SDKFunctionName: SDKFunctionName,
params: params,
pkgName: pkgName,
fileName: fileName,
client: client,
returnType: returnType,
returnTypeName: returnTypeName,
classConstructorData: classConstructorData,
});
return result;
}, {})
);
return methodArr;
}
exports.groupGCPMethods = groupGCPMethods;
function filterGCPMethods(groupedMethods) {
var methods = [];
groupedMethods.map(function(group) {
if (group.array.length === 1) {
methods.push(group.array[0]);
} else {
var methodPushed_1 = false;
group.array.map(function(method) {
if (
!method.params.find(function(param) {
return param.name === "callback";
})
) {
methods.push(method);
methodPushed_1 = true;
}
});
if (!methodPushed_1) {
methods.push(group.array[0]);
}
}
});
return methods;
var methods = [];
groupedMethods.map(function(group) {
if (group.array.length === 1) {
methods.push(group.array[0]);
} else {
var methodPushed_1 = false;
group.array.map(function(method) {
if (
!method.params.find(function(param) {
return param.name === 'callback';
})
) {
methods.push(method);
methodPushed_1 = true;
}
});
if (!methodPushed_1) {
methods.push(group.array[0]);
}
}
});
return methods;
}
exports.filterGCPMethods = filterGCPMethods;
64 changes: 32 additions & 32 deletions generator/generators/lib/helper.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
"use strict";
'use strict';
exports.__esModule = true;
exports.getDir = exports.filters = exports.groupers = exports.printFile = void 0;
var fs = require("fs");
var awsHelper_1 = require("../lib/aws/awsHelper");
var gcpHelper_1 = require("../lib/googleCloud/gcpHelper");
var azureHelper_1 = require("../lib/azure/azureHelper");
var awsHelper_2 = require("../lib/aws/awsHelper");
var gcpHelper_2 = require("../lib/googleCloud/gcpHelper");
var azureHelper_2 = require("../lib/azure/azureHelper");
exports.groupers = exports.getDir = exports.filters = exports.printFile = void 0;
var fs = require('fs');
var awsHelper_1 = require('../lib/aws/awsHelper');
var awsHelper_2 = require('../lib/aws/awsHelper');
var azureHelper_1 = require('../lib/azure/azureHelper');
var azureHelper_2 = require('../lib/azure/azureHelper');
var gcpHelper_1 = require('../lib/googleCloud/gcpHelper');
var gcpHelper_2 = require('../lib/googleCloud/gcpHelper');
var dirMap = {
appServices: ["PaaS"],
compute: ["ComputeInstance", "Kubernetes", "Container"],
database: ["NoSqlIndexed", "RDBMS", "NoSql"],
management: ["Monitoring", "KeyManagement", "NotificationService"],
network: ["DNS", "LoadBalancer"],
security: ["IAM"],
storage: ["StorageBucket", "BlockStorage", "ArchivalStorage"],
artificialinteligence: ["Translation"]
appServices: ['PaaS'],
compute: ['ComputeInstance', 'Kubernetes', 'Container'],
database: ['NoSqlIndexed', 'RDBMS', 'NoSql'],
management: ['Monitoring', 'KeyManagement', 'NotificationService'],
network: ['DNS', 'LoadBalancer'],
security: ['IAM'],
storage: ['StorageBucket', 'BlockStorage', 'ArchivalStorage'],
artificialinteligence: ['Translation'],
};
function printFile(fileName, data) {
fs.writeFile(fileName, data, function(err) {
if (err) throw err;
});
fs.writeFile(fileName, data, function(err) {
if (err) throw err;
});
}
exports.printFile = printFile;
var groupers = {
aws: awsHelper_1.groupAWSMethods,
gcp: gcpHelper_1.groupGCPMethods,
azure: azureHelper_1.groupAzureMethods
aws: awsHelper_1.groupAWSMethods,
gcp: gcpHelper_1.groupGCPMethods,
azure: azureHelper_1.groupAzureMethods,
};
exports.groupers = groupers;
var filters = {
aws: awsHelper_2.filterAWSMethods,
gcp: gcpHelper_2.filterGCPMethods,
azure: azureHelper_2.filterAzureMethods
aws: awsHelper_2.filterAWSMethods,
gcp: gcpHelper_2.filterGCPMethods,
azure: azureHelper_2.filterAzureMethods,
};
exports.filters = filters;
var getDir = function(service) {
for (var dir in dirMap) {
if (dirMap[dir].includes(service)) {
return dir;
}
}
throw new Error("Not a valid service: " + service);
for (var dir in dirMap) {
if (dirMap[dir].includes(service)) {
return dir;
}
}
throw new Error('Not a valid service: ' + service);
};
exports.getDir = getDir;
Loading