diff --git a/package-lock.json b/package-lock.json index 1c7ecd4f9e..4518db4c00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,8 +18,7 @@ "google-auth-library": "^9.14.2", "jsonwebtoken": "^9.0.0", "jwks-rsa": "^3.1.0", - "node-forge": "^1.3.1", - "uuid": "^11.0.2" + "node-forge": "^1.3.1" }, "devDependencies": { "@firebase/api-documenter": "^0.5.0", @@ -40,7 +39,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": "^7.16.1", "@typescript-eslint/parser": "^7.16.1", "bcrypt": "^6.0.0", @@ -2262,13 +2260,6 @@ "devOptional": true, "license": "MIT" }, - "node_modules/@types/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", - "dev": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "7.18.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz", @@ -11763,19 +11754,6 @@ "devOptional": true, "license": "MIT" }, - "node_modules/uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/esm/bin/uuid" - } - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/package.json b/package.json index a17a1e291f..6d6cc0d2d1 100644 --- a/package.json +++ b/package.json @@ -215,8 +215,7 @@ "google-auth-library": "^9.14.2", "jsonwebtoken": "^9.0.0", "jwks-rsa": "^3.1.0", - "node-forge": "^1.3.1", - "uuid": "^11.0.2" + "node-forge": "^1.3.1" }, "optionalDependencies": { "@google-cloud/firestore": "^7.11.0", @@ -241,7 +240,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": "^7.16.1", "@typescript-eslint/parser": "^7.16.1", "bcrypt": "^6.0.0", diff --git a/src/eventarc/eventarc-client-internal.ts b/src/eventarc/eventarc-client-internal.ts index e4e5bda0a4..929c3a77df 100644 --- a/src/eventarc/eventarc-client-internal.ts +++ b/src/eventarc/eventarc-client-internal.ts @@ -78,7 +78,7 @@ export class EventarcApiClient { * * The following CloudEvent fields are auto-populated if not set: * * specversion - `1.0` - * * id - uuidv4() + * * id - a randomly generated UUID v4 string * * source - populated with `process.env.EVENTARC_CLOUD_EVENT_SOURCE` and * if not set an error is thrown. * diff --git a/src/eventarc/eventarc-utils.ts b/src/eventarc/eventarc-utils.ts index 3737e5a906..737e7f5310 100644 --- a/src/eventarc/eventarc-utils.ts +++ b/src/eventarc/eventarc-utils.ts @@ -15,9 +15,10 @@ * limitations under the License. */ +import { randomUUID } from 'crypto'; + import { PrefixedFirebaseError } from '../utils/error'; import { CloudEvent } from './cloudevent'; -import { v4 as uuid } from 'uuid'; import * as validator from '../utils/validator'; // List of CloudEvent properties that are handled "by hand" and should be skipped by @@ -50,7 +51,7 @@ export function toCloudEventProtoFormat(ce: CloudEvent): any { } const out: Record = { '@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 diff --git a/test/unit/remote-config/condition-evaluator.spec.ts b/test/unit/remote-config/condition-evaluator.spec.ts index 764d1b76ef..7576d22586 100644 --- a/test/unit/remote-config/condition-evaluator.spec.ts +++ b/test/unit/remote-config/condition-evaluator.spec.ts @@ -26,7 +26,6 @@ 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'; @@ -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 }