Skip to content

Commit 2c8d215

Browse files
chore: remove uuid dependency (#3130)
* chore: remove `uuid` dependency * fix: add import * refactor: use node:crypto prefix and named imports * resolve merge conflicts --------- Co-authored-by: Lahiru Maramba <llahiru@gmail.com>
1 parent da2141a commit 2c8d215

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@
221221
"fast-deep-equal": "^3.1.1",
222222
"google-auth-library": "^10.6.1",
223223
"jsonwebtoken": "^9.0.0",
224-
"jwks-rsa": "^3.1.0",
225-
"uuid": "^11.0.2"
224+
"jwks-rsa": "^3.1.0"
226225
},
227226
"optionalDependencies": {
228227
"@google-cloud/firestore": "^7.11.0",
@@ -248,7 +247,6 @@
248247
"@types/request-promise": "^4.1.41",
249248
"@types/sinon": "^17.0.2",
250249
"@types/sinon-chai": "^3.0.0",
251-
"@types/uuid": "^10.0.0",
252250
"@typescript-eslint/eslint-plugin": "^8.56.0",
253251
"@typescript-eslint/parser": "^8.56.0",
254252
"bcrypt": "^6.0.0",
@@ -281,4 +279,4 @@
281279
"typescript": "^5.7.3",
282280
"yargs": "^17.0.1"
283281
}
284-
}
282+
}

src/eventarc/eventarc-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import { PrefixedFirebaseError } from '../utils/error';
1919
import { CloudEvent } from './cloudevent';
20-
import { v4 as uuid } from 'uuid';
2120
import * as validator from '../utils/validator';
21+
import { randomUUID } from 'node:crypto';
2222

2323
// List of CloudEvent properties that are handled "by hand" and should be skipped by
2424
// automatic attribute copy.
@@ -50,7 +50,7 @@ export function toCloudEventProtoFormat(ce: CloudEvent): any {
5050
}
5151
const out: Record<string, any> = {
5252
'@type': 'type.googleapis.com/io.cloudevents.v1.CloudEvent',
53-
'id': ce.id ?? uuid(),
53+
'id': ce.id ?? randomUUID(),
5454
'type': ce.type,
5555
'specVersion': ce.specversion ?? '1.0',
5656
'source': source

test/unit/remote-config/condition-evaluator.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ import {
2626
NamedCondition,
2727
OneOfCondition,
2828
} from '../../../src/remote-config/remote-config-api';
29-
import { v4 as uuidv4 } from 'uuid';
3029
import { clone } from 'lodash';
31-
import * as crypto from 'crypto';
30+
import * as crypto from 'node:crypto';
3231

3332
const expect = chai.expect;
3433

@@ -907,7 +906,7 @@ describe('ConditionEvaluator', () => {
907906
...clone(condition),
908907
seed: 'seed'
909908
};
910-
const context = { randomizationId: uuidv4() }
909+
const context = { randomizationId: crypto.randomUUID() }
911910
if (conditionEvaluator.evaluateConditions([{
912911
name: 'is_enabled',
913912
condition: { percent: clonedCondition }

0 commit comments

Comments
 (0)