Skip to content

Commit f49876b

Browse files
committed
Implement IntToUuid Specification
1 parent f1fb739 commit f49876b

18 files changed

Lines changed: 1137 additions & 7 deletions

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test (Node.js ${{ matrix.node-version }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: ["20", "22", "24"]
16+
steps:
17+
- uses: actions/checkout@v6
18+
- uses: actions/setup-node@v6
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
- run: npm ci
22+
- run: npm test
23+
24+
lint:
25+
name: Lint & Type Check
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v6
29+
- uses: actions/setup-node@v6
30+
with:
31+
node-version: "24"
32+
- run: npm ci
33+
- run: npm run typecheck
34+
- run: npm run lint
35+
36+
build:
37+
name: Build
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v6
41+
- uses: actions/setup-node@v6
42+
with:
43+
node-version: "24"
44+
- run: npm ci
45+
- run: npm run build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules/
22
dist/
33
*.tgz
44
.DS_Store
5+
/.idea
6+
/.remember

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22
1+
24

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
package-lock.json

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2026-03-25
9+
10+
### Added
11+
12+
- Initial release
13+
- `IntegerId` value object with validation and immutability
14+
- `encode()` function to convert IntegerId to Version 8 UUID
15+
- `decode()` function to convert Version 8 UUID back to IntegerId
16+
- Full test suite with 36 official test vectors
17+
- Dual ESM/CJS output via tsup
18+
19+
[1.0.0]: https://github.com/wickedbyte/int-to-uuid-ts/releases/tag/v1.0.0

CODE_OF_CONDUCT.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Contributor Covenant 3.0 Code of Conduct
2+
3+
## Our Pledge
4+
5+
We pledge to make our community welcoming, safe, and equitable for all.
6+
7+
We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all
8+
individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics,
9+
neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or
10+
religion, national or social origin, socio-economic position, level of education, or other status. The same privileges
11+
of participation are extended to everyone who participates in good faith and in accordance with this Covenant.
12+
13+
## Encouraged Behaviors
14+
15+
While acknowledging differences in social norms, we all strive to meet our community's expectations for positive
16+
behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture,
17+
background, or native language.
18+
19+
With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared
20+
values, including:
21+
22+
1. Respecting the **purpose of our community**, our activities, and our ways of gathering.
23+
2. Engaging **kindly and honestly** with others.
24+
3. Respecting **different viewpoints** and experiences.
25+
4. **Taking responsibility** for our actions and contributions.
26+
5. Gracefully giving and accepting **constructive feedback**.
27+
6. Committing to **repairing harm** when it occurs.
28+
7. Behaving in other ways that promote and sustain the **well-being of our community**.
29+
30+
## Restricted Behaviors
31+
32+
We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are
33+
violations of this Code of Conduct.
34+
35+
1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any
36+
clear request to stop.
37+
2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of
38+
people.
39+
3. **Stereotyping or discrimination.** Characterizing anyone's personality or behavior on the basis of immutable
40+
identities or traits.
41+
4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or
42+
purpose of the community.
43+
5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their
44+
permission.
45+
6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group.
46+
7. Behaving in other ways that **threaten the well-being** of our community.
47+
48+
### Other Restrictions
49+
50+
1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade
51+
enforcement actions.
52+
2. **Failing to credit sources.** Not properly crediting the sources of content you contribute.
53+
3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the
54+
community.
55+
4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other
56+
restricted behaviors.
57+
58+
## Reporting an Issue
59+
60+
Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict
61+
represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help
62+
avoid conflicts and minimize harm.
63+
64+
When an incident does occur, it is important to report it promptly. To report a possible violation, **email
65+
[security@wickedbyte.com](mailto:security@wickedbyte.com) or use
66+
the [wickedbyte.com contact form](https://wickedbyte.com/contact).** Please be sure to indicate that you are reporting a
67+
code of conduct violation in your message.
68+
69+
Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They
70+
will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing
71+
witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as
72+
possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried
73+
out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon
74+
resolution.
75+
76+
## Addressing and Repairing Harm
77+
78+
If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following
79+
enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals
80+
involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be
81+
skipped.
82+
83+
1. Warning
84+
1. Event: A violation involving a single incident or series of incidents.
85+
2. Consequence: A private, written warning from the Community Moderators.
86+
3. Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking
87+
clarification on expectations.
88+
2. Temporarily Limited Activities
89+
1. Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a
90+
more serious violation.
91+
2. Consequence: A private, written warning with a time-limited cooldown period designed to underscore the
92+
seriousness of the situation and give the community members involved time to process the incident. The cooldown
93+
period may be limited to particular communication channels or interactions with particular community members.
94+
3. Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and
95+
impact, and being thoughtful about re-entering community spaces after the period is over.
96+
3. Temporary Suspension
97+
1. Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a
98+
single serious violation.
99+
2. Consequence: A private written warning with conditions for return from suspension. In general, temporary
100+
suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions.
101+
3. Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for
102+
return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
103+
4. Permanent Ban
104+
1. Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or
105+
a violation so serious that the Community Moderators determine there is no way to keep the community safe with
106+
this person as a member.
107+
2. Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent
108+
bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working
109+
through other remedies has failed to change the behavior.
110+
3. Repair: There is no possible repair in cases of this severity.
111+
112+
This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their
113+
discretion and judgment, in keeping with the best interests of our community.
114+
115+
## Scope
116+
117+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
118+
the community in public or other spaces. Examples of representing our community include using an official email address,
119+
posting via an official social media account, or acting as an appointed representative at an online or offline event.
120+
121+
## Attribution
122+
123+
This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available
124+
at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
125+
126+
Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy
127+
of this license,
128+
visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/)
129+
130+
For answers to common questions about Contributor Covenant, see the FAQ
131+
at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided
132+
at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional
133+
enforcement and community guideline resources can be found
134+
at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement
135+
ladder was inspired by the work of [Mozilla's code of conduct team](https://github.com/mozilla/inclusion).

CONTRIBUTING.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Contributing
2+
3+
Contributions are welcome. This project accepts pull requests on [GitHub][github].
4+
5+
## Communication Channels & Reporting Bugs
6+
7+
You can find help and discussion at the project's [GitHub Issues page][issues]. Please use the issue tracker to report
8+
any bugs found with this project.
9+
10+
⚠️ _**ATTENTION!!!** DO NOT include passwords or other sensitive information in your bug report._
11+
12+
When submitting a bug report, please include enough information to reproduce the bug. A good bug report includes the
13+
following sections:
14+
15+
- **Description**: Provide a short and clear description of the bug.
16+
17+
- **Steps to Reproduce**: Provide steps to reproduce the behavior you are experiencing. Please try to keep this as short
18+
as possible. If able, create a reproducible script outside any framework you are using. This will help us to
19+
quickly debug the issue.
20+
21+
- **Expected Behavior**: Provide a short and clear description of what you expect to happen.
22+
23+
- **Screenshots or Other Output**: If applicable, add screenshots or program output to help explain your problem.
24+
25+
- **Environment Details**: Provide details about the system where you're using this package, such as Node.js version and
26+
operating system.
27+
28+
- **Additional Context**: Provide any additional context that may help us debug the problem.
29+
30+
## Fixing Bugs
31+
32+
This project welcomes pull requests to fix bugs!
33+
34+
If you see a bug report that you'd like to fix, please feel free to do so. Following the directions and guidelines
35+
described in the "Adding New Features" section below, you may create bugfix branches and send pull requests.
36+
37+
## Adding New Features
38+
39+
If you have an idea for a new feature, it's a good idea to check out the [issues][] or active [pull requests][] first to
40+
see if anyone is already working on the feature. If not, feel free to submit an issue first, asking whether the feature
41+
is beneficial to the project. This will save you from doing a lot of development work only to have your feature
42+
rejected. We don't enjoy rejecting your hard work, but some features don't fit with the goals of the project.
43+
44+
When you do begin working on your feature, here are some guidelines to consider:
45+
46+
- Your pull request description should clearly detail the changes you have made. We will use this description to update
47+
the CHANGELOG. If there is no description, or it does not adequately describe your feature, we may ask you to update
48+
the description.
49+
- All pull requests must comply with the project coding standard (see below). Please ensure your code does, too. _Hint:
50+
run `npm run lint` to check._
51+
- Please **write tests** for any new features you add.
52+
- Please **ensure that tests pass** before submitting your pull request. `wickedbyte/int-to-uuid-ts` automatically runs
53+
tests for pull requests. However, running the tests locally will help save time. _Hint: run `npm test`._
54+
- **Use topic/feature branches.** Please do not ask to pull from your main branch. - For more information,
55+
see "[Understanding the GitHub flow][gh-flow]."
56+
- **Submit one feature per pull request.** If you have multiple features you wish to submit, please break them into
57+
separate pull requests.
58+
59+
## Developing
60+
61+
To develop this project, you will need [Node.js](https://nodejs.org) 20 or greater and [npm](https://www.npmjs.com).
62+
63+
After cloning this repository locally, execute the following commands:
64+
65+
```bash
66+
cd /path/to/repository
67+
npm install
68+
npm test
69+
```
70+
71+
The full suite of code quality tools can be run with:
72+
73+
```bash
74+
npm run typecheck && npm run lint && npm test
75+
```
76+
77+
### Static Analysis
78+
79+
This project uses [TypeScript](https://www.typescriptlang.org) for static type checking. You may run type checking
80+
manually across the whole codebase with the following command:
81+
82+
```bash
83+
# Static analysis
84+
npm run typecheck
85+
```
86+
87+
### Coding Standards
88+
89+
This project uses [ESLint](https://eslint.org) for linting and [Prettier](https://prettier.io) for code formatting.
90+
91+
```bash
92+
# Run the code standards linter
93+
npm run lint
94+
95+
# Attempt to auto-fix coding standards issues
96+
npm run lint -- --fix
97+
98+
# Run the code formatter
99+
npm run format
100+
```
101+
102+
### Running Tests
103+
104+
The following must pass before we will accept a pull request. If this does not pass, it will result in a complete build
105+
failure. Before you can run this, be sure to `npm install`.
106+
107+
To run all the tests and coding standards checks, execute the following from the command line, while in the project root
108+
directory:
109+
110+
```
111+
npm test
112+
```
113+
114+
[github]: https://github.com/wickedbyte/int-to-uuid-ts
115+
[issues]: https://github.com/wickedbyte/int-to-uuid-ts/issues
116+
[pull requests]: https://github.com/wickedbyte/int-to-uuid-ts/pulls
117+
[gh-flow]: https://guides.github.com/introduction/flow/

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025-2026 WickedByte
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

0 commit comments

Comments
 (0)