Skip to content

Commit

Permalink
refactor: update uuid typings and remove deprecated deep import of uu…
Browse files Browse the repository at this point in the history
…id/v4
  • Loading branch information
CheerlessCloud committed Mar 25, 2020
1 parent 460e825 commit 77fbc17
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 108 deletions.
102 changes: 0 additions & 102 deletions flow-typed/npm/uuid_v3.x.x.js

This file was deleted.

71 changes: 71 additions & 0 deletions flow-typed/npm/uuid_v7.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
declare module 'uuid' {
// v1 (Timestamp)
declare type V1Options = {|
node?: $ReadOnlyArray<number>,
clockseq?: number,
msecs?: number,
nsecs?: number,
random?: $ReadOnlyArray<number>,
rng?: () => $ReadOnlyArray<number>,
|};

declare export function v1(options?: V1Options): string;

declare export function v1(
options: V1Options | null,
buffer: Array<number>,
offset?: number
): Array<number>;

// v3 (Namespace)
declare function v3Impl(
name: string | $ReadOnlyArray<number>,
namespace: string | $ReadOnlyArray<number>
): string;

declare function v3Impl(
name: string | $ReadOnlyArray<number>,
namespace: string | $ReadOnlyArray<number>,
buffer: Array<number>,
offset?: number
): Array<number>;

declare export var v3: {|
[[call]]: typeof v3Impl,
DNS: string,
URL: string,
|};

// v4 (Random)
declare type V4Options = {|
random?: $ReadOnlyArray<number>,
rng?: () => $ReadOnlyArray<number>,
|};

declare export function v4(options?: V4Options): string;

declare export function v4(
options: V4Options | null,
buffer: Array<number>,
offset?: number
): Array<number>;

// v5 (Namespace)
declare function v5Impl(
name: string | $ReadOnlyArray<number>,
namespace: string | $ReadOnlyArray<number>
): string;

declare function v5Impl(
name: string | $ReadOnlyArray<number>,
namespace: string | $ReadOnlyArray<number>,
buffer: Array<number>,
offset?: number
): Array<number>;

declare export var v5: {|
[[call]]: typeof v5Impl,
DNS: string,
URL: string,
|};
}
2 changes: 1 addition & 1 deletion src/AMQPMessageMock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import uuid from 'uuid/v4';
import { v4 as uuid } from 'uuid';
// eslint-disable-next-line import/no-extraneous-dependencies
import { stub } from 'sinon';
import AMQPMessage from './AMQPMessage';
Expand Down
2 changes: 1 addition & 1 deletion src/Client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @flow
import uuid from 'uuid/v4';
import { v4 as uuid } from 'uuid';
import EError from 'eerror';
import pTimeout from 'p-timeout';
import type { IMessage } from './AMQPMessage';
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/Handler.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-param-reassign */
import test from 'ava';
import { spy, stub } from 'sinon';
import uuid from 'uuid/v4';
import { v4 as uuid } from 'uuid';
import EError from 'eerror';
import errorToObject from './errorToObject';
import Handler from './Handler';
Expand Down
2 changes: 1 addition & 1 deletion test/adapter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-param-reassign */
import test from 'ava';
import uuid from 'uuid/v4';
import { v4 as uuid } from 'uuid';
import AMQPAdapter from '../src/AMQPAdapter';

test.beforeEach(async t => {
Expand Down
2 changes: 1 addition & 1 deletion test/retries.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-param-reassign */
import test from 'ava';
import uuid from 'uuid/v4';
import { v4 as uuid } from 'uuid';
import RpcClient from '../src/Client';
import RpcService from '../src/Service';
import RpcHandler from '../src/rpc/Handler';
Expand Down
2 changes: 1 addition & 1 deletion test/rpc-integration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-param-reassign */
import test from 'ava';
import uuid from 'uuid/v4';
import { v4 as uuid } from 'uuid';
import EError from 'eerror';
import { stub } from 'sinon';
import RpcClient from '../src/Client';
Expand Down

0 comments on commit 77fbc17

Please sign in to comment.