Installations
npm install @maxim_mazurok/gapi.client.acmedns-v1
Releases
Unable to fetch releases
Developer
Maxim-Mazurok
Developer Guide
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Yes
Node Version
20.10.0
NPM Version
10.2.3
Statistics
49 Stars
2,372 Commits
10 Forks
4 Watching
18 Branches
7 Contributors
Updated on 24 Nov 2024
Languages
TypeScript (99.21%)
JavaScript (0.54%)
Shell (0.26%)
Total Downloads
Cumulative downloads
Total Downloads
87,862
Last day
0.7%
144
Compared to previous day
Last week
32%
1,221
Compared to previous week
Last month
-1.2%
4,419
Compared to previous month
Last year
280.8%
69,588
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
google-api-typings-generator
Generate TypeScript type definitions for all Google APIs, using Google API discovery service.
Meant to be used with Google APIs JavaScript Browser Client, aka gapi
.
Not to be mistaken with NodeJS Server Client which is already in TS; details
Fork Log:
- ⚠️ This is the only maintained repo for GAPI type definitions (forked and detached from Bolisov/google-api-typings-generator)
- 🤖 Auto updates every hour; details
- Supports both
resource
and second-argument approaches; details - Includes empty interfaces; details
- Works for arrays, aka
"repeated": true
; details - System proxy support (see Azure/get-proxy-settings)
- Other minor fixes and updates
Usage
Generating types
-
Use the supported Node version via Node Version Manager:
1nvm install
-
Install dependencies:
1npm install
-
Generate type definitions for:
-
all discovered Google APIs:
1npm start
Some APIs are disabled or not fully developed yet, so some expected errors might be output.
-
one service by name:
1npm start "--" --service sheets
where
sheets
is the name of the Google Sheets service. -
one service by URL:
1npm start "--" --url "https://sheets.googleapis.com/$discovery/rest?version=v4"
Note that we have to use
$
- full-width dollar sign instead of the regular$
, it will be replaced by the script, this is to avoid complications with escaping of$discovery
.
-
Compiling project
1npm run compile
1node dist/cli.js --out ./types
Running tests
Tests are run automatically in practice via GitHub Actions continuous integration.
Syncing gapi client namespace in DT with available APIs
Here's how to sync (add new and remove obsolete) Google APIs to/from @types/gapi.client.* namespace in DefinitelyTyped:
- Make sure that this project, DefinitelyTyped/DefinitelyTyped, and microsoft/DefinitelyTyped-tools are all in the home directory on Linux:
~
- Ensure that both DT and DT-tools are reset to latest master
npm run apis-sync-helper
will update allowed list in DT-tools (only adds new packages and removes ones that are no longer in DT)npm run start-dt
will update DT- Open PR to DT-tools
- Wait for it to get merged
- Open PR to DT
- Once it's merged - all done, rinse and repeat in a few months or so.
Ideally, this should be automated in #401
Lint
The generated type definitions are linted via dtslint
, mimicking
DefinitelyTyped's process.
A single project can be linted via:
1npm run dtslint types/<project-directory>
All projects can be linted in parallel via:
1GAPI_MAX_PARALLEL=3 npm run lint
Unit (WIP)
Unit tests for this generator project are written with Vitest. They can be run via:
1npm run test
Fixing formatting
This project leverages Google's TypeScript Style (gts) to standardize formatting.
To invoke the automatic code fixer, run:
1npm run fix
Publishing to DefinitelyTypes @types
Do not publish types to DT directly
We've switched to publishing "real" types to npm as @maxim_mazurok/gapi.client.*
and then referencing them in @types/gapi.client.*
so that we can release updates automatically and quickly, without using too many human resources of DT.
See Syncing gapi client namespace in DT with available APIs section for instructions.
Details
Auto Updates
Every hour, type definitions are generated, linted, tested, and published to NPM.
Resource VS Body
First approach (Resource):
1gapi.client.sheets.spreadsheets.batchUpdate({ 2 spreadsheetId: 'someId', 3 resource: { 4 // Request Body goes here, as part of `request` 5 }, 6});
second approach (Body):
1gapi.client.sheets.spreadsheets.batchUpdate( 2 { 3 spreadsheetId: 'someId', 4 }, 5 { 6 // Request Body goes here, as a second argument 7 } 8);
Both approaches are valid (tested for Google Sheets API), but the first one seems to be the default for JS Client Library.
More info here: google/google-api-javascript-client#432 (comment),
and here: declanvong@bec4f89
#r35992626
NOTE: Some APIs have methods that accept resource
parameter that is not the request body. In that case, we only generate the second approach (details)
Empty interfaces
This fork keeps interfaces even if they are empty to make typings more accurate.
More info here: Maxim-Mazurok/google-api-typings-generator#4
Arrays / repeated values
This fork understands "repeated": true
More info here: Maxim-Mazurok/google-api-typings-generator#1
and here: declanvong@bec4f89
#r35992626
JavaScript VS NodeJS Clients
There are two ways to use Google APIs: on the client-side (in the browser) and on the server-side.
The client-side library, called gapi
is kinda closed-source.
We can see compiled (unreadable minified) JS code of the client-side library.
When you use any Google JS API, you use gapi
. It loads library definitions from Google API Discovery Service
and generates all API calls on the fly.
So, there's no TS version of gapi
because it's closed-source
and other client libraries do not exist, because they are being generated on the fly by gapi
.
If you want to use TypeScript with gapi
- you have to use type definitions generated by this project.
While we do generate typings for Google APIs, we can't generate gapi
typings from discovery, so we rely on
@types/gapi and you also should.
The server-side libraries are open-sourced and are available here. Since they are written in TS, you don't need any additional type definitions to use them.
Troubleshooting
npm install - 404 Not Found
The error looks like this (see #483):
$ npm install @types/gapi.client.YOUR_API@v2 --save-dev
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fgapi.client.YOUR_API - Not found
npm ERR! 404
npm ERR! 404 '@types/gapi.client.YOUR_API@v2' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
It's most likely caused by your API package not being published to NPM yet.
To fix this - open an issue and I'll update the list of supported APIs.
Later on, when #401 is closed - this process will be automated.
Also, you can use these types from the types branch
No vulnerabilities found.
Reason
26 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
SAST tool is run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Info: all commits (30) are checked with a SAST tool
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/add-automerge-label.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/add-automerge-label.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/add-automerge-label.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/add-automerge-label.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-generate.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-generate.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-generate.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-generate.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-generate.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-generate.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-generate.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-generate.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto-generate.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-generate.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-publish.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-publish.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/auto-publish.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/ci-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/ci-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci-test.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/ci-test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-dedupe-update.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/npm-dedupe-update.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-dedupe-update.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/npm-dedupe-update.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/npm-dedupe-update.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/npm-dedupe-update.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/npm-dedupe-update.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/npm-dedupe-update.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/rebase-pull-requests.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Maxim-Mazurok/google-api-typings-generator/rebase-pull-requests.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/npm-dedupe-update.yml:31
- Info: 0 out of 16 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 5 third-party GitHubAction dependencies pinned
- Info: 3 out of 4 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/add-automerge-label.yml:1
- Warn: no topLevel permission defined: .github/workflows/auto-generate.yml:1
- Warn: no topLevel permission defined: .github/workflows/auto-publish.yml:1
- Warn: no topLevel permission defined: .github/workflows/ci-test.yml:1
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/npm-dedupe-update.yml:1
- Warn: no topLevel permission defined: .github/workflows/rebase-pull-requests.yml:1
- Info: no jobLevel write permissions found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
6.1
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More