@theholocron/holocron-plugin-postman 3.58.1 → 3.60.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/dist/index.d.mts CHANGED
@@ -23,7 +23,7 @@ declare class PostmanTooling implements Tooling {
23
23
  readonly providerName = "postman";
24
24
  private readonly opts;
25
25
  private readonly repoRoot;
26
- constructor(client: PostmanClient$1, opts: PostmanToolingOptions);
26
+ constructor(client: () => PostmanClient$1, opts: PostmanToolingOptions);
27
27
  sync(): Promise<void>;
28
28
  doctor(): Promise<ToolingDoctorReport>;
29
29
  getMyself(): Promise<PostmanUser>;
@@ -102,7 +102,7 @@ interface PostmanPluginOptions extends ResolveTokenInput, PostmanToolingOptions
102
102
  }
103
103
  interface PluginContext {
104
104
  options: PostmanPluginOptions;
105
- client: PostmanClient;
105
+ client: () => PostmanClient;
106
106
  }
107
107
  declare function createContext(options: PostmanPluginOptions): PluginContext;
108
108
  declare function tooling(ctx: PluginContext): Tooling;
package/dist/index.mjs CHANGED
@@ -114,46 +114,46 @@ var PostmanTooling = class {
114
114
  }
115
115
  }
116
116
  async getMyself() {
117
- return (await this.client.me.get()).user ?? {};
117
+ return (await this.client().me.get()).user ?? {};
118
118
  }
119
119
  async listWorkspaces() {
120
- const { workspaces } = await this.client.workspaces.list();
120
+ const { workspaces } = await this.client().workspaces.list();
121
121
  return workspaces;
122
122
  }
123
123
  async findCollectionByName(input) {
124
- const { collections } = await this.client.collections.list(input.workspaceId);
124
+ const { collections } = await this.client().collections.list(input.workspaceId);
125
125
  return collections.find((c) => c.name === input.name) ?? null;
126
126
  }
127
127
  async deleteCollection(uid) {
128
- await this.client.collections.delete(uid);
128
+ await this.client().collections.delete(uid);
129
129
  }
130
130
  async importOpenApi(input) {
131
- const { collections } = await this.client.import.openapi(input.workspaceId, input.spec);
131
+ const { collections } = await this.client().import.openapi(input.workspaceId, input.spec);
132
132
  const created = collections[0];
133
133
  if (!created) throw new ProviderApiError("Postman returned no collection on import — check the OpenAPI spec is well-formed", 500, void 0);
134
134
  return created;
135
135
  }
136
136
  async listEnvironments(input) {
137
- const { environments } = await this.client.environments.list(input.workspaceId);
137
+ const { environments } = await this.client().environments.list(input.workspaceId);
138
138
  return environments;
139
139
  }
140
140
  async findEnvironmentByName(input) {
141
141
  return (await this.listEnvironments(input)).find((e) => e.name === input.name) ?? null;
142
142
  }
143
143
  async createEnvironment(input) {
144
- const { environment } = await this.client.environments.create(input.workspaceId, input.environment);
144
+ const { environment } = await this.client().environments.create(input.workspaceId, input.environment);
145
145
  return environment;
146
146
  }
147
147
  async updateEnvironment(input) {
148
- const { environment } = await this.client.environments.update(input.uid, input.environment);
148
+ const { environment } = await this.client().environments.update(input.uid, input.environment);
149
149
  return environment;
150
150
  }
151
151
  async findSpecByName(input) {
152
- const { specs } = await this.client.specs.list(input.workspaceId);
152
+ const { specs } = await this.client().specs.list(input.workspaceId);
153
153
  return specs.find((s) => s.name === input.name) ?? null;
154
154
  }
155
155
  async createSpec(input) {
156
- return this.client.specs.create(input.workspaceId, {
156
+ return this.client().specs.create(input.workspaceId, {
157
157
  name: input.name,
158
158
  type: input.type,
159
159
  filePath: input.filePath,
@@ -161,7 +161,7 @@ var PostmanTooling = class {
161
161
  });
162
162
  }
163
163
  async upsertSpecFile(input) {
164
- await this.client.specs.updateFile(input.specId, input.filePath, input.content);
164
+ await this.client().specs.updateFile(input.specId, input.filePath, input.content);
165
165
  }
166
166
  };
167
167
  //#endregion
@@ -194,9 +194,10 @@ async function verifyToken(token, opts = {}) {
194
194
  //#region src/index.ts
195
195
  function createContext(options) {
196
196
  if (!options.workspaceId) throw new Error("@theholocron/holocron-plugin-postman requires `workspaceId` in options");
197
+ let client;
197
198
  return {
198
199
  options,
199
- client: createPostmanClient({
200
+ client: () => client ??= createPostmanClient({
200
201
  token: resolveToken(options),
201
202
  baseUrl: options.baseUrl,
202
203
  fetch: options.fetch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-postman",
3
- "version": "3.58.1",
3
+ "version": "3.60.0",
4
4
  "description": "Holocron plugin for Postman. Implements the tooling capability against Postman's REST API — workspace + collection + spec + environment sync.",
5
5
  "keywords": [
6
6
  "holocron",
@@ -45,11 +45,11 @@
45
45
  "tsx": "4.23.12",
46
46
  "typescript": "^5.9.3",
47
47
  "vitest": "^4.1.11",
48
- "@theholocron/cli": "3.58.1"
48
+ "@theholocron/cli": "3.60.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@theholocron/postman-client": "^1.14.2",
52
- "@theholocron/cli": "3.58.1"
52
+ "@theholocron/cli": "3.60.0"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "@theholocron/postman-client": {}