@jxsuite/protocol 2.1.0 → 2.2.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/package.json +2 -2
- package/src/types.ts +58 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/protocol",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "The Studio Backend Protocol — wire types and the canonical route table every Jx Studio backend implements",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,6 @@
|
|
|
27
27
|
"test:coverage": "bun test --isolate --coverage"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@jxsuite/schema": "^2.
|
|
30
|
+
"@jxsuite/schema": "^2.1.0"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/types.ts
CHANGED
|
@@ -576,7 +576,11 @@ export interface ImportSiteOptions {
|
|
|
576
576
|
url: string;
|
|
577
577
|
/** Display name for the new project. */
|
|
578
578
|
name: string;
|
|
579
|
-
/**
|
|
579
|
+
/**
|
|
580
|
+
* Where the project goes, interpreted by the platform that receives it: an absolute path on
|
|
581
|
+
* desktop, project-relative on the dev server, `owner/repo` on a host whose projects are
|
|
582
|
+
* repositories. Never a path the caller assumes a filesystem for.
|
|
583
|
+
*/
|
|
580
584
|
directory: string;
|
|
581
585
|
/** Max crawl depth; 0 = single page. */
|
|
582
586
|
depth: number;
|
|
@@ -701,9 +705,61 @@ export interface AiModelsResponse {
|
|
|
701
705
|
|
|
702
706
|
// ─── Cloudflare publish surface ──────────────────────────────────────────────
|
|
703
707
|
|
|
704
|
-
/**
|
|
708
|
+
/**
|
|
709
|
+
* Cloudflare connection state (see StudioPlatform.cfConnection).
|
|
710
|
+
*
|
|
711
|
+
* Three answers, not two, and a reader tells them apart by SHAPE:
|
|
712
|
+
*
|
|
713
|
+
* - `null` — no credential and no row exists at all; nothing was ever connected here.
|
|
714
|
+
* - `{connected: false}` — a credential exists but the provider rejected it. That is the dev server's
|
|
715
|
+
* stored-token-invalid case, and the publish panel's "Replace token" branch keys on it.
|
|
716
|
+
* - `{connected: true, needsReconnect: true}` — a brokered row exists whose OAuth grant has lapsed.
|
|
717
|
+
* Its access token is gone or unrenewable, so every Cloudflare call will fail until the user goes
|
|
718
|
+
* back through the hosted flow.
|
|
719
|
+
*
|
|
720
|
+
* Each platform emits a strict subset: **cloud never emits `{connected: false}`** (a broker row it
|
|
721
|
+
* cannot use is a reconnect, not a bad token) and **the dev server never emits `needsReconnect`**
|
|
722
|
+
* (it holds a pasted token, not a grant, so there is nothing to lapse). Collapsing the lapsed case
|
|
723
|
+
* into a healthy one is precisely the defect that let the connect popup close over a dead row while
|
|
724
|
+
* the user was still typing their Cloudflare password.
|
|
725
|
+
*/
|
|
705
726
|
export interface CfConnection {
|
|
706
727
|
connected: boolean;
|
|
707
728
|
accountId?: string | undefined;
|
|
708
729
|
accountName?: string | undefined;
|
|
730
|
+
/** A broker row exists but its grant has lapsed — reconnect before any Cloudflare call. */
|
|
731
|
+
needsReconnect?: boolean | undefined;
|
|
732
|
+
/** Connected and usable, but no account has been chosen yet (multi-account connect). */
|
|
733
|
+
needsAccount?: boolean | undefined;
|
|
734
|
+
code?: "cf_reconnect_required" | "cf_account_required" | undefined;
|
|
735
|
+
reason?: string | undefined;
|
|
736
|
+
/**
|
|
737
|
+
* Whether the broker holds a refresh token for this row. Diagnostic: without one the connection
|
|
738
|
+
* dies at the access token's expiry and cannot renew itself silently, which is a degraded state
|
|
739
|
+
* worth naming on screen rather than discovering an hour later.
|
|
740
|
+
*/
|
|
741
|
+
hasRefreshToken?: boolean | undefined;
|
|
742
|
+
/** Unix seconds at which the current access token expires (after any silent refresh). */
|
|
743
|
+
expiresAt?: number | undefined;
|
|
709
744
|
}
|
|
745
|
+
|
|
746
|
+
/** One Cloudflare account the connected grant can reach (the account picker's row). */
|
|
747
|
+
export interface CfAccountSummary {
|
|
748
|
+
id: string;
|
|
749
|
+
name: string;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* How an interactive `cfConnect` ended.
|
|
754
|
+
*
|
|
755
|
+
* A connect flow has four endings and only one of them is a failure, so they are a union rather
|
|
756
|
+
* than a nullable connection: `redirect` means the page is already navigating away and the caller
|
|
757
|
+
* must render nothing, `timeout` means the deadline passed with no confirmation, and `canceled`
|
|
758
|
+
* means the user closed the popup. Returning `null` for all three made "the user changed their
|
|
759
|
+
* mind" indistinguishable from "this browser blocked the popup", and the UI apologised for both.
|
|
760
|
+
*/
|
|
761
|
+
export type CfConnectOutcome =
|
|
762
|
+
| { status: "connected"; connection: CfConnection }
|
|
763
|
+
| { status: "redirect" }
|
|
764
|
+
| { status: "timeout" }
|
|
765
|
+
| { status: "canceled" };
|