@salesforce/b2c-tooling-sdk 1.17.0 → 1.19.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 (94) hide show
  1. package/data/content-schemas/componenttype.json +79 -17
  2. package/data/content-schemas/pagetype.json +4 -0
  3. package/data/guides/enrichment.json +11264 -0
  4. package/data/guides/index.json +15166 -0
  5. package/data/job-steps/index.json +71 -1
  6. package/data/job-steps/job-steps.json +1 -1
  7. package/data/script-api/index.json +2145 -37
  8. package/data/tooling/index.json +222 -0
  9. package/data/xsd/index.json +1 -1
  10. package/dist/esm/auth/client-credentials.d.ts +27 -0
  11. package/dist/esm/auth/client-credentials.js +60 -0
  12. package/dist/esm/auth/client-credentials.js.map +1 -0
  13. package/dist/esm/auth/index.d.ts +1 -0
  14. package/dist/esm/auth/index.js +2 -0
  15. package/dist/esm/auth/index.js.map +1 -1
  16. package/dist/esm/auth/oauth.js +2 -1
  17. package/dist/esm/auth/oauth.js.map +1 -1
  18. package/dist/esm/cli/base-command.d.ts +40 -0
  19. package/dist/esm/cli/base-command.js +66 -5
  20. package/dist/esm/cli/base-command.js.map +1 -1
  21. package/dist/esm/cli/index.d.ts +2 -2
  22. package/dist/esm/cli/index.js +1 -1
  23. package/dist/esm/cli/index.js.map +1 -1
  24. package/dist/esm/cli/instance-command.d.ts +1 -1
  25. package/dist/esm/cli/instance-command.js +5 -3
  26. package/dist/esm/cli/instance-command.js.map +1 -1
  27. package/dist/esm/cli/oauth-command.d.ts +1 -1
  28. package/dist/esm/cli/oauth-command.js +5 -3
  29. package/dist/esm/cli/oauth-command.js.map +1 -1
  30. package/dist/esm/cli/ods-command.d.ts +1 -1
  31. package/dist/esm/cli/webdav-command.d.ts +1 -1
  32. package/dist/esm/clients/index.d.ts +2 -0
  33. package/dist/esm/clients/index.js +1 -0
  34. package/dist/esm/clients/index.js.map +1 -1
  35. package/dist/esm/clients/metrics.d.ts +123 -0
  36. package/dist/esm/clients/metrics.generated.d.ts +1016 -0
  37. package/dist/esm/clients/metrics.generated.js +6 -0
  38. package/dist/esm/clients/metrics.generated.js.map +1 -0
  39. package/dist/esm/clients/metrics.js +65 -0
  40. package/dist/esm/clients/metrics.js.map +1 -0
  41. package/dist/esm/clients/middleware-registry.d.ts +1 -1
  42. package/dist/esm/clients/middleware-registry.js.map +1 -1
  43. package/dist/esm/config/sources/env-source.js +1 -0
  44. package/dist/esm/config/sources/env-source.js.map +1 -1
  45. package/dist/esm/discovery/detector.d.ts +0 -5
  46. package/dist/esm/discovery/detector.js +24 -3
  47. package/dist/esm/discovery/detector.js.map +1 -1
  48. package/dist/esm/discovery/index.d.ts +1 -0
  49. package/dist/esm/discovery/index.js +1 -0
  50. package/dist/esm/discovery/index.js.map +1 -1
  51. package/dist/esm/discovery/patterns/index.d.ts +4 -2
  52. package/dist/esm/discovery/patterns/index.js +9 -3
  53. package/dist/esm/discovery/patterns/index.js.map +1 -1
  54. package/dist/esm/discovery/patterns/pwa-kit.d.ts +12 -0
  55. package/dist/esm/discovery/patterns/pwa-kit.js +18 -7
  56. package/dist/esm/discovery/patterns/pwa-kit.js.map +1 -1
  57. package/dist/esm/discovery/patterns/sfra.d.ts +5 -4
  58. package/dist/esm/discovery/patterns/sfra.js +1 -1
  59. package/dist/esm/discovery/patterns/sfra.js.map +1 -1
  60. package/dist/esm/discovery/patterns/storefront-next.js +18 -2
  61. package/dist/esm/discovery/patterns/storefront-next.js.map +1 -1
  62. package/dist/esm/discovery/types.d.ts +13 -4
  63. package/dist/esm/discovery/types.js +11 -1
  64. package/dist/esm/discovery/types.js.map +1 -1
  65. package/dist/esm/docs/index.d.ts +3 -3
  66. package/dist/esm/docs/index.js +1 -1
  67. package/dist/esm/docs/index.js.map +1 -1
  68. package/dist/esm/docs/search.d.ts +111 -38
  69. package/dist/esm/docs/search.js +402 -81
  70. package/dist/esm/docs/search.js.map +1 -1
  71. package/dist/esm/docs/types.d.ts +56 -6
  72. package/dist/esm/docs/types.js +2 -0
  73. package/dist/esm/docs/types.js.map +1 -1
  74. package/dist/esm/index.d.ts +4 -2
  75. package/dist/esm/index.js +3 -1
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/esm/operations/logs/filter.d.ts +6 -1
  78. package/dist/esm/operations/logs/filter.js +7 -2
  79. package/dist/esm/operations/logs/filter.js.map +1 -1
  80. package/dist/esm/operations/metrics/index.d.ts +371 -0
  81. package/dist/esm/operations/metrics/index.js +478 -0
  82. package/dist/esm/operations/metrics/index.js.map +1 -0
  83. package/dist/esm/operations/metrics/tags.d.ts +148 -0
  84. package/dist/esm/operations/metrics/tags.js +235 -0
  85. package/dist/esm/operations/metrics/tags.js.map +1 -0
  86. package/dist/esm/slas/token.d.ts +9 -2
  87. package/dist/esm/slas/token.js +25 -29
  88. package/dist/esm/slas/token.js.map +1 -1
  89. package/dist/esm/telemetry/telemetry.d.ts +1 -0
  90. package/dist/esm/telemetry/telemetry.js +32 -0
  91. package/dist/esm/telemetry/telemetry.js.map +1 -1
  92. package/dist/esm/telemetry/types.d.ts +6 -0
  93. package/package.json +12 -3
  94. package/specs/metrics-v1.json +1713 -0
@@ -1,70 +1,143 @@
1
- import { type DocEntry, type SearchIndex, type SearchResult } from './types.js';
1
+ import type { ProjectType } from '../discovery/types.js';
2
+ import { type DocCategory, type DocEntry, type SearchIndex, type SearchResult } from './types.js';
2
3
  /**
3
- * Loads the pre-built search index from the bundled data directories.
4
+ * The canonical list of documentation categories, in a stable display order.
5
+ * Exported so the CLI and MCP surfaces validate against a single source of truth
6
+ * instead of maintaining their own copies. Derived from {@link CATEGORY_TAXONOMY}.
7
+ */
8
+ export declare const DOC_CATEGORIES: readonly DocCategory[];
9
+ /**
10
+ * Parses and validates a user-supplied set of documentation categories into a
11
+ * "topics" allowlist that bounds the entire available corpus (see
12
+ * {@link SearchDocsOptions.enabledCategories}). Accepts a comma-separated string
13
+ * or an array; names are trimmed and lower-cased.
4
14
  *
5
- * Combines the Script API documentation corpus with the standard job-step
6
- * reference so both are searchable through the same functions.
15
+ * Unknown names are dropped (and reported via `onInvalid`, if provided). Returns
16
+ * `undefined` when the input is empty or contains no valid categories, which
17
+ * means "no restriction" — matching the tolerant behavior of the MCP `--toolsets`
18
+ * flag, so a typo yields a warning and the full corpus rather than a dead tool.
19
+ *
20
+ * @param input - Comma-separated category names, or an array of names
21
+ * @param onInvalid - Optional callback invoked with any unrecognized names
22
+ * @returns The validated, de-duplicated categories, or `undefined` for no restriction
23
+ */
24
+ export declare function resolveEnabledCategories(input: string | readonly string[] | undefined, onInvalid?: (invalid: string[]) => void): DocCategory[] | undefined;
25
+ /**
26
+ * Computes the set of doc categories relevant to the given workspace marker(s):
27
+ * the always-relevant categories plus the union of each marker's categories
28
+ * (merged, not summed).
29
+ */
30
+ export declare function categoriesForWorkspace(workspace: ProjectType | ProjectType[]): DocCategory[];
31
+ /**
32
+ * Loads the combined search index from every bundled corpus directory.
33
+ *
34
+ * Combines the Script API reference, standard job steps, Developer Center
35
+ * guides, and this project's own docs so all are searchable through the same
36
+ * functions. Corpora that have not been generated are skipped.
7
37
  *
8
38
  * @returns The combined search index with all documentation entries
9
- * @throws Error if the Script API index file cannot be read
10
39
  */
11
40
  export declare function loadSearchIndex(): SearchIndex;
12
41
  /**
13
- * Searches the documentation index with fuzzy matching.
42
+ * Options for {@link searchDocs}.
43
+ */
44
+ export interface SearchDocsOptions {
45
+ /** Maximum number of results to return (default: 20). */
46
+ limit?: number;
47
+ /** Restrict results to one or more corpora/categories (hard filter). */
48
+ category?: DocCategory | DocCategory[];
49
+ /**
50
+ * The current workspace marker(s) (e.g. from workspace detection). When set,
51
+ * the categories relevant to those markers rank higher (always a boost — never
52
+ * hides anything). To hard-scope instead, use {@link SearchDocsOptions.category}
53
+ * or {@link SearchDocsOptions.enabledCategories}.
54
+ */
55
+ workspace?: ProjectType | ProjectType[];
56
+ /**
57
+ * A hard allowlist of categories that bounds the ENTIRE available corpus for
58
+ * this call — a configuration boundary, distinct from the per-query
59
+ * {@link SearchDocsOptions.category} filter and the soft workspace boost.
60
+ *
61
+ * When set, only entries in these categories are ever eligible; any `category`
62
+ * narrows *within* this set (their intersection wins). Intended to be resolved
63
+ * once from a launch-time flag/env var (see {@link resolveEnabledCategories}) so
64
+ * operators can pin the docs surface to exactly the topics they want exposed.
65
+ * `undefined` means no restriction.
66
+ */
67
+ enabledCategories?: readonly DocCategory[];
68
+ }
69
+ /**
70
+ * Searches the combined documentation index.
71
+ *
72
+ * Higher scores are better. Results carry the full {@link DocEntry} (including
73
+ * `category`, `summary`, `keywords`, and `url` when available) so callers can
74
+ * triage matches without a follow-up read.
75
+ *
76
+ * When `workspace` is provided, the categories relevant to those markers (e.g.
77
+ * `sfra` for an SFRA project, `script-api`/`job-step` for any cartridge project,
78
+ * `pwa-kit-managed-runtime`/`commerce-api` for PWA Kit, `sfnext`/`commerce-api`
79
+ * for Storefront Next — plus the always-relevant docs) are boosted. It only ever
80
+ * reorders results; use `category`/`enabledCategories` to hard-scope.
14
81
  *
15
82
  * @param query - The search query string
16
- * @param limit - Maximum number of results to return (default: 20)
17
- * @returns Array of search results sorted by relevance
83
+ * @param limitOrOptions - Result limit (number) or {@link SearchDocsOptions}
84
+ * @returns Array of search results sorted by relevance (best first)
18
85
  *
19
86
  * @example
20
87
  * ```typescript
21
- * const results = searchDocs('ProductMgr');
22
- * results.forEach(r => console.log(r.entry.id, r.score));
88
+ * // Favor the current workspace's docs (nothing hidden)
89
+ * searchDocs('deploy bundle', {workspace: 'pwa-kit-v3'});
90
+ * // Hard-scope to one category instead
91
+ * searchDocs('components', {category: 'sfnext'});
23
92
  * ```
24
93
  */
25
- export declare function searchDocs(query: string, limit?: number): SearchResult[];
94
+ export declare function searchDocs(query: string, limitOrOptions?: number | SearchDocsOptions): SearchResult[];
26
95
  /**
27
- * Reads the content of a documentation file by its ID.
96
+ * Lists documentation entries, optionally filtered by category.
28
97
  *
29
- * @param id - The documentation ID (filename without .md extension)
30
- * @returns The raw markdown content of the document
31
- * @throws Error if the document is not found
98
+ * @param category - Optional corpus/category (or list) to restrict to
99
+ * @param enabledCategories - Optional launch-time allowlist that bounds the
100
+ * entire corpus (see {@link SearchDocsOptions.enabledCategories}). When set,
101
+ * only entries in these categories are eligible; `category` narrows within it.
102
+ * @returns Array of matching documentation entries
103
+ */
104
+ export declare function listDocs(category?: DocCategory | DocCategory[], enabledCategories?: readonly DocCategory[]): DocEntry[];
105
+ /**
106
+ * Reads the full content of a documentation entry by its exact id.
32
107
  *
33
- * @example
34
- * ```typescript
35
- * const content = readDoc('dw.catalog.ProductMgr');
36
- * console.log(content);
37
- * ```
108
+ * Bundled entries are read from disk. Entries whose content is published online
109
+ * (Developer Center guides) are fetched from their canonical URL; on network
110
+ * failure a readable fallback assembled from the indexed metadata is returned.
111
+ *
112
+ * @param id - The documentation id
113
+ * @returns The document content (markdown)
114
+ * @throws Error if the id is unknown
115
+ */
116
+ export declare function readDoc(id: string): Promise<string>;
117
+ /**
118
+ * Reads the content of a resolved {@link DocEntry}, choosing bundled-file vs.
119
+ * online fetch based on whether the entry ships its content on disk.
38
120
  */
39
- export declare function readDoc(id: string): string;
121
+ export declare function readEntryContent(entry: DocEntry): Promise<string>;
40
122
  /**
41
123
  * Reads documentation by fuzzy-matching the query and returning the best match.
42
124
  *
43
125
  * @param query - The search query string
126
+ * @param options - Optional search constraints (e.g. category)
44
127
  * @returns The best matching entry and its content, or null if no match
45
128
  *
46
129
  * @example
47
130
  * ```typescript
48
- * const doc = readDocByQuery('ProductMgr');
49
- * if (doc) {
50
- * console.log(`Found: ${doc.entry.title}`);
51
- * console.log(doc.content);
52
- * }
131
+ * const doc = await readDocByQuery('ProductMgr');
132
+ * if (doc) console.log(doc.content);
53
133
  * ```
54
134
  */
55
- export declare function readDocByQuery(query: string): {
135
+ export declare function readDocByQuery(query: string, options?: SearchDocsOptions): Promise<{
56
136
  entry: DocEntry;
57
137
  content: string;
58
- } | null;
138
+ } | null>;
59
139
  /**
60
- * Lists all available documentation entries.
61
- *
62
- * @returns Array of all documentation entries in the index
63
- *
64
- * @example
65
- * ```typescript
66
- * const docs = listDocs();
67
- * console.log(`${docs.length} documentation files available`);
68
- * ```
140
+ * Resets the in-memory index/search caches. Intended for tests that swap the
141
+ * bundled data on disk between assertions.
69
142
  */
70
- export declare function listDocs(): DocEntry[];
143
+ export declare function resetDocsCache(): void;