@theholocron/postman-client 1.58.0-alpha.2 → 1.58.0-alpha.4

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/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import "@theholocron/http-client";
2
2
  import { ErrorSink, Logger } from "@theholocron/observability/core";
3
+ /** Options for `createPostmanClient`. */
3
4
  interface PostmanClientOptions {
4
5
  /** Postman API key. */
5
6
  token: string;
@@ -12,57 +13,97 @@ interface PostmanClientOptions {
12
13
  /** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
13
14
  errors?: ErrorSink;
14
15
  }
16
+ /** A Postman collection, as listed by the API. */
15
17
  interface PostmanCollection {
18
+ /** The collection's id. */
16
19
  id: string;
20
+ /** The collection's unique id, prefixed with its owner's id. */
17
21
  uid: string;
22
+ /** The collection's name. */
18
23
  name: string;
19
24
  }
25
+ /** The response of listing collections. */
20
26
  interface PostmanCollectionsResponse {
27
+ /** The collections returned. */
21
28
  collections: PostmanCollection[];
22
29
  }
30
+ /** A Postman environment, as listed by the API. */
23
31
  interface PostmanEnvironment {
32
+ /** The environment's id. */
24
33
  id: string;
34
+ /** The environment's unique id, prefixed with its owner's id. */
25
35
  uid: string;
36
+ /** The environment's name. */
26
37
  name: string;
27
38
  }
39
+ /** The response of listing environments. */
28
40
  interface PostmanEnvironmentsResponse {
41
+ /** The environments returned. */
29
42
  environments: PostmanEnvironment[];
30
43
  }
44
+ /** The response of fetching or creating one environment. */
31
45
  interface PostmanEnvironmentResponse {
46
+ /** The environment. */
32
47
  environment: PostmanEnvironment;
33
48
  }
49
+ /** The response of importing an OpenAPI definition. */
34
50
  interface PostmanImportOpenApiResponse {
51
+ /** The collections the import created. */
35
52
  collections: PostmanCollection[];
36
53
  }
54
+ /** The user the API key belongs to. */
37
55
  interface PostmanUser {
56
+ /** The user's id. */
38
57
  id?: number | string;
58
+ /** The user's username. */
39
59
  username?: string;
60
+ /** The user's email address. */
40
61
  email?: string;
62
+ /** The user's full name. */
41
63
  fullName?: string;
42
64
  }
65
+ /** The response of fetching the current user. */
43
66
  interface PostmanMeResponse {
67
+ /** The user. */
44
68
  user?: PostmanUser;
45
69
  }
70
+ /** A Postman API specification, as listed by the API. */
46
71
  interface PostmanSpec {
72
+ /** The specification's id. */
47
73
  id: string;
74
+ /** The specification's name. */
48
75
  name: string;
76
+ /** The specification's type. */
49
77
  type: string;
50
78
  }
79
+ /** The response of listing specifications. */
51
80
  interface PostmanSpecsResponse {
81
+ /** The specifications returned. */
52
82
  specs: PostmanSpec[];
53
83
  }
84
+ /** What to send to Postman to create a specification. */
54
85
  interface PostmanCreateSpecInput {
86
+ /** The specification's name. */
55
87
  name: string;
88
+ /** The specification's content, as a string. */
56
89
  fileContent: string;
90
+ /** The specification's type, when set. */
57
91
  type?: string;
92
+ /** The path of the specification's file, when set. */
58
93
  filePath?: string;
59
94
  }
95
+ /** A Postman workspace, as listed by the API. */
60
96
  interface PostmanWorkspace {
97
+ /** The workspace's id. */
61
98
  id: string;
99
+ /** The workspace's name. */
62
100
  name: string;
101
+ /** The workspace's type. */
63
102
  type: string;
64
103
  }
104
+ /** The response of listing workspaces. */
65
105
  interface PostmanWorkspacesResponse {
106
+ /** The workspaces returned. */
66
107
  workspaces: PostmanWorkspace[];
67
108
  }
68
109
  /**
@@ -70,12 +111,21 @@ interface PostmanWorkspacesResponse {
70
111
  * account hitting the "0 APIs" cap).
71
112
  */
72
113
  export declare class PostmanPlanLimitError extends Error {
114
+ /** Postman's message about the plan limit. */
73
115
  readonly limitMessage: string;
116
+ /** The raw response body Postman returned. */
74
117
  readonly body: string;
118
+ /** The error's name, `"PostmanPlanLimitError"`. */
75
119
  name: string;
76
- constructor(limitMessage: string, body: string);
120
+ constructor(
121
+ /** Postman's message about the plan limit. */
122
+ limitMessage: string,
123
+ /** The raw response body Postman returned. */
124
+ body: string);
77
125
  }
126
+ /** Returns the message of a `limitReachedError` in a Postman response body, or `null` when the body is not one (or is not JSON). */
78
127
  export declare function detectPlanLimit(body: string): string | null;
128
+ /** Creates a Postman client with `collections`, `environments`, `import`, `me`, `specs` and `workspaces` groups sharing one REST client. */
79
129
  export declare function createPostmanClient(opts: PostmanClientOptions): {
80
130
  collections: {
81
131
  list: (workspaceId: string) => Promise<PostmanCollectionsResponse>;
@@ -101,5 +151,6 @@ export declare function createPostmanClient(opts: PostmanClientOptions): {
101
151
  list: () => Promise<PostmanWorkspacesResponse>;
102
152
  };
103
153
  };
154
+ /** The client `createPostmanClient` returns. */
104
155
  export type PostmanClient = ReturnType<typeof createPostmanClient>;
105
156
  export type { PostmanClientOptions, PostmanCollection, PostmanCollectionsResponse, PostmanCreateSpecInput, PostmanEnvironment, PostmanEnvironmentResponse, PostmanEnvironmentsResponse, PostmanImportOpenApiResponse, PostmanMeResponse, PostmanSpec, PostmanSpecsResponse, PostmanUser, PostmanWorkspace, PostmanWorkspacesResponse };
package/dist/index.mjs CHANGED
@@ -66,6 +66,7 @@ function specs(rest) {
66
66
  var PostmanPlanLimitError = class extends Error {
67
67
  limitMessage;
68
68
  body;
69
+ /** The error's name, `"PostmanPlanLimitError"`. */
69
70
  name = "PostmanPlanLimitError";
70
71
  constructor(limitMessage, body) {
71
72
  super(limitMessage);
@@ -73,6 +74,7 @@ var PostmanPlanLimitError = class extends Error {
73
74
  this.body = body;
74
75
  }
75
76
  };
77
+ /** Returns the message of a `limitReachedError` in a Postman response body, or `null` when the body is not one (or is not JSON). */
76
78
  function detectPlanLimit(body) {
77
79
  try {
78
80
  const parsed = JSON.parse(body);
@@ -113,6 +115,7 @@ function workspaces(rest) {
113
115
  return { list: () => rest.request("/workspaces") };
114
116
  }
115
117
  // src/index.ts
118
+ /** Creates a Postman client with `collections`, `environments`, `import`, `me`, `specs` and `workspaces` groups sharing one REST client. */
116
119
  function createPostmanClient(opts) {
117
120
  const rest = createPostmanRestClient(opts);
118
121
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/postman-client",
3
- "version": "1.58.0-alpha.2",
3
+ "version": "1.58.0-alpha.4",
4
4
  "description": "A TypeScript client for the Postman API",
5
5
  "keywords": [
6
6
  "postman",
@@ -31,7 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@theholocron/http-client": "^1.58.0-alpha.2",
34
+ "@theholocron/http-client": "^1.58.0-alpha.4",
35
35
  "@theholocron/observability": "^0.6.1-alpha.1"
36
36
  },
37
37
  "devDependencies": {
@@ -44,10 +44,10 @@
44
44
  "tsdown": "^0.23.3",
45
45
  "typescript": "^5.9.3",
46
46
  "vitest": "^5.0.5",
47
- "@theholocron/tsconfig": "^8.9.0-alpha.3",
48
- "@theholocron/tsdown-config": "^8.9.0-alpha.3",
49
- "@theholocron/vitest-config": "^8.9.0-alpha.3",
50
- "@theholocron/eslint-config": "^8.9.0-alpha.3"
47
+ "@theholocron/tsconfig": "^8.9.0-alpha.5",
48
+ "@theholocron/vitest-config": "^8.9.0-alpha.5",
49
+ "@theholocron/tsdown-config": "^8.9.0-alpha.5",
50
+ "@theholocron/eslint-config": "^8.9.0-alpha.5"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=22.0.0"