@salesforce/b2c-tooling-sdk 0.0.7 → 0.1.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.
Files changed (34) hide show
  1. package/dist/cjs/clients/index.d.ts +3 -0
  2. package/dist/cjs/clients/index.js +2 -0
  3. package/dist/cjs/clients/index.js.map +1 -1
  4. package/dist/cjs/clients/middleware-registry.d.ts +1 -1
  5. package/dist/cjs/clients/scapi-schemas.d.ts +132 -0
  6. package/dist/cjs/clients/scapi-schemas.generated.d.ts +328 -0
  7. package/dist/cjs/clients/scapi-schemas.generated.js +6 -0
  8. package/dist/cjs/clients/scapi-schemas.generated.js.map +1 -0
  9. package/dist/cjs/clients/scapi-schemas.js +95 -0
  10. package/dist/cjs/clients/scapi-schemas.js.map +1 -0
  11. package/dist/cjs/operations/scapi-schemas/collapse.d.ts +150 -0
  12. package/dist/cjs/operations/scapi-schemas/collapse.js +180 -0
  13. package/dist/cjs/operations/scapi-schemas/collapse.js.map +1 -0
  14. package/dist/cjs/operations/scapi-schemas/index.d.ts +53 -0
  15. package/dist/cjs/operations/scapi-schemas/index.js +59 -0
  16. package/dist/cjs/operations/scapi-schemas/index.js.map +1 -0
  17. package/dist/esm/clients/index.d.ts +3 -0
  18. package/dist/esm/clients/index.js +2 -0
  19. package/dist/esm/clients/index.js.map +1 -1
  20. package/dist/esm/clients/middleware-registry.d.ts +1 -1
  21. package/dist/esm/clients/scapi-schemas.d.ts +132 -0
  22. package/dist/esm/clients/scapi-schemas.generated.d.ts +328 -0
  23. package/dist/esm/clients/scapi-schemas.generated.js +6 -0
  24. package/dist/esm/clients/scapi-schemas.generated.js.map +1 -0
  25. package/dist/esm/clients/scapi-schemas.js +95 -0
  26. package/dist/esm/clients/scapi-schemas.js.map +1 -0
  27. package/dist/esm/operations/scapi-schemas/collapse.d.ts +150 -0
  28. package/dist/esm/operations/scapi-schemas/collapse.js +180 -0
  29. package/dist/esm/operations/scapi-schemas/collapse.js.map +1 -0
  30. package/dist/esm/operations/scapi-schemas/index.d.ts +53 -0
  31. package/dist/esm/operations/scapi-schemas/index.js +59 -0
  32. package/dist/esm/operations/scapi-schemas/index.js.map +1 -0
  33. package/package.json +13 -2
  34. package/specs/scapi-schemas-v1.yaml +341 -0
@@ -0,0 +1,328 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export interface paths {
6
+ "/organizations/{organizationId}/schemas": {
7
+ parameters: {
8
+ query?: never;
9
+ header?: never;
10
+ path?: never;
11
+ cookie?: never;
12
+ };
13
+ /**
14
+ * Get a list of available SCAPI schemas.
15
+ * @description List available SCAPI schema definitions with optional filtering by API family, name, version, or status.
16
+ */
17
+ get: operations["getSchemas"];
18
+ put?: never;
19
+ post?: never;
20
+ delete?: never;
21
+ options?: never;
22
+ head?: never;
23
+ patch?: never;
24
+ trace?: never;
25
+ };
26
+ "/organizations/{organizationId}/schemas/{apiFamily}/{apiName}/{apiVersion}": {
27
+ parameters: {
28
+ query?: never;
29
+ header?: never;
30
+ path?: never;
31
+ cookie?: never;
32
+ };
33
+ /**
34
+ * Get a specific SCAPI schema.
35
+ * @description Retrieve the detailed OpenAPI schema specification for a specific SCAPI API.
36
+ */
37
+ get: operations["getSchema"];
38
+ put?: never;
39
+ post?: never;
40
+ delete?: never;
41
+ options?: never;
42
+ head?: never;
43
+ patch?: never;
44
+ trace?: never;
45
+ };
46
+ }
47
+ export type webhooks = Record<string, never>;
48
+ export interface components {
49
+ schemas: {
50
+ /**
51
+ * @description An identifier for the organization the request is being made by
52
+ * @example f_ecom_zzxy_prd
53
+ */
54
+ OrganizationId: string;
55
+ /**
56
+ * @example current
57
+ * @enum {string}
58
+ */
59
+ SchemaStatus: "current" | "deprecated";
60
+ /**
61
+ * Format: int32
62
+ * @description Maximum records to retrieve per request, not to exceed the maximum defined. A limit must be at least 1 so at least one record is returned (if any match the criteria).
63
+ * @default 10
64
+ * @example 10
65
+ */
66
+ Limit: number;
67
+ /**
68
+ * Format: int32
69
+ * @description The total number of hits that match the search's criteria. This can be greater than the number of results returned as search results are paginated.
70
+ * @default 0
71
+ * @example 10
72
+ */
73
+ Total: number;
74
+ /** @description Schema defining generic list result. Each response schema of a resource requiring a list response should extend this schema. */
75
+ ResultBase: {
76
+ limit: components["schemas"]["Limit"];
77
+ total: components["schemas"]["Total"];
78
+ };
79
+ SchemaListFilter: {
80
+ /** @example shopper */
81
+ apiFamily?: string;
82
+ /** @example products */
83
+ apiName?: string;
84
+ /** @example v1 */
85
+ apiVersion?: string;
86
+ status?: components["schemas"]["SchemaStatus"];
87
+ };
88
+ SchemaListItem: {
89
+ /**
90
+ * @description Semantic version of the schema (e.g., "1.0.0")
91
+ * @example 1.0.0
92
+ */
93
+ schemaVersion?: string;
94
+ /**
95
+ * @description The API family (e.g., shopper, admin)
96
+ * @example shopper
97
+ */
98
+ apiFamily?: string;
99
+ /**
100
+ * @description The API name (e.g., products, orders)
101
+ * @example products
102
+ */
103
+ apiName?: string;
104
+ /**
105
+ * @description The API version (e.g., v1)
106
+ * @example v1
107
+ */
108
+ apiVersion?: string;
109
+ status?: components["schemas"]["SchemaStatus"];
110
+ /**
111
+ * @description URL to the schema detail endpoint
112
+ * @example /organizations/f_ecom_zzxy_prd/schemas/shopper/products/v1
113
+ */
114
+ link?: string;
115
+ };
116
+ SchemaListResult: {
117
+ filter?: components["schemas"]["SchemaListFilter"];
118
+ data?: components["schemas"]["SchemaListItem"][];
119
+ } & components["schemas"]["ResultBase"];
120
+ /** @description An OpenAPI 3.0 schema specification */
121
+ OpenApiSchema: {
122
+ /**
123
+ * @description OpenAPI version
124
+ * @example 3.0.3
125
+ */
126
+ openapi?: string;
127
+ info?: {
128
+ title?: string;
129
+ version?: string;
130
+ description?: string;
131
+ } & {
132
+ [key: string]: unknown;
133
+ };
134
+ paths?: {
135
+ [key: string]: unknown;
136
+ };
137
+ components?: {
138
+ [key: string]: unknown;
139
+ };
140
+ } & {
141
+ [key: string]: unknown;
142
+ };
143
+ ErrorResponse: {
144
+ /**
145
+ * @description A short, human-readable summary of the problem type.
146
+ * @example Bad Request
147
+ */
148
+ title: string;
149
+ /**
150
+ * @description A URI reference that identifies the problem type.
151
+ * @example https://api.commercecloud.salesforce.com/documentation/error/v1/errors/bad-request
152
+ */
153
+ type: string;
154
+ /**
155
+ * @description A human-readable explanation specific to this occurrence of the problem.
156
+ * @example Invalid value for filter parameter.
157
+ */
158
+ detail: string;
159
+ /** @description A URI reference that identifies the specific occurrence of the problem. */
160
+ instance?: string;
161
+ } & {
162
+ [key: string]: unknown;
163
+ };
164
+ };
165
+ responses: never;
166
+ parameters: {
167
+ /**
168
+ * @description An identifier for the organization the request is being made by
169
+ * @example f_ecom_zzxy_prd
170
+ */
171
+ organizationId: components["schemas"]["OrganizationId"];
172
+ /** @description Filter by API family (e.g., shopper, admin) */
173
+ apiFamily: string;
174
+ /** @description Filter by API name (e.g., products, orders) */
175
+ apiName: string;
176
+ /** @description Filter by API version (e.g., v1) */
177
+ apiVersion: string;
178
+ /** @description Filter by schema status */
179
+ status: components["schemas"]["SchemaStatus"];
180
+ /** @description The API family (e.g., shopper, admin) */
181
+ apiFamilyPath: string;
182
+ /** @description The API name (e.g., products, orders) */
183
+ apiNamePath: string;
184
+ /** @description The API version (e.g., v1) */
185
+ apiVersionPath: string;
186
+ /** @description Comma-separated list of sections to expand (e.g., "custom_properties") */
187
+ expand: string;
188
+ };
189
+ requestBodies: never;
190
+ headers: never;
191
+ pathItems: never;
192
+ }
193
+ export type $defs = Record<string, never>;
194
+ export interface operations {
195
+ getSchemas: {
196
+ parameters: {
197
+ query?: {
198
+ /** @description Filter by API family (e.g., shopper, admin) */
199
+ apiFamily?: components["parameters"]["apiFamily"];
200
+ /** @description Filter by API name (e.g., products, orders) */
201
+ apiName?: components["parameters"]["apiName"];
202
+ /** @description Filter by API version (e.g., v1) */
203
+ apiVersion?: components["parameters"]["apiVersion"];
204
+ /** @description Filter by schema status */
205
+ status?: components["parameters"]["status"];
206
+ };
207
+ header?: never;
208
+ path: {
209
+ /**
210
+ * @description An identifier for the organization the request is being made by
211
+ * @example f_ecom_zzxy_prd
212
+ */
213
+ organizationId: components["parameters"]["organizationId"];
214
+ };
215
+ cookie?: never;
216
+ };
217
+ requestBody?: never;
218
+ responses: {
219
+ /** @description Successful operation */
220
+ 200: {
221
+ headers: {
222
+ [name: string]: unknown;
223
+ };
224
+ content: {
225
+ "application/json": components["schemas"]["SchemaListResult"];
226
+ };
227
+ };
228
+ /** @description Invalid or malformed filter parameter */
229
+ 400: {
230
+ headers: {
231
+ [name: string]: unknown;
232
+ };
233
+ content: {
234
+ "application/problem+json": components["schemas"]["ErrorResponse"];
235
+ };
236
+ };
237
+ /** @description Unauthorized - invalid or missing authentication */
238
+ 401: {
239
+ headers: {
240
+ [name: string]: unknown;
241
+ };
242
+ content: {
243
+ "application/problem+json": components["schemas"]["ErrorResponse"];
244
+ };
245
+ };
246
+ /** @description Forbidden - insufficient permissions */
247
+ 403: {
248
+ headers: {
249
+ [name: string]: unknown;
250
+ };
251
+ content: {
252
+ "application/problem+json": components["schemas"]["ErrorResponse"];
253
+ };
254
+ };
255
+ };
256
+ };
257
+ getSchema: {
258
+ parameters: {
259
+ query?: {
260
+ /** @description Comma-separated list of sections to expand (e.g., "custom_properties") */
261
+ expand?: components["parameters"]["expand"];
262
+ };
263
+ header?: never;
264
+ path: {
265
+ /**
266
+ * @description An identifier for the organization the request is being made by
267
+ * @example f_ecom_zzxy_prd
268
+ */
269
+ organizationId: components["parameters"]["organizationId"];
270
+ /** @description The API family (e.g., shopper, admin) */
271
+ apiFamily: components["parameters"]["apiFamilyPath"];
272
+ /** @description The API name (e.g., products, orders) */
273
+ apiName: components["parameters"]["apiNamePath"];
274
+ /** @description The API version (e.g., v1) */
275
+ apiVersion: components["parameters"]["apiVersionPath"];
276
+ };
277
+ cookie?: never;
278
+ };
279
+ requestBody?: never;
280
+ responses: {
281
+ /** @description Successful operation - returns OpenAPI schema */
282
+ 200: {
283
+ headers: {
284
+ [name: string]: unknown;
285
+ };
286
+ content: {
287
+ "application/json": components["schemas"]["OpenApiSchema"];
288
+ };
289
+ };
290
+ /** @description Invalid parameter value */
291
+ 400: {
292
+ headers: {
293
+ [name: string]: unknown;
294
+ };
295
+ content: {
296
+ "application/problem+json": components["schemas"]["ErrorResponse"];
297
+ };
298
+ };
299
+ /** @description Unauthorized - invalid or missing authentication */
300
+ 401: {
301
+ headers: {
302
+ [name: string]: unknown;
303
+ };
304
+ content: {
305
+ "application/problem+json": components["schemas"]["ErrorResponse"];
306
+ };
307
+ };
308
+ /** @description Forbidden - insufficient permissions */
309
+ 403: {
310
+ headers: {
311
+ [name: string]: unknown;
312
+ };
313
+ content: {
314
+ "application/problem+json": components["schemas"]["ErrorResponse"];
315
+ };
316
+ };
317
+ /** @description Schema not found */
318
+ 404: {
319
+ headers: {
320
+ [name: string]: unknown;
321
+ };
322
+ content: {
323
+ "application/problem+json": components["schemas"]["ErrorResponse"];
324
+ };
325
+ };
326
+ };
327
+ };
328
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=scapi-schemas.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scapi-schemas.generated.js","sourceRoot":"","sources":["../../../src/clients/scapi-schemas.generated.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * SPDX-License-Identifier: Apache-2
4
+ * For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ /**
7
+ * SCAPI Schemas API client for B2C Commerce.
8
+ *
9
+ * Provides a fully typed client for SCAPI Schemas API operations using
10
+ * openapi-fetch with OAuth authentication middleware. Used for discovering
11
+ * and retrieving OpenAPI schema specifications for SCAPI APIs.
12
+ *
13
+ * @module clients/scapi-schemas
14
+ */
15
+ import createClient, {} from 'openapi-fetch';
16
+ import { OAuthStrategy } from '../auth/oauth.js';
17
+ import { createAuthMiddleware, createLoggingMiddleware } from './middleware.js';
18
+ import { globalMiddlewareRegistry } from './middleware-registry.js';
19
+ import { toOrganizationId, toTenantId, buildTenantScope } from './custom-apis.js';
20
+ /**
21
+ * Re-export organization/tenant utilities for convenience.
22
+ */
23
+ export { toOrganizationId, toTenantId, buildTenantScope };
24
+ /** Default OAuth scopes required for SCAPI Schemas (read-only) */
25
+ export const SCAPI_SCHEMAS_DEFAULT_SCOPES = ['sfcc.scapi-schemas'];
26
+ /**
27
+ * Creates a typed SCAPI Schemas API client.
28
+ *
29
+ * Returns the openapi-fetch client directly, with authentication
30
+ * handled via middleware. This gives full access to all openapi-fetch
31
+ * features with type-safe paths, parameters, and responses.
32
+ *
33
+ * The client automatically handles OAuth scope requirements:
34
+ * - Domain scope: `sfcc.scapi-schemas` (or custom via config.scopes)
35
+ * - Tenant scope: `SALESFORCE_COMMERCE_API:{tenantId}`
36
+ *
37
+ * @param config - SCAPI Schemas client configuration including shortCode and tenantId
38
+ * @param auth - Authentication strategy (typically OAuth)
39
+ * @returns Typed openapi-fetch client
40
+ *
41
+ * @example
42
+ * // Create SCAPI Schemas client - scopes are handled automatically
43
+ * const oauthStrategy = new OAuthStrategy({
44
+ * clientId: 'your-client-id',
45
+ * clientSecret: 'your-client-secret',
46
+ * });
47
+ *
48
+ * const client = createScapiSchemasClient(
49
+ * { shortCode: 'kv7kzm78', tenantId: 'zzxy_prd' },
50
+ * oauthStrategy
51
+ * );
52
+ *
53
+ * // List available SCAPI schemas
54
+ * const { data, error } = await client.GET('/organizations/{organizationId}/schemas', {
55
+ * params: {
56
+ * path: { organizationId: toOrganizationId('zzxy_prd') }
57
+ * }
58
+ * });
59
+ *
60
+ * // Get a specific schema
61
+ * const { data: schema } = await client.GET(
62
+ * '/organizations/{organizationId}/schemas/{apiFamily}/{apiName}/{apiVersion}',
63
+ * {
64
+ * params: {
65
+ * path: {
66
+ * organizationId: toOrganizationId('zzxy_prd'),
67
+ * apiFamily: 'shopper',
68
+ * apiName: 'products',
69
+ * apiVersion: 'v1'
70
+ * },
71
+ * query: { expand: 'custom_properties' }
72
+ * }
73
+ * }
74
+ * );
75
+ */
76
+ export function createScapiSchemasClient(config, auth) {
77
+ const registry = config.middlewareRegistry ?? globalMiddlewareRegistry;
78
+ const client = createClient({
79
+ baseUrl: `https://${config.shortCode}.api.commercecloud.salesforce.com/dx/scapi-schemas/v1`,
80
+ });
81
+ // Build required scopes: domain scope + tenant-specific scope
82
+ const requiredScopes = config.scopes ?? [...SCAPI_SCHEMAS_DEFAULT_SCOPES, buildTenantScope(config.tenantId)];
83
+ // If OAuth strategy, add required scopes; otherwise use as-is
84
+ const scopedAuth = auth instanceof OAuthStrategy ? auth.withAdditionalScopes(requiredScopes) : auth;
85
+ // Core middleware: auth first
86
+ client.use(createAuthMiddleware(scopedAuth));
87
+ // Plugin middleware from registry
88
+ for (const middleware of registry.getMiddleware('scapi-schemas')) {
89
+ client.use(middleware);
90
+ }
91
+ // Logging middleware last (sees complete request with all modifications)
92
+ client.use(createLoggingMiddleware('SCAPI-SCHEMAS'));
93
+ return client;
94
+ }
95
+ //# sourceMappingURL=scapi-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scapi-schemas.js","sourceRoot":"","sources":["../../../src/clients/scapi-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;GAQG;AACH,OAAO,YAAY,EAAE,EAAa,MAAM,eAAe,CAAC;AAExD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAC,oBAAoB,EAAE,uBAAuB,EAAC,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAC,wBAAwB,EAA0B,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAOhF;;GAEG;AACH,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAC,CAAC;AAkCxD,kEAAkE;AAClE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAiCnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAgC,EAAE,IAAkB;IAC3F,MAAM,QAAQ,GAAG,MAAM,CAAC,kBAAkB,IAAI,wBAAwB,CAAC;IAEvE,MAAM,MAAM,GAAG,YAAY,CAAQ;QACjC,OAAO,EAAE,WAAW,MAAM,CAAC,SAAS,uDAAuD;KAC5F,CAAC,CAAC;IAEH,8DAA8D;IAC9D,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,4BAA4B,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE7G,8DAA8D;IAC9D,MAAM,UAAU,GAAG,IAAI,YAAY,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEpG,8BAA8B;IAC9B,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAC;IAE7C,kCAAkC;IAClC,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,CAAC;QACjE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,yEAAyE;IACzE,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * OpenAPI schema collapsing utilities for agentic clients.
3
+ *
4
+ * These utilities implement a three-tier disclosure model for OpenAPI schemas:
5
+ * - **Collapsed** (default): Show structure only - paths as method names, schemas as keys
6
+ * - **Selective expansion**: Full details for specific items only
7
+ * - **Full expansion**: Complete schema without any collapsing
8
+ *
9
+ * This approach addresses context length concerns when working with large OpenAPI
10
+ * schemas in agentic/LLM contexts.
11
+ *
12
+ * @module operations/scapi-schemas/collapse
13
+ */
14
+ /**
15
+ * Options for collapsing an OpenAPI schema.
16
+ */
17
+ export interface SchemaCollapseOptions {
18
+ /**
19
+ * Paths to fully expand (e.g., ["/products", "/orders"]).
20
+ * When provided, only these paths will have full operation details.
21
+ * Other paths will show only their HTTP method names.
22
+ */
23
+ expandPaths?: string[];
24
+ /**
25
+ * Schema names to fully expand (e.g., ["Product", "Order"]).
26
+ * When provided, only these schemas will have full definitions.
27
+ * Other schemas will be shown as empty objects.
28
+ */
29
+ expandSchemas?: string[];
30
+ /**
31
+ * Example names to fully expand (e.g., ["ProductExample"]).
32
+ * When provided, only these examples will have full content.
33
+ * Other examples will be shown as empty objects.
34
+ */
35
+ expandExamples?: string[];
36
+ }
37
+ /**
38
+ * Represents an OpenAPI 3.x schema structure.
39
+ * This is a simplified type that captures the structure we need for collapsing.
40
+ */
41
+ export interface OpenApiSchemaInput {
42
+ openapi?: string;
43
+ info?: Record<string, unknown>;
44
+ servers?: unknown[];
45
+ paths?: Record<string, Record<string, unknown>>;
46
+ components?: {
47
+ schemas?: Record<string, unknown>;
48
+ examples?: Record<string, unknown>;
49
+ parameters?: Record<string, unknown>;
50
+ responses?: Record<string, unknown>;
51
+ requestBodies?: Record<string, unknown>;
52
+ headers?: Record<string, unknown>;
53
+ securitySchemes?: Record<string, unknown>;
54
+ links?: Record<string, unknown>;
55
+ callbacks?: Record<string, unknown>;
56
+ };
57
+ security?: unknown[];
58
+ tags?: unknown[];
59
+ externalDocs?: unknown;
60
+ [key: string]: unknown;
61
+ }
62
+ /**
63
+ * Represents a collapsed path entry.
64
+ * When collapsed, a path only shows the HTTP methods it supports.
65
+ */
66
+ export type CollapsedPath = string[] | Record<string, unknown>;
67
+ /**
68
+ * The output schema structure after collapsing.
69
+ */
70
+ export interface CollapsedOpenApiSchema {
71
+ openapi?: string;
72
+ info?: Record<string, unknown>;
73
+ servers?: unknown[];
74
+ paths?: Record<string, CollapsedPath>;
75
+ components?: {
76
+ schemas?: Record<string, unknown>;
77
+ examples?: Record<string, unknown>;
78
+ parameters?: Record<string, unknown>;
79
+ responses?: Record<string, unknown>;
80
+ requestBodies?: Record<string, unknown>;
81
+ headers?: Record<string, unknown>;
82
+ securitySchemes?: Record<string, unknown>;
83
+ links?: Record<string, unknown>;
84
+ callbacks?: Record<string, unknown>;
85
+ };
86
+ security?: unknown[];
87
+ tags?: unknown[];
88
+ externalDocs?: unknown;
89
+ [key: string]: unknown;
90
+ }
91
+ /**
92
+ * Collapses an OpenAPI schema for context-efficient representation.
93
+ *
94
+ * This function implements a three-tier disclosure model:
95
+ *
96
+ * 1. **No options provided (default):**
97
+ * - Paths: `{"/products": ["get", "post"]}` (method names only)
98
+ * - Schemas: `{"Product": {}}` (keys only)
99
+ * - Examples: `{"ProductExample": {}}` (keys only)
100
+ *
101
+ * 2. **Selective expansion:**
102
+ * - Only specified paths/schemas/examples are fully expanded
103
+ * - Everything else remains collapsed
104
+ *
105
+ * Non-collapsible sections (info, servers, security, tags, etc.) are preserved as-is.
106
+ *
107
+ * @param schema - The OpenAPI schema to collapse
108
+ * @param options - Options controlling what to expand
109
+ * @returns The collapsed schema
110
+ *
111
+ * @example
112
+ * // Collapse everything (default behavior)
113
+ * const collapsed = collapseOpenApiSchema(fullSchema);
114
+ *
115
+ * @example
116
+ * // Expand only /products path and Product schema
117
+ * const collapsed = collapseOpenApiSchema(fullSchema, {
118
+ * expandPaths: ['/products'],
119
+ * expandSchemas: ['Product']
120
+ * });
121
+ */
122
+ export declare function collapseOpenApiSchema(schema: OpenApiSchemaInput, options?: SchemaCollapseOptions): CollapsedOpenApiSchema;
123
+ /**
124
+ * Checks if a schema has been collapsed (i.e., is in outline form).
125
+ *
126
+ * @param schema - The schema to check
127
+ * @returns true if paths are collapsed (arrays) or schemas are empty objects
128
+ */
129
+ export declare function isCollapsedSchema(schema: CollapsedOpenApiSchema): boolean;
130
+ /**
131
+ * Gets the list of available path keys from a schema.
132
+ *
133
+ * @param schema - The OpenAPI schema
134
+ * @returns Array of path keys (e.g., ["/products", "/orders"])
135
+ */
136
+ export declare function getPathKeys(schema: OpenApiSchemaInput | CollapsedOpenApiSchema): string[];
137
+ /**
138
+ * Gets the list of available schema names from a schema.
139
+ *
140
+ * @param schema - The OpenAPI schema
141
+ * @returns Array of schema names (e.g., ["Product", "Order"])
142
+ */
143
+ export declare function getSchemaNames(schema: OpenApiSchemaInput | CollapsedOpenApiSchema): string[];
144
+ /**
145
+ * Gets the list of available example names from a schema.
146
+ *
147
+ * @param schema - The OpenAPI schema
148
+ * @returns Array of example names
149
+ */
150
+ export declare function getExampleNames(schema: OpenApiSchemaInput | CollapsedOpenApiSchema): string[];