@theholocron/holocron-plugin-postman 2.0.0-alpha.0 → 2.0.0-alpha.1

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/README.md CHANGED
@@ -3,6 +3,12 @@
3
3
  Postman plugin for [Holocron](../cli). Implements the **multi-cardinality**
4
4
  `tooling` capability against [Postman's REST API](https://learning.postman.com/docs/developer/postman-api/).
5
5
 
6
+ ## Install
7
+
8
+ ```bash
9
+ pnpm add -D @theholocron/holocron-plugin-postman@alpha
10
+ ```
11
+
6
12
  ## Why REST, not the CLI
7
13
 
8
14
  Postman ships a CLI (`postman`, the newer + more capable successor to
@@ -19,24 +25,27 @@ Token resolution order:
19
25
  2. `HOLOCRON_POSTMAN_API_KEY` env var
20
26
  3. `POSTMAN_API_KEY` env var (Postman's own standard)
21
27
 
22
- Generate the key at https://web.postman.co/settings/me/api-keys.
28
+ Generate the key at <https://web.postman.co/settings/me/api-keys>.
23
29
 
24
30
  ## Config
25
31
 
26
32
  ```jsonc
27
33
  {
28
- "providers": {
29
- "tooling": [
30
- ["postman", {
31
- "workspaceId": "00000000-0000-0000-0000-000000000000",
32
- "specFile": "apps/api/openapi.json",
33
- "specName": "Rando API",
34
- "collectionName": "Rando API",
35
- "envFiles": ["apps/api/postman-env-staging.json"]
36
- }],
37
- "storybook"
38
- ]
39
- }
34
+ "providers": {
35
+ "tooling": [
36
+ [
37
+ "postman",
38
+ {
39
+ "workspaceId": "00000000-0000-0000-0000-000000000000",
40
+ "specFile": "apps/api/openapi.json",
41
+ "specName": "Rando API",
42
+ "collectionName": "Rando API",
43
+ "envFiles": ["apps/api/postman-env-staging.json"],
44
+ },
45
+ ],
46
+ "storybook",
47
+ ],
48
+ },
40
49
  }
41
50
  ```
42
51
 
@@ -48,27 +57,30 @@ Generate the key at https://web.postman.co/settings/me/api-keys.
48
57
 
49
58
  ## What's implemented
50
59
 
51
- | Method | What it does |
52
- | ---------------------------- | ------------------------------------------------------------- |
53
- | **Tooling interface** | |
54
- | `sync()` | Reads `specFile`, upserts the Spec Hub spec, delete-then-imports the collection, find-or-creates each env in `envFiles`. |
55
- | `doctor()` | Probes `/me` + `/workspaces`; returns `{ ok, message }`. |
56
- | **Postman-specific methods** (on `PostmanTooling`, not on the `Tooling` interface) | |
57
- | `getMyself` | `GET /me` — authed user identity. |
58
- | `listWorkspaces` | `GET /workspaces`. |
59
- | `findCollectionByName` | `GET /collections?workspace=…` + name filter. |
60
- | `deleteCollection` | `DELETE /collections/{uid}`. |
61
- | `importOpenApi` | `POST /import/openapi?workspace=…` with the spec stringified into `{ type: "string", input }`. |
62
- | `findEnvironmentByName` | `GET /environments?workspace=…` + name filter. |
63
- | `createEnvironment` | `POST /environments?workspace=…`. |
64
- | `updateEnvironment` | `PUT /environments/{uid}`. |
65
- | `findSpecByName` | `GET /specs?workspaceId=…` + name filter. |
66
- | `createSpec` | `POST /specs?workspaceId=…` (flat body — name/type are NOT wrapped under `spec`). |
67
- | `upsertSpecFile` | `PATCH /specs/{id}/files/{path}` (PUT returns 404 here). |
60
+ | Method | What it does |
61
+ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
62
+ | **Tooling interface** | |
63
+ | `sync()` | Reads `specFile`, upserts the Spec Hub spec, delete-then-imports the collection, find-or-creates each env in `envFiles`. |
64
+ | `doctor()` | Probes `/me` + `/workspaces`; returns `{ ok, message }`. |
65
+ | **Postman-specific methods** (on `PostmanTooling`, not on the `Tooling` interface) | |
66
+ | `getMyself` | `GET /me` — authed user identity. |
67
+ | `listWorkspaces` | `GET /workspaces`. |
68
+ | `findCollectionByName` | `GET /collections?workspace=…` + name filter. |
69
+ | `deleteCollection` | `DELETE /collections/{uid}`. |
70
+ | `importOpenApi` | `POST /import/openapi?workspace=…` with the spec stringified into `{ type: "string", input }`. |
71
+ | `findEnvironmentByName` | `GET /environments?workspace=…` + name filter. |
72
+ | `createEnvironment` | `POST /environments?workspace=…`. |
73
+ | `updateEnvironment` | `PUT /environments/{uid}`. |
74
+ | `findSpecByName` | `GET /specs?workspaceId=…` + name filter. |
75
+ | `createSpec` | `POST /specs?workspaceId=…` (flat body — name/type are NOT wrapped under `spec`). |
76
+ | `upsertSpecFile` | `PATCH /specs/{id}/files/{path}` (PUT returns 404 here). |
68
77
 
69
78
  ## Status
70
79
 
71
- **v0.0.0 — first port.** Surface matches Rando's `adapters/postman.ts`.
80
+ **`v2.0.0-alpha.0`**published on npm under the `alpha` dist-tag.
81
+ [Release notes](https://github.com/theholocron/holocron/releases/tag/v2.0.0-alpha.0).
82
+ APIs may still shift before stable v2.0.0.
83
+
72
84
  `PostmanPlanLimitError` is thrown when Postman responds with
73
85
  `limitReachedError` (e.g., Free-tier "0 APIs" cap) — callers can
74
86
  discriminate to render "upgrade required" instead of a raw API dump.
package/dist/index.d.mts CHANGED
@@ -35,7 +35,7 @@ interface RestClientOptions {
35
35
  baseUrl?: string;
36
36
  }
37
37
  interface RequestOptions {
38
- method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
38
+ method?: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
39
39
  body?: unknown;
40
40
  query?: Record<string, string>;
41
41
  }
package/dist/index.mjs CHANGED
@@ -281,7 +281,9 @@ var PostmanRestClient = class {
281
281
  constructor(opts) {
282
282
  this.token = opts.token;
283
283
  this.fetchImpl = opts.fetch ?? globalThis.fetch;
284
- this.baseUrl = (opts.baseUrl ?? "https://api.getpostman.com").replace(/\/+$/, "");
284
+ let url = opts.baseUrl ?? "https://api.getpostman.com";
285
+ while (url.endsWith("/")) url = url.slice(0, -1);
286
+ this.baseUrl = url;
285
287
  }
286
288
  async request(path, opts = {}) {
287
289
  const url = new URL(`${this.baseUrl}${path.startsWith("/") ? path : "/" + path}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-postman",
3
- "version": "2.0.0-alpha.0",
3
+ "version": "2.0.0-alpha.1",
4
4
  "description": "Holocron plugin for Postman. Implements the tooling capability against Postman's REST API — workspace + collection + spec + environment sync.",
5
5
  "homepage": "https://github.com/theholocron/holocron/tree/main/packages/holocron-plugin-postman#readme",
6
6
  "bugs": "https://github.com/theholocron/holocron/issues",
@@ -21,7 +21,7 @@
21
21
  }
22
22
  },
23
23
  "peerDependencies": {
24
- "@theholocron/cli": "2.0.0-alpha.0"
24
+ "@theholocron/cli": "2.0.0-alpha.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@theholocron/tsconfig": "^4.1.0",
@@ -32,7 +32,7 @@
32
32
  "typescript": "^5.9.3",
33
33
  "vitest": "^3.2.6",
34
34
  "tsdown": "^0.22.3",
35
- "@theholocron/cli": "2.0.0-alpha.0"
35
+ "@theholocron/cli": "2.0.0-alpha.1"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"