feat(core): Use WebCrypto to generate all random numbers and strings (#9786)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-06-19 13:33:57 +02:00
committed by GitHub
parent cfc4db00e3
commit 65c5609ab5
49 changed files with 254 additions and 214 deletions

View File

@@ -11,7 +11,7 @@ import type {
INodeTypeDescription,
IRequestOptions,
} from 'n8n-workflow';
import { deepCopy } from 'n8n-workflow';
import { deepCopy, randomInt } from 'n8n-workflow';
import { capitalCase } from 'change-case';
import {
@@ -115,8 +115,8 @@ export class Odoo implements INodeType {
const db = odooGetDBName(credentials.db as string, url);
const userID = await odooGetUserID.call(this, db, username, password, url);
const responce = await odooGetModelFields.call(this, db, userID, password, resource, url);
const options = Object.values(responce).map((field) => {
const response = await odooGetModelFields.call(this, db, userID, password, resource, url);
const options = Object.values(response).map((field) => {
const optionField = field as { [key: string]: string };
let name = '';
try {
@@ -158,12 +158,12 @@ export class Odoo implements INodeType {
['name', 'model', 'modules'],
],
},
id: Math.floor(Math.random() * 100),
id: randomInt(100),
};
const responce = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const response = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const options = responce.map((model) => {
const options = response.map((model) => {
return {
name: model.name,
value: model.model,
@@ -188,12 +188,12 @@ export class Odoo implements INodeType {
method: 'execute',
args: [db, userID, password, 'res.country.state', 'search_read', [], ['id', 'name']],
},
id: Math.floor(Math.random() * 100),
id: randomInt(100),
};
const responce = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const response = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const options = responce.map((state) => {
const options = response.map((state) => {
return {
name: state.name as string,
value: state.id,
@@ -217,12 +217,12 @@ export class Odoo implements INodeType {
method: 'execute',
args: [db, userID, password, 'res.country', 'search_read', [], ['id', 'name']],
},
id: Math.floor(Math.random() * 100),
id: randomInt(100),
};
const responce = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const response = (await odooJSONRPCRequest.call(this, body, url)) as IDataObject[];
const options = responce.map((country) => {
const options = response.map((country) => {
return {
name: country.name as string,
value: country.id,
@@ -252,7 +252,7 @@ export class Odoo implements INodeType {
credentials?.password,
],
},
id: Math.floor(Math.random() * 100),
id: randomInt(100),
};
const options: IRequestOptions = {