@ingram-cloud/sdk 1.7.0 → 1.9.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/client.js CHANGED
@@ -709,5 +709,11 @@ export class IngramCloud {
709
709
  delete: (pid, tid, opts) => this.empty("DELETE", `/organization/projects/${enc(pid)}/tokens/${enc(tid)}`, opts),
710
710
  },
711
711
  },
712
+ /** Third-party apps linked through the authorization server. */
713
+ apps: {
714
+ list: (query, opts) => this.page("/organization/apps", query, opts),
715
+ /** Disconnect: revokes every token the app holds. */
716
+ delete: (id, opts) => this.empty("DELETE", `/organization/apps/${enc(id)}`, opts),
717
+ },
712
718
  };
713
719
  }
@@ -26,6 +26,27 @@ export const ProjectOut = z
26
26
  })
27
27
  .meta({ id: "ProjectOut" });
28
28
  export const ProjectListOut = pageOut(ProjectOut, "ProjectListOut");
29
+ /**
30
+ * A third-party app linked to the organization through the authorization
31
+ * server (`GET /oauth/authorize` with no `resource`): one per `(organization,
32
+ * client_id)`, owning the project it runs in. Disconnecting revokes every
33
+ * token the app holds.
34
+ */
35
+ export const AppInstallOut = z
36
+ .object({
37
+ id: z.string(),
38
+ organization: z.string(),
39
+ /** The app's Client ID Metadata Document URL. */
40
+ client_id: z.string(),
41
+ client_name: z.string(),
42
+ project: z.string(),
43
+ /** The scopes the app's tokens carry, space-separated. */
44
+ scope: z.string(),
45
+ created_at: z.string(),
46
+ revoked_at: z.string().nullable(),
47
+ })
48
+ .meta({ id: "AppInstallOut" });
49
+ export const AppInstallListOut = pageOut(AppInstallOut, "AppInstallListOut");
29
50
  /**
30
51
  * The secret minted when an org mints a project (tenant-admin) token. Shape
31
52
  * matches `mintToken`'s return; the `tenant` module owns the canonical
@@ -263,17 +263,27 @@ export const ProviderIn = z
263
263
  * `authorize_url`. */
264
264
  export const AuthorizeRequestOut = z
265
265
  .object({
266
+ /** `connector`: an MCP host connecting to a deployment (the tenant's page
267
+ * completes it naming a smith). `app`: a third-party app linking an
268
+ * organization (the console completes it with an organization token; the
269
+ * grant's subject is the app's project in that organization). */
270
+ kind: z.enum(["connector", "app"]),
271
+ client_id: z.string(),
266
272
  client_name: z.string(),
273
+ /** The scopes the client asked for, space-separated (`app` only). */
274
+ scope: z.string(),
267
275
  target_name: z.string(),
276
+ /** '' on an `app` request until it is completed. */
268
277
  tenant: z.string(),
269
278
  resource: z.string(),
270
279
  deployment_id: z.string(),
271
280
  })
272
281
  .meta({ id: "AuthorizeRequestOut" });
273
- /** Complete the delegated grant: the tenant asserts (server-to-server) which
274
- * smith the end-user authorized. */
282
+ /** Complete the delegated grant server-to-server. A `connector` request names
283
+ * the smith the end-user authorized; an `app` request carries nothing — the
284
+ * organization is the token's. */
275
285
  export const AuthorizeCompleteIn = z
276
- .object({ smith_id: z.string() })
286
+ .object({ smith_id: z.string().nullish() })
277
287
  .meta({ id: "AuthorizeCompleteIn" });
278
288
  /** Where the tenant 302s the browser after completing or declining. */
279
289
  export const AuthorizeRedirectOut = z
@@ -229,23 +229,37 @@ export const VectorStoreFileBatchOut = z
229
229
  })
230
230
  .meta({ id: "VectorStoreFileBatchOut" });
231
231
  // ── Search ───────────────────────────────────────────────────────────────────
232
+ /** OpenAI's `ranking_options`. `hybrid_search` turns on reciprocal-rank fusion
233
+ * of the embedding ranking with a full-text (keyword) ranking, weighted as
234
+ * given; without it search is embedding-only. */
235
+ export const VectorStoreRankingOptions = z
236
+ .object({
237
+ score_threshold: z.number().min(0).max(1).optional(),
238
+ hybrid_search: z
239
+ .object({
240
+ embedding_weight: z.number().min(0),
241
+ text_weight: z.number().min(0),
242
+ })
243
+ .refine((w) => w.embedding_weight > 0 || w.text_weight > 0, {
244
+ message: "at least one weight must be positive",
245
+ })
246
+ .optional(),
247
+ })
248
+ .meta({ id: "VectorStoreRankingOptions" });
232
249
  export const VectorStoreSearchIn = z
233
250
  .object({
234
251
  query: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),
235
252
  max_num_results: z.number().int().min(1).max(50).optional(),
236
253
  filters: VectorStoreFilter.nullish(),
237
- ranking_options: z
238
- .object({
239
- score_threshold: z.number().min(0).max(1).optional(),
240
- })
241
- .optional(),
254
+ ranking_options: VectorStoreRankingOptions.optional(),
242
255
  })
243
256
  .meta({ id: "VectorStoreSearchIn" });
244
257
  export const VectorStoreSearchResult = z
245
258
  .object({
246
259
  file_id: z.string(),
247
260
  filename: z.string(),
248
- /** Cosine similarity in [0, 1]. */
261
+ /** In [0, 1]: cosine similarity, or — with `hybrid_search` — the fused
262
+ * reciprocal-rank score (1 = first in both rankings). */
249
263
  score: z.number(),
250
264
  attributes: VectorStoreAttributes.nullable(),
251
265
  content: z.array(z.object({ type: z.literal("text"), text: z.string() })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingram-cloud/sdk",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Typed wire contract + management-plane client for the Ingram Cloud API: Zod schemas to validate request/response bodies, TypeScript types for the JSON you read back, SSE/webhook event types, and a typed REST client.",
5
5
  "keywords": [
6
6
  "api",
package/ts/client.ts CHANGED
@@ -56,6 +56,7 @@ import type {
56
56
  ICOrgUsage,
57
57
  ICOrgUsageSeries,
58
58
  ICProject,
59
+ ICAppInstall,
59
60
  ICProvider,
60
61
  ICRecallHit,
61
62
  ICRun,
@@ -1690,5 +1691,14 @@ export class IngramCloud {
1690
1691
  ),
1691
1692
  },
1692
1693
  },
1694
+
1695
+ /** Third-party apps linked through the authorization server. */
1696
+ apps: {
1697
+ list: (query?: PageOpts, opts?: RequestOptions) =>
1698
+ this.page<ICAppInstall>("/organization/apps", query, opts),
1699
+ /** Disconnect: revokes every token the app holds. */
1700
+ delete: (id: string, opts?: RequestOptions) =>
1701
+ this.empty("DELETE", `/organization/apps/${enc(id)}`, opts),
1702
+ },
1693
1703
  };
1694
1704
  }
package/ts/responses.ts CHANGED
@@ -84,7 +84,7 @@ export type {
84
84
  ICUsageBreakdown,
85
85
  ICUsageEvent,
86
86
  } from "./zod/observability.js";
87
- export type { ICProject } from "./zod/projects.js";
87
+ export type { ICProject, ICAppInstall } from "./zod/projects.js";
88
88
  export type { ICActor } from "./zod/_actor.js";
89
89
  export type {
90
90
  ICRun,
@@ -29,6 +29,29 @@ export const ProjectOut = z
29
29
 
30
30
  export const ProjectListOut = pageOut(ProjectOut, "ProjectListOut");
31
31
 
32
+ /**
33
+ * A third-party app linked to the organization through the authorization
34
+ * server (`GET /oauth/authorize` with no `resource`): one per `(organization,
35
+ * client_id)`, owning the project it runs in. Disconnecting revokes every
36
+ * token the app holds.
37
+ */
38
+ export const AppInstallOut = z
39
+ .object({
40
+ id: z.string(),
41
+ organization: z.string(),
42
+ /** The app's Client ID Metadata Document URL. */
43
+ client_id: z.string(),
44
+ client_name: z.string(),
45
+ project: z.string(),
46
+ /** The scopes the app's tokens carry, space-separated. */
47
+ scope: z.string(),
48
+ created_at: z.string(),
49
+ revoked_at: z.string().nullable(),
50
+ })
51
+ .meta({ id: "AppInstallOut" });
52
+
53
+ export const AppInstallListOut = pageOut(AppInstallOut, "AppInstallListOut");
54
+
32
55
  /**
33
56
  * The secret minted when an org mints a project (tenant-admin) token. Shape
34
57
  * matches `mintToken`'s return; the `tenant` module owns the canonical
@@ -66,3 +89,5 @@ export const ProjectTokenIn = z
66
89
  // ── Inferred consumer-facing type ────────────────────────────────────────────
67
90
 
68
91
  export type ICProject = z.infer<typeof ProjectOut>;
92
+
93
+ export type ICAppInstall = z.infer<typeof AppInstallOut>;
package/ts/zod/tenant.ts CHANGED
@@ -305,18 +305,28 @@ export const ProviderIn = z
305
305
  * `authorize_url`. */
306
306
  export const AuthorizeRequestOut = z
307
307
  .object({
308
+ /** `connector`: an MCP host connecting to a deployment (the tenant's page
309
+ * completes it naming a smith). `app`: a third-party app linking an
310
+ * organization (the console completes it with an organization token; the
311
+ * grant's subject is the app's project in that organization). */
312
+ kind: z.enum(["connector", "app"]),
313
+ client_id: z.string(),
308
314
  client_name: z.string(),
315
+ /** The scopes the client asked for, space-separated (`app` only). */
316
+ scope: z.string(),
309
317
  target_name: z.string(),
318
+ /** '' on an `app` request until it is completed. */
310
319
  tenant: z.string(),
311
320
  resource: z.string(),
312
321
  deployment_id: z.string(),
313
322
  })
314
323
  .meta({ id: "AuthorizeRequestOut" });
315
324
 
316
- /** Complete the delegated grant: the tenant asserts (server-to-server) which
317
- * smith the end-user authorized. */
325
+ /** Complete the delegated grant server-to-server. A `connector` request names
326
+ * the smith the end-user authorized; an `app` request carries nothing — the
327
+ * organization is the token's. */
318
328
  export const AuthorizeCompleteIn = z
319
- .object({ smith_id: z.string() })
329
+ .object({ smith_id: z.string().nullish() })
320
330
  .meta({ id: "AuthorizeCompleteIn" });
321
331
 
322
332
  /** Where the tenant 302s the browser after completing or declining. */
@@ -268,16 +268,30 @@ export const VectorStoreFileBatchOut = z
268
268
 
269
269
  // ── Search ───────────────────────────────────────────────────────────────────
270
270
 
271
+ /** OpenAI's `ranking_options`. `hybrid_search` turns on reciprocal-rank fusion
272
+ * of the embedding ranking with a full-text (keyword) ranking, weighted as
273
+ * given; without it search is embedding-only. */
274
+ export const VectorStoreRankingOptions = z
275
+ .object({
276
+ score_threshold: z.number().min(0).max(1).optional(),
277
+ hybrid_search: z
278
+ .object({
279
+ embedding_weight: z.number().min(0),
280
+ text_weight: z.number().min(0),
281
+ })
282
+ .refine((w) => w.embedding_weight > 0 || w.text_weight > 0, {
283
+ message: "at least one weight must be positive",
284
+ })
285
+ .optional(),
286
+ })
287
+ .meta({ id: "VectorStoreRankingOptions" });
288
+
271
289
  export const VectorStoreSearchIn = z
272
290
  .object({
273
291
  query: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),
274
292
  max_num_results: z.number().int().min(1).max(50).optional(),
275
293
  filters: VectorStoreFilter.nullish(),
276
- ranking_options: z
277
- .object({
278
- score_threshold: z.number().min(0).max(1).optional(),
279
- })
280
- .optional(),
294
+ ranking_options: VectorStoreRankingOptions.optional(),
281
295
  })
282
296
  .meta({ id: "VectorStoreSearchIn" });
283
297
 
@@ -285,7 +299,8 @@ export const VectorStoreSearchResult = z
285
299
  .object({
286
300
  file_id: z.string(),
287
301
  filename: z.string(),
288
- /** Cosine similarity in [0, 1]. */
302
+ /** In [0, 1]: cosine similarity, or — with `hybrid_search` — the fused
303
+ * reciprocal-rank score (1 = first in both rankings). */
289
304
  score: z.number(),
290
305
  attributes: VectorStoreAttributes.nullable(),
291
306
  content: z.array(z.object({ type: z.literal("text"), text: z.string() })),