@stryke/unique-id 0.3.20 → 0.3.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +289 -0
  2. package/README.md +18 -10
  3. package/dist/cuid-BuvbHUZ8.cjs +1 -0
  4. package/dist/cuid-CcPQdiR_.mjs +2 -0
  5. package/dist/cuid-CcPQdiR_.mjs.map +1 -0
  6. package/dist/cuid-DT9rtBzf.d.mts +20 -0
  7. package/dist/cuid-DT9rtBzf.d.mts.map +1 -0
  8. package/dist/cuid-gUcp5l6X.d.cts +20 -0
  9. package/dist/cuid-gUcp5l6X.d.cts.map +1 -0
  10. package/dist/cuid.cjs +1 -30
  11. package/dist/cuid.d.cts +2 -0
  12. package/dist/cuid.d.mts +2 -0
  13. package/dist/cuid.mjs +1 -1
  14. package/dist/index.cjs +1 -60
  15. package/dist/index.d.cts +6 -0
  16. package/dist/index.d.mts +6 -0
  17. package/dist/index.mjs +1 -1
  18. package/dist/nanoid-client-DxgQ8Vt2.cjs +1 -0
  19. package/dist/nanoid-client-bEHxSBYB.mjs +2 -0
  20. package/dist/nanoid-client-bEHxSBYB.mjs.map +1 -0
  21. package/dist/{nanoid-client.d.ts → nanoid-client-mNAgNxsW.d.cts} +5 -1
  22. package/dist/nanoid-client-mNAgNxsW.d.cts.map +1 -0
  23. package/dist/nanoid-client-nC1JFvZD.d.mts +11 -0
  24. package/dist/nanoid-client-nC1JFvZD.d.mts.map +1 -0
  25. package/dist/nanoid-client.cjs +1 -10
  26. package/dist/nanoid-client.d.cts +2 -0
  27. package/dist/nanoid-client.d.mts +2 -0
  28. package/dist/nanoid-client.mjs +1 -1
  29. package/dist/{random.d.ts → random-Bd2-oY2n.d.cts} +8 -4
  30. package/dist/random-Bd2-oY2n.d.cts.map +1 -0
  31. package/dist/random-C4CrqJsp.cjs +1 -0
  32. package/dist/random-DTxCCJYh.d.mts +33 -0
  33. package/dist/random-DTxCCJYh.d.mts.map +1 -0
  34. package/dist/random-kTN0s0Jy.mjs +2 -0
  35. package/dist/random-kTN0s0Jy.mjs.map +1 -0
  36. package/dist/random.cjs +1 -28
  37. package/dist/random.d.cts +2 -0
  38. package/dist/random.d.mts +2 -0
  39. package/dist/random.mjs +1 -1
  40. package/dist/snowflake-B6ivA7bE.d.mts +102 -0
  41. package/dist/snowflake-B6ivA7bE.d.mts.map +1 -0
  42. package/dist/snowflake-BtoDXB99.mjs +2 -0
  43. package/dist/snowflake-BtoDXB99.mjs.map +1 -0
  44. package/dist/snowflake-CLDXd54w.cjs +1 -0
  45. package/dist/snowflake-DQmoRlnq.d.cts +102 -0
  46. package/dist/snowflake-DQmoRlnq.d.cts.map +1 -0
  47. package/dist/snowflake.cjs +1 -47
  48. package/dist/snowflake.d.cts +2 -0
  49. package/dist/snowflake.d.mts +2 -0
  50. package/dist/snowflake.mjs +1 -1
  51. package/dist/uuid-BnD3hGTH.cjs +1 -0
  52. package/dist/{uuid.d.ts → uuid-ByPTbUGJ.d.mts} +5 -1
  53. package/dist/uuid-ByPTbUGJ.d.mts.map +1 -0
  54. package/dist/uuid-DCE9JeUQ.d.cts +22 -0
  55. package/dist/uuid-DCE9JeUQ.d.cts.map +1 -0
  56. package/dist/uuid-DSMliG_W.mjs +2 -0
  57. package/dist/uuid-DSMliG_W.mjs.map +1 -0
  58. package/dist/uuid.cjs +1 -23
  59. package/dist/uuid.d.cts +2 -0
  60. package/dist/uuid.d.mts +2 -0
  61. package/dist/uuid.mjs +1 -1
  62. package/package.json +19 -115
  63. package/dist/cuid.d.ts +0 -16
  64. package/dist/index.d.ts +0 -13
  65. package/dist/snowflake.d.ts +0 -98
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/unique-id",
3
- "version": "0.3.20",
3
+ "version": "0.3.28",
4
4
  "type": "module",
5
5
  "description": "A package containing various helper functions to generate unique identifier strings",
6
6
  "repository": {
@@ -9,124 +9,28 @@
9
9
  "directory": "packages/unique-id"
10
10
  },
11
11
  "private": false,
12
- "publishConfig": { "access": "public" },
13
- "dependencies": { "@stryke/hash": "^0.12.15" },
14
- "devDependencies": {},
15
- "sideEffects": false,
16
- "files": ["dist/**/*"],
17
- "homepage": "https://stormsoftware.com",
18
- "bugs": {
19
- "url": "https://stormsoftware.com/support",
20
- "email": "support@stormsoftware.com"
21
- },
22
- "license": "Apache-2.0",
23
- "keywords": [
24
- "stryke",
25
- "typescript",
26
- "utilities",
27
- "storm-software",
28
- "storm",
29
- "storm-ops",
30
- "cyclone-ui",
31
- "sullivanpj",
32
- "monorepo"
33
- ],
34
- "funding": {
35
- "type": "github",
36
- "url": "https://github.com/sponsors/storm-software"
37
- },
38
- "author": {
39
- "name": "Storm Software",
40
- "email": "contact@stormsoftware.com",
41
- "url": "https://stormsoftware.com"
42
- },
43
- "maintainers": [
44
- {
45
- "name": "Storm Software",
46
- "email": "contact@stormsoftware.com",
47
- "url": "https://stormsoftware.com"
48
- }
49
- ],
50
- "contributors": [
51
- {
52
- "name": "Storm Software",
53
- "email": "contact@stormsoftware.com",
54
- "url": "https://stormsoftware.com"
55
- }
56
- ],
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.mjs",
57
14
  "exports": {
58
- "./uuid": {
59
- "import": { "types": "./dist/uuid.d.ts", "default": "./dist/uuid.mjs" },
60
- "require": { "types": "./dist/uuid.d.ts", "default": "./dist/uuid.cjs" },
61
- "default": { "types": "./dist/uuid.d.ts", "default": "./dist/uuid.mjs" }
62
- },
63
- "./snowflake": {
64
- "import": {
65
- "types": "./dist/snowflake.d.ts",
66
- "default": "./dist/snowflake.mjs"
67
- },
68
- "require": {
69
- "types": "./dist/snowflake.d.ts",
70
- "default": "./dist/snowflake.cjs"
71
- },
72
- "default": {
73
- "types": "./dist/snowflake.d.ts",
74
- "default": "./dist/snowflake.mjs"
75
- }
76
- },
77
- "./random": {
78
- "import": {
79
- "types": "./dist/random.d.ts",
80
- "default": "./dist/random.mjs"
81
- },
82
- "require": {
83
- "types": "./dist/random.d.ts",
84
- "default": "./dist/random.cjs"
85
- },
86
- "default": {
87
- "types": "./dist/random.d.ts",
88
- "default": "./dist/random.mjs"
89
- }
90
- },
15
+ ".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
16
+ "./cuid": { "require": "./dist/cuid.cjs", "import": "./dist/cuid.mjs" },
91
17
  "./nanoid-client": {
92
- "import": {
93
- "types": "./dist/nanoid-client.d.ts",
94
- "default": "./dist/nanoid-client.mjs"
95
- },
96
- "require": {
97
- "types": "./dist/nanoid-client.d.ts",
98
- "default": "./dist/nanoid-client.cjs"
99
- },
100
- "default": {
101
- "types": "./dist/nanoid-client.d.ts",
102
- "default": "./dist/nanoid-client.mjs"
103
- }
18
+ "require": "./dist/nanoid-client.cjs",
19
+ "import": "./dist/nanoid-client.mjs"
104
20
  },
105
- "./index": {
106
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
107
- "require": {
108
- "types": "./dist/index.d.ts",
109
- "default": "./dist/index.cjs"
110
- },
111
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
112
- },
113
- "./cuid": {
114
- "import": { "types": "./dist/cuid.d.ts", "default": "./dist/cuid.mjs" },
115
- "require": { "types": "./dist/cuid.d.ts", "default": "./dist/cuid.cjs" },
116
- "default": { "types": "./dist/cuid.d.ts", "default": "./dist/cuid.mjs" }
21
+ "./random": {
22
+ "require": "./dist/random.cjs",
23
+ "import": "./dist/random.mjs"
117
24
  },
118
- ".": {
119
- "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" },
120
- "require": {
121
- "types": "./dist/index.d.ts",
122
- "default": "./dist/index.cjs"
123
- },
124
- "default": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }
25
+ "./snowflake": {
26
+ "require": "./dist/snowflake.cjs",
27
+ "import": "./dist/snowflake.mjs"
125
28
  },
126
- "./package.json": "./package.json"
29
+ "./uuid": { "require": "./dist/uuid.cjs", "import": "./dist/uuid.mjs" },
30
+ "./*": "./*"
127
31
  },
128
- "main": "./dist/index.cjs",
129
- "module": "./dist/index.mjs",
130
- "types": "./dist/index.d.ts",
131
- "gitHead": "eb28313b3230b7ea654c87586ca07773e2e57f52"
32
+ "types": "./dist/index.d.cts",
33
+ "devDependencies": { "tsdown": "^0.17.1" },
34
+ "publishConfig": { "access": "public" },
35
+ "gitHead": "e9fb3e13aebac54518fd668cecdd3dd89540d34e"
132
36
  }
package/dist/cuid.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export interface FingerprintOptions {
2
- globalObj?: any;
3
- }
4
- /**
5
- * Generate a random CUID
6
- *
7
- * @example
8
- * ```typescript
9
- *
10
- * // Generate a random CUID
11
- * const id = cuid();
12
- * ```
13
- *
14
- * @returns A random CUID string
15
- */
16
- export declare function cuid(): string;
package/dist/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * The unique-id library used by Storm Software for building TypeScript applications.
3
- *
4
- * @remarks
5
- * A package containing various helper functions to generate unique identifier strings
6
- *
7
- * @packageDocumentation
8
- */
9
- export * from "./cuid";
10
- export * from "./nanoid-client";
11
- export * from "./random";
12
- export * from "./snowflake";
13
- export * from "./uuid";
@@ -1,98 +0,0 @@
1
- /**
2
- * Options passed to the `generate` function to create a snowflake identifier.
3
- */
4
- export interface SnowflakeGeneratorOptions {
5
- /**
6
- * The id of the shard running this generator.
7
- *
8
- * @defaultValue 1
9
- */
10
- shardId?: number;
11
- /**
12
- * The epoch to use for the snowflake.
13
- *
14
- * @remarks
15
- * This is the time in milliseconds since 1 January 1970 00:00:00 UTC.
16
- *
17
- * @defaultValue 1420070400000 (Date.UTC(1970, 0, 1).valueOf())
18
- */
19
- epoch?: number;
20
- /**
21
- * The current timestamp to use for the snowflake.
22
- *
23
- * @defaultValue Date.now()
24
- */
25
- timestamp?: number | Date;
26
- }
27
- /**
28
- * Resolvable value types for a valid Snowflake:
29
- * string
30
- * number
31
- * bigint
32
- */
33
- export type SnowflakeResolvable = string;
34
- /**
35
- * A deconstructed snowflake and the details around it's creation.
36
- */
37
- export interface DeconstructedSnowflake {
38
- /**
39
- * Snowflake deconstructed from
40
- */
41
- snowflake: SnowflakeResolvable;
42
- /**
43
- * The timestamp the snowflake was generated
44
- */
45
- timestamp: number;
46
- /**
47
- * The shard_id used when generating
48
- */
49
- shard_id: number;
50
- /**
51
- * The increment of this snowflake
52
- */
53
- sequence: number;
54
- /**
55
- * The 64Bit snowflake binary string
56
- */
57
- binary: string;
58
- }
59
- export declare const DEFAULT_SHARD_ID = 1;
60
- export declare const DEFAULT_EPOCH: number;
61
- /**
62
- * Generate a snowflake identifier.
63
- *
64
- * @remarks
65
- * Snowflakes are 64-bit unsigned integers that are roughly time-ordered.
66
- *
67
- * @example
68
- * ```typescript
69
- *
70
- * // Generate a snowflake with the default options
71
- * const id1 = snowflake();
72
- *
73
- * // Generate a snowflake with a custom shard id
74
- * const id2 = snowflake({ shardId: 2 });
75
- *
76
- * // Generate a snowflake with a custom shard id and timestamp
77
- * const id3 = snowflake({ shardId: 3, timestamp: new Date("2021-01-01") });
78
- *
79
- * ```
80
- *
81
- * @param options - The options to use when generating the snowflake
82
- * @returns A snowflake
83
- */
84
- export declare function snowflake(options?: SnowflakeGeneratorOptions): string;
85
- /**
86
- * Deconstruct a snowflake to its values using the `epoch`.
87
- *
88
- * @param snowflake - Snowflake to deconstruct
89
- * @returns Either the DeconstructedSnowflake object
90
- */
91
- export declare function deconstructSnowflake(snowflake: SnowflakeResolvable): DeconstructedSnowflake;
92
- /**
93
- * Check if a snowflake string Id is valid.
94
- *
95
- * @param snowflake - Snowflake to check
96
- * @returns Whether the snowflake is valid
97
- */
98
- export declare function isValidSnowflake(snowflake: string): boolean;