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

@c6fc/spellcraft-gcp-auth

v1.0.1

Published

A plugin to add functionality via @c6fc/spellcraft

Downloads

196

Readme

SpellCraft @c6fc/spellcraft-gcp-auth Module

NPM version License

Seamlessly integrate Google APIs Node.js Client into your SpellCraft SpellFrames. This plugin allows you to natively expose authenticated GCP contexts and identity impersonation to your SpellFrames, and use the full power of the APIs in both JavaScript native functions and JSonnet.

npm install --save @c6fc/spellcraft @c6fc/spellcraft-gcp-auth

This module will use credential sources in the same order as the API Library for JavaScript, with service account impersonation happening after the priority credential source is identified.

# Show your current gcloud credential context
npx spellcraft gcp-identity

{
	identity: '[email protected]',
	projectId: 'purple-giggletron-121405',
	scopes: [
		'https://www.googleapis.com/auth/cloud-platform',
		'https://www.googleapis.com/auth/sqlservice.login',
		'https://www.googleapis.com/auth/userinfo.email',
		'openid'
	],
	expiresIn: 3599,
	authType: 'User/Authorized Account',
	impersonatedBy: null
}

You can perform service account impersonation using this initial context to chain into a different deployment role by setting the SPELLFRAME_GCP_IMPERSONATE envvar:

export SPELLFRAME_GCP_IMPERSONATE="terraform-deploy@purple-giggletron-121405.iam.gserviceaccount.com"

# See the new assumerole credential context:
npx spellcraft gcp-identity

[+] Impersonating GCP Service Account: terraform-deploy@purple-giggletron-121405.iam.gserviceaccount.com
{
	identity: 'terraform-deploy@purple-giggletron-121405.iam.gserviceaccount.com',
	projectId: 'purple-giggletron-121405',
	scopes: [ 'https://www.googleapis.com/auth/cloud-platform' ],
	expiresIn: 3599,
	authType: 'Impersonated Service Account',
	impersonatedBy: 'Local ADC/Key'
}

Features

  • Authenticate to GCP with native means, as well as role assumptions with SPELLFRAME_GCP_IMPERSONATE
  • Provide an authenticated google instance to function contexts.
  • Expose all googleapis clients and methods directly to JSonnet.

CLI Commands

  • spellcraft gcp-identity Display the GCP identity of the SpellCraft execution context

SpellFrame 'init()' features

Extends the SpellFrame's init() to include obtaining GCP credentials, and optionally performing service account impersonation, before instantiating the Google APIs Node.js Client.

JavaScript context features

Exposes this.google for all native function executions, which is an authenticated Google APIs Node.js Client

API Reference

getProjectId()

Returns the default Project ID from the environment


api(fullpath, params={ project: gcp.getProjectId()

Generic GCP API Call

  • param {string} path - A dot-delimited path of ..<...method> (e.g. 'compute.v1.zones.list' or 'storage.v1.buckets.list')
  • param {object} params - The request parameters

listBuckets(params={ project: gcp.getProjectId()

Shortcut for Cloud Storage


listInstances(params={ project: gcp.getProjectId()

Shortcut for Compute Instances


assertProject(expectedId)

Termination check to ensure we are in the right project


Installation

Install the plugin as a dependency in your SpellCraft project:

npm install --save @c6fc/spellcraft-gcp-auth

Then import the module into your Jsonnet code and use it.

local gcp = import "@c6fc/spellcraft-gcp-auth/module.jsonnet";

{
	'identity.json': {
		gcp: gcp.getCallerIdentity()
	}
}