Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pushgateway type def #469

Merged
merged 7 commits into from
Sep 30, 2021

Conversation

adilhafeez
Copy link
Contributor

@adilhafeez adilhafeez commented Sep 30, 2021

Update pushgateway typedef to reflect javascript implementation

const { resp, body } = await pushGateway.push({
  jobName: serviceName,
});
console.log(body);
console.log(`${resp.statusCode}`);

output


200

Update pushgateway typedef to reflect javascript implementation
@adilhafeez
Copy link
Contributor Author

ptal @PierrickP / @siimon

index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
@PierrickP
Copy link
Contributor

:\ indeed i did not update the typedef (sorry) as i'm not using it.
How can we test / unit test it for futurs update ?

@SimenB
Copy link
Collaborator

SimenB commented Sep 30, 2021

We could add tsd or something

adilhafeez and others added 2 commits September 30, 2021 09:38
Co-authored-by: Simen Bekkhus <sbekkhus91@gmail.com>
@adilhafeez
Copy link
Contributor Author

@siimon I added tsd-check but seems like github won't allow me to create another workflow

Here is the error I got,

 ! [remote rejected] fix_pushgateaway_typedef -> fix_pushgateaway_typedef (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/nodejs.yml` without `workflow` scope)

Here is the patch,

diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 6d35657..6051440 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -40,3 +40,5 @@ jobs:
         run: npm i
       - name: Test
         run: npm run test
+      - name: TSD Check
+        run: npx tsd-check
diff --git a/index.test-d.ts b/index.test-d.ts
new file mode 100644
index 0000000..e28823b
--- /dev/null
+++ b/index.test-d.ts
@@ -0,0 +1,17 @@
+import { Pushgateway } from './index';
+
+const pushGateway = new Pushgateway('');
+pushGateway.push({ jobName: '' }).then(({ resp, body }) => {
+       console.log(resp);
+       console.log(body);
+});
+
+pushGateway.pushAdd({ jobName: '' }).then(({ resp, body }) => {
+       console.log(resp);
+       console.log(body);
+});
+
+pushGateway.delete({ jobName: '' }).then(({ resp, body }) => {
+       console.log(resp);
+       console.log(body);
+});
diff --git a/package.json b/package.json
index 1bd3f23..0da851b 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,8 @@
                "typescript": "^4.0.2"
        },
        "dependencies": {
-               "tdigest": "^0.1.1"
+               "tdigest": "^0.1.1",
+               "tsd-check": "^0.6.0"
        },
        "types": "./index.d.ts",
        "jest": {

@adilhafeez
Copy link
Contributor Author

@SimenB I missed changelog file. I've added it just now can you pls approve it again? (workflows are blocked)

@adilhafeez
Copy link
Contributor Author

I don't seem to have permission to merge. One of the maintainers need to merge this PR? @SimenB could you help?

@Ghazgkull
Copy link

@zbjornson @SimenB The changes merged in this PR are great, but they still haven't been released. It seems that the package version didn't get bumped. The result is that the promise-based API has been broken/unavailable for Typescript users for some time now. Is it possible to cut a release with this fix please?

@SimenB
Copy link
Collaborator

SimenB commented Nov 2, 2021

https://github.com/siimon/prom-client/releases/tag/v14.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants