npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gasboost/auth-sheetorm

v0.3.0

Published

SheetORM repository adapter for @gasboost/auth.

Downloads

615

Readme

@gasboost/auth-sheetorm

@gasboost/auth の Repository を @gasboost/sheetorm で実装する adapter package です。 認証テーブルの論理定義は @gasboost/authSheetTable への具体化は application の Backend が担当します。

Install

pnpm add @gasboost/auth @gasboost/auth-sheetorm @gasboost/sheetorm

Define Shared Tables

Frontend と Backend の両方から参照できる shared module で論理テーブルを定義します。この段階では dbId などの storage 固有設定を含みません。

// src/shared/tables.ts
import { createAuthTables } from "@gasboost/auth";
import { defineTable } from "@gasboost/table";
import { z } from "zod";

export const authTables = createAuthTables();
export const tutorialTable = defineTable({
  name: "tutorial",
  schema: z.object({ id: z.string(), title: z.string() }),
  primaryKey: "id",
});

必要な definition だけを Replica などで再利用できます。

createReplica({
  name: "app",
  tables: [authTables.user, tutorialTable] as const,
});

Build SheetDB

Backend の composition root で shared definition を SheetTable に具体化します。

// src/server/lib/db.ts
import { SheetDB, SheetTable } from "@gasboost/sheetorm";
import { authTables, tutorialTable } from "../../shared/tables";

const userTable = new SheetTable({ ...authTables.user, dbId });
const accountTable = new SheetTable({ ...authTables.account, dbId });
const passwordResetTable = new SheetTable({
  ...authTables.passwordReset,
  dbId,
});
const tutorialSheetTable = new SheetTable({
  ...tutorialTable,
  dbId,
  autoNumbering: "uuid",
});

const tables = [
  userTable,
  accountTable,
  passwordResetTable,
  tutorialSheetTable,
] as const;

export const db = new SheetDB({
  tables,
  gateway,
  cacheService: CacheService,
  utilities: Utilities,
});

Create Repository

Repository は構築済みの SheetDB を唯一のテーブル所有者として利用します。初期化時に tables を重ねて渡す必要はありません。

import { SheetOrmAuthRepository } from "@gasboost/auth-sheetorm";

export const repository = new SheetOrmAuthRepository({
  db,
  schema: authTables.schema,
});

生成した Repository は AppsScriptAuth にそのまま渡せます。

const auth = new AppsScriptAuth({
  repository,
  runtime,
  session: { storageType: "cache" },
  emailPassword: { enabled: true, pepper },
  appsScript: { enabled: true },
});

Authorization assignment も同じ流れで SheetOrmAuthorizationRepository を利用できます。permission vocabulary や role definition は保存せず、createAuthorizationTables() が作る assignment table だけを SheetTable に具体化します。

import { createAuthorizationTables } from "@gasboost/auth";
import { SheetOrmAuthorizationRepository } from "@gasboost/auth-sheetorm";

export const authorizationTables = createAuthorizationTables();

const authorizationRoleTable = new SheetTable({
  ...authorizationTables.role,
  dbId,
});
const authorizationPermissionTable = new SheetTable({
  ...authorizationTables.permission,
  dbId,
});

export const authorizationRepository = new SheetOrmAuthorizationRepository({
  db,
  schema: authorizationTables.schema,
});

Customize Tables

model name と physical field name は createAuthTables() の plain object で変更できます。解決済み mapping は authTables.schema から取得するため、Repository 用に同じ設定を再記述する必要はありません。

export const authTables = createAuthTables({
  user: {
    modelName: "authUsers",
    fields: { id: "userId", name: "displayName" },
  },
  account: { modelName: "authAccounts" },
  passwordReset: { modelName: "authPasswordResets" },
});

Responsibilities

@gasboost/auth-sheetorm は User、Account、PasswordReset の hydrate / persist と transaction 境界を担当します。テーブル定義、SheetTable の生成、認証ロジック、password hashing、session management、routing、frontend UI は担当しません。