@theholocron/postman-client 1.3.5 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.mjs +50 -50
  2. package/package.json +11 -11
package/dist/index.mjs CHANGED
@@ -1,4 +1,54 @@
1
1
  import { createRestClient } from "@theholocron/http-client";
2
+ //#region src/errors.ts
3
+ /**
4
+ * Thrown when Postman returns a `limitReachedError` (e.g., a Free-tier
5
+ * account hitting the "0 APIs" cap).
6
+ */
7
+ var PostmanPlanLimitError = class extends Error {
8
+ limitMessage;
9
+ body;
10
+ name = "PostmanPlanLimitError";
11
+ constructor(limitMessage, body) {
12
+ super(limitMessage);
13
+ this.limitMessage = limitMessage;
14
+ this.body = body;
15
+ }
16
+ };
17
+ function detectPlanLimit(body) {
18
+ try {
19
+ const parsed = JSON.parse(body);
20
+ if (parsed.error?.name === "limitReachedError" && parsed.error.message) return parsed.error.message;
21
+ } catch {}
22
+ return null;
23
+ }
24
+ //#endregion
25
+ //#region src/utils.ts
26
+ function createPostmanRestClient(opts) {
27
+ const base = createRestClient({
28
+ baseUrl: opts.baseUrl ?? "https://api.getpostman.com",
29
+ token: opts.token,
30
+ tokenScheme: "apikey",
31
+ apiKeyHeader: "x-api-key",
32
+ vendor: "Postman",
33
+ fetch: opts.fetch
34
+ });
35
+ return {
36
+ baseUrl: base.baseUrl,
37
+ async request(path, reqOpts) {
38
+ try {
39
+ return await base.request(path, reqOpts);
40
+ } catch (err) {
41
+ const details = err.details;
42
+ if (typeof details === "string") {
43
+ const limit = detectPlanLimit(details);
44
+ if (limit) throw new PostmanPlanLimitError(limit, details);
45
+ }
46
+ throw err;
47
+ }
48
+ }
49
+ };
50
+ }
51
+ //#endregion
2
52
  //#region src/collections/collections.ts
3
53
  function collections(rest) {
4
54
  return {
@@ -63,56 +113,6 @@ function specs(rest) {
63
113
  };
64
114
  }
65
115
  //#endregion
66
- //#region src/errors.ts
67
- /**
68
- * Thrown when Postman returns a `limitReachedError` (e.g., a Free-tier
69
- * account hitting the "0 APIs" cap).
70
- */
71
- var PostmanPlanLimitError = class extends Error {
72
- limitMessage;
73
- body;
74
- name = "PostmanPlanLimitError";
75
- constructor(limitMessage, body) {
76
- super(limitMessage);
77
- this.limitMessage = limitMessage;
78
- this.body = body;
79
- }
80
- };
81
- function detectPlanLimit(body) {
82
- try {
83
- const parsed = JSON.parse(body);
84
- if (parsed.error?.name === "limitReachedError" && parsed.error.message) return parsed.error.message;
85
- } catch {}
86
- return null;
87
- }
88
- //#endregion
89
- //#region src/utils.ts
90
- function createPostmanRestClient(opts) {
91
- const base = createRestClient({
92
- baseUrl: opts.baseUrl ?? "https://api.getpostman.com",
93
- token: opts.token,
94
- tokenScheme: "apikey",
95
- apiKeyHeader: "x-api-key",
96
- vendor: "Postman",
97
- fetch: opts.fetch
98
- });
99
- return {
100
- baseUrl: base.baseUrl,
101
- async request(path, reqOpts) {
102
- try {
103
- return await base.request(path, reqOpts);
104
- } catch (err) {
105
- const details = err.details;
106
- if (typeof details === "string") {
107
- const limit = detectPlanLimit(details);
108
- if (limit) throw new PostmanPlanLimitError(limit, details);
109
- }
110
- throw err;
111
- }
112
- }
113
- };
114
- }
115
- //#endregion
116
116
  //#region src/workspaces/workspaces.ts
117
117
  function workspaces(rest) {
118
118
  return { list: () => rest.request("/workspaces") };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/postman-client",
3
- "version": "1.3.5",
3
+ "version": "1.5.0",
4
4
  "description": "A TypeScript client for the Postman API",
5
5
  "homepage": "https://github.com/theholocron/clients/tree/main/packages/postman-client#readme",
6
6
  "bugs": "https://github.com/theholocron/clients/issues",
@@ -29,21 +29,21 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@theholocron/http-client": "^1.3.5"
32
+ "@theholocron/http-client": "^1.5.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/node": "^26.1.1",
36
- "@theholocron/eslint-config": "^7.6.0",
37
- "@theholocron/tsconfig": "^7.4.1",
38
- "@theholocron/tsdown-config": "^7.4.1",
39
- "@theholocron/vitest-config": "^7.4.1",
35
+ "@types/node": "^26.1.2",
36
+ "@theholocron/eslint-config": "^7.6.1",
37
+ "@theholocron/tsconfig": "^7.6.1",
38
+ "@theholocron/tsdown-config": "^7.6.1",
39
+ "@theholocron/vitest-config": "^7.6.1",
40
40
  "@vitest/coverage-v8": "^4.1.10",
41
- "@vitest/eslint-plugin": "^1.6.23",
42
- "eslint": "^10.7.0",
41
+ "@vitest/eslint-plugin": "^1.6.24",
42
+ "eslint": "^10.8.0",
43
43
  "eslint-plugin-n": "^18.2.2",
44
44
  "eslint-plugin-simple-import-sort": "^14.0.0",
45
- "globals": "^17.7.0",
46
- "tsdown": "^0.22.13",
45
+ "globals": "^17.8.0",
46
+ "tsdown": "^0.22.14",
47
47
  "typescript": "^5.9.3",
48
48
  "vitest": "^4.1.10"
49
49
  },