Skip to content
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
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@
"fast-deep-equal": "^3.1.1",
"google-auth-library": "^10.6.1",
"jsonwebtoken": "^9.0.0",
"jwks-rsa": "^3.1.0",
"uuid": "^11.0.2"
"jwks-rsa": "^3.1.0"
},
"optionalDependencies": {
"@google-cloud/firestore": "^7.11.0",
Expand All @@ -248,7 +247,6 @@
"@types/request-promise": "^4.1.41",
"@types/sinon": "^17.0.2",
"@types/sinon-chai": "^3.0.0",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.56.0",
"@typescript-eslint/parser": "^8.56.0",
"bcrypt": "^6.0.0",
Expand Down Expand Up @@ -281,4 +279,4 @@
"typescript": "^5.7.3",
"yargs": "^17.0.1"
}
}
}
4 changes: 2 additions & 2 deletions src/eventarc/eventarc-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import { PrefixedFirebaseError } from '../utils/error';
import { CloudEvent } from './cloudevent';
import { v4 as uuid } from 'uuid';
Comment thread
gameroman marked this conversation as resolved.
import * as validator from '../utils/validator';
import { randomUUID } from 'node:crypto';
Comment on lines 20 to +21
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Following standard TypeScript conventions, built-in modules (like node:crypto) should be grouped together and placed before local relative imports. This improves readability and maintainability by clearly separating external/built-in dependencies from internal project files.

Suggested change
import * as validator from '../utils/validator';
import { randomUUID } from 'node:crypto';
import { randomUUID } from 'node:crypto';
import * as validator from '../utils/validator';


// List of CloudEvent properties that are handled "by hand" and should be skipped by
// automatic attribute copy.
Expand Down Expand Up @@ -50,7 +50,7 @@ export function toCloudEventProtoFormat(ce: CloudEvent): any {
}
const out: Record<string, any> = {
'@type': 'type.googleapis.com/io.cloudevents.v1.CloudEvent',
'id': ce.id ?? uuid(),
'id': ce.id ?? randomUUID(),
'type': ce.type,
'specVersion': ce.specversion ?? '1.0',
'source': source
Expand Down
5 changes: 2 additions & 3 deletions test/unit/remote-config/condition-evaluator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ import {
NamedCondition,
OneOfCondition,
} from '../../../src/remote-config/remote-config-api';
import { v4 as uuidv4 } from 'uuid';
import { clone } from 'lodash';
import * as crypto from 'crypto';
import * as crypto from 'node:crypto';
Comment on lines 29 to +30
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Built-in Node.js modules should ideally be grouped at the top of the import section, before external dependencies like lodash. This follows common style guides for organizing imports in TypeScript projects.

Suggested change
import { clone } from 'lodash';
import * as crypto from 'crypto';
import * as crypto from 'node:crypto';
import * as crypto from 'node:crypto';
import { clone } from 'lodash';


const expect = chai.expect;

Expand Down Expand Up @@ -907,7 +906,7 @@ describe('ConditionEvaluator', () => {
...clone(condition),
seed: 'seed'
};
const context = { randomizationId: uuidv4() }
const context = { randomizationId: crypto.randomUUID() }
if (conditionEvaluator.evaluateConditions([{
name: 'is_enabled',
condition: { percent: clonedCondition }
Expand Down
Loading