Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Feature Request] nanoid support custom alphabet

オープン
#2,348 コメント 9 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #2377 @sanny-io による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
sqlite, typescript
領域
databases

調査の方向性

The request is to let @default(nanoid(16)) in the ZenStack schema draw from a user-supplied alphabet, configured via a new option on ZenStackClient (shown next to SqliteDialect in the body). Start by locating where the nanoid default is resolved and where client options are declared, then thread a nanoidCustomAlphabet value through to the ID generator so existing nanoid(n) usage keeps working. Done means the schema default honors the configured alphabet and the behaviour is covered by a test; note that a linked pull request (#2377) was closed unmerged and the thread has been silent for months, so confirm the desired API with maintainers before starting.

索引モデルが issue の本文から書いたものです。

説明

Most of the time, we need to define a special business ID field for models, such as post_id or user_id. We often choose UUID or nanoid for generating these IDs. However, when using nanoid, we found that it cannot meet our requirements because it defaults to generating IDs with uppercase letters and numbers. Sometimes we prefer IDs in lowercase letters and numbers, which nanoid cannot handle. As a result, we are forced to set the ID field as non‑nullable and generate a compliant ID in the code layer when creating records.

This is not an ideal practice. Providing a custom alphabet feature for nanoid would help reduce this mental overhead. Moreover, I believe the optimal API design would be:

  • Keep the usage as is:
    @default(nanoid(16))

  • Add an optional parameter when creating the client:

export const db = new ZenStackClient(schema, {
    dialect: new SqliteDialect({
        database: new SQLite(':memory:'),
    }),
    nanoidCustomAlphabet: "1234567890abcdef"
});
主要言語
TypeScript
スター
2.9k
フォーク
157
平均マージ
2日 46分
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

zenstackhq/zenstack のほかの issue

zenstackhq/zenstack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。