@smartcrab/management-client 0.5.0 → 0.6.0-next-20261124093243

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/client.d.ts CHANGED
@@ -147,6 +147,7 @@ export interface ManagementClient {
147
147
  rotateClientSecret(clientId: string, options?: WriteOptions): Api<cm.ClientRotateSecretResponse>;
148
148
  listConnections(params: ConnectionListParams): Api<cm.ConnectionListResponse>;
149
149
  createConnection(body: ConnectionCreateInput, options?: WriteOptions): Api<cm.Connection>;
150
+ getConnection(connectionId: string): Api<cm.Connection>;
150
151
  updateConnection(connectionId: string, body: ConnectionUpdateInput, options?: WriteOptions): Api<cm.Connection>;
151
152
  deleteConnection(connectionId: string, options?: WriteOptions): Api<cm.ConnectionDeleteResponse>;
152
153
  listDomains(params: DomainListParams): Api<cm.DomainListResponse>;
@@ -175,6 +176,7 @@ export interface ManagementClient {
175
176
  createUserExportJob(body: UserExportJobCreateInput, options?: WriteOptions): Api<cm.UserExportJob>;
176
177
  getUserExportJob(jobId: string): Api<cm.UserExportJob>;
177
178
  listWebhooks(params: WebhookListParams): Api<cm.WebhookListResponse>;
179
+ getWebhook(webhookId: string): Api<cm.Webhook>;
178
180
  listWebhookDeliveries(webhookId: string, params?: WebhookDeliveryListParams): Api<cm.WebhookDeliveryListResponse>;
179
181
  createWebhook(body: WebhookCreateInput, options?: WriteOptions): Api<cm.WebhookCreateResponse>;
180
182
  updateWebhook(webhookId: string, body: WebhookUpdateInput, options?: WriteOptions): Api<cm.Webhook>;
package/dist/client.js CHANGED
@@ -112,6 +112,7 @@ export const createManagementClient = (options) => {
112
112
  provider: params.provider,
113
113
  }), cm.connectionListResponseSchema),
114
114
  createConnection: (body, writeOptions) => withValidBody(cm.connectionCreateRequestSchema, body, (valid) => send(config, writeSpec("POST", "/connections", valid, writeOptions), cm.connectionCreateResponseSchema)),
115
+ getConnection: (connectionId) => send(config, getSpec(`/connections/${segment(connectionId)}`), cm.connectionGetResponseSchema),
115
116
  updateConnection: (connectionId, body, writeOptions) => withValidBody(cm.connectionUpdateRequestSchema, body, (valid) => send(config, writeSpec("PATCH", `/connections/${segment(connectionId)}`, valid, writeOptions), cm.connectionUpdateResponseSchema)),
116
117
  deleteConnection: (connectionId, writeOptions) => send(config, writeSpec("DELETE", `/connections/${segment(connectionId)}`, undefined, writeOptions), cm.connectionDeleteResponseSchema),
117
118
  // --------------------------------------------------------------
@@ -194,6 +195,7 @@ export const createManagementClient = (options) => {
194
195
  limit: params.limit,
195
196
  environment_id: params.environment_id,
196
197
  }), cm.webhookListResponseSchema),
198
+ getWebhook: (webhookId) => send(config, getSpec(`/webhooks/${segment(webhookId)}`), cm.webhookGetResponseSchema),
197
199
  listWebhookDeliveries: (webhookId, params) => send(config, getSpec(`/webhooks/${segment(webhookId)}/deliveries`, {
198
200
  cursor: params?.cursor,
199
201
  limit: params?.limit,
@@ -525,6 +525,14 @@ const ROUTES = [
525
525
  responseBody: connection,
526
526
  write: true,
527
527
  },
528
+ {
529
+ name: "getConnection",
530
+ invoke: (c) => c.getConnection(ID("con")),
531
+ method: "GET",
532
+ path: `/connections/${ID("con")}`,
533
+ responseBody: connection,
534
+ write: false,
535
+ },
528
536
  {
529
537
  name: "updateConnection",
530
538
  invoke: (c) => c.updateConnection(ID("con"), { status: "disabled" }),
@@ -761,6 +769,14 @@ const ROUTES = [
761
769
  responseBody: page(webhook),
762
770
  write: false,
763
771
  },
772
+ {
773
+ name: "getWebhook",
774
+ invoke: (c) => c.getWebhook(ID("whk")),
775
+ method: "GET",
776
+ path: `/webhooks/${ID("whk")}`,
777
+ responseBody: webhook,
778
+ write: false,
779
+ },
764
780
  {
765
781
  name: "listWebhookDeliveries",
766
782
  invoke: (c) => c.listWebhookDeliveries(ID("whk")),
@@ -885,7 +901,7 @@ const ROUTES = [
885
901
  ];
886
902
  describe("createManagementClient — one method per design.md §26.2 route", () => {
887
903
  test(`covers ${ROUTES.length} routes`, () => {
888
- expect(ROUTES.length).toBe(67);
904
+ expect(ROUTES.length).toBe(69);
889
905
  expect(new Set(ROUTES.map((r) => r.name)).size).toBe(ROUTES.length);
890
906
  });
891
907
  for (const route of ROUTES) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartcrab/management-client",
3
- "version": "0.5.0",
3
+ "version": "0.6.0-next-20261124093243",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@smartcrab/contracts-management": "0.5.0"
30
+ "@smartcrab/contracts-management": "0.6.0-next-20261124093243"
31
31
  },
32
32
  "devDependencies": {
33
33
  "typescript": "5.9.3",
@@ -571,6 +571,14 @@ const ROUTES: readonly RouteCase[] = [
571
571
  responseBody: connection,
572
572
  write: true,
573
573
  },
574
+ {
575
+ name: "getConnection",
576
+ invoke: (c) => c.getConnection(ID("con")),
577
+ method: "GET",
578
+ path: `/connections/${ID("con")}`,
579
+ responseBody: connection,
580
+ write: false,
581
+ },
574
582
  {
575
583
  name: "updateConnection",
576
584
  invoke: (c) => c.updateConnection(ID("con"), { status: "disabled" }),
@@ -809,6 +817,14 @@ const ROUTES: readonly RouteCase[] = [
809
817
  responseBody: page(webhook),
810
818
  write: false,
811
819
  },
820
+ {
821
+ name: "getWebhook",
822
+ invoke: (c) => c.getWebhook(ID("whk")),
823
+ method: "GET",
824
+ path: `/webhooks/${ID("whk")}`,
825
+ responseBody: webhook,
826
+ write: false,
827
+ },
812
828
  {
813
829
  name: "listWebhookDeliveries",
814
830
  invoke: (c) => c.listWebhookDeliveries(ID("whk")),
@@ -936,7 +952,7 @@ const ROUTES: readonly RouteCase[] = [
936
952
 
937
953
  describe("createManagementClient — one method per design.md §26.2 route", () => {
938
954
  test(`covers ${ROUTES.length} routes`, () => {
939
- expect(ROUTES.length).toBe(67);
955
+ expect(ROUTES.length).toBe(69);
940
956
  expect(new Set(ROUTES.map((r) => r.name)).size).toBe(ROUTES.length);
941
957
  });
942
958
 
package/src/client.ts CHANGED
@@ -200,6 +200,7 @@ export interface ManagementClient {
200
200
  // Connections (social/OAuth providers, design.md §20)
201
201
  listConnections(params: ConnectionListParams): Api<cm.ConnectionListResponse>;
202
202
  createConnection(body: ConnectionCreateInput, options?: WriteOptions): Api<cm.Connection>;
203
+ getConnection(connectionId: string): Api<cm.Connection>;
203
204
  updateConnection(
204
205
  connectionId: string,
205
206
  body: ConnectionUpdateInput,
@@ -302,6 +303,7 @@ export interface ManagementClient {
302
303
 
303
304
  // Webhooks
304
305
  listWebhooks(params: WebhookListParams): Api<cm.WebhookListResponse>;
306
+ getWebhook(webhookId: string): Api<cm.Webhook>;
305
307
  listWebhookDeliveries(
306
308
  webhookId: string,
307
309
  params?: WebhookDeliveryListParams,
@@ -616,6 +618,12 @@ export const createManagementClient = (options: ManagementClientOptions): Manage
616
618
  cm.connectionCreateResponseSchema,
617
619
  ),
618
620
  ),
621
+ getConnection: (connectionId) =>
622
+ send(
623
+ config,
624
+ getSpec(`/connections/${segment(connectionId)}`),
625
+ cm.connectionGetResponseSchema,
626
+ ),
619
627
  updateConnection: (connectionId, body, writeOptions) =>
620
628
  withValidBody(cm.connectionUpdateRequestSchema, body, (valid) =>
621
629
  send(
@@ -871,6 +879,8 @@ export const createManagementClient = (options: ManagementClientOptions): Manage
871
879
  }),
872
880
  cm.webhookListResponseSchema,
873
881
  ),
882
+ getWebhook: (webhookId) =>
883
+ send(config, getSpec(`/webhooks/${segment(webhookId)}`), cm.webhookGetResponseSchema),
874
884
  listWebhookDeliveries: (webhookId, params) =>
875
885
  send(
876
886
  config,