Comparing version 2.0.0 to 2.0.1
@@ -1,20 +0,5 @@ | ||
/** | ||
* Copyright 2017 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
export declare class EventId { | ||
b: Uint8Array; | ||
constructor(); | ||
new(): any; | ||
new(): string; | ||
} |
"use strict"; | ||
/** | ||
* Copyright 2017 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Copyright 2017 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EventId = void 0; | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const d64 = require('d64'); | ||
const uuid = require("uuid"); | ||
// This function is pulled directly from the d64 module: | ||
// https://github.com/dominictarr/d64 | ||
// That module hasn't been updated in 8 years, and misuses the Buffer package. | ||
// See issue here: https://github.com/google/eventid-js/issues/160 | ||
const chars = '.PYFGCRLAOEUIDHTNSQJKXBMWVZ_pyfgcrlaoeuidhtnsqjkxbmwvz1234567890' | ||
.split('') | ||
.sort() | ||
.join(''); | ||
function encode(data) { | ||
let s = ''; | ||
const l = data.length; | ||
let hang = 0; | ||
for (let i = 0; i < l; i++) { | ||
const v = data[i]; | ||
switch (i % 3) { | ||
case 0: | ||
s += chars[v >> 2]; | ||
hang = (v & 3) << 4; | ||
break; | ||
case 1: | ||
s += chars[hang | (v >> 4)]; | ||
hang = (v & 0xf) << 2; | ||
break; | ||
case 2: | ||
s += chars[hang | (v >> 6)]; | ||
s += chars[v & 0x3f]; | ||
hang = 0; | ||
break; | ||
} | ||
} | ||
if (l % 3) | ||
s += chars[hang]; | ||
return s; | ||
} | ||
class EventId { | ||
@@ -35,3 +65,3 @@ constructor() { | ||
} | ||
return d64.encode(this.b); | ||
return encode(this.b); | ||
} | ||
@@ -38,0 +68,0 @@ } |
# Changelog | ||
### [2.0.1](https://www.github.com/google/eventid-js/compare/v2.0.0...v2.0.1) (2021-12-06) | ||
### Bug Fixes | ||
* **deps:** remove dependency on d64 ([#161](https://www.github.com/google/eventid-js/issues/161)) ([58753da](https://www.github.com/google/eventid-js/commit/58753da30cb4443395c4436ac95471ca2d2de6aa)) | ||
## [2.0.0](https://www.github.com/google/eventid-js/compare/v1.0.0...v2.0.0) (2021-08-31) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "eventid", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A utility for generating monotonically increasing unique event ids across a network of services.", | ||
@@ -34,3 +34,2 @@ "main": "build/src/index.js", | ||
"dependencies": { | ||
"d64": "^1.0.0", | ||
"uuid": "^8.0.0" | ||
@@ -40,3 +39,3 @@ }, | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^14.0.0", | ||
"@types/node": "^16.0.0", | ||
"@types/uuid": "^8.0.0", | ||
@@ -43,0 +42,0 @@ "c8": "^7.3.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20482
1
77
- Removedd64@^1.0.0
- Removedd64@1.0.0(transitive)