@salesforce/b2c-tooling-sdk 1.17.0 → 1.18.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/data/content-schemas/componenttype.json +79 -17
- package/data/content-schemas/pagetype.json +4 -0
- package/data/guides/enrichment.json +11264 -0
- package/data/guides/index.json +15166 -0
- package/data/job-steps/index.json +71 -1
- package/data/job-steps/job-steps.json +1 -1
- package/data/script-api/index.json +2145 -37
- package/data/tooling/index.json +222 -0
- package/data/xsd/index.json +1 -1
- package/dist/esm/auth/client-credentials.d.ts +27 -0
- package/dist/esm/auth/client-credentials.js +60 -0
- package/dist/esm/auth/client-credentials.js.map +1 -0
- package/dist/esm/auth/index.d.ts +1 -0
- package/dist/esm/auth/index.js +2 -0
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/auth/oauth.js +2 -1
- package/dist/esm/auth/oauth.js.map +1 -1
- package/dist/esm/cli/base-command.d.ts +40 -0
- package/dist/esm/cli/base-command.js +66 -5
- package/dist/esm/cli/base-command.js.map +1 -1
- package/dist/esm/cli/index.d.ts +2 -2
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/instance-command.d.ts +1 -1
- package/dist/esm/cli/instance-command.js +5 -3
- package/dist/esm/cli/instance-command.js.map +1 -1
- package/dist/esm/cli/oauth-command.d.ts +1 -1
- package/dist/esm/cli/oauth-command.js +5 -3
- package/dist/esm/cli/oauth-command.js.map +1 -1
- package/dist/esm/cli/ods-command.d.ts +1 -1
- package/dist/esm/cli/webdav-command.d.ts +1 -1
- package/dist/esm/config/sources/env-source.js +1 -0
- package/dist/esm/config/sources/env-source.js.map +1 -1
- package/dist/esm/discovery/detector.d.ts +0 -5
- package/dist/esm/discovery/detector.js +24 -3
- package/dist/esm/discovery/detector.js.map +1 -1
- package/dist/esm/discovery/index.d.ts +1 -0
- package/dist/esm/discovery/index.js +1 -0
- package/dist/esm/discovery/index.js.map +1 -1
- package/dist/esm/discovery/patterns/index.d.ts +4 -2
- package/dist/esm/discovery/patterns/index.js +9 -3
- package/dist/esm/discovery/patterns/index.js.map +1 -1
- package/dist/esm/discovery/patterns/pwa-kit.d.ts +12 -0
- package/dist/esm/discovery/patterns/pwa-kit.js +18 -7
- package/dist/esm/discovery/patterns/pwa-kit.js.map +1 -1
- package/dist/esm/discovery/patterns/sfra.d.ts +5 -4
- package/dist/esm/discovery/patterns/sfra.js +1 -1
- package/dist/esm/discovery/patterns/sfra.js.map +1 -1
- package/dist/esm/discovery/patterns/storefront-next.js +18 -2
- package/dist/esm/discovery/patterns/storefront-next.js.map +1 -1
- package/dist/esm/discovery/types.d.ts +13 -4
- package/dist/esm/discovery/types.js +11 -1
- package/dist/esm/discovery/types.js.map +1 -1
- package/dist/esm/docs/index.d.ts +3 -3
- package/dist/esm/docs/index.js +1 -1
- package/dist/esm/docs/index.js.map +1 -1
- package/dist/esm/docs/search.d.ts +111 -38
- package/dist/esm/docs/search.js +402 -81
- package/dist/esm/docs/search.js.map +1 -1
- package/dist/esm/docs/types.d.ts +56 -6
- package/dist/esm/docs/types.js +2 -0
- package/dist/esm/docs/types.js.map +1 -1
- package/dist/esm/slas/token.d.ts +9 -2
- package/dist/esm/slas/token.js +25 -29
- package/dist/esm/slas/token.js.map +1 -1
- package/dist/esm/telemetry/telemetry.d.ts +1 -0
- package/dist/esm/telemetry/telemetry.js +32 -0
- package/dist/esm/telemetry/telemetry.js.map +1 -1
- package/dist/esm/telemetry/types.d.ts +6 -0
- package/package.json +7 -2
|
@@ -10,13 +10,29 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import path from 'node:path';
|
|
12
12
|
import { readPackageJson, globDirs } from '../utils.js';
|
|
13
|
+
import { packageIndicatesPwaKit } from './pwa-kit.js';
|
|
14
|
+
/**
|
|
15
|
+
* The Storefront Next dev toolchain dependency — the definitive dependency
|
|
16
|
+
* signal that a project is Storefront Next.
|
|
17
|
+
*
|
|
18
|
+
* We deliberately do NOT match the broader `@salesforce/storefront-next*` prefix:
|
|
19
|
+
* `@salesforce/storefront-next-runtime` is now also pulled in by PWA Kit projects
|
|
20
|
+
* for unrelated reasons, and matching the prefix produced false positives there.
|
|
21
|
+
*/
|
|
22
|
+
const STOREFRONT_NEXT_DEV_DEP = '@salesforce/storefront-next-dev';
|
|
13
23
|
/**
|
|
14
24
|
* Returns true if this package.json (deps or name) indicates a Storefront Next project.
|
|
15
|
-
*
|
|
25
|
+
*
|
|
26
|
+
* A PWA Kit signal disqualifies the package outright: PWA Kit apps may depend on
|
|
27
|
+
* `@salesforce/storefront-next-runtime`, and a package that is clearly PWA Kit is
|
|
28
|
+
* not Storefront Next.
|
|
16
29
|
*/
|
|
17
30
|
function packageIndicatesStorefrontNext(pkg) {
|
|
31
|
+
// PWA Kit and Storefront Next are distinct; a PWA Kit package is never SFNext.
|
|
32
|
+
if (packageIndicatesPwaKit(pkg))
|
|
33
|
+
return false;
|
|
18
34
|
const deps = Object.keys({ ...pkg.dependencies, ...pkg.devDependencies });
|
|
19
|
-
if (deps.
|
|
35
|
+
if (deps.includes(STOREFRONT_NEXT_DEV_DEP)) {
|
|
20
36
|
return true;
|
|
21
37
|
}
|
|
22
38
|
const name = pkg.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storefront-next.js","sourceRoot":"","sources":["../../../../src/discovery/patterns/storefront-next.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"storefront-next.js","sourceRoot":"","sources":["../../../../src/discovery/patterns/storefront-next.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAC,MAAM,cAAc,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAElE;;;;;;GAMG;AACH,SAAS,8BAA8B,CAAC,GAAgB;IACtD,+EAA+E;IAC/E,IAAI,sBAAsB,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAE9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAC,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,eAAe,EAAC,CAAC,CAAC;IACxE,IAAI,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IACtB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,OAAO,KAAK,CAAC;IAC3D,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1F,IAAI,CAAC,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,gBAAgB,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,aAAa,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAE3B,IAAI,8BAA8B,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAEzD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QAE9B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACvE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;gBAAE,SAAS;YAC7D,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,EAAC,GAAG,EAAE,aAAa,EAAC,CAAC,CAAC;YAC3D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;gBAC9C,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;gBAC3C,IAAI,GAAG,IAAI,8BAA8B,CAAC,GAAG,CAAC;oBAAE,OAAO,IAAI,CAAC;YAC9D,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
|
|
@@ -4,14 +4,23 @@
|
|
|
4
4
|
* @module discovery/types
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* A workspace marker: something detected about a B2C Commerce project. A single
|
|
8
|
+
* workspace can carry several — they are not mutually exclusive. In particular
|
|
9
|
+
* `sfra` is a refinement of `cartridges` (a SFRA project also has cartridges),
|
|
10
|
+
* so an SFRA workspace detects as both.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
12
|
+
* - cartridges: any project with cartridges (detected via .project files)
|
|
13
|
+
* - sfra: a Storefront Reference Architecture project (has `app_storefront_base`)
|
|
11
14
|
* - pwa-kit-v3: PWA Kit v3 storefront
|
|
12
15
|
* - storefront-next: Storefront Next (Odyssey)
|
|
13
16
|
*/
|
|
14
|
-
export type ProjectType = 'cartridges' | 'pwa-kit-v3' | 'storefront-next';
|
|
17
|
+
export type ProjectType = 'cartridges' | 'sfra' | 'pwa-kit-v3' | 'storefront-next';
|
|
18
|
+
/**
|
|
19
|
+
* All workspace markers as a runtime list (single source of truth for callers
|
|
20
|
+
* that need to validate user input, e.g. a CLI flag or MCP enum). Kept in sync
|
|
21
|
+
* with {@link ProjectType} by the `satisfies` check below.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PROJECT_TYPES: readonly ["cartridges", "sfra", "pwa-kit-v3", "storefront-next"];
|
|
15
24
|
/**
|
|
16
25
|
* Detection pattern definition.
|
|
17
26
|
*/
|
|
@@ -8,5 +8,15 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module discovery/types
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* All workspace markers as a runtime list (single source of truth for callers
|
|
13
|
+
* that need to validate user input, e.g. a CLI flag or MCP enum). Kept in sync
|
|
14
|
+
* with {@link ProjectType} by the `satisfies` check below.
|
|
15
|
+
*/
|
|
16
|
+
export const PROJECT_TYPES = [
|
|
17
|
+
'cartridges',
|
|
18
|
+
'sfra',
|
|
19
|
+
'pwa-kit-v3',
|
|
20
|
+
'storefront-next',
|
|
21
|
+
];
|
|
12
22
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/discovery/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/discovery/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;GAIG;AAmBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY;IACZ,MAAM;IACN,YAAY;IACZ,iBAAiB;CACwB,CAAC"}
|
package/dist/esm/docs/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* results.forEach(r => console.log(r.entry.id, r.score));
|
|
30
30
|
*
|
|
31
31
|
* // Read a specific doc by fuzzy query
|
|
32
|
-
* const doc = readDocByQuery('dw.catalog.ProductMgr');
|
|
32
|
+
* const doc = await readDocByQuery('dw.catalog.ProductMgr');
|
|
33
33
|
* if (doc) {
|
|
34
34
|
* console.log(doc.content);
|
|
35
35
|
* }
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
*
|
|
38
38
|
* @module docs
|
|
39
39
|
*/
|
|
40
|
-
export type { DocEntry, SearchIndex, SearchResult, SchemaEntry, SchemaIndex, SchemaSearchResult } from './types.js';
|
|
41
|
-
export { searchDocs, readDoc, readDocByQuery, listDocs, loadSearchIndex } from './search.js';
|
|
40
|
+
export type { DocCategory, DocEntry, SearchIndex, SearchResult, SchemaEntry, SchemaIndex, SchemaSearchResult, } from './types.js';
|
|
41
|
+
export { searchDocs, readDoc, readDocByQuery, readEntryContent, listDocs, loadSearchIndex, resetDocsCache, categoriesForWorkspace, resolveEnabledCategories, DOC_CATEGORIES, type SearchDocsOptions, } from './search.js';
|
|
42
42
|
export { listSchemas, readSchema, readSchemaByQuery, searchSchemas } from './schema.js';
|
|
43
43
|
export { downloadDocs } from './download.js';
|
|
44
44
|
export type { DownloadDocsOptions, DownloadDocsResult } from './download.js';
|
package/dist/esm/docs/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
5
|
*/
|
|
6
6
|
// Search operations
|
|
7
|
-
export { searchDocs, readDoc, readDocByQuery, listDocs, loadSearchIndex } from './search.js';
|
|
7
|
+
export { searchDocs, readDoc, readDocByQuery, readEntryContent, listDocs, loadSearchIndex, resetDocsCache, categoriesForWorkspace, resolveEnabledCategories, DOC_CATEGORIES, } from './search.js';
|
|
8
8
|
// Schema operations
|
|
9
9
|
export { listSchemas, readSchema, readSchemaByQuery, searchSchemas } from './schema.js';
|
|
10
10
|
// Download operation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/docs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/docs/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqDH,oBAAoB;AACpB,OAAO,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,GAEf,MAAM,aAAa,CAAC;AAErB,oBAAoB;AACpB,OAAO,EAAC,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAEtF,qBAAqB;AACrB,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC"}
|
|
@@ -1,70 +1,143 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { ProjectType } from '../discovery/types.js';
|
|
2
|
+
import { type DocCategory, type DocEntry, type SearchIndex, type SearchResult } from './types.js';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
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
|
-
*
|
|
6
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
22
|
-
*
|
|
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,
|
|
94
|
+
export declare function searchDocs(query: string, limitOrOptions?: number | SearchDocsOptions): SearchResult[];
|
|
26
95
|
/**
|
|
27
|
-
*
|
|
96
|
+
* Lists documentation entries, optionally filtered by category.
|
|
28
97
|
*
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
*
|
|
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
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
143
|
+
export declare function resetDocsCache(): void;
|