gocreative-dockerhub-image 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/index.js +31 -0
- package/package.json +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Colin Hughes / GoCreative AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# gocreative-dockerhub-image
|
|
2
|
+
|
|
3
|
+
Tiny Node helper to look up Docker Hub image metadata (pulls, stars, tags) by owner/image via the GoCreative AI pay-per-call API. Bring your own gck_ API key or use the free demo tier (5/day per IP). For full multi-endpoint coverage install the unified `gocreative` package.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install gocreative-dockerhub-image
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 30-second quickstart
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
const { lookup } = require("gocreative-dockerhub-image");
|
|
15
|
+
|
|
16
|
+
(async () => {
|
|
17
|
+
// Free demo tier (no key needed, 5 calls/day per IP):
|
|
18
|
+
console.log(await lookup("library/nginx"));
|
|
19
|
+
|
|
20
|
+
// Or with a paid API key:
|
|
21
|
+
console.log(await lookup("library/nginx", { apiKey: "gck_your_key_here" }));
|
|
22
|
+
})();
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You can also set `GOCREATIVE_API_KEY=gck_...` in your environment.
|
|
26
|
+
|
|
27
|
+
## What this returns
|
|
28
|
+
|
|
29
|
+
A JSON object with Docker Hub image metadata fetched live from the GoCreative AI API.
|
|
30
|
+
|
|
31
|
+
## Need more endpoints?
|
|
32
|
+
|
|
33
|
+
This package wraps just **one** GoCreative endpoint. For the full SDK with
|
|
34
|
+
enrich / lookup / scrape / search across 145+ endpoints, install:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install gocreative
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Powered by **GoCreative AI** — free tier 5 calls/day, paid plans at
|
|
41
|
+
<https://api.gocreativeai.com/credits/buy>.
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// gocreative-dockerhub-image — narrow GoCreative AI helper. https://api.gocreativeai.com
|
|
2
|
+
const BASE_URL = "https://api.gocreativeai.com";
|
|
3
|
+
const USER_AGENT = "gocreative-dockerhub-image/0.1.0";
|
|
4
|
+
|
|
5
|
+
class GoCreativeError extends Error {}
|
|
6
|
+
|
|
7
|
+
async function lookup(ownerImage, opts = {}) {
|
|
8
|
+
const apiKey = opts.apiKey || process.env.GOCREATIVE_API_KEY || null;
|
|
9
|
+
const timeout = opts.timeout || 30000;
|
|
10
|
+
const headers = { "User-Agent": USER_AGENT, "Accept": "application/json" };
|
|
11
|
+
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
|
12
|
+
const encoded = String(ownerImage).split("/").map(encodeURIComponent).join("/");
|
|
13
|
+
const ctl = new AbortController();
|
|
14
|
+
const t = setTimeout(() => ctl.abort(), timeout);
|
|
15
|
+
const fetchOnce = (url) => fetch(url, { headers, signal: ctl.signal });
|
|
16
|
+
try {
|
|
17
|
+
let r = await fetchOnce(`${BASE_URL}/v1/lookup/dockerhub/${encoded}`);
|
|
18
|
+
if (r.status === 402 && !apiKey) {
|
|
19
|
+
r = await fetchOnce(`${BASE_URL}/demo/dockerhub/${encoded}`);
|
|
20
|
+
}
|
|
21
|
+
if (r.status >= 400) {
|
|
22
|
+
const text = await r.text().catch(() => "");
|
|
23
|
+
throw new GoCreativeError(`HTTP ${r.status}: ${text.slice(0, 300)}`);
|
|
24
|
+
}
|
|
25
|
+
const ct = r.headers.get("content-type") || "";
|
|
26
|
+
return ct.includes("application/json") ? r.json() : { raw: await r.text() };
|
|
27
|
+
} finally { clearTimeout(t); }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { lookup, GoCreativeError };
|
|
31
|
+
module.exports.default = lookup;
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gocreative-dockerhub-image",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Tiny Node helper to look up Docker Hub image metadata (pulls, stars, tags) by owner/image via the GoCreative AI pay-per-call API. Bring your own gck_ API key or use the free demo tier (5/day per IP). For full multi-endpoint coverage install the unified `gocreative` package.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"index.js",
|
|
8
|
+
"README.md",
|
|
9
|
+
"LICENSE"
|
|
10
|
+
],
|
|
11
|
+
"keywords": [
|
|
12
|
+
"docker",
|
|
13
|
+
"dockerhub",
|
|
14
|
+
"docker-hub",
|
|
15
|
+
"docker-image",
|
|
16
|
+
"container",
|
|
17
|
+
"gocreative",
|
|
18
|
+
"ai-agents"
|
|
19
|
+
],
|
|
20
|
+
"author": "Colin Hughes <contact@gocreativeai.com>",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"homepage": "https://api.gocreativeai.com",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
}
|
|
26
|
+
}
|