diff --git a/docs/client/api.js b/docs/client/api.js index 00c7dfb5a8..5f2ba48dda 100644 --- a/docs/client/api.js +++ b/docs/client/api.js @@ -684,7 +684,7 @@ Template.api.cursor_observe_changes = { Template.api.id = { id: "meteor_id", - name: "Meteor.id()", + name: "Random.id()", locus: "Anywhere", descr: ["Return a unique identifier."], args: [ ] diff --git a/docs/client/docs.js b/docs/client/docs.js index 4dee50fc1e..96be550e70 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -151,7 +151,7 @@ var toc = [ {instance: "cursor", name: "observeChanges", id: "observe_changes"} ], {type: "spacer"}, - "Meteor.id", + "Random.id", // XXX move this to the packages section {name: "Meteor.Collection.ObjectID", id: "collection_object_id"}, {type: "spacer"}, {name: "Selectors", style: "noncode"}, diff --git a/packages/livedata/livedata_server.js b/packages/livedata/livedata_server.js index ab969be6af..9740942588 100644 --- a/packages/livedata/livedata_server.js +++ b/packages/livedata/livedata_server.js @@ -772,7 +772,7 @@ Meteor._LivedataSubscription = function ( if (self._subscriptionId) { self._subscriptionHandle = 'N' + self._subscriptionId; } else { - self._subscriptionHandle = 'U' + Meteor.id(); + self._subscriptionHandle = 'U' + Random.id(); } // has _deactivate been called? diff --git a/packages/livedata/livedata_test_service.js b/packages/livedata/livedata_test_service.js index 740af62335..322cc5b504 100644 --- a/packages/livedata/livedata_test_service.js +++ b/packages/livedata/livedata_test_service.js @@ -244,7 +244,7 @@ if (Meteor.isServer) { // First add a random item, which should be cleaned up. We use ready/onReady // to make sure that the second test block is only called after the added is // processed, so that there's any chance of the coll.find().count() failing. - sub.added(collName, Meteor.id(), {foo: 42}); + sub.added(collName, Random.id(), {foo: 42}); sub.ready(); if (options.stopInHandler) { diff --git a/packages/livedata/livedata_tests.js b/packages/livedata/livedata_tests.js index 62c73bbac6..8e89fc7510 100644 --- a/packages/livedata/livedata_tests.js +++ b/packages/livedata/livedata_tests.js @@ -436,7 +436,7 @@ if (Meteor.isClient) { // conn._subscriptions is empty. var conn = new Meteor._LivedataConnection('/', {reloadWithOutstanding: true}); - var collName = Meteor.id(); + var collName = Random.id(); var coll = new Meteor.Collection(collName, {manager: conn}); var errorFromRerun; var gotErrorFromStopper = false; diff --git a/packages/mongo-livedata/observe_changes_tests.js b/packages/mongo-livedata/observe_changes_tests.js index e1fa9eecf1..908da0f180 100644 --- a/packages/mongo-livedata/observe_changes_tests.js +++ b/packages/mongo-livedata/observe_changes_tests.js @@ -2,7 +2,7 @@ var makeCollection = function () { if (Meteor.isServer) - return new Meteor.Collection(Meteor.id()); + return new Meteor.Collection(Random.id()); else return new Meteor.Collection(null); }; diff --git a/packages/random/random.js b/packages/random/random.js index 90854020db..52aed0301b 100644 --- a/packages/random/random.js +++ b/packages/random/random.js @@ -1,3 +1,5 @@ +// XXX update these comments + // XXX dups packages/minimongo/uuid.js // Meteor.random() -- known good PRNG, replaces Math.random() @@ -29,6 +31,8 @@ // SOFTWARE. (function() { +Random = {}; + var HEX_DIGITS = "0123456789abcdef"; var UNMISTAKABLE_CHARS = "23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijkmnopqrstuvwxyz"; @@ -148,7 +152,7 @@ Meteor.uuid = function () { return uuid; }; -Meteor.id = function() { +Random.id = function() { var digits = []; var base = UNMISTAKABLE_CHARS.length; // Length of 17 preserves around 96 bits of entropy, which is the