@fluid-app/fluid-cli-widget 0.1.40 → 0.1.41
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/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as fluidOsV0WidgetPackageGitCredentialCreate, l as WidgetToolingError, n as loadAndValidateWidgetPackage, r as publishWidgetPackage$1, t as buildWidgetPackage$1 } from "./src-
|
|
1
|
+
import { i as fluidOsV0WidgetPackageGitCredentialCreate, l as WidgetToolingError, n as loadAndValidateWidgetPackage, r as publishWidgetPackage$1, t as buildWidgetPackage$1 } from "./src-DmzhQfOq.mjs";
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -574,9 +574,9 @@ function isRecord$3(value) {
|
|
|
574
574
|
}
|
|
575
575
|
//#endregion
|
|
576
576
|
//#region src/utils/template.ts
|
|
577
|
-
const EMBEDDED_PORTAL_SDK_VERSION = "0.1.
|
|
578
|
-
const EMBEDDED_CLI_CORE_VERSION = "0.1.
|
|
579
|
-
const EMBEDDED_CLI_WIDGET_VERSION = "0.1.
|
|
577
|
+
const EMBEDDED_PORTAL_SDK_VERSION = "0.1.485";
|
|
578
|
+
const EMBEDDED_CLI_CORE_VERSION = "0.1.20";
|
|
579
|
+
const EMBEDDED_CLI_WIDGET_VERSION = "0.1.41";
|
|
580
580
|
function getDefaultTemplatePath() {
|
|
581
581
|
return path.join(findPackageRoot(), "templates", "default");
|
|
582
582
|
}
|
|
@@ -2198,17 +2198,26 @@ function unwrapResponseData(response) {
|
|
|
2198
2198
|
/**
|
|
2199
2199
|
* Mint a git credential for a widget package.
|
|
2200
2200
|
*
|
|
2201
|
-
* Backend
|
|
2201
|
+
* Backend endpoints:
|
|
2202
2202
|
* - droplet-owned: POST /api/droplets/:uuid/widget_package/git_credential
|
|
2203
2203
|
* - company-owned: POST /api/company/fluid_os/widget_package/git_credential
|
|
2204
2204
|
* Both respond `{ git_credential: { remote_url, expires_at } }`.
|
|
2205
2205
|
*
|
|
2206
|
+
* The raw droplet-scoped call must pass `security` — the hey-api runtime only
|
|
2207
|
+
* attaches the bearer token when a request declares it (generated SDK
|
|
2208
|
+
* functions do; a bare `client.post` does not, and the request goes out
|
|
2209
|
+
* unauthenticated → 401 "Invalid credentials").
|
|
2210
|
+
*
|
|
2206
2211
|
* Throws the underlying `ApiError` (with `.status`) on failure so callers can
|
|
2207
2212
|
* decide whether to degrade gracefully (see `isGitSyncUnavailable`).
|
|
2208
2213
|
*/
|
|
2209
2214
|
async function mintWidgetGitCredential(options) {
|
|
2210
2215
|
const response = unwrapResponseData(options.droplet ? await options.client.post({
|
|
2211
2216
|
responseStyle: "data",
|
|
2217
|
+
security: [{
|
|
2218
|
+
scheme: "bearer",
|
|
2219
|
+
type: "http"
|
|
2220
|
+
}],
|
|
2212
2221
|
url: `/api/droplets/${encodeURIComponent(options.droplet)}/widget_package/git_credential`
|
|
2213
2222
|
}) : await fluidOsV0WidgetPackageGitCredentialCreate({
|
|
2214
2223
|
client: options.client,
|
|
@@ -2254,9 +2263,10 @@ function getErrorStatus(err) {
|
|
|
2254
2263
|
}
|
|
2255
2264
|
/**
|
|
2256
2265
|
* Should a git-credential failure degrade to "publish artifacts only" rather
|
|
2257
|
-
* than abort? True when
|
|
2258
|
-
*
|
|
2259
|
-
*
|
|
2266
|
+
* than abort? True when there is no repository to sync with yet: the widget
|
|
2267
|
+
* package record does not exist (404), or it exists but its `GitSync` repo has
|
|
2268
|
+
* not been created and connected (409). Other statuses (auth, 5xx) are genuine
|
|
2269
|
+
* errors the caller may still choose to treat as best-effort.
|
|
2260
2270
|
*/
|
|
2261
2271
|
function isGitSyncUnavailable(err) {
|
|
2262
2272
|
const status = getErrorStatus(err);
|
|
@@ -2692,6 +2702,10 @@ async function listDroplets(client) {
|
|
|
2692
2702
|
const firstResponse = await client.get({
|
|
2693
2703
|
query: { page: 1 },
|
|
2694
2704
|
responseStyle: "data",
|
|
2705
|
+
security: [{
|
|
2706
|
+
scheme: "bearer",
|
|
2707
|
+
type: "http"
|
|
2708
|
+
}],
|
|
2695
2709
|
url: "/api/droplets"
|
|
2696
2710
|
});
|
|
2697
2711
|
const totalPages = Math.min(readTotalPages(firstResponse) ?? 1, MAX_DROPLET_PAGES);
|
|
@@ -2699,6 +2713,10 @@ async function listDroplets(client) {
|
|
|
2699
2713
|
for (let page = 2; page <= totalPages; page += 1) responses.push(await client.get({
|
|
2700
2714
|
query: { page },
|
|
2701
2715
|
responseStyle: "data",
|
|
2716
|
+
security: [{
|
|
2717
|
+
scheme: "bearer",
|
|
2718
|
+
type: "http"
|
|
2719
|
+
}],
|
|
2702
2720
|
url: "/api/droplets"
|
|
2703
2721
|
}));
|
|
2704
2722
|
return responses.flatMap(normalizeDropletsResponse);
|
|
@@ -2799,6 +2817,10 @@ const linkCommand = new Command("link").description("Link this widget project to
|
|
|
2799
2817
|
async function fetchDropletWidgetStatus(options) {
|
|
2800
2818
|
return extractArray(await options.client.get({
|
|
2801
2819
|
responseStyle: "data",
|
|
2820
|
+
security: [{
|
|
2821
|
+
scheme: "bearer",
|
|
2822
|
+
type: "http"
|
|
2823
|
+
}],
|
|
2802
2824
|
url: `/api/droplets/${encodeURIComponent(options.droplet)}/widget_package_versions`
|
|
2803
2825
|
})).map(normalizeVersionSummary);
|
|
2804
2826
|
}
|
|
@@ -2806,6 +2828,10 @@ async function fetchDropletWidgetLogs(options) {
|
|
|
2806
2828
|
return extractArray(await options.client.get({
|
|
2807
2829
|
query: options.limit ? { limit: options.limit } : void 0,
|
|
2808
2830
|
responseStyle: "data",
|
|
2831
|
+
security: [{
|
|
2832
|
+
scheme: "bearer",
|
|
2833
|
+
type: "http"
|
|
2834
|
+
}],
|
|
2809
2835
|
url: `/api/droplets/${encodeURIComponent(options.droplet)}/widget_package_versions/logs`
|
|
2810
2836
|
})).map(normalizeLogEntry);
|
|
2811
2837
|
}
|
|
@@ -3066,6 +3092,10 @@ function str(value) {
|
|
|
3066
3092
|
async function fetchCurrentUser(client) {
|
|
3067
3093
|
const raw = await client.get({
|
|
3068
3094
|
responseStyle: "data",
|
|
3095
|
+
security: [{
|
|
3096
|
+
scheme: "bearer",
|
|
3097
|
+
type: "http"
|
|
3098
|
+
}],
|
|
3069
3099
|
url: "/api/me"
|
|
3070
3100
|
});
|
|
3071
3101
|
const composed = [str(raw.first_name), str(raw.last_name)].filter((part) => part !== null).join(" ").trim();
|