@nurix/apollo 0.5.3 → 0.5.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/dist/commands/search.js +3 -3
- package/dist/index.js +0 -1
- package/dist/lib/apollo_client.js +3 -10
- package/package.json +1 -1
package/dist/commands/search.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// the Apollo Directory. `apollo search <kw>` searches the apps users built (the
|
|
3
3
|
// headline); `apollo search services <kw>` searches the services registry. Both
|
|
4
4
|
// support --json (raw results for agents), --category/--type, and --limit.
|
|
5
|
-
import {
|
|
5
|
+
import { resolveApolloUrl, searchApps, searchCatalogue, } from "../lib/apollo_client.js";
|
|
6
6
|
// `apollo search <keywords...>` — apps (the headline).
|
|
7
7
|
export async function runSearch(keywords, options, globals) {
|
|
8
8
|
const query = keywords.join(" ").trim();
|
|
@@ -11,8 +11,8 @@ export async function runSearch(keywords, options, globals) {
|
|
|
11
11
|
process.exitCode = 1;
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
const results = await searchApps(
|
|
14
|
+
const baseUrl = resolveApolloUrl(globals);
|
|
15
|
+
const results = await searchApps(baseUrl, query, { category: options.category, limit: options.limit });
|
|
16
16
|
if (options.json) {
|
|
17
17
|
console.log(JSON.stringify(results, null, 2));
|
|
18
18
|
return;
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,6 @@ program
|
|
|
24
24
|
.description("Bootstrap NuStack services into your repo via the Apollo discovery plane.")
|
|
25
25
|
.version(version)
|
|
26
26
|
.option("--apollo-url <url>", "Apollo base URL (defaults to $APOLLO_URL, then the hosted instance)")
|
|
27
|
-
.option("--admin-url <url>", "Apollo base URL for app search (defaults to $APOLLO_ADMIN_URL, then the hosted Apollo instance)")
|
|
28
27
|
// Bare `apollo`: bootstrap — check sign-in, login if needed, then init.
|
|
29
28
|
.action(async () => runBootstrap(program.opts()));
|
|
30
29
|
program.addHelpText("after", "\nRun `apollo` with no command to bootstrap: it checks your sign-in, runs login if needed, then init.");
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
// packages/cli/src/lib/apollo_client.ts - HTTP client for the Apollo discovery
|
|
2
2
|
// plane: catalogue fetch + credential exchange + key validation.
|
|
3
3
|
const DEFAULT_APOLLO_URL = "https://apollo.nurix-ai.co";
|
|
4
|
-
// App search now lives on the merged Apollo worker (same origin as everything
|
|
5
|
-
// else); there is no separate admin host.
|
|
6
|
-
const DEFAULT_ADMIN_URL = "https://apollo.nurix-ai.co";
|
|
7
4
|
const REQUEST_TIMEOUT_MS = 10_000;
|
|
8
5
|
// Resolve the Apollo base URL: --apollo-url flag > APOLLO_URL env > hosted default.
|
|
9
6
|
export function resolveApolloUrl(options) {
|
|
10
7
|
return (options.apolloUrl ?? process.env.APOLLO_URL ?? DEFAULT_APOLLO_URL).replace(/\/+$/, "");
|
|
11
8
|
}
|
|
12
|
-
// Resolve the admin base URL (app search): --admin-url > APOLLO_ADMIN_URL > hosted admin.
|
|
13
|
-
export function resolveAdminUrl(options) {
|
|
14
|
-
return (options.adminUrl ?? process.env.APOLLO_ADMIN_URL ?? DEFAULT_ADMIN_URL).replace(/\/+$/, "");
|
|
15
|
-
}
|
|
16
9
|
// Fetch the public discovery catalogue.
|
|
17
10
|
export async function fetchCatalogue(baseUrl) {
|
|
18
11
|
const response = await fetch(`${baseUrl}/api/catalog.json`, {
|
|
@@ -66,9 +59,9 @@ export async function fetchBrokeredCredential(baseUrl, appKey, service) {
|
|
|
66
59
|
return { url: payload.url ?? null, key: payload.key, meta: payload.meta ?? null };
|
|
67
60
|
}
|
|
68
61
|
// Search published marketplace apps by keyword — the Apollo Directory headline.
|
|
69
|
-
// Extends
|
|
70
|
-
export async function searchApps(
|
|
71
|
-
const url = new URL(`${
|
|
62
|
+
// Extends the apollo Worker's public GET /api/v2/apps with ?q= (the `{ data }` envelope).
|
|
63
|
+
export async function searchApps(baseUrl, query, opts = {}) {
|
|
64
|
+
const url = new URL(`${baseUrl}/api/v2/apps`);
|
|
72
65
|
url.searchParams.set("q", query);
|
|
73
66
|
if (opts.category)
|
|
74
67
|
url.searchParams.set("category", opts.category);
|