@astryxdesign/cli 0.6.4-canary.ed2e54e → 0.6.4
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/README.md +66 -64
- package/api/component/_adapter.d.mts +0 -25
- package/api/component/_adapter.mjs +5 -59
- package/api/component/component.d.mts +3 -6
- package/api/component/component.doc.mjs +10 -23
- package/api/component/component.mjs +9 -249
- package/api/component/component.type.d.mts +0 -25
- package/api/component/component.type.mjs +0 -44
- package/api/discover/_adapter.d.mts +6 -114
- package/api/discover/_adapter.mjs +17 -372
- package/api/discover/detail/detail.d.mts +6 -18
- package/api/discover/detail/detail.mjs +13 -67
- package/api/discover/detail/detail.test.mjs +0 -85
- package/api/discover/discover.d.mts +9 -3
- package/api/discover/discover.doc.mjs +18 -61
- package/api/discover/discover.mjs +36 -220
- package/api/discover/discover.test.mjs +2 -11
- package/api/discover/discover.type.d.mts +8 -147
- package/api/discover/discover.type.mjs +12 -102
- package/api/discover/list/list.d.mts +6 -20
- package/api/discover/list/list.mjs +12 -45
- package/api/discover/list/list.test.mjs +0 -46
- package/api/discover/search/search.d.mts +16 -18
- package/api/discover/search/search.mjs +56 -102
- package/api/discover/search/search.test.mjs +10 -144
- package/api/docs/docs.test.mjs +0 -2
- package/api/doctor/doctor.d.mts +3 -8
- package/api/doctor/doctor.mjs +9 -90
- package/api/doctor/doctor.test.mjs +10 -122
- package/api/index.d.mts +2 -1
- package/api/index.mjs +4 -4
- package/api/integration/add-helpers.d.mts +2 -5
- package/api/integration/add-helpers.mjs +9 -36
- package/api/integration/pack-check.mjs +3 -28
- package/api/json/index.ts +1 -0
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/search/search.test.mjs +0 -18
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.mjs +1 -1
- package/api/theme/add/add.mjs +25 -17
- package/api/theme/add/add.staging.test.mjs +23 -40
- package/api/theme/build/build.family.test.mjs +12 -7
- package/api/theme/build/build.mjs +18 -8
- package/api/upgrade/run/run.mjs +4 -6
- package/api/upgrade/upgrade.type.mjs +2 -2
- package/assets/codemods/__tests__/runner.test.mjs +1 -3
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +4 -5
- package/assets/docs/internationalization.doc.mjs +5 -7
- package/assets/docs/tree/integrations.doc.mjs +1 -20
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/authoring/config/config.doc.mjs +1 -9
- package/authoring/config/parse.d.mts +0 -2
- package/authoring/config/parse.mjs +0 -19
- package/authoring/config/parse.test.mjs +0 -8
- package/authoring/config/type.ts +2 -13
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +0 -10
- package/authoring/index.mjs +0 -1
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component/index.mjs +55 -152
- package/clients/cli/commands/component-ownership.test.mjs +0 -89
- package/clients/cli/commands/component.doc.mjs +6 -23
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/discover.doc.mjs +9 -53
- package/clients/cli/commands/discover.mjs +118 -393
- package/clients/cli/commands/docs.test.mjs +0 -29
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/text-json-parity.test.mjs +17 -0
- package/clients/cli/index.mjs +4 -0
- package/clients/cli/lib/exit-codes.test.mjs +8 -1
- package/clients/cli/lib/json-shim.mjs +14 -24
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +8 -3
- package/clients/cli/lib/manifest.test.mjs +2 -5
- package/foundation/discovery/authoring-self-docs.mjs +0 -1
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +12 -0
- package/foundation/doc-compiler/tree.test.mjs +1 -9
- package/foundation/integrations/integrations.d.mts +1 -14
- package/foundation/integrations/integrations.mjs +1 -41
- package/foundation/integrations/integrations.test.mjs +0 -31
- package/foundation/response/response-types.doc.mjs +21 -15
- package/foundation/response/response-types.doc.test.mjs +0 -23
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
- package/api/discover/_adapter.test.mjs +0 -215
- package/api/discover/_catalog-view.d.mts +0 -115
- package/api/discover/_catalog-view.mjs +0 -203
- package/api/discover/_catalog-view.test.mjs +0 -128
- package/api/discover/detail/item/item.d.mts +0 -26
- package/api/discover/detail/item/item.mjs +0 -78
- package/api/discover/detail/item/item.test.mjs +0 -73
- package/api/integration/pack-check.lifecycle-output.test.mjs +0 -105
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/build/build.rollback.test.mjs +0 -148
- package/api/upgrade/run/files-changed.test.mjs +0 -111
- package/assets/codemods/file-count.test.mjs +0 -163
- package/assets/docs/tree/component-lookups.doc.mjs +0 -149
- package/authoring/discover/discover.doc.d.mts +0 -13
- package/authoring/discover/discover.doc.mjs +0 -138
- package/authoring/discover/parse.d.mts +0 -24
- package/authoring/discover/parse.mjs +0 -128
- package/authoring/discover/parse.test.mjs +0 -124
- package/authoring/discover/type.ts +0 -87
- package/clients/cli/commands/component-batch.test.mjs +0 -341
- package/clients/cli/commands/discover.sources.test.mjs +0 -267
- package/clients/cli/lib/parse-error-format.test.mjs +0 -81
- package/foundation/response/batch.type.d.mts +0 -33
- package/foundation/response/batch.type.mjs +0 -34
|
@@ -6,36 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type DiscoverListResponse = {
|
|
8
8
|
type: "discover.list";
|
|
9
|
-
/**
|
|
10
|
-
* The integrations the project loads.
|
|
11
|
-
*/
|
|
12
9
|
data: DiscoverListEntry[];
|
|
13
10
|
/**
|
|
14
|
-
* Present when the list is empty
|
|
15
|
-
*
|
|
11
|
+
* Present when the list is empty so
|
|
12
|
+
* callers can distinguish "no packages configured" from "configured but
|
|
13
|
+
* nothing discovered".
|
|
16
14
|
*/
|
|
17
|
-
meta?:
|
|
15
|
+
meta?: {
|
|
16
|
+
configured: boolean;
|
|
17
|
+
} | undefined;
|
|
18
18
|
};
|
|
19
|
-
export type DiscoverListMeta = {
|
|
20
|
-
/**
|
|
21
|
-
* Present when `data` is empty, so callers can
|
|
22
|
-
* distinguish "no packages configured" from "configured but nothing
|
|
23
|
-
* discovered".
|
|
24
|
-
*/
|
|
25
|
-
configured?: boolean | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* What the project could add,
|
|
28
|
-
* one entry per integration, never an alias of a package it has.
|
|
29
|
-
*/
|
|
30
|
-
available?: DiscoverAvailableEntry[] | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* What each discover source did.
|
|
33
|
-
*/
|
|
34
|
-
sources?: DiscoverSourceState[] | undefined;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* An installed integration.
|
|
38
|
-
*/
|
|
39
19
|
export type DiscoverListEntry = {
|
|
40
20
|
name: string;
|
|
41
21
|
category: string;
|
|
@@ -43,94 +23,13 @@ export type DiscoverListEntry = {
|
|
|
43
23
|
version?: string | undefined;
|
|
44
24
|
description?: string | undefined;
|
|
45
25
|
displayName?: string | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Template ids, when it adds any.
|
|
48
|
-
*/
|
|
49
|
-
templates?: string[] | undefined;
|
|
50
|
-
/**
|
|
51
|
-
* Doc topic names, when it adds any.
|
|
52
|
-
*/
|
|
53
|
-
docs?: string[] | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Theme slugs, when it adds any.
|
|
56
|
-
*/
|
|
57
|
-
themes?: string[] | undefined;
|
|
58
|
-
/**
|
|
59
|
-
* `<version>/<id>`, when it adds any.
|
|
60
|
-
*/
|
|
61
|
-
codemods?: string[] | undefined;
|
|
62
|
-
/**
|
|
63
|
-
* Agent guidance, when a source lists any.
|
|
64
|
-
*/
|
|
65
|
-
agentDocs?: string[] | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* The latest release a discover source knows.
|
|
68
|
-
*/
|
|
69
|
-
latest?: string | undefined;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* A package the project could add.
|
|
73
|
-
*/
|
|
74
|
-
export type DiscoverAvailableEntry = {
|
|
75
|
-
name: string;
|
|
76
|
-
/**
|
|
77
|
-
* Its latest release.
|
|
78
|
-
*/
|
|
79
|
-
version?: string | undefined;
|
|
80
|
-
components: string[];
|
|
81
|
-
templates?: string[] | undefined;
|
|
82
|
-
docs?: string[] | undefined;
|
|
83
|
-
themes?: string[] | undefined;
|
|
84
|
-
codemods?: string[] | undefined;
|
|
85
|
-
agentDocs?: string[] | undefined;
|
|
86
|
-
description?: string | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* The integration's other package names.
|
|
89
|
-
*/
|
|
90
|
-
aliases?: string[] | undefined;
|
|
91
|
-
/**
|
|
92
|
-
* The discover source that lists it.
|
|
93
|
-
*/
|
|
94
|
-
source: string;
|
|
95
|
-
};
|
|
96
|
-
export type DiscoverSourceState = {
|
|
97
|
-
name: string;
|
|
98
|
-
/**
|
|
99
|
-
* `astryx.config`, or the integration that exports it.
|
|
100
|
-
*/
|
|
101
|
-
from: string;
|
|
102
|
-
/**
|
|
103
|
-
* `saved`: the live call
|
|
104
|
-
* failed and discover used the copy saved at `savedAt`.
|
|
105
|
-
*/
|
|
106
|
-
status: "fresh" | "saved" | "failed";
|
|
107
|
-
generatedAt?: string | undefined;
|
|
108
|
-
complete?: boolean | undefined;
|
|
109
|
-
savedAt?: string | undefined;
|
|
110
|
-
error?: string | undefined;
|
|
111
26
|
};
|
|
112
27
|
/**
|
|
113
28
|
* astryx --json discover
|
|
114
29
|
*/
|
|
115
30
|
export type DiscoverDetailResponse = {
|
|
116
31
|
type: "discover.detail";
|
|
117
|
-
|
|
118
|
-
* `installed` says whether the project has the package;
|
|
119
|
-
* `installedVersion` is set when it has another version than the one shown.
|
|
120
|
-
* `install` is the package-manager command that adds a package the project
|
|
121
|
-
* does not have; discover prints it and never runs it. `installedAs` names
|
|
122
|
-
* the package the project has instead, when this one is an alias of it.
|
|
123
|
-
* `versions` (newest first) comes from a discover source.
|
|
124
|
-
*/
|
|
125
|
-
data: DiscoverListEntry & {
|
|
126
|
-
installed: boolean;
|
|
127
|
-
installedVersion?: string;
|
|
128
|
-
aliases?: string[];
|
|
129
|
-
source?: string;
|
|
130
|
-
installedAs?: string;
|
|
131
|
-
install?: string;
|
|
132
|
-
versions?: import("../../authoring/discover/type").DiscoverVersion[];
|
|
133
|
-
};
|
|
32
|
+
data: DiscoverListEntry;
|
|
134
33
|
};
|
|
135
34
|
/**
|
|
136
35
|
* astryx --json discover
|
|
@@ -140,52 +39,18 @@ export type DiscoverDetailDocResponse = {
|
|
|
140
39
|
data: import("@astryxdesign/cli/authoring").ComponentDoc;
|
|
141
40
|
};
|
|
142
41
|
/**
|
|
143
|
-
* astryx --json discover
|
|
144
|
-
*/
|
|
145
|
-
export type DiscoverItemResponse = {
|
|
146
|
-
type: "discover.item";
|
|
147
|
-
data: {
|
|
148
|
-
package: string;
|
|
149
|
-
version?: string;
|
|
150
|
-
kind: import("../../authoring/discover/type").DiscoverKind;
|
|
151
|
-
name: string;
|
|
152
|
-
title?: string;
|
|
153
|
-
summary?: string;
|
|
154
|
-
keywords?: string[];
|
|
155
|
-
installed: boolean;
|
|
156
|
-
installedAs?: string;
|
|
157
|
-
install?: string;
|
|
158
|
-
source?: string;
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* astryx --json discover <searchterm>
|
|
42
|
+
* astryx --json discover <searchterm> (multiple matches)
|
|
163
43
|
*/
|
|
164
44
|
export type DiscoverSearchResponse = {
|
|
165
45
|
type: "discover.search";
|
|
166
|
-
/**
|
|
167
|
-
* `total` is set when `--limit` cut the list.
|
|
168
|
-
*/
|
|
169
46
|
data: {
|
|
170
47
|
query: string;
|
|
171
48
|
matches: DiscoverSearchEntry[];
|
|
172
|
-
total?: number;
|
|
173
49
|
};
|
|
174
50
|
};
|
|
175
51
|
export type DiscoverSearchEntry = {
|
|
176
52
|
package: string;
|
|
177
|
-
/**
|
|
178
|
-
* The item's name, for every kind; for a package
|
|
179
|
-
* match, the package name.
|
|
180
|
-
*/
|
|
181
53
|
component: string;
|
|
182
|
-
kind: import("../../authoring/discover/type").DiscoverKind | "package";
|
|
183
|
-
/**
|
|
184
|
-
* Whether the project has the package.
|
|
185
|
-
*/
|
|
186
|
-
installed: boolean;
|
|
187
|
-
title?: string | undefined;
|
|
188
|
-
summary?: string | undefined;
|
|
189
54
|
};
|
|
190
55
|
/**
|
|
191
56
|
* Options for `discover()`.
|
|
@@ -194,8 +59,4 @@ export type DiscoverOptions = {
|
|
|
194
59
|
components?: boolean | undefined;
|
|
195
60
|
lang?: string | undefined;
|
|
196
61
|
zh?: boolean | undefined;
|
|
197
|
-
type?: import("@astryxdesign/cli/authoring").DiscoverKind | undefined;
|
|
198
|
-
installed?: boolean | undefined;
|
|
199
|
-
available?: boolean | undefined;
|
|
200
|
-
limit?: number | undefined;
|
|
201
62
|
};
|
|
@@ -7,37 +7,24 @@
|
|
|
7
7
|
* Invocation -> type discriminator
|
|
8
8
|
* ------------------------------------------------------------------
|
|
9
9
|
* astryx --json discover -> discover.list
|
|
10
|
-
* astryx --json discover @scope/name
|
|
10
|
+
* astryx --json discover @scope/name -> discover.detail
|
|
11
11
|
* astryx --json discover @scope/name/Component -> discover.detail.doc
|
|
12
|
-
* astryx --json discover
|
|
13
|
-
* astryx --json discover <searchterm>
|
|
12
|
+
* astryx --json discover <searchterm> (1 match) -> discover.detail.doc
|
|
13
|
+
* astryx --json discover <searchterm> (N matches) -> discover.search
|
|
14
14
|
* (not found) -> CLIError
|
|
15
|
-
*
|
|
16
|
-
* Fields added for discover sources are additive: every earlier field keeps
|
|
17
|
-
* its meaning.
|
|
18
15
|
*/
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* astryx --json discover
|
|
22
19
|
* @typedef {object} DiscoverListResponse
|
|
23
20
|
* @property {'discover.list'} type
|
|
24
|
-
* @property {DiscoverListEntry[]} data
|
|
25
|
-
* @property {
|
|
26
|
-
*
|
|
21
|
+
* @property {DiscoverListEntry[]} data
|
|
22
|
+
* @property {{configured: boolean}} [meta] Present when the list is empty so
|
|
23
|
+
* callers can distinguish "no packages configured" from "configured but
|
|
24
|
+
* nothing discovered".
|
|
27
25
|
*/
|
|
28
26
|
|
|
29
27
|
/**
|
|
30
|
-
* @typedef {object} DiscoverListMeta
|
|
31
|
-
* @property {boolean} [configured] Present when `data` is empty, so callers can
|
|
32
|
-
* distinguish "no packages configured" from "configured but nothing
|
|
33
|
-
* discovered".
|
|
34
|
-
* @property {DiscoverAvailableEntry[]} [available] What the project could add,
|
|
35
|
-
* one entry per integration, never an alias of a package it has.
|
|
36
|
-
* @property {DiscoverSourceState[]} [sources] What each discover source did.
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* An installed integration.
|
|
41
28
|
* @typedef {object} DiscoverListEntry
|
|
42
29
|
* @property {string} name
|
|
43
30
|
* @property {string} category
|
|
@@ -45,60 +32,13 @@
|
|
|
45
32
|
* @property {string} [version]
|
|
46
33
|
* @property {string} [description]
|
|
47
34
|
* @property {string} [displayName]
|
|
48
|
-
* @property {string[]} [templates] Template ids, when it adds any.
|
|
49
|
-
* @property {string[]} [docs] Doc topic names, when it adds any.
|
|
50
|
-
* @property {string[]} [themes] Theme slugs, when it adds any.
|
|
51
|
-
* @property {string[]} [codemods] `<version>/<id>`, when it adds any.
|
|
52
|
-
* @property {string[]} [agentDocs] Agent guidance, when a source lists any.
|
|
53
|
-
* @property {string} [latest] The latest release a discover source knows.
|
|
54
35
|
*/
|
|
55
36
|
|
|
56
37
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @typedef {object} DiscoverAvailableEntry
|
|
59
|
-
* @property {string} name
|
|
60
|
-
* @property {string} [version] Its latest release.
|
|
61
|
-
* @property {string[]} components
|
|
62
|
-
* @property {string[]} [templates]
|
|
63
|
-
* @property {string[]} [docs]
|
|
64
|
-
* @property {string[]} [themes]
|
|
65
|
-
* @property {string[]} [codemods]
|
|
66
|
-
* @property {string[]} [agentDocs]
|
|
67
|
-
* @property {string} [description]
|
|
68
|
-
* @property {string[]} [aliases] The integration's other package names.
|
|
69
|
-
* @property {string} source The discover source that lists it.
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @typedef {object} DiscoverSourceState
|
|
74
|
-
* @property {string} name
|
|
75
|
-
* @property {string} from `astryx.config`, or the integration that exports it.
|
|
76
|
-
* @property {'fresh' | 'saved' | 'failed'} status `saved`: the live call
|
|
77
|
-
* failed and discover used the copy saved at `savedAt`.
|
|
78
|
-
* @property {string} [generatedAt]
|
|
79
|
-
* @property {boolean} [complete]
|
|
80
|
-
* @property {string} [savedAt]
|
|
81
|
-
* @property {string} [error]
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* astryx --json discover @scope/name[@version]
|
|
38
|
+
* astryx --json discover @scope/name
|
|
86
39
|
* @typedef {object} DiscoverDetailResponse
|
|
87
40
|
* @property {'discover.detail'} type
|
|
88
|
-
* @property {DiscoverListEntry
|
|
89
|
-
* installed: boolean,
|
|
90
|
-
* installedVersion?: string,
|
|
91
|
-
* aliases?: string[],
|
|
92
|
-
* source?: string,
|
|
93
|
-
* installedAs?: string,
|
|
94
|
-
* install?: string,
|
|
95
|
-
* versions?: import('../../authoring/discover/type').DiscoverVersion[],
|
|
96
|
-
* }} data `installed` says whether the project has the package;
|
|
97
|
-
* `installedVersion` is set when it has another version than the one shown.
|
|
98
|
-
* `install` is the package-manager command that adds a package the project
|
|
99
|
-
* does not have; discover prints it and never runs it. `installedAs` names
|
|
100
|
-
* the package the project has instead, when this one is an alias of it.
|
|
101
|
-
* `versions` (newest first) comes from a discover source.
|
|
41
|
+
* @property {DiscoverListEntry} data
|
|
102
42
|
*/
|
|
103
43
|
|
|
104
44
|
/**
|
|
@@ -109,42 +49,16 @@
|
|
|
109
49
|
*/
|
|
110
50
|
|
|
111
51
|
/**
|
|
112
|
-
* astryx --json discover
|
|
113
|
-
* installed component.
|
|
114
|
-
* @typedef {object} DiscoverItemResponse
|
|
115
|
-
* @property {'discover.item'} type
|
|
116
|
-
* @property {{
|
|
117
|
-
* package: string,
|
|
118
|
-
* version?: string,
|
|
119
|
-
* kind: import('../../authoring/discover/type').DiscoverKind,
|
|
120
|
-
* name: string,
|
|
121
|
-
* title?: string,
|
|
122
|
-
* summary?: string,
|
|
123
|
-
* keywords?: string[],
|
|
124
|
-
* installed: boolean,
|
|
125
|
-
* installedAs?: string,
|
|
126
|
-
* install?: string,
|
|
127
|
-
* source?: string,
|
|
128
|
-
* }} data
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* astryx --json discover <searchterm>
|
|
52
|
+
* astryx --json discover <searchterm> (multiple matches)
|
|
133
53
|
* @typedef {object} DiscoverSearchResponse
|
|
134
54
|
* @property {'discover.search'} type
|
|
135
|
-
* @property {{query: string, matches: DiscoverSearchEntry[]
|
|
136
|
-
* `total` is set when `--limit` cut the list.
|
|
55
|
+
* @property {{query: string, matches: DiscoverSearchEntry[]}} data
|
|
137
56
|
*/
|
|
138
57
|
|
|
139
58
|
/**
|
|
140
59
|
* @typedef {object} DiscoverSearchEntry
|
|
141
60
|
* @property {string} package
|
|
142
|
-
* @property {string} component
|
|
143
|
-
* match, the package name.
|
|
144
|
-
* @property {import('../../authoring/discover/type').DiscoverKind | 'package'} kind
|
|
145
|
-
* @property {boolean} installed Whether the project has the package.
|
|
146
|
-
* @property {string} [title]
|
|
147
|
-
* @property {string} [summary]
|
|
61
|
+
* @property {string} component
|
|
148
62
|
*/
|
|
149
63
|
|
|
150
64
|
/**
|
|
@@ -153,10 +67,6 @@
|
|
|
153
67
|
* @property {boolean} [components]
|
|
154
68
|
* @property {string} [lang]
|
|
155
69
|
* @property {boolean} [zh]
|
|
156
|
-
* @property {import('../../authoring/discover/type').DiscoverKind} [type]
|
|
157
|
-
* @property {boolean} [installed]
|
|
158
|
-
* @property {boolean} [available]
|
|
159
|
-
* @property {number} [limit]
|
|
160
70
|
*/
|
|
161
71
|
|
|
162
72
|
export {};
|
|
@@ -2,28 +2,14 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Build the discover.list response. `
|
|
6
|
-
*
|
|
7
|
-
* configured" from "configured but nothing discovered".
|
|
8
|
-
* `meta.available` lists what the project could add and `meta.sources` reports
|
|
9
|
-
* what each source did.
|
|
5
|
+
* Build the discover.list response. An empty `packages` set produces the empty
|
|
6
|
+
* envelope carrying `meta.configured`, so callers can distinguish "nothing
|
|
7
|
+
* configured" from "configured but nothing discovered".
|
|
10
8
|
*
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {{
|
|
13
|
-
* configured: boolean,
|
|
14
|
-
* available?: Array<Record<string, unknown>>,
|
|
15
|
-
* sources?: import('../_adapter.mjs').SourceState[],
|
|
16
|
-
* type?: import('../../../authoring/discover/type').DiscoverKind,
|
|
17
|
-
* only?: 'installed' | 'available',
|
|
18
|
-
* }} options
|
|
9
|
+
* @param {import('../_package-scanner.mjs').ScannedPackage[]} packages
|
|
10
|
+
* @param {{configured: boolean}} meta
|
|
19
11
|
* @returns {import('../discover.type.mjs').DiscoverListResponse}
|
|
20
12
|
*/
|
|
21
|
-
export function list(packages:
|
|
22
|
-
latest?: string;
|
|
23
|
-
}>, { configured, available, sources, type, only }: {
|
|
13
|
+
export function list(packages: import("../_package-scanner.mjs").ScannedPackage[], { configured }: {
|
|
24
14
|
configured: boolean;
|
|
25
|
-
available?: Array<Record<string, unknown>>;
|
|
26
|
-
sources?: import("../_adapter.mjs").SourceState[];
|
|
27
|
-
type?: import("../../../authoring/discover/type").DiscoverKind;
|
|
28
|
-
only?: "installed" | "available";
|
|
29
15
|
}): import("../discover.type.mjs").DiscoverListResponse;
|
|
@@ -1,59 +1,26 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file discover.list leaf —
|
|
5
|
-
* discover sources, the ones it could add.
|
|
4
|
+
* @file discover.list leaf — list the discovered external packages.
|
|
6
5
|
*
|
|
7
|
-
* @position api/discover/list — pure projection of the packages
|
|
8
|
-
*
|
|
6
|
+
* @position api/discover/list — pure projection of the packages resolved by
|
|
7
|
+
* ../_adapter into the discover.list envelope.
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
10
|
import {toEntry} from '../_adapter.mjs';
|
|
12
|
-
import {hasKind} from '../_catalog-view.mjs';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
|
-
* Build the discover.list response. `
|
|
16
|
-
*
|
|
17
|
-
* configured" from "configured but nothing discovered".
|
|
18
|
-
* `meta.available` lists what the project could add and `meta.sources` reports
|
|
19
|
-
* what each source did.
|
|
13
|
+
* Build the discover.list response. An empty `packages` set produces the empty
|
|
14
|
+
* envelope carrying `meta.configured`, so callers can distinguish "nothing
|
|
15
|
+
* configured" from "configured but nothing discovered".
|
|
20
16
|
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {{
|
|
23
|
-
* configured: boolean,
|
|
24
|
-
* available?: Array<Record<string, unknown>>,
|
|
25
|
-
* sources?: import('../_adapter.mjs').SourceState[],
|
|
26
|
-
* type?: import('../../../authoring/discover/type').DiscoverKind,
|
|
27
|
-
* only?: 'installed' | 'available',
|
|
28
|
-
* }} options
|
|
17
|
+
* @param {import('../_package-scanner.mjs').ScannedPackage[]} packages
|
|
18
|
+
* @param {{configured: boolean}} meta
|
|
29
19
|
* @returns {import('../discover.type.mjs').DiscoverListResponse}
|
|
30
20
|
*/
|
|
31
|
-
export function list(packages, {configured
|
|
32
|
-
|
|
33
|
-
type
|
|
34
|
-
const data =
|
|
35
|
-
only === 'available'
|
|
36
|
-
? []
|
|
37
|
-
: packages
|
|
38
|
-
.map(toEntry)
|
|
39
|
-
.filter(entry =>
|
|
40
|
-
keep(/** @type {Record<string, unknown>} */ (entry)),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
/** @type {Record<string, unknown>} */
|
|
44
|
-
const meta = {};
|
|
45
|
-
if (data.length === 0) meta.configured = configured;
|
|
46
|
-
if (sources !== undefined) {
|
|
47
|
-
meta.available = only === 'installed' ? [] : (available ?? []).filter(keep);
|
|
48
|
-
meta.sources = sources;
|
|
21
|
+
export function list(packages, {configured}) {
|
|
22
|
+
if (packages.length === 0) {
|
|
23
|
+
return {type: 'discover.list', data: [], meta: {configured}};
|
|
49
24
|
}
|
|
50
|
-
return
|
|
51
|
-
? {
|
|
52
|
-
type: 'discover.list',
|
|
53
|
-
data,
|
|
54
|
-
meta: /** @type {import('../discover.type.mjs').DiscoverListMeta} */ (
|
|
55
|
-
meta
|
|
56
|
-
),
|
|
57
|
-
}
|
|
58
|
-
: {type: 'discover.list', data};
|
|
25
|
+
return {type: 'discover.list', data: packages.map(toEntry)};
|
|
59
26
|
}
|
|
@@ -57,49 +57,3 @@ describe('discover.list leaf', () => {
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
|
-
|
|
61
|
-
describe('discover.list leaf with discover sources', () => {
|
|
62
|
-
const installed = [
|
|
63
|
-
pkg('@acme/widgets', ['Alpha'], {
|
|
64
|
-
version: '1.2.3',
|
|
65
|
-
latest: '1.3.0',
|
|
66
|
-
templates: ['pages/Home'],
|
|
67
|
-
}),
|
|
68
|
-
];
|
|
69
|
-
const available = [
|
|
70
|
-
{name: '@acme/charts', version: '2.0.0', components: ['Chart'], source: 'Acme'},
|
|
71
|
-
{name: '@acme/themes', version: '1.0.0', components: [], themes: ['ocean'], source: 'Acme'},
|
|
72
|
-
];
|
|
73
|
-
const sources = [{name: 'Acme', from: 'astryx.config', status: 'fresh'}];
|
|
74
|
-
|
|
75
|
-
it('lists what is installed in data and what could be added in meta', () => {
|
|
76
|
-
const res = list(installed, {configured: true, available, sources});
|
|
77
|
-
expect(res.data).toEqual([
|
|
78
|
-
{
|
|
79
|
-
name: '@acme/widgets',
|
|
80
|
-
category: '@acme/widgets',
|
|
81
|
-
components: ['Alpha'],
|
|
82
|
-
version: '1.2.3',
|
|
83
|
-
templates: ['pages/Home'],
|
|
84
|
-
latest: '1.3.0',
|
|
85
|
-
},
|
|
86
|
-
]);
|
|
87
|
-
expect(res.meta).toEqual({available, sources});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('keeps one side with only', () => {
|
|
91
|
-
expect(
|
|
92
|
-
list(installed, {configured: true, available, sources, only: 'installed'})
|
|
93
|
-
.meta?.available,
|
|
94
|
-
).toEqual([]);
|
|
95
|
-
const res = list(installed, {configured: true, available, sources, only: 'available'});
|
|
96
|
-
expect(res.data).toEqual([]);
|
|
97
|
-
expect(res.meta).toEqual({configured: true, available, sources});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('keeps only packages that add a kind with type', () => {
|
|
101
|
-
const res = list(installed, {configured: true, available, sources, type: 'theme'});
|
|
102
|
-
expect(res.data).toEqual([]);
|
|
103
|
-
expect(res.meta?.available?.map(e => e.name)).toEqual(['@acme/themes']);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import('../_package-scanner.mjs').ScannedPackage} ScannedPackage
|
|
6
|
+
*/
|
|
4
7
|
/**
|
|
5
8
|
* Search all packages for `query` (a free-text term that never starts with
|
|
6
|
-
* `@`). Resolves to a
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
+
* `@`). Resolves to a single component's docs when unambiguous, a search
|
|
10
|
+
* response when several match, or throws AstryxError (ERR_NOT_FOUND) — with
|
|
11
|
+
* fuzzy suggestions when any exist.
|
|
9
12
|
*
|
|
10
|
-
* @param {ScannedPackage[]} packages
|
|
13
|
+
* @param {ScannedPackage[]} packages
|
|
11
14
|
* @param {string} query
|
|
12
|
-
* @param {{
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* }} opts
|
|
18
|
-
* @returns {Promise<import('../discover.type.mjs').DiscoverSearchResponse>}
|
|
15
|
+
* @param {{lang?: string | null, zh?: boolean}} opts
|
|
16
|
+
* @returns {Promise<
|
|
17
|
+
* import('../discover.type.mjs').DiscoverDetailDocResponse |
|
|
18
|
+
* import('../discover.type.mjs').DiscoverSearchResponse
|
|
19
|
+
* >}
|
|
19
20
|
*/
|
|
20
|
-
export function search(packages: ScannedPackage[], query: string,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
limit?: number;
|
|
25
|
-
}): Promise<import("../discover.type.mjs").DiscoverSearchResponse>;
|
|
21
|
+
export function search(packages: ScannedPackage[], query: string, { lang, zh }: {
|
|
22
|
+
lang?: string | null;
|
|
23
|
+
zh?: boolean;
|
|
24
|
+
}): Promise<import("../discover.type.mjs").DiscoverDetailDocResponse | import("../discover.type.mjs").DiscoverSearchResponse>;
|
|
26
25
|
export type ScannedPackage = import("../_package-scanner.mjs").ScannedPackage;
|
|
27
|
-
export type SearchItem = import("../_catalog-view.mjs").SearchItem;
|