Skip to content

Commit 38dea89

Browse files
authoredFeb 28, 2025
Merge pull request #225 from oracle/rateLimitFix
Fix Rate exceeded errors found in npm run migrate
2 parents 551b63c + 2220974 commit 38dea89

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed
 

‎templates/ords-remix-jwt-sample/ords/RESTfulServices/grantSQLDeveloperRole.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
*/
1414
function grantSQLDeveloperRole(schema, object, objectAlias) {
1515
return `
16-
DECLARE
17-
L_PRIV_ROLES owa.vc_arr;
18-
L_PRIV_PATTERNS owa.vc_arr;
19-
L_PRIV_MODULES owa.vc_arr;
2016
BEGIN
2117
L_PRIV_ROLES( 1 ) := 'oracle.dbtools.autorest.any.schema';
2218
L_PRIV_ROLES( 2 ) := 'oracle.dbtools.role.autorest.${schema}.${object}';
@@ -32,9 +28,10 @@ function grantSQLDeveloperRole(schema, object, objectAlias) {
3228
P_DESCRIPTION => 'allow access to autoREST API',
3329
P_COMMENTS=> ''
3430
);
35-
COMMIT;
31+
L_PRIV_ROLES.DELETE;
32+
L_PRIV_PATTERNS.DELETE;
33+
L_PRIV_MODULES.DELETE;
3634
END;
37-
/
3835
`;
3936
}
4037

‎templates/ords-remix-jwt-sample/ords/migrateScripts/autoRESTEnableObjects.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,26 @@ async function autoRESTEnableObjects(schemaName, endpoint, basicAuth) {
9797
const statementsResponse = await postRequest(endpoint, autoRESTenableStatements, basicAuth);
9898
printResponse(statementsResponse);
9999
// Add the SQL Developer role to the objects that where autoREST Enabled.
100-
objectsToRESTEnable.filter((object) => object.isAutoRestAuth).map(async (object) => {
101-
const grantSQLDevStmt = grantSQLDeveloperRole(
100+
const sqlDeveloperObjects = objectsToRESTEnable.filter((object) => object.isAutoRestAuth)
101+
.map((object) => grantSQLDeveloperRole(
102102
schemaName,
103103
object.objectName,
104104
object.objectAlias,
105-
);
106-
const statementResponse = await postRequest(endpoint, grantSQLDevStmt, basicAuth);
107-
printResponse(statementResponse);
108-
});
105+
));
106+
107+
const sqlDeveloperStatement = `
108+
DECLARE
109+
L_PRIV_ROLES owa.vc_arr;
110+
L_PRIV_PATTERNS owa.vc_arr;
111+
L_PRIV_MODULES owa.vc_arr;
112+
BEGIN
113+
${sqlDeveloperObjects.join(' ')}
114+
COMMIT;
115+
END;
116+
/
117+
`;
118+
const statementResponse = await postRequest(endpoint, sqlDeveloperStatement, basicAuth);
119+
printResponse(statementResponse);
109120
}
110121

111122
export default autoRESTEnableObjects;

0 commit comments

Comments
 (0)
Please sign in to comment.